lkml.org 
[lkml]   [1999]   [Nov]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: Specifying properly the PCI driver model on all linux archite ctur es, (ioremap(), bus_to_virt() ...)
From
Date
>>>>> "Bret" == Bret Indrelee <bindrelee@sbs-cp.com> writes:

Bret> Jes Sorensen [mailto:Jes.Sorensen@cern.ch] wrote:
>> Dont' forget that the virtual address you get from ioremap() is
>> not a real pointer in the sense that you are allowed to directly
>> reference the memory it points at.

Bret> What exactly is it that ioremap() returns?

I would call it a virtual bus address.

Bret> Where in the heck did you find that?
>> By following Linux kernel.

Bret> This would be part of the problem I mentioned.

Bret> It also totally destroys Alan Cox's and other peoples statements
Bret> in the past about Linux being faster than something like UDI
Bret> because it doesn't have to go through a routine just to access
Bret> the bus.

Completely wrong, on Linux we are dealing with inline macros, not
going via function pointers etc.

>> The problem here is that some PCI implementations will not provide
>> a direct linear mapping of the PCI shared memory space, like on
>> some Alphas which come with sparse memory.

Bret> I thought they got rid of that sparse addressing junk. It was
Bret> always a kludge to work around lack of a true access of less
Bret> than one word.

Yes the ditched it in more recent machines I think, but that doesn't
change the point that someone may change the way you access PCI space
some time in the future. And you want to make sure that your code
works on all Alphas anyway.

>> I thought it was already documented, but I guess you are
>> right. Documentation/pci.txt still refers to the old and deprecated
>> pcibios_foo() functions and Documentation/IO-mapping.txt doesn't
>> mention sparse memory directly, though it does state that one
>> should use readl/writel.

Bret> Check a more recent copy of the file.

I checked the one from 2.3.22.

Bret> In rereading it, I see that the IO-mapping.txt file does mention
Bret> that you need to use the readl/w/b and writel/w/b
Bret> functions. This statement really needs to be added to section 4
Bret> of the pci.txt file, since most of the documentation is talking
Bret> about things needed for PCI DMA masters.

I am sure Linus will apply it if you submit a patch with this change.

Bret> I'm really getting to dislike Linux because of this kind of
Bret> stuff.

Well nobody prevents you from working on improving this.

Bret> It is no surprise to me that many of the drivers don't do things
Bret> correctly, considering how tough it is to determine what correct
Bret> is.

One of the major problems is that many drivers were written long time
before Linux really started being portable. Yes we have had non x86
ports for years, but a lot of code has legacy roots and another
problem is that people write code with the x86 in mind and do not even
look at the documentation existing.

Jes

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:54    [W:3.715 / U:0.260 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site