mbgtools-lx  4.2.8
pcidefs.h
Go to the documentation of this file.
1 
2 /**************************************************************************
3  *
4  * $Id: pcidefs.h 1.9 2017/05/10 15:24:15 martin REL_M $
5  *
6  * Copyright (c) Meinberg Funkuhren, Bad Pyrmont, Germany
7  *
8  * Description:
9  * Common definitions to be used with PCI.
10  *
11  * -----------------------------------------------------------------------
12  * $Log: pcidefs.h $
13  * Revision 1.9 2017/05/10 15:24:15 martin
14  * Tiny cleanup.
15  * Revision 1.8 2013/09/26 09:26:34 martin
16  * Added num of addr regs for PCI CFG header type 0x01.
17  * Re-ordered definition of PCI vendor IDs based on numerical code.
18  * Added some PCI vendor IDs.
19  * Revision 1.7 2008/06/09 10:43:09Z martin
20  * Added PCI_CMD_ENB_MEM_ACC code.
21  * Revision 1.6 2005/09/19 13:06:15Z martin
22  * Added definition for number of base address registers.
23  * Revision 1.5 2004/11/09 13:15:05Z martin
24  * Redefined interface data types using C99 fixed-size definitions.
25  * Revision 1.4 2001/02/05 16:28:21Z MARTIN
26  * Don't include stdlib.h.
27  * Revision 1.3 2000/09/11 13:51:10 MARTIN
28  * Moved structure PCI_IRQ_ROUTE_BUFFER to pci_dos.h.
29  * Revision 1.2 2000/07/21 11:56:20 MARTIN
30  * Initial revision
31  *
32  **************************************************************************/
33 
34 #ifndef _PCIDEFS_H
35 #define _PCIDEFS_H
36 
37 
38 /* Other headers to be included */
39 
40 #include <words.h>
41 
42 
43 #ifdef _PCIDEFS
44  #define _ext
45 #else
46  #define _ext extern
47 #endif
48 
49 
50 /* Start of header body */
51 
52 #ifdef __cplusplus
53 extern "C" {
54 #endif
55 
56 // Available PCI subfunction codes depend on the operating system
57 // so they are defined in the associated headers.
58 
59 // The interrupt number used to access PCI BIOS in real mode:
60 #define PCI_BIOS_INT 0x1A
61 
62 
63 // The function code is put into the AH register when a PCI function
64 // is called:
65 #define PCI_BIOS_FNC 0xB1
66 
67 
68 // The PCI subfunction codes listed below are put into the AL register
69 // when PCI functions are called. Other registers must be set according
70 // to the subfunction specs:
71 #define PCI_BIOS_PRESENT 0x01
72 #define PCI_FIND_DEVICE 0x02
73 #define PCI_FIND_CLASS_CODE 0x03
74 #define PCI_GEN_SPECIAL_CYCLE 0x06
75 #define PCI_READ_CFG_BYTE 0x08
76 #define PCI_READ_CFG_WORD 0x09
77 #define PCI_READ_CFG_DWORD 0x0A
78 #define PCI_WRITE_CFG_BYTE 0x0B
79 #define PCI_WRITE_CFG_WORD 0x0C
80 #define PCI_WRITE_CFG_DWORD 0x0D
81 #define PCI_GET_IRQ_ROUTING 0x0E
82 
83 
84 // List of PCI BIOS return codes:
85 #define PCI_SUCCESS 0x00
86 #define PCI_NO_SUCCESS 0x01 // (not returned by BIOS)
87 #define PCI_FUNC_NOT_SUPP 0x81
88 #define PCI_BAD_VENDOR_ID 0x83
89 #define PCI_DEVICE_NOT_FOUND 0x86
90 #define PCI_BAD_REGISTER_NUMB 0x87
91 #define PCI_BUFFER_TOO_SMALL 0x89
92 
93 
94 // The 80x86 Flags Register Carry Flag bit returns completion status.
95 // If the Carry Flag is set, the function call did not succeed.
96 #define CARRY_FLAG 0x01
97 
98 
99 // The signature "PCI " is returned in EDX when the subfunction
100 // PCI_BIOS_PRESENT has been called:
101 #define PCI_BIOS_SIGNATURE 0x20494350UL
102 
103 
104 // The code below represents an invalid vendor id
105 // or wildcard:
106 #define PCI_INV_VENDOR_ID 0xFFFFU
107 
108 
109 // The number of possible PCI devices per bus:
110 #define PCI_DEVICES_PER_BUS 32
111 
112 
113 // A variable of the type below is used to keep
114 // the PCI interrupt routing information:
115 typedef struct
116 {
130 
131 
132 // List of PCI BIOS return codes
133 
134 #define PCI_SUCCESS 0x00
135 #define PCI_NO_SUCCESS 0x01 // not returned by BIOS
136 #define PCI_FUNC_NOT_SUPP 0x81
137 #define PCI_BAD_VENDOR_ID 0x83
138 #define PCI_DEVICE_NOT_FOUND 0x86
139 #define PCI_BAD_REGISTER_NUMB 0x87
140 #define PCI_BUFFER_TOO_SMALL 0x89
141 
142 
143 
144 // The 80x86 flags register carry flag bit returns completion status.
145 // If the carry flag is set, the function call did not succeed.
146 
147 #ifndef CARRY_FLAG
148  #define CARRY_FLAG 0x01
149 #endif
150 
151 
152 // The signature "PCI " is returned in EDX when the subfunction
153 // PCI_BIOS_PRESENT has been called.
154 
155 #define PCI_BIOS_SIGNATURE 0x20494350UL
156 
157 
158 // PCI configuration space registers
159 
160 #define PCI_CS_VENDOR_ID 0x00
161 #define PCI_CS_DEVICE_ID 0x02
162 #define PCI_CS_COMMAND 0x04
163 #define PCI_CS_STATUS 0x06
164 #define PCI_CS_REVISION_ID 0x08
165 #define PCI_CS_CLASS_CODE 0x09
166 #define PCI_CS_CACHE_LINE_SIZE 0x0C
167 #define PCI_CS_MASTER_LATENCY 0x0D
168 #define PCI_CS_HEADER_TYPE 0x0E
169 #define PCI_CS_BIST 0x0F
170 #define PCI_CS_BASE_ADDRESS_0 0x10
171 #define PCI_CS_BASE_ADDRESS_1 0x14
172 #define PCI_CS_BASE_ADDRESS_2 0x18
173 #define PCI_CS_BASE_ADDRESS_3 0x1C
174 #define PCI_CS_BASE_ADDRESS_4 0x20
175 #define PCI_CS_BASE_ADDRESS_5 0x24
176 #define PCI_CS_EXPANSION_ROM 0x30
177 #define PCI_CS_INTERRUPT_LINE 0x3C
178 #define PCI_CS_INTERRUPT_PIN 0x3D
179 #define PCI_CS_MIN_GNT 0x3E
180 #define PCI_CS_MAX_LAT 0x3F
181 
182 #define PCI_CS_N_BASE_ADDRESS 6 /* num of badr regs for header type 0x00 */
183 #define PCI_CS_N_BASE_ADDRESS_01 2 /* num of badr regs for header type 0x01 */
184 
185 
186 #define PCI_CMD_ENB_IO_ACC 0x01
187 #define PCI_CMD_ENB_MEM_ACC 0x02
188 
189 
190 typedef struct
191 {
195 } PCI_CLASS;
196 
197 #define PCI_N_BASE_ADDR_FIELD 6
198 
199 typedef struct
200 {
211  uint32_t base_addr[PCI_N_BASE_ADDR_FIELD];
212  uint32_t cardbus_cis;
216  uint32_t res_0;
217  uint32_t res_1;
222 } PCI_CFG_SPACE;
223 
224 
225 
226 // some known vendor IDs, in numerical order:
227 
228 #define PCI_VENDOR_ASUS 0x1000
229 #define PCI_VENDOR_ATI 0x1002
230 #define PCI_VENDOR_CIRRUS_LOGIC 0x1013
231 #define PCI_VENDOR_IBM 0x1014
232 #define PCI_VENDOR_AMD 0x1022
233 #define PCI_VENDOR_MATROX 0x102B
234 #define PCI_VENDOR_NEC 0x1033
235 #define PCI_VENDOR_TEXAS_INSTR 0x104C
236 #define PCI_VENDOR_PLX 0x10B5
237 #define PCI_VENDOR_3COM 0x10B7
238 #define PCI_VENDOR_AMCC 0x10E8
239 #define PCI_VENDOR_REALTEK 0x10EC
240 #define PCI_VENDOR_MEINBERG 0x1360
241 #define PCI_VENDOR_JMICRON 0x197B
242 #define PCI_VENDOR_ELSA 0x5333
243 #define PCI_VENDOR_INTEL 0x8086
244 #define PCI_VENDOR_ADAPTEC_1 0x9004
245 #define PCI_VENDOR_ADAPTEC_2 0x9005
246 
247 
248 /* ----- function prototypes begin ----- */
249 
250 /* This section was generated automatically */
251 /* by MAKEHDR, do not remove the comments. */
252 
253 /* (no header definitions found) */
254 
255 /* ----- function prototypes end ----- */
256 
257 #ifdef __cplusplus
258 }
259 #endif
260 
261 
262 /* End of header body */
263 
264 #undef _ext
265 
266 #endif /* _PCIDEFS_H */
267 
uint32_t cardbus_cis
Definition: pcidefs.h:212
uint16_t sub_system_id
Definition: pcidefs.h:214
uint8_t reserved
Definition: pcidefs.h:128
uint8_t prog_if
Definition: pcidefs.h:192
uint8_t cache_line_size
Definition: pcidefs.h:207
PCI_CLASS class_code
Definition: pcidefs.h:206
uint8_t bus
Definition: pcidefs.h:117
uint32_t res_0
Definition: pcidefs.h:216
uint8_t slot
Definition: pcidefs.h:127
uint8_t revision_id
Definition: pcidefs.h:205
uint8_t irq_line
Definition: pcidefs.h:218
unsigned short uint16_t
Definition: words.h:213
uint16_t intb_map
Definition: pcidefs.h:122
#define PCI_N_BASE_ADDR_FIELD
Definition: pcidefs.h:197
uint8_t intc_link
Definition: pcidefs.h:123
Definition: pcidefs.h:115
uint16_t intd_map
Definition: pcidefs.h:126
uint8_t inta_link
Definition: pcidefs.h:119
uint8_t intb_link
Definition: pcidefs.h:121
uint8_t latency_timer
Definition: pcidefs.h:208
uint32_t expansion_rom_base
Definition: pcidefs.h:215
uint16_t sub_vendor_id
Definition: pcidefs.h:213
uint8_t min_gnt
Definition: pcidefs.h:220
uint8_t intd_link
Definition: pcidefs.h:125
uint32_t res_1
Definition: pcidefs.h:217
uint8_t header_type
Definition: pcidefs.h:209
uint16_t inta_map
Definition: pcidefs.h:120
uint8_t device_number
Definition: pcidefs.h:118
uint8_t bist
Definition: pcidefs.h:210
uint16_t vendor_id
Definition: pcidefs.h:201
unsigned char uint8_t
Definition: words.h:210
uint8_t base
Definition: pcidefs.h:194
uint16_t status
Definition: pcidefs.h:204
uint8_t sub
Definition: pcidefs.h:193
uint16_t command
Definition: pcidefs.h:203
uint16_t intc_map
Definition: pcidefs.h:124
uint8_t irq_pin
Definition: pcidefs.h:219
uint8_t max_lat
Definition: pcidefs.h:221
uint16_t device_id
Definition: pcidefs.h:202