summaryrefslogtreecommitdiffstats
path: root/src/drivers/bus
diff options
context:
space:
mode:
authorMichael Brown2015-02-02 15:31:18 +0100
committerMichael Brown2015-02-02 15:31:18 +0100
commit072d656a2fe0b0d89ded610d11257889fc35e0f1 (patch)
tree85fae6d01c78dad2ebaeba914eb606bd77de14a4 /src/drivers/bus
parent[build] Include Hyper-V driver in the all-drivers build (diff)
downloadipxe-072d656a2fe0b0d89ded610d11257889fc35e0f1.tar.gz
ipxe-072d656a2fe0b0d89ded610d11257889fc35e0f1.tar.xz
ipxe-072d656a2fe0b0d89ded610d11257889fc35e0f1.zip
[pci] Allow drivers to specify a PCI class
Allow drivers to specify a supported PCI class code. To save space in the final binary, make this an attribute of the driver rather than an attribute of a PCI device ID list entry. Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/drivers/bus')
-rw-r--r--src/drivers/bus/pci.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/drivers/bus/pci.c b/src/drivers/bus/pci.c
index 4a8d00b5..f861d452 100644
--- a/src/drivers/bus/pci.c
+++ b/src/drivers/bus/pci.c
@@ -253,6 +253,8 @@ int pci_find_driver ( struct pci_device *pci ) {
unsigned int i;
for_each_table_entry ( driver, PCI_DRIVERS ) {
+ if ( ( driver->class.class ^ pci->class ) & driver->class.mask )
+ continue;
for ( i = 0 ; i < driver->id_count ; i++ ) {
id = &driver->ids[i];
if ( ( id->vendor != PCI_ANY_ID ) &&
@@ -334,14 +336,15 @@ static int pcibus_probe ( struct root_device *rootdev ) {
/* Look for a driver */
if ( ( rc = pci_find_driver ( pci ) ) != 0 ) {
- DBGC ( pci, PCI_FMT " (%04x:%04x) has no driver\n",
- PCI_ARGS ( pci ), pci->vendor, pci->device );
+ DBGC ( pci, PCI_FMT " (%04x:%04x class %06x) has no "
+ "driver\n", PCI_ARGS ( pci ), pci->vendor,
+ pci->device, pci->class );
continue;
}
/* Add to device hierarchy */
pci->dev.parent = &rootdev->dev;
- list_add ( &pci->dev.siblings, &rootdev->dev.children);
+ list_add ( &pci->dev.siblings, &rootdev->dev.children );
/* Look for a driver */
if ( ( rc = pci_probe ( pci ) ) == 0 ) {