diff options
-rw-r--r-- | EdkModulePkg/Include/Common/FlashMap.h | 2 | ||||
-rw-r--r-- | EdkNt32Pkg/Pei/FlashMap/FlashMap.c | 26 | ||||
-rw-r--r-- | Tools/CCode/Source/FlashMap/FlashDefFile.c | 64 |
3 files changed, 83 insertions, 9 deletions
diff --git a/EdkModulePkg/Include/Common/FlashMap.h b/EdkModulePkg/Include/Common/FlashMap.h index 829fa2d..9c0afc4 100644 --- a/EdkModulePkg/Include/Common/FlashMap.h +++ b/EdkModulePkg/Include/Common/FlashMap.h @@ -103,6 +103,8 @@ typedef struct { UINTN Length;
EFI_FLASH_AREA_ATTRIBUTES Attributes;
EFI_FLASH_AREA_TYPE AreaType;
+ UINT8 Reserved[3];
+ EFI_GUID AreaTypeGuid;
} EFI_FLASH_AREA_DATA;
#pragma pack()
diff --git a/EdkNt32Pkg/Pei/FlashMap/FlashMap.c b/EdkNt32Pkg/Pei/FlashMap/FlashMap.c index af8e13c..ae3ceb9 100644 --- a/EdkNt32Pkg/Pei/FlashMap/FlashMap.c +++ b/EdkNt32Pkg/Pei/FlashMap/FlashMap.c @@ -60,7 +60,9 @@ static EFI_FLASH_AREA_DATA mFlashAreaData[] = { EFI_VARIABLE_STORE_OFFSET,
EFI_VARIABLE_STORE_LENGTH,
EFI_FLASH_AREA_SUBFV | EFI_FLASH_AREA_MEMMAPPED_FV,
- EFI_FLASH_AREA_EFI_VARIABLES
+ EFI_FLASH_AREA_EFI_VARIABLES,
+ 0, 0, 0,
+ { 0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
},
//
// FTW spare (backup) block
@@ -69,7 +71,9 @@ static EFI_FLASH_AREA_DATA mFlashAreaData[] = { EFI_WINNT_FTW_SPARE_BLOCK_OFFSET,
EFI_WINNT_FTW_SPARE_BLOCK_LENGTH,
EFI_FLASH_AREA_SUBFV | EFI_FLASH_AREA_MEMMAPPED_FV,
- EFI_FLASH_AREA_FTW_BACKUP
+ EFI_FLASH_AREA_FTW_BACKUP,
+ 0, 0, 0,
+ { 0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
},
//
// FTW private working (state) area
@@ -78,7 +82,9 @@ static EFI_FLASH_AREA_DATA mFlashAreaData[] = { EFI_FTW_WORKING_OFFSET,
EFI_FTW_WORKING_LENGTH,
EFI_FLASH_AREA_SUBFV | EFI_FLASH_AREA_MEMMAPPED_FV,
- EFI_FLASH_AREA_FTW_STATE
+ EFI_FLASH_AREA_FTW_STATE,
+ 0, 0, 0,
+ { 0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
},
//
// Recovery FV
@@ -87,7 +93,9 @@ static EFI_FLASH_AREA_DATA mFlashAreaData[] = { EFI_WINNT_FIRMWARE_OFFSET,
EFI_WINNT_FIRMWARE_LENGTH,
EFI_FLASH_AREA_FV | EFI_FLASH_AREA_MEMMAPPED_FV,
- EFI_FLASH_AREA_RECOVERY_BIOS
+ EFI_FLASH_AREA_RECOVERY_BIOS,
+ 0, 0, 0,
+ { 0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
},
//
// System Non-Volatile Storage FV
@@ -96,7 +104,9 @@ static EFI_FLASH_AREA_DATA mFlashAreaData[] = { EFI_WINNT_RUNTIME_UPDATABLE_OFFSET,
EFI_WINNT_RUNTIME_UPDATABLE_LENGTH + EFI_WINNT_FTW_SPARE_BLOCK_LENGTH,
EFI_FLASH_AREA_FV | EFI_FLASH_AREA_MEMMAPPED_FV,
- EFI_FLASH_AREA_GUID_DEFINED
+ EFI_FLASH_AREA_GUID_DEFINED,
+ 0, 0, 0,
+ EFI_SYSTEM_NV_DATA_HOB_GUID
},
};
@@ -213,7 +223,7 @@ Returns: case EFI_FLASH_AREA_GUID_DEFINED:
(*PeiServices)->CopyMem (
&FlashHobData.AreaTypeGuid,
- &gEfiSystemNvDataHobGuid,
+ &mFlashAreaData[Index].AreaTypeGuid,
sizeof (EFI_GUID)
);
(*PeiServices)->CopyMem (
@@ -275,7 +285,7 @@ GetAreaInfo ( if (AreaType == FlashMapEntry->AreaType) {
if (AreaType == EFI_FLASH_AREA_GUID_DEFINED) {
if (!CompareGuid (AreaTypeGuid, &FlashMapEntry->AreaTypeGuid)) {
- continue;
+ goto NextHob;
}
}
@@ -284,7 +294,7 @@ GetAreaInfo ( return EFI_SUCCESS;
}
}
-
+ NextHob:
Hob.Raw = GET_NEXT_HOB (Hob);
}
diff --git a/Tools/CCode/Source/FlashMap/FlashDefFile.c b/Tools/CCode/Source/FlashMap/FlashDefFile.c index 0bfdad2..5a9205a 100644 --- a/Tools/CCode/Source/FlashMap/FlashDefFile.c +++ b/Tools/CCode/Source/FlashMap/FlashDefFile.c @@ -76,6 +76,8 @@ typedef struct _FLASH_BLOCK_DESCRIPTION { unsigned int Alignment; // power of 2 alignment
WCHAR_T Attributes[MAX_ATTR_LEN]; // only used for Region definitions
WCHAR_T AreaType[MAX_AREATYPE_LEN]; // only used for Region definitions
+ EFI_GUID AreaTypeGuid;
+ WCHAR_T AreaTypeGuidString[MAX_NAME_LEN];
FLASH_SUBREGION_DESCRIPTION *Subregions;
FLASH_SUBREGION_DESCRIPTION *LastSubregion;
} FLASH_BLOCK_DESCRIPTION;
@@ -796,6 +798,41 @@ Returns: PreviousComma = SFPIsToken (",");
//
+ // Parse optional attribute "AreaTypeGuid"
+ //
+ if (SFPIsKeyword ("AreaTypeGuid")) {
+ //
+ // Check for preceeding comma now
+ //
+ if (!PreviousComma) {
+ Warning (SFPGetFileName (), SFPGetLineNumber (), 0, "expected ',' before 'AreaTypeGuid'", NULL);
+ WarningCount++;
+ }
+
+ if (!SFPIsToken ("=")) {
+ Warning (SFPGetFileName (), SFPGetLineNumber (), 0, "expected '='", NULL);
+ WarningCount++;
+ }
+
+ if (SFPGetQuotedString (FBlockDesc->AreaTypeGuidString, sizeof (FBlockDesc->AreaTypeGuidString))) {
+ //
+ // Nothing else to do
+ //
+ } else if (!SFPGetGuid (PARSE_GUID_STYLE_5_FIELDS, &FBlockDesc->AreaTypeGuid)) {
+ Error (
+ SFPGetFileName (),
+ SFPGetLineNumber (),
+ 0,
+ "expected AreaTypeGuid quoted string or GUID of form 12345678-1234-1234-1234-123456789ABC",
+ NULL
+ );
+ ErrorCount++;
+ goto Done;
+ }
+ PreviousComma = SFPIsToken (",");
+ }
+
+ //
// Parse optional Subregion definitions
//
SubregionSizeLeft = FBlockDesc->Size;
@@ -1781,7 +1818,32 @@ Returns: fprintf (OutFptr, " FLASH_REGION_%s_BASE,\\\n", FBlock->Name);
fprintf (OutFptr, " FLASH_REGION_%s_SIZE,\\\n", FBlock->Name);
fprintf (OutFptr, " %s,\\\n", FBlock->Attributes);
- fprintf (OutFptr, " %s,\\\n },\\\n", FBlock->AreaType);
+ fprintf (OutFptr, " %s,\\\n", FBlock->AreaType);
+ fprintf (OutFptr, " 0, 0, 0,\\\n");
+ //
+ // The AreaTypeGuid may have been specified in the input flash definition file as a GUID, or
+ // as a quoted string. Do the right one.
+ //
+ if (FBlock->AreaTypeGuidString[0] != 0) {
+ fprintf (OutFptr, " %s, \\\n", FBlock->AreaTypeGuidString);
+ } else {
+ fprintf (
+ OutFptr,
+ " { 0x%08X, 0x%04X, 0x%04X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X },\\\n",
+ FBlock->AreaTypeGuid.Data1,
+ (unsigned int) FBlock->AreaTypeGuid.Data2,
+ (unsigned int) FBlock->AreaTypeGuid.Data3,
+ (unsigned int) FBlock->AreaTypeGuid.Data4[0],
+ (unsigned int) FBlock->AreaTypeGuid.Data4[1],
+ (unsigned int) FBlock->AreaTypeGuid.Data4[2],
+ (unsigned int) FBlock->AreaTypeGuid.Data4[3],
+ (unsigned int) FBlock->AreaTypeGuid.Data4[4],
+ (unsigned int) FBlock->AreaTypeGuid.Data4[5],
+ (unsigned int) FBlock->AreaTypeGuid.Data4[6],
+ (unsigned int) FBlock->AreaTypeGuid.Data4[7]
+ );
+ }
+ fprintf (OutFptr, " },\\\n");
}
fprintf (OutFptr, "\n\n");
|