aboutsummaryrefslogtreecommitdiffstats
path: root/src/include/ipxe/null_pci.h
blob: 476ede202ed759f9e523adfea9ba0407c008496f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
#ifndef _IPXE_NULL_PCI_H
#define _IPXE_NULL_PCI_H

#include <stdint.h>

/** @file
 *
 * Null PCI API
 *
 */

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );

#ifdef PCIAPI_NULL
#define PCIAPI_PREFIX_null
#else
#define PCIAPI_PREFIX_null __null_
#endif

struct pci_device;

/**
 * Check if PCI bus probing is allowed
 *
 * @ret ok		Bus probing is allowed
 */
static inline __always_inline int
PCIAPI_INLINE ( null, pci_can_probe ) ( void ) {
	return 0;
}

/**
 * Find next PCI bus:dev.fn address range in system
 *
 * @v busdevfn		Starting PCI bus:dev.fn address
 * @v range		PCI bus:dev.fn address range to fill in
 */
static inline __always_inline void
PCIAPI_INLINE ( null, pci_discover ) ( uint32_t busdevfn __unused,
				       struct pci_range *range ) {

	range->start = 0;
	range->count = 0;
}

/**
 * Read byte from PCI configuration space via PCI BIOS
 *
 * @v pci	PCI device
 * @v where	Location within PCI configuration space
 * @v value	Value read
 * @ret rc	Return status code
 */
static inline __always_inline int
PCIAPI_INLINE ( null, pci_read_config_byte ) ( struct pci_device *pci __unused,
					       unsigned int where __unused,
					       uint8_t *value ) {
	*value = 0xff;
	return 0;
}

/**
 * Read word from PCI configuration space via PCI BIOS
 *
 * @v pci	PCI device
 * @v where	Location within PCI configuration space
 * @v value	Value read
 * @ret rc	Return status code
 */
static inline __always_inline int
PCIAPI_INLINE ( null, pci_read_config_word ) ( struct pci_device *pci __unused,
					       unsigned int where __unused,
					       uint16_t *value ) {
	*value = 0xffff;
	return 0;
}

/**
 * Read dword from PCI configuration space via PCI BIOS
 *
 * @v pci	PCI device
 * @v where	Location within PCI configuration space
 * @v value	Value read
 * @ret rc	Return status code
 */
static inline __always_inline int
PCIAPI_INLINE ( null, pci_read_config_dword ) ( struct pci_device *pci __unused,
						unsigned int where __unused,
						uint32_t *value ) {
	*value = 0xffffffff;
	return 0;
}

/**
 * Write byte to PCI configuration space via PCI BIOS
 *
 * @v pci	PCI device
 * @v where	Location within PCI configuration space
 * @v value	Value to be written
 * @ret rc	Return status code
 */
static inline __always_inline int
PCIAPI_INLINE ( null, pci_write_config_byte ) ( struct pci_device *pci __unused,
						unsigned int where __unused,
						uint8_t value __unused ) {
	return 0;
}

/**
 * Write word to PCI configuration space via PCI BIOS
 *
 * @v pci	PCI device
 * @v where	Location within PCI configuration space
 * @v value	Value to be written
 * @ret rc	Return status code
 */
static inline __always_inline int
PCIAPI_INLINE ( null, pci_write_config_word ) ( struct pci_device *pci __unused,
						unsigned int where __unused,
						uint16_t value __unused ) {
	return 0;
}

/**
 * Write dword to PCI configuration space via PCI BIOS
 *
 * @v pci	PCI device
 * @v where	Location within PCI configuration space
 * @v value	Value to be written
 * @ret rc	Return status code
 */
static inline __always_inline int
PCIAPI_INLINE ( null, pci_write_config_dword ) ( struct pci_device *pci
						 __unused,
						 unsigned int where __unused,
						 uint32_t value __unused ) {
	return 0;
}

/**
 * Map PCI bus address as an I/O address
 *
 * @v bus_addr		PCI bus address
 * @v len		Length of region
 * @ret io_addr		I/O address, or NULL on error
 */
static inline __always_inline void *
PCIAPI_INLINE ( null, pci_ioremap ) ( struct pci_device *pci __unused,
				      unsigned long bus_addr __unused,
				      size_t len __unused ) {
	return NULL;
}

#endif /* _IPXE_NULL_PCI_H */