]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Protocol/PciHotPlugInit.h
MdePkg: Apply uncrustify changes
[mirror_edk2.git] / MdePkg / Include / Protocol / PciHotPlugInit.h
CommitLineData
73c31a3d 1/** @file\r
2 This file declares EFI PCI Hot Plug Init Protocol.\r
9095d37b
LG
3\r
4 This protocol provides the necessary functionality to initialize the Hot Plug\r
5 Controllers (HPCs) and the buses that they control. This protocol also provides\r
73c31a3d 6 information regarding resource padding.\r
9095d37b
LG
7\r
8 @par Note:\r
73c31a3d 9 This protocol is required only on platforms that support one or more PCI Hot\r
9095d37b 10 Plug* slots or CardBus sockets.\r
73c31a3d 11\r
12 The EFI_PCI_HOT_PLUG_INIT_PROTOCOL provides a mechanism for the PCI bus enumerator\r
9095d37b
LG
13 to properly initialize the HPCs and CardBus sockets that require initialization.\r
14 The HPC initialization takes place before the PCI enumeration process is complete.\r
15 There cannot be more than one instance of this protocol in a system. This protocol\r
16 is installed on its own separate handle.\r
17\r
18 Because the system may include multiple HPCs, one instance of this protocol\r
19 should represent all of them. The protocol functions use the device path of\r
20 the HPC to identify the HPC. When the PCI bus enumerator finds a root HPC, it\r
73c31a3d 21 will call EFI_PCI_HOT_PLUG_INIT_PROTOCOL.InitializeRootHpc(). If InitializeRootHpc()\r
9095d37b
LG
22 is unable to initialize a root HPC, the PCI enumerator will ignore that root HPC\r
23 and continue the enumeration process. If the HPC is not initialized, the devices\r
73c31a3d 24 that it controls may not be initialized, and no resource padding will be provided.\r
25\r
9095d37b 26 From the standpoint of the PCI bus enumerator, HPCs are divided into the following\r
73c31a3d 27 two classes:\r
28\r
29 - Root HPC:\r
9095d37b
LG
30 These HPCs must be initialized by calling InitializeRootHpc() during the\r
31 enumeration process. These HPCs will also require resource padding. The\r
32 platform code must have a priori knowledge of these devices and must know\r
33 how to initialize them. There may not be any way to access their PCI\r
73c31a3d 34 configuration space before the PCI enumerator programs all the upstream\r
9095d37b
LG
35 bridges and thus enables the path to these devices. The PCI bus enumerator\r
36 is responsible for determining the PCI bus address of the HPC before it\r
73c31a3d 37 calls InitializeRootHpc().\r
38 - Nonroot HPC:\r
9095d37b
LG
39 These HPCs will not need explicit initialization during enumeration process.\r
40 These HPCs will require resource padding. The platform code does not have\r
73c31a3d 41 to have a priori knowledge of these devices.\r
42\r
9095d37b 43 Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>\r
9344f092 44 SPDX-License-Identifier: BSD-2-Clause-Patent\r
73c31a3d 45\r
46 @par Revision Reference:\r
9095d37b 47 This Protocol is defined in UEFI Platform Initialization Specification 1.2\r
73c31a3d 48 Volume 5: Standards\r
49\r
50**/\r
51\r
52#ifndef _EFI_PCI_HOT_PLUG_INIT_H_\r
53#define _EFI_PCI_HOT_PLUG_INIT_H_\r
54\r
55///\r
56/// Global ID for the EFI_PCI_HOT_PLUG_INIT_PROTOCOL\r
57///\r
58#define EFI_PCI_HOT_PLUG_INIT_PROTOCOL_GUID \\r
59 { \\r
60 0xaa0e8bc1, 0xdabc, 0x46b0, {0xa8, 0x44, 0x37, 0xb8, 0x16, 0x9b, 0x2b, 0xea } \\r
61 }\r
62\r
63///\r
64/// Forward declaration for EFI_PCI_HOT_PLUG_INIT_PROTOCOL\r
65///\r
66typedef struct _EFI_PCI_HOT_PLUG_INIT_PROTOCOL EFI_PCI_HOT_PLUG_INIT_PROTOCOL;\r
67\r
68///\r
69/// Describes the current state of an HPC\r
70///\r
71typedef UINT16 EFI_HPC_STATE;\r
72\r
73///\r
9095d37b
LG
74/// The HPC initialization function was called and the HPC completed\r
75/// initialization, but it was not enabled for some reason. The HPC may be\r
76/// disabled in hardware, or it may be disabled due to user preferences,\r
73c31a3d 77/// hardware failure, or other reasons. No resource padding is required.\r
78///\r
2f88bd3a 79#define EFI_HPC_STATE_INITIALIZED 0x01\r
73c31a3d 80\r
81///\r
9095d37b 82/// The HPC initialization function was called, the HPC completed\r
73c31a3d 83/// initialization, and it was enabled. Resource padding is required.\r
84///\r
2f88bd3a 85#define EFI_HPC_STATE_ENABLED 0x02\r
73c31a3d 86\r
87///\r
88/// Location definition for PCI Hot Plug Controller\r
89///\r
2f88bd3a 90typedef struct {\r
73c31a3d 91 ///\r
9095d37b 92 ///\r
73c31a3d 93 /// The device path to the root HPC. An HPC cannot control its parent buses.\r
9095d37b
LG
94 /// The PCI bus driver requires this information so that it can pass the\r
95 /// correct HpcPciAddress to the InitializeRootHpc() and GetResourcePadding()\r
96 /// functions.\r
73c31a3d 97 ///\r
2f88bd3a 98 EFI_DEVICE_PATH_PROTOCOL *HpcDevicePath;\r
73c31a3d 99 ///\r
9095d37b
LG
100 /// The device path to the Hot Plug Bus (HPB) that is controlled by the root\r
101 /// HPC. The PCI bus driver uses this information to check if a particular PCI\r
102 /// bus has hot-plug slots. The device path of a PCI bus is the same as the\r
103 /// device path of its parent. For Standard(PCI) Hot Plug Controllers (SHPCs)\r
73c31a3d 104 /// and PCI Express*, HpbDevicePath is the same as HpcDevicePath.\r
105 ///\r
2f88bd3a 106 EFI_DEVICE_PATH_PROTOCOL *HpbDevicePath;\r
73c31a3d 107} EFI_HPC_LOCATION;\r
108\r
109///\r
110/// Describes how resource padding should be applied\r
111///\r
112typedef enum {\r
113 ///\r
114 /// Apply the padding at a PCI bus level. In other words, the resources\r
115 /// that are allocated to the bus containing hot-plug slots are padded by\r
116 /// the specified amount. If the hot-plug bus is behind a PCI-to-PCI\r
117 /// bridge, the PCI-to-PCI bridge apertures will indicate the padding\r
118 ///\r
119 EfiPaddingPciBus,\r
120 ///\r
121 /// Apply the padding at a PCI root bridge level. If a PCI root bridge\r
122 /// includes more than one hot-plug bus, the resource padding requests\r
123 /// for these buses are added together and the resources that are\r
124 /// allocated to the root bridge are padded by the specified amount. This\r
125 /// strategy may reduce the total amount of padding, but requires\r
126 /// reprogramming of PCI-to-PCI bridges in a hot-add event. If the hotplug\r
127 /// bus is behind a PCI-to-PCI bridge, the PCI-to-PCI bridge\r
9095d37b 128 /// apertures do not indicate the padding for that bus.\r
73c31a3d 129 ///\r
130 EfiPaddingPciRootBridge\r
131} EFI_HPC_PADDING_ATTRIBUTES;\r
132\r
133/**\r
134 Returns a list of root Hot Plug Controllers (HPCs) that require initialization\r
135 during the boot process.\r
136\r
9095d37b
LG
137 This procedure returns a list of root HPCs. The PCI bus driver must initialize\r
138 these controllers during the boot process. The PCI bus driver may or may not be\r
139 able to detect these HPCs. If the platform includes a PCI-to-CardBus bridge, it\r
140 can be included in this list if it requires initialization. The HpcList must be\r
141 self consistent. An HPC cannot control any of its parent buses. Only one HPC can\r
142 control a PCI bus. Because this list includes only root HPCs, no HPC in the list\r
143 can be a child of another HPC. This policy must be enforced by the\r
144 EFI_PCI_HOT_PLUG_INIT_PROTOCOL. The PCI bus driver may not check for such\r
73c31a3d 145 invalid conditions. The callee allocates the buffer HpcList\r
146\r
147 @param[in] This Pointer to the EFI_PCI_HOT_PLUG_INIT_PROTOCOL instance.\r
148 @param[out] HpcCount The number of root HPCs that were returned.\r
149 @param[out] HpcList The list of root HPCs. HpcCount defines the number of\r
150 elements in this list.\r
151\r
152 @retval EFI_SUCCESS HpcList was returned.\r
9095d37b 153 @retval EFI_OUT_OF_RESOURCES HpcList was not returned due to insufficient\r
73c31a3d 154 resources.\r
155 @retval EFI_INVALID_PARAMETER HpcCount is NULL or HpcList is NULL.\r
156\r
157**/\r
158typedef\r
159EFI_STATUS\r
160(EFIAPI *EFI_GET_ROOT_HPC_LIST)(\r
161 IN EFI_PCI_HOT_PLUG_INIT_PROTOCOL *This,\r
162 OUT UINTN *HpcCount,\r
163 OUT EFI_HPC_LOCATION **HpcList\r
164 );\r
165\r
166/**\r
167 Initializes one root Hot Plug Controller (HPC). This process may causes\r
168 initialization of its subordinate buses.\r
9095d37b
LG
169\r
170 This function initializes the specified HPC. At the end of initialization,\r
171 the hot-plug slots or sockets (controlled by this HPC) are powered and are\r
172 connected to the bus. All the necessary registers in the HPC are set up. For\r
173 a Standard (PCI) Hot Plug Controller (SHPC), the registers that must be set\r
174 up are defined in the PCI Standard Hot Plug Controller and Subsystem\r
175 Specification.\r
73c31a3d 176\r
177 @param[in] This Pointer to the EFI_PCI_HOT_PLUG_INIT_PROTOCOL instance.\r
178 @param[in] HpcDevicePath The device path to the HPC that is being initialized.\r
179 @param[in] HpcPciAddress The address of the HPC function on the PCI bus.\r
9095d37b
LG
180 @param[in] Event The event that should be signaled when the HPC\r
181 initialization is complete. Set to NULL if the\r
182 caller wants to wait until the entire initialization\r
73c31a3d 183 process is complete.\r
9095d37b 184 @param[out] HpcState The state of the HPC hardware. The state is\r
73c31a3d 185 EFI_HPC_STATE_INITIALIZED or EFI_HPC_STATE_ENABLED.\r
186\r
187 @retval EFI_SUCCESS If Event is NULL, the specific HPC was successfully\r
9095d37b 188 initialized. If Event is not NULL, Event will be\r
73c31a3d 189 signaled at a later time when initialization is complete.\r
190 @retval EFI_UNSUPPORTED This instance of EFI_PCI_HOT_PLUG_INIT_PROTOCOL\r
191 does not support the specified HPC.\r
192 @retval EFI_OUT_OF_RESOURCES Initialization failed due to insufficient\r
193 resources.\r
194 @retval EFI_INVALID_PARAMETER HpcState is NULL.\r
195\r
196**/\r
197typedef\r
198EFI_STATUS\r
199(EFIAPI *EFI_INITIALIZE_ROOT_HPC)(\r
200 IN EFI_PCI_HOT_PLUG_INIT_PROTOCOL *This,\r
201 IN EFI_DEVICE_PATH_PROTOCOL *HpcDevicePath,\r
202 IN UINT64 HpcPciAddress,\r
d0e2f823 203 IN EFI_EVENT Event OPTIONAL,\r
73c31a3d 204 OUT EFI_HPC_STATE *HpcState\r
205 );\r
206\r
207/**\r
208 Returns the resource padding that is required by the PCI bus that is controlled\r
209 by the specified Hot Plug Controller (HPC).\r
210\r
211 This function returns the resource padding that is required by the PCI bus that\r
9095d37b
LG
212 is controlled by the specified HPC. This member function is called for all the\r
213 root HPCs and nonroot HPCs that are detected by the PCI bus enumerator. This\r
214 function will be called before PCI resource allocation is completed. This function\r
215 must be called after all the root HPCs, with the possible exception of a\r
73c31a3d 216 PCI-to-CardBus bridge, have completed initialization.\r
217\r
218 @param[in] This Pointer to the EFI_PCI_HOT_PLUG_INIT_PROTOCOL instance.\r
219 @param[in] HpcDevicePath The device path to the HPC.\r
220 @param[in] HpcPciAddress The address of the HPC function on the PCI bus.\r
221 @param[in] HpcState The state of the HPC hardware.\r
222 @param[out] Padding The amount of resource padding that is required by the\r
223 PCI bus under the control of the specified HPC.\r
224 @param[out] Attributes Describes how padding is accounted for. The padding\r
225 is returned in the form of ACPI 2.0 resource descriptors.\r
226\r
227 @retval EFI_SUCCESS The resource padding was successfully returned.\r
228 @retval EFI_UNSUPPORTED This instance of the EFI_PCI_HOT_PLUG_INIT_PROTOCOL\r
229 does not support the specified HPC.\r
230 @retval EFI_NOT_READY This function was called before HPC initialization\r
231 is complete.\r
232 @retval EFI_INVALID_PARAMETER HpcState or Padding or Attributes is NULL.\r
233 @retval EFI_OUT_OF_RESOURCES ACPI 2.0 resource descriptors for Padding\r
234 cannot be allocated due to insufficient resources.\r
235\r
236**/\r
237typedef\r
238EFI_STATUS\r
239(EFIAPI *EFI_GET_HOT_PLUG_PADDING)(\r
240 IN EFI_PCI_HOT_PLUG_INIT_PROTOCOL *This,\r
241 IN EFI_DEVICE_PATH_PROTOCOL *HpcDevicePath,\r
242 IN UINT64 HpcPciAddress,\r
243 OUT EFI_HPC_STATE *HpcState,\r
244 OUT VOID **Padding,\r
245 OUT EFI_HPC_PADDING_ATTRIBUTES *Attributes\r
246 );\r
247\r
248///\r
249/// This protocol provides the necessary functionality to initialize the\r
250/// Hot Plug Controllers (HPCs) and the buses that they control. This protocol\r
251/// also provides information regarding resource padding.\r
252///\r
253struct _EFI_PCI_HOT_PLUG_INIT_PROTOCOL {\r
254 ///\r
255 /// Returns a list of root HPCs and the buses that they control.\r
256 ///\r
2f88bd3a 257 EFI_GET_ROOT_HPC_LIST GetRootHpcList;\r
9095d37b 258\r
73c31a3d 259 ///\r
260 /// Initializes the specified root HPC.\r
261 ///\r
2f88bd3a 262 EFI_INITIALIZE_ROOT_HPC InitializeRootHpc;\r
9095d37b 263\r
73c31a3d 264 ///\r
265 /// Returns the resource padding that is required by the HPC.\r
266 ///\r
2f88bd3a 267 EFI_GET_HOT_PLUG_PADDING GetResourcePadding;\r
73c31a3d 268};\r
269\r
2f88bd3a 270extern EFI_GUID gEfiPciHotPlugInitProtocolGuid;\r
73c31a3d 271\r
272#endif\r