From fdc97499bf83ef958db8a50985fdd321835dccf3 Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Wed, 10 Jan 2007 15:27:48 +0000 Subject: Add device description fields to struct device. --- src/include/gpxe/device.h | 48 +++++++++++++++++++++++++++++++++++++++++++++++ src/include/gpxe/pci.h | 7 ++++--- 2 files changed, 52 insertions(+), 3 deletions(-) (limited to 'src/include') diff --git a/src/include/gpxe/device.h b/src/include/gpxe/device.h index 9f670cfd2..139fb78b5 100644 --- a/src/include/gpxe/device.h +++ b/src/include/gpxe/device.h @@ -11,10 +11,58 @@ #include #include +/** A PCI device description */ +struct pci_device_description { + /** Bus type + * + * Must be @c BUS_TYPE_PCI. + */ + unsigned int bus_type; + /** Bus:dev.fn address + * + * As constructed by PCI_BUSDEVFN(). + */ + unsigned int busdevfn; + /** Vendor ID */ + unsigned int vendor; + /** Device ID */ + unsigned int device; +}; + +/** PCI bus type */ +#define BUS_TYPE_PCI 1 + +/** An ISAPnP device description */ +struct isapnp_device_description { + /** Bus type + * + * Must be @c BUS_TYPE_ISAPNP. + */ + unsigned int bus_type; +}; + +/** PCI bus type */ +#define BUS_TYPE_ISAPNP 2 + +/** A hardware device description */ +union device_description { + /** Bus type + * + * This must be a BUS_TYPE_XXX constant. + */ + unsigned int bus_type; + /** PCI device description */ + struct pci_device_description pci; + /** ISAPnP device description */ + struct isapnp_device_description isapnp; +}; + /** A hardware device */ struct device { /** Name */ char name[16]; + /** Device description */ + union device_description desc; /** Devices on the same bus */ struct list_head siblings; /** Devices attached to this device */ diff --git a/src/include/gpxe/pci.h b/src/include/gpxe/pci.h index 8269dfaa3..eaa1560b7 100644 --- a/src/include/gpxe/pci.h +++ b/src/include/gpxe/pci.h @@ -307,9 +307,10 @@ struct pci_driver { /** Declare a PCI driver */ #define __pci_driver __table ( struct pci_driver, pci_drivers, 01 ) -#define PCI_DEVFN( slot, func ) ( ( (slot) << 3 ) | (func) ) -#define PCI_SLOT( devfn ) ( ( (devfn) >> 3 ) & 0x1f ) -#define PCI_FUNC( devfn ) ( (devfn) & 0x07 ) +#define PCI_DEVFN( slot, func ) ( ( (slot) << 3 ) | (func) ) +#define PCI_SLOT( devfn ) ( ( (devfn) >> 3 ) & 0x1f ) +#define PCI_FUNC( devfn ) ( (devfn) & 0x07 ) +#define PCI_BUSDEVFN( bus, devfn ) ( ( (bus) << 8 ) | (devfn) ) #define PCI_BASE_CLASS( class ) ( (class) >> 16 ) -- cgit v1.2.3-55-g7522