\r
Copyright (c) 2016 - 2017, Intel Corporation. All rights reserved.<BR>\r
\r
- This program and the accompanying materials\r
- are licensed and made available under the terms and conditions\r
- of the BSD License which accompanies this distribution. The\r
- full text of the license may be found at\r
- http://opensource.org/licenses/bsd-license.php\r
-\r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+ SPDX-License-Identifier: BSD-2-Clause-Patent\r
\r
**/\r
\r
#include <Library/IniParsingLib.h>\r
#include <Library/PrintLib.h>\r
\r
-#define MAX_LINE_LENGTH 512\r
+#define MAX_LINE_LENGTH 512\r
\r
/**\r
Parse Config data file to get the updated data array.\r
**/\r
EFI_STATUS\r
ParseUpdateDataFile (\r
- IN UINT8 *DataBuffer,\r
- IN UINTN BufferSize,\r
- IN OUT CONFIG_HEADER *ConfigHeader,\r
- IN OUT UPDATE_CONFIG_DATA **UpdateArray\r
+ IN UINT8 *DataBuffer,\r
+ IN UINTN BufferSize,\r
+ IN OUT CONFIG_HEADER *ConfigHeader,\r
+ IN OUT UPDATE_CONFIG_DATA **UpdateArray\r
)\r
{\r
- EFI_STATUS Status;\r
- CHAR8 *SectionName;\r
- CHAR8 Entry[MAX_LINE_LENGTH];\r
- UINTN Num;\r
- UINT64 Num64;\r
- UINTN Index;\r
- EFI_GUID FileGuid;\r
- VOID *Context;\r
+ EFI_STATUS Status;\r
+ CHAR8 *SectionName;\r
+ CHAR8 Entry[MAX_LINE_LENGTH];\r
+ UINTN Num;\r
+ UINT64 Num64;\r
+ UINTN Index;\r
+ EFI_GUID FileGuid;\r
+ VOID *Context;\r
\r
//\r
// First process the data buffer and get all sections and entries\r
//\r
- Context = OpenIniFile(DataBuffer, BufferSize);\r
+ Context = OpenIniFile (DataBuffer, BufferSize);\r
if (Context == NULL) {\r
return EFI_INVALID_PARAMETER;\r
}\r
//\r
// Now get NumOfUpdate\r
//\r
- Status = GetDecimalUintnFromDataFile(\r
+ Status = GetDecimalUintnFromDataFile (\r
Context,\r
"Head",\r
"NumOfUpdate",\r
&Num\r
);\r
- if (EFI_ERROR(Status) || (Num == 0)) {\r
- DEBUG((DEBUG_ERROR, "NumOfUpdate not found\n"));\r
- CloseIniFile(Context);\r
+ if (EFI_ERROR (Status) || (Num == 0)) {\r
+ DEBUG ((DEBUG_ERROR, "NumOfUpdate not found\n"));\r
+ CloseIniFile (Context);\r
return EFI_NOT_FOUND;\r
}\r
\r
ConfigHeader->NumOfUpdates = Num;\r
- *UpdateArray = AllocateZeroPool ((sizeof (UPDATE_CONFIG_DATA) * Num));\r
+ *UpdateArray = AllocateZeroPool ((sizeof (UPDATE_CONFIG_DATA) * Num));\r
if (*UpdateArray == NULL) {\r
- CloseIniFile(Context);\r
+ CloseIniFile (Context);\r
return EFI_OUT_OF_RESOURCES;\r
}\r
\r
- for (Index = 0 ; Index < ConfigHeader->NumOfUpdates ; Index++) {\r
+ for (Index = 0; Index < ConfigHeader->NumOfUpdates; Index++) {\r
//\r
// Get the section name of each update\r
//\r
Index,\r
0\r
);\r
- Status = GetStringFromDataFile(\r
+ Status = GetStringFromDataFile (\r
Context,\r
"Head",\r
Entry,\r
&SectionName\r
);\r
- if (EFI_ERROR(Status) || (SectionName == NULL)) {\r
- DEBUG((DEBUG_ERROR, "[%d] %a not found\n", Index, Entry));\r
- CloseIniFile(Context);\r
+ if (EFI_ERROR (Status) || (SectionName == NULL)) {\r
+ DEBUG ((DEBUG_ERROR, "[%d] %a not found\n", Index, Entry));\r
+ CloseIniFile (Context);\r
return EFI_NOT_FOUND;\r
}\r
\r
//\r
// FirmwareType\r
//\r
- Status = GetDecimalUintnFromDataFile(\r
+ Status = GetDecimalUintnFromDataFile (\r
Context,\r
SectionName,\r
"FirmwareType",\r
&Num\r
);\r
- if (EFI_ERROR(Status)) {\r
- CloseIniFile(Context);\r
- DEBUG((DEBUG_ERROR, "[%d] FirmwareType not found\n", Index));\r
+ if (EFI_ERROR (Status)) {\r
+ CloseIniFile (Context);\r
+ DEBUG ((DEBUG_ERROR, "[%d] FirmwareType not found\n", Index));\r
return EFI_NOT_FOUND;\r
}\r
- (*UpdateArray)[Index].FirmwareType = (PLATFORM_FIRMWARE_TYPE) Num;\r
+\r
+ (*UpdateArray)[Index].FirmwareType = (PLATFORM_FIRMWARE_TYPE)Num;\r
\r
//\r
// AddressType\r
//\r
- Status = GetDecimalUintnFromDataFile(\r
+ Status = GetDecimalUintnFromDataFile (\r
Context,\r
SectionName,\r
"AddressType",\r
&Num\r
);\r
- if (EFI_ERROR(Status)) {\r
- CloseIniFile(Context);\r
- DEBUG((DEBUG_ERROR, "[%d] AddressType not found\n", Index));\r
+ if (EFI_ERROR (Status)) {\r
+ CloseIniFile (Context);\r
+ DEBUG ((DEBUG_ERROR, "[%d] AddressType not found\n", Index));\r
return EFI_NOT_FOUND;\r
}\r
- (*UpdateArray)[Index].AddressType = (FLASH_ADDRESS_TYPE) Num;\r
+\r
+ (*UpdateArray)[Index].AddressType = (FLASH_ADDRESS_TYPE)Num;\r
\r
//\r
// BaseAddress\r
//\r
- Status = GetHexUint64FromDataFile(\r
+ Status = GetHexUint64FromDataFile (\r
Context,\r
SectionName,\r
"BaseAddress",\r
&Num64\r
);\r
- if (EFI_ERROR(Status)) {\r
- CloseIniFile(Context);\r
- DEBUG((DEBUG_ERROR, "[%d] BaseAddress not found\n", Index));\r
+ if (EFI_ERROR (Status)) {\r
+ CloseIniFile (Context);\r
+ DEBUG ((DEBUG_ERROR, "[%d] BaseAddress not found\n", Index));\r
return EFI_NOT_FOUND;\r
}\r
- (*UpdateArray)[Index].BaseAddress = (EFI_PHYSICAL_ADDRESS) Num64;\r
+\r
+ (*UpdateArray)[Index].BaseAddress = (EFI_PHYSICAL_ADDRESS)Num64;\r
\r
//\r
- // FileBuid\r
+ // FileGuid\r
//\r
- Status = GetGuidFromDataFile(\r
+ Status = GetGuidFromDataFile (\r
Context,\r
SectionName,\r
"FileGuid",\r
&FileGuid\r
);\r
- if (EFI_ERROR(Status)) {\r
- CloseIniFile(Context);\r
- DEBUG((DEBUG_ERROR, "[%d] FileGuid not found\n", Index));\r
+ if (EFI_ERROR (Status)) {\r
+ CloseIniFile (Context);\r
+ DEBUG ((DEBUG_ERROR, "[%d] FileGuid not found\n", Index));\r
return EFI_NOT_FOUND;\r
}\r
\r
- CopyGuid(&((*UpdateArray)[Index].FileGuid), &FileGuid);\r
+ CopyGuid (&((*UpdateArray)[Index].FileGuid), &FileGuid);\r
\r
//\r
// Length\r
//\r
- Status = GetHexUintnFromDataFile(\r
+ Status = GetHexUintnFromDataFile (\r
Context,\r
SectionName,\r
"Length",\r
&Num\r
);\r
- if (EFI_ERROR(Status)) {\r
- CloseIniFile(Context);\r
- DEBUG((DEBUG_ERROR, "[%d] Length not found\n", Index));\r
+ if (EFI_ERROR (Status)) {\r
+ CloseIniFile (Context);\r
+ DEBUG ((DEBUG_ERROR, "[%d] Length not found\n", Index));\r
return EFI_NOT_FOUND;\r
}\r
- (*UpdateArray)[Index].Length = (UINTN) Num;\r
+\r
+ (*UpdateArray)[Index].Length = (UINTN)Num;\r
\r
//\r
// ImageOffset\r
//\r
- Status = GetHexUintnFromDataFile(\r
+ Status = GetHexUintnFromDataFile (\r
Context,\r
SectionName,\r
"ImageOffset",\r
&Num\r
);\r
- if (EFI_ERROR(Status)) {\r
- CloseIniFile(Context);\r
- DEBUG((DEBUG_ERROR, "[%d] ImageOffset not found\n", Index));\r
+ if (EFI_ERROR (Status)) {\r
+ CloseIniFile (Context);\r
+ DEBUG ((DEBUG_ERROR, "[%d] ImageOffset not found\n", Index));\r
return EFI_NOT_FOUND;\r
}\r
- (*UpdateArray)[Index].ImageOffset = (UINTN) Num;\r
+\r
+ (*UpdateArray)[Index].ImageOffset = (UINTN)Num;\r
}\r
\r
//\r
// Now all configuration data got. Free those temporary buffers\r
//\r
- CloseIniFile(Context);\r
+ CloseIniFile (Context);\r
\r
return EFI_SUCCESS;\r
}\r
-\r