[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>
This commit is contained in:
Michael Brown
2015-02-02 14:31:18 +00:00
parent d38bac05e7
commit 072d656a2f
4 changed files with 63 additions and 101 deletions

View File

@@ -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 ) {