]> git.proxmox.com Git - mirror_edk2.git/blame - ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.h
Add "Debug1" profile (all but Edit and HexEdit commands)
[mirror_edk2.git] / ShellPkg / Library / UefiShellDebug1CommandsLib / Pci.h
CommitLineData
5d73d92f 1/** @file\r
2 Header file for Pci shell Debug1 function.\r
3\r
4 Copyright (c) 2005 - 2010, Intel Corporation. All rights reserved.<BR>\r
5 This program and the accompanying materials\r
6 are licensed and made available under the terms and conditions of the BSD License\r
7 which accompanies this distribution. The full text of the license may be found at\r
8 http://opensource.org/licenses/bsd-license.php\r
9\r
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12\r
13**/\r
14\r
15#ifndef _EFI_SHELL_PCI_H_\r
16#define _EFI_SHELL_PCI_H_\r
17\r
18typedef enum {\r
19 PciDevice,\r
20 PciP2pBridge,\r
21 PciCardBusBridge,\r
22 PciUndefined\r
23} PCI_HEADER_TYPE;\r
24\r
25#define HEADER_TYPE_MULTI_FUNCTION 0x80\r
26\r
27#define MAX_BUS_NUMBER 255\r
28#define MAX_DEVICE_NUMBER 31\r
29#define MAX_FUNCTION_NUMBER 7\r
30\r
31#define EFI_PCI_CAPABILITY_ID_PCIEXP 0x10\r
32#define EFI_PCI_CAPABILITY_ID_PCIX 0x07\r
33\r
34#define CALC_EFI_PCI_ADDRESS(Bus, Dev, Func, Reg) \\r
35 ((UINT64) ((((UINTN) Bus) << 24) + (((UINTN) Dev) << 16) + (((UINTN) Func) << 8) + ((UINTN) Reg)))\r
36\r
37#define CALC_EFI_PCIEX_ADDRESS(Bus, Dev, Func, ExReg) ( \\r
38 (UINT64) ((((UINTN) Bus) << 24) + (((UINTN) Dev) << 16) + (((UINTN) Func) << 8) + (LShiftU64 ((UINT64) ExReg, 32))) \\r
39 );\r
40\r
41#define INDEX_OF(Field) ((UINT8 *) (Field) - (UINT8 *) mConfigSpace)\r
42\r
43#define PCI_BIT_0 0x00000001\r
44#define PCI_BIT_1 0x00000002\r
45#define PCI_BIT_2 0x00000004\r
46#define PCI_BIT_3 0x00000008\r
47#define PCI_BIT_4 0x00000010\r
48#define PCI_BIT_5 0x00000020\r
49#define PCI_BIT_6 0x00000040\r
50#define PCI_BIT_7 0x00000080\r
51#define PCI_BIT_8 0x00000100\r
52#define PCI_BIT_9 0x00000200\r
53#define PCI_BIT_10 0x00000400\r
54#define PCI_BIT_11 0x00000800\r
55#define PCI_BIT_12 0x00001000\r
56#define PCI_BIT_13 0x00002000\r
57#define PCI_BIT_14 0x00004000\r
58#define PCI_BIT_15 0x00008000\r
59\r
60//\r
61// PCIE device/port types\r
62//\r
63#define PCIE_PCIE_ENDPOINT 0\r
64#define PCIE_LEGACY_PCIE_ENDPOINT 1\r
65#define PCIE_ROOT_COMPLEX_ROOT_PORT 4\r
66#define PCIE_SWITCH_UPSTREAM_PORT 5\r
67#define PCIE_SWITCH_DOWNSTREAM_PORT 6\r
68#define PCIE_PCIE_TO_PCIX_BRIDGE 7\r
69#define PCIE_PCIX_TO_PCIE_BRIDGE 8\r
70#define PCIE_ROOT_COMPLEX_INTEGRATED_PORT 9\r
71#define PCIE_ROOT_COMPLEX_EVENT_COLLECTOR 10\r
72#define PCIE_DEVICE_PORT_TYPE_MAX 11\r
73\r
74#define IS_PCIE_ENDPOINT(DevicePortType) \\r
75 ((DevicePortType) == PCIE_PCIE_ENDPOINT || \\r
76 (DevicePortType) == PCIE_LEGACY_PCIE_ENDPOINT || \\r
77 (DevicePortType) == PCIE_ROOT_COMPLEX_INTEGRATED_PORT)\r
78\r
79#define IS_PCIE_SWITCH(DevicePortType) \\r
80 ((DevicePortType == PCIE_SWITCH_UPSTREAM_PORT) || \\r
81 (DevicePortType == PCIE_SWITCH_DOWNSTREAM_PORT))\r
82\r
83//\r
84// Capabilities Register\r
85//\r
86#define PCIE_CAP_VERSION(PcieCapReg) \\r
87 ((PcieCapReg) & 0x0f)\r
88#define PCIE_CAP_DEVICEPORT_TYPE(PcieCapReg) \\r
89 (((PcieCapReg) >> 4) & 0x0f)\r
90#define PCIE_CAP_SLOT_IMPLEMENTED(PcieCapReg) \\r
91 (((PcieCapReg) >> 8) & 0x1)\r
92#define PCIE_CAP_INT_MSG_NUM(PcieCapReg) \\r
93 (((PcieCapReg) >> 9) & 0x1f)\r
94//\r
95// Device Capabilities Register\r
96//\r
97#define PCIE_CAP_MAX_PAYLOAD(PcieDeviceCap) \\r
98 ((PcieDeviceCap) & 0x7)\r
99#define PCIE_CAP_PHANTOM_FUNC(PcieDeviceCap) \\r
100 (((PcieDeviceCap) >> 3) & 0x3)\r
101#define PCIE_CAP_EXTENDED_TAG(PcieDeviceCap) \\r
102 (((PcieDeviceCap) >> 5) & 0x1)\r
103#define PCIE_CAP_L0sLatency(PcieDeviceCap) \\r
104 (((PcieDeviceCap) >> 6) & 0x7)\r
105#define PCIE_CAP_L1Latency(PcieDeviceCap) \\r
106 (((PcieDeviceCap) >> 9) & 0x7)\r
107#define PCIE_CAP_ERR_REPORTING(PcieDeviceCap) \\r
108 (((PcieDeviceCap) >> 15) & 0x1)\r
109#define PCIE_CAP_SLOT_POWER_VALUE(PcieDeviceCap) \\r
110 (((PcieDeviceCap) >> 18) & 0x0ff)\r
111#define PCIE_CAP_SLOT_POWER_SCALE(PcieDeviceCap) \\r
112 (((PcieDeviceCap) >> 26) & 0x3)\r
113#define PCIE_CAP_FUNC_LEVEL_RESET(PcieDeviceCap) \\r
114 (((PcieDeviceCap) >> 28) & 0x1)\r
115//\r
116// Device Control Register\r
117//\r
118#define PCIE_CAP_COR_ERR_REPORTING_ENABLE(PcieDeviceControl) \\r
119 ((PcieDeviceControl) & 0x1)\r
120#define PCIE_CAP_NONFAT_ERR_REPORTING_ENABLE(PcieDeviceControl) \\r
121 (((PcieDeviceControl) >> 1) & 0x1)\r
122#define PCIE_CAP_FATAL_ERR_REPORTING_ENABLE(PcieDeviceControl) \\r
123 (((PcieDeviceControl) >> 2) & 0x1)\r
124#define PCIE_CAP_UNSUP_REQ_REPORTING_ENABLE(PcieDeviceControl) \\r
125 (((PcieDeviceControl) >> 3) & 0x1)\r
126#define PCIE_CAP_RELAXED_ORDERING_ENABLE(PcieDeviceControl) \\r
127 (((PcieDeviceControl) >> 4) & 0x1)\r
128#define PCIE_CAP_MAX_PAYLOAD_SIZE(PcieDeviceControl) \\r
129 (((PcieDeviceControl) >> 5) & 0x7)\r
130#define PCIE_CAP_EXTENDED_TAG_ENABLE(PcieDeviceControl) \\r
131 (((PcieDeviceControl) >> 8) & 0x1)\r
132#define PCIE_CAP_PHANTOM_FUNC_ENABLE(PcieDeviceControl) \\r
133 (((PcieDeviceControl) >> 9) & 0x1)\r
134#define PCIE_CAP_AUX_PM_ENABLE(PcieDeviceControl) \\r
135 (((PcieDeviceControl) >> 10) & 0x1)\r
136#define PCIE_CAP_NO_SNOOP_ENABLE(PcieDeviceControl) \\r
137 (((PcieDeviceControl) >> 11) & 0x1)\r
138#define PCIE_CAP_MAX_READ_REQ_SIZE(PcieDeviceControl) \\r
139 (((PcieDeviceControl) >> 12) & 0x7)\r
140#define PCIE_CAP_BRG_CONF_RETRY(PcieDeviceControl) \\r
141 (((PcieDeviceControl) >> 15) & 0x1)\r
142//\r
143// Device Status Register\r
144//\r
145#define PCIE_CAP_COR_ERR_DETECTED(PcieDeviceStatus) \\r
146 ((PcieDeviceStatus) & 0x1)\r
147#define PCIE_CAP_NONFAT_ERR_DETECTED(PcieDeviceStatus) \\r
148 (((PcieDeviceStatus) >> 1) & 0x1)\r
149#define PCIE_CAP_FATAL_ERR_DETECTED(PcieDeviceStatus) \\r
150 (((PcieDeviceStatus) >> 2) & 0x1)\r
151#define PCIE_CAP_UNSUP_REQ_DETECTED(PcieDeviceStatus) \\r
152 (((PcieDeviceStatus) >> 3) & 0x1)\r
153#define PCIE_CAP_AUX_POWER_DETECTED(PcieDeviceStatus) \\r
154 (((PcieDeviceStatus) >> 4) & 0x1)\r
155#define PCIE_CAP_TRANSACTION_PENDING(PcieDeviceStatus) \\r
156 (((PcieDeviceStatus) >> 5) & 0x1)\r
157//\r
158// Link Capabilities Register\r
159//\r
160#define PCIE_CAP_SUP_LINK_SPEEDS(PcieLinkCap) \\r
161 ((PcieLinkCap) & 0x0f)\r
162#define PCIE_CAP_MAX_LINK_WIDTH(PcieLinkCap) \\r
163 (((PcieLinkCap) >> 4) & 0x3f)\r
164#define PCIE_CAP_ASPM_SUPPORT(PcieLinkCap) \\r
165 (((PcieLinkCap) >> 10) & 0x3)\r
166#define PCIE_CAP_L0s_LATENCY(PcieLinkCap) \\r
167 (((PcieLinkCap) >> 12) & 0x7)\r
168#define PCIE_CAP_L1_LATENCY(PcieLinkCap) \\r
169 (((PcieLinkCap) >> 15) & 0x7)\r
170#define PCIE_CAP_CLOCK_PM(PcieLinkCap) \\r
171 (((PcieLinkCap) >> 18) & 0x1)\r
172#define PCIE_CAP_SUP_DOWN_ERR_REPORTING(PcieLinkCap) \\r
173 (((PcieLinkCap) >> 19) & 0x1)\r
174#define PCIE_CAP_LINK_ACTIVE_REPORTING(PcieLinkCap) \\r
175 (((PcieLinkCap) >> 20) & 0x1)\r
176#define PCIE_CAP_LINK_BWD_NOTIF_CAP(PcieLinkCap) \\r
177 (((PcieLinkCap) >> 21) & 0x1)\r
178#define PCIE_CAP_PORT_NUMBER(PcieLinkCap) \\r
179 (((PcieLinkCap) >> 24) & 0x0ff)\r
180//\r
181// Link Control Register\r
182//\r
183#define PCIE_CAP_ASPM_CONTROL(PcieLinkControl) \\r
184 ((PcieLinkControl) & 0x3)\r
185#define PCIE_CAP_RCB(PcieLinkControl) \\r
186 (((PcieLinkControl) >> 3) & 0x1)\r
187#define PCIE_CAP_LINK_DISABLE(PcieLinkControl) \\r
188 (((PcieLinkControl) >> 4) & 0x1)\r
189#define PCIE_CAP_COMMON_CLK_CONF(PcieLinkControl) \\r
190 (((PcieLinkControl) >> 6) & 0x1)\r
191#define PCIE_CAP_EXT_SYNC(PcieLinkControl) \\r
192 (((PcieLinkControl) >> 7) & 0x1)\r
193#define PCIE_CAP_CLK_PWR_MNG(PcieLinkControl) \\r
194 (((PcieLinkControl) >> 8) & 0x1)\r
195#define PCIE_CAP_HW_AUTO_WIDTH_DISABLE(PcieLinkControl) \\r
196 (((PcieLinkControl) >> 9) & 0x1)\r
197#define PCIE_CAP_LINK_BDW_MNG_INT_EN(PcieLinkControl) \\r
198 (((PcieLinkControl) >> 10) & 0x1)\r
199#define PCIE_CAP_LINK_AUTO_BDW_INT_EN(PcieLinkControl) \\r
200 (((PcieLinkControl) >> 11) & 0x1)\r
201//\r
202// Link Status Register\r
203//\r
204#define PCIE_CAP_CUR_LINK_SPEED(PcieLinkStatus) \\r
205 ((PcieLinkStatus) & 0x0f)\r
206#define PCIE_CAP_NEGO_LINK_WIDTH(PcieLinkStatus) \\r
207 (((PcieLinkStatus) >> 4) & 0x3f)\r
208#define PCIE_CAP_LINK_TRAINING(PcieLinkStatus) \\r
209 (((PcieLinkStatus) >> 11) & 0x1)\r
210#define PCIE_CAP_SLOT_CLK_CONF(PcieLinkStatus) \\r
211 (((PcieLinkStatus) >> 12) & 0x1)\r
212#define PCIE_CAP_DATA_LINK_ACTIVE(PcieLinkStatus) \\r
213 (((PcieLinkStatus) >> 13) & 0x1)\r
214#define PCIE_CAP_LINK_BDW_MNG_STAT(PcieLinkStatus) \\r
215 (((PcieLinkStatus) >> 14) & 0x1)\r
216#define PCIE_CAP_LINK_AUTO_BDW_STAT(PcieLinkStatus) \\r
217 (((PcieLinkStatus) >> 15) & 0x1)\r
218//\r
219// Slot Capabilities Register\r
220//\r
221#define PCIE_CAP_ATT_BUT_PRESENT(PcieSlotCap) \\r
222 ((PcieSlotCap) & 0x1)\r
223#define PCIE_CAP_PWR_CTRLLER_PRESENT(PcieSlotCap) \\r
224 (((PcieSlotCap) >> 1) & 0x1)\r
225#define PCIE_CAP_MRL_SENSOR_PRESENT(PcieSlotCap) \\r
226 (((PcieSlotCap) >> 2) & 0x1)\r
227#define PCIE_CAP_ATT_IND_PRESENT(PcieSlotCap) \\r
228 (((PcieSlotCap) >> 3) & 0x1)\r
229#define PCIE_CAP_PWD_IND_PRESENT(PcieSlotCap) \\r
230 (((PcieSlotCap) >> 4) & 0x1)\r
231#define PCIE_CAP_HOTPLUG_SUPPRISE(PcieSlotCap) \\r
232 (((PcieSlotCap) >> 5) & 0x1)\r
233#define PCIE_CAP_HOTPLUG_CAPABLE(PcieSlotCap) \\r
234 (((PcieSlotCap) >> 6) & 0x1)\r
235#define PCIE_CAP_SLOT_PWR_LIMIT_VALUE(PcieSlotCap) \\r
236 (((PcieSlotCap) >> 7) & 0x0ff)\r
237#define PCIE_CAP_SLOT_PWR_LIMIT_SCALE(PcieSlotCap) \\r
238 (((PcieSlotCap) >> 15) & 0x3)\r
239#define PCIE_CAP_ELEC_INTERLOCK_PRESENT(PcieSlotCap) \\r
240 (((PcieSlotCap) >> 17) & 0x1)\r
241#define PCIE_CAP_NO_COMM_COMPLETED_SUP(PcieSlotCap) \\r
242 (((PcieSlotCap) >> 18) & 0x1)\r
243#define PCIE_CAP_PHY_SLOT_NUM(PcieSlotCap) \\r
244 (((PcieSlotCap) >> 19) & 0x1fff)\r
245//\r
246// Slot Control Register\r
247//\r
248#define PCIE_CAP_ATT_BUT_ENABLE(PcieSlotControl) \\r
249 ((PcieSlotControl) & 0x1)\r
250#define PCIE_CAP_PWR_FLT_DETECT_ENABLE(PcieSlotControl) \\r
251 (((PcieSlotControl) >> 1) & 0x1)\r
252#define PCIE_CAP_MRL_SENSOR_CHANGE_ENABLE(PcieSlotControl) \\r
253 (((PcieSlotControl) >> 2) & 0x1)\r
254#define PCIE_CAP_PRES_DETECT_CHANGE_ENABLE(PcieSlotControl) \\r
255 (((PcieSlotControl) >> 3) & 0x1)\r
256#define PCIE_CAP_COMM_CMPL_INT_ENABLE(PcieSlotControl) \\r
257 (((PcieSlotControl) >> 4) & 0x1)\r
258#define PCIE_CAP_HOTPLUG_INT_ENABLE(PcieSlotControl) \\r
259 (((PcieSlotControl) >> 5) & 0x1)\r
260#define PCIE_CAP_ATT_IND_CTRL(PcieSlotControl) \\r
261 (((PcieSlotControl) >> 6) & 0x3)\r
262#define PCIE_CAP_PWR_IND_CTRL(PcieSlotControl) \\r
263 (((PcieSlotControl) >> 8) & 0x3)\r
264#define PCIE_CAP_PWR_CTRLLER_CTRL(PcieSlotControl) \\r
265 (((PcieSlotControl) >> 10) & 0x1)\r
266#define PCIE_CAP_ELEC_INTERLOCK_CTRL(PcieSlotControl) \\r
267 (((PcieSlotControl) >> 11) & 0x1)\r
268#define PCIE_CAP_DLINK_STAT_CHANGE_ENABLE(PcieSlotControl) \\r
269 (((PcieSlotControl) >> 12) & 0x1)\r
270//\r
271// Slot Status Register\r
272//\r
273#define PCIE_CAP_ATT_BUT_PRESSED(PcieSlotStatus) \\r
274 ((PcieSlotStatus) & 0x1)\r
275#define PCIE_CAP_PWR_FLT_DETECTED(PcieSlotStatus) \\r
276 (((PcieSlotStatus) >> 1) & 0x1)\r
277#define PCIE_CAP_MRL_SENSOR_CHANGED(PcieSlotStatus) \\r
278 (((PcieSlotStatus) >> 2) & 0x1)\r
279#define PCIE_CAP_PRES_DETECT_CHANGED(PcieSlotStatus) \\r
280 (((PcieSlotStatus) >> 3) & 0x1)\r
281#define PCIE_CAP_COMM_COMPLETED(PcieSlotStatus) \\r
282 (((PcieSlotStatus) >> 4) & 0x1)\r
283#define PCIE_CAP_MRL_SENSOR_STATE(PcieSlotStatus) \\r
284 (((PcieSlotStatus) >> 5) & 0x1)\r
285#define PCIE_CAP_PRES_DETECT_STATE(PcieSlotStatus) \\r
286 (((PcieSlotStatus) >> 6) & 0x1)\r
287#define PCIE_CAP_ELEC_INTERLOCK_STATE(PcieSlotStatus) \\r
288 (((PcieSlotStatus) >> 7) & 0x1)\r
289#define PCIE_CAP_DLINK_STAT_CHANGED(PcieSlotStatus) \\r
290 (((PcieSlotStatus) >> 8) & 0x1)\r
291//\r
292// Root Control Register\r
293//\r
294#define PCIE_CAP_SYSERR_ON_CORERR_EN(PcieRootControl) \\r
295 ((PcieRootControl) & 0x1)\r
296#define PCIE_CAP_SYSERR_ON_NONFATERR_EN(PcieRootControl) \\r
297 (((PcieRootControl) >> 1) & 0x1)\r
298#define PCIE_CAP_SYSERR_ON_FATERR_EN(PcieRootControl) \\r
299 (((PcieRootControl) >> 2) & 0x1)\r
300#define PCIE_CAP_PME_INT_ENABLE(PcieRootControl) \\r
301 (((PcieRootControl) >> 3) & 0x1)\r
302#define PCIE_CAP_CRS_SW_VIS_ENABLE(PcieRootControl) \\r
303 (((PcieRootControl) >> 4) & 0x1)\r
304//\r
305// Root Capabilities Register\r
306//\r
307#define PCIE_CAP_CRS_SW_VIS(PcieRootCap) \\r
308 ((PcieRootCap) & 0x1)\r
309//\r
310// Root Status Register\r
311//\r
312#define PCIE_CAP_PME_REQ_ID(PcieRootStatus) \\r
313 ((PcieRootStatus) & 0x0ffff)\r
314#define PCIE_CAP_PME_STATUS(PcieRootStatus) \\r
315 (((PcieRootStatus) >> 16) & 0x1)\r
316#define PCIE_CAP_PME_PENDING(PcieRootStatus) \\r
317 (((PcieRootStatus) >> 17) & 0x1)\r
318\r
319#pragma pack(1)\r
320//\r
321// Common part of the PCI configuration space header for devices, P2P bridges,\r
322// and cardbus bridges\r
323//\r
324typedef struct {\r
325 UINT16 VendorId;\r
326 UINT16 DeviceId;\r
327\r
328 UINT16 Command;\r
329 UINT16 Status;\r
330\r
331 UINT8 RevisionId;\r
332 UINT8 ClassCode[3];\r
333\r
334 UINT8 CacheLineSize;\r
335 UINT8 PrimaryLatencyTimer;\r
336 UINT8 HeaderType;\r
337 UINT8 BIST;\r
338\r
339} PCI_COMMON_HEADER;\r
340\r
341//\r
342// PCI configuration space header for devices(after the common part)\r
343//\r
344typedef struct {\r
345 UINT32 Bar[6]; // Base Address Registers\r
346 UINT32 CardBusCISPtr; // CardBus CIS Pointer\r
347 UINT16 SubVendorId; // Subsystem Vendor ID\r
348 UINT16 SubSystemId; // Subsystem ID\r
349 UINT32 ROMBar; // Expansion ROM Base Address\r
350 UINT8 CapabilitiesPtr; // Capabilities Pointer\r
351 UINT8 Reserved[3];\r
352\r
353 UINT32 Reserved1;\r
354\r
355 UINT8 InterruptLine; // Interrupt Line\r
356 UINT8 InterruptPin; // Interrupt Pin\r
357 UINT8 MinGnt; // Min_Gnt\r
358 UINT8 MaxLat; // Max_Lat\r
359} PCI_DEVICE_HEADER;\r
360\r
361//\r
362// PCI configuration space header for pci-to-pci bridges(after the common part)\r
363//\r
364typedef struct {\r
365 UINT32 Bar[2]; // Base Address Registers\r
366 UINT8 PrimaryBus; // Primary Bus Number\r
367 UINT8 SecondaryBus; // Secondary Bus Number\r
368 UINT8 SubordinateBus; // Subordinate Bus Number\r
369 UINT8 SecondaryLatencyTimer; // Secondary Latency Timer\r
370 UINT8 IoBase; // I/O Base\r
371 UINT8 IoLimit; // I/O Limit\r
372 UINT16 SecondaryStatus; // Secondary Status\r
373 UINT16 MemoryBase; // Memory Base\r
374 UINT16 MemoryLimit; // Memory Limit\r
375 UINT16 PrefetchableMemBase; // Pre-fetchable Memory Base\r
376 UINT16 PrefetchableMemLimit; // Pre-fetchable Memory Limit\r
377 UINT32 PrefetchableBaseUpper; // Pre-fetchable Base Upper 32 bits\r
378 UINT32 PrefetchableLimitUpper; // Pre-fetchable Limit Upper 32 bits\r
379 UINT16 IoBaseUpper; // I/O Base Upper 16 bits\r
380 UINT16 IoLimitUpper; // I/O Limit Upper 16 bits\r
381 UINT8 CapabilitiesPtr; // Capabilities Pointer\r
382 UINT8 Reserved[3];\r
383\r
384 UINT32 ROMBar; // Expansion ROM Base Address\r
385 UINT8 InterruptLine; // Interrupt Line\r
386 UINT8 InterruptPin; // Interrupt Pin\r
387 UINT16 BridgeControl; // Bridge Control\r
388} PCI_BRIDGE_HEADER;\r
389\r
390//\r
391// PCI configuration space header for cardbus bridges(after the common part)\r
392//\r
393typedef struct {\r
394 UINT32 CardBusSocketReg; // Cardus Socket/ExCA Base\r
395 // Address Register\r
396 //\r
397 UINT8 CapabilitiesPtr; // 14h in pci-cardbus bridge.\r
398 UINT8 Reserved;\r
399 UINT16 SecondaryStatus; // Secondary Status\r
400 UINT8 PciBusNumber; // PCI Bus Number\r
401 UINT8 CardBusBusNumber; // CardBus Bus Number\r
402 UINT8 SubordinateBusNumber; // Subordinate Bus Number\r
403 UINT8 CardBusLatencyTimer; // CardBus Latency Timer\r
404 UINT32 MemoryBase0; // Memory Base Register 0\r
405 UINT32 MemoryLimit0; // Memory Limit Register 0\r
406 UINT32 MemoryBase1;\r
407 UINT32 MemoryLimit1;\r
408 UINT32 IoBase0;\r
409 UINT32 IoLimit0; // I/O Base Register 0\r
410 UINT32 IoBase1; // I/O Limit Register 0\r
411 UINT32 IoLimit1;\r
412\r
413 UINT8 InterruptLine; // Interrupt Line\r
414 UINT8 InterruptPin; // Interrupt Pin\r
415 UINT16 BridgeControl; // Bridge Control\r
416} PCI_CARDBUS_HEADER;\r
417\r
418//\r
419// Data region after PCI configuration header(for cardbus bridge)\r
420//\r
421typedef struct {\r
422 UINT16 SubVendorId; // Subsystem Vendor ID\r
423 UINT16 SubSystemId; // Subsystem ID\r
424 UINT32 LegacyBase; // Optional 16-Bit PC Card Legacy\r
425 // Mode Base Address\r
426 //\r
427 UINT32 Data[46];\r
428} PCI_CARDBUS_DATA;\r
429\r
430typedef struct {\r
431 PCI_COMMON_HEADER Common;\r
432 union {\r
433 PCI_DEVICE_HEADER Device;\r
434 PCI_BRIDGE_HEADER Bridge;\r
435 PCI_CARDBUS_HEADER CardBus;\r
436 } NonCommon;\r
437 UINT32 Data[48];\r
438} PCI_CONFIG_SPACE;\r
439\r
440typedef struct {\r
441 UINT8 PcieCapId;\r
442 UINT8 NextCapPtr;\r
443 UINT16 PcieCapReg;\r
444 UINT32 PcieDeviceCap;\r
445 UINT16 DeviceControl;\r
446 UINT16 DeviceStatus;\r
447 UINT32 LinkCap;\r
448 UINT16 LinkControl;\r
449 UINT16 LinkStatus;\r
450 UINT32 SlotCap;\r
451 UINT16 SlotControl;\r
452 UINT16 SlotStatus;\r
453 UINT16 RsvdP;\r
454 UINT16 RootControl;\r
455 UINT32 RootStatus;\r
456} PCIE_CAP_STURCTURE;\r
457\r
458#pragma pack()\r
459\r
460#endif // _PCI_H_\r