diff options
author | lgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524> | 2011-08-26 07:46:26 +0000 |
---|---|---|
committer | lgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524> | 2011-08-26 07:46:26 +0000 |
commit | 4234283c3acb8c35014acc1546621fbc2621b095 (patch) | |
tree | 208a4f87b2820ec1f3a414508ca1c215c5deed18 /BaseTools/Source/C | |
parent | ba944801a988dddf3ed217c72c8d880d0f03d150 (diff) | |
download | edk2-platforms-4234283c3acb8c35014acc1546621fbc2621b095.tar.xz |
Sync BaseTools Branch (version r2271) to EDKII main trunk.
BaseTool Branch:
https://edk2-buildtools.svn.sourceforge.net/svnroot/edk2-buildtools/branches/Releases/BaseTools_r2100
Signed-off-by: lgao4
Reviewed-by: hchen30
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12214 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'BaseTools/Source/C')
-rw-r--r-- | BaseTools/Source/C/Common/ParseInf.h | 9 | ||||
-rw-r--r-- | BaseTools/Source/C/GenPage/GenPage.c | 29 | ||||
-rw-r--r-- | BaseTools/Source/C/Include/Common/MdeModuleHii.h | 161 | ||||
-rw-r--r-- | BaseTools/Source/C/Include/Common/UefiInternalFormRepresentation.h | 27 | ||||
-rw-r--r-- | BaseTools/Source/C/Include/Protocol/DevicePath.h | 548 | ||||
-rw-r--r-- | BaseTools/Source/C/VfrCompile/EfiVfr.h | 4 | ||||
-rw-r--r-- | BaseTools/Source/C/VfrCompile/VfrCompiler.cpp | 40 | ||||
-rw-r--r-- | BaseTools/Source/C/VfrCompile/VfrCompiler.h | 7 | ||||
-rw-r--r-- | BaseTools/Source/C/VfrCompile/VfrFormPkg.cpp | 4 | ||||
-rw-r--r-- | BaseTools/Source/C/VfrCompile/VfrFormPkg.h | 94 | ||||
-rw-r--r-- | BaseTools/Source/C/VfrCompile/VfrSyntax.g | 275 | ||||
-rw-r--r-- | BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp | 538 | ||||
-rw-r--r-- | BaseTools/Source/C/VfrCompile/VfrUtilityLib.h | 32 |
13 files changed, 1100 insertions, 668 deletions
diff --git a/BaseTools/Source/C/Common/ParseInf.h b/BaseTools/Source/C/Common/ParseInf.h index 88ded8760e..dfd180db74 100644 --- a/BaseTools/Source/C/Common/ParseInf.h +++ b/BaseTools/Source/C/Common/ParseInf.h @@ -31,7 +31,9 @@ Abstract: #define _MAX_PATH 500
#endif
-
+#ifdef __cplusplus
+extern "C" {
+#endif
//
// Functions declarations
//
@@ -227,4 +229,9 @@ Returns: TRUE if section found
--*/
+
+#ifdef __cplusplus
+}
+#endif
+
#endif
diff --git a/BaseTools/Source/C/GenPage/GenPage.c b/BaseTools/Source/C/GenPage/GenPage.c index c72011045c..e92bcf5d9e 100644 --- a/BaseTools/Source/C/GenPage/GenPage.c +++ b/BaseTools/Source/C/GenPage/GenPage.c @@ -1,6 +1,6 @@ /** @file
-Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
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
@@ -63,7 +63,7 @@ UINT32 gPageTableOffsetInFile = EFI_PAGE_BASE_OFFSET_IN_LDR; //
// Utility Name
//
-#define UTILITY_NAME "GenBootSector"
+#define UTILITY_NAME "GenPage"
//
// Utility version information
@@ -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 - 2010 Intel Corporation. All rights reserved.\n");
+ printf ("Copyright (c) 2008 - 2011 Intel Corporation. All rights reserved.\n");
}
VOID
@@ -103,14 +103,21 @@ Usage ( Version();
printf ("\nUsage: \n\
GenPage\n\
- -o, --output Filename containing page table\n\
- [-b, --baseaddr baseaddress of page table]\n\
- [-f, --offset offset in the file that page table will reside]\n\
- [-v, --verbose]\n\
- [--version]\n\
- [-q, --quiet disable all messages except fatal errors]\n\
- [-d, --debug[#]\n\
- [-h, --help]\n\
+ -o, --output Filename\n\
+ The file that contains both non-page table part and\n\
+ page table\n\
+ [-b, --baseaddr baseaddress]\n\
+ The page table location\n\
+ [-f, --offset offset]\n\
+ The position that the page table will appear in the\n\
+ output file\n\
+ [-v, --verbose] Turn on verbose output with informational messages\n\
+ printed\n\
+ [--version] Print version and copyright of this program and exit\n\
+ [-q, --quiet] Disable all messages except unrecoverable errors\n\
+ [-d, --debug[#]] Enable debug messages, at level #\n\
+ [-h, --help] Print copyright, version and usage of this program\n\
+ and exit\n\
EfiLoaderImageName\n");
}
diff --git a/BaseTools/Source/C/Include/Common/MdeModuleHii.h b/BaseTools/Source/C/Include/Common/MdeModuleHii.h index 8b42061d71..b756fef2c3 100644 --- a/BaseTools/Source/C/Include/Common/MdeModuleHii.h +++ b/BaseTools/Source/C/Include/Common/MdeModuleHii.h @@ -1,7 +1,7 @@ /** @file
EDK II specific HII relative definition.
- Copyright (c) 2006 - 2007, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials are licensed and made available
under the terms and conditions of the BSD License which accompanies this
@@ -22,51 +22,45 @@ #define WIDE_CHAR 0xFFF1
#define NON_BREAKING_CHAR 0xFFF2
-#define GLYPH_WIDTH EFI_GLYPH_WIDTH
-#define GLYPH_HEIGHT EFI_GLYPH_HEIGHT
-
-//
-// State defined for password statemachine
-//
+///
+/// State defined for password statemachine .
+///
#define BROWSER_STATE_VALIDATE_PASSWORD 0
#define BROWSER_STATE_SET_PASSWORD 1
-
-//
-// Tiano Implementation specific Device Path definition.
-//
-#pragma pack(1)
-typedef struct {
- VENDOR_DEVICE_PATH VendorDevicePath;
- UINT32 Reserved;
- UINT64 UniqueId;
-} HII_VENDOR_DEVICE_PATH_NODE;
-#pragma pack()
-
-typedef struct {
- HII_VENDOR_DEVICE_PATH_NODE Node;
- EFI_DEVICE_PATH_PROTOCOL End;
-} HII_VENDOR_DEVICE_PATH;
-
-
-//
-// GUIDed opcodes defined for Tiano
-//
+///
+/// GUIDed opcodes defined for EDKII implementation.
+///
#define EFI_IFR_TIANO_GUID \
{ 0xf0b1735, 0x87a0, 0x4193, {0xb2, 0x66, 0x53, 0x8c, 0x38, 0xaf, 0x48, 0xce} }
#pragma pack(1)
+///
+/// EDKII implementation extension opcodes, new extension can be added here later.
+///
#define EFI_IFR_EXTEND_OP_LABEL 0x0
#define EFI_IFR_EXTEND_OP_BANNER 0x1
#define EFI_IFR_EXTEND_OP_TIMEOUT 0x2
#define EFI_IFR_EXTEND_OP_CLASS 0x3
#define EFI_IFR_EXTEND_OP_SUBCLASS 0x4
+///
+/// Label opcode.
+///
typedef struct _EFI_IFR_GUID_LABEL {
EFI_IFR_OP_HEADER Header;
+ ///
+ /// EFI_IFR_TIANO_GUID.
+ ///
EFI_GUID Guid;
+ ///
+ /// EFI_IFR_EXTEND_OP_LABEL.
+ ///
UINT8 ExtendOpCode;
+ ///
+ /// Label Number.
+ ///
UINT16 Number;
} EFI_IFR_GUID_LABEL;
@@ -74,20 +68,38 @@ typedef struct _EFI_IFR_GUID_LABEL { #define EFI_IFR_BANNER_ALIGN_CENTER 1
#define EFI_IFR_BANNER_ALIGN_RIGHT 2
+///
+/// Banner opcode.
+///
typedef struct _EFI_IFR_GUID_BANNER {
EFI_IFR_OP_HEADER Header;
+ ///
+ /// EFI_IFR_TIANO_GUID.
+ ///
EFI_GUID Guid;
- UINT8 ExtendOpCode; // Extended opcode is EFI_IFR_EXTEND_OP_BANNER
- EFI_STRING_ID Title; // The string token for the banner title
- UINT16 LineNumber; // 1-based line number
- UINT8 Alignment; // left, center, or right-aligned
+ ///
+ /// EFI_IFR_EXTEND_OP_BANNER
+ ///
+ UINT8 ExtendOpCode;
+ EFI_STRING_ID Title; ///< The string token for the banner title.
+ UINT16 LineNumber; ///< 1-based line number.
+ UINT8 Alignment; ///< left, center, or right-aligned.
} EFI_IFR_GUID_BANNER;
+///
+/// Timeout opcode.
+///
typedef struct _EFI_IFR_GUID_TIMEOUT {
EFI_IFR_OP_HEADER Header;
+ ///
+ /// EFI_IFR_TIANO_GUID.
+ ///
EFI_GUID Guid;
+ ///
+ /// EFI_IFR_EXTEND_OP_TIMEOUT.
+ ///
UINT8 ExtendOpCode;
- UINT16 TimeOut;
+ UINT16 TimeOut; ///< TimeOut Value.
} EFI_IFR_GUID_TIMEOUT;
#define EFI_NON_DEVICE_CLASS 0x00
@@ -98,11 +110,20 @@ typedef struct _EFI_IFR_GUID_TIMEOUT { #define EFI_ON_BOARD_DEVICE_CLASS 0x10
#define EFI_OTHER_DEVICE_CLASS 0x20
+///
+/// Device Class opcode.
+///
typedef struct _EFI_IFR_GUID_CLASS {
EFI_IFR_OP_HEADER Header;
+ ///
+ /// EFI_IFR_TIANO_GUID.
+ ///
EFI_GUID Guid;
+ ///
+ /// EFI_IFR_EXTEND_OP_CLASS.
+ ///
UINT8 ExtendOpCode;
- UINT16 Class;
+ UINT16 Class; ///< Device Class from the above.
} EFI_IFR_GUID_CLASS;
#define EFI_SETUP_APPLICATION_SUBCLASS 0x00
@@ -110,45 +131,93 @@ typedef struct _EFI_IFR_GUID_CLASS { #define EFI_FRONT_PAGE_SUBCLASS 0x02
#define EFI_SINGLE_USE_SUBCLASS 0x03
+///
+/// SubClass opcode
+///
typedef struct _EFI_IFR_GUID_SUBCLASS {
EFI_IFR_OP_HEADER Header;
+ ///
+ /// EFI_IFR_TIANO_GUID.
+ ///
EFI_GUID Guid;
+ ///
+ /// EFI_IFR_EXTEND_OP_SUBCLASS.
+ ///
UINT8 ExtendOpCode;
- UINT16 SubClass;
+ UINT16 SubClass; ///< Sub Class type from the above.
} EFI_IFR_GUID_SUBCLASS;
-//
-// GUIDed opcodes defined for Tiano
-//
+///
+/// GUIDed opcodes support for framework vfr.
+///
#define EFI_IFR_FRAMEWORK_GUID \
{ 0x31ca5d1a, 0xd511, 0x4931, { 0xb7, 0x82, 0xae, 0x6b, 0x2b, 0x17, 0x8c, 0xd7 } }
+///
+/// Two extended opcodes are added, and new extensions can be added here later.
+/// One is for framework OneOf question Option Key value;
+/// another is for framework vareqval.
+///
#define EFI_IFR_EXTEND_OP_OPTIONKEY 0x0
#define EFI_IFR_EXTEND_OP_VAREQNAME 0x1
-//
-// Store the framework vfr option key value
-//
+
+///
+/// Store the framework vfr option key value.
+///
typedef struct _EFI_IFR_GUID_OPTIONKEY {
EFI_IFR_OP_HEADER Header;
+ ///
+ /// EFI_IFR_FRAMEWORK_GUID.
+ ///
EFI_GUID Guid;
+ ///
+ /// EFI_IFR_EXTEND_OP_OPTIONKEY.
+ ///
UINT8 ExtendOpCode;
+ ///
+ /// OneOf Questiond ID binded by OneOf Option.
+ ///
EFI_QUESTION_ID QuestionId;
+ ///
+ /// The OneOf Option Value.
+ ///
EFI_IFR_TYPE_VALUE OptionValue;
- EFI_QUESTION_ID KeyValue;
+ ///
+ /// The Framework OneOf Option Key Value.
+ ///
+ UINT16 KeyValue;
} EFI_IFR_GUID_OPTIONKEY;
-//
-// Store the framework vfr vareqval name number
-//
+///
+/// Store the framework vfr vareqval name number.
+///
typedef struct _EFI_IFR_GUID_VAREQNAME {
EFI_IFR_OP_HEADER Header;
+ ///
+ /// EFI_IFR_FRAMEWORK_GUID.
+ ///
EFI_GUID Guid;
+ ///
+ /// EFI_IFR_EXTEND_OP_VAREQNAME.
+ ///
UINT8 ExtendOpCode;
+ ///
+ /// Question ID of the Numeric Opcode created.
+ ///
EFI_QUESTION_ID QuestionId;
- EFI_STRING_ID NameId;
+ ///
+ /// For vareqval (0x100), NameId is 0x100.
+ /// This value will convert to a Unicode String following this rule;
+ /// sprintf(StringBuffer, "%d", NameId) .
+ /// The the Unicode String will be used as a EFI Variable Name.
+ ///
+ UINT16 NameId;
} EFI_IFR_GUID_VAREQNAME;
#pragma pack()
+extern EFI_GUID gEfiIfrTianoGuid;
+extern EFI_GUID gEfiIfrFrameworkGuid;
+
#endif
diff --git a/BaseTools/Source/C/Include/Common/UefiInternalFormRepresentation.h b/BaseTools/Source/C/Include/Common/UefiInternalFormRepresentation.h index 61fc191618..1cabc959d8 100644 --- a/BaseTools/Source/C/Include/Common/UefiInternalFormRepresentation.h +++ b/BaseTools/Source/C/Include/Common/UefiInternalFormRepresentation.h @@ -575,6 +575,13 @@ typedef struct { UINT8 Day;
} EFI_HII_DATE;
+typedef struct {
+ EFI_QUESTION_ID QuestionId;
+ EFI_FORM_ID FormId;
+ EFI_GUID FormSetGuid;
+ EFI_STRING_ID DevicePath;
+} EFI_HII_REF;
+
typedef union {
UINT8 u8;
UINT16 u16;
@@ -584,6 +591,7 @@ typedef union { EFI_HII_TIME time;
EFI_HII_DATE date;
EFI_STRING_ID string;
+ EFI_HII_REF ref;
} EFI_IFR_TYPE_VALUE;
#define EFI_IFR_FORM_OP 0x01
@@ -681,6 +689,8 @@ typedef union { #define EFI_IFR_CATENATE_OP 0x5E
#define EFI_IFR_GUID_OP 0x5F
#define EFI_IFR_SECURITY_OP 0x60
+#define EFI_IFR_MODAL_TAG_OP 0x61
+#define EFI_IFR_REFRESH_ID_OP 0x62
typedef struct _EFI_IFR_OP_HEADER {
@@ -739,6 +749,8 @@ typedef struct _EFI_IFR_VARSTORE_EFI { EFI_VARSTORE_ID VarStoreId;
EFI_GUID Guid;
UINT32 Attributes;
+ UINT16 Size;
+ UINT8 Name[1];
} EFI_IFR_VARSTORE_EFI;
typedef struct _EFI_IFR_VARSTORE_NAME_VALUE {
@@ -771,6 +783,10 @@ typedef struct _EFI_IFR_IMAGE { EFI_IMAGE_ID Id;
} EFI_IFR_IMAGE;
+typedef struct _EFI_IFR_MODAL {
+ EFI_IFR_OP_HEADER Header;
+} EFI_IFR_MODAL;
+
typedef struct _EFI_IFR_LOCKED {
EFI_IFR_OP_HEADER Header;
} EFI_IFR_LOCKED;
@@ -844,6 +860,11 @@ typedef struct _EFI_IFR_REF4 { EFI_STRING_ID DevicePath;
} EFI_IFR_REF4;
+typedef struct _EFI_IFR_REF5 {
+ EFI_IFR_OP_HEADER Header;
+ EFI_IFR_QUESTION_HEADER Question;
+} EFI_IFR_REF5;
+
typedef struct _EFI_IFR_RESET_BUTTON {
EFI_IFR_OP_HEADER Header;
EFI_IFR_STATEMENT_HEADER Statement;
@@ -993,6 +1014,11 @@ typedef struct _EFI_IFR_REFRESH { UINT8 RefreshInterval;
} EFI_IFR_REFRESH;
+typedef struct _EFI_IFR_REFRESH_ID {
+ EFI_IFR_OP_HEADER Header;
+ EFI_GUID RefreshEventGroupId;
+} EFI_IFR_REFRESH_ID;
+
typedef struct _EFI_IFR_VARSTORE_DEVICE {
EFI_IFR_OP_HEADER Header;
EFI_STRING_ID DevicePath;
@@ -1018,6 +1044,7 @@ typedef struct _EFI_IFR_ONE_OF_OPTION { #define EFI_IFR_TYPE_UNDEFINED 0x09
#define EFI_IFR_TYPE_ACTION 0x0A
#define EFI_IFR_TYPE_BUFFER 0x0B
+#define EFI_IFR_TYPE_REF 0x0C
#define EFI_IFR_OPTION_DEFAULT 0x10
#define EFI_IFR_OPTION_DEFAULT_MFG 0x20
diff --git a/BaseTools/Source/C/Include/Protocol/DevicePath.h b/BaseTools/Source/C/Include/Protocol/DevicePath.h deleted file mode 100644 index 9fc8cb1aff..0000000000 --- a/BaseTools/Source/C/Include/Protocol/DevicePath.h +++ /dev/null @@ -1,548 +0,0 @@ -/** @file
- The device path protocol as defined in UEFI 2.0.
-
- The device path represents a programatic path to a device. It's the view
- from a software point of view. It also must persist from boot to boot, so
- it can not contain things like PCI bus numbers that change from boot to boot.
-
- Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
-
- 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.
-
- File Name: DevicePath.h
-
-**/
-
-#ifndef __EFI_DEVICE_PATH_PROTOCOL_H__
-#define __EFI_DEVICE_PATH_PROTOCOL_H__
-
-#include <Guid/PcAnsi.h>
-
-//
-// Device Path protocol
-//
-#define EFI_DEVICE_PATH_PROTOCOL_GUID \
- { \
- 0x9576e91, 0x6d3f, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b } \
- }
-
-//
-// Protocol GUID defined in EFI1.1.
-//
-
-//
-// Device Path information
-//
-#define DEVICE_PATH_PROTOCOL EFI_DEVICE_PATH_PROTOCOL_GUID
-
-#pragma pack(1)
-
-typedef struct {
- UINT8 Type;
- UINT8 SubType;
- UINT8 Length[2];
-} EFI_DEVICE_PATH_PROTOCOL;
-
-//
-// For backward-compatible with EFI1.1.
-//
-typedef EFI_DEVICE_PATH_PROTOCOL EFI_DEVICE_PATH;
-
-//
-// Hardware Device Paths
-//
-#define HARDWARE_DEVICE_PATH 0x01
-
-#define HW_PCI_DP 0x01
-typedef struct {
- EFI_DEVICE_PATH_PROTOCOL Header;
- UINT8 Function;
- UINT8 Device;
-} PCI_DEVICE_PATH;
-
-#define HW_PCCARD_DP 0x02
-typedef struct {
- EFI_DEVICE_PATH_PROTOCOL Header;
- UINT8 FunctionNumber;
-} PCCARD_DEVICE_PATH;
-
-#define HW_MEMMAP_DP 0x03
-typedef struct {
- EFI_DEVICE_PATH_PROTOCOL Header;
- UINT32 MemoryType;
- EFI_PHYSICAL_ADDRESS StartingAddress;
- EFI_PHYSICAL_ADDRESS EndingAddress;
-} MEMMAP_DEVICE_PATH;
-
-#define HW_VENDOR_DP 0x04
-typedef struct {
- EFI_DEVICE_PATH_PROTOCOL Header;
- EFI_GUID Guid;
-} VENDOR_DEVICE_PATH;
-
-#define HW_CONTROLLER_DP 0x05
-typedef struct {
- EFI_DEVICE_PATH_PROTOCOL Header;
- UINT32 ControllerNumber;
-} CONTROLLER_DEVICE_PATH;
-
-//
-// ACPI Device Paths
-//
-#define ACPI_DEVICE_PATH 0x02
-
-#define ACPI_DP 0x01
-typedef struct {
- EFI_DEVICE_PATH_PROTOCOL Header;
- UINT32 HID;
- UINT32 UID;
-} ACPI_HID_DEVICE_PATH;
-
-#define ACPI_EXTENDED_DP 0x02
-typedef struct {
- EFI_DEVICE_PATH_PROTOCOL Header;
- UINT32 HID;
- UINT32 UID;
- UINT32 CID;
- //
- // Optional variable length _HIDSTR
- // Optional variable length _UIDSTR
- //
-} ACPI_EXTENDED_HID_DEVICE_PATH;
-
-//
-// EISA ID Macro
-// EISA ID Definition 32-bits
-// bits[15:0] - three character compressed ASCII EISA ID.
-// bits[31:16] - binary number
-// Compressed ASCII is 5 bits per character 0b00001 = 'A' 0b11010 = 'Z'
-//
-#define PNP_EISA_ID_CONST 0x41d0
-#define EISA_ID(_Name, _Num) ((UINT32) ((_Name) | (_Num) << 16))
-#define EISA_PNP_ID(_PNPId) (EISA_ID(PNP_EISA_ID_CONST, (_PNPId)))
-#define EFI_PNP_ID(_PNPId) (EISA_ID(PNP_EISA_ID_CONST, (_PNPId)))
-
-#define PNP_EISA_ID_MASK 0xffff
-#define EISA_ID_TO_NUM(_Id) ((_Id) >> 16)
-
-
-#define ACPI_ADR_DP 0x03
-typedef struct {
- EFI_DEVICE_PATH_PROTOCOL Header;
- UINT32 ADR;
-} ACPI_ADR_DEVICE_PATH;
-
-
-//
-// Messaging Device Paths
-//
-#define MESSAGING_DEVICE_PATH 0x03
-
-#define MSG_ATAPI_DP 0x01
-typedef struct {
- EFI_DEVICE_PATH_PROTOCOL Header;
- UINT8 PrimarySecondary;
- UINT8 SlaveMaster;
- UINT16 Lun;
-} ATAPI_DEVICE_PATH;
-
-#define MSG_SCSI_DP 0x02
-typedef struct {
- EFI_DEVICE_PATH_PROTOCOL Header;
- UINT16 Pun;
- UINT16 Lun;
-} SCSI_DEVICE_PATH;
-
-#define MSG_FIBRECHANNEL_DP 0x03
-typedef struct {
- EFI_DEVICE_PATH_PROTOCOL Header;
- UINT32 Reserved;
- UINT64 WWN;
- UINT64 Lun;
-} FIBRECHANNEL_DEVICE_PATH;
-
-#define MSG_1394_DP 0x04
-typedef struct {
- EFI_DEVICE_PATH_PROTOCOL Header;
- UINT32 Reserved;
- UINT64 Guid;
-} F1394_DEVICE_PATH;
-
-#define MSG_USB_DP 0x05
-typedef struct {
- EFI_DEVICE_PATH_PROTOCOL Header;
- UINT8 ParentPortNumber;
- UINT8 InterfaceNumber;
-} USB_DEVICE_PATH;
-
-#define MSG_USB_CLASS_DP 0x0f
-typedef struct {
- EFI_DEVICE_PATH_PROTOCOL Header;
- UINT16 VendorId;
- UINT16 ProductId;
- UINT8 DeviceClass;
- UINT8 DeviceSubClass;
- UINT8 DeviceProtocol;
-} USB_CLASS_DEVICE_PATH;
-
-#define MSG_USB_WWID_DP 0x10
-typedef struct {
- EFI_DEVICE_PATH_PROTOCOL Header;
- UINT16 InterfaceNumber;
- UINT16 VendorId;
- UINT16 ProductId;
- // CHAR16 SerialNumber[...];
-} USB_WWID_DEVICE_PATH;
-
-
-#define MSG_DEVICE_LOGICAL_UNIT_DP 0x11
-typedef struct {
- EFI_DEVICE_PATH_PROTOCOL Header;
- UINT8 Lun;
-} DEVICE_LOGICAL_UNIT_DEVICE_PATH;
-
-#define MSG_SATA_DP 0x12
-typedef struct {
- EFI_DEVICE_PATH_PROTOCOL Header;
- UINT16 HBAPortNumber;
- UINT16 PortMultiplierPortNumber;
- UINT16 Lun;
-} SATA_DEVICE_PATH;
-
-#define MSG_I2O_DP 0x06
-typedef struct {
- EFI_DEVICE_PATH_PROTOCOL Header;
- UINT32 Tid;
-} I2O_DEVICE_PATH;
-
-#define MSG_MAC_ADDR_DP 0x0b
-typedef struct {
- EFI_DEVICE_PATH_PROTOCOL Header;
- EFI_MAC_ADDRESS MacAddress;
- UINT8 IfType;
-} MAC_ADDR_DEVICE_PATH;
-
-#define MSG_IPv4_DP 0x0c
-typedef struct {
- EFI_DEVICE_PATH_PROTOCOL Header;
- EFI_IPv4_ADDRESS LocalIpAddress;
- EFI_IPv4_ADDRESS RemoteIpAddress;
- UINT16 LocalPort;
- UINT16 RemotePort;
- UINT16 Protocol;
- BOOLEAN StaticIpAddress;
-} IPv4_DEVICE_PATH;
-
-#define MSG_IPv6_DP 0x0d
-typedef struct {
- EFI_DEVICE_PATH_PROTOCOL Header;
- EFI_IPv6_ADDRESS LocalIpAddress;
- EFI_IPv6_ADDRESS RemoteIpAddress;
- UINT16 LocalPort;
- UINT16 RemotePort;
- UINT16 Protocol;
- BOOLEAN StaticIpAddress;
-} IPv6_DEVICE_PATH;
-
-#define MSG_INFINIBAND_DP 0x09
-typedef struct {
- EFI_DEVICE_PATH_PROTOCOL Header;
- UINT32 ResourceFlags;
- UINT8 PortGid[16];
- UINT64 ServiceId;
- UINT64 TargetPortId;
- UINT64 DeviceId;
-} INFINIBAND_DEVICE_PATH;
-
-#define INFINIBAND_RESOURCE_FLAG_IOC_SERVICE 0x01
-#define INFINIBAND_RESOURCE_FLAG_EXTENDED_BOOT_ENVIRONMENT 0x02
-#define INFINIBAND_RESOURCE_FLAG_CONSOLE_PROTOCOL 0x04
-#define INFINIBAND_RESOURCE_FLAG_STORAGE_PROTOCOL 0x08
-#define INFINIBAND_RESOURCE_FLAG_NETWORK_PROTOCOL 0x10
-
-#define MSG_UART_DP 0x0e
-typedef struct {
- EFI_DEVICE_PATH_PROTOCOL Header;
- UINT32 Reserved;
- UINT64 BaudRate;
- UINT8 DataBits;
- UINT8 Parity;
- UINT8 StopBits;
-} UART_DEVICE_PATH;
-
-//
-// Use VENDOR_DEVICE_PATH struct
-//
-#define MSG_VENDOR_DP 0x0a
-typedef VENDOR_DEVICE_PATH VENDOR_DEFINED_DEVICE_PATH;
-
-#define DEVICE_PATH_MESSAGING_PC_ANSI EFI_PC_ANSI_GUID
-#define DEVICE_PATH_MESSAGING_VT_100 EFI_VT_100_GUID
-#define DEVICE_PATH_MESSAGING_VT_100_PLUS EFI_VT_100_PLUS_GUID
-#define DEVICE_PATH_MESSAGING_VT_UTF8 EFI_VT_UTF8_GUID
-
-#define DEVICE_PATH_MESSAGING_UART_FLOW_CONTROL EFI_UART_DEVICE_PATH_GUID
-
-typedef struct {
- EFI_DEVICE_PATH_PROTOCOL Header;
- EFI_GUID Guid;
- UINT32 FlowControlMap;
-} UART_FLOW_CONTROL_DEVICE_PATH;
-
-#define DEVICE_PATH_MESSAGING_SAS EFI_SAS_DEVICE_PATH_GUID
-
-typedef struct {
- EFI_DEVICE_PATH_PROTOCOL Header;
- EFI_GUID Guid;
- UINT32 Reserved;
- UINT64 SasAddress;
- UINT64 Lun;
- UINT16 DeviceTopology;
- UINT16 RelativeTargetPort;
-} SAS_DEVICE_PATH;
-
-#define MSG_ISCSI_DP 0x13
-typedef struct {
- EFI_DEVICE_PATH_PROTOCOL Header;
- UINT16 NetworkProtocol;
- UINT16 LoginOption;
- UINT64 Lun;
- UINT16 TargetPortalGroupTag;
- // CHAR8 iSCSI Target Name
-} ISCSI_DEVICE_PATH;
-
-#define ISCSI_LOGIN_OPTION_NO_HEADER_DIGEST 0x0000
-#define ISCSI_LOGIN_OPTION_HEADER_DIGEST_USING_CRC32C 0x0002
-#define ISCSI_LOGIN_OPTION_NO_DATA_DIGEST 0x0000
-#define ISCSI_LOGIN_OPTION_DATA_DIGEST_USING_CRC32C 0x0008
-#define ISCSI_LOGIN_OPTION_AUTHMETHOD_CHAP 0x0000
-#define ISCSI_LOGIN_OPTION_AUTHMETHOD_NON 0x1000
-#define ISCSI_LOGIN_OPTION_CHAP_BI 0x0000
-#define ISCSI_LOGIN_OPTION_CHAP_UNI 0x2000
-
-//
-// Media Device Path
-//
-#define MEDIA_DEVICE_PATH 0x04
-
-#define MEDIA_HARDDRIVE_DP 0x01
-typedef struct {
- EFI_DEVICE_PATH_PROTOCOL Header;
- UINT32 PartitionNumber;
- UINT64 PartitionStart;
- UINT64 PartitionSize;
- UINT8 Signature[16];
- UINT8 MBRType;
- UINT8 SignatureType;
-} HARDDRIVE_DEVICE_PATH;
-
-#define MBR_TYPE_PCAT 0x01
-#define MBR_TYPE_EFI_PARTITION_TABLE_HEADER 0x02
-
-#define SIGNATURE_TYPE_MBR 0x01
-#define SIGNATURE_TYPE_GUID 0x02
-
-#define MEDIA_CDROM_DP 0x02
-typedef struct {
- EFI_DEVICE_PATH_PROTOCOL Header;
- UINT32 BootEntry;
- UINT64 PartitionStart;
- UINT64 PartitionSize;
-} CDROM_DEVICE_PATH;
-
-//
-// Use VENDOR_DEVICE_PATH struct
-//
-#define MEDIA_VENDOR_DP 0x03
-
-#define MEDIA_FILEPATH_DP 0x04
-typedef struct {
- EFI_DEVICE_PATH_PROTOCOL Header;
- CHAR16 PathName[1];
-} FILEPATH_DEVICE_PATH;
-
-#define SIZE_OF_FILEPATH_DEVICE_PATH EFI_FIELD_OFFSET(FILEPATH_DEVICE_PATH,PathName)
-
-#define MEDIA_PROTOCOL_DP 0x05
-typedef struct {
- EFI_DEVICE_PATH_PROTOCOL Header;
- EFI_GUID Protocol;
-} MEDIA_PROTOCOL_DEVICE_PATH;
-
-
-#define MEDIA_PIWG_FW_VOL_DP 0x7
-typedef struct {
- EFI_DEVICE_PATH_PROTOCOL Header;
- EFI_GUID FvName;
-} MEDIA_FW_VOL_DEVICE_PATH;
-
-
-#define MEDIA_PIWG_FW_FILE_DP 0x6
-typedef struct {
- EFI_DEVICE_PATH_PROTOCOL Header;
- EFI_GUID FvFileName;
-} MEDIA_FW_VOL_FILEPATH_DEVICE_PATH;
-
-//
-// BBS Device Path
-//
-#define BBS_DEVICE_PATH 0x05
-#define BBS_BBS_DP 0x01
-typedef struct {
- EFI_DEVICE_PATH_PROTOCOL Header;
- UINT16 DeviceType;
- UINT16 StatusFlag;
- CHAR8 String[1];
-} BBS_BBS_DEVICE_PATH;
-
-//
-// DeviceType definitions - from BBS specification
-//
-#define BBS_TYPE_FLOPPY 0x01
-#define BBS_TYPE_HARDDRIVE 0x02
-#define BBS_TYPE_CDROM 0x03
-#define BBS_TYPE_PCMCIA 0x04
-#define BBS_TYPE_USB 0x05
-#define BBS_TYPE_EMBEDDED_NETWORK 0x06
-#define BBS_TYPE_BEV 0x80
-#define BBS_TYPE_UNKNOWN 0xFF
-
-
-//
-// Union of all possible Device Paths and pointers to Device Paths
-//
-
-typedef union {
- EFI_DEVICE_PATH_PROTOCOL DevPath;
- PCI_DEVICE_PATH Pci;
- PCCARD_DEVICE_PATH PcCard;
- MEMMAP_DEVICE_PATH MemMap;
- VENDOR_DEVICE_PATH Vendor;
-
- CONTROLLER_DEVICE_PATH Controller;
- ACPI_HID_DEVICE_PATH Acpi;
-
- ATAPI_DEVICE_PATH Atapi;
- SCSI_DEVICE_PATH Scsi;
- ISCSI_DEVICE_PATH Iscsi;
- FIBRECHANNEL_DEVICE_PATH FibreChannel;
-
- F1394_DEVICE_PATH F1394;
- USB_DEVICE_PATH Usb;
- SATA_DEVICE_PATH Sata;
- USB_CLASS_DEVICE_PATH UsbClass;
- I2O_DEVICE_PATH I2O;
- MAC_ADDR_DEVICE_PATH MacAddr;
- IPv4_DEVICE_PATH Ipv4;
- IPv6_DEVICE_PATH Ipv6;
- INFINIBAND_DEVICE_PATH InfiniBand;
- UART_DEVICE_PATH Uart;
-
- HARDDRIVE_DEVICE_PATH HardDrive;
- CDROM_DEVICE_PATH CD;
-
- FILEPATH_DEVICE_PATH FilePath;
- MEDIA_PROTOCOL_DEVICE_PATH MediaProtocol;
-
- BBS_BBS_DEVICE_PATH Bbs;
-} EFI_DEV_PATH;
-
-
-
-typedef union {
- EFI_DEVICE_PATH_PROTOCOL *DevPath;
- PCI_DEVICE_PATH *Pci;
- PCCARD_DEVICE_PATH *PcCard;
- MEMMAP_DEVICE_PATH *MemMap;
- VENDOR_DEVICE_PATH *Vendor;
-
- CONTROLLER_DEVICE_PATH *Controller;
- ACPI_HID_DEVICE_PATH *Acpi;
- ACPI_EXTENDED_HID_DEVICE_PATH *ExtendedAcpi;
-
- ATAPI_DEVICE_PATH *Atapi;
- SCSI_DEVICE_PATH *Scsi;
- FIBRECHANNEL_DEVICE_PATH *FibreChannel;
-
- F1394_DEVICE_PATH *F1394;
- USB_DEVICE_PATH *Usb;
- SATA_DEVICE_PATH *Sata;
- USB_CLASS_DEVICE_PATH *UsbClass;
- I2O_DEVICE_PATH *I2O;
- MAC_ADDR_DEVICE_PATH *MacAddr;
- IPv4_DEVICE_PATH *Ipv4;
- IPv6_DEVICE_PATH *Ipv6;
- INFINIBAND_DEVICE_PATH *InfiniBand;
- UART_DEVICE_PATH *Uart;
-
- HARDDRIVE_DEVICE_PATH *HardDrive;
- CDROM_DEVICE_PATH *CD;
-
- FILEPATH_DEVICE_PATH *FilePath;
- MEDIA_PROTOCOL_DEVICE_PATH *MediaProtocol;
-
- BBS_BBS_DEVICE_PATH *Bbs;
- UINT8 *Raw;
-} EFI_DEV_PATH_PTR;
-
-#pragma pack()
-
-#define EFI_DP_TYPE_MASK 0x7F
-#define EFI_DP_TYPE_UNPACKED 0x80
-#define END_DEVICE_PATH_TYPE 0x7f
-
-#define EFI_END_ENTIRE_DEVICE_PATH 0xff
-#define EFI_END_ENTIRE_DEVICE_PATH_SUBTYPE 0xff
-#define EFI_END_INSTANCE_DEVICE_PATH 0x01
-#define END_ENTIRE_DEVICE_PATH_SUBTYPE EFI_END_ENTIRE_DEVICE_PATH_SUBTYPE
-#define END_INSTANCE_DEVICE_PATH_SUBTYPE EFI_END_INSTANCE_DEVICE_PATH
-
-#define EFI_END_DEVICE_PATH_LENGTH (sizeof (EFI_DEVICE_PATH_PROTOCOL))
-#define END_DEVICE_PATH_LENGTH EFI_END_DEVICE_PATH_LENGTH
-
-#define DP_IS_END_TYPE(a)
-#define DP_IS_END_SUBTYPE(a) (((a)->SubType == END_ENTIRE_DEVICE_PATH_SUBTYPE)
-#define DevicePathSubType(a) ((a)->SubType)
-#define IsDevicePathUnpacked(a) ((a)->Type & EFI_DP_TYPE_UNPACKED)
-
-#define EfiDevicePathNodeLength(a) (((a)->Length[0]) | ((a)->Length[1] << 8))
-#define DevicePathNodeLength(a) (EfiDevicePathNodeLength(a))
-#define EfiNextDevicePathNode(a) ((EFI_DEVICE_PATH_PROTOCOL *) (((UINT8 *) (a)) + EfiDevicePathNodeLength (a)))
-#define NextDevicePathNode(a) (EfiNextDevicePathNode(a))
-
-#define EfiDevicePathType(a) (((a)->Type) & EFI_DP_TYPE_MASK)
-#define DevicePathType(a) (EfiDevicePathType(a))
-#define EfiIsDevicePathEndType(a) (EfiDevicePathType (a) == END_DEVICE_PATH_TYPE)
-#define IsDevicePathEndType(a) (EfiIsDevicePathEndType(a))
-
-
-#define EfiIsDevicePathEndSubType(a) ((a)->SubType == EFI_END_ENTIRE_DEVICE_PATH_SUBTYPE)
-#define IsDevicePathEndSubType(a) (EfiIsDevicePathEndSubType(a))
-#define EfiIsDevicePathEndInstanceSubType(a) ((a)->SubType == EFI_END_INSTANCE_DEVICE_PATH)
-
-#define EfiIsDevicePathEnd(a) (EfiIsDevicePathEndType (a) && EfiIsDevicePathEndSubType (a))
-#define IsDevicePathEnd(a) (EfiIsDevicePathEnd(a))
-#define EfiIsDevicePathEndInstance(a) (EfiIsDevicePathEndType (a) && EfiIsDevicePathEndInstanceSubType (a))
-
-
-#define SetDevicePathNodeLength(a,l) { \
- (a)->Length[0] = (UINT8) (l); \
- (a)->Length[1] = (UINT8) ((l) >> 8); \
- }
-
-#define SetDevicePathEndNode(a) { \
- (a)->Type = END_DEVICE_PATH_TYPE; \
- (a)->SubType = END_ENTIRE_DEVICE_PATH_SUBTYPE; \
- (a)->Length[0] = sizeof(EFI_DEVICE_PATH_PROTOCOL); \
- (a)->Length[1] = 0; \
- }
-
-extern EFI_GUID gEfiDevicePathProtocolGuid;
-
-#endif
diff --git a/BaseTools/Source/C/VfrCompile/EfiVfr.h b/BaseTools/Source/C/VfrCompile/EfiVfr.h index 406a12491d..aad9417156 100644 --- a/BaseTools/Source/C/VfrCompile/EfiVfr.h +++ b/BaseTools/Source/C/VfrCompile/EfiVfr.h @@ -1,6 +1,6 @@ /** @file
-Copyright (c) 2004 - 2010, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2004 - 2011, Intel Corporation. All rights reserved.<BR>
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
@@ -23,7 +23,6 @@ Abstract: #define _EFIVFR_H_
#include "Common/UefiBaseTypes.h"
-#include "Protocol/DevicePath.h"
#include "Common/UefiInternalFormRepresentation.h"
#include "Common/MdeModuleHii.h"
@@ -43,6 +42,7 @@ typedef enum { QUESTION_NORMAL,
QUESTION_DATE,
QUESTION_TIME,
+ QUESTION_REF,
} EFI_QUESION_TYPE;
typedef enum {
diff --git a/BaseTools/Source/C/VfrCompile/VfrCompiler.cpp b/BaseTools/Source/C/VfrCompile/VfrCompiler.cpp index 5985a7ad5d..926561760a 100644 --- a/BaseTools/Source/C/VfrCompile/VfrCompiler.cpp +++ b/BaseTools/Source/C/VfrCompile/VfrCompiler.cpp @@ -22,6 +22,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. PACKAGE_DATA gCBuffer;
PACKAGE_DATA gRBuffer;
+CVfrStringDB gCVfrStringDB;
VOID
CVfrCompiler::DebugError (
@@ -62,7 +63,9 @@ CVfrCompiler::OptionInitialization ( )
{
INT32 Index;
-
+ EFI_STATUS Status;
+
+ Status = EFI_SUCCESS;
SetUtilityName ((CHAR8*) PROGRAM_NAME);
mOptions.VfrFileName[0] = '\0';
@@ -78,6 +81,8 @@ CVfrCompiler::OptionInitialization ( mOptions.SkipCPreprocessor = TRUE;
mOptions.CPreprocessorOptions = NULL;
mOptions.CompatibleMode = FALSE;
+ mOptions.HasOverrideClassGuid = FALSE;
+ memset (&mOptions.OverrideClassGuid, 0, sizeof (EFI_GUID));
if (Argc == 1) {
Usage ();
@@ -132,6 +137,22 @@ CVfrCompiler::OptionInitialization ( AppendCPreprocessorOptions (Argv[Index]);
} else if (stricmp(Argv[Index], "-c") == 0 || stricmp(Argv[Index], "--compatible-framework") == 0) {
mOptions.CompatibleMode = TRUE;
+ } else if (stricmp(Argv[Index], "-s") == 0|| stricmp(Argv[Index], "--string-db") == 0) {
+ Index++;
+ if ((Index >= Argc) || (Argv[Index][0] == '-')) {
+ DebugError (NULL, 0, 1001, "Missing option", "-s missing input string file name");
+ goto Fail;
+ }
+ gCVfrStringDB.SetStringFileName(Argv[Index]);
+ DebugMsg (NULL, 0, 9, (CHAR8 *) "Input string file path", Argv[Index]);
+ } else if ((stricmp (Argv[Index], "-g") == 0) || (stricmp (Argv[Index], "--guid") == 0)) {
+ Index++;
+ Status = StringToGuid (Argv[Index], &mOptions.OverrideClassGuid);
+ if (EFI_ERROR (Status)) {
+ DebugError (NULL, 0, 1000, "Invalid format:", "%s", Argv[Index]);
+ goto Fail;
+ }
+ mOptions.HasOverrideClassGuid = TRUE;
} else {
DebugError (NULL, 0, 1000, "Unknown option", "unrecognized option %s", Argv[Index]);
goto Fail;
@@ -399,6 +420,11 @@ CVfrCompiler::Usage ( " do not preprocessing input file",
" -c, --compatible-framework",
" compatible framework vfr file",
+ " -s, --string-db",
+ " input uni string package file",
+ " -g, --guid",
+ " override class guid input",
+ " format is xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
NULL
};
for (Index = 0; Help[Index] != NULL; Index++) {
@@ -472,7 +498,7 @@ Fail: delete PreProcessCmd;
}
-extern UINT8 VfrParserStart (IN FILE *, IN BOOLEAN);
+extern UINT8 VfrParserStart (IN FILE *, IN INPUT_INFO_TO_SYNTAX *);
VOID
CVfrCompiler::Compile (
@@ -481,6 +507,7 @@ CVfrCompiler::Compile ( {
FILE *pInFile = NULL;
CHAR8 *InFileName = NULL;
+ INPUT_INFO_TO_SYNTAX InputInfo;
if (!IS_RUN_STATUS(STATUS_PREPROCESSED)) {
goto Fail;
@@ -495,7 +522,14 @@ CVfrCompiler::Compile ( goto Fail;
}
- if (VfrParserStart (pInFile, mOptions.CompatibleMode) != 0) {
+ InputInfo.CompatibleMode = mOptions.CompatibleMode;
+ if (mOptions.HasOverrideClassGuid) {
+ InputInfo.OverrideClassGuid = &mOptions.OverrideClassGuid;
+ } else {
+ InputInfo.OverrideClassGuid = NULL;
+ }
+
+ if (VfrParserStart (pInFile, &InputInfo) != 0) {
goto Fail;
}
diff --git a/BaseTools/Source/C/VfrCompile/VfrCompiler.h b/BaseTools/Source/C/VfrCompile/VfrCompiler.h index 7525bb5603..1c83e87f5f 100644 --- a/BaseTools/Source/C/VfrCompile/VfrCompiler.h +++ b/BaseTools/Source/C/VfrCompile/VfrCompiler.h @@ -20,10 +20,11 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include "EfiVfr.h"
#include "VfrFormPkg.h"
#include "VfrUtilityLib.h"
+#include "ParseInf.h"
#define PROGRAM_NAME "VfrCompile"
-#define VFR_COMPILER_VERSION " 1.95 (UEFI 2.1)"
-#define VFR_COMPILER_UPDATE_TIME " updated on 2011/02/25"
+#define VFR_COMPILER_VERSION " 2.00 (UEFI 2.3.1)"
+#define VFR_COMPILER_UPDATE_TIME " updated on 2011/07/15"
//
// This is how we invoke the C preprocessor on the VFR source file
// to resolve #defines, #includes, etc. To make C source files
@@ -54,6 +55,8 @@ typedef struct { bool SkipCPreprocessor;
CHAR8 *CPreprocessorOptions;
BOOLEAN CompatibleMode;
+ BOOLEAN HasOverrideClassGuid;
+ EFI_GUID OverrideClassGuid;
} OPTIONS;
typedef enum {
diff --git a/BaseTools/Source/C/VfrCompile/VfrFormPkg.cpp b/BaseTools/Source/C/VfrCompile/VfrFormPkg.cpp index 571af91b0a..6401e71f4d 100644 --- a/BaseTools/Source/C/VfrCompile/VfrFormPkg.cpp +++ b/BaseTools/Source/C/VfrCompile/VfrFormPkg.cpp @@ -1305,6 +1305,8 @@ static struct { { 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
+ { sizeof (EFI_IFR_MODAL), 0}, // EFI_IFR_MODAL_OP - 0x61
+ { sizeof (EFI_IFR_REFRESH_ID), 0}, // EFI_IFR_REFRESH_ID_OP - 0x62
};
#ifdef CIFROBJ_DEUBG
@@ -1327,7 +1329,7 @@ static struct { "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_FORM_MAP", "EFI_IFR_CATENATE", "EFI_IFR_GUID",
- "EFI_IFR_SECURITY",
+ "EFI_IFR_SECURITY", "EFI_IFR_MODAL", "EFI_IFR_REFRESH_ID",
};
VOID
diff --git a/BaseTools/Source/C/VfrCompile/VfrFormPkg.h b/BaseTools/Source/C/VfrCompile/VfrFormPkg.h index 4cdd1cc5db..f908718c02 100644 --- a/BaseTools/Source/C/VfrCompile/VfrFormPkg.h +++ b/BaseTools/Source/C/VfrCompile/VfrFormPkg.h @@ -96,6 +96,11 @@ struct SBufferNode { struct SBufferNode *mNext;
};
+typedef struct {
+ BOOLEAN CompatibleMode;
+ EFI_GUID *OverrideClassGuid;
+} INPUT_INFO_TO_SYNTAX;
+
class CFormPkg {
private:
UINT32 mBufferSize;
@@ -144,7 +149,8 @@ public: );
};
-extern CFormPkg gCFormPkg;
+extern CFormPkg gCFormPkg;
+extern CVfrStringDB gCVfrStringDB;
struct SIfrRecord {
UINT32 mLineNo;
@@ -233,6 +239,15 @@ public: return FALSE;
}
}
+
+ inline bool ShrinkObjBin (IN UINT8 Size) {
+ if ((mDelayEmit == TRUE) && (mObjBinLen > Size)) {
+ mObjBinLen -= Size;
+ return TRUE;
+ } else {
+ return FALSE;
+ }
+ }
};
/*
@@ -254,7 +269,7 @@ public: VOID DecLength (UINT8 Size) {
if (mHeader->Length >= Size) {
- mHeader -= Size;
+ mHeader->Length -= Size;
}
}
@@ -755,10 +770,12 @@ private: EFI_IFR_VARSTORE_EFI *mVarStoreEfi;
public:
- CIfrVarStoreEfi () : CIfrObj (EFI_IFR_VARSTORE_EFI_OP, (CHAR8 **)&mVarStoreEfi),
+ CIfrVarStoreEfi () : CIfrObj (EFI_IFR_VARSTORE_EFI_OP, (CHAR8 **)&mVarStoreEfi, sizeof (EFI_IFR_VARSTORE_EFI), TRUE),
CIfrOpHeader (EFI_IFR_VARSTORE_EFI_OP, &mVarStoreEfi->Header) {
mVarStoreEfi->VarStoreId = EFI_VAROFFSET_INVALID;
+ mVarStoreEfi->Size = 0;
memset (&mVarStoreEfi->Guid, 0, sizeof (EFI_GUID));
+ mVarStoreEfi->Name[0] = '\0';
}
VOID SetGuid (IN EFI_GUID *Guid) {
@@ -772,6 +789,36 @@ public: VOID SetAttributes (IN UINT32 Attributes) {
mVarStoreEfi->Attributes = Attributes;
}
+ VOID SetSize (IN UINT16 Size) {
+ mVarStoreEfi->Size = Size;
+ }
+
+ VOID SetName (IN CHAR8 *Name) {
+ UINT8 Len;
+
+ if (Name != NULL) {
+ Len = (UINT8) strlen (Name);
+ if (Len != 0) {
+ if (ExpendObjBin (Len) == TRUE) {
+ IncLength (Len);
+ strcpy ((CHAR8 *)(mVarStoreEfi->Name), Name);
+ }
+ }
+ }
+ }
+
+ VOID SetBinaryLength (IN UINT16 Size) {
+ UINT16 Len;
+
+ Len = sizeof (EFI_IFR_VARSTORE_EFI);
+ if (Size > Len) {
+ ExpendObjBin(Size - Len);
+ IncLength(Size - Len);
+ } else {
+ ShrinkObjBin(Len - Size);
+ DecLength(Len - Size);
+ }
+ }
};
class CIfrVarStoreNameValue : public CIfrObj, public CIfrOpHeader {
@@ -809,6 +856,17 @@ public: }
};
+class CIfrModal : public CIfrObj, public CIfrOpHeader {
+private:
+ EFI_IFR_MODAL *mModal;
+
+public:
+ CIfrModal () : CIfrObj (EFI_IFR_MODAL_TAG_OP, (CHAR8 **)&mModal),
+ CIfrOpHeader (EFI_IFR_MODAL_TAG_OP, &mModal->Header) {
+ }
+};
+
+
class CIfrLocked : public CIfrObj, public CIfrOpHeader {
private:
EFI_IFR_LOCKED *mLocked;
@@ -1043,8 +1101,8 @@ private: EFI_IFR_REF4 *mRef4;
public:
- CIfrRef4 () : CIfrObj (EFI_IFR_REF_OP, (CHAR8 **)&mRef4, sizeof(EFI_IFR_REF3)),
- CIfrOpHeader (EFI_IFR_REF_OP, &mRef4->Header, sizeof (EFI_IFR_REF3)),
+ CIfrRef4 () : CIfrObj (EFI_IFR_REF_OP, (CHAR8 **)&mRef4, sizeof(EFI_IFR_REF4)),
+ CIfrOpHeader (EFI_IFR_REF_OP, &mRef4->Header, sizeof(EFI_IFR_REF4)),
CIfrQuestionHeader (&mRef4->Question) {
mRef4->FormId = 0;
mRef4->QuestionId = EFI_QUESTION_ID_INVALID;
@@ -1069,6 +1127,17 @@ public: }
};
+class CIfrRef5 : public CIfrObj, public CIfrOpHeader, public CIfrQuestionHeader {
+private:
+ EFI_IFR_REF5 *mRef5;
+
+public:
+ CIfrRef5 () : CIfrObj (EFI_IFR_REF_OP, (CHAR8 **)&mRef5, sizeof (EFI_IFR_REF5)),
+ CIfrOpHeader (EFI_IFR_REF_OP, &mRef5->Header, sizeof (EFI_IFR_REF5)),
+ CIfrQuestionHeader (&mRef5->Question) {
+ }
+};
+
class CIfrResetButton : public CIfrObj, public CIfrOpHeader, public CIfrStatementHeader {
private:
EFI_IFR_RESET_BUTTON *mResetButton;
@@ -1481,6 +1550,21 @@ public: }
};
+class CIfrRefreshId : public CIfrObj, public CIfrOpHeader {
+private:
+ EFI_IFR_REFRESH_ID *mRefreshId;
+
+public:
+ CIfrRefreshId () : CIfrObj (EFI_IFR_REFRESH_ID_OP, (CHAR8 **)&mRefreshId),
+ CIfrOpHeader (EFI_IFR_REFRESH_ID_OP, &mRefreshId->Header) {
+ memset (&mRefreshId->RefreshEventGroupId, 0, sizeof (EFI_GUID));
+ }
+
+ VOID SetRefreshEventGroutId (IN EFI_GUID *RefreshEventGroupId) {
+ memcpy (&mRefreshId->RefreshEventGroupId, RefreshEventGroupId, sizeof (EFI_GUID));
+ }
+};
+
class CIfrVarStoreDevice : public CIfrObj, public CIfrOpHeader {
private:
EFI_IFR_VARSTORE_DEVICE *mVarStoreDevice;
diff --git a/BaseTools/Source/C/VfrCompile/VfrSyntax.g b/BaseTools/Source/C/VfrCompile/VfrSyntax.g index 02a7b5c1f4..081c67d715 100644 --- a/BaseTools/Source/C/VfrCompile/VfrSyntax.g +++ b/BaseTools/Source/C/VfrCompile/VfrSyntax.g @@ -51,11 +51,12 @@ public: UINT8
VfrParserStart (
IN FILE *File,
- IN BOOLEAN CompatibleMode
+ IN INPUT_INFO_TO_SYNTAX *InputInfo
)
{
ParserBlackBox<CVfrDLGLexer, EfiVfrParser, ANTLRToken> VfrParser(File);
- VfrParser.parser()->SetCompatibleMode (CompatibleMode);
+ VfrParser.parser()->SetCompatibleMode (InputInfo->CompatibleMode);
+ VfrParser.parser()->SetOverrideClassGuid (InputInfo->OverrideClassGuid);
return VfrParser.parser()->vfrProgram();
}
>>
@@ -237,6 +238,7 @@ VfrParserStart ( #token EndGuidOp("endguidop") "endguidop"
#token DataType("datatype") "datatype"
#token Data("data") "data"
+#token Modal("modal") "modal"
//
// Define the class and subclass tokens
@@ -340,6 +342,7 @@ vfrDataStructFields : dataStructFieldString |
dataStructFieldDate |
dataStructFieldTime |
+ dataStructFieldRef |
dataStructFieldUser
)*
;
@@ -426,6 +429,16 @@ dataStructFieldTime : ";" << _PCATCH(gCVfrVarDataTypeDB.DataTypeAddField (N->getText(), D->getText(), ArrayNum), N); >>
;
+dataStructFieldRef :
+ << UINT32 ArrayNum = 0; >>
+ D:"EFI_HII_REF"
+ N:StringIdentifier
+ {
+ OpenBracket I:Number CloseBracket << ArrayNum = _STOU32(I->getText()); >>
+ }
+ ";" << _PCATCH(gCVfrVarDataTypeDB.DataTypeAddField (N->getText(), D->getText(), ArrayNum), N); >>
+ ;
+
dataStructFieldUser :
<< UINT32 ArrayNum = 0; >>
T:StringIdentifier
@@ -497,19 +510,42 @@ vfrFormSetDefinition : ","
}
<<
+ if (mOverrideClassGuid != NULL && ClassGuidNum >= 3) {
+ _PCATCH (VFR_RETURN_INVALID_PARAMETER, L->getLine(), "Already has 3 class guids, can't add extra class guid!");
+ }
switch (ClassGuidNum) {
case 0:
- FSObj = new CIfrFormSet(sizeof(EFI_IFR_FORM_SET) + sizeof(EFI_GUID));
+ if (mOverrideClassGuid != NULL) {
+ ClassGuidNum = 2;
+ } else {
+ ClassGuidNum = 1;
+ }
+ FSObj = new CIfrFormSet(sizeof(EFI_IFR_FORM_SET) + ClassGuidNum * sizeof(EFI_GUID));
FSObj->SetClassGuid(&DefaultClassGuid);
+ if (mOverrideClassGuid != NULL) {
+ FSObj->SetClassGuid(mOverrideClassGuid);
+ }
break;
case 1:
+ if (mOverrideClassGuid != NULL) {
+ ClassGuidNum ++;
+ }
FSObj = new CIfrFormSet(sizeof(EFI_IFR_FORM_SET) + ClassGuidNum * sizeof(EFI_GUID));
FSObj->SetClassGuid(&ClassGuid1);
+ if (mOverrideClassGuid != NULL) {
+ FSObj->SetClassGuid(mOverrideClassGuid);
+ }
break;
case 2:
+ if (mOverrideClassGuid != NULL) {
+ ClassGuidNum ++;
+ }
FSObj = new CIfrFormSet(sizeof(EFI_IFR_FORM_SET) + ClassGuidNum * sizeof(EFI_GUID));
FSObj->SetClassGuid(&ClassGuid1);
FSObj->SetClassGuid(&ClassGuid2);
+ if (mOverrideClassGuid != NULL) {
+ FSObj->SetClassGuid(mOverrideClassGuid);
+ }
break;
case 3:
FSObj = new CIfrFormSet(sizeof(EFI_IFR_FORM_SET) + ClassGuidNum * sizeof(EFI_GUID));
@@ -602,7 +638,9 @@ vfrStatementExtension: << TypeName = D->getText(); LineNum = D->getLine(); IsStruct = TRUE;>>
| T:"EFI_HII_TIME" {OpenBracket AN8:Number CloseBracket <<ArrayNum = _STOU32(AN8->getText());>>}
<< TypeName = T->getText(); LineNum = T->getLine(); IsStruct = TRUE;>>
- | TN:StringIdentifier {OpenBracket AN9:Number CloseBracket <<ArrayNum = _STOU32(AN9->getText());>>}
+ | R:"EFI_HII_REF" {OpenBracket AN9:Number CloseBracket <<ArrayNum = _STOU32(AN9->getText());>>}
+ << TypeName = R->getText(); LineNum = R->getLine(); IsStruct = TRUE;>>
+ | TN:StringIdentifier {OpenBracket AN10:Number CloseBracket <<ArrayNum = _STOU32(AN10->getText());>>}
<< TypeName = TN->getText(); LineNum = TN->getLine(); IsStruct = TRUE;>>
)
<<
@@ -794,6 +832,7 @@ vfrStatementVarStoreLinear : | 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(); >>
+ | R:"EFI_HII_REF" "," << TypeName = R->getText(); LineNum = R->getLine(); >>
)
{ Key "=" FID:Number "," << // Key is used to assign Varid in Framework VFR but no use in UEFI2.1 VFR
if (mCompatibleMode) {
@@ -838,22 +877,102 @@ vfrStatementVarStoreLinear : vfrStatementVarStoreEfi :
<<
+ BOOLEAN IsUEFI23EfiVarstore = TRUE;
EFI_GUID Guid;
CIfrVarStoreEfi VSEObj;
- EFI_VARSTORE_ID VarStoreId;
+ EFI_VARSTORE_ID VarStoreId = EFI_VARSTORE_ID_INVALID;
UINT32 Attr = 0;
+ UINT32 Size;
+ CHAR8 *TypeName;
+ UINT32 LineNum;
+ CHAR8 *StoreName = NULL;
>>
E:Efivarstore << VSEObj.SetLineNo(E->getLine()); >>
- SN:StringIdentifier ","
+ (
+ TN:StringIdentifier "," << TypeName = TN->getText(); LineNum = TN->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(); >>
+ | R:"EFI_HII_REF" "," << TypeName = R->getText(); LineNum = R->getLine(); >>
+ )
+ {
+ VarId "=" ID:Number "," <<
+ _PCATCH(
+ (INTN)(VarStoreId = _STOU16(ID->getText())) != 0,
+ (INTN)TRUE,
+ ID,
+ "varid 0 is not allowed."
+ );
+ >>
+ }
Attribute "=" vfrVarStoreEfiAttr[Attr] ( "\|" vfrVarStoreEfiAttr[Attr] )* ","
<< VSEObj.SetAttributes (Attr); >>
- Name "=" "STRING_TOKEN" "\(" VN:Number "\)" ","
- VarSize "=" N:Number ","
- Uuid "=" guidDefinition[Guid] << mCVfrDataStorage.DeclareEfiVarStore (SN->getText(), &Guid, _STOSID(VN->getText()), _STOU32(N->getText())); >>
- <<
- VSEObj.SetGuid (&Guid);
- _PCATCH(mCVfrDataStorage.GetVarStoreId(SN->getText(), &VarStoreId), SN);
+
+ (
+ Name "=" SN:StringIdentifier "," << StoreName = SN->getText(); >>
+ |
+ Name "=" "STRING_TOKEN" "\(" VN:Number "\)" ","
+ VarSize "=" N:Number "," <<
+ IsUEFI23EfiVarstore = FALSE;
+ StoreName = gCVfrStringDB.GetVarStoreNameFormStringId(_STOSID(VN->getText()));
+ if (StoreName == NULL) {
+ _PCATCH (VFR_RETURN_UNSUPPORTED, VN->getLine(), "Can't get varstore name for this StringId!");
+ }
+ Size = _STOU32(N->getText());
+ switch (Size) {
+ case 1:
+ TypeName = (CHAR8 *) "UINT8";
+ break;
+ case 2:
+ TypeName = (CHAR8 *) "UINT16";
+ break;
+ case 4:
+ TypeName = (CHAR8 *) "UINT32";
+ break;
+ case 8:
+ TypeName = (CHAR8 *) "UINT64";
+ break;
+ default:
+ _PCATCH (VFR_RETURN_UNSUPPORTED, N);
+ break;
+ }
+ >>
+ )
+
+ Uuid "=" guidDefinition[Guid] <<
+ if (IsUEFI23EfiVarstore) {
+ _PCATCH(mCVfrDataStorage.DeclareBufferVarStore (
+ StoreName,
+ &Guid,
+ &gCVfrVarDataTypeDB,
+ TypeName,
+ VarStoreId
+ ), LineNum);
+ _PCATCH(mCVfrDataStorage.GetVarStoreId(StoreName, &VarStoreId), SN);
+ _PCATCH(gCVfrVarDataTypeDB.GetDataTypeSize(TypeName, &Size), LineNum);
+ } else {
+ _PCATCH(mCVfrDataStorage.DeclareBufferVarStore (
+ TN->getText(),
+ &Guid,
+ &gCVfrVarDataTypeDB,
+ TypeName,
+ VarStoreId
+ ), LineNum);
+ _PCATCH(mCVfrDataStorage.GetVarStoreId(TN->getText(), &VarStoreId), VN);
+ _PCATCH(gCVfrVarDataTypeDB.GetDataTypeSize(TypeName, &Size), N->getLine());
+ }
+ VSEObj.SetGuid (&Guid);
VSEObj.SetVarStoreId (VarStoreId);
+
+ VSEObj.SetSize ((UINT16) Size);
+ VSEObj.SetName (StoreName);
+ if (IsUEFI23EfiVarstore == FALSE && StoreName != NULL) {
+ delete StoreName;
+ }
>>
";"
;
@@ -978,39 +1097,31 @@ vfrQuestionHeader[CIfrQuestionHeader & QHObj, EFI_QUESION_TYPE QType = QUESTION_ case QUESTION_TIME:
mCVfrQuestionDB.RegisterNewTimeQuestion (QName, VarIdStr, QId);
break;
+ case QUESTION_REF:
+ //
+ // VarIdStr != NULL stand for question with storagae.
+ //
+ if (VarIdStr != NULL) {
+ mCVfrQuestionDB.RegisterRefQuestion (QName, VarIdStr, QId);
+ } else {
+ mCVfrQuestionDB.RegisterQuestion (QName, NULL, QId);
+ }
+ break;
default:
_PCATCH(VFR_RETURN_FATAL_ERROR);
}
$QHObj.SetQuestionId (QId);
- $QHObj.SetVarStoreInfo (&Info);
+ if (VarIdStr != NULL) {
+ $QHObj.SetVarStoreInfo (&Info);
+ }
>>
vfrStatementHeader[&$QHObj]
- << _SAVE_CURRQEST_VARINFO (Info); >>
- << if (VarIdStr != NULL) delete VarIdStr; >>
- ;
-
-vfrQuestionHeaderWithNoStorage[CIfrQuestionHeader *QHObj] :
- <<
- EFI_QUESTION_ID QId = EFI_QUESTION_ID_INVALID;
- CHAR8 *QName = NULL;
- >>
- {
- Name "=" QN:StringIdentifier "," <<
- QName = QN->getText();
- _PCATCH(mCVfrQuestionDB.FindQuestion (QName), VFR_RETURN_UNDEFINED, QN, "has already been used please used anther name");
- >>
- }
- {
- QuestionId "=" ID:Number "," <<
- QId = _STOQID(ID->getText());
- _PCATCH(mCVfrQuestionDB.FindQuestion (QId), VFR_RETURN_UNDEFINED, ID, "redefined quesiont ID");
- >>
- }
- <<
- mCVfrQuestionDB.RegisterQuestion (QName, NULL, QId);
- $QHObj->SetQuestionId (QId);
+ <<
+ if (VarIdStr != NULL) {
+ delete VarIdStr;
+ _SAVE_CURRQEST_VARINFO (Info);
+ }
>>
- vfrStatementHeader[$QHObj]
;
questionheaderFlagsField[UINT8 & Flags] :
@@ -1060,6 +1171,8 @@ vfrStorageVarId[EFI_VARSTORE_INFO & Info, CHAR8 *&QuestVarIdStr, BOOLEAN CheckFl _PCATCH(mCVfrDataStorage.GetVarStoreId (SName, &$Info.mVarStoreId), SN1);
_PCATCH(mCVfrDataStorage.GetNameVarStoreInfo (&$Info, Idx), SN1);
}
+
+ QuestVarIdStr = VarIdStr;
>>
)
|
@@ -1194,6 +1307,9 @@ vfrQuestionDataFieldName [EFI_QUESTION_ID &QId, UINT32 &Mask, CHAR8 *&VarIdStr, ;
vfrConstantValueField[UINT8 Type] > [EFI_IFR_TYPE_VALUE Value] :
+ <<
+ EFI_GUID Guid;
+ >>
N1:Number <<
switch ($Type) {
case EFI_IFR_TYPE_NUM_SIZE_8 :
@@ -1216,6 +1332,7 @@ vfrConstantValueField[UINT8 Type] > [EFI_IFR_TYPE_VALUE Value] : break;
case EFI_IFR_TYPE_TIME :
case EFI_IFR_TYPE_DATE :
+ case EFI_IFR_TYPE_REF :
default :
break;
}
@@ -1227,6 +1344,8 @@ vfrConstantValueField[UINT8 Type] > [EFI_IFR_TYPE_VALUE Value] : | Z:Zero << $Value.u8 = _STOU8(Z->getText()); >>
| HOUR:Number ":" MINUTE:Number ":" SECOND:Number << $Value.time = _STOT(HOUR->getText(), MINUTE->getText(), SECOND->getText()); >>
| YEAR:Number "/" MONTH:Number "/" DAY:Number << $Value.date = _STOD(YEAR->getText(), MONTH->getText(), DAY->getText()); >>
+ | QI:Number";" FI:Number";" guidDefinition[Guid] ";" "STRING_TOKEN" "\(" DP:Number "\)"
+ << $Value.ref = _STOR(QI->getText(), FI->getText(), &Guid, DP->getText()); >>
| "STRING_TOKEN" "\(" S1:Number "\)" << $Value.string = _STOSID(S1->getText()); >>
;
@@ -1251,7 +1370,8 @@ vfrFormDefinition : vfrStatementBanner |
// Just for framework vfr compatibility
vfrStatementInvalid |
- vfrStatementExtension
+ vfrStatementExtension |
+ vfrStatementModal
)*
E:EndForm <<
if (mCompatibleMode) {
@@ -1310,7 +1430,8 @@ vfrFormMapDefinition : vfrStatementConditional |
vfrStatementLabel |
vfrStatementBanner |
- vfrStatementExtension
+ vfrStatementExtension |
+ vfrStatementModal
)*
E:EndForm << CRT_END_OP (E); >>
";"
@@ -1516,7 +1637,7 @@ vfrStatementCrossReference : vfrStatementGoto :
<<
- UINT8 RefType = 1;
+ UINT8 RefType = 5;
EFI_STRING_ID DevPath = EFI_STRING_ID_INVALID;
EFI_GUID FSId = {0,};
EFI_FORM_ID FId;
@@ -1527,9 +1648,10 @@ vfrStatementGoto : CIfrRef2 *R2Obj = NULL;
CIfrRef3 *R3Obj = NULL;
CIfrRef4 *R4Obj = NULL;
+ CIfrRef5 *R5Obj = NULL;
>>
G:Goto
- (
+ {
(
DevicePath "=" "STRING_TOKEN" "\(" P:Number "\)" ","
FormSetGuid "=" guidDefinition[FSId] ","
@@ -1569,9 +1691,16 @@ vfrStatementGoto : FId = _STOFID(F4->getText());
>>
)
- )
+ }
<<
switch (RefType) {
+ case 5:
+ {
+ R5Obj = new CIfrRef5;
+ QHObj = R5Obj;
+ R5Obj->SetLineNo(G->getLine());
+ break;
+ }
case 4:
{
R4Obj = new CIfrRef4;
@@ -1613,13 +1742,13 @@ vfrStatementGoto : default: break;
}
>>
- vfrQuestionHeaderWithNoStorage[QHObj]
+ vfrQuestionHeader[*QHObj, QUESTION_REF]
{ "," vfrStatementStatTagList }
{ "," F:FLAGS "=" vfrGotoFlags[QHObj, F->getLine()] }
{
"," Key "=" KN:Number << AssignQuestionKey (*QHObj, KN); >>
}
- ";" << if (R1Obj != NULL) {delete R1Obj;} if (R2Obj != NULL) {delete R2Obj;} if (R3Obj != NULL) {delete R3Obj;} if (R4Obj != NULL) {delete R4Obj;} >>
+ ";" << if (R1Obj != NULL) {delete R1Obj;} if (R2Obj != NULL) {delete R2Obj;} if (R3Obj != NULL) {delete R3Obj;} if (R4Obj != NULL) {delete R4Obj;} if (R5Obj != NULL) {delete R5Obj;}>>
;
vfrGotoFlags [CIfrQuestionHeader *QHObj, UINT32 LineNum] :
@@ -1792,7 +1921,7 @@ checkboxFlagsField[UINT8 & LFlags, UINT8 & HFlags] : vfrStatementAction :
<< CIfrAction AObj; >>
L:Action << AObj.SetLineNo(L->getLine()); >>
- vfrQuestionHeaderWithNoStorage[&AObj] ","
+ vfrQuestionHeader[AObj] ","
{ F:FLAGS "=" vfrActionFlags[AObj, F->getLine()] "," }
Config "=" "STRING_TOKEN" "\(" S:Number "\)" "," << AObj.SetQuestionConfig (_STOSID(S->getText())); >>
vfrStatementQuestionTagList
@@ -2339,7 +2468,8 @@ vfrStatementQuestionTag : vfrStatementDisableIfQuest |
vfrStatementRefresh |
vfrStatementVarstoreDevice |
- vfrStatementExtension
+ vfrStatementExtension |
+ vfrStatementRefreshEvent
;
vfrStatementQuestionTagList :
@@ -2490,6 +2620,11 @@ vfrLockedTag : L:Locked << LObj.SetLineNo(L->getLine()); >>
;
+vfrModalTag :
+ << CIfrModal MObj; >>
+ L:Modal << MObj.SetLineNo(L->getLine()); >>
+ ;
+
vfrStatementStatTag :
vfrImageTag |
vfrLockedTag
@@ -2504,6 +2639,11 @@ vfrStatementImage : ";"
;
+vfrStatementModal :
+ vfrModalTag
+ ";"
+ ;
+
vfrStatementLocked :
vfrLockedTag
";"
@@ -2543,6 +2683,15 @@ vfrStatementRefresh : Interval "=" I:Number << RObj.SetRefreshInterval (_STOU8(I->getText())); >>
;
+vfrStatementRefreshEvent :
+ <<
+ CIfrRefreshId RiObj;
+ EFI_GUID Guid;
+ >>
+ L:RefreshGuid << RiObj.SetLineNo(L->getLine()); >>
+ "=" guidDefinition[Guid] "," << RiObj.SetRefreshEventGroutId (&Guid); >>
+ ;
+
vfrStatementVarstoreDevice :
<< CIfrVarStoreDevice VDObj; >>
L:VarstoreDevice << VDObj.SetLineNo(L->getLine()); >>
@@ -2811,6 +2960,7 @@ vfrStatementInvalidSaveRestoreDefaults : #token QuestionRefVal("questionrefval") "questionrefval"
#token StringRefVal("stringrefval") "stringrefval"
#token Map("map") "map"
+#token RefreshGuid("refreshguid") "refreshguid"
//
// Root expression extension function called by other function.
@@ -3687,6 +3837,7 @@ private: EFI_VARSTORE_INFO mCurrQestVarInfo;
+ EFI_GUID *mOverrideClassGuid;
//
// For framework vfr compatibility
@@ -3720,6 +3871,7 @@ public: UINT64 _STOU64 (IN CHAR8 *);
EFI_HII_DATE _STOD (IN CHAR8 *, IN CHAR8 *, IN CHAR8 *);
EFI_HII_TIME _STOT (IN CHAR8 *, IN CHAR8 *, IN CHAR8 *);
+ EFI_HII_REF _STOR (IN CHAR8 *, IN CHAR8 *, IN EFI_GUID *, IN CHAR8 *);
EFI_STRING_ID _STOSID (IN CHAR8 *);
EFI_FORM_ID _STOFID (IN CHAR8 *);
@@ -3737,6 +3889,7 @@ public: VOID IdEqValDoSpecial (IN UINT32 &, IN UINT32, IN EFI_QUESTION_ID, IN CHAR8 *, IN UINT32, IN UINT16, IN EFI_COMPARE_TYPE);
VOID IdEqIdDoSpecial (IN UINT32 &, IN UINT32, IN EFI_QUESTION_ID, IN CHAR8 *, IN UINT32, IN EFI_QUESTION_ID, IN CHAR8 *, IN UINT32, IN EFI_COMPARE_TYPE);
VOID IdEqListDoSpecial (IN UINT32 &, IN UINT32, IN EFI_QUESTION_ID, IN CHAR8 *, IN UINT32, IN UINT16, IN UINT16 *);
+ VOID SetOverrideClassGuid (IN EFI_GUID *);
//
// For framework vfr compatibility
//
@@ -4158,6 +4311,25 @@ EfiVfrParser::_STRCAT ( *Dest = NewStr;
}
+EFI_HII_REF
+EfiVfrParser::_STOR (
+ IN CHAR8 *QuestionId,
+ IN CHAR8 *FormId,
+ IN EFI_GUID *FormSetGuid,
+ IN CHAR8 *DevicePath
+ )
+{
+ EFI_HII_REF Ref;
+ UINT32 Index;
+
+ memcpy (&Ref.FormSetGuid, FormSetGuid, sizeof (EFI_GUID));
+ Ref.QuestionId = _STOQID (QuestionId);
+ Ref.FormId = _STOFID (FormId);
+ Ref.DevicePath = _STOSID (DevicePath);
+
+ return Ref;
+}
+
//
// framework vfr to default declare varstore for each structure
//
@@ -4225,6 +4397,9 @@ EfiVfrParser::_DeclareDefaultFrameworkVarStore ( VSEObj.SetAttributes (0x00000002); //hardcode EFI_VARIABLE_BOOTSERVICE_ACCESS attribute
VSEObj.SetGuid (&pNode->mGuid);
VSEObj.SetVarStoreId (pNode->mVarStoreId);
+ // Generate old efi varstore storage structure for compatiable with old "VarEqVal" opcode,
+ // which is 3 bytes less than new structure define in UEFI Spec 2.3.1.
+ VSEObj.SetBinaryLength (sizeof (EFI_IFR_VARSTORE_EFI) - 3);
#ifdef VFREXP_DEBUG
printf ("undefined Efi VarStoreName is %s and Id is 0x%x\n", pNode->mVarStoreName, pNode->mVarStoreId);
#endif
@@ -4523,6 +4698,12 @@ EfiVfrParser::IdEqListDoSpecial ( }
}
+VOID
+EfiVfrParser::SetOverrideClassGuid (IN EFI_GUID *OverrideClassGuid)
+{
+ mOverrideClassGuid = OverrideClassGuid;
+}
+
//
// For framework vfr compatibility
//
diff --git a/BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp b/BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp index b839a0ab0e..c3a729eabf 100644 --- a/BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp +++ b/BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp @@ -468,6 +468,7 @@ static struct { {"EFI_HII_DATE", EFI_IFR_TYPE_DATE, sizeof (EFI_HII_DATE), sizeof (UINT16)},
{"EFI_STRING_ID", EFI_IFR_TYPE_STRING, sizeof (EFI_STRING_ID),sizeof (EFI_STRING_ID)},
{"EFI_HII_TIME", EFI_IFR_TYPE_TIME, sizeof (EFI_HII_TIME), sizeof (UINT8)},
+ {"EFI_HII_REF", EFI_IFR_TYPE_REF, sizeof (EFI_HII_REF), sizeof (EFI_GUID)},
{NULL, EFI_IFR_TYPE_OTHER, 0, 0}
};
@@ -635,7 +636,7 @@ CVfrVarDataTypeDB::ExtractFieldNameAndArrary ( EFI_VFR_RETURN_CODE
CVfrVarDataTypeDB::GetTypeField (
- IN CHAR8 *FName,
+ IN CONST CHAR8 *FName,
IN SVfrDataType *Type,
OUT SVfrDataField *&Field
)
@@ -647,6 +648,20 @@ CVfrVarDataTypeDB::GetTypeField ( }
for (pField = Type->mMembers; pField != NULL; pField = pField->mNext) {
+ //
+ // For type EFI_IFR_TYPE_TIME, because field name is not correctly wrote,
+ // add code to adjust it.
+ //
+ if (Type->mType == EFI_IFR_TYPE_TIME) {
+ if (strcmp (FName, "Hour") == 0) {
+ FName = "Hours";
+ } else if (strcmp (FName, "Minute") == 0) {
+ FName = "Minuts";
+ } else if (strcmp (FName, "Second") == 0) {
+ FName = "Seconds";
+ }
+ }
+
if (strcmp (pField->mFieldName, FName) == 0) {
Field = pField;
return VFR_RETURN_SUCCESS;
@@ -789,6 +804,37 @@ CVfrVarDataTypeDB::InternalTypesListInit ( pSecondsField->mArrayNum = 0;
New->mMembers = pHoursField;
+ } else if (strcmp (gInternalTypesTable[Index].mTypeName, "EFI_HII_REF") == 0) {
+ SVfrDataField *pQuestionIdField = new SVfrDataField;
+ SVfrDataField *pFormIdField = new SVfrDataField;
+ SVfrDataField *pFormSetGuidField = new SVfrDataField;
+ SVfrDataField *pDevicePathField = new SVfrDataField;
+
+ strcpy (pQuestionIdField->mFieldName, "QuestionId");
+ GetDataType ((CHAR8 *)"UINT16", &pQuestionIdField->mFieldType);
+ pQuestionIdField->mOffset = 0;
+ pQuestionIdField->mNext = pFormIdField;
+ pQuestionIdField->mArrayNum = 0;
+
+ strcpy (pFormIdField->mFieldName, "FormId");
+ GetDataType ((CHAR8 *)"UINT16", &pFormIdField->mFieldType);
+ pFormIdField->mOffset = 2;
+ pFormIdField->mNext = pFormSetGuidField;
+ pFormIdField->mArrayNum = 0;
+
+ strcpy (pFormSetGuidField->mFieldName, "FormSetGuid");
+ GetDataType ((CHAR8 *)"EFI_GUID", &pFormSetGuidField->mFieldType);
+ pFormSetGuidField->mOffset = 4;
+ pFormSetGuidField->mNext = pDevicePathField;
+ pFormSetGuidField->mArrayNum = 0;
+
+ strcpy (pDevicePathField->mFieldName, "DevicePath");
+ GetDataType ((CHAR8 *)"EFI_STRING_ID", &pDevicePathField->mFieldType);
+ pDevicePathField->mOffset = 20;
+ pDevicePathField->mNext = NULL;
+ pDevicePathField->mArrayNum = 0;
+
+ New->mMembers = pQuestionIdField;
} else {
New->mMembers = NULL;
}
@@ -2770,6 +2816,100 @@ Err: }
}
+VOID
+CVfrQuestionDB::RegisterRefQuestion (
+ IN CHAR8 *Name,
+ IN CHAR8 *BaseVarId,
+ IN OUT EFI_QUESTION_ID &QuestionId
+ )
+{
+ SVfrQuestionNode *pNode[4] = {NULL, };
+ UINT32 Len;
+ CHAR8 *VarIdStr[4] = {NULL, };
+ CHAR8 Index;
+
+ if (BaseVarId == NULL) {
+ return;
+ }
+
+ Len = strlen (BaseVarId);
+
+ VarIdStr[0] = new CHAR8[Len + strlen (".QuestionId") + 1];
+ if (VarIdStr[0] != NULL) {
+ strcpy (VarIdStr[0], BaseVarId);
+ strcat (VarIdStr[0], ".QuestionId");
+ }
+ VarIdStr[1] = new CHAR8[Len + strlen (".FormId") + 1];
+ if (VarIdStr[1] != NULL) {
+ strcpy (VarIdStr[1], BaseVarId);
+ strcat (VarIdStr[1], ".FormId");
+ }
+ VarIdStr[2] = new CHAR8[Len + strlen (".FormSetGuid") + 1];
+ if (VarIdStr[2] != NULL) {
+ strcpy (VarIdStr[2], BaseVarId);
+ strcat (VarIdStr[2], ".FormSetGuid");
+ }
+ VarIdStr[3] = new CHAR8[Len + strlen (".DevicePath") + 1];
+ if (VarIdStr[3] != NULL) {
+ strcpy (VarIdStr[3], BaseVarId);
+ strcat (VarIdStr[3], ".DevicePath");
+ }
+
+ if ((pNode[0] = new SVfrQuestionNode (Name, VarIdStr[0])) == NULL) {
+ goto Err;
+ }
+ if ((pNode[1] = new SVfrQuestionNode (Name, VarIdStr[1])) == NULL) {
+ goto Err;
+ }
+ if ((pNode[2] = new SVfrQuestionNode (Name, VarIdStr[2])) == NULL) {
+ goto Err;
+ }
+ if ((pNode[3] = new SVfrQuestionNode (Name, VarIdStr[3])) == NULL) {
+ goto Err;
+ }
+
+ if (QuestionId == EFI_QUESTION_ID_INVALID) {
+ QuestionId = GetFreeQuestionId ();
+ } else {
+ if (ChekQuestionIdFree (QuestionId) == FALSE) {
+ goto Err;
+ }
+ MarkQuestionIdUsed (QuestionId);
+ }
+
+ pNode[0]->mQuestionId = QuestionId;
+ pNode[1]->mQuestionId = QuestionId;
+ pNode[2]->mQuestionId = QuestionId;
+ pNode[3]->mQuestionId = QuestionId;
+ pNode[0]->mQtype = QUESTION_REF;
+ pNode[1]->mQtype = QUESTION_REF;
+ pNode[2]->mQtype = QUESTION_REF;
+ pNode[3]->mQtype = QUESTION_REF;
+ pNode[0]->mNext = pNode[1];
+ pNode[1]->mNext = pNode[2];
+ pNode[2]->mNext = pNode[3];
+ pNode[3]->mNext = mQuestionList;
+ mQuestionList = pNode[0];
+
+ gCFormPkg.DoPendingAssign (VarIdStr[0], (VOID *)&QuestionId, sizeof(EFI_QUESTION_ID));
+ gCFormPkg.DoPendingAssign (VarIdStr[1], (VOID *)&QuestionId, sizeof(EFI_QUESTION_ID));
+ gCFormPkg.DoPendingAssign (VarIdStr[2], (VOID *)&QuestionId, sizeof(EFI_QUESTION_ID));
+ gCFormPkg.DoPendingAssign (VarIdStr[3], (VOID *)&QuestionId, sizeof(EFI_QUESTION_ID));
+
+ return;
+
+ Err:
+ for (Index = 0; Index < 4; Index++) {
+ if (pNode[Index] != NULL) {
+ delete pNode[Index];
+ }
+
+ if (VarIdStr[Index] != NULL) {
+ delete VarIdStr[Index];
+ }
+ }
+}
+
EFI_VFR_RETURN_CODE
CVfrQuestionDB::UpdateQuestionId (
IN EFI_QUESTION_ID QId,
@@ -2894,6 +3034,402 @@ CVfrQuestionDB::FindQuestion ( return VFR_RETURN_UNDEFINED;
}
+CVfrStringDB::CVfrStringDB ()
+{
+ mStringFileName = NULL;
+}
+
+CVfrStringDB::~CVfrStringDB ()
+{
+ if (mStringFileName != NULL) {
+ delete mStringFileName;
+ }
+ mStringFileName = NULL;
+}
+
+
+VOID
+CVfrStringDB::SetStringFileName(IN CHAR8 *StringFileName)
+{
+ UINT32 FileLen = 0;
+
+ if (StringFileName == NULL) {
+ return;
+ }
+
+ FileLen = strlen (StringFileName) + 1;
+ mStringFileName = new CHAR8[FileLen];
+ if (mStringFileName == NULL) {
+ return;
+ }
+
+ strcpy (mStringFileName, StringFileName);
+ mStringFileName[FileLen - 1] = '\0';
+}
+
+CHAR8 *
+CVfrStringDB::GetVarStoreNameFormStringId (
+ IN EFI_STRING_ID StringId
+ )
+{
+ FILE *pInFile = NULL;
+ UINT32 NameOffset;
+ UINT32 Length;
+ UINT8 *StringPtr;
+ CHAR8 *StringName;
+ CHAR16 *UnicodeString;
+ CHAR8 *VarStoreName = NULL;
+ CHAR8 *DestTmp;
+ UINT8 *Current;
+ EFI_STATUS Status;
+ CHAR8 LineBuf[EFI_IFR_MAX_LENGTH];
+ UINT8 BlockType;
+ EFI_HII_STRING_PACKAGE_HDR *PkgHeader;
+
+ if (mStringFileName == '\0' ) {
+ return NULL;
+ }
+
+ if ((pInFile = fopen (mStringFileName, "rb")) == NULL) {
+ return NULL;
+ }
+
+ //
+ // Get file length.
+ //
+ fseek (pInFile, 0, SEEK_END);
+ Length = ftell (pInFile);
+ fseek (pInFile, 0, SEEK_SET);
+
+ //
+ // Get file data.
+ //
+ StringPtr = new UINT8[Length];
+ if (StringPtr == NULL) {
+ fclose (pInFile);
+ return NULL;
+ }
+ fread ((char *)StringPtr, sizeof (UINT8), Length, pInFile);
+ fclose (pInFile);
+
+ PkgHeader = (EFI_HII_STRING_PACKAGE_HDR *) StringPtr;
+ //
+ // Check the String package.
+ //
+ if (PkgHeader->Header.Type != EFI_HII_PACKAGE_STRINGS) {
+ delete StringPtr;
+ return NULL;
+ }
+
+ //
+ // Search the language, only search the "en-US".
+ //
+ Current = StringPtr;
+ while (strcmp (PkgHeader->Language, "en-US") != 0) {
+ Current += PkgHeader->Header.Length;
+ PkgHeader = (EFI_HII_STRING_PACKAGE_HDR *) Current;
+ //
+ // If can't find "en-US" string package, just return the first string package.
+ //
+ if (Current - StringPtr >= Length) {
+ Current = StringPtr;
+ break;
+ }
+ }
+
+ Current += PkgHeader->HdrSize;
+ //
+ // Find the string block according the stringId.
+ //
+ Status = FindStringBlock(Current, StringId, &NameOffset, &BlockType);
+ if (Status != EFI_SUCCESS) {
+ delete StringPtr;
+ return NULL;
+ }
+
+ //
+ // Get varstore name according the string type.
+ //
+ switch (BlockType) {
+ case EFI_HII_SIBT_STRING_SCSU:
+ case EFI_HII_SIBT_STRING_SCSU_FONT:
+ case EFI_HII_SIBT_STRINGS_SCSU:
+ case EFI_HII_SIBT_STRINGS_SCSU_FONT:
+ StringName = (CHAR8*)(Current + NameOffset);
+ VarStoreName = new CHAR8[strlen(StringName) + 1];
+ strcpy (VarStoreName, StringName);
+ break;
+ case EFI_HII_SIBT_STRING_UCS2:
+ case EFI_HII_SIBT_STRING_UCS2_FONT:
+ case EFI_HII_SIBT_STRINGS_UCS2:
+ case EFI_HII_SIBT_STRINGS_UCS2_FONT:
+ UnicodeString = (CHAR16*)(Current + NameOffset);
+ Length = GetUnicodeStringTextSize ((UINT8*)UnicodeString) ;
+ DestTmp = new CHAR8[Length / 2 + 1];
+ VarStoreName = DestTmp;
+ while (*UnicodeString != '\0') {
+ *(DestTmp++) = (CHAR8) *(UnicodeString++);
+ }
+ *DestTmp = '\0';
+ break;
+ default:
+ break;
+ }
+
+ delete StringPtr;
+
+ return VarStoreName;
+}
+
+EFI_STATUS
+CVfrStringDB::FindStringBlock (
+ IN UINT8 *StringData,
+ IN EFI_STRING_ID StringId,
+ OUT UINT32 *StringTextOffset,
+ OUT UINT8 *BlockType
+ )
+{
+ UINT8 *BlockHdr;
+ EFI_STRING_ID CurrentStringId;
+ UINT32 BlockSize;
+ UINT32 Index;
+ UINT8 *StringTextPtr;
+ UINT32 Offset;
+ UINT16 StringCount;
+ UINT16 SkipCount;
+ UINT8 Length8;
+ EFI_HII_SIBT_EXT2_BLOCK Ext2;
+ UINT32 Length32;
+ UINT32 StringSize;
+
+ CurrentStringId = 1;
+
+ //
+ // Parse the string blocks to get the string text and font.
+ //
+ BlockHdr = StringData;
+ BlockSize = 0;
+ Offset = 0;
+ while (*BlockHdr != EFI_HII_SIBT_END) {
+ switch (*BlockHdr) {
+ case EFI_HII_SIBT_STRING_SCSU:
+ Offset = sizeof (EFI_HII_STRING_BLOCK);
+ StringTextPtr = BlockHdr + Offset;
+ BlockSize += Offset + strlen ((CHAR8 *) StringTextPtr) + 1;
+ CurrentStringId++;
+ break;
+
+ case EFI_HII_SIBT_STRING_SCSU_FONT:
+ Offset = sizeof (EFI_HII_SIBT_STRING_SCSU_FONT_BLOCK) - sizeof (UINT8);
+ StringTextPtr = BlockHdr + Offset;
+ BlockSize += Offset + strlen ((CHAR8 *) StringTextPtr) + 1;
+ CurrentStringId++;
+ break;
+
+ case EFI_HII_SIBT_STRINGS_SCSU:
+ memcpy (&StringCount, BlockHdr + sizeof (EFI_HII_STRING_BLOCK), sizeof (UINT16));
+ StringTextPtr = BlockHdr + sizeof (EFI_HII_SIBT_STRINGS_SCSU_BLOCK) - sizeof (UINT8);
+ BlockSize += StringTextPtr - BlockHdr;
+
+ for (Index = 0; Index < StringCount; Index++) {
+ BlockSize += strlen ((CHAR8 *) StringTextPtr) + 1;
+ if (CurrentStringId == StringId) {
+ *BlockType = *BlockHdr;
+ *StringTextOffset = StringTextPtr - StringData;
+ return EFI_SUCCESS;
+ }
+ StringTextPtr = StringTextPtr + strlen ((CHAR8 *) StringTextPtr) + 1;
+ CurrentStringId++;
+ }
+ break;
+
+ case EFI_HII_SIBT_STRINGS_SCSU_FONT:
+ memcpy (
+ &StringCount,
+ BlockHdr + sizeof (EFI_HII_STRING_BLOCK) + sizeof (UINT8),
+ sizeof (UINT16)
+ );
+ StringTextPtr = BlockHdr + sizeof (EFI_HII_SIBT_STRINGS_SCSU_FONT_BLOCK) - sizeof (UINT8);
+ BlockSize += StringTextPtr - BlockHdr;
+
+ for (Index = 0; Index < StringCount; Index++) {
+ BlockSize += strlen ((CHAR8 *) StringTextPtr) + 1;
+ if (CurrentStringId == StringId) {
+ *BlockType = *BlockHdr;
+ *StringTextOffset = StringTextPtr - StringData;
+ return EFI_SUCCESS;
+ }
+ StringTextPtr = StringTextPtr + strlen ((CHAR8 *) StringTextPtr) + 1;
+ CurrentStringId++;
+ }
+ break;
+
+ case EFI_HII_SIBT_STRING_UCS2:
+ Offset = sizeof (EFI_HII_STRING_BLOCK);
+ StringTextPtr = BlockHdr + Offset;
+ //
+ // Use StringSize to store the size of the specified string, including the NULL
+ // terminator.
+ //
+ StringSize = GetUnicodeStringTextSize (StringTextPtr);
+ BlockSize += Offset + StringSize;
+ CurrentStringId++;
+ break;
+
+ case EFI_HII_SIBT_STRING_UCS2_FONT:
+ Offset = sizeof (EFI_HII_SIBT_STRING_UCS2_FONT_BLOCK) - sizeof (CHAR16);
+ StringTextPtr = BlockHdr + Offset;
+ //
+ // Use StrSize to store the size of the specified string, including the NULL
+ // terminator.
+ //
+ StringSize = GetUnicodeStringTextSize (StringTextPtr);
+ BlockSize += Offset + StringSize;
+ CurrentStringId++;
+ break;
+
+ case EFI_HII_SIBT_STRINGS_UCS2:
+ Offset = sizeof (EFI_HII_SIBT_STRINGS_UCS2_BLOCK) - sizeof (CHAR16);
+ StringTextPtr = BlockHdr + Offset;
+ BlockSize += Offset;
+ memcpy (&StringCount, BlockHdr + sizeof (EFI_HII_STRING_BLOCK), sizeof (UINT16));
+ for (Index = 0; Index < StringCount; Index++) {
+ StringSize = GetUnicodeStringTextSize (StringTextPtr);
+ BlockSize += StringSize;
+ if (CurrentStringId == StringId) {
+ *BlockType = *BlockHdr;
+ *StringTextOffset = StringTextPtr - StringData;
+ return EFI_SUCCESS;
+ }
+ StringTextPtr = StringTextPtr + StringSize;
+ CurrentStringId++;
+ }
+ break;
+
+ case EFI_HII_SIBT_STRINGS_UCS2_FONT:
+ Offset = sizeof (EFI_HII_SIBT_STRINGS_UCS2_FONT_BLOCK) - sizeof (CHAR16);
+ StringTextPtr = BlockHdr + Offset;
+ BlockSize += Offset;
+ memcpy (
+ &StringCount,
+ BlockHdr + sizeof (EFI_HII_STRING_BLOCK) + sizeof (UINT8),
+ sizeof (UINT16)
+ );
+ for (Index = 0; Index < StringCount; Index++) {
+ StringSize = GetUnicodeStringTextSize (StringTextPtr);
+ BlockSize += StringSize;
+ if (CurrentStringId == StringId) {
+ *BlockType = *BlockHdr;
+ *StringTextOffset = StringTextPtr - StringData;
+ return EFI_SUCCESS;
+ }
+ StringTextPtr = StringTextPtr + StringSize;
+ CurrentStringId++;
+ }
+ break;
+
+ case EFI_HII_SIBT_DUPLICATE:
+ if (CurrentStringId == StringId) {
+ //
+ // Incoming StringId is an id of a duplicate string block.
+ // Update the StringId to be the previous string block.
+ // Go back to the header of string block to search.
+ //
+ memcpy (
+ &StringId,
+ BlockHdr + sizeof (EFI_HII_STRING_BLOCK),
+ sizeof (EFI_STRING_ID)
+ );
+ CurrentStringId = 1;
+ BlockSize = 0;
+ } else {
+ BlockSize += sizeof (EFI_HII_SIBT_DUPLICATE_BLOCK);
+ CurrentStringId++;
+ }
+ break;
+
+ case EFI_HII_SIBT_SKIP1:
+ SkipCount = (UINT16) (*(BlockHdr + sizeof (EFI_HII_STRING_BLOCK)));
+ CurrentStringId = (UINT16) (CurrentStringId + SkipCount);
+ BlockSize += sizeof (EFI_HII_SIBT_SKIP1_BLOCK);
+ break;
+
+ case EFI_HII_SIBT_SKIP2:
+ memcpy (&SkipCount, BlockHdr + sizeof (EFI_HII_STRING_BLOCK), sizeof (UINT16));
+ CurrentStringId = (UINT16) (CurrentStringId + SkipCount);
+ BlockSize += sizeof (EFI_HII_SIBT_SKIP2_BLOCK);
+ break;
+
+ case EFI_HII_SIBT_EXT1:
+ memcpy (
+ &Length8,
+ BlockHdr + sizeof (EFI_HII_STRING_BLOCK) + sizeof (UINT8),
+ sizeof (UINT8)
+ );
+ BlockSize += Length8;
+ break;
+
+ case EFI_HII_SIBT_EXT2:
+ memcpy (&Ext2, BlockHdr, sizeof (EFI_HII_SIBT_EXT2_BLOCK));
+ BlockSize += Ext2.Length;
+ break;
+
+ case EFI_HII_SIBT_EXT4:
+ memcpy (
+ &Length32,
+ BlockHdr + sizeof (EFI_HII_STRING_BLOCK) + sizeof (UINT8),
+ sizeof (UINT32)
+ );
+
+ BlockSize += Length32;
+ break;
+
+ default:
+ break;
+ }
+
+ if (StringId > 0 && StringId != (EFI_STRING_ID)(-1)) {
+ *StringTextOffset = BlockHdr - StringData + Offset;
+ *BlockType = *BlockHdr;
+
+ if (StringId == CurrentStringId - 1) {
+ //
+ // if only one skip item, return EFI_NOT_FOUND.
+ //
+ if(*BlockType == EFI_HII_SIBT_SKIP2 || *BlockType == EFI_HII_SIBT_SKIP1) {
+ return EFI_NOT_FOUND;
+ } else {
+ return EFI_SUCCESS;
+ }
+ }
+
+ if (StringId < CurrentStringId - 1) {
+ return EFI_NOT_FOUND;
+ }
+ }
+ BlockHdr = StringData + BlockSize;
+ }
+
+ return EFI_NOT_FOUND;
+}
+
+UINT32
+CVfrStringDB::GetUnicodeStringTextSize (
+ IN UINT8 *StringSrc
+ )
+{
+ UINT32 StringSize;
+ CHAR16 *StringPtr;
+
+ StringSize = sizeof (CHAR16);
+ StringPtr = (UINT16*)StringSrc;
+ while (*StringPtr++ != L'\0') {
+ StringSize += sizeof (CHAR16);
+ }
+
+ return StringSize;
+}
+
BOOLEAN VfrCompatibleMode = FALSE;
CVfrVarDataTypeDB gCVfrVarDataTypeDB;
diff --git a/BaseTools/Source/C/VfrCompile/VfrUtilityLib.h b/BaseTools/Source/C/VfrCompile/VfrUtilityLib.h index b921115b0a..9facce8149 100644 --- a/BaseTools/Source/C/VfrCompile/VfrUtilityLib.h +++ b/BaseTools/Source/C/VfrCompile/VfrUtilityLib.h @@ -175,7 +175,7 @@ private: VOID RegisterNewType (IN SVfrDataType *);
EFI_VFR_RETURN_CODE ExtractStructTypeName (IN CHAR8 *&, OUT CHAR8 *);
- EFI_VFR_RETURN_CODE GetTypeField (IN CHAR8 *, IN SVfrDataType *, IN SVfrDataField *&);
+ EFI_VFR_RETURN_CODE GetTypeField (IN CONST CHAR8 *, IN SVfrDataType *, IN SVfrDataField *&);
EFI_VFR_RETURN_CODE GetFieldOffset (IN SVfrDataField *, IN UINT32, OUT UINT32 &);
UINT8 GetFieldWidth (IN SVfrDataField *);
UINT32 GetFieldSize (IN SVfrDataField *, IN UINT32);
@@ -359,6 +359,7 @@ public: VOID RegisterNewDateQuestion (IN CHAR8 *, IN CHAR8 *, IN OUT EFI_QUESTION_ID &);
VOID RegisterOldTimeQuestion (IN CHAR8 *, IN CHAR8 *, IN CHAR8 *, IN OUT EFI_QUESTION_ID &);
VOID RegisterNewTimeQuestion (IN CHAR8 *, IN CHAR8 *, IN OUT EFI_QUESTION_ID &);
+ VOID RegisterRefQuestion (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 &, OUT EFI_QUESION_TYPE *QType = NULL);
EFI_VFR_RETURN_CODE FindQuestion (IN EFI_QUESTION_ID);
@@ -423,4 +424,33 @@ public: UINT8 GetRuleId (IN CHAR8 *);
};
+class CVfrStringDB {
+private:
+ CHAR8 *mStringFileName;
+
+ EFI_STATUS FindStringBlock (
+ IN UINT8 *StringData,
+ IN EFI_STRING_ID StringId,
+ OUT UINT32 *StringTextOffset,
+ OUT UINT8 *BlockType
+ );
+
+ UINT32 GetUnicodeStringTextSize (
+ IN UINT8 *StringSrc
+ );
+
+public:
+ CVfrStringDB ();
+ ~CVfrStringDB ();
+
+ VOID SetStringFileName (
+ IN CHAR8 *StringFileName
+ );
+
+ CHAR8 * GetVarStoreNameFormStringId (
+ IN EFI_STRING_ID StringId
+ );
+
+};
+
#endif
|