Sync EDKII BaseTools to BaseTools project r1903.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10123 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@@ -4,7 +4,7 @@ Abstract:
|
||||
Patch the BPB information in boot sector image file.
|
||||
Patch the MBR code in MBR image file.
|
||||
|
||||
Copyright 2006 - 2008, Intel Corporation
|
||||
Copyright 2006 - 2010, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
@@ -56,7 +56,7 @@ Returns:
|
||||
--*/
|
||||
{
|
||||
printf ("%s v%d.%d - Utility to break a file into two pieces at the specified offset.\n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION);
|
||||
printf ("Copyright (c) 1999-2007 Intel Corporation. All rights reserved.\n");
|
||||
printf ("Copyright (c) 1999-2010 Intel Corporation. All rights reserved.\n");
|
||||
}
|
||||
|
||||
void
|
||||
|
@@ -44,18 +44,6 @@ STATIC UINT32 mMaxWarnings = 0;
|
||||
STATIC UINT32 mMaxWarningsPlusErrors = 0;
|
||||
STATIC INT8 mPrintLimitsSet = 0;
|
||||
|
||||
STATIC
|
||||
VOID
|
||||
PrintMessage (
|
||||
CHAR8 *Type,
|
||||
CHAR8 *FileName,
|
||||
UINT32 LineNumber,
|
||||
UINT32 MessageCode,
|
||||
CHAR8 *Text,
|
||||
CHAR8 *MsgFmt,
|
||||
va_list List
|
||||
);
|
||||
|
||||
STATIC
|
||||
VOID
|
||||
PrintLimitExceeded (
|
||||
@@ -151,12 +139,6 @@ Notes:
|
||||
va_start (List, MsgFmt);
|
||||
PrintMessage ("ERROR", FileName, LineNumber, MessageCode, Text, MsgFmt, List);
|
||||
va_end (List);
|
||||
//
|
||||
// Set status accordingly
|
||||
//
|
||||
if (mStatus < STATUS_ERROR) {
|
||||
mStatus = STATUS_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
VOID
|
||||
@@ -211,12 +193,6 @@ Returns:
|
||||
va_start (List, MsgFmt);
|
||||
PrintMessage ("ERROR", mSourceFileName, mSourceFileLineNum, MessageCode, Text, MsgFmt, List);
|
||||
va_end (List);
|
||||
//
|
||||
// Set status accordingly
|
||||
//
|
||||
if (mStatus < STATUS_ERROR) {
|
||||
mStatus = STATUS_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
VOID
|
||||
@@ -396,7 +372,6 @@ Returns:
|
||||
va_end (List);
|
||||
}
|
||||
|
||||
STATIC
|
||||
VOID
|
||||
PrintMessage (
|
||||
CHAR8 *Type,
|
||||
@@ -517,6 +492,15 @@ Notes:
|
||||
sprintf (Line, "%s", mUtilityName);
|
||||
}
|
||||
}
|
||||
|
||||
if (strcmp (Type, "ERROR") == 0) {
|
||||
//
|
||||
// Set status accordingly for ERROR information.
|
||||
//
|
||||
if (mStatus < STATUS_ERROR) {
|
||||
mStatus = STATUS_ERROR;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
@@ -545,6 +529,7 @@ Notes:
|
||||
vsprintf (Line2, MsgFmt, List);
|
||||
fprintf (stdout, " %s\n", Line2);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
STATIC
|
||||
|
@@ -70,6 +70,17 @@ SetUtilityName (
|
||||
)
|
||||
;
|
||||
|
||||
VOID
|
||||
PrintMessage (
|
||||
CHAR8 *Type,
|
||||
CHAR8 *FileName,
|
||||
UINT32 LineNumber,
|
||||
UINT32 MessageCode,
|
||||
CHAR8 *Text,
|
||||
CHAR8 *MsgFmt,
|
||||
va_list List
|
||||
);
|
||||
|
||||
VOID
|
||||
Error (
|
||||
CHAR8 *FileName,
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/** @file
|
||||
|
||||
Copyright (c) 2004 - 2008, Intel Corporation
|
||||
Copyright (c) 2004 - 2010, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
@@ -484,13 +484,14 @@ Returns:
|
||||
--*/
|
||||
{
|
||||
UINT8 Index;
|
||||
UINT64 HexNumber;
|
||||
UINT64 Value;
|
||||
CHAR8 CurrentChar;
|
||||
|
||||
//
|
||||
// Initialize the result
|
||||
//
|
||||
HexNumber = 0;
|
||||
Value = 0;
|
||||
Index = 0;
|
||||
|
||||
//
|
||||
// Check input paramter
|
||||
@@ -498,50 +499,65 @@ Returns:
|
||||
if (AsciiString == NULL || ReturnValue == NULL) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
while (AsciiString[Index] == ' ') {
|
||||
Index ++;
|
||||
}
|
||||
|
||||
//
|
||||
// Add each character to the result
|
||||
//
|
||||
if (IsHex || (AsciiString[0] == '0' && (AsciiString[1] == 'x' || AsciiString[1] == 'X'))) {
|
||||
//
|
||||
// Verify string is a hex number
|
||||
//
|
||||
for (Index = 2; Index < strlen (AsciiString); Index++) {
|
||||
if (isxdigit ((int)AsciiString[Index]) == 0) {
|
||||
return EFI_ABORTED;
|
||||
}
|
||||
}
|
||||
if (IsHex || (AsciiString[Index] == '0' && (AsciiString[Index + 1] == 'x' || AsciiString[Index + 1] == 'X'))) {
|
||||
//
|
||||
// Convert the hex string.
|
||||
//
|
||||
for (Index = 2; AsciiString[Index] != '\0'; Index++) {
|
||||
for (Index = Index + 2; AsciiString[Index] != '\0'; Index++) {
|
||||
CurrentChar = AsciiString[Index];
|
||||
HexNumber *= 16;
|
||||
if (CurrentChar >= '0' && CurrentChar <= '9') {
|
||||
HexNumber += CurrentChar - '0';
|
||||
} else if (CurrentChar >= 'a' && CurrentChar <= 'f') {
|
||||
HexNumber += CurrentChar - 'a' + 10;
|
||||
} else if (CurrentChar >= 'A' && CurrentChar <= 'F') {
|
||||
HexNumber += CurrentChar - 'A' + 10;
|
||||
} else {
|
||||
//
|
||||
// Unrecognized character
|
||||
//
|
||||
if (CurrentChar == ' ') {
|
||||
break;
|
||||
}
|
||||
//
|
||||
// Verify Hex string
|
||||
//
|
||||
if (isxdigit ((int)CurrentChar) == 0) {
|
||||
return EFI_ABORTED;
|
||||
}
|
||||
//
|
||||
// Add hex value
|
||||
//
|
||||
Value *= 16;
|
||||
if (CurrentChar >= '0' && CurrentChar <= '9') {
|
||||
Value += CurrentChar - '0';
|
||||
} else if (CurrentChar >= 'a' && CurrentChar <= 'f') {
|
||||
Value += CurrentChar - 'a' + 10;
|
||||
} else if (CurrentChar >= 'A' && CurrentChar <= 'F') {
|
||||
Value += CurrentChar - 'A' + 10;
|
||||
}
|
||||
}
|
||||
|
||||
*ReturnValue = HexNumber;
|
||||
*ReturnValue = Value;
|
||||
} else {
|
||||
//
|
||||
// Verify string is a number
|
||||
// Convert dec string is a number
|
||||
//
|
||||
for (Index = 0; Index < strlen (AsciiString); Index++) {
|
||||
if (isdigit ((int)AsciiString[Index]) == 0) {
|
||||
for (; Index < strlen (AsciiString); Index++) {
|
||||
CurrentChar = AsciiString[Index];
|
||||
if (CurrentChar == ' ') {
|
||||
break;
|
||||
}
|
||||
//
|
||||
// Verify Dec string
|
||||
//
|
||||
if (isdigit ((int)CurrentChar) == 0) {
|
||||
return EFI_ABORTED;
|
||||
}
|
||||
//
|
||||
// Add dec value
|
||||
//
|
||||
Value = Value * 10;
|
||||
Value += CurrentChar - '0';
|
||||
}
|
||||
|
||||
*ReturnValue = atol (AsciiString);
|
||||
*ReturnValue = Value;
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/** @file
|
||||
|
||||
Copyright 2006 - 2008, Intel Corporation
|
||||
Copyright 2006 - 2010, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
@@ -84,7 +84,7 @@ Returns:
|
||||
--*/
|
||||
{
|
||||
printf ("%s v%d.%d -Utility to break a file into two pieces at the request offset.\n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION);
|
||||
printf ("Copyright (c) 1999-2007 Intel Corporation. All rights reserved.\n");
|
||||
printf ("Copyright (c) 1999-2010 Intel Corporation. All rights reserved.\n");
|
||||
}
|
||||
|
||||
VOID
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/** @file
|
||||
|
||||
Copyright (c) 1999-2008 Intel Corporation. All rights reserved
|
||||
Copyright (c) 1999-2010 Intel Corporation. All rights reserved
|
||||
This program and the accompanying materials are licensed and made available
|
||||
under the terms and conditions of the BSD License which accompanies this
|
||||
distribution. The full text of the license may be found at
|
||||
@@ -1205,7 +1205,7 @@ Returns:
|
||||
//
|
||||
// Copyright declaration
|
||||
//
|
||||
fprintf (stdout, "Copyright (c) 2007 - 2009, Intel Corporation. All rights reserved.\n\n");
|
||||
fprintf (stdout, "Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.\n\n");
|
||||
|
||||
//
|
||||
// Details Option
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/** @file
|
||||
|
||||
Copyright 2006 - 2008, Intel Corporation
|
||||
Copyright 2006 - 2010, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
@@ -542,7 +542,7 @@ Returns:
|
||||
--*/
|
||||
{
|
||||
printf ("%s v%d.%d -Utility to retrieve and update the boot sector or MBR.\n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION);
|
||||
printf ("Copyright (c) 2009 Intel Corporation. All rights reserved.\n");
|
||||
printf ("Copyright (c) 2009 - 2010 Intel Corporation. All rights reserved.\n");
|
||||
}
|
||||
|
||||
VOID
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/** @file
|
||||
|
||||
Copyright (c) 2007 - 2008, Intel Corporation
|
||||
Copyright (c) 2007 - 2010, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
@@ -86,7 +86,7 @@ Returns:
|
||||
//
|
||||
// Copyright declaration
|
||||
//
|
||||
fprintf (stdout, "Copyright (c) 2007 - 2009, Intel Corporation. All rights reserved.\n\n");
|
||||
fprintf (stdout, "Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.\n\n");
|
||||
|
||||
//
|
||||
// Details Option
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
|
||||
Copyright (c) 2004-2008, Intel Corporation
|
||||
Copyright (c) 2004-2010, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
@@ -119,7 +119,7 @@ Returns:
|
||||
//
|
||||
// Copyright declaration
|
||||
//
|
||||
fprintf (stdout, "Copyright (c) 2007, Intel Corporation. All rights reserved.\n\n");
|
||||
fprintf (stdout, "Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.\n\n");
|
||||
|
||||
//
|
||||
// Details Option
|
||||
@@ -287,6 +287,8 @@ Returns:
|
||||
EFI_COMMON_SECTION_HEADER TempSectHeader;
|
||||
EFI_TE_IMAGE_HEADER TeHeader;
|
||||
UINT32 TeOffset;
|
||||
EFI_GUID_DEFINED_SECTION GuidSectHeader;
|
||||
UINT32 HeaderSize;
|
||||
|
||||
Size = 0;
|
||||
Offset = 0;
|
||||
@@ -330,6 +332,7 @@ Returns:
|
||||
// Check this section is Te/Pe section, and Calculate the numbers of Te/Pe section.
|
||||
//
|
||||
TeOffset = 0;
|
||||
HeaderSize = sizeof (EFI_COMMON_SECTION_HEADER);
|
||||
fread (&TempSectHeader, 1, sizeof (TempSectHeader), InFile);
|
||||
if (TempSectHeader.Type == EFI_SECTION_TE) {
|
||||
(*PESectionNum) ++;
|
||||
@@ -339,8 +342,14 @@ Returns:
|
||||
}
|
||||
} else if (TempSectHeader.Type == EFI_SECTION_PE32) {
|
||||
(*PESectionNum) ++;
|
||||
} else if (TempSectHeader.Type == EFI_SECTION_GUID_DEFINED) {
|
||||
fseek (InFile, 0, SEEK_SET);
|
||||
fread (&GuidSectHeader, 1, sizeof (GuidSectHeader), InFile);
|
||||
if ((GuidSectHeader.Attributes & EFI_GUIDED_SECTION_PROCESSING_REQUIRED) == 0) {
|
||||
HeaderSize = GuidSectHeader.DataOffset;
|
||||
}
|
||||
(*PESectionNum) ++;
|
||||
} else if (TempSectHeader.Type == EFI_SECTION_COMPRESSION ||
|
||||
TempSectHeader.Type == EFI_SECTION_GUID_DEFINED ||
|
||||
TempSectHeader.Type == EFI_SECTION_FIRMWARE_VOLUME_IMAGE) {
|
||||
//
|
||||
// for the encapsulated section, assume it contains Pe/Te section
|
||||
@@ -358,17 +367,18 @@ Returns:
|
||||
TeOffset = InputFileAlign [Index] - (TeOffset % InputFileAlign [Index]);
|
||||
TeOffset = TeOffset % InputFileAlign [Index];
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// make sure section data meet its alignment requirement by adding one raw pad section.
|
||||
// But the different sections have the different section header. Necessary or not?
|
||||
// Based on section type to adjust offset? Todo
|
||||
//
|
||||
if ((InputFileAlign [Index] != 0) && (((Size + sizeof (EFI_COMMON_SECTION_HEADER) + TeOffset) % InputFileAlign [Index]) != 0)) {
|
||||
Offset = (Size + 2 * sizeof (EFI_COMMON_SECTION_HEADER) + TeOffset + InputFileAlign [Index] - 1) & ~(InputFileAlign [Index] - 1);
|
||||
Offset = Offset - Size - sizeof (EFI_COMMON_SECTION_HEADER) - TeOffset;
|
||||
if ((InputFileAlign [Index] != 0) && (((Size + HeaderSize + TeOffset) % InputFileAlign [Index]) != 0)) {
|
||||
Offset = (Size + sizeof (EFI_COMMON_SECTION_HEADER) + HeaderSize + TeOffset + InputFileAlign [Index] - 1) & ~(InputFileAlign [Index] - 1);
|
||||
Offset = Offset - Size - HeaderSize - TeOffset;
|
||||
|
||||
if (FileBuffer != NULL && ((Size + Offset) < *BufferLength)) {
|
||||
memset (FileBuffer + Size, 0, Offset);
|
||||
SectHeader = (EFI_COMMON_SECTION_HEADER *) (FileBuffer + Size);
|
||||
SectHeader->Type = EFI_SECTION_RAW;
|
||||
SectHeader->Size[0] = (UINT8) (Offset & 0xff);
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/** @file
|
||||
|
||||
Copyright (c) 2007 - 2009, Intel Corporation
|
||||
Copyright (c) 2007 - 2010, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
@@ -40,7 +40,7 @@ Abstract:
|
||||
//
|
||||
#define UTILITY_MAJOR_VERSION 0
|
||||
#define UTILITY_MINOR_VERSION 1
|
||||
#define GENFV_UPDATE_TIME " updated on 2008/11/21"
|
||||
#define GENFV_UPDATE_TIME " updated on 2010/2/1"
|
||||
|
||||
EFI_GUID mEfiFirmwareFileSystem2Guid = EFI_FIRMWARE_FILE_SYSTEM2_GUID;
|
||||
|
||||
@@ -97,7 +97,7 @@ Returns:
|
||||
//
|
||||
// Copyright declaration
|
||||
//
|
||||
fprintf (stdout, "Copyright (c) 2007, Intel Corporation. All rights reserved.\n\n");
|
||||
fprintf (stdout, "Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.\n\n");
|
||||
|
||||
//
|
||||
// Details Option
|
||||
@@ -126,11 +126,8 @@ Returns:
|
||||
run in Flash. It supports DEC or HEX digital format.\n\
|
||||
If it is set to zero, no rebase action will be taken\n");
|
||||
fprintf (stdout, " -a AddressFile, --addrfile AddressFile\n\
|
||||
AddressFile is one file used to record boot driver base\n\
|
||||
address and runtime driver base address. And this tool\n\
|
||||
will update these two addresses after it relocates all\n\
|
||||
boot drivers and runtime drivers in this fv iamge to\n\
|
||||
the preferred loaded memory address.\n");
|
||||
AddressFile is one file used to record the child\n\
|
||||
FV base address when current FV base address is set.\n");
|
||||
fprintf (stdout, " -m logfile, --map logfile\n\
|
||||
Logfile is the output fv map file name. if it is not\n\
|
||||
given, the FvName.map will be the default map file name\n");
|
||||
@@ -194,10 +191,8 @@ Returns:
|
||||
CHAR8 *InfFileImage;
|
||||
UINT32 InfFileSize;
|
||||
CHAR8 *OutFileName;
|
||||
CHAR8 ValueString[_MAX_PATH];
|
||||
BOOLEAN CapsuleFlag;
|
||||
BOOLEAN DumpCapsule;
|
||||
MEMORY_FILE AddrMemoryFile;
|
||||
FILE *FpFile;
|
||||
EFI_CAPSULE_HEADER *CapsuleHeader;
|
||||
UINT64 LogLevel, TempNumber;
|
||||
@@ -545,62 +540,6 @@ Returns:
|
||||
VerboseMsg ("the output file name is %s", OutFileName);
|
||||
}
|
||||
|
||||
//
|
||||
// Read boot and runtime address from address file
|
||||
//
|
||||
if (AddrFileName != NULL) {
|
||||
VerboseMsg ("the input address file name is %s", AddrFileName);
|
||||
Status = GetFileImage (AddrFileName, &InfFileImage, &InfFileSize);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return STATUS_ERROR;
|
||||
}
|
||||
|
||||
AddrMemoryFile.FileImage = InfFileImage;
|
||||
AddrMemoryFile.CurrentFilePointer = InfFileImage;
|
||||
AddrMemoryFile.Eof = InfFileImage + InfFileSize;
|
||||
|
||||
//
|
||||
// Read the boot driver base address for this FV image
|
||||
//
|
||||
Status = FindToken (&AddrMemoryFile, OPTIONS_SECTION_STRING, EFI_FV_BOOT_DRIVER_BASE_ADDRESS_STRING, 0, ValueString);
|
||||
if (Status == EFI_SUCCESS) {
|
||||
//
|
||||
// Get the base address
|
||||
//
|
||||
Status = AsciiStringToUint64 (ValueString, FALSE, &TempNumber);
|
||||
if (EFI_ERROR (Status)) {
|
||||
Error (NULL, 0, 2000, "Invalid parameter", "%s = %s", EFI_FV_BOOT_DRIVER_BASE_ADDRESS_STRING, ValueString);
|
||||
return STATUS_ERROR;
|
||||
}
|
||||
mFvDataInfo.BootBaseAddress = TempNumber;
|
||||
DebugMsg (NULL, 0, 9, "Boot driver base address", "%s = %s", EFI_FV_BOOT_DRIVER_BASE_ADDRESS_STRING, ValueString);
|
||||
}
|
||||
|
||||
//
|
||||
// Read the FV runtime driver base address
|
||||
//
|
||||
Status = FindToken (&AddrMemoryFile, OPTIONS_SECTION_STRING, EFI_FV_RUNTIME_DRIVER_BASE_ADDRESS_STRING, 0, ValueString);
|
||||
if (Status == EFI_SUCCESS) {
|
||||
//
|
||||
// Get the base address
|
||||
//
|
||||
Status = AsciiStringToUint64 (ValueString, FALSE, &TempNumber);
|
||||
if (EFI_ERROR (Status)) {
|
||||
Error (NULL, 0, 2000, "Invalid parameter", "%s = %s", EFI_FV_RUNTIME_DRIVER_BASE_ADDRESS_STRING, ValueString);
|
||||
return STATUS_ERROR;
|
||||
}
|
||||
mFvDataInfo.RuntimeBaseAddress = TempNumber;
|
||||
DebugMsg (NULL, 0, 9, "Runtime driver base address", "%s = %s", EFI_FV_RUNTIME_DRIVER_BASE_ADDRESS_STRING, ValueString);
|
||||
}
|
||||
|
||||
//
|
||||
// free the allocated memory space for addr file.
|
||||
//
|
||||
free (InfFileImage);
|
||||
InfFileImage = NULL;
|
||||
InfFileSize = 0;
|
||||
}
|
||||
|
||||
//
|
||||
// Read the INF file image
|
||||
//
|
||||
@@ -683,32 +622,22 @@ Returns:
|
||||
//
|
||||
// update boot driver address and runtime driver address in address file
|
||||
//
|
||||
if (Status == EFI_SUCCESS && AddrFileName != NULL) {
|
||||
if (Status == EFI_SUCCESS && AddrFileName != NULL && mFvBaseAddressNumber > 0) {
|
||||
FpFile = fopen (AddrFileName, "w");
|
||||
if (FpFile == NULL) {
|
||||
Error (NULL, 0, 0001, "Error opening file", AddrFileName);
|
||||
return STATUS_ERROR;
|
||||
}
|
||||
fprintf (FpFile, OPTIONS_SECTION_STRING);
|
||||
fprintf (FpFile, FV_BASE_ADDRESS_STRING);
|
||||
fprintf (FpFile, "\n");
|
||||
if (mFvDataInfo.BootBaseAddress != 0) {
|
||||
fprintf (FpFile, EFI_FV_BOOT_DRIVER_BASE_ADDRESS_STRING);
|
||||
for (Index = 0; Index < mFvBaseAddressNumber; Index ++) {
|
||||
fprintf (
|
||||
FpFile,
|
||||
" = 0x%llx\n",
|
||||
(unsigned long long)mFvDataInfo.BootBaseAddress
|
||||
"0x%llx\n",
|
||||
(unsigned long long)mFvBaseAddress[Index]
|
||||
);
|
||||
DebugMsg (NULL, 0, 9, "Updated boot driver base address", "%s = 0x%llx", EFI_FV_RUNTIME_DRIVER_BASE_ADDRESS_STRING, (unsigned long long) mFvDataInfo.BootBaseAddress);
|
||||
}
|
||||
if (mFvDataInfo.RuntimeBaseAddress != 0) {
|
||||
fprintf (FpFile, EFI_FV_RUNTIME_DRIVER_BASE_ADDRESS_STRING);
|
||||
fprintf (
|
||||
FpFile,
|
||||
" = 0x%llx\n",
|
||||
(unsigned long long)mFvDataInfo.RuntimeBaseAddress
|
||||
);
|
||||
DebugMsg (NULL, 0, 9, "Updated runtime driver base address", "%s = 0x%llx", EFI_FV_RUNTIME_DRIVER_BASE_ADDRESS_STRING, (unsigned long long) mFvDataInfo.RuntimeBaseAddress);
|
||||
}
|
||||
fflush (FpFile);
|
||||
fclose (FpFile);
|
||||
}
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/** @file
|
||||
|
||||
Copyright (c) 2004 - 2009, Intel Corporation
|
||||
Copyright (c) 2004 - 2010, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
@@ -159,6 +159,9 @@ UINT8 m64kRecoveryStartupApDataArray[SIZEOF_ST
|
||||
FV_INFO mFvDataInfo;
|
||||
CAP_INFO mCapDataInfo;
|
||||
|
||||
EFI_PHYSICAL_ADDRESS mFvBaseAddress[0x10];
|
||||
UINT32 mFvBaseAddressNumber = 0;
|
||||
|
||||
EFI_STATUS
|
||||
ParseFvInf (
|
||||
IN MEMORY_FILE *InfFile,
|
||||
@@ -716,6 +719,11 @@ Returns:
|
||||
EFI_TE_IMAGE_HEADER *TEImageHeader;
|
||||
EFI_IMAGE_SECTION_HEADER *SectionHeader;
|
||||
unsigned long long TempLongAddress;
|
||||
UINT32 TextVirtualAddress;
|
||||
UINT32 DataVirtualAddress;
|
||||
EFI_PHYSICAL_ADDRESS LinkTimeBaseAddress;
|
||||
|
||||
|
||||
//
|
||||
// Init local variable
|
||||
//
|
||||
@@ -789,29 +797,35 @@ Returns:
|
||||
SectionHeader = (EFI_IMAGE_SECTION_HEADER *) (TEImageHeader + 1);
|
||||
Index = TEImageHeader->NumberOfSections;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// module information output
|
||||
//
|
||||
if (ImageBaseAddress == 0) {
|
||||
fprintf (FvMapFile, "%s (dummy) (", KeyWord);
|
||||
fprintf (FvMapFile, "BaseAddress=%08llx, ", (unsigned long long) ImageBaseAddress);
|
||||
fprintf (FvMapFile, "BaseAddress=%010llx, ", (unsigned long long) ImageBaseAddress);
|
||||
} else {
|
||||
fprintf (FvMapFile, "%s (", KeyWord);
|
||||
fprintf (FvMapFile, "BaseAddress=%08llx, ", (unsigned long long) (ImageBaseAddress + Offset));
|
||||
fprintf (FvMapFile, "%s (Fixed Flash Address, ", KeyWord);
|
||||
fprintf (FvMapFile, "BaseAddress=0x%010llx, ", (unsigned long long) (ImageBaseAddress + Offset));
|
||||
}
|
||||
fprintf (FvMapFile, "EntryPoint=%08llx, ", (unsigned long long) (ImageBaseAddress + AddressOfEntryPoint));
|
||||
fprintf (FvMapFile, "GUID=%s", FileGuidName);
|
||||
fprintf (FvMapFile, "EntryPoint=0x%010llx", (unsigned long long) (ImageBaseAddress + AddressOfEntryPoint));
|
||||
fprintf (FvMapFile, ")\n");
|
||||
|
||||
fprintf (FvMapFile, "(GUID=%s", FileGuidName);
|
||||
TextVirtualAddress = 0;
|
||||
DataVirtualAddress = 0;
|
||||
for (; Index > 0; Index --, SectionHeader ++) {
|
||||
if (stricmp ((CHAR8 *)SectionHeader->Name, ".text") == 0) {
|
||||
fprintf (FvMapFile, ".textbaseaddress=%08llx ", (unsigned long long) (ImageBaseAddress + SectionHeader->VirtualAddress));
|
||||
if (stricmp ((CHAR8 *)SectionHeader->Name, ".text") == 0) {
|
||||
TextVirtualAddress = SectionHeader->VirtualAddress;
|
||||
} else if (stricmp ((CHAR8 *)SectionHeader->Name, ".data") == 0) {
|
||||
fprintf (FvMapFile, ".databaseaddress=%08llx ", (unsigned long long) (ImageBaseAddress + SectionHeader->VirtualAddress));
|
||||
DataVirtualAddress = SectionHeader->VirtualAddress;
|
||||
} else if (stricmp ((CHAR8 *)SectionHeader->Name, ".sdata") == 0) {
|
||||
DataVirtualAddress = SectionHeader->VirtualAddress;
|
||||
}
|
||||
}
|
||||
fprintf (FvMapFile, "\n\n");
|
||||
fprintf (FvMapFile, " .textbaseaddress=0x%010llx", (unsigned long long) (ImageBaseAddress + TextVirtualAddress));
|
||||
fprintf (FvMapFile, " .databaseaddress=0x%010llx", (unsigned long long) (ImageBaseAddress + DataVirtualAddress));
|
||||
fprintf (FvMapFile, ")\n\n");
|
||||
|
||||
//
|
||||
// Open PeMapFile
|
||||
@@ -826,6 +840,7 @@ Returns:
|
||||
//
|
||||
// Output Functions information into Fv Map file
|
||||
//
|
||||
LinkTimeBaseAddress = 0;
|
||||
while (fgets (Line, MAX_LINE_LEN, PeMapFile) != NULL) {
|
||||
//
|
||||
// Skip blank line
|
||||
@@ -851,6 +866,9 @@ Returns:
|
||||
//
|
||||
FunctionType = 2;
|
||||
fgets (Line, MAX_LINE_LEN, PeMapFile);
|
||||
} else if (stricmp (KeyWord, "Preferred") ==0) {
|
||||
sscanf (Line + strlen (" Preferred load address is"), "%llx", &TempLongAddress);
|
||||
LinkTimeBaseAddress = (UINT64) TempLongAddress;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
@@ -861,24 +879,14 @@ Returns:
|
||||
sscanf (Line, "%s %s %llx %s", KeyWord, FunctionName, &TempLongAddress, FunctionTypeName);
|
||||
FunctionAddress = (UINT64) TempLongAddress;
|
||||
if (FunctionTypeName [1] == '\0' && (FunctionTypeName [0] == 'f' || FunctionTypeName [0] == 'F')) {
|
||||
fprintf (FvMapFile, " %016llx ", (unsigned long long) (ImageBaseAddress + FunctionAddress));
|
||||
fprintf (FvMapFile, "(%08llx) F ", (unsigned long long) (FunctionAddress - Offset));
|
||||
fprintf (FvMapFile, "%s\n", FunctionName);
|
||||
} else {
|
||||
fprintf (FvMapFile, " %016llx ", (unsigned long long) (ImageBaseAddress + FunctionAddress));
|
||||
fprintf (FvMapFile, "(%08llx) ", (unsigned long long) (FunctionAddress - Offset));
|
||||
fprintf (FvMapFile, " 0x%010llx ", (unsigned long long) (ImageBaseAddress + FunctionAddress - LinkTimeBaseAddress));
|
||||
fprintf (FvMapFile, "%s\n", FunctionName);
|
||||
}
|
||||
} else if (FunctionType == 2) {
|
||||
sscanf (Line, "%s %s %llx %s", KeyWord, FunctionName, &TempLongAddress, FunctionTypeName);
|
||||
FunctionAddress = (UINT64) TempLongAddress;
|
||||
if (FunctionTypeName [1] == '\0' && (FunctionTypeName [0] == 'f' || FunctionTypeName [0] == 'F')) {
|
||||
fprintf (FvMapFile, " %016llx ", (unsigned long long) (ImageBaseAddress + FunctionAddress));
|
||||
fprintf (FvMapFile, "(%08llx) FS ", (unsigned long long) (FunctionAddress - Offset));
|
||||
fprintf (FvMapFile, "%s\n", FunctionName);
|
||||
} else {
|
||||
fprintf (FvMapFile, " %016llx ", (unsigned long long) (ImageBaseAddress + FunctionAddress));
|
||||
fprintf (FvMapFile, "(%08llx) ", (unsigned long long) (FunctionAddress - Offset));
|
||||
fprintf (FvMapFile, " 0x%010llx ", (unsigned long long) (ImageBaseAddress + FunctionAddress - LinkTimeBaseAddress));
|
||||
fprintf (FvMapFile, "%s\n", FunctionName);
|
||||
}
|
||||
}
|
||||
@@ -898,7 +906,8 @@ AddFile (
|
||||
IN FV_INFO *FvInfo,
|
||||
IN UINTN Index,
|
||||
IN OUT EFI_FFS_FILE_HEADER **VtfFileImage,
|
||||
IN FILE *FvMapFile
|
||||
IN FILE *FvMapFile,
|
||||
IN FILE *FvReportFile
|
||||
)
|
||||
/*++
|
||||
|
||||
@@ -916,6 +925,7 @@ Arguments:
|
||||
VtfFileImage A pointer to the VTF file within the FvImage. If this is equal
|
||||
to the end of the FvImage then no VTF previously found.
|
||||
FvMapFile Pointer to FvMap File
|
||||
FvReportFile Pointer to FvReport File
|
||||
|
||||
Returns:
|
||||
|
||||
@@ -933,6 +943,7 @@ Returns:
|
||||
UINT32 CurrentFileAlignment;
|
||||
EFI_STATUS Status;
|
||||
UINTN Index1;
|
||||
UINT8 FileGuidString[PRINTED_GUID_BUFFER_SIZE];
|
||||
|
||||
Index1 = 0;
|
||||
//
|
||||
@@ -1071,6 +1082,10 @@ Returns:
|
||||
// copy VTF File
|
||||
//
|
||||
memcpy (*VtfFileImage, FileBuffer, FileSize);
|
||||
|
||||
PrintGuidToBuffer ((EFI_GUID *) FileBuffer, FileGuidString, sizeof (FileGuidString), TRUE);
|
||||
fprintf (FvReportFile, "0x%08X %s\n", (unsigned)(UINTN) (((UINT8 *)*VtfFileImage) - (UINTN)FvImage->FileImage), FileGuidString);
|
||||
|
||||
free (FileBuffer);
|
||||
DebugMsg (NULL, 0, 9, "Add VTF FFS file in FV image", NULL);
|
||||
return EFI_SUCCESS;
|
||||
@@ -1106,6 +1121,8 @@ Returns:
|
||||
// Copy the file
|
||||
//
|
||||
memcpy (FvImage->CurrentFilePointer, FileBuffer, FileSize);
|
||||
PrintGuidToBuffer ((EFI_GUID *) FileBuffer, FileGuidString, sizeof (FileGuidString), TRUE);
|
||||
fprintf (FvReportFile, "0x%08X %s\n", (unsigned) (FvImage->CurrentFilePointer - FvImage->FileImage), FileGuidString);
|
||||
FvImage->CurrentFilePointer += FileSize;
|
||||
} else {
|
||||
Error (NULL, 0, 4002, "Resource", "FV space is full, cannot add file %s.", FvInfo->FvFiles[Index]);
|
||||
@@ -1967,10 +1984,13 @@ Returns:
|
||||
EFI_FIRMWARE_VOLUME_EXT_HEADER *FvExtHeader;
|
||||
FILE *FvExtHeaderFile;
|
||||
UINTN FileSize;
|
||||
CHAR8 FvReportName[_MAX_PATH];
|
||||
FILE *FvReportFile;
|
||||
|
||||
FvBufferHeader = NULL;
|
||||
FvFile = NULL;
|
||||
FvMapFile = NULL;
|
||||
FvReportFile = NULL;
|
||||
|
||||
if (InfFileImage != NULL) {
|
||||
//
|
||||
@@ -2109,6 +2129,12 @@ Returns:
|
||||
}
|
||||
VerboseMsg ("FV Map file name is %s", FvMapName);
|
||||
|
||||
//
|
||||
// FvReport file to log the FV information in one Fvimage
|
||||
//
|
||||
strcpy (FvReportName, FvFileName);
|
||||
strcat (FvReportName, ".txt");
|
||||
|
||||
//
|
||||
// Calculate the FV size and Update Fv Size based on the actual FFS files.
|
||||
// And Update mFvDataInfo data.
|
||||
@@ -2224,6 +2250,14 @@ Returns:
|
||||
return EFI_ABORTED;
|
||||
}
|
||||
|
||||
//
|
||||
// Open FvReport file
|
||||
//
|
||||
FvReportFile = fopen(FvReportName, "w");
|
||||
if (FvReportFile == NULL) {
|
||||
Error (NULL, 0, 0001, "Error opening file", FvReportName);
|
||||
return EFI_ABORTED;
|
||||
}
|
||||
//
|
||||
// record FV size information into FvMap file.
|
||||
//
|
||||
@@ -2240,6 +2274,12 @@ Returns:
|
||||
fprintf (FvMapFile, " = 0x%x\n\n", (unsigned) (mFvTotalSize - mFvTakenSize));
|
||||
}
|
||||
|
||||
//
|
||||
// record FV size information to FvReportFile.
|
||||
//
|
||||
fprintf (FvReportFile, "%s = 0x%x\n", EFI_FV_TOTAL_SIZE_STRING, (unsigned) mFvTotalSize);
|
||||
fprintf (FvReportFile, "%s = 0x%x\n", EFI_FV_TAKEN_SIZE_STRING, (unsigned) mFvTakenSize);
|
||||
|
||||
//
|
||||
// Add PI FV extension header
|
||||
//
|
||||
@@ -2263,7 +2303,7 @@ Returns:
|
||||
//
|
||||
// Add the file
|
||||
//
|
||||
Status = AddFile (&FvImageMemoryFile, &mFvDataInfo, Index, &VtfFileImage, FvMapFile);
|
||||
Status = AddFile (&FvImageMemoryFile, &mFvDataInfo, Index, &VtfFileImage, FvMapFile, FvReportFile);
|
||||
|
||||
//
|
||||
// Exit if error detected while adding the file
|
||||
@@ -2358,13 +2398,19 @@ Finish:
|
||||
}
|
||||
|
||||
if (FvFile != NULL) {
|
||||
fflush (FvFile);
|
||||
fclose (FvFile);
|
||||
}
|
||||
|
||||
if (FvMapFile != NULL) {
|
||||
fflush (FvMapFile);
|
||||
fclose (FvMapFile);
|
||||
}
|
||||
|
||||
if (FvReportFile != NULL) {
|
||||
fflush (FvReportFile);
|
||||
fclose (FvReportFile);
|
||||
}
|
||||
return Status;
|
||||
}
|
||||
|
||||
@@ -2652,6 +2698,54 @@ Returns:
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
GetChildFvFromFfs (
|
||||
IN FV_INFO *FvInfo,
|
||||
IN EFI_FFS_FILE_HEADER *FfsFile,
|
||||
IN UINTN XipOffset
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
This function gets all child FvImages in the input FfsFile, and records
|
||||
their base address to the parent image.
|
||||
|
||||
Arguments:
|
||||
FvInfo A pointer to FV_INFO struture.
|
||||
FfsFile A pointer to Ffs file image that may contain FvImage.
|
||||
XipOffset The offset address to the parent FvImage base.
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCCESS Base address of child Fv image is recorded.
|
||||
--*/
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
UINTN Index;
|
||||
EFI_FILE_SECTION_POINTER SubFvSection;
|
||||
EFI_FIRMWARE_VOLUME_HEADER *SubFvImageHeader;
|
||||
EFI_PHYSICAL_ADDRESS SubFvBaseAddress;
|
||||
|
||||
for (Index = 1;; Index++) {
|
||||
//
|
||||
// Find FV section
|
||||
//
|
||||
Status = GetSectionByType (FfsFile, EFI_SECTION_FIRMWARE_VOLUME_IMAGE, Index, &SubFvSection);
|
||||
if (EFI_ERROR (Status)) {
|
||||
break;
|
||||
}
|
||||
SubFvImageHeader = (EFI_FIRMWARE_VOLUME_HEADER *) ((UINT8 *) SubFvSection.FVImageSection + sizeof (EFI_FIRMWARE_VOLUME_IMAGE_SECTION));
|
||||
//
|
||||
// Rebase on Flash
|
||||
//
|
||||
SubFvBaseAddress = FvInfo->BaseAddress + (UINTN) SubFvImageHeader - (UINTN) FfsFile + XipOffset;
|
||||
mFvBaseAddress[mFvBaseAddressNumber ++ ] = SubFvBaseAddress;
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
FfsRebase (
|
||||
IN OUT FV_INFO *FvInfo,
|
||||
@@ -2696,7 +2790,6 @@ Returns:
|
||||
EFI_FFS_FILE_STATE SavedState;
|
||||
EFI_IMAGE_OPTIONAL_HEADER_UNION *ImgHdr;
|
||||
EFI_TE_IMAGE_HEADER *TEImageHeader;
|
||||
UINT8 Flags;
|
||||
UINT8 *MemoryImagePointer;
|
||||
EFI_IMAGE_SECTION_HEADER *SectionHeader;
|
||||
CHAR8 PeFileName [_MAX_PATH];
|
||||
@@ -2717,26 +2810,12 @@ Returns:
|
||||
PeFileBuffer = NULL;
|
||||
|
||||
//
|
||||
// Check XipAddress, BootAddress and RuntimeAddress
|
||||
// Don't need to relocate image when BaseAddress is not set.
|
||||
//
|
||||
Flags = 0;
|
||||
XipBase = 0;
|
||||
if (FvInfo->BaseAddress != 0) {
|
||||
Flags |= REBASE_XIP_FILE;
|
||||
XipBase = FvInfo->BaseAddress + XipOffset;
|
||||
if (FvInfo->BaseAddress == 0) {
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
if (FvInfo->BootBaseAddress != 0) {
|
||||
Flags |= REBASE_BOOTTIME_FILE;
|
||||
}
|
||||
if (FvInfo->RuntimeBaseAddress != 0) {
|
||||
Flags |= REBASE_RUNTIME_FILE;
|
||||
}
|
||||
|
||||
//
|
||||
// Don't Rebase this FFS.
|
||||
// Only copy the original map file into the FvMap file
|
||||
// for the image that is not required to be relocated.
|
||||
//
|
||||
XipBase = FvInfo->BaseAddress + XipOffset;
|
||||
|
||||
//
|
||||
// We only process files potentially containing PE32 sections.
|
||||
@@ -2749,6 +2828,16 @@ Returns:
|
||||
case EFI_FV_FILETYPE_DRIVER:
|
||||
case EFI_FV_FILETYPE_DXE_CORE:
|
||||
break;
|
||||
case EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE:
|
||||
//
|
||||
// Rebase the inside FvImage.
|
||||
//
|
||||
GetChildFvFromFfs (FvInfo, FfsFile, XipOffset);
|
||||
|
||||
//
|
||||
// Search PE/TE section in FV sectin.
|
||||
//
|
||||
break;
|
||||
default:
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
@@ -2809,13 +2898,6 @@ Returns:
|
||||
case EFI_FV_FILETYPE_PEI_CORE:
|
||||
case EFI_FV_FILETYPE_PEIM:
|
||||
case EFI_FV_FILETYPE_COMBINED_PEIM_DRIVER:
|
||||
if ((Flags & REBASE_XIP_FILE) == 0) {
|
||||
//
|
||||
// We aren't relocating XIP code, so skip it.
|
||||
//
|
||||
goto WritePeMap;
|
||||
}
|
||||
|
||||
//
|
||||
// Check if section-alignment and file-alignment match or not
|
||||
//
|
||||
@@ -2889,70 +2971,18 @@ Returns:
|
||||
|
||||
case EFI_FV_FILETYPE_DRIVER:
|
||||
case EFI_FV_FILETYPE_DXE_CORE:
|
||||
switch (ImgHdr->Pe32.OptionalHeader.Subsystem) {
|
||||
case EFI_IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER:
|
||||
if ((Flags & REBASE_XIP_FILE) == REBASE_XIP_FILE) {
|
||||
//
|
||||
// Check if section-alignment and file-alignment match or not
|
||||
//
|
||||
if ((ImgHdr->Pe32.OptionalHeader.SectionAlignment != ImgHdr->Pe32.OptionalHeader.FileAlignment)) {
|
||||
//
|
||||
// Xip module has the same section alignment and file alignment.
|
||||
//
|
||||
Error (NULL, 0, 3000, "Invalid", "Section-Alignment and File-Alignment do not match : %s.", FileName);
|
||||
return EFI_ABORTED;
|
||||
}
|
||||
NewPe32BaseAddress = XipBase + (UINTN) CurrentPe32Section.Pe32Section + sizeof (EFI_PE32_SECTION) - (UINTN)FfsFile;
|
||||
BaseToUpdate = &XipBase;
|
||||
} else if ((Flags & REBASE_RUNTIME_FILE) == REBASE_RUNTIME_FILE) {
|
||||
//
|
||||
// make sure image base address at the section alignment
|
||||
//
|
||||
FvInfo->RuntimeBaseAddress = (FvInfo->RuntimeBaseAddress - ImageContext.ImageSize) & (~(ImageContext.SectionAlignment - 1));
|
||||
FvInfo->RuntimeBaseAddress = FvInfo->RuntimeBaseAddress & (~(EFI_PAGE_SIZE - 1));
|
||||
NewPe32BaseAddress = FvInfo->RuntimeBaseAddress;
|
||||
BaseToUpdate = &(FvInfo->RuntimeBaseAddress);
|
||||
} else {
|
||||
//
|
||||
// RT drivers aren't supposed to be relocated
|
||||
//
|
||||
goto WritePeMap;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
//
|
||||
// We treat all other subsystems the same as BS_DRIVER
|
||||
//
|
||||
if ((Flags & REBASE_XIP_FILE) == REBASE_XIP_FILE) {
|
||||
//
|
||||
// Check if section-alignment and file-alignment match or not
|
||||
//
|
||||
if ((ImgHdr->Pe32.OptionalHeader.SectionAlignment != ImgHdr->Pe32.OptionalHeader.FileAlignment)) {
|
||||
//
|
||||
// Xip module has the same section alignment and file alignment.
|
||||
//
|
||||
Error (NULL, 0, 3000, "Invalid", "Section-Alignment and File-Alignment do not match : %s.", FileName);
|
||||
return EFI_ABORTED;
|
||||
}
|
||||
NewPe32BaseAddress = XipBase + (UINTN) CurrentPe32Section.Pe32Section + sizeof (EFI_PE32_SECTION) - (UINTN)FfsFile;
|
||||
BaseToUpdate = &XipBase;
|
||||
} else if ((Flags & REBASE_BOOTTIME_FILE) == REBASE_BOOTTIME_FILE) {
|
||||
//
|
||||
// make sure image base address at the Section and Page alignment
|
||||
//
|
||||
FvInfo->BootBaseAddress = (FvInfo->BootBaseAddress - ImageContext.ImageSize) & (~(ImageContext.SectionAlignment - 1));
|
||||
FvInfo->BootBaseAddress = FvInfo->BootBaseAddress & (~(EFI_PAGE_SIZE - 1));
|
||||
NewPe32BaseAddress = FvInfo->BootBaseAddress;
|
||||
BaseToUpdate = &(FvInfo->BootBaseAddress);
|
||||
} else {
|
||||
//
|
||||
// Skip all BS_DRIVER's
|
||||
//
|
||||
goto WritePeMap;
|
||||
}
|
||||
break;
|
||||
//
|
||||
// Check if section-alignment and file-alignment match or not
|
||||
//
|
||||
if ((ImgHdr->Pe32.OptionalHeader.SectionAlignment != ImgHdr->Pe32.OptionalHeader.FileAlignment)) {
|
||||
//
|
||||
// Xip module has the same section alignment and file alignment.
|
||||
//
|
||||
Error (NULL, 0, 3000, "Invalid", "Section-Alignment and File-Alignment do not match : %s.", FileName);
|
||||
return EFI_ABORTED;
|
||||
}
|
||||
NewPe32BaseAddress = XipBase + (UINTN) CurrentPe32Section.Pe32Section + sizeof (EFI_PE32_SECTION) - (UINTN)FfsFile;
|
||||
BaseToUpdate = &XipBase;
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -2962,69 +2992,75 @@ Returns:
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
//
|
||||
// Relocation doesn't exist
|
||||
//
|
||||
if (ImageContext.RelocationsStripped) {
|
||||
Warning (NULL, 0, 0, "Invalid", "The file %s has no .reloc section.", FileName);
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
// Relocation exist and rebase
|
||||
//
|
||||
if (!ImageContext.RelocationsStripped) {
|
||||
//
|
||||
// Load and Relocate Image Data
|
||||
//
|
||||
MemoryImagePointer = (UINT8 *) malloc ((UINTN) ImageContext.ImageSize + ImageContext.SectionAlignment);
|
||||
if (MemoryImagePointer == NULL) {
|
||||
Error (NULL, 0, 4001, "Resource", "memory cannot be allocated on rebase of %s", FileName);
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
memset ((VOID *) MemoryImagePointer, 0, (UINTN) ImageContext.ImageSize + ImageContext.SectionAlignment);
|
||||
ImageContext.ImageAddress = ((UINTN) MemoryImagePointer + ImageContext.SectionAlignment - 1) & (~((INT64)ImageContext.SectionAlignment - 1));
|
||||
|
||||
Status = PeCoffLoaderLoadImage (&ImageContext);
|
||||
if (EFI_ERROR (Status)) {
|
||||
Error (NULL, 0, 3000, "Invalid", "LocateImage() call failed on rebase of %s", FileName);
|
||||
free ((VOID *) MemoryImagePointer);
|
||||
return Status;
|
||||
}
|
||||
|
||||
ImageContext.DestinationAddress = NewPe32BaseAddress;
|
||||
Status = PeCoffLoaderRelocateImage (&ImageContext);
|
||||
if (EFI_ERROR (Status)) {
|
||||
Error (NULL, 0, 3000, "Invalid", "RelocateImage() call failed on rebase of %s", FileName);
|
||||
free ((VOID *) MemoryImagePointer);
|
||||
return Status;
|
||||
}
|
||||
|
||||
//
|
||||
// Copy Relocated data to raw image file.
|
||||
//
|
||||
SectionHeader = (EFI_IMAGE_SECTION_HEADER *) (
|
||||
(UINTN) ImgHdr +
|
||||
sizeof (UINT32) +
|
||||
sizeof (EFI_IMAGE_FILE_HEADER) +
|
||||
ImgHdr->Pe32.FileHeader.SizeOfOptionalHeader
|
||||
);
|
||||
|
||||
for (Index = 0; Index < ImgHdr->Pe32.FileHeader.NumberOfSections; Index ++, SectionHeader ++) {
|
||||
CopyMem (
|
||||
(UINT8 *) CurrentPe32Section.Pe32Section + sizeof (EFI_COMMON_SECTION_HEADER) + SectionHeader->PointerToRawData,
|
||||
(VOID*) (UINTN) (ImageContext.ImageAddress + SectionHeader->VirtualAddress),
|
||||
SectionHeader->SizeOfRawData
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
// Load and Relocate Image Data
|
||||
//
|
||||
MemoryImagePointer = (UINT8 *) malloc ((UINTN) ImageContext.ImageSize + ImageContext.SectionAlignment);
|
||||
if (MemoryImagePointer == NULL) {
|
||||
Error (NULL, 0, 4001, "Resource", "memory cannot be allocated on rebase of %s", FileName);
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
memset ((VOID *) MemoryImagePointer, 0, (UINTN) ImageContext.ImageSize + ImageContext.SectionAlignment);
|
||||
ImageContext.ImageAddress = ((UINTN) MemoryImagePointer + ImageContext.SectionAlignment - 1) & (~((INT64)ImageContext.SectionAlignment - 1));
|
||||
|
||||
Status = PeCoffLoaderLoadImage (&ImageContext);
|
||||
if (EFI_ERROR (Status)) {
|
||||
Error (NULL, 0, 3000, "Invalid", "LocateImage() call failed on rebase of %s", FileName);
|
||||
free ((VOID *) MemoryImagePointer);
|
||||
MemoryImagePointer = NULL;
|
||||
if (PeFileBuffer != NULL) {
|
||||
free (PeFileBuffer);
|
||||
PeFileBuffer = NULL;
|
||||
}
|
||||
return Status;
|
||||
}
|
||||
|
||||
ImageContext.DestinationAddress = NewPe32BaseAddress;
|
||||
Status = PeCoffLoaderRelocateImage (&ImageContext);
|
||||
if (EFI_ERROR (Status)) {
|
||||
Error (NULL, 0, 3000, "Invalid", "RelocateImage() call failed on rebase of %s", FileName);
|
||||
free ((VOID *) MemoryImagePointer);
|
||||
return Status;
|
||||
}
|
||||
|
||||
//
|
||||
// Copy Relocated data to raw image file.
|
||||
//
|
||||
SectionHeader = (EFI_IMAGE_SECTION_HEADER *) (
|
||||
(UINTN) ImgHdr +
|
||||
sizeof (UINT32) +
|
||||
sizeof (EFI_IMAGE_FILE_HEADER) +
|
||||
ImgHdr->Pe32.FileHeader.SizeOfOptionalHeader
|
||||
);
|
||||
|
||||
for (Index = 0; Index < ImgHdr->Pe32.FileHeader.NumberOfSections; Index ++, SectionHeader ++) {
|
||||
CopyMem (
|
||||
(UINT8 *) CurrentPe32Section.Pe32Section + sizeof (EFI_COMMON_SECTION_HEADER) + SectionHeader->PointerToRawData,
|
||||
(VOID*) (UINTN) (ImageContext.ImageAddress + SectionHeader->VirtualAddress),
|
||||
SectionHeader->SizeOfRawData
|
||||
);
|
||||
}
|
||||
|
||||
free ((VOID *) MemoryImagePointer);
|
||||
MemoryImagePointer = NULL;
|
||||
if (PeFileBuffer != NULL) {
|
||||
free (PeFileBuffer);
|
||||
PeFileBuffer = NULL;
|
||||
}
|
||||
|
||||
//
|
||||
// Update Image Base Address
|
||||
//
|
||||
if (ImgHdr->Pe32.OptionalHeader.Magic == EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC) {
|
||||
ImgHdr->Pe32.OptionalHeader.ImageBase = (UINT32) NewPe32BaseAddress;
|
||||
ImgHdr->Pe32.OptionalHeader.ImageBase = (UINT32) NewPe32BaseAddress;
|
||||
} else if (ImgHdr->Pe32Plus.OptionalHeader.Magic == EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC) {
|
||||
ImgHdr->Pe32Plus.OptionalHeader.ImageBase = NewPe32BaseAddress;
|
||||
ImgHdr->Pe32Plus.OptionalHeader.ImageBase = NewPe32BaseAddress;
|
||||
} else {
|
||||
Error (NULL, 0, 3000, "Invalid", "unknown PE magic signature %X in PE32 image %s",
|
||||
ImgHdr->Pe32.OptionalHeader.Magic,
|
||||
@@ -3033,11 +3069,6 @@ Returns:
|
||||
return EFI_ABORTED;
|
||||
}
|
||||
|
||||
//
|
||||
// Update BASE address by add one page size.
|
||||
//
|
||||
*BaseToUpdate -= EFI_PAGE_SIZE;
|
||||
|
||||
//
|
||||
// Now update file checksum
|
||||
//
|
||||
@@ -3055,7 +3086,7 @@ Returns:
|
||||
//
|
||||
// Get this module function address from ModulePeMapFile and add them into FvMap file
|
||||
//
|
||||
WritePeMap:
|
||||
|
||||
//
|
||||
// Default use FileName as map file path
|
||||
//
|
||||
@@ -3069,7 +3100,8 @@ WritePeMap:
|
||||
if (FfsFile->Type != EFI_FV_FILETYPE_SECURITY_CORE &&
|
||||
FfsFile->Type != EFI_FV_FILETYPE_PEI_CORE &&
|
||||
FfsFile->Type != EFI_FV_FILETYPE_PEIM &&
|
||||
FfsFile->Type != EFI_FV_FILETYPE_COMBINED_PEIM_DRIVER
|
||||
FfsFile->Type != EFI_FV_FILETYPE_COMBINED_PEIM_DRIVER &&
|
||||
FfsFile->Type != EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE
|
||||
) {
|
||||
//
|
||||
// Only Peim code may have a TE section
|
||||
@@ -3122,13 +3154,6 @@ WritePeMap:
|
||||
// Get File PdbPointer
|
||||
//
|
||||
PdbPointer = PeCoffLoaderGetPdbPointer (ImageContext.Handle);
|
||||
|
||||
if ((Flags & REBASE_XIP_FILE) == 0) {
|
||||
//
|
||||
// For none XIP PEIM module, their map info also are collected.
|
||||
//
|
||||
goto WriteTeMap;
|
||||
}
|
||||
|
||||
//
|
||||
// Set new rebased address.
|
||||
@@ -3139,7 +3164,7 @@ WritePeMap:
|
||||
//
|
||||
// if reloc is stripped, try to get the original efi image to get reloc info.
|
||||
//
|
||||
if (ImageContext.RelocationsStripped == TRUE) {
|
||||
if (ImageContext.RelocationsStripped) {
|
||||
//
|
||||
// Construct the original efi file name
|
||||
//
|
||||
@@ -3194,70 +3219,75 @@ WritePeMap:
|
||||
ImageContext.RelocationsStripped = FALSE;
|
||||
}
|
||||
}
|
||||
//
|
||||
// Relocation doesn't exist
|
||||
//
|
||||
if (ImageContext.RelocationsStripped) {
|
||||
Warning (NULL, 0, 0, "Invalid", "The file %s has no .reloc section.", FileName);
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
// Relocation exist and rebase
|
||||
//
|
||||
if (!ImageContext.RelocationsStripped) {
|
||||
//
|
||||
// Load and Relocate Image Data
|
||||
//
|
||||
MemoryImagePointer = (UINT8 *) malloc ((UINTN) ImageContext.ImageSize + ImageContext.SectionAlignment);
|
||||
if (MemoryImagePointer == NULL) {
|
||||
Error (NULL, 0, 4001, "Resource", "memory cannot be allocated on rebase of %s", FileName);
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
memset ((VOID *) MemoryImagePointer, 0, (UINTN) ImageContext.ImageSize + ImageContext.SectionAlignment);
|
||||
ImageContext.ImageAddress = ((UINTN) MemoryImagePointer + ImageContext.SectionAlignment - 1) & (~(ImageContext.SectionAlignment - 1));
|
||||
|
||||
Status = PeCoffLoaderLoadImage (&ImageContext);
|
||||
if (EFI_ERROR (Status)) {
|
||||
Error (NULL, 0, 3000, "Invalid", "LocateImage() call failed on rebase of %s", FileName);
|
||||
free ((VOID *) MemoryImagePointer);
|
||||
return Status;
|
||||
}
|
||||
//
|
||||
// Reloacate TeImage
|
||||
//
|
||||
ImageContext.DestinationAddress = NewPe32BaseAddress;
|
||||
Status = PeCoffLoaderRelocateImage (&ImageContext);
|
||||
if (EFI_ERROR (Status)) {
|
||||
Error (NULL, 0, 3000, "Invalid", "RelocateImage() call failed on rebase of TE image %s", FileName);
|
||||
free ((VOID *) MemoryImagePointer);
|
||||
return Status;
|
||||
}
|
||||
|
||||
//
|
||||
// Copy the relocated image into raw image file.
|
||||
//
|
||||
SectionHeader = (EFI_IMAGE_SECTION_HEADER *) (TEImageHeader + 1);
|
||||
for (Index = 0; Index < TEImageHeader->NumberOfSections; Index ++, SectionHeader ++) {
|
||||
if (!ImageContext.IsTeImage) {
|
||||
CopyMem (
|
||||
(UINT8 *) TEImageHeader + sizeof (EFI_TE_IMAGE_HEADER) - TEImageHeader->StrippedSize + SectionHeader->PointerToRawData,
|
||||
(VOID*) (UINTN) (ImageContext.ImageAddress + SectionHeader->VirtualAddress),
|
||||
SectionHeader->SizeOfRawData
|
||||
);
|
||||
} else {
|
||||
CopyMem (
|
||||
(UINT8 *) TEImageHeader + sizeof (EFI_TE_IMAGE_HEADER) - TEImageHeader->StrippedSize + SectionHeader->PointerToRawData,
|
||||
(VOID*) (UINTN) (ImageContext.ImageAddress + sizeof (EFI_TE_IMAGE_HEADER) - TEImageHeader->StrippedSize + SectionHeader->VirtualAddress),
|
||||
SectionHeader->SizeOfRawData
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Free the allocated memory resource
|
||||
//
|
||||
//
|
||||
// Load and Relocate Image Data
|
||||
//
|
||||
MemoryImagePointer = (UINT8 *) malloc ((UINTN) ImageContext.ImageSize + ImageContext.SectionAlignment);
|
||||
if (MemoryImagePointer == NULL) {
|
||||
Error (NULL, 0, 4001, "Resource", "memory cannot be allocated on rebase of %s", FileName);
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
memset ((VOID *) MemoryImagePointer, 0, (UINTN) ImageContext.ImageSize + ImageContext.SectionAlignment);
|
||||
ImageContext.ImageAddress = ((UINTN) MemoryImagePointer + ImageContext.SectionAlignment - 1) & (~(ImageContext.SectionAlignment - 1));
|
||||
|
||||
Status = PeCoffLoaderLoadImage (&ImageContext);
|
||||
if (EFI_ERROR (Status)) {
|
||||
Error (NULL, 0, 3000, "Invalid", "LocateImage() call failed on rebase of %s", FileName);
|
||||
free ((VOID *) MemoryImagePointer);
|
||||
MemoryImagePointer = NULL;
|
||||
if (PeFileBuffer != NULL) {
|
||||
free (PeFileBuffer);
|
||||
PeFileBuffer = NULL;
|
||||
return Status;
|
||||
}
|
||||
//
|
||||
// Reloacate TeImage
|
||||
//
|
||||
ImageContext.DestinationAddress = NewPe32BaseAddress;
|
||||
Status = PeCoffLoaderRelocateImage (&ImageContext);
|
||||
if (EFI_ERROR (Status)) {
|
||||
Error (NULL, 0, 3000, "Invalid", "RelocateImage() call failed on rebase of TE image %s", FileName);
|
||||
free ((VOID *) MemoryImagePointer);
|
||||
return Status;
|
||||
}
|
||||
|
||||
//
|
||||
// Copy the relocated image into raw image file.
|
||||
//
|
||||
SectionHeader = (EFI_IMAGE_SECTION_HEADER *) (TEImageHeader + 1);
|
||||
for (Index = 0; Index < TEImageHeader->NumberOfSections; Index ++, SectionHeader ++) {
|
||||
if (!ImageContext.IsTeImage) {
|
||||
CopyMem (
|
||||
(UINT8 *) TEImageHeader + sizeof (EFI_TE_IMAGE_HEADER) - TEImageHeader->StrippedSize + SectionHeader->PointerToRawData,
|
||||
(VOID*) (UINTN) (ImageContext.ImageAddress + SectionHeader->VirtualAddress),
|
||||
SectionHeader->SizeOfRawData
|
||||
);
|
||||
} else {
|
||||
CopyMem (
|
||||
(UINT8 *) TEImageHeader + sizeof (EFI_TE_IMAGE_HEADER) - TEImageHeader->StrippedSize + SectionHeader->PointerToRawData,
|
||||
(VOID*) (UINTN) (ImageContext.ImageAddress + sizeof (EFI_TE_IMAGE_HEADER) - TEImageHeader->StrippedSize + SectionHeader->VirtualAddress),
|
||||
SectionHeader->SizeOfRawData
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Free the allocated memory resource
|
||||
//
|
||||
free ((VOID *) MemoryImagePointer);
|
||||
MemoryImagePointer = NULL;
|
||||
if (PeFileBuffer != NULL) {
|
||||
free (PeFileBuffer);
|
||||
PeFileBuffer = NULL;
|
||||
}
|
||||
|
||||
//
|
||||
// Update Image Base Address
|
||||
//
|
||||
@@ -3279,7 +3309,7 @@ WritePeMap:
|
||||
//
|
||||
// Get this module function address from ModulePeMapFile and add them into FvMap file
|
||||
//
|
||||
WriteTeMap:
|
||||
|
||||
//
|
||||
// Default use FileName as map file path
|
||||
//
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/** @file
|
||||
|
||||
Copyright (c) 2004 - 2008, Intel Corporation
|
||||
Copyright (c) 2004 - 2010, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
@@ -67,6 +67,7 @@ Abstract:
|
||||
#define OPTIONS_SECTION_STRING "[options]"
|
||||
#define ATTRIBUTES_SECTION_STRING "[attributes]"
|
||||
#define FILES_SECTION_STRING "[files]"
|
||||
#define FV_BASE_ADDRESS_STRING "[FV_BASE_ADDRESS]"
|
||||
|
||||
//
|
||||
// Options section
|
||||
@@ -82,8 +83,6 @@ Abstract:
|
||||
#define EFI_CAPSULE_HEADER_SIZE_STRING "EFI_CAPSULE_HEADER_SIZE"
|
||||
#define EFI_CAPSULE_FLAGS_STRING "EFI_CAPSULE_FLAGS"
|
||||
#define EFI_CAPSULE_VERSION_STRING "EFI_CAPSULE_VERSION"
|
||||
#define EFI_FV_BOOT_DRIVER_BASE_ADDRESS_STRING "EFI_BOOT_DRIVER_BASE_ADDRESS"
|
||||
#define EFI_FV_RUNTIME_DRIVER_BASE_ADDRESS_STRING "EFI_RUNTIME_DRIVER_BASE_ADDRESS"
|
||||
|
||||
#define EFI_FV_TOTAL_SIZE_STRING "EFI_FV_TOTAL_SIZE"
|
||||
#define EFI_FV_TAKEN_SIZE_STRING "EFI_FV_TAKEN_SIZE"
|
||||
@@ -204,13 +203,6 @@ Abstract:
|
||||
#define FIT_TYPE_MASK 0x7F
|
||||
#define CHECKSUM_BIT_MASK 0x80
|
||||
|
||||
//
|
||||
// Rebase File type
|
||||
//
|
||||
#define REBASE_XIP_FILE 0x1
|
||||
#define REBASE_BOOTTIME_FILE 0x2
|
||||
#define REBASE_RUNTIME_FILE 0x4
|
||||
|
||||
//
|
||||
// Private data types
|
||||
//
|
||||
@@ -228,8 +220,6 @@ typedef struct {
|
||||
typedef struct {
|
||||
BOOLEAN BaseAddressSet;
|
||||
EFI_PHYSICAL_ADDRESS BaseAddress;
|
||||
EFI_PHYSICAL_ADDRESS BootBaseAddress;
|
||||
EFI_PHYSICAL_ADDRESS RuntimeBaseAddress;
|
||||
EFI_GUID FvFileSystemGuid;
|
||||
BOOLEAN FvFileSystemGuidSet;
|
||||
EFI_GUID FvNameGuid;
|
||||
@@ -270,6 +260,9 @@ extern CAP_INFO mCapDataInfo;
|
||||
extern EFI_GUID mEfiFirmwareFileSystem2Guid;
|
||||
extern UINT32 mFvTotalSize;
|
||||
extern UINT32 mFvTakenSize;
|
||||
|
||||
extern EFI_PHYSICAL_ADDRESS mFvBaseAddress[];
|
||||
extern UINT32 mFvBaseAddressNumber;
|
||||
//
|
||||
// Local function prototypes
|
||||
//
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -1,3 +1,17 @@
|
||||
/** @file
|
||||
Ported ELF include files from FreeBSD
|
||||
|
||||
Copyright (c) 2009 - 2010, Apple, Inc. All rights reserved.
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
|
||||
**/
|
||||
/*-
|
||||
* Copyright (c) 1996-1998 John D. Polstra.
|
||||
* All rights reserved.
|
||||
|
@@ -1,3 +1,16 @@
|
||||
/** @file
|
||||
Ported ELF include files from FreeBSD
|
||||
|
||||
Copyright (c) 2009 - 2010, Apple, Inc. All rights reserved.
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
/*-
|
||||
* Copyright (c) 1996-1998 John D. Polstra.
|
||||
* All rights reserved.
|
||||
|
@@ -1,3 +1,17 @@
|
||||
/** @file
|
||||
Ported ELF include files from FreeBSD
|
||||
|
||||
Copyright (c) 2009 - 2010, Apple, Inc. All rights reserved.
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
|
||||
**/
|
||||
/*-
|
||||
* Copyright (c) 1998 John D. Polstra.
|
||||
* All rights reserved.
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/** @file
|
||||
|
||||
Copyright 2006 - 2008, Intel Corporation
|
||||
Copyright 2006 - 2010, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
@@ -92,7 +92,7 @@ Returns:
|
||||
--*/
|
||||
{
|
||||
printf ("%s v%d.%d -Utility to generate the EfiLoader image containing page table.\n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION);
|
||||
printf ("Copyright (c) 2008 - 2009 Intel Corporation. All rights reserved.\n");
|
||||
printf ("Copyright (c) 2008 - 2010 Intel Corporation. All rights reserved.\n");
|
||||
}
|
||||
|
||||
VOID
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/** @file
|
||||
|
||||
Copyright (c) 2004 - 2008, Intel Corporation
|
||||
Copyright (c) 2004 - 2010, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
@@ -27,6 +27,7 @@ Abstract:
|
||||
#include <Common/UefiBaseTypes.h>
|
||||
#include <Common/PiFirmwareFile.h>
|
||||
#include <Protocol/GuidedSectionExtraction.h>
|
||||
#include <IndustryStandard/PeImage.h>
|
||||
|
||||
#include "CommonLib.h"
|
||||
#include "Compress.h"
|
||||
@@ -80,6 +81,11 @@ STATIC CHAR8 *mCompressionTypeName[] = { "PI_NONE", "PI_STD" };
|
||||
#define EFI_GUIDED_SECTION_NONE 0x80
|
||||
STATIC CHAR8 *mGUIDedSectionAttribue[] = { "NONE", "PROCESSING_REQUIRED", "AUTH_STATUS_VALID"};
|
||||
|
||||
STATIC CHAR8 *mAlignName[] = {
|
||||
"1", "2", "4", "8", "16", "32", "64", "128", "256", "512",
|
||||
"1K", "2K", "4K", "8K", "16K", "32K", "64K"
|
||||
};
|
||||
|
||||
//
|
||||
// Crc32 GUID section related definitions.
|
||||
//
|
||||
@@ -144,7 +150,7 @@ Returns:
|
||||
//
|
||||
// Copyright declaration
|
||||
//
|
||||
fprintf (stdout, "Copyright (c) 2007, Intel Corporation. All rights reserved.\n\n");
|
||||
fprintf (stdout, "Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.\n\n");
|
||||
|
||||
//
|
||||
// Details Option
|
||||
@@ -180,6 +186,10 @@ Returns:
|
||||
fprintf (stdout, " -j Number, --buildnumber Number\n\
|
||||
Number is an integer value between 0000 and 9999\n\
|
||||
used in Ver section.\n");
|
||||
fprintf (stdout, " --sectionalign SectionAlign\n\
|
||||
SectionAlign points to section alignment, which support\n\
|
||||
the alignment scope 1~64K. It is specified in same\n\
|
||||
order that the section file is input.\n");
|
||||
fprintf (stdout, " -v, --verbose Turn on verbose output with informational messages.\n");
|
||||
fprintf (stdout, " -q, --quiet Disable all messages except key message and fatal error\n");
|
||||
fprintf (stdout, " -d, --debug level Enable debug messages, at input debug level.\n");
|
||||
@@ -329,9 +339,50 @@ Done:
|
||||
return Status;
|
||||
}
|
||||
|
||||
STATIC
|
||||
EFI_STATUS
|
||||
StringtoAlignment (
|
||||
IN CHAR8 *AlignBuffer,
|
||||
OUT UINT32 *AlignNumber
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Converts Align String to align value (1~64K).
|
||||
|
||||
Arguments:
|
||||
|
||||
AlignBuffer - Pointer to Align string.
|
||||
AlignNumber - Pointer to Align value.
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCCESS Successfully convert align string to align value.
|
||||
EFI_INVALID_PARAMETER Align string is invalid or align value is not in scope.
|
||||
|
||||
--*/
|
||||
{
|
||||
UINT32 Index = 0;
|
||||
//
|
||||
// Check AlignBuffer
|
||||
//
|
||||
if (AlignBuffer == NULL) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
for (Index = 0; Index < sizeof (mAlignName) / sizeof (CHAR8 *); Index ++) {
|
||||
if (stricmp (AlignBuffer, mAlignName [Index]) == 0) {
|
||||
*AlignNumber = 1 << Index;
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
}
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
GetSectionContents (
|
||||
CHAR8 **InputFileName,
|
||||
UINT32 *InputFileAlign,
|
||||
UINT32 InputFileNum,
|
||||
UINT8 *FileBuffer,
|
||||
UINT32 *BufferLength
|
||||
@@ -346,7 +397,9 @@ Routine Description:
|
||||
Arguments:
|
||||
|
||||
InputFileName - Name of the input file.
|
||||
|
||||
|
||||
InputFileAlign - Alignment required by the input file data.
|
||||
|
||||
InputFileNum - Number of input files. Should be at least 1.
|
||||
|
||||
FileBuffer - Output buffer to contain data
|
||||
@@ -362,10 +415,17 @@ Returns:
|
||||
EFI_BUFFER_TOO_SMALL FileBuffer is not enough to contain all file data.
|
||||
--*/
|
||||
{
|
||||
UINT32 Size;
|
||||
UINT32 FileSize;
|
||||
UINT32 Index;
|
||||
FILE *InFile;
|
||||
UINT32 Size;
|
||||
UINT32 Offset;
|
||||
UINT32 FileSize;
|
||||
UINT32 Index;
|
||||
FILE *InFile;
|
||||
EFI_COMMON_SECTION_HEADER *SectHeader;
|
||||
EFI_COMMON_SECTION_HEADER TempSectHeader;
|
||||
EFI_TE_IMAGE_HEADER TeHeader;
|
||||
UINT32 TeOffset;
|
||||
EFI_GUID_DEFINED_SECTION GuidSectHeader;
|
||||
UINT32 HeaderSize;
|
||||
|
||||
if (InputFileNum < 1) {
|
||||
Error (NULL, 0, 2000, "Invalid paramter", "must specify at least one input file");
|
||||
@@ -377,7 +437,9 @@ Returns:
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
Size = 0;
|
||||
Size = 0;
|
||||
Offset = 0;
|
||||
TeOffset = 0;
|
||||
//
|
||||
// Go through our array of file names and copy their contents
|
||||
// to the output buffer.
|
||||
@@ -406,11 +468,66 @@ Returns:
|
||||
FileSize = ftell (InFile);
|
||||
fseek (InFile, 0, SEEK_SET);
|
||||
DebugMsg (NULL, 0, 9, "Input files", "the input file name is %s and the size is %u bytes", InputFileName[Index], (unsigned) FileSize);
|
||||
//
|
||||
// Adjust section buffer when section alignment is required.
|
||||
//
|
||||
if (InputFileAlign != NULL) {
|
||||
//
|
||||
// Check this section is Te/Pe section, and Calculate the numbers of Te/Pe section.
|
||||
//
|
||||
TeOffset = 0;
|
||||
HeaderSize = sizeof (EFI_COMMON_SECTION_HEADER);
|
||||
fread (&TempSectHeader, 1, sizeof (TempSectHeader), InFile);
|
||||
if (TempSectHeader.Type == EFI_SECTION_TE) {
|
||||
fread (&TeHeader, 1, sizeof (TeHeader), InFile);
|
||||
if (TeHeader.Signature == EFI_TE_IMAGE_HEADER_SIGNATURE) {
|
||||
TeOffset = TeHeader.StrippedSize - sizeof (TeHeader);
|
||||
}
|
||||
} else if (TempSectHeader.Type == EFI_SECTION_GUID_DEFINED) {
|
||||
fseek (InFile, 0, SEEK_SET);
|
||||
fread (&GuidSectHeader, 1, sizeof (GuidSectHeader), InFile);
|
||||
if ((GuidSectHeader.Attributes & EFI_GUIDED_SECTION_PROCESSING_REQUIRED) == 0) {
|
||||
HeaderSize = GuidSectHeader.DataOffset;
|
||||
}
|
||||
}
|
||||
|
||||
fseek (InFile, 0, SEEK_SET);
|
||||
|
||||
//
|
||||
// Revert TeOffset to the converse value relative to Alignment
|
||||
// This is to assure the original PeImage Header at Alignment.
|
||||
//
|
||||
if (TeOffset != 0) {
|
||||
TeOffset = InputFileAlign [Index] - (TeOffset % InputFileAlign [Index]);
|
||||
TeOffset = TeOffset % InputFileAlign [Index];
|
||||
}
|
||||
|
||||
//
|
||||
// make sure section data meet its alignment requirement by adding one raw pad section.
|
||||
//
|
||||
if ((InputFileAlign [Index] != 0) && (((Size + HeaderSize + TeOffset) % InputFileAlign [Index]) != 0)) {
|
||||
Offset = (Size + sizeof (EFI_COMMON_SECTION_HEADER) + HeaderSize + TeOffset + InputFileAlign [Index] - 1) & ~(InputFileAlign [Index] - 1);
|
||||
Offset = Offset - Size - HeaderSize - TeOffset;
|
||||
|
||||
if (FileBuffer != NULL && ((Size + Offset) < *BufferLength)) {
|
||||
memset (FileBuffer + Size, 0, Offset);
|
||||
SectHeader = (EFI_COMMON_SECTION_HEADER *) (FileBuffer + Size);
|
||||
SectHeader->Type = EFI_SECTION_RAW;
|
||||
SectHeader->Size[0] = (UINT8) (Offset & 0xff);
|
||||
SectHeader->Size[1] = (UINT8) ((Offset & 0xff00) >> 8);
|
||||
SectHeader->Size[2] = (UINT8) ((Offset & 0xff0000) >> 16);
|
||||
}
|
||||
DebugMsg (NULL, 0, 9, "Pad raw section for section data alignment", "Pad Raw section size is %u", (unsigned) Offset);
|
||||
|
||||
Size = Size + Offset;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Now read the contents of the file into the buffer
|
||||
// Buffer must be enough to contain the file content.
|
||||
//
|
||||
if (FileSize > 0 && FileBuffer != NULL && (Size + FileSize) <= *BufferLength) {
|
||||
if ((FileSize > 0) && (FileBuffer != NULL) && ((Size + FileSize) <= *BufferLength)) {
|
||||
if (fread (FileBuffer + Size, (size_t) FileSize, 1, InFile) != 1) {
|
||||
Error (NULL, 0, 0004, "Error reading file", InputFileName[Index]);
|
||||
fclose (InFile);
|
||||
@@ -437,6 +554,7 @@ Returns:
|
||||
EFI_STATUS
|
||||
GenSectionCompressionSection (
|
||||
CHAR8 **InputFileName,
|
||||
UINT32 *InputFileAlign,
|
||||
UINT32 InputFileNum,
|
||||
UINT8 SectCompSubType,
|
||||
UINT8 **OutFileBuffer
|
||||
@@ -453,7 +571,9 @@ Routine Description:
|
||||
Arguments:
|
||||
|
||||
InputFileName - Name of the input file.
|
||||
|
||||
|
||||
InputFileAlign - Alignment required by the input file data.
|
||||
|
||||
InputFileNum - Number of input files. Should be at least 1.
|
||||
|
||||
SectCompSubType - Specify the compression algorithm requested.
|
||||
@@ -487,6 +607,7 @@ Returns:
|
||||
//
|
||||
Status = GetSectionContents (
|
||||
InputFileName,
|
||||
InputFileAlign,
|
||||
InputFileNum,
|
||||
FileBuffer,
|
||||
&InputLength
|
||||
@@ -503,6 +624,7 @@ Returns:
|
||||
//
|
||||
Status = GetSectionContents (
|
||||
InputFileName,
|
||||
InputFileAlign,
|
||||
InputFileNum,
|
||||
FileBuffer,
|
||||
&InputLength
|
||||
@@ -524,6 +646,16 @@ Returns:
|
||||
switch (SectCompSubType) {
|
||||
case EFI_NOT_COMPRESSED:
|
||||
CompressedLength = InputLength;
|
||||
//
|
||||
// Copy file buffer to the none compressed data.
|
||||
//
|
||||
OutputBuffer = malloc (CompressedLength + sizeof (EFI_COMPRESSION_SECTION));
|
||||
if (OutputBuffer == NULL) {
|
||||
free (FileBuffer);
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
memcpy (OutputBuffer + sizeof (EFI_COMPRESSION_SECTION), FileBuffer, CompressedLength);
|
||||
FileBuffer = OutputBuffer;
|
||||
break;
|
||||
|
||||
case EFI_STANDARD_COMPRESSION:
|
||||
@@ -599,6 +731,7 @@ Returns:
|
||||
EFI_STATUS
|
||||
GenSectionGuidDefinedSection (
|
||||
CHAR8 **InputFileName,
|
||||
UINT32 *InputFileAlign,
|
||||
UINT32 InputFileNum,
|
||||
EFI_GUID *VendorGuid,
|
||||
UINT16 DataAttribute,
|
||||
@@ -618,6 +751,8 @@ Arguments:
|
||||
|
||||
InputFileName - Name of the input file.
|
||||
|
||||
InputFileAlign - Alignment required by the input file data.
|
||||
|
||||
InputFileNum - Number of input files. Should be at least 1.
|
||||
|
||||
VendorGuid - Specify vendor guid value.
|
||||
@@ -662,6 +797,7 @@ Returns:
|
||||
//
|
||||
Status = GetSectionContents (
|
||||
InputFileName,
|
||||
InputFileAlign,
|
||||
InputFileNum,
|
||||
FileBuffer,
|
||||
&InputLength
|
||||
@@ -678,6 +814,7 @@ Returns:
|
||||
//
|
||||
Status = GetSectionContents (
|
||||
InputFileName,
|
||||
InputFileAlign,
|
||||
InputFileNum,
|
||||
FileBuffer + Offset,
|
||||
&InputLength
|
||||
@@ -797,7 +934,11 @@ Returns:
|
||||
UINT8 *OutFileBuffer;
|
||||
EFI_STATUS Status;
|
||||
UINT64 LogLevel;
|
||||
|
||||
UINT32 *InputFileAlign;
|
||||
UINT32 InputFileAlignNum;
|
||||
|
||||
InputFileAlign = NULL;
|
||||
InputFileAlignNum = 0;
|
||||
InputFileName = NULL;
|
||||
OutputFileName = NULL;
|
||||
SectionName = NULL;
|
||||
@@ -809,7 +950,7 @@ Returns:
|
||||
InputFileNum = 0;
|
||||
SectType = EFI_SECTION_ALL;
|
||||
SectCompSubType = 0;
|
||||
SectGuidAttribute = 0;
|
||||
SectGuidAttribute = EFI_GUIDED_SECTION_NONE;
|
||||
OutFileBuffer = NULL;
|
||||
InputLength = 0;
|
||||
Status = STATUS_SUCCESS;
|
||||
@@ -983,6 +1124,41 @@ Returns:
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
// Section File alignment requirement
|
||||
//
|
||||
if (stricmp (argv[0], "--sectionalign") == 0) {
|
||||
if (InputFileAlignNum == 0) {
|
||||
InputFileAlign = (UINT32 *) malloc (MAXIMUM_INPUT_FILE_NUM * sizeof (UINT32));
|
||||
if (InputFileAlign == NULL) {
|
||||
Error (NULL, 0, 4001, "Resource", "memory cannot be allocated!");
|
||||
return 1;
|
||||
}
|
||||
memset (InputFileAlign, 1, MAXIMUM_INPUT_FILE_NUM * sizeof (UINT32));
|
||||
} else if (InputFileAlignNum % MAXIMUM_INPUT_FILE_NUM == 0) {
|
||||
InputFileAlign = (UINT32 *) realloc (
|
||||
InputFileAlign,
|
||||
(InputFileNum + MAXIMUM_INPUT_FILE_NUM) * sizeof (UINT32)
|
||||
);
|
||||
|
||||
if (InputFileAlign == NULL) {
|
||||
Error (NULL, 0, 4001, "Resource", "memory cannot be allocated!");
|
||||
return 1;
|
||||
}
|
||||
memset (&(InputFileAlign[InputFileNum]), 1, (MAXIMUM_INPUT_FILE_NUM * sizeof (UINT32)));
|
||||
}
|
||||
|
||||
Status = StringtoAlignment (argv[1], &(InputFileAlign[InputFileAlignNum]));
|
||||
if (EFI_ERROR (Status)) {
|
||||
Error (NULL, 0, 1003, "Invalid option value", "%s = %s", argv[0], argv[1]);
|
||||
goto Finish;
|
||||
}
|
||||
argc -= 2;
|
||||
argv += 2;
|
||||
InputFileAlignNum ++;
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
// Get Input file name
|
||||
//
|
||||
@@ -992,7 +1168,6 @@ Returns:
|
||||
Error (NULL, 0, 4001, "Resource", "memory cannot be allcoated");
|
||||
return 1;
|
||||
}
|
||||
|
||||
memset (InputFileName, 0, (MAXIMUM_INPUT_FILE_NUM * sizeof (CHAR8 *)));
|
||||
} else if (InputFileNum % MAXIMUM_INPUT_FILE_NUM == 0) {
|
||||
//
|
||||
@@ -1007,7 +1182,6 @@ Returns:
|
||||
Error (NULL, 0, 4001, "Resource", "memory cannot be allcoated");
|
||||
return 1;
|
||||
}
|
||||
|
||||
memset (&(InputFileName[InputFileNum]), 0, (MAXIMUM_INPUT_FILE_NUM * sizeof (CHAR8 *)));
|
||||
}
|
||||
|
||||
@@ -1016,6 +1190,11 @@ Returns:
|
||||
argv ++;
|
||||
}
|
||||
|
||||
if (InputFileAlignNum > 0 && InputFileAlignNum != InputFileNum) {
|
||||
Error (NULL, 0, 1003, "Invalid option", "section alignment must be set for each section");
|
||||
goto Finish;
|
||||
}
|
||||
|
||||
VerboseMsg ("%s tool start.", UTILITY_NAME);
|
||||
|
||||
//
|
||||
@@ -1050,14 +1229,11 @@ Returns:
|
||||
memcpy (&VendorGuid, &mEfiCrc32SectionGuid, sizeof (EFI_GUID));
|
||||
}
|
||||
|
||||
if (SectGuidAttribute == 0) {
|
||||
SectGuidAttribute = EFI_GUIDED_SECTION_PROCESSING_REQUIRED;
|
||||
}
|
||||
if ((SectGuidAttribute & EFI_GUIDED_SECTION_NONE) != 0) {
|
||||
//
|
||||
// NONE attribute, clear attribute value.
|
||||
//
|
||||
SectGuidAttribute = 0;
|
||||
SectGuidAttribute = SectGuidAttribute & ~EFI_GUIDED_SECTION_NONE;
|
||||
}
|
||||
VerboseMsg ("Vendor Guid is %08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X",
|
||||
(unsigned) VendorGuid.Data1,
|
||||
@@ -1161,8 +1337,13 @@ Returns:
|
||||
//
|
||||
switch (SectType) {
|
||||
case EFI_SECTION_COMPRESSION:
|
||||
if (InputFileAlign != NULL) {
|
||||
free (InputFileAlign);
|
||||
InputFileAlign = NULL;
|
||||
}
|
||||
Status = GenSectionCompressionSection (
|
||||
InputFileName,
|
||||
InputFileAlign,
|
||||
InputFileNum,
|
||||
SectCompSubType,
|
||||
&OutFileBuffer
|
||||
@@ -1170,8 +1351,17 @@ Returns:
|
||||
break;
|
||||
|
||||
case EFI_SECTION_GUID_DEFINED:
|
||||
if (InputFileAlign != NULL && (CompareGuid (&VendorGuid, &mEfiCrc32SectionGuid) != 0)) {
|
||||
//
|
||||
// Only process alignment for the default known CRC32 guided section.
|
||||
// For the unknown guided section, the alignment is processed when the dummy all section (EFI_SECTION_ALL) is generated.
|
||||
//
|
||||
free (InputFileAlign);
|
||||
InputFileAlign = NULL;
|
||||
}
|
||||
Status = GenSectionGuidDefinedSection (
|
||||
InputFileName,
|
||||
InputFileAlign,
|
||||
InputFileNum,
|
||||
&VendorGuid,
|
||||
SectGuidAttribute,
|
||||
@@ -1232,6 +1422,7 @@ Returns:
|
||||
//
|
||||
Status = GetSectionContents (
|
||||
InputFileName,
|
||||
InputFileAlign,
|
||||
InputFileNum,
|
||||
OutFileBuffer,
|
||||
&InputLength
|
||||
@@ -1248,6 +1439,7 @@ Returns:
|
||||
//
|
||||
Status = GetSectionContents (
|
||||
InputFileName,
|
||||
InputFileAlign,
|
||||
InputFileNum,
|
||||
OutFileBuffer,
|
||||
&InputLength
|
||||
@@ -1296,6 +1488,10 @@ Finish:
|
||||
free (InputFileName);
|
||||
}
|
||||
|
||||
if (InputFileAlign != NULL) {
|
||||
free (InputFileAlign);
|
||||
}
|
||||
|
||||
if (OutFileBuffer != NULL) {
|
||||
free (OutFileBuffer);
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
|
||||
Copyright (c) 1999-2008 Intel Corporation. All rights reserved
|
||||
Copyright (c) 1999-2010 Intel Corporation. All rights reserved
|
||||
This program and the accompanying materials are licensed and made available
|
||||
under the terms and conditions of the BSD License which accompanies this
|
||||
distribution. The full text of the license may be found at
|
||||
@@ -342,7 +342,6 @@ Returns:
|
||||
VtfInfo->LocationType = SECOND_VTF;
|
||||
} else {
|
||||
VtfInfo->LocationType = NONE;
|
||||
Warning(UTILITY_NAME, 0, 0001, "Unknown location for component.", VtfInfo->CompName);
|
||||
}
|
||||
} else if (strnicmp (*TokenStr, "COMP_TYPE", 9) == 0) {
|
||||
TokenStr++;
|
||||
@@ -2408,7 +2407,7 @@ Returns:
|
||||
//
|
||||
// Copyright declaration
|
||||
//
|
||||
fprintf (stdout, "Copyright (c) 2007 - 2009, Intel Corporation. All rights reserved.\n\n");
|
||||
fprintf (stdout, "Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.\n\n");
|
||||
//
|
||||
// Details Option
|
||||
//
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/** @file
|
||||
|
||||
Copyright 2006 - 2009, Intel Corporation
|
||||
Copyright 2006 - 2010, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
@@ -273,7 +273,7 @@ Version (
|
||||
)
|
||||
{
|
||||
printf ("%s v%d.%d -Utility to retrieve and update the boot sector or MBR.\n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION);
|
||||
printf ("Copyright (c) 2007-2009 Intel Corporation. All rights reserved.\n");
|
||||
printf ("Copyright (c) 2007-2010 Intel Corporation. All rights reserved.\n");
|
||||
}
|
||||
|
||||
|
||||
|
@@ -68,12 +68,10 @@ typedef UINT8 EFI_FFS_FILE_STATE;
|
||||
#define FFS_ATTRIB_DATA_ALIGNMENT 0x38
|
||||
#define FFS_ATTRIB_CHECKSUM 0x40
|
||||
//
|
||||
// FFS_FIXED_CHECKSUM is the default checksum value used when the
|
||||
// FFS_FIXED_CHECKSUM is the checksum value used when the
|
||||
// FFS_ATTRIB_CHECKSUM attribute bit is clear
|
||||
// note this is NOT an architecturally defined value, but is in this file for
|
||||
// implementation convenience
|
||||
//
|
||||
#define FFS_FIXED_CHECKSUM 0x5A
|
||||
#define FFS_FIXED_CHECKSUM 0xAA
|
||||
|
||||
//
|
||||
// FFS File State Bits.
|
||||
|
@@ -3,7 +3,7 @@
|
||||
IFR is primarily consumed by the EFI presentation engine, and produced by EFI
|
||||
internal application and drivers as well as all add-in card option-ROM drivers
|
||||
|
||||
Copyright (c) 2006 - 2009, Intel Corporation All rights reserved.
|
||||
Copyright (c) 2006 - 2010, Intel Corporation All rights reserved.
|
||||
|
||||
This program and the accompanying materials are licensed and made available
|
||||
under the terms and conditions of the BSD License which accompanies this
|
||||
@@ -618,6 +618,7 @@ typedef union {
|
||||
#define EFI_IFR_DISABLE_IF_OP 0x1E
|
||||
#define EFI_IFR_TO_LOWER_OP 0x20
|
||||
#define EFI_IFR_TO_UPPER_OP 0x21
|
||||
#define EFI_IFR_MAP_OP 0x22
|
||||
#define EFI_IFR_ORDERED_LIST_OP 0x23
|
||||
#define EFI_IFR_VARSTORE_OP 0x24
|
||||
#define EFI_IFR_VARSTORE_NAME_VALUE_OP 0x25
|
||||
@@ -626,6 +627,10 @@ typedef union {
|
||||
#define EFI_IFR_VERSION_OP 0x28
|
||||
#define EFI_IFR_END_OP 0x29
|
||||
#define EFI_IFR_MATCH_OP 0x2A
|
||||
#define EFI_IFR_GET_OP 0x2B
|
||||
#define EFI_IFR_SET_OP 0x2C
|
||||
#define EFI_IFR_READ_OP 0x2D
|
||||
#define EFI_IFR_WRITE_OP 0x2E
|
||||
#define EFI_IFR_EQUAL_OP 0x2F
|
||||
#define EFI_IFR_NOT_EQUAL_OP 0x30
|
||||
#define EFI_IFR_GREATER_THAN_OP 0x31
|
||||
@@ -672,6 +677,7 @@ typedef union {
|
||||
#define EFI_IFR_VALUE_OP 0x5A
|
||||
#define EFI_IFR_DEFAULT_OP 0x5B
|
||||
#define EFI_IFR_DEFAULTSTORE_OP 0x5C
|
||||
#define EFI_IFR_FORM_MAP_OP 0x5D
|
||||
#define EFI_IFR_CATENATE_OP 0x5E
|
||||
#define EFI_IFR_GUID_OP 0x5F
|
||||
#define EFI_IFR_SECURITY_OP 0x60
|
||||
@@ -730,14 +736,14 @@ typedef struct _EFI_IFR_VARSTORE {
|
||||
|
||||
typedef struct _EFI_IFR_VARSTORE_EFI {
|
||||
EFI_IFR_OP_HEADER Header;
|
||||
UINT16 VarStoreId;
|
||||
EFI_VARSTORE_ID VarStoreId;
|
||||
EFI_GUID Guid;
|
||||
UINT32 Attributes;
|
||||
} EFI_IFR_VARSTORE_EFI;
|
||||
|
||||
typedef struct _EFI_IFR_VARSTORE_NAME_VALUE {
|
||||
EFI_IFR_OP_HEADER Header;
|
||||
UINT16 VarStoreId;
|
||||
EFI_VARSTORE_ID VarStoreId;
|
||||
EFI_GUID Guid;
|
||||
} EFI_IFR_VARSTORE_NAME_VALUE;
|
||||
|
||||
@@ -747,7 +753,7 @@ typedef struct _EFI_IFR_FORM_SET {
|
||||
EFI_STRING_ID FormSetTitle;
|
||||
EFI_STRING_ID Help;
|
||||
UINT8 Flags;
|
||||
EFI_GUID ClassGuid[1];
|
||||
// EFI_GUID ClassGuid[];
|
||||
} EFI_IFR_FORM_SET;
|
||||
|
||||
typedef struct _EFI_IFR_END {
|
||||
@@ -1009,6 +1015,9 @@ typedef struct _EFI_IFR_ONE_OF_OPTION {
|
||||
#define EFI_IFR_TYPE_DATE 0x06
|
||||
#define EFI_IFR_TYPE_STRING 0x07
|
||||
#define EFI_IFR_TYPE_OTHER 0x08
|
||||
#define EFI_IFR_TYPE_UNDEFINED 0x09
|
||||
#define EFI_IFR_TYPE_ACTION 0x0A
|
||||
#define EFI_IFR_TYPE_BUFFER 0x0B
|
||||
|
||||
#define EFI_IFR_OPTION_DEFAULT 0x10
|
||||
#define EFI_IFR_OPTION_DEFAULT_MFG 0x20
|
||||
@@ -1288,6 +1297,100 @@ typedef struct _EFI_IFR_SECURITY {
|
||||
EFI_GUID Permissions;
|
||||
} EFI_IFR_SECURITY;
|
||||
|
||||
typedef struct _EFI_IFR_FORM_MAP_METHOD {
|
||||
///
|
||||
/// The string identifier which provides the human-readable name of
|
||||
/// the configuration method for this standards map form.
|
||||
///
|
||||
EFI_STRING_ID MethodTitle;
|
||||
///
|
||||
/// Identifier which uniquely specifies the configuration methods
|
||||
/// associated with this standards map form.
|
||||
///
|
||||
EFI_GUID MethodIdentifier;
|
||||
} EFI_IFR_FORM_MAP_METHOD;
|
||||
|
||||
typedef struct _EFI_IFR_FORM_MAP {
|
||||
///
|
||||
/// The sequence that defines the type of opcode as well as the length
|
||||
/// of the opcode being defined. Header.OpCode = EFI_IFR_FORM_MAP_OP.
|
||||
///
|
||||
EFI_IFR_OP_HEADER Header;
|
||||
///
|
||||
/// The unique identifier for this particular form.
|
||||
///
|
||||
EFI_FORM_ID FormId;
|
||||
///
|
||||
/// One or more configuration method's name and unique identifier.
|
||||
///
|
||||
// EFI_IFR_FORM_MAP_METHOD Methods[];
|
||||
} EFI_IFR_FORM_MAP;
|
||||
|
||||
typedef struct _EFI_IFR_SET {
|
||||
///
|
||||
/// The sequence that defines the type of opcode as well as the length
|
||||
/// of the opcode being defined. Header.OpCode = EFI_IFR_SET_OP.
|
||||
///
|
||||
EFI_IFR_OP_HEADER Header;
|
||||
///
|
||||
/// Specifies the identifier of a previously declared variable store to
|
||||
/// use when storing the question's value.
|
||||
///
|
||||
EFI_VARSTORE_ID VarStoreId;
|
||||
union {
|
||||
///
|
||||
/// A 16-bit Buffer Storage offset.
|
||||
///
|
||||
EFI_STRING_ID VarName;
|
||||
///
|
||||
/// A Name Value or EFI Variable name (VarName).
|
||||
///
|
||||
UINT16 VarOffset;
|
||||
} VarStoreInfo;
|
||||
///
|
||||
/// Specifies the type used for storage.
|
||||
///
|
||||
UINT8 VarStoreType;
|
||||
} EFI_IFR_SET;
|
||||
|
||||
typedef struct _EFI_IFR_GET {
|
||||
///
|
||||
/// The sequence that defines the type of opcode as well as the length
|
||||
/// of the opcode being defined. Header.OpCode = EFI_IFR_GET_OP.
|
||||
///
|
||||
EFI_IFR_OP_HEADER Header;
|
||||
///
|
||||
/// Specifies the identifier of a previously declared variable store to
|
||||
/// use when retrieving the value.
|
||||
///
|
||||
EFI_VARSTORE_ID VarStoreId;
|
||||
union {
|
||||
///
|
||||
/// A 16-bit Buffer Storage offset.
|
||||
///
|
||||
EFI_STRING_ID VarName;
|
||||
///
|
||||
/// A Name Value or EFI Variable name (VarName).
|
||||
///
|
||||
UINT16 VarOffset;
|
||||
} VarStoreInfo;
|
||||
///
|
||||
/// Specifies the type used for storage.
|
||||
///
|
||||
UINT8 VarStoreType;
|
||||
} EFI_IFR_GET;
|
||||
|
||||
typedef struct _EFI_IFR_READ {
|
||||
EFI_IFR_OP_HEADER Header;
|
||||
} EFI_IFR_READ;
|
||||
|
||||
typedef struct _EFI_IFR_WRITE {
|
||||
EFI_IFR_OP_HEADER Header;
|
||||
} EFI_IFR_WRITE;
|
||||
|
||||
typedef struct _EFI_IFR_MAP {
|
||||
EFI_IFR_OP_HEADER Header;
|
||||
} EFI_IFR_MAP;
|
||||
//
|
||||
// Keyboard Package
|
||||
//
|
||||
|
@@ -1,3 +1,15 @@
|
||||
@REM ## @file
|
||||
@REM #
|
||||
@REM # Copyright (c) 2007 - 2010, Intel Corporation
|
||||
@REM # All rights reserved. This program and the accompanying materials
|
||||
@REM # are licensed and made available under the terms and conditions of the BSD License
|
||||
@REM # which accompanies this distribution. The full text of the license may be found at
|
||||
@REM # http://opensource.org/licenses/bsd-license.php
|
||||
@REM #
|
||||
@REM # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
@REM # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
|
||||
@echo off
|
||||
setlocal
|
||||
SET NMAKE_COMMAND=%1
|
||||
|
@@ -1,3 +1,15 @@
|
||||
## @file
|
||||
#
|
||||
# Copyright (c) 2007 - 2010, Intel Corporation
|
||||
# All rights reserved. This program and the accompanying materials
|
||||
# are licensed and made available under the terms and conditions of the BSD License
|
||||
# which accompanies this distribution. The full text of the license may be found at
|
||||
# http://opensource.org/licenses/bsd-license.php
|
||||
#
|
||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
#
|
||||
|
||||
MAKEROOT ?= ../..
|
||||
|
||||
include $(MAKEROOT)/Makefiles/header.makefile
|
||||
|
@@ -1,3 +1,14 @@
|
||||
## @file
|
||||
#
|
||||
# Copyright (c) 2007 - 2010, Intel Corporation
|
||||
# All rights reserved. This program and the accompanying materials
|
||||
# are licensed and made available under the terms and conditions of the BSD License
|
||||
# which accompanies this distribution. The full text of the license may be found at
|
||||
# http://opensource.org/licenses/bsd-license.php
|
||||
#
|
||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
DEPFILES = $(OBJECTS:%.o=%.d)
|
||||
|
||||
$(MAKEROOT)/libs-$(ARCH):
|
||||
|
@@ -1,8 +1,19 @@
|
||||
## @file
|
||||
#
|
||||
# The makefile can be invoked with
|
||||
# ARCH = x86_64 or x64 for EM64T build
|
||||
# ARCH = ia32 or IA32 for IA32 build
|
||||
# ARCH = ia64 or IA64 for IA64 build
|
||||
#
|
||||
# Copyright (c) 2007 - 2010, Intel Corporation
|
||||
# All rights reserved. This program and the accompanying materials
|
||||
# are licensed and made available under the terms and conditions of the BSD License
|
||||
# which accompanies this distribution. The full text of the license may be found at
|
||||
# http://opensource.org/licenses/bsd-license.php
|
||||
#
|
||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
ARCH ?= IA32
|
||||
|
||||
CYGWIN:=$(findstring CYGWIN, $(shell uname -s))
|
||||
|
@@ -1,3 +1,14 @@
|
||||
## @file
|
||||
#
|
||||
# Copyright (c) 2007 - 2010, Intel Corporation
|
||||
# All rights reserved. This program and the accompanying materials
|
||||
# are licensed and made available under the terms and conditions of the BSD License
|
||||
# which accompanies this distribution. The full text of the license may be found at
|
||||
# http://opensource.org/licenses/bsd-license.php
|
||||
#
|
||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
include $(MAKEROOT)/Makefiles/header.makefile
|
||||
|
||||
LIBRARY = $(MAKEROOT)/libs/lib$(LIBNAME).a
|
||||
|
@@ -1,3 +1,14 @@
|
||||
## @file
|
||||
#
|
||||
# Copyright (c) 2007 - 2010, Intel Corporation
|
||||
# All rights reserved. This program and the accompanying materials
|
||||
# are licensed and made available under the terms and conditions of the BSD License
|
||||
# which accompanies this distribution. The full text of the license may be found at
|
||||
# http://opensource.org/licenses/bsd-license.php
|
||||
#
|
||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
!INCLUDE ..\Makefiles\ms.common
|
||||
|
||||
APPLICATION = $(BIN_PATH)\$(APPNAME).exe
|
||||
|
@@ -1,3 +1,14 @@
|
||||
## @file
|
||||
#
|
||||
# Copyright (c) 2007 - 2010, Intel Corporation
|
||||
# All rights reserved. This program and the accompanying materials
|
||||
# are licensed and made available under the terms and conditions of the BSD License
|
||||
# which accompanies this distribution. The full text of the license may be found at
|
||||
# http://opensource.org/licenses/bsd-license.php
|
||||
#
|
||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
!IFNDEF EDK_TOOLS_PATH
|
||||
!ERROR "Please set your EDK_TOOLS_PATH!"
|
||||
!ENDIF
|
||||
|
@@ -1,3 +1,14 @@
|
||||
## @file
|
||||
#
|
||||
# Copyright (c) 2007 - 2010, Intel Corporation
|
||||
# All rights reserved. This program and the accompanying materials
|
||||
# are licensed and made available under the terms and conditions of the BSD License
|
||||
# which accompanies this distribution. The full text of the license may be found at
|
||||
# http://opensource.org/licenses/bsd-license.php
|
||||
#
|
||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
!INCLUDE ..\Makefiles\ms.common
|
||||
|
||||
LIBRARY = $(LIB_PATH)\$(LIBNAME).lib
|
||||
|
@@ -1,3 +1,14 @@
|
||||
## @file
|
||||
#
|
||||
# Copyright (c) 2007 - 2010, Intel Corporation
|
||||
# All rights reserved. This program and the accompanying materials
|
||||
# are licensed and made available under the terms and conditions of the BSD License
|
||||
# which accompanies this distribution. The full text of the license may be found at
|
||||
# http://opensource.org/licenses/bsd-license.php
|
||||
#
|
||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
#DEPFILES = $(OBJECTS:%.o=%.d)
|
||||
|
||||
.c.obj :
|
||||
|
@@ -1,3 +1,16 @@
|
||||
/** @file
|
||||
|
||||
Copyright (c) 2009 - 2010 Intel Corporation. All rights reserved
|
||||
This program and the accompanying materials are licensed and made available
|
||||
under the terms and conditions of the BSD License which accompanies this
|
||||
distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
#include <Python.h>
|
||||
#include <Decompress.h>
|
||||
|
||||
|
@@ -1,3 +1,14 @@
|
||||
## @file
|
||||
#
|
||||
# Copyright (c) 2007 - 2010, Intel Corporation
|
||||
# All rights reserved. This program and the accompanying materials
|
||||
# are licensed and made available under the terms and conditions of the BSD License
|
||||
# which accompanies this distribution. The full text of the license may be found at
|
||||
# http://opensource.org/licenses/bsd-license.php
|
||||
#
|
||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
!INCLUDE ..\Makefiles\ms.common
|
||||
|
||||
APPNAME = GenSec
|
||||
|
@@ -1,3 +1,14 @@
|
||||
## @file
|
||||
#
|
||||
# Copyright (c) 2007 - 2010, Intel Corporation
|
||||
# All rights reserved. This program and the accompanying materials
|
||||
# are licensed and made available under the terms and conditions of the BSD License
|
||||
# which accompanies this distribution. The full text of the license may be found at
|
||||
# http://opensource.org/licenses/bsd-license.php
|
||||
#
|
||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
!INCLUDE ..\Makefiles\ms.common
|
||||
|
||||
APPNAME = GenSec
|
||||
|
@@ -1,3 +1,16 @@
|
||||
/** @file
|
||||
|
||||
Copyright (c) 2009 - 2010 Intel Corporation. All rights reserved
|
||||
This program and the accompanying materials are licensed and made available
|
||||
under the terms and conditions of the BSD License which accompanies this
|
||||
distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
#include <Python.h>
|
||||
#include <Windows.h>
|
||||
#include <Common/UefiBaseTypes.h>
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
Split a file into two pieces at the request offset.
|
||||
|
||||
Copyright (c) 1999-2008 Intel Corporation. All rights reserved
|
||||
Copyright (c) 1999-2010 Intel Corporation. All rights reserved
|
||||
This program and the accompanying materials are licensed and made available
|
||||
under the terms and conditions of the BSD License which accompanies this
|
||||
distribution. The full text of the license may be found at
|
||||
@@ -58,7 +58,7 @@ Returns:
|
||||
--*/
|
||||
{
|
||||
printf ("%s v%d.%d -Utility to break a file into two pieces at the request offset.\n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION);
|
||||
printf ("Copyright (c) 1999-2007 Intel Corporation. All rights reserved.\n");
|
||||
printf ("Copyright (c) 1999-2010 Intel Corporation. All rights reserved.\n");
|
||||
}
|
||||
|
||||
void
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/** @file
|
||||
|
||||
Copyright (c) 2007 - 2008, Intel Corporation
|
||||
Copyright (c) 2007 - 2010, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
@@ -1695,7 +1695,7 @@ Returns:
|
||||
//
|
||||
// Copyright declaration
|
||||
//
|
||||
fprintf (stdout, "Copyright (c) 2007, Intel Corporation. All rights reserved.\n\n");
|
||||
fprintf (stdout, "Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.\n\n");
|
||||
|
||||
//
|
||||
// Details Option
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/** @file
|
||||
|
||||
Copyright (c) 2004 - 2008, Intel Corporation
|
||||
Copyright (c) 2004 - 2010, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
@@ -31,6 +31,7 @@ Abstract:
|
||||
#define MAX_VFR_LINE_LEN 4096
|
||||
|
||||
#define EFI_IFR_MAX_LENGTH 0xFF
|
||||
#define MAX_IFR_EXPRESSION_DEPTH 0x9
|
||||
|
||||
#define EFI_VARSTORE_ID_INVALID 0
|
||||
#define EFI_VAROFFSET_INVALID 0xFFFF
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
VfrCompiler main class and main function.
|
||||
|
||||
Copyright (c) 2004 - 2008, Intel Corporation
|
||||
Copyright (c) 2004 - 2010, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
@@ -24,9 +24,19 @@ PACKAGE_DATA gCBuffer;
|
||||
PACKAGE_DATA gRBuffer;
|
||||
|
||||
VOID
|
||||
CVfrCompiler::DebugError () {
|
||||
Error (NULL, 0, 0001, "Error parsing vfr file", " %s", mOptions.VfrFileName);
|
||||
//_asm int 3;
|
||||
CVfrCompiler::DebugError (
|
||||
IN CHAR8 *FileName,
|
||||
IN UINT32 LineNumber,
|
||||
IN UINT32 MessageCode,
|
||||
IN CONST CHAR8 *Text,
|
||||
IN CONST CHAR8 *MsgFmt,
|
||||
...
|
||||
)
|
||||
{
|
||||
va_list List;
|
||||
va_start (List, MsgFmt);
|
||||
PrintMessage ((CHAR8 *) "ERROR", FileName, LineNumber, MessageCode, (CHAR8 *) Text, (CHAR8 *) MsgFmt, List);
|
||||
va_end (List);
|
||||
}
|
||||
|
||||
VOID
|
||||
@@ -53,7 +63,7 @@ CVfrCompiler::OptionInitialization (
|
||||
{
|
||||
INT32 Index;
|
||||
|
||||
SetUtilityName (PROGRAM_NAME);
|
||||
SetUtilityName ((CHAR8*) PROGRAM_NAME);
|
||||
|
||||
mOptions.VfrFileName[0] = '\0';
|
||||
mOptions.RecordListFile[0] = '\0';
|
||||
@@ -84,11 +94,9 @@ CVfrCompiler::OptionInitialization (
|
||||
mOptions.CreateRecordListFile = TRUE;
|
||||
gCIfrRecordInfoDB.TurnOn ();
|
||||
} else if (stricmp(Argv[Index], "-i") == 0) {
|
||||
Error (NULL, 0, 1000, "Unknown option", "unrecognized option %s", Argv[Index]);
|
||||
goto Fail;
|
||||
Index++;
|
||||
if ((Index >= Argc) || (Argv[Index][0] == '-')) {
|
||||
Error (NULL, 0, 1001, "Missing option", "-i missing path argument");
|
||||
DebugError (NULL, 0, 1001, "Missing option", "-i missing path argument");
|
||||
goto Fail;
|
||||
}
|
||||
|
||||
@@ -96,7 +104,7 @@ CVfrCompiler::OptionInitialization (
|
||||
} else if (stricmp(Argv[Index], "-o") == 0 || stricmp(Argv[Index], "--output-directory") == 0 || stricmp(Argv[Index], "-od") == 0) {
|
||||
Index++;
|
||||
if ((Index >= Argc) || (Argv[Index][0] == '-')) {
|
||||
Error (NULL, 0, 1001, "Missing option", "-o missing output directory name");
|
||||
DebugError (NULL, 0, 1001, "Missing option", "-o missing output directory name");
|
||||
goto Fail;
|
||||
}
|
||||
strcpy (mOptions.OutputDirectory, Argv[Index]);
|
||||
@@ -109,17 +117,15 @@ CVfrCompiler::OptionInitialization (
|
||||
strcat (mOptions.OutputDirectory, "\\");
|
||||
}
|
||||
}
|
||||
DebugMsg (NULL, 0, 9, "Output Directory", mOptions.OutputDirectory);
|
||||
DebugMsg (NULL, 0, 9, (CHAR8 *) "Output Directory", mOptions.OutputDirectory);
|
||||
} else if (stricmp(Argv[Index], "-b") == 0 || stricmp(Argv[Index], "--create-ifr-package") == 0 || stricmp(Argv[Index], "-ibin") == 0) {
|
||||
mOptions.CreateIfrPkgFile = TRUE;
|
||||
} else if (stricmp(Argv[Index], "-n") == 0 || stricmp(Argv[Index], "--no-pre-processing") == 0 || stricmp(Argv[Index], "-nopp") == 0) {
|
||||
mOptions.SkipCPreprocessor = TRUE;
|
||||
} else if (stricmp(Argv[Index], "-f") == 0 || stricmp(Argv[Index], "--pre-processing-flag") == 0 || stricmp(Argv[Index], "-ppflag") == 0) {
|
||||
Error (NULL, 0, 1000, "Unknown option", "unrecognized option %s", Argv[Index]);
|
||||
goto Fail;
|
||||
Index++;
|
||||
if ((Index >= Argc) || (Argv[Index][0] == '-')) {
|
||||
Error (NULL, 0, 1001, "Missing option", "-od - missing C-preprocessor argument");
|
||||
DebugError (NULL, 0, 1001, "Missing option", "-od - missing C-preprocessor argument");
|
||||
goto Fail;
|
||||
}
|
||||
|
||||
@@ -127,13 +133,13 @@ CVfrCompiler::OptionInitialization (
|
||||
} else if (stricmp(Argv[Index], "-c") == 0 || stricmp(Argv[Index], "--compatible-framework") == 0) {
|
||||
mOptions.CompatibleMode = TRUE;
|
||||
} else {
|
||||
Error (NULL, 0, 1000, "Unknown option", "unrecognized option %s", Argv[Index]);
|
||||
DebugError (NULL, 0, 1000, "Unknown option", "unrecognized option %s", Argv[Index]);
|
||||
goto Fail;
|
||||
}
|
||||
}
|
||||
|
||||
if (Index != Argc - 1) {
|
||||
Error (NULL, 0, 1001, "Missing option", "VFR file name is not specified.");
|
||||
DebugError (NULL, 0, 1001, "Missing option", "VFR file name is not specified.");
|
||||
goto Fail;
|
||||
} else {
|
||||
strcpy (mOptions.VfrFileName, Argv[Index]);
|
||||
@@ -192,7 +198,7 @@ CVfrCompiler::AppendIncludePath (
|
||||
}
|
||||
IncludePaths = new CHAR8[Len];
|
||||
if (IncludePaths == NULL) {
|
||||
Error (NULL, 0, 4001, "Resource: memory can't be allocated", NULL);
|
||||
DebugError (NULL, 0, 4001, "Resource: memory can't be allocated", NULL);
|
||||
return;
|
||||
}
|
||||
IncludePaths[0] = '\0';
|
||||
@@ -221,7 +227,7 @@ CVfrCompiler::AppendCPreprocessorOptions (
|
||||
}
|
||||
Opt = new CHAR8[Len];
|
||||
if (Opt == NULL) {
|
||||
Error (NULL, 0, 4001, "Resource: memory can't be allocated", NULL);
|
||||
DebugError (NULL, 0, 4001, "Resource: memory can't be allocated", NULL);
|
||||
return;
|
||||
}
|
||||
Opt[0] = 0;
|
||||
@@ -339,8 +345,8 @@ CVfrCompiler::CVfrCompiler (
|
||||
IN CHAR8 **Argv
|
||||
)
|
||||
{
|
||||
mPreProcessCmd = PREPROCESSOR_COMMAND;
|
||||
mPreProcessOpt = PREPROCESSOR_OPTIONS;
|
||||
mPreProcessCmd = (CHAR8 *) PREPROCESSOR_COMMAND;
|
||||
mPreProcessOpt = (CHAR8 *) PREPROCESSOR_OPTIONS;
|
||||
|
||||
OptionInitialization(Argc, Argv);
|
||||
|
||||
@@ -377,6 +383,7 @@ CVfrCompiler::Usage (
|
||||
CONST CHAR8 *Help[] = {
|
||||
" ",
|
||||
"VfrCompile version " VFR_COMPILER_VERSION VFR_COMPILER_UPDATE_TIME,
|
||||
"Copyright (c) 2004-2010 Intel Corporation. All rights reserved.",
|
||||
" ",
|
||||
"Usage: VfrCompile [options] VfrFile",
|
||||
" ",
|
||||
@@ -417,7 +424,7 @@ CVfrCompiler::PreProcess (
|
||||
}
|
||||
|
||||
if ((pVfrFile = fopen (mOptions.VfrFileName, "r")) == NULL) {
|
||||
Error (NULL, 0, 0001, "Error opening the input VFR file", mOptions.VfrFileName);
|
||||
DebugError (NULL, 0, 0001, "Error opening the input VFR file", mOptions.VfrFileName);
|
||||
goto Fail;
|
||||
}
|
||||
fclose (pVfrFile);
|
||||
@@ -433,7 +440,7 @@ CVfrCompiler::PreProcess (
|
||||
|
||||
PreProcessCmd = new CHAR8[CmdLen + 10];
|
||||
if (PreProcessCmd == NULL) {
|
||||
Error (NULL, 0, 4001, "Resource: memory can't be allocated", NULL);
|
||||
DebugError (NULL, 0, 4001, "Resource: memory can't be allocated", NULL);
|
||||
goto Fail;
|
||||
}
|
||||
strcpy (PreProcessCmd, mPreProcessCmd), strcat (PreProcessCmd, " ");
|
||||
@@ -448,7 +455,7 @@ CVfrCompiler::PreProcess (
|
||||
strcat (PreProcessCmd, mOptions.PreprocessorOutputFileName);
|
||||
|
||||
if (system (PreProcessCmd) != 0) {
|
||||
Error (NULL, 0, 0003, "Error parsing file", "failed to spawn C preprocessor on VFR file %s\n", PreProcessCmd);
|
||||
DebugError (NULL, 0, 0003, "Error parsing file", "failed to spawn C preprocessor on VFR file %s\n", PreProcessCmd);
|
||||
goto Fail;
|
||||
}
|
||||
|
||||
@@ -484,7 +491,7 @@ CVfrCompiler::Compile (
|
||||
gCVfrErrorHandle.SetInputFile (InFileName);
|
||||
|
||||
if ((pInFile = fopen (InFileName, "r")) == NULL) {
|
||||
Error (NULL, 0, 0001, "Error opening the input file", InFileName);
|
||||
DebugError (NULL, 0, 0001, "Error opening the input file", InFileName);
|
||||
goto Fail;
|
||||
}
|
||||
|
||||
@@ -504,7 +511,7 @@ CVfrCompiler::Compile (
|
||||
|
||||
Fail:
|
||||
if (!IS_RUN_STATUS(STATUS_DEAD)) {
|
||||
Error (NULL, 0, 0003, "Error parsing", "compile error in file %s", InFileName);
|
||||
DebugError (NULL, 0, 0003, "Error parsing", "compile error in file %s", InFileName);
|
||||
SET_RUN_STATUS (STATUS_FAILED);
|
||||
}
|
||||
if (pInFile != NULL) {
|
||||
@@ -534,7 +541,7 @@ CVfrCompiler::AdjustBin (
|
||||
if (gCBuffer.Buffer != NULL && gRBuffer.Buffer != NULL) {
|
||||
UINT32 Index;
|
||||
if (gCBuffer.Size != gRBuffer.Size) {
|
||||
Error (NULL, 0, 0001, "Error parsing vfr file", " %s. FormBinary Size 0x%X is not same to RecordBuffer Size 0x%X", mOptions.VfrFileName, gCBuffer.Size, gRBuffer.Size);
|
||||
DebugError (NULL, 0, 0001, "Error parsing vfr file", " %s. FormBinary Size 0x%X is not same to RecordBuffer Size 0x%X", mOptions.VfrFileName, gCBuffer.Size, gRBuffer.Size);
|
||||
}
|
||||
for (Index = 0; Index < gCBuffer.Size; Index ++) {
|
||||
if (gCBuffer.Buffer[Index] != gRBuffer.Buffer[Index]) {
|
||||
@@ -542,13 +549,13 @@ CVfrCompiler::AdjustBin (
|
||||
}
|
||||
}
|
||||
if (Index != gCBuffer.Size) {
|
||||
Error (NULL, 0, 0001, "Error parsing vfr file", " %s. the 0x%X byte is different between Form and Record", mOptions.VfrFileName, Index);
|
||||
DebugError (NULL, 0, 0001, "Error parsing vfr file", " %s. the 0x%X byte is different between Form and Record", mOptions.VfrFileName, Index);
|
||||
}
|
||||
DebugMsg (NULL, 0, 9, "IFR Buffer", "Form Buffer same to Record Buffer and Size is 0x%X", Index);
|
||||
DebugMsg (NULL, 0, 9, (CHAR8 *) "IFR Buffer", (CHAR8 *) "Form Buffer same to Record Buffer and Size is 0x%X", Index);
|
||||
} else if (gCBuffer.Buffer == NULL && gRBuffer.Buffer == NULL) {
|
||||
//ok
|
||||
} else {
|
||||
Error (NULL, 0, 0001, "Error parsing vfr file", " %s.Buffer not allocated.", mOptions.VfrFileName);
|
||||
DebugError (NULL, 0, 0001, "Error parsing vfr file", " %s.Buffer not allocated.", mOptions.VfrFileName);
|
||||
}
|
||||
|
||||
//
|
||||
@@ -588,7 +595,7 @@ CVfrCompiler::GenBinary (
|
||||
|
||||
if (mOptions.CreateIfrPkgFile == TRUE) {
|
||||
if ((pFile = fopen (mOptions.PkgOutputFileName, "wb")) == NULL) {
|
||||
Error (NULL, 0, 0001, "Error opening file", mOptions.PkgOutputFileName);
|
||||
DebugError (NULL, 0, 0001, "Error opening file", mOptions.PkgOutputFileName);
|
||||
goto Fail;
|
||||
}
|
||||
if (gCFormPkg.BuildPkg (pFile, &gRBuffer) != VFR_RETURN_SUCCESS) {
|
||||
@@ -631,7 +638,7 @@ CVfrCompiler::GenCFile (
|
||||
|
||||
if (!mOptions.CreateIfrPkgFile || mOptions.CompatibleMode) {
|
||||
if ((pFile = fopen (mOptions.COutputFileName, "w")) == NULL) {
|
||||
Error (NULL, 0, 0001, "Error opening output C file", mOptions.COutputFileName);
|
||||
DebugError (NULL, 0, 0001, "Error opening output C file", mOptions.COutputFileName);
|
||||
goto Fail;
|
||||
}
|
||||
|
||||
@@ -678,12 +685,12 @@ CVfrCompiler::GenRecordListFile (
|
||||
}
|
||||
|
||||
if ((pInFile = fopen (InFileName, "r")) == NULL) {
|
||||
Error (NULL, 0, 0001, "Error opening the input VFR preprocessor output file", InFileName);
|
||||
DebugError (NULL, 0, 0001, "Error opening the input VFR preprocessor output file", InFileName);
|
||||
return;
|
||||
}
|
||||
|
||||
if ((pOutFile = fopen (mOptions.RecordListFile, "w")) == NULL) {
|
||||
Error (NULL, 0, 0001, "Error opening the record list file", mOptions.RecordListFile);
|
||||
DebugError (NULL, 0, 0001, "Error opening the record list file", mOptions.RecordListFile);
|
||||
goto Err1;
|
||||
}
|
||||
|
||||
@@ -713,8 +720,8 @@ Err1:
|
||||
|
||||
int
|
||||
main (
|
||||
IN INT32 Argc,
|
||||
IN CHAR8 **Argv
|
||||
IN int Argc,
|
||||
IN char **Argv
|
||||
)
|
||||
{
|
||||
COMPILER_RUN_STATUS Status;
|
||||
@@ -743,3 +750,4 @@ main (
|
||||
return GetUtilityStatus ();
|
||||
}
|
||||
|
||||
|
||||
|
@@ -102,7 +102,7 @@ public:
|
||||
VOID GenBinary (VOID);
|
||||
VOID GenCFile (VOID);
|
||||
VOID GenRecordListFile (VOID);
|
||||
VOID DebugError (VOID);
|
||||
VOID DebugError (IN CHAR8*, IN UINT32, IN UINT32, IN CONST CHAR8*, IN CONST CHAR8*, ...);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@@ -135,7 +135,6 @@ CVfrErrorHandle::ParseFileScopeRecord (
|
||||
IN UINT32 WholeScopeLine
|
||||
)
|
||||
{
|
||||
CHAR8 *FullPathName = NULL;
|
||||
SVfrFileScopeRecord *pNode = NULL;
|
||||
|
||||
if (Record == NULL) {
|
||||
@@ -195,19 +194,19 @@ VOID
|
||||
CVfrErrorHandle::PrintMsg (
|
||||
IN UINT32 LineNum,
|
||||
IN CHAR8 *TokName,
|
||||
IN CHAR8 *MsgType,
|
||||
IN CHAR8 *ErrorMsg
|
||||
IN CONST CHAR8 *MsgType,
|
||||
IN CONST CHAR8 *ErrorMsg
|
||||
)
|
||||
{
|
||||
CHAR8 *FileName = NULL;
|
||||
UINT32 FileLine;
|
||||
|
||||
if (strncmp ("Warning", MsgType, strlen ("Warning")) == 0) {
|
||||
VerboseMsg (ErrorMsg);
|
||||
VerboseMsg ((CHAR8 *) ErrorMsg);
|
||||
return;
|
||||
}
|
||||
GetFileNameLineNum (LineNum, &FileName, &FileLine);
|
||||
Error (FileName, FileLine, 0x3000, TokName, "\t%s\n", ErrorMsg);
|
||||
Error (FileName, FileLine, 0x3000, TokName, (CHAR8 *) "\t%s\n", (CHAR8 *) ErrorMsg);
|
||||
}
|
||||
|
||||
UINT8
|
||||
@@ -220,7 +219,7 @@ CVfrErrorHandle::HandleError (
|
||||
UINT32 Index;
|
||||
CHAR8 *FileName = NULL;
|
||||
UINT32 FileLine;
|
||||
CHAR8 *ErrorMsg = NULL;
|
||||
CONST CHAR8 *ErrorMsg = NULL;
|
||||
|
||||
if (mVfrErrorHandleTable == NULL) {
|
||||
return 1;
|
||||
@@ -235,7 +234,7 @@ CVfrErrorHandle::HandleError (
|
||||
|
||||
if (ErrorMsg != NULL) {
|
||||
GetFileNameLineNum (LineNum, &FileName, &FileLine);
|
||||
Error (FileName, FileLine, 0x3000, TokName, "\t%s\n", ErrorMsg);
|
||||
Error (FileName, FileLine, 0x3000, TokName, (CHAR8 *) "\t%s\n", (CHAR8 *) ErrorMsg);
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
|
@@ -47,7 +47,7 @@ typedef enum {
|
||||
|
||||
typedef struct _SVFR_ERROR_HANDLE {
|
||||
EFI_VFR_RETURN_CODE mErrorCode;
|
||||
CHAR8 *mErrorMsg;
|
||||
CONST CHAR8 *mErrorMsg;
|
||||
} SVFR_ERROR_HANDLE;
|
||||
|
||||
struct SVfrFileScopeRecord {
|
||||
@@ -74,8 +74,8 @@ public:
|
||||
VOID SetInputFile (IN CHAR8 *);
|
||||
VOID ParseFileScopeRecord (IN CHAR8 *, IN UINT32);
|
||||
VOID GetFileNameLineNum (IN UINT32, OUT CHAR8 **, OUT UINT32 *);
|
||||
UINT8 HandleError (IN EFI_VFR_RETURN_CODE, IN UINT32 LineNum = 0, IN CHAR8 *TokName = "\0");
|
||||
VOID PrintMsg (IN UINT32 LineNum = 0, IN CHAR8 *TokName = "\0", IN CHAR8 *MsgType = "Error", IN CHAR8 *ErrorMsg = "\0");
|
||||
UINT8 HandleError (IN EFI_VFR_RETURN_CODE, IN UINT32 LineNum = 0, IN CHAR8 *TokName = NULL);
|
||||
VOID PrintMsg (IN UINT32 LineNum = 0, IN CHAR8 *TokName = NULL, IN CONST CHAR8 *MsgType = "Error", IN CONST CHAR8 *ErrorMsg = "");
|
||||
};
|
||||
|
||||
#define CHECK_ERROR_RETURN(f, v) do { EFI_VFR_RETURN_CODE r; if ((r = (f)) != (v)) { return r; } } while (0)
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
The definition of CFormPkg's member function
|
||||
|
||||
Copyright (c) 2004 - 2009, Intel Corporation
|
||||
Copyright (c) 2004 - 2010, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
@@ -25,7 +25,7 @@ SPendingAssign::SPendingAssign (
|
||||
IN VOID *Addr,
|
||||
IN UINT32 Len,
|
||||
IN UINT32 LineNo,
|
||||
IN CHAR8 *Msg
|
||||
IN CONST CHAR8 *Msg
|
||||
)
|
||||
{
|
||||
mKey = NULL;
|
||||
@@ -352,11 +352,11 @@ CFormPkg::BuildPkg (
|
||||
|
||||
VOID
|
||||
CFormPkg::_WRITE_PKG_LINE (
|
||||
IN FILE *pFile,
|
||||
IN UINT32 LineBytes,
|
||||
IN CHAR8 *LineHeader,
|
||||
IN CHAR8 *BlkBuf,
|
||||
IN UINT32 BlkSize
|
||||
IN FILE *pFile,
|
||||
IN UINT32 LineBytes,
|
||||
IN CONST CHAR8 *LineHeader,
|
||||
IN CHAR8 *BlkBuf,
|
||||
IN UINT32 BlkSize
|
||||
)
|
||||
{
|
||||
UINT32 Index;
|
||||
@@ -375,11 +375,11 @@ CFormPkg::_WRITE_PKG_LINE (
|
||||
|
||||
VOID
|
||||
CFormPkg::_WRITE_PKG_END (
|
||||
IN FILE *pFile,
|
||||
IN UINT32 LineBytes,
|
||||
IN CHAR8 *LineHeader,
|
||||
IN CHAR8 *BlkBuf,
|
||||
IN UINT32 BlkSize
|
||||
IN FILE *pFile,
|
||||
IN UINT32 LineBytes,
|
||||
IN CONST CHAR8 *LineHeader,
|
||||
IN CHAR8 *BlkBuf,
|
||||
IN UINT32 BlkSize
|
||||
)
|
||||
{
|
||||
UINT32 Index;
|
||||
@@ -483,7 +483,7 @@ CFormPkg::AssignPending (
|
||||
IN VOID *ValAddr,
|
||||
IN UINT32 ValLen,
|
||||
IN UINT32 LineNo,
|
||||
IN CHAR8 *Msg
|
||||
IN CONST CHAR8 *Msg
|
||||
)
|
||||
{
|
||||
SPendingAssign *pNew;
|
||||
@@ -1242,7 +1242,7 @@ static struct {
|
||||
{ 0, 0 }, // 0x1F
|
||||
{ sizeof (EFI_IFR_TO_LOWER), 0 }, // EFI_IFR_TO_LOWER_OP - 0x20
|
||||
{ sizeof (EFI_IFR_TO_UPPER), 0 }, // EFI_IFR_TO_UPPER_OP - 0x21
|
||||
{ 0, 0 }, // 0x22
|
||||
{ sizeof (EFI_IFR_MAP), 1 }, // EFI_IFR_MAP - 0x22
|
||||
{ sizeof (EFI_IFR_ORDERED_LIST), 1 }, // EFI_IFR_ORDERED_LIST_OP - 0x23
|
||||
{ sizeof (EFI_IFR_VARSTORE), 0 }, // EFI_IFR_VARSTORE_OP
|
||||
{ sizeof (EFI_IFR_VARSTORE_NAME_VALUE), 0 }, // EFI_IFR_VARSTORE_NAME_VALUE_OP
|
||||
@@ -1250,8 +1250,11 @@ static struct {
|
||||
{ sizeof (EFI_IFR_VARSTORE_DEVICE), 1 }, // EFI_IFR_VARSTORE_DEVICE_OP
|
||||
{ sizeof (EFI_IFR_VERSION), 0 }, // EFI_IFR_VERSION_OP - 0x28
|
||||
{ sizeof (EFI_IFR_END), 0 }, // EFI_IFR_END_OP
|
||||
{ sizeof (EFI_IFR_MATCH), 1 }, // EFI_IFR_MATCH_OP - 0x2A
|
||||
{ 0, 0 }, { 0, 0} , { 0, 0} , { 0, 0} , // 0x2B ~ 0x2E
|
||||
{ sizeof (EFI_IFR_MATCH), 0 }, // EFI_IFR_MATCH_OP - 0x2A
|
||||
{ sizeof (EFI_IFR_GET), 0 }, // EFI_IFR_GET - 0x2B
|
||||
{ sizeof (EFI_IFR_SET), 0 }, // EFI_IFR_SET - 0x2C
|
||||
{ sizeof (EFI_IFR_READ), 0 }, // EFI_IFR_READ - 0x2D
|
||||
{ sizeof (EFI_IFR_WRITE), 0 }, // EFI_IFR_WRITE - 0x2E
|
||||
{ sizeof (EFI_IFR_EQUAL), 0 }, // EFI_IFR_EQUAL_OP - 0x2F
|
||||
{ sizeof (EFI_IFR_NOT_EQUAL), 0 }, // EFI_IFR_NOT_EQUAL_OP
|
||||
{ sizeof (EFI_IFR_GREATER_THAN), 0 }, // EFI_IFR_GREATER_THAN_OP
|
||||
@@ -1298,7 +1301,7 @@ static struct {
|
||||
{ sizeof (EFI_IFR_VALUE), 1 }, // EFI_IFR_VALUE_OP
|
||||
{ sizeof (EFI_IFR_DEFAULT), 0 }, // EFI_IFR_DEFAULT_OP
|
||||
{ sizeof (EFI_IFR_DEFAULTSTORE), 0 }, // EFI_IFR_DEFAULTSTORE_OP - 0x5C
|
||||
{ 0, 0}, // 0x5D
|
||||
{ sizeof (EFI_IFR_FORM_MAP), 1}, // EFI_IFR_FORM_MAP_OP - 0x5D
|
||||
{ sizeof (EFI_IFR_CATENATE), 0 }, // EFI_IFR_CATENATE_OP
|
||||
{ sizeof (EFI_IFR_GUID), 0 }, // EFI_IFR_GUID_OP
|
||||
{ sizeof (EFI_IFR_SECURITY), 0 }, // EFI_IFR_SECURITY_OP - 0x60
|
||||
@@ -1313,9 +1316,9 @@ static struct {
|
||||
"EFI_IFR_ACTION", "EFI_IFR_RESET_BUTTON", "EFI_IFR_FORM_SET", "EFI_IFR_REF", "EFI_IFR_NO_SUBMIT_IF", "EFI_IFR_INCONSISTENT_IF",
|
||||
"EFI_IFR_EQ_ID_VAL", "EFI_IFR_EQ_ID_ID", "EFI_IFR_EQ_ID_LIST", "EFI_IFR_AND", "EFI_IFR_OR", "EFI_IFR_NOT",
|
||||
"EFI_IFR_RULE", "EFI_IFR_GRAY_OUT_IF", "EFI_IFR_DATE", "EFI_IFR_TIME", "EFI_IFR_STRING", "EFI_IFR_REFRESH",
|
||||
"EFI_IFR_DISABLE_IF", "EFI_IFR_INVALID", "EFI_IFR_TO_LOWER", "EFI_IFR_TO_UPPER", "EFI_IFR_INVALID", "EFI_IFR_ORDERED_LIST",
|
||||
"EFI_IFR_DISABLE_IF", "EFI_IFR_INVALID", "EFI_IFR_TO_LOWER", "EFI_IFR_TO_UPPER", "EFI_IFR_MAP", "EFI_IFR_ORDERED_LIST",
|
||||
"EFI_IFR_VARSTORE", "EFI_IFR_VARSTORE_NAME_VALUE", "EFI_IFR_VARSTORE_EFI", "EFI_IFR_VARSTORE_DEVICE", "EFI_IFR_VERSION", "EFI_IFR_END",
|
||||
"EFI_IFR_MATCH", "EFI_IFR_INVALID", "EFI_IFR_INVALID", "EFI_IFR_INVALID", "EFI_IFR_INVALID", "EFI_IFR_EQUAL",
|
||||
"EFI_IFR_MATCH", "EFI_IFR_GET", "EFI_IFR_SET", "EFI_IFR_READ", "EFI_IFR_WRITE", "EFI_IFR_EQUAL",
|
||||
"EFI_IFR_NOT_EQUAL", "EFI_IFR_GREATER_THAN", "EFI_IFR_GREATER_EQUAL", "EFI_IFR_LESS_THAN", "EFI_IFR_LESS_EQUAL", "EFI_IFR_BITWISE_AND",
|
||||
"EFI_IFR_BITWISE_OR", "EFI_IFR_BITWISE_NOT", "EFI_IFR_SHIFT_LEFT", "EFI_IFR_SHIFT_RIGHT", "EFI_IFR_ADD", "EFI_IFR_SUBTRACT",
|
||||
"EFI_IFR_MULTIPLY", "EFI_IFR_DIVIDE", "EFI_IFR_MODULO", "EFI_IFR_RULE_REF", "EFI_IFR_QUESTION_REF1", "EFI_IFR_QUESTION_REF2",
|
||||
@@ -1323,7 +1326,7 @@ static struct {
|
||||
"EFI_IFR_TO_UINT", "EFI_IFR_TO_STRING", "EFI_IFR_TO_BOOLEAN", "EFI_IFR_MID", "EFI_IFR_FIND", "EFI_IFR_TOKEN",
|
||||
"EFI_IFR_STRING_REF1","EFI_IFR_STRING_REF2", "EFI_IFR_CONDITIONAL", "EFI_IFR_QUESTION_REF3", "EFI_IFR_ZERO", "EFI_IFR_ONE",
|
||||
"EFI_IFR_ONES", "EFI_IFR_UNDEFINED", "EFI_IFR_LENGTH", "EFI_IFR_DUP", "EFI_IFR_THIS", "EFI_IFR_SPAN",
|
||||
"EFI_IFR_VALUE", "EFI_IFR_DEFAULT", "EFI_IFR_DEFAULTSTORE", "EFI_IFR_INVALID", "EFI_IFR_CATENATE", "EFI_IFR_GUID",
|
||||
"EFI_IFR_VALUE", "EFI_IFR_DEFAULT", "EFI_IFR_DEFAULTSTORE", "EFI_IFR_FORM_MAP", "EFI_IFR_CATENATE", "EFI_IFR_GUID",
|
||||
"EFI_IFR_SECURITY",
|
||||
};
|
||||
|
||||
@@ -1340,7 +1343,7 @@ CIFROBJ_DEBUG_PRINT (
|
||||
|
||||
#endif
|
||||
|
||||
bool gCreateOp = TRUE;
|
||||
BOOLEAN gCreateOp = TRUE;
|
||||
|
||||
CIfrObj::CIfrObj (
|
||||
IN UINT8 OpCode,
|
||||
@@ -1396,4 +1399,4 @@ CIfrOpHeader::CIfrOpHeader (
|
||||
mHeader = OpHdr.mHeader;
|
||||
}
|
||||
|
||||
UINT32 CIfrForm::FormIdBitMap[EFI_FREE_FORM_ID_BITMAP_SIZE] = {0, };
|
||||
UINT32 CIfrFormId::FormIdBitMap[EFI_FREE_FORM_ID_BITMAP_SIZE] = {0, };
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
The definition of CFormPkg's member function
|
||||
|
||||
Copyright (c) 2004 - 2009, Intel Corporation
|
||||
Copyright (c) 2004 - 2010, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
@@ -81,7 +81,7 @@ struct SPendingAssign {
|
||||
CHAR8 *mMsg;
|
||||
struct SPendingAssign *mNext;
|
||||
|
||||
SPendingAssign (IN CHAR8 *, IN VOID *, IN UINT32, IN UINT32, IN CHAR8 *);
|
||||
SPendingAssign (IN CHAR8 *, IN VOID *, IN UINT32, IN UINT32, IN CONST CHAR8 *);
|
||||
~SPendingAssign ();
|
||||
|
||||
VOID SetAddrAndLen (IN VOID *, IN UINT32);
|
||||
@@ -108,8 +108,8 @@ private:
|
||||
|
||||
UINT32 mPkgLength;
|
||||
|
||||
VOID _WRITE_PKG_LINE (IN FILE *, IN UINT32 , IN CHAR8 *, IN CHAR8 *, IN UINT32);
|
||||
VOID _WRITE_PKG_END (IN FILE *, IN UINT32 , IN CHAR8 *, IN CHAR8 *, IN UINT32);
|
||||
VOID _WRITE_PKG_LINE (IN FILE *, IN UINT32 , IN CONST CHAR8 *, IN CHAR8 *, IN UINT32);
|
||||
VOID _WRITE_PKG_END (IN FILE *, IN UINT32 , IN CONST CHAR8 *, IN CHAR8 *, IN UINT32);
|
||||
|
||||
private:
|
||||
SPendingAssign *PendingAssignList;
|
||||
@@ -131,7 +131,7 @@ public:
|
||||
EFI_VFR_RETURN_CODE GenCFile (IN CHAR8 *, IN FILE *, IN PACKAGE_DATA *PkgData = NULL);
|
||||
|
||||
public:
|
||||
EFI_VFR_RETURN_CODE AssignPending (IN CHAR8 *, IN VOID *, IN UINT32, IN UINT32, IN CHAR8 *Msg = NULL);
|
||||
EFI_VFR_RETURN_CODE AssignPending (IN CHAR8 *, IN VOID *, IN UINT32, IN UINT32, IN CONST CHAR8 *Msg = NULL);
|
||||
VOID DoPendingAssign (IN CHAR8 *, IN VOID *, IN UINT32);
|
||||
bool HavePendingUnassigned (VOID);
|
||||
VOID PendingAssignPrintAll (VOID);
|
||||
@@ -195,11 +195,11 @@ extern CIfrRecordInfoDB gCIfrRecordInfoDB;
|
||||
/*
|
||||
* The definition of CIfrObj
|
||||
*/
|
||||
extern bool gCreateOp;
|
||||
extern BOOLEAN gCreateOp;
|
||||
|
||||
class CIfrObj {
|
||||
private:
|
||||
bool mDelayEmit;
|
||||
BOOLEAN mDelayEmit;
|
||||
|
||||
CHAR8 *mObjBinBuf;
|
||||
UINT8 mObjBinLen;
|
||||
@@ -227,7 +227,7 @@ public:
|
||||
|
||||
inline bool ExpendObjBin (IN UINT8 Size) {
|
||||
if ((mDelayEmit == TRUE) && ((mObjBinLen + Size) > mObjBinLen)) {
|
||||
mObjBinLen += Size;
|
||||
mObjBinLen = mObjBinLen + Size;
|
||||
return TRUE;
|
||||
} else {
|
||||
return FALSE;
|
||||
@@ -248,7 +248,7 @@ public:
|
||||
|
||||
VOID IncLength (UINT8 Size) {
|
||||
if ((mHeader->Length + Size) > mHeader->Length) {
|
||||
mHeader->Length += Size;
|
||||
mHeader->Length = mHeader->Length + Size;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -557,6 +557,7 @@ static CIfrMinMaxStepData *gCurrentMinMaxData = NULL;
|
||||
class CIfrFormSet : public CIfrObj, public CIfrOpHeader {
|
||||
private:
|
||||
EFI_IFR_FORM_SET *mFormSet;
|
||||
EFI_GUID *mClassGuid;
|
||||
|
||||
public:
|
||||
CIfrFormSet (UINT8 Size) : CIfrObj (EFI_IFR_FORM_SET_OP, (CHAR8 **)&mFormSet, Size),
|
||||
@@ -565,6 +566,7 @@ public:
|
||||
mFormSet->FormSetTitle = EFI_STRING_ID_INVALID;
|
||||
mFormSet->Flags = 0;
|
||||
memset (&mFormSet->Guid, 0, sizeof (EFI_GUID));
|
||||
mClassGuid = (EFI_GUID *) (mFormSet + 1);
|
||||
}
|
||||
|
||||
VOID SetGuid (IN EFI_GUID *Guid) {
|
||||
@@ -580,7 +582,7 @@ public:
|
||||
}
|
||||
|
||||
VOID SetClassGuid (IN EFI_GUID *Guid) {
|
||||
memcpy (&(mFormSet->ClassGuid[mFormSet->Flags++]), Guid, sizeof (EFI_GUID));
|
||||
memcpy (&(mClassGuid[mFormSet->Flags++]), Guid, sizeof (EFI_GUID));
|
||||
}
|
||||
|
||||
UINT8 GetFlags() {
|
||||
@@ -620,10 +622,8 @@ public:
|
||||
#define EFI_FORM_ID_MAX 0xFFFF
|
||||
#define EFI_FREE_FORM_ID_BITMAP_SIZE ((EFI_FORM_ID_MAX + 1) / EFI_BITS_PER_UINT32)
|
||||
|
||||
class CIfrForm : public CIfrObj, public CIfrOpHeader {
|
||||
private:
|
||||
EFI_IFR_FORM *mForm;
|
||||
|
||||
class CIfrFormId {
|
||||
public:
|
||||
STATIC UINT32 FormIdBitMap[EFI_FREE_FORM_ID_BITMAP_SIZE];
|
||||
|
||||
STATIC BOOLEAN ChekFormIdFree (IN EFI_FORM_ID FormId) {
|
||||
@@ -639,6 +639,11 @@ private:
|
||||
|
||||
FormIdBitMap[Index] |= (0x80000000 >> Offset);
|
||||
}
|
||||
};
|
||||
|
||||
class CIfrForm : public CIfrObj, public CIfrOpHeader {
|
||||
private:
|
||||
EFI_IFR_FORM *mForm;
|
||||
|
||||
public:
|
||||
CIfrForm () : CIfrObj (EFI_IFR_FORM_OP, (CHAR8 **)&mForm),
|
||||
@@ -654,11 +659,11 @@ public:
|
||||
//
|
||||
return VFR_RETURN_INVALID_PARAMETER;
|
||||
}
|
||||
if (CIfrForm::ChekFormIdFree (FormId) == FALSE) {
|
||||
if (CIfrFormId::ChekFormIdFree (FormId) == FALSE) {
|
||||
return VFR_RETURN_FORMID_REDEFINED;
|
||||
}
|
||||
mForm->FormId = FormId;
|
||||
CIfrForm::MarkFormIdUsed (FormId);
|
||||
CIfrFormId::MarkFormIdUsed (FormId);
|
||||
return VFR_RETURN_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -667,6 +672,44 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
class CIfrFormMap : public CIfrObj, public CIfrOpHeader {
|
||||
private:
|
||||
EFI_IFR_FORM_MAP *mFormMap;
|
||||
EFI_IFR_FORM_MAP_METHOD *mMethodMap;
|
||||
|
||||
public:
|
||||
CIfrFormMap () : CIfrObj (EFI_IFR_FORM_MAP_OP, (CHAR8 **)&mFormMap, sizeof (EFI_IFR_FORM_MAP), TRUE),
|
||||
CIfrOpHeader (EFI_IFR_FORM_MAP_OP, &mFormMap->Header) {
|
||||
mFormMap->FormId = 0;
|
||||
mMethodMap = (EFI_IFR_FORM_MAP_METHOD *) (mFormMap + 1);
|
||||
}
|
||||
|
||||
EFI_VFR_RETURN_CODE SetFormId (IN EFI_FORM_ID FormId) {
|
||||
if (FormId == 0) {
|
||||
//
|
||||
// FormId can't be 0.
|
||||
//
|
||||
return VFR_RETURN_INVALID_PARAMETER;
|
||||
}
|
||||
if (CIfrFormId::ChekFormIdFree (FormId) == FALSE) {
|
||||
return VFR_RETURN_FORMID_REDEFINED;
|
||||
}
|
||||
mFormMap->FormId = FormId;
|
||||
CIfrFormId::MarkFormIdUsed (FormId);
|
||||
return VFR_RETURN_SUCCESS;
|
||||
}
|
||||
|
||||
VOID SetFormMapMethod (IN EFI_STRING_ID MethodTitle, IN EFI_GUID *MethodGuid) {
|
||||
if (ExpendObjBin (sizeof (EFI_IFR_FORM_MAP_METHOD))) {
|
||||
IncLength (sizeof (EFI_IFR_FORM_MAP_METHOD));
|
||||
|
||||
mMethodMap->MethodTitle = MethodTitle;
|
||||
memcpy (&(mMethodMap->MethodIdentifier), MethodGuid, sizeof (EFI_GUID));
|
||||
mMethodMap ++;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
class CIfrVarStore : public CIfrObj, public CIfrOpHeader {
|
||||
private:
|
||||
EFI_IFR_VARSTORE *mVarStore;
|
||||
@@ -696,7 +739,7 @@ public:
|
||||
UINT8 Len;
|
||||
|
||||
if (Name != NULL) {
|
||||
Len = strlen (Name);
|
||||
Len = (UINT8) strlen (Name);
|
||||
if (Len != 0) {
|
||||
if (ExpendObjBin (Len) == TRUE) {
|
||||
IncLength (Len);
|
||||
@@ -832,6 +875,66 @@ public:
|
||||
|
||||
};
|
||||
|
||||
class CIfrRead : public CIfrObj, public CIfrOpHeader{
|
||||
private:
|
||||
EFI_IFR_READ *mRead;
|
||||
|
||||
public:
|
||||
CIfrRead () : CIfrObj (EFI_IFR_READ_OP, (CHAR8 **)&mRead),
|
||||
CIfrOpHeader (EFI_IFR_READ_OP, &mRead->Header) {}
|
||||
|
||||
};
|
||||
|
||||
class CIfrWrite : public CIfrObj, public CIfrOpHeader{
|
||||
private:
|
||||
EFI_IFR_WRITE *mWrite;
|
||||
|
||||
public:
|
||||
CIfrWrite () : CIfrObj (EFI_IFR_WRITE_OP, (CHAR8 **)&mWrite),
|
||||
CIfrOpHeader (EFI_IFR_WRITE_OP, &mWrite->Header) {}
|
||||
|
||||
};
|
||||
|
||||
class CIfrGet : public CIfrObj, public CIfrOpHeader{
|
||||
private:
|
||||
EFI_IFR_GET *mGet;
|
||||
|
||||
public:
|
||||
CIfrGet (
|
||||
IN UINT32 LineNo
|
||||
) : CIfrObj (EFI_IFR_GET_OP, (CHAR8 **)&mGet),
|
||||
CIfrOpHeader (EFI_IFR_GET_OP, &mGet->Header) {
|
||||
SetLineNo (LineNo);
|
||||
}
|
||||
|
||||
VOID SetVarInfo (IN EFI_VARSTORE_INFO *Info) {
|
||||
mGet->VarStoreId = Info->mVarStoreId;
|
||||
mGet->VarStoreInfo.VarName = Info->mInfo.mVarName;
|
||||
mGet->VarStoreInfo.VarOffset = Info->mInfo.mVarOffset;
|
||||
mGet->VarStoreType = Info->mVarType;
|
||||
}
|
||||
};
|
||||
|
||||
class CIfrSet : public CIfrObj, public CIfrOpHeader{
|
||||
private:
|
||||
EFI_IFR_SET *mSet;
|
||||
|
||||
public:
|
||||
CIfrSet (
|
||||
IN UINT32 LineNo
|
||||
) : CIfrObj (EFI_IFR_SET_OP, (CHAR8 **)&mSet),
|
||||
CIfrOpHeader (EFI_IFR_SET_OP, &mSet->Header) {
|
||||
SetLineNo (LineNo);
|
||||
}
|
||||
|
||||
VOID SetVarInfo (IN EFI_VARSTORE_INFO *Info) {
|
||||
mSet->VarStoreId = Info->mVarStoreId;
|
||||
mSet->VarStoreInfo.VarName = Info->mInfo.mVarName;
|
||||
mSet->VarStoreInfo.VarOffset = Info->mInfo.mVarOffset;
|
||||
mSet->VarStoreType = Info->mVarType;
|
||||
}
|
||||
};
|
||||
|
||||
class CIfrSubtitle : public CIfrObj, public CIfrOpHeader, public CIfrStatementHeader {
|
||||
private:
|
||||
EFI_IFR_SUBTITLE *mSubtitle;
|
||||
@@ -2310,6 +2413,19 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
class CIfrMap : public CIfrObj, public CIfrOpHeader{
|
||||
private:
|
||||
EFI_IFR_MAP *mMap;
|
||||
|
||||
public:
|
||||
CIfrMap (
|
||||
IN UINT32 LineNo
|
||||
) : CIfrObj (EFI_IFR_MAP_OP, (CHAR8 **)&mMap),
|
||||
CIfrOpHeader (EFI_IFR_MAP_OP, &mMap->Header) {
|
||||
SetLineNo (LineNo);
|
||||
}
|
||||
};
|
||||
|
||||
class CIfrMatch : public CIfrObj, public CIfrOpHeader {
|
||||
private:
|
||||
EFI_IFR_MATCH *mMatch;
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*++
|
||||
Copyright (c) 2004 - 2009, Intel Corporation
|
||||
Copyright (c) 2004 - 2010, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
@@ -131,6 +131,9 @@ VfrParserStart (
|
||||
#token EndList("endlist") "endlist"
|
||||
#token EndForm("endform") "endform"
|
||||
#token Form("form") "form"
|
||||
#token FormMap("formmap") "formmap"
|
||||
#token MapTitle("maptitle") "maptitle"
|
||||
#token MapGuid("mapguid") "mapguid"
|
||||
#token Subtitle("subtitle") "subtitle"
|
||||
#token Help("help") "help"
|
||||
#token Text("text") "text"
|
||||
@@ -214,6 +217,8 @@ VfrParserStart (
|
||||
#token Rule("rule") "rule"
|
||||
#token EndRule("endrule") "endrule"
|
||||
#token Value("value") "value"
|
||||
#token Read("read") "read"
|
||||
#token Write("write") "write"
|
||||
#token ResetButton("resetbutton") "resetbutton"
|
||||
#token EndResetButton("endresetbutton") "endresetbutton"
|
||||
#token DefaultStore("defaultstore") "defaultstore"
|
||||
@@ -250,7 +255,8 @@ VfrParserStart (
|
||||
|
||||
vfrProgram > [UINT8 Return] :
|
||||
<<
|
||||
mParserStatus = 0;
|
||||
mParserStatus = 0;
|
||||
mCIfrOpHdrIndex = 0;
|
||||
mConstantOnlyInExpression = FALSE;
|
||||
>>
|
||||
(
|
||||
@@ -335,82 +341,84 @@ vfrDataStructFields :
|
||||
|
||||
dataStructField64 :
|
||||
<< UINT32 ArrayNum = 0; >>
|
||||
"UINT64"
|
||||
D:"UINT64"
|
||||
N:StringIdentifier
|
||||
{
|
||||
OpenBracket I:Number CloseBracket << ArrayNum = _STOU32(I->getText()); >>
|
||||
}
|
||||
";" << _PCATCH(gCVfrVarDataTypeDB.DataTypeAddField (N->getText(), "UINT64", ArrayNum), N); >>
|
||||
";" << _PCATCH(gCVfrVarDataTypeDB.DataTypeAddField (N->getText(), D->getText(), ArrayNum), N); >>
|
||||
;
|
||||
|
||||
dataStructField32 :
|
||||
<< UINT32 ArrayNum = 0; >>
|
||||
"UINT32"
|
||||
D:"UINT32"
|
||||
N:StringIdentifier
|
||||
{
|
||||
OpenBracket I:Number CloseBracket << ArrayNum = _STOU32(I->getText()); >>
|
||||
}
|
||||
";" << _PCATCH(gCVfrVarDataTypeDB.DataTypeAddField (N->getText(), "UINT32", ArrayNum), N); >>
|
||||
";" << _PCATCH(gCVfrVarDataTypeDB.DataTypeAddField (N->getText(), D->getText(), ArrayNum), N); >>
|
||||
;
|
||||
|
||||
dataStructField16 :
|
||||
<< UINT32 ArrayNum = 0; >>
|
||||
<<
|
||||
UINT32 ArrayNum = 0;
|
||||
>>
|
||||
("UINT16" | "CHAR16")
|
||||
N:StringIdentifier
|
||||
{
|
||||
OpenBracket I:Number CloseBracket << ArrayNum = _STOU32(I->getText()); >>
|
||||
}
|
||||
";" << _PCATCH(gCVfrVarDataTypeDB.DataTypeAddField (N->getText(), "UINT16", ArrayNum), N); >>
|
||||
";" << _PCATCH(gCVfrVarDataTypeDB.DataTypeAddField (N->getText(), (CHAR8 *) "UINT16", ArrayNum), N); >>
|
||||
;
|
||||
|
||||
dataStructField8 :
|
||||
<< UINT32 ArrayNum = 0; >>
|
||||
"UINT8"
|
||||
D:"UINT8"
|
||||
N:StringIdentifier
|
||||
{
|
||||
OpenBracket I:Number CloseBracket << ArrayNum = _STOU32(I->getText()); >>
|
||||
}
|
||||
";" << _PCATCH(gCVfrVarDataTypeDB.DataTypeAddField (N->getText(), "UINT8", ArrayNum), N); >>
|
||||
";" << _PCATCH(gCVfrVarDataTypeDB.DataTypeAddField (N->getText(), D->getText(), ArrayNum), N); >>
|
||||
;
|
||||
|
||||
dataStructFieldBool :
|
||||
<< UINT32 ArrayNum = 0; >>
|
||||
"BOOLEAN"
|
||||
D:"BOOLEAN"
|
||||
N:StringIdentifier
|
||||
{
|
||||
OpenBracket I:Number CloseBracket << ArrayNum = _STOU32(I->getText()); >>
|
||||
}
|
||||
";" << _PCATCH(gCVfrVarDataTypeDB.DataTypeAddField (N->getText(), "BOOLEAN", ArrayNum), N); >>
|
||||
";" << _PCATCH(gCVfrVarDataTypeDB.DataTypeAddField (N->getText(), D->getText(), ArrayNum), N); >>
|
||||
;
|
||||
|
||||
dataStructFieldString :
|
||||
<< UINT32 ArrayNum = 0; >>
|
||||
"EFI_STRING_ID"
|
||||
D:"EFI_STRING_ID"
|
||||
N:StringIdentifier
|
||||
{
|
||||
OpenBracket I:Number CloseBracket << ArrayNum = _STOU32(I->getText()); >>
|
||||
}
|
||||
";" << _PCATCH(gCVfrVarDataTypeDB.DataTypeAddField (N->getText(), "EFI_STRING_ID", ArrayNum), N); >>
|
||||
";" << _PCATCH(gCVfrVarDataTypeDB.DataTypeAddField (N->getText(), D->getText(), ArrayNum), N); >>
|
||||
;
|
||||
|
||||
dataStructFieldDate :
|
||||
<< UINT32 ArrayNum = 0; >>
|
||||
"EFI_HII_DATE"
|
||||
D:"EFI_HII_DATE"
|
||||
N:StringIdentifier
|
||||
{
|
||||
OpenBracket I:Number CloseBracket << ArrayNum = _STOU32(I->getText()); >>
|
||||
}
|
||||
";" << _PCATCH(gCVfrVarDataTypeDB.DataTypeAddField (N->getText(), "EFI_HII_DATE", ArrayNum), N); >>
|
||||
";" << _PCATCH(gCVfrVarDataTypeDB.DataTypeAddField (N->getText(), D->getText(), ArrayNum), N); >>
|
||||
;
|
||||
|
||||
dataStructFieldTime :
|
||||
<< UINT32 ArrayNum = 0; >>
|
||||
"EFI_HII_TIME"
|
||||
D:"EFI_HII_TIME"
|
||||
N:StringIdentifier
|
||||
{
|
||||
OpenBracket I:Number CloseBracket << ArrayNum = _STOU32(I->getText()); >>
|
||||
}
|
||||
";" << _PCATCH(gCVfrVarDataTypeDB.DataTypeAddField (N->getText(), "EFI_HII_TIME", ArrayNum), N); >>
|
||||
";" << _PCATCH(gCVfrVarDataTypeDB.DataTypeAddField (N->getText(), D->getText(), ArrayNum), N); >>
|
||||
;
|
||||
|
||||
dataStructFieldUser :
|
||||
@@ -486,24 +494,26 @@ vfrFormSetDefinition :
|
||||
<<
|
||||
switch (ClassGuidNum) {
|
||||
case 0:
|
||||
FSObj = new CIfrFormSet(sizeof(EFI_IFR_FORM_SET));
|
||||
FSObj = new CIfrFormSet(sizeof(EFI_IFR_FORM_SET) + sizeof(EFI_GUID));
|
||||
FSObj->SetClassGuid(&DefaultClassGuid);
|
||||
break;
|
||||
case 1:
|
||||
FSObj = new CIfrFormSet(sizeof(EFI_IFR_FORM_SET));
|
||||
FSObj = new CIfrFormSet(sizeof(EFI_IFR_FORM_SET) + ClassGuidNum * sizeof(EFI_GUID));
|
||||
FSObj->SetClassGuid(&ClassGuid1);
|
||||
break;
|
||||
case 2:
|
||||
FSObj = new CIfrFormSet(sizeof(EFI_IFR_FORM_SET) + sizeof(EFI_GUID));
|
||||
FSObj = new CIfrFormSet(sizeof(EFI_IFR_FORM_SET) + ClassGuidNum * sizeof(EFI_GUID));
|
||||
FSObj->SetClassGuid(&ClassGuid1);
|
||||
FSObj->SetClassGuid(&ClassGuid2);
|
||||
break;
|
||||
default:
|
||||
FSObj = new CIfrFormSet(sizeof(EFI_IFR_FORM_SET) + 2 * sizeof(EFI_GUID));
|
||||
case 3:
|
||||
FSObj = new CIfrFormSet(sizeof(EFI_IFR_FORM_SET) + ClassGuidNum * sizeof(EFI_GUID));
|
||||
FSObj->SetClassGuid(&ClassGuid1);
|
||||
FSObj->SetClassGuid(&ClassGuid2);
|
||||
FSObj->SetClassGuid(&ClassGuid3);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
SET_LINE_INFO (*FSObj, L);
|
||||
@@ -542,6 +552,7 @@ vfrFormSetDefinition :
|
||||
vfrFormSetList :
|
||||
(
|
||||
vfrFormDefinition |
|
||||
vfrFormMapDefinition |
|
||||
vfrStatementImage |
|
||||
vfrStatementVarStoreLinear |
|
||||
vfrStatementVarStoreEfi |
|
||||
@@ -586,12 +597,13 @@ vfrStatementVarStoreLinear :
|
||||
V:Varstore << VSObj.SetLineNo(V->getLine()); >>
|
||||
(
|
||||
TN:StringIdentifier "," << TypeName = TN->getText(); LineNum = TN->getLine(); >>
|
||||
| U8:"UINT8" "," << TypeName = "UINT8"; LineNum = U8->getLine(); >>
|
||||
| U16:"UINT16" "," << TypeName = "UINT16"; LineNum = U16->getLine(); >>
|
||||
| U32:"UINT32" "," << TypeName = "UINT32"; LineNum = U32->getLine(); >>
|
||||
| U64:"UINT64" "," << TypeName = "UINT64"; LineNum = U64->getLine(); >>
|
||||
| D:"EFI_HII_DATE" "," << TypeName = "EFI_HII_DATE"; LineNum = D->getLine(); >>
|
||||
| T:"EFI_HII_TIME" "," << TypeName = "EFI_HII_TIME"; LineNum = T->getLine(); >>
|
||||
| U8:"UINT8" "," << TypeName = U8->getText(); LineNum = U8->getLine(); >>
|
||||
| U16:"UINT16" "," << TypeName = U16->getText(); LineNum = U16->getLine(); >>
|
||||
| C16:"CHAR16" "," << TypeName = (CHAR8 *) "UINT16"; LineNum = C16->getLine(); >>
|
||||
| U32:"UINT32" "," << TypeName = U32->getText(); LineNum = U32->getLine(); >>
|
||||
| U64:"UINT64" "," << TypeName = U64->getText(); LineNum = U64->getLine(); >>
|
||||
| D:"EFI_HII_DATE" "," << TypeName = D->getText(); LineNum = D->getLine(); >>
|
||||
| T:"EFI_HII_TIME" "," << TypeName = T->getText(); LineNum = T->getLine(); >>
|
||||
)
|
||||
{ Key "=" FID:Number "," << // Key is used to assign Varid in Framework VFR but no use in UEFI2.1 VFR
|
||||
if (mCompatibleMode) {
|
||||
@@ -628,7 +640,7 @@ vfrStatementVarStoreLinear :
|
||||
_PCATCH(mCVfrDataStorage.GetVarStoreId(StoreName, &VarStoreId), SN);
|
||||
VSObj.SetVarStoreId (VarStoreId);
|
||||
_PCATCH(gCVfrVarDataTypeDB.GetDataTypeSize(TypeName, &Size), LineNum);
|
||||
VSObj.SetSize (Size);
|
||||
VSObj.SetSize ((UINT16) Size);
|
||||
VSObj.SetName (SN->getText());
|
||||
>>
|
||||
";"
|
||||
@@ -771,11 +783,11 @@ vfrQuestionHeader[CIfrQuestionHeader & QHObj, EFI_QUESION_TYPE QType = QUESTION_
|
||||
mCVfrQuestionDB.RegisterQuestion (QName, VarIdStr, QId);
|
||||
break;
|
||||
case QUESTION_DATE:
|
||||
mCVfrQuestionDB.RegisterNewDateQuestion (QName, VarIdStr, QId);
|
||||
break;
|
||||
mCVfrQuestionDB.RegisterNewDateQuestion (QName, VarIdStr, QId);
|
||||
break;
|
||||
case QUESTION_TIME:
|
||||
mCVfrQuestionDB.RegisterNewTimeQuestion (QName, VarIdStr, QId);
|
||||
break;
|
||||
mCVfrQuestionDB.RegisterNewTimeQuestion (QName, VarIdStr, QId);
|
||||
break;
|
||||
default:
|
||||
_PCATCH(VFR_RETURN_FATAL_ERROR);
|
||||
}
|
||||
@@ -820,7 +832,7 @@ questionheaderFlagsField[UINT8 & Flags] :
|
||||
| LateCheckFlag
|
||||
;
|
||||
|
||||
vfrStorageVarId[EFI_VARSTORE_INFO & Info, CHAR8 *&QuestVarIdStr] :
|
||||
vfrStorageVarId[EFI_VARSTORE_INFO & Info, CHAR8 *&QuestVarIdStr, BOOLEAN CheckFlag = TRUE] :
|
||||
<<
|
||||
UINT32 Idx;
|
||||
UINT32 LineNo;
|
||||
@@ -853,9 +865,11 @@ vfrStorageVarId[EFI_VARSTORE_INFO & Info, CHAR8 *&QuestVarIdStr] :
|
||||
);
|
||||
VfrReturnCode = mCVfrDataStorage.GetVarStoreType (SName, VarStoreType);
|
||||
}
|
||||
_PCATCH(VfrReturnCode, SN1);
|
||||
_PCATCH(mCVfrDataStorage.GetVarStoreId (SName, &$Info.mVarStoreId), SN1);
|
||||
_PCATCH(mCVfrDataStorage.GetNameVarStoreInfo (&$Info, Idx), SN1);
|
||||
if (CheckFlag || VfrReturnCode == VFR_RETURN_SUCCESS) {
|
||||
_PCATCH(VfrReturnCode, SN1);
|
||||
_PCATCH(mCVfrDataStorage.GetVarStoreId (SName, &$Info.mVarStoreId), SN1);
|
||||
_PCATCH(mCVfrDataStorage.GetNameVarStoreInfo (&$Info, Idx), SN1);
|
||||
}
|
||||
>>
|
||||
)
|
||||
|
|
||||
@@ -874,17 +888,21 @@ vfrStorageVarId[EFI_VARSTORE_INFO & Info, CHAR8 *&QuestVarIdStr] :
|
||||
);
|
||||
VfrReturnCode = mCVfrDataStorage.GetVarStoreType (SName, VarStoreType);
|
||||
}
|
||||
_PCATCH(VfrReturnCode, SN2);
|
||||
_PCATCH(mCVfrDataStorage.GetVarStoreId (SName, &$Info.mVarStoreId), SN2);
|
||||
if (VarStoreType == EFI_VFR_VARSTORE_BUFFER) {
|
||||
_PCATCH(mCVfrDataStorage.GetBufferVarStoreDataTypeName(SName, &TName), SN2);
|
||||
_STRCAT(&VarStr, TName);
|
||||
if (CheckFlag || VfrReturnCode == VFR_RETURN_SUCCESS) {
|
||||
_PCATCH(VfrReturnCode, SN2);
|
||||
_PCATCH(mCVfrDataStorage.GetVarStoreId (SName, &$Info.mVarStoreId), SN2);
|
||||
if (VarStoreType == EFI_VFR_VARSTORE_BUFFER) {
|
||||
_PCATCH(mCVfrDataStorage.GetBufferVarStoreDataTypeName(SName, &TName), SN2);
|
||||
_STRCAT(&VarStr, TName);
|
||||
}
|
||||
}
|
||||
>>
|
||||
|
||||
(
|
||||
"." <<
|
||||
_PCATCH(((VarStoreType != EFI_VFR_VARSTORE_BUFFER) ? VFR_RETURN_EFIVARSTORE_USE_ERROR : VFR_RETURN_SUCCESS), SN2);
|
||||
if (CheckFlag || VfrReturnCode == VFR_RETURN_SUCCESS) {
|
||||
_PCATCH(((VarStoreType != EFI_VFR_VARSTORE_BUFFER) ? VFR_RETURN_EFIVARSTORE_USE_ERROR : VFR_RETURN_SUCCESS), SN2);
|
||||
}
|
||||
_STRCAT(&VarIdStr, "."); _STRCAT(&VarStr, ".");
|
||||
>>
|
||||
SF:StringIdentifier << _STRCAT(&VarIdStr, SF->getText()); _STRCAT(&VarStr, SF->getText()); >>
|
||||
@@ -1079,6 +1097,33 @@ vfrFormDefinition :
|
||||
";"
|
||||
;
|
||||
|
||||
vfrFormMapDefinition :
|
||||
<<
|
||||
CIfrFormMap *FMapObj = NULL;
|
||||
UINT32 FormMapMethodNumber = 0;
|
||||
EFI_GUID Guid;
|
||||
>>
|
||||
F:FormMap << FMapObj = new CIfrFormMap(); FMapObj->SetLineNo(F->getLine()); >>
|
||||
FormId "=" S1:Number "," << _PCATCH(FMapObj->SetFormId (_STOFID(S1->getText())), S1); >>
|
||||
(
|
||||
MapTitle "=" "STRING_TOKEN" "\(" S2:Number "\)" ";"
|
||||
MapGuid "=" guidDefinition[Guid] ";" << FMapObj->SetFormMapMethod (_STOFID(S2->getText()), &Guid); FormMapMethodNumber ++; >>
|
||||
)* << if (FormMapMethodNumber == 0) {_PCATCH (VFR_RETURN_INVALID_PARAMETER, F->getLine(), "No MapMethod is set for FormMap!");} delete FMapObj;>>
|
||||
(
|
||||
vfrStatementImage |
|
||||
vfrStatementLocked |
|
||||
vfrStatementRules |
|
||||
vfrStatementDefault |
|
||||
vfrStatementStat |
|
||||
vfrStatementQuestions |
|
||||
vfrStatementConditional |
|
||||
vfrStatementLabel |
|
||||
vfrStatementBanner
|
||||
)*
|
||||
E:EndForm << CRT_END_OP (E); >>
|
||||
";"
|
||||
;
|
||||
|
||||
vfrStatementRules :
|
||||
<< CIfrRule RObj; >>
|
||||
R:Rule << RObj.SetLineNo(R->getLine()); >>
|
||||
@@ -1194,6 +1239,18 @@ vfrStatementValue :
|
||||
"=" vfrStatementExpression[0] << {CIfrEnd EndObj; EndObj.SetLineNo(V->getLine());} >>
|
||||
;
|
||||
|
||||
vfrStatementRead :
|
||||
<< CIfrRead RObj; >>
|
||||
R:Read << RObj.SetLineNo(R->getLine()); >>
|
||||
vfrStatementExpression[0] ";"
|
||||
;
|
||||
|
||||
vfrStatementWrite :
|
||||
<< CIfrWrite WObj; >>
|
||||
W:Write << WObj.SetLineNo(W->getLine()); >>
|
||||
vfrStatementExpression[0] ";"
|
||||
;
|
||||
|
||||
vfrStatementSubTitle :
|
||||
<< CIfrSubtitle SObj; >>
|
||||
L:Subtitle << SObj.SetLineNo(L->getLine()); >>
|
||||
@@ -1268,8 +1325,8 @@ vfrStatementCrossReference :
|
||||
vfrStatementGoto :
|
||||
<<
|
||||
UINT8 RefType = 1;
|
||||
EFI_STRING_ID DevPath;
|
||||
EFI_GUID FSId;
|
||||
EFI_STRING_ID DevPath = EFI_STRING_ID_INVALID;
|
||||
EFI_GUID FSId = {0,};
|
||||
EFI_FORM_ID FId;
|
||||
EFI_QUESTION_ID QId = EFI_QUESTION_ID_INVALID;
|
||||
UINT32 BitMask;
|
||||
@@ -2046,6 +2103,8 @@ vfrStatementQuestionOptionTag :
|
||||
vfrStatementGrayOutIfQuest |
|
||||
vfrStatementValue |
|
||||
vfrStatementDefault |
|
||||
vfrStatementRead |
|
||||
vfrStatementWrite |
|
||||
vfrStatementOptions
|
||||
;
|
||||
|
||||
@@ -2479,6 +2538,7 @@ vfrStatementInvalidSaveRestoreDefaults :
|
||||
#token StringRef("stringref") "stringref"
|
||||
#token PushThis("pushthis") "pushthis"
|
||||
#token Security("security") "security"
|
||||
#token Get("get") "get"
|
||||
#token True("TRUE") "TRUE"
|
||||
#token False("FALSE") "FALSE"
|
||||
#token One("ONE") "ONE"
|
||||
@@ -2490,6 +2550,7 @@ vfrStatementInvalidSaveRestoreDefaults :
|
||||
#token AND("AND") "AND"
|
||||
#token OR("OR") "OR"
|
||||
#token NOT("NOT") "NOT"
|
||||
#token Set("set") "set"
|
||||
#token BitWiseNot("~") "\~"
|
||||
#token BoolVal("boolval") "boolval"
|
||||
#token StringVal("stringval") "stringval"
|
||||
@@ -2500,12 +2561,13 @@ vfrStatementInvalidSaveRestoreDefaults :
|
||||
#token Catenate("catenate") "catenate"
|
||||
#token QuestionRefVal("questionrefval") "questionrefval"
|
||||
#token StringRefVal("stringrefval") "stringrefval"
|
||||
#token Map("map") "map"
|
||||
|
||||
//
|
||||
// Root expression extension function called by other function.
|
||||
//
|
||||
vfrStatementExpression [UINT32 RootLevel, UINT32 ExpOpCount = 0] :
|
||||
<< if ($RootLevel == 0) {_CLEAR_SAVED_OPHDR ();} >>
|
||||
<< if ($RootLevel == 0) {mCIfrOpHdrIndex ++; if (mCIfrOpHdrIndex >= MAX_IFR_EXPRESSION_DEPTH) _PCATCH (VFR_RETURN_INVALID_PARAMETER, 0, "The depth of expression exceeds the max supported level 8!"); _CLEAR_SAVED_OPHDR ();} >>
|
||||
andTerm[$RootLevel, $ExpOpCount]
|
||||
(
|
||||
L:OR andTerm[$RootLevel, $ExpOpCount] << $ExpOpCount++; CIfrOr OObj(L->getLine()); >>
|
||||
@@ -2517,11 +2579,15 @@ vfrStatementExpression [UINT32 RootLevel, UINT32 ExpOpCount = 0] :
|
||||
if ($ExpOpCount > 1 && $RootLevel == 0) {
|
||||
if (_SET_SAVED_OPHDR_SCOPE()) {
|
||||
CIfrEnd EObj;
|
||||
if (mCIfrOpHdrLineNo != 0) {
|
||||
EObj.SetLineNo (mCIfrOpHdrLineNo);
|
||||
if (mCIfrOpHdrLineNo[mCIfrOpHdrIndex] != 0) {
|
||||
EObj.SetLineNo (mCIfrOpHdrLineNo[mCIfrOpHdrIndex]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($RootLevel == 0) {
|
||||
mCIfrOpHdrIndex --;
|
||||
}
|
||||
>>
|
||||
;
|
||||
|
||||
@@ -2664,6 +2730,7 @@ atomTerm [UINT32 & RootLevel, UINT32 & ExpOpCount]:
|
||||
| vfrExpressionConstant[$RootLevel, $ExpOpCount]
|
||||
| vfrExpressionUnaryOp[$RootLevel, $ExpOpCount]
|
||||
| vfrExpressionTernaryOp[$RootLevel, $ExpOpCount]
|
||||
| vfrExpressionMap[$RootLevel, $ExpOpCount]
|
||||
| (
|
||||
L:NOT
|
||||
atomTerm[$RootLevel, $ExpOpCount] << { CIfrNot NObj(L->getLine()); $ExpOpCount++; } >>
|
||||
@@ -2705,6 +2772,7 @@ vfrExpressionBuildInFunction [UINT32 & RootLevel, UINT32 & ExpOpCount] :
|
||||
| stringref1Exp[$RootLevel, $ExpOpCount]
|
||||
| pushthisExp[$RootLevel, $ExpOpCount]
|
||||
| securityExp[$RootLevel, $ExpOpCount]
|
||||
| getExp[$RootLevel, $ExpOpCount]
|
||||
;
|
||||
|
||||
dupExp [UINT32 & RootLevel, UINT32 & ExpOpCount] :
|
||||
@@ -2937,8 +3005,8 @@ ideqvallistExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
|
||||
questionref13Exp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
|
||||
<<
|
||||
UINT8 Type = 0x1;
|
||||
EFI_STRING_ID DevPath;
|
||||
EFI_GUID Guid;
|
||||
EFI_STRING_ID DevPath = EFI_STRING_ID_INVALID;
|
||||
EFI_GUID Guid = {0,};
|
||||
EFI_QUESTION_ID QId = EFI_QUESTION_ID_INVALID;
|
||||
UINT32 BitMask;
|
||||
CHAR8 *QName = NULL;
|
||||
@@ -2990,8 +3058,19 @@ rulerefExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
|
||||
// stringref (STR_FORM_SET_TITLE)
|
||||
//
|
||||
stringref1Exp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
|
||||
<<
|
||||
EFI_STRING_ID RefStringId = EFI_STRING_ID_INVALID;
|
||||
>>
|
||||
L:StringRef
|
||||
"\(" S:Number "\)" << { CIfrStringRef1 SR1Obj(L->getLine()); _SAVE_OPHDR_COND (SR1Obj, ($ExpOpCount == 0), L->getLine()); SR1Obj.SetStringId (_STOSID(S->getText())); $ExpOpCount++; } >>
|
||||
"\("
|
||||
(
|
||||
"STRING_TOKEN"
|
||||
"\("
|
||||
S:Number << RefStringId = _STOSID(S->getText()); >>
|
||||
"\)"
|
||||
| I:Number << RefStringId = _STOSID(I->getText()); >>
|
||||
)
|
||||
"\)" << { CIfrStringRef1 SR1Obj(L->getLine()); _SAVE_OPHDR_COND (SR1Obj, ($ExpOpCount == 0), L->getLine()); SR1Obj.SetStringId (RefStringId); $ExpOpCount++; } >>
|
||||
;
|
||||
|
||||
pushthisExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
|
||||
@@ -3006,6 +3085,84 @@ securityExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
|
||||
"\(" guidDefinition[Guid] "\)" << { CIfrSecurity SObj(L->getLine()); _SAVE_OPHDR_COND (SObj, ($ExpOpCount == 0), L->getLine()); SObj.SetPermissions (&Guid); } $ExpOpCount++; >>
|
||||
;
|
||||
|
||||
numericVarStoreType [UINT8 & VarType] :
|
||||
"NUMERIC_SIZE_1" << $VarType = EFI_IFR_NUMERIC_SIZE_1; >>
|
||||
| "NUMERIC_SIZE_2" << $VarType = EFI_IFR_NUMERIC_SIZE_2; >>
|
||||
| "NUMERIC_SIZE_4" << $VarType = EFI_IFR_NUMERIC_SIZE_4; >>
|
||||
| "NUMERIC_SIZE_8" << $VarType = EFI_IFR_NUMERIC_SIZE_8; >>
|
||||
;
|
||||
|
||||
getExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
|
||||
<<
|
||||
EFI_VARSTORE_INFO Info;
|
||||
CHAR8 *VarIdStr = NULL;
|
||||
EFI_QUESTION_ID QId = EFI_QUESTION_ID_INVALID;
|
||||
UINT32 Mask = 0;
|
||||
EFI_QUESION_TYPE QType = QUESTION_NORMAL;
|
||||
UINT8 VarType = EFI_IFR_TYPE_UNDEFINED;
|
||||
UINT32 VarSize = 0;
|
||||
Info.mVarStoreId = 0;
|
||||
>>
|
||||
L:Get
|
||||
"\("
|
||||
vfrStorageVarId[Info, VarIdStr, FALSE]
|
||||
{"\|" FLAGS "=" numericVarStoreType [VarType] }
|
||||
"\)" <<
|
||||
{
|
||||
if (Info.mVarStoreId == 0) {
|
||||
// support Date/Time question
|
||||
mCVfrQuestionDB.GetQuestionId (NULL, VarIdStr, QId, Mask, &QType);
|
||||
if (QId == EFI_QUESTION_ID_INVALID || Mask == 0 || QType == QUESTION_NORMAL) {
|
||||
_PCATCH(VFR_RETURN_UNSUPPORTED, L->getLine(), "Get/Set opcode can't get the enough varstore information");
|
||||
}
|
||||
if (QType == QUESTION_DATE) {
|
||||
Info.mVarType = EFI_IFR_TYPE_DATE;
|
||||
} else if (QType == QUESTION_TIME) {
|
||||
Info.mVarType = EFI_IFR_TYPE_TIME;
|
||||
}
|
||||
switch (Mask) {
|
||||
case DATE_YEAR_BITMASK:
|
||||
Info.mInfo.mVarOffset = 0;
|
||||
break;
|
||||
case DATE_DAY_BITMASK:
|
||||
Info.mInfo.mVarOffset = 3;
|
||||
break;
|
||||
case TIME_HOUR_BITMASK:
|
||||
Info.mInfo.mVarOffset = 0;
|
||||
break;
|
||||
case TIME_MINUTE_BITMASK:
|
||||
Info.mInfo.mVarOffset = 1;
|
||||
break;
|
||||
case TIME_SECOND_BITMASK:
|
||||
Info.mInfo.mVarOffset = 2;
|
||||
break;
|
||||
default:
|
||||
_PCATCH(VFR_RETURN_UNSUPPORTED, L->getLine(), "Get/Set opcode can't get the enough varstore information");
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
if ((mCVfrDataStorage.GetVarStoreType(Info.mVarStoreId) == EFI_VFR_VARSTORE_NAME) && (VarType == EFI_IFR_TYPE_UNDEFINED)) {
|
||||
_PCATCH(VFR_RETURN_UNSUPPORTED, L->getLine(), "Get/Set opcode don't support name string");
|
||||
}
|
||||
if (VarType != EFI_IFR_TYPE_UNDEFINED) {
|
||||
Info.mVarType = VarType;
|
||||
_PCATCH(gCVfrVarDataTypeDB.GetDataTypeSize (Info.mVarType, &VarSize), L->getLine(), "Get/Set opcode can't get var type size");
|
||||
Info.mVarTotalSize = VarSize;
|
||||
}
|
||||
_PCATCH(gCVfrVarDataTypeDB.GetDataTypeSize (Info.mVarType, &VarSize), L->getLine(), "Get/Set opcode can't get var type size");
|
||||
if (VarSize != Info.mVarTotalSize) {
|
||||
_PCATCH(VFR_RETURN_UNSUPPORTED, L->getLine(), "Get/Set opcode don't support data array");
|
||||
}
|
||||
}
|
||||
CIfrGet GObj(L->getLine());
|
||||
_SAVE_OPHDR_COND (GObj, ($ExpOpCount == 0), L->getLine());
|
||||
GObj.SetVarInfo (&Info);
|
||||
delete VarIdStr;
|
||||
$ExpOpCount++;
|
||||
}
|
||||
>>
|
||||
;
|
||||
|
||||
vfrExpressionConstant[UINT32 & RootLevel, UINT32 & ExpOpCount] :
|
||||
L1:True << CIfrTrue TObj(L1->getLine()); _SAVE_OPHDR_COND (TObj, ($ExpOpCount == 0), L1->getLine()); $ExpOpCount++; >>
|
||||
| L2:False << CIfrFalse FObj(L2->getLine()); _SAVE_OPHDR_COND (FObj, ($ExpOpCount == 0), L2->getLine()); $ExpOpCount++; >>
|
||||
@@ -3026,6 +3183,7 @@ vfrExpressionUnaryOp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
|
||||
| unintExp[$RootLevel, $ExpOpCount]
|
||||
| toupperExp[$RootLevel, $ExpOpCount]
|
||||
| tolwerExp[$RootLevel, $ExpOpCount]
|
||||
| setExp[$RootLevel, $ExpOpCount]
|
||||
;
|
||||
|
||||
lengthExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
|
||||
@@ -3086,6 +3244,78 @@ tolwerExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
|
||||
<< { CIfrToLower TLObj(L->getLine()); $ExpOpCount++; } >>
|
||||
;
|
||||
|
||||
setExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
|
||||
<<
|
||||
EFI_VARSTORE_INFO Info;
|
||||
CHAR8 *VarIdStr = NULL;
|
||||
EFI_QUESTION_ID QId = EFI_QUESTION_ID_INVALID;
|
||||
UINT32 Mask = 0;
|
||||
EFI_QUESION_TYPE QType = QUESTION_NORMAL;
|
||||
UINT8 VarType = EFI_IFR_TYPE_UNDEFINED;
|
||||
UINT32 VarSize = 0;
|
||||
Info.mVarStoreId = 0;
|
||||
>>
|
||||
L:Set
|
||||
"\("
|
||||
vfrStorageVarId[Info, VarIdStr, FALSE]
|
||||
{"\|" FLAG "=" numericVarStoreType [VarType] }
|
||||
"," vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]
|
||||
"\)"
|
||||
<<
|
||||
{
|
||||
if (Info.mVarStoreId == 0) {
|
||||
// support Date/Time question
|
||||
mCVfrQuestionDB.GetQuestionId (NULL, VarIdStr, QId, Mask, &QType);
|
||||
if (QId == EFI_QUESTION_ID_INVALID || Mask == 0 || QType == QUESTION_NORMAL) {
|
||||
_PCATCH(VFR_RETURN_UNSUPPORTED, L->getLine(), "Get/Set opcode can't get the enough varstore information");
|
||||
}
|
||||
if (QType == QUESTION_DATE) {
|
||||
Info.mVarType = EFI_IFR_TYPE_DATE;
|
||||
} else if (QType == QUESTION_TIME) {
|
||||
Info.mVarType = EFI_IFR_TYPE_TIME;
|
||||
}
|
||||
switch (Mask) {
|
||||
case DATE_YEAR_BITMASK:
|
||||
Info.mInfo.mVarOffset = 0;
|
||||
break;
|
||||
case DATE_DAY_BITMASK:
|
||||
Info.mInfo.mVarOffset = 3;
|
||||
break;
|
||||
case TIME_HOUR_BITMASK:
|
||||
Info.mInfo.mVarOffset = 0;
|
||||
break;
|
||||
case TIME_MINUTE_BITMASK:
|
||||
Info.mInfo.mVarOffset = 1;
|
||||
break;
|
||||
case TIME_SECOND_BITMASK:
|
||||
Info.mInfo.mVarOffset = 2;
|
||||
break;
|
||||
default:
|
||||
_PCATCH(VFR_RETURN_UNSUPPORTED, L->getLine(), "Get/Set opcode can't get the enough varstore information");
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
if ((mCVfrDataStorage.GetVarStoreType(Info.mVarStoreId) == EFI_VFR_VARSTORE_NAME) && (VarType == EFI_IFR_TYPE_UNDEFINED)) {
|
||||
_PCATCH(VFR_RETURN_UNSUPPORTED, L->getLine(), "Get/Set opcode don't support name string");
|
||||
}
|
||||
if (VarType != EFI_IFR_TYPE_UNDEFINED) {
|
||||
Info.mVarType = VarType;
|
||||
_PCATCH(gCVfrVarDataTypeDB.GetDataTypeSize (Info.mVarType, &VarSize), L->getLine(), "Get/Set opcode can't get var type size");
|
||||
Info.mVarTotalSize = VarSize;
|
||||
}
|
||||
_PCATCH(gCVfrVarDataTypeDB.GetDataTypeSize (Info.mVarType, &VarSize), L->getLine(), "Get/Set opcode can't get var type size");
|
||||
if (VarSize != Info.mVarTotalSize) {
|
||||
_PCATCH(VFR_RETURN_UNSUPPORTED, L->getLine(), "Get/Set opcode don't support data array");
|
||||
}
|
||||
}
|
||||
CIfrSet TSObj(L->getLine());
|
||||
TSObj.SetVarInfo (&Info);
|
||||
delete VarIdStr;
|
||||
$ExpOpCount++;
|
||||
}
|
||||
>>
|
||||
;
|
||||
|
||||
vfrExpressionTernaryOp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
|
||||
conditionalExp[$RootLevel, $ExpOpCount]
|
||||
| findExp[$RootLevel, $ExpOpCount]
|
||||
@@ -3161,6 +3391,20 @@ spanExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
|
||||
"\)" << { CIfrSpan SObj(S->getLine()); SObj.SetFlags(Flags); $ExpOpCount++; } >>
|
||||
;
|
||||
|
||||
vfrExpressionMap [UINT32 & RootLevel, UINT32 & ExpOpCount]:
|
||||
L:Map
|
||||
"\("
|
||||
vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]
|
||||
":" << { CIfrMap MObj(L->getLine()); } >>
|
||||
(
|
||||
vfrStatementExpression[0]
|
||||
","
|
||||
vfrStatementExpression[0]
|
||||
";"
|
||||
) *
|
||||
E:"\)" << { CIfrEnd EObj; EObj.SetLineNo(E->getLine()); $ExpOpCount++; } >>
|
||||
;
|
||||
|
||||
spanFlags [UINT8 & Flags] :
|
||||
N:Number << $Flags |= _STOU8(N->getText()); >>
|
||||
| "LAST_NON_MATCH" << $Flags |= 0x00; >>
|
||||
@@ -3185,8 +3429,9 @@ private:
|
||||
CVfrQuestionDB mCVfrQuestionDB;
|
||||
CVfrRulesDB mCVfrRulesDB;
|
||||
|
||||
CIfrOpHeader *mCIfrOpHdr;
|
||||
UINT32 mCIfrOpHdrLineNo;
|
||||
CIfrOpHeader * mCIfrOpHdr[MAX_IFR_EXPRESSION_DEPTH];
|
||||
UINT32 mCIfrOpHdrLineNo[MAX_IFR_EXPRESSION_DEPTH];
|
||||
UINT8 mCIfrOpHdrIndex;
|
||||
VOID _SAVE_OPHDR_COND (IN CIfrOpHeader &, IN BOOLEAN, UINT32 LineNo = 0);
|
||||
VOID _CLEAR_SAVED_OPHDR (VOID);
|
||||
BOOLEAN _SET_SAVED_OPHDR_SCOPE (VOID);
|
||||
@@ -3210,11 +3455,11 @@ private:
|
||||
UINT32 _GET_CURRQEST_ARRAY_SIZE();
|
||||
|
||||
public:
|
||||
VOID _PCATCH (IN INTN, IN INTN, IN ANTLRTokenPtr, IN CHAR8 *);
|
||||
VOID _PCATCH (IN INTN, IN INTN, IN ANTLRTokenPtr, IN CONST CHAR8 *);
|
||||
VOID _PCATCH (IN EFI_VFR_RETURN_CODE);
|
||||
VOID _PCATCH (IN EFI_VFR_RETURN_CODE, IN ANTLRTokenPtr);
|
||||
VOID _PCATCH (IN EFI_VFR_RETURN_CODE, IN UINT32);
|
||||
VOID _PCATCH (IN EFI_VFR_RETURN_CODE, IN UINT32, IN CHAR8 *);
|
||||
VOID _PCATCH (IN EFI_VFR_RETURN_CODE, IN UINT32, IN CONST CHAR8 *);
|
||||
|
||||
VOID syn (ANTLRAbstractToken *, ANTLRChar *, SetWordType *, ANTLRTokenType, INT32);
|
||||
|
||||
@@ -3231,7 +3476,7 @@ public:
|
||||
EFI_FORM_ID _STOFID (IN CHAR8 *);
|
||||
EFI_QUESTION_ID _STOQID (IN CHAR8 *);
|
||||
|
||||
VOID _STRCAT (IN OUT CHAR8 **, IN CHAR8 *);
|
||||
VOID _STRCAT (IN OUT CHAR8 **, IN CONST CHAR8 *);
|
||||
|
||||
VOID _DeclareDefaultLinearVarStore (IN UINT32);
|
||||
VOID _DeclareStandardDefaultStorage (IN UINT32);
|
||||
@@ -3259,11 +3504,11 @@ EfiVfrParser::_SAVE_OPHDR_COND (
|
||||
)
|
||||
{
|
||||
if (Cond == TRUE) {
|
||||
if (mCIfrOpHdr != NULL) {
|
||||
if (mCIfrOpHdr[mCIfrOpHdrIndex] != NULL) {
|
||||
return ;
|
||||
}
|
||||
mCIfrOpHdr = new CIfrOpHeader(OpHdr);
|
||||
mCIfrOpHdrLineNo = LineNo;
|
||||
mCIfrOpHdr[mCIfrOpHdrIndex] = new CIfrOpHeader(OpHdr);
|
||||
mCIfrOpHdrLineNo[mCIfrOpHdrIndex] = LineNo;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3272,8 +3517,8 @@ EfiVfrParser::_CLEAR_SAVED_OPHDR (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
mCIfrOpHdr = NULL;
|
||||
mCIfrOpHdrLineNo = 0;
|
||||
mCIfrOpHdr[mCIfrOpHdrIndex] = NULL;
|
||||
mCIfrOpHdrLineNo[mCIfrOpHdrIndex] = 0;
|
||||
}
|
||||
|
||||
BOOLEAN
|
||||
@@ -3281,10 +3526,11 @@ EfiVfrParser::_SET_SAVED_OPHDR_SCOPE (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
if (mCIfrOpHdr != NULL) {
|
||||
mCIfrOpHdr->SetScope (1);
|
||||
if (mCIfrOpHdr[mCIfrOpHdrIndex] != NULL) {
|
||||
mCIfrOpHdr[mCIfrOpHdrIndex]->SetScope (1);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
//
|
||||
// IfrOpHdr is not set, FALSE is return.
|
||||
//
|
||||
@@ -3367,7 +3613,7 @@ EfiVfrParser::_PCATCH (
|
||||
IN INTN ReturnCode,
|
||||
IN INTN ExpectCode,
|
||||
IN ANTLRTokenPtr Tok,
|
||||
IN CHAR8 *ErrorMsg
|
||||
IN CONST CHAR8 *ErrorMsg
|
||||
)
|
||||
{
|
||||
if (ReturnCode != ExpectCode) {
|
||||
@@ -3381,7 +3627,7 @@ EfiVfrParser::_PCATCH (
|
||||
IN EFI_VFR_RETURN_CODE ReturnCode
|
||||
)
|
||||
{
|
||||
mParserStatus += gCVfrErrorHandle.HandleError (ReturnCode);
|
||||
mParserStatus = mParserStatus + gCVfrErrorHandle.HandleError (ReturnCode);
|
||||
}
|
||||
|
||||
VOID
|
||||
@@ -3390,7 +3636,7 @@ EfiVfrParser::_PCATCH (
|
||||
IN ANTLRTokenPtr Tok
|
||||
)
|
||||
{
|
||||
mParserStatus += gCVfrErrorHandle.HandleError (ReturnCode, Tok->getLine(), Tok->getText());
|
||||
mParserStatus = mParserStatus + gCVfrErrorHandle.HandleError (ReturnCode, Tok->getLine(), Tok->getText());
|
||||
}
|
||||
|
||||
VOID
|
||||
@@ -3399,17 +3645,17 @@ EfiVfrParser::_PCATCH (
|
||||
IN UINT32 LineNum
|
||||
)
|
||||
{
|
||||
mParserStatus += gCVfrErrorHandle.HandleError (ReturnCode, LineNum);
|
||||
mParserStatus = mParserStatus + gCVfrErrorHandle.HandleError (ReturnCode, LineNum);
|
||||
}
|
||||
|
||||
VOID
|
||||
EfiVfrParser::_PCATCH (
|
||||
IN EFI_VFR_RETURN_CODE ReturnCode,
|
||||
IN UINT32 LineNum,
|
||||
IN CHAR8 *ErrorMsg
|
||||
IN CONST CHAR8 *ErrorMsg
|
||||
)
|
||||
{
|
||||
mParserStatus += gCVfrErrorHandle.HandleError (ReturnCode, LineNum, ErrorMsg);
|
||||
mParserStatus = mParserStatus + gCVfrErrorHandle.HandleError (ReturnCode, LineNum, (CHAR8 *) ErrorMsg);
|
||||
}
|
||||
|
||||
VOID
|
||||
@@ -3638,7 +3884,7 @@ EfiVfrParser::_STOQID (
|
||||
VOID
|
||||
EfiVfrParser::_STRCAT (
|
||||
IN OUT CHAR8 **Dest,
|
||||
IN CHAR8 *Src
|
||||
IN CONST CHAR8 *Src
|
||||
)
|
||||
{
|
||||
CHAR8 *NewStr;
|
||||
@@ -3674,6 +3920,7 @@ EfiVfrParser::_DeclareDefaultFrameworkVarStore (
|
||||
SVfrVarStorageNode *pNode;
|
||||
UINT32 TypeSize;
|
||||
BOOLEAN FirstNode;
|
||||
CONST CHAR8 VarName[] = "Setup";
|
||||
|
||||
FirstNode = TRUE;
|
||||
pNode = mCVfrDataStorage.GetBufferVarStoreList();
|
||||
@@ -3686,9 +3933,9 @@ EfiVfrParser::_DeclareDefaultFrameworkVarStore (
|
||||
CIfrVarStore VSObj;
|
||||
VSObj.SetLineNo (LineNo);
|
||||
VSObj.SetVarStoreId (0x1); //the first and only one Buffer Var Store
|
||||
VSObj.SetSize (TypeSize);
|
||||
VSObj.SetSize ((UINT16) TypeSize);
|
||||
//VSObj.SetName (gCVfrVarDataTypeDB.mFirstNewDataTypeName);
|
||||
VSObj.SetName ("Setup");
|
||||
VSObj.SetName ((CHAR8 *) VarName);
|
||||
VSObj.SetGuid (&mFormsetGuid);
|
||||
#ifdef VFREXP_DEBUG
|
||||
printf ("Create the default VarStoreName is %s\n", gCVfrVarDataTypeDB.mFirstNewDataTypeName);
|
||||
@@ -3703,9 +3950,9 @@ EfiVfrParser::_DeclareDefaultFrameworkVarStore (
|
||||
CIfrVarStore VSObj;
|
||||
VSObj.SetLineNo (LineNo);
|
||||
VSObj.SetVarStoreId (pNode->mVarStoreId);
|
||||
VSObj.SetSize (pNode->mStorageInfo.mDataType->mTotalSize);
|
||||
VSObj.SetSize ((UINT16) pNode->mStorageInfo.mDataType->mTotalSize);
|
||||
if (FirstNode) {
|
||||
VSObj.SetName ("Setup");
|
||||
VSObj.SetName ((CHAR8 *) VarName);
|
||||
FirstNode = FALSE;
|
||||
} else {
|
||||
VSObj.SetName (pNode->mVarStoreName);
|
||||
@@ -3745,6 +3992,10 @@ EfiVfrParser::_DeclareDefaultLinearVarStore (
|
||||
UINT32 Index;
|
||||
CHAR8 **TypeNameList;
|
||||
UINT32 ListSize;
|
||||
CONST CHAR8 DateName[] = "Date";
|
||||
CONST CHAR8 TimeName[] = "Time";
|
||||
CONST CHAR8 DateType[] = "EFI_HII_DATE";
|
||||
CONST CHAR8 TimeType[] = "EFI_HII_TIME";
|
||||
|
||||
gCVfrVarDataTypeDB.GetUserDefinedTypeNameList (&TypeNameList, &ListSize);
|
||||
|
||||
@@ -3764,7 +4015,7 @@ EfiVfrParser::_DeclareDefaultLinearVarStore (
|
||||
mCVfrDataStorage.GetVarStoreId(TypeNameList[Index], &VarStoreId);
|
||||
VSObj.SetVarStoreId (VarStoreId);
|
||||
gCVfrVarDataTypeDB.GetDataTypeSize(TypeNameList[Index], &Size);
|
||||
VSObj.SetSize (Size);
|
||||
VSObj.SetSize ((UINT16) Size);
|
||||
VSObj.SetName (TypeNameList[Index]);
|
||||
VSObj.SetGuid (&mFormsetGuid);
|
||||
}
|
||||
@@ -3773,45 +4024,45 @@ EfiVfrParser::_DeclareDefaultLinearVarStore (
|
||||
// not required to declare Date and Time VarStore,
|
||||
// because code to support old format Data and Time
|
||||
//
|
||||
if (gCVfrVarDataTypeDB.IsTypeNameDefined ("Date") == FALSE) {
|
||||
if (gCVfrVarDataTypeDB.IsTypeNameDefined ((CHAR8 *) DateName) == FALSE) {
|
||||
UINT32 Size;
|
||||
EFI_VARSTORE_ID VarStoreId;
|
||||
CIfrVarStore VSObj;
|
||||
|
||||
VSObj.SetLineNo (LineNo);
|
||||
mCVfrDataStorage.DeclareBufferVarStore (
|
||||
"Date",
|
||||
(CHAR8 *) DateName,
|
||||
&mFormsetGuid,
|
||||
&gCVfrVarDataTypeDB,
|
||||
"EFI_HII_DATE",
|
||||
(CHAR8 *) DateType,
|
||||
EFI_VARSTORE_ID_INVALID
|
||||
);
|
||||
mCVfrDataStorage.GetVarStoreId("Date", &VarStoreId);
|
||||
mCVfrDataStorage.GetVarStoreId((CHAR8 *) DateName, &VarStoreId);
|
||||
VSObj.SetVarStoreId (VarStoreId);
|
||||
gCVfrVarDataTypeDB.GetDataTypeSize("EFI_HII_DATE", &Size);
|
||||
VSObj.SetSize (Size);
|
||||
VSObj.SetName ("Date");
|
||||
gCVfrVarDataTypeDB.GetDataTypeSize((CHAR8 *) DateType, &Size);
|
||||
VSObj.SetSize ((UINT16) Size);
|
||||
VSObj.SetName ((CHAR8 *) DateName);
|
||||
VSObj.SetGuid (&mFormsetGuid);
|
||||
}
|
||||
|
||||
if (gCVfrVarDataTypeDB.IsTypeNameDefined ("Time") == FALSE) {
|
||||
if (gCVfrVarDataTypeDB.IsTypeNameDefined ((CHAR8 *) TimeName) == FALSE) {
|
||||
UINT32 Size;
|
||||
EFI_VARSTORE_ID VarStoreId;
|
||||
CIfrVarStore VSObj;
|
||||
|
||||
VSObj.SetLineNo (LineNo);
|
||||
mCVfrDataStorage.DeclareBufferVarStore (
|
||||
"Time",
|
||||
(CHAR8 *) TimeName,
|
||||
&mFormsetGuid,
|
||||
&gCVfrVarDataTypeDB,
|
||||
"EFI_HII_TIME",
|
||||
(CHAR8 *) TimeType,
|
||||
EFI_VARSTORE_ID_INVALID
|
||||
);
|
||||
mCVfrDataStorage.GetVarStoreId("Time", &VarStoreId);
|
||||
mCVfrDataStorage.GetVarStoreId((CHAR8 *) TimeName, &VarStoreId);
|
||||
VSObj.SetVarStoreId (VarStoreId);
|
||||
gCVfrVarDataTypeDB.GetDataTypeSize("EFI_HII_TIME", &Size);
|
||||
VSObj.SetSize (Size);
|
||||
VSObj.SetName ("Time");
|
||||
gCVfrVarDataTypeDB.GetDataTypeSize((CHAR8 *) TimeType, &Size);
|
||||
VSObj.SetSize ((UINT16) Size);
|
||||
VSObj.SetName ((CHAR8 *) TimeName);
|
||||
VSObj.SetGuid (&mFormsetGuid);
|
||||
}
|
||||
}
|
||||
@@ -3826,7 +4077,7 @@ EfiVfrParser::_DeclareStandardDefaultStorage (
|
||||
//
|
||||
CIfrDefaultStore DSObj;
|
||||
|
||||
mCVfrDefaultStore.RegisterDefaultStore (DSObj.GetObjBinAddr(), "Standard Defaults", EFI_STRING_ID_INVALID, EFI_HII_DEFAULT_CLASS_STANDARD);
|
||||
mCVfrDefaultStore.RegisterDefaultStore (DSObj.GetObjBinAddr(), (CHAR8 *) "Standard Defaults", EFI_STRING_ID_INVALID, EFI_HII_DEFAULT_CLASS_STANDARD);
|
||||
DSObj.SetLineNo (LineNo);
|
||||
DSObj.SetDefaultName (EFI_STRING_ID_INVALID);
|
||||
DSObj.SetDefaultId (EFI_HII_DEFAULT_CLASS_STANDARD);
|
||||
@@ -3836,7 +4087,7 @@ EfiVfrParser::_DeclareStandardDefaultStorage (
|
||||
//
|
||||
CIfrDefaultStore DSObjMF;
|
||||
|
||||
mCVfrDefaultStore.RegisterDefaultStore (DSObjMF.GetObjBinAddr(), "Standard ManuFacturing", EFI_STRING_ID_INVALID, EFI_HII_DEFAULT_CLASS_MANUFACTURING);
|
||||
mCVfrDefaultStore.RegisterDefaultStore (DSObjMF.GetObjBinAddr(), (CHAR8 *) "Standard ManuFacturing", EFI_STRING_ID_INVALID, EFI_HII_DEFAULT_CLASS_MANUFACTURING);
|
||||
DSObjMF.SetLineNo (LineNo);
|
||||
DSObjMF.SetDefaultName (EFI_STRING_ID_INVALID);
|
||||
DSObjMF.SetDefaultId (EFI_HII_DEFAULT_CLASS_MANUFACTURING);
|
||||
|
@@ -20,11 +20,11 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
VOID
|
||||
CVfrBinaryOutput::WriteLine (
|
||||
IN FILE *pFile,
|
||||
IN UINT32 LineBytes,
|
||||
IN CHAR8 *LineHeader,
|
||||
IN CHAR8 *BlkBuf,
|
||||
IN UINT32 BlkSize
|
||||
IN FILE *pFile,
|
||||
IN UINT32 LineBytes,
|
||||
IN CONST CHAR8 *LineHeader,
|
||||
IN CHAR8 *BlkBuf,
|
||||
IN UINT32 BlkSize
|
||||
)
|
||||
{
|
||||
UINT32 Index;
|
||||
@@ -43,11 +43,11 @@ CVfrBinaryOutput::WriteLine (
|
||||
|
||||
VOID
|
||||
CVfrBinaryOutput::WriteEnd (
|
||||
IN FILE *pFile,
|
||||
IN UINT32 LineBytes,
|
||||
IN CHAR8 *LineHeader,
|
||||
IN CHAR8 *BlkBuf,
|
||||
IN UINT32 BlkSize
|
||||
IN FILE *pFile,
|
||||
IN UINT32 LineBytes,
|
||||
IN CONST CHAR8 *LineHeader,
|
||||
IN CHAR8 *BlkBuf,
|
||||
IN UINT32 BlkSize
|
||||
)
|
||||
{
|
||||
UINT32 Index;
|
||||
@@ -287,7 +287,7 @@ CVfrBufferConfig::Write (
|
||||
switch (Mode) {
|
||||
case 'a' : // add
|
||||
if (Select (Name, Id) != 0) {
|
||||
if ((pItem = new SConfigItem (Name, Id, Type, Offset, Width, Value)) == NULL) {
|
||||
if ((pItem = new SConfigItem (Name, Id, Type, Offset, (UINT16) Width, Value)) == NULL) {
|
||||
return 2;
|
||||
}
|
||||
if (mItemListHead == NULL) {
|
||||
@@ -455,7 +455,7 @@ CVfrBufferConfig::~CVfrBufferConfig (
|
||||
CVfrBufferConfig gCVfrBufferConfig;
|
||||
|
||||
static struct {
|
||||
CHAR8 *mTypeName;
|
||||
CONST CHAR8 *mTypeName;
|
||||
UINT8 mType;
|
||||
UINT32 mSize;
|
||||
UINT32 mAlign;
|
||||
@@ -744,20 +744,20 @@ CVfrVarDataTypeDB::InternalTypesListInit (
|
||||
SVfrDataField *pDayField = new SVfrDataField;
|
||||
|
||||
strcpy (pYearField->mFieldName, "Year");
|
||||
GetDataType ("UINT8", &pYearField->mFieldType);
|
||||
GetDataType ((CHAR8 *)"UINT16", &pYearField->mFieldType);
|
||||
pYearField->mOffset = 0;
|
||||
pYearField->mNext = pMonthField;
|
||||
pYearField->mArrayNum = 0;
|
||||
|
||||
strcpy (pMonthField->mFieldName, "Month");
|
||||
GetDataType ("UINT8", &pMonthField->mFieldType);
|
||||
pMonthField->mOffset = 1;
|
||||
GetDataType ((CHAR8 *)"UINT8", &pMonthField->mFieldType);
|
||||
pMonthField->mOffset = 2;
|
||||
pMonthField->mNext = pDayField;
|
||||
pMonthField->mArrayNum = 0;
|
||||
|
||||
strcpy (pDayField->mFieldName, "Day");
|
||||
GetDataType ("UINT8", &pDayField->mFieldType);
|
||||
pDayField->mOffset = 2;
|
||||
GetDataType ((CHAR8 *)"UINT8", &pDayField->mFieldType);
|
||||
pDayField->mOffset = 3;
|
||||
pDayField->mNext = NULL;
|
||||
pDayField->mArrayNum = 0;
|
||||
|
||||
@@ -768,19 +768,19 @@ CVfrVarDataTypeDB::InternalTypesListInit (
|
||||
SVfrDataField *pSecondsField = new SVfrDataField;
|
||||
|
||||
strcpy (pHoursField->mFieldName, "Hours");
|
||||
GetDataType ("UINT8", &pHoursField->mFieldType);
|
||||
GetDataType ((CHAR8 *)"UINT8", &pHoursField->mFieldType);
|
||||
pHoursField->mOffset = 0;
|
||||
pHoursField->mNext = pMinutesField;
|
||||
pHoursField->mArrayNum = 0;
|
||||
|
||||
strcpy (pMinutesField->mFieldName, "Minutes");
|
||||
GetDataType ("UINT8", &pMinutesField->mFieldType);
|
||||
GetDataType ((CHAR8 *)"UINT8", &pMinutesField->mFieldType);
|
||||
pMinutesField->mOffset = 1;
|
||||
pMinutesField->mNext = pSecondsField;
|
||||
pMinutesField->mArrayNum = 0;
|
||||
|
||||
strcpy (pSecondsField->mFieldName, "Seconds");
|
||||
GetDataType ("UINT8", &pSecondsField->mFieldType);
|
||||
GetDataType ((CHAR8 *)"UINT8", &pSecondsField->mFieldType);
|
||||
pSecondsField->mOffset = 2;
|
||||
pSecondsField->mNext = NULL;
|
||||
pSecondsField->mArrayNum = 0;
|
||||
@@ -853,7 +853,7 @@ CVfrVarDataTypeDB::Pack (
|
||||
|
||||
if (Action & VFR_PACK_SHOW) {
|
||||
sprintf (Msg, "value of pragma pack(show) == %d", mPackAlign);
|
||||
gCVfrErrorHandle.PrintMsg (LineNum, "", "Warning", Msg);
|
||||
gCVfrErrorHandle.PrintMsg (LineNum, NULL, "Warning", Msg);
|
||||
}
|
||||
|
||||
if (Action & VFR_PACK_PUSH) {
|
||||
@@ -870,7 +870,7 @@ CVfrVarDataTypeDB::Pack (
|
||||
SVfrPackStackNode *pNode = NULL;
|
||||
|
||||
if (mPackStack == NULL) {
|
||||
gCVfrErrorHandle.PrintMsg (LineNum, "", "Error", "#pragma pack(pop...) : more pops than pushes");
|
||||
gCVfrErrorHandle.PrintMsg (LineNum, NULL, "Error", "#pragma pack(pop...) : more pops than pushes");
|
||||
}
|
||||
|
||||
for (pNode = mPackStack; pNode != NULL; pNode = pNode->mNext) {
|
||||
@@ -884,7 +884,7 @@ CVfrVarDataTypeDB::Pack (
|
||||
if (Action & VFR_PACK_ASSIGN) {
|
||||
PackAlign = (Number > 1) ? Number + Number % 2 : Number;
|
||||
if ((PackAlign == 0) || (PackAlign > 16)) {
|
||||
gCVfrErrorHandle.PrintMsg (LineNum, "", "Error", "expected pragma parameter to be '1', '2', '4', '8', or '16'");
|
||||
gCVfrErrorHandle.PrintMsg (LineNum, NULL, "Error", "expected pragma parameter to be '1', '2', '4', '8', or '16'");
|
||||
} else {
|
||||
mPackAlign = PackAlign;
|
||||
}
|
||||
@@ -1127,7 +1127,7 @@ CVfrVarDataTypeDB::GetDataFieldInfo (
|
||||
CHECK_ERROR_RETURN(GetTypeField (FName, pType, pField), VFR_RETURN_SUCCESS);
|
||||
pType = pField->mFieldType;
|
||||
CHECK_ERROR_RETURN(GetFieldOffset (pField, ArrayIdx, Tmp), VFR_RETURN_SUCCESS);
|
||||
Offset += Tmp;
|
||||
Offset = (UINT16) (Offset + Tmp);
|
||||
Type = GetFieldWidth (pField);
|
||||
Size = GetFieldSize (pField, ArrayIdx);
|
||||
}
|
||||
@@ -1386,6 +1386,7 @@ CVfrDataStorage::GetFreeVarStoreId (
|
||||
//
|
||||
// Assign the different ID range for the different type VarStore to support Framework Vfr
|
||||
//
|
||||
Index = 0;
|
||||
if ((!VfrCompatibleMode) || (VarType == EFI_VFR_VARSTORE_BUFFER)) {
|
||||
Index = 0;
|
||||
} else if (VarType == EFI_VFR_VARSTORE_EFI) {
|
||||
@@ -1838,13 +1839,11 @@ CVfrDataStorage::BufferVarStoreRequestElementAdd (
|
||||
IN EFI_VARSTORE_INFO &Info
|
||||
)
|
||||
{
|
||||
CHAR8 NewReqElt[128] = {'\0',};
|
||||
CHAR8 *OldReqElt = NULL;
|
||||
SVfrVarStorageNode *pNode = NULL;
|
||||
EFI_IFR_TYPE_VALUE Value = gZeroEfiIfrTypeValue;
|
||||
|
||||
for (pNode = mBufferVarStoreList; pNode != NULL; pNode = pNode->mNext) {
|
||||
if (strcmp (pNode->mVarStoreName, StoreName) == NULL) {
|
||||
if (strcmp (pNode->mVarStoreName, StoreName) == 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -2024,85 +2023,6 @@ CVfrDefaultStore::GetDefaultId (
|
||||
return VFR_RETURN_UNDEFINED;
|
||||
}
|
||||
|
||||
STATIC
|
||||
EFI_VFR_RETURN_CODE
|
||||
AltCfgItemPrintToBuffer (
|
||||
IN CHAR8 *NewAltCfg,
|
||||
IN EFI_VARSTORE_INFO Info,
|
||||
IN UINT8 Type,
|
||||
IN EFI_IFR_TYPE_VALUE Value
|
||||
)
|
||||
{
|
||||
UINT32 Index;
|
||||
UINT8 *BufChar = NULL;
|
||||
UINT32 Count = 0;
|
||||
|
||||
if (NewAltCfg != NULL) {
|
||||
Count = sprintf (
|
||||
NewAltCfg,
|
||||
"&OFFSET=%x&WIDTH=%x&VALUE=",
|
||||
Info.mInfo.mVarOffset,
|
||||
Info.mVarTotalSize
|
||||
);
|
||||
NewAltCfg += Count;
|
||||
|
||||
switch (Type) {
|
||||
case EFI_IFR_TYPE_NUM_SIZE_8 :
|
||||
Count = sprintf (NewAltCfg, "%x", Value.u8);
|
||||
NewAltCfg += Count;
|
||||
break;
|
||||
case EFI_IFR_TYPE_NUM_SIZE_16 :
|
||||
Count = sprintf (NewAltCfg, "%x", Value.u16);
|
||||
NewAltCfg += Count;
|
||||
break;
|
||||
case EFI_IFR_TYPE_NUM_SIZE_32 :
|
||||
Count = sprintf (NewAltCfg, "%x", Value.u32);
|
||||
NewAltCfg += Count;
|
||||
break;
|
||||
case EFI_IFR_TYPE_NUM_SIZE_64 :
|
||||
Count = sprintf (NewAltCfg, "%x", Value.u64);
|
||||
NewAltCfg += Count;
|
||||
break;
|
||||
case EFI_IFR_TYPE_BOOLEAN :
|
||||
Count = sprintf (NewAltCfg, "%x", Value.b);
|
||||
NewAltCfg += Count;
|
||||
break;
|
||||
case EFI_IFR_TYPE_TIME :
|
||||
#if 1
|
||||
Count = sprintf (NewAltCfg, "%x", *((UINT32 *)(&Value.time)));
|
||||
NewAltCfg += Count;
|
||||
#else
|
||||
BufChar = (UINT8 *)&Value.time;
|
||||
for (Index = 0; Index < sizeof(EFI_HII_TIME); Index++) {
|
||||
Count = sprintf (NewAltCfg, "%02x", (UINT8)BufChar[Index]);
|
||||
NewAltCfg += Count;
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
case EFI_IFR_TYPE_DATE :
|
||||
#if 1
|
||||
Count = sprintf (NewAltCfg, "%x", *((UINT32 *)(&Value.date)));
|
||||
NewAltCfg += Count;
|
||||
#else
|
||||
BufChar = (UINT8 *)&Value.date;
|
||||
for (Index = 0; Index < sizeof(EFI_HII_DATE); Index++) {
|
||||
Count = sprintf (NewAltCfg, "%02x", (UINT8)BufChar[Index]);
|
||||
NewAltCfg += Count;
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
case EFI_IFR_TYPE_STRING :
|
||||
Count = sprintf (NewAltCfg, "%x", Value.string);
|
||||
NewAltCfg += Count;
|
||||
break;
|
||||
case EFI_IFR_TYPE_OTHER :
|
||||
return VFR_RETURN_UNSUPPORTED;
|
||||
}
|
||||
}
|
||||
|
||||
return VFR_RETURN_FATAL_ERROR;
|
||||
}
|
||||
|
||||
EFI_VFR_RETURN_CODE
|
||||
CVfrDefaultStore::BufferVarStoreAltConfigAdd (
|
||||
IN EFI_VARSTORE_ID DefaultId,
|
||||
@@ -2340,6 +2260,7 @@ SVfrQuestionNode::SVfrQuestionNode (
|
||||
mQuestionId = EFI_QUESTION_ID_INVALID;
|
||||
mBitMask = BitMask;
|
||||
mNext = NULL;
|
||||
mQtype = QUESTION_NORMAL;
|
||||
|
||||
if (Name == NULL) {
|
||||
mName = new CHAR8[strlen ("$DEFAULT") + 1];
|
||||
@@ -2509,6 +2430,9 @@ CVfrQuestionDB::RegisterOldDateQuestion (
|
||||
pNode[0]->mQuestionId = QuestionId;
|
||||
pNode[1]->mQuestionId = QuestionId;
|
||||
pNode[2]->mQuestionId = QuestionId;
|
||||
pNode[0]->mQtype = QUESTION_DATE;
|
||||
pNode[1]->mQtype = QUESTION_DATE;
|
||||
pNode[2]->mQtype = QUESTION_DATE;
|
||||
pNode[0]->mNext = pNode[1];
|
||||
pNode[1]->mNext = pNode[2];
|
||||
pNode[2]->mNext = mQuestionList;
|
||||
@@ -2585,6 +2509,9 @@ CVfrQuestionDB::RegisterNewDateQuestion (
|
||||
pNode[0]->mQuestionId = QuestionId;
|
||||
pNode[1]->mQuestionId = QuestionId;
|
||||
pNode[2]->mQuestionId = QuestionId;
|
||||
pNode[0]->mQtype = QUESTION_DATE;
|
||||
pNode[1]->mQtype = QUESTION_DATE;
|
||||
pNode[2]->mQtype = QUESTION_DATE;
|
||||
pNode[0]->mNext = pNode[1];
|
||||
pNode[1]->mNext = pNode[2];
|
||||
pNode[2]->mNext = mQuestionList;
|
||||
@@ -2651,6 +2578,9 @@ CVfrQuestionDB::RegisterOldTimeQuestion (
|
||||
pNode[0]->mQuestionId = QuestionId;
|
||||
pNode[1]->mQuestionId = QuestionId;
|
||||
pNode[2]->mQuestionId = QuestionId;
|
||||
pNode[0]->mQtype = QUESTION_TIME;
|
||||
pNode[1]->mQtype = QUESTION_TIME;
|
||||
pNode[2]->mQtype = QUESTION_TIME;
|
||||
pNode[0]->mNext = pNode[1];
|
||||
pNode[1]->mNext = pNode[2];
|
||||
pNode[2]->mNext = mQuestionList;
|
||||
@@ -2727,6 +2657,9 @@ CVfrQuestionDB::RegisterNewTimeQuestion (
|
||||
pNode[0]->mQuestionId = QuestionId;
|
||||
pNode[1]->mQuestionId = QuestionId;
|
||||
pNode[2]->mQuestionId = QuestionId;
|
||||
pNode[0]->mQtype = QUESTION_TIME;
|
||||
pNode[1]->mQtype = QUESTION_TIME;
|
||||
pNode[2]->mQtype = QUESTION_TIME;
|
||||
pNode[0]->mNext = pNode[1];
|
||||
pNode[1]->mNext = pNode[2];
|
||||
pNode[2]->mNext = mQuestionList;
|
||||
@@ -2800,13 +2733,17 @@ CVfrQuestionDB::GetQuestionId (
|
||||
IN CHAR8 *Name,
|
||||
IN CHAR8 *VarIdStr,
|
||||
OUT EFI_QUESTION_ID &QuestionId,
|
||||
OUT UINT32 &BitMask
|
||||
OUT UINT32 &BitMask,
|
||||
OUT EFI_QUESION_TYPE *QType
|
||||
)
|
||||
{
|
||||
SVfrQuestionNode *pNode;
|
||||
|
||||
QuestionId = EFI_QUESTION_ID_INVALID;
|
||||
BitMask = 0x00000000;
|
||||
if (QType != NULL) {
|
||||
*QType = QUESTION_NORMAL;
|
||||
}
|
||||
|
||||
if ((Name == NULL) && (VarIdStr == NULL)) {
|
||||
return ;
|
||||
@@ -2827,6 +2764,9 @@ CVfrQuestionDB::GetQuestionId (
|
||||
|
||||
QuestionId = pNode->mQuestionId;
|
||||
BitMask = pNode->mBitMask;
|
||||
if (QType != NULL) {
|
||||
*QType = pNode->mQtype;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -2877,3 +2817,4 @@ BOOLEAN VfrCompatibleMode = FALSE;
|
||||
|
||||
CVfrVarDataTypeDB gCVfrVarDataTypeDB;
|
||||
|
||||
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
Vfr common library functions.
|
||||
|
||||
Copyright (c) 2004 - 2009, Intel Corporation
|
||||
Copyright (c) 2004 - 2010, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
@@ -36,8 +36,8 @@ extern BOOLEAN VfrCompatibleMode;
|
||||
|
||||
class CVfrBinaryOutput {
|
||||
public:
|
||||
virtual VOID WriteLine (IN FILE *, IN UINT32, IN CHAR8 *, IN CHAR8 *, IN UINT32);
|
||||
virtual VOID WriteEnd (IN FILE *, IN UINT32, IN CHAR8 *, IN CHAR8 *, IN UINT32);
|
||||
virtual VOID WriteLine (IN FILE *, IN UINT32, IN CONST CHAR8 *, IN CHAR8 *, IN UINT32);
|
||||
virtual VOID WriteEnd (IN FILE *, IN UINT32, IN CONST CHAR8 *, IN CHAR8 *, IN UINT32);
|
||||
};
|
||||
|
||||
UINT32
|
||||
@@ -332,6 +332,7 @@ struct SVfrQuestionNode {
|
||||
EFI_QUESTION_ID mQuestionId;
|
||||
UINT32 mBitMask;
|
||||
SVfrQuestionNode *mNext;
|
||||
EFI_QUESION_TYPE mQtype;
|
||||
|
||||
SVfrQuestionNode (IN CHAR8 *, IN CHAR8 *, IN UINT32 BitMask = 0);
|
||||
~SVfrQuestionNode ();
|
||||
@@ -358,7 +359,7 @@ public:
|
||||
VOID RegisterOldTimeQuestion (IN CHAR8 *, IN CHAR8 *, IN CHAR8 *, IN OUT EFI_QUESTION_ID &);
|
||||
VOID RegisterNewTimeQuestion (IN CHAR8 *, IN CHAR8 *, IN OUT EFI_QUESTION_ID &);
|
||||
EFI_VFR_RETURN_CODE UpdateQuestionId (IN EFI_QUESTION_ID, IN EFI_QUESTION_ID);
|
||||
VOID GetQuestionId (IN CHAR8 *, IN CHAR8 *, OUT EFI_QUESTION_ID &, OUT UINT32 &);
|
||||
VOID GetQuestionId (IN CHAR8 *, IN CHAR8 *, OUT EFI_QUESTION_ID &, OUT UINT32 &, OUT EFI_QUESION_TYPE *QType = NULL);
|
||||
EFI_VFR_RETURN_CODE FindQuestion (IN EFI_QUESTION_ID);
|
||||
EFI_VFR_RETURN_CODE FindQuestion (IN CHAR8 *);
|
||||
VOID PrintAllQuestion (IN VOID);
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/** @file
|
||||
|
||||
Copyright (c) 1999 - 2008, Intel Corporation
|
||||
Copyright (c) 1999 - 2010, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
@@ -1801,7 +1801,7 @@ Returns:
|
||||
//
|
||||
// Copyright declaration
|
||||
//
|
||||
fprintf (stdout, "Copyright (c) 2007, Intel Corporation. All rights reserved.\n\n");
|
||||
fprintf (stdout, "Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.\n\n");
|
||||
|
||||
//
|
||||
// Details Option
|
||||
|
Reference in New Issue
Block a user