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