iPXE
null_pci.h
Go to the documentation of this file.
1 #ifndef _IPXE_NULL_PCI_H
2 #define _IPXE_NULL_PCI_H
3 
4 #include <stdint.h>
5 
6 /** @file
7  *
8  * Null PCI API
9  *
10  */
11 
12 FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
13 
14 #ifdef PCIAPI_NULL
15 #define PCIAPI_PREFIX_null
16 #else
17 #define PCIAPI_PREFIX_null __null_
18 #endif
19 
20 struct pci_device;
21 
22 /**
23  * Check if PCI bus probing is allowed
24  *
25  * @ret ok Bus probing is allowed
26  */
27 static inline __always_inline int
28 PCIAPI_INLINE ( null, pci_can_probe ) ( void ) {
29  return 0;
30 }
31 
32 /**
33  * Find next PCI bus:dev.fn address range in system
34  *
35  * @v busdevfn Starting PCI bus:dev.fn address
36  * @v range PCI bus:dev.fn address range to fill in
37  */
38 static inline __always_inline void
40  struct pci_range *range ) {
41 
42  range->start = 0;
43  range->count = 0;
44 }
45 
46 /**
47  * Read byte from PCI configuration space via PCI BIOS
48  *
49  * @v pci PCI device
50  * @v where Location within PCI configuration space
51  * @v value Value read
52  * @ret rc Return status code
53  */
54 static inline __always_inline int
56  unsigned int where __unused,
58  *value = 0xff;
59  return 0;
60 }
61 
62 /**
63  * Read word from PCI configuration space via PCI BIOS
64  *
65  * @v pci PCI device
66  * @v where Location within PCI configuration space
67  * @v value Value read
68  * @ret rc Return status code
69  */
70 static inline __always_inline int
72  unsigned int where __unused,
73  uint16_t *value ) {
74  *value = 0xffff;
75  return 0;
76 }
77 
78 /**
79  * Read dword from PCI configuration space via PCI BIOS
80  *
81  * @v pci PCI device
82  * @v where Location within PCI configuration space
83  * @v value Value read
84  * @ret rc Return status code
85  */
86 static inline __always_inline int
88  unsigned int where __unused,
89  uint32_t *value ) {
90  *value = 0xffffffff;
91  return 0;
92 }
93 
94 /**
95  * Write byte to PCI configuration space via PCI BIOS
96  *
97  * @v pci PCI device
98  * @v where Location within PCI configuration space
99  * @v value Value to be written
100  * @ret rc Return status code
101  */
102 static inline __always_inline int
104  unsigned int where __unused,
106  return 0;
107 }
108 
109 /**
110  * Write word to PCI configuration space via PCI BIOS
111  *
112  * @v pci PCI device
113  * @v where Location within PCI configuration space
114  * @v value Value to be written
115  * @ret rc Return status code
116  */
117 static inline __always_inline int
119  unsigned int where __unused,
121  return 0;
122 }
123 
124 /**
125  * Write dword to PCI configuration space via PCI BIOS
126  *
127  * @v pci PCI device
128  * @v where Location within PCI configuration space
129  * @v value Value to be written
130  * @ret rc Return status code
131  */
132 static inline __always_inline int
133 PCIAPI_INLINE ( null, pci_write_config_dword ) ( struct pci_device *pci
134  __unused,
135  unsigned int where __unused,
137  return 0;
138 }
139 
140 /**
141  * Map PCI bus address as an I/O address
142  *
143  * @v bus_addr PCI bus address
144  * @v len Length of region
145  * @ret io_addr I/O address, or NULL on error
146  */
147 static inline __always_inline void *
148 PCIAPI_INLINE ( null, pci_ioremap ) ( struct pci_device *pci __unused,
149  unsigned long bus_addr __unused,
150  size_t len __unused ) {
151  return NULL;
152 }
153 
154 #endif /* _IPXE_NULL_PCI_H */
uint32_t start
Starting bus:dev.fn address.
Definition: pci_io.h:23
unsigned short uint16_t
Definition: stdint.h:11
int pci_write_config_word(struct pci_device *pci, unsigned int where, uint16_t value)
Write 16-bit word to PCI configuration space.
int pci_can_probe(void)
Check if PCI bus probing is allowed.
int pci_read_config_word(struct pci_device *pci, unsigned int where, uint16_t *value)
Read 16-bit word from PCI configuration space.
static __always_inline int PCIAPI_INLINE(null, pci_can_probe)(void)
Check if PCI bus probing is allowed.
Definition: null_pci.h:28
static __always_inline void unsigned long bus_addr
Definition: pcibios.h:154
static __always_inline int unsigned int where uint8_t * value
Definition: null_pci.h:57
uint16_t busdevfn
PCI bus:dev.fn address.
Definition: ena.h:28
int pci_read_config_dword(struct pci_device *pci, unsigned int where, uint32_t *value)
Read 32-bit dword from PCI configuration space.
A PCI bus:dev.fn address range.
Definition: pci_io.h:21
int pci_write_config_byte(struct pci_device *pci, unsigned int where, uint8_t value)
Write byte to PCI configuration space.
static __always_inline int unsigned int where __unused
Definition: null_pci.h:56
A PCI device.
Definition: pci.h:206
#define __always_inline
Declare a function to be always inline.
Definition: compiler.h:611
unsigned char uint8_t
Definition: stdint.h:10
unsigned int uint32_t
Definition: stdint.h:12
unsigned int count
Number of bus:dev.fn addresses within this range.
Definition: pci_io.h:25
void pci_discover(uint32_t busdevfn, struct pci_range *range)
Find next PCI bus:dev.fn address range in system.
static __always_inline void struct pci_range * range
Definition: null_pci.h:40
int pci_write_config_dword(struct pci_device *pci, unsigned int where, uint32_t value)
Write 32-bit dword to PCI configuration space.
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
static __always_inline int unsigned int where
Definition: pcibios.h:55
void * pci_ioremap(struct pci_device *pci, unsigned long bus_addr, size_t len)
Map PCI bus address as an I/O address.
uint32_t len
Length.
Definition: ena.h:14
#define NULL
NULL pointer (VOID *)
Definition: Base.h:321
int pci_read_config_byte(struct pci_device *pci, unsigned int where, uint8_t *value)
Read byte from PCI configuration space.