-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Thu, Mar 22, 2007 at 03:56:44PM +0200, Tzahi Fadida wrote: > On Thursday 22 March 2007 15:14, Erik Mouw wrote: > > > Also, i would appreciate to have the actual commands in linux to do the > > > above. > > > > See Documentation/IO-mapping.txt, Documentation/pci.txt, LDD3 and other > > driver sources. > > Well, i am asking this question after reading LDD3 but not understanding how > it worked. On ISA i understand you use ioremap(physical address, size) to get > a buffer that you can play with *pointer or better use the write read methods > that are relevant. ioremap() returns a cookie, not a pointer. Yes, on x86 it happens to be an address, but on other architectures that have an ISA or ISA-like bus it can be something completely different. Always use the read/write methods. > However, i don't understand how this is done in PCI. The > physical address is not enough there since you need to pass on also the bus, > device, function address. You don't need to know about bus, device, and function. All you need to know in your driver is the PCI ID(s) the driver is able to handle. In your driver you first call pci_enable_device() and pci_request_regions() to enable the device and get its resources mapped. After that call pci_iomap() to get a cookie and writel() and friends to write to the device. > Btw, if you do mmap? to that area, is it still not safe to use *pointer = > something? Is there a way to make it right? I don't know how that's supposed to work. Have a look at the framebuffer drivers, that's about the only device I can think of where mmap("/dev/fb0") would make sense. Erik - -- They're all fools. Don't worry. Darwin may be slow, but he'll eventually get them. -- Matthew Lammers in alt.sysadmin.recovery -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQFGAsP6/PlVHJtIto0RAknZAKCB1laBUc4OTkOQ5esg2H1/z7hamgCfRWgU aF1cZtrH4bg3K3xPqibIyzY= =IORO -----END PGP SIGNATURE----- -- To unsubscribe from this list: send an email with "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx Please read the FAQ at http://kernelnewbies.org/FAQ