Sync BaseTool trunk (version r2599) into EDKII BaseTools.

Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Heshen Chen <chen.heshen@intel.com>


git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14591 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
Liming Gao 2013-08-23 02:18:16 +00:00 committed by lgao4
parent a365eed476
commit 4afd3d0422
136 changed files with 5524 additions and 2478 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -301,8 +301,8 @@
-$(CP) $(DEBUG_DIR)(+)*.map $(OUTPUT_DIR)
<Command.GCC>
$(OBJCOPY) --only-keep-debug ${src} $(DEBUG_DIR)(+)$(MODULE_NAME).debug
$(OBJCOPY) --strip-unneeded ${src}
$(CP) ${src} $(DEBUG_DIR)(+)$(MODULE_NAME).debug
$(OBJCOPY) --strip-unneeded -R .eh_frame ${src}
#
#The below 2 lines are only needed for UNIXGCC tool chain, which genereates PE image directly

View File

@ -34,7 +34,8 @@ ACTIVE_PLATFORM = Nt32Pkg/Nt32Pkg.dsc
TARGET = DEBUG
# TARGET_ARCH List Optional What kind of architecture is the binary being target for.
# One, or more, of the following, IA32, IPF, X64, EBC or ARM.
# One, or more, of the following, IA32, IPF, X64, EBC, ARM
# or AArch64.
# Multiple values can be specified on a single line, using
# space charaters to separate the values. These are used
# during the parsing of a platform description file,

File diff suppressed because it is too large Load Diff

188
BaseTools/Contributions.txt Normal file
View File

@ -0,0 +1,188 @@
======================
= Code Contributions =
======================
To make a contribution to a TianoCore project, follow these steps.
1. Create a change description in the format specified below to
use in the source control commit log.
2. Your commit message must include your "Signed-off-by" signature,
and "Contributed-under" message.
3. Your "Contributed-under" message explicitly states that the
contribution is made under the terms of the specified
contribution agreement. Your "Contributed-under" message
must include the name of contribution agreement and version.
For example: Contributed-under: TianoCore Contribution Agreement 1.0
The "TianoCore Contribution Agreement" is included below in
this document.
4. Submit your code to the TianoCore project using the process
that the project documents on its web page. If the process is
not documented, then submit the code on development email list
for the project.
=======================================
= Change Description / Commit Message =
=======================================
Your change description should use the standard format for a
commit message, and must include your "Signed-off-by" signature
and the "Contributed-under" message.
== Sample Change Description / Commit Message =
=== Definitions for sample change description ===
* "CodeModule" is a short idenfier for the affected code. For
example MdePkg, or MdeModulePkg UsbBusDxe.
* "Brief-single-line-summary" is a short summary of the change.
* The entire first line should be less than ~70 characters.
* "Full-commit-message" a verbose multiple line comment describing
the change. Each line should be less than ~70 characters.
* "Contributed-under" explicitely states that the contribution is
made under the terms of the contribtion agreement. This
agreement is included below in this document.
* "Signed-off-by" is the contributor's signature identifying them
by their real/legal name and their email address.
=== Start of sample change description / commit message ===
CodeModule: Brief-single-line-summary
Full-commit-message
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Contributor Name <contributor@email.server>
=== End of sample change description / commit message ===
========================================
= TianoCore Contribution Agreement 1.0 =
========================================
INTEL CORPORATION ("INTEL") MAKES AVAILABLE SOFTWARE, DOCUMENTATION,
INFORMATION AND/OR OTHER MATERIALS FOR USE IN THE TIANOCORE OPEN SOURCE
PROJECT (COLLECTIVELY "CONTENT"). USE OF THE CONTENT IS GOVERNED BY THE
TERMS AND CONDITIONS OF THIS AGREEMENT BETWEEN YOU AND INTEL AND/OR THE
TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR
REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE OF THE
CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS
OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED
BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS
AGREEMENT AND THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE
AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT
USE THE CONTENT.
Unless otherwise indicated, all Content made available on the TianoCore
site is provided to you under the terms and conditions of the BSD
License ("BSD"). A copy of the BSD License is available at
http://opensource.org/licenses/bsd-license.php
or when applicable, in the associated License.txt file.
Certain other content may be made available under other licenses as
indicated in or with such Content. (For example, in a License.txt file.)
You accept and agree to the following terms and conditions for Your
present and future Contributions submitted to TianoCore site. Except
for the license granted to Intel hereunder, You reserve all right,
title, and interest in and to Your Contributions.
== SECTION 1: Definitions ==
* "You" or "Contributor" shall mean the copyright owner or legal
entity authorized by the copyright owner that is making a
Contribution hereunder. All other entities that control, are
controlled by, or are under common control with that entity are
considered to be a single Contributor. For the purposes of this
definition, "control" means (i) the power, direct or indirect, to
cause the direction or management of such entity, whether by
contract or otherwise, or (ii) ownership of fifty percent (50%)
or more of the outstanding shares, or (iii) beneficial ownership
of such entity.
* "Contribution" shall mean any original work of authorship,
including any modifications or additions to an existing work,
that is intentionally submitted by You to the TinaoCore site for
inclusion in, or documentation of, any of the Content. For the
purposes of this definition, "submitted" means any form of
electronic, verbal, or written communication sent to the
TianoCore site or its representatives, including but not limited
to communication on electronic mailing lists, source code
control systems, and issue tracking systems that are managed by,
or on behalf of, the TianoCore site for the purpose of
discussing and improving the Content, but excluding
communication that is conspicuously marked or otherwise
designated in writing by You as "Not a Contribution."
== SECTION 2: License for Contributions ==
* Contributor hereby agrees that redistribution and use of the
Contribution in source and binary forms, with or without
modification, are permitted provided that the following
conditions are met:
** Redistributions of source code must retain the Contributor's
copyright notice, this list of conditions and the following
disclaimer.
** Redistributions in binary form must reproduce the Contributor's
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
* Disclaimer. None of the names of Contributor, Intel, or the names
of their respective contributors may be used to endorse or
promote products derived from this software without specific
prior written permission.
* Contributor grants a license (with the right to sublicense) under
claims of Contributor's patents that Contributor can license that
are infringed by the Contribution (as delivered by Contributor) to
make, use, distribute, sell, offer for sale, and import the
Contribution and derivative works thereof solely to the minimum
extent necessary for licensee to exercise the granted copyright
license; this patent license applies solely to those portions of
the Contribution that are unmodified. No hardware per se is
licensed.
* EXCEPT AS EXPRESSLY SET FORTH IN SECTION 3 BELOW, THE
CONTRIBUTION IS PROVIDED BY THE CONTRIBUTOR "AS IS" AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
CONTRIBUTOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THE
CONTRIBUTION, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
DAMAGE.
== SECTION 3: Representations ==
* You represent that You are legally entitled to grant the above
license. If your employer(s) has rights to intellectual property
that You create that includes Your Contributions, You represent
that You have received permission to make Contributions on behalf
of that employer, that Your employer has waived such rights for
Your Contributions.
* You represent that each of Your Contributions is Your original
creation (see Section 4 for submissions on behalf of others).
You represent that Your Contribution submissions include complete
details of any third-party license or other restriction
(including, but not limited to, related patents and trademarks)
of which You are personally aware and which are associated with
any part of Your Contributions.
== SECTION 4: Third Party Contributions ==
* Should You wish to submit work that is not Your original creation,
You may submit it to TianoCore site separately from any
Contribution, identifying the complete details of its source
and of any license or other restriction (including, but not
limited to, related patents, trademarks, and license agreements)
of which You are personally aware, and conspicuously marking the
work as "Submitted on behalf of a third-party: [named here]".
== SECTION 5: Miscellaneous ==
* Applicable Laws. Any claims arising under or relating to this
Agreement shall be governed by the internal substantive laws of
the State of Delaware or federal courts located in Delaware,
without regard to principles of conflict of laws.
* Language. This Agreement is in the English language only, which
language shall be controlling in all respects, and all versions
of this Agreement in any other language shall be for accommodation
only and shall not be binding. All communications and notices made
or given pursuant to this Agreement, and all documentation and
support to be provided, unless otherwise noted, shall be in the
English language.

View File

@ -1,5 +1,5 @@
## @file
# Windows makefile for Base Tools project build.
# GNU/Linux makefile for Base Tools project build.
#
# Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
# This program and the accompanying materials

25
BaseTools/License.txt Normal file
View File

@ -0,0 +1,25 @@
Copyright (c) 2013, Intel Corporation. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.

View File

@ -33,7 +33,7 @@ the base directory of the project.
On Ubuntu, the following command should install all the necessary build
packages to build all the C BaseTools:
sudo apt-get install build-essentials uuid-dev
sudo apt-get install build-essential uuid-dev
=== Python sqlite3 module ===
On Windows, the cx_freeze will not copy the sqlite3.dll to the frozen
@ -43,10 +43,4 @@ Please copy it manually from <PythonHome>\DLLs.
The Python distributed with most recent Linux will have sqlite3 module
built in. If not, please install sqlit3 package separately.
2. The binary tools will be updated only after passing developer testing.
Current state of the tools is Proto-Type - not all tool functions have been implemented
and there may be bugs in these tools. These tools are under constant development at
this time.
26-OCT-2011

View File

@ -18,6 +18,10 @@ SECTIONS
)
. = ALIGN(0x20);
}
.eh_frame ALIGN(0x20) :
{
KEEP (*(.eh_frame))
}
.got ALIGN(0x20) :
{
*(.got .got.*)

View File

@ -1,5 +1,5 @@
## @file
# Windows makefile for 'BootSectImage' module build.
# GNU/Linux makefile for 'BootSectImage' module build.
#
# Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
# This program and the accompanying materials

View File

@ -3,6 +3,7 @@
Functions to get info and load PE/COFF image.
Copyright (c) 2004 - 2010, Intel Corporation. All rights reserved.<BR>
Portions Copyright (c) 2011 - 2013, ARM Ltd. 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
@ -79,6 +80,14 @@ PeCoffLoaderRelocateArmImage (
IN UINT64 Adjust
);
RETURN_STATUS
PeCoffLoaderRelocateAArch64Image (
IN UINT16 *Reloc,
IN OUT CHAR8 *Fixup,
IN OUT CHAR8 **FixupData,
IN UINT64 Adjust
);
STATIC
RETURN_STATUS
PeCoffLoaderGetPeHeader (
@ -194,7 +203,8 @@ Returns:
ImageContext->Machine != EFI_IMAGE_MACHINE_IA64 && \
ImageContext->Machine != EFI_IMAGE_MACHINE_X64 && \
ImageContext->Machine != EFI_IMAGE_MACHINE_ARMT && \
ImageContext->Machine != EFI_IMAGE_MACHINE_EBC) {
ImageContext->Machine != EFI_IMAGE_MACHINE_EBC && \
ImageContext->Machine != EFI_IMAGE_MACHINE_AARCH64) {
if (ImageContext->Machine == IMAGE_FILE_MACHINE_ARM) {
//
// There are two types of ARM images. Pure ARM and ARM/Thumb.
@ -791,6 +801,9 @@ Returns:
case EFI_IMAGE_MACHINE_IA64:
Status = PeCoffLoaderRelocateIpfImage (Reloc, Fixup, &FixupData, Adjust);
break;
case EFI_IMAGE_MACHINE_AARCH64:
Status = PeCoffLoaderRelocateAArch64Image (Reloc, Fixup, &FixupData, Adjust);
break;
default:
Status = RETURN_UNSUPPORTED;
break;

View File

@ -1,5 +1,5 @@
## @file
# Windows makefile for 'Common' module build.
# GNU/Linux makefile for 'Common' module build.
#
# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
# This program and the accompanying materials

View File

@ -1,6 +1,7 @@
/** @file
Copyright (c) 2004 - 2008, Intel Corporation. All rights reserved.<BR>
Portions Copyright (c) 2011 - 2013, ARM Ltd. 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
@ -15,7 +16,7 @@ Module Name:
Abstract:
IA32, X64 and IPF Specific relocation fixups
IA32, X64, IPF, ARM and AArch64 Specific relocation fixups
Revision History
@ -25,6 +26,7 @@ Revision History
#include <IndustryStandard/PeImage.h>
#include "PeCoffLib.h"
#include "CommonLib.h"
#include "EfiUtilityMsgs.h"
#define EXT_IMM64(Value, Address, Size, InstPos, ValPos) \
@ -472,3 +474,43 @@ PeCoffLoaderRelocateArmImage (
return RETURN_SUCCESS;
}
RETURN_STATUS
PeCoffLoaderRelocateAArch64Image (
IN UINT16 *Reloc,
IN OUT CHAR8 *Fixup,
IN OUT CHAR8 **FixupData,
IN UINT64 Adjust
)
/**
Performs an AArch64 specific relocation fixup
@param Reloc Pointer to the relocation record
@param Fixup Pointer to the address to fix up
@param FixupData Pointer to a buffer to log the fixups
@param Adjust The offset to adjust the fixup
@retval RETURN_SUCCESS Success to perform relocation
@retval RETURN_UNSUPPORTED Unsupported.
**/
{
UINT64 *F64;
switch ((*Reloc) >> 12) {
case EFI_IMAGE_REL_BASED_DIR64:
F64 = (UINT64 *) Fixup;
*F64 = *F64 + (UINT64) Adjust;
if (*FixupData != NULL) {
*FixupData = ALIGN_POINTER(*FixupData, sizeof(UINT64));
*(UINT64 *)(*FixupData) = *F64;
*FixupData = *FixupData + sizeof(UINT64);
}
break;
default:
return RETURN_UNSUPPORTED;
}
return RETURN_SUCCESS;
}

View File

@ -1,5 +1,5 @@
## @file
# Windows makefile for 'EfiLdrImage' module build.
# GNU/Linux makefile for 'EfiLdrImage' module build.
#
# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
# This program and the accompanying materials

View File

@ -1,5 +1,5 @@
## @file
# Windows makefile for 'EfiRom' module build.
# GNU/Linux makefile for 'EfiRom' module build.
#
# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
# This program and the accompanying materials

View File

@ -1,5 +1,5 @@
## @file
# GNU Make makefile for C tools build.
# GNU/Linux makefile for C tools build.
#
# Copyright (c) 2007 - 2012, Intel Corporation. All rights reserved.<BR>
#

View File

@ -1,6 +1,6 @@
/** @file
Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2006 - 2013, 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
@ -542,8 +542,7 @@ Returns:
--*/
{
printf ("%s v%d.%d %s -Utility to retrieve and update the boot sector or MBR.\n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION, __BUILD_VERSION);
printf ("Copyright (c) 2009 - 2010 Intel Corporation. All rights reserved.\n");
printf ("%s Version %d.%d Build%s\n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION, __BUILD_VERSION);
}
VOID
@ -551,18 +550,27 @@ PrintUsage (
void
)
{
Version();
printf ("\nUsage: \n\
GenBootSector\n\
[-l, --list list disks]\n\
[-i, --input Filename]\n\
[-o, --output Filename]\n\
[-m, --mbr process the MBR also]\n\
[-v, --verbose]\n\
[--version]\n\
[-q, --quiet disable all messages except fatal errors]\n\
[-d, --debug[#]\n\
[-h, --help]\n");
printf ("Usage: GenBootSector [options] --cfg-file CFG_FILE\n\n\
Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved.\n\n\
Utility to retrieve and update the boot sector or MBR.\n\n\
optional arguments:\n\
-h, --help Show this help message and exit\n\
--version Show program's version number and exit\n\
-d [DEBUG], --debug [DEBUG]\n\
Output DEBUG statements, where DEBUG_LEVEL is 0 (min)\n\
- 9 (max)\n\
-v, --verbose Print informational statements\n\
-q, --quiet Returns the exit code, error messages will be\n\
displayed\n\
-s, --silent Returns only the exit code; informational and error\n\
messages are not displayed\n\
-l, --list List disk drives\n\
-i INPUT_FILENAME, --input INPUT_FILENAME\n\
Input file name\n\
-o OUTPUT_FILENAME, --output OUTPUT_FILENAME\n\
Output file name\n\
-m, --mbr Also process the MBR\n\
--sfo Reserved for future use\n");
}

View File

@ -1,5 +1,5 @@
## @file
# Windows makefile for 'GenCrc32' module build.
# GNU/Linux makefile for 'GenCrc32' module build.
#
# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
# This program and the accompanying materials

View File

@ -1,6 +1,6 @@
/** @file
Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2007 - 2013, 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
@ -55,7 +55,7 @@ Returns:
--*/
{
fprintf (stdout, "%s Version %d.%d %s \n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION, __BUILD_VERSION);
fprintf (stdout, "%s Version %d.%d Build %s \n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION, __BUILD_VERSION);
}
VOID
@ -81,26 +81,32 @@ Returns:
//
// Summary usage
//
fprintf (stdout, "\nUsage: %s -e|-d [options] <input_file>\n\n", UTILITY_NAME);
fprintf (stdout, "Usage: GenCrc32 -e|-d [options] <input_file>\n\n");
//
// Copyright declaration
//
fprintf (stdout, "Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.\n\n");
fprintf (stdout, "Copyright (c) 2007 - 2013, Intel Corporation. All rights reserved.\n\n");
//
// Details Option
//
fprintf (stdout, "Options:\n");
fprintf (stdout, " -o FileName, --output FileName\n\
File will be created to store the ouput content.\n");
fprintf (stdout, " -e, --encode Calculate CRC32 value for the input file.\n");
fprintf (stdout, " -d, --decode Verify CRC32 value for the input file.\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, " --debug level Enable debug messages, at input debug level.\n");
fprintf (stdout, " --version Show program's version number and exit.\n");
fprintf (stdout, " -h, --help Show this help message and exit.\n");
fprintf (stdout, "optional arguments:\n");
fprintf (stdout, " -h, --help Show this help message and exit\n");
fprintf (stdout, " --version Show program's version number and exit\n");
fprintf (stdout, " --debug [DEBUG] Output DEBUG statements, where DEBUG_LEVEL is 0 (min)\n\
- 9 (max)\n");
fprintf (stdout, " -v, --verbose Print informational statements\n");
fprintf (stdout, " -q, --quiet Returns the exit code, error messages will be\n\
displayed\n");
fprintf (stdout, " -s, --silent Returns only the exit code; informational and error\n\
messages are not displayed\n");
fprintf (stdout, " -e, --encode Calculate CRC32 value for the input file\n");
fprintf (stdout, " -d, --decode Verify CRC32 value for the input file\n");
fprintf (stdout, " -o OUTPUT_FILENAME, --output OUTPUT_FILENAME\n\
Output file name\n");
fprintf (stdout, " --sfo Reserved for future use\n");
}
int
@ -164,7 +170,6 @@ Returns:
argv ++;
if ((stricmp (argv[0], "-h") == 0) || (stricmp (argv[0], "--help") == 0)) {
Version ();
Usage ();
return STATUS_SUCCESS;
}

View File

@ -1,5 +1,5 @@
## @file
# Windows makefile for 'GenFfs' module build.
# GNU/Linux makefile for 'GenFfs' module build.
#
# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
# This program and the accompanying materials

View File

@ -1,5 +1,5 @@
## @file
# Windows makefile for 'GenFv' module build.
# GNU/Linux makefile for 'GenFv' module build.
#
# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
# This program and the accompanying materials

View File

@ -1,6 +1,7 @@
/** @file
Copyright (c) 2004 - 2011, Intel Corporation. All rights reserved.<BR>
Portions Copyright (c) 2011 - 2013, ARM Ltd. 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
@ -1580,6 +1581,11 @@ Returns:
// Since the ARM reset vector is in the FV Header you really don't need a
// Volume Top File, but if you have one for some reason don't crash...
//
} else if (MachineType == EFI_IMAGE_MACHINE_AARCH64) {
//
// Since the AArch64 reset vector is in the FV Header you really don't need a
// Volume Top File, but if you have one for some reason don't crash...
//
} else {
Error (NULL, 0, 3000, "Invalid", "machine type=0x%X in PEI core.", MachineType);
return EFI_ABORTED;
@ -1617,9 +1623,11 @@ Routine Description:
This parses the FV looking for SEC and patches that address into the
beginning of the FV header.
For ARM the reset vector is at 0x00000000 or 0xFFFF0000.
For ARM32 the reset vector is at 0x00000000 or 0xFFFF0000.
For AArch64 the reset vector is at 0x00000000.
This would commonly map to the first entry in the ROM.
ARM Exceptions:
ARM32 Exceptions:
Reset +0
Undefined +4
SWI +8
@ -1633,11 +1641,10 @@ Routine Description:
2) Reset vector is data bytes FDF file and that code branches to reset vector
in the beginning of the FV (fixed size offset).
Need to have the jump for the reset vector at location zero.
We also need to store the address or PEI (if it exists).
We stub out a return from interrupt in case the debugger
is using SWI.
is using SWI (not done for AArch64, not enough space in struct).
The optional entry to the common exception handler is
to support full featured exception handling from ROM and is currently
not support by this tool.
@ -1664,10 +1671,14 @@ Returns:
UINT16 MachineType;
EFI_PHYSICAL_ADDRESS PeiCorePhysicalAddress;
EFI_PHYSICAL_ADDRESS SecCorePhysicalAddress;
INT32 ResetVector[4]; // 0 - is branch relative to SEC entry point
INT32 ResetVector[4]; // ARM32:
// 0 - is branch relative to SEC entry point
// 1 - PEI Entry Point
// 2 - movs pc,lr for a SWI handler
// 3 - Place holder for Common Exception Handler
// AArch64: Used as UINT64 ResetVector[2]
// 0 - is branch relative to SEC entry point
// 1 - PEI Entry Point
//
// Verify input parameters
@ -1727,7 +1738,7 @@ Returns:
PeiCorePhysicalAddress += EntryPoint;
DebugMsg (NULL, 0, 9, "PeiCore physical entry point address", "Address = 0x%llX", (unsigned long long) PeiCorePhysicalAddress);
if (MachineType == EFI_IMAGE_MACHINE_ARMT) {
if (MachineType == EFI_IMAGE_MACHINE_ARMT || MachineType == EFI_IMAGE_MACHINE_AARCH64) {
memset (ResetVector, 0, sizeof (ResetVector));
// Address of PEI Core, if we have one
ResetVector[1] = (UINT32)PeiCorePhysicalAddress;
@ -1767,7 +1778,7 @@ Returns:
return EFI_ABORTED;
}
if (MachineType != EFI_IMAGE_MACHINE_ARMT) {
if ((MachineType != EFI_IMAGE_MACHINE_ARMT) && (MachineType != EFI_IMAGE_MACHINE_AARCH64)) {
//
// If SEC is not ARM we have nothing to do
//
@ -1821,31 +1832,60 @@ Returns:
DebugMsg (NULL, 0, 9, "PeiCore physical entry point address", "Address = 0x%llX", (unsigned long long) PeiCorePhysicalAddress);
}
if (MachineType == EFI_IMAGE_MACHINE_ARMT) {
// B SecEntryPoint - signed_immed_24 part +/-32MB offset
// on ARM, the PC is always 8 ahead, so we're not really jumping from the base address, but from base address + 8
ResetVector[0] = (INT32)(SecCorePhysicalAddress - FvInfo->BaseAddress - 8) >> 2;
if (ResetVector[0] > 0x00FFFFFF) {
Error (NULL, 0, 3000, "Invalid", "SEC Entry point must be within 32MB of the start of the FV");
return EFI_ABORTED;
}
// B SecEntryPoint - signed_immed_24 part +/-32MB offset
// on ARM, the PC is always 8 ahead, so we're not really jumping from the base address, but from base address + 8
ResetVector[0] = (INT32)(SecCorePhysicalAddress - FvInfo->BaseAddress - 8) >> 2;
// Add opcode for an uncondional branch with no link. AKA B SecEntryPoint
ResetVector[0] |= 0xEB000000;
if (ResetVector[0] > 0x00FFFFFF) {
Error (NULL, 0, 3000, "Invalid", "SEC Entry point must be within 32MB of the start of the FV");
return EFI_ABORTED;
// Address of PEI Core, if we have one
ResetVector[1] = (UINT32)PeiCorePhysicalAddress;
// SWI handler movs pc,lr. Just in case a debugger uses SWI
ResetVector[2] = 0xE1B0F07E;
// Place holder to support a common interrupt handler from ROM.
// Currently not suppprted. For this to be used the reset vector would not be in this FV
// and the exception vectors would be hard coded in the ROM and just through this address
// to find a common handler in the a module in the FV.
ResetVector[3] = 0;
} else if (MachineType == EFI_IMAGE_MACHINE_AARCH64) {
/* NOTE:
ARMT above has an entry in ResetVector[2] for SWI. The way we are using the ResetVector
array at the moment, for AArch64, does not allow us space for this as the header only
allows for a fixed amount of bytes at the start. If we are sure that UEFI will live
within the first 4GB of addressable RAM we could potensioally adopt the same ResetVector
layout as above. But for the moment we replace the four 32bit vectors with two 64bit
vectors in the same area of the Image heasder. This allows UEFI to start from a 64bit
base.
*/
((UINT64*)ResetVector)[0] = (UINT64)(SecCorePhysicalAddress - FvInfo->BaseAddress) >> 2;
// B SecEntryPoint - signed_immed_26 part +/-128MB offset
if ( ((UINT64*)ResetVector)[0] > 0x03FFFFFF) {
Error (NULL, 0, 3000, "Invalid", "SEC Entry point must be within 128MB of the start of the FV");
return EFI_ABORTED;
}
// Add opcode for an uncondional branch with no link. AKA B SecEntryPoint
((UINT64*)ResetVector)[0] |= 0x14000000;
// Address of PEI Core, if we have one
((UINT64*)ResetVector)[1] = (UINT64)PeiCorePhysicalAddress;
} else {
Error (NULL, 0, 3000, "Invalid", "Unknown ARM machine type");
return EFI_ABORTED;
}
// Add opcode for an uncondional branch with no link. AKA B SecEntryPoint
ResetVector[0] |= 0xEB000000;
// Address of PEI Core, if we have one
ResetVector[1] = (UINT32)PeiCorePhysicalAddress;
// SWI handler movs pc,lr. Just in case a debugger uses SWI
ResetVector[2] = 0xE1B0F07E;
// Place holder to support a common interrupt handler from ROM.
// Currently not suppprted. For this to be used the reset vector would not be in this FV
// and the exception vectors would be hard coded in the ROM and just through this address
// to find a common handler in the a module in the FV.
ResetVector[3] = 0;
//
// Copy to the beginning of the FV
@ -1948,8 +1988,8 @@ Returns:
//
// Verify machine type is supported
//
if (*MachineType != EFI_IMAGE_MACHINE_IA32 && *MachineType != EFI_IMAGE_MACHINE_IA64 && *MachineType != EFI_IMAGE_MACHINE_X64 && *MachineType != EFI_IMAGE_MACHINE_EBC &&
*MachineType != EFI_IMAGE_MACHINE_ARMT) {
if ((*MachineType != EFI_IMAGE_MACHINE_IA32) && (*MachineType != EFI_IMAGE_MACHINE_IA64) && (*MachineType != EFI_IMAGE_MACHINE_X64) && (*MachineType != EFI_IMAGE_MACHINE_EBC) &&
(*MachineType != EFI_IMAGE_MACHINE_ARMT) && (*MachineType != EFI_IMAGE_MACHINE_AARCH64)) {
Error (NULL, 0, 3000, "Invalid", "Unrecognized machine type in the PE32 file.");
return EFI_UNSUPPORTED;
}
@ -2895,7 +2935,8 @@ Returns:
return Status;
}
if (ImageContext.Machine == EFI_IMAGE_MACHINE_ARMT) {
if ( (ImageContext.Machine == EFI_IMAGE_MACHINE_ARMT) ||
(ImageContext.Machine == EFI_IMAGE_MACHINE_AARCH64) ) {
mArm = TRUE;
}
@ -3163,7 +3204,8 @@ Returns:
return Status;
}
if (ImageContext.Machine == EFI_IMAGE_MACHINE_ARMT) {
if ( (ImageContext.Machine == EFI_IMAGE_MACHINE_ARMT) ||
(ImageContext.Machine == EFI_IMAGE_MACHINE_AARCH64) ) {
mArm = TRUE;
}

View File

@ -1,6 +1,7 @@
/** @file
Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>
Portions copyright (c) 2013, ARM Ltd. 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
@ -146,8 +147,8 @@ InitializeElf64 (
Error (NULL, 0, 3000, "Unsupported", "ELF e_type not ET_EXEC or ET_DYN");
return FALSE;
}
if (!((mEhdr->e_machine == EM_X86_64))) {
Error (NULL, 0, 3000, "Unsupported", "ELF e_machine not EM_X86_64");
if (!((mEhdr->e_machine == EM_X86_64) || (mEhdr->e_machine == EM_AARCH64))) {
Error (NULL, 0, 3000, "Unsupported", "ELF e_machine not EM_X86_64 or EM_AARCH64");
return FALSE;
}
if (mEhdr->e_version != EV_CURRENT) {
@ -269,6 +270,7 @@ ScanSections64 (
switch (mEhdr->e_machine) {
case EM_X86_64:
case EM_IA_64:
case EM_AARCH64:
mCoffOffset += sizeof (EFI_IMAGE_NT_HEADERS64);
break;
default:
@ -412,6 +414,10 @@ ScanSections64 (
NtHdr->Pe32Plus.FileHeader.Machine = EFI_IMAGE_MACHINE_IPF;
NtHdr->Pe32Plus.OptionalHeader.Magic = EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC;
break;
case EM_AARCH64:
NtHdr->Pe32Plus.FileHeader.Machine = EFI_IMAGE_MACHINE_AARCH64;
NtHdr->Pe32Plus.OptionalHeader.Magic = EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC;
break;
default:
VerboseMsg ("%s unknown e_machine type. Assume X64", (UINTN)mEhdr->e_machine);
NtHdr->Pe32Plus.FileHeader.Machine = EFI_IMAGE_MACHINE_X64;
@ -542,22 +548,55 @@ WriteSections64 (
//
VerboseMsg ("Applying Relocations...");
for (Idx = 0; Idx < mEhdr->e_shnum; Idx++) {
//
// Determine if this is a relocation section.
//
Elf_Shdr *RelShdr = GetShdrByIndex(Idx);
if ((RelShdr->sh_type != SHT_REL) && (RelShdr->sh_type != SHT_RELA)) {
continue;
}
//
// Relocation section found. Now extract section information that the relocations
// apply to in the ELF data and the new COFF data.
//
SecShdr = GetShdrByIndex(RelShdr->sh_info);
SecOffset = mCoffSectionsOffset[RelShdr->sh_info];
//
// Only process relocations for the current filter type.
//
if (RelShdr->sh_type == SHT_RELA && (*Filter)(SecShdr)) {
UINT64 RelIdx;
//
// Determine the symbol table referenced by the relocation data.
//
Elf_Shdr *SymtabShdr = GetShdrByIndex(RelShdr->sh_link);
UINT8 *Symtab = (UINT8*)mEhdr + SymtabShdr->sh_offset;
//
// Process all relocation entries for this section.
//
for (RelIdx = 0; RelIdx < RelShdr->sh_size; RelIdx += (UINT32) RelShdr->sh_entsize) {
//
// Set pointer to relocation entry
//
Elf_Rela *Rel = (Elf_Rela *)((UINT8*)mEhdr + RelShdr->sh_offset + RelIdx);
//
// Set pointer to symbol table entry associated with the relocation entry.
//
Elf_Sym *Sym = (Elf_Sym *)(Symtab + ELF_R_SYM(Rel->r_info) * SymtabShdr->sh_entsize);
Elf_Shdr *SymShdr;
UINT8 *Targ;
//
// Check section header index found in symbol table and get the section
// header location.
//
if (Sym->st_shndx == SHN_UNDEF
|| Sym->st_shndx == SHN_ABS
|| Sym->st_shndx > mEhdr->e_shnum) {
@ -566,11 +605,20 @@ WriteSections64 (
SymShdr = GetShdrByIndex(Sym->st_shndx);
//
// Note: r_offset in a memory address.
// Convert it to a pointer in the coff file.
// Convert the relocation data to a pointer into the coff file.
//
// Note:
// r_offset is the virtual address of the storage unit to be relocated.
// sh_addr is the virtual address for the base of the section.
//
// r_offset in a memory address.
// Convert it to a pointer in the coff file.
//
Targ = mCoffFile + SecOffset + (Rel->r_offset - SecShdr->sh_addr);
//
// Determine how to handle each relocation type based on the machine type.
//
if (mEhdr->e_machine == EM_X86_64) {
switch (ELF_R_TYPE(Rel->r_info)) {
case R_X86_64_NONE:
@ -618,8 +666,51 @@ WriteSections64 (
default:
Error (NULL, 0, 3000, "Invalid", "%s unsupported ELF EM_X86_64 relocation 0x%x.", mInImageName, (unsigned) ELF_R_TYPE(Rel->r_info));
}
} else if (mEhdr->e_machine == EM_AARCH64) {
// AARCH64 GCC uses RELA relocation, so all relocations have to be fixed up.
// As opposed to ARM32 using REL.
switch (ELF_R_TYPE(Rel->r_info)) {
case R_AARCH64_LD_PREL_LO19:
if (Rel->r_addend != 0 ) { /* TODO */
Error (NULL, 0, 3000, "Invalid", "AArch64: R_AARCH64_LD_PREL_LO19 Need to fixup with addend!.");
}
break;
case R_AARCH64_CALL26:
if (Rel->r_addend != 0 ) { /* TODO */
Error (NULL, 0, 3000, "Invalid", "AArch64: R_AARCH64_CALL26 Need to fixup with addend!.");
}
break;
case R_AARCH64_JUMP26:
if (Rel->r_addend != 0 ) { /* TODO : AArch64 '-O2' optimisation. */
Error (NULL, 0, 3000, "Invalid", "AArch64: R_AARCH64_JUMP26 Need to fixup with addend!.");
}
break;
case R_AARCH64_ADR_PREL_PG_HI21:
// TODO : AArch64 'small' memory model.
Error (NULL, 0, 3000, "Invalid", "WriteSections64(): %s unsupported ELF EM_AARCH64 relocation R_AARCH64_ADR_PREL_PG_HI21.", mInImageName);
break;
case R_AARCH64_ADD_ABS_LO12_NC:
// TODO : AArch64 'small' memory model.
Error (NULL, 0, 3000, "Invalid", "WriteSections64(): %s unsupported ELF EM_AARCH64 relocation R_AARCH64_ADD_ABS_LO12_NC.", mInImageName);
break;
// Absolute relocations.
case R_AARCH64_ABS64:
*(UINT64 *)Targ = *(UINT64 *)Targ - SymShdr->sh_addr + mCoffSectionsOffset[Sym->st_shndx];
break;
default:
Error (NULL, 0, 3000, "Invalid", "WriteSections64(): %s unsupported ELF EM_AARCH64 relocation 0x%x.", mInImageName, (unsigned) ELF_R_TYPE(Rel->r_info));
}
} else {
Error (NULL, 0, 3000, "Invalid", "Not EM_X86_X64");
Error (NULL, 0, 3000, "Invalid", "Not a supported machine type");
}
}
}
@ -673,6 +764,45 @@ WriteRelocations64 (
default:
Error (NULL, 0, 3000, "Invalid", "%s unsupported ELF EM_X86_64 relocation 0x%x.", mInImageName, (unsigned) ELF_R_TYPE(Rel->r_info));
}
} else if (mEhdr->e_machine == EM_AARCH64) {
// AArch64 GCC uses RELA relocation, so all relocations has to be fixed up. ARM32 uses REL.
switch (ELF_R_TYPE(Rel->r_info)) {
case R_AARCH64_LD_PREL_LO19:
break;
case R_AARCH64_CALL26:
break;
case R_AARCH64_JUMP26:
break;
case R_AARCH64_ADR_PREL_PG_HI21:
// TODO : AArch64 'small' memory model.
Error (NULL, 0, 3000, "Invalid", "WriteRelocations64(): %s unsupported ELF EM_AARCH64 relocation R_AARCH64_ADR_PREL_PG_HI21.", mInImageName);
break;
case R_AARCH64_ADD_ABS_LO12_NC:
// TODO : AArch64 'small' memory model.
Error (NULL, 0, 3000, "Invalid", "WriteRelocations64(): %s unsupported ELF EM_AARCH64 relocation R_AARCH64_ADD_ABS_LO12_NC.", mInImageName);
break;
case R_AARCH64_ABS64:
CoffAddFixup(
(UINT32) ((UINT64) mCoffSectionsOffset[RelShdr->sh_info]
+ (Rel->r_offset - SecShdr->sh_addr)),
EFI_IMAGE_REL_BASED_DIR64);
break;
case R_AARCH64_ABS32:
CoffAddFixup(
(UINT32) ((UINT64) mCoffSectionsOffset[RelShdr->sh_info]
+ (Rel->r_offset - SecShdr->sh_addr)),
EFI_IMAGE_REL_BASED_HIGHLOW);
break;
default:
Error (NULL, 0, 3000, "Invalid", "WriteRelocations64(): %s unsupported ELF EM_AARCH64 relocation 0x%x.", mInImageName, (unsigned) ELF_R_TYPE(Rel->r_info));
}
} else {
Error (NULL, 0, 3000, "Not Supported", "This tool does not support relocations for ELF with e_machine %u (processor type).", (unsigned) mEhdr->e_machine);
}

View File

@ -1,5 +1,5 @@
## @file
# Windows makefile for 'GenFw' module build.
# GNU/Linux makefile for 'GenFw' module build.
#
# Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
# This program and the accompanying materials

View File

@ -2,6 +2,7 @@
Ported ELF include files from FreeBSD
Copyright (c) 2009 - 2010, Apple Inc. All rights reserved.<BR>
Portions Copyright (c) 2011 - 2013, ARM Ltd. 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
@ -183,6 +184,7 @@ typedef struct {
#define EM_TINYJ 61 /* Advanced Logic Corp. TinyJ processor. */
#define EM_X86_64 62 /* Advanced Micro Devices x86-64 */
#define EM_AMD64 EM_X86_64 /* Advanced Micro Devices x86-64 (compat) */
#define EM_AARCH64 183 /* ARM 64bit Architecture */
/* Non-standard or deprecated. */
#define EM_486 6 /* Intel i486. */
@ -543,6 +545,135 @@ typedef struct {
#define R_386_TLS_DTPOFF32 36 /* GOT entry containing TLS offset */
#define R_386_TLS_TPOFF32 37 /* GOT entry of -ve static TLS offset */
/* Null relocation */
#define R_AARCH64_NONE 256 /* No relocation */
/* Static AArch64 relocations */
/* Static data relocations */
#define R_AARCH64_ABS64 257 /* S + A */
#define R_AARCH64_ABS32 258 /* S + A */
#define R_AARCH64_ABS16 259 /* S + A */
#define R_AARCH64_PREL64 260 /* S + A - P */
#define R_AARCH64_PREL32 261 /* S + A - P */
#define R_AARCH64_PREL16 262 /* S + A - P */
/* Group relocations to create a 16, 32, 48, or 64 bit unsigned data value or address inline */
#define R_AARCH64_MOVW_UABS_G0 263 /* S + A */
#define R_AARCH64_MOVW_UABS_G0_NC 264 /* S + A */
#define R_AARCH64_MOVW_UABS_G1 265 /* S + A */
#define R_AARCH64_MOVW_UABS_G1_NC 266 /* S + A */
#define R_AARCH64_MOVW_UABS_G2 267 /* S + A */
#define R_AARCH64_MOVW_UABS_G2_NC 268 /* S + A */
#define R_AARCH64_MOVW_UABS_G3 269 /* S + A */
/* Group relocations to create a 16, 32, 48, or 64 bit signed data or offset value inline */
#define R_AARCH64_MOVW_SABS_G0 270 /* S + A */
#define R_AARCH64_MOVW_SABS_G1 271 /* S + A */
#define R_AARCH64_MOVW_SABS_G2 272 /* S + A */
/* Relocations to generate 19, 21 and 33 bit PC-relative addresses */
#define R_AARCH64_LD_PREL_LO19 273 /* S + A - P */
#define R_AARCH64_ADR_PREL_LO21 274 /* S + A - P */
#define R_AARCH64_ADR_PREL_PG_HI21 275 /* Page(S+A) - Page(P) */
#define R_AARCH64_ADR_PREL_PG_HI21_NC 276 /* Page(S+A) - Page(P) */
#define R_AARCH64_ADD_ABS_LO12_NC 277 /* S + A */
#define R_AARCH64_LDST8_ABS_LO12_NC 278 /* S + A */
#define R_AARCH64_LDST16_ABS_LO12_NC 284 /* S + A */
#define R_AARCH64_LDST32_ABS_LO12_NC 285 /* S + A */
#define R_AARCH64_LDST64_ABS_LO12_NC 286 /* S + A */
#define R_AARCH64_LDST128_ABS_LO12_NC 299 /* S + A */
/* Relocations for control-flow instructions - all offsets are a multiple of 4 */
#define R_AARCH64_TSTBR14 279 /* S+A-P */
#define R_AARCH64_CONDBR19 280 /* S+A-P */
#define R_AARCH64_JUMP26 282 /* S+A-P */
#define R_AARCH64_CALL26 283 /* S+A-P */
/* Group relocations to create a 16, 32, 48, or 64 bit PC-relative offset inline */
#define R_AARCH64_MOVW_PREL_G0 287 /* S+A-P */
#define R_AARCH64_MOVW_PREL_G0_NC 288 /* S+A-P */
#define R_AARCH64_MOVW_PREL_G1 289 /* S+A-P */
#define R_AARCH64_MOVW_PREL_G1_NC 290 /* S+A-P */
#define R_AARCH64_MOVW_PREL_G2 291 /* S+A-P */
#define R_AARCH64_MOVW_PREL_G2_NC 292 /* S+A-P */
#define R_AARCH64_MOVW_PREL_G3 293 /* S+A-P */
/* Group relocations to create a 16, 32, 48, or 64 bit GOT-relative offsets inline */
#define R_AARCH64_MOVW_GOTOFF_G0 300 /* G(S)-GOT */
#define R_AARCH64_MOVW_GOTOFF_G0_NC 301 /* G(S)-GOT */
#define R_AARCH64_MOVW_GOTOFF_G1 302 /* G(S)-GOT */
#define R_AARCH64_MOVW_GOTOFF_G1_NC 303 /* G(S)-GOT */
#define R_AARCH64_MOVW_GOTOFF_G2 304 /* G(S)-GOT */
#define R_AARCH64_MOVW_GOTOFF_G2_NC 305 /* G(S)-GOT */
#define R_AARCH64_MOVW_GOTOFF_G3 306 /* G(S)-GOT */
/* GOT-relative data relocations */
#define R_AARCH64_GOTREL64 307 /* S+A-GOT */
#define R_AARCH64_GOTREL32 308 /* S+A-GOT */
/* GOT-relative instruction relocations */
#define R_AARCH64_GOT_LD_PREL19 309 /* G(S)-P */
#define R_AARCH64_LD64_GOTOFF_LO15 310 /* G(S)-GOT */
#define R_AARCH64_ADR_GOT_PAGE 311 /* Page(G(S))-Page(P) */
#define R_AARCH64_LD64_GOT_LO12_NC 312 /* G(S) */
#define R_AARCH64_LD64_GOTPAGE_LO15 313 /* G(S)-Page(GOT) */
/* Relocations for thread-local storage */
/* General Dynamic TLS relocations */
#define R_AARCH64_TLSGD_ADR_PREL21 512 /* G(TLSIDX(S+A)) - P */
#define R_AARCH64_TLSGD_ADR_PAGE21 513 /* Page(G(TLSIDX(S+A))) - Page(P) */
#define R_AARCH64_TLSGD_ADD_LO12_NC 514 /* G(TLSIDX(S+A)) */
#define R_AARCH64_TLSGD_MOVW_G1 515 /* G(TLSIDX(S+A)) - GOT */
#define R_AARCH64_TLSGD_MOVW_G0_NC 516 /* G(TLSIDX(S+A)) - GOT */
/* Local Dynamic TLS relocations */
#define R_AARCH64_TLSLD_ADR_PREL21 517 /* G(LDM(S))) - P */
#define R_AARCH64_TLSLD_ADR_PAGE21 518 /* Page(G(LDM(S)))-Page(P) */
#define R_AARCH64_TLSLD_ADD_LO12_NC 519 /* G(LDM(S)) */
#define R_AARCH64_TLSLD_MOVW_G1 520 /* G(LDM(S)) - GOT */
#define R_AARCH64_TLSLD_MOVW_G0_NC 521 /* G(LDM(S)) - GOT */
#define R_AARCH64_TLSLD_LD_PREL19 522 /* G(LDM(S)) - P */
#define R_AARCH64_TLSLD_MOVW_DTPREL_G2 523 /* DTPREL(S+A) */
#define R_AARCH64_TLSLD_MOVW_DTPREL_G1 524 /* DTPREL(S+A) */
#define R_AARCH64_TLSLD_MOVW_DTPREL_G1_NC 525 /* DTPREL(S+A) */
#define R_AARCH64_TLSLD_MOVW_DTPREL_G0 526 /* DTPREL(S+A) */
#define R_AARCH64_TLSLD_MOVW_DTPREL_G0_NC 527 /* DTPREL(S+A) */
#define R_AARCH64_TLSLD_ADD_DTPREL_HI12 528 /* DTPREL(S+A) */
#define R_AARCH64_TLSLD_ADD_DTPREL_LO12 529 /* DTPREL(S+A) */
#define R_AARCH64_TLSLD_ADD_DTPREL_LO12_NC 530 /* DTPREL(S+A) */
#define R_AARCH64_TLSLD_LDST8_DTPREL_LO12 531 /* DTPREL(S+A) */
#define R_AARCH64_TLSLD_LDST8_DTPREL_LO12_NC 532 /* DTPREL(S+A) */
#define R_AARCH64_TLSLD_LDST16_DTPREL_LO12 533 /* DTPREL(S+A) */
#define R_AARCH64_TLSLD_LDST16_DTPREL_LO12_NC 534 /* DTPREL(S+A) */
#define R_AARCH64_TLSLD_LDST32_DTPREL_LO12 535 /* DTPREL(S+A) */
#define R_AARCH64_TLSLD_LDST32_DTPREL_LO12_NC 536 /* DTPREL(S+A) */
#define R_AARCH64_TLSLD_LDST64_DTPREL_LO12 537 /* DTPREL(S+A) */
#define R_AARCH64_TLSLD_LDST64_DTPREL_LO12_NC 538 /* DTPREL(S+A) */
/* Initial Exec TLS relocations */
#define R_AARCH64_TLSIE_MOVW_GOTTPREL_G1 539 /* G(TPREL(S+A)) - GOT */
#define R_AARCH64_TLSIE_MOVW_GOTTPREL_G0_NC 540 /* G(TPREL(S+A)) - GOT */
#define R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21 541 /* Page(G(TPREL(S+A))) - Page(P) */
#define R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC 542 /* G(TPREL(S+A)) */
#define R_AARCH64_TLSIE_LD_GOTTPREL_PREL19 543 /* G(TPREL(S+A)) - P */
/* Local Exec TLS relocations */
#define R_AARCH64_TLSLE_MOVW_TPREL_G2 544 /* TPREL(S+A) */
#define R_AARCH64_TLSLE_MOVW_TPREL_G1 545 /* TPREL(S+A) */
#define R_AARCH64_TLSLE_MOVW_TPREL_G1_NC 546 /* TPREL(S+A) */
#define R_AARCH64_TLSLE_MOVW_TPREL_G0 547 /* TPREL(S+A) */
#define R_AARCH64_TLSLE_MOVW_TPREL_G0_NC 548 /* TPREL(S+A) */
#define R_AARCH64_TLSLE_ADD_TPREL_HI12 549 /* TPREL(S+A) */
#define R_AARCH64_TLSLE_ADD_TPREL_LO12 550 /* TPREL(S+A) */
#define R_AARCH64_TLSLE_ADD_TPREL_LO12_NC 551 /* TPREL(S+A) */
#define R_AARCH64_TLSLE_LDST8_TPREL_LO12 552 /* TPREL(S+A) */
#define R_AARCH64_TLSLE_LDST8_TPREL_LO12_NC 553 /* TPREL(S+A) */
#define R_AARCH64_TLSLE_LDST16_TPREL_LO12 554 /* TPREL(S+A) */
#define R_AARCH64_TLSLE_LDST16_TPREL_LO12_NC 555 /* TPREL(S+A) */
#define R_AARCH64_TLSLE_LDST32_TPREL_LO12 556 /* TPREL(S+A) */
#define R_AARCH64_TLSLE_LDST32_TPREL_LO12_NC 557 /* TPREL(S+A) */
#define R_AARCH64_TLSLE_LDST64_TPREL_LO12 558 /* TPREL(S+A) */
#define R_AARCH64_TLSLE_LDST64_TPREL_LO12_NC 559 /* TPREL(S+A) */
/* Dynamic relocations */
/* Dynamic relocations */
#define R_AARCH64_COPY 1024
#define R_AARCH64_GLOB_DAT 1025 /* S + A */
#define R_AARCH64_JUMP_SLOT 1026 /* S + A */
#define R_AARCH64_RELATIVE 1027 /* Delta(S) + A , Delta(P) + A */
#define R_AARCH64_TLS_DTPREL64 1028 /* DTPREL(S+A) */
#define R_AARCH64_TLS_DTPMOD64 1029 /* LDM(S) */
#define R_AARCH64_TLS_TPREL64 1030 /* TPREL(S+A) */
#define R_AARCH64_TLS_DTPREL32 1031 /* DTPREL(S+A) */
#define R_AARCH64_TLS_DTPMOD32 1032 /* LDM(S) */
#define R_AARCH64_TLS_TPREL32 1033 /* DTPREL(S+A) */
#define R_ALPHA_NONE 0 /* No reloc */
#define R_ALPHA_REFLONG 1 /* Direct 32 bit */
#define R_ALPHA_REFQUAD 2 /* Direct 64 bit */

View File

@ -1,5 +1,5 @@
## @file
# Windows makefile for 'GenPage' module build.
# GNU/Linux makefile for 'GenPage' module build.
#
# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
# This program and the accompanying materials

View File

@ -1,6 +1,6 @@
/** @file
Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2006 - 2013, 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
@ -91,8 +91,7 @@ Returns:
--*/
{
printf ("%s v%d.%d %s -Utility to generate the EfiLoader image containing page table.\n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION, __BUILD_VERSION);
printf ("Copyright (c) 2008 - 2011 Intel Corporation. All rights reserved.\n");
printf ("%s Version %d.%d Build %s\n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION, __BUILD_VERSION);
}
VOID
@ -100,25 +99,29 @@ Usage (
void
)
{
Version();
printf ("\nUsage: \n\
GenPage\n\
-o, --output Filename\n\
The file that contains both non-page table part and\n\
page table\n\
[-b, --baseaddr baseaddress]\n\
printf ("Usage: GenPage.exe [options] EfiLoaderImageName \n\n\
Copyright (c) 2008 - 2013, Intel Corporation. All rights reserved.\n\n\
Utility to generate the EfiLoader image containing a page table.\n\n\
optional arguments:\n\
-h, --help Show this help message and exit\n\
--version Show program's version number and exit\n\
-d [DEBUG], --debug [DEBUG]\n\
Output DEBUG statements, where DEBUG_LEVEL is 0 (min)\n\
- 9 (max)\n\
-v, --verbose Print informational statements\n\
-q, --quiet Returns the exit code, error messages will be\n\
displayed\n\
-s, --silent Returns only the exit code; informational and error\n\
messages are not displayed\n\
-o OUTPUT_FILENAME, --output OUTPUT_FILENAME\n\
Output file contain both the non-page table part and\n\
the page table\n\
-b BASE_ADDRESS, --baseaddr BASE_ADDRESS\n\
The page table location\n\
[-f, --offset offset]\n\
-f OFFSET, --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");
--sfo Reserved for future use\n");
}

View File

@ -1,5 +1,5 @@
## @file
# Windows makefile for 'GenSec' module build.
# GNU/Linux makefile for 'GenSec' module build.
#
# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
# This program and the accompanying materials

View File

@ -1,5 +1,5 @@
## @file
# Windows makefile for 'GenVtf' module build.
# GNU/Linux makefile for 'GenVtf' module build.
#
# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
# This program and the accompanying materials

View File

@ -1,5 +1,5 @@
## @file
# Windows makefile for 'GnuGenBootSector' module build.
# GNU/Linux makefile for 'GnuGenBootSector' module build.
#
# Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
# This program and the accompanying materials

View File

@ -0,0 +1,159 @@
/** @file
Processor or Compiler specific defines and types for AArch64.
Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
Portions copyright (c) 2013, ARM Ltd. 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.
**/
#ifndef __PROCESSOR_BIND_H__
#define __PROCESSOR_BIND_H__
///
/// Define the processor type so other code can make processor based choices
///
#define MDE_CPU_AARCH64
//
// Make sure we are using the correct packing rules per EFI specification
//
#ifndef __GNUC__
#pragma pack()
#endif
#if _MSC_EXTENSIONS
//
// use Microsoft* C complier dependent integer width types
//
typedef unsigned __int64 UINT64;
typedef __int64 INT64;
typedef unsigned __int32 UINT32;
typedef __int32 INT32;
typedef unsigned short UINT16;
typedef unsigned short CHAR16;
typedef short INT16;
typedef unsigned char BOOLEAN;
typedef unsigned char UINT8;
typedef char CHAR8;
typedef signed char INT8;
#else
//
// Assume standard AARCH64 alignment.
//
typedef unsigned long long UINT64;
typedef long long INT64;
typedef unsigned int UINT32;
typedef int INT32;
typedef unsigned short UINT16;
typedef unsigned short CHAR16;
typedef short INT16;
typedef unsigned char BOOLEAN;
typedef unsigned char UINT8;
typedef char CHAR8;
typedef signed char INT8;
#define UINT8_MAX 0xff
#endif
///
/// Unsigned value of native width. (4 bytes on supported 32-bit processor instructions,
/// 8 bytes on supported 64-bit processor instructions)
///
typedef UINT64 UINTN;
///
/// Signed value of native width. (4 bytes on supported 32-bit processor instructions,
/// 8 bytes on supported 64-bit processor instructions)
///
typedef INT64 INTN;
//
// Processor specific defines
//
///
/// A value of native width with the highest bit set.
///
#define MAX_BIT 0x8000000000000000
///
/// A value of native width with the two highest bits set.
///
#define MAX_2_BITS 0xC000000000000000
///
/// Maximum legal AARCH64 address
///
#define MAX_ADDRESS 0xFFFFFFFFFFFFFFFF
///
/// The stack alignment required for AARCH64
///
#define CPU_STACK_ALIGNMENT 16
//
// Modifier to ensure that all protocol member functions and EFI intrinsics
// use the correct C calling convention. All protocol member functions and
// EFI intrinsics are required to modify their member functions with EFIAPI.
//
#define EFIAPI
#if defined(__GNUC__)
///
/// For GNU assembly code, .global or .globl can declare global symbols.
/// Define this macro to unify the usage.
///
#define ASM_GLOBAL .globl
#if !defined(__APPLE__)
///
/// ARM EABI defines that the linker should not manipulate call relocations
/// (do bl/blx conversion) unless the target symbol has function type.
/// CodeSourcery 2010.09 started requiring the .type to function properly
///
#define INTERWORK_FUNC(func__) .type ASM_PFX(func__), %function
#define GCC_ASM_EXPORT(func__) \
.global _CONCATENATE (__USER_LABEL_PREFIX__, func__) ;\
.type ASM_PFX(func__), %function
#define GCC_ASM_IMPORT(func__) \
.extern _CONCATENATE (__USER_LABEL_PREFIX__, func__)
#else
//
// .type not supported by Apple Xcode tools
//
#define INTERWORK_FUNC(func__)
#define GCC_ASM_EXPORT(func__) \
.globl _CONCATENATE (__USER_LABEL_PREFIX__, func__) \
#define GCC_ASM_IMPORT(name)
#endif
#endif
/**
Return the pointer to the first instruction of a function given a function pointer.
On ARM CPU architectures, these two pointer values are the same,
so the implementation of this macro is very simple.
@param FunctionPointer A pointer to a function.
@return The pointer to the first instruction of a function given a function pointer.
**/
#define FUNCTION_ENTRY_POINT(FunctionPointer) (VOID *)(UINTN)(FunctionPointer)
#endif

View File

@ -0,0 +1,158 @@
/** @file
Processor or Compiler specific defines and types for ARM.
Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
Portions copyright (c) 2008 - 2009, Apple Inc. 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.
**/
#ifndef __PROCESSOR_BIND_H__
#define __PROCESSOR_BIND_H__
///
/// Define the processor type so other code can make processor based choices
///
#define MDE_CPU_ARM
//
// Make sure we are using the correct packing rules per EFI specification
//
#ifndef __GNUC__
#pragma pack()
#endif
#if _MSC_EXTENSIONS
//
// use Microsoft* C complier dependent integer width types
//
typedef unsigned __int64 UINT64;
typedef __int64 INT64;
typedef unsigned __int32 UINT32;
typedef __int32 INT32;
typedef unsigned short UINT16;
typedef unsigned short CHAR16;
typedef short INT16;
typedef unsigned char BOOLEAN;
typedef unsigned char UINT8;
typedef char CHAR8;
typedef signed char INT8;
#else
//
// Assume standard ARM alignment.
//
typedef unsigned long long UINT64;
typedef long long INT64;
typedef unsigned int UINT32;
typedef int INT32;
typedef unsigned short UINT16;
typedef unsigned short CHAR16;
typedef short INT16;
typedef unsigned char BOOLEAN;
typedef unsigned char UINT8;
typedef char CHAR8;
typedef signed char INT8;
#define UINT8_MAX 0xff
#endif
///
/// Unsigned value of native width. (4 bytes on supported 32-bit processor instructions,
/// 8 bytes on supported 64-bit processor instructions)
///
typedef UINT32 UINTN;
///
/// Signed value of native width. (4 bytes on supported 32-bit processor instructions,
/// 8 bytes on supported 64-bit processor instructions)
///
typedef INT32 INTN;
//
// Processor specific defines
//
///
/// A value of native width with the highest bit set.
///
#define MAX_BIT 0x80000000
///
/// A value of native width with the two highest bits set.
///
#define MAX_2_BITS 0xC0000000
///
/// Maximum legal ARM address
///
#define MAX_ADDRESS 0xFFFFFFFF
///
/// The stack alignment required for ARM
///
#define CPU_STACK_ALIGNMENT sizeof(UINT64)
//
// Modifier to ensure that all protocol member functions and EFI intrinsics
// use the correct C calling convention. All protocol member functions and
// EFI intrinsics are required to modify their member functions with EFIAPI.
//
#define EFIAPI
#if defined(__GNUC__)
///
/// For GNU assembly code, .global or .globl can declare global symbols.
/// Define this macro to unify the usage.
///
#define ASM_GLOBAL .globl
#if !defined(__APPLE__)
///
/// ARM EABI defines that the linker should not manipulate call relocations
/// (do bl/blx conversion) unless the target symbol has function type.
/// CodeSourcery 2010.09 started requiring the .type to function properly
///
#define INTERWORK_FUNC(func__) .type ASM_PFX(func__), %function
#define GCC_ASM_EXPORT(func__) \
.global _CONCATENATE (__USER_LABEL_PREFIX__, func__) ;\
.type ASM_PFX(func__), %function
#define GCC_ASM_IMPORT(func__) \
.extern _CONCATENATE (__USER_LABEL_PREFIX__, func__)
#else
//
// .type not supported by Apple Xcode tools
//
#define INTERWORK_FUNC(func__)
#define GCC_ASM_EXPORT(func__) \
.globl _CONCATENATE (__USER_LABEL_PREFIX__, func__) \
#define GCC_ASM_IMPORT(name)
#endif
#endif
/**
Return the pointer to the first instruction of a function given a function pointer.
On ARM CPU architectures, these two pointer values are the same,
so the implementation of this macro is very simple.
@param FunctionPointer A pointer to a function.
@return The pointer to the first instruction of a function given a function pointer.
**/
#define FUNCTION_ENTRY_POINT(FunctionPointer) (VOID *)(UINTN)(FunctionPointer)
#endif

View File

@ -14,4 +14,4 @@
**/
#define __BUILD_VERSION "Build 2524"
#define __BUILD_VERSION ""

View File

@ -783,9 +783,9 @@ typedef struct _EFI_IFR_IMAGE {
EFI_IMAGE_ID Id;
} EFI_IFR_IMAGE;
typedef struct _EFI_IFR_MODAL {
typedef struct _EFI_IFR_MODAL_TAG {
EFI_IFR_OP_HEADER Header;
} EFI_IFR_MODAL;
} EFI_IFR_MODAL_TAG;
typedef struct _EFI_IFR_LOCKED {
EFI_IFR_OP_HEADER Header;
@ -803,6 +803,12 @@ typedef struct _EFI_IFR_DEFAULT {
EFI_IFR_TYPE_VALUE Value;
} EFI_IFR_DEFAULT;
typedef struct _EFI_IFR_DEFAULT_2 {
EFI_IFR_OP_HEADER Header;
UINT16 DefaultId;
UINT8 Type;
} EFI_IFR_DEFAULT_2;
typedef struct _EFI_IFR_VALUE {
EFI_IFR_OP_HEADER Header;
} EFI_IFR_VALUE;

View File

@ -1,7 +1,7 @@
/** @file
This includes some definitions introduced in UEFI that will be used in both PEI and DXE phases.
Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2006 - 2012, 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
@ -117,9 +117,9 @@ typedef struct _WIN_CERTIFICATE {
// WIN_CERTIFICATE_UEFI_GUID.CertData
//
typedef struct _EFI_CERT_BLOCK_RSA_2048_SHA256 {
UINT32 HashType;
UINT8 PublicKey[256];
UINT8 Signature[256];
EFI_GUID HashType;
UINT8 PublicKey[256];
UINT8 Signature[256];
} EFI_CERT_BLOCK_RSA_2048_SHA256;
@ -127,7 +127,7 @@ typedef struct _EFI_CERT_BLOCK_RSA_2048_SHA256 {
@param Hdr This is the standard WIN_CERTIFICATE header, where
wCertificateType is set to
WIN_CERT_TYPE_UEFI_GUID.
WIN_CERT_TYPE_EFI_GUID.
@param CertType This is the unique id which determines the
format of the CertData. In this case, the

View File

@ -1,7 +1,7 @@
/** @file
Processor or Compiler specific defines and types for x64.
Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2006 - 2012, 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
@ -70,7 +70,7 @@
#if _MSC_EXTENSIONS
//
// use Microsoft* C complier dependent interger width types
// use Microsoft* C complier dependent integer width types
//
typedef unsigned __int64 UINT64;
typedef __int64 INT64;

View File

@ -5,6 +5,7 @@
@bug Fix text - doc as defined in MSFT EFI specification.
Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
Portions copyright (c) 2011 - 2013, ARM Ltd. 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
@ -48,6 +49,7 @@
#define IMAGE_FILE_MACHINE_X64 0x8664
#define IMAGE_FILE_MACHINE_ARM 0x01c0 // Thumb only
#define IMAGE_FILE_MACHINE_ARMT 0x01c2 // 32bit Mixed ARM and Thumb/Thumb 2 Little Endian
#define IMAGE_FILE_MACHINE_ARM64 0xAA64 // 64bit ARM Architecture, Little Endian
//
// Support old names for backward compatible
@ -58,6 +60,7 @@
#define EFI_IMAGE_MACHINE_EBC IMAGE_FILE_MACHINE_EBC
#define EFI_IMAGE_MACHINE_X64 IMAGE_FILE_MACHINE_X64
#define EFI_IMAGE_MACHINE_ARMT IMAGE_FILE_MACHINE_ARMT
#define EFI_IMAGE_MACHINE_AARCH64 IMAGE_FILE_MACHINE_ARM64
#define EFI_IMAGE_DOS_SIGNATURE 0x5A4D // MZ
#define EFI_IMAGE_OS2_SIGNATURE 0x454E // NE

View File

@ -1,7 +1,7 @@
/** @file
Processor or Compiler specific defines and types x64 (Intel(r) EM64T, AMD64).
Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2006 - 2012, 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
@ -73,7 +73,7 @@
//
// use Microsoft C complier dependent interger width types
// use Microsoft C complier dependent integer width types
//
typedef unsigned __int64 UINT64;
typedef __int64 INT64;

View File

@ -1,5 +1,5 @@
## @file
# Windows makefile for 'LzmaCompress' module build.
# GNU/Linux makefile for 'LzmaCompress' module build.
#
# Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>
# This program and the accompanying materials

View File

@ -4,6 +4,7 @@
# ARCH = x86_64 or x64 for EM64T build
# ARCH = ia32 or IA32 for IA32 build
# ARCH = ia64 or IA64 for IA64 build
# ARCH = Arm or ARM for ARM build
#
# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
# This program and the accompanying materials
@ -34,6 +35,10 @@ ifeq ($(ARCH), X64)
ARCH_INCLUDE = -I $(MAKEROOT)/Include/X64/
endif
ifeq ($(ARCH), ARM)
ARCH_INCLUDE = -I $(MAKEROOT)/Include/Arm/
endif
INCLUDE = $(TOOL_INCLUDE) -I $(MAKEROOT) -I $(MAKEROOT)/Include/Common -I $(MAKEROOT)/Include/ -I $(MAKEROOT)/Include/IndustryStandard -I $(MAKEROOT)/Common/ -I .. -I . $(ARCH_INCLUDE)
CPPFLAGS = $(INCLUDE)
CFLAGS = -MD -fshort-wchar -fno-strict-aliasing -fno-merge-constants -nostdlib -Wall -Werror -c -g

View File

@ -1,5 +1,5 @@
## @file
# Windows makefile for 'Split' module build.
# GNU/Linux makefile for 'Split' module build.
#
# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
# This program and the accompanying materials

View File

@ -1,5 +1,5 @@
## @file
# Windows makefile for 'TianoCompress' module build.
# GNU/Linux makefile for 'TianoCompress' module build.
#
# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
# This program and the accompanying materials

View File

@ -38,6 +38,8 @@ Abstract:
#define EFI_STRING_ID_INVALID 0x0
#define EFI_IMAGE_ID_INVALID 0xFFFF
#define EFI_IFR_MAX_DEFAULT_TYPE 0x10
typedef enum {
QUESTION_NORMAL,
QUESTION_DATE,

View File

@ -1,5 +1,5 @@
## @file
# Windows makefile for 'VfrCompile' module build.
# GNU/Linux makefile for 'VfrCompile' module build.
#
# Copyright (c) 2008 - 2010, Intel Corporation. All rights reserved.<BR>
# This program and the accompanying materials

View File

@ -2,7 +2,7 @@
VfrCompiler main class and main function.
Copyright (c) 2004 - 2011, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2004 - 2012, 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
@ -82,6 +82,7 @@ CVfrCompiler::OptionInitialization (
mOptions.CPreprocessorOptions = NULL;
mOptions.CompatibleMode = FALSE;
mOptions.HasOverrideClassGuid = FALSE;
mOptions.WarningAsError = FALSE;
memset (&mOptions.OverrideClassGuid, 0, sizeof (EFI_GUID));
if (Argc == 1) {
@ -153,6 +154,8 @@ CVfrCompiler::OptionInitialization (
goto Fail;
}
mOptions.HasOverrideClassGuid = TRUE;
} else if (stricmp(Argv[Index], "-w") == 0 || stricmp(Argv[Index], "--warning-as-error") == 0) {
mOptions.WarningAsError = TRUE;
} else {
DebugError (NULL, 0, 1000, "Unknown option", "unrecognized option %s", Argv[Index]);
goto Fail;
@ -425,6 +428,8 @@ CVfrCompiler::Usage (
" -g, --guid",
" override class guid input",
" format is xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
" -w --warning-as-error",
" treat warning as an error",
NULL
};
for (Index = 0; Help[Index] != NULL; Index++) {
@ -516,6 +521,7 @@ CVfrCompiler::Compile (
InFileName = (mOptions.SkipCPreprocessor == TRUE) ? mOptions.VfrFileName : mOptions.PreprocessorOutputFileName;
gCVfrErrorHandle.SetInputFile (InFileName);
gCVfrErrorHandle.SetWarningAsError(mOptions.WarningAsError);
if ((pInFile = fopen (InFileName, "r")) == NULL) {
DebugError (NULL, 0, 0001, "Error opening the input file", InFileName);
@ -553,12 +559,55 @@ Fail:
}
}
VOID
CVfrCompiler::UpdateInfoForDynamicOpcode (
VOID
)
{
SIfrRecord *pRecord;
if (!gNeedAdjustOpcode) {
return;
}
//
// Base on the original offset info to update the record list.
//
if (!gCIfrRecordInfoDB.IfrAdjustDynamicOpcodeInRecords()) {
DebugError (NULL, 0, 1001, "Error parsing vfr file", "Can find the offset in the record.");
}
//
// Base on the opcode binary length to recalculate the offset for each opcode.
//
gCIfrRecordInfoDB.IfrAdjustOffsetForRecord();
//
// Base on the offset to find the binary address.
//
pRecord = gCIfrRecordInfoDB.GetRecordInfoFromOffset(gAdjustOpcodeOffset);
while (pRecord != NULL) {
pRecord->mIfrBinBuf = gCFormPkg.GetBufAddrBaseOnOffset(pRecord->mOffset);
if (pRecord->mIfrBinBuf == NULL) {
DebugError (NULL, 0, 0001, "Error parsing vfr file", " 0x%X. offset not allocated.", pRecord->mOffset);
}
pRecord = pRecord->mNext;
}
}
VOID
CVfrCompiler::AdjustBin (
VOID
)
{
EFI_VFR_RETURN_CODE Status;
if (!IS_RUN_STATUS(STATUS_COMPILEED)) {
return;
}
UpdateInfoForDynamicOpcode ();
//
// Check Binary Code consistent between Form and IfrRecord
//
@ -759,6 +808,8 @@ main (
)
{
COMPILER_RUN_STATUS Status;
SetPrintLevel(WARNING_LOG_LEVEL);
CVfrCompiler Compiler(Argc, Argv);
Compiler.PreProcess();

View File

@ -57,6 +57,7 @@ typedef struct {
BOOLEAN CompatibleMode;
BOOLEAN HasOverrideClassGuid;
EFI_GUID OverrideClassGuid;
BOOLEAN WarningAsError;
} OPTIONS;
typedef enum {
@ -87,6 +88,7 @@ private:
VOID SET_RUN_STATUS (IN COMPILER_RUN_STATUS);
BOOLEAN IS_RUN_STATUS (IN COMPILER_RUN_STATUS);
VOID UpdateInfoForDynamicOpcode (VOID);
public:
COMPILER_RUN_STATUS RunStatus (VOID) {

View File

@ -2,7 +2,7 @@
VfrCompiler error handler.
Copyright (c) 2004 - 2011, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2004 - 2013, 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
@ -45,17 +45,24 @@ static SVFR_ERROR_HANDLE VFR_ERROR_HANDLE_TABLE [] = {
{ VFR_RETURN_DATA_STRING_ERROR, ": data field string error or not support"},
{ VFR_RETURN_DEFAULT_VALUE_REDEFINED, ": default value re-defined with different value"},
{ VFR_RETURN_CONSTANT_ONLY, ": only constant is allowed in the expression"},
{ VFR_RETURN_VARSTORE_NAME_REDEFINED_ERROR, ": Varstore name is defined by more than one varstores, it can't be referred as varstore, only varstore strucure name could be used."},
{ VFR_RETURN_CODEUNDEFINED, ": undefined Error Code" }
};
static SVFR_WARNING_HANDLE VFR_WARNING_HANDLE_TABLE [] = {
{ VFR_WARNING_DEFAULT_VALUE_REDEFINED, ": default value re-defined with different value"},
{ VFR_WARNING_CODEUNDEFINED, ": undefined Warning Code" }
};
CVfrErrorHandle::CVfrErrorHandle (
VOID
)
{
mInputFileName = NULL;
mScopeRecordListHead = NULL;
mScopeRecordListTail = NULL;
mVfrErrorHandleTable = VFR_ERROR_HANDLE_TABLE;
mInputFileName = NULL;
mScopeRecordListHead = NULL;
mScopeRecordListTail = NULL;
mVfrErrorHandleTable = VFR_ERROR_HANDLE_TABLE;
mVfrWarningHandleTable = VFR_WARNING_HANDLE_TABLE;
}
CVfrErrorHandle::~CVfrErrorHandle (
@ -74,9 +81,18 @@ CVfrErrorHandle::~CVfrErrorHandle (
delete pNode;
}
mScopeRecordListHead = NULL;
mScopeRecordListTail = NULL;
mVfrErrorHandleTable = NULL;
mScopeRecordListHead = NULL;
mScopeRecordListTail = NULL;
mVfrErrorHandleTable = NULL;
mVfrWarningHandleTable = NULL;
}
VOID
CVfrErrorHandle::SetWarningAsError (
IN BOOLEAN WarningAsError
)
{
mWarningAsError = WarningAsError;
}
VOID
@ -242,4 +258,41 @@ CVfrErrorHandle::HandleError (
}
}
UINT8
CVfrErrorHandle::HandleWarning (
IN EFI_VFR_WARNING_CODE WarningCode,
IN UINT32 LineNum,
IN CHAR8 *TokName
)
{
UINT32 Index;
CHAR8 *FileName = NULL;
UINT32 FileLine;
CONST CHAR8 *WarningMsg = NULL;
if (mVfrWarningHandleTable == NULL) {
return 1;
}
GetFileNameLineNum (LineNum, &FileName, &FileLine);
if (mWarningAsError) {
Error (FileName, FileLine, 0x2220, "warning treated as error", NULL);
}
for (Index = 0; mVfrWarningHandleTable[Index].mWarningCode != VFR_WARNING_CODEUNDEFINED; Index++) {
if (WarningCode == mVfrWarningHandleTable[Index].mWarningCode) {
WarningMsg = mVfrWarningHandleTable[Index].mWarningMsg;
break;
}
}
if (WarningMsg != NULL) {
Warning (FileName, FileLine, 0, TokName, (CHAR8 *) "\t%s\n", (CHAR8 *) WarningMsg);
return 1;
} else {
return 0;
}
}
CVfrErrorHandle gCVfrErrorHandle;

View File

@ -2,7 +2,7 @@
VfrCompiler Error definition
Copyright (c) 2004 - 2011, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2004 - 2013, 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
@ -43,14 +43,25 @@ typedef enum {
VFR_RETURN_DATA_STRING_ERROR,
VFR_RETURN_DEFAULT_VALUE_REDEFINED,
VFR_RETURN_CONSTANT_ONLY,
VFR_RETURN_VARSTORE_NAME_REDEFINED_ERROR,
VFR_RETURN_CODEUNDEFINED
} EFI_VFR_RETURN_CODE;
typedef enum {
VFR_WARNING_DEFAULT_VALUE_REDEFINED = 0,
VFR_WARNING_CODEUNDEFINED
} EFI_VFR_WARNING_CODE;
typedef struct _SVFR_ERROR_HANDLE {
EFI_VFR_RETURN_CODE mErrorCode;
CONST CHAR8 *mErrorMsg;
} SVFR_ERROR_HANDLE;
typedef struct _SVFR_WARNING_HANDLE {
EFI_VFR_WARNING_CODE mWarningCode;
CONST CHAR8 *mWarningMsg;
} SVFR_WARNING_HANDLE;
struct SVfrFileScopeRecord {
CHAR8 *mFileName;
UINT32 mWholeScopeLine;
@ -65,17 +76,21 @@ class CVfrErrorHandle {
private:
CHAR8 *mInputFileName;
SVFR_ERROR_HANDLE *mVfrErrorHandleTable;
SVFR_WARNING_HANDLE *mVfrWarningHandleTable;
SVfrFileScopeRecord *mScopeRecordListHead;
SVfrFileScopeRecord *mScopeRecordListTail;
BOOLEAN mWarningAsError;
public:
CVfrErrorHandle (VOID);
~CVfrErrorHandle (VOID);
VOID SetWarningAsError (IN BOOLEAN);
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 = NULL);
UINT8 HandleWarning (IN EFI_VFR_WARNING_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 = "");
};

View File

@ -2,7 +2,7 @@
The definition of CFormPkg's member function
Copyright (c) 2004 - 2012, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2004 - 2013, 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
@ -152,12 +152,39 @@ CFormPkg::~CFormPkg ()
PendingAssignList = NULL;
}
SBufferNode *
CFormPkg::CreateNewNode (
VOID
)
{
SBufferNode *Node;
Node = new SBufferNode;
if (Node == NULL) {
return NULL;
}
Node->mBufferStart = new CHAR8[mBufferSize];
if (Node->mBufferStart == NULL) {
delete Node;
return NULL;
} else {
memset (Node->mBufferStart, 0, mBufferSize);
Node->mBufferEnd = Node->mBufferStart + mBufferSize;
Node->mBufferFree = Node->mBufferStart;
Node->mNext = NULL;
}
return Node;
}
CHAR8 *
CFormPkg::IfrBinBufferGet (
IN UINT32 Len
)
{
CHAR8 *BinBuffer = NULL;
CHAR8 *BinBuffer = NULL;
SBufferNode *Node = NULL;
if ((Len == 0) || (Len > mBufferSize)) {
return NULL;
@ -167,24 +194,11 @@ CFormPkg::IfrBinBufferGet (
BinBuffer = mCurrBufferNode->mBufferFree;
mCurrBufferNode->mBufferFree += Len;
} else {
SBufferNode *Node;
Node = new SBufferNode;
Node = CreateNewNode ();
if (Node == NULL) {
return NULL;
}
Node->mBufferStart = new CHAR8[mBufferSize];
if (Node->mBufferStart == NULL) {
delete Node;
return NULL;
} else {
memset (Node->mBufferStart, 0, mBufferSize);
Node->mBufferEnd = Node->mBufferStart + mBufferSize;
Node->mBufferFree = Node->mBufferStart;
Node->mNext = NULL;
}
if (mBufferNodeQueueTail == NULL) {
mBufferNodeQueueHead = mBufferNodeQueueTail = Node;
} else {
@ -245,7 +259,7 @@ CFormPkg::Read (
}
if (mReadBufferNode == NULL) {
return 0;
return 0;
}
for (Index = 0; Index < Size; Index++) {
@ -256,7 +270,7 @@ CFormPkg::Read (
return Index;
} else {
mReadBufferOffset = 0;
Buffer[Index] = mReadBufferNode->mBufferStart[mReadBufferOffset++];
Index --;
}
}
}
@ -402,6 +416,9 @@ CFormPkg::_WRITE_PKG_END (
}
#define BYTES_PRE_LINE 0x10
UINT32 gAdjustOpcodeOffset = 0;
BOOLEAN gNeedAdjustOpcode = FALSE;
UINT32 gAdjustOpcodeLen = 0;
EFI_VFR_RETURN_CODE
CFormPkg::GenCFile (
@ -548,13 +565,236 @@ CFormPkg::PendingAssignPrintAll (
}
}
SBufferNode *
CFormPkg::GetBinBufferNodeForAddr (
IN CHAR8 *BinBuffAddr
)
{
SBufferNode *TmpNode;
TmpNode = mBufferNodeQueueHead;
while (TmpNode != NULL) {
if (TmpNode->mBufferStart <= BinBuffAddr && TmpNode->mBufferFree >= BinBuffAddr) {
return TmpNode;
}
TmpNode = TmpNode->mNext;
}
return NULL;
}
SBufferNode *
CFormPkg::GetNodeBefore(
IN SBufferNode *CurrentNode
)
{
SBufferNode *FirstNode = mBufferNodeQueueHead;
SBufferNode *LastNode = mBufferNodeQueueHead;
while (FirstNode != NULL) {
if (FirstNode == CurrentNode) {
break;
}
LastNode = FirstNode;
FirstNode = FirstNode->mNext;
}
if (FirstNode == NULL) {
LastNode = NULL;
}
return LastNode;
}
EFI_VFR_RETURN_CODE
CFormPkg::InsertNodeBefore(
IN SBufferNode *CurrentNode,
IN SBufferNode *NewNode
)
{
SBufferNode *LastNode = GetNodeBefore (CurrentNode);
if (LastNode == NULL) {
return VFR_RETURN_MISMATCHED;
}
NewNode->mNext = LastNode->mNext;
LastNode->mNext = NewNode;
return VFR_RETURN_SUCCESS;
}
CHAR8 *
CFormPkg::GetBufAddrBaseOnOffset (
IN UINT32 Offset
)
{
SBufferNode *TmpNode;
UINT32 TotalBufLen;
UINT32 CurrentBufLen;
TotalBufLen = 0;
for (TmpNode = mBufferNodeQueueHead; TmpNode != NULL; TmpNode = TmpNode->mNext) {
CurrentBufLen = TmpNode->mBufferFree - TmpNode->mBufferStart;
if (Offset >= TotalBufLen && Offset < TotalBufLen + CurrentBufLen) {
return TmpNode->mBufferStart + (Offset - TotalBufLen);
}
TotalBufLen += CurrentBufLen;
}
return NULL;
}
EFI_VFR_RETURN_CODE
CFormPkg::AdjustDynamicInsertOpcode (
IN CHAR8 *LastFormEndAddr,
IN CHAR8 *InsertOpcodeAddr
)
{
SBufferNode *LastFormEndNode;
SBufferNode *InsertOpcodeNode;
SBufferNode *NewRestoreNodeBegin;
SBufferNode *NewRestoreNodeEnd;
SBufferNode *NewLastEndNode;
SBufferNode *TmpNode;
UINT32 NeedRestoreCodeLen;
NewRestoreNodeEnd = NULL;
LastFormEndNode = GetBinBufferNodeForAddr(LastFormEndAddr);
InsertOpcodeNode = GetBinBufferNodeForAddr(InsertOpcodeAddr);
if (LastFormEndNode == InsertOpcodeNode) {
//
// Create New Node to save the restore opcode.
//
NeedRestoreCodeLen = InsertOpcodeAddr - LastFormEndAddr;
gAdjustOpcodeLen = NeedRestoreCodeLen;
NewRestoreNodeBegin = CreateNewNode ();
if (NewRestoreNodeBegin == NULL) {
return VFR_RETURN_OUT_FOR_RESOURCES;
}
memcpy (NewRestoreNodeBegin->mBufferFree, LastFormEndAddr, NeedRestoreCodeLen);
NewRestoreNodeBegin->mBufferFree += NeedRestoreCodeLen;
//
// Override the restore buffer data.
//
memcpy (LastFormEndAddr, InsertOpcodeAddr, InsertOpcodeNode->mBufferFree - InsertOpcodeAddr);
InsertOpcodeNode->mBufferFree -= NeedRestoreCodeLen;
memset (InsertOpcodeNode->mBufferFree, 0, NeedRestoreCodeLen);
} else {
//
// Create New Node to save the restore opcode.
//
NeedRestoreCodeLen = LastFormEndNode->mBufferFree - LastFormEndAddr;
gAdjustOpcodeLen = NeedRestoreCodeLen;
NewRestoreNodeBegin = CreateNewNode ();
if (NewRestoreNodeBegin == NULL) {
return VFR_RETURN_OUT_FOR_RESOURCES;
}
memcpy (NewRestoreNodeBegin->mBufferFree, LastFormEndAddr, NeedRestoreCodeLen);
NewRestoreNodeBegin->mBufferFree += NeedRestoreCodeLen;
//
// Override the restore buffer data.
//
LastFormEndNode->mBufferFree -= NeedRestoreCodeLen;
//
// Link the restore data to new node.
//
NewRestoreNodeBegin->mNext = LastFormEndNode->mNext;
//
// Count the Adjust opcode len.
//
TmpNode = LastFormEndNode->mNext;
while (TmpNode != InsertOpcodeNode) {
gAdjustOpcodeLen += TmpNode->mBufferFree - TmpNode->mBufferStart;
TmpNode = TmpNode->mNext;
}
//
// Create New Node to save the last node of restore opcode.
//
NeedRestoreCodeLen = InsertOpcodeAddr - InsertOpcodeNode->mBufferStart;
gAdjustOpcodeLen += NeedRestoreCodeLen;
if (NeedRestoreCodeLen > 0) {
NewRestoreNodeEnd = CreateNewNode ();
if (NewRestoreNodeEnd == NULL) {
return VFR_RETURN_OUT_FOR_RESOURCES;
}
memcpy (NewRestoreNodeEnd->mBufferFree, InsertOpcodeNode->mBufferStart, NeedRestoreCodeLen);
NewRestoreNodeEnd->mBufferFree += NeedRestoreCodeLen;
//
// Override the restore buffer data.
//
memcpy (InsertOpcodeNode->mBufferStart, InsertOpcodeAddr, InsertOpcodeNode->mBufferFree - InsertOpcodeAddr);
InsertOpcodeNode->mBufferFree -= InsertOpcodeAddr - InsertOpcodeNode->mBufferStart;
//
// Insert the last restore data node.
//
TmpNode = GetNodeBefore (InsertOpcodeNode);
if (TmpNode == LastFormEndNode) {
NewRestoreNodeBegin->mNext = NewRestoreNodeEnd;
} else {
TmpNode->mNext = NewRestoreNodeEnd;
}
//
// Connect the dynamic opcode node to the node before last form end node.
//
LastFormEndNode->mNext = InsertOpcodeNode;
}
}
if (mBufferNodeQueueTail->mBufferFree - mBufferNodeQueueTail->mBufferStart > 2) {
//
// End form set opcode all in the mBufferNodeQueueTail node.
//
NewLastEndNode = CreateNewNode ();
if (NewLastEndNode == NULL) {
return VFR_RETURN_OUT_FOR_RESOURCES;
}
NewLastEndNode->mBufferStart[0] = 0x29;
NewLastEndNode->mBufferStart[1] = 0x02;
NewLastEndNode->mBufferFree += 2;
mBufferNodeQueueTail->mBufferFree -= 2;
mBufferNodeQueueTail->mNext = NewRestoreNodeBegin;
if (NewRestoreNodeEnd != NULL) {
NewRestoreNodeEnd->mNext = NewLastEndNode;
} else {
NewRestoreNodeBegin->mNext = NewLastEndNode;
}
mBufferNodeQueueTail = NewLastEndNode;
} else if (mBufferNodeQueueTail->mBufferFree - mBufferNodeQueueTail->mBufferStart == 2) {
TmpNode = GetNodeBefore(mBufferNodeQueueTail);
TmpNode->mNext = NewRestoreNodeBegin;
if (NewRestoreNodeEnd != NULL) {
NewRestoreNodeEnd->mNext = mBufferNodeQueueTail;
} else {
NewRestoreNodeBegin->mNext = mBufferNodeQueueTail;
}
}
return VFR_RETURN_SUCCESS;
}
EFI_VFR_RETURN_CODE
CFormPkg::DeclarePendingQuestion (
IN CVfrVarDataTypeDB &lCVfrVarDataTypeDB,
IN CVfrDataStorage &lCVfrDataStorage,
IN CVfrQuestionDB &lCVfrQuestionDB,
IN EFI_GUID *LocalFormSetGuid,
IN UINT32 LineNo
IN UINT32 LineNo,
OUT CHAR8 **InsertOpcodeAddr
)
{
SPendingAssign *pNode;
@ -563,8 +803,10 @@ CFormPkg::DeclarePendingQuestion (
CHAR8 FName[MAX_NAME_LEN];
CHAR8 *SName;
CHAR8 *NewStr;
UINT32 ShrinkSize;
EFI_VFR_RETURN_CODE ReturnCode;
EFI_VFR_VARSTORE_TYPE VarStoreType = EFI_VFR_VARSTORE_INVALID;
EFI_VARSTORE_ID VarStoreId = EFI_VARSTORE_ID_INVALID;
//
// Declare all questions as Numeric in DisableIf True
@ -572,6 +814,7 @@ CFormPkg::DeclarePendingQuestion (
// DisableIf
CIfrDisableIf DIObj;
DIObj.SetLineNo (LineNo);
*InsertOpcodeAddr = DIObj.GetObjBinAddr ();
//TrueOpcode
CIfrTrue TObj (LineNo);
@ -581,7 +824,7 @@ CFormPkg::DeclarePendingQuestion (
if (pNode->mFlag == PENDING) {
CIfrNumeric CNObj;
EFI_VARSTORE_INFO Info;
EFI_QUESTION_ID QId = EFI_QUESTION_ID_INVALID;
EFI_QUESTION_ID QId = EFI_QUESTION_ID_INVALID;
CNObj.SetLineNo (LineNo);
CNObj.SetPrompt (0x0);
@ -611,7 +854,7 @@ CFormPkg::DeclarePendingQuestion (
//
// Get VarStoreType
//
ReturnCode = lCVfrDataStorage.GetVarStoreType (FName, VarStoreType);
ReturnCode = lCVfrDataStorage.GetVarStoreId (FName, &Info.mVarStoreId);
if (ReturnCode == VFR_RETURN_UNDEFINED) {
lCVfrDataStorage.DeclareBufferVarStore (
FName,
@ -621,18 +864,13 @@ CFormPkg::DeclarePendingQuestion (
EFI_VARSTORE_ID_INVALID,
FALSE
);
ReturnCode = lCVfrDataStorage.GetVarStoreType (FName, VarStoreType);
ReturnCode = lCVfrDataStorage.GetVarStoreId (FName, &Info.mVarStoreId, LocalFormSetGuid);
}
if (ReturnCode != VFR_RETURN_SUCCESS) {
gCVfrErrorHandle.PrintMsg (pNode->mLineNo, FName, "Error", "Var Store Type is not defined");
return ReturnCode;
}
ReturnCode = lCVfrDataStorage.GetVarStoreId (FName, &Info.mVarStoreId);
if (ReturnCode != VFR_RETURN_SUCCESS) {
gCVfrErrorHandle.PrintMsg (pNode->mLineNo, FName, "Error", "Var Store Type is not defined");
return ReturnCode;
}
VarStoreType = lCVfrDataStorage.GetVarStoreType (Info.mVarStoreId);
if (*VarStr == '\0' && ArrayIdx != INVALID_ARRAY_INDEX) {
ReturnCode = lCVfrDataStorage.GetNameVarStoreInfo (&Info, ArrayIdx);
@ -642,7 +880,7 @@ CFormPkg::DeclarePendingQuestion (
} else if (VarStoreType == EFI_VFR_VARSTORE_BUFFER) {
VarStr = pNode->mKey;
//convert VarStr with store name to VarStr with structure name
ReturnCode = lCVfrDataStorage.GetBufferVarStoreDataTypeName (FName, &SName);
ReturnCode = lCVfrDataStorage.GetBufferVarStoreDataTypeName (Info.mVarStoreId, &SName);
if (ReturnCode == VFR_RETURN_SUCCESS) {
NewStr = new CHAR8[strlen (VarStr) + strlen (SName) + 1];
NewStr[0] = '\0';
@ -676,19 +914,24 @@ CFormPkg::DeclarePendingQuestion (
switch (Info.mVarType) {
case EFI_IFR_TYPE_NUM_SIZE_64:
CNObj.SetMinMaxStepData ((UINT64) 0, (UINT64) -1 , (UINT64) 0);
ShrinkSize = 0;
break;
case EFI_IFR_TYPE_NUM_SIZE_32:
CNObj.SetMinMaxStepData ((UINT32) 0, (UINT32) -1 , (UINT32) 0);
ShrinkSize = 12;
break;
case EFI_IFR_TYPE_NUM_SIZE_16:
CNObj.SetMinMaxStepData ((UINT16) 0, (UINT16) -1 , (UINT16) 0);
ShrinkSize = 18;
break;
case EFI_IFR_TYPE_NUM_SIZE_8:
CNObj.SetMinMaxStepData ((UINT8) 0, (UINT8) -1 , (UINT8) 0);
ShrinkSize = 21;
break;
default:
break;
}
CNObj.ShrinkBinSize (ShrinkSize);
//
// For undefined Efi VarStore type question
@ -698,7 +941,7 @@ CFormPkg::DeclarePendingQuestion (
CIfrVarEqName CVNObj (QId, Info.mInfo.mVarName);
CVNObj.SetLineNo (LineNo);
}
//
// End for Numeric
//
@ -983,6 +1226,94 @@ CIfrRecordInfoDB::GetOpcodeQuestionId (
return QuestionHead->QuestionId;
}
SIfrRecord *
CIfrRecordInfoDB::GetRecordInfoFromOffset (
IN UINT32 Offset
)
{
SIfrRecord *pNode = NULL;
for (pNode = mIfrRecordListHead; pNode != NULL; pNode = pNode->mNext) {
if (pNode->mOffset == Offset) {
return pNode;
}
}
return pNode;
}
/*
Add just the op code position.
From
| form end opcode + end of if opcode for form ... + Dynamic opcode + form set end opcode |
To
| Dynamic opcode + form end opcode + end of if opcode for form ... + form set end opcode |
*/
BOOLEAN
CIfrRecordInfoDB::IfrAdjustDynamicOpcodeInRecords (
VOID
)
{
UINT32 OpcodeOffset;
SIfrRecord *pNode, *pPreNode;
SIfrRecord *pStartNode, *pNodeBeforeStart;
SIfrRecord *pEndNode;
pStartNode = NULL;
pEndNode = NULL;
OpcodeOffset = 0;
//
// Base on the offset info to get the node.
//
for (pNode = mIfrRecordListHead; pNode->mNext != NULL; pPreNode = pNode,pNode = pNode->mNext) {
if (OpcodeOffset == gAdjustOpcodeOffset) {
pStartNode = pNode;
pNodeBeforeStart = pPreNode;
} else if (OpcodeOffset == gAdjustOpcodeOffset + gAdjustOpcodeLen) {
pEndNode = pPreNode;
}
OpcodeOffset += pNode->mBinBufLen;
}
//
// Check the value.
//
if (pEndNode == NULL || pStartNode == NULL) {
return FALSE;
}
//
// Adjust the node. pPreNode save the Node before mIfrRecordListTail
//
pNodeBeforeStart->mNext = pEndNode->mNext;
pPreNode->mNext = pStartNode;
pEndNode->mNext = mIfrRecordListTail;
return TRUE;
}
VOID
CIfrRecordInfoDB::IfrAdjustOffsetForRecord (
VOID
)
{
UINT32 OpcodeOffset;
SIfrRecord *pNode;
OpcodeOffset = 0;
for (pNode = mIfrRecordListHead; pNode != NULL; pNode = pNode->mNext) {
pNode->mOffset = OpcodeOffset;
OpcodeOffset += pNode->mBinBufLen;
}
}
EFI_VFR_RETURN_CODE
CIfrRecordInfoDB::IfrRecordAdjust (
VOID
@ -1195,11 +1526,7 @@ CIfrRecordInfoDB::IfrRecordAdjust (
// Update Ifr Opcode Offset
//
if (Status == VFR_RETURN_SUCCESS) {
OpcodeOffset = 0;
for (pNode = mIfrRecordListHead; pNode != NULL; pNode = pNode->mNext) {
pNode->mOffset = OpcodeOffset;
OpcodeOffset += pNode->mBinBufLen;
}
IfrAdjustOffsetForRecord ();
}
return Status;
}
@ -1344,7 +1671,7 @@ 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_MODAL_TAG), 0}, // EFI_IFR_MODAL_TAG_OP - 0x61
{ sizeof (EFI_IFR_REFRESH_ID), 0}, // EFI_IFR_REFRESH_ID_OP - 0x62
};
@ -1368,7 +1695,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_MODAL", "EFI_IFR_REFRESH_ID",
"EFI_IFR_SECURITY", "EFI_IFR_MODAL_TAG", "EFI_IFR_REFRESH_ID",
};
VOID

View File

@ -2,7 +2,7 @@
The definition of CFormPkg's member function
Copyright (c) 2004 - 2012, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2004 - 2013, 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
@ -115,6 +115,10 @@ private:
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);
SBufferNode * GetBinBufferNodeForAddr (IN CHAR8 *);
SBufferNode * CreateNewNode ();
SBufferNode * GetNodeBefore (IN SBufferNode *);
EFI_VFR_RETURN_CODE InsertNodeBefore (IN SBufferNode *, IN SBufferNode *);
private:
SPendingAssign *PendingAssignList;
@ -145,12 +149,22 @@ public:
IN CVfrDataStorage &lCVfrDataStorage,
IN CVfrQuestionDB &lCVfrQuestionDB,
IN EFI_GUID *LocalFormSetGuid,
IN UINT32 LineNo
IN UINT32 LineNo,
OUT CHAR8 **InsertOpcodeAddr
);
EFI_VFR_RETURN_CODE AdjustDynamicInsertOpcode (
IN CHAR8 *LastFormEndAddr,
IN CHAR8 *InsertOpcodeAddr
);
CHAR8 * GetBufAddrBaseOnOffset (
IN UINT32 Offset
);
};
extern CFormPkg gCFormPkg;
extern CVfrStringDB gCVfrStringDB;
extern UINT32 gAdjustOpcodeOffset;
extern BOOLEAN gNeedAdjustOpcode;
struct SIfrRecord {
UINT32 mLineNo;
@ -189,6 +203,10 @@ public:
mSwitch = FALSE;
}
SIfrRecord * GetRecordInfoFromOffset (IN UINT32);
VOID IfrAdjustOffsetForRecord (VOID);
BOOLEAN IfrAdjustDynamicOpcodeInRecords (VOID);
UINT32 IfrRecordRegister (IN UINT32, IN CHAR8 *, IN UINT8, IN UINT32);
VOID IfrRecordInfoUpdate (IN UINT32, IN UINT32, IN CHAR8*, IN UINT8, IN UINT32);
VOID IfrRecordOutput (IN FILE *, IN UINT32 LineNo);
@ -227,6 +245,10 @@ public:
return mObjBinBuf;
}
inline UINT32 GetObjBinOffset (VOID) {
return mPkgOffset;
}
inline UINT8 GetObjBinLen (VOID) {
return mObjBinLen;
}
@ -411,6 +433,10 @@ public:
return _FLAGS_ZERO (Flags) ? VFR_RETURN_SUCCESS : VFR_RETURN_FLAGS_UNSUPPORTED;
}
VOID UpdateCIfrQuestionHeader (IN EFI_IFR_QUESTION_HEADER *Header) {
mHeader = Header;
}
};
/*
@ -561,6 +587,10 @@ public:
BOOLEAN IsNumericOpcode () {
return IsNumeric;
}
VOID UpdateCIfrMinMaxStepData (IN MINMAXSTEP_DATA *MinMaxStepData) {
mMinMaxStepData = MinMaxStepData;
}
};
static CIfrQuestionHeader *gCurrentQuestion = NULL;
@ -858,7 +888,7 @@ public:
class CIfrModal : public CIfrObj, public CIfrOpHeader {
private:
EFI_IFR_MODAL *mModal;
EFI_IFR_MODAL_TAG *mModal;
public:
CIfrModal () : CIfrObj (EFI_IFR_MODAL_TAG_OP, (CHAR8 **)&mModal),
@ -900,14 +930,15 @@ private:
public:
CIfrDefault (
IN UINT8 Size,
IN UINT16 DefaultId = EFI_HII_DEFAULT_CLASS_STANDARD,
IN UINT8 Type = EFI_IFR_TYPE_OTHER,
IN EFI_IFR_TYPE_VALUE Value = gZeroEfiIfrTypeValue
) : CIfrObj (EFI_IFR_DEFAULT_OP, (CHAR8 **)&mDefault),
CIfrOpHeader (EFI_IFR_DEFAULT_OP, &mDefault->Header) {
) : CIfrObj (EFI_IFR_DEFAULT_OP, (CHAR8 **)&mDefault, Size),
CIfrOpHeader (EFI_IFR_DEFAULT_OP, &mDefault->Header, Size) {
mDefault->Type = Type;
mDefault->Value = Value;
mDefault->DefaultId = DefaultId;
memcpy (&(mDefault->Value), &Value, Size - OFFSET_OF (EFI_IFR_DEFAULT, Value));
}
VOID SetDefaultId (IN UINT16 DefaultId) {
@ -919,7 +950,30 @@ public:
}
VOID SetValue (IN EFI_IFR_TYPE_VALUE Value) {
mDefault->Value = Value;
memcpy (&mDefault->Value, &Value, mDefault->Header.Length - OFFSET_OF (EFI_IFR_DEFAULT, Value));
}
};
class CIfrDefault2 : public CIfrObj, public CIfrOpHeader {
private:
EFI_IFR_DEFAULT_2 *mDefault;
public:
CIfrDefault2 (
IN UINT16 DefaultId = EFI_HII_DEFAULT_CLASS_STANDARD,
IN UINT8 Type = EFI_IFR_TYPE_OTHER
) : CIfrObj (EFI_IFR_DEFAULT_OP, (CHAR8 **)&mDefault, sizeof (EFI_IFR_DEFAULT_2)),
CIfrOpHeader (EFI_IFR_DEFAULT_OP, &mDefault->Header, sizeof (EFI_IFR_DEFAULT_2)) {
mDefault->Type = Type;
mDefault->DefaultId = DefaultId;
}
VOID SetDefaultId (IN UINT16 DefaultId) {
mDefault->DefaultId = DefaultId;
}
VOID SetType (IN UINT8 Type) {
mDefault->Type = Type;
}
};
@ -1254,7 +1308,7 @@ private:
EFI_IFR_NUMERIC *mNumeric;
public:
CIfrNumeric () : CIfrObj (EFI_IFR_NUMERIC_OP, (CHAR8 **)&mNumeric),
CIfrNumeric () : CIfrObj (EFI_IFR_NUMERIC_OP, (CHAR8 **)&mNumeric, sizeof (EFI_IFR_NUMERIC), TRUE),
CIfrOpHeader (EFI_IFR_NUMERIC_OP, &mNumeric->Header),
CIfrQuestionHeader (&mNumeric->Question),
CIfrMinMaxStepData (&mNumeric->data, TRUE) {
@ -1268,6 +1322,27 @@ public:
gCurrentMinMaxData = NULL;
}
VOID ShrinkBinSize (IN UINT16 Size) {
//
// Update the buffer size which is truly be used later.
//
ShrinkObjBin(Size);
DecLength(Size);
//
// Allocate buffer in gCFormPkg.
//
_EMIT_PENDING_OBJ();
//
// Update the buffer pointer used by other class.
//
mNumeric = (EFI_IFR_NUMERIC *) GetObjBinAddr();
UpdateHeader (&mNumeric->Header);
UpdateCIfrQuestionHeader(&mNumeric->Question);
UpdateCIfrMinMaxStepData(&mNumeric->data);
}
EFI_VFR_RETURN_CODE SetFlags (IN UINT8 HFlags, IN UINT8 LFlags) {
EFI_VFR_RETURN_CODE Ret;
@ -1290,7 +1365,7 @@ private:
EFI_IFR_ONE_OF *mOneOf;
public:
CIfrOneOf () : CIfrObj (EFI_IFR_ONE_OF_OP, (CHAR8 **)&mOneOf),
CIfrOneOf () : CIfrObj (EFI_IFR_ONE_OF_OP, (CHAR8 **)&mOneOf, sizeof (EFI_IFR_ONE_OF), TRUE),
CIfrOpHeader (EFI_IFR_ONE_OF_OP, &mOneOf->Header),
CIfrQuestionHeader (&mOneOf->Question),
CIfrMinMaxStepData (&mOneOf->data) {
@ -1319,6 +1394,27 @@ public:
}
return VFR_RETURN_SUCCESS;
}
VOID ShrinkBinSize (IN UINT16 Size) {
//
// Update the buffer size which is truly be used later.
//
ShrinkObjBin(Size);
DecLength(Size);
//
// Allocate buffer in gCFormPkg.
//
_EMIT_PENDING_OBJ();
//
// Update the buffer pointer used by other class.
//
mOneOf = (EFI_IFR_ONE_OF *) GetObjBinAddr();
UpdateHeader (&mOneOf->Header);
UpdateCIfrQuestionHeader(&mOneOf->Question);
UpdateCIfrMinMaxStepData(&mOneOf->data);
}
};
class CIfrString : public CIfrObj, public CIfrOpHeader, public CIfrQuestionHeader {
@ -1581,12 +1677,12 @@ private:
EFI_IFR_ONE_OF_OPTION *mOneOfOption;
public:
CIfrOneOfOption () : CIfrObj (EFI_IFR_ONE_OF_OPTION_OP, (CHAR8 **)&mOneOfOption),
CIfrOpHeader (EFI_IFR_ONE_OF_OPTION_OP, &mOneOfOption->Header) {
CIfrOneOfOption (UINT8 Size) : CIfrObj (EFI_IFR_ONE_OF_OPTION_OP, (CHAR8 **)&mOneOfOption, Size),
CIfrOpHeader (EFI_IFR_ONE_OF_OPTION_OP, &mOneOfOption->Header, Size) {
mOneOfOption->Flags = 0;
mOneOfOption->Option = EFI_STRING_ID_INVALID;
mOneOfOption->Type = EFI_IFR_TYPE_OTHER;
memset (&mOneOfOption->Value, 0, sizeof (mOneOfOption->Value));
memset (&mOneOfOption->Value, 0, Size - OFFSET_OF (EFI_IFR_ONE_OF_OPTION, Value));
}
VOID SetOption (IN EFI_STRING_ID Option) {
@ -1639,7 +1735,7 @@ public:
}
VOID SetValue (IN EFI_IFR_TYPE_VALUE Value) {
mOneOfOption->Value = Value;
memcpy (&mOneOfOption->Value, &Value, mOneOfOption->Header.Length - OFFSET_OF (EFI_IFR_ONE_OF_OPTION, Value));
}
UINT8 GetFlags (VOID) {

View File

@ -1,5 +1,5 @@
/*++
Copyright (c) 2004 - 2011, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2004 - 2013, 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
@ -494,6 +494,7 @@ vfrFormSetDefinition :
UINT8 ClassGuidNum = 0;
CIfrFormSet *FSObj = NULL;
UINT16 C, SC;
CHAR8* InsertOpcodeAddr = NULL;
>>
L:FormSet
Uuid "=" guidDefinition[Guid] ","
@ -585,7 +586,38 @@ vfrFormSetDefinition :
//
_DeclareDefaultFrameworkVarStore (GET_LINENO(E));
}
CRT_END_OP (E); if (FSObj != NULL) delete FSObj;
//
// Declare undefined Question so that they can be used in expression.
//
if (gCFormPkg.HavePendingUnassigned()) {
mParserStatus += gCFormPkg.DeclarePendingQuestion (
gCVfrVarDataTypeDB,
mCVfrDataStorage,
mCVfrQuestionDB,
&mFormsetGuid,
E->getLine(),
&InsertOpcodeAddr
);
gNeedAdjustOpcode = TRUE;
}
CRT_END_OP (E);
//
// Adjust the pending question position.
// Move the position from current to before the end of the last form in the form set.
//
if (gNeedAdjustOpcode) {
gCFormPkg.AdjustDynamicInsertOpcode (
mLastFormEndAddr,
InsertOpcodeAddr
);
}
if (FSObj != NULL) {
delete FSObj;
}
>>
";"
;
@ -866,7 +898,7 @@ vfrStatementVarStoreLinear :
VarStoreId
), LineNum);
VSObj.SetGuid (&Guid);
_PCATCH(mCVfrDataStorage.GetVarStoreId(StoreName, &VarStoreId), SN);
_PCATCH(mCVfrDataStorage.GetVarStoreId(StoreName, &VarStoreId, &Guid), SN);
VSObj.SetVarStoreId (VarStoreId);
_PCATCH(gCVfrVarDataTypeDB.GetDataTypeSize(TypeName, &Size), LineNum);
VSObj.SetSize ((UINT16) Size);
@ -952,7 +984,7 @@ vfrStatementVarStoreEfi :
TypeName,
VarStoreId
), LineNum);
_PCATCH(mCVfrDataStorage.GetVarStoreId(StoreName, &VarStoreId), SN);
_PCATCH(mCVfrDataStorage.GetVarStoreId(StoreName, &VarStoreId, &Guid), SN);
_PCATCH(gCVfrVarDataTypeDB.GetDataTypeSize(TypeName, &Size), LineNum);
} else {
_PCATCH(mCVfrDataStorage.DeclareBufferVarStore (
@ -962,7 +994,7 @@ vfrStatementVarStoreEfi :
TypeName,
VarStoreId
), LineNum);
_PCATCH(mCVfrDataStorage.GetVarStoreId(TN->getText(), &VarStoreId), VN);
_PCATCH(mCVfrDataStorage.GetVarStoreId(TN->getText(), &VarStoreId, &Guid), VN);
_PCATCH(gCVfrVarDataTypeDB.GetDataTypeSize(TypeName, &Size), N->getLine());
}
VSEObj.SetGuid (&Guid);
@ -995,7 +1027,7 @@ vfrStatementVarStoreNameValue :
Uuid "=" guidDefinition[Guid] << _PCATCH(mCVfrDataStorage.DeclareNameVarStoreEnd (&Guid), SN); >>
<<
VSNVObj.SetGuid (&Guid);
_PCATCH(mCVfrDataStorage.GetVarStoreId(SN->getText(), &VarStoreId), SN);
_PCATCH(mCVfrDataStorage.GetVarStoreId(SN->getText(), &VarStoreId, &Guid), SN);
VSNVObj.SetVarStoreId (VarStoreId);
>>
";"
@ -1069,9 +1101,14 @@ vfrStatementHeader[CIfrStatementHeader *SHObj] :
vfrQuestionHeader[CIfrQuestionHeader & QHObj, EFI_QUESION_TYPE QType = QUESTION_NORMAL]:
<<
EFI_VARSTORE_INFO Info;
Info.mVarType = EFI_IFR_TYPE_OTHER;
Info.mVarTotalSize = 0;
Info.mInfo.mVarOffset = EFI_VAROFFSET_INVALID;
Info.mVarStoreId = EFI_VARSTORE_ID_INVALID;
EFI_QUESTION_ID QId = EFI_QUESTION_ID_INVALID;
CHAR8 *QName = NULL;
CHAR8 *VarIdStr = NULL;
mUsedDefaultCount = 0;
>>
{
Name "=" QN:StringIdentifier "," <<
@ -1119,8 +1156,8 @@ vfrQuestionHeader[CIfrQuestionHeader & QHObj, EFI_QUESION_TYPE QType = QUESTION_
<<
if (VarIdStr != NULL) {
delete VarIdStr;
_SAVE_CURRQEST_VARINFO (Info);
}
_SAVE_CURRQEST_VARINFO (Info);
>>
;
@ -1144,6 +1181,7 @@ vfrStorageVarId[EFI_VARSTORE_INFO & Info, CHAR8 *&QuestVarIdStr, BOOLEAN CheckFl
CHAR8 *TName = NULL;
EFI_VFR_RETURN_CODE VfrReturnCode = VFR_RETURN_SUCCESS;
EFI_IFR_TYPE_VALUE Dummy = gZeroEfiIfrTypeValue;
EFI_GUID *VarGuid = NULL;
>>
(
SN1:StringIdentifier << SName = SN1->getText(); _STRCAT(&VarIdStr, SN1->getText()); >>
@ -1154,7 +1192,7 @@ vfrStorageVarId[EFI_VARSTORE_INFO & Info, CHAR8 *&QuestVarIdStr, BOOLEAN CheckFl
_STRCAT(&VarIdStr, "]");
>>
<<
VfrReturnCode = mCVfrDataStorage.GetVarStoreType (SName, VarStoreType);
VfrReturnCode = mCVfrDataStorage.GetVarStoreId(SName, &$Info.mVarStoreId);
if (mCompatibleMode && VfrReturnCode == VFR_RETURN_UNDEFINED) {
mCVfrDataStorage.DeclareBufferVarStore (
SName,
@ -1164,11 +1202,10 @@ vfrStorageVarId[EFI_VARSTORE_INFO & Info, CHAR8 *&QuestVarIdStr, BOOLEAN CheckFl
EFI_VARSTORE_ID_INVALID,
FALSE
);
VfrReturnCode = mCVfrDataStorage.GetVarStoreType (SName, VarStoreType);
VfrReturnCode = mCVfrDataStorage.GetVarStoreId(SName, &$Info.mVarStoreId, &mFormsetGuid);
}
if (CheckFlag || VfrReturnCode == VFR_RETURN_SUCCESS) {
_PCATCH(VfrReturnCode, SN1);
_PCATCH(mCVfrDataStorage.GetVarStoreId (SName, &$Info.mVarStoreId), SN1);
_PCATCH(mCVfrDataStorage.GetNameVarStoreInfo (&$Info, Idx), SN1);
}
@ -1179,7 +1216,7 @@ vfrStorageVarId[EFI_VARSTORE_INFO & Info, CHAR8 *&QuestVarIdStr, BOOLEAN CheckFl
(
SN2:StringIdentifier << SName = SN2->getText(); _STRCAT(&VarIdStr, SName); >>
<<
VfrReturnCode = mCVfrDataStorage.GetVarStoreType (SName, VarStoreType);
VfrReturnCode = mCVfrDataStorage.GetVarStoreId(SName, &$Info.mVarStoreId);
if (mCompatibleMode && VfrReturnCode == VFR_RETURN_UNDEFINED) {
mCVfrDataStorage.DeclareBufferVarStore (
SName,
@ -1189,13 +1226,13 @@ vfrStorageVarId[EFI_VARSTORE_INFO & Info, CHAR8 *&QuestVarIdStr, BOOLEAN CheckFl
EFI_VARSTORE_ID_INVALID,
FALSE
);
VfrReturnCode = mCVfrDataStorage.GetVarStoreType (SName, VarStoreType);
VfrReturnCode = mCVfrDataStorage.GetVarStoreId(SName, &$Info.mVarStoreId, &mFormsetGuid);
}
if (CheckFlag || VfrReturnCode == VFR_RETURN_SUCCESS) {
_PCATCH(VfrReturnCode, SN2);
_PCATCH(mCVfrDataStorage.GetVarStoreId (SName, &$Info.mVarStoreId), SN2);
VarStoreType = mCVfrDataStorage.GetVarStoreType ($Info.mVarStoreId);
if (VarStoreType == EFI_VFR_VARSTORE_BUFFER) {
_PCATCH(mCVfrDataStorage.GetBufferVarStoreDataTypeName(SName, &TName), SN2);
_PCATCH(mCVfrDataStorage.GetBufferVarStoreDataTypeName(Info.mVarStoreId, &TName), SN2);
_STRCAT(&VarStr, TName);
}
}
@ -1234,13 +1271,16 @@ vfrStorageVarId[EFI_VARSTORE_INFO & Info, CHAR8 *&QuestVarIdStr, BOOLEAN CheckFl
break;
case EFI_VFR_VARSTORE_BUFFER:
_PCATCH(gCVfrVarDataTypeDB.GetDataFieldInfo (VarStr, $Info.mInfo.mVarOffset, $Info.mVarType, $Info.mVarTotalSize), SN2->getLine(), VarStr);
VarGuid = mCVfrDataStorage.GetVarStoreGuid($Info.mVarStoreId);
_PCATCH((EFI_VFR_RETURN_CODE)gCVfrBufferConfig.Register (
SName,
VarGuid,
NULL),
SN2->getLine());
_PCATCH((EFI_VFR_RETURN_CODE)gCVfrBufferConfig.Write (
'a',
SName,
VarGuid,
NULL,
$Info.mVarType,
$Info.mInfo.mVarOffset,
@ -1389,23 +1429,7 @@ vfrFormDefinition :
LObj3.SetNumber (0xffff); //add end label for UEFI, label number hardcode 0xffff
}
//
// Declare undefined Question so that they can be used in expression.
//
if (gCFormPkg.HavePendingUnassigned()) {
gCFormPkg.DeclarePendingQuestion (
gCVfrVarDataTypeDB,
mCVfrDataStorage,
mCVfrQuestionDB,
&mFormsetGuid,
E->getLine()
);
}
//
// mCVfrQuestionDB.PrintAllQuestion();
//
CRT_END_OP (E);
{CIfrEnd EObj; EObj.SetLineNo (E->getLine()); mLastFormEndAddr = EObj.GetObjBinAddr (); gAdjustOpcodeOffset = EObj.GetObjBinOffset ();}
>>
";"
;
@ -1455,42 +1479,72 @@ vfrStatementDefault :
<<
BOOLEAN IsExp = FALSE;
EFI_IFR_TYPE_VALUE Val = gZeroEfiIfrTypeValue;
CIfrDefault DObj;
CIfrDefault *DObj = NULL;
CIfrDefault2 *DObj2 = NULL;
EFI_DEFAULT_ID DefaultId = EFI_HII_DEFAULT_CLASS_STANDARD;
CHAR8 *VarStoreName = NULL;
EFI_VFR_VARSTORE_TYPE VarStoreType = EFI_VFR_VARSTORE_INVALID;
UINT32 Size = 0;
EFI_GUID *VarGuid = NULL;
>>
D:Default << DObj.SetLineNo(D->getLine()); >>
D:Default
(
(
vfrStatementValue "," << IsExp = TRUE; DObj.SetScope (1); CIfrEnd EndObj1; EndObj1.SetLineNo(D->getLine()); >>
| "=" vfrConstantValueField[_GET_CURRQEST_DATATYPE()] > [Val] "," <<
"=" vfrConstantValueField[_GET_CURRQEST_DATATYPE()] > [Val] ","
<<
if (gCurrentMinMaxData != NULL && gCurrentMinMaxData->IsNumericOpcode()) {
//check default value is valid for Numeric Opcode
if (Val.u64 < gCurrentMinMaxData->GetMinData(_GET_CURRQEST_DATATYPE()) || Val.u64 > gCurrentMinMaxData->GetMaxData(_GET_CURRQEST_DATATYPE())) {
_PCATCH (VFR_RETURN_INVALID_PARAMETER, D->getLine(), "Numeric default value must be between MinValue and MaxValue.");
}
}
DObj.SetType (_GET_CURRQEST_DATATYPE());
DObj.SetValue(Val);
if (_GET_CURRQEST_DATATYPE() == EFI_IFR_TYPE_OTHER) {
_PCATCH (VFR_RETURN_FATAL_ERROR, D->getLine(), "Default data type error.");
Size = sizeof (EFI_IFR_TYPE_VALUE);
} else {
_PCATCH (gCVfrVarDataTypeDB.GetDataTypeSize (_GET_CURRQEST_DATATYPE(), &Size), D->getLine());
}
Size += OFFSET_OF (EFI_IFR_DEFAULT, Value);
DObj = new CIfrDefault ((UINT8)Size);
DObj->SetLineNo(D->getLine());
DObj->SetType (_GET_CURRQEST_DATATYPE());
DObj->SetValue(Val);
>>
| << IsExp = TRUE; DObj2 = new CIfrDefault2; DObj2->SetLineNo(D->getLine()); DObj2->SetScope (1); >>
vfrStatementValue "," << CIfrEnd EndObj1; EndObj1.SetLineNo(D->getLine()); >>
)
{
DefaultStore "=" SN:StringIdentifier "," << _PCATCH(mCVfrDefaultStore.GetDefaultId (SN->getText(), &DefaultId), SN); DObj.SetDefaultId (DefaultId); >>
DefaultStore "=" SN:StringIdentifier "," <<
_PCATCH(mCVfrDefaultStore.GetDefaultId (SN->getText(), &DefaultId), SN);
if (DObj != NULL) {
DObj->SetDefaultId (DefaultId);
}
if (DObj2 != NULL) {
DObj2->SetDefaultId (DefaultId);
}
>>
}
<<
CheckDuplicateDefaultValue (DefaultId, D);
if (_GET_CURRQEST_VARTINFO().mVarStoreId != EFI_VARSTORE_ID_INVALID) {
_PCATCH(mCVfrDataStorage.GetVarStoreName (_GET_CURRQEST_VARTINFO().mVarStoreId, &VarStoreName), D->getLine());
_PCATCH(mCVfrDataStorage.GetVarStoreType (VarStoreName, VarStoreType), D->getLine());
VarGuid = mCVfrDataStorage.GetVarStoreGuid(_GET_CURRQEST_VARTINFO().mVarStoreId);
VarStoreType = mCVfrDataStorage.GetVarStoreType (_GET_CURRQEST_VARTINFO().mVarStoreId);
if ((IsExp == FALSE) && (VarStoreType == EFI_VFR_VARSTORE_BUFFER)) {
_PCATCH(mCVfrDefaultStore.BufferVarStoreAltConfigAdd (
DefaultId,
_GET_CURRQEST_VARTINFO(),
VarStoreName,
VarGuid,
_GET_CURRQEST_DATATYPE (),
Val),
D->getLine()
);
Val),
D->getLine()
);
}
}
if (DObj != NULL) {delete DObj;}
if (DObj2 != NULL) {delete DObj2;}
>>
)
;
@ -1755,7 +1809,11 @@ vfrStatementGoto :
default: break;
}
>>
vfrQuestionHeader[*QHObj, QUESTION_REF]
vfrQuestionHeader[*QHObj, QUESTION_REF] <<
if (_GET_CURRQEST_DATATYPE() == EFI_IFR_TYPE_OTHER) {
_GET_CURRQEST_VARTINFO().mVarType = EFI_IFR_TYPE_REF;
}
>>
{ "," F:FLAGS "=" vfrGotoFlags[QHObj, F->getLine()] }
{
"," Key "=" KN:Number << AssignQuestionKey (*QHObj, KN); >>
@ -1824,49 +1882,62 @@ vfrStatementCheckBox :
EFI_IFR_TYPE_VALUE Val = gZeroEfiIfrTypeValue;
CHAR8 *VarStoreName = NULL;
UINT32 DataTypeSize;
EFI_GUID *VarStoreGuid = NULL;
>>
L:CheckBox << CBObj.SetLineNo(L->getLine()); >>
vfrQuestionHeader[CBObj] "," << //check data type
_PCATCH (gCVfrVarDataTypeDB.GetDataTypeSize (_GET_CURRQEST_DATATYPE(), &DataTypeSize), L->getLine(), "CheckBox varid is not the valid data type");
if (DataTypeSize != 0 && DataTypeSize != _GET_CURRQEST_VARSIZE()) {
_PCATCH (VFR_RETURN_INVALID_PARAMETER, L->getLine(), "CheckBox varid doesn't support array");
} else if ((mCVfrDataStorage.GetVarStoreType (_GET_CURRQEST_VARTINFO().mVarStoreId) == EFI_VFR_VARSTORE_BUFFER) &&
(_GET_CURRQEST_VARSIZE() != sizeof (BOOLEAN))) {
_PCATCH (VFR_RETURN_INVALID_PARAMETER, L->getLine(), "CheckBox varid only support BOOLEAN data type");
if (_GET_CURRQEST_DATATYPE() == EFI_IFR_TYPE_OTHER) {
_GET_CURRQEST_VARTINFO().mVarType = EFI_IFR_TYPE_BOOLEAN;
}
if (_GET_CURRQEST_VARTINFO().mVarStoreId != EFI_VARSTORE_ID_INVALID) {
_PCATCH (gCVfrVarDataTypeDB.GetDataTypeSize (_GET_CURRQEST_DATATYPE(), &DataTypeSize), L->getLine(), "CheckBox varid is not the valid data type");
if (DataTypeSize != 0 && DataTypeSize != _GET_CURRQEST_VARSIZE()) {
_PCATCH (VFR_RETURN_INVALID_PARAMETER, L->getLine(), "CheckBox varid doesn't support array");
} else if ((mCVfrDataStorage.GetVarStoreType (_GET_CURRQEST_VARTINFO().mVarStoreId) == EFI_VFR_VARSTORE_BUFFER) &&
(_GET_CURRQEST_VARSIZE() != sizeof (BOOLEAN))) {
_PCATCH (VFR_RETURN_INVALID_PARAMETER, L->getLine(), "CheckBox varid only support BOOLEAN data type");
}
}
>>
{
F:FLAGS "=" vfrCheckBoxFlags[CBObj, F->getLine()] ","
<<
_PCATCH(mCVfrDataStorage.GetVarStoreName (_GET_CURRQEST_VARTINFO().mVarStoreId, &VarStoreName), VFR_RETURN_SUCCESS, L, "Failed to retrieve varstore name");
Val.b = TRUE;
if (CBObj.GetFlags () & 0x01) {
_PCATCH(
mCVfrDefaultStore.BufferVarStoreAltConfigAdd (
EFI_HII_DEFAULT_CLASS_STANDARD,
_GET_CURRQEST_VARTINFO(),
VarStoreName,
_GET_CURRQEST_DATATYPE (),
Val
),
VFR_RETURN_SUCCESS,
L,
"No standard default storage found"
);
}
if (CBObj.GetFlags () & 0x02) {
_PCATCH(
mCVfrDefaultStore.BufferVarStoreAltConfigAdd (
EFI_HII_DEFAULT_CLASS_MANUFACTURING,
_GET_CURRQEST_VARTINFO(),
VarStoreName,
_GET_CURRQEST_DATATYPE (),
Val
),
VFR_RETURN_SUCCESS,
L,
"No manufacturing default storage found"
);
if (_GET_CURRQEST_VARTINFO().mVarStoreId != EFI_VARSTORE_ID_INVALID) {
_PCATCH(mCVfrDataStorage.GetVarStoreName (_GET_CURRQEST_VARTINFO().mVarStoreId, &VarStoreName), VFR_RETURN_SUCCESS, L, "Failed to retrieve varstore name");
VarStoreGuid = mCVfrDataStorage.GetVarStoreGuid(_GET_CURRQEST_VARTINFO().mVarStoreId);
Val.b = TRUE;
if (CBObj.GetFlags () & 0x01) {
CheckDuplicateDefaultValue (EFI_HII_DEFAULT_CLASS_STANDARD, F);
_PCATCH(
mCVfrDefaultStore.BufferVarStoreAltConfigAdd (
EFI_HII_DEFAULT_CLASS_STANDARD,
_GET_CURRQEST_VARTINFO(),
VarStoreName,
VarStoreGuid,
_GET_CURRQEST_DATATYPE (),
Val
),
VFR_RETURN_SUCCESS,
L,
"No standard default storage found"
);
}
if (CBObj.GetFlags () & 0x02) {
CheckDuplicateDefaultValue (EFI_HII_DEFAULT_CLASS_MANUFACTURING, F);
_PCATCH(
mCVfrDefaultStore.BufferVarStoreAltConfigAdd (
EFI_HII_DEFAULT_CLASS_MANUFACTURING,
_GET_CURRQEST_VARTINFO(),
VarStoreName,
VarStoreGuid,
_GET_CURRQEST_DATATYPE (),
Val
),
VFR_RETURN_SUCCESS,
L,
"No manufacturing default storage found"
);
}
}
>>
}
@ -1962,11 +2033,16 @@ vfrStatementDate :
CHAR8 *VarIdStr[3] = {NULL, };
CIfrDate DObj;
EFI_IFR_TYPE_VALUE Val = gZeroEfiIfrTypeValue;
UINT8 Size = OFFSET_OF (EFI_IFR_DEFAULT, Value) + sizeof (EFI_HII_DATE);
>>
L:Date << DObj.SetLineNo(L->getLine()); >>
(
(
vfrQuestionHeader[DObj, QUESTION_DATE] ","
vfrQuestionHeader[DObj, QUESTION_DATE] "," <<
if (_GET_CURRQEST_DATATYPE() == EFI_IFR_TYPE_OTHER) {
_GET_CURRQEST_VARTINFO().mVarType = EFI_IFR_TYPE_DATE;
}
>>
{ F:FLAGS "=" vfrDateFlags[DObj, F->getLine()] "," }
vfrStatementQuestionOptionList
)
@ -1998,7 +2074,7 @@ vfrStatementDate :
DObj.SetHelp (_STOSID(YH->getText()));
if (VarIdStr[0] != NULL) { delete VarIdStr[0]; } if (VarIdStr[1] != NULL) { delete VarIdStr[1]; } if (VarIdStr[2] != NULL) { delete VarIdStr[2]; }
>>
<< {CIfrDefault DefaultObj(EFI_HII_DEFAULT_CLASS_STANDARD, EFI_IFR_TYPE_DATE, Val); DefaultObj.SetLineNo(L->getLine());} >>
<< {CIfrDefault DefaultObj(Size, EFI_HII_DEFAULT_CLASS_STANDARD, EFI_IFR_TYPE_DATE, Val); DefaultObj.SetLineNo(L->getLine());} >>
)
( vfrStatementInconsistentIf )*
)
@ -2126,38 +2202,45 @@ vfrSetMinMaxStep[CIfrMinMaxStepData & MMSDObj] :
vfrStatementNumeric :
<<
CIfrNumeric NObj;
UINT32 DataTypeSize;
BOOLEAN IsSupported;
UINT32 DataTypeSize;
BOOLEAN IsSupported = TRUE;
UINT8 ShrinkSize = 0;
>>
L:Numeric << NObj.SetLineNo(L->getLine()); >>
vfrQuestionHeader[NObj] "," << // check data type
_PCATCH (gCVfrVarDataTypeDB.GetDataTypeSize (_GET_CURRQEST_DATATYPE(), &DataTypeSize), L->getLine(), "Numeric varid is not the valid data type");
if (DataTypeSize != 0 && DataTypeSize != _GET_CURRQEST_VARSIZE()) {
_PCATCH (VFR_RETURN_INVALID_PARAMETER, L->getLine(), "Numeric varid doesn't support array");
if (_GET_CURRQEST_VARTINFO().mVarStoreId != EFI_VARSTORE_ID_INVALID) {
_PCATCH (gCVfrVarDataTypeDB.GetDataTypeSize (_GET_CURRQEST_DATATYPE(), &DataTypeSize), L->getLine(), "Numeric varid is not the valid data type");
if (DataTypeSize != 0 && DataTypeSize != _GET_CURRQEST_VARSIZE()) {
_PCATCH (VFR_RETURN_INVALID_PARAMETER, L->getLine(), "Numeric varid doesn't support array");
}
_PCATCH(NObj.SetFlags (NObj.FLAGS(), _GET_CURRQEST_DATATYPE()), L->getLine());
}
_PCATCH(NObj.SetFlags (NObj.FLAGS(), _GET_CURRQEST_DATATYPE()), L->getLine());
>>
{ F:FLAGS "=" vfrNumericFlags[NObj, F->getLine()] "," }
{
Key "=" KN:Number "," << AssignQuestionKey (NObj, KN); >>
}
vfrSetMinMaxStep[NObj]
vfrStatementQuestionOptionList
E:EndNumeric <<
IsSupported = FALSE;
vfrSetMinMaxStep[NObj] <<
switch (_GET_CURRQEST_DATATYPE()) {
case EFI_IFR_TYPE_NUM_SIZE_8:
case EFI_IFR_TYPE_NUM_SIZE_16:
case EFI_IFR_TYPE_NUM_SIZE_32:
case EFI_IFR_TYPE_NUM_SIZE_64:
IsSupported = TRUE;
break;
default:
//
// Base on the type to know the actual used size,shrink the buffer
// size allocate before.
//
case EFI_IFR_TYPE_NUM_SIZE_8: ShrinkSize = 21;break;
case EFI_IFR_TYPE_NUM_SIZE_16:ShrinkSize = 18;break;
case EFI_IFR_TYPE_NUM_SIZE_32:ShrinkSize = 12;break;
case EFI_IFR_TYPE_NUM_SIZE_64:break;
default:
IsSupported = FALSE;
break;
}
NObj.ShrinkBinSize (ShrinkSize);
if (!IsSupported) {
_PCATCH (VFR_RETURN_INVALID_PARAMETER, L->getLine(), "Numeric question only support UINT8, UINT16, UINT32 and UINT64 data type.");
}
>>
vfrStatementQuestionOptionList
E:EndNumeric <<
CRT_END_OP (E);
>>
";"
@ -2168,32 +2251,37 @@ vfrNumericFlags [CIfrNumeric & NObj, UINT32 LineNum] :
UINT8 LFlags = _GET_CURRQEST_DATATYPE() & EFI_IFR_NUMERIC_SIZE;
UINT8 HFlags = 0;
EFI_VFR_VARSTORE_TYPE VarStoreType = EFI_VFR_VARSTORE_INVALID;
BOOLEAN IsSetType = FALSE;
>>
numericFlagsField[HFlags, LFlags] ( "\|" numericFlagsField[HFlags, LFlags] )*
numericFlagsField[HFlags, LFlags, IsSetType] ( "\|" numericFlagsField[HFlags, LFlags, IsSetType] )*
<<
//check data type flag
VarStoreType = mCVfrDataStorage.GetVarStoreType (_GET_CURRQEST_VARTINFO().mVarStoreId);
if (VarStoreType == EFI_VFR_VARSTORE_BUFFER || VarStoreType == EFI_VFR_VARSTORE_EFI) {
if (_GET_CURRQEST_DATATYPE() != (LFlags & EFI_IFR_NUMERIC_SIZE)) {
_PCATCH(VFR_RETURN_INVALID_PARAMETER, LineNum, "Numeric Flag is not same to Numeric VarData type");
if (_GET_CURRQEST_VARTINFO().mVarStoreId != EFI_VARSTORE_ID_INVALID) {
VarStoreType = mCVfrDataStorage.GetVarStoreType (_GET_CURRQEST_VARTINFO().mVarStoreId);
if (VarStoreType == EFI_VFR_VARSTORE_BUFFER || VarStoreType == EFI_VFR_VARSTORE_EFI) {
if (_GET_CURRQEST_DATATYPE() != (LFlags & EFI_IFR_NUMERIC_SIZE)) {
_PCATCH(VFR_RETURN_INVALID_PARAMETER, LineNum, "Numeric Flag is not same to Numeric VarData type");
}
} else {
// update data type for name/value store
UINT32 DataTypeSize;
_GET_CURRQEST_VARTINFO().mVarType = LFlags & EFI_IFR_NUMERIC_SIZE;
gCVfrVarDataTypeDB.GetDataTypeSize (_GET_CURRQEST_DATATYPE(), &DataTypeSize);
_GET_CURRQEST_VARTINFO().mVarTotalSize = DataTypeSize;
}
} else {
// update data type for name/value store
UINT32 DataTypeSize;
} else if (IsSetType){
_GET_CURRQEST_VARTINFO().mVarType = LFlags & EFI_IFR_NUMERIC_SIZE;
gCVfrVarDataTypeDB.GetDataTypeSize (_GET_CURRQEST_DATATYPE(), &DataTypeSize);
_GET_CURRQEST_VARTINFO().mVarTotalSize = DataTypeSize;
}
_PCATCH(NObj.SetFlags (HFlags, LFlags), LineNum);
>>
;
numericFlagsField [UINT8 & HFlags, UINT8 & LFlags] :
numericFlagsField [UINT8 & HFlags, UINT8 & LFlags, BOOLEAN & IsSetType] :
N:Number << _PCATCH(_STOU8(N->getText()) == 0 ? VFR_RETURN_SUCCESS : VFR_RETURN_UNSUPPORTED, N->getLine()); >>
| "NUMERIC_SIZE_1" << $LFlags = ($LFlags & ~EFI_IFR_NUMERIC_SIZE) | EFI_IFR_NUMERIC_SIZE_1; >>
| "NUMERIC_SIZE_2" << $LFlags = ($LFlags & ~EFI_IFR_NUMERIC_SIZE) | EFI_IFR_NUMERIC_SIZE_2; >>
| "NUMERIC_SIZE_4" << $LFlags = ($LFlags & ~EFI_IFR_NUMERIC_SIZE) | EFI_IFR_NUMERIC_SIZE_4; >>
| "NUMERIC_SIZE_8" << $LFlags = ($LFlags & ~EFI_IFR_NUMERIC_SIZE) | EFI_IFR_NUMERIC_SIZE_8; >>
| "NUMERIC_SIZE_1" << $LFlags = ($LFlags & ~EFI_IFR_NUMERIC_SIZE) | EFI_IFR_NUMERIC_SIZE_1; IsSetType = TRUE;>>
| "NUMERIC_SIZE_2" << $LFlags = ($LFlags & ~EFI_IFR_NUMERIC_SIZE) | EFI_IFR_NUMERIC_SIZE_2; IsSetType = TRUE;>>
| "NUMERIC_SIZE_4" << $LFlags = ($LFlags & ~EFI_IFR_NUMERIC_SIZE) | EFI_IFR_NUMERIC_SIZE_4; IsSetType = TRUE;>>
| "NUMERIC_SIZE_8" << $LFlags = ($LFlags & ~EFI_IFR_NUMERIC_SIZE) | EFI_IFR_NUMERIC_SIZE_8; IsSetType = TRUE;>>
| "DISPLAY_INT_DEC" << $LFlags = ($LFlags & ~EFI_IFR_DISPLAY) | EFI_IFR_DISPLAY_INT_DEC; >>
| "DISPLAY_UINT_DEC" << $LFlags = ($LFlags & ~EFI_IFR_DISPLAY) | EFI_IFR_DISPLAY_UINT_DEC; >>
| "DISPLAY_UINT_HEX" << $LFlags = ($LFlags & ~EFI_IFR_DISPLAY) | EFI_IFR_DISPLAY_UINT_HEX; >>
@ -2204,36 +2292,44 @@ vfrStatementOneOf :
<<
CIfrOneOf OObj;
UINT32 DataTypeSize;
BOOLEAN IsSupported;
BOOLEAN IsSupported = TRUE;
UINT8 ShrinkSize = 0;
>>
L:OneOf << OObj.SetLineNo(L->getLine()); >>
vfrQuestionHeader[OObj] "," << //check data type
_PCATCH (gCVfrVarDataTypeDB.GetDataTypeSize (_GET_CURRQEST_DATATYPE(), &DataTypeSize), L->getLine(), "OneOf varid is not the valid data type");
if (DataTypeSize != 0 && DataTypeSize != _GET_CURRQEST_VARSIZE()) {
_PCATCH (VFR_RETURN_INVALID_PARAMETER, L->getLine(), "OneOf varid doesn't support array");
if (_GET_CURRQEST_VARTINFO().mVarStoreId != EFI_VARSTORE_ID_INVALID) {
_PCATCH (gCVfrVarDataTypeDB.GetDataTypeSize (_GET_CURRQEST_DATATYPE(), &DataTypeSize), L->getLine(), "OneOf varid is not the valid data type");
if (DataTypeSize != 0 && DataTypeSize != _GET_CURRQEST_VARSIZE()) {
_PCATCH (VFR_RETURN_INVALID_PARAMETER, L->getLine(), "OneOf varid doesn't support array");
}
_PCATCH(OObj.SetFlags (OObj.FLAGS(), _GET_CURRQEST_DATATYPE()), L->getLine());
}
_PCATCH(OObj.SetFlags (OObj.FLAGS(), _GET_CURRQEST_DATATYPE()), L->getLine());
>>
{ F:FLAGS "=" vfrOneofFlagsField[OObj, F->getLine()] "," }
{
vfrSetMinMaxStep[OObj]
}
vfrStatementQuestionOptionList
E:EndOneOf <<
IsSupported = FALSE;
<<
switch (_GET_CURRQEST_DATATYPE()) {
case EFI_IFR_TYPE_NUM_SIZE_8:
case EFI_IFR_TYPE_NUM_SIZE_16:
case EFI_IFR_TYPE_NUM_SIZE_32:
case EFI_IFR_TYPE_NUM_SIZE_64:
IsSupported = TRUE;
break;
//
// Base on the type to know the actual used size,shrink the buffer
// size allocate before.
//
case EFI_IFR_TYPE_NUM_SIZE_8: ShrinkSize = 21;break;
case EFI_IFR_TYPE_NUM_SIZE_16:ShrinkSize = 18;break;
case EFI_IFR_TYPE_NUM_SIZE_32:ShrinkSize = 12;break;
case EFI_IFR_TYPE_NUM_SIZE_64:break;
default:
IsSupported = FALSE;
break;
}
OObj.ShrinkBinSize (ShrinkSize);
if (!IsSupported) {
_PCATCH (VFR_RETURN_INVALID_PARAMETER, L->getLine(), "OneOf question only support UINT8, UINT16, UINT32 and UINT64 data type.");
}
>>
vfrStatementQuestionOptionList
E:EndOneOf <<
CRT_END_OP (E);
>>
";"
@ -2244,21 +2340,26 @@ vfrOneofFlagsField [CIfrOneOf & OObj, UINT32 LineNum] :
UINT8 LFlags = _GET_CURRQEST_DATATYPE() & EFI_IFR_NUMERIC_SIZE;
UINT8 HFlags = 0;
EFI_VFR_VARSTORE_TYPE VarStoreType = EFI_VFR_VARSTORE_INVALID;
BOOLEAN IsSetType = FALSE;
>>
numericFlagsField[HFlags, LFlags] ( "\|" numericFlagsField[HFlags, LFlags] )*
numericFlagsField[HFlags, LFlags, IsSetType] ( "\|" numericFlagsField[HFlags, LFlags, IsSetType] )*
<<
//check data type flag
VarStoreType = mCVfrDataStorage.GetVarStoreType (_GET_CURRQEST_VARTINFO().mVarStoreId);
if (VarStoreType == EFI_VFR_VARSTORE_BUFFER || VarStoreType == EFI_VFR_VARSTORE_EFI) {
if (_GET_CURRQEST_DATATYPE() != (LFlags & EFI_IFR_NUMERIC_SIZE)) {
_PCATCH(VFR_RETURN_INVALID_PARAMETER, LineNum, "Numeric Flag is not same to Numeric VarData type");
if (_GET_CURRQEST_VARTINFO().mVarStoreId != EFI_VARSTORE_ID_INVALID) {
VarStoreType = mCVfrDataStorage.GetVarStoreType (_GET_CURRQEST_VARTINFO().mVarStoreId);
if (VarStoreType == EFI_VFR_VARSTORE_BUFFER || VarStoreType == EFI_VFR_VARSTORE_EFI) {
if (_GET_CURRQEST_DATATYPE() != (LFlags & EFI_IFR_NUMERIC_SIZE)) {
_PCATCH(VFR_RETURN_INVALID_PARAMETER, LineNum, "Numeric Flag is not same to Numeric VarData type");
}
} else {
// update data type for Name/Value store
UINT32 DataTypeSize;
_GET_CURRQEST_VARTINFO().mVarType = LFlags & EFI_IFR_NUMERIC_SIZE;
gCVfrVarDataTypeDB.GetDataTypeSize (_GET_CURRQEST_DATATYPE(), &DataTypeSize);
_GET_CURRQEST_VARTINFO().mVarTotalSize = DataTypeSize;
}
} else {
// update data type for Name/Value store
UINT32 DataTypeSize;
} else if (IsSetType){
_GET_CURRQEST_VARTINFO().mVarType = LFlags & EFI_IFR_NUMERIC_SIZE;
gCVfrVarDataTypeDB.GetDataTypeSize (_GET_CURRQEST_DATATYPE(), &DataTypeSize);
_GET_CURRQEST_VARTINFO().mVarTotalSize = DataTypeSize;
}
_PCATCH(OObj.SetFlags (HFlags, LFlags), LineNum);
>>
@ -2423,11 +2524,16 @@ vfrStatementTime :
CHAR8 *VarIdStr[3] = {NULL, };
CIfrTime TObj;
EFI_IFR_TYPE_VALUE Val = gZeroEfiIfrTypeValue;
UINT8 Size = OFFSET_OF (EFI_IFR_DEFAULT, Value) + sizeof (EFI_HII_TIME);
>>
L:Time << TObj.SetLineNo(L->getLine()); >>
(
(
vfrQuestionHeader[TObj, QUESTION_TIME] ","
vfrQuestionHeader[TObj, QUESTION_TIME] "," <<
if (_GET_CURRQEST_DATATYPE() == EFI_IFR_TYPE_OTHER) {
_GET_CURRQEST_VARTINFO().mVarType = EFI_IFR_TYPE_TIME;
}
>>
{ F:FLAGS "=" vfrTimeFlags[TObj, F->getLine()] "," }
vfrStatementQuestionOptionList
)
@ -2459,7 +2565,7 @@ vfrStatementTime :
TObj.SetHelp (_STOSID(HH->getText()));
if (VarIdStr[0] != NULL) { delete VarIdStr[0]; } if (VarIdStr[1] != NULL) { delete VarIdStr[1]; } if (VarIdStr[2] != NULL) { delete VarIdStr[2]; }
>>
<< {CIfrDefault DefaultObj(EFI_HII_DEFAULT_CLASS_STANDARD, EFI_IFR_TYPE_TIME, Val); DefaultObj.SetLineNo(L->getLine());} >>
<< {CIfrDefault DefaultObj(Size, EFI_HII_DEFAULT_CLASS_STANDARD, EFI_IFR_TYPE_TIME, Val); DefaultObj.SetLineNo(L->getLine());} >>
)
( vfrStatementInconsistentIf )*
)
@ -2774,11 +2880,32 @@ vfrStatementOptions :
vfrStatementOneOfOption :
<<
EFI_IFR_TYPE_VALUE Val = gZeroEfiIfrTypeValue;
CIfrOneOfOption OOOObj;
EFI_IFR_TYPE_VALUE Val = gZeroEfiIfrTypeValue;
CHAR8 *VarStoreName = NULL;
UINT32 Size = 0;
BOOLEAN TypeError = FALSE;
EFI_VFR_RETURN_CODE ReturnCode = VFR_RETURN_SUCCESS;
EFI_GUID *VarStoreGuid = NULL;
if (_GET_CURRQEST_DATATYPE() == EFI_IFR_TYPE_OTHER) {
TypeError = TRUE;
Size = sizeof (EFI_IFR_TYPE_VALUE);
} else {
ReturnCode = gCVfrVarDataTypeDB.GetDataTypeSize (_GET_CURRQEST_DATATYPE(), &Size);
}
Size += OFFSET_OF (EFI_IFR_ONE_OF_OPTION, Value);
CIfrOneOfOption OOOObj ((UINT8)Size);
>>
L:Option << OOOObj.SetLineNo(L->getLine()); >>
L:Option <<
OOOObj.SetLineNo(L->getLine());
if (TypeError) {
_PCATCH (VFR_RETURN_FATAL_ERROR, L->getLine(), "Get data type error.");
}
if (ReturnCode != VFR_RETURN_SUCCESS) {
_PCATCH (ReturnCode, L->getLine());
}
>>
Text "=" "STRING_TOKEN" "\(" S:Number "\)" "," << OOOObj.SetOption (_STOSID(S->getText())); >>
Value "=" vfrConstantValueField[_GET_CURRQEST_DATATYPE()] >[Val] ","
<<
@ -2807,24 +2934,31 @@ vfrStatementOneOfOption :
>>
F:FLAGS "=" vfrOneOfOptionFlags[OOOObj, F->getLine()]
<<
_PCATCH(mCVfrDataStorage.GetVarStoreName (_GET_CURRQEST_VARTINFO().mVarStoreId, &VarStoreName), L->getLine());
if (OOOObj.GetFlags () & 0x10) {
_PCATCH(mCVfrDefaultStore.BufferVarStoreAltConfigAdd (
EFI_HII_DEFAULT_CLASS_STANDARD,
_GET_CURRQEST_VARTINFO(),
VarStoreName,
_GET_CURRQEST_DATATYPE (),
Val
), L->getLine());
}
if (OOOObj.GetFlags () & 0x20) {
_PCATCH(mCVfrDefaultStore.BufferVarStoreAltConfigAdd (
EFI_HII_DEFAULT_CLASS_MANUFACTURING,
_GET_CURRQEST_VARTINFO(),
VarStoreName,
_GET_CURRQEST_DATATYPE (),
Val
), L->getLine());
if (_GET_CURRQEST_VARTINFO().mVarStoreId != EFI_VARSTORE_ID_INVALID) {
_PCATCH(mCVfrDataStorage.GetVarStoreName (_GET_CURRQEST_VARTINFO().mVarStoreId, &VarStoreName), L->getLine());
VarStoreGuid = mCVfrDataStorage.GetVarStoreGuid(_GET_CURRQEST_VARTINFO().mVarStoreId);
if (OOOObj.GetFlags () & 0x10) {
CheckDuplicateDefaultValue (EFI_HII_DEFAULT_CLASS_STANDARD, F);
_PCATCH(mCVfrDefaultStore.BufferVarStoreAltConfigAdd (
EFI_HII_DEFAULT_CLASS_STANDARD,
_GET_CURRQEST_VARTINFO(),
VarStoreName,
VarStoreGuid,
_GET_CURRQEST_DATATYPE (),
Val
), L->getLine());
}
if (OOOObj.GetFlags () & 0x20) {
CheckDuplicateDefaultValue (EFI_HII_DEFAULT_CLASS_MANUFACTURING, F);
_PCATCH(mCVfrDefaultStore.BufferVarStoreAltConfigAdd (
EFI_HII_DEFAULT_CLASS_MANUFACTURING,
_GET_CURRQEST_VARTINFO(),
VarStoreName,
VarStoreGuid,
_GET_CURRQEST_DATATYPE (),
Val
), L->getLine());
}
}
>>
{
@ -3237,8 +3371,8 @@ vareqvalExp [UINT32 & RootLevel, UINT32 & ExpOpCount] :
UINT16 ConstVal;
CHAR8 *VarIdStr;
UINT32 LineNo;
EFI_VFR_VARSTORE_TYPE VarStoreType = EFI_VFR_VARSTORE_INVALID;
EFI_VFR_RETURN_CODE VfrReturnCode = VFR_RETURN_SUCCESS;
EFI_VARSTORE_ID VarStoreId = EFI_VARSTORE_ID_INVALID;
>>
L:VarEqVal <<
if (!mCompatibleMode) {
@ -3249,7 +3383,7 @@ vareqvalExp [UINT32 & RootLevel, UINT32 & ExpOpCount] :
OpenParen
VN:Number <<
VarIdStr = NULL; _STRCAT(&VarIdStr, VK->getText()); _STRCAT(&VarIdStr, VN->getText());
VfrReturnCode = mCVfrDataStorage.GetVarStoreType (VarIdStr, VarStoreType);
VfrReturnCode = mCVfrDataStorage.GetVarStoreId (VarIdStr, &VarStoreId);
if (VfrReturnCode == VFR_RETURN_UNDEFINED) {
_PCATCH (mCVfrDataStorage.DeclareEfiVarStore (
VarIdStr,
@ -3887,6 +4021,13 @@ private:
EFI_VARSTORE_INFO mCurrQestVarInfo;
EFI_GUID *mOverrideClassGuid;
CHAR8* mLastFormEndAddr;
//
// Whether the question already has default value.
//
UINT16 mUsedDefaultArray[EFI_IFR_MAX_DEFAULT_TYPE];
UINT16 mUsedDefaultCount;
//
// For framework vfr compatibility
@ -3902,6 +4043,7 @@ private:
UINT8 _GET_CURRQEST_DATATYPE ();
UINT32 _GET_CURRQEST_VARSIZE ();
UINT32 _GET_CURRQEST_ARRAY_SIZE();
VOID CheckDuplicateDefaultValue (IN EFI_DEFAULT_ID, IN ANTLRTokenPtr);
public:
VOID _PCATCH (IN INTN, IN INTN, IN ANTLRTokenPtr, IN CONST CHAR8 *);
@ -4485,7 +4627,7 @@ EfiVfrParser::_DeclareDefaultLinearVarStore (
TypeNameList[Index],
EFI_VARSTORE_ID_INVALID
);
mCVfrDataStorage.GetVarStoreId(TypeNameList[Index], &VarStoreId);
mCVfrDataStorage.GetVarStoreId(TypeNameList[Index], &VarStoreId, &mFormsetGuid);
VSObj.SetVarStoreId (VarStoreId);
gCVfrVarDataTypeDB.GetDataTypeSize(TypeNameList[Index], &Size);
VSObj.SetSize ((UINT16) Size);
@ -4510,7 +4652,7 @@ EfiVfrParser::_DeclareDefaultLinearVarStore (
(CHAR8 *) DateType,
EFI_VARSTORE_ID_INVALID
);
mCVfrDataStorage.GetVarStoreId((CHAR8 *) DateName, &VarStoreId);
mCVfrDataStorage.GetVarStoreId((CHAR8 *) DateName, &VarStoreId, &mFormsetGuid);
VSObj.SetVarStoreId (VarStoreId);
gCVfrVarDataTypeDB.GetDataTypeSize((CHAR8 *) DateType, &Size);
VSObj.SetSize ((UINT16) Size);
@ -4531,7 +4673,7 @@ EfiVfrParser::_DeclareDefaultLinearVarStore (
(CHAR8 *) TimeType,
EFI_VARSTORE_ID_INVALID
);
mCVfrDataStorage.GetVarStoreId((CHAR8 *) TimeName, &VarStoreId);
mCVfrDataStorage.GetVarStoreId((CHAR8 *) TimeName, &VarStoreId, &mFormsetGuid);
VSObj.SetVarStoreId (VarStoreId);
gCVfrVarDataTypeDB.GetDataTypeSize((CHAR8 *) TimeType, &Size);
VSObj.SetSize ((UINT16) Size);
@ -4762,4 +4904,25 @@ EfiVfrParser::SetCompatibleMode (IN BOOLEAN Mode)
mCompatibleMode = Mode;
mCVfrQuestionDB.SetCompatibleMode (Mode);
}
VOID
EfiVfrParser::CheckDuplicateDefaultValue (
IN EFI_DEFAULT_ID DefaultId,
IN ANTLRTokenPtr Tok
)
{
UINT16 Index;
for(Index = 0; Index < mUsedDefaultCount; Index++) {
if (mUsedDefaultArray[Index] == DefaultId) {
gCVfrErrorHandle.HandleWarning (VFR_WARNING_DEFAULT_VALUE_REDEFINED, Tok->getLine(), Tok->getText());
}
}
if (mUsedDefaultCount >= EFI_IFR_MAX_DEFAULT_TYPE - 1) {
gCVfrErrorHandle.HandleError (VFR_RETURN_FATAL_ERROR, Tok->getLine(), Tok->getText());
}
mUsedDefaultArray[mUsedDefaultCount++] = DefaultId;
}
>>

View File

@ -2,7 +2,7 @@
Vfr common library functions.
Copyright (c) 2004 - 2012, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2004 - 2013, 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
@ -123,11 +123,13 @@ SConfigInfo::~SConfigInfo (
SConfigItem::SConfigItem (
IN CHAR8 *Name,
IN EFI_GUID *Guid,
IN CHAR8 *Id
)
{
mName = NULL;
mId = 0;
mGuid = NULL;
mId = NULL;
mInfoStrList = NULL;
mNext = NULL;
@ -137,6 +139,12 @@ SConfigItem::SConfigItem (
}
}
if (Guid != NULL) {
if ((mGuid = (EFI_GUID *) new CHAR8[sizeof (EFI_GUID)]) != NULL) {
memcpy (mGuid, Guid, sizeof (EFI_GUID));
}
}
if (Id != NULL) {
if ((mId = new CHAR8[strlen (Id) + 1]) != NULL) {
strcpy (mId, Id);
@ -146,6 +154,7 @@ SConfigItem::SConfigItem (
SConfigItem::SConfigItem (
IN CHAR8 *Name,
IN EFI_GUID *Guid,
IN CHAR8 *Id,
IN UINT8 Type,
IN UINT16 Offset,
@ -154,6 +163,7 @@ SConfigItem::SConfigItem (
)
{
mName = NULL;
mGuid = NULL;
mId = NULL;
mInfoStrList = NULL;
mNext = NULL;
@ -164,6 +174,12 @@ SConfigItem::SConfigItem (
}
}
if (Guid != NULL) {
if ((mGuid = (EFI_GUID *) new CHAR8[sizeof (EFI_GUID)]) != NULL) {
memcpy (mGuid, Guid, sizeof (EFI_GUID));
}
}
if (Id != NULL) {
if ((mId = new CHAR8[strlen (Id) + 1]) != NULL) {
strcpy (mId, Id);
@ -180,6 +196,7 @@ SConfigItem::~SConfigItem (
SConfigInfo *Info;
BUFFER_SAFE_FREE (mName);
BUFFER_SAFE_FREE (mGuid);
BUFFER_SAFE_FREE (mId);
while (mInfoStrList != NULL) {
Info = mInfoStrList;
@ -192,18 +209,20 @@ SConfigItem::~SConfigItem (
UINT8
CVfrBufferConfig::Register (
IN CHAR8 *Name,
IN EFI_GUID *Guid,
IN CHAR8 *Id
)
{
SConfigItem *pNew;
if (Select (Name) == 0) {
if (Select (Name, Guid) == 0) {
return 1;
}
if ((pNew = new SConfigItem (Name, Id)) == NULL) {
if ((pNew = new SConfigItem (Name, Guid, Id)) == NULL) {
return 2;
}
if (mItemListHead == NULL) {
mItemListHead = pNew;
mItemListTail = pNew;
@ -234,18 +253,19 @@ CVfrBufferConfig::Eof(
UINT8
CVfrBufferConfig::Select (
IN CHAR8 *Name,
IN CHAR8 *Id
IN CHAR8 *Name,
IN EFI_GUID *Guid,
IN CHAR8 *Id
)
{
SConfigItem *p;
if (Name == NULL) {
if (Name == NULL || Guid == NULL) {
mItemListPos = mItemListHead;
return 0;
} else {
for (p = mItemListHead; p != NULL; p = p->mNext) {
if (strcmp (p->mName, Name) != 0) {
if ((strcmp (p->mName, Name) != 0) || (memcmp (p->mGuid, Guid, sizeof (EFI_GUID)) != 0)) {
continue;
}
@ -269,6 +289,7 @@ UINT8
CVfrBufferConfig::Write (
IN CONST CHAR8 Mode,
IN CHAR8 *Name,
IN EFI_GUID *Guid,
IN CHAR8 *Id,
IN UINT8 Type,
IN UINT16 Offset,
@ -280,14 +301,14 @@ CVfrBufferConfig::Write (
SConfigItem *pItem;
SConfigInfo *pInfo;
if ((Ret = Select (Name)) != 0) {
if ((Ret = Select (Name, Guid)) != 0) {
return Ret;
}
switch (Mode) {
case 'a' : // add
if (Select (Name, Id) != 0) {
if ((pItem = new SConfigItem (Name, Id, Type, Offset, (UINT16) Width, Value)) == NULL) {
if (Select (Name, Guid, Id) != 0) {
if ((pItem = new SConfigItem (Name, Guid, Id, Type, Offset, (UINT16) Width, Value)) == NULL) {
return 2;
}
if (mItemListHead == NULL) {
@ -302,10 +323,6 @@ CVfrBufferConfig::Write (
// tranverse the list to find out if there's already the value for the same offset
for (pInfo = mItemListPos->mInfoStrList; pInfo != NULL; pInfo = pInfo->mNext) {
if (pInfo->mOffset == Offset) {
// check if the value and width are the same; return error if not
if ((Id != NULL) && (pInfo->mWidth != Width || memcmp(pInfo->mValue, &Value, Width) != 0)) {
return VFR_RETURN_DEFAULT_VALUE_REDEFINED;
}
return 0;
}
}
@ -1578,7 +1595,7 @@ CVfrDataStorage::DeclareEfiVarStore (
return VFR_RETURN_EFIVARSTORE_SIZE_ERROR;
}
if (GetVarStoreId (StoreName, &VarStoreId) == VFR_RETURN_SUCCESS) {
if (GetVarStoreId (StoreName, &VarStoreId, Guid) == VFR_RETURN_SUCCESS) {
return VFR_RETURN_REDEFINED;
}
@ -1611,7 +1628,7 @@ CVfrDataStorage::DeclareBufferVarStore (
return VFR_RETURN_FATAL_ERROR;
}
if (GetVarStoreId (StoreName, &TempVarStoreId) == VFR_RETURN_SUCCESS) {
if (GetVarStoreId (StoreName, &TempVarStoreId, Guid) == VFR_RETURN_SUCCESS) {
return VFR_RETURN_REDEFINED;
}
@ -1633,7 +1650,7 @@ CVfrDataStorage::DeclareBufferVarStore (
pNew->mNext = mBufferVarStoreList;
mBufferVarStoreList = pNew;
if (gCVfrBufferConfig.Register(StoreName) != 0) {
if (gCVfrBufferConfig.Register(StoreName, Guid) != 0) {
return VFR_RETURN_FATAL_ERROR;
}
@ -1643,7 +1660,8 @@ CVfrDataStorage::DeclareBufferVarStore (
EFI_VFR_RETURN_CODE
CVfrDataStorage::GetVarStoreByDataType (
IN CHAR8 *DataTypeName,
OUT SVfrVarStorageNode **VarNode
OUT SVfrVarStorageNode **VarNode,
IN EFI_GUID *VarGuid
)
{
SVfrVarStorageNode *pNode;
@ -1658,7 +1676,16 @@ CVfrDataStorage::GetVarStoreByDataType (
MatchNode = NULL;
for (pNode = mBufferVarStoreList; pNode != NULL; pNode = pNode->mNext) {
if (strcmp (pNode->mStorageInfo.mDataType->mTypeName, DataTypeName) == 0) {
if (strcmp (pNode->mStorageInfo.mDataType->mTypeName, DataTypeName) != 0) {
continue;
}
if ((VarGuid != NULL)) {
if (memcmp (VarGuid, &pNode->mGuid, sizeof (EFI_GUID)) == 0) {
*VarNode = pNode;
return VFR_RETURN_SUCCESS;
}
} else {
if (MatchNode == NULL) {
MatchNode = pNode;
} else {
@ -1678,46 +1705,108 @@ CVfrDataStorage::GetVarStoreByDataType (
return VFR_RETURN_SUCCESS;
}
EFI_VARSTORE_ID
CVfrDataStorage::CheckGuidField (
IN SVfrVarStorageNode *pNode,
IN EFI_GUID *StoreGuid,
IN BOOLEAN *HasFoundOne,
OUT EFI_VFR_RETURN_CODE *ReturnCode
)
{
if (StoreGuid != NULL) {
//
// If has guid info, compare the guid filed.
//
if (memcmp (StoreGuid, &pNode->mGuid, sizeof (EFI_GUID)) == 0) {
//
// Both name and guid are same, this this varstore.
//
mCurrVarStorageNode = pNode;
*ReturnCode = VFR_RETURN_SUCCESS;
return TRUE;
}
} else {
//
// Not has Guid field, check whether this name is the only one.
//
if (*HasFoundOne) {
//
// The name has conflict, return name redefined.
//
*ReturnCode = VFR_RETURN_VARSTORE_NAME_REDEFINED_ERROR;
return TRUE;
}
*HasFoundOne = TRUE;
mCurrVarStorageNode = pNode;
}
return FALSE;
}
/**
Base on the input store name and guid to find the varstore id.
If both name and guid are inputed, base on the name and guid to
found the varstore. If only name inputed, base on the name to
found the varstore and go on to check whether more than one varstore
has the same name. If only has found one varstore, return this
varstore; if more than one varstore has same name, return varstore
name redefined error. If no varstore found by varstore name, call
function GetVarStoreByDataType and use inputed varstore name as
data type name to search.
**/
EFI_VFR_RETURN_CODE
CVfrDataStorage::GetVarStoreId (
IN CHAR8 *StoreName,
OUT EFI_VARSTORE_ID *VarStoreId
OUT EFI_VARSTORE_ID *VarStoreId,
IN EFI_GUID *StoreGuid
)
{
EFI_VFR_RETURN_CODE ReturnCode;
SVfrVarStorageNode *pNode;
BOOLEAN HasFoundOne = FALSE;
mCurrVarStorageNode = NULL;
for (pNode = mBufferVarStoreList; pNode != NULL; pNode = pNode->mNext) {
if (strcmp (pNode->mVarStoreName, StoreName) == 0) {
mCurrVarStorageNode = pNode;
*VarStoreId = pNode->mVarStoreId;
return VFR_RETURN_SUCCESS;
if (CheckGuidField(pNode, StoreGuid, &HasFoundOne, &ReturnCode)) {
*VarStoreId = mCurrVarStorageNode->mVarStoreId;
return ReturnCode;
}
}
}
for (pNode = mEfiVarStoreList; pNode != NULL; pNode = pNode->mNext) {
if (strcmp (pNode->mVarStoreName, StoreName) == 0) {
mCurrVarStorageNode = pNode;
*VarStoreId = pNode->mVarStoreId;
return VFR_RETURN_SUCCESS;
if (CheckGuidField(pNode, StoreGuid, &HasFoundOne, &ReturnCode)) {
*VarStoreId = mCurrVarStorageNode->mVarStoreId;
return ReturnCode;
}
}
}
for (pNode = mNameVarStoreList; pNode != NULL; pNode = pNode->mNext) {
if (strcmp (pNode->mVarStoreName, StoreName) == 0) {
mCurrVarStorageNode = pNode;
*VarStoreId = pNode->mVarStoreId;
return VFR_RETURN_SUCCESS;
if (CheckGuidField(pNode, StoreGuid, &HasFoundOne, &ReturnCode)) {
*VarStoreId = mCurrVarStorageNode->mVarStoreId;
return ReturnCode;
}
}
}
mCurrVarStorageNode = NULL;
if (HasFoundOne) {
*VarStoreId = mCurrVarStorageNode->mVarStoreId;
return VFR_RETURN_SUCCESS;
}
*VarStoreId = EFI_VARSTORE_ID_INVALID;
//
// Assume that Data strucutre name is used as StoreName, and check again.
//
ReturnCode = GetVarStoreByDataType (StoreName, &pNode);
ReturnCode = GetVarStoreByDataType (StoreName, &pNode, StoreGuid);
if (pNode != NULL) {
mCurrVarStorageNode = pNode;
*VarStoreId = pNode->mVarStoreId;
@ -1728,88 +1817,24 @@ CVfrDataStorage::GetVarStoreId (
EFI_VFR_RETURN_CODE
CVfrDataStorage::GetBufferVarStoreDataTypeName (
IN CHAR8 *StoreName,
IN EFI_VARSTORE_ID VarStoreId,
OUT CHAR8 **DataTypeName
)
{
SVfrVarStorageNode *pNode;
EFI_VFR_RETURN_CODE ReturnCode;
if ((StoreName == NULL) || (DataTypeName == NULL)) {
if (VarStoreId == EFI_VARSTORE_ID_INVALID) {
return VFR_RETURN_FATAL_ERROR;
}
for (pNode = mBufferVarStoreList; pNode != NULL; pNode = pNode->mNext) {
if (strcmp (pNode->mVarStoreName, StoreName) == 0) {
break;
}
}
ReturnCode = VFR_RETURN_UNDEFINED;
//
// Assume that Data strucutre name is used as StoreName, and check again.
//
if (pNode == NULL) {
ReturnCode = GetVarStoreByDataType (StoreName, &pNode);
}
if (pNode == NULL) {
return ReturnCode;
}
if (pNode->mStorageInfo.mDataType == NULL) {
return VFR_RETURN_FATAL_ERROR;
}
*DataTypeName = pNode->mStorageInfo.mDataType->mTypeName;
return VFR_RETURN_SUCCESS;
}
EFI_VFR_RETURN_CODE
CVfrDataStorage::GetVarStoreType (
IN CHAR8 *StoreName,
OUT EFI_VFR_VARSTORE_TYPE &VarStoreType
)
{
SVfrVarStorageNode *pNode;
EFI_VFR_RETURN_CODE ReturnCode;
if (StoreName == NULL) {
return VFR_RETURN_FATAL_ERROR;
}
for (pNode = mBufferVarStoreList; pNode != NULL; pNode = pNode->mNext) {
if (strcmp (pNode->mVarStoreName, StoreName) == 0) {
VarStoreType = pNode->mVarStoreType;
if (pNode->mVarStoreId == VarStoreId) {
*DataTypeName = pNode->mStorageInfo.mDataType->mTypeName;
return VFR_RETURN_SUCCESS;
}
}
for (pNode = mEfiVarStoreList; pNode != NULL; pNode = pNode->mNext) {
if (strcmp (pNode->mVarStoreName, StoreName) == 0) {
VarStoreType = pNode->mVarStoreType;
return VFR_RETURN_SUCCESS;
}
}
for (pNode = mNameVarStoreList; pNode != NULL; pNode = pNode->mNext) {
if (strcmp (pNode->mVarStoreName, StoreName) == 0) {
VarStoreType = pNode->mVarStoreType;
return VFR_RETURN_SUCCESS;
}
}
VarStoreType = EFI_VFR_VARSTORE_INVALID;
//
// Assume that Data strucutre name is used as StoreName, and check again.
//
ReturnCode = GetVarStoreByDataType (StoreName, &pNode);
if (pNode != NULL) {
VarStoreType = pNode->mVarStoreType;
}
return ReturnCode;
return VFR_RETURN_UNDEFINED;
}
EFI_VFR_VARSTORE_TYPE
@ -1850,6 +1875,44 @@ CVfrDataStorage::GetVarStoreType (
return VarStoreType;
}
EFI_GUID *
CVfrDataStorage::GetVarStoreGuid (
IN EFI_VARSTORE_ID VarStoreId
)
{
SVfrVarStorageNode *pNode;
EFI_GUID *VarGuid;
VarGuid = NULL;
if (VarStoreId == EFI_VARSTORE_ID_INVALID) {
return VarGuid;
}
for (pNode = mBufferVarStoreList; pNode != NULL; pNode = pNode->mNext) {
if (pNode->mVarStoreId == VarStoreId) {
VarGuid = &pNode->mGuid;
return VarGuid;
}
}
for (pNode = mEfiVarStoreList; pNode != NULL; pNode = pNode->mNext) {
if (pNode->mVarStoreId == VarStoreId) {
VarGuid = &pNode->mGuid;
return VarGuid;
}
}
for (pNode = mNameVarStoreList; pNode != NULL; pNode = pNode->mNext) {
if (pNode->mVarStoreId == VarStoreId) {
VarGuid = &pNode->mGuid;
return VarGuid;
}
}
return VarGuid;
}
EFI_VFR_RETURN_CODE
CVfrDataStorage::GetVarStoreName (
IN EFI_VARSTORE_ID VarStoreId,
@ -1951,44 +2014,6 @@ CVfrDataStorage::GetNameVarStoreInfo (
return VFR_RETURN_SUCCESS;
}
EFI_VFR_RETURN_CODE
CVfrDataStorage::BufferVarStoreRequestElementAdd (
IN CHAR8 *StoreName,
IN EFI_VARSTORE_INFO &Info
)
{
SVfrVarStorageNode *pNode = NULL;
EFI_IFR_TYPE_VALUE Value = gZeroEfiIfrTypeValue;
EFI_VFR_RETURN_CODE ReturnCode;
for (pNode = mBufferVarStoreList; pNode != NULL; pNode = pNode->mNext) {
if (strcmp (pNode->mVarStoreName, StoreName) == 0) {
break;
}
}
ReturnCode = VFR_RETURN_UNDEFINED;
//
// Assume that Data strucutre name is used as StoreName, and check again.
//
if (pNode == NULL) {
ReturnCode = GetVarStoreByDataType (StoreName, &pNode);
}
if (pNode == NULL) {
return ReturnCode;
}
gCVfrBufferConfig.Open ();
Value.u8 = 0;
if (gCVfrBufferConfig.Write ('a', StoreName, NULL, EFI_IFR_TYPE_NUM_SIZE_8, Info.mInfo.mVarOffset, Info.mVarTotalSize, Value) != 0) {
return VFR_RETURN_FATAL_ERROR;
}
gCVfrBufferConfig.Close ();
return VFR_RETURN_SUCCESS;
}
SVfrDefaultStoreNode::SVfrDefaultStoreNode (
IN EFI_IFR_DEFAULTSTORE *ObjBinAddr,
IN CHAR8 *RefName,
@ -2155,6 +2180,7 @@ CVfrDefaultStore::BufferVarStoreAltConfigAdd (
IN EFI_VARSTORE_ID DefaultId,
IN EFI_VARSTORE_INFO &Info,
IN CHAR8 *VarStoreName,
IN EFI_GUID *VarStoreGuid,
IN UINT8 Type,
IN EFI_IFR_TYPE_VALUE Value
)
@ -2180,8 +2206,8 @@ CVfrDefaultStore::BufferVarStoreAltConfigAdd (
gCVfrBufferConfig.Open ();
sprintf (NewAltCfg, "%04x", pNode->mDefaultId);
if ((Returnvalue = gCVfrBufferConfig.Select(VarStoreName)) == 0) {
if ((Returnvalue = gCVfrBufferConfig.Write ('a', VarStoreName, NewAltCfg, Type, Info.mInfo.mVarOffset, Info.mVarTotalSize, Value)) != 0) {
if ((Returnvalue = gCVfrBufferConfig.Select(VarStoreName, VarStoreGuid)) == 0) {
if ((Returnvalue = gCVfrBufferConfig.Write ('a', VarStoreName, VarStoreGuid, NewAltCfg, Type, Info.mInfo.mVarOffset, Info.mVarTotalSize, Value)) != 0) {
goto WriteError;
}
}
@ -2592,26 +2618,46 @@ CVfrQuestionDB::RegisterNewDateQuestion (
CHAR8 *VarIdStr[3] = {NULL, };
CHAR8 Index;
if (BaseVarId == NULL) {
if (BaseVarId == NULL && Name == NULL) {
return;
}
Len = strlen (BaseVarId);
if (BaseVarId != NULL) {
Len = strlen (BaseVarId);
VarIdStr[0] = new CHAR8[Len + strlen (".Year") + 1];
if (VarIdStr[0] != NULL) {
strcpy (VarIdStr[0], BaseVarId);
strcat (VarIdStr[0], ".Year");
}
VarIdStr[1] = new CHAR8[Len + strlen (".Month") + 1];
if (VarIdStr[1] != NULL) {
strcpy (VarIdStr[1], BaseVarId);
strcat (VarIdStr[1], ".Month");
}
VarIdStr[2] = new CHAR8[Len + strlen (".Day") + 1];
if (VarIdStr[2] != NULL) {
strcpy (VarIdStr[2], BaseVarId);
strcat (VarIdStr[2], ".Day");
VarIdStr[0] = new CHAR8[Len + strlen (".Year") + 1];
if (VarIdStr[0] != NULL) {
strcpy (VarIdStr[0], BaseVarId);
strcat (VarIdStr[0], ".Year");
}
VarIdStr[1] = new CHAR8[Len + strlen (".Month") + 1];
if (VarIdStr[1] != NULL) {
strcpy (VarIdStr[1], BaseVarId);
strcat (VarIdStr[1], ".Month");
}
VarIdStr[2] = new CHAR8[Len + strlen (".Day") + 1];
if (VarIdStr[2] != NULL) {
strcpy (VarIdStr[2], BaseVarId);
strcat (VarIdStr[2], ".Day");
}
} else {
Len = strlen (Name);
VarIdStr[0] = new CHAR8[Len + strlen (".Year") + 1];
if (VarIdStr[0] != NULL) {
strcpy (VarIdStr[0], Name);
strcat (VarIdStr[0], ".Year");
}
VarIdStr[1] = new CHAR8[Len + strlen (".Month") + 1];
if (VarIdStr[1] != NULL) {
strcpy (VarIdStr[1], Name);
strcat (VarIdStr[1], ".Month");
}
VarIdStr[2] = new CHAR8[Len + strlen (".Day") + 1];
if (VarIdStr[2] != NULL) {
strcpy (VarIdStr[2], Name);
strcat (VarIdStr[2], ".Day");
}
}
if ((pNode[0] = new SVfrQuestionNode (Name, VarIdStr[0], DATE_YEAR_BITMASK)) == NULL) {
@ -2740,26 +2786,46 @@ CVfrQuestionDB::RegisterNewTimeQuestion (
CHAR8 *VarIdStr[3] = {NULL, };
CHAR8 Index;
if (BaseVarId == NULL) {
if (BaseVarId == NULL && Name == NULL) {
return;
}
Len = strlen (BaseVarId);
if (BaseVarId != NULL) {
Len = strlen (BaseVarId);
VarIdStr[0] = new CHAR8[Len + strlen (".Hour") + 1];
if (VarIdStr[0] != NULL) {
strcpy (VarIdStr[0], BaseVarId);
strcat (VarIdStr[0], ".Hour");
}
VarIdStr[1] = new CHAR8[Len + strlen (".Minute") + 1];
if (VarIdStr[1] != NULL) {
strcpy (VarIdStr[1], BaseVarId);
strcat (VarIdStr[1], ".Minute");
}
VarIdStr[2] = new CHAR8[Len + strlen (".Second") + 1];
if (VarIdStr[2] != NULL) {
strcpy (VarIdStr[2], BaseVarId);
strcat (VarIdStr[2], ".Second");
VarIdStr[0] = new CHAR8[Len + strlen (".Hour") + 1];
if (VarIdStr[0] != NULL) {
strcpy (VarIdStr[0], BaseVarId);
strcat (VarIdStr[0], ".Hour");
}
VarIdStr[1] = new CHAR8[Len + strlen (".Minute") + 1];
if (VarIdStr[1] != NULL) {
strcpy (VarIdStr[1], BaseVarId);
strcat (VarIdStr[1], ".Minute");
}
VarIdStr[2] = new CHAR8[Len + strlen (".Second") + 1];
if (VarIdStr[2] != NULL) {
strcpy (VarIdStr[2], BaseVarId);
strcat (VarIdStr[2], ".Second");
}
} else {
Len = strlen (Name);
VarIdStr[0] = new CHAR8[Len + strlen (".Hour") + 1];
if (VarIdStr[0] != NULL) {
strcpy (VarIdStr[0], Name);
strcat (VarIdStr[0], ".Hour");
}
VarIdStr[1] = new CHAR8[Len + strlen (".Minute") + 1];
if (VarIdStr[1] != NULL) {
strcpy (VarIdStr[1], Name);
strcat (VarIdStr[1], ".Minute");
}
VarIdStr[2] = new CHAR8[Len + strlen (".Second") + 1];
if (VarIdStr[2] != NULL) {
strcpy (VarIdStr[2], Name);
strcat (VarIdStr[2], ".Second");
}
}
if ((pNode[0] = new SVfrQuestionNode (Name, VarIdStr[0], TIME_HOUR_BITMASK)) == NULL) {
@ -2828,31 +2894,56 @@ CVfrQuestionDB::RegisterRefQuestion (
CHAR8 *VarIdStr[4] = {NULL, };
CHAR8 Index;
if (BaseVarId == NULL) {
if (BaseVarId == NULL && Name == NULL) {
return;
}
Len = strlen (BaseVarId);
if (BaseVarId != NULL) {
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");
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");
}
} else {
Len = strlen (Name);
VarIdStr[0] = new CHAR8[Len + strlen (".QuestionId") + 1];
if (VarIdStr[0] != NULL) {
strcpy (VarIdStr[0], Name);
strcat (VarIdStr[0], ".QuestionId");
}
VarIdStr[1] = new CHAR8[Len + strlen (".FormId") + 1];
if (VarIdStr[1] != NULL) {
strcpy (VarIdStr[1], Name);
strcat (VarIdStr[1], ".FormId");
}
VarIdStr[2] = new CHAR8[Len + strlen (".FormSetGuid") + 1];
if (VarIdStr[2] != NULL) {
strcpy (VarIdStr[2], Name);
strcat (VarIdStr[2], ".FormSetGuid");
}
VarIdStr[3] = new CHAR8[Len + strlen (".DevicePath") + 1];
if (VarIdStr[3] != NULL) {
strcpy (VarIdStr[3], Name);
strcat (VarIdStr[3], ".DevicePath");
}
}
if ((pNode[0] = new SVfrQuestionNode (Name, VarIdStr[0])) == NULL) {

View File

@ -2,7 +2,7 @@
Vfr common library functions.
Copyright (c) 2004 - 2012, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2004 - 2013, 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
@ -57,13 +57,14 @@ struct SConfigInfo {
struct SConfigItem {
CHAR8 *mName; // varstore name
CHAR8 *mId; // varstore ID
EFI_GUID *mGuid; // varstore guid, varstore name + guid deside one varstore
CHAR8 *mId; // default ID
SConfigInfo *mInfoStrList; // list of Offset/Value in the varstore
SConfigItem *mNext;
public:
SConfigItem (IN CHAR8 *, IN CHAR8 *);
SConfigItem (IN CHAR8 *, IN CHAR8 *, IN UINT8, IN UINT16, IN UINT16, IN EFI_IFR_TYPE_VALUE);
SConfigItem (IN CHAR8 *, IN EFI_GUID *, IN CHAR8 *);
SConfigItem (IN CHAR8 *, IN EFI_GUID *, IN CHAR8 *, IN UINT8, IN UINT16, IN UINT16, IN EFI_IFR_TYPE_VALUE);
virtual ~SConfigItem ();
};
@ -77,11 +78,11 @@ public:
CVfrBufferConfig (VOID);
virtual ~CVfrBufferConfig (VOID);
virtual UINT8 Register (IN CHAR8 *, IN CHAR8 *Info = NULL);
virtual UINT8 Register (IN CHAR8 *, IN EFI_GUID *,IN CHAR8 *Info = NULL);
virtual VOID Open (VOID);
virtual BOOLEAN Eof(VOID);
virtual UINT8 Select (IN CHAR8 *, IN CHAR8 *Info = NULL);
virtual UINT8 Write (IN CONST CHAR8, IN CHAR8 *, IN CHAR8 *, IN UINT8, IN UINT16, IN UINT32, IN EFI_IFR_TYPE_VALUE);
virtual UINT8 Select (IN CHAR8 *, IN EFI_GUID *, IN CHAR8 *Info = NULL);
virtual UINT8 Write (IN CONST CHAR8, IN CHAR8 *, IN EFI_GUID *, IN CHAR8 *, IN UINT8, IN UINT16, IN UINT32, IN EFI_IFR_TYPE_VALUE);
#if 0
virtual UINT8 Read (OUT CHAR8 **, OUT CHAR8 **, OUT CHAR8 **, OUT CHAR8 **, OUT CHAR8 **);
#endif
@ -284,6 +285,10 @@ private:
BOOLEAN ChekVarStoreIdFree (IN EFI_VARSTORE_ID);
VOID MarkVarStoreIdUsed (IN EFI_VARSTORE_ID);
VOID MarkVarStoreIdUnused (IN EFI_VARSTORE_ID);
EFI_VARSTORE_ID CheckGuidField (IN SVfrVarStorageNode *,
IN EFI_GUID *,
IN BOOLEAN *,
OUT EFI_VFR_RETURN_CODE *);
public:
CVfrDataStorage ();
@ -303,17 +308,15 @@ public:
EFI_VFR_RETURN_CODE DeclareBufferVarStore (IN CHAR8 *, IN EFI_GUID *, IN CVfrVarDataTypeDB *, IN CHAR8 *, IN EFI_VARSTORE_ID, IN BOOLEAN Flag = TRUE);
EFI_VFR_RETURN_CODE GetVarStoreId (IN CHAR8 *, OUT EFI_VARSTORE_ID *);
EFI_VFR_RETURN_CODE GetVarStoreType (IN CHAR8 *, OUT EFI_VFR_VARSTORE_TYPE &);
EFI_VFR_RETURN_CODE GetVarStoreId (IN CHAR8 *, OUT EFI_VARSTORE_ID *, IN EFI_GUID *VarGuid = NULL);
EFI_VFR_VARSTORE_TYPE GetVarStoreType (IN EFI_VARSTORE_ID);
EFI_GUID * GetVarStoreGuid (IN EFI_VARSTORE_ID);
EFI_VFR_RETURN_CODE GetVarStoreName (IN EFI_VARSTORE_ID, OUT CHAR8 **);
EFI_VFR_RETURN_CODE GetVarStoreByDataType (IN CHAR8 *, OUT SVfrVarStorageNode **);
EFI_VFR_RETURN_CODE GetVarStoreByDataType (IN CHAR8 *, OUT SVfrVarStorageNode **, IN EFI_GUID *VarGuid = NULL);
EFI_VFR_RETURN_CODE GetBufferVarStoreDataTypeName (IN CHAR8 *, OUT CHAR8 **);
EFI_VFR_RETURN_CODE GetBufferVarStoreDataTypeName (IN EFI_VARSTORE_ID, OUT CHAR8 **);
EFI_VFR_RETURN_CODE GetEfiVarStoreInfo (IN EFI_VARSTORE_INFO *);
EFI_VFR_RETURN_CODE GetNameVarStoreInfo (IN EFI_VARSTORE_INFO *, IN UINT32);
EFI_VFR_RETURN_CODE BufferVarStoreRequestElementAdd (IN CHAR8 *, IN EFI_VARSTORE_INFO &);
};
#define EFI_QUESTION_ID_MAX 0xFFFF
@ -396,7 +399,7 @@ public:
EFI_VFR_RETURN_CODE ReRegisterDefaultStoreById (IN UINT16, IN CHAR8 *, IN EFI_STRING_ID);
BOOLEAN DefaultIdRegistered (IN UINT16);
EFI_VFR_RETURN_CODE GetDefaultId (IN CHAR8 *, OUT UINT16 *);
EFI_VFR_RETURN_CODE BufferVarStoreAltConfigAdd (IN EFI_VARSTORE_ID, IN EFI_VARSTORE_INFO &, IN CHAR8 *, IN UINT8, IN EFI_IFR_TYPE_VALUE);
EFI_VFR_RETURN_CODE BufferVarStoreAltConfigAdd (IN EFI_VARSTORE_ID, IN EFI_VARSTORE_INFO &, IN CHAR8 *, IN EFI_GUID *, IN UINT8, IN EFI_IFR_TYPE_VALUE);
};
#define EFI_RULE_ID_START 0x01

View File

@ -1,5 +1,5 @@
## @file
# Windows makefile for 'VolInfo' module build.
# GNU/Linux makefile for 'VolInfo' module build.
#
# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
# This program and the accompanying materials

View File

@ -293,12 +293,13 @@ class WorkspaceAutoGen(AutoGen):
Platform = self.BuildDatabase[self.MetaFile, Arch, Target, Toolchain]
DecPcds = {}
DecPcdsKey = set()
PGen = PlatformAutoGen(self, self.MetaFile, Target, Toolchain, Arch)
Pkgs = PGen.PackageList
for Pkg in Pkgs:
for Pcd in Pkg.Pcds:
DecPcds[Pcd[0], Pcd[1]] = Pkg.Pcds[Pcd]
Platform.IsPlatformPcdDeclared(DecPcds)
DecPcdsKey.add((Pcd[0], Pcd[1], Pcd[2]))
Platform.SkuName = self.SkuId
for Name, Guid in PcdSet:
@ -310,7 +311,21 @@ class WorkspaceAutoGen(AutoGen):
File = self.FdfProfile.PcdFileLineDict[Name, Guid][0],
Line = self.FdfProfile.PcdFileLineDict[Name, Guid][1]
)
Platform.AddPcd(Name, Guid, PcdSet[Name, Guid])
else:
# Check whether Dynamic or DynamicEx PCD used in FDF file. If used, build break and give a error message.
if (Name, Guid, TAB_PCDS_FIXED_AT_BUILD) in DecPcdsKey \
or (Name, Guid, TAB_PCDS_PATCHABLE_IN_MODULE) in DecPcdsKey \
or (Name, Guid, TAB_PCDS_FEATURE_FLAG) in DecPcdsKey:
Platform.AddPcd(Name, Guid, PcdSet[Name, Guid])
continue
elif (Name, Guid, TAB_PCDS_DYNAMIC) in DecPcdsKey or (Name, Guid, TAB_PCDS_DYNAMIC_EX) in DecPcdsKey:
EdkLogger.error(
'build',
PARSER_ERROR,
"Using Dynamic or DynamicEx type of PCD [%s.%s] in FDF file is not allowed." % (Guid, Name),
File = self.FdfProfile.PcdFileLineDict[Name, Guid][0],
Line = self.FdfProfile.PcdFileLineDict[Name, Guid][1]
)
Pa = PlatformAutoGen(self, self.MetaFile, Target, Toolchain, Arch)
#

View File

@ -2043,7 +2043,8 @@ def CreateHeaderCode(Info, AutoGenC, AutoGenH):
if 'PcdLib' in Info.Module.LibraryClasses or Info.Module.Pcds:
AutoGenH.Append("#include <Library/PcdLib.h>\n")
AutoGenH.Append('\nextern GUID gEfiCallerIdGuid;\n\n')
AutoGenH.Append('\nextern GUID gEfiCallerIdGuid;')
AutoGenH.Append('\nextern CHAR8 *gEfiCallerBaseName;\n\n')
if Info.IsLibrary:
return
@ -2066,6 +2067,7 @@ def CreateHeaderCode(Info, AutoGenC, AutoGenH):
# Publish the CallerId Guid
#
AutoGenC.Append('\nGLOBAL_REMOVE_IF_UNREFERENCED GUID gEfiCallerIdGuid = %s;\n' % GuidStringToGuidStructureString(Info.Guid))
AutoGenC.Append('\nGLOBAL_REMOVE_IF_UNREFERENCED CHAR8 *gEfiCallerBaseName = "%s";\n' % Info.Name)
## Create common code for header file
#

View File

@ -1,4 +1,4 @@
# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
# Copyright (c) 2007 - 2012, 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
@ -38,6 +38,9 @@ LF = u'\u000A'
NULL = u'\u0000'
TAB = u'\t'
BACK_SPLASH = u'\\'
DOBULE_QUOTED_SPLASH = u'\\"'
SIGLE_QUOTED_SPLASH = u"\\'"
TAB_BACK_SLASH = u"\\/"
gIncludePattern = re.compile("^#include +[\"<]+([^\"< >]+)[>\"]+$", re.MULTILINE | re.UNICODE)
@ -334,11 +337,11 @@ class UniFileClassObject(object):
Line = Line.replace(u'/language', u'#language')
Line = Line.replace(u'/include', u'#include')
Line = Line.replace(u'\\\\', u'\u0006')
Line = Line.replace(UNICODE_WIDE_CHAR, WIDE_CHAR)
Line = Line.replace(UNICODE_NARROW_CHAR, NARROW_CHAR)
Line = Line.replace(UNICODE_NON_BREAKING_CHAR, NON_BREAKING_CHAR)
Line = Line.replace(u'\\\\', u'\u0006')
Line = Line.replace(u'\\r\\n', CR + LF)
Line = Line.replace(u'\\n', CR + LF)
Line = Line.replace(u'\\r', CR)
@ -346,7 +349,10 @@ class UniFileClassObject(object):
Line = Line.replace(u'''\"''', u'''"''')
Line = Line.replace(u'\t', u' ')
Line = Line.replace(u'\u0006', u'\\')
Line = Line.replace(DOBULE_QUOTED_SPLASH, u'"')
Line = Line.replace(SIGLE_QUOTED_SPLASH, u"'")
Line = Line.replace(TAB_BACK_SLASH, u"/")
# if Line.find(u'\\x'):
# hex = Line[Line.find(u'\\x') + 2 : Line.find(u'\\x') + 6]
# hex = "u'\\u" + hex + "'"

View File

@ -13,4 +13,4 @@
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#
gBUILD_VERSION = "Build 2524"
gBUILD_VERSION = ""

View File

@ -1,7 +1,8 @@
## @file
# This file is used to define common static strings used by INF/DEC/DSC files
#
# Copyright (c) 2007 - 2008, Intel Corporation. All rights reserved.<BR>
# Copyright (c) 2007 - 2012, Intel Corporation. All rights reserved.<BR>
# Portions copyright (c) 2011 - 2013, ARM Ltd. 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
@ -18,6 +19,7 @@ TAB_COMMENT_EDK_START = '/*'
TAB_COMMENT_EDK_END = '*/'
TAB_COMMENT_EDK_SPLIT = '//'
TAB_COMMENT_SPLIT = '#'
TAB_SPECIAL_COMMENT = '##'
TAB_EQUAL_SPLIT = '='
TAB_VALUE_SPLIT = '|'
TAB_COMMA_SPLIT = ','
@ -26,10 +28,18 @@ TAB_SEMI_COLON_SPLIT = ';'
TAB_SECTION_START = '['
TAB_SECTION_END = ']'
TAB_OPTION_START = '<'
TAB_OPTION_END = '>'
TAB_OPTION_END = '>'
TAB_SLASH = '\\'
TAB_BACK_SLASH = '/'
TAB_LINE_BREAK = '\n'
TAB_PRINTCHAR_VT = '\x0b'
TAB_PRINTCHAR_BS = '\b'
TAB_PRINTCHAR_NUL = '\0'
TAB_UINT8 = 'UINT8'
TAB_UINT16 = 'UINT16'
TAB_UINT32 = 'UINT32'
TAB_UINT64 = 'UINT64'
TAB_VOID = 'VOID*'
TAB_EDK_SOURCE = '$(EDK_SOURCE)'
TAB_EFI_SOURCE = '$(EFI_SOURCE)'
@ -42,8 +52,9 @@ TAB_ARCH_X64 = 'X64'
TAB_ARCH_IPF = 'IPF'
TAB_ARCH_ARM = 'ARM'
TAB_ARCH_EBC = 'EBC'
TAB_ARCH_AARCH64 = 'AARCH64'
ARCH_LIST = [TAB_ARCH_IA32, TAB_ARCH_X64, TAB_ARCH_IPF, TAB_ARCH_ARM, TAB_ARCH_EBC]
ARCH_LIST = [TAB_ARCH_IA32, TAB_ARCH_X64, TAB_ARCH_IPF, TAB_ARCH_ARM, TAB_ARCH_EBC, TAB_ARCH_AARCH64]
ARCH_LIST_FULL = [TAB_ARCH_COMMON] + ARCH_LIST
SUP_MODULE_BASE = 'BASE'
@ -75,7 +86,7 @@ EDK_COMPONENT_TYPE_BS_DRIVER = 'BS_DRIVER'
EDK_COMPONENT_TYPE_RT_DRIVER = 'RT_DRIVER'
EDK_COMPONENT_TYPE_SAL_RT_DRIVER = 'SAL_RT_DRIVER'
EDK_COMPONENT_TYPE_APPLICATION = 'APPLICATION'
EDK_NAME = 'EDK'
EDK_NAME = 'EDK'
EDKII_NAME = 'EDKII'
BINARY_FILE_TYPE_FW = 'FW'
@ -109,6 +120,7 @@ TAB_SOURCES_X64 = TAB_SOURCES + TAB_SPLIT + TAB_ARCH_X64
TAB_SOURCES_IPF = TAB_SOURCES + TAB_SPLIT + TAB_ARCH_IPF
TAB_SOURCES_ARM = TAB_SOURCES + TAB_SPLIT + TAB_ARCH_ARM
TAB_SOURCES_EBC = TAB_SOURCES + TAB_SPLIT + TAB_ARCH_EBC
TAB_SOURCES_AARCH64 = TAB_SOURCES + TAB_SPLIT + TAB_ARCH_AARCH64
TAB_BINARIES = 'Binaries'
TAB_BINARIES_COMMON = TAB_BINARIES + TAB_SPLIT + TAB_ARCH_COMMON
@ -117,6 +129,7 @@ TAB_BINARIES_X64 = TAB_BINARIES + TAB_SPLIT + TAB_ARCH_X64
TAB_BINARIES_IPF = TAB_BINARIES + TAB_SPLIT + TAB_ARCH_IPF
TAB_BINARIES_ARM = TAB_BINARIES + TAB_SPLIT + TAB_ARCH_ARM
TAB_BINARIES_EBC = TAB_BINARIES + TAB_SPLIT + TAB_ARCH_EBC
TAB_BINARIES_AARCH64 = TAB_BINARIES + TAB_SPLIT + TAB_ARCH_AARCH64
TAB_INCLUDES = 'Includes'
TAB_INCLUDES_COMMON = TAB_INCLUDES + TAB_SPLIT + TAB_ARCH_COMMON
@ -125,6 +138,7 @@ TAB_INCLUDES_X64 = TAB_INCLUDES + TAB_SPLIT + TAB_ARCH_X64
TAB_INCLUDES_IPF = TAB_INCLUDES + TAB_SPLIT + TAB_ARCH_IPF
TAB_INCLUDES_ARM = TAB_INCLUDES + TAB_SPLIT + TAB_ARCH_ARM
TAB_INCLUDES_EBC = TAB_INCLUDES + TAB_SPLIT + TAB_ARCH_EBC
TAB_INCLUDES_AARCH64 = TAB_INCLUDES + TAB_SPLIT + TAB_ARCH_AARCH64
TAB_GUIDS = 'Guids'
TAB_GUIDS_COMMON = TAB_GUIDS + TAB_SPLIT + TAB_ARCH_COMMON
@ -133,6 +147,7 @@ TAB_GUIDS_X64 = TAB_GUIDS + TAB_SPLIT + TAB_ARCH_X64
TAB_GUIDS_IPF = TAB_GUIDS + TAB_SPLIT + TAB_ARCH_IPF
TAB_GUIDS_ARM = TAB_GUIDS + TAB_SPLIT + TAB_ARCH_ARM
TAB_GUIDS_EBC = TAB_GUIDS + TAB_SPLIT + TAB_ARCH_EBC
TAB_GUIDS_AARCH64 = TAB_GUIDS + TAB_SPLIT + TAB_ARCH_AARCH64
TAB_PROTOCOLS = 'Protocols'
TAB_PROTOCOLS_COMMON = TAB_PROTOCOLS + TAB_SPLIT + TAB_ARCH_COMMON
@ -141,6 +156,7 @@ TAB_PROTOCOLS_X64 = TAB_PROTOCOLS + TAB_SPLIT + TAB_ARCH_X64
TAB_PROTOCOLS_IPF = TAB_PROTOCOLS + TAB_SPLIT + TAB_ARCH_IPF
TAB_PROTOCOLS_ARM = TAB_PROTOCOLS + TAB_SPLIT + TAB_ARCH_ARM
TAB_PROTOCOLS_EBC = TAB_PROTOCOLS + TAB_SPLIT + TAB_ARCH_EBC
TAB_PROTOCOLS_AARCH64 = TAB_PROTOCOLS + TAB_SPLIT + TAB_ARCH_AARCH64
TAB_PPIS = 'Ppis'
TAB_PPIS_COMMON = TAB_PPIS + TAB_SPLIT + TAB_ARCH_COMMON
@ -149,6 +165,7 @@ TAB_PPIS_X64 = TAB_PPIS + TAB_SPLIT + TAB_ARCH_X64
TAB_PPIS_IPF = TAB_PPIS + TAB_SPLIT + TAB_ARCH_IPF
TAB_PPIS_ARM = TAB_PPIS + TAB_SPLIT + TAB_ARCH_ARM
TAB_PPIS_EBC = TAB_PPIS + TAB_SPLIT + TAB_ARCH_EBC
TAB_PPIS_AARCH64 = TAB_PPIS + TAB_SPLIT + TAB_ARCH_AARCH64
TAB_LIBRARY_CLASSES = 'LibraryClasses'
TAB_LIBRARY_CLASSES_COMMON = TAB_LIBRARY_CLASSES + TAB_SPLIT + TAB_ARCH_COMMON
@ -157,6 +174,7 @@ TAB_LIBRARY_CLASSES_X64 = TAB_LIBRARY_CLASSES + TAB_SPLIT + TAB_ARCH_X64
TAB_LIBRARY_CLASSES_IPF = TAB_LIBRARY_CLASSES + TAB_SPLIT + TAB_ARCH_IPF
TAB_LIBRARY_CLASSES_ARM = TAB_LIBRARY_CLASSES + TAB_SPLIT + TAB_ARCH_ARM
TAB_LIBRARY_CLASSES_EBC = TAB_LIBRARY_CLASSES + TAB_SPLIT + TAB_ARCH_EBC
TAB_LIBRARY_CLASSES_AARCH64 = TAB_LIBRARY_CLASSES + TAB_SPLIT + TAB_ARCH_AARCH64
TAB_PACKAGES = 'Packages'
TAB_PACKAGES_COMMON = TAB_PACKAGES + TAB_SPLIT + TAB_ARCH_COMMON
@ -165,6 +183,7 @@ TAB_PACKAGES_X64 = TAB_PACKAGES + TAB_SPLIT + TAB_ARCH_X64
TAB_PACKAGES_IPF = TAB_PACKAGES + TAB_SPLIT + TAB_ARCH_IPF
TAB_PACKAGES_ARM = TAB_PACKAGES + TAB_SPLIT + TAB_ARCH_ARM
TAB_PACKAGES_EBC = TAB_PACKAGES + TAB_SPLIT + TAB_ARCH_EBC
TAB_PACKAGES_AARCH64 = TAB_PACKAGES + TAB_SPLIT + TAB_ARCH_AARCH64
TAB_PCDS = 'Pcds'
TAB_PCDS_FIXED_AT_BUILD = 'FixedAtBuild'
@ -192,6 +211,7 @@ TAB_PCDS_FIXED_AT_BUILD_X64 = TAB_PCDS + TAB_PCDS_FIXED_AT_BUILD + TAB_SPLIT + T
TAB_PCDS_FIXED_AT_BUILD_IPF = TAB_PCDS + TAB_PCDS_FIXED_AT_BUILD + TAB_SPLIT + TAB_ARCH_IPF
TAB_PCDS_FIXED_AT_BUILD_ARM = TAB_PCDS + TAB_PCDS_FIXED_AT_BUILD + TAB_SPLIT + TAB_ARCH_ARM
TAB_PCDS_FIXED_AT_BUILD_EBC = TAB_PCDS + TAB_PCDS_FIXED_AT_BUILD + TAB_SPLIT + TAB_ARCH_EBC
TAB_PCDS_FIXED_AT_BUILD_AARCH64 = TAB_PCDS + TAB_PCDS_FIXED_AT_BUILD + TAB_SPLIT + TAB_ARCH_AARCH64
TAB_PCDS_PATCHABLE_IN_MODULE_NULL = TAB_PCDS + TAB_PCDS_PATCHABLE_IN_MODULE
TAB_PCDS_PATCHABLE_IN_MODULE_COMMON = TAB_PCDS + TAB_PCDS_PATCHABLE_IN_MODULE + TAB_SPLIT + TAB_ARCH_COMMON
@ -200,6 +220,7 @@ TAB_PCDS_PATCHABLE_IN_MODULE_X64 = TAB_PCDS + TAB_PCDS_PATCHABLE_IN_MODULE + TAB
TAB_PCDS_PATCHABLE_IN_MODULE_IPF = TAB_PCDS + TAB_PCDS_PATCHABLE_IN_MODULE + TAB_SPLIT + TAB_ARCH_IPF
TAB_PCDS_PATCHABLE_IN_MODULE_ARM = TAB_PCDS + TAB_PCDS_PATCHABLE_IN_MODULE + TAB_SPLIT + TAB_ARCH_ARM
TAB_PCDS_PATCHABLE_IN_MODULE_EBC = TAB_PCDS + TAB_PCDS_PATCHABLE_IN_MODULE + TAB_SPLIT + TAB_ARCH_EBC
TAB_PCDS_PATCHABLE_IN_MODULE_AARCH64 = TAB_PCDS + TAB_PCDS_PATCHABLE_IN_MODULE + TAB_SPLIT + TAB_ARCH_AARCH64
TAB_PCDS_FEATURE_FLAG_NULL = TAB_PCDS + TAB_PCDS_FEATURE_FLAG
TAB_PCDS_FEATURE_FLAG_COMMON = TAB_PCDS + TAB_PCDS_FEATURE_FLAG + TAB_SPLIT + TAB_ARCH_COMMON
@ -208,6 +229,7 @@ TAB_PCDS_FEATURE_FLAG_X64 = TAB_PCDS + TAB_PCDS_FEATURE_FLAG + TAB_SPLIT + TAB_A
TAB_PCDS_FEATURE_FLAG_IPF = TAB_PCDS + TAB_PCDS_FEATURE_FLAG + TAB_SPLIT + TAB_ARCH_IPF
TAB_PCDS_FEATURE_FLAG_ARM = TAB_PCDS + TAB_PCDS_FEATURE_FLAG + TAB_SPLIT + TAB_ARCH_ARM
TAB_PCDS_FEATURE_FLAG_EBC = TAB_PCDS + TAB_PCDS_FEATURE_FLAG + TAB_SPLIT + TAB_ARCH_EBC
TAB_PCDS_FEATURE_FLAG_AARCH64 = TAB_PCDS + TAB_PCDS_FEATURE_FLAG + TAB_SPLIT + TAB_ARCH_AARCH64
TAB_PCDS_DYNAMIC_EX_NULL = TAB_PCDS + TAB_PCDS_DYNAMIC_EX
TAB_PCDS_DYNAMIC_EX_DEFAULT_NULL = TAB_PCDS + TAB_PCDS_DYNAMIC_EX_DEFAULT
@ -219,6 +241,7 @@ TAB_PCDS_DYNAMIC_EX_X64 = TAB_PCDS + TAB_PCDS_DYNAMIC_EX + TAB_SPLIT + TAB_ARCH_
TAB_PCDS_DYNAMIC_EX_IPF = TAB_PCDS + TAB_PCDS_DYNAMIC_EX + TAB_SPLIT + TAB_ARCH_IPF
TAB_PCDS_DYNAMIC_EX_ARM = TAB_PCDS + TAB_PCDS_DYNAMIC_EX + TAB_SPLIT + TAB_ARCH_ARM
TAB_PCDS_DYNAMIC_EX_EBC = TAB_PCDS + TAB_PCDS_DYNAMIC_EX + TAB_SPLIT + TAB_ARCH_EBC
TAB_PCDS_DYNAMIC_EX_AARCH64 = TAB_PCDS + TAB_PCDS_DYNAMIC_EX + TAB_SPLIT + TAB_ARCH_AARCH64
TAB_PCDS_DYNAMIC_NULL = TAB_PCDS + TAB_PCDS_DYNAMIC
TAB_PCDS_DYNAMIC_DEFAULT_NULL = TAB_PCDS + TAB_PCDS_DYNAMIC_DEFAULT
@ -230,6 +253,7 @@ TAB_PCDS_DYNAMIC_X64 = TAB_PCDS + TAB_PCDS_DYNAMIC + TAB_SPLIT + TAB_ARCH_X64
TAB_PCDS_DYNAMIC_IPF = TAB_PCDS + TAB_PCDS_DYNAMIC + TAB_SPLIT + TAB_ARCH_IPF
TAB_PCDS_DYNAMIC_ARM = TAB_PCDS + TAB_PCDS_DYNAMIC + TAB_SPLIT + TAB_ARCH_ARM
TAB_PCDS_DYNAMIC_EBC = TAB_PCDS + TAB_PCDS_DYNAMIC + TAB_SPLIT + TAB_ARCH_EBC
TAB_PCDS_DYNAMIC_AARCH64 = TAB_PCDS + TAB_PCDS_DYNAMIC + TAB_SPLIT + TAB_ARCH_AARCH64
TAB_PCD_DYNAMIC_TYPE_LIST = [TAB_PCDS_DYNAMIC_DEFAULT_NULL, TAB_PCDS_DYNAMIC_VPD_NULL, TAB_PCDS_DYNAMIC_HII_NULL]
TAB_PCD_DYNAMIC_EX_TYPE_LIST = [TAB_PCDS_DYNAMIC_EX_DEFAULT_NULL, TAB_PCDS_DYNAMIC_EX_VPD_NULL, TAB_PCDS_DYNAMIC_EX_HII_NULL]
@ -254,6 +278,7 @@ TAB_DEPEX_X64 = TAB_DEPEX + TAB_SPLIT + TAB_ARCH_X64
TAB_DEPEX_IPF = TAB_DEPEX + TAB_SPLIT + TAB_ARCH_IPF
TAB_DEPEX_ARM = TAB_DEPEX + TAB_SPLIT + TAB_ARCH_ARM
TAB_DEPEX_EBC = TAB_DEPEX + TAB_SPLIT + TAB_ARCH_EBC
TAB_DEPEX_AARCH64 = TAB_DEPEX + TAB_SPLIT + TAB_ARCH_AARCH64
TAB_SKUIDS = 'SkuIds'
@ -264,6 +289,7 @@ TAB_LIBRARIES_X64 = TAB_LIBRARIES + TAB_SPLIT + TAB_ARCH_X64
TAB_LIBRARIES_IPF = TAB_LIBRARIES + TAB_SPLIT + TAB_ARCH_IPF
TAB_LIBRARIES_ARM = TAB_LIBRARIES + TAB_SPLIT + TAB_ARCH_ARM
TAB_LIBRARIES_EBC = TAB_LIBRARIES + TAB_SPLIT + TAB_ARCH_EBC
TAB_LIBRARIES_AARCH64 = TAB_LIBRARIES + TAB_SPLIT + TAB_ARCH_AARCH64
TAB_COMPONENTS = 'Components'
TAB_COMPONENTS_COMMON = TAB_COMPONENTS + TAB_SPLIT + TAB_ARCH_COMMON
@ -272,6 +298,7 @@ TAB_COMPONENTS_X64 = TAB_COMPONENTS + TAB_SPLIT + TAB_ARCH_X64
TAB_COMPONENTS_IPF = TAB_COMPONENTS + TAB_SPLIT + TAB_ARCH_IPF
TAB_COMPONENTS_ARM = TAB_COMPONENTS + TAB_SPLIT + TAB_ARCH_ARM
TAB_COMPONENTS_EBC = TAB_COMPONENTS + TAB_SPLIT + TAB_ARCH_EBC
TAB_COMPONENTS_AARCH64 = TAB_COMPONENTS + TAB_SPLIT + TAB_ARCH_AARCH64
TAB_COMPONENTS_SOURCE_OVERRIDE_PATH = 'SOURCE_OVERRIDE_PATH'
@ -328,6 +355,25 @@ TAB_INF_FEATURE_PCD = 'FeaturePcd'
TAB_INF_PATCH_PCD = 'PatchPcd'
TAB_INF_PCD = 'Pcd'
TAB_INF_PCD_EX = 'PcdEx'
TAB_INF_USAGE_PRO = 'PRODUCES'
TAB_INF_USAGE_SOME_PRO = 'SOMETIMES_PRODUCES'
TAB_INF_USAGE_CON = 'CONSUMES'
TAB_INF_USAGE_SOME_CON = 'SOMETIMES_CONSUMES'
TAB_INF_USAGE_NOTIFY = 'NOTIFY'
TAB_INF_USAGE_TO_START = 'TO_START'
TAB_INF_USAGE_BY_START = 'BY_START'
TAB_INF_GUIDTYPE_EVENT = 'Event'
TAB_INF_GUIDTYPE_FILE = 'File'
TAB_INF_GUIDTYPE_FV = 'FV'
TAB_INF_GUIDTYPE_GUID = 'GUID'
TAB_INF_GUIDTYPE_HII = 'HII'
TAB_INF_GUIDTYPE_HOB = 'HOB'
TAB_INF_GUIDTYPE_ST = 'SystemTable'
TAB_INF_GUIDTYPE_TSG = 'TokenSpaceGuid'
TAB_INF_GUIDTYPE_VAR = 'Variable'
TAB_INF_GUIDTYPE_PROTOCOL = 'PROTOCOL'
TAB_INF_GUIDTYPE_PPI = 'PPI'
TAB_INF_GUIDTYPE_UNDEFINED = 'UNDEFINED'
#
# Dec Definitions
@ -430,3 +476,22 @@ TAB_BRG_LIBRARY = 'Library'
# Build Rule File Version Definition
#
TAB_BUILD_RULE_VERSION = "build_rule_version"
# section name for PCDs
PCDS_DYNAMIC_DEFAULT = "PcdsDynamicDefault"
PCDS_DYNAMIC_VPD = "PcdsDynamicVpd"
PCDS_DYNAMIC_HII = "PcdsDynamicHii"
PCDS_DYNAMICEX_DEFAULT = "PcdsDynamicExDefault"
PCDS_DYNAMICEX_VPD = "PcdsDynamicExVpd"
PCDS_DYNAMICEX_HII = "PcdsDynamicExHii"
# Section allowed to have items after arch
SECTIONS_HAVE_ITEM_AFTER_ARCH = [TAB_LIBRARY_CLASSES.upper(), TAB_DEPEX.upper(), TAB_USER_EXTENSIONS.upper(),
PCDS_DYNAMIC_DEFAULT.upper(),
PCDS_DYNAMIC_VPD.upper(),
PCDS_DYNAMIC_HII.upper(),
PCDS_DYNAMICEX_DEFAULT.upper(),
PCDS_DYNAMICEX_VPD.upper(),
PCDS_DYNAMICEX_HII.upper(),
TAB_BUILD_OPTIONS.upper(),
TAB_INCLUDES.upper()]

View File

@ -405,7 +405,7 @@ class ItemBuild(object):
#
# @var WorkspaceDir: To store value for WorkspaceDir
# @var SupArchList: To store value for SupArchList, selection scope is in below list
# EBC | IA32 | X64 | IPF | ARM | PPC
# EBC | IA32 | X64 | IPF | ARM | PPC | AARCH64
# @var BuildTarget: To store value for WorkspaceDir, selection scope is in below list
# RELEASE | DEBUG
# @var SkuId: To store value for SkuId

View File

@ -246,12 +246,14 @@ class ValueExpression(object):
# @return: True or False if RealValue is False
# Evaluated value of string format if RealValue is True
#
def __call__(self, RealValue=False):
def __call__(self, RealValue=False, Depth=0):
if self._NoProcess:
return self._Expr
self._Depth = Depth
self._Expr = self._Expr.strip()
if RealValue:
if RealValue and Depth == 0:
self._Token = self._Expr
if self.__IsNumberToken():
return self._Expr
@ -471,7 +473,7 @@ class ValueExpression(object):
Ex = BadExpression(ERR_PCD_RESOLVE % self._Token)
Ex.Pcd = self._Token
raise Ex
self._Token = ValueExpression(self._Symb[self._Token], self._Symb)(True)
self._Token = ValueExpression(self._Symb[self._Token], self._Symb)(True, self._Depth+1)
if type(self._Token) != type(''):
self._LiteralToken = hex(self._Token)
return
@ -551,7 +553,7 @@ class ValueExpression(object):
if Match and not Expr[Match.end():Match.end()+1].isalnum() \
and Expr[Match.end():Match.end()+1] != '_':
self._Idx += Match.end()
self._Token = ValueExpression(GuidStringToGuidStructureString(Expr[0:Match.end()]))(True)
self._Token = ValueExpression(GuidStringToGuidStructureString(Expr[0:Match.end()]))(True, self._Depth+1)
return self._Token
elif self.__IsIdChar(Ch):
return self.__GetIdToken()

Some files were not shown because too many files have changed in this diff Show More