]> git.proxmox.com Git - mirror_edk2.git/blame_incremental - MdePkg/Library/PeiExtractGuidedSectionLib/PeiExtractGuidedSectionLib.c
MdePkg: Change OPTIONAL keyword usage style
[mirror_edk2.git] / MdePkg / Library / PeiExtractGuidedSectionLib / PeiExtractGuidedSectionLib.c
... / ...
CommitLineData
1/** @file\r
2 Provide generic extract guided section functions for PEI phase.\r
3\r
4 Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>\r
5 SPDX-License-Identifier: BSD-2-Clause-Patent\r
6\r
7**/\r
8\r
9#include <PiPei.h>\r
10\r
11#include <Library/DebugLib.h>\r
12#include <Library/PcdLib.h>\r
13#include <Library/BaseMemoryLib.h>\r
14#include <Library/HobLib.h>\r
15#include <Library/ExtractGuidedSectionLib.h>\r
16\r
17#define PEI_EXTRACT_HANDLER_INFO_SIGNATURE SIGNATURE_32 ('P', 'E', 'H', 'I')\r
18\r
19typedef struct {\r
20 UINT32 Signature;\r
21 UINT32 NumberOfExtractHandler;\r
22 GUID *ExtractHandlerGuidTable;\r
23 EXTRACT_GUIDED_SECTION_DECODE_HANDLER *ExtractDecodeHandlerTable;\r
24 EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER *ExtractGetInfoHandlerTable;\r
25} PEI_EXTRACT_GUIDED_SECTION_HANDLER_INFO;\r
26\r
27/**\r
28 Build guid hob for the global memory to store the registered guid and Handler list.\r
29 If GuidHob exists, HandlerInfo will be directly got from Guid hob data.\r
30\r
31 @param[in, out] InfoPointer The pointer to pei handler information structure.\r
32\r
33 @retval RETURN_SUCCESS Build Guid hob for the global memory space to store guid and function tables.\r
34 @retval RETURN_OUT_OF_RESOURCES No enough memory to allocated.\r
35**/\r
36RETURN_STATUS\r
37PeiGetExtractGuidedSectionHandlerInfo (\r
38 IN OUT PEI_EXTRACT_GUIDED_SECTION_HANDLER_INFO **InfoPointer\r
39 )\r
40{\r
41 PEI_EXTRACT_GUIDED_SECTION_HANDLER_INFO *HandlerInfo;\r
42 EFI_PEI_HOB_POINTERS Hob;\r
43\r
44 //\r
45 // First try to get handler information from guid hob specified by CallerId.\r
46 //\r
47 Hob.Raw = GetNextHob (EFI_HOB_TYPE_GUID_EXTENSION, GetHobList ());\r
48 while (Hob.Raw != NULL) {\r
49 if (CompareGuid (&(Hob.Guid->Name), &gEfiCallerIdGuid)) {\r
50 HandlerInfo = (PEI_EXTRACT_GUIDED_SECTION_HANDLER_INFO *) GET_GUID_HOB_DATA (Hob.Guid);\r
51 if (HandlerInfo->Signature == PEI_EXTRACT_HANDLER_INFO_SIGNATURE) {\r
52 //\r
53 // Update Table Pointer when hob start address is changed.\r
54 //\r
55 if (HandlerInfo->ExtractHandlerGuidTable != (GUID *) (HandlerInfo + 1)) {\r
56 HandlerInfo->ExtractHandlerGuidTable = (GUID *) (HandlerInfo + 1);\r
57 HandlerInfo->ExtractDecodeHandlerTable = (EXTRACT_GUIDED_SECTION_DECODE_HANDLER *) (\r
58 (UINT8 *)HandlerInfo->ExtractHandlerGuidTable +\r
59 PcdGet32 (PcdMaximumGuidedExtractHandler) * sizeof (GUID)\r
60 );\r
61 HandlerInfo->ExtractGetInfoHandlerTable = (EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER *) (\r
62 (UINT8 *)HandlerInfo->ExtractDecodeHandlerTable +\r
63 PcdGet32 (PcdMaximumGuidedExtractHandler) *\r
64 sizeof (EXTRACT_GUIDED_SECTION_DECODE_HANDLER)\r
65 );\r
66 }\r
67 //\r
68 // Return HandlerInfo pointer.\r
69 //\r
70 *InfoPointer = HandlerInfo;\r
71 return EFI_SUCCESS;\r
72 }\r
73 }\r
74 Hob.Raw = GET_NEXT_HOB (Hob);\r
75 Hob.Raw = GetNextHob (EFI_HOB_TYPE_GUID_EXTENSION, Hob.Raw);\r
76 }\r
77\r
78 //\r
79 // If Guid Hob is not found, Build CallerId Guid hob to store Handler Info\r
80 //\r
81 HandlerInfo = BuildGuidHob (\r
82 &gEfiCallerIdGuid,\r
83 sizeof (PEI_EXTRACT_GUIDED_SECTION_HANDLER_INFO) +\r
84 PcdGet32 (PcdMaximumGuidedExtractHandler) *\r
85 (sizeof (GUID) + sizeof (EXTRACT_GUIDED_SECTION_DECODE_HANDLER) + sizeof (EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER))\r
86 );\r
87 if (HandlerInfo == NULL) {\r
88 //\r
89 // No enough resource to build guid hob.\r
90 //\r
91 *InfoPointer = NULL;\r
92 return EFI_OUT_OF_RESOURCES;\r
93 }\r
94 //\r
95 // Init HandlerInfo structure\r
96 //\r
97 HandlerInfo->Signature = PEI_EXTRACT_HANDLER_INFO_SIGNATURE;\r
98 HandlerInfo->NumberOfExtractHandler = 0;\r
99 HandlerInfo->ExtractHandlerGuidTable = (GUID *) (HandlerInfo + 1);\r
100 HandlerInfo->ExtractDecodeHandlerTable = (EXTRACT_GUIDED_SECTION_DECODE_HANDLER *) (\r
101 (UINT8 *)HandlerInfo->ExtractHandlerGuidTable +\r
102 PcdGet32 (PcdMaximumGuidedExtractHandler) * sizeof (GUID)\r
103 );\r
104 HandlerInfo->ExtractGetInfoHandlerTable = (EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER *) (\r
105 (UINT8 *)HandlerInfo->ExtractDecodeHandlerTable +\r
106 PcdGet32 (PcdMaximumGuidedExtractHandler) *\r
107 sizeof (EXTRACT_GUIDED_SECTION_DECODE_HANDLER)\r
108 );\r
109 //\r
110 // return the created HandlerInfo.\r
111 //\r
112 *InfoPointer = HandlerInfo;\r
113 return EFI_SUCCESS;\r
114}\r
115\r
116/**\r
117 Retrieve the list GUIDs that have been registered through ExtractGuidedSectionRegisterHandlers().\r
118\r
119 Sets ExtractHandlerGuidTable so it points at a callee allocated array of registered GUIDs.\r
120 The total number of GUIDs in the array are returned. Since the array of GUIDs is callee allocated\r
121 and caller must treat this array of GUIDs as read-only data.\r
122 If ExtractHandlerGuidTable is NULL, then ASSERT().\r
123\r
124 @param[out] ExtractHandlerGuidTable A pointer to the array of GUIDs that have been registered through\r
125 ExtractGuidedSectionRegisterHandlers().\r
126\r
127 @return the number of the supported extract guided Handler.\r
128\r
129**/\r
130UINTN\r
131EFIAPI\r
132ExtractGuidedSectionGetGuidList (\r
133 OUT GUID **ExtractHandlerGuidTable\r
134 )\r
135{\r
136 EFI_STATUS Status;\r
137 PEI_EXTRACT_GUIDED_SECTION_HANDLER_INFO *HandlerInfo;\r
138\r
139 ASSERT (ExtractHandlerGuidTable != NULL);\r
140\r
141 //\r
142 // Get all registered handler information\r
143 //\r
144 Status = PeiGetExtractGuidedSectionHandlerInfo (&HandlerInfo);\r
145 if (EFI_ERROR (Status)) {\r
146 *ExtractHandlerGuidTable = NULL;\r
147 return 0;\r
148 }\r
149\r
150 //\r
151 // Get GuidTable and Table Number\r
152 //\r
153 ASSERT (HandlerInfo != NULL);\r
154 *ExtractHandlerGuidTable = HandlerInfo->ExtractHandlerGuidTable;\r
155 return HandlerInfo->NumberOfExtractHandler;\r
156}\r
157\r
158/**\r
159 Registers handlers of type EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER and EXTRACT_GUIDED_SECTION_DECODE_HANDLER\r
160 for a specific GUID section type.\r
161\r
162 Registers the handlers specified by GetInfoHandler and DecodeHandler with the GUID specified by SectionGuid.\r
163 If the GUID value specified by SectionGuid has already been registered, then return RETURN_ALREADY_STARTED.\r
164 If there are not enough resources available to register the handlers then RETURN_OUT_OF_RESOURCES is returned.\r
165\r
166 If SectionGuid is NULL, then ASSERT().\r
167 If GetInfoHandler is NULL, then ASSERT().\r
168 If DecodeHandler is NULL, then ASSERT().\r
169\r
170 @param[in] SectionGuid A pointer to the GUID associated with the the handlers\r
171 of the GUIDed section type being registered.\r
172 @param[in] GetInfoHandler The pointer to a function that examines a GUIDed section and returns the\r
173 size of the decoded buffer and the size of an optional scratch buffer\r
174 required to actually decode the data in a GUIDed section.\r
175 @param[in] DecodeHandler The pointer to a function that decodes a GUIDed section into a caller\r
176 allocated output buffer.\r
177\r
178 @retval RETURN_SUCCESS The handlers were registered.\r
179 @retval RETURN_OUT_OF_RESOURCES There are not enough resources available to register the handlers.\r
180\r
181**/\r
182RETURN_STATUS\r
183EFIAPI\r
184ExtractGuidedSectionRegisterHandlers (\r
185 IN CONST GUID *SectionGuid,\r
186 IN EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER GetInfoHandler,\r
187 IN EXTRACT_GUIDED_SECTION_DECODE_HANDLER DecodeHandler\r
188 )\r
189{\r
190 EFI_STATUS Status;\r
191 UINT32 Index;\r
192 PEI_EXTRACT_GUIDED_SECTION_HANDLER_INFO *HandlerInfo;\r
193\r
194 //\r
195 // Check input parameter\r
196 //\r
197 ASSERT (SectionGuid != NULL);\r
198 ASSERT (GetInfoHandler != NULL);\r
199 ASSERT (DecodeHandler != NULL);\r
200\r
201\r
202\r
203 //\r
204 // Get the registered handler information\r
205 //\r
206 Status = PeiGetExtractGuidedSectionHandlerInfo (&HandlerInfo);\r
207 if (EFI_ERROR (Status)) {\r
208 return Status;\r
209 }\r
210\r
211 //\r
212 // Search the match registered GetInfo handler for the input guided section.\r
213 //\r
214 ASSERT (HandlerInfo != NULL);\r
215 for (Index = 0; Index < HandlerInfo->NumberOfExtractHandler; Index ++) {\r
216 if (CompareGuid (HandlerInfo->ExtractHandlerGuidTable + Index, SectionGuid)) {\r
217 //\r
218 // If the guided handler has been registered before, only update its handler.\r
219 //\r
220 HandlerInfo->ExtractDecodeHandlerTable [Index] = DecodeHandler;\r
221 HandlerInfo->ExtractGetInfoHandlerTable [Index] = GetInfoHandler;\r
222 return RETURN_SUCCESS;\r
223 }\r
224 }\r
225\r
226 //\r
227 // Check the global table is enough to contain new Handler.\r
228 //\r
229 if (HandlerInfo->NumberOfExtractHandler >= PcdGet32 (PcdMaximumGuidedExtractHandler)) {\r
230 return RETURN_OUT_OF_RESOURCES;\r
231 }\r
232\r
233 //\r
234 // Register new Handler and guid value.\r
235 //\r
236 CopyGuid (HandlerInfo->ExtractHandlerGuidTable + HandlerInfo->NumberOfExtractHandler, SectionGuid);\r
237 HandlerInfo->ExtractDecodeHandlerTable [HandlerInfo->NumberOfExtractHandler] = DecodeHandler;\r
238 HandlerInfo->ExtractGetInfoHandlerTable [HandlerInfo->NumberOfExtractHandler++] = GetInfoHandler;\r
239\r
240 //\r
241 // Build the Guided Section GUID HOB to record the GUID itself.\r
242 // Then the content of the GUIDed HOB will be the same as the GUID value itself.\r
243 //\r
244 BuildGuidDataHob (\r
245 (EFI_GUID *) SectionGuid,\r
246 (VOID *) SectionGuid,\r
247 sizeof (GUID)\r
248 );\r
249\r
250 return RETURN_SUCCESS;\r
251}\r
252\r
253/**\r
254 Retrieves a GUID from a GUIDed section and uses that GUID to select an associated handler of type\r
255 EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER that was registered with ExtractGuidedSectionRegisterHandlers().\r
256 The selected handler is used to retrieve and return the size of the decoded buffer and the size of an\r
257 optional scratch buffer required to actually decode the data in a GUIDed section.\r
258\r
259 Examines a GUIDed section specified by InputSection.\r
260 If GUID for InputSection does not match any of the GUIDs registered through ExtractGuidedSectionRegisterHandlers(),\r
261 then RETURN_UNSUPPORTED is returned.\r
262 If the GUID of InputSection does match the GUID that this handler supports, then the the associated handler\r
263 of type EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER that was registered with ExtractGuidedSectionRegisterHandlers()\r
264 is used to retrieve the OututBufferSize, ScratchSize, and Attributes values. The return status from the handler of\r
265 type EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER is returned.\r
266\r
267 If InputSection is NULL, then ASSERT().\r
268 If OutputBufferSize is NULL, then ASSERT().\r
269 If ScratchBufferSize is NULL, then ASSERT().\r
270 If SectionAttribute is NULL, then ASSERT().\r
271\r
272 @param[in] InputSection A pointer to a GUIDed section of an FFS formatted file.\r
273 @param[out] OutputBufferSize A pointer to the size, in bytes, of an output buffer required if the buffer\r
274 specified by InputSection were decoded.\r
275 @param[out] ScratchBufferSize A pointer to the size, in bytes, required as scratch space if the buffer specified by\r
276 InputSection were decoded.\r
277 @param[out] SectionAttribute A pointer to the attributes of the GUIDed section. See the Attributes field of\r
278 EFI_GUID_DEFINED_SECTION in the PI Specification.\r
279\r
280 @retval RETURN_SUCCESS Get the required information successfully.\r
281 @retval RETURN_UNSUPPORTED The GUID from the section specified by InputSection does not match any of\r
282 the GUIDs registered with ExtractGuidedSectionRegisterHandlers().\r
283 @retval Others The return status from the handler associated with the GUID retrieved from\r
284 the section specified by InputSection.\r
285\r
286**/\r
287RETURN_STATUS\r
288EFIAPI\r
289ExtractGuidedSectionGetInfo (\r
290 IN CONST VOID *InputSection,\r
291 OUT UINT32 *OutputBufferSize,\r
292 OUT UINT32 *ScratchBufferSize,\r
293 OUT UINT16 *SectionAttribute\r
294 )\r
295{\r
296 UINT32 Index;\r
297 EFI_STATUS Status;\r
298 PEI_EXTRACT_GUIDED_SECTION_HANDLER_INFO *HandlerInfo;\r
299 EFI_GUID *SectionDefinitionGuid;\r
300\r
301 //\r
302 // Check input parameter\r
303 //\r
304 ASSERT (InputSection != NULL);\r
305 ASSERT (OutputBufferSize != NULL);\r
306 ASSERT (ScratchBufferSize != NULL);\r
307 ASSERT (SectionAttribute != NULL);\r
308\r
309 //\r
310 // Get all registered handler information.\r
311 //\r
312 Status = PeiGetExtractGuidedSectionHandlerInfo (&HandlerInfo);\r
313 if (EFI_ERROR (Status)) {\r
314 return Status;\r
315 }\r
316\r
317 if (IS_SECTION2 (InputSection)) {\r
318 SectionDefinitionGuid = &(((EFI_GUID_DEFINED_SECTION2 *) InputSection)->SectionDefinitionGuid);\r
319 } else {\r
320 SectionDefinitionGuid = &(((EFI_GUID_DEFINED_SECTION *) InputSection)->SectionDefinitionGuid);\r
321 }\r
322\r
323 //\r
324 // Search the match registered GetInfo handler for the input guided section.\r
325 //\r
326 ASSERT (HandlerInfo != NULL);\r
327 for (Index = 0; Index < HandlerInfo->NumberOfExtractHandler; Index ++) {\r
328 if (CompareGuid (HandlerInfo->ExtractHandlerGuidTable + Index, SectionDefinitionGuid)) {\r
329 //\r
330 // Call the match handler to get information for the input section data.\r
331 //\r
332 return HandlerInfo->ExtractGetInfoHandlerTable [Index] (\r
333 InputSection,\r
334 OutputBufferSize,\r
335 ScratchBufferSize,\r
336 SectionAttribute\r
337 );\r
338 }\r
339 }\r
340\r
341 //\r
342 // Not found, the input guided section is not supported.\r
343 //\r
344 return RETURN_UNSUPPORTED;\r
345}\r
346\r
347/**\r
348 Retrieves the GUID from a GUIDed section and uses that GUID to select an associated handler of type\r
349 EXTRACT_GUIDED_SECTION_DECODE_HANDLER that was registered with ExtractGuidedSectionRegisterHandlers().\r
350 The selected handler is used to decode the data in a GUIDed section and return the result in a caller\r
351 allocated output buffer.\r
352\r
353 Decodes the GUIDed section specified by InputSection.\r
354 If GUID for InputSection does not match any of the GUIDs registered through ExtractGuidedSectionRegisterHandlers(),\r
355 then RETURN_UNSUPPORTED is returned.\r
356 If the GUID of InputSection does match the GUID that this handler supports, then the the associated handler\r
357 of type EXTRACT_GUIDED_SECTION_DECODE_HANDLER that was registered with ExtractGuidedSectionRegisterHandlers()\r
358 is used to decode InputSection into the buffer specified by OutputBuffer and the authentication status of this\r
359 decode operation is returned in AuthenticationStatus. If the decoded buffer is identical to the data in InputSection,\r
360 then OutputBuffer is set to point at the data in InputSection. Otherwise, the decoded data will be placed in caller\r
361 allocated buffer specified by OutputBuffer. This function is responsible for computing the EFI_AUTH_STATUS_PLATFORM_OVERRIDE\r
362 bit of in AuthenticationStatus. The return status from the handler of type EXTRACT_GUIDED_SECTION_DECODE_HANDLER is returned.\r
363\r
364 If InputSection is NULL, then ASSERT().\r
365 If OutputBuffer is NULL, then ASSERT().\r
366 If ScratchBuffer is NULL and this decode operation requires a scratch buffer, then ASSERT().\r
367 If AuthenticationStatus is NULL, then ASSERT().\r
368\r
369 @param[in] InputSection A pointer to a GUIDed section of an FFS formatted file.\r
370 @param[out] OutputBuffer A pointer to a buffer that contains the result of a decode operation.\r
371 @param[in] ScratchBuffer A caller allocated buffer that may be required by this function as a scratch buffer to perform the decode operation.\r
372 @param[out] AuthenticationStatus\r
373 A pointer to the authentication status of the decoded output buffer. See the definition\r
374 of authentication status in the EFI_PEI_GUIDED_SECTION_EXTRACTION_PPI section of the PI\r
375 Specification.\r
376\r
377 @retval RETURN_SUCCESS The buffer specified by InputSection was decoded.\r
378 @retval RETURN_UNSUPPORTED The section specified by InputSection does not match the GUID this handler supports.\r
379 @retval RETURN_INVALID_PARAMETER The section specified by InputSection can not be decoded.\r
380\r
381**/\r
382RETURN_STATUS\r
383EFIAPI\r
384ExtractGuidedSectionDecode (\r
385 IN CONST VOID *InputSection,\r
386 OUT VOID **OutputBuffer,\r
387 IN VOID *ScratchBuffer OPTIONAL,\r
388 OUT UINT32 *AuthenticationStatus\r
389 )\r
390{\r
391 UINT32 Index;\r
392 EFI_STATUS Status;\r
393 PEI_EXTRACT_GUIDED_SECTION_HANDLER_INFO *HandlerInfo;\r
394 EFI_GUID *SectionDefinitionGuid;\r
395\r
396 //\r
397 // Check input parameter\r
398 //\r
399 ASSERT (InputSection != NULL);\r
400 ASSERT (OutputBuffer != NULL);\r
401 ASSERT (AuthenticationStatus != NULL);\r
402\r
403 //\r
404 // Get all registered handler information.\r
405 //\r
406 Status = PeiGetExtractGuidedSectionHandlerInfo (&HandlerInfo);\r
407 if (EFI_ERROR (Status)) {\r
408 return Status;\r
409 }\r
410\r
411 if (IS_SECTION2 (InputSection)) {\r
412 SectionDefinitionGuid = &(((EFI_GUID_DEFINED_SECTION2 *) InputSection)->SectionDefinitionGuid);\r
413 } else {\r
414 SectionDefinitionGuid = &(((EFI_GUID_DEFINED_SECTION *) InputSection)->SectionDefinitionGuid);\r
415 }\r
416\r
417 //\r
418 // Search the match registered Extract handler for the input guided section.\r
419 //\r
420 ASSERT (HandlerInfo != NULL);\r
421 for (Index = 0; Index < HandlerInfo->NumberOfExtractHandler; Index ++) {\r
422 if (CompareGuid (HandlerInfo->ExtractHandlerGuidTable + Index, SectionDefinitionGuid)) {\r
423 //\r
424 // Call the match handler to extract raw data for the input guided section.\r
425 //\r
426 return HandlerInfo->ExtractDecodeHandlerTable [Index] (\r
427 InputSection,\r
428 OutputBuffer,\r
429 ScratchBuffer,\r
430 AuthenticationStatus\r
431 );\r
432 }\r
433 }\r
434\r
435 //\r
436 // Not found, the input guided section is not supported.\r
437 //\r
438 return RETURN_UNSUPPORTED;\r
439}\r
440\r
441/**\r
442 Retrieves handlers of type EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER and\r
443 EXTRACT_GUIDED_SECTION_DECODE_HANDLER for a specific GUID section type.\r
444\r
445 Retrieves the handlers associated with SectionGuid and returns them in\r
446 GetInfoHandler and DecodeHandler.\r
447\r
448 If the GUID value specified by SectionGuid has not been registered, then\r
449 return RETURN_NOT_FOUND.\r
450\r
451 If SectionGuid is NULL, then ASSERT().\r
452\r
453 @param[in] SectionGuid A pointer to the GUID associated with the handlersof the GUIDed\r
454 section type being retrieved.\r
455 @param[out] GetInfoHandler Pointer to a function that examines a GUIDed section and returns\r
456 the size of the decoded buffer and the size of an optional scratch\r
457 buffer required to actually decode the data in a GUIDed section.\r
458 This is an optional parameter that may be NULL. If it is NULL, then\r
459 the previously registered handler is not returned.\r
460 @param[out] DecodeHandler Pointer to a function that decodes a GUIDed section into a caller\r
461 allocated output buffer. This is an optional parameter that may be NULL.\r
462 If it is NULL, then the previously registered handler is not returned.\r
463\r
464 @retval RETURN_SUCCESS The handlers were retrieved.\r
465 @retval RETURN_NOT_FOUND No handlers have been registered with the specified GUID.\r
466\r
467**/\r
468RETURN_STATUS\r
469EFIAPI\r
470ExtractGuidedSectionGetHandlers (\r
471 IN CONST GUID *SectionGuid,\r
472 OUT EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER *GetInfoHandler OPTIONAL,\r
473 OUT EXTRACT_GUIDED_SECTION_DECODE_HANDLER *DecodeHandler OPTIONAL\r
474 )\r
475{\r
476 EFI_STATUS Status;\r
477 UINT32 Index;\r
478 PEI_EXTRACT_GUIDED_SECTION_HANDLER_INFO *HandlerInfo;\r
479\r
480 //\r
481 // Check input parameter\r
482 //\r
483 ASSERT (SectionGuid != NULL);\r
484\r
485 //\r
486 // Get the registered handler information\r
487 //\r
488 Status = PeiGetExtractGuidedSectionHandlerInfo (&HandlerInfo);\r
489 if (EFI_ERROR (Status)) {\r
490 return Status;\r
491 }\r
492\r
493 //\r
494 // Search the match registered GetInfo handler for the input guided section.\r
495 //\r
496 ASSERT (HandlerInfo != NULL);\r
497 for (Index = 0; Index < HandlerInfo->NumberOfExtractHandler; Index ++) {\r
498 if (CompareGuid (HandlerInfo->ExtractHandlerGuidTable + Index, SectionGuid)) {\r
499\r
500 //\r
501 // If the guided handler has been registered before, then return the registered handlers.\r
502 //\r
503 if (GetInfoHandler != NULL) {\r
504 *GetInfoHandler = HandlerInfo->ExtractGetInfoHandlerTable[Index];\r
505 }\r
506 if (DecodeHandler != NULL) {\r
507 *DecodeHandler = HandlerInfo->ExtractDecodeHandlerTable[Index];\r
508 }\r
509 return RETURN_SUCCESS;\r
510 }\r
511 }\r
512 return RETURN_NOT_FOUND;\r
513}\r