aboutsummaryrefslogtreecommitdiff
path: root/src/include/ipxe/pci.h
diff options
context:
space:
mode:
authorMichael Brown <mcb30@ipxe.org>2015-02-02 14:31:18 +0000
committerMichael Brown <mcb30@ipxe.org>2015-02-02 14:31:18 +0000
commit072d656a2fe0b0d89ded610d11257889fc35e0f1 (patch)
tree85fae6d01c78dad2ebaeba914eb606bd77de14a4 /src/include/ipxe/pci.h
parentd38bac05e7d0eb67fc19f3532a6b4fa00804106e (diff)
downloadipxe-072d656a2fe0b0d89ded610d11257889fc35e0f1.zip
ipxe-072d656a2fe0b0d89ded610d11257889fc35e0f1.tar.gz
ipxe-072d656a2fe0b0d89ded610d11257889fc35e0f1.tar.bz2
[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>
Diffstat (limited to 'src/include/ipxe/pci.h')
-rw-r--r--src/include/ipxe/pci.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/include/ipxe/pci.h b/src/include/ipxe/pci.h
index 692771e..0bd976e 100644
--- a/src/include/ipxe/pci.h
+++ b/src/include/ipxe/pci.h
@@ -279,6 +279,29 @@ struct pci_device_id {
/** Match-anything ID */
#define PCI_ANY_ID 0xffff
+/** A PCI class ID */
+struct pci_class_id {
+ /** Class */
+ uint32_t class;
+ /** Class mask */
+ uint32_t mask;
+};
+
+/** Construct PCI class ID
+ *
+ * @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) { \
+ .class = ( ( ( (base) & 0xff ) << 16 ) | \
+ ( ( (sub) & 0xff ) << 8 ) | \
+ ( ( (progif) & 0xff) << 0 ) ), \
+ .mask = ( ( ( ( (base) == PCI_ANY_ID ) ? 0x00 : 0xff ) << 16 ) | \
+ ( ( ( (sub) == PCI_ANY_ID ) ? 0x00 : 0xff ) << 8 ) | \
+ ( ( ( (progif) == PCI_ANY_ID ) ? 0x00 : 0xff ) << 0 ) ), \
+ }
+
/** A PCI device */
struct pci_device {
/** Generic device */
@@ -322,6 +345,8 @@ struct pci_driver {
struct pci_device_id *ids;
/** Number of entries in PCI ID table */
unsigned int id_count;
+ /** PCI class ID */
+ struct pci_class_id class;
/**
* Probe device
*