]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Ppi/PciCfg2.h
Refine version info in MDE file header.
[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
7 Copyright (c) 2006 - 2008, 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
0c7f62f8 24#include <Pi/PiPeiCis.h>\r
5879b875 25\r
26#define EFI_PEI_PCI_CFG2_PPI_GUID \\r
27 { 0x57a449a, 0x1fdc, 0x4c06, { 0xbf, 0xc9, 0xf5, 0x3f, 0x6a, 0x99, 0xbb, 0x92 } }\r
28\r
29\r
30typedef struct _EFI_PEI_PCI_CFG2_PPI EFI_PEI_PCI_CFG2_PPI;\r
31\r
32#define EFI_PEI_PCI_CFG_ADDRESS(bus,dev,func,reg) \\r
33 (((bus) << 24) | \\r
34 ((dev) << 16) | \\r
35 ((func) << 8) | \\r
8b13229b 36 ((reg) < 256 ? (reg) : ((UINT64)(reg) << 32)));\r
5879b875 37\r
06889842 38///\r
39/// EFI_PEI_PCI_CFG_PPI_WIDTH\r
40///\r
5879b875 41typedef enum {\r
42 EfiPeiPciCfgWidthUint8 = 0,\r
43 EfiPeiPciCfgWidthUint16 = 1,\r
44 EfiPeiPciCfgWidthUint32 = 2,\r
45 EfiPeiPciCfgWidthUint64 = 3,\r
46 EfiPeiPciCfgWidthMaximum\r
47} EFI_PEI_PCI_CFG_PPI_WIDTH;\r
48\r
06889842 49///\r
50/// EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS\r
51///\r
5879b875 52typedef struct {\r
11227adb 53 ///\r
54 /// 8-bit register offset within the PCI configuration space for a given device's function\r
55 /// space.\r
56 ///\r
5879b875 57 UINT8 Register;\r
11227adb 58 ///\r
59 /// Only the 3 least-significant bits are used to encode one of 8 possible functions within a\r
60 /// given device.\r
61 ///\r
5879b875 62 UINT8 Function;\r
11227adb 63 ///\r
64 /// Only the 5 least-significant bits are used to encode one of 32 possible devices.\r
65 ///\r
5879b875 66 UINT8 Device;\r
11227adb 67 ///\r
68 /// 8-bit value to encode between 0 and 255 buses.\r
69 ///\r
5879b875 70 UINT8 Bus;\r
11227adb 71 ///\r
72 /// Register number in PCI configuration space. If this field is zero, then Register is used\r
73 /// for the register number. If this field is non-zero, then Register is ignored and this field\r
74 /// is used for the register number.\r
75 ///\r
5879b875 76 UINT32 ExtendedRegister;\r
77} EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS;\r
78\r
79/**\r
80 Reads from or write to a given location in the PCI configuration space.\r
81\r
82 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.\r
83\r
84 @param This Pointer to local data for the interface.\r
85\r
845effb3 86 @param Width The width of the access. Enumerated in bytes.\r
5879b875 87 See EFI_PEI_PCI_CFG_PPI_WIDTH above.\r
88\r
845effb3 89 @param Address The physical address of the access. The format of\r
5879b875 90 the address is described by EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS.\r
91\r
92 @param Buffer A pointer to the buffer of data..\r
93\r
94\r
95 @retval EFI_SUCCESS The function completed successfully.\r
96\r
97 @retval EFI_DEVICE_ERROR There was a problem with the transaction.\r
98\r
99 @retval EFI_DEVICE_NOT_READY The device is not capable of supporting the operation at this\r
100 time.\r
101\r
102**/\r
103typedef\r
104EFI_STATUS\r
8b13229b 105(EFIAPI *EFI_PEI_PCI_CFG2_PPI_IO)(\r
00edb218
A
106 IN CONST EFI_PEI_SERVICES **PeiServices,\r
107 IN CONST EFI_PEI_PCI_CFG2_PPI *This,\r
ef4fa1a4 108 IN EFI_PEI_PCI_CFG_PPI_WIDTH Width,\r
109 IN UINT64 Address,\r
5879b875 110 IN OUT VOID *Buffer\r
111);\r
112\r
113\r
114/**\r
d7132512
LG
115 Performs a read-modify-write operation on the contents \r
116 from a given location in the PCI configuration space.\r
5879b875 117\r
845effb3 118 @param PeiServices An indirect pointer to the PEI Services Table\r
5879b875 119 published by the PEI Foundation.\r
120\r
121 @param This Pointer to local data for the interface.\r
122\r
123 @param Width The width of the access. Enumerated in bytes. Type\r
124 EFI_PEI_PCI_CFG_PPI_WIDTH is defined in Read().\r
125\r
126 @param Address The physical address of the access.\r
127\r
845effb3 128 @param SetBits Points to value to bitwise-OR with the read configuration value.\r
5879b875 129\r
130 The size of the value is determined by Width.\r
131\r
845effb3 132 @param ClearBits Points to the value to negate and bitwise-AND with the read configuration value.\r
5879b875 133 The size of the value is determined by Width.\r
134\r
135\r
136 @retval EFI_SUCCESS The function completed successfully.\r
137\r
138 @retval EFI_DEVICE_ERROR There was a problem with the transaction.\r
139\r
845effb3 140 @retval EFI_DEVICE_NOT_READY The device is not capable of supporting\r
5879b875 141 the operation at this time.\r
142\r
143**/\r
144typedef\r
145EFI_STATUS\r
8b13229b 146(EFIAPI *EFI_PEI_PCI_CFG2_PPI_RW)(\r
5879b875 147 IN CONST EFI_PEI_SERVICES **PeiServices,\r
148 IN CONST EFI_PEI_PCI_CFG2_PPI *This,\r
ef4fa1a4 149 IN EFI_PEI_PCI_CFG_PPI_WIDTH Width,\r
150 IN UINT64 Address,\r
11227adb 151 IN VOID *SetBits,\r
152 IN VOID *ClearBits\r
5879b875 153);\r
154\r
44717a39 155///\r
156/// The EFI_PEI_PCI_CFG_PPI interfaces are used to abstract accesses to PCI\r
157/// controllers behind a PCI root bridge controller.\r
158///\r
5879b875 159struct _EFI_PEI_PCI_CFG2_PPI {\r
845effb3 160 EFI_PEI_PCI_CFG2_PPI_IO Read;\r
161 EFI_PEI_PCI_CFG2_PPI_IO Write;\r
162 EFI_PEI_PCI_CFG2_PPI_RW Modify;\r
44717a39 163 ///\r
164 /// The PCI bus segment which the specified functions will access.\r
165 ///\r
5879b875 166 UINT16 Segment;\r
167};\r
168\r
169\r
170extern EFI_GUID gEfiPciCfg2PpiGuid;\r
171\r
172#endif\r