iPXE
pcibios.h
Go to the documentation of this file.
1#ifndef _IPXE_PCIBIOS_H
2#define _IPXE_PCIBIOS_H
3
4#include <stdint.h>
5
6/** @file
7 *
8 * PCI configuration space access via PCI BIOS
9 *
10 */
11
12FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
13FILE_SECBOOT ( PERMITTED );
14
15#ifdef PCIAPI_PCBIOS
16#define PCIAPI_PREFIX_pcbios
17#else
18#define PCIAPI_PREFIX_pcbios __pcbios_
19#endif
20
21struct pci_device;
22
23#define PCIBIOS_INSTALLATION_CHECK 0xb1010000
24#define PCIBIOS_READ_CONFIG_BYTE 0xb1080000
25#define PCIBIOS_READ_CONFIG_WORD 0xb1090000
26#define PCIBIOS_READ_CONFIG_DWORD 0xb10a0000
27#define PCIBIOS_WRITE_CONFIG_BYTE 0xb10b0000
28#define PCIBIOS_WRITE_CONFIG_WORD 0xb10c0000
29#define PCIBIOS_WRITE_CONFIG_DWORD 0xb10d0000
30
31extern int pcibios_read ( struct pci_device *pci, uint32_t command,
32 uint32_t *value );
33extern int pcibios_write ( struct pci_device *pci, uint32_t command,
35
36/**
37 * Check if PCI bus probing is allowed
38 *
39 * @v pci PCI device
40 * @ret ok Bus probing is allowed
41 */
42static inline __always_inline int
43PCIAPI_INLINE ( pcbios, pci_can_probe ) ( struct pci_device *pci __unused ) {
44 return 1;
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 */
55static inline __always_inline int
57 unsigned int where,
60 int rc;
61
63 *value = tmp;
64 return rc;
65}
66
67/**
68 * Read word from PCI configuration space via PCI BIOS
69 *
70 * @v pci PCI device
71 * @v where Location within PCI configuration space
72 * @v value Value read
73 * @ret rc Return status code
74 */
75static inline __always_inline int
77 unsigned int where,
78 uint16_t *value ) {
80 int rc;
81
83 *value = tmp;
84 return rc;
85}
86
87/**
88 * Read dword from PCI configuration space via PCI BIOS
89 *
90 * @v pci PCI device
91 * @v where Location within PCI configuration space
92 * @v value Value read
93 * @ret rc Return status code
94 */
95static inline __always_inline int
97 unsigned int where,
98 uint32_t *value ) {
100}
101
102/**
103 * Write byte to PCI configuration space via PCI BIOS
104 *
105 * @v pci PCI device
106 * @v where Location within PCI configuration space
107 * @v value Value to be written
108 * @ret rc Return status code
109 */
110static inline __always_inline int
112 unsigned int where,
113 uint8_t value ) {
115}
116
117/**
118 * Write word to PCI configuration space via PCI BIOS
119 *
120 * @v pci PCI device
121 * @v where Location within PCI configuration space
122 * @v value Value to be written
123 * @ret rc Return status code
124 */
125static inline __always_inline int
127 unsigned int where,
128 uint16_t value ) {
130}
131
132/**
133 * Write dword to PCI configuration space via PCI BIOS
134 *
135 * @v pci PCI device
136 * @v where Location within PCI configuration space
137 * @v value Value to be written
138 * @ret rc Return status code
139 */
140static inline __always_inline int
142 unsigned int where,
143 uint32_t value ) {
145}
146
147/**
148 * Map PCI bus address as an I/O address
149 *
150 * @v bus_addr PCI bus address
151 * @v len Length of region
152 * @ret io_addr I/O address, or NULL on error
153 */
154static inline __always_inline void *
156 unsigned long bus_addr, size_t len ) {
157 return ioremap ( bus_addr, len );
158}
159
160#endif /* _IPXE_PCIBIOS_H */
struct arbelprm_rc_send_wqe rc
Definition arbel.h:3
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
#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
void * ioremap(unsigned long bus_addr, size_t len)
Map bus address as an I/O address.
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.
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.
unsigned long tmp
Definition linux_pci.h:65
#define PCIBIOS_READ_CONFIG_WORD
Definition pcibios.h:25
#define PCIBIOS_WRITE_CONFIG_BYTE
Definition pcibios.h:27
static __always_inline void unsigned long bus_addr
Definition pcibios.h:156
#define PCIBIOS_WRITE_CONFIG_WORD
Definition pcibios.h:28
#define PCIBIOS_READ_CONFIG_BYTE
Definition pcibios.h:24
#define PCIBIOS_WRITE_CONFIG_DWORD
Definition pcibios.h:29
int pcibios_write(struct pci_device *pci, uint32_t command, uint32_t value)
Write configuration space via PCI BIOS.
Definition pcibios.c:105
int pcibios_read(struct pci_device *pci, uint32_t command, uint32_t *value)
Read configuration space via PCI BIOS.
Definition pcibios.c:77
static __always_inline int unsigned int where
Definition pcibios.h:57
#define PCIBIOS_READ_CONFIG_DWORD
Definition pcibios.h:26
A command-line command.
Definition command.h:10
A PCI device.
Definition pci.h:211