Usenet comp.os.linux.alpha (1997-2013)
 help / color / mirror / Atom feed
From: torvalds@transmeta.com (Linus Torvalds)
Subject: Re: ISA BUS, memory, and mmap
Date: 1998/05/20	[thread overview]
Message-ID: <6jvh2d$rnb$1@palladium.transmeta.com> (raw)
In-Reply-To: 873ee4u1zf.fsf@bj2-64.rh.uchicago.edu


In article <873ee4u1zf.fsf@bj2-64.rh.uchicago.edu>,
Peter A Fein  <p-fein@uchicago.edu> wrote:
>lsr@snerd.ddns.org writes:
>
>> Greetings,
>> 
>> I am writing a C program to access a card installed in a ISA slot in a DEC
>> Alpha 500au workstation.  The card is designed to be accessible via the memory
>> bus and installs at memory address 0xFC0000 which is configurable via
>> jumpers.  The question is:  Is this really the address that it will appear at,
>> or is there some non obvious translation that needs to occur?  Any info would
>> be greatly appreciated.  Thanks.
>
>First, which OS are you using, as this is probably going to make a
>difference in how you access this memory.  I don't know anything about
>OSF, but in linux, user programs can't access real memory locations
>b/c of virtual memory.  You'd need to write a kernel-level driver
>which provided a user interface to the hardware.  I have heard some
>talk of adding user-level direct adressing, but I don't believe it's
>going to be implemented any time soon.

You _can_ do user-level direct addressing under Linux, and this is what
the X server does.  It's not trivial, and it needs some setup, but it
does work.  You'd have to look into X sources to see how they do all the
details, I suspect. 

I assume the same could work on OSF/1 if they got the HAE handling
correct (HAE can be a bitch to get right if you want to be able to do
reliable IO from user space - I know Linux does this correctly, but it
may be that the DEC engineers decided that direct IO from user space
wasn't something they wanted to support). 

If you're writing a kernel driver, the thing is trivial to use under
Linux.  The only thing you need to be aware of are the functions to
access IO memory, and there is actually documentation for this in the
file linux/Documentation/IO-mapping.txt in the 2.1.x kernel tree. 

You'd be using something like this:

	unsigned int base_address = 0xFC0000;
	__u32 word;

	/* Move a 32-bit word in IO memory from offset 0x10 to 0x20 */
	word = readl(base_address + 0x10);
	writel(word, base_address + 0x20);

	/* Clear the low 32 bytes of the PCI memory region */
	memset_io(base_addres, 0, 0x20);

etc. See IO-mapping.txt for more details.

		Linus



  reply	other threads:[~1998-05-20  4:00 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-05-20  4:00 ISA BUS, memory, and mmap lsr
1998-05-20  4:00 ` Peter A Fein
1998-05-20  4:00   ` Linus Torvalds [this message]
1998-05-20  4:00     ` Peter A Fein
1998-05-20  4:00   ` Robert Hyatt
1998-05-21  4:00   ` lsr
1998-05-21  4:00     ` Peter A Fein
1998-05-21  4:00     ` Wayne J. Salamon
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox