From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <7fc8ea5b5129cdcd8a2166fa6cf3f548.axp-list@archive.invalid> X-Archive-Original-Message-ID: <9607130004.AA09948@ives.amt.tay1.dec.com> Date: Sat, 13 Jul 1996 11:50:47 +0000 (GMT) From: Gerard Roudier Subject: Re: MMIO for new NCR810 driver? In-Reply-To: On Sat, 13 Jul 1996, Linus Torvalds wrote: > > On Fri, 12 Jul 1996, Gerard Roudier wrote: > > > > I have understand something like that too. I think that this address > > calculation allows to acces the video memory directly, without calling > > some readx() function. > > Don't follow that path too closely. > I always try to follow allowed pathes for kernel code. Harald was speaking about X servers and I (wrongly?) imagine that, in user space, this formula was some kind of reverse ingenieering of kernel architecture dependant implementation for performances considerations. > You MUST NOT access IO memory any other way than read/write[bwl](). > or memcpy_fromio/toio(). EVER. It is what I had understood and I have changed direct memory references to "read[bwl]()" function calls in the driver in january. I am a little aware of portability considerations and constraints but I have to learn about architectures. > There are other considerations than just address calculations. Using the > address calculation stuff for 32- and 64-bit stuff can work on PCI alpha's > (and on the new ev56 alphas you may even be able to use it for 8- and 16-bit > accesses if you have a compiler that generates those instructions), but it's > STILL not correct. > > It's simply not portable. On some architectures the IO space may be in a > totally different address space than the kernel, so that you have to use > special instructions and/or "segment overrides" (in x86 parlance) etc. > > On other architectures you'll only see a _window_ into the IO space, so that > the IO access functions have to set up the window correctly, and the same > processor virtual address can actually be _different_ IO ports depending on > where the window happens to be. Or look at the Jensen, for example: it has > _no_ support for dense memory, and you _cannot_ make the IO memory look like > a memory access. > > In short, don't even try to make IO memory look like real memory: it > isn't real memory, and it will never work reliably and portably if you > try. > > Use "read[bwl]/write[bwl]/memcpy_toio/memcpy_fromio". On the x86, they > translate to the obvious thing anyway so there is no performance impact, > and on other architectures they may do strange things, but those strange > things are _needed_. Thank a lot for your explanations. The questions I asked me were the following: - Do read[bwl]() functions expect addresses relative to the base reported by the PCI BIOS or something else (vremap(ed) for example)? - Is there some advantage (or not) to try to use the BASE1 window (memory mapped for i386 PCI implementation) for NCR chips on alpha hardwares? > Linus > Gerard. -- To unsubscribe: mail -s unsubscribe axp-list-request@redhat.com < /dev/null