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 FILE_SECBOOT ( PERMITTED );
14 
15 #ifdef PCIAPI_NULL
16 #define PCIAPI_PREFIX_null
17 #else
18 #define PCIAPI_PREFIX_null __null_
19 #endif
20 
21 struct pci_device;
22 
23 /**
24  * Check if PCI bus probing is allowed
25  *
26  * @v pci PCI device
27  * @ret ok Bus probing is allowed
28  */
29 static inline __always_inline int
30 PCIAPI_INLINE ( null, pci_can_probe ) ( struct pci_device *pci __unused ) {
31  return 0;
32 }
33 
34 /**
35  * Find next PCI bus:dev.fn address range in system
36  *
37  * @v busdevfn Starting PCI bus:dev.fn address
38  * @v range PCI bus:dev.fn address range to fill in
39  */
40 static inline __always_inline void
42  struct pci_range *range ) {
43 
44  range->start = 0;
45  range->count = 0;
46 }
47 
48 /**
49  * Read byte from PCI configuration space via PCI BIOS
50  *
51  * @v pci PCI device
52  * @v where Location within PCI configuration space
53  * @v value Value read
54  * @ret rc Return status code
55  */
56 static inline __always_inline int
58  unsigned int where __unused,
60  *value = 0xff;
61  return 0;
62 }
63 
64 /**
65  * Read word from PCI configuration space via PCI BIOS
66  *
67  * @v pci PCI device
68  * @v where Location within PCI configuration space
69  * @v value Value read
70  * @ret rc Return status code
71  */
72 static inline __always_inline int
74  unsigned int where __unused,
75  uint16_t *value ) {
76  *value = 0xffff;
77  return 0;
78 }
79 
80 /**
81  * Read dword from PCI configuration space via PCI BIOS
82  *
83  * @v pci PCI device
84  * @v where Location within PCI configuration space
85  * @v value Value read
86  * @ret rc Return status code
87  */
88 static inline __always_inline int
90  unsigned int where __unused,
91  uint32_t *value ) {
92  *value = 0xffffffff;
93  return 0;
94 }
95 
96 /**
97  * Write byte to PCI configuration space via PCI BIOS
98  *
99  * @v pci PCI device
100  * @v where Location within PCI configuration space
101  * @v value Value to be written
102  * @ret rc Return status code
103  */
104 static inline __always_inline int
106  unsigned int where __unused,
108  return 0;
109 }
110 
111 /**
112  * Write word to PCI configuration space via PCI BIOS
113  *
114  * @v pci PCI device
115  * @v where Location within PCI configuration space
116  * @v value Value to be written
117  * @ret rc Return status code
118  */
119 static inline __always_inline int
121  unsigned int where __unused,
123  return 0;
124 }
125 
126 /**
127  * Write dword to PCI configuration space via PCI BIOS
128  *
129  * @v pci PCI device
130  * @v where Location within PCI configuration space
131  * @v value Value to be written
132  * @ret rc Return status code
133  */
134 static inline __always_inline int
135 PCIAPI_INLINE ( null, pci_write_config_dword ) ( struct pci_device *pci
136  __unused,
137  unsigned int where __unused,
139  return 0;
140 }
141 
142 /**
143  * Map PCI bus address as an I/O address
144  *
145  * @v bus_addr PCI bus address
146  * @v len Length of region
147  * @ret io_addr I/O address, or NULL on error
148  */
149 static inline __always_inline void *
150 PCIAPI_INLINE ( null, pci_ioremap ) ( struct pci_device *pci __unused,
151  unsigned long bus_addr __unused,
152  size_t len __unused ) {
153  return NULL;
154 }
155 
156 #endif /* _IPXE_NULL_PCI_H */
uint32_t start
Starting bus:dev.fn address.
Definition: pci_io.h:25
unsigned short uint16_t
Definition: stdint.h:11
int pci_can_probe(struct pci_device *pci)
Check if PCI bus probing is allowed.
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_read_config_word(struct pci_device *pci, unsigned int where, uint16_t *value)
Read 16-bit word from PCI configuration space.
static __always_inline void unsigned long bus_addr
Definition: pcibios.h:156
static __always_inline int PCIAPI_INLINE(null, pci_can_probe)(struct pci_device *pci __unused)
Check if PCI bus probing is allowed.
Definition: null_pci.h:30
static __always_inline int unsigned int where uint8_t * value
Definition: null_pci.h:59
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.
ring len
Length.
Definition: dwmac.h:231
A PCI bus:dev.fn address range.
Definition: pci_io.h:23
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:58
A PCI device.
Definition: pci.h:211
#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:27
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:42
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:57
void * pci_ioremap(struct pci_device *pci, unsigned long bus_addr, size_t len)
Map PCI bus address as an I/O address.
#define NULL
NULL pointer (VOID *)
Definition: Base.h:322
FILE_SECBOOT(PERMITTED)
int pci_read_config_byte(struct pci_device *pci, unsigned int where, uint8_t *value)
Read byte from PCI configuration space.