10 FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
14 #include <config/ioapi.h>
17 * Calculate static inline PCI I/O API function name
19 * @v _prefix Subsystem prefix
20 * @v _api_func API function
21 * @ret _subsys_func Subsystem API function
23 #define PCIAPI_INLINE( _subsys, _api_func ) \
24 SINGLE_API_INLINE ( PCIAPI_PREFIX_ ## _subsys, _api_func )
27 * Provide a PCI I/O API implementation
29 * @v _prefix Subsystem prefix
30 * @v _api_func API function
31 * @v _func Implementing function
33 #define PROVIDE_PCIAPI( _subsys, _api_func, _func ) \
34 PROVIDE_SINGLE_API ( PCIAPI_PREFIX_ ## _subsys, _api_func, _func )
37 * Provide a static inline PCI I/O API implementation
39 * @v _prefix Subsystem prefix
40 * @v _api_func API function
42 #define PROVIDE_PCIAPI_INLINE( _subsys, _api_func ) \
43 PROVIDE_SINGLE_API_INLINE ( PCIAPI_PREFIX_ ## _subsys, _api_func )
45 /* Include all architecture-independent I/O API headers */
46 #include <ipxe/efi/efi_pci_api.h>
47 #include <ipxe/linux/linux_pci.h>
49 /* Include all architecture-dependent I/O API headers */
50 #include <bits/pci_io.h>
53 * Determine number of PCI buses within system
55 * @ret num_bus Number of buses
57 int pci_num_bus ( void );
60 * Read byte from PCI configuration space
63 * @v where Location within PCI configuration space
65 * @ret rc Return status code
67 int pci_read_config_byte ( struct pci_device *pci, unsigned int where,
71 * Read 16-bit word from PCI configuration space
74 * @v where Location within PCI configuration space
76 * @ret rc Return status code
78 int pci_read_config_word ( struct pci_device *pci, unsigned int where,
82 * Read 32-bit dword from PCI configuration space
85 * @v where Location within PCI configuration space
87 * @ret rc Return status code
89 int pci_read_config_dword ( struct pci_device *pci, unsigned int where,
93 * Write byte to PCI configuration space
96 * @v where Location within PCI configuration space
97 * @v value Value to be written
98 * @ret rc Return status code
100 int pci_write_config_byte ( struct pci_device *pci, unsigned int where,
104 * Write 16-bit word to PCI configuration space
107 * @v where Location within PCI configuration space
108 * @v value Value to be written
109 * @ret rc Return status code
111 int pci_write_config_word ( struct pci_device *pci, unsigned int where,
115 * Write 32-bit dword to PCI configuration space
118 * @v where Location within PCI configuration space
119 * @v value Value to be written
120 * @ret rc Return status code
122 int pci_write_config_dword ( struct pci_device *pci, unsigned int where,
125 #endif /* _IPXE_PCI_IO_H */