Let specify GUID value for GUID-defined FV region, and remove potential dead loop...
[mirror_edk2.git] / EdkNt32Pkg / Pei / FlashMap / FlashMap.c
index af8e13c..ae3ceb9 100644 (file)
@@ -60,7 +60,9 @@ static EFI_FLASH_AREA_DATA    mFlashAreaData[] = {
     EFI_VARIABLE_STORE_OFFSET,\r
     EFI_VARIABLE_STORE_LENGTH,\r
     EFI_FLASH_AREA_SUBFV | EFI_FLASH_AREA_MEMMAPPED_FV,\r
-    EFI_FLASH_AREA_EFI_VARIABLES\r
+    EFI_FLASH_AREA_EFI_VARIABLES,\r
+    0, 0, 0,\r
+    { 0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }\r
   },\r
   //\r
   // FTW spare (backup) block\r
@@ -69,7 +71,9 @@ static EFI_FLASH_AREA_DATA    mFlashAreaData[] = {
     EFI_WINNT_FTW_SPARE_BLOCK_OFFSET,\r
     EFI_WINNT_FTW_SPARE_BLOCK_LENGTH,\r
     EFI_FLASH_AREA_SUBFV | EFI_FLASH_AREA_MEMMAPPED_FV,\r
-    EFI_FLASH_AREA_FTW_BACKUP\r
+    EFI_FLASH_AREA_FTW_BACKUP,\r
+    0, 0, 0,\r
+    { 0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }\r
   },\r
   //\r
   // FTW private working (state) area\r
@@ -78,7 +82,9 @@ static EFI_FLASH_AREA_DATA    mFlashAreaData[] = {
     EFI_FTW_WORKING_OFFSET,\r
     EFI_FTW_WORKING_LENGTH,\r
     EFI_FLASH_AREA_SUBFV | EFI_FLASH_AREA_MEMMAPPED_FV,\r
-    EFI_FLASH_AREA_FTW_STATE\r
+    EFI_FLASH_AREA_FTW_STATE,\r
+    0, 0, 0,\r
+    { 0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }\r
   },\r
   //\r
   // Recovery FV\r
@@ -87,7 +93,9 @@ static EFI_FLASH_AREA_DATA    mFlashAreaData[] = {
     EFI_WINNT_FIRMWARE_OFFSET,\r
     EFI_WINNT_FIRMWARE_LENGTH,\r
     EFI_FLASH_AREA_FV | EFI_FLASH_AREA_MEMMAPPED_FV,\r
-    EFI_FLASH_AREA_RECOVERY_BIOS\r
+    EFI_FLASH_AREA_RECOVERY_BIOS,\r
+    0, 0, 0,\r
+    { 0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }\r
   },\r
   //\r
   // System Non-Volatile Storage FV\r
@@ -96,7 +104,9 @@ static EFI_FLASH_AREA_DATA    mFlashAreaData[] = {
     EFI_WINNT_RUNTIME_UPDATABLE_OFFSET,\r
     EFI_WINNT_RUNTIME_UPDATABLE_LENGTH + EFI_WINNT_FTW_SPARE_BLOCK_LENGTH,\r
     EFI_FLASH_AREA_FV | EFI_FLASH_AREA_MEMMAPPED_FV,\r
-    EFI_FLASH_AREA_GUID_DEFINED\r
+    EFI_FLASH_AREA_GUID_DEFINED,\r
+    0, 0, 0,\r
+    EFI_SYSTEM_NV_DATA_HOB_GUID\r
   },\r
 };\r
 \r
@@ -213,7 +223,7 @@ Returns:
     case EFI_FLASH_AREA_GUID_DEFINED:\r
       (*PeiServices)->CopyMem (\r
                         &FlashHobData.AreaTypeGuid,\r
-                        &gEfiSystemNvDataHobGuid,\r
+                        &mFlashAreaData[Index].AreaTypeGuid,\r
                         sizeof (EFI_GUID)\r
                         );\r
       (*PeiServices)->CopyMem (\r
@@ -275,7 +285,7 @@ GetAreaInfo (
       if (AreaType == FlashMapEntry->AreaType) {\r
         if (AreaType == EFI_FLASH_AREA_GUID_DEFINED) {\r
           if (!CompareGuid (AreaTypeGuid, &FlashMapEntry->AreaTypeGuid)) {\r
-            continue;\r
+            goto NextHob;\r
           }\r
         }\r
 \r
@@ -284,7 +294,7 @@ GetAreaInfo (
         return EFI_SUCCESS;\r
       }\r
     }\r
-\r
+  NextHob:\r
     Hob.Raw = GET_NEXT_HOB (Hob);\r
   }\r
 \r