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
12FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
13FILE_SECBOOT ( PERMITTED );
14
15#ifdef PCIAPI_NULL
16#define PCIAPI_PREFIX_null
17#else
18#define PCIAPI_PREFIX_null __null_
19#endif
20
21struct 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 */
29static inline __always_inline int
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 */
40static 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 */
56static 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 */
72static 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 */
88static 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 */
104static 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 */
119static 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 */
134static inline __always_inline int
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 */
149static inline __always_inline void *
151 unsigned long bus_addr __unused,
152 size_t len __unused ) {
153 return NULL;
154}
155
156#endif /* _IPXE_NULL_PCI_H */
#define NULL
NULL pointer (VOID *)
Definition Base.h:322
pseudo_bit_t value[0x00020]
Definition arbel.h:2
unsigned short uint16_t
Definition stdint.h:11
unsigned int uint32_t
Definition stdint.h:12
unsigned char uint8_t
Definition stdint.h:10
ring len
Length.
Definition dwmac.h:226
uint16_t busdevfn
PCI bus:dev.fn address.
Definition ena.h:17
#define __always_inline
Declare a function to be always inline.
Definition compiler.h:611
#define __unused
Declare a variable or data structure as unused.
Definition compiler.h:573
#define FILE_LICENCE(_licence)
Declare a particular licence as applying to a file.
Definition compiler.h:896
#define FILE_SECBOOT(_status)
Declare a file's UEFI Secure Boot permission status.
Definition compiler.h:926
int pci_read_config_dword(struct pci_device *pci, unsigned int where, uint32_t *value)
Read 32-bit dword from PCI configuration space.
int pci_can_probe(struct pci_device *pci)
Check if PCI bus probing is allowed.
void pci_discover(uint32_t busdevfn, struct pci_range *range)
Find next PCI bus:dev.fn address range in system.
int pci_read_config_word(struct pci_device *pci, unsigned int where, uint16_t *value)
Read 16-bit word from PCI configuration space.
void * pci_ioremap(struct pci_device *pci, unsigned long bus_addr, size_t len)
Map PCI bus address as an I/O address.
int pci_write_config_byte(struct pci_device *pci, unsigned int where, uint8_t value)
Write byte to PCI configuration space.
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_byte(struct pci_device *pci, unsigned int where, uint8_t *value)
Read byte from PCI configuration space.
#define PCIAPI_INLINE(_subsys, _api_func)
Calculate static inline PCI I/O API function name.
Definition pci_io.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.
static __always_inline void unsigned long bus_addr
Definition pcibios.h:156
static __always_inline int unsigned int where
Definition pcibios.h:57
struct pci_range range
PCI bus:dev.fn address range.
Definition pcicloud.c:40
A PCI device.
Definition pci.h:211
A PCI bus:dev.fn address range.
Definition pci_io.h:23