lkml.org 
[lkml]   [1999]   [Nov]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRE: Specifying properly the PCI driver model on all linux archite ctur es, (ioremap(), bus_to_virt() ...)
Date
Jes Sorensen [mailto:Jes.Sorensen@cern.ch] wrote:
> >>>>> "Patrick" == Patrick Lerda <LERDA@microprocess.com> writes:
> Patrick> My goal is to specify a model to write properly a PCI drivers
> Patrick> and to remove the junk on the actual drivers. ( Ex on
> Patrick> matroxfb.c: if __power__pc use bus_to_virt() ..., if __i386__
> Patrick> use ioremap() and so on)...
>
> This goal is already achieved, if the PPC uses bus_to_virt() it is
> doing it wrong. The correct way is to use ioremap(), however what
> ioremap() returns what could be referred to as a _bus_ _virtual_
> address.


I think it would help a lot of people started talking about three different
addresses:
1. The Bus physical address, i.e. what is in the PCI configuration
registers.
2. The System physical address, i.e. what ioremap() uses and is found in the
struct pci_dev base_address[] array. It is the physical address used by the
CPU. On systems like SPARC, this address would then go through the IOMMU to
generate the correct bus physical address.
3. The System virtual address, i.e. what the programmer uses to reference
the address space. It goes through the normal kernel virtual address
translation.

> This one is not allowed to be accessed directly by the CPU
> but must use the readl/writel macros, or __raw_readl/__raw_writel
> ones.

Where in the heck did you find that?

I was under the impression that the readb/w/l and writeb/w/l were only for
spaces marked as I/O space in PCI. I thought that if it was in PCI memory
space you could directly reference the address after you used ioremap().

If this is true, you can't just directly access the virtual address, then
somebody should really add this information to the Documentation/pci.txt
file.


[ snip ]
> Remember that the base_address[] value are not some that we just make
> out of nowhere, they are assigned by the hardware/bios at boot time
> and we read them out of registers.

Actually, my understanding is that the base_address[] is assigned in the PCI
configuration. The configuration registers are programmed with the PCI
physical address, and the base_address[] is set to the system physical
address (which may be different.)


If people really want to get the device drivers all working correctly, you
should probably start by agreeing on AND DOCUMENTING exactly what 'correct'
is. Without such information available, people are going to keep on having
problems writing device drivers.

-Bret

-------------------------------------------------------------
SBS Technologies, Connectivity Products
... solutions for real-time connectivity

Bret Indrelee, Engineer
SBS Technologies, Inc., Connectivity Products
1284 Corporate Center Drive, St. Paul MN 55121
Direct: (651) 905-4731
Main: (651) 905-4700 Fax: (651) 905-4701
E-mail: bindrelee@sbs-cp.com http://www.sbs.com
-------------------------------------------------------------

-
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:0.132 / U:0.032 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site