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