#include <Library/ExtractGuidedSectionLib.h>\r
#include <Library/UefiBootServicesTableLib.h>\r
\r
-#define EXTRACT_HANDLER_TABLE_SIZE 0x10\r
+#define EXTRACT_HANDLER_TABLE_SIZE 0x10\r
\r
-UINT32 mNumberOfExtractHandler = 0;\r
-UINT32 mMaxNumberOfExtractHandler = 0;\r
+UINT32 mNumberOfExtractHandler = 0;\r
+UINT32 mMaxNumberOfExtractHandler = 0;\r
\r
-GUID *mExtractHandlerGuidTable = NULL;\r
-EXTRACT_GUIDED_SECTION_DECODE_HANDLER *mExtractDecodeHandlerTable = NULL;\r
-EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER *mExtractGetInfoHandlerTable = NULL;\r
+GUID *mExtractHandlerGuidTable = NULL;\r
+EXTRACT_GUIDED_SECTION_DECODE_HANDLER *mExtractDecodeHandlerTable = NULL;\r
+EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER *mExtractGetInfoHandlerTable = NULL;\r
\r
/**\r
Reallocates more global memory to store the registered guid and Handler list.\r
mMaxNumberOfExtractHandler * sizeof (GUID),\r
(mMaxNumberOfExtractHandler + EXTRACT_HANDLER_TABLE_SIZE) * sizeof (GUID),\r
mExtractHandlerGuidTable\r
- );\r
+ );\r
\r
if (mExtractHandlerGuidTable == NULL) {\r
goto Done;\r
// Reallocate memory for Decode handler Table\r
//\r
mExtractDecodeHandlerTable = ReallocatePool (\r
- mMaxNumberOfExtractHandler * sizeof (EXTRACT_GUIDED_SECTION_DECODE_HANDLER),\r
- (mMaxNumberOfExtractHandler + EXTRACT_HANDLER_TABLE_SIZE) * sizeof (EXTRACT_GUIDED_SECTION_DECODE_HANDLER),\r
- mExtractDecodeHandlerTable\r
- );\r
+ mMaxNumberOfExtractHandler * sizeof (EXTRACT_GUIDED_SECTION_DECODE_HANDLER),\r
+ (mMaxNumberOfExtractHandler + EXTRACT_HANDLER_TABLE_SIZE) * sizeof (EXTRACT_GUIDED_SECTION_DECODE_HANDLER),\r
+ mExtractDecodeHandlerTable\r
+ );\r
\r
if (mExtractDecodeHandlerTable == NULL) {\r
goto Done;\r
// Reallocate memory for GetInfo handler Table\r
//\r
mExtractGetInfoHandlerTable = ReallocatePool (\r
- mMaxNumberOfExtractHandler * sizeof (EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER),\r
- (mMaxNumberOfExtractHandler + EXTRACT_HANDLER_TABLE_SIZE) * sizeof (EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER),\r
- mExtractGetInfoHandlerTable\r
- );\r
+ mMaxNumberOfExtractHandler * sizeof (EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER),\r
+ (mMaxNumberOfExtractHandler + EXTRACT_HANDLER_TABLE_SIZE) * sizeof (EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER),\r
+ mExtractGetInfoHandlerTable\r
+ );\r
\r
if (mExtractGetInfoHandlerTable == NULL) {\r
goto Done;\r
if (mExtractHandlerGuidTable != NULL) {\r
FreePool (mExtractHandlerGuidTable);\r
}\r
+\r
if (mExtractDecodeHandlerTable != NULL) {\r
FreePool (mExtractDecodeHandlerTable);\r
}\r
+\r
if (mExtractGetInfoHandlerTable != NULL) {\r
FreePool (mExtractGetInfoHandlerTable);\r
}\r
\r
return RETURN_OUT_OF_RESOURCES;\r
}\r
+\r
/**\r
Constructor allocates the global memory to store the registered guid and Handler list.\r
\r
IN EXTRACT_GUIDED_SECTION_DECODE_HANDLER DecodeHandler\r
)\r
{\r
- UINT32 Index;\r
- VOID *GuidData;\r
+ UINT32 Index;\r
+ VOID *GuidData;\r
\r
//\r
// Check input parameter.\r
//\r
// Search the match registered GetInfo handler for the input guided section.\r
//\r
- for (Index = 0; Index < mNumberOfExtractHandler; Index ++) {\r
+ for (Index = 0; Index < mNumberOfExtractHandler; Index++) {\r
if (CompareGuid (&mExtractHandlerGuidTable[Index], SectionGuid)) {\r
//\r
// If the guided handler has been registered before, only update its handler.\r
//\r
- mExtractDecodeHandlerTable [Index] = DecodeHandler;\r
- mExtractGetInfoHandlerTable [Index] = GetInfoHandler;\r
+ mExtractDecodeHandlerTable[Index] = DecodeHandler;\r
+ mExtractGetInfoHandlerTable[Index] = GetInfoHandler;\r
return RETURN_SUCCESS;\r
}\r
}\r
//\r
// Register new Handler and guid value.\r
//\r
- CopyGuid (&mExtractHandlerGuidTable [mNumberOfExtractHandler], SectionGuid);\r
- mExtractDecodeHandlerTable [mNumberOfExtractHandler] = DecodeHandler;\r
- mExtractGetInfoHandlerTable [mNumberOfExtractHandler++] = GetInfoHandler;\r
+ CopyGuid (&mExtractHandlerGuidTable[mNumberOfExtractHandler], SectionGuid);\r
+ mExtractDecodeHandlerTable[mNumberOfExtractHandler] = DecodeHandler;\r
+ mExtractGetInfoHandlerTable[mNumberOfExtractHandler++] = GetInfoHandler;\r
\r
//\r
// Install the Guided Section GUID configuration table to record the GUID itself.\r
// Then the content of the configuration table buffer will be the same as the GUID value itself.\r
//\r
- GuidData = AllocateCopyPool (sizeof (GUID), (VOID *) SectionGuid);\r
+ GuidData = AllocateCopyPool (sizeof (GUID), (VOID *)SectionGuid);\r
if (GuidData != NULL) {\r
- gBS->InstallConfigurationTable ((EFI_GUID *) SectionGuid, GuidData);\r
+ gBS->InstallConfigurationTable ((EFI_GUID *)SectionGuid, GuidData);\r
}\r
\r
return RETURN_SUCCESS;\r
OUT UINT16 *SectionAttribute\r
)\r
{\r
- UINT32 Index;\r
- EFI_GUID *SectionDefinitionGuid;\r
+ UINT32 Index;\r
+ EFI_GUID *SectionDefinitionGuid;\r
\r
ASSERT (InputSection != NULL);\r
ASSERT (OutputBufferSize != NULL);\r
ASSERT (SectionAttribute != NULL);\r
\r
if (IS_SECTION2 (InputSection)) {\r
- SectionDefinitionGuid = &(((EFI_GUID_DEFINED_SECTION2 *) InputSection)->SectionDefinitionGuid);\r
+ SectionDefinitionGuid = &(((EFI_GUID_DEFINED_SECTION2 *)InputSection)->SectionDefinitionGuid);\r
} else {\r
- SectionDefinitionGuid = &(((EFI_GUID_DEFINED_SECTION *) InputSection)->SectionDefinitionGuid);\r
+ SectionDefinitionGuid = &(((EFI_GUID_DEFINED_SECTION *)InputSection)->SectionDefinitionGuid);\r
}\r
\r
//\r
// Search the match registered GetInfo handler for the input guided section.\r
//\r
- for (Index = 0; Index < mNumberOfExtractHandler; Index ++) {\r
+ for (Index = 0; Index < mNumberOfExtractHandler; Index++) {\r
if (CompareGuid (&mExtractHandlerGuidTable[Index], SectionDefinitionGuid)) {\r
//\r
// Call the match handler to getinfo for the input section data.\r
//\r
- return mExtractGetInfoHandlerTable [Index] (\r
- InputSection,\r
- OutputBufferSize,\r
- ScratchBufferSize,\r
- SectionAttribute\r
- );\r
+ return mExtractGetInfoHandlerTable[Index](\r
+ InputSection,\r
+ OutputBufferSize,\r
+ ScratchBufferSize,\r
+ SectionAttribute\r
+ );\r
}\r
}\r
\r
OUT UINT32 *AuthenticationStatus\r
)\r
{\r
- UINT32 Index;\r
- EFI_GUID *SectionDefinitionGuid;\r
+ UINT32 Index;\r
+ EFI_GUID *SectionDefinitionGuid;\r
\r
//\r
// Check the input parameters\r
ASSERT (AuthenticationStatus != NULL);\r
\r
if (IS_SECTION2 (InputSection)) {\r
- SectionDefinitionGuid = &(((EFI_GUID_DEFINED_SECTION2 *) InputSection)->SectionDefinitionGuid);\r
+ SectionDefinitionGuid = &(((EFI_GUID_DEFINED_SECTION2 *)InputSection)->SectionDefinitionGuid);\r
} else {\r
- SectionDefinitionGuid = &(((EFI_GUID_DEFINED_SECTION *) InputSection)->SectionDefinitionGuid);\r
+ SectionDefinitionGuid = &(((EFI_GUID_DEFINED_SECTION *)InputSection)->SectionDefinitionGuid);\r
}\r
\r
//\r
// Search the match registered extract handler for the input guided section.\r
//\r
- for (Index = 0; Index < mNumberOfExtractHandler; Index ++) {\r
+ for (Index = 0; Index < mNumberOfExtractHandler; Index++) {\r
if (CompareGuid (&mExtractHandlerGuidTable[Index], SectionDefinitionGuid)) {\r
//\r
// Call the match handler to extract raw data for the input section data.\r
//\r
- return mExtractDecodeHandlerTable [Index] (\r
- InputSection,\r
- OutputBuffer,\r
- ScratchBuffer,\r
- AuthenticationStatus\r
- );\r
+ return mExtractDecodeHandlerTable[Index](\r
+ InputSection,\r
+ OutputBuffer,\r
+ ScratchBuffer,\r
+ AuthenticationStatus\r
+ );\r
}\r
}\r
\r
OUT EXTRACT_GUIDED_SECTION_DECODE_HANDLER *DecodeHandler OPTIONAL\r
)\r
{\r
- UINT32 Index;\r
+ UINT32 Index;\r
\r
//\r
// Check input parameter.\r
//\r
// Search the match registered GetInfo handler for the input guided section.\r
//\r
- for (Index = 0; Index < mNumberOfExtractHandler; Index ++) {\r
+ for (Index = 0; Index < mNumberOfExtractHandler; Index++) {\r
if (CompareGuid (&mExtractHandlerGuidTable[Index], SectionGuid)) {\r
-\r
//\r
// If the guided handler has been registered before, then return the registered handlers.\r
//\r
if (GetInfoHandler != NULL) {\r
*GetInfoHandler = mExtractGetInfoHandlerTable[Index];\r
}\r
+\r
if (DecodeHandler != NULL) {\r
*DecodeHandler = mExtractDecodeHandlerTable[Index];\r
}\r
+\r
return RETURN_SUCCESS;\r
}\r
}\r
+\r
return RETURN_NOT_FOUND;\r
}\r