Solved PCI Driver vendorID/deviceID defined where?

Farhan Khan

Active Member

Reaction score: 8
Messages: 114

Hi all,

I am reading the FreeBSD Architecture Handbook, PCI Devices. In the sample source provided, I do not see where the VendorID or DeviceID are defined. My test VirtualBox instance seems probe and attach to 0x80EE (Likely because its Oracle Virtualbox) with the alternating device IDs of 0xcafe/0x7113.

I looked at some sample code but failed to see how lines 118-127 were used by the device driver.

Pardon my ignorance, I am relatively new to this amazing system.
 

Phishfry

Son of Beastie

Reaction score: 1,479
Messages: 4,284

Same 2 includes on the atheros driver as well.

#include <dev/pci/pcivar.h>
#include <dev/pci/pcireg.h>
 
OP
OP
Farhan Khan

Farhan Khan

Active Member

Reaction score: 8
Messages: 114

I see how it includes the header files, but I do not see where the vendorID and deviceID are utilized within them.
 

usdmatt

Daemon

Reaction score: 522
Messages: 1,402

In the linked if_ath driver, the vendors are specified in lines 118-127 as you mention.
Just under this, if_ath_pci_devlist.h is included, which contains a table listing all the devices (vendor id & device id) that the driver supports. I don't know why the vendors are in the main .c file, then the table is in the .h file...

The ath_pci_attach function calls ath_pci_probe_device, which runs through the table of supported devices. I'm no kernel hacker so I don't know why this is done in the attach function when the sample code from the handbook does it in probe.
 
OP
OP
Farhan Khan

Farhan Khan

Active Member

Reaction score: 8
Messages: 114

The code makes perfect sense, I was misreading it. The sample code just checking if a winmodem (0x11c1) was present. It was merely displaying what vendor/device IDs it was surveying. Nothing more.
 
Top