Messages in this thread | | | From | Patrick Lerda <> | Subject | Specifying properly the PCI driver model on all linux architectur es, (ioremap(), bus_to_virt() ...) | Date | Tue, 2 Nov 1999 10:58:40 +0100 |
| |
4 memory spaces can be defined: - virtual memory: Memory space see from a software point of view - physical memory: Memory sp ace see by the CPU before the MMU translation take place. An aperture in this space is defined for host DRAM memory, PCI memory, and PCI IO (PowerPC CPU need this). (This memory space is defined by the North Birdge manual.) - PCI memory bus: Memory space see by PCI boards. - PCI IO: IO space see by the PCI boards.
On an intel architecture the physical memory and the PCI bus memory use the same address translation. On a PREP PowerPC with a MPC106 North bridge all theses space are differents and overlap each others.
My goal is to specify a model to write properly a PCI drivers and to remove the junk on the actual drivers. ( Ex on matroxfb.c: if __power__pc use bus_to_virt() ..., if __i386__ use ioremap() and so on)...
All the space conversion functions are properly defined: bus_to_virt() virt_to_bus() ...
Some members of struct pci_dev are not defined properly: base_address[6] (1) returns PCI bus memory on my PowerPC. (In my opinion this is not a good idea.) rom_address " "
Some functions are not defined properly: ioremap(void *,size) (2) Seems to take a ptr on the PCI bus memory (use base_address[] as argument)
(1), (2) A lot of drivers use ioremap() or bus_to_virt() to get the virtual memory pointer of the PCI memory space device. Using directly bus_to_virt() is not a good idea on some architecture the MMU page is not defined, and linux crash. Using ioremap() seems to be the good way, but a lot of drivers use the PCI bus memory as an argument to ioremap(). ioremap() seems to be a general function not limited to the allocation of PCI memory...
I think the good way will be to defined base_address[6], rom_address (1) to return the physical memory pointer. And to give to ioremap() the physical memory pointer.
Some functions are defined to access PCI memory: readl ... Theses function seems to be useless... (See linux/Documentation/IO-mapping.txt)
Some drivers use directly the pci functions to get the PCI memory base adddress this work on x86 but this is wrong...
And the last thing, to get all the PCI drivers working on all linux architectures (I use a big-endian PowerPC but ...) is to have all theses drivers Big Endian compliant...
Am I Wrong ?
Patrick LERDA
- 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/
| |