]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Ppi/PciCfg2.h
1. Clean up MdePkg internal header files
[mirror_edk2.git] / MdePkg / Include / Ppi / PciCfg2.h
CommitLineData
5879b875 1/** @file\r
d7132512 2 This file declares PciCfg2 PPI.\r
5879b875 3\r
d7132512
LG
4 This ppi Provides platform or chipset-specific access to \r
5 the PCI configuration space for a specific PCI segment.\r
6\r
d7dfd027 7 Copyright (c) 2006 - 2009, Intel Corporation\r
845effb3 8 All rights reserved. This program and the accompanying materials\r
9 are licensed and made available under the terms and conditions of the BSD License\r
10 which accompanies this distribution. The full text of the license may be found at\r
11 http://opensource.org/licenses/bsd-license.php\r
5879b875 12\r
845effb3 13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
14 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
5879b875 15\r
5879b875 16 @par Revision Reference:\r
0047820e 17 This PPI is introduced in PI Version 1.0.\r
5879b875 18\r
19**/\r
20\r
21#ifndef __PEI_PCI_CFG2_H__\r
22#define __PEI_PCI_CFG2_H__\r
23\r
5879b875 24#define EFI_PEI_PCI_CFG2_PPI_GUID \\r
25 { 0x57a449a, 0x1fdc, 0x4c06, { 0xbf, 0xc9, 0xf5, 0x3f, 0x6a, 0x99, 0xbb, 0x92 } }\r
26\r
27\r
28typedef struct _EFI_PEI_PCI_CFG2_PPI EFI_PEI_PCI_CFG2_PPI;\r
29\r
30#define EFI_PEI_PCI_CFG_ADDRESS(bus,dev,func,reg) \\r
31 (((bus) << 24) | \\r
32 ((dev) << 16) | \\r
33 ((func) << 8) | \\r
8b13229b 34 ((reg) < 256 ? (reg) : ((UINT64)(reg) << 32)));\r
5879b875 35\r
06889842 36///\r
37/// EFI_PEI_PCI_CFG_PPI_WIDTH\r
38///\r
5879b875 39typedef enum {\r
97c4afff 40 ///\r
41 /// 8-bit access\r
42 ///\r
5879b875 43 EfiPeiPciCfgWidthUint8 = 0,\r
97c4afff 44 ///\r
45 /// 16-bit access\r
46 ///\r
5879b875 47 EfiPeiPciCfgWidthUint16 = 1,\r
97c4afff 48 ///\r
49 /// 32-bit access\r
50 ///\r
5879b875 51 EfiPeiPciCfgWidthUint32 = 2,\r
97c4afff 52 ///\r
53 /// 64-bit access\r
54 ///\r
5879b875 55 EfiPeiPciCfgWidthUint64 = 3,\r
56 EfiPeiPciCfgWidthMaximum\r
57} EFI_PEI_PCI_CFG_PPI_WIDTH;\r
58\r
06889842 59///\r
60/// EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS\r
61///\r
5879b875 62typedef struct {\r
11227adb 63 ///\r
64 /// 8-bit register offset within the PCI configuration space for a given device's function\r
65 /// space.\r
66 ///\r
5879b875 67 UINT8 Register;\r
11227adb 68 ///\r
69 /// Only the 3 least-significant bits are used to encode one of 8 possible functions within a\r
70 /// given device.\r
71 ///\r
5879b875 72 UINT8 Function;\r
11227adb 73 ///\r
74 /// Only the 5 least-significant bits are used to encode one of 32 possible devices.\r
75 ///\r
5879b875 76 UINT8 Device;\r
11227adb 77 ///\r
78 /// 8-bit value to encode between 0 and 255 buses.\r
79 ///\r
5879b875 80 UINT8 Bus;\r
11227adb 81 ///\r
82 /// Register number in PCI configuration space. If this field is zero, then Register is used\r
83 /// for the register number. If this field is non-zero, then Register is ignored and this field\r
84 /// is used for the register number.\r
85 ///\r
5879b875 86 UINT32 ExtendedRegister;\r
87} EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS;\r
88\r
89/**\r
90 Reads from or write to a given location in the PCI configuration space.\r
91\r
92 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.\r
93\r
94 @param This Pointer to local data for the interface.\r
95\r
845effb3 96 @param Width The width of the access. Enumerated in bytes.\r
5879b875 97 See EFI_PEI_PCI_CFG_PPI_WIDTH above.\r
98\r
845effb3 99 @param Address The physical address of the access. The format of\r
5879b875 100 the address is described by EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS.\r
101\r
102 @param Buffer A pointer to the buffer of data..\r
103\r
104\r
105 @retval EFI_SUCCESS The function completed successfully.\r
106\r
107 @retval EFI_DEVICE_ERROR There was a problem with the transaction.\r
108\r
109 @retval EFI_DEVICE_NOT_READY The device is not capable of supporting the operation at this\r
110 time.\r
111\r
112**/\r
113typedef\r
114EFI_STATUS\r
8b13229b 115(EFIAPI *EFI_PEI_PCI_CFG2_PPI_IO)(\r
00edb218
A
116 IN CONST EFI_PEI_SERVICES **PeiServices,\r
117 IN CONST EFI_PEI_PCI_CFG2_PPI *This,\r
ef4fa1a4 118 IN EFI_PEI_PCI_CFG_PPI_WIDTH Width,\r
119 IN UINT64 Address,\r
5879b875 120 IN OUT VOID *Buffer\r
121);\r
122\r
123\r
124/**\r
d7132512
LG
125 Performs a read-modify-write operation on the contents \r
126 from a given location in the PCI configuration space.\r
5879b875 127\r
845effb3 128 @param PeiServices An indirect pointer to the PEI Services Table\r
5879b875 129 published by the PEI Foundation.\r
130\r
131 @param This Pointer to local data for the interface.\r
132\r
133 @param Width The width of the access. Enumerated in bytes. Type\r
134 EFI_PEI_PCI_CFG_PPI_WIDTH is defined in Read().\r
135\r
136 @param Address The physical address of the access.\r
137\r
845effb3 138 @param SetBits Points to value to bitwise-OR with the read configuration value.\r
5879b875 139\r
140 The size of the value is determined by Width.\r
141\r
845effb3 142 @param ClearBits Points to the value to negate and bitwise-AND with the read configuration value.\r
5879b875 143 The size of the value is determined by Width.\r
144\r
145\r
146 @retval EFI_SUCCESS The function completed successfully.\r
147\r
148 @retval EFI_DEVICE_ERROR There was a problem with the transaction.\r
149\r
845effb3 150 @retval EFI_DEVICE_NOT_READY The device is not capable of supporting\r
5879b875 151 the operation at this time.\r
152\r
153**/\r
154typedef\r
155EFI_STATUS\r
8b13229b 156(EFIAPI *EFI_PEI_PCI_CFG2_PPI_RW)(\r
5879b875 157 IN CONST EFI_PEI_SERVICES **PeiServices,\r
158 IN CONST EFI_PEI_PCI_CFG2_PPI *This,\r
ef4fa1a4 159 IN EFI_PEI_PCI_CFG_PPI_WIDTH Width,\r
160 IN UINT64 Address,\r
11227adb 161 IN VOID *SetBits,\r
162 IN VOID *ClearBits\r
5879b875 163);\r
164\r
44717a39 165///\r
166/// The EFI_PEI_PCI_CFG_PPI interfaces are used to abstract accesses to PCI\r
167/// controllers behind a PCI root bridge controller.\r
168///\r
5879b875 169struct _EFI_PEI_PCI_CFG2_PPI {\r
845effb3 170 EFI_PEI_PCI_CFG2_PPI_IO Read;\r
171 EFI_PEI_PCI_CFG2_PPI_IO Write;\r
172 EFI_PEI_PCI_CFG2_PPI_RW Modify;\r
44717a39 173 ///\r
174 /// The PCI bus segment which the specified functions will access.\r
175 ///\r
5879b875 176 UINT16 Segment;\r
177};\r
178\r
179\r
180extern EFI_GUID gEfiPciCfg2PpiGuid;\r
181\r
182#endif\r