summaryrefslogtreecommitdiffstats
path: root/src/include/ipxe/pci.h
diff options
context:
space:
mode:
authorMichael Brown2015-05-08 15:54:12 +0200
committerMichael Brown2015-05-08 15:57:12 +0200
commitb88ab14ba38d0eb2123975ed78c8eb04ba13cf72 (patch)
tree8f11b8d05ccd29484a46263db66a1d493ce5fc10 /src/include/ipxe/pci.h
parent[usb] Include setup packet within I/O buffer for message transfers (diff)
downloadipxe-b88ab14ba38d0eb2123975ed78c8eb04ba13cf72.tar.gz
ipxe-b88ab14ba38d0eb2123975ed78c8eb04ba13cf72.tar.xz
ipxe-b88ab14ba38d0eb2123975ed78c8eb04ba13cf72.zip
[pci] Provide PCI_CLASS() to calculate a scalar PCI class value
Rename PCI_CLASS() (which constructs a struct pci_class_id) to PCI_CLASS_ID(), and provide PCI_CLASS() as a macro which constructs the 24-bit scalar value of a PCI class code. Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/include/ipxe/pci.h')
-rw-r--r--src/include/ipxe/pci.h16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/include/ipxe/pci.h b/src/include/ipxe/pci.h
index 976a37c5..ccc42fee 100644
--- a/src/include/ipxe/pci.h
+++ b/src/include/ipxe/pci.h
@@ -118,6 +118,16 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#define PCI_CLASS_SERIAL_USB_EHCI 0x20 /**< ECHI USB controller */
#define PCI_CLASS_SERIAL_USB_XHCI 0x30 /**< xHCI USB controller */
+/** Construct PCI class
+ *
+ * @v base Base class (or PCI_ANY_ID)
+ * @v sub Subclass (or PCI_ANY_ID)
+ * @v progif Programming interface (or PCI_ANY_ID)
+ */
+#define PCI_CLASS( base, sub, progif ) \
+ ( ( ( (base) & 0xff ) << 16 ) | ( ( (sub) & 0xff ) << 8 ) | \
+ ( ( (progif) & 0xff) << 0 ) )
+
/** A PCI device ID list entry */
struct pci_device_id {
/** Name */
@@ -147,10 +157,8 @@ struct pci_class_id {
* @v sub Subclass (or PCI_ANY_ID)
* @v progif Programming interface (or PCI_ANY_ID)
*/
-#define PCI_CLASS(base,sub,progif) { \
- .class = ( ( ( (base) & 0xff ) << 16 ) | \
- ( ( (sub) & 0xff ) << 8 ) | \
- ( ( (progif) & 0xff) << 0 ) ), \
+#define PCI_CLASS_ID( base, sub, progif ) { \
+ .class = PCI_CLASS ( base, sub, progif ), \
.mask = ( ( ( ( (base) == PCI_ANY_ID ) ? 0x00 : 0xff ) << 16 ) | \
( ( ( (sub) == PCI_ANY_ID ) ? 0x00 : 0xff ) << 8 ) | \
( ( ( (progif) == PCI_ANY_ID ) ? 0x00 : 0xff ) << 0 ) ), \