Re: PCI Device Driver Development

David A. Deal (ddeal@titan.com)
Thu, 16 Apr 1998 13:26:55 -0700


I am aware of the /proc/pci listing however I'm not sure if it's memory or
I/O mapped. The following is my /proc/pci:

PCI devices found:
Bus 0, device 9, function 0:
Bridge: TrueTime GPS Down Converter (rev 1).
Medium devsel. Fast back-to-back capable. IRQ 9.
Non-prefetchable 32 bit memory at 0xffbeef80. <<<<<<<<<<<<<<<<
Here it is
I/O at 0xf880.
Non-prefetchable 32 bit memory at 0xffbeec00.
Bus 0, device 8, function 0:
SCSI storage controller: Adaptec AIC-7871 (rev 3).
etc..........

Memory mapped I assume that I should be doing readb/writeb. I/O should be
the inb/outb family. The documentation does not reveal which addresses the
regiesters get mapped to. Can you tell from this? Remember, this card has
a LOT of registers to hold the time/location/satellite values. Once I
figure out the address, do I need to do any paging for this many registers?

Thanks for the responses.
Dave

Dave Deal writes:

> ... According to the PCI
> specification I should be able to set the base address registers to
> map the card to some physical address. Is this done by the kernel's PCI
> probing or do I have to set the address when I initialize the card?

Neither; the BIOS should set them for you when it does the initial PCI scan.
After the system comes up try "more /proc/pci"---you should see a listing
of the board's base address registers. For example

Bus 0, device 14, function 0:
Bridge: Unknown vendor Unknown device (rev 2).
Vendor id=10b5. Device id=9080.
Medium devsel. Fast back-to-back capable. IRQ 9. Master Capable.
Latency=32.
Non-prefetchable 32 bit memory at 0xfebffd00.
I/O at 0xdc00.
I/O at 0xd800.

shows a memory BAR 0, I/O BAR 1, and I/O BAR 2. If your device uses
the mapping from say BAR 1 for its registers, then outl(data,0xdc00+offset)
should work. (Of course the driver should read the BAR from the board
rather than hardwiring it, since the location the BIOS uses will change
as boards are added or removed.)

> If you can direct me to any source code or documentation that would
> help me solve this problem I would greatly appreciate it.

Try the PCI network card drivers or SCSI drivers for PCI probing examples;
I can send you some generic driver init code if that helps. There's also
the "Kernel Hacker's Guide" with some discussion of writing drivers.

Cheers,
Peter Monta pmonta@imedia.com
Imedia Corp.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu