Let specify GUID value for GUID-defined FV region, and remove potential dead loop in Nt32 package.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2065 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
xli24 2006-12-07 06:02:54 +00:00
parent 30f80dd8de
commit 02918ed0ab
3 changed files with 83 additions and 9 deletions

View File

@ -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()

View File

@ -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);
}

View File

@ -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;
@ -795,6 +797,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
//
@ -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");