aboutsummaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorMichael Brown <mcb30@ipxe.org>2022-09-19 17:47:57 +0100
committerMichael Brown <mcb30@ipxe.org>2022-09-19 17:47:57 +0100
commit3aa6b79c8d9dd0b4126c966aa83114dd0b9b4120 (patch)
tree99cb3ae4867260a4f9746f861551811e757c32be /src/include
parent649176cd608e74ce54d20488a0618b4c6d8be71d (diff)
downloadipxe-3aa6b79c8d9dd0b4126c966aa83114dd0b9b4120.zip
ipxe-3aa6b79c8d9dd0b4126c966aa83114dd0b9b4120.tar.gz
ipxe-3aa6b79c8d9dd0b4126c966aa83114dd0b9b4120.tar.bz2
[pci] Add minimal PCI bridge driver
Add a minimal driver for PCI bridges that can be used to locate the bridge to which a PCI device is attached. Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/include')
-rw-r--r--src/include/ipxe/errfile.h1
-rw-r--r--src/include/ipxe/pci.h15
-rw-r--r--src/include/ipxe/pcibridge.h43
3 files changed, 59 insertions, 0 deletions
diff --git a/src/include/ipxe/errfile.h b/src/include/ipxe/errfile.h
index 2b8adbf..1fca747 100644
--- a/src/include/ipxe/errfile.h
+++ b/src/include/ipxe/errfile.h
@@ -217,6 +217,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#define ERRFILE_rdc ( ERRFILE_DRIVER | 0x00d10000 )
#define ERRFILE_ice ( ERRFILE_DRIVER | 0x00d20000 )
#define ERRFILE_ecam ( ERRFILE_DRIVER | 0x00d30000 )
+#define ERRFILE_pcibridge ( ERRFILE_DRIVER | 0x00d40000 )
#define ERRFILE_aoe ( ERRFILE_NET | 0x00000000 )
#define ERRFILE_arp ( ERRFILE_NET | 0x00010000 )
diff --git a/src/include/ipxe/pci.h b/src/include/ipxe/pci.h
index c91baad..637b20d 100644
--- a/src/include/ipxe/pci.h
+++ b/src/include/ipxe/pci.h
@@ -127,6 +127,10 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
/** Network controller */
#define PCI_CLASS_NETWORK 0x02
+/** Bridge device */
+#define PCI_CLASS_BRIDGE 0x06
+#define PCI_CLASS_BRIDGE_PCI 0x04 /**< PCI-to-PCI bridge */
+
/** Serial bus controller */
#define PCI_CLASS_SERIAL 0x0c
#define PCI_CLASS_SERIAL_USB 0x03 /**< USB controller */
@@ -135,9 +139,20 @@ 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 */
+/** Primary bus number */
+#define PCI_PRIMARY 0x18
+
+/** Secondary bus number */
+#define PCI_SECONDARY 0x19
+
/** Subordinate bus number */
#define PCI_SUBORDINATE 0x1a
+/** Memory base and limit */
+#define PCI_MEM_BASE 0x20
+#define PCI_MEM_LIMIT 0x22
+#define PCI_MEM_MASK 0x000f
+
/** Construct PCI class
*
* @v base Base class (or PCI_ANY_ID)
diff --git a/src/include/ipxe/pcibridge.h b/src/include/ipxe/pcibridge.h
new file mode 100644
index 0000000..c57a810
--- /dev/null
+++ b/src/include/ipxe/pcibridge.h
@@ -0,0 +1,43 @@
+#ifndef _IPXE_PCIBRIDGE_H
+#define _IPXE_PCIBRIDGE_H
+
+/** @file
+ *
+ * PCI-to-PCI bridge
+ *
+ */
+
+FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
+
+#include <stdint.h>
+#include <ipxe/list.h>
+#include <ipxe/pci.h>
+
+/** A PCI-to-PCI bridge */
+struct pci_bridge {
+ /** PCI device */
+ struct pci_device *pci;
+ /** Bridge numbers */
+ union {
+ /** Raw dword */
+ uint32_t buses;
+ struct {
+ /** Primary bus */
+ uint8_t primary;
+ /** Secondary bus */
+ uint8_t secondary;
+ /** Subordinate bus */
+ uint8_t subordinate;
+ } __attribute__ (( packed ));
+ };
+ /** Memory base */
+ uint32_t membase;
+ /** Memory limit */
+ uint32_t memlimit;
+ /** List of bridges */
+ struct list_head list;
+};
+
+extern struct pci_bridge * pcibridge_find ( struct pci_device *pci );
+
+#endif /* _IPXE_PCIBRIDGE_H */