From 5af4918356a224735b7a2d5034d714e1ebedb49e Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Mon, 8 Jan 2007 03:23:38 +0000 Subject: [PATCH] Added support for wildcard device/vendor ID matches --- src/drivers/bus/pci.c | 5 ++++- src/include/gpxe/pci.h | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/drivers/bus/pci.c b/src/drivers/bus/pci.c index 0abc1e9c..e7528e3c 100644 --- a/src/drivers/bus/pci.c +++ b/src/drivers/bus/pci.c @@ -187,7 +187,10 @@ static int pci_probe ( struct pci_device *pci ) { for ( driver = pci_drivers ; driver < pci_drivers_end ; driver++ ) { for ( i = 0 ; i < driver->id_count ; i++ ) { id = &driver->ids[i]; - if ( ( id->vendor != pci->vendor ) || + if ( ( id->vendor != PCI_ANY_ID ) && + ( id->vendor != pci->vendor ) ) + continue; + if ( ( id->device != PCI_ANY_ID ) && ( id->device != pci->device ) ) continue; pci->driver = driver; diff --git a/src/include/gpxe/pci.h b/src/include/gpxe/pci.h index 5fc21009..801bf2cc 100644 --- a/src/include/gpxe/pci.h +++ b/src/include/gpxe/pci.h @@ -239,6 +239,9 @@ struct pci_device_id { uint16_t device; }; +/** Match-anything ID */ +#define PCI_ANY_ID 0xffff + /** A PCI device */ struct pci_device { /** Generic device */