]> git.proxmox.com Git - mirror_edk2.git/blob - ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.h
ShellPkg/Dp: Add null pointer check
[mirror_edk2.git] / ShellPkg / Library / UefiShellDebug1CommandsLib / Pci.h
1 /** @file
2 Header file for Pci shell Debug1 function.
3
4 Copyright (c) 2013 Hewlett-Packard Development Company, L.P.
5 Copyright (c) 2005 - 2017, Intel Corporation. All rights reserved.<BR>
6 This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
10
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13
14 **/
15
16 #ifndef _EFI_SHELL_PCI_H_
17 #define _EFI_SHELL_PCI_H_
18
19 typedef enum {
20 PciDevice,
21 PciP2pBridge,
22 PciCardBusBridge,
23 PciUndefined
24 } PCI_HEADER_TYPE;
25
26 #define INDEX_OF(Field) ((UINT8 *) (Field) - (UINT8 *) mConfigSpace)
27
28 #define IS_PCIE_ENDPOINT(DevicePortType) \
29 ((DevicePortType) == PCIE_DEVICE_PORT_TYPE_PCIE_ENDPOINT || \
30 (DevicePortType) == PCIE_DEVICE_PORT_TYPE_LEGACY_PCIE_ENDPOINT || \
31 (DevicePortType) == PCIE_DEVICE_PORT_TYPE_ROOT_COMPLEX_INTEGRATED_ENDPOINT)
32
33 #define IS_PCIE_SWITCH(DevicePortType) \
34 ((DevicePortType == PCIE_DEVICE_PORT_TYPE_UPSTREAM_PORT) || \
35 (DevicePortType == PCIE_DEVICE_PORT_TYPE_DOWNSTREAM_PORT))
36
37 #pragma pack(1)
38 //
39 // Data region after PCI configuration header(for cardbus bridge)
40 //
41 typedef struct {
42 UINT16 SubVendorId; // Subsystem Vendor ID
43 UINT16 SubSystemId; // Subsystem ID
44 UINT32 LegacyBase; // Optional 16-Bit PC Card Legacy
45 // Mode Base Address
46 //
47 UINT32 Data[46];
48 } PCI_CARDBUS_DATA;
49
50 typedef union {
51 PCI_DEVICE_HEADER_TYPE_REGION Device;
52 PCI_BRIDGE_CONTROL_REGISTER Bridge;
53 PCI_CARDBUS_CONTROL_REGISTER CardBus;
54 } NON_COMMON_UNION;
55
56 typedef struct {
57 PCI_DEVICE_INDEPENDENT_REGION Common;
58 NON_COMMON_UNION NonCommon;
59 UINT32 Data[48];
60 } PCI_CONFIG_SPACE;
61
62 #pragma pack()
63
64 #endif // _PCI_H_