diff options
| author | Michael Brown | 2011-02-09 01:32:58 +0100 |
|---|---|---|
| committer | Michael Brown | 2011-02-17 02:25:11 +0100 |
| commit | f9b3fae8d46a6b1862b3f5b02490e5a8c224286f (patch) | |
| tree | 1862f41cd2b7ab031780881ed953acc647d38114 /src/include | |
| parent | [bitops] Add missing __attribute__ (( packed )) (diff) | |
| download | ipxe-f9b3fae8d46a6b1862b3f5b02490e5a8c224286f.tar.gz ipxe-f9b3fae8d46a6b1862b3f5b02490e5a8c224286f.tar.xz ipxe-f9b3fae8d46a6b1862b3f5b02490e5a8c224286f.zip | |
[pci] Use single "busdevfn" field in struct pci_device
Merge the "bus" and "devfn" fields into a single "busdevfn" field, to
match the format used by the majority of external code.
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/include')
| -rw-r--r-- | src/include/ipxe/pci.h | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/src/include/ipxe/pci.h b/src/include/ipxe/pci.h index 90e268985..01df76176 100644 --- a/src/include/ipxe/pci.h +++ b/src/include/ipxe/pci.h @@ -302,10 +302,8 @@ struct pci_device { uint32_t class; /** Interrupt number */ uint8_t irq; - /** Bus number */ - uint8_t bus; - /** Device and function number */ - uint8_t devfn; + /** Bus, device, and function (bus:dev.fn) number */ + uint16_t busdevfn; /** Driver for this device */ struct pci_driver *driver; /** Driver-private data @@ -347,11 +345,11 @@ struct pci_driver { /** Declare a PCI driver */ #define __pci_driver __table_entry ( 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_BUS( busdevfn ) ( (busdevfn) >> 8 ) -#define PCI_BUSDEVFN( bus, devfn ) ( ( (bus) << 8 ) | (devfn) ) +#define PCI_BUS( busdevfn ) ( ( (busdevfn) >> 8 ) & 0xff ) +#define PCI_SLOT( busdevfn ) ( ( (busdevfn) >> 3 ) & 0x1f ) +#define PCI_FUNC( busdevfn ) ( ( (busdevfn) >> 0 ) & 0x07 ) +#define PCI_BUSDEVFN( bus, slot, func ) \ + ( ( (bus) << 8 ) | ( (slot) << 3 ) | ( (func) << 0 ) ) #define PCI_BASE_CLASS( class ) ( (class) >> 16 ) #define PCI_SUB_CLASS( class ) ( ( (class) >> 8 ) & 0xff ) @@ -378,8 +376,9 @@ struct pci_driver { #define PCI_FMT "PCI %02x:%02x.%x" /** PCI device debug message arguments */ -#define PCI_ARGS( pci ) \ - (pci)->bus, PCI_SLOT ( (pci)->devfn ), PCI_FUNC ( (pci)->devfn ) +#define PCI_ARGS( pci ) \ + PCI_BUS ( (pci)->busdevfn ), PCI_SLOT ( (pci)->busdevfn ), \ + PCI_FUNC ( (pci)->busdevfn ) extern void adjust_pci_device ( struct pci_device *pci ); extern unsigned long pci_bar_start ( struct pci_device *pci, |
