mirror of
https://github.com/ipxe/ipxe
synced 2025-12-16 17:41:18 +03:00
[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>
This commit is contained in:
@@ -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 )
|
||||
|
||||
@@ -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)
|
||||
|
||||
43
src/include/ipxe/pcibridge.h
Normal file
43
src/include/ipxe/pcibridge.h
Normal file
@@ -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 */
|
||||
Reference in New Issue
Block a user