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