summaryrefslogtreecommitdiff
path: root/MdePkg
diff options
context:
space:
mode:
authorydong10 <ydong10@6f19259b-4bc3-4df7-8a09-765794883524>2010-11-04 05:51:32 +0000
committerydong10 <ydong10@6f19259b-4bc3-4df7-8a09-765794883524>2010-11-04 05:51:32 +0000
commit9be899c5cc644d710e3392dedb672bf67b84b9c1 (patch)
treec86aa90ea1fffd7769c7a1a36d24103a5f84861b /MdePkg
parent0a6c09052110ebd0242f4ddacf8b4e5007a29774 (diff)
downloadedk2-platforms-9be899c5cc644d710e3392dedb672bf67b84b9c1.tar.xz
Add API to ExtractGuidedSectionLib.h to retrieve the set of registered handlers.
API Function name is ExtractGuidedSectionGetHandlers. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11002 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdePkg')
-rw-r--r--MdePkg/Include/Library/ExtractGuidedSectionLib.h37
-rw-r--r--MdePkg/Library/BaseExtractGuidedSectionLib/BaseExtractGuidedSectionLib.c74
-rw-r--r--MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.c63
-rw-r--r--MdePkg/Library/PeiExtractGuidedSectionLib/PeiExtractGuidedSectionLib.c74
4 files changed, 247 insertions, 1 deletions
diff --git a/MdePkg/Include/Library/ExtractGuidedSectionLib.h b/MdePkg/Include/Library/ExtractGuidedSectionLib.h
index 4f2a8edec4..539b98d41a 100644
--- a/MdePkg/Include/Library/ExtractGuidedSectionLib.h
+++ b/MdePkg/Include/Library/ExtractGuidedSectionLib.h
@@ -10,7 +10,7 @@
EFI_PEI_GUIDED_SECTION_EXTRACTION_PPI or a EFI_GUIDED_SECTION_EXTRACTION_PROTOCOL
providing a simple method to extend the number of GUIDed sections types a platform supports.
-Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -246,4 +246,39 @@ ExtractGuidedSectionDecode (
OUT UINT32 *AuthenticationStatus
);
+/**
+ Retrieves handlers of type EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER and
+ EXTRACT_GUIDED_SECTION_DECODE_HANDLER for a specific GUID section type.
+
+ Retrieves the handlers associated with SectionGuid and returns them in
+ GetInfoHandler and DecodeHandler.
+
+ If the GUID value specified by SectionGuid has not been registered, then
+ return RETURN_NOT_FOUND.
+
+ If SectionGuid is NULL, then ASSERT().
+
+ @param[in] SectionGuid A pointer to the GUID associated with the handlersof the GUIDed
+ section type being retrieved.
+ @param[out] GetInfoHandler Pointer to a function that examines a GUIDed section and returns
+ the size of the decoded buffer and the size of an optional scratch
+ buffer required to actually decode the data in a GUIDed section.
+ This is an optional parameter that may be NULL. If it is NULL, then
+ the previously registered handler is not returned.
+ @param[out] DecodeHandler Pointer to a function that decodes a GUIDed section into a caller
+ allocated output buffer. This is an optional parameter that may be NULL.
+ If it is NULL, then the previously registered handler is not returned.
+
+ @retval RETURN_SUCCESS The handlers were retrieved.
+ @retval RETURN_NOT_FOUND No handlers have been registered with the specified GUID.
+
+**/
+RETURN_STATUS
+EFIAPI
+ExtractGuidedSectionGetHandlers (
+ IN CONST GUID *SectionGuid,
+ OUT EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER *GetInfoHandler, OPTIONAL
+ OUT EXTRACT_GUIDED_SECTION_DECODE_HANDLER *DecodeHandler OPTIONAL
+ );
+
#endif
diff --git a/MdePkg/Library/BaseExtractGuidedSectionLib/BaseExtractGuidedSectionLib.c b/MdePkg/Library/BaseExtractGuidedSectionLib/BaseExtractGuidedSectionLib.c
index c3978c9b50..6a2cde5200 100644
--- a/MdePkg/Library/BaseExtractGuidedSectionLib/BaseExtractGuidedSectionLib.c
+++ b/MdePkg/Library/BaseExtractGuidedSectionLib/BaseExtractGuidedSectionLib.c
@@ -386,3 +386,77 @@ ExtractGuidedSectionDecode (
//
return RETURN_UNSUPPORTED;
}
+
+/**
+ Retrieves handlers of type EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER and
+ EXTRACT_GUIDED_SECTION_DECODE_HANDLER for a specific GUID section type.
+
+ Retrieves the handlers associated with SectionGuid and returns them in
+ GetInfoHandler and DecodeHandler.
+
+ If the GUID value specified by SectionGuid has not been registered, then
+ return RETURN_NOT_FOUND.
+
+ If SectionGuid is NULL, then ASSERT().
+
+ @param[in] SectionGuid A pointer to the GUID associated with the handlersof the GUIDed
+ section type being retrieved.
+ @param[out] GetInfoHandler Pointer to a function that examines a GUIDed section and returns
+ the size of the decoded buffer and the size of an optional scratch
+ buffer required to actually decode the data in a GUIDed section.
+ This is an optional parameter that may be NULL. If it is NULL, then
+ the previously registered handler is not returned.
+ @param[out] DecodeHandler Pointer to a function that decodes a GUIDed section into a caller
+ allocated output buffer. This is an optional parameter that may be NULL.
+ If it is NULL, then the previously registered handler is not returned.
+
+ @retval RETURN_SUCCESS The handlers were retrieved.
+ @retval RETURN_NOT_FOUND No handlers have been registered with the specified GUID.
+
+**/
+RETURN_STATUS
+EFIAPI
+ExtractGuidedSectionGetHandlers (
+ IN CONST GUID *SectionGuid,
+ OUT EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER *GetInfoHandler, OPTIONAL
+ OUT EXTRACT_GUIDED_SECTION_DECODE_HANDLER *DecodeHandler OPTIONAL
+ )
+{
+ UINT32 Index;
+ RETURN_STATUS Status;
+ EXTRACT_GUIDED_SECTION_HANDLER_INFO *HandlerInfo;
+
+ //
+ // Check input paramter
+ //
+ ASSERT (SectionGuid != NULL);
+
+ //
+ // Get the registered handler information
+ //
+ Status = GetExtractGuidedSectionHandlerInfo (&HandlerInfo);
+ if (RETURN_ERROR (Status)) {
+ return Status;
+ }
+
+ //
+ // Search the match registered GetInfo handler for the input guided section.
+ //
+ ASSERT (HandlerInfo != NULL);
+ for (Index = 0; Index < HandlerInfo->NumberOfExtractHandler; Index ++) {
+ if (CompareGuid (HandlerInfo->ExtractHandlerGuidTable + Index, SectionGuid)) {
+
+ //
+ // If the guided handler has been registered before, then return the registered handlers.
+ //
+ if (GetInfoHandler != NULL) {
+ *GetInfoHandler = HandlerInfo->ExtractGetInfoHandlerTable[Index];
+ }
+ if (DecodeHandler != NULL) {
+ *DecodeHandler = HandlerInfo->ExtractDecodeHandlerTable[Index];
+ }
+ return RETURN_SUCCESS;
+ }
+ }
+ return RETURN_NOT_FOUND;
+}
diff --git a/MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.c b/MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.c
index 1587e872fa..b8bb83c20e 100644
--- a/MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.c
+++ b/MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.c
@@ -363,3 +363,66 @@ ExtractGuidedSectionDecode (
//
return RETURN_UNSUPPORTED;
}
+
+/**
+ Retrieves handlers of type EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER and
+ EXTRACT_GUIDED_SECTION_DECODE_HANDLER for a specific GUID section type.
+
+ Retrieves the handlers associated with SectionGuid and returns them in
+ GetInfoHandler and DecodeHandler.
+
+ If the GUID value specified by SectionGuid has not been registered, then
+ return RETURN_NOT_FOUND.
+
+ If SectionGuid is NULL, then ASSERT().
+
+ @param[in] SectionGuid A pointer to the GUID associated with the handlersof the GUIDed
+ section type being retrieved.
+ @param[out] GetInfoHandler Pointer to a function that examines a GUIDed section and returns
+ the size of the decoded buffer and the size of an optional scratch
+ buffer required to actually decode the data in a GUIDed section.
+ This is an optional parameter that may be NULL. If it is NULL, then
+ the previously registered handler is not returned.
+ @param[out] DecodeHandler Pointer to a function that decodes a GUIDed section into a caller
+ allocated output buffer. This is an optional parameter that may be NULL.
+ If it is NULL, then the previously registered handler is not returned.
+
+ @retval RETURN_SUCCESS The handlers were retrieved.
+ @retval RETURN_NOT_FOUND No handlers have been registered with the specified GUID.
+
+**/
+RETURN_STATUS
+EFIAPI
+ExtractGuidedSectionGetHandlers (
+ IN CONST GUID *SectionGuid,
+ OUT EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER *GetInfoHandler, OPTIONAL
+ OUT EXTRACT_GUIDED_SECTION_DECODE_HANDLER *DecodeHandler OPTIONAL
+ )
+{
+ UINT32 Index;
+
+ //
+ // Check input parameter.
+ //
+ ASSERT (SectionGuid != NULL);
+
+ //
+ // Search the match registered GetInfo handler for the input guided section.
+ //
+ for (Index = 0; Index < mNumberOfExtractHandler; Index ++) {
+ if (CompareGuid (&mExtractHandlerGuidTable[Index], SectionGuid)) {
+
+ //
+ // If the guided handler has been registered before, then return the registered handlers.
+ //
+ if (GetInfoHandler != NULL) {
+ *GetInfoHandler = mExtractGetInfoHandlerTable[Index];
+ }
+ if (DecodeHandler != NULL) {
+ *DecodeHandler = mExtractDecodeHandlerTable[Index];
+ }
+ return RETURN_SUCCESS;
+ }
+ }
+ return RETURN_NOT_FOUND;
+}
diff --git a/MdePkg/Library/PeiExtractGuidedSectionLib/PeiExtractGuidedSectionLib.c b/MdePkg/Library/PeiExtractGuidedSectionLib/PeiExtractGuidedSectionLib.c
index 099d7cc24c..fa382ae3c8 100644
--- a/MdePkg/Library/PeiExtractGuidedSectionLib/PeiExtractGuidedSectionLib.c
+++ b/MdePkg/Library/PeiExtractGuidedSectionLib/PeiExtractGuidedSectionLib.c
@@ -415,3 +415,77 @@ ExtractGuidedSectionDecode (
//
return RETURN_UNSUPPORTED;
}
+
+/**
+ Retrieves handlers of type EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER and
+ EXTRACT_GUIDED_SECTION_DECODE_HANDLER for a specific GUID section type.
+
+ Retrieves the handlers associated with SectionGuid and returns them in
+ GetInfoHandler and DecodeHandler.
+
+ If the GUID value specified by SectionGuid has not been registered, then
+ return RETURN_NOT_FOUND.
+
+ If SectionGuid is NULL, then ASSERT().
+
+ @param[in] SectionGuid A pointer to the GUID associated with the handlersof the GUIDed
+ section type being retrieved.
+ @param[out] GetInfoHandler Pointer to a function that examines a GUIDed section and returns
+ the size of the decoded buffer and the size of an optional scratch
+ buffer required to actually decode the data in a GUIDed section.
+ This is an optional parameter that may be NULL. If it is NULL, then
+ the previously registered handler is not returned.
+ @param[out] DecodeHandler Pointer to a function that decodes a GUIDed section into a caller
+ allocated output buffer. This is an optional parameter that may be NULL.
+ If it is NULL, then the previously registered handler is not returned.
+
+ @retval RETURN_SUCCESS The handlers were retrieved.
+ @retval RETURN_NOT_FOUND No handlers have been registered with the specified GUID.
+
+**/
+RETURN_STATUS
+EFIAPI
+ExtractGuidedSectionGetHandlers (
+ IN CONST GUID *SectionGuid,
+ OUT EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER *GetInfoHandler, OPTIONAL
+ OUT EXTRACT_GUIDED_SECTION_DECODE_HANDLER *DecodeHandler OPTIONAL
+ )
+{
+ EFI_STATUS Status;
+ UINT32 Index;
+ PEI_EXTRACT_GUIDED_SECTION_HANDLER_INFO *HandlerInfo;
+
+ //
+ // Check input parameter
+ //
+ ASSERT (SectionGuid != NULL);
+
+ //
+ // Get the registered handler information
+ //
+ Status = PeiGetExtractGuidedSectionHandlerInfo (&HandlerInfo);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ //
+ // Search the match registered GetInfo handler for the input guided section.
+ //
+ ASSERT (HandlerInfo != NULL);
+ for (Index = 0; Index < HandlerInfo->NumberOfExtractHandler; Index ++) {
+ if (CompareGuid (HandlerInfo->ExtractHandlerGuidTable + Index, SectionGuid)) {
+
+ //
+ // If the guided handler has been registered before, then return the registered handlers.
+ //
+ if (GetInfoHandler != NULL) {
+ *GetInfoHandler = HandlerInfo->ExtractGetInfoHandlerTable[Index];
+ }
+ if (DecodeHandler != NULL) {
+ *DecodeHandler = HandlerInfo->ExtractDecodeHandlerTable[Index];
+ }
+ return RETURN_SUCCESS;
+ }
+ }
+ return RETURN_NOT_FOUND;
+}