]> git.proxmox.com Git - mirror_edk2.git/blobdiff - SignedCapsulePkg/Universal/RecoveryModuleLoadPei/ParseConfigProfile.c
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[mirror_edk2.git] / SignedCapsulePkg / Universal / RecoveryModuleLoadPei / ParseConfigProfile.c
index 5cd690ddeb76d3f5b74a61d0c9d05717ce151523..3d4066f8475d7c45f338bcdbe25ae23cda890aa5 100644 (file)
@@ -12,7 +12,7 @@
 #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
 ParseRecoveryDataFile (\r
-  IN      UINT8                         *DataBuffer,\r
-  IN      UINTN                         BufferSize,\r
-  IN OUT  CONFIG_HEADER                 *ConfigHeader,\r
-  IN OUT  RECOVERY_CONFIG_DATA          **RecoveryArray\r
+  IN      UINT8                 *DataBuffer,\r
+  IN      UINTN                 BufferSize,\r
+  IN OUT  CONFIG_HEADER         *ConfigHeader,\r
+  IN OUT  RECOVERY_CONFIG_DATA  **RecoveryArray\r
   )\r
 {\r
-  EFI_STATUS                            Status;\r
-  CHAR8                                 *SectionName;\r
-  CHAR8                                 Entry[MAX_LINE_LENGTH];\r
-  UINTN                                 Num;\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
+  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
@@ -54,26 +54,26 @@ ParseRecoveryDataFile (
   //\r
   // Now get NumOfUpdate\r
   //\r
-  Status = GetDecimalUintnFromDataFile(\r
+  Status = GetDecimalUintnFromDataFile (\r
              Context,\r
              "Head",\r
              "NumOfRecovery",\r
              &Num\r
              );\r
-  if (EFI_ERROR(Status) || (Num == 0)) {\r
-    DEBUG((DEBUG_ERROR, "NumOfRecovery not found\n"));\r
-    CloseIniFile(Context);\r
+  if (EFI_ERROR (Status) || (Num == 0)) {\r
+    DEBUG ((DEBUG_ERROR, "NumOfRecovery not found\n"));\r
+    CloseIniFile (Context);\r
     return EFI_NOT_FOUND;\r
   }\r
 \r
   ConfigHeader->NumOfRecovery = Num;\r
-  *RecoveryArray = AllocateZeroPool ((sizeof (RECOVERY_CONFIG_DATA) * Num));\r
+  *RecoveryArray              = AllocateZeroPool ((sizeof (RECOVERY_CONFIG_DATA) * Num));\r
   if (*RecoveryArray == NULL) {\r
-    CloseIniFile(Context);\r
+    CloseIniFile (Context);\r
     return EFI_OUT_OF_RESOURCES;\r
   }\r
 \r
-  for (Index = 0 ; Index < ConfigHeader->NumOfRecovery; Index++) {\r
+  for (Index = 0; Index < ConfigHeader->NumOfRecovery; Index++) {\r
     //\r
     // Get the section name of each update\r
     //\r
@@ -85,15 +85,15 @@ ParseRecoveryDataFile (
       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
@@ -105,58 +105,59 @@ ParseRecoveryDataFile (
     //\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(&((*RecoveryArray)[Index].FileGuid), &FileGuid);\r
+    CopyGuid (&((*RecoveryArray)[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
+\r
     (*RecoveryArray)[Index].Length = 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
+\r
     (*RecoveryArray)[Index].ImageOffset = 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