mirror of
https://github.com/ipxe/ipxe
synced 2025-12-25 00:17:57 +03:00
[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:
@@ -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 ) {
|
||||
|
||||
Reference in New Issue
Block a user