summaryrefslogtreecommitdiffstats
path: root/EmbeddedPkg/Library/PrePiExtractGuidedSectionLib/PrePiExtractGuidedSectionLib.c
diff options
context:
space:
mode:
Diffstat (limited to 'EmbeddedPkg/Library/PrePiExtractGuidedSectionLib/PrePiExtractGuidedSectionLib.c')
-rw-r--r--EmbeddedPkg/Library/PrePiExtractGuidedSectionLib/PrePiExtractGuidedSectionLib.c83
1 files changed, 42 insertions, 41 deletions
diff --git a/EmbeddedPkg/Library/PrePiExtractGuidedSectionLib/PrePiExtractGuidedSectionLib.c b/EmbeddedPkg/Library/PrePiExtractGuidedSectionLib/PrePiExtractGuidedSectionLib.c
index 12885f4230..e6d72adfb0 100644
--- a/EmbeddedPkg/Library/PrePiExtractGuidedSectionLib/PrePiExtractGuidedSectionLib.c
+++ b/EmbeddedPkg/Library/PrePiExtractGuidedSectionLib/PrePiExtractGuidedSectionLib.c
@@ -13,13 +13,13 @@
#include <Library/PcdLib.h>
#include <Library/PrePiLib.h>
-#define PRE_PI_EXTRACT_GUIDED_SECTION_DATA_GUID { 0x385A982C, 0x2F49, 0x4043, { 0xA5, 0x1E, 0x49, 0x01, 0x02, 0x5C, 0x8B, 0x6B }}
+#define PRE_PI_EXTRACT_GUIDED_SECTION_DATA_GUID { 0x385A982C, 0x2F49, 0x4043, { 0xA5, 0x1E, 0x49, 0x01, 0x02, 0x5C, 0x8B, 0x6B }}
typedef struct {
- UINT32 NumberOfExtractHandler;
- GUID *ExtractHandlerGuidTable;
- EXTRACT_GUIDED_SECTION_DECODE_HANDLER *ExtractDecodeHandlerTable;
- EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER *ExtractGetInfoHandlerTable;
+ UINT32 NumberOfExtractHandler;
+ GUID *ExtractHandlerGuidTable;
+ EXTRACT_GUIDED_SECTION_DECODE_HANDLER *ExtractDecodeHandlerTable;
+ EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER *ExtractGetInfoHandlerTable;
} PRE_PI_EXTRACT_GUIDED_SECTION_DATA;
PRE_PI_EXTRACT_GUIDED_SECTION_DATA *
@@ -27,10 +27,10 @@ GetSavedData (
VOID
)
{
- EFI_HOB_GUID_TYPE *GuidHob;
- GUID SavedDataGuid = PRE_PI_EXTRACT_GUIDED_SECTION_DATA_GUID;
+ EFI_HOB_GUID_TYPE *GuidHob;
+ GUID SavedDataGuid = PRE_PI_EXTRACT_GUIDED_SECTION_DATA_GUID;
- GuidHob = GetFirstGuidHob(&SavedDataGuid);
+ GuidHob = GetFirstGuidHob (&SavedDataGuid);
GuidHob++;
return (PRE_PI_EXTRACT_GUIDED_SECTION_DATA *)GuidHob;
@@ -46,6 +46,7 @@ ExtractGuidedSectionRegisterHandlers (
{
PRE_PI_EXTRACT_GUIDED_SECTION_DATA *SavedData;
UINT32 Index;
+
//
// Check input parameter.
//
@@ -53,12 +54,12 @@ ExtractGuidedSectionRegisterHandlers (
return RETURN_INVALID_PARAMETER;
}
- SavedData = GetSavedData();
+ SavedData = GetSavedData ();
//
// Search the match registered GetInfo handler for the input guided section.
//
- for (Index = 0; Index < SavedData->NumberOfExtractHandler; Index ++) {
+ for (Index = 0; Index < SavedData->NumberOfExtractHandler; Index++) {
if (CompareGuid (&SavedData->ExtractHandlerGuidTable[Index], SectionGuid)) {
break;
}
@@ -68,8 +69,8 @@ ExtractGuidedSectionRegisterHandlers (
// If the guided handler has been registered before, only update its handler.
//
if (Index < SavedData->NumberOfExtractHandler) {
- SavedData->ExtractDecodeHandlerTable [Index] = DecodeHandler;
- SavedData->ExtractGetInfoHandlerTable [Index] = GetInfoHandler;
+ SavedData->ExtractDecodeHandlerTable[Index] = DecodeHandler;
+ SavedData->ExtractGetInfoHandlerTable[Index] = GetInfoHandler;
return RETURN_SUCCESS;
}
@@ -83,9 +84,9 @@ ExtractGuidedSectionRegisterHandlers (
//
// Register new Handler and guid value.
//
- CopyGuid (&SavedData->ExtractHandlerGuidTable [SavedData->NumberOfExtractHandler], SectionGuid);
- SavedData->ExtractDecodeHandlerTable [SavedData->NumberOfExtractHandler] = DecodeHandler;
- SavedData->ExtractGetInfoHandlerTable [SavedData->NumberOfExtractHandler++] = GetInfoHandler;
+ CopyGuid (&SavedData->ExtractHandlerGuidTable[SavedData->NumberOfExtractHandler], SectionGuid);
+ SavedData->ExtractDecodeHandlerTable[SavedData->NumberOfExtractHandler] = DecodeHandler;
+ SavedData->ExtractGetInfoHandlerTable[SavedData->NumberOfExtractHandler++] = GetInfoHandler;
return RETURN_SUCCESS;
}
@@ -98,9 +99,9 @@ ExtractGuidedSectionGetGuidList (
{
PRE_PI_EXTRACT_GUIDED_SECTION_DATA *SavedData;
- ASSERT(ExtractHandlerGuidTable != NULL);
+ ASSERT (ExtractHandlerGuidTable != NULL);
- SavedData = GetSavedData();
+ SavedData = GetSavedData ();
*ExtractHandlerGuidTable = SavedData->ExtractHandlerGuidTable;
return SavedData->NumberOfExtractHandler;
@@ -127,18 +128,18 @@ ExtractGuidedSectionGetInfo (
ASSERT (ScratchBufferSize != NULL);
ASSERT (SectionAttribute != NULL);
- SavedData = GetSavedData();
+ SavedData = GetSavedData ();
if (IS_SECTION2 (InputSection)) {
- SectionDefinitionGuid = &(((EFI_GUID_DEFINED_SECTION2 *) InputSection)->SectionDefinitionGuid);
+ SectionDefinitionGuid = &(((EFI_GUID_DEFINED_SECTION2 *)InputSection)->SectionDefinitionGuid);
} else {
- SectionDefinitionGuid = &(((EFI_GUID_DEFINED_SECTION *) InputSection)->SectionDefinitionGuid);
+ SectionDefinitionGuid = &(((EFI_GUID_DEFINED_SECTION *)InputSection)->SectionDefinitionGuid);
}
//
// Search the match registered GetInfo handler for the input guided section.
//
- for (Index = 0; Index < SavedData->NumberOfExtractHandler; Index ++) {
+ for (Index = 0; Index < SavedData->NumberOfExtractHandler; Index++) {
if (CompareGuid (&SavedData->ExtractHandlerGuidTable[Index], SectionDefinitionGuid)) {
break;
}
@@ -154,12 +155,12 @@ ExtractGuidedSectionGetInfo (
//
// Call the match handler to getinfo for the input section data.
//
- return SavedData->ExtractGetInfoHandlerTable [Index] (
- InputSection,
- OutputBufferSize,
- ScratchBufferSize,
- SectionAttribute
- );
+ return SavedData->ExtractGetInfoHandlerTable[Index](
+ InputSection,
+ OutputBufferSize,
+ ScratchBufferSize,
+ SectionAttribute
+ );
}
RETURN_STATUS
@@ -182,18 +183,18 @@ ExtractGuidedSectionDecode (
ASSERT (OutputBuffer != NULL);
ASSERT (AuthenticationStatus != NULL);
- SavedData = GetSavedData();
+ SavedData = GetSavedData ();
if (IS_SECTION2 (InputSection)) {
- SectionDefinitionGuid = &(((EFI_GUID_DEFINED_SECTION2 *) InputSection)->SectionDefinitionGuid);
+ SectionDefinitionGuid = &(((EFI_GUID_DEFINED_SECTION2 *)InputSection)->SectionDefinitionGuid);
} else {
- SectionDefinitionGuid = &(((EFI_GUID_DEFINED_SECTION *) InputSection)->SectionDefinitionGuid);
+ SectionDefinitionGuid = &(((EFI_GUID_DEFINED_SECTION *)InputSection)->SectionDefinitionGuid);
}
//
// Search the match registered GetInfo handler for the input guided section.
//
- for (Index = 0; Index < SavedData->NumberOfExtractHandler; Index ++) {
+ for (Index = 0; Index < SavedData->NumberOfExtractHandler; Index++) {
if (CompareGuid (&SavedData->ExtractHandlerGuidTable[Index], SectionDefinitionGuid)) {
break;
}
@@ -209,12 +210,12 @@ ExtractGuidedSectionDecode (
//
// Call the match handler to getinfo for the input section data.
//
- return SavedData->ExtractDecodeHandlerTable [Index] (
- InputSection,
- OutputBuffer,
- ScratchBuffer,
- AuthenticationStatus
- );
+ return SavedData->ExtractDecodeHandlerTable[Index](
+ InputSection,
+ OutputBuffer,
+ ScratchBuffer,
+ AuthenticationStatus
+ );
}
RETURN_STATUS
@@ -229,17 +230,17 @@ ExtractGuidedSectionLibConstructor (
//
// Allocate global pool space to store the registered handler and its guid value.
//
- SavedData.ExtractHandlerGuidTable = (GUID *)AllocatePool(PcdGet32(PcdMaximumGuidedExtractHandler) * sizeof(GUID));
+ SavedData.ExtractHandlerGuidTable = (GUID *)AllocatePool (PcdGet32 (PcdMaximumGuidedExtractHandler) * sizeof (GUID));
if (SavedData.ExtractHandlerGuidTable == NULL) {
return RETURN_OUT_OF_RESOURCES;
}
- SavedData.ExtractDecodeHandlerTable = (EXTRACT_GUIDED_SECTION_DECODE_HANDLER *)AllocatePool(PcdGet32(PcdMaximumGuidedExtractHandler) * sizeof(EXTRACT_GUIDED_SECTION_DECODE_HANDLER));
+ SavedData.ExtractDecodeHandlerTable = (EXTRACT_GUIDED_SECTION_DECODE_HANDLER *)AllocatePool (PcdGet32 (PcdMaximumGuidedExtractHandler) * sizeof (EXTRACT_GUIDED_SECTION_DECODE_HANDLER));
if (SavedData.ExtractDecodeHandlerTable == NULL) {
return RETURN_OUT_OF_RESOURCES;
}
- SavedData.ExtractGetInfoHandlerTable = (EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER *)AllocatePool(PcdGet32(PcdMaximumGuidedExtractHandler) * sizeof(EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER));
+ SavedData.ExtractGetInfoHandlerTable = (EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER *)AllocatePool (PcdGet32 (PcdMaximumGuidedExtractHandler) * sizeof (EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER));
if (SavedData.ExtractGetInfoHandlerTable == NULL) {
return RETURN_OUT_OF_RESOURCES;
}
@@ -249,7 +250,7 @@ ExtractGuidedSectionLibConstructor (
//
SavedData.NumberOfExtractHandler = 0;
- BuildGuidDataHob(&HobGuid, &SavedData, sizeof(SavedData));
+ BuildGuidDataHob (&HobGuid, &SavedData, sizeof (SavedData));
return RETURN_SUCCESS;
}