BaseTools: Clean up source files
1. Do not use tab characters 2. No trailing white space in one line 3. All files must end with CRLF Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Liming Gao <liming.gao@intel.com> Cc: Yonghong Zhu <yonghong.zhu@intel.com> Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
This commit is contained in:
@@ -1,94 +1,94 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
#
|
#
|
||||||
# Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
|
# Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
|
||||||
#
|
#
|
||||||
# This program and the accompanying materials
|
# This program and the accompanying materials
|
||||||
# are licensed and made available under the terms and conditions of the BSD License
|
# 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
|
# which accompanies this distribution. The full text of the license may be found at
|
||||||
#
|
#
|
||||||
# http://opensource.org/licenses/bsd-license.php
|
# http://opensource.org/licenses/bsd-license.php
|
||||||
#
|
#
|
||||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
#
|
#
|
||||||
|
|
||||||
#
|
#
|
||||||
# ARMCC tools do not support cygwin paths. Ths script converts cygwin paths to DOS paths
|
# ARMCC tools do not support cygwin paths. Ths script converts cygwin paths to DOS paths
|
||||||
# in any arguments.
|
# in any arguments.
|
||||||
#
|
#
|
||||||
# armcc_wrapper.py ToolToExec [command line to convert]
|
# armcc_wrapper.py ToolToExec [command line to convert]
|
||||||
#
|
#
|
||||||
# anthing with the / will be converted via cygpath cygwin call or manually.
|
# anthing with the / will be converted via cygpath cygwin call or manually.
|
||||||
# -I/cygpath/c/example is a special case as you can not pass -I to cygpath
|
# -I/cygpath/c/example is a special case as you can not pass -I to cygpath
|
||||||
#
|
#
|
||||||
# ExceptionList if a tool takes an argument with a / add it to the exception list
|
# ExceptionList if a tool takes an argument with a / add it to the exception list
|
||||||
#
|
#
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
import pipes
|
import pipes
|
||||||
|
|
||||||
#
|
#
|
||||||
# Convert using cygpath command line tool
|
# Convert using cygpath command line tool
|
||||||
# Currently not used, but just in case we need it in the future
|
# Currently not used, but just in case we need it in the future
|
||||||
#
|
#
|
||||||
def ConvertCygPathToDosViacygpath(CygPath):
|
def ConvertCygPathToDosViacygpath(CygPath):
|
||||||
p = subprocess.Popen("cygpath -m " + pipes.quote(CygPath), shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, close_fds=True)
|
p = subprocess.Popen("cygpath -m " + pipes.quote(CygPath), shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, close_fds=True)
|
||||||
return p.stdout.read().strip()
|
return p.stdout.read().strip()
|
||||||
|
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
def ConvertCygPathToDos(CygPath):
|
def ConvertCygPathToDos(CygPath):
|
||||||
if CygPath.find("/cygdrive/") == 0:
|
if CygPath.find("/cygdrive/") == 0:
|
||||||
# convert /cygdrive/c/Xyz to c:/Xyz
|
# convert /cygdrive/c/Xyz to c:/Xyz
|
||||||
DosPath = CygPath[10] + ':' + CygPath[11:]
|
DosPath = CygPath[10] + ':' + CygPath[11:]
|
||||||
else:
|
else:
|
||||||
DosPath = CygPath
|
DosPath = CygPath
|
||||||
|
|
||||||
# pipes.quote will add the extra \\ for us.
|
# pipes.quote will add the extra \\ for us.
|
||||||
return DosPath.replace('/', '\\')
|
return DosPath.replace('/', '\\')
|
||||||
|
|
||||||
|
|
||||||
# we receive our options as a list, but we will be passing them to the shell as a line
|
# we receive our options as a list, but we will be passing them to the shell as a line
|
||||||
# this means we have to requote things as they will get one round of unquoting.
|
# this means we have to requote things as they will get one round of unquoting.
|
||||||
# we can't set "shell=False" because we are running commands from the PATH and
|
# we can't set "shell=False" because we are running commands from the PATH and
|
||||||
# if you don't use the shell you don't get a PATH search.
|
# if you don't use the shell you don't get a PATH search.
|
||||||
def main(argv):
|
def main(argv):
|
||||||
|
|
||||||
# use 1st argument as name of tool to call
|
# use 1st argument as name of tool to call
|
||||||
Command = pipes.quote(sys.argv[1]);
|
Command = pipes.quote(sys.argv[1]);
|
||||||
|
|
||||||
ExceptionList = ["/interwork"]
|
ExceptionList = ["/interwork"]
|
||||||
|
|
||||||
for arg in argv:
|
for arg in argv:
|
||||||
if arg.find('/') == -1:
|
if arg.find('/') == -1:
|
||||||
# if we don't need to convert just add to the command line
|
# if we don't need to convert just add to the command line
|
||||||
Command = Command + ' ' + pipes.quote(arg)
|
Command = Command + ' ' + pipes.quote(arg)
|
||||||
elif arg in ExceptionList:
|
elif arg in ExceptionList:
|
||||||
# if it is in the list, then don't do a cygpath
|
# if it is in the list, then don't do a cygpath
|
||||||
# assembler stuff after --apcs has the /.
|
# assembler stuff after --apcs has the /.
|
||||||
Command = Command + ' ' + pipes.quote(arg)
|
Command = Command + ' ' + pipes.quote(arg)
|
||||||
else:
|
else:
|
||||||
if ((arg[0] == '-') and (arg[1] == 'I' or arg[1] == 'i')):
|
if ((arg[0] == '-') and (arg[1] == 'I' or arg[1] == 'i')):
|
||||||
CygPath = arg[0] + arg[1] + ConvertCygPathToDos(arg[2:])
|
CygPath = arg[0] + arg[1] + ConvertCygPathToDos(arg[2:])
|
||||||
else:
|
else:
|
||||||
CygPath = ConvertCygPathToDos(arg)
|
CygPath = ConvertCygPathToDos(arg)
|
||||||
|
|
||||||
Command = Command + ' ' + pipes.quote(CygPath)
|
Command = Command + ' ' + pipes.quote(CygPath)
|
||||||
|
|
||||||
# call the real tool with the converted paths
|
# call the real tool with the converted paths
|
||||||
return subprocess.call(Command, shell=True)
|
return subprocess.call(Command, shell=True)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
try:
|
try:
|
||||||
ret = main(sys.argv[2:])
|
ret = main(sys.argv[2:])
|
||||||
|
|
||||||
except:
|
except:
|
||||||
print("exiting: exception from " + sys.argv[0])
|
print("exiting: exception from " + sys.argv[0])
|
||||||
ret = 2
|
ret = 2
|
||||||
|
|
||||||
sys.exit(ret)
|
sys.exit(ret)
|
||||||
|
|
||||||
|
@@ -6,7 +6,7 @@ Root Package 1.00
|
|||||||
Intel is a trademark or registered trademark of Intel Corporation or its
|
Intel is a trademark or registered trademark of Intel Corporation or its
|
||||||
subsidiaries in the United States and other countries.
|
subsidiaries in the United States and other countries.
|
||||||
* Other names and brands may be claimed as the property of others.
|
* Other names and brands may be claimed as the property of others.
|
||||||
Copyright (c) 2007, Intel Corporation. All rights reserved.
|
Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Quick Start
|
Quick Start
|
||||||
@@ -33,28 +33,28 @@ Tools in Python
|
|||||||
---------------
|
---------------
|
||||||
* Convert Python source to exe file
|
* Convert Python source to exe file
|
||||||
|
|
||||||
The tools written in Python can be converted into executable program which can
|
The tools written in Python can be converted into executable program which can
|
||||||
be executed without installing a Python interpreter. (Generally it is easier
|
be executed without installing a Python interpreter. (Generally it is easier
|
||||||
to run the scripts from their source on operating systems other than Windows.)
|
to run the scripts from their source on operating systems other than Windows.)
|
||||||
|
|
||||||
For Windows and Linux, the conversion tool package is called cx_Freeze, its
|
For Windows and Linux, the conversion tool package is called cx_Freeze, its
|
||||||
home page is:
|
home page is:
|
||||||
|
|
||||||
http://sourceforge.net/projects/cx-freeze/
|
http://sourceforge.net/projects/cx-freeze/
|
||||||
|
|
||||||
If you have installed cx_Freeze at c:\cx_Freeze-3.0.3. Use following command
|
If you have installed cx_Freeze at c:\cx_Freeze-3.0.3. Use following command
|
||||||
lines to convert MyBuild.py to MyBuild.exe (note this is an example, there is
|
lines to convert MyBuild.py to MyBuild.exe (note this is an example, there is
|
||||||
no MyBuild Python project in the BaseTools\Python tree.
|
no MyBuild Python project in the BaseTools\Python tree.
|
||||||
|
|
||||||
set PYTHONPATH=<BaseToolsDirPath>\Source\Python
|
set PYTHONPATH=<BaseToolsDirPath>\Source\Python
|
||||||
c:\cx_Freeze-3.0.3\FreezePython.exe --include-modules=encodings.cp437,encodings.gbk,encodings.utf_16,encodings.utf_16_le,encodings.utf_8 --install-dir=.\mybuild MyBuild.py
|
c:\cx_Freeze-3.0.3\FreezePython.exe --include-modules=encodings.cp437,encodings.gbk,encodings.utf_16,encodings.utf_16_le,encodings.utf_8 --install-dir=.\mybuild MyBuild.py
|
||||||
|
|
||||||
The generated .exe (and .dll) files are put in "mybuild" subdirectory.
|
The generated .exe (and .dll) files are put in "mybuild" subdirectory.
|
||||||
|
|
||||||
The following is a real example with the BuildTools/trunk/BaseTools project
|
The following is a real example with the BuildTools/trunk/BaseTools project
|
||||||
installed in: C:\Work\BaseTools
|
installed in: C:\Work\BaseTools
|
||||||
|
|
||||||
|
|
||||||
C:\Work\BaseTools\Source\Python> set PYTHONPATH=C:\Work\BaseTools\Source\Python
|
C:\Work\BaseTools\Source\Python> set PYTHONPATH=C:\Work\BaseTools\Source\Python
|
||||||
C:\Work\BaseTools\Source\Python> c:\cx_Freeze-3.0.3\FreezePython.exe --include-modules=encodings.cp437,encodings.gbk,encodings.utf_16,encodings.utf_16_le,encodings.utf_8 --install-dir=C:\Work\BaseTools\Bin\Win32 build\build.py
|
C:\Work\BaseTools\Source\Python> c:\cx_Freeze-3.0.3\FreezePython.exe --include-modules=encodings.cp437,encodings.gbk,encodings.utf_16,encodings.utf_16_le,encodings.utf_8 --install-dir=C:\Work\BaseTools\Bin\Win32 build\build.py
|
||||||
|
|
||||||
@@ -70,7 +70,7 @@ Windows:
|
|||||||
|
|
||||||
The tools written in Python can be executed directly from its source directory
|
The tools written in Python can be executed directly from its source directory
|
||||||
as long as the Python interpreter (Python 2.5) has been installed. Before the execution,
|
as long as the Python interpreter (Python 2.5) has been installed. Before the execution,
|
||||||
please make sure the environment variable PYTHONPATH is set to
|
please make sure the environment variable PYTHONPATH is set to
|
||||||
|
|
||||||
<buildtools_project>/BaseTools/Source/Python
|
<buildtools_project>/BaseTools/Source/Python
|
||||||
|
|
||||||
|
@@ -6,4 +6,4 @@ These files may be updated frequently.
|
|||||||
|
|
||||||
The XMLSchema directory contains the EDK II Packaging XML definitions. The
|
The XMLSchema directory contains the EDK II Packaging XML definitions. The
|
||||||
schema may change in the future. It differs somewhat from the early versions
|
schema may change in the future. It differs somewhat from the early versions
|
||||||
of the XML Schema.
|
of the XML Schema.
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
This directory contains the next generation of EDK II build tools and template files.
|
This directory contains the next generation of EDK II build tools and template files.
|
||||||
Templates are located in the Conf directory, while the tools executables for
|
Templates are located in the Conf directory, while the tools executables for
|
||||||
Microsoft Windows 32-bit Operating Systems are located in the Bin\Win32 directory, other
|
Microsoft Windows 32-bit Operating Systems are located in the Bin\Win32 directory, other
|
||||||
directory contatins tools source.
|
directory contatins tools source.
|
||||||
|
|
||||||
1. Build step to generate the binary tools.
|
1. Build step to generate the binary tools.
|
||||||
@@ -38,8 +38,8 @@ packages to build all the C BaseTools:
|
|||||||
sudo apt-get install build-essential uuid-dev
|
sudo apt-get install build-essential uuid-dev
|
||||||
|
|
||||||
=== Python sqlite3 module ===
|
=== Python sqlite3 module ===
|
||||||
On Windows, the cx_freeze will not copy the sqlite3.dll to the frozen
|
On Windows, the cx_freeze will not copy the sqlite3.dll to the frozen
|
||||||
binary directory (the same directory as build.exe and GenFds.exe).
|
binary directory (the same directory as build.exe and GenFds.exe).
|
||||||
Please copy it manually from <PythonHome>\DLLs.
|
Please copy it manually from <PythonHome>\DLLs.
|
||||||
|
|
||||||
The Python distributed with most recent Linux will have sqlite3 module
|
The Python distributed with most recent Linux will have sqlite3 module
|
||||||
|
@@ -3,7 +3,7 @@
|
|||||||
#
|
#
|
||||||
# This tool depends on DIA2Dump.exe (VS) or nm (gcc) to parse debug entry.
|
# This tool depends on DIA2Dump.exe (VS) or nm (gcc) to parse debug entry.
|
||||||
#
|
#
|
||||||
# Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
|
# Copyright (c) 2016 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
# This program and the accompanying materials are licensed and made available under
|
# This program and the accompanying materials are licensed and made available under
|
||||||
# the terms and conditions of the BSD License that accompanies this distribution.
|
# the terms and conditions of the BSD License that accompanies this distribution.
|
||||||
# The full text of the license may be found at
|
# The full text of the license may be found at
|
||||||
@@ -21,7 +21,7 @@ import sys
|
|||||||
from optparse import OptionParser
|
from optparse import OptionParser
|
||||||
|
|
||||||
versionNumber = "1.1"
|
versionNumber = "1.1"
|
||||||
__copyright__ = "Copyright (c) 2016, Intel Corporation. All rights reserved."
|
__copyright__ = "Copyright (c) 2016 - 2018, Intel Corporation. All rights reserved."
|
||||||
|
|
||||||
class Symbols:
|
class Symbols:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
@@ -72,7 +72,7 @@ class Symbols:
|
|||||||
reportLines = linefile.readlines()
|
reportLines = linefile.readlines()
|
||||||
linefile.close()
|
linefile.close()
|
||||||
|
|
||||||
# 000113ca T AllocatePool c:\home\edk-ii\MdePkg\Library\UefiMemoryAllocationLib\MemoryAllocationLib.c:399
|
# 000113ca T AllocatePool c:\home\edk-ii\MdePkg\Library\UefiMemoryAllocationLib\MemoryAllocationLib.c:399
|
||||||
patchLineFileMatchString = "([0-9a-fA-F]*)\s+[T|D|t|d]\s+(\w+)\s*((?:[a-zA-Z]:)?[\w+\-./_a-zA-Z0-9\\\\]*):?([0-9]*)"
|
patchLineFileMatchString = "([0-9a-fA-F]*)\s+[T|D|t|d]\s+(\w+)\s*((?:[a-zA-Z]:)?[\w+\-./_a-zA-Z0-9\\\\]*):?([0-9]*)"
|
||||||
|
|
||||||
for reportLine in reportLines:
|
for reportLine in reportLines:
|
||||||
@@ -127,9 +127,9 @@ class Symbols:
|
|||||||
linefile.close()
|
linefile.close()
|
||||||
|
|
||||||
# ** GetDebugPrintErrorLevel
|
# ** GetDebugPrintErrorLevel
|
||||||
# line 32 at [0000C790][0001:0000B790], len = 0x3 c:\home\edk-ii\mdepkg\library\basedebugprinterrorlevellib\basedebugprinterrorlevellib.c (MD5: 687C0AE564079D35D56ED5D84A6164CC)
|
# line 32 at [0000C790][0001:0000B790], len = 0x3 c:\home\edk-ii\mdepkg\library\basedebugprinterrorlevellib\basedebugprinterrorlevellib.c (MD5: 687C0AE564079D35D56ED5D84A6164CC)
|
||||||
# line 36 at [0000C793][0001:0000B793], len = 0x5
|
# line 36 at [0000C793][0001:0000B793], len = 0x5
|
||||||
# line 37 at [0000C798][0001:0000B798], len = 0x2
|
# line 37 at [0000C798][0001:0000B798], len = 0x2
|
||||||
|
|
||||||
patchLineFileMatchString = "\s+line ([0-9]+) at \[([0-9a-fA-F]{8})\]\[[0-9a-fA-F]{4}\:[0-9a-fA-F]{8}\], len = 0x[0-9a-fA-F]+\s*([\w+\-\:./_a-zA-Z0-9\\\\]*)\s*"
|
patchLineFileMatchString = "\s+line ([0-9]+) at \[([0-9a-fA-F]{8})\]\[[0-9a-fA-F]{4}\:[0-9a-fA-F]{8}\], len = 0x[0-9a-fA-F]+\s*([\w+\-\:./_a-zA-Z0-9\\\\]*)\s*"
|
||||||
patchLineFileMatchStringFunc = "\*\*\s+(\w+)\s*"
|
patchLineFileMatchStringFunc = "\*\*\s+(\w+)\s*"
|
||||||
|
@@ -8,10 +8,10 @@
|
|||||||
# If a tool requires additional files, the developer must list those files in the
|
# If a tool requires additional files, the developer must list those files in the
|
||||||
# [ExtraFiles.Win32] section.
|
# [ExtraFiles.Win32] section.
|
||||||
# The [CxFreeze.Win32] section is maintained by the owner of the Build Server who
|
# The [CxFreeze.Win32] section is maintained by the owner of the Build Server who
|
||||||
# must ensure that files that are required by the cx_freeze frozen binaries are
|
# must ensure that files that are required by the cx_freeze frozen binaries are
|
||||||
# present in the Bin\Win32 directory.
|
# present in the Bin\Win32 directory.
|
||||||
#
|
#
|
||||||
# Copyright (c) 2014 - 2017, Intel Corporation. All rights reserved.<BR>
|
# Copyright (c) 2014 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
#
|
#
|
||||||
# This program and the accompanying materials are licensed and made available under
|
# 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 terms and conditions of the BSD License which accompanies this distribution.
|
||||||
|
@@ -4,14 +4,14 @@ Abstract:
|
|||||||
Patch the BPB information in boot sector image file.
|
Patch the BPB information in boot sector image file.
|
||||||
Patch the MBR code in MBR image file.
|
Patch the MBR code in MBR image file.
|
||||||
|
|
||||||
Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
http://opensource.org/licenses/bsd-license.php
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
@@ -98,7 +98,7 @@ Returns:
|
|||||||
}
|
}
|
||||||
|
|
||||||
int WriteToFile (
|
int WriteToFile (
|
||||||
void *BootSector,
|
void *BootSector,
|
||||||
char *FileName
|
char *FileName
|
||||||
)
|
)
|
||||||
/*++
|
/*++
|
||||||
@@ -136,7 +136,7 @@ Return:
|
|||||||
}
|
}
|
||||||
|
|
||||||
int ReadFromFile (
|
int ReadFromFile (
|
||||||
void *BootSector,
|
void *BootSector,
|
||||||
char *FileName
|
char *FileName
|
||||||
)
|
)
|
||||||
/*++
|
/*++
|
||||||
@@ -446,17 +446,17 @@ Return:
|
|||||||
FatBpb->Fat32.BS_BootSig, FAT_BS_BOOTSIG);
|
FatBpb->Fat32.BS_BootSig, FAT_BS_BOOTSIG);
|
||||||
return FatTypeUnknown;
|
return FatTypeUnknown;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((FatType == FatTypeFat12) || (FatType == FatTypeFat16)) {
|
if ((FatType == FatTypeFat12) || (FatType == FatTypeFat16)) {
|
||||||
memcpy (FilSysType, FatBpb->Fat12_16.BS_FilSysType, 8);
|
memcpy (FilSysType, FatBpb->Fat12_16.BS_FilSysType, 8);
|
||||||
FilSysType[8] = 0;
|
FilSysType[8] = 0;
|
||||||
if ((FatType == FatTypeFat12) &&
|
if ((FatType == FatTypeFat12) &&
|
||||||
(strcmp (FilSysType, FAT12_FILSYSTYPE) != 0) &&
|
(strcmp (FilSysType, FAT12_FILSYSTYPE) != 0) &&
|
||||||
(strcmp (FilSysType, FAT_FILSYSTYPE) != 0)) {
|
(strcmp (FilSysType, FAT_FILSYSTYPE) != 0)) {
|
||||||
DebugMsg (NULL, 0, DEBUG_WARN, NULL, "ERROR: E3003: FAT12 - BS_FilSysType - %s, expected: %s, or %s\n",
|
DebugMsg (NULL, 0, DEBUG_WARN, NULL, "ERROR: E3003: FAT12 - BS_FilSysType - %s, expected: %s, or %s\n",
|
||||||
FilSysType, FAT12_FILSYSTYPE, FAT_FILSYSTYPE);
|
FilSysType, FAT12_FILSYSTYPE, FAT_FILSYSTYPE);
|
||||||
}
|
}
|
||||||
if ((FatType == FatTypeFat16) &&
|
if ((FatType == FatTypeFat16) &&
|
||||||
(strcmp (FilSysType, FAT16_FILSYSTYPE) != 0) &&
|
(strcmp (FilSysType, FAT16_FILSYSTYPE) != 0) &&
|
||||||
(strcmp (FilSysType, FAT_FILSYSTYPE) != 0)) {
|
(strcmp (FilSysType, FAT_FILSYSTYPE) != 0)) {
|
||||||
DebugMsg (NULL, 0, DEBUG_WARN, NULL, "ERROR: E3003: FAT16 - BS_FilSysType - %s, expected: %s, or %s\n",
|
DebugMsg (NULL, 0, DEBUG_WARN, NULL, "ERROR: E3003: FAT16 - BS_FilSysType - %s, expected: %s, or %s\n",
|
||||||
@@ -486,11 +486,11 @@ ParseBootSector (
|
|||||||
{
|
{
|
||||||
FAT_BPB_STRUCT FatBpb;
|
FAT_BPB_STRUCT FatBpb;
|
||||||
FAT_TYPE FatType;
|
FAT_TYPE FatType;
|
||||||
|
|
||||||
if (ReadFromFile ((void *)&FatBpb, FileName) == 0) {
|
if (ReadFromFile ((void *)&FatBpb, FileName) == 0) {
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
|
|
||||||
FatType = GetFatType (&FatBpb);
|
FatType = GetFatType (&FatBpb);
|
||||||
if (FatType <= FatTypeUnknown || FatType >= FatTypeMax) {
|
if (FatType <= FatTypeUnknown || FatType >= FatTypeMax) {
|
||||||
printf ("ERROR: E3002: Unknown FAT Type!\n");
|
printf ("ERROR: E3002: Unknown FAT Type!\n");
|
||||||
@@ -608,7 +608,7 @@ ParseBootSector (
|
|||||||
printf (" 1FE Signature %04x\n", FatBpb.Fat12_16.Signature);
|
printf (" 1FE Signature %04x\n", FatBpb.Fat12_16.Signature);
|
||||||
printf ("\n");
|
printf ("\n");
|
||||||
|
|
||||||
|
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -634,14 +634,14 @@ Arguments:
|
|||||||
FAT_TYPE SourceFatType;
|
FAT_TYPE SourceFatType;
|
||||||
CHAR8 VolLab[11];
|
CHAR8 VolLab[11];
|
||||||
CHAR8 FilSysType[8];
|
CHAR8 FilSysType[8];
|
||||||
|
|
||||||
if (ReadFromFile ((void *)&DestFatBpb, DestFileName) == 0) {
|
if (ReadFromFile ((void *)&DestFatBpb, DestFileName) == 0) {
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
if (ReadFromFile ((void *)&SourceFatBpb, SourceFileName) == 0) {
|
if (ReadFromFile ((void *)&SourceFatBpb, SourceFileName) == 0) {
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
|
|
||||||
DestFatType = GetFatType (&DestFatBpb);
|
DestFatType = GetFatType (&DestFatBpb);
|
||||||
SourceFatType = GetFatType (&SourceFatBpb);
|
SourceFatType = GetFatType (&SourceFatBpb);
|
||||||
|
|
||||||
@@ -650,10 +650,10 @@ Arguments:
|
|||||||
// FAT type mismatch
|
// FAT type mismatch
|
||||||
//
|
//
|
||||||
if (ForcePatch) {
|
if (ForcePatch) {
|
||||||
DebugMsg (NULL, 0, DEBUG_WARN, NULL, "ERROR: E3004: FAT type mismatch: Source - %s, Dest - %s",
|
DebugMsg (NULL, 0, DEBUG_WARN, NULL, "ERROR: E3004: FAT type mismatch: Source - %s, Dest - %s",
|
||||||
FatTypeToString(SourceFatType), FatTypeToString(DestFatType));
|
FatTypeToString(SourceFatType), FatTypeToString(DestFatType));
|
||||||
} else {
|
} else {
|
||||||
DebugMsg (NULL, 0, DEBUG_ERROR, NULL, "ERROR: E3004: FAT type mismatch: Source - %s, Dest - %s",
|
DebugMsg (NULL, 0, DEBUG_ERROR, NULL, "ERROR: E3004: FAT type mismatch: Source - %s, Dest - %s",
|
||||||
FatTypeToString(SourceFatType), FatTypeToString(DestFatType));
|
FatTypeToString(SourceFatType), FatTypeToString(DestFatType));
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
@@ -707,7 +707,7 @@ Arguments:
|
|||||||
memcpy (DestFatBpb.Fat32.BS_VolLab, VolLab, sizeof(VolLab));
|
memcpy (DestFatBpb.Fat32.BS_VolLab, VolLab, sizeof(VolLab));
|
||||||
memcpy (DestFatBpb.Fat32.BS_FilSysType, FilSysType, sizeof(FilSysType));
|
memcpy (DestFatBpb.Fat32.BS_FilSysType, FilSysType, sizeof(FilSysType));
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Set Signature of DestFatBpb to 55AA
|
// Set Signature of DestFatBpb to 55AA
|
||||||
//
|
//
|
||||||
@@ -731,11 +731,11 @@ ParseMbr (
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
MASTER_BOOT_RECORD Mbr;
|
MASTER_BOOT_RECORD Mbr;
|
||||||
|
|
||||||
if (ReadFromFile ((void *)&Mbr, FileName) == 0) {
|
if (ReadFromFile ((void *)&Mbr, FileName) == 0) {
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf ("\nMaster Boot Record:\n");
|
printf ("\nMaster Boot Record:\n");
|
||||||
printf ("\n");
|
printf ("\n");
|
||||||
printf (" Offset Title Value\n");
|
printf (" Offset Title Value\n");
|
||||||
@@ -805,14 +805,14 @@ PatchMbr (
|
|||||||
{
|
{
|
||||||
MASTER_BOOT_RECORD DestMbr;
|
MASTER_BOOT_RECORD DestMbr;
|
||||||
MASTER_BOOT_RECORD SourceMbr;
|
MASTER_BOOT_RECORD SourceMbr;
|
||||||
|
|
||||||
if (ReadFromFile ((void *)&DestMbr, DestFileName) == 0) {
|
if (ReadFromFile ((void *)&DestMbr, DestFileName) == 0) {
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
if (ReadFromFile ((void *)&SourceMbr, SourceFileName) == 0) {
|
if (ReadFromFile ((void *)&SourceMbr, SourceFileName) == 0) {
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SourceMbr.Signature != MBR_SIGNATURE) {
|
if (SourceMbr.Signature != MBR_SIGNATURE) {
|
||||||
printf ("ERROR: E3000: Invalid MBR!\n");
|
printf ("ERROR: E3000: Invalid MBR!\n");
|
||||||
return;
|
return;
|
||||||
|
@@ -2,14 +2,14 @@
|
|||||||
|
|
||||||
Fat file system structure and definition.
|
Fat file system structure and definition.
|
||||||
|
|
||||||
Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
http://opensource.org/licenses/bsd-license.php
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
|
@@ -2,14 +2,14 @@
|
|||||||
|
|
||||||
MBR Partition Entry and Table structure defintions.
|
MBR Partition Entry and Table structure defintions.
|
||||||
|
|
||||||
Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
http://opensource.org/licenses/bsd-license.php
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
|
@@ -2,15 +2,15 @@
|
|||||||
|
|
||||||
Functions to get info and load PE/COFF image.
|
Functions to get info and load PE/COFF image.
|
||||||
|
|
||||||
Copyright (c) 2004 - 2017, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
Portions Copyright (c) 2011 - 2013, ARM Ltd. All rights reserved.<BR>
|
Portions Copyright (c) 2011 - 2013, ARM Ltd. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
http://opensource.org/licenses/bsd-license.php
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
@@ -20,7 +20,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||||||
#include "PeCoffLib.h"
|
#include "PeCoffLib.h"
|
||||||
|
|
||||||
typedef union {
|
typedef union {
|
||||||
VOID *Header;
|
VOID *Header;
|
||||||
EFI_IMAGE_OPTIONAL_HEADER32 *Optional32;
|
EFI_IMAGE_OPTIONAL_HEADER32 *Optional32;
|
||||||
EFI_IMAGE_OPTIONAL_HEADER64 *Optional64;
|
EFI_IMAGE_OPTIONAL_HEADER64 *Optional64;
|
||||||
} EFI_IMAGE_OPTIONAL_HEADER_POINTER;
|
} EFI_IMAGE_OPTIONAL_HEADER_POINTER;
|
||||||
@@ -90,12 +90,12 @@ Arguments:
|
|||||||
ImageContext - The context of the image being loaded
|
ImageContext - The context of the image being loaded
|
||||||
|
|
||||||
PeHdr - The buffer in which to return the PE header
|
PeHdr - The buffer in which to return the PE header
|
||||||
|
|
||||||
TeHdr - The buffer in which to return the TE header
|
TeHdr - The buffer in which to return the TE header
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
|
|
||||||
RETURN_SUCCESS if the PE or TE Header is read,
|
RETURN_SUCCESS if the PE or TE Header is read,
|
||||||
Otherwise, the error status from reading the PE/COFF or TE image using the ImageRead function.
|
Otherwise, the error status from reading the PE/COFF or TE image using the ImageRead function.
|
||||||
|
|
||||||
--*/
|
--*/
|
||||||
@@ -135,7 +135,7 @@ Returns:
|
|||||||
//
|
//
|
||||||
// Check the PE/COFF Header Signature. If not, then try to get a TE header
|
// Check the PE/COFF Header Signature. If not, then try to get a TE header
|
||||||
//
|
//
|
||||||
*TeHdr = (EFI_TE_IMAGE_HEADER *)*PeHdr;
|
*TeHdr = (EFI_TE_IMAGE_HEADER *)*PeHdr;
|
||||||
if ((*TeHdr)->Signature != EFI_TE_IMAGE_HEADER_SIGNATURE) {
|
if ((*TeHdr)->Signature != EFI_TE_IMAGE_HEADER_SIGNATURE) {
|
||||||
return RETURN_UNSUPPORTED;
|
return RETURN_UNSUPPORTED;
|
||||||
}
|
}
|
||||||
@@ -163,7 +163,7 @@ Arguments:
|
|||||||
ImageContext - The context of the image being loaded
|
ImageContext - The context of the image being loaded
|
||||||
|
|
||||||
PeHdr - The buffer in which to return the PE header
|
PeHdr - The buffer in which to return the PE header
|
||||||
|
|
||||||
TeHdr - The buffer in which to return the TE header
|
TeHdr - The buffer in which to return the TE header
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
@@ -174,7 +174,7 @@ Returns:
|
|||||||
--*/
|
--*/
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// See if the machine type is supported.
|
// See if the machine type is supported.
|
||||||
// We support a native machine type (IA-32/Itanium-based)
|
// We support a native machine type (IA-32/Itanium-based)
|
||||||
//
|
//
|
||||||
if (ImageContext->IsTeImage == FALSE) {
|
if (ImageContext->IsTeImage == FALSE) {
|
||||||
@@ -182,7 +182,7 @@ Returns:
|
|||||||
} else {
|
} else {
|
||||||
ImageContext->Machine = TeHdr->Machine;
|
ImageContext->Machine = TeHdr->Machine;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ImageContext->Machine != EFI_IMAGE_MACHINE_IA32 && \
|
if (ImageContext->Machine != EFI_IMAGE_MACHINE_IA32 && \
|
||||||
ImageContext->Machine != EFI_IMAGE_MACHINE_IA64 && \
|
ImageContext->Machine != EFI_IMAGE_MACHINE_IA64 && \
|
||||||
ImageContext->Machine != EFI_IMAGE_MACHINE_X64 && \
|
ImageContext->Machine != EFI_IMAGE_MACHINE_X64 && \
|
||||||
@@ -191,7 +191,7 @@ Returns:
|
|||||||
ImageContext->Machine != EFI_IMAGE_MACHINE_AARCH64) {
|
ImageContext->Machine != EFI_IMAGE_MACHINE_AARCH64) {
|
||||||
if (ImageContext->Machine == IMAGE_FILE_MACHINE_ARM) {
|
if (ImageContext->Machine == IMAGE_FILE_MACHINE_ARM) {
|
||||||
//
|
//
|
||||||
// There are two types of ARM images. Pure ARM and ARM/Thumb.
|
// There are two types of ARM images. Pure ARM and ARM/Thumb.
|
||||||
// If we see the ARM say it is the ARM/Thumb so there is only
|
// If we see the ARM say it is the ARM/Thumb so there is only
|
||||||
// a single machine type we need to check for ARM.
|
// a single machine type we need to check for ARM.
|
||||||
//
|
//
|
||||||
@@ -204,8 +204,8 @@ Returns:
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
//
|
//
|
||||||
// unsupported PeImage machine type
|
// unsupported PeImage machine type
|
||||||
//
|
//
|
||||||
return RETURN_UNSUPPORTED;
|
return RETURN_UNSUPPORTED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -225,8 +225,8 @@ Returns:
|
|||||||
ImageContext->ImageType != EFI_IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER && \
|
ImageContext->ImageType != EFI_IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER && \
|
||||||
ImageContext->ImageType != EFI_IMAGE_SUBSYSTEM_SAL_RUNTIME_DRIVER) {
|
ImageContext->ImageType != EFI_IMAGE_SUBSYSTEM_SAL_RUNTIME_DRIVER) {
|
||||||
//
|
//
|
||||||
// upsupported PeImage subsystem type
|
// upsupported PeImage subsystem type
|
||||||
//
|
//
|
||||||
return RETURN_UNSUPPORTED;
|
return RETURN_UNSUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -348,7 +348,7 @@ Returns:
|
|||||||
ImageContext->ImageSize = (UINT64) OptionHeader.Optional32->SizeOfImage;
|
ImageContext->ImageSize = (UINT64) OptionHeader.Optional32->SizeOfImage;
|
||||||
ImageContext->SectionAlignment = OptionHeader.Optional32->SectionAlignment;
|
ImageContext->SectionAlignment = OptionHeader.Optional32->SectionAlignment;
|
||||||
ImageContext->SizeOfHeaders = OptionHeader.Optional32->SizeOfHeaders;
|
ImageContext->SizeOfHeaders = OptionHeader.Optional32->SizeOfHeaders;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Modify ImageSize to contain .PDB file name if required and initialize
|
// Modify ImageSize to contain .PDB file name if required and initialize
|
||||||
// PdbRVA field...
|
// PdbRVA field...
|
||||||
@@ -361,7 +361,7 @@ Returns:
|
|||||||
ImageContext->ImageSize = (UINT64) OptionHeader.Optional64->SizeOfImage;
|
ImageContext->ImageSize = (UINT64) OptionHeader.Optional64->SizeOfImage;
|
||||||
ImageContext->SectionAlignment = OptionHeader.Optional64->SectionAlignment;
|
ImageContext->SectionAlignment = OptionHeader.Optional64->SectionAlignment;
|
||||||
ImageContext->SizeOfHeaders = OptionHeader.Optional64->SizeOfHeaders;
|
ImageContext->SizeOfHeaders = OptionHeader.Optional64->SizeOfHeaders;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Modify ImageSize to contain .PDB file name if required and initialize
|
// Modify ImageSize to contain .PDB file name if required and initialize
|
||||||
// PdbRVA field...
|
// PdbRVA field...
|
||||||
@@ -371,7 +371,7 @@ Returns:
|
|||||||
DebugDirectoryEntryRva = DebugDirectoryEntry->VirtualAddress;
|
DebugDirectoryEntryRva = DebugDirectoryEntry->VirtualAddress;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DebugDirectoryEntryRva != 0) {
|
if (DebugDirectoryEntryRva != 0) {
|
||||||
//
|
//
|
||||||
// Determine the file offset of the debug directory... This means we walk
|
// Determine the file offset of the debug directory... This means we walk
|
||||||
@@ -382,8 +382,8 @@ Returns:
|
|||||||
|
|
||||||
SectionHeaderOffset = (UINTN)(
|
SectionHeaderOffset = (UINTN)(
|
||||||
ImageContext->PeCoffHeaderOffset +
|
ImageContext->PeCoffHeaderOffset +
|
||||||
sizeof (UINT32) +
|
sizeof (UINT32) +
|
||||||
sizeof (EFI_IMAGE_FILE_HEADER) +
|
sizeof (EFI_IMAGE_FILE_HEADER) +
|
||||||
PeHdr->Pe32.FileHeader.SizeOfOptionalHeader
|
PeHdr->Pe32.FileHeader.SizeOfOptionalHeader
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -413,12 +413,12 @@ Returns:
|
|||||||
SectionHeaderOffset += sizeof (EFI_IMAGE_SECTION_HEADER);
|
SectionHeaderOffset += sizeof (EFI_IMAGE_SECTION_HEADER);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DebugDirectoryEntryFileOffset != 0) {
|
if (DebugDirectoryEntryFileOffset != 0) {
|
||||||
for (Index = 0; Index < DebugDirectoryEntry->Size; Index += sizeof (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY)) {
|
for (Index = 0; Index < DebugDirectoryEntry->Size; Index += sizeof (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY)) {
|
||||||
//
|
//
|
||||||
// Read next debug directory entry
|
// Read next debug directory entry
|
||||||
//
|
//
|
||||||
Size = sizeof (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY);
|
Size = sizeof (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY);
|
||||||
Status = ImageContext->ImageRead (
|
Status = ImageContext->ImageRead (
|
||||||
ImageContext->Handle,
|
ImageContext->Handle,
|
||||||
DebugDirectoryEntryFileOffset + Index,
|
DebugDirectoryEntryFileOffset + Index,
|
||||||
@@ -489,8 +489,8 @@ Returns:
|
|||||||
|
|
||||||
//
|
//
|
||||||
// In Te image header there is not a field to describe the ImageSize.
|
// In Te image header there is not a field to describe the ImageSize.
|
||||||
// Actually, the ImageSize equals the RVA plus the VirtualSize of
|
// Actually, the ImageSize equals the RVA plus the VirtualSize of
|
||||||
// the last section mapped into memory (Must be rounded up to
|
// the last section mapped into memory (Must be rounded up to
|
||||||
// a mulitple of Section Alignment). Per the PE/COFF specification, the
|
// a mulitple of Section Alignment). Per the PE/COFF specification, the
|
||||||
// section headers in the Section Table must appear in order of the RVA
|
// section headers in the Section Table must appear in order of the RVA
|
||||||
// values for the corresponding sections. So the ImageSize can be determined
|
// values for the corresponding sections. So the ImageSize can be determined
|
||||||
@@ -627,9 +627,9 @@ Returns:
|
|||||||
// Use DestinationAddress field of ImageContext as the relocation address even if it is 0.
|
// Use DestinationAddress field of ImageContext as the relocation address even if it is 0.
|
||||||
//
|
//
|
||||||
BaseAddress = ImageContext->DestinationAddress;
|
BaseAddress = ImageContext->DestinationAddress;
|
||||||
|
|
||||||
if (!(ImageContext->IsTeImage)) {
|
if (!(ImageContext->IsTeImage)) {
|
||||||
PeHdr = (EFI_IMAGE_OPTIONAL_HEADER_UNION *)((UINTN)ImageContext->ImageAddress +
|
PeHdr = (EFI_IMAGE_OPTIONAL_HEADER_UNION *)((UINTN)ImageContext->ImageAddress +
|
||||||
ImageContext->PeCoffHeaderOffset);
|
ImageContext->PeCoffHeaderOffset);
|
||||||
OptionHeader.Header = (VOID *) &(PeHdr->Pe32.OptionalHeader);
|
OptionHeader.Header = (VOID *) &(PeHdr->Pe32.OptionalHeader);
|
||||||
if (PeHdr->Pe32.OptionalHeader.Magic == EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC) {
|
if (PeHdr->Pe32.OptionalHeader.Magic == EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC) {
|
||||||
@@ -708,20 +708,20 @@ Returns:
|
|||||||
Adjust = (UINT64) (BaseAddress - TeHdr->ImageBase);
|
Adjust = (UINT64) (BaseAddress - TeHdr->ImageBase);
|
||||||
TeHdr->ImageBase = (UINT64) (BaseAddress);
|
TeHdr->ImageBase = (UINT64) (BaseAddress);
|
||||||
MachineType = TeHdr->Machine;
|
MachineType = TeHdr->Machine;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Find the relocation block
|
// Find the relocation block
|
||||||
//
|
//
|
||||||
RelocDir = &TeHdr->DataDirectory[0];
|
RelocDir = &TeHdr->DataDirectory[0];
|
||||||
RelocBase = (EFI_IMAGE_BASE_RELOCATION *)(UINTN)(
|
RelocBase = (EFI_IMAGE_BASE_RELOCATION *)(UINTN)(
|
||||||
ImageContext->ImageAddress +
|
ImageContext->ImageAddress +
|
||||||
RelocDir->VirtualAddress +
|
RelocDir->VirtualAddress +
|
||||||
sizeof(EFI_TE_IMAGE_HEADER) -
|
sizeof(EFI_TE_IMAGE_HEADER) -
|
||||||
TeHdr->StrippedSize
|
TeHdr->StrippedSize
|
||||||
);
|
);
|
||||||
RelocBaseEnd = (EFI_IMAGE_BASE_RELOCATION *) ((UINTN) RelocBase + (UINTN) RelocDir->Size - 1);
|
RelocBaseEnd = (EFI_IMAGE_BASE_RELOCATION *) ((UINTN) RelocBase + (UINTN) RelocDir->Size - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Run the relocation information and apply the fixups
|
// Run the relocation information and apply the fixups
|
||||||
//
|
//
|
||||||
@@ -739,13 +739,13 @@ Returns:
|
|||||||
} else {
|
} else {
|
||||||
FixupBase = (CHAR8 *)(UINTN)(ImageContext->ImageAddress +
|
FixupBase = (CHAR8 *)(UINTN)(ImageContext->ImageAddress +
|
||||||
RelocBase->VirtualAddress +
|
RelocBase->VirtualAddress +
|
||||||
sizeof(EFI_TE_IMAGE_HEADER) -
|
sizeof(EFI_TE_IMAGE_HEADER) -
|
||||||
TeHdr->StrippedSize
|
TeHdr->StrippedSize
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((CHAR8 *) RelocEnd < (CHAR8 *) ((UINTN) ImageContext->ImageAddress) ||
|
if ((CHAR8 *) RelocEnd < (CHAR8 *) ((UINTN) ImageContext->ImageAddress) ||
|
||||||
(CHAR8 *) RelocEnd > (CHAR8 *)((UINTN)ImageContext->ImageAddress +
|
(CHAR8 *) RelocEnd > (CHAR8 *)((UINTN)ImageContext->ImageAddress +
|
||||||
(UINTN)ImageContext->ImageSize)) {
|
(UINTN)ImageContext->ImageSize)) {
|
||||||
ImageContext->ImageError = IMAGE_ERROR_FAILED_RELOCATION;
|
ImageContext->ImageError = IMAGE_ERROR_FAILED_RELOCATION;
|
||||||
return RETURN_LOAD_ERROR;
|
return RETURN_LOAD_ERROR;
|
||||||
@@ -961,12 +961,12 @@ Returns:
|
|||||||
((UINTN)ImageContext->ImageAddress + ImageContext->PeCoffHeaderOffset);
|
((UINTN)ImageContext->ImageAddress + ImageContext->PeCoffHeaderOffset);
|
||||||
|
|
||||||
OptionHeader.Header = (VOID *) &(PeHdr->Pe32.OptionalHeader);
|
OptionHeader.Header = (VOID *) &(PeHdr->Pe32.OptionalHeader);
|
||||||
|
|
||||||
FirstSection = (EFI_IMAGE_SECTION_HEADER *) (
|
FirstSection = (EFI_IMAGE_SECTION_HEADER *) (
|
||||||
(UINTN)ImageContext->ImageAddress +
|
(UINTN)ImageContext->ImageAddress +
|
||||||
ImageContext->PeCoffHeaderOffset +
|
ImageContext->PeCoffHeaderOffset +
|
||||||
sizeof(UINT32) +
|
sizeof(UINT32) +
|
||||||
sizeof(EFI_IMAGE_FILE_HEADER) +
|
sizeof(EFI_IMAGE_FILE_HEADER) +
|
||||||
PeHdr->Pe32.FileHeader.SizeOfOptionalHeader
|
PeHdr->Pe32.FileHeader.SizeOfOptionalHeader
|
||||||
);
|
);
|
||||||
NumberOfSections = (UINTN) (PeHdr->Pe32.FileHeader.NumberOfSections);
|
NumberOfSections = (UINTN) (PeHdr->Pe32.FileHeader.NumberOfSections);
|
||||||
@@ -1016,7 +1016,7 @@ Returns:
|
|||||||
return RETURN_LOAD_ERROR;
|
return RETURN_LOAD_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (ImageContext->IsTeImage) {
|
if (ImageContext->IsTeImage) {
|
||||||
Base = (CHAR8 *) ((UINTN) Base + sizeof (EFI_TE_IMAGE_HEADER) - (UINTN) TeHdr->StrippedSize);
|
Base = (CHAR8 *) ((UINTN) Base + sizeof (EFI_TE_IMAGE_HEADER) - (UINTN) TeHdr->StrippedSize);
|
||||||
End = (CHAR8 *) ((UINTN) End + sizeof (EFI_TE_IMAGE_HEADER) - (UINTN) TeHdr->StrippedSize);
|
End = (CHAR8 *) ((UINTN) End + sizeof (EFI_TE_IMAGE_HEADER) - (UINTN) TeHdr->StrippedSize);
|
||||||
@@ -1286,19 +1286,19 @@ PeCoffLoaderGetPdbPointer (
|
|||||||
if (Hdr.Te->DataDirectory[EFI_TE_IMAGE_DIRECTORY_ENTRY_DEBUG].VirtualAddress != 0) {
|
if (Hdr.Te->DataDirectory[EFI_TE_IMAGE_DIRECTORY_ENTRY_DEBUG].VirtualAddress != 0) {
|
||||||
DirectoryEntry = &Hdr.Te->DataDirectory[EFI_TE_IMAGE_DIRECTORY_ENTRY_DEBUG];
|
DirectoryEntry = &Hdr.Te->DataDirectory[EFI_TE_IMAGE_DIRECTORY_ENTRY_DEBUG];
|
||||||
TEImageAdjust = sizeof (EFI_TE_IMAGE_HEADER) - Hdr.Te->StrippedSize;
|
TEImageAdjust = sizeof (EFI_TE_IMAGE_HEADER) - Hdr.Te->StrippedSize;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Get the DebugEntry offset in the raw data image.
|
// Get the DebugEntry offset in the raw data image.
|
||||||
//
|
//
|
||||||
SectionHeader = (EFI_IMAGE_SECTION_HEADER *) (Hdr.Te + 1);
|
SectionHeader = (EFI_IMAGE_SECTION_HEADER *) (Hdr.Te + 1);
|
||||||
Index = Hdr.Te->NumberOfSections;
|
Index = Hdr.Te->NumberOfSections;
|
||||||
for (Index1 = 0; Index1 < Index; Index1 ++) {
|
for (Index1 = 0; Index1 < Index; Index1 ++) {
|
||||||
if ((DirectoryEntry->VirtualAddress >= SectionHeader[Index1].VirtualAddress) &&
|
if ((DirectoryEntry->VirtualAddress >= SectionHeader[Index1].VirtualAddress) &&
|
||||||
(DirectoryEntry->VirtualAddress < (SectionHeader[Index1].VirtualAddress + SectionHeader[Index1].Misc.VirtualSize))) {
|
(DirectoryEntry->VirtualAddress < (SectionHeader[Index1].VirtualAddress + SectionHeader[Index1].Misc.VirtualSize))) {
|
||||||
DebugEntry = (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY *)((UINTN) Hdr.Te +
|
DebugEntry = (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY *)((UINTN) Hdr.Te +
|
||||||
DirectoryEntry->VirtualAddress -
|
DirectoryEntry->VirtualAddress -
|
||||||
SectionHeader [Index1].VirtualAddress +
|
SectionHeader [Index1].VirtualAddress +
|
||||||
SectionHeader [Index1].PointerToRawData +
|
SectionHeader [Index1].PointerToRawData +
|
||||||
TEImageAdjust);
|
TEImageAdjust);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -1334,8 +1334,8 @@ PeCoffLoaderGetPdbPointer (
|
|||||||
|
|
||||||
SectionHeader = (EFI_IMAGE_SECTION_HEADER *) (
|
SectionHeader = (EFI_IMAGE_SECTION_HEADER *) (
|
||||||
(UINT8 *) Hdr.Pe32 +
|
(UINT8 *) Hdr.Pe32 +
|
||||||
sizeof (UINT32) +
|
sizeof (UINT32) +
|
||||||
sizeof (EFI_IMAGE_FILE_HEADER) +
|
sizeof (EFI_IMAGE_FILE_HEADER) +
|
||||||
Hdr.Pe32->FileHeader.SizeOfOptionalHeader
|
Hdr.Pe32->FileHeader.SizeOfOptionalHeader
|
||||||
);
|
);
|
||||||
Index = Hdr.Pe32->FileHeader.NumberOfSections;
|
Index = Hdr.Pe32->FileHeader.NumberOfSections;
|
||||||
@@ -1362,12 +1362,12 @@ PeCoffLoaderGetPdbPointer (
|
|||||||
// Get the DebugEntry offset in the raw data image.
|
// Get the DebugEntry offset in the raw data image.
|
||||||
//
|
//
|
||||||
for (Index1 = 0; Index1 < Index; Index1 ++) {
|
for (Index1 = 0; Index1 < Index; Index1 ++) {
|
||||||
if ((DirectoryEntry->VirtualAddress >= SectionHeader[Index1].VirtualAddress) &&
|
if ((DirectoryEntry->VirtualAddress >= SectionHeader[Index1].VirtualAddress) &&
|
||||||
(DirectoryEntry->VirtualAddress < (SectionHeader[Index1].VirtualAddress + SectionHeader[Index1].Misc.VirtualSize))) {
|
(DirectoryEntry->VirtualAddress < (SectionHeader[Index1].VirtualAddress + SectionHeader[Index1].Misc.VirtualSize))) {
|
||||||
DebugEntry = (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY *) (
|
DebugEntry = (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY *) (
|
||||||
(UINTN) Pe32Data +
|
(UINTN) Pe32Data +
|
||||||
DirectoryEntry->VirtualAddress -
|
DirectoryEntry->VirtualAddress -
|
||||||
SectionHeader[Index1].VirtualAddress +
|
SectionHeader[Index1].VirtualAddress +
|
||||||
SectionHeader[Index1].PointerToRawData);
|
SectionHeader[Index1].PointerToRawData);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -1383,7 +1383,7 @@ PeCoffLoaderGetPdbPointer (
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Scan the directory to find the debug entry.
|
// Scan the directory to find the debug entry.
|
||||||
//
|
//
|
||||||
for (DirCount = 0; DirCount < DirectoryEntry->Size; DirCount += sizeof (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY), DebugEntry++) {
|
for (DirCount = 0; DirCount < DirectoryEntry->Size; DirCount += sizeof (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY), DebugEntry++) {
|
||||||
if (EFI_IMAGE_DEBUG_TYPE_CODEVIEW == DebugEntry->Type) {
|
if (EFI_IMAGE_DEBUG_TYPE_CODEVIEW == DebugEntry->Type) {
|
||||||
if (DebugEntry->SizeOfData > 0) {
|
if (DebugEntry->SizeOfData > 0) {
|
||||||
@@ -1392,13 +1392,13 @@ PeCoffLoaderGetPdbPointer (
|
|||||||
//
|
//
|
||||||
CodeViewEntryPointer = NULL;
|
CodeViewEntryPointer = NULL;
|
||||||
for (Index1 = 0; Index1 < Index; Index1 ++) {
|
for (Index1 = 0; Index1 < Index; Index1 ++) {
|
||||||
if ((DebugEntry->RVA >= SectionHeader[Index1].VirtualAddress) &&
|
if ((DebugEntry->RVA >= SectionHeader[Index1].VirtualAddress) &&
|
||||||
(DebugEntry->RVA < (SectionHeader[Index1].VirtualAddress + SectionHeader[Index1].Misc.VirtualSize))) {
|
(DebugEntry->RVA < (SectionHeader[Index1].VirtualAddress + SectionHeader[Index1].Misc.VirtualSize))) {
|
||||||
CodeViewEntryPointer = (VOID *) (
|
CodeViewEntryPointer = (VOID *) (
|
||||||
((UINTN)Pe32Data) +
|
((UINTN)Pe32Data) +
|
||||||
(UINTN) DebugEntry->RVA -
|
(UINTN) DebugEntry->RVA -
|
||||||
SectionHeader[Index1].VirtualAddress +
|
SectionHeader[Index1].VirtualAddress +
|
||||||
SectionHeader[Index1].PointerToRawData +
|
SectionHeader[Index1].PointerToRawData +
|
||||||
(UINTN)TEImageAdjust);
|
(UINTN)TEImageAdjust);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
/** @file
|
/** @file
|
||||||
Prototypes for binder functions that allow common code to be written which then
|
Prototypes for binder functions that allow common code to be written which then
|
||||||
links to implementation of these functions which is appropriate for the specific
|
links to implementation of these functions which is appropriate for the specific
|
||||||
environment that they are running under.
|
environment that they are running under.
|
||||||
|
|
||||||
Copyright (c) 1999 - 2014, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 1999 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
|
@@ -2,13 +2,13 @@
|
|||||||
Common basic Library Functions
|
Common basic Library Functions
|
||||||
|
|
||||||
Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
http://opensource.org/licenses/bsd-license.php
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
@@ -136,7 +136,7 @@ Arguments:
|
|||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
= 0 if Guid1 == Guid2
|
= 0 if Guid1 == Guid2
|
||||||
!= 0 if Guid1 != Guid2
|
!= 0 if Guid1 != Guid2
|
||||||
|
|
||||||
--*/
|
--*/
|
||||||
{
|
{
|
||||||
@@ -169,7 +169,7 @@ GetFileImage (
|
|||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
|
|
||||||
This function opens a file and reads it into a memory buffer. The function
|
This function opens a file and reads it into a memory buffer. The function
|
||||||
will allocate the memory buffer and returns the size of the buffer.
|
will allocate the memory buffer and returns the size of the buffer.
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
@@ -332,7 +332,7 @@ CalculateChecksum8 (
|
|||||||
IN UINTN Size
|
IN UINTN Size
|
||||||
)
|
)
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
|
|
||||||
This function calculates the value needed for a valid UINT8 checksum
|
This function calculates the value needed for a valid UINT8 checksum
|
||||||
@@ -357,7 +357,7 @@ CalculateSum8 (
|
|||||||
IN UINTN Size
|
IN UINTN Size
|
||||||
)
|
)
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Routine Description::
|
Routine Description::
|
||||||
|
|
||||||
This function calculates the UINT8 sum for the requested region.
|
This function calculates the UINT8 sum for the requested region.
|
||||||
@@ -394,7 +394,7 @@ CalculateChecksum16 (
|
|||||||
IN UINTN Size
|
IN UINTN Size
|
||||||
)
|
)
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Routine Description::
|
Routine Description::
|
||||||
|
|
||||||
This function calculates the value needed for a valid UINT16 checksum
|
This function calculates the value needed for a valid UINT16 checksum
|
||||||
@@ -419,7 +419,7 @@ CalculateSum16 (
|
|||||||
IN UINTN Size
|
IN UINTN Size
|
||||||
)
|
)
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
|
|
||||||
This function calculates the UINT16 sum for the requested region.
|
This function calculates the UINT16 sum for the requested region.
|
||||||
@@ -518,7 +518,7 @@ Returns:
|
|||||||
EFI_SUCCESS The GUID was printed.
|
EFI_SUCCESS The GUID was printed.
|
||||||
EFI_INVALID_PARAMETER The input was NULL.
|
EFI_INVALID_PARAMETER The input was NULL.
|
||||||
EFI_BUFFER_TOO_SMALL The input buffer was not big enough
|
EFI_BUFFER_TOO_SMALL The input buffer was not big enough
|
||||||
|
|
||||||
--*/
|
--*/
|
||||||
{
|
{
|
||||||
if (Guid == NULL) {
|
if (Guid == NULL) {
|
||||||
@@ -593,7 +593,7 @@ char *strlwr(char *s)
|
|||||||
#define WINDOWS_UNC_EXTENSION_PATH "\\\\?\\UNC"
|
#define WINDOWS_UNC_EXTENSION_PATH "\\\\?\\UNC"
|
||||||
|
|
||||||
//
|
//
|
||||||
// Global data to store full file path. It is not required to be free.
|
// Global data to store full file path. It is not required to be free.
|
||||||
//
|
//
|
||||||
CHAR8 mCommonLibFullPath[MAX_LONG_FILE_PATH];
|
CHAR8 mCommonLibFullPath[MAX_LONG_FILE_PATH];
|
||||||
|
|
||||||
@@ -604,32 +604,32 @@ LongFilePath (
|
|||||||
/*++
|
/*++
|
||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
Convert FileName to the long file path, which can support larger than 260 length.
|
Convert FileName to the long file path, which can support larger than 260 length.
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
FileName - FileName.
|
FileName - FileName.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
LongFilePath A pointer to the converted long file path.
|
LongFilePath A pointer to the converted long file path.
|
||||||
|
|
||||||
--*/
|
--*/
|
||||||
{
|
{
|
||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
//
|
//
|
||||||
// __GNUC__ may not be good way to differentiate unix and windows. Need more investigation here.
|
// __GNUC__ may not be good way to differentiate unix and windows. Need more investigation here.
|
||||||
// unix has no limitation on file path. Just return FileName.
|
// unix has no limitation on file path. Just return FileName.
|
||||||
//
|
//
|
||||||
return FileName;
|
return FileName;
|
||||||
#else
|
#else
|
||||||
CHAR8 *RootPath;
|
CHAR8 *RootPath;
|
||||||
CHAR8 *PathPointer;
|
CHAR8 *PathPointer;
|
||||||
CHAR8 *NextPointer;
|
CHAR8 *NextPointer;
|
||||||
|
|
||||||
PathPointer = (CHAR8 *) FileName;
|
PathPointer = (CHAR8 *) FileName;
|
||||||
|
|
||||||
if (FileName != NULL) {
|
if (FileName != NULL) {
|
||||||
//
|
//
|
||||||
// Add the extension string first to support long file path.
|
// Add the extension string first to support long file path.
|
||||||
//
|
//
|
||||||
mCommonLibFullPath[0] = 0;
|
mCommonLibFullPath[0] = 0;
|
||||||
strcpy (mCommonLibFullPath, WINDOWS_EXTENSION_PATH);
|
strcpy (mCommonLibFullPath, WINDOWS_EXTENSION_PATH);
|
||||||
@@ -642,7 +642,7 @@ Returns:
|
|||||||
FileName ++;
|
FileName ++;
|
||||||
} else if (strlen (FileName) < 3 || FileName[1] != ':' || (FileName[2] != '\\' && FileName[2] != '/')) {
|
} else if (strlen (FileName) < 3 || FileName[1] != ':' || (FileName[2] != '\\' && FileName[2] != '/')) {
|
||||||
//
|
//
|
||||||
// Relative file path. Convert it to absolute path.
|
// Relative file path. Convert it to absolute path.
|
||||||
//
|
//
|
||||||
RootPath = getcwd (NULL, 0);
|
RootPath = getcwd (NULL, 0);
|
||||||
if (RootPath != NULL) {
|
if (RootPath != NULL) {
|
||||||
@@ -675,7 +675,7 @@ Returns:
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
strncat (mCommonLibFullPath, FileName, MAX_LONG_FILE_PATH - strlen (mCommonLibFullPath) - 1);
|
strncat (mCommonLibFullPath, FileName, MAX_LONG_FILE_PATH - strlen (mCommonLibFullPath) - 1);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Convert directory separator '/' to '\\'
|
// Convert directory separator '/' to '\\'
|
||||||
//
|
//
|
||||||
@@ -685,7 +685,7 @@ Returns:
|
|||||||
*PathPointer = '\\';
|
*PathPointer = '\\';
|
||||||
}
|
}
|
||||||
} while (*PathPointer ++ != '\0');
|
} while (*PathPointer ++ != '\0');
|
||||||
|
|
||||||
//
|
//
|
||||||
// Convert ":\\\\" to ":\\", because it doesn't work with WINDOWS_EXTENSION_PATH.
|
// Convert ":\\\\" to ":\\", because it doesn't work with WINDOWS_EXTENSION_PATH.
|
||||||
//
|
//
|
||||||
@@ -693,7 +693,7 @@ Returns:
|
|||||||
*(PathPointer + 2) = '\0';
|
*(PathPointer + 2) = '\0';
|
||||||
strncat (mCommonLibFullPath, PathPointer + 3, MAX_LONG_FILE_PATH - strlen (mCommonLibFullPath) - 1);
|
strncat (mCommonLibFullPath, PathPointer + 3, MAX_LONG_FILE_PATH - strlen (mCommonLibFullPath) - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Convert ".\\" to "", because it doesn't work with WINDOWS_EXTENSION_PATH.
|
// Convert ".\\" to "", because it doesn't work with WINDOWS_EXTENSION_PATH.
|
||||||
//
|
//
|
||||||
@@ -701,7 +701,7 @@ Returns:
|
|||||||
*PathPointer = '\0';
|
*PathPointer = '\0';
|
||||||
strncat (mCommonLibFullPath, PathPointer + 2, MAX_LONG_FILE_PATH - strlen (mCommonLibFullPath) - 1);
|
strncat (mCommonLibFullPath, PathPointer + 2, MAX_LONG_FILE_PATH - strlen (mCommonLibFullPath) - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Convert "\\.\\" to "\\", because it doesn't work with WINDOWS_EXTENSION_PATH.
|
// Convert "\\.\\" to "\\", because it doesn't work with WINDOWS_EXTENSION_PATH.
|
||||||
//
|
//
|
||||||
@@ -732,10 +732,10 @@ Returns:
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PathPointer = mCommonLibFullPath;
|
PathPointer = mCommonLibFullPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
return PathPointer;
|
return PathPointer;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@@ -451,14 +451,14 @@ SplitStr (
|
|||||||
/*++
|
/*++
|
||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
Convert FileName to the long file path, which can support larger than 260 length.
|
Convert FileName to the long file path, which can support larger than 260 length.
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
FileName - FileName.
|
FileName - FileName.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
LongFilePath A pointer to the converted long file path.
|
LongFilePath A pointer to the converted long file path.
|
||||||
|
|
||||||
--*/
|
--*/
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@@ -1,16 +1,16 @@
|
|||||||
/** @file
|
/** @file
|
||||||
Header file for compression routine.
|
Header file for compression routine.
|
||||||
Providing both EFI and Tiano Compress algorithms.
|
Providing both EFI and Tiano Compress algorithms.
|
||||||
|
|
||||||
Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
http://opensource.org/licenses/bsd-license.php
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
#ifndef _COMPRESS_H_
|
#ifndef _COMPRESS_H_
|
||||||
|
@@ -1,14 +1,14 @@
|
|||||||
/** @file
|
/** @file
|
||||||
CalcuateCrc32 routine.
|
CalcuateCrc32 routine.
|
||||||
|
|
||||||
Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
http://opensource.org/licenses/bsd-license.php
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
|
@@ -1,14 +1,14 @@
|
|||||||
/** @file
|
/** @file
|
||||||
Header file for CalcuateCrc32 routine
|
Header file for CalcuateCrc32 routine
|
||||||
|
|
||||||
Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
http://opensource.org/licenses/bsd-license.php
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
/** @file
|
/** @file
|
||||||
Decompressor. Algorithm Ported from OPSD code (Decomp.asm) for Efi and Tiano
|
Decompressor. Algorithm Ported from OPSD code (Decomp.asm) for Efi and Tiano
|
||||||
compress algorithm.
|
compress algorithm.
|
||||||
|
|
||||||
Copyright (c) 2004 - 2017, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
|
@@ -1,14 +1,14 @@
|
|||||||
/** @file
|
/** @file
|
||||||
Header file for compression routine
|
Header file for compression routine
|
||||||
|
|
||||||
Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
http://opensource.org/licenses/bsd-license.php
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -1,14 +1,14 @@
|
|||||||
/** @file
|
/** @file
|
||||||
Defines and prototypes for common EFI utility error and debug messages.
|
Defines and prototypes for common EFI utility error and debug messages.
|
||||||
|
|
||||||
Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
http://opensource.org/licenses/bsd-license.php
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
@@ -32,7 +32,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||||||
#define STATUS_SUCCESS 0
|
#define STATUS_SUCCESS 0
|
||||||
#define STATUS_WARNING 1
|
#define STATUS_WARNING 1
|
||||||
#define STATUS_ERROR 2
|
#define STATUS_ERROR 2
|
||||||
#define VOID void
|
#define VOID void
|
||||||
|
|
||||||
typedef int STATUS;
|
typedef int STATUS;
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
/** @file
|
/** @file
|
||||||
EFI Firmware Volume routines which work on a Fv image in buffers.
|
EFI Firmware Volume routines which work on a Fv image in buffers.
|
||||||
|
|
||||||
Copyright (c) 1999 - 2016, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 1999 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
@@ -1654,7 +1654,7 @@ FvBufCalculateSum16 (
|
|||||||
IN UINTN Size
|
IN UINTN Size
|
||||||
)
|
)
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
|
|
||||||
This function calculates the UINT16 sum for the requested region.
|
This function calculates the UINT16 sum for the requested region.
|
||||||
@@ -1693,7 +1693,7 @@ FvBufCalculateChecksum16 (
|
|||||||
IN UINTN Size
|
IN UINTN Size
|
||||||
)
|
)
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Routine Description::
|
Routine Description::
|
||||||
|
|
||||||
This function calculates the value needed for a valid UINT16 checksum
|
This function calculates the value needed for a valid UINT16 checksum
|
||||||
|
@@ -1,14 +1,14 @@
|
|||||||
/** @file
|
/** @file
|
||||||
These functions assist in parsing and manipulating a Firmware Volume.
|
These functions assist in parsing and manipulating a Firmware Volume.
|
||||||
|
|
||||||
Copyright (c) 2004 - 2015, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
http://opensource.org/licenses/bsd-license.php
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
@@ -44,9 +44,9 @@ Arguments:
|
|||||||
|
|
||||||
Fv Buffer containing the FV.
|
Fv Buffer containing the FV.
|
||||||
FvLength Length of the FV
|
FvLength Length of the FV
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
|
|
||||||
EFI_SUCCESS Function Completed successfully.
|
EFI_SUCCESS Function Completed successfully.
|
||||||
EFI_INVALID_PARAMETER A required parameter was NULL.
|
EFI_INVALID_PARAMETER A required parameter was NULL.
|
||||||
|
|
||||||
@@ -80,9 +80,9 @@ Arguments:
|
|||||||
|
|
||||||
FvHeader Pointer to the FV buffer.
|
FvHeader Pointer to the FV buffer.
|
||||||
FvLength Length of the FV
|
FvLength Length of the FV
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
|
|
||||||
EFI_SUCCESS Function Completed successfully.
|
EFI_SUCCESS Function Completed successfully.
|
||||||
EFI_INVALID_PARAMETER A required parameter was NULL.
|
EFI_INVALID_PARAMETER A required parameter was NULL.
|
||||||
EFI_ABORTED The library needs to be initialized.
|
EFI_ABORTED The library needs to be initialized.
|
||||||
@@ -117,16 +117,16 @@ GetNextFile (
|
|||||||
Routine Description:
|
Routine Description:
|
||||||
|
|
||||||
This function returns the next file. If the current file is NULL, it returns
|
This function returns the next file. If the current file is NULL, it returns
|
||||||
the first file in the FV. If the function returns EFI_SUCCESS and the file
|
the first file in the FV. If the function returns EFI_SUCCESS and the file
|
||||||
pointer is NULL, then there are no more files in the FV.
|
pointer is NULL, then there are no more files in the FV.
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
|
|
||||||
CurrentFile Pointer to the current file, must be within the current FV.
|
CurrentFile Pointer to the current file, must be within the current FV.
|
||||||
NextFile Pointer to the next file in the FV.
|
NextFile Pointer to the next file in the FV.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
|
|
||||||
EFI_SUCCESS Function completed successfully.
|
EFI_SUCCESS Function completed successfully.
|
||||||
EFI_INVALID_PARAMETER A required parameter was NULL or is out of range.
|
EFI_INVALID_PARAMETER A required parameter was NULL or is out of range.
|
||||||
EFI_ABORTED The library needs to be initialized.
|
EFI_ABORTED The library needs to be initialized.
|
||||||
@@ -496,7 +496,7 @@ GetSectionByType (
|
|||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
|
|
||||||
Find a section in a file by type and instance. An instance of 1 is the first
|
Find a section in a file by type and instance. An instance of 1 is the first
|
||||||
instance. The function will return NULL if a matching section cannot be found.
|
instance. The function will return NULL if a matching section cannot be found.
|
||||||
GUID-defined sections, if special processing is not needed, are handled in a
|
GUID-defined sections, if special processing is not needed, are handled in a
|
||||||
depth-first manner.
|
depth-first manner.
|
||||||
@@ -543,7 +543,7 @@ Returns:
|
|||||||
// Get the first section
|
// Get the first section
|
||||||
//
|
//
|
||||||
CurrentSection.CommonHeader = (EFI_COMMON_SECTION_HEADER *) ((UINTN) File + GetFfsHeaderLength(File));
|
CurrentSection.CommonHeader = (EFI_COMMON_SECTION_HEADER *) ((UINTN) File + GetFfsHeaderLength(File));
|
||||||
|
|
||||||
//
|
//
|
||||||
// Depth-first manner to find section file.
|
// Depth-first manner to find section file.
|
||||||
//
|
//
|
||||||
@@ -858,7 +858,7 @@ Returns:
|
|||||||
EFI_SUCCESS The function completed successfully.
|
EFI_SUCCESS The function completed successfully.
|
||||||
EFI_INVALID_PARAMETER One of the input parameters was invalid.
|
EFI_INVALID_PARAMETER One of the input parameters was invalid.
|
||||||
EFI_ABORTED Operation aborted.
|
EFI_ABORTED Operation aborted.
|
||||||
|
|
||||||
--*/
|
--*/
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
@@ -905,7 +905,7 @@ Routine Description:
|
|||||||
It in no way validate the FFS file.
|
It in no way validate the FFS file.
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
|
|
||||||
ErasePolarity The erase polarity for the file state bits.
|
ErasePolarity The erase polarity for the file state bits.
|
||||||
FfsHeader Pointer to a FFS file.
|
FfsHeader Pointer to a FFS file.
|
||||||
|
|
||||||
|
@@ -1,14 +1,14 @@
|
|||||||
/** @file
|
/** @file
|
||||||
These functions assist in parsing and manipulating a Firmware Volume.
|
These functions assist in parsing and manipulating a Firmware Volume.
|
||||||
|
|
||||||
Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
http://opensource.org/licenses/bsd-license.php
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
@@ -183,7 +183,7 @@ Routine Description:
|
|||||||
It in no way validate the FFS file.
|
It in no way validate the FFS file.
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
|
|
||||||
ErasePolarity The erase polarity for the file state bits.
|
ErasePolarity The erase polarity for the file state bits.
|
||||||
FfsHeader Pointer to a FFS file.
|
FfsHeader Pointer to a FFS file.
|
||||||
|
|
||||||
|
@@ -1,14 +1,14 @@
|
|||||||
/** @file
|
/** @file
|
||||||
This contains some useful functions for accessing files.
|
This contains some useful functions for accessing files.
|
||||||
|
|
||||||
Copyright (c) 2004 - 2016, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
http://opensource.org/licenses/bsd-license.php
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
|
@@ -1,14 +1,14 @@
|
|||||||
/** @file
|
/** @file
|
||||||
Header file for helper functions useful for accessing files.
|
Header file for helper functions useful for accessing files.
|
||||||
|
|
||||||
Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
http://opensource.org/licenses/bsd-license.php
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
|
@@ -1,14 +1,14 @@
|
|||||||
/** @file
|
/** @file
|
||||||
File for memory allocation tracking functions.
|
File for memory allocation tracking functions.
|
||||||
|
|
||||||
Copyright (c) 2004 - 2016, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
http://opensource.org/licenses/bsd-license.php
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
|
@@ -1,14 +1,14 @@
|
|||||||
/** @file
|
/** @file
|
||||||
Header file for memory allocation tracking functions.
|
Header file for memory allocation tracking functions.
|
||||||
|
|
||||||
Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
http://opensource.org/licenses/bsd-license.php
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
|
@@ -1,14 +1,14 @@
|
|||||||
/** @file
|
/** @file
|
||||||
Functions useful to operate file directories by parsing file path.
|
Functions useful to operate file directories by parsing file path.
|
||||||
|
|
||||||
Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
http://opensource.org/licenses/bsd-license.php
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
@@ -87,7 +87,7 @@ Returns:
|
|||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
for (Offset = Length; Offset > 0; Offset--) {
|
for (Offset = Length; Offset > 0; Offset--) {
|
||||||
if ((Return[Offset] == '/') || (Return[Offset] == '\\')) {
|
if ((Return[Offset] == '/') || (Return[Offset] == '\\')) {
|
||||||
@@ -195,7 +195,7 @@ Returns:
|
|||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
for (Offset = Length; Offset > 0; Offset--) {
|
for (Offset = Length; Offset > 0; Offset--) {
|
||||||
if ((Return[Offset] == '/') || (Return[Offset] == '\\')) {
|
if ((Return[Offset] == '/') || (Return[Offset] == '\\')) {
|
||||||
|
@@ -1,15 +1,15 @@
|
|||||||
/** @file
|
/** @file
|
||||||
Header file for helper functions useful to operate file directories by parsing
|
Header file for helper functions useful to operate file directories by parsing
|
||||||
file path.
|
file path.
|
||||||
|
|
||||||
Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
http://opensource.org/licenses/bsd-license.php
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
|
@@ -1,14 +1,14 @@
|
|||||||
/** @file
|
/** @file
|
||||||
Helper functions for parsing GuidedSectionTools.txt
|
Helper functions for parsing GuidedSectionTools.txt
|
||||||
|
|
||||||
Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
http://opensource.org/licenses/bsd-license.php
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
@@ -76,7 +76,7 @@ Returns:
|
|||||||
ParsedGuidedSectionTools = ParseGuidedSectionToolsMemoryFile (MemoryFile);
|
ParsedGuidedSectionTools = ParseGuidedSectionToolsMemoryFile (MemoryFile);
|
||||||
|
|
||||||
FreeMemoryFile (MemoryFile);
|
FreeMemoryFile (MemoryFile);
|
||||||
|
|
||||||
return ParsedGuidedSectionTools;
|
return ParsedGuidedSectionTools;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -122,7 +122,7 @@ Returns:
|
|||||||
if (NextLine == NULL) {
|
if (NextLine == NULL) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = StripInfDscStringInPlace (NextLine);
|
Status = StripInfDscStringInPlace (NextLine);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
free (NextLine);
|
free (NextLine);
|
||||||
|
@@ -1,14 +1,14 @@
|
|||||||
/** @file
|
/** @file
|
||||||
Header file for helper functions for parsing GuidedSectionTools.txt
|
Header file for helper functions for parsing GuidedSectionTools.txt
|
||||||
|
|
||||||
Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
http://opensource.org/licenses/bsd-license.php
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
|
@@ -1,14 +1,14 @@
|
|||||||
/** @file
|
/** @file
|
||||||
This contains some useful functions for parsing INF files.
|
This contains some useful functions for parsing INF files.
|
||||||
|
|
||||||
Copyright (c) 2004 - 2016, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
http://opensource.org/licenses/bsd-license.php
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
@@ -31,11 +31,11 @@ ReadLine (
|
|||||||
Routine Description:
|
Routine Description:
|
||||||
|
|
||||||
This function reads a line, stripping any comments.
|
This function reads a line, stripping any comments.
|
||||||
The function reads a string from the input stream argument and stores it in
|
The function reads a string from the input stream argument and stores it in
|
||||||
the input string. ReadLine reads characters from the current file position
|
the input string. ReadLine reads characters from the current file position
|
||||||
to and including the first newline character, to the end of the stream, or
|
to and including the first newline character, to the end of the stream, or
|
||||||
until the number of characters read is equal to MaxLength - 1, whichever
|
until the number of characters read is equal to MaxLength - 1, whichever
|
||||||
comes first. The newline character, if read, is replaced with a \0.
|
comes first. The newline character, if read, is replaced with a \0.
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
|
|
||||||
@@ -372,17 +372,17 @@ StringToGuid (
|
|||||||
)
|
)
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
|
|
||||||
Converts a string to an EFI_GUID. The string must be in the
|
Converts a string to an EFI_GUID. The string must be in the
|
||||||
xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx format.
|
xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx format.
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
|
|
||||||
AsciiGuidBuffer - pointer to ascii string
|
AsciiGuidBuffer - pointer to ascii string
|
||||||
GuidBuffer - pointer to destination Guid
|
GuidBuffer - pointer to destination Guid
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
|
|
||||||
EFI_ABORTED Could not convert the string
|
EFI_ABORTED Could not convert the string
|
||||||
EFI_SUCCESS The string was successfully converted
|
EFI_SUCCESS The string was successfully converted
|
||||||
@@ -408,7 +408,7 @@ Returns:
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (((AsciiGuidBuffer[Index] >= '0') && (AsciiGuidBuffer[Index] <= '9')) ||
|
if (((AsciiGuidBuffer[Index] >= '0') && (AsciiGuidBuffer[Index] <= '9')) ||
|
||||||
((AsciiGuidBuffer[Index] >= 'a') && (AsciiGuidBuffer[Index] <= 'f')) ||
|
((AsciiGuidBuffer[Index] >= 'a') && (AsciiGuidBuffer[Index] <= 'f')) ||
|
||||||
((AsciiGuidBuffer[Index] >= 'A') && (AsciiGuidBuffer[Index] <= 'F'))) {
|
((AsciiGuidBuffer[Index] >= 'A') && (AsciiGuidBuffer[Index] <= 'F'))) {
|
||||||
continue;
|
continue;
|
||||||
@@ -417,12 +417,12 @@ Returns:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Index < 36 || AsciiGuidBuffer[36] != '\0') {
|
if (Index < 36 || AsciiGuidBuffer[36] != '\0') {
|
||||||
Error (NULL, 0, 1003, "Invalid option value", "Incorrect GUID \"%s\"\n Correct Format \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\"", AsciiGuidBuffer);
|
Error (NULL, 0, 1003, "Invalid option value", "Incorrect GUID \"%s\"\n Correct Format \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\"", AsciiGuidBuffer);
|
||||||
return EFI_ABORTED;
|
return EFI_ABORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Scan the guid string into the buffer
|
// Scan the guid string into the buffer
|
||||||
//
|
//
|
||||||
@@ -477,9 +477,9 @@ AsciiStringToUint64 (
|
|||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
|
|
||||||
Converts a null terminated ascii string that represents a number into a
|
Converts a null terminated ascii string that represents a number into a
|
||||||
UINT64 value. A hex number may be preceeded by a 0x, but may not be
|
UINT64 value. A hex number may be preceeded by a 0x, but may not be
|
||||||
succeeded by an h. A number without 0x or 0X is considered to be base 10
|
succeeded by an h. A number without 0x or 0X is considered to be base 10
|
||||||
unless the IsHex input is true.
|
unless the IsHex input is true.
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
@@ -498,13 +498,13 @@ Returns:
|
|||||||
UINT8 Index;
|
UINT8 Index;
|
||||||
UINT64 Value;
|
UINT64 Value;
|
||||||
CHAR8 CurrentChar;
|
CHAR8 CurrentChar;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Initialize the result
|
// Initialize the result
|
||||||
//
|
//
|
||||||
Value = 0;
|
Value = 0;
|
||||||
Index = 0;
|
Index = 0;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Check input parameter
|
// Check input parameter
|
||||||
//
|
//
|
||||||
@@ -514,11 +514,11 @@ Returns:
|
|||||||
while (AsciiString[Index] == ' ') {
|
while (AsciiString[Index] == ' ') {
|
||||||
Index ++;
|
Index ++;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Add each character to the result
|
// Add each character to the result
|
||||||
//
|
//
|
||||||
|
|
||||||
//
|
//
|
||||||
// Skip first two chars only if the string starts with '0x' or '0X'
|
// Skip first two chars only if the string starts with '0x' or '0X'
|
||||||
//
|
//
|
||||||
|
@@ -1,14 +1,14 @@
|
|||||||
/** @file
|
/** @file
|
||||||
Header file for helper functions useful for parsing INF files.
|
Header file for helper functions useful for parsing INF files.
|
||||||
|
|
||||||
Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
http://opensource.org/licenses/bsd-license.php
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
@@ -39,11 +39,11 @@ ReadLine (
|
|||||||
Routine Description:
|
Routine Description:
|
||||||
|
|
||||||
This function reads a line, stripping any comments.
|
This function reads a line, stripping any comments.
|
||||||
The function reads a string from the input stream argument and stores it in
|
The function reads a string from the input stream argument and stores it in
|
||||||
the input string. ReadLine reads characters from the current file position
|
the input string. ReadLine reads characters from the current file position
|
||||||
to and including the first newline character, to the end of the stream, or
|
to and including the first newline character, to the end of the stream, or
|
||||||
until the number of characters read is equal to MaxLength - 1, whichever
|
until the number of characters read is equal to MaxLength - 1, whichever
|
||||||
comes first. The newline character, if read, is replaced with a \0.
|
comes first. The newline character, if read, is replaced with a \0.
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
|
|
||||||
@@ -124,17 +124,17 @@ StringToGuid (
|
|||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
|
|
||||||
Converts a string to an EFI_GUID. The string must be in the
|
Converts a string to an EFI_GUID. The string must be in the
|
||||||
xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx format.
|
xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx format.
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
|
|
||||||
GuidBuffer - pointer to destination Guid
|
GuidBuffer - pointer to destination Guid
|
||||||
AsciiGuidBuffer - pointer to ascii string
|
AsciiGuidBuffer - pointer to ascii string
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
|
|
||||||
EFI_ABORTED Could not convert the string
|
EFI_ABORTED Could not convert the string
|
||||||
EFI_SUCCESS The string was successfully converted
|
EFI_SUCCESS The string was successfully converted
|
||||||
@@ -152,9 +152,9 @@ AsciiStringToUint64 (
|
|||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
|
|
||||||
Converts a null terminated ascii string that represents a number into a
|
Converts a null terminated ascii string that represents a number into a
|
||||||
UINT64 value. A hex number may be preceeded by a 0x, but may not be
|
UINT64 value. A hex number may be preceeded by a 0x, but may not be
|
||||||
succeeded by an h. A number without 0x or 0X is considered to be base 10
|
succeeded by an h. A number without 0x or 0X is considered to be base 10
|
||||||
unless the IsHex input is true.
|
unless the IsHex input is true.
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
|
@@ -1,14 +1,14 @@
|
|||||||
/** @file
|
/** @file
|
||||||
Function prototypes and defines on Memory Only PE COFF loader
|
Function prototypes and defines on Memory Only PE COFF loader
|
||||||
|
|
||||||
Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
http://opensource.org/licenses/bsd-license.php
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
@@ -20,7 +20,7 @@
|
|||||||
// BUGBUG: Find where used and see if can be replaced by RETURN_STATUS codes
|
// BUGBUG: Find where used and see if can be replaced by RETURN_STATUS codes
|
||||||
//
|
//
|
||||||
#define IMAGE_ERROR_SUCCESS 0
|
#define IMAGE_ERROR_SUCCESS 0
|
||||||
#define IMAGE_ERROR_IMAGE_READ 1
|
#define IMAGE_ERROR_IMAGE_READ 1
|
||||||
#define IMAGE_ERROR_INVALID_PE_HEADER_SIGNATURE 2
|
#define IMAGE_ERROR_INVALID_PE_HEADER_SIGNATURE 2
|
||||||
#define IMAGE_ERROR_INVALID_MACHINE_TYPE 3
|
#define IMAGE_ERROR_INVALID_MACHINE_TYPE 3
|
||||||
#define IMAGE_ERROR_INVALID_SUBSYSTEM 4
|
#define IMAGE_ERROR_INVALID_SUBSYSTEM 4
|
||||||
@@ -73,15 +73,15 @@ typedef struct {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Retrieves information on a PE/COFF image
|
Retrieves information on a PE/COFF image
|
||||||
|
|
||||||
@param ImageContext The context of the image being loaded
|
@param ImageContext The context of the image being loaded
|
||||||
|
|
||||||
@retval EFI_SUCCESS The information on the PE/COFF image was collected.
|
@retval EFI_SUCCESS The information on the PE/COFF image was collected.
|
||||||
@retval EFI_INVALID_PARAMETER ImageContext is NULL.
|
@retval EFI_INVALID_PARAMETER ImageContext is NULL.
|
||||||
@retval EFI_UNSUPPORTED The PE/COFF image is not supported.
|
@retval EFI_UNSUPPORTED The PE/COFF image is not supported.
|
||||||
@retval Otherwise The error status from reading the PE/COFF image using the
|
@retval Otherwise The error status from reading the PE/COFF image using the
|
||||||
ImageContext->ImageRead() function
|
ImageContext->ImageRead() function
|
||||||
|
|
||||||
**/
|
**/
|
||||||
RETURN_STATUS
|
RETURN_STATUS
|
||||||
@@ -92,13 +92,13 @@ PeCoffLoaderGetImageInfo (
|
|||||||
;
|
;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Relocates a PE/COFF image in memory
|
Relocates a PE/COFF image in memory
|
||||||
|
|
||||||
@param ImageContext Contains information on the loaded image to relocate
|
@param ImageContext Contains information on the loaded image to relocate
|
||||||
|
|
||||||
@retval EFI_SUCCESS if the PE/COFF image was relocated
|
@retval EFI_SUCCESS if the PE/COFF image was relocated
|
||||||
@retval EFI_LOAD_ERROR if the image is not a valid PE/COFF image
|
@retval EFI_LOAD_ERROR if the image is not a valid PE/COFF image
|
||||||
@retval EFI_UNSUPPORTED not support
|
@retval EFI_UNSUPPORTED not support
|
||||||
|
|
||||||
**/
|
**/
|
||||||
RETURN_STATUS
|
RETURN_STATUS
|
||||||
@@ -109,14 +109,14 @@ PeCoffLoaderRelocateImage (
|
|||||||
;
|
;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Loads a PE/COFF image into memory
|
Loads a PE/COFF image into memory
|
||||||
|
|
||||||
@param ImageContext Contains information on image to load into memory
|
@param ImageContext Contains information on image to load into memory
|
||||||
|
|
||||||
@retval EFI_SUCCESS if the PE/COFF image was loaded
|
@retval EFI_SUCCESS if the PE/COFF image was loaded
|
||||||
@retval EFI_BUFFER_TOO_SMALL if the caller did not provide a large enough buffer
|
@retval EFI_BUFFER_TOO_SMALL if the caller did not provide a large enough buffer
|
||||||
@retval EFI_LOAD_ERROR if the image is a runtime driver with no relocations
|
@retval EFI_LOAD_ERROR if the image is a runtime driver with no relocations
|
||||||
@retval EFI_INVALID_PARAMETER if the image address is invalid
|
@retval EFI_INVALID_PARAMETER if the image address is invalid
|
||||||
|
|
||||||
**/
|
**/
|
||||||
RETURN_STATUS
|
RETURN_STATUS
|
||||||
@@ -148,7 +148,7 @@ PeCoffLoaderGetEntryPoint (
|
|||||||
//
|
//
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Pass in a pointer to an ARM MOVT or MOVW immediate instruciton and
|
Pass in a pointer to an ARM MOVT or MOVW immediate instruciton and
|
||||||
return the immediate data encoded in the instruction
|
return the immediate data encoded in the instruction
|
||||||
|
|
||||||
@param Instruction Pointer to ARM MOVT or MOVW immediate instruction
|
@param Instruction Pointer to ARM MOVT or MOVW immediate instruction
|
||||||
@@ -178,7 +178,7 @@ ThumbMovtImmediatePatch (
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Pass in a pointer to an ARM MOVW/MOVT instruciton pair and
|
Pass in a pointer to an ARM MOVW/MOVT instruciton pair and
|
||||||
return the immediate data encoded in the two` instruction
|
return the immediate data encoded in the two` instruction
|
||||||
|
|
||||||
@param Instructions Pointer to ARM MOVW/MOVT insturction pair
|
@param Instructions Pointer to ARM MOVW/MOVT insturction pair
|
||||||
|
@@ -1,15 +1,15 @@
|
|||||||
/** @file
|
/** @file
|
||||||
IA32, X64 and IPF Specific relocation fixups
|
IA32, X64 and IPF Specific relocation fixups
|
||||||
|
|
||||||
Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
Portions Copyright (c) 2011 - 2013, ARM Ltd. All rights reserved.<BR>
|
Portions Copyright (c) 2011 - 2013, ARM Ltd. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
http://opensource.org/licenses/bsd-license.php
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
--*/
|
--*/
|
||||||
|
|
||||||
@@ -27,45 +27,45 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||||||
*(UINT32*)Address = (*(UINT32*)Address & ~(((1 << Size) - 1) << InstPos)) | \
|
*(UINT32*)Address = (*(UINT32*)Address & ~(((1 << Size) - 1) << InstPos)) | \
|
||||||
((UINT32)((((UINT64)Value >> ValPos) & (((UINT64)1 << Size) - 1))) << InstPos)
|
((UINT32)((((UINT64)Value >> ValPos) & (((UINT64)1 << Size) - 1))) << InstPos)
|
||||||
|
|
||||||
#define IMM64_IMM7B_INST_WORD_X 3
|
#define IMM64_IMM7B_INST_WORD_X 3
|
||||||
#define IMM64_IMM7B_SIZE_X 7
|
#define IMM64_IMM7B_SIZE_X 7
|
||||||
#define IMM64_IMM7B_INST_WORD_POS_X 4
|
#define IMM64_IMM7B_INST_WORD_POS_X 4
|
||||||
#define IMM64_IMM7B_VAL_POS_X 0
|
#define IMM64_IMM7B_VAL_POS_X 0
|
||||||
|
|
||||||
#define IMM64_IMM9D_INST_WORD_X 3
|
#define IMM64_IMM9D_INST_WORD_X 3
|
||||||
#define IMM64_IMM9D_SIZE_X 9
|
#define IMM64_IMM9D_SIZE_X 9
|
||||||
#define IMM64_IMM9D_INST_WORD_POS_X 18
|
#define IMM64_IMM9D_INST_WORD_POS_X 18
|
||||||
#define IMM64_IMM9D_VAL_POS_X 7
|
#define IMM64_IMM9D_VAL_POS_X 7
|
||||||
|
|
||||||
#define IMM64_IMM5C_INST_WORD_X 3
|
#define IMM64_IMM5C_INST_WORD_X 3
|
||||||
#define IMM64_IMM5C_SIZE_X 5
|
#define IMM64_IMM5C_SIZE_X 5
|
||||||
#define IMM64_IMM5C_INST_WORD_POS_X 13
|
#define IMM64_IMM5C_INST_WORD_POS_X 13
|
||||||
#define IMM64_IMM5C_VAL_POS_X 16
|
#define IMM64_IMM5C_VAL_POS_X 16
|
||||||
|
|
||||||
#define IMM64_IC_INST_WORD_X 3
|
#define IMM64_IC_INST_WORD_X 3
|
||||||
#define IMM64_IC_SIZE_X 1
|
#define IMM64_IC_SIZE_X 1
|
||||||
#define IMM64_IC_INST_WORD_POS_X 12
|
#define IMM64_IC_INST_WORD_POS_X 12
|
||||||
#define IMM64_IC_VAL_POS_X 21
|
#define IMM64_IC_VAL_POS_X 21
|
||||||
|
|
||||||
#define IMM64_IMM41a_INST_WORD_X 1
|
#define IMM64_IMM41a_INST_WORD_X 1
|
||||||
#define IMM64_IMM41a_SIZE_X 10
|
#define IMM64_IMM41a_SIZE_X 10
|
||||||
#define IMM64_IMM41a_INST_WORD_POS_X 14
|
#define IMM64_IMM41a_INST_WORD_POS_X 14
|
||||||
#define IMM64_IMM41a_VAL_POS_X 22
|
#define IMM64_IMM41a_VAL_POS_X 22
|
||||||
|
|
||||||
#define IMM64_IMM41b_INST_WORD_X 1
|
#define IMM64_IMM41b_INST_WORD_X 1
|
||||||
#define IMM64_IMM41b_SIZE_X 8
|
#define IMM64_IMM41b_SIZE_X 8
|
||||||
#define IMM64_IMM41b_INST_WORD_POS_X 24
|
#define IMM64_IMM41b_INST_WORD_POS_X 24
|
||||||
#define IMM64_IMM41b_VAL_POS_X 32
|
#define IMM64_IMM41b_VAL_POS_X 32
|
||||||
|
|
||||||
#define IMM64_IMM41c_INST_WORD_X 2
|
#define IMM64_IMM41c_INST_WORD_X 2
|
||||||
#define IMM64_IMM41c_SIZE_X 23
|
#define IMM64_IMM41c_SIZE_X 23
|
||||||
#define IMM64_IMM41c_INST_WORD_POS_X 0
|
#define IMM64_IMM41c_INST_WORD_POS_X 0
|
||||||
#define IMM64_IMM41c_VAL_POS_X 40
|
#define IMM64_IMM41c_VAL_POS_X 40
|
||||||
|
|
||||||
#define IMM64_SIGN_INST_WORD_X 3
|
#define IMM64_SIGN_INST_WORD_X 3
|
||||||
#define IMM64_SIGN_SIZE_X 1
|
#define IMM64_SIGN_SIZE_X 1
|
||||||
#define IMM64_SIGN_INST_WORD_POS_X 27
|
#define IMM64_SIGN_INST_WORD_POS_X 27
|
||||||
#define IMM64_SIGN_VAL_POS_X 63
|
#define IMM64_SIGN_VAL_POS_X 63
|
||||||
|
|
||||||
RETURN_STATUS
|
RETURN_STATUS
|
||||||
PeCoffLoaderRelocateIa32Image (
|
PeCoffLoaderRelocateIa32Image (
|
||||||
@@ -102,7 +102,7 @@ Returns:
|
|||||||
RETURN_STATUS
|
RETURN_STATUS
|
||||||
PeCoffLoaderRelocateIpfImage (
|
PeCoffLoaderRelocateIpfImage (
|
||||||
IN UINT16 *Reloc,
|
IN UINT16 *Reloc,
|
||||||
IN OUT CHAR8 *Fixup,
|
IN OUT CHAR8 *Fixup,
|
||||||
IN OUT CHAR8 **FixupData,
|
IN OUT CHAR8 **FixupData,
|
||||||
IN UINT64 Adjust
|
IN UINT64 Adjust
|
||||||
)
|
)
|
||||||
@@ -142,8 +142,8 @@ Returns:
|
|||||||
|
|
||||||
Fixup = (CHAR8 *)((UINTN) Fixup & (UINTN) ~(15));
|
Fixup = (CHAR8 *)((UINTN) Fixup & (UINTN) ~(15));
|
||||||
FixupVal = (UINT64)0;
|
FixupVal = (UINT64)0;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Extract the lower 32 bits of IMM64 from bundle
|
// Extract the lower 32 bits of IMM64 from bundle
|
||||||
//
|
//
|
||||||
EXT_IMM64(FixupVal,
|
EXT_IMM64(FixupVal,
|
||||||
@@ -180,13 +180,13 @@ Returns:
|
|||||||
IMM64_IMM41a_INST_WORD_POS_X,
|
IMM64_IMM41a_INST_WORD_POS_X,
|
||||||
IMM64_IMM41a_VAL_POS_X
|
IMM64_IMM41a_VAL_POS_X
|
||||||
);
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Update 64-bit address
|
// Update 64-bit address
|
||||||
//
|
//
|
||||||
FixupVal += Adjust;
|
FixupVal += Adjust;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Insert IMM64 into bundle
|
// Insert IMM64 into bundle
|
||||||
//
|
//
|
||||||
INS_IMM64(FixupVal,
|
INS_IMM64(FixupVal,
|
||||||
@@ -261,7 +261,7 @@ Returns:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Pass in a pointer to an ARM MOVT or MOVW immediate instruciton and
|
Pass in a pointer to an ARM MOVT or MOVW immediate instruciton and
|
||||||
return the immediate data encoded in the instruction
|
return the immediate data encoded in the instruction
|
||||||
|
|
||||||
@param Instruction Pointer to ARM MOVT or MOVW immediate instruction
|
@param Instruction Pointer to ARM MOVT or MOVW immediate instruction
|
||||||
@@ -279,7 +279,7 @@ ThumbMovtImmediateAddress (
|
|||||||
|
|
||||||
// Thumb2 is two 16-bit instructions working together. Not a single 32-bit instruction
|
// Thumb2 is two 16-bit instructions working together. Not a single 32-bit instruction
|
||||||
// Example MOVT R0, #0 is 0x0000f2c0 or 0xf2c0 0x0000
|
// Example MOVT R0, #0 is 0x0000f2c0 or 0xf2c0 0x0000
|
||||||
Movt = (*Instruction << 16) | (*(Instruction + 1));
|
Movt = (*Instruction << 16) | (*(Instruction + 1));
|
||||||
|
|
||||||
// imm16 = imm4:i:imm3:imm8
|
// imm16 = imm4:i:imm3:imm8
|
||||||
// imm4 -> Bit19:Bit16
|
// imm4 -> Bit19:Bit16
|
||||||
@@ -308,7 +308,7 @@ ThumbMovtImmediatePatch (
|
|||||||
UINT16 Patch;
|
UINT16 Patch;
|
||||||
|
|
||||||
// First 16-bit chunk of instruciton
|
// First 16-bit chunk of instruciton
|
||||||
Patch = ((Address >> 12) & 0x000f); // imm4
|
Patch = ((Address >> 12) & 0x000f); // imm4
|
||||||
Patch |= (((Address & BIT11) != 0) ? BIT10 : 0); // i
|
Patch |= (((Address & BIT11) != 0) ? BIT10 : 0); // i
|
||||||
*Instruction = (*Instruction & ~0x040f) | Patch;
|
*Instruction = (*Instruction & ~0x040f) | Patch;
|
||||||
|
|
||||||
@@ -320,7 +320,7 @@ ThumbMovtImmediatePatch (
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Pass in a pointer to an ARM MOVW/MOVT instruciton pair and
|
Pass in a pointer to an ARM MOVW/MOVT instruciton pair and
|
||||||
return the immediate data encoded in the two` instruction
|
return the immediate data encoded in the two` instruction
|
||||||
|
|
||||||
@param Instructions Pointer to ARM MOVW/MOVT insturction pair
|
@param Instructions Pointer to ARM MOVW/MOVT insturction pair
|
||||||
@@ -336,10 +336,10 @@ ThumbMovwMovtImmediateAddress (
|
|||||||
{
|
{
|
||||||
UINT16 *Word;
|
UINT16 *Word;
|
||||||
UINT16 *Top;
|
UINT16 *Top;
|
||||||
|
|
||||||
Word = Instructions; // MOVW
|
Word = Instructions; // MOVW
|
||||||
Top = Word + 2; // MOVT
|
Top = Word + 2; // MOVT
|
||||||
|
|
||||||
return (ThumbMovtImmediateAddress (Top) << 16) + ThumbMovtImmediateAddress (Word);
|
return (ThumbMovtImmediateAddress (Top) << 16) + ThumbMovtImmediateAddress (Word);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -359,7 +359,7 @@ ThumbMovwMovtImmediatePatch (
|
|||||||
{
|
{
|
||||||
UINT16 *Word;
|
UINT16 *Word;
|
||||||
UINT16 *Top;
|
UINT16 *Top;
|
||||||
|
|
||||||
Word = (UINT16 *)Instructions; // MOVW
|
Word = (UINT16 *)Instructions; // MOVW
|
||||||
Top = Word + 2; // MOVT
|
Top = Word + 2; // MOVT
|
||||||
|
|
||||||
@@ -394,19 +394,19 @@ PeCoffLoaderRelocateArmImage (
|
|||||||
Fixup16 = (UINT16 *) Fixup;
|
Fixup16 = (UINT16 *) Fixup;
|
||||||
|
|
||||||
switch ((**Reloc) >> 12) {
|
switch ((**Reloc) >> 12) {
|
||||||
|
|
||||||
case EFI_IMAGE_REL_BASED_ARM_MOV32T:
|
case EFI_IMAGE_REL_BASED_ARM_MOV32T:
|
||||||
FixupVal = ThumbMovwMovtImmediateAddress (Fixup16) + (UINT32)Adjust;
|
FixupVal = ThumbMovwMovtImmediateAddress (Fixup16) + (UINT32)Adjust;
|
||||||
ThumbMovwMovtImmediatePatch (Fixup16, FixupVal);
|
ThumbMovwMovtImmediatePatch (Fixup16, FixupVal);
|
||||||
|
|
||||||
|
|
||||||
if (*FixupData != NULL) {
|
if (*FixupData != NULL) {
|
||||||
*FixupData = ALIGN_POINTER(*FixupData, sizeof(UINT64));
|
*FixupData = ALIGN_POINTER(*FixupData, sizeof(UINT64));
|
||||||
CopyMem (*FixupData, Fixup16, sizeof (UINT64));
|
CopyMem (*FixupData, Fixup16, sizeof (UINT64));
|
||||||
*FixupData = *FixupData + sizeof(UINT64);
|
*FixupData = *FixupData + sizeof(UINT64);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EFI_IMAGE_REL_BASED_ARM_MOV32A:
|
case EFI_IMAGE_REL_BASED_ARM_MOV32A:
|
||||||
// break omitted - ARM instruction encoding not implemented
|
// break omitted - ARM instruction encoding not implemented
|
||||||
default:
|
default:
|
||||||
|
@@ -1,14 +1,14 @@
|
|||||||
/** @file
|
/** @file
|
||||||
Generic but simple file parsing routines.
|
Generic but simple file parsing routines.
|
||||||
|
|
||||||
Copyright (c) 2004 - 2017, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
http://opensource.org/licenses/bsd-license.php
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
--*/
|
--*/
|
||||||
|
|
||||||
@@ -238,7 +238,7 @@ Arguments:
|
|||||||
FileName - name of the file to parse
|
FileName - name of the file to parse
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
|
|
||||||
|
|
||||||
--*/
|
--*/
|
||||||
{
|
{
|
||||||
@@ -345,7 +345,7 @@ SFPGetNextToken (
|
|||||||
/*++
|
/*++
|
||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
Get the next token from the input stream.
|
Get the next token from the input stream.
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
Str - pointer to a copy of the next token
|
Str - pointer to a copy of the next token
|
||||||
@@ -356,7 +356,7 @@ Returns:
|
|||||||
FALSE - otherwise
|
FALSE - otherwise
|
||||||
|
|
||||||
Notes:
|
Notes:
|
||||||
Preceeding white space is ignored.
|
Preceeding white space is ignored.
|
||||||
The parser's buffer pointer is advanced past the end of the
|
The parser's buffer pointer is advanced past the end of the
|
||||||
token.
|
token.
|
||||||
|
|
||||||
@@ -580,7 +580,7 @@ Arguments:
|
|||||||
None.
|
None.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
STATUS_SUCCESS - the file was closed
|
STATUS_SUCCESS - the file was closed
|
||||||
STATUS_ERROR - no file is currently open
|
STATUS_ERROR - no file is currently open
|
||||||
|
|
||||||
--*/
|
--*/
|
||||||
@@ -605,7 +605,7 @@ ProcessIncludeFile (
|
|||||||
Routine Description:
|
Routine Description:
|
||||||
|
|
||||||
Given a source file, open the file and parse it
|
Given a source file, open the file and parse it
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
|
|
||||||
SourceFile - name of file to parse
|
SourceFile - name of file to parse
|
||||||
@@ -614,7 +614,7 @@ Arguments:
|
|||||||
Returns:
|
Returns:
|
||||||
|
|
||||||
Standard status.
|
Standard status.
|
||||||
|
|
||||||
--*/
|
--*/
|
||||||
{
|
{
|
||||||
STATIC UINTN NestDepth = 0;
|
STATIC UINTN NestDepth = 0;
|
||||||
@@ -674,7 +674,7 @@ Routine Description:
|
|||||||
|
|
||||||
Given a source file that's been opened, read the contents into an internal
|
Given a source file that's been opened, read the contents into an internal
|
||||||
buffer and pre-process it to remove comments.
|
buffer and pre-process it to remove comments.
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
|
|
||||||
SourceFile - structure containing info on the file to process
|
SourceFile - structure containing info on the file to process
|
||||||
@@ -682,7 +682,7 @@ Arguments:
|
|||||||
Returns:
|
Returns:
|
||||||
|
|
||||||
Standard status.
|
Standard status.
|
||||||
|
|
||||||
--*/
|
--*/
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -722,13 +722,13 @@ PreprocessFile (
|
|||||||
Routine Description:
|
Routine Description:
|
||||||
Preprocess a file to replace all carriage returns with NULLs so
|
Preprocess a file to replace all carriage returns with NULLs so
|
||||||
we can print lines (as part of error messages) from the file to the screen.
|
we can print lines (as part of error messages) from the file to the screen.
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
SourceFile - structure that we use to keep track of an input file.
|
SourceFile - structure that we use to keep track of an input file.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
Nothing.
|
Nothing.
|
||||||
|
|
||||||
--*/
|
--*/
|
||||||
{
|
{
|
||||||
BOOLEAN InComment;
|
BOOLEAN InComment;
|
||||||
@@ -826,8 +826,8 @@ SFPGetQuotedString (
|
|||||||
/*++
|
/*++
|
||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
Retrieve a quoted-string from the input file.
|
Retrieve a quoted-string from the input file.
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
Str - pointer to a copy of the quoted string parsed
|
Str - pointer to a copy of the quoted string parsed
|
||||||
Length - size of buffer pointed to by Str
|
Length - size of buffer pointed to by Str
|
||||||
@@ -836,7 +836,7 @@ Returns:
|
|||||||
TRUE - next token in input stream was a quoted string, and
|
TRUE - next token in input stream was a quoted string, and
|
||||||
the string value was returned in Str
|
the string value was returned in Str
|
||||||
FALSE - otherwise
|
FALSE - otherwise
|
||||||
|
|
||||||
--*/
|
--*/
|
||||||
{
|
{
|
||||||
SkipWhiteSpace (&mGlobals.SourceFile);
|
SkipWhiteSpace (&mGlobals.SourceFile);
|
||||||
@@ -881,14 +881,14 @@ SFPIsEOF (
|
|||||||
Routine Description:
|
Routine Description:
|
||||||
Return TRUE of FALSE to indicate whether or not we've reached the end of the
|
Return TRUE of FALSE to indicate whether or not we've reached the end of the
|
||||||
file we're parsing.
|
file we're parsing.
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
NA
|
NA
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
TRUE - EOF reached
|
TRUE - EOF reached
|
||||||
FALSE - otherwise
|
FALSE - otherwise
|
||||||
|
|
||||||
--*/
|
--*/
|
||||||
{
|
{
|
||||||
SkipWhiteSpace (&mGlobals.SourceFile);
|
SkipWhiteSpace (&mGlobals.SourceFile);
|
||||||
|
@@ -1,14 +1,14 @@
|
|||||||
/** @file
|
/** @file
|
||||||
Function prototypes and defines for the simple file parsing routines.
|
Function prototypes and defines for the simple file parsing routines.
|
||||||
|
|
||||||
Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
http://opensource.org/licenses/bsd-license.php
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
|
@@ -1,14 +1,14 @@
|
|||||||
/** @file
|
/** @file
|
||||||
Function prototypes and defines for string routines.
|
Function prototypes and defines for string routines.
|
||||||
|
|
||||||
Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
http://opensource.org/licenses/bsd-license.php
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
@@ -383,7 +383,7 @@ Returns:
|
|||||||
strcat (NewString, "\"");
|
strcat (NewString, "\"");
|
||||||
}
|
}
|
||||||
strcat (NewString, "]");
|
strcat (NewString, "]");
|
||||||
|
|
||||||
return NewString;
|
return NewString;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,14 +1,14 @@
|
|||||||
/** @file
|
/** @file
|
||||||
String routines implementation
|
String routines implementation
|
||||||
|
|
||||||
Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
http://opensource.org/licenses/bsd-license.php
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
|
@@ -1,17 +1,17 @@
|
|||||||
/** @file
|
/** @file
|
||||||
Compression routine. The compression algorithm is a mixture of LZ77 and Huffman
|
Compression routine. The compression algorithm is a mixture of LZ77 and Huffman
|
||||||
coding. LZ77 transforms the source data into a sequence of Original Characters
|
coding. LZ77 transforms the source data into a sequence of Original Characters
|
||||||
and Pointers to repeated strings. This sequence is further divided into Blocks
|
and Pointers to repeated strings. This sequence is further divided into Blocks
|
||||||
and Huffman codings are applied to each Block.
|
and Huffman codings are applied to each Block.
|
||||||
|
|
||||||
Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
http://opensource.org/licenses/bsd-license.php
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
@@ -367,13 +367,13 @@ PutDword (
|
|||||||
Routine Description:
|
Routine Description:
|
||||||
|
|
||||||
Put a dword to output stream
|
Put a dword to output stream
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
|
|
||||||
Data - the dword to put
|
Data - the dword to put
|
||||||
|
|
||||||
Returns: (VOID)
|
Returns: (VOID)
|
||||||
|
|
||||||
--*/
|
--*/
|
||||||
{
|
{
|
||||||
if (mDst < mDstUpperLimit) {
|
if (mDst < mDstUpperLimit) {
|
||||||
@@ -403,8 +403,8 @@ AllocateMemory (
|
|||||||
Routine Description:
|
Routine Description:
|
||||||
|
|
||||||
Allocate memory spaces for data structures used in compression process
|
Allocate memory spaces for data structures used in compression process
|
||||||
|
|
||||||
Argements:
|
Argements:
|
||||||
VOID
|
VOID
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
@@ -460,7 +460,7 @@ FreeMemory (
|
|||||||
Routine Description:
|
Routine Description:
|
||||||
|
|
||||||
Called when compression is completed to free memory previously allocated.
|
Called when compression is completed to free memory previously allocated.
|
||||||
|
|
||||||
Arguments: (VOID)
|
Arguments: (VOID)
|
||||||
|
|
||||||
Returns: (VOID)
|
Returns: (VOID)
|
||||||
@@ -512,7 +512,7 @@ InitSlide (
|
|||||||
Routine Description:
|
Routine Description:
|
||||||
|
|
||||||
Initialize String Info Log data structures
|
Initialize String Info Log data structures
|
||||||
|
|
||||||
Arguments: (VOID)
|
Arguments: (VOID)
|
||||||
|
|
||||||
Returns: (VOID)
|
Returns: (VOID)
|
||||||
@@ -552,16 +552,16 @@ Child (
|
|||||||
Routine Description:
|
Routine Description:
|
||||||
|
|
||||||
Find child node given the parent node and the edge character
|
Find child node given the parent node and the edge character
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
|
|
||||||
NodeQ - the parent node
|
NodeQ - the parent node
|
||||||
CharC - the edge character
|
CharC - the edge character
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
|
|
||||||
The child node (NIL if not found)
|
The child node (NIL if not found)
|
||||||
|
|
||||||
--*/
|
--*/
|
||||||
{
|
{
|
||||||
NODE NodeR;
|
NODE NodeR;
|
||||||
@@ -590,13 +590,13 @@ MakeChild (
|
|||||||
Routine Description:
|
Routine Description:
|
||||||
|
|
||||||
Create a new child for a given parent node.
|
Create a new child for a given parent node.
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
|
|
||||||
Parent - the parent node
|
Parent - the parent node
|
||||||
CharC - the edge character
|
CharC - the edge character
|
||||||
Child - the child node
|
Child - the child node
|
||||||
|
|
||||||
Returns: (VOID)
|
Returns: (VOID)
|
||||||
|
|
||||||
--*/
|
--*/
|
||||||
@@ -624,11 +624,11 @@ Split (
|
|||||||
Routine Description:
|
Routine Description:
|
||||||
|
|
||||||
Split a node.
|
Split a node.
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
|
|
||||||
Old - the node to split
|
Old - the node to split
|
||||||
|
|
||||||
Returns: (VOID)
|
Returns: (VOID)
|
||||||
|
|
||||||
--*/
|
--*/
|
||||||
@@ -662,7 +662,7 @@ InsertNode (
|
|||||||
Routine Description:
|
Routine Description:
|
||||||
|
|
||||||
Insert string info for current position into the String Info Log
|
Insert string info for current position into the String Info Log
|
||||||
|
|
||||||
Arguments: (VOID)
|
Arguments: (VOID)
|
||||||
|
|
||||||
Returns: (VOID)
|
Returns: (VOID)
|
||||||
@@ -795,7 +795,7 @@ Routine Description:
|
|||||||
|
|
||||||
Delete outdated string info. (The Usage of PERC_FLAG
|
Delete outdated string info. (The Usage of PERC_FLAG
|
||||||
ensures a clean deletion)
|
ensures a clean deletion)
|
||||||
|
|
||||||
Arguments: (VOID)
|
Arguments: (VOID)
|
||||||
|
|
||||||
Returns: (VOID)
|
Returns: (VOID)
|
||||||
@@ -926,7 +926,7 @@ Routine Description:
|
|||||||
Arguments: (VOID)
|
Arguments: (VOID)
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
|
|
||||||
EFI_SUCCESS - The compression is successful
|
EFI_SUCCESS - The compression is successful
|
||||||
EFI_OUT_0F_RESOURCES - Not enough memory for compression process
|
EFI_OUT_0F_RESOURCES - Not enough memory for compression process
|
||||||
|
|
||||||
@@ -1012,7 +1012,7 @@ CountTFreq (
|
|||||||
Routine Description:
|
Routine Description:
|
||||||
|
|
||||||
Count the frequencies for the Extra Set
|
Count the frequencies for the Extra Set
|
||||||
|
|
||||||
Arguments: (VOID)
|
Arguments: (VOID)
|
||||||
|
|
||||||
Returns: (VOID)
|
Returns: (VOID)
|
||||||
@@ -1071,13 +1071,13 @@ WritePTLen (
|
|||||||
Routine Description:
|
Routine Description:
|
||||||
|
|
||||||
Outputs the code length array for the Extra Set or the Position Set.
|
Outputs the code length array for the Extra Set or the Position Set.
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
|
|
||||||
Number - the number of symbols
|
Number - the number of symbols
|
||||||
nbit - the number of bits needed to represent 'n'
|
nbit - the number of bits needed to represent 'n'
|
||||||
Special - the special symbol that needs to be take care of
|
Special - the special symbol that needs to be take care of
|
||||||
|
|
||||||
Returns: (VOID)
|
Returns: (VOID)
|
||||||
|
|
||||||
--*/
|
--*/
|
||||||
@@ -1119,7 +1119,7 @@ WriteCLen (
|
|||||||
Routine Description:
|
Routine Description:
|
||||||
|
|
||||||
Outputs the code length array for Char&Length Set
|
Outputs the code length array for Char&Length Set
|
||||||
|
|
||||||
Arguments: (VOID)
|
Arguments: (VOID)
|
||||||
|
|
||||||
Returns: (VOID)
|
Returns: (VOID)
|
||||||
@@ -1209,11 +1209,11 @@ SendBlock (
|
|||||||
Routine Description:
|
Routine Description:
|
||||||
|
|
||||||
Huffman code the block and output it.
|
Huffman code the block and output it.
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
(VOID)
|
(VOID)
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
(VOID)
|
(VOID)
|
||||||
|
|
||||||
--*/
|
--*/
|
||||||
@@ -1420,7 +1420,7 @@ Routine Description:
|
|||||||
Arguments:
|
Arguments:
|
||||||
|
|
||||||
Number - the rightmost n bits of the data is used
|
Number - the rightmost n bits of the data is used
|
||||||
x - the data
|
x - the data
|
||||||
|
|
||||||
Returns: (VOID)
|
Returns: (VOID)
|
||||||
|
|
||||||
@@ -1456,7 +1456,7 @@ FreadCrc (
|
|||||||
Routine Description:
|
Routine Description:
|
||||||
|
|
||||||
Read in source data
|
Read in source data
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
|
|
||||||
Pointer - the buffer to hold the data
|
Pointer - the buffer to hold the data
|
||||||
@@ -1465,7 +1465,7 @@ Arguments:
|
|||||||
Returns:
|
Returns:
|
||||||
|
|
||||||
number of bytes actually read
|
number of bytes actually read
|
||||||
|
|
||||||
--*/
|
--*/
|
||||||
{
|
{
|
||||||
INT32 Index;
|
INT32 Index;
|
||||||
@@ -1507,11 +1507,11 @@ CountLen (
|
|||||||
Routine Description:
|
Routine Description:
|
||||||
|
|
||||||
Count the number of each code length for a Huffman tree.
|
Count the number of each code length for a Huffman tree.
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
|
|
||||||
Index - the top node
|
Index - the top node
|
||||||
|
|
||||||
Returns: (VOID)
|
Returns: (VOID)
|
||||||
|
|
||||||
--*/
|
--*/
|
||||||
@@ -1538,11 +1538,11 @@ MakeLen (
|
|||||||
Routine Description:
|
Routine Description:
|
||||||
|
|
||||||
Create code length array for a Huffman tree
|
Create code length array for a Huffman tree
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
|
|
||||||
Root - the root of the tree
|
Root - the root of the tree
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
@@ -1634,7 +1634,7 @@ MakeCode (
|
|||||||
Routine Description:
|
Routine Description:
|
||||||
|
|
||||||
Assign code to each symbol based on the code length array
|
Assign code to each symbol based on the code length array
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
|
|
||||||
Number - number of symbols
|
Number - number of symbols
|
||||||
@@ -1671,18 +1671,18 @@ MakeTree (
|
|||||||
Routine Description:
|
Routine Description:
|
||||||
|
|
||||||
Generates Huffman codes given a frequency distribution of symbols
|
Generates Huffman codes given a frequency distribution of symbols
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
|
|
||||||
NParm - number of symbols
|
NParm - number of symbols
|
||||||
FreqParm - frequency of each symbol
|
FreqParm - frequency of each symbol
|
||||||
LenParm - code length for each symbol
|
LenParm - code length for each symbol
|
||||||
CodeParm - code for each symbol
|
CodeParm - code for each symbol
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
|
|
||||||
Root of the Huffman tree.
|
Root of the Huffman tree.
|
||||||
|
|
||||||
--*/
|
--*/
|
||||||
{
|
{
|
||||||
INT32 Index;
|
INT32 Index;
|
||||||
|
@@ -5,15 +5,15 @@ FILE := EFILDR_HEADER
|
|||||||
EFILDR_IMAGE +
|
EFILDR_IMAGE +
|
||||||
<PeImageFileContent> +
|
<PeImageFileContent> +
|
||||||
The order of EFILDR_IMAGE is same as the order of placing PeImageFileContent.
|
The order of EFILDR_IMAGE is same as the order of placing PeImageFileContent.
|
||||||
|
|
||||||
Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>
|
|
||||||
This program and the accompanying materials
|
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
|
||||||
which accompanies this distribution. The full text of the license may be found at
|
|
||||||
http://opensource.org/licenses/bsd-license.php
|
|
||||||
|
|
||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
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.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
@@ -36,8 +36,8 @@ typedef struct {
|
|||||||
UINT8 FileName[52];
|
UINT8 FileName[52];
|
||||||
} EFILDR_IMAGE;
|
} EFILDR_IMAGE;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
UINT32 Signature;
|
UINT32 Signature;
|
||||||
UINT32 HeaderCheckSum;
|
UINT32 HeaderCheckSum;
|
||||||
UINT32 FileLength;
|
UINT32 FileLength;
|
||||||
UINT32 NumberOfImages;
|
UINT32 NumberOfImages;
|
||||||
@@ -102,7 +102,7 @@ CountVerboseLevel (
|
|||||||
}
|
}
|
||||||
++(*ReturnValue);
|
++(*ReturnValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -176,29 +176,29 @@ Returns:
|
|||||||
UINT64 DebugLevel = 0;
|
UINT64 DebugLevel = 0;
|
||||||
UINT64 VerboseLevel = 0;
|
UINT64 VerboseLevel = 0;
|
||||||
EFI_STATUS Status = EFI_SUCCESS;
|
EFI_STATUS Status = EFI_SUCCESS;
|
||||||
|
|
||||||
SetUtilityName (UTILITY_NAME);
|
SetUtilityName (UTILITY_NAME);
|
||||||
|
|
||||||
if (argc == 1) {
|
if (argc == 1) {
|
||||||
printf ("Usage: EfiLdrImage -o OutImage LoaderImage PeImage1 PeImage2 ... PeImageN\n");
|
printf ("Usage: EfiLdrImage -o OutImage LoaderImage PeImage1 PeImage2 ... PeImageN\n");
|
||||||
return STATUS_ERROR;
|
return STATUS_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
argc --;
|
argc --;
|
||||||
argv ++;
|
argv ++;
|
||||||
|
|
||||||
if ((stricmp (argv[0], "-h") == 0) || (stricmp (argv[0], "--help") == 0)) {
|
if ((stricmp (argv[0], "-h") == 0) || (stricmp (argv[0], "--help") == 0)) {
|
||||||
Usage();
|
Usage();
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stricmp (argv[0], "--version") == 0) {
|
if (stricmp (argv[0], "--version") == 0) {
|
||||||
Version();
|
Version();
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (argc > 0) {
|
while (argc > 0) {
|
||||||
|
|
||||||
if ((stricmp (argv[0], "-o") == 0) || (stricmp (argv[0], "--output") == 0)) {
|
if ((stricmp (argv[0], "-o") == 0) || (stricmp (argv[0], "--output") == 0)) {
|
||||||
OutputFileName = argv[1];
|
OutputFileName = argv[1];
|
||||||
if (OutputFileName == NULL) {
|
if (OutputFileName == NULL) {
|
||||||
@@ -207,39 +207,39 @@ Returns:
|
|||||||
}
|
}
|
||||||
argc -= 2;
|
argc -= 2;
|
||||||
argv += 2;
|
argv += 2;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((stricmp (argv[0], "-q") == 0) || (stricmp (argv[0], "--quiet") == 0)) {
|
if ((stricmp (argv[0], "-q") == 0) || (stricmp (argv[0], "--quiet") == 0)) {
|
||||||
argc --;
|
argc --;
|
||||||
argv ++;
|
argv ++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((strlen(argv[0]) >= 2 && argv[0][0] == '-' && (argv[0][1] == 'v' || argv[0][1] == 'V')) || (stricmp (argv[0], "--verbose") == 0)) {
|
if ((strlen(argv[0]) >= 2 && argv[0][0] == '-' && (argv[0][1] == 'v' || argv[0][1] == 'V')) || (stricmp (argv[0], "--verbose") == 0)) {
|
||||||
VerboseLevel = 1;
|
VerboseLevel = 1;
|
||||||
if (strlen(argv[0]) > 2) {
|
if (strlen(argv[0]) > 2) {
|
||||||
Status = CountVerboseLevel (&argv[0][2], strlen(argv[0]) - 2, &VerboseLevel);
|
Status = CountVerboseLevel (&argv[0][2], strlen(argv[0]) - 2, &VerboseLevel);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
Error (NULL, 0, 1003, "Invalid option value", "%s", argv[0]);
|
Error (NULL, 0, 1003, "Invalid option value", "%s", argv[0]);
|
||||||
return STATUS_ERROR;
|
return STATUS_ERROR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
argc --;
|
argc --;
|
||||||
argv ++;
|
argv ++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((stricmp (argv[0], "-d") == 0) || (stricmp (argv[0], "--debug") == 0)) {
|
if ((stricmp (argv[0], "-d") == 0) || (stricmp (argv[0], "--debug") == 0)) {
|
||||||
Status = AsciiStringToUint64 (argv[1], FALSE, &DebugLevel);
|
Status = AsciiStringToUint64 (argv[1], FALSE, &DebugLevel);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
Error (NULL, 0, 1003, "Invalid option value", "%s = %s", argv[0], argv[1]);
|
Error (NULL, 0, 1003, "Invalid option value", "%s = %s", argv[0], argv[1]);
|
||||||
return STATUS_ERROR;
|
return STATUS_ERROR;
|
||||||
}
|
}
|
||||||
argc -= 2;
|
argc -= 2;
|
||||||
argv += 2;
|
argv += 2;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
// Don't recognize the parameter, should be regarded as the input file name.
|
// Don't recognize the parameter, should be regarded as the input file name.
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
/** @file
|
/** @file
|
||||||
Utility program to create an EFI option ROM image from binary and EFI PE32 files.
|
Utility program to create an EFI option ROM image from binary and EFI PE32 files.
|
||||||
|
|
||||||
Copyright (c) 1999 - 2017, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 1999 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials are licensed and made available
|
This program and the accompanying materials are licensed and made available
|
||||||
under the terms and conditions of the BSD License which accompanies this
|
under the terms and conditions of the BSD License which accompanies this
|
||||||
distribution. The full text of the license may be found at
|
distribution. The full text of the license may be found at
|
||||||
http://opensource.org/licenses/bsd-license.php
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
@@ -26,8 +26,8 @@ main (
|
|||||||
/*++
|
/*++
|
||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
|
|
||||||
Given an EFI image filename, create a ROM-able image by creating an option
|
Given an EFI image filename, create a ROM-able image by creating an option
|
||||||
ROM header and PCI data structure, filling them in, and then writing the
|
ROM header and PCI data structure, filling them in, and then writing the
|
||||||
option ROM header + PCI data structure + EFI image out to the output file.
|
option ROM header + PCI data structure + EFI image out to the output file.
|
||||||
|
|
||||||
@@ -71,11 +71,11 @@ Returns:
|
|||||||
} else if (mOptions.Debug) {
|
} else if (mOptions.Debug) {
|
||||||
SetPrintLevel(DebugLevel);
|
SetPrintLevel(DebugLevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mOptions.Verbose) {
|
if (mOptions.Verbose) {
|
||||||
VerboseMsg("%s tool start.\n", UTILITY_NAME);
|
VerboseMsg("%s tool start.\n", UTILITY_NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// If dumping an image, then do that and quit
|
// If dumping an image, then do that and quit
|
||||||
//
|
//
|
||||||
@@ -208,7 +208,7 @@ BailOut:
|
|||||||
VerboseMsg("%s tool done with return code is 0x%x.\n", UTILITY_NAME, GetUtilityStatus ());
|
VerboseMsg("%s tool done with return code is 0x%x.\n", UTILITY_NAME, GetUtilityStatus ());
|
||||||
}
|
}
|
||||||
|
|
||||||
return GetUtilityStatus ();
|
return GetUtilityStatus ();
|
||||||
}
|
}
|
||||||
|
|
||||||
static
|
static
|
||||||
@@ -221,7 +221,7 @@ ProcessBinFile (
|
|||||||
/*++
|
/*++
|
||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
|
|
||||||
Process a binary input file.
|
Process a binary input file.
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
@@ -247,7 +247,7 @@ Returns:
|
|||||||
UINT32 Index;
|
UINT32 Index;
|
||||||
UINT8 ByteCheckSum;
|
UINT8 ByteCheckSum;
|
||||||
UINT16 CodeType;
|
UINT16 CodeType;
|
||||||
|
|
||||||
PciDs23 = NULL;
|
PciDs23 = NULL;
|
||||||
PciDs30 = NULL;
|
PciDs30 = NULL;
|
||||||
Status = STATUS_SUCCESS;
|
Status = STATUS_SUCCESS;
|
||||||
@@ -351,7 +351,7 @@ Returns:
|
|||||||
} else {
|
} else {
|
||||||
PciDs30->ImageLength = (UINT16) (TotalSize / 512);
|
PciDs30->ImageLength = (UINT16) (TotalSize / 512);
|
||||||
CodeType = PciDs30->CodeType;
|
CodeType = PciDs30->CodeType;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// If this is the last image, then set the LAST bit unless requested not
|
// If this is the last image, then set the LAST bit unless requested not
|
||||||
@@ -362,13 +362,13 @@ Returns:
|
|||||||
PciDs23->Indicator = INDICATOR_LAST;
|
PciDs23->Indicator = INDICATOR_LAST;
|
||||||
} else {
|
} else {
|
||||||
PciDs30->Indicator = INDICATOR_LAST;
|
PciDs30->Indicator = INDICATOR_LAST;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (mOptions.Pci23 == 1) {
|
if (mOptions.Pci23 == 1) {
|
||||||
PciDs23->Indicator = 0;
|
PciDs23->Indicator = 0;
|
||||||
} else {
|
} else {
|
||||||
PciDs30->Indicator = 0;
|
PciDs30->Indicator = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CodeType != PCI_CODE_TYPE_EFI_IMAGE) {
|
if (CodeType != PCI_CODE_TYPE_EFI_IMAGE) {
|
||||||
@@ -431,7 +431,7 @@ ProcessEfiFile (
|
|||||||
/*++
|
/*++
|
||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
|
|
||||||
Process a PE32 EFI file.
|
Process a PE32 EFI file.
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
@@ -502,7 +502,7 @@ Returns:
|
|||||||
} else {
|
} else {
|
||||||
HeaderPadBytes = 0;
|
HeaderPadBytes = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// For Pci3.0 to use the different data structure.
|
// For Pci3.0 to use the different data structure.
|
||||||
//
|
//
|
||||||
@@ -600,7 +600,7 @@ Returns:
|
|||||||
// Check size
|
// Check size
|
||||||
//
|
//
|
||||||
if (TotalSize > MAX_OPTION_ROM_SIZE) {
|
if (TotalSize > MAX_OPTION_ROM_SIZE) {
|
||||||
Error (NULL, 0, 2000, "Invalid", "Option ROM image %s size exceeds limit of 0x%X bytes.", InFile->FileName, MAX_OPTION_ROM_SIZE);
|
Error (NULL, 0, 2000, "Invalid", "Option ROM image %s size exceeds limit of 0x%X bytes.", InFile->FileName, MAX_OPTION_ROM_SIZE);
|
||||||
Status = STATUS_ERROR;
|
Status = STATUS_ERROR;
|
||||||
goto BailOut;
|
goto BailOut;
|
||||||
}
|
}
|
||||||
@@ -685,12 +685,12 @@ Returns:
|
|||||||
if ((InFile->Next == NULL) && (mOptions.NoLast == 0)) {
|
if ((InFile->Next == NULL) && (mOptions.NoLast == 0)) {
|
||||||
if (mOptions.Pci23 == 1) {
|
if (mOptions.Pci23 == 1) {
|
||||||
PciDs23.Indicator = INDICATOR_LAST;
|
PciDs23.Indicator = INDICATOR_LAST;
|
||||||
} else {
|
} else {
|
||||||
PciDs30.Indicator = INDICATOR_LAST;}
|
PciDs30.Indicator = INDICATOR_LAST;}
|
||||||
} else {
|
} else {
|
||||||
if (mOptions.Pci23 == 1) {
|
if (mOptions.Pci23 == 1) {
|
||||||
PciDs23.Indicator = 0;
|
PciDs23.Indicator = 0;
|
||||||
} else {
|
} else {
|
||||||
PciDs30.Indicator = 0;
|
PciDs30.Indicator = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -723,13 +723,13 @@ Returns:
|
|||||||
Error (NULL, 0, 0002, "Failed to write PCI ROM header to output file!", NULL);
|
Error (NULL, 0, 0002, "Failed to write PCI ROM header to output file!", NULL);
|
||||||
Status = STATUS_ERROR;
|
Status = STATUS_ERROR;
|
||||||
goto BailOut;
|
goto BailOut;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (fwrite (&PciDs30, sizeof (PciDs30), 1, OutFptr) != 1) {
|
if (fwrite (&PciDs30, sizeof (PciDs30), 1, OutFptr) != 1) {
|
||||||
Error (NULL, 0, 0002, "Failed to write PCI ROM header to output file!", NULL);
|
Error (NULL, 0, 0002, "Failed to write PCI ROM header to output file!", NULL);
|
||||||
Status = STATUS_ERROR;
|
Status = STATUS_ERROR;
|
||||||
goto BailOut;
|
goto BailOut;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -819,7 +819,7 @@ CheckPE32File (
|
|||||||
/*++
|
/*++
|
||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
|
|
||||||
Given a file pointer to a supposed PE32 image file, verify that it is indeed a
|
Given a file pointer to a supposed PE32 image file, verify that it is indeed a
|
||||||
PE32 image file, and then return the machine type in the supplied pointer.
|
PE32 image file, and then return the machine type in the supplied pointer.
|
||||||
|
|
||||||
@@ -911,7 +911,7 @@ ParseCommandLine (
|
|||||||
/*++
|
/*++
|
||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
|
|
||||||
Given the Argc/Argv program arguments, and a pointer to an options structure,
|
Given the Argc/Argv program arguments, and a pointer to an options structure,
|
||||||
parse the command-line options and check their validity.
|
parse the command-line options and check their validity.
|
||||||
|
|
||||||
@@ -973,12 +973,12 @@ Returns:
|
|||||||
Usage ();
|
Usage ();
|
||||||
return STATUS_ERROR;
|
return STATUS_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((stricmp(Argv[0], "-h") == 0) || (stricmp(Argv[0], "--help") == 0)) {
|
if ((stricmp(Argv[0], "-h") == 0) || (stricmp(Argv[0], "--help") == 0)) {
|
||||||
Usage();
|
Usage();
|
||||||
return STATUS_ERROR;
|
return STATUS_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((stricmp(Argv[0], "--version") == 0)) {
|
if ((stricmp(Argv[0], "--version") == 0)) {
|
||||||
Version();
|
Version();
|
||||||
return STATUS_ERROR;
|
return STATUS_ERROR;
|
||||||
@@ -1222,7 +1222,7 @@ Returns:
|
|||||||
ReturnStatus = STATUS_ERROR;
|
ReturnStatus = STATUS_ERROR;
|
||||||
goto Done;
|
goto Done;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// set flag and class code for this image.
|
// set flag and class code for this image.
|
||||||
//
|
//
|
||||||
@@ -1239,7 +1239,7 @@ Returns:
|
|||||||
} else {
|
} else {
|
||||||
if (PrevFileList == NULL) {
|
if (PrevFileList == NULL) {
|
||||||
PrevFileList = FileList;
|
PrevFileList = FileList;
|
||||||
} else {
|
} else {
|
||||||
PrevFileList->Next = FileList;
|
PrevFileList->Next = FileList;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1273,7 +1273,7 @@ Returns:
|
|||||||
ReturnStatus = STATUS_ERROR;
|
ReturnStatus = STATUS_ERROR;
|
||||||
goto Done;
|
goto Done;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Options->DevIdCount) {
|
if (!Options->DevIdCount) {
|
||||||
Error (NULL, 0, 2000, "Missing Device ID in command line", NULL);
|
Error (NULL, 0, 2000, "Missing Device ID in command line", NULL);
|
||||||
ReturnStatus = STATUS_ERROR;
|
ReturnStatus = STATUS_ERROR;
|
||||||
@@ -1307,7 +1307,7 @@ Version (
|
|||||||
/*++
|
/*++
|
||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
|
|
||||||
Print version information for this utility.
|
Print version information for this utility.
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
@@ -1321,7 +1321,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 %s \n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION, __BUILD_VERSION);
|
||||||
}
|
}
|
||||||
|
|
||||||
static
|
static
|
||||||
void
|
void
|
||||||
Usage (
|
Usage (
|
||||||
@@ -1330,7 +1330,7 @@ Usage (
|
|||||||
/*++
|
/*++
|
||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
|
|
||||||
Print usage information for this utility.
|
Print usage information for this utility.
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
@@ -1347,11 +1347,11 @@ Returns:
|
|||||||
// Summary usage
|
// Summary usage
|
||||||
//
|
//
|
||||||
fprintf (stdout, "Usage: %s -f VendorId -i DeviceId [options] [file name<s>] \n\n", UTILITY_NAME);
|
fprintf (stdout, "Usage: %s -f VendorId -i DeviceId [options] [file name<s>] \n\n", UTILITY_NAME);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Copyright declaration
|
// Copyright declaration
|
||||||
//
|
//
|
||||||
fprintf (stdout, "Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.\n\n");
|
fprintf (stdout, "Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.\n\n");
|
||||||
|
|
||||||
//
|
//
|
||||||
// Details Option
|
// Details Option
|
||||||
@@ -1386,7 +1386,7 @@ Returns:
|
|||||||
fprintf (stdout, " -q, --quiet\n\
|
fprintf (stdout, " -q, --quiet\n\
|
||||||
Disable all messages except FATAL ERRORS.\n");
|
Disable all messages except FATAL ERRORS.\n");
|
||||||
fprintf (stdout, " --debug [#,0-9]\n\
|
fprintf (stdout, " --debug [#,0-9]\n\
|
||||||
Enable debug messages at level #.\n");
|
Enable debug messages at level #.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
static
|
static
|
||||||
@@ -1515,7 +1515,7 @@ Returns:
|
|||||||
fprintf (stdout, " Device ID 0x%04X\n", PciDs30.DeviceId);
|
fprintf (stdout, " Device ID 0x%04X\n", PciDs30.DeviceId);
|
||||||
fprintf (stdout, " Length 0x%04X\n", PciDs30.Length);
|
fprintf (stdout, " Length 0x%04X\n", PciDs30.Length);
|
||||||
fprintf (stdout, " Revision 0x%04X\n", PciDs30.Revision);
|
fprintf (stdout, " Revision 0x%04X\n", PciDs30.Revision);
|
||||||
fprintf (stdout, " DeviceListOffset 0x%02X\n", PciDs30.DeviceListOffset);
|
fprintf (stdout, " DeviceListOffset 0x%02X\n", PciDs30.DeviceListOffset);
|
||||||
if (PciDs30.DeviceListOffset) {
|
if (PciDs30.DeviceListOffset) {
|
||||||
//
|
//
|
||||||
// Print device ID list
|
// Print device ID list
|
||||||
@@ -1549,8 +1549,8 @@ Returns:
|
|||||||
fprintf (stdout, " Code revision: 0x%04X\n", PciDs30.CodeRevision);
|
fprintf (stdout, " Code revision: 0x%04X\n", PciDs30.CodeRevision);
|
||||||
fprintf (stdout, " MaxRuntimeImageLength 0x%02X\n", PciDs30.MaxRuntimeImageLength);
|
fprintf (stdout, " MaxRuntimeImageLength 0x%02X\n", PciDs30.MaxRuntimeImageLength);
|
||||||
fprintf (stdout, " ConfigUtilityCodeHeaderOffset 0x%02X\n", PciDs30.ConfigUtilityCodeHeaderOffset);
|
fprintf (stdout, " ConfigUtilityCodeHeaderOffset 0x%02X\n", PciDs30.ConfigUtilityCodeHeaderOffset);
|
||||||
fprintf (stdout, " DMTFCLPEntryPointOffset 0x%02X\n", PciDs30.DMTFCLPEntryPointOffset);
|
fprintf (stdout, " DMTFCLPEntryPointOffset 0x%02X\n", PciDs30.DMTFCLPEntryPointOffset);
|
||||||
fprintf (stdout, " Indicator 0x%02X", PciDs30.Indicator);
|
fprintf (stdout, " Indicator 0x%02X", PciDs30.Indicator);
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
// Print the indicator, used to flag the last image
|
// Print the indicator, used to flag the last image
|
||||||
@@ -1566,7 +1566,7 @@ Returns:
|
|||||||
if (mOptions.Pci23 == 1) {
|
if (mOptions.Pci23 == 1) {
|
||||||
fprintf (stdout, " Code type 0x%02X", PciDs23.CodeType);
|
fprintf (stdout, " Code type 0x%02X", PciDs23.CodeType);
|
||||||
} else {
|
} else {
|
||||||
fprintf (stdout, " Code type 0x%02X", PciDs30.CodeType);
|
fprintf (stdout, " Code type 0x%02X", PciDs30.CodeType);
|
||||||
}
|
}
|
||||||
if (PciDs23.CodeType == PCI_CODE_TYPE_EFI_IMAGE || PciDs30.CodeType == PCI_CODE_TYPE_EFI_IMAGE) {
|
if (PciDs23.CodeType == PCI_CODE_TYPE_EFI_IMAGE || PciDs30.CodeType == PCI_CODE_TYPE_EFI_IMAGE) {
|
||||||
fprintf (stdout, " (EFI image)\n");
|
fprintf (stdout, " (EFI image)\n");
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
/** @file
|
/** @file
|
||||||
This file contains the relevant declarations required to generate Option Rom File
|
This file contains the relevant declarations required to generate Option Rom File
|
||||||
|
|
||||||
Copyright (c) 1999 - 2017, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 1999 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials are licensed and made available
|
This program and the accompanying materials are licensed and made available
|
||||||
under the terms and conditions of the BSD License which accompanies this
|
under the terms and conditions of the BSD License which accompanies this
|
||||||
distribution. The full text of the license may be found at
|
distribution. The full text of the license may be found at
|
||||||
http://opensource.org/licenses/bsd-license.php
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
@@ -93,7 +93,7 @@ typedef struct {
|
|||||||
INT8 Pci30;
|
INT8 Pci30;
|
||||||
INT8 DumpOption;
|
INT8 DumpOption;
|
||||||
// INT8 Help;
|
// INT8 Help;
|
||||||
// INT8 Version;
|
// INT8 Version;
|
||||||
FILE_LIST *FileList;
|
FILE_LIST *FileList;
|
||||||
} OPTIONS;
|
} OPTIONS;
|
||||||
|
|
||||||
@@ -177,7 +177,7 @@ Returns:
|
|||||||
|
|
||||||
None
|
None
|
||||||
|
|
||||||
--*/
|
--*/
|
||||||
;
|
;
|
||||||
|
|
||||||
static
|
static
|
||||||
@@ -190,7 +190,7 @@ ParseCommandLine (
|
|||||||
/*++
|
/*++
|
||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
|
|
||||||
Given the Argc/Argv program arguments, and a pointer to an options structure,
|
Given the Argc/Argv program arguments, and a pointer to an options structure,
|
||||||
parse the command-line options and check their validity.
|
parse the command-line options and check their validity.
|
||||||
|
|
||||||
@@ -218,7 +218,7 @@ CheckPE32File (
|
|||||||
/*++
|
/*++
|
||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
|
|
||||||
Given the Argc/Argv program arguments, and a pointer to an options structure,
|
Given the Argc/Argv program arguments, and a pointer to an options structure,
|
||||||
parse the command-line options and check their validity.
|
parse the command-line options and check their validity.
|
||||||
|
|
||||||
@@ -233,7 +233,7 @@ Returns:
|
|||||||
STATUS_SUCCESS success
|
STATUS_SUCCESS success
|
||||||
non-zero otherwise
|
non-zero otherwise
|
||||||
|
|
||||||
--*/
|
--*/
|
||||||
;
|
;
|
||||||
|
|
||||||
static
|
static
|
||||||
@@ -248,7 +248,7 @@ ProcessEfiFile (
|
|||||||
/*++
|
/*++
|
||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
|
|
||||||
Process a PE32 EFI file.
|
Process a PE32 EFI file.
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
@@ -276,7 +276,7 @@ ProcessBinFile (
|
|||||||
/*++
|
/*++
|
||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
|
|
||||||
Process a binary input file.
|
Process a binary input file.
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
@@ -289,7 +289,7 @@ Returns:
|
|||||||
|
|
||||||
0 - successful
|
0 - successful
|
||||||
|
|
||||||
--*/
|
--*/
|
||||||
;
|
;
|
||||||
|
|
||||||
static
|
static
|
||||||
|
@@ -2,14 +2,14 @@
|
|||||||
|
|
||||||
Fat file system structure and definition.
|
Fat file system structure and definition.
|
||||||
|
|
||||||
Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
http://opensource.org/licenses/bsd-license.php
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
--*/
|
--*/
|
||||||
|
|
||||||
|
@@ -3,15 +3,15 @@ Reading/writing MBR/DBR.
|
|||||||
NOTE:
|
NOTE:
|
||||||
If we write MBR to disk, we just update the MBR code and the partition table wouldn't be over written.
|
If we write MBR to disk, we just update the MBR code and the partition table wouldn't be over written.
|
||||||
If we process DBR, we will patch MBR to set first partition active if no active partition exists.
|
If we process DBR, we will patch MBR to set first partition active if no active partition exists.
|
||||||
|
|
||||||
Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
http://opensource.org/licenses/bsd-license.php
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
@@ -166,16 +166,16 @@ Return:
|
|||||||
);
|
);
|
||||||
if (VolumeHandle == INVALID_HANDLE_VALUE) {
|
if (VolumeHandle == INVALID_HANDLE_VALUE) {
|
||||||
fprintf (
|
fprintf (
|
||||||
stderr,
|
stderr,
|
||||||
"error E0005: CreateFile failed: Volume = %s, LastError = 0x%lx\n",
|
"error E0005: CreateFile failed: Volume = %s, LastError = 0x%lx\n",
|
||||||
VolumeAccessPath,
|
VolumeAccessPath,
|
||||||
GetLastError ()
|
GetLastError ()
|
||||||
);
|
);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Get Disk Number. It should fail when operating on floppy. That's ok
|
// Get Disk Number. It should fail when operating on floppy. That's ok
|
||||||
// because Disk Number is only needed when operating on Hard or USB disk.
|
// because Disk Number is only needed when operating on Hard or USB disk.
|
||||||
//
|
//
|
||||||
// To direct write to disk:
|
// To direct write to disk:
|
||||||
@@ -183,13 +183,13 @@ Return:
|
|||||||
// for floppy: use path = \\.\X:, where X can be A or B
|
// for floppy: use path = \\.\X:, where X can be A or B
|
||||||
//
|
//
|
||||||
Success = DeviceIoControl(
|
Success = DeviceIoControl(
|
||||||
VolumeHandle,
|
VolumeHandle,
|
||||||
IOCTL_STORAGE_GET_DEVICE_NUMBER,
|
IOCTL_STORAGE_GET_DEVICE_NUMBER,
|
||||||
NULL,
|
NULL,
|
||||||
0,
|
0,
|
||||||
&StorageDeviceNumber,
|
&StorageDeviceNumber,
|
||||||
sizeof(StorageDeviceNumber),
|
sizeof(StorageDeviceNumber),
|
||||||
&BytesReturned,
|
&BytesReturned,
|
||||||
NULL
|
NULL
|
||||||
);
|
);
|
||||||
//
|
//
|
||||||
@@ -207,7 +207,7 @@ Return:
|
|||||||
DriveInfo->DiskNumber = StorageDeviceNumber.DeviceNumber;
|
DriveInfo->DiskNumber = StorageDeviceNumber.DeviceNumber;
|
||||||
}
|
}
|
||||||
CloseHandle(VolumeHandle);
|
CloseHandle(VolumeHandle);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Fill in the type string
|
// Fill in the type string
|
||||||
//
|
//
|
||||||
@@ -241,7 +241,7 @@ Routine Description:
|
|||||||
{
|
{
|
||||||
UINT Index;
|
UINT Index;
|
||||||
DRIVE_INFO DriveInfo;
|
DRIVE_INFO DriveInfo;
|
||||||
|
|
||||||
UINT Mask = GetLogicalDrives();
|
UINT Mask = GetLogicalDrives();
|
||||||
|
|
||||||
for (Index = 0; Index < MAX_DRIVE; Index++) {
|
for (Index = 0; Index < MAX_DRIVE; Index++) {
|
||||||
@@ -258,9 +258,9 @@ Routine Description:
|
|||||||
} else {
|
} else {
|
||||||
fprintf (
|
fprintf (
|
||||||
stdout,
|
stdout,
|
||||||
"%c: - DiskNum: %u, Type: %s\n",
|
"%c: - DiskNum: %u, Type: %s\n",
|
||||||
DriveInfo.VolumeLetter,
|
DriveInfo.VolumeLetter,
|
||||||
(unsigned) DriveInfo.DiskNumber,
|
(unsigned) DriveInfo.DiskNumber,
|
||||||
DriveInfo.DriveType->Description
|
DriveInfo.DriveType->Description
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -301,7 +301,7 @@ Return:
|
|||||||
|
|
||||||
DbrOffset = 0;
|
DbrOffset = 0;
|
||||||
HasMbr = FALSE;
|
HasMbr = FALSE;
|
||||||
|
|
||||||
SetFilePointer(DiskHandle, 0, NULL, FILE_BEGIN);
|
SetFilePointer(DiskHandle, 0, NULL, FILE_BEGIN);
|
||||||
if (!ReadFile (DiskHandle, DiskPartition, 0x200, &BytesReturn, NULL)) {
|
if (!ReadFile (DiskHandle, DiskPartition, 0x200, &BytesReturn, NULL)) {
|
||||||
return -1;
|
return -1;
|
||||||
@@ -359,12 +359,12 @@ Return:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get window file handle for input/ouput disk/file.
|
* Get window file handle for input/ouput disk/file.
|
||||||
*
|
*
|
||||||
* @param PathInfo
|
* @param PathInfo
|
||||||
* @param ProcessMbr
|
* @param ProcessMbr
|
||||||
* @param FileHandle
|
* @param FileHandle
|
||||||
*
|
*
|
||||||
* @return ERROR_STATUS
|
* @return ERROR_STATUS
|
||||||
*/
|
*/
|
||||||
ERROR_STATUS
|
ERROR_STATUS
|
||||||
@@ -384,11 +384,11 @@ GetFileHandle (
|
|||||||
|
|
||||||
*FileHandle = CreateFile(
|
*FileHandle = CreateFile(
|
||||||
PathInfo->PhysicalPath,
|
PathInfo->PhysicalPath,
|
||||||
GENERIC_READ | GENERIC_WRITE,
|
GENERIC_READ | GENERIC_WRITE,
|
||||||
FILE_SHARE_READ,
|
FILE_SHARE_READ,
|
||||||
NULL,
|
NULL,
|
||||||
OpenFlag,
|
OpenFlag,
|
||||||
FILE_ATTRIBUTE_NORMAL,
|
FILE_ATTRIBUTE_NORMAL,
|
||||||
NULL
|
NULL
|
||||||
);
|
);
|
||||||
if (*FileHandle == INVALID_HANDLE_VALUE) {
|
if (*FileHandle == INVALID_HANDLE_VALUE) {
|
||||||
@@ -419,19 +419,19 @@ GetFileHandle (
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Writing or reading boot sector or MBR according to the argument.
|
Writing or reading boot sector or MBR according to the argument.
|
||||||
|
|
||||||
@param InputInfo PATH_INFO instance for input path
|
@param InputInfo PATH_INFO instance for input path
|
||||||
@param OutputInfo PATH_INFO instance for output path
|
@param OutputInfo PATH_INFO instance for output path
|
||||||
@param ProcessMbr TRUE is to process MBR, otherwise, processing boot sector
|
@param ProcessMbr TRUE is to process MBR, otherwise, processing boot sector
|
||||||
|
|
||||||
@return ERROR_STATUS
|
@return ERROR_STATUS
|
||||||
**/
|
**/
|
||||||
ERROR_STATUS
|
ERROR_STATUS
|
||||||
ProcessBsOrMbr (
|
ProcessBsOrMbr (
|
||||||
PATH_INFO *InputInfo,
|
PATH_INFO *InputInfo,
|
||||||
PATH_INFO *OutputInfo,
|
PATH_INFO *OutputInfo,
|
||||||
BOOL ProcessMbr
|
BOOL ProcessMbr
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
BYTE DiskPartition[0x200] = {0};
|
BYTE DiskPartition[0x200] = {0};
|
||||||
@@ -462,14 +462,14 @@ ProcessBsOrMbr (
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Read boot sector from source disk/file
|
// Read boot sector from source disk/file
|
||||||
//
|
//
|
||||||
if (!ReadFile (InputHandle, DiskPartition, 0x200, &BytesReturn, NULL)) {
|
if (!ReadFile (InputHandle, DiskPartition, 0x200, &BytesReturn, NULL)) {
|
||||||
Status = ErrorFileReadWrite;
|
Status = ErrorFileReadWrite;
|
||||||
goto Done;
|
goto Done;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (InputInfo->Type == PathUsb) {
|
if (InputInfo->Type == PathUsb) {
|
||||||
// Manually set BS_DrvNum to 0x80 as window's format.exe has a bug which will clear this field discarding USB disk's MBR.
|
// Manually set BS_DrvNum to 0x80 as window's format.exe has a bug which will clear this field discarding USB disk's MBR.
|
||||||
// offset of BS_DrvNum is 0x24 for FAT12/16
|
// offset of BS_DrvNum is 0x24 for FAT12/16
|
||||||
// 0x40 for FAT32
|
// 0x40 for FAT32
|
||||||
//
|
//
|
||||||
@@ -509,7 +509,7 @@ ProcessBsOrMbr (
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Write boot sector to taget disk/file
|
// Write boot sector to taget disk/file
|
||||||
//
|
//
|
||||||
if (!WriteFile (OutputHandle, DiskPartition, 0x200, &BytesReturn, NULL)) {
|
if (!WriteFile (OutputHandle, DiskPartition, 0x200, &BytesReturn, NULL)) {
|
||||||
Status = ErrorFileReadWrite;
|
Status = ErrorFileReadWrite;
|
||||||
goto Done;
|
goto Done;
|
||||||
@@ -555,7 +555,7 @@ PrintUsage (
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
printf ("Usage: GenBootSector [options] --cfg-file CFG_FILE\n\n\
|
printf ("Usage: GenBootSector [options] --cfg-file CFG_FILE\n\n\
|
||||||
Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.\n\n\
|
Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.\n\n\
|
||||||
Utility to retrieve and update the boot sector or MBR.\n\n\
|
Utility to retrieve and update the boot sector or MBR.\n\n\
|
||||||
optional arguments:\n\
|
optional arguments:\n\
|
||||||
-h, --help Show this help message and exit\n\
|
-h, --help Show this help message and exit\n\
|
||||||
@@ -601,7 +601,7 @@ GetPathInfo (
|
|||||||
//
|
//
|
||||||
if (IsLetter(PathInfo->Path[0]) && (PathInfo->Path[1] == ':') && (PathInfo->Path[2] == '\0')) {
|
if (IsLetter(PathInfo->Path[0]) && (PathInfo->Path[1] == ':') && (PathInfo->Path[2] == '\0')) {
|
||||||
VolumeLetter = PathInfo->Path[0];
|
VolumeLetter = PathInfo->Path[0];
|
||||||
if ((VolumeLetter == 'A') || (VolumeLetter == 'a') ||
|
if ((VolumeLetter == 'A') || (VolumeLetter == 'a') ||
|
||||||
(VolumeLetter == 'B') || (VolumeLetter == 'b')) {
|
(VolumeLetter == 'B') || (VolumeLetter == 'b')) {
|
||||||
PathInfo->Type = PathFloppy;
|
PathInfo->Type = PathFloppy;
|
||||||
sprintf (PathInfo->PhysicalPath, FloppyPathTemplate, VolumeLetter);
|
sprintf (PathInfo->PhysicalPath, FloppyPathTemplate, VolumeLetter);
|
||||||
@@ -628,8 +628,8 @@ GetPathInfo (
|
|||||||
return ErrorPath;
|
return ErrorPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ErrorSuccess;
|
return ErrorSuccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Check the path length
|
// Check the path length
|
||||||
@@ -660,7 +660,7 @@ GetPathInfo (
|
|||||||
PathInfo->PhysicalPath[sizeof (PathInfo->PhysicalPath) / sizeof (PathInfo->PhysicalPath[0]) - 1] = 0;
|
PathInfo->PhysicalPath[sizeof (PathInfo->PhysicalPath) / sizeof (PathInfo->PhysicalPath[0]) - 1] = 0;
|
||||||
|
|
||||||
return ErrorSuccess;
|
return ErrorSuccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
INT
|
INT
|
||||||
main (
|
main (
|
||||||
@@ -682,14 +682,14 @@ main (
|
|||||||
AppName = *argv;
|
AppName = *argv;
|
||||||
argv ++;
|
argv ++;
|
||||||
argc --;
|
argc --;
|
||||||
|
|
||||||
ProcessMbr = FALSE;
|
ProcessMbr = FALSE;
|
||||||
|
|
||||||
if (argc == 0) {
|
if (argc == 0) {
|
||||||
PrintUsage();
|
PrintUsage();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Parse command line
|
// Parse command line
|
||||||
//
|
//
|
||||||
@@ -697,23 +697,23 @@ main (
|
|||||||
if ((stricmp (argv[Index], "-l") == 0) || (stricmp (argv[Index], "--list") == 0)) {
|
if ((stricmp (argv[Index], "-l") == 0) || (stricmp (argv[Index], "--list") == 0)) {
|
||||||
ListDrive ();
|
ListDrive ();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((stricmp (argv[Index], "-m") == 0) || (stricmp (argv[Index], "--mbr") == 0)) {
|
if ((stricmp (argv[Index], "-m") == 0) || (stricmp (argv[Index], "--mbr") == 0)) {
|
||||||
ProcessMbr = TRUE;
|
ProcessMbr = TRUE;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((stricmp (argv[Index], "-i") == 0) || (stricmp (argv[Index], "--input") == 0)) {
|
if ((stricmp (argv[Index], "-i") == 0) || (stricmp (argv[Index], "--input") == 0)) {
|
||||||
InputPathInfo.Path = argv[Index + 1];
|
InputPathInfo.Path = argv[Index + 1];
|
||||||
InputPathInfo.Input = TRUE;
|
InputPathInfo.Input = TRUE;
|
||||||
if (InputPathInfo.Path == NULL) {
|
if (InputPathInfo.Path == NULL) {
|
||||||
Error (NULL, 0, 1003, "Invalid option value", "Input file name can't be NULL");
|
Error (NULL, 0, 1003, "Invalid option value", "Input file name can't be NULL");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if (InputPathInfo.Path[0] == '-') {
|
if (InputPathInfo.Path[0] == '-') {
|
||||||
Error (NULL, 0, 1003, "Invalid option value", "Input file is missing");
|
Error (NULL, 0, 1003, "Invalid option value", "Input file is missing");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
++Index;
|
++Index;
|
||||||
continue;
|
continue;
|
||||||
@@ -725,33 +725,33 @@ main (
|
|||||||
if (OutputPathInfo.Path == NULL) {
|
if (OutputPathInfo.Path == NULL) {
|
||||||
Error (NULL, 0, 1003, "Invalid option value", "Output file name can't be NULL");
|
Error (NULL, 0, 1003, "Invalid option value", "Output file name can't be NULL");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if (OutputPathInfo.Path[0] == '-') {
|
if (OutputPathInfo.Path[0] == '-') {
|
||||||
Error (NULL, 0, 1003, "Invalid option value", "Output file is missing");
|
Error (NULL, 0, 1003, "Invalid option value", "Output file is missing");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
++Index;
|
++Index;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((stricmp (argv[Index], "-h") == 0) || (stricmp (argv[Index], "--help") == 0)) {
|
if ((stricmp (argv[Index], "-h") == 0) || (stricmp (argv[Index], "--help") == 0)) {
|
||||||
PrintUsage ();
|
PrintUsage ();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stricmp (argv[Index], "--version") == 0) {
|
if (stricmp (argv[Index], "--version") == 0) {
|
||||||
Version ();
|
Version ();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((stricmp (argv[Index], "-v") == 0) || (stricmp (argv[Index], "--verbose") == 0)) {
|
if ((stricmp (argv[Index], "-v") == 0) || (stricmp (argv[Index], "--verbose") == 0)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((stricmp (argv[Index], "-q") == 0) || (stricmp (argv[Index], "--quiet") == 0)) {
|
if ((stricmp (argv[Index], "-q") == 0) || (stricmp (argv[Index], "--quiet") == 0)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((stricmp (argv[Index], "-d") == 0) || (stricmp (argv[Index], "--debug") == 0)) {
|
if ((stricmp (argv[Index], "-d") == 0) || (stricmp (argv[Index], "--debug") == 0)) {
|
||||||
EfiStatus = AsciiStringToUint64 (argv[Index + 1], FALSE, &LogLevel);
|
EfiStatus = AsciiStringToUint64 (argv[Index + 1], FALSE, &LogLevel);
|
||||||
if (EFI_ERROR (EfiStatus)) {
|
if (EFI_ERROR (EfiStatus)) {
|
||||||
@@ -774,7 +774,7 @@ main (
|
|||||||
Error (NULL, 0, 1000, "Unknown option", "%s", argv[Index]);
|
Error (NULL, 0, 1000, "Unknown option", "%s", argv[Index]);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (InputPathInfo.Path == NULL) {
|
if (InputPathInfo.Path == NULL) {
|
||||||
Error (NULL, 0, 1001, "Missing options", "Input file is missing");
|
Error (NULL, 0, 1001, "Missing options", "Input file is missing");
|
||||||
return 1;
|
return 1;
|
||||||
@@ -784,7 +784,7 @@ main (
|
|||||||
Error (NULL, 0, 1001, "Missing options", "Output file is missing");
|
Error (NULL, 0, 1001, "Missing options", "Output file is missing");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GetPathInfo(&InputPathInfo) != ErrorSuccess) {
|
if (GetPathInfo(&InputPathInfo) != ErrorSuccess) {
|
||||||
Error (NULL, 0, 1003, "Invalid option value", "Input file can't be found.");
|
Error (NULL, 0, 1003, "Invalid option value", "Input file can't be found.");
|
||||||
return 1;
|
return 1;
|
||||||
@@ -794,7 +794,7 @@ main (
|
|||||||
Error (NULL, 0, 1003, "Invalid option value", "Output file can't be found.");
|
Error (NULL, 0, 1003, "Invalid option value", "Output file can't be found.");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Process DBR (Patch or Read)
|
// Process DBR (Patch or Read)
|
||||||
//
|
//
|
||||||
@@ -802,19 +802,19 @@ main (
|
|||||||
|
|
||||||
if (Status == ErrorSuccess) {
|
if (Status == ErrorSuccess) {
|
||||||
fprintf (
|
fprintf (
|
||||||
stdout,
|
stdout,
|
||||||
"%s %s: successful!\n",
|
"%s %s: successful!\n",
|
||||||
(OutputPathInfo.Type != PathFile) ? "Write" : "Read",
|
(OutputPathInfo.Type != PathFile) ? "Write" : "Read",
|
||||||
ProcessMbr ? "MBR" : "DBR"
|
ProcessMbr ? "MBR" : "DBR"
|
||||||
);
|
);
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
fprintf (
|
fprintf (
|
||||||
stderr,
|
stderr,
|
||||||
"%s: %s %s: failed - %s (LastError: 0x%lx)!\n",
|
"%s: %s %s: failed - %s (LastError: 0x%lx)!\n",
|
||||||
(Status == ErrorNoMbr) ? "WARNING" : "ERROR",
|
(Status == ErrorNoMbr) ? "WARNING" : "ERROR",
|
||||||
(OutputPathInfo.Type != PathFile) ? "Write" : "Read",
|
(OutputPathInfo.Type != PathFile) ? "Write" : "Read",
|
||||||
ProcessMbr ? "MBR" : "DBR",
|
ProcessMbr ? "MBR" : "DBR",
|
||||||
ErrorStatusDesc[Status],
|
ErrorStatusDesc[Status],
|
||||||
GetLastError ()
|
GetLastError ()
|
||||||
);
|
);
|
||||||
|
@@ -2,14 +2,14 @@
|
|||||||
|
|
||||||
Get Drv Num offset from Fat file system.
|
Get Drv Num offset from Fat file system.
|
||||||
|
|
||||||
Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
http://opensource.org/licenses/bsd-license.php
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
|
@@ -1,14 +1,14 @@
|
|||||||
/** @file
|
/** @file
|
||||||
Calculate Crc32 value and Verify Crc32 value for input data.
|
Calculate Crc32 value and Verify Crc32 value for input data.
|
||||||
|
|
||||||
Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
http://opensource.org/licenses/bsd-license.php
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
@@ -27,7 +27,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||||||
|
|
||||||
#define CRC32_NULL 0
|
#define CRC32_NULL 0
|
||||||
#define CRC32_ENCODE 1
|
#define CRC32_ENCODE 1
|
||||||
#define CRC32_DECODE 2
|
#define CRC32_DECODE 2
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
Version (
|
Version (
|
||||||
@@ -76,11 +76,11 @@ Returns:
|
|||||||
// Summary usage
|
// Summary usage
|
||||||
//
|
//
|
||||||
fprintf (stdout, "Usage: GenCrc32 -e|-d [options] <input_file>\n\n");
|
fprintf (stdout, "Usage: GenCrc32 -e|-d [options] <input_file>\n\n");
|
||||||
|
|
||||||
//
|
//
|
||||||
// Copyright declaration
|
// Copyright declaration
|
||||||
//
|
//
|
||||||
fprintf (stdout, "Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.\n\n");
|
fprintf (stdout, "Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.\n\n");
|
||||||
|
|
||||||
//
|
//
|
||||||
// Details Option
|
// Details Option
|
||||||
@@ -100,7 +100,7 @@ Returns:
|
|||||||
fprintf (stdout, " -o OUTPUT_FILENAME, --output OUTPUT_FILENAME\n\
|
fprintf (stdout, " -o OUTPUT_FILENAME, --output OUTPUT_FILENAME\n\
|
||||||
Output file name\n");
|
Output file name\n");
|
||||||
fprintf (stdout, " --sfo Reserved for future use\n");
|
fprintf (stdout, " --sfo Reserved for future use\n");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
@@ -135,7 +135,7 @@ Returns:
|
|||||||
UINT32 Crc32Value;
|
UINT32 Crc32Value;
|
||||||
FILE *InFile;
|
FILE *InFile;
|
||||||
FILE *OutFile;
|
FILE *OutFile;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Init local variables
|
// Init local variables
|
||||||
//
|
//
|
||||||
@@ -165,12 +165,12 @@ Returns:
|
|||||||
|
|
||||||
if ((stricmp (argv[0], "-h") == 0) || (stricmp (argv[0], "--help") == 0)) {
|
if ((stricmp (argv[0], "-h") == 0) || (stricmp (argv[0], "--help") == 0)) {
|
||||||
Usage ();
|
Usage ();
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stricmp (argv[0], "--version") == 0) {
|
if (stricmp (argv[0], "--version") == 0) {
|
||||||
Version ();
|
Version ();
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (argc > 0) {
|
while (argc > 0) {
|
||||||
@@ -182,21 +182,21 @@ Returns:
|
|||||||
OutputFileName = argv[1];
|
OutputFileName = argv[1];
|
||||||
argc -= 2;
|
argc -= 2;
|
||||||
argv += 2;
|
argv += 2;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((stricmp (argv[0], "-e") == 0) || (stricmp (argv[0], "--encode") == 0)) {
|
if ((stricmp (argv[0], "-e") == 0) || (stricmp (argv[0], "--encode") == 0)) {
|
||||||
FileAction = CRC32_ENCODE;
|
FileAction = CRC32_ENCODE;
|
||||||
argc --;
|
argc --;
|
||||||
argv ++;
|
argv ++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((stricmp (argv[0], "-d") == 0) || (stricmp (argv[0], "--decode") == 0)) {
|
if ((stricmp (argv[0], "-d") == 0) || (stricmp (argv[0], "--decode") == 0)) {
|
||||||
FileAction = CRC32_DECODE;
|
FileAction = CRC32_DECODE;
|
||||||
argc --;
|
argc --;
|
||||||
argv ++;
|
argv ++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((stricmp (argv[0], "-v") == 0) || (stricmp (argv[0], "--verbose") == 0)) {
|
if ((stricmp (argv[0], "-v") == 0) || (stricmp (argv[0], "--verbose") == 0)) {
|
||||||
@@ -246,7 +246,7 @@ Returns:
|
|||||||
}
|
}
|
||||||
|
|
||||||
VerboseMsg ("%s tool start.", UTILITY_NAME);
|
VerboseMsg ("%s tool start.", UTILITY_NAME);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Check Input parameters
|
// Check Input parameters
|
||||||
//
|
//
|
||||||
@@ -258,7 +258,7 @@ Returns:
|
|||||||
} else if (FileAction == CRC32_DECODE) {
|
} else if (FileAction == CRC32_DECODE) {
|
||||||
VerboseMsg ("File will be decoded by Crc32");
|
VerboseMsg ("File will be decoded by Crc32");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (InputFileName == NULL) {
|
if (InputFileName == NULL) {
|
||||||
Error (NULL, 0, 1001, "Missing option", "Input files are not specified");
|
Error (NULL, 0, 1001, "Missing option", "Input files are not specified");
|
||||||
goto Finish;
|
goto Finish;
|
||||||
@@ -272,7 +272,7 @@ Returns:
|
|||||||
} else {
|
} else {
|
||||||
VerboseMsg ("Output file name is %s", OutputFileName);
|
VerboseMsg ("Output file name is %s", OutputFileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Open Input file and read file data.
|
// Open Input file and read file data.
|
||||||
//
|
//
|
||||||
@@ -285,18 +285,18 @@ Returns:
|
|||||||
fseek (InFile, 0, SEEK_END);
|
fseek (InFile, 0, SEEK_END);
|
||||||
FileSize = ftell (InFile);
|
FileSize = ftell (InFile);
|
||||||
fseek (InFile, 0, SEEK_SET);
|
fseek (InFile, 0, SEEK_SET);
|
||||||
|
|
||||||
FileBuffer = (UINT8 *) malloc (FileSize);
|
FileBuffer = (UINT8 *) malloc (FileSize);
|
||||||
if (FileBuffer == NULL) {
|
if (FileBuffer == NULL) {
|
||||||
Error (NULL, 0, 4001, "Resource", "memory cannot be allcoated!");
|
Error (NULL, 0, 4001, "Resource", "memory cannot be allcoated!");
|
||||||
fclose (InFile);
|
fclose (InFile);
|
||||||
goto Finish;
|
goto Finish;
|
||||||
}
|
}
|
||||||
|
|
||||||
fread (FileBuffer, 1, FileSize, InFile);
|
fread (FileBuffer, 1, FileSize, InFile);
|
||||||
fclose (InFile);
|
fclose (InFile);
|
||||||
VerboseMsg ("the size of the input file is %u bytes", (unsigned) FileSize);
|
VerboseMsg ("the size of the input file is %u bytes", (unsigned) FileSize);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Open output file
|
// Open output file
|
||||||
//
|
//
|
||||||
@@ -305,7 +305,7 @@ Returns:
|
|||||||
Error (NULL, 0, 0001, "Error opening file", OutputFileName);
|
Error (NULL, 0, 0001, "Error opening file", OutputFileName);
|
||||||
goto Finish;
|
goto Finish;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Calculate Crc32 value
|
// Calculate Crc32 value
|
||||||
//
|
//
|
||||||
@@ -352,16 +352,16 @@ Finish:
|
|||||||
if (FileBuffer != NULL) {
|
if (FileBuffer != NULL) {
|
||||||
free (FileBuffer);
|
free (FileBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (OutFile != NULL) {
|
if (OutFile != NULL) {
|
||||||
fclose (OutFile);
|
fclose (OutFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
VerboseMsg ("%s tool done with return code is 0x%x.", UTILITY_NAME, GetUtilityStatus ());
|
VerboseMsg ("%s tool done with return code is 0x%x.", UTILITY_NAME, GetUtilityStatus ());
|
||||||
|
|
||||||
return GetUtilityStatus ();
|
return GetUtilityStatus ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1,14 +1,14 @@
|
|||||||
/** @file
|
/** @file
|
||||||
This file contains functions required to generate a Firmware File System file.
|
This file contains functions required to generate a Firmware File System file.
|
||||||
|
|
||||||
Copyright (c) 2004 - 2017, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
http://opensource.org/licenses/bsd-license.php
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
@@ -76,7 +76,7 @@ STATIC EFI_GUID mZeroGuid = {0};
|
|||||||
STATIC EFI_GUID mEfiFfsSectionAlignmentPaddingGuid = EFI_FFS_SECTION_ALIGNMENT_PADDING_GUID;
|
STATIC EFI_GUID mEfiFfsSectionAlignmentPaddingGuid = EFI_FFS_SECTION_ALIGNMENT_PADDING_GUID;
|
||||||
|
|
||||||
STATIC
|
STATIC
|
||||||
VOID
|
VOID
|
||||||
Version (
|
Version (
|
||||||
VOID
|
VOID
|
||||||
)
|
)
|
||||||
@@ -89,12 +89,12 @@ Routine Description:
|
|||||||
Arguments:
|
Arguments:
|
||||||
|
|
||||||
None
|
None
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
|
|
||||||
None
|
None
|
||||||
|
|
||||||
--*/
|
--*/
|
||||||
{
|
{
|
||||||
fprintf (stdout, "%s Version %d.%d %s \n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION, __BUILD_VERSION);
|
fprintf (stdout, "%s Version %d.%d %s \n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION, __BUILD_VERSION);
|
||||||
}
|
}
|
||||||
@@ -124,11 +124,11 @@ Returns:
|
|||||||
// Summary usage
|
// Summary usage
|
||||||
//
|
//
|
||||||
fprintf (stdout, "\nUsage: %s [options]\n\n", UTILITY_NAME);
|
fprintf (stdout, "\nUsage: %s [options]\n\n", UTILITY_NAME);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Copyright declaration
|
// Copyright declaration
|
||||||
//
|
//
|
||||||
fprintf (stdout, "Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.\n\n");
|
fprintf (stdout, "Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.\n\n");
|
||||||
|
|
||||||
//
|
//
|
||||||
// Details Option
|
// Details Option
|
||||||
@@ -236,7 +236,7 @@ Returns:
|
|||||||
--*/
|
--*/
|
||||||
{
|
{
|
||||||
UINT8 Index = 0;
|
UINT8 Index = 0;
|
||||||
|
|
||||||
if (String == NULL) {
|
if (String == NULL) {
|
||||||
return EFI_FV_FILETYPE_ALL;
|
return EFI_FV_FILETYPE_ALL;
|
||||||
}
|
}
|
||||||
@@ -262,31 +262,31 @@ GetSectionContents (
|
|||||||
OUT UINT8 *PESectionNum
|
OUT UINT8 *PESectionNum
|
||||||
)
|
)
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
|
|
||||||
Get the contents of all section files specified in InputFileName
|
Get the contents of all section files specified in InputFileName
|
||||||
into FileBuffer.
|
into FileBuffer.
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
|
|
||||||
InputFileName - Name of the input file.
|
InputFileName - Name of the input file.
|
||||||
|
|
||||||
InputFileAlign - Alignment required by the input file data.
|
InputFileAlign - Alignment required by the input file data.
|
||||||
|
|
||||||
InputFileNum - Number of input files. Should be at least 1.
|
InputFileNum - Number of input files. Should be at least 1.
|
||||||
|
|
||||||
FileBuffer - Output buffer to contain data
|
FileBuffer - Output buffer to contain data
|
||||||
|
|
||||||
BufferLength - On input, this is size of the FileBuffer.
|
BufferLength - On input, this is size of the FileBuffer.
|
||||||
On output, this is the actual length of the data.
|
On output, this is the actual length of the data.
|
||||||
|
|
||||||
MaxAlignment - The max alignment required by all the input file datas.
|
MaxAlignment - The max alignment required by all the input file datas.
|
||||||
|
|
||||||
PeSectionNum - Calculate the number of Pe/Te Section in this FFS file.
|
PeSectionNum - Calculate the number of Pe/Te Section in this FFS file.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
|
|
||||||
EFI_SUCCESS on successful return
|
EFI_SUCCESS on successful return
|
||||||
EFI_INVALID_PARAMETER if InputFileNum is less than 1 or BufferLength point is NULL.
|
EFI_INVALID_PARAMETER if InputFileNum is less than 1 or BufferLength point is NULL.
|
||||||
EFI_ABORTED if unable to open input file.
|
EFI_ABORTED if unable to open input file.
|
||||||
@@ -323,8 +323,8 @@ Returns:
|
|||||||
while ((Size & 0x03) != 0) {
|
while ((Size & 0x03) != 0) {
|
||||||
Size++;
|
Size++;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Open file and read contents
|
// Open file and read contents
|
||||||
//
|
//
|
||||||
InFile = fopen (LongFilePath (InputFileName[Index]), "rb");
|
InFile = fopen (LongFilePath (InputFileName[Index]), "rb");
|
||||||
@@ -336,8 +336,8 @@ Returns:
|
|||||||
fseek (InFile, 0, SEEK_END);
|
fseek (InFile, 0, SEEK_END);
|
||||||
FileSize = ftell (InFile);
|
FileSize = ftell (InFile);
|
||||||
fseek (InFile, 0, SEEK_SET);
|
fseek (InFile, 0, SEEK_SET);
|
||||||
DebugMsg (NULL, 0, 9, "Input section files",
|
DebugMsg (NULL, 0, 9, "Input section files",
|
||||||
"the input section name is %s and the size is %u bytes", InputFileName[Index], (unsigned) FileSize);
|
"the input section name is %s and the size is %u bytes", InputFileName[Index], (unsigned) FileSize);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Check this section is Te/Pe section, and Calculate the numbers of Te/Pe section.
|
// Check this section is Te/Pe section, and Calculate the numbers of Te/Pe section.
|
||||||
@@ -371,10 +371,10 @@ Returns:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
(*PESectionNum) ++;
|
(*PESectionNum) ++;
|
||||||
} else if (TempSectHeader.Type == EFI_SECTION_COMPRESSION ||
|
} else if (TempSectHeader.Type == EFI_SECTION_COMPRESSION ||
|
||||||
TempSectHeader.Type == EFI_SECTION_FIRMWARE_VOLUME_IMAGE) {
|
TempSectHeader.Type == EFI_SECTION_FIRMWARE_VOLUME_IMAGE) {
|
||||||
//
|
//
|
||||||
// for the encapsulated section, assume it contains Pe/Te section
|
// for the encapsulated section, assume it contains Pe/Te section
|
||||||
//
|
//
|
||||||
(*PESectionNum) ++;
|
(*PESectionNum) ++;
|
||||||
}
|
}
|
||||||
@@ -398,7 +398,7 @@ Returns:
|
|||||||
if ((InputFileAlign [Index] != 0) && (((Size + HeaderSize + TeOffset) % InputFileAlign [Index]) != 0)) {
|
if ((InputFileAlign [Index] != 0) && (((Size + HeaderSize + TeOffset) % InputFileAlign [Index]) != 0)) {
|
||||||
Offset = (Size + sizeof (EFI_COMMON_SECTION_HEADER) + HeaderSize + TeOffset + InputFileAlign [Index] - 1) & ~(InputFileAlign [Index] - 1);
|
Offset = (Size + sizeof (EFI_COMMON_SECTION_HEADER) + HeaderSize + TeOffset + InputFileAlign [Index] - 1) & ~(InputFileAlign [Index] - 1);
|
||||||
Offset = Offset - Size - HeaderSize - TeOffset;
|
Offset = Offset - Size - HeaderSize - TeOffset;
|
||||||
|
|
||||||
if (FileBuffer != NULL && ((Size + Offset) < *BufferLength)) {
|
if (FileBuffer != NULL && ((Size + Offset) < *BufferLength)) {
|
||||||
//
|
//
|
||||||
// The maximal alignment is 64K, the raw section size must be less than 0xffffff
|
// The maximal alignment is 64K, the raw section size must be less than 0xffffff
|
||||||
@@ -425,7 +425,7 @@ Returns:
|
|||||||
SectHeader->CommonHeader.Type = EFI_SECTION_RAW;
|
SectHeader->CommonHeader.Type = EFI_SECTION_RAW;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
DebugMsg (NULL, 0, 9, "Pad raw section for section data alignment",
|
DebugMsg (NULL, 0, 9, "Pad raw section for section data alignment",
|
||||||
"Pad Raw section size is %u", (unsigned) Offset);
|
"Pad Raw section size is %u", (unsigned) Offset);
|
||||||
|
|
||||||
Size = Size + Offset;
|
Size = Size + Offset;
|
||||||
@@ -612,13 +612,13 @@ Returns:
|
|||||||
// unsigned 32-bit integer plus the size unit character.
|
// unsigned 32-bit integer plus the size unit character.
|
||||||
//
|
//
|
||||||
CHAR8 AlignmentBuffer[16];
|
CHAR8 AlignmentBuffer[16];
|
||||||
|
|
||||||
//
|
//
|
||||||
// Init local variables
|
// Init local variables
|
||||||
//
|
//
|
||||||
LogLevel = 0;
|
LogLevel = 0;
|
||||||
Index = 0;
|
Index = 0;
|
||||||
FfsAttrib = 0;
|
FfsAttrib = 0;
|
||||||
FfsAlign = 0;
|
FfsAlign = 0;
|
||||||
FfsFiletype = EFI_FV_FILETYPE_ALL;
|
FfsFiletype = EFI_FV_FILETYPE_ALL;
|
||||||
OutputFileName = NULL;
|
OutputFileName = NULL;
|
||||||
@@ -649,12 +649,12 @@ Returns:
|
|||||||
if ((stricmp (argv[0], "-h") == 0) || (stricmp (argv[0], "--help") == 0)) {
|
if ((stricmp (argv[0], "-h") == 0) || (stricmp (argv[0], "--help") == 0)) {
|
||||||
Version ();
|
Version ();
|
||||||
Usage ();
|
Usage ();
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stricmp (argv[0], "--version") == 0) {
|
if (stricmp (argv[0], "--version") == 0) {
|
||||||
Version ();
|
Version ();
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (argc > 0) {
|
while (argc > 0) {
|
||||||
@@ -670,7 +670,7 @@ Returns:
|
|||||||
}
|
}
|
||||||
argc -= 2;
|
argc -= 2;
|
||||||
argv += 2;
|
argv += 2;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((stricmp (argv[0], "-o") == 0) || (stricmp (argv[0], "--outputfile") == 0)) {
|
if ((stricmp (argv[0], "-o") == 0) || (stricmp (argv[0], "--outputfile") == 0)) {
|
||||||
@@ -681,7 +681,7 @@ Returns:
|
|||||||
OutputFileName = argv[1];
|
OutputFileName = argv[1];
|
||||||
argc -= 2;
|
argc -= 2;
|
||||||
argv += 2;
|
argv += 2;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((stricmp (argv[0], "-g") == 0) || (stricmp (argv[0], "--fileguid") == 0)) {
|
if ((stricmp (argv[0], "-g") == 0) || (stricmp (argv[0], "--fileguid") == 0)) {
|
||||||
@@ -755,7 +755,7 @@ Returns:
|
|||||||
return STATUS_ERROR;
|
return STATUS_ERROR;
|
||||||
}
|
}
|
||||||
memset (InputFileName, 0, (MAXIMUM_INPUT_FILE_NUM * sizeof (CHAR8 *)));
|
memset (InputFileName, 0, (MAXIMUM_INPUT_FILE_NUM * sizeof (CHAR8 *)));
|
||||||
|
|
||||||
InputFileAlign = (UINT32 *) malloc (MAXIMUM_INPUT_FILE_NUM * sizeof (UINT32));
|
InputFileAlign = (UINT32 *) malloc (MAXIMUM_INPUT_FILE_NUM * sizeof (UINT32));
|
||||||
if (InputFileAlign == NULL) {
|
if (InputFileAlign == NULL) {
|
||||||
Error (NULL, 0, 4001, "Resource", "memory cannot be allocated!");
|
Error (NULL, 0, 4001, "Resource", "memory cannot be allocated!");
|
||||||
@@ -771,7 +771,7 @@ Returns:
|
|||||||
InputFileName,
|
InputFileName,
|
||||||
(InputFileNum + MAXIMUM_INPUT_FILE_NUM) * sizeof (CHAR8 *)
|
(InputFileNum + MAXIMUM_INPUT_FILE_NUM) * sizeof (CHAR8 *)
|
||||||
);
|
);
|
||||||
|
|
||||||
if (InputFileName == NULL) {
|
if (InputFileName == NULL) {
|
||||||
Error (NULL, 0, 4001, "Resource", "memory cannot be allocated!");
|
Error (NULL, 0, 4001, "Resource", "memory cannot be allocated!");
|
||||||
free (InputFileAlign);
|
free (InputFileAlign);
|
||||||
@@ -783,7 +783,7 @@ Returns:
|
|||||||
InputFileAlign,
|
InputFileAlign,
|
||||||
(InputFileNum + MAXIMUM_INPUT_FILE_NUM) * sizeof (UINT32)
|
(InputFileNum + MAXIMUM_INPUT_FILE_NUM) * sizeof (UINT32)
|
||||||
);
|
);
|
||||||
|
|
||||||
if (InputFileAlign == NULL) {
|
if (InputFileAlign == NULL) {
|
||||||
Error (NULL, 0, 4001, "Resource", "memory cannot be allocated!");
|
Error (NULL, 0, 4001, "Resource", "memory cannot be allocated!");
|
||||||
free (InputFileName);
|
free (InputFileName);
|
||||||
@@ -791,16 +791,16 @@ Returns:
|
|||||||
}
|
}
|
||||||
memset (&(InputFileAlign[InputFileNum]), 0, (MAXIMUM_INPUT_FILE_NUM * sizeof (UINT32)));
|
memset (&(InputFileAlign[InputFileNum]), 0, (MAXIMUM_INPUT_FILE_NUM * sizeof (UINT32)));
|
||||||
}
|
}
|
||||||
|
|
||||||
InputFileName[InputFileNum] = argv[1];
|
InputFileName[InputFileNum] = argv[1];
|
||||||
argc -= 2;
|
argc -= 2;
|
||||||
argv += 2;
|
argv += 2;
|
||||||
|
|
||||||
if (argc <= 0) {
|
if (argc <= 0) {
|
||||||
InputFileNum ++;
|
InputFileNum ++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Section File alignment requirement
|
// Section File alignment requirement
|
||||||
//
|
//
|
||||||
@@ -834,7 +834,7 @@ Returns:
|
|||||||
argv += 2;
|
argv += 2;
|
||||||
}
|
}
|
||||||
InputFileNum ++;
|
InputFileNum ++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((stricmp (argv[0], "-n") == 0) || (stricmp (argv[0], "--sectionalign") == 0)) {
|
if ((stricmp (argv[0], "-n") == 0) || (stricmp (argv[0], "--sectionalign") == 0)) {
|
||||||
@@ -886,25 +886,25 @@ Returns:
|
|||||||
//
|
//
|
||||||
if (FfsFiletype == EFI_FV_FILETYPE_ALL) {
|
if (FfsFiletype == EFI_FV_FILETYPE_ALL) {
|
||||||
Error (NULL, 0, 1001, "Missing option", "filetype");
|
Error (NULL, 0, 1001, "Missing option", "filetype");
|
||||||
goto Finish;
|
goto Finish;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CompareGuid (&FileGuid, &mZeroGuid) == 0) {
|
if (CompareGuid (&FileGuid, &mZeroGuid) == 0) {
|
||||||
Error (NULL, 0, 1001, "Missing option", "fileguid");
|
Error (NULL, 0, 1001, "Missing option", "fileguid");
|
||||||
goto Finish;
|
goto Finish;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (InputFileNum == 0) {
|
if (InputFileNum == 0) {
|
||||||
Error (NULL, 0, 1001, "Missing option", "Input files");
|
Error (NULL, 0, 1001, "Missing option", "Input files");
|
||||||
goto Finish;
|
goto Finish;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Output input parameter information
|
// Output input parameter information
|
||||||
//
|
//
|
||||||
VerboseMsg ("Fv File type is %s", mFfsFileType [FfsFiletype]);
|
VerboseMsg ("Fv File type is %s", mFfsFileType [FfsFiletype]);
|
||||||
VerboseMsg ("Output file name is %s", OutputFileName);
|
VerboseMsg ("Output file name is %s", OutputFileName);
|
||||||
VerboseMsg ("FFS File Guid is %08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X",
|
VerboseMsg ("FFS File Guid is %08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X",
|
||||||
(unsigned) FileGuid.Data1,
|
(unsigned) FileGuid.Data1,
|
||||||
FileGuid.Data2,
|
FileGuid.Data2,
|
||||||
FileGuid.Data3,
|
FileGuid.Data3,
|
||||||
@@ -932,10 +932,10 @@ Returns:
|
|||||||
}
|
}
|
||||||
VerboseMsg ("the %dth input section name is %s and section alignment is %u", Index, InputFileName[Index], (unsigned) InputFileAlign[Index]);
|
VerboseMsg ("the %dth input section name is %s and section alignment is %u", Index, InputFileName[Index], (unsigned) InputFileAlign[Index]);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Calculate the size of all input section files.
|
// Calculate the size of all input section files.
|
||||||
//
|
//
|
||||||
Status = GetSectionContents (
|
Status = GetSectionContents (
|
||||||
InputFileName,
|
InputFileName,
|
||||||
InputFileAlign,
|
InputFileAlign,
|
||||||
@@ -946,20 +946,20 @@ Returns:
|
|||||||
&MaxAlignment,
|
&MaxAlignment,
|
||||||
&PeSectionNum
|
&PeSectionNum
|
||||||
);
|
);
|
||||||
|
|
||||||
if ((FfsFiletype == EFI_FV_FILETYPE_SECURITY_CORE ||
|
if ((FfsFiletype == EFI_FV_FILETYPE_SECURITY_CORE ||
|
||||||
FfsFiletype == EFI_FV_FILETYPE_PEI_CORE ||
|
FfsFiletype == EFI_FV_FILETYPE_PEI_CORE ||
|
||||||
FfsFiletype == EFI_FV_FILETYPE_DXE_CORE) && (PeSectionNum != 1)) {
|
FfsFiletype == EFI_FV_FILETYPE_DXE_CORE) && (PeSectionNum != 1)) {
|
||||||
Error (NULL, 0, 2000, "Invalid parameter", "Fv File type %s must have one and only one Pe or Te section, but %u Pe/Te section are input", mFfsFileType [FfsFiletype], PeSectionNum);
|
Error (NULL, 0, 2000, "Invalid parameter", "Fv File type %s must have one and only one Pe or Te section, but %u Pe/Te section are input", mFfsFileType [FfsFiletype], PeSectionNum);
|
||||||
goto Finish;
|
goto Finish;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((FfsFiletype == EFI_FV_FILETYPE_PEIM ||
|
if ((FfsFiletype == EFI_FV_FILETYPE_PEIM ||
|
||||||
FfsFiletype == EFI_FV_FILETYPE_DRIVER ||
|
FfsFiletype == EFI_FV_FILETYPE_DRIVER ||
|
||||||
FfsFiletype == EFI_FV_FILETYPE_COMBINED_PEIM_DRIVER ||
|
FfsFiletype == EFI_FV_FILETYPE_COMBINED_PEIM_DRIVER ||
|
||||||
FfsFiletype == EFI_FV_FILETYPE_APPLICATION) && (PeSectionNum < 1)) {
|
FfsFiletype == EFI_FV_FILETYPE_APPLICATION) && (PeSectionNum < 1)) {
|
||||||
Error (NULL, 0, 2000, "Invalid parameter", "Fv File type %s must have at least one Pe or Te section, but no Pe/Te section is input", mFfsFileType [FfsFiletype]);
|
Error (NULL, 0, 2000, "Invalid parameter", "Fv File type %s must have at least one Pe or Te section, but no Pe/Te section is input", mFfsFileType [FfsFiletype]);
|
||||||
goto Finish;
|
goto Finish;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Status == EFI_BUFFER_TOO_SMALL) {
|
if (Status == EFI_BUFFER_TOO_SMALL) {
|
||||||
@@ -969,7 +969,7 @@ Returns:
|
|||||||
goto Finish;
|
goto Finish;
|
||||||
}
|
}
|
||||||
memset (FileBuffer, 0, FileSize);
|
memset (FileBuffer, 0, FileSize);
|
||||||
|
|
||||||
//
|
//
|
||||||
// read all input file contents into a buffer
|
// read all input file contents into a buffer
|
||||||
//
|
//
|
||||||
@@ -993,7 +993,7 @@ Returns:
|
|||||||
Error (NULL, 0, 4001, "Resource", "memory cannot be allocated!");
|
Error (NULL, 0, 4001, "Resource", "memory cannot be allocated!");
|
||||||
goto Finish;
|
goto Finish;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Create Ffs file header.
|
// Create Ffs file header.
|
||||||
//
|
//
|
||||||
@@ -1001,9 +1001,9 @@ Returns:
|
|||||||
memcpy (&FfsFileHeader.Name, &FileGuid, sizeof (EFI_GUID));
|
memcpy (&FfsFileHeader.Name, &FileGuid, sizeof (EFI_GUID));
|
||||||
FfsFileHeader.Type = FfsFiletype;
|
FfsFileHeader.Type = FfsFiletype;
|
||||||
//
|
//
|
||||||
// Update FFS Alignment based on the max alignment required by input section files
|
// Update FFS Alignment based on the max alignment required by input section files
|
||||||
//
|
//
|
||||||
VerboseMsg ("the max alignment of all input sections is %u", (unsigned) MaxAlignment);
|
VerboseMsg ("the max alignment of all input sections is %u", (unsigned) MaxAlignment);
|
||||||
for (Index = 0; Index < sizeof (mFfsValidAlign) / sizeof (UINT32) - 1; Index ++) {
|
for (Index = 0; Index < sizeof (mFfsValidAlign) / sizeof (UINT32) - 1; Index ++) {
|
||||||
if ((MaxAlignment > mFfsValidAlign [Index]) && (MaxAlignment <= mFfsValidAlign [Index + 1])) {
|
if ((MaxAlignment > mFfsValidAlign [Index]) && (MaxAlignment <= mFfsValidAlign [Index + 1])) {
|
||||||
break;
|
break;
|
||||||
@@ -1012,8 +1012,8 @@ Returns:
|
|||||||
if (FfsAlign < Index) {
|
if (FfsAlign < Index) {
|
||||||
FfsAlign = Index;
|
FfsAlign = Index;
|
||||||
}
|
}
|
||||||
VerboseMsg ("the alignment of the generated FFS file is %u", (unsigned) mFfsValidAlign [FfsAlign + 1]);
|
VerboseMsg ("the alignment of the generated FFS file is %u", (unsigned) mFfsValidAlign [FfsAlign + 1]);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Now FileSize includes the EFI_FFS_FILE_HEADER
|
// Now FileSize includes the EFI_FFS_FILE_HEADER
|
||||||
//
|
//
|
||||||
@@ -1056,15 +1056,15 @@ Returns:
|
|||||||
// Ffs header checksum = zero, so only need to calculate ffs body.
|
// Ffs header checksum = zero, so only need to calculate ffs body.
|
||||||
//
|
//
|
||||||
FfsFileHeader.IntegrityCheck.Checksum.File = CalculateChecksum8 (
|
FfsFileHeader.IntegrityCheck.Checksum.File = CalculateChecksum8 (
|
||||||
FileBuffer,
|
FileBuffer,
|
||||||
FileSize - HeaderSize
|
FileSize - HeaderSize
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
FfsFileHeader.IntegrityCheck.Checksum.File = FFS_FIXED_CHECKSUM;
|
FfsFileHeader.IntegrityCheck.Checksum.File = FFS_FIXED_CHECKSUM;
|
||||||
}
|
}
|
||||||
|
|
||||||
FfsFileHeader.State = EFI_FILE_HEADER_CONSTRUCTION | EFI_FILE_HEADER_VALID | EFI_FILE_DATA_VALID;
|
FfsFileHeader.State = EFI_FILE_HEADER_CONSTRUCTION | EFI_FILE_HEADER_VALID | EFI_FILE_DATA_VALID;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Open output file to write ffs data.
|
// Open output file to write ffs data.
|
||||||
//
|
//
|
||||||
|
@@ -1,17 +1,17 @@
|
|||||||
/** @file
|
/** @file
|
||||||
This contains all code necessary to build the GenFvImage.exe utility.
|
This contains all code necessary to build the GenFvImage.exe utility.
|
||||||
This utility relies heavily on the GenFvImage Lib. Definitions for both
|
This utility relies heavily on the GenFvImage Lib. Definitions for both
|
||||||
can be found in the Tiano Firmware Volume Generation Utility
|
can be found in the Tiano Firmware Volume Generation Utility
|
||||||
Specification, review draft.
|
Specification, review draft.
|
||||||
|
|
||||||
Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
http://opensource.org/licenses/bsd-license.php
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
@@ -38,7 +38,7 @@ EFI_GUID mEfiFirmwareFileSystem2Guid = EFI_FIRMWARE_FILE_SYSTEM2_GUID;
|
|||||||
EFI_GUID mEfiFirmwareFileSystem3Guid = EFI_FIRMWARE_FILE_SYSTEM3_GUID;
|
EFI_GUID mEfiFirmwareFileSystem3Guid = EFI_FIRMWARE_FILE_SYSTEM3_GUID;
|
||||||
|
|
||||||
STATIC
|
STATIC
|
||||||
VOID
|
VOID
|
||||||
Version (
|
Version (
|
||||||
VOID
|
VOID
|
||||||
)
|
)
|
||||||
@@ -62,7 +62,7 @@ Returns:
|
|||||||
}
|
}
|
||||||
|
|
||||||
STATIC
|
STATIC
|
||||||
VOID
|
VOID
|
||||||
Usage (
|
Usage (
|
||||||
VOID
|
VOID
|
||||||
)
|
)
|
||||||
@@ -86,11 +86,11 @@ Returns:
|
|||||||
// Summary usage
|
// Summary usage
|
||||||
//
|
//
|
||||||
fprintf (stdout, "\nUsage: %s [options]\n\n", UTILITY_NAME);
|
fprintf (stdout, "\nUsage: %s [options]\n\n", UTILITY_NAME);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Copyright declaration
|
// Copyright declaration
|
||||||
//
|
//
|
||||||
fprintf (stdout, "Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.\n\n");
|
fprintf (stdout, "Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.\n\n");
|
||||||
|
|
||||||
//
|
//
|
||||||
// Details Option
|
// Details Option
|
||||||
@@ -128,7 +128,7 @@ Returns:
|
|||||||
FV base address when current FV base address is set.\n");
|
FV base address when current FV base address is set.\n");
|
||||||
fprintf (stdout, " -m logfile, --map logfile\n\
|
fprintf (stdout, " -m logfile, --map logfile\n\
|
||||||
Logfile is the output fv map file name. if it is not\n\
|
Logfile is the output fv map file name. if it is not\n\
|
||||||
given, the FvName.map will be the default map file name\n");
|
given, the FvName.map will be the default map file name\n");
|
||||||
fprintf (stdout, " -g Guid, --guid Guid\n\
|
fprintf (stdout, " -g Guid, --guid Guid\n\
|
||||||
GuidValue is one specific capsule guid value\n\
|
GuidValue is one specific capsule guid value\n\
|
||||||
or fv file system guid value.\n\
|
or fv file system guid value.\n\
|
||||||
@@ -141,7 +141,7 @@ Returns:
|
|||||||
Capsule OEM Flag is an integer between 0x0000 and 0xffff\n");
|
Capsule OEM Flag is an integer between 0x0000 and 0xffff\n");
|
||||||
fprintf (stdout, " --capheadsize HeadSize\n\
|
fprintf (stdout, " --capheadsize HeadSize\n\
|
||||||
HeadSize is one HEX or DEC format value\n\
|
HeadSize is one HEX or DEC format value\n\
|
||||||
HeadSize is required by Capsule Image.\n");
|
HeadSize is required by Capsule Image.\n");
|
||||||
fprintf (stdout, " -c, --capsule Create Capsule Image.\n");
|
fprintf (stdout, " -c, --capsule Create Capsule Image.\n");
|
||||||
fprintf (stdout, " -p, --dump Dump Capsule Image header.\n");
|
fprintf (stdout, " -p, --dump Dump Capsule Image header.\n");
|
||||||
fprintf (stdout, " -v, --verbose Turn on verbose output with informational messages.\n");
|
fprintf (stdout, " -v, --verbose Turn on verbose output with informational messages.\n");
|
||||||
@@ -170,14 +170,14 @@ Arguments:
|
|||||||
FvInfFileName The name of an FV image description file or Capsule Image.
|
FvInfFileName The name of an FV image description file or Capsule Image.
|
||||||
|
|
||||||
Arguments come in pair in any order.
|
Arguments come in pair in any order.
|
||||||
-I FvInfFileName
|
-I FvInfFileName
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
|
|
||||||
EFI_SUCCESS No error conditions detected.
|
EFI_SUCCESS No error conditions detected.
|
||||||
EFI_INVALID_PARAMETER One or more of the input parameters is invalid.
|
EFI_INVALID_PARAMETER One or more of the input parameters is invalid.
|
||||||
EFI_OUT_OF_RESOURCES A resource required by the utility was unavailable.
|
EFI_OUT_OF_RESOURCES A resource required by the utility was unavailable.
|
||||||
Most commonly this will be memory allocation
|
Most commonly this will be memory allocation
|
||||||
or file creation.
|
or file creation.
|
||||||
EFI_LOAD_ERROR GenFvImage.lib could not be loaded.
|
EFI_LOAD_ERROR GenFvImage.lib could not be loaded.
|
||||||
EFI_ABORTED Error executing the GenFvImage lib.
|
EFI_ABORTED Error executing the GenFvImage lib.
|
||||||
@@ -216,7 +216,7 @@ Returns:
|
|||||||
Status = EFI_SUCCESS;
|
Status = EFI_SUCCESS;
|
||||||
|
|
||||||
SetUtilityName (UTILITY_NAME);
|
SetUtilityName (UTILITY_NAME);
|
||||||
|
|
||||||
if (argc == 1) {
|
if (argc == 1) {
|
||||||
Error (NULL, 0, 1001, "Missing options", "No input options specified.");
|
Error (NULL, 0, 1001, "Missing options", "No input options specified.");
|
||||||
Usage ();
|
Usage ();
|
||||||
@@ -227,13 +227,13 @@ Returns:
|
|||||||
// Init global data to Zero
|
// Init global data to Zero
|
||||||
//
|
//
|
||||||
memset (&mFvDataInfo, 0, sizeof (FV_INFO));
|
memset (&mFvDataInfo, 0, sizeof (FV_INFO));
|
||||||
memset (&mCapDataInfo, 0, sizeof (CAP_INFO));
|
memset (&mCapDataInfo, 0, sizeof (CAP_INFO));
|
||||||
//
|
//
|
||||||
// Set the default FvGuid
|
// Set the default FvGuid
|
||||||
//
|
//
|
||||||
memcpy (&mFvDataInfo.FvFileSystemGuid, &mEfiFirmwareFileSystem2Guid, sizeof (EFI_GUID));
|
memcpy (&mFvDataInfo.FvFileSystemGuid, &mEfiFirmwareFileSystem2Guid, sizeof (EFI_GUID));
|
||||||
mFvDataInfo.ForceRebase = -1;
|
mFvDataInfo.ForceRebase = -1;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Parse command line
|
// Parse command line
|
||||||
//
|
//
|
||||||
@@ -243,12 +243,12 @@ Returns:
|
|||||||
if ((stricmp (argv[0], "-h") == 0) || (stricmp (argv[0], "--help") == 0)) {
|
if ((stricmp (argv[0], "-h") == 0) || (stricmp (argv[0], "--help") == 0)) {
|
||||||
Version ();
|
Version ();
|
||||||
Usage ();
|
Usage ();
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stricmp (argv[0], "--version") == 0) {
|
if (stricmp (argv[0], "--version") == 0) {
|
||||||
Version ();
|
Version ();
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (argc > 0) {
|
while (argc > 0) {
|
||||||
@@ -260,7 +260,7 @@ Returns:
|
|||||||
}
|
}
|
||||||
argc -= 2;
|
argc -= 2;
|
||||||
argv += 2;
|
argv += 2;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((stricmp (argv[0], "-a") == 0) || (stricmp (argv[0], "--addrfile") == 0)) {
|
if ((stricmp (argv[0], "-a") == 0) || (stricmp (argv[0], "--addrfile") == 0)) {
|
||||||
@@ -271,7 +271,7 @@ Returns:
|
|||||||
}
|
}
|
||||||
argc -= 2;
|
argc -= 2;
|
||||||
argv += 2;
|
argv += 2;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((stricmp (argv[0], "-o") == 0) || (stricmp (argv[0], "--outputfile") == 0)) {
|
if ((stricmp (argv[0], "-o") == 0) || (stricmp (argv[0], "--outputfile") == 0)) {
|
||||||
@@ -282,54 +282,54 @@ Returns:
|
|||||||
}
|
}
|
||||||
argc -= 2;
|
argc -= 2;
|
||||||
argv += 2;
|
argv += 2;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((stricmp (argv[0], "-r") == 0) || (stricmp (argv[0], "--baseaddr") == 0)) {
|
if ((stricmp (argv[0], "-r") == 0) || (stricmp (argv[0], "--baseaddr") == 0)) {
|
||||||
Status = AsciiStringToUint64 (argv[1], FALSE, &TempNumber);
|
Status = AsciiStringToUint64 (argv[1], FALSE, &TempNumber);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
Error (NULL, 0, 1003, "Invalid option value", "%s = %s", argv[0], argv[1]);
|
Error (NULL, 0, 1003, "Invalid option value", "%s = %s", argv[0], argv[1]);
|
||||||
return STATUS_ERROR;
|
return STATUS_ERROR;
|
||||||
}
|
}
|
||||||
mFvDataInfo.BaseAddress = TempNumber;
|
mFvDataInfo.BaseAddress = TempNumber;
|
||||||
mFvDataInfo.BaseAddressSet = TRUE;
|
mFvDataInfo.BaseAddressSet = TRUE;
|
||||||
argc -= 2;
|
argc -= 2;
|
||||||
argv += 2;
|
argv += 2;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((stricmp (argv[0], "-b") == 0) || (stricmp (argv[0], "--blocksize") == 0)) {
|
if ((stricmp (argv[0], "-b") == 0) || (stricmp (argv[0], "--blocksize") == 0)) {
|
||||||
Status = AsciiStringToUint64 (argv[1], FALSE, &TempNumber);
|
Status = AsciiStringToUint64 (argv[1], FALSE, &TempNumber);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
Error (NULL, 0, 1003, "Invalid option value", "%s = %s", argv[0], argv[1]);
|
Error (NULL, 0, 1003, "Invalid option value", "%s = %s", argv[0], argv[1]);
|
||||||
return STATUS_ERROR;
|
return STATUS_ERROR;
|
||||||
}
|
}
|
||||||
if (TempNumber == 0) {
|
if (TempNumber == 0) {
|
||||||
Error (NULL, 0, 1003, "Invalid option value", "Fv block size can't be be set to zero");
|
Error (NULL, 0, 1003, "Invalid option value", "Fv block size can't be be set to zero");
|
||||||
return STATUS_ERROR;
|
return STATUS_ERROR;
|
||||||
}
|
}
|
||||||
mFvDataInfo.FvBlocks[0].Length = (UINT32) TempNumber;
|
mFvDataInfo.FvBlocks[0].Length = (UINT32) TempNumber;
|
||||||
DebugMsg (NULL, 0, 9, "FV Block Size", "%s = 0x%llx", EFI_BLOCK_SIZE_STRING, (unsigned long long) TempNumber);
|
DebugMsg (NULL, 0, 9, "FV Block Size", "%s = 0x%llx", EFI_BLOCK_SIZE_STRING, (unsigned long long) TempNumber);
|
||||||
argc -= 2;
|
argc -= 2;
|
||||||
argv += 2;
|
argv += 2;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((stricmp (argv[0], "-n") == 0) || (stricmp (argv[0], "--numberblock") == 0)) {
|
if ((stricmp (argv[0], "-n") == 0) || (stricmp (argv[0], "--numberblock") == 0)) {
|
||||||
Status = AsciiStringToUint64 (argv[1], FALSE, &TempNumber);
|
Status = AsciiStringToUint64 (argv[1], FALSE, &TempNumber);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
Error (NULL, 0, 1003, "Invalid option value", "%s = %s", argv[0], argv[1]);
|
Error (NULL, 0, 1003, "Invalid option value", "%s = %s", argv[0], argv[1]);
|
||||||
return STATUS_ERROR;
|
return STATUS_ERROR;
|
||||||
}
|
}
|
||||||
if (TempNumber == 0) {
|
if (TempNumber == 0) {
|
||||||
Error (NULL, 0, 1003, "Invalid option value", "Fv block number can't be set to zero");
|
Error (NULL, 0, 1003, "Invalid option value", "Fv block number can't be set to zero");
|
||||||
return STATUS_ERROR;
|
return STATUS_ERROR;
|
||||||
}
|
}
|
||||||
mFvDataInfo.FvBlocks[0].NumBlocks = (UINT32) TempNumber;
|
mFvDataInfo.FvBlocks[0].NumBlocks = (UINT32) TempNumber;
|
||||||
DebugMsg (NULL, 0, 9, "FV Number Block", "%s = 0x%llx", EFI_NUM_BLOCKS_STRING, (unsigned long long) TempNumber);
|
DebugMsg (NULL, 0, 9, "FV Number Block", "%s = 0x%llx", EFI_NUM_BLOCKS_STRING, (unsigned long long) TempNumber);
|
||||||
argc -= 2;
|
argc -= 2;
|
||||||
argv += 2;
|
argv += 2;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((strcmp (argv[0], "-f") == 0) || (stricmp (argv[0], "--ffsfile") == 0)) {
|
if ((strcmp (argv[0], "-f") == 0) || (stricmp (argv[0], "--ffsfile") == 0)) {
|
||||||
@@ -348,38 +348,38 @@ Returns:
|
|||||||
argv += 2;
|
argv += 2;
|
||||||
|
|
||||||
if (argc > 0) {
|
if (argc > 0) {
|
||||||
if ((stricmp (argv[0], "-s") == 0) || (stricmp (argv[0], "--filetakensize") == 0)) {
|
if ((stricmp (argv[0], "-s") == 0) || (stricmp (argv[0], "--filetakensize") == 0)) {
|
||||||
if (argv[1] == NULL) {
|
if (argv[1] == NULL) {
|
||||||
Error (NULL, 0, 1003, "Invalid option value", "Ffsfile Size can't be null");
|
Error (NULL, 0, 1003, "Invalid option value", "Ffsfile Size can't be null");
|
||||||
return STATUS_ERROR;
|
return STATUS_ERROR;
|
||||||
}
|
}
|
||||||
Status = AsciiStringToUint64 (argv[1], FALSE, &TempNumber);
|
Status = AsciiStringToUint64 (argv[1], FALSE, &TempNumber);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
Error (NULL, 0, 1003, "Invalid option value", "%s = %s", argv[0], argv[1]);
|
Error (NULL, 0, 1003, "Invalid option value", "%s = %s", argv[0], argv[1]);
|
||||||
return STATUS_ERROR;
|
return STATUS_ERROR;
|
||||||
}
|
}
|
||||||
mFvDataInfo.SizeofFvFiles[Index] = (UINT32) TempNumber;
|
mFvDataInfo.SizeofFvFiles[Index] = (UINT32) TempNumber;
|
||||||
DebugMsg (NULL, 0, 9, "FV component file size", "the %uth size is %s", (unsigned) Index + 1, argv[1]);
|
DebugMsg (NULL, 0, 9, "FV component file size", "the %uth size is %s", (unsigned) Index + 1, argv[1]);
|
||||||
argc -= 2;
|
argc -= 2;
|
||||||
argv += 2;
|
argv += 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Index ++;
|
Index ++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((stricmp (argv[0], "-s") == 0) || (stricmp (argv[0], "--filetakensize") == 0)) {
|
if ((stricmp (argv[0], "-s") == 0) || (stricmp (argv[0], "--filetakensize") == 0)) {
|
||||||
Error (NULL, 0, 1003, "Invalid option", "It must be specified together with -f option to specify the file size.");
|
Error (NULL, 0, 1003, "Invalid option", "It must be specified together with -f option to specify the file size.");
|
||||||
return STATUS_ERROR;
|
return STATUS_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((stricmp (argv[0], "-c") == 0) || (stricmp (argv[0], "--capsule") == 0)) {
|
if ((stricmp (argv[0], "-c") == 0) || (stricmp (argv[0], "--capsule") == 0)) {
|
||||||
CapsuleFlag = TRUE;
|
CapsuleFlag = TRUE;
|
||||||
argc --;
|
argc --;
|
||||||
argv ++;
|
argv ++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((strcmp (argv[0], "-F") == 0) || (stricmp (argv[0], "--force-rebase") == 0)) {
|
if ((strcmp (argv[0], "-F") == 0) || (stricmp (argv[0], "--force-rebase") == 0)) {
|
||||||
if (argv[1] == NULL) {
|
if (argv[1] == NULL) {
|
||||||
Error (NULL, 0, 1003, "Invalid option value", "Froce rebase flag can't be null");
|
Error (NULL, 0, 1003, "Invalid option value", "Froce rebase flag can't be null");
|
||||||
@@ -397,8 +397,8 @@ Returns:
|
|||||||
|
|
||||||
argc -= 2;
|
argc -= 2;
|
||||||
argv += 2;
|
argv += 2;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stricmp (argv[0], "--capheadsize") == 0) {
|
if (stricmp (argv[0], "--capheadsize") == 0) {
|
||||||
//
|
//
|
||||||
@@ -407,13 +407,13 @@ Returns:
|
|||||||
Status = AsciiStringToUint64 (argv[1], FALSE, &TempNumber);
|
Status = AsciiStringToUint64 (argv[1], FALSE, &TempNumber);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
Error (NULL, 0, 1003, "Invalid option value", "%s = %s", argv[0], argv[1]);
|
Error (NULL, 0, 1003, "Invalid option value", "%s = %s", argv[0], argv[1]);
|
||||||
return STATUS_ERROR;
|
return STATUS_ERROR;
|
||||||
}
|
}
|
||||||
mCapDataInfo.HeaderSize = (UINT32) TempNumber;
|
mCapDataInfo.HeaderSize = (UINT32) TempNumber;
|
||||||
DebugMsg (NULL, 0, 9, "Capsule Header size", "%s = 0x%llx", EFI_CAPSULE_HEADER_SIZE_STRING, (unsigned long long) TempNumber);
|
DebugMsg (NULL, 0, 9, "Capsule Header size", "%s = 0x%llx", EFI_CAPSULE_HEADER_SIZE_STRING, (unsigned long long) TempNumber);
|
||||||
argc -= 2;
|
argc -= 2;
|
||||||
argv += 2;
|
argv += 2;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stricmp (argv[0], "--capflag") == 0) {
|
if (stricmp (argv[0], "--capflag") == 0) {
|
||||||
@@ -437,7 +437,7 @@ Returns:
|
|||||||
DebugMsg (NULL, 0, 9, "Capsule Flag", argv[1]);
|
DebugMsg (NULL, 0, 9, "Capsule Flag", argv[1]);
|
||||||
argc -= 2;
|
argc -= 2;
|
||||||
argv += 2;
|
argv += 2;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stricmp (argv[0], "--capoemflag") == 0) {
|
if (stricmp (argv[0], "--capoemflag") == 0) {
|
||||||
@@ -468,7 +468,7 @@ Returns:
|
|||||||
DebugMsg (NULL, 0, 9, "Capsule Guid", "%s = %s", EFI_CAPSULE_GUID_STRING, argv[1]);
|
DebugMsg (NULL, 0, 9, "Capsule Guid", "%s = %s", EFI_CAPSULE_GUID_STRING, argv[1]);
|
||||||
argc -= 2;
|
argc -= 2;
|
||||||
argv += 2;
|
argv += 2;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((stricmp (argv[0], "-g") == 0) || (stricmp (argv[0], "--guid") == 0)) {
|
if ((stricmp (argv[0], "-g") == 0) || (stricmp (argv[0], "--guid") == 0)) {
|
||||||
@@ -486,7 +486,7 @@ Returns:
|
|||||||
DebugMsg (NULL, 0, 9, "FV Guid", "%s = %s", EFI_FV_FILESYSTEMGUID_STRING, argv[1]);
|
DebugMsg (NULL, 0, 9, "FV Guid", "%s = %s", EFI_FV_FILESYSTEMGUID_STRING, argv[1]);
|
||||||
argc -= 2;
|
argc -= 2;
|
||||||
argv += 2;
|
argv += 2;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stricmp (argv[0], "--FvNameGuid") == 0) {
|
if (stricmp (argv[0], "--FvNameGuid") == 0) {
|
||||||
@@ -502,14 +502,14 @@ Returns:
|
|||||||
DebugMsg (NULL, 0, 9, "FV Name Guid", "%s = %s", EFI_FV_NAMEGUID_STRING, argv[1]);
|
DebugMsg (NULL, 0, 9, "FV Name Guid", "%s = %s", EFI_FV_NAMEGUID_STRING, argv[1]);
|
||||||
argc -= 2;
|
argc -= 2;
|
||||||
argv += 2;
|
argv += 2;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((stricmp (argv[0], "-p") == 0) || (stricmp (argv[0], "--dump") == 0)) {
|
if ((stricmp (argv[0], "-p") == 0) || (stricmp (argv[0], "--dump") == 0)) {
|
||||||
DumpCapsule = TRUE;
|
DumpCapsule = TRUE;
|
||||||
argc --;
|
argc --;
|
||||||
argv ++;
|
argv ++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((stricmp (argv[0], "-m") == 0) || (stricmp (argv[0], "--map") == 0)) {
|
if ((stricmp (argv[0], "-m") == 0) || (stricmp (argv[0], "--map") == 0)) {
|
||||||
@@ -520,7 +520,7 @@ Returns:
|
|||||||
}
|
}
|
||||||
argc -= 2;
|
argc -= 2;
|
||||||
argv += 2;
|
argv += 2;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((stricmp (argv[0], "-v") == 0) || (stricmp (argv[0], "--verbose") == 0)) {
|
if ((stricmp (argv[0], "-v") == 0) || (stricmp (argv[0], "--verbose") == 0)) {
|
||||||
@@ -564,7 +564,7 @@ Returns:
|
|||||||
}
|
}
|
||||||
|
|
||||||
VerboseMsg ("%s tool start.", UTILITY_NAME);
|
VerboseMsg ("%s tool start.", UTILITY_NAME);
|
||||||
|
|
||||||
//
|
//
|
||||||
// check input parameter, InfFileName can be NULL
|
// check input parameter, InfFileName can be NULL
|
||||||
//
|
//
|
||||||
@@ -581,7 +581,7 @@ Returns:
|
|||||||
if (OutFileName != NULL) {
|
if (OutFileName != NULL) {
|
||||||
VerboseMsg ("the output file name is %s", OutFileName);
|
VerboseMsg ("the output file name is %s", OutFileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Read the INF file image
|
// Read the INF file image
|
||||||
//
|
//
|
||||||
@@ -591,7 +591,7 @@ Returns:
|
|||||||
return STATUS_ERROR;
|
return STATUS_ERROR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DumpCapsule) {
|
if (DumpCapsule) {
|
||||||
VerboseMsg ("Dump the capsule header information for the input capsule image %s", InfFileName);
|
VerboseMsg ("Dump the capsule header information for the input capsule image %s", InfFileName);
|
||||||
//
|
//
|
||||||
@@ -636,7 +636,7 @@ Returns:
|
|||||||
}
|
}
|
||||||
|
|
||||||
Status = GenerateCapImage (
|
Status = GenerateCapImage (
|
||||||
InfFileImage,
|
InfFileImage,
|
||||||
InfFileSize,
|
InfFileSize,
|
||||||
OutFileName
|
OutFileName
|
||||||
);
|
);
|
||||||
@@ -667,7 +667,7 @@ Returns:
|
|||||||
if (InfFileImage != NULL) {
|
if (InfFileImage != NULL) {
|
||||||
free (InfFileImage);
|
free (InfFileImage);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// update boot driver address and runtime driver address in address file
|
// update boot driver address and runtime driver address in address file
|
||||||
//
|
//
|
||||||
@@ -689,7 +689,7 @@ Returns:
|
|||||||
fflush (FpFile);
|
fflush (FpFile);
|
||||||
fclose (FpFile);
|
fclose (FpFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Status == EFI_SUCCESS) {
|
if (Status == EFI_SUCCESS) {
|
||||||
DebugMsg (NULL, 0, 9, "The Total Fv Size", "%s = 0x%x", EFI_FV_TOTAL_SIZE_STRING, (unsigned) mFvTotalSize);
|
DebugMsg (NULL, 0, 9, "The Total Fv Size", "%s = 0x%x", EFI_FV_TOTAL_SIZE_STRING, (unsigned) mFvTotalSize);
|
||||||
DebugMsg (NULL, 0, 9, "The used Fv Size", "%s = 0x%x", EFI_FV_TAKEN_SIZE_STRING, (unsigned) mFvTakenSize);
|
DebugMsg (NULL, 0, 9, "The used Fv Size", "%s = 0x%x", EFI_FV_TAKEN_SIZE_STRING, (unsigned) mFvTakenSize);
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -1,15 +1,15 @@
|
|||||||
/** @file
|
/** @file
|
||||||
This file contains describes the public interfaces to the GenFvImage Library.
|
This file contains describes the public interfaces to the GenFvImage Library.
|
||||||
The basic purpose of the library is to create Firmware Volume images.
|
The basic purpose of the library is to create Firmware Volume images.
|
||||||
|
|
||||||
Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
http://opensource.org/licenses/bsd-license.php
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
@@ -71,7 +71,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||||||
#define EFI_BLOCK_SIZE_STRING "EFI_BLOCK_SIZE"
|
#define EFI_BLOCK_SIZE_STRING "EFI_BLOCK_SIZE"
|
||||||
#define EFI_GUID_STRING "EFI_GUID"
|
#define EFI_GUID_STRING "EFI_GUID"
|
||||||
#define EFI_FV_FILESYSTEMGUID_STRING "EFI_FV_GUID"
|
#define EFI_FV_FILESYSTEMGUID_STRING "EFI_FV_GUID"
|
||||||
#define EFI_FV_NAMEGUID_STRING "EFI_FVNAME_GUID"
|
#define EFI_FV_NAMEGUID_STRING "EFI_FVNAME_GUID"
|
||||||
#define EFI_CAPSULE_GUID_STRING "EFI_CAPSULE_GUID"
|
#define EFI_CAPSULE_GUID_STRING "EFI_CAPSULE_GUID"
|
||||||
#define EFI_CAPSULE_HEADER_SIZE_STRING "EFI_CAPSULE_HEADER_SIZE"
|
#define EFI_CAPSULE_HEADER_SIZE_STRING "EFI_CAPSULE_HEADER_SIZE"
|
||||||
#define EFI_CAPSULE_FLAGS_STRING "EFI_CAPSULE_FLAGS"
|
#define EFI_CAPSULE_FLAGS_STRING "EFI_CAPSULE_FLAGS"
|
||||||
@@ -105,38 +105,38 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||||||
#define EFI_FVB2_WRITE_LOCK_CAP_STRING "EFI_WRITE_LOCK_CAP"
|
#define EFI_FVB2_WRITE_LOCK_CAP_STRING "EFI_WRITE_LOCK_CAP"
|
||||||
#define EFI_FVB2_WRITE_LOCK_STATUS_STRING "EFI_WRITE_LOCK_STATUS"
|
#define EFI_FVB2_WRITE_LOCK_STATUS_STRING "EFI_WRITE_LOCK_STATUS"
|
||||||
|
|
||||||
#define EFI_FVB2_ALIGNMENT_1_STRING "EFI_FVB2_ALIGNMENT_1"
|
#define EFI_FVB2_ALIGNMENT_1_STRING "EFI_FVB2_ALIGNMENT_1"
|
||||||
#define EFI_FVB2_ALIGNMENT_2_STRING "EFI_FVB2_ALIGNMENT_2"
|
#define EFI_FVB2_ALIGNMENT_2_STRING "EFI_FVB2_ALIGNMENT_2"
|
||||||
#define EFI_FVB2_ALIGNMENT_4_STRING "EFI_FVB2_ALIGNMENT_4"
|
#define EFI_FVB2_ALIGNMENT_4_STRING "EFI_FVB2_ALIGNMENT_4"
|
||||||
#define EFI_FVB2_ALIGNMENT_8_STRING "EFI_FVB2_ALIGNMENT_8"
|
#define EFI_FVB2_ALIGNMENT_8_STRING "EFI_FVB2_ALIGNMENT_8"
|
||||||
#define EFI_FVB2_ALIGNMENT_16_STRING "EFI_FVB2_ALIGNMENT_16"
|
#define EFI_FVB2_ALIGNMENT_16_STRING "EFI_FVB2_ALIGNMENT_16"
|
||||||
#define EFI_FVB2_ALIGNMENT_32_STRING "EFI_FVB2_ALIGNMENT_32"
|
#define EFI_FVB2_ALIGNMENT_32_STRING "EFI_FVB2_ALIGNMENT_32"
|
||||||
#define EFI_FVB2_ALIGNMENT_64_STRING "EFI_FVB2_ALIGNMENT_64"
|
#define EFI_FVB2_ALIGNMENT_64_STRING "EFI_FVB2_ALIGNMENT_64"
|
||||||
#define EFI_FVB2_ALIGNMENT_128_STRING "EFI_FVB2_ALIGNMENT_128"
|
#define EFI_FVB2_ALIGNMENT_128_STRING "EFI_FVB2_ALIGNMENT_128"
|
||||||
#define EFI_FVB2_ALIGNMENT_256_STRING "EFI_FVB2_ALIGNMENT_256"
|
#define EFI_FVB2_ALIGNMENT_256_STRING "EFI_FVB2_ALIGNMENT_256"
|
||||||
#define EFI_FVB2_ALIGNMENT_512_STRING "EFI_FVB2_ALIGNMENT_512"
|
#define EFI_FVB2_ALIGNMENT_512_STRING "EFI_FVB2_ALIGNMENT_512"
|
||||||
#define EFI_FVB2_ALIGNMENT_1K_STRING "EFI_FVB2_ALIGNMENT_1K"
|
#define EFI_FVB2_ALIGNMENT_1K_STRING "EFI_FVB2_ALIGNMENT_1K"
|
||||||
#define EFI_FVB2_ALIGNMENT_2K_STRING "EFI_FVB2_ALIGNMENT_2K"
|
#define EFI_FVB2_ALIGNMENT_2K_STRING "EFI_FVB2_ALIGNMENT_2K"
|
||||||
#define EFI_FVB2_ALIGNMENT_4K_STRING "EFI_FVB2_ALIGNMENT_4K"
|
#define EFI_FVB2_ALIGNMENT_4K_STRING "EFI_FVB2_ALIGNMENT_4K"
|
||||||
#define EFI_FVB2_ALIGNMENT_8K_STRING "EFI_FVB2_ALIGNMENT_8K"
|
#define EFI_FVB2_ALIGNMENT_8K_STRING "EFI_FVB2_ALIGNMENT_8K"
|
||||||
#define EFI_FVB2_ALIGNMENT_16K_STRING "EFI_FVB2_ALIGNMENT_16K"
|
#define EFI_FVB2_ALIGNMENT_16K_STRING "EFI_FVB2_ALIGNMENT_16K"
|
||||||
#define EFI_FVB2_ALIGNMENT_32K_STRING "EFI_FVB2_ALIGNMENT_32K"
|
#define EFI_FVB2_ALIGNMENT_32K_STRING "EFI_FVB2_ALIGNMENT_32K"
|
||||||
#define EFI_FVB2_ALIGNMENT_64K_STRING "EFI_FVB2_ALIGNMENT_64K"
|
#define EFI_FVB2_ALIGNMENT_64K_STRING "EFI_FVB2_ALIGNMENT_64K"
|
||||||
#define EFI_FVB2_ALIGNMENT_128K_STRING "EFI_FVB2_ALIGNMENT_128K"
|
#define EFI_FVB2_ALIGNMENT_128K_STRING "EFI_FVB2_ALIGNMENT_128K"
|
||||||
#define EFI_FVB2_ALIGNMENT_256K_STRING "EFI_FVB2_ALIGNMENT_256K"
|
#define EFI_FVB2_ALIGNMENT_256K_STRING "EFI_FVB2_ALIGNMENT_256K"
|
||||||
#define EFI_FVB2_ALIGNMENT_512K_STRING "EFI_FVB2_ALIGNMENT_512K"
|
#define EFI_FVB2_ALIGNMENT_512K_STRING "EFI_FVB2_ALIGNMENT_512K"
|
||||||
#define EFI_FVB2_ALIGNMENT_1M_STRING "EFI_FVB2_ALIGNMENT_1M"
|
#define EFI_FVB2_ALIGNMENT_1M_STRING "EFI_FVB2_ALIGNMENT_1M"
|
||||||
#define EFI_FVB2_ALIGNMENT_2M_STRING "EFI_FVB2_ALIGNMENT_2M"
|
#define EFI_FVB2_ALIGNMENT_2M_STRING "EFI_FVB2_ALIGNMENT_2M"
|
||||||
#define EFI_FVB2_ALIGNMENT_4M_STRING "EFI_FVB2_ALIGNMENT_4M"
|
#define EFI_FVB2_ALIGNMENT_4M_STRING "EFI_FVB2_ALIGNMENT_4M"
|
||||||
#define EFI_FVB2_ALIGNMENT_8M_STRING "EFI_FVB2_ALIGNMENT_8M"
|
#define EFI_FVB2_ALIGNMENT_8M_STRING "EFI_FVB2_ALIGNMENT_8M"
|
||||||
#define EFI_FVB2_ALIGNMENT_16M_STRING "EFI_FVB2_ALIGNMENT_16M"
|
#define EFI_FVB2_ALIGNMENT_16M_STRING "EFI_FVB2_ALIGNMENT_16M"
|
||||||
#define EFI_FVB2_ALIGNMENT_32M_STRING "EFI_FVB2_ALIGNMENT_32M"
|
#define EFI_FVB2_ALIGNMENT_32M_STRING "EFI_FVB2_ALIGNMENT_32M"
|
||||||
#define EFI_FVB2_ALIGNMENT_64M_STRING "EFI_FVB2_ALIGNMENT_64M"
|
#define EFI_FVB2_ALIGNMENT_64M_STRING "EFI_FVB2_ALIGNMENT_64M"
|
||||||
#define EFI_FVB2_ALIGNMENT_128M_STRING "EFI_FVB2_ALIGNMENT_128M"
|
#define EFI_FVB2_ALIGNMENT_128M_STRING "EFI_FVB2_ALIGNMENT_128M"
|
||||||
#define EFI_FVB2_ALIGNMENT_256M_STRING "EFI_FVB2_ALIGNMENT_256M"
|
#define EFI_FVB2_ALIGNMENT_256M_STRING "EFI_FVB2_ALIGNMENT_256M"
|
||||||
#define EFI_FVB2_ALIGNMENT_512M_STRING "EFI_FVB2_ALIGNMENT_512M"
|
#define EFI_FVB2_ALIGNMENT_512M_STRING "EFI_FVB2_ALIGNMENT_512M"
|
||||||
#define EFI_FVB2_ALIGNMENT_1G_STRING "EFI_FVB2_ALIGNMENT_1G"
|
#define EFI_FVB2_ALIGNMENT_1G_STRING "EFI_FVB2_ALIGNMENT_1G"
|
||||||
#define EFI_FVB2_ALIGNMENT_2G_STRING "EFI_FVB2_ALIGNMENT_2G"
|
#define EFI_FVB2_ALIGNMENT_2G_STRING "EFI_FVB2_ALIGNMENT_2G"
|
||||||
|
|
||||||
#define EFI_FV_WEAK_ALIGNMENT_STRING "EFI_WEAK_ALIGNMENT"
|
#define EFI_FV_WEAK_ALIGNMENT_STRING "EFI_WEAK_ALIGNMENT"
|
||||||
|
|
||||||
@@ -336,7 +336,7 @@ EFI_STATUS
|
|||||||
FindApResetVectorPosition (
|
FindApResetVectorPosition (
|
||||||
IN MEMORY_FILE *FvImage,
|
IN MEMORY_FILE *FvImage,
|
||||||
OUT UINT8 **Pointer
|
OUT UINT8 **Pointer
|
||||||
);
|
);
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
CalculateFvSize (
|
CalculateFvSize (
|
||||||
@@ -344,9 +344,9 @@ CalculateFvSize (
|
|||||||
);
|
);
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
FfsRebase (
|
FfsRebase (
|
||||||
IN OUT FV_INFO *FvInfo,
|
IN OUT FV_INFO *FvInfo,
|
||||||
IN CHAR8 *FileName,
|
IN CHAR8 *FileName,
|
||||||
IN OUT EFI_FFS_FILE_HEADER *FfsFile,
|
IN OUT EFI_FFS_FILE_HEADER *FfsFile,
|
||||||
IN UINTN XipOffset,
|
IN UINTN XipOffset,
|
||||||
IN FILE *FvMapFile
|
IN FILE *FvMapFile
|
||||||
@@ -365,7 +365,7 @@ GenerateCapImage (
|
|||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
|
|
||||||
This is the main function which will be called from application to
|
This is the main function which will be called from application to
|
||||||
generate UEFI Capsule image.
|
generate UEFI Capsule image.
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
@@ -388,14 +388,14 @@ EFI_STATUS
|
|||||||
GenerateFvImage (
|
GenerateFvImage (
|
||||||
IN CHAR8 *InfFileImage,
|
IN CHAR8 *InfFileImage,
|
||||||
IN UINTN InfFileSize,
|
IN UINTN InfFileSize,
|
||||||
IN CHAR8 *FvFileName,
|
IN CHAR8 *FvFileName,
|
||||||
IN CHAR8 *MapFileName
|
IN CHAR8 *MapFileName
|
||||||
)
|
)
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
|
|
||||||
This is the main function which will be called from application to
|
This is the main function which will be called from application to
|
||||||
generate Firmware Image conforms to PI spec.
|
generate Firmware Image conforms to PI spec.
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
@@ -404,9 +404,9 @@ Arguments:
|
|||||||
InfFileSize Size of the contents of the InfFileImage buffer.
|
InfFileSize Size of the contents of the InfFileImage buffer.
|
||||||
FvFileName Requested name for the FV file.
|
FvFileName Requested name for the FV file.
|
||||||
MapFileName Fv map file to log fv driver information.
|
MapFileName Fv map file to log fv driver information.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
|
|
||||||
EFI_SUCCESS Function completed successfully.
|
EFI_SUCCESS Function completed successfully.
|
||||||
EFI_OUT_OF_RESOURCES Could not allocate required resources.
|
EFI_OUT_OF_RESOURCES Could not allocate required resources.
|
||||||
EFI_ABORTED Error encountered.
|
EFI_ABORTED Error encountered.
|
||||||
|
@@ -130,7 +130,7 @@ InitializeElf32 (
|
|||||||
//
|
//
|
||||||
// Initialize data pointer and structures.
|
// Initialize data pointer and structures.
|
||||||
//
|
//
|
||||||
mEhdr = (Elf_Ehdr*) FileBuffer;
|
mEhdr = (Elf_Ehdr*) FileBuffer;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Check the ELF32 specific header information.
|
// Check the ELF32 specific header information.
|
||||||
@@ -142,12 +142,12 @@ InitializeElf32 (
|
|||||||
if (mEhdr->e_ident[EI_DATA] != ELFDATA2LSB) {
|
if (mEhdr->e_ident[EI_DATA] != ELFDATA2LSB) {
|
||||||
Error (NULL, 0, 3000, "Unsupported", "ELF EI_DATA not ELFDATA2LSB");
|
Error (NULL, 0, 3000, "Unsupported", "ELF EI_DATA not ELFDATA2LSB");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
if ((mEhdr->e_type != ET_EXEC) && (mEhdr->e_type != ET_DYN)) {
|
if ((mEhdr->e_type != ET_EXEC) && (mEhdr->e_type != ET_DYN)) {
|
||||||
Error (NULL, 0, 3000, "Unsupported", "ELF e_type not ET_EXEC or ET_DYN");
|
Error (NULL, 0, 3000, "Unsupported", "ELF e_type not ET_EXEC or ET_DYN");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
if (!((mEhdr->e_machine == EM_386) || (mEhdr->e_machine == EM_ARM))) {
|
if (!((mEhdr->e_machine == EM_386) || (mEhdr->e_machine == EM_ARM))) {
|
||||||
Error (NULL, 0, 3000, "Unsupported", "ELF e_machine not EM_386 or EM_ARM");
|
Error (NULL, 0, 3000, "Unsupported", "ELF e_machine not EM_386 or EM_ARM");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@@ -155,13 +155,13 @@ InitializeElf32 (
|
|||||||
Error (NULL, 0, 3000, "Unsupported", "ELF e_version (%u) not EV_CURRENT (%d)", (unsigned) mEhdr->e_version, EV_CURRENT);
|
Error (NULL, 0, 3000, "Unsupported", "ELF e_version (%u) not EV_CURRENT (%d)", (unsigned) mEhdr->e_version, EV_CURRENT);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Update section header pointers
|
// Update section header pointers
|
||||||
//
|
//
|
||||||
mShdrBase = (Elf_Shdr *)((UINT8 *)mEhdr + mEhdr->e_shoff);
|
mShdrBase = (Elf_Shdr *)((UINT8 *)mEhdr + mEhdr->e_shoff);
|
||||||
mPhdrBase = (Elf_Phdr *)((UINT8 *)mEhdr + mEhdr->e_phoff);
|
mPhdrBase = (Elf_Phdr *)((UINT8 *)mEhdr + mEhdr->e_phoff);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Create COFF Section offset buffer and zero.
|
// Create COFF Section offset buffer and zero.
|
||||||
//
|
//
|
||||||
@@ -707,20 +707,20 @@ WriteSections32 (
|
|||||||
if ((RelShdr->sh_type != SHT_REL) && (RelShdr->sh_type != SHT_RELA)) {
|
if ((RelShdr->sh_type != SHT_REL) && (RelShdr->sh_type != SHT_RELA)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Relocation section found. Now extract section information that the relocations
|
// Relocation section found. Now extract section information that the relocations
|
||||||
// apply to in the ELF data and the new COFF data.
|
// apply to in the ELF data and the new COFF data.
|
||||||
//
|
//
|
||||||
SecShdr = GetShdrByIndex(RelShdr->sh_info);
|
SecShdr = GetShdrByIndex(RelShdr->sh_info);
|
||||||
SecOffset = mCoffSectionsOffset[RelShdr->sh_info];
|
SecOffset = mCoffSectionsOffset[RelShdr->sh_info];
|
||||||
|
|
||||||
//
|
//
|
||||||
// Only process relocations for the current filter type.
|
// Only process relocations for the current filter type.
|
||||||
//
|
//
|
||||||
if (RelShdr->sh_type == SHT_REL && (*Filter)(SecShdr)) {
|
if (RelShdr->sh_type == SHT_REL && (*Filter)(SecShdr)) {
|
||||||
UINT32 RelOffset;
|
UINT32 RelOffset;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Determine the symbol table referenced by the relocation data.
|
// Determine the symbol table referenced by the relocation data.
|
||||||
//
|
//
|
||||||
@@ -735,18 +735,18 @@ WriteSections32 (
|
|||||||
// Set pointer to relocation entry
|
// Set pointer to relocation entry
|
||||||
//
|
//
|
||||||
Elf_Rel *Rel = (Elf_Rel *)((UINT8*)mEhdr + RelShdr->sh_offset + RelOffset);
|
Elf_Rel *Rel = (Elf_Rel *)((UINT8*)mEhdr + RelShdr->sh_offset + RelOffset);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Set pointer to symbol table entry associated with the relocation entry.
|
// 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_Sym *Sym = (Elf_Sym *)(Symtab + ELF_R_SYM(Rel->r_info) * SymtabShdr->sh_entsize);
|
||||||
|
|
||||||
Elf_Shdr *SymShdr;
|
Elf_Shdr *SymShdr;
|
||||||
UINT8 *Targ;
|
UINT8 *Targ;
|
||||||
UINT16 Address;
|
UINT16 Address;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Check section header index found in symbol table and get the section
|
// Check section header index found in symbol table and get the section
|
||||||
// header location.
|
// header location.
|
||||||
//
|
//
|
||||||
if (Sym->st_shndx == SHN_UNDEF
|
if (Sym->st_shndx == SHN_UNDEF
|
||||||
@@ -768,7 +768,7 @@ WriteSections32 (
|
|||||||
//
|
//
|
||||||
// Convert the relocation data to a pointer into the coff file.
|
// Convert the relocation data to a pointer into the coff file.
|
||||||
//
|
//
|
||||||
// Note:
|
// Note:
|
||||||
// r_offset is the virtual address of the storage unit to be relocated.
|
// 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.
|
// sh_addr is the virtual address for the base of the section.
|
||||||
//
|
//
|
||||||
@@ -814,9 +814,9 @@ WriteSections32 (
|
|||||||
case R_ARM_THM_JUMP19:
|
case R_ARM_THM_JUMP19:
|
||||||
case R_ARM_CALL:
|
case R_ARM_CALL:
|
||||||
case R_ARM_JMP24:
|
case R_ARM_JMP24:
|
||||||
case R_ARM_THM_JUMP24:
|
case R_ARM_THM_JUMP24:
|
||||||
case R_ARM_PREL31:
|
case R_ARM_PREL31:
|
||||||
case R_ARM_MOVW_PREL_NC:
|
case R_ARM_MOVW_PREL_NC:
|
||||||
case R_ARM_MOVT_PREL:
|
case R_ARM_MOVT_PREL:
|
||||||
case R_ARM_THM_MOVW_PREL_NC:
|
case R_ARM_THM_MOVW_PREL_NC:
|
||||||
case R_ARM_THM_MOVT_PREL:
|
case R_ARM_THM_MOVT_PREL:
|
||||||
@@ -909,7 +909,7 @@ WriteRelocations32 (
|
|||||||
for (RelIdx = 0; RelIdx < RelShdr->sh_size; RelIdx += RelShdr->sh_entsize) {
|
for (RelIdx = 0; RelIdx < RelShdr->sh_size; RelIdx += RelShdr->sh_entsize) {
|
||||||
Rel = (Elf_Rel *)((UINT8*)mEhdr + RelShdr->sh_offset + RelIdx);
|
Rel = (Elf_Rel *)((UINT8*)mEhdr + RelShdr->sh_offset + RelIdx);
|
||||||
|
|
||||||
if (mEhdr->e_machine == EM_386) {
|
if (mEhdr->e_machine == EM_386) {
|
||||||
switch (ELF_R_TYPE(Rel->r_info)) {
|
switch (ELF_R_TYPE(Rel->r_info)) {
|
||||||
case R_386_NONE:
|
case R_386_NONE:
|
||||||
case R_386_PC32:
|
case R_386_PC32:
|
||||||
@@ -941,9 +941,9 @@ WriteRelocations32 (
|
|||||||
case R_ARM_THM_JUMP19:
|
case R_ARM_THM_JUMP19:
|
||||||
case R_ARM_CALL:
|
case R_ARM_CALL:
|
||||||
case R_ARM_JMP24:
|
case R_ARM_JMP24:
|
||||||
case R_ARM_THM_JUMP24:
|
case R_ARM_THM_JUMP24:
|
||||||
case R_ARM_PREL31:
|
case R_ARM_PREL31:
|
||||||
case R_ARM_MOVW_PREL_NC:
|
case R_ARM_MOVW_PREL_NC:
|
||||||
case R_ARM_MOVT_PREL:
|
case R_ARM_MOVT_PREL:
|
||||||
case R_ARM_THM_MOVW_PREL_NC:
|
case R_ARM_THM_MOVW_PREL_NC:
|
||||||
case R_ARM_THM_MOVT_PREL:
|
case R_ARM_THM_MOVT_PREL:
|
||||||
@@ -1090,7 +1090,7 @@ WriteRelocations32 (
|
|||||||
case R_ARM_RABS32:
|
case R_ARM_RABS32:
|
||||||
CoffAddFixup (Rel->r_offset, EFI_IMAGE_REL_BASED_HIGHLOW);
|
CoffAddFixup (Rel->r_offset, EFI_IMAGE_REL_BASED_HIGHLOW);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
Error (NULL, 0, 3000, "Invalid", "%s bad ARM dynamic relocations, unkown type %d.", mInImageName, ELF32_R_TYPE (Rel->r_info));
|
Error (NULL, 0, 3000, "Invalid", "%s bad ARM dynamic relocations, unkown type %d.", mInImageName, ELF32_R_TYPE (Rel->r_info));
|
||||||
break;
|
break;
|
||||||
@@ -1163,7 +1163,7 @@ SetImageSize32 (
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_IMAGE_OPTIONAL_HEADER_UNION *NtHdr;
|
EFI_IMAGE_OPTIONAL_HEADER_UNION *NtHdr;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Set image size
|
// Set image size
|
||||||
//
|
//
|
||||||
|
@@ -1,11 +1,11 @@
|
|||||||
/** @file
|
/** @file
|
||||||
Header file for Elf32 Convert solution
|
Header file for Elf32 Convert solution
|
||||||
|
|
||||||
Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
|
|
||||||
This program and the accompanying materials are licensed and made available
|
This program and the accompanying materials are licensed and made available
|
||||||
under the terms and conditions of the BSD License which accompanies this
|
under the terms and conditions of the BSD License which accompanies this
|
||||||
distribution. The full text of the license may be found at
|
distribution. The full text of the license may be found at
|
||||||
http://opensource.org/licenses/bsd-license.php
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
|
@@ -800,24 +800,24 @@ WriteSections64 (
|
|||||||
// Absolute relocation.
|
// Absolute relocation.
|
||||||
//
|
//
|
||||||
VerboseMsg ("R_X86_64_64");
|
VerboseMsg ("R_X86_64_64");
|
||||||
VerboseMsg ("Offset: 0x%08X, Addend: 0x%016LX",
|
VerboseMsg ("Offset: 0x%08X, Addend: 0x%016LX",
|
||||||
(UINT32)(SecOffset + (Rel->r_offset - SecShdr->sh_addr)),
|
(UINT32)(SecOffset + (Rel->r_offset - SecShdr->sh_addr)),
|
||||||
*(UINT64 *)Targ);
|
*(UINT64 *)Targ);
|
||||||
*(UINT64 *)Targ = *(UINT64 *)Targ - SymShdr->sh_addr + mCoffSectionsOffset[Sym->st_shndx];
|
*(UINT64 *)Targ = *(UINT64 *)Targ - SymShdr->sh_addr + mCoffSectionsOffset[Sym->st_shndx];
|
||||||
VerboseMsg ("Relocation: 0x%016LX", *(UINT64*)Targ);
|
VerboseMsg ("Relocation: 0x%016LX", *(UINT64*)Targ);
|
||||||
break;
|
break;
|
||||||
case R_X86_64_32:
|
case R_X86_64_32:
|
||||||
VerboseMsg ("R_X86_64_32");
|
VerboseMsg ("R_X86_64_32");
|
||||||
VerboseMsg ("Offset: 0x%08X, Addend: 0x%08X",
|
VerboseMsg ("Offset: 0x%08X, Addend: 0x%08X",
|
||||||
(UINT32)(SecOffset + (Rel->r_offset - SecShdr->sh_addr)),
|
(UINT32)(SecOffset + (Rel->r_offset - SecShdr->sh_addr)),
|
||||||
*(UINT32 *)Targ);
|
*(UINT32 *)Targ);
|
||||||
*(UINT32 *)Targ = (UINT32)((UINT64)(*(UINT32 *)Targ) - SymShdr->sh_addr + mCoffSectionsOffset[Sym->st_shndx]);
|
*(UINT32 *)Targ = (UINT32)((UINT64)(*(UINT32 *)Targ) - SymShdr->sh_addr + mCoffSectionsOffset[Sym->st_shndx]);
|
||||||
VerboseMsg ("Relocation: 0x%08X", *(UINT32*)Targ);
|
VerboseMsg ("Relocation: 0x%08X", *(UINT32*)Targ);
|
||||||
break;
|
break;
|
||||||
case R_X86_64_32S:
|
case R_X86_64_32S:
|
||||||
VerboseMsg ("R_X86_64_32S");
|
VerboseMsg ("R_X86_64_32S");
|
||||||
VerboseMsg ("Offset: 0x%08X, Addend: 0x%08X",
|
VerboseMsg ("Offset: 0x%08X, Addend: 0x%08X",
|
||||||
(UINT32)(SecOffset + (Rel->r_offset - SecShdr->sh_addr)),
|
(UINT32)(SecOffset + (Rel->r_offset - SecShdr->sh_addr)),
|
||||||
*(UINT32 *)Targ);
|
*(UINT32 *)Targ);
|
||||||
*(INT32 *)Targ = (INT32)((INT64)(*(INT32 *)Targ) - SymShdr->sh_addr + mCoffSectionsOffset[Sym->st_shndx]);
|
*(INT32 *)Targ = (INT32)((INT64)(*(INT32 *)Targ) - SymShdr->sh_addr + mCoffSectionsOffset[Sym->st_shndx]);
|
||||||
VerboseMsg ("Relocation: 0x%08X", *(UINT32*)Targ);
|
VerboseMsg ("Relocation: 0x%08X", *(UINT32*)Targ);
|
||||||
@@ -838,8 +838,8 @@ WriteSections64 (
|
|||||||
// Relative relocation: Symbol - Ip + Addend
|
// Relative relocation: Symbol - Ip + Addend
|
||||||
//
|
//
|
||||||
VerboseMsg ("R_X86_64_PC32");
|
VerboseMsg ("R_X86_64_PC32");
|
||||||
VerboseMsg ("Offset: 0x%08X, Addend: 0x%08X",
|
VerboseMsg ("Offset: 0x%08X, Addend: 0x%08X",
|
||||||
(UINT32)(SecOffset + (Rel->r_offset - SecShdr->sh_addr)),
|
(UINT32)(SecOffset + (Rel->r_offset - SecShdr->sh_addr)),
|
||||||
*(UINT32 *)Targ);
|
*(UINT32 *)Targ);
|
||||||
*(UINT32 *)Targ = (UINT32) (*(UINT32 *)Targ
|
*(UINT32 *)Targ = (UINT32) (*(UINT32 *)Targ
|
||||||
+ (mCoffSectionsOffset[Sym->st_shndx] - SymShdr->sh_addr)
|
+ (mCoffSectionsOffset[Sym->st_shndx] - SymShdr->sh_addr)
|
||||||
@@ -986,7 +986,7 @@ WriteRelocations64 (
|
|||||||
case R_X86_64_PLT32:
|
case R_X86_64_PLT32:
|
||||||
break;
|
break;
|
||||||
case R_X86_64_64:
|
case R_X86_64_64:
|
||||||
VerboseMsg ("EFI_IMAGE_REL_BASED_DIR64 Offset: 0x%08X",
|
VerboseMsg ("EFI_IMAGE_REL_BASED_DIR64 Offset: 0x%08X",
|
||||||
mCoffSectionsOffset[RelShdr->sh_info] + (Rel->r_offset - SecShdr->sh_addr));
|
mCoffSectionsOffset[RelShdr->sh_info] + (Rel->r_offset - SecShdr->sh_addr));
|
||||||
CoffAddFixup(
|
CoffAddFixup(
|
||||||
(UINT32) ((UINT64) mCoffSectionsOffset[RelShdr->sh_info]
|
(UINT32) ((UINT64) mCoffSectionsOffset[RelShdr->sh_info]
|
||||||
@@ -995,7 +995,7 @@ WriteRelocations64 (
|
|||||||
break;
|
break;
|
||||||
case R_X86_64_32S:
|
case R_X86_64_32S:
|
||||||
case R_X86_64_32:
|
case R_X86_64_32:
|
||||||
VerboseMsg ("EFI_IMAGE_REL_BASED_HIGHLOW Offset: 0x%08X",
|
VerboseMsg ("EFI_IMAGE_REL_BASED_HIGHLOW Offset: 0x%08X",
|
||||||
mCoffSectionsOffset[RelShdr->sh_info] + (Rel->r_offset - SecShdr->sh_addr));
|
mCoffSectionsOffset[RelShdr->sh_info] + (Rel->r_offset - SecShdr->sh_addr));
|
||||||
CoffAddFixup(
|
CoffAddFixup(
|
||||||
(UINT32) ((UINT64) mCoffSectionsOffset[RelShdr->sh_info]
|
(UINT32) ((UINT64) mCoffSectionsOffset[RelShdr->sh_info]
|
||||||
|
@@ -1,11 +1,11 @@
|
|||||||
/** @file
|
/** @file
|
||||||
Header file for Elf64 convert solution
|
Header file for Elf64 convert solution
|
||||||
|
|
||||||
Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
|
|
||||||
This program and the accompanying materials are licensed and made available
|
This program and the accompanying materials are licensed and made available
|
||||||
under the terms and conditions of the BSD License which accompanies this
|
under the terms and conditions of the BSD License which accompanies this
|
||||||
distribution. The full text of the license may be found at
|
distribution. The full text of the license may be found at
|
||||||
http://opensource.org/licenses/bsd-license.php
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
|
@@ -3,9 +3,9 @@ Elf convert solution
|
|||||||
|
|
||||||
Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
|
|
||||||
This program and the accompanying materials are licensed and made available
|
This program and the accompanying materials are licensed and made available
|
||||||
under the terms and conditions of the BSD License which accompanies this
|
under the terms and conditions of the BSD License which accompanies this
|
||||||
distribution. The full text of the license may be found at
|
distribution. The full text of the license may be found at
|
||||||
http://opensource.org/licenses/bsd-license.php
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
@@ -92,7 +92,7 @@ CoffAddFixup(
|
|||||||
// Add a null entry (is it required ?)
|
// Add a null entry (is it required ?)
|
||||||
//
|
//
|
||||||
CoffAddFixupEntry (0);
|
CoffAddFixupEntry (0);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Pad for alignment.
|
// Pad for alignment.
|
||||||
//
|
//
|
||||||
@@ -163,7 +163,7 @@ IsElfHeader (
|
|||||||
UINT8 *FileBuffer
|
UINT8 *FileBuffer
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return (FileBuffer[EI_MAG0] == ELFMAG0 &&
|
return (FileBuffer[EI_MAG0] == ELFMAG0 &&
|
||||||
FileBuffer[EI_MAG1] == ELFMAG1 &&
|
FileBuffer[EI_MAG1] == ELFMAG1 &&
|
||||||
FileBuffer[EI_MAG2] == ELFMAG2 &&
|
FileBuffer[EI_MAG2] == ELFMAG2 &&
|
||||||
FileBuffer[EI_MAG3] == ELFMAG3);
|
FileBuffer[EI_MAG3] == ELFMAG3);
|
||||||
@@ -199,7 +199,7 @@ ConvertElf (
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Compute sections new address.
|
// Compute sections new address.
|
||||||
//
|
//
|
||||||
VerboseMsg ("Compute sections new address.");
|
VerboseMsg ("Compute sections new address.");
|
||||||
ElfFunctions.ScanSections ();
|
ElfFunctions.ScanSections ();
|
||||||
|
|
||||||
@@ -246,6 +246,6 @@ ConvertElf (
|
|||||||
// Free resources used by ELF functions.
|
// Free resources used by ELF functions.
|
||||||
//
|
//
|
||||||
ElfFunctions.CleanUp ();
|
ElfFunctions.CleanUp ();
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@@ -3,9 +3,9 @@ Header file for Elf convert solution
|
|||||||
|
|
||||||
Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
|
|
||||||
This program and the accompanying materials are licensed and made available
|
This program and the accompanying materials are licensed and made available
|
||||||
under the terms and conditions of the BSD License which accompanies this
|
under the terms and conditions of the BSD License which accompanies this
|
||||||
distribution. The full text of the license may be found at
|
distribution. The full text of the license may be found at
|
||||||
http://opensource.org/licenses/bsd-license.php
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
@@ -45,7 +45,7 @@ typedef enum {
|
|||||||
SECTION_TEXT,
|
SECTION_TEXT,
|
||||||
SECTION_HII,
|
SECTION_HII,
|
||||||
SECTION_DATA
|
SECTION_DATA
|
||||||
|
|
||||||
} SECTION_FILTER_TYPES;
|
} SECTION_FILTER_TYPES;
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -58,7 +58,7 @@ typedef struct {
|
|||||||
VOID (*WriteDebug) ();
|
VOID (*WriteDebug) ();
|
||||||
VOID (*SetImageSize) ();
|
VOID (*SetImageSize) ();
|
||||||
VOID (*CleanUp) ();
|
VOID (*CleanUp) ();
|
||||||
|
|
||||||
} ELF_FUNCTION_TABLE;
|
} ELF_FUNCTION_TABLE;
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
/** @file
|
/** @file
|
||||||
Converts a pe32+ image to an FW, Te image type, or other specific image.
|
Converts a pe32+ image to an FW, Te image type, or other specific image.
|
||||||
|
|
||||||
Copyright (c) 2004 - 2016, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
@@ -169,7 +169,7 @@ Returns:
|
|||||||
//
|
//
|
||||||
// Copyright declaration
|
// Copyright declaration
|
||||||
//
|
//
|
||||||
fprintf (stdout, "Copyright (c) 2007 - 2015, Intel Corporation. All rights reserved.\n\n");
|
fprintf (stdout, "Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.\n\n");
|
||||||
|
|
||||||
//
|
//
|
||||||
// Details Option
|
// Details Option
|
||||||
@@ -242,7 +242,7 @@ Returns:
|
|||||||
If it is combined with other action options, the later\n\
|
If it is combined with other action options, the later\n\
|
||||||
input action option will override the previous one.\n");
|
input action option will override the previous one.\n");
|
||||||
fprintf (stdout, " -a NUM, --align NUM NUM is one HEX or DEC format alignment value.\n\
|
fprintf (stdout, " -a NUM, --align NUM NUM is one HEX or DEC format alignment value.\n\
|
||||||
This option is only used together with -j option.\n");
|
This option is only used together with -j option.\n");
|
||||||
fprintf (stdout, " -p NUM, --pad NUM NUM is one HEX or DEC format padding value.\n\
|
fprintf (stdout, " -p NUM, --pad NUM NUM is one HEX or DEC format padding value.\n\
|
||||||
This option is only used together with -j option.\n");
|
This option is only used together with -j option.\n");
|
||||||
fprintf (stdout, " --keepexceptiontable Don't clear exception table.\n\
|
fprintf (stdout, " --keepexceptiontable Don't clear exception table.\n\
|
||||||
@@ -490,7 +490,7 @@ SetHiiResourceHeader (
|
|||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Now it ought to be resource Data and update its OffsetToData value
|
// Now it ought to be resource Data and update its OffsetToData value
|
||||||
//
|
//
|
||||||
if (!ResourceDirectoryEntry->u2.s.DataIsDirectory) {
|
if (!ResourceDirectoryEntry->u2.s.DataIsDirectory) {
|
||||||
ResourceDataEntry = (EFI_IMAGE_RESOURCE_DATA_ENTRY *) (HiiBinData + ResourceDirectoryEntry->u2.OffsetToData);
|
ResourceDataEntry = (EFI_IMAGE_RESOURCE_DATA_ENTRY *) (HiiBinData + ResourceDirectoryEntry->u2.OffsetToData);
|
||||||
@@ -501,7 +501,7 @@ SetHiiResourceHeader (
|
|||||||
}
|
}
|
||||||
ResourceDirectoryEntry++;
|
ResourceDirectoryEntry++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -530,7 +530,7 @@ GetPeCoffHeader (
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return PeHdr;
|
return PeHdr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -555,7 +555,7 @@ PeCoffConvertImageToXip (
|
|||||||
if (PeHdr == NULL) {
|
if (PeHdr == NULL) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PeHdr->Pe32.OptionalHeader.SectionAlignment != PeHdr->Pe32.OptionalHeader.FileAlignment) {
|
if (PeHdr->Pe32.OptionalHeader.SectionAlignment != PeHdr->Pe32.OptionalHeader.FileAlignment) {
|
||||||
//
|
//
|
||||||
// The only reason to expand zero fill sections is to make them compatible with XIP images.
|
// The only reason to expand zero fill sections is to make them compatible with XIP images.
|
||||||
@@ -672,7 +672,7 @@ PeCoffConvertImageToXip (
|
|||||||
|
|
||||||
UINT8 *
|
UINT8 *
|
||||||
CreateHiiResouceSectionHeader (
|
CreateHiiResouceSectionHeader (
|
||||||
UINT32 *pSectionHeaderSize,
|
UINT32 *pSectionHeaderSize,
|
||||||
UINT32 HiiDataSize
|
UINT32 HiiDataSize
|
||||||
)
|
)
|
||||||
/*++
|
/*++
|
||||||
@@ -705,8 +705,8 @@ Returns:
|
|||||||
// Calculate the total size for the resource header (include Type, Name and Language)
|
// Calculate the total size for the resource header (include Type, Name and Language)
|
||||||
// then allocate memory for the resource header.
|
// then allocate memory for the resource header.
|
||||||
//
|
//
|
||||||
HiiSectionHeaderSize = 3 * (sizeof (EFI_IMAGE_RESOURCE_DIRECTORY) + sizeof (EFI_IMAGE_RESOURCE_DIRECTORY_ENTRY))
|
HiiSectionHeaderSize = 3 * (sizeof (EFI_IMAGE_RESOURCE_DIRECTORY) + sizeof (EFI_IMAGE_RESOURCE_DIRECTORY_ENTRY))
|
||||||
+ 3 * (sizeof (UINT16) + 3 * sizeof (CHAR16))
|
+ 3 * (sizeof (UINT16) + 3 * sizeof (CHAR16))
|
||||||
+ sizeof (EFI_IMAGE_RESOURCE_DATA_ENTRY);
|
+ sizeof (EFI_IMAGE_RESOURCE_DATA_ENTRY);
|
||||||
HiiSectionHeader = malloc (HiiSectionHeaderSize);
|
HiiSectionHeader = malloc (HiiSectionHeaderSize);
|
||||||
if (HiiSectionHeader == NULL) {
|
if (HiiSectionHeader == NULL) {
|
||||||
@@ -717,7 +717,7 @@ Returns:
|
|||||||
|
|
||||||
HiiSectionOffset = 0;
|
HiiSectionOffset = 0;
|
||||||
//
|
//
|
||||||
// Create Type entry
|
// Create Type entry
|
||||||
//
|
//
|
||||||
ResourceDirectory = (EFI_IMAGE_RESOURCE_DIRECTORY *) (HiiSectionHeader + HiiSectionOffset);
|
ResourceDirectory = (EFI_IMAGE_RESOURCE_DIRECTORY *) (HiiSectionHeader + HiiSectionOffset);
|
||||||
HiiSectionOffset += sizeof (EFI_IMAGE_RESOURCE_DIRECTORY);
|
HiiSectionOffset += sizeof (EFI_IMAGE_RESOURCE_DIRECTORY);
|
||||||
@@ -877,7 +877,7 @@ Returns:
|
|||||||
|
|
||||||
if (ImageContext.RelocationsStripped) {
|
if (ImageContext.RelocationsStripped) {
|
||||||
Error (NULL, 0, 3000, "Invalid", "The input PeImage %s has no relocation to be fixed up", FileName);
|
Error (NULL, 0, 3000, "Invalid", "The input PeImage %s has no relocation to be fixed up", FileName);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -890,8 +890,8 @@ Returns:
|
|||||||
//
|
//
|
||||||
SectionHeader = (EFI_IMAGE_SECTION_HEADER *) (
|
SectionHeader = (EFI_IMAGE_SECTION_HEADER *) (
|
||||||
(UINTN) ImgHdr +
|
(UINTN) ImgHdr +
|
||||||
sizeof (UINT32) +
|
sizeof (UINT32) +
|
||||||
sizeof (EFI_IMAGE_FILE_HEADER) +
|
sizeof (EFI_IMAGE_FILE_HEADER) +
|
||||||
ImgHdr->Pe32.FileHeader.SizeOfOptionalHeader
|
ImgHdr->Pe32.FileHeader.SizeOfOptionalHeader
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -957,7 +957,7 @@ Returns:
|
|||||||
|
|
||||||
if (ImageContext.RelocationsStripped) {
|
if (ImageContext.RelocationsStripped) {
|
||||||
Error (NULL, 0, 3000, "Invalid", "The input PeImage %s has no relocation to be fixed up", FileName);
|
Error (NULL, 0, 3000, "Invalid", "The input PeImage %s has no relocation to be fixed up", FileName);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -996,15 +996,15 @@ Returns:
|
|||||||
//
|
//
|
||||||
SectionHeader = (EFI_IMAGE_SECTION_HEADER *) (
|
SectionHeader = (EFI_IMAGE_SECTION_HEADER *) (
|
||||||
(UINTN) ImgHdr +
|
(UINTN) ImgHdr +
|
||||||
sizeof (UINT32) +
|
sizeof (UINT32) +
|
||||||
sizeof (EFI_IMAGE_FILE_HEADER) +
|
sizeof (EFI_IMAGE_FILE_HEADER) +
|
||||||
ImgHdr->Pe32.FileHeader.SizeOfOptionalHeader
|
ImgHdr->Pe32.FileHeader.SizeOfOptionalHeader
|
||||||
);
|
);
|
||||||
|
|
||||||
for (Index = 0; Index < ImgHdr->Pe32.FileHeader.NumberOfSections; Index ++, SectionHeader ++) {
|
for (Index = 0; Index < ImgHdr->Pe32.FileHeader.NumberOfSections; Index ++, SectionHeader ++) {
|
||||||
CopyMem (
|
CopyMem (
|
||||||
FileBuffer + SectionHeader->PointerToRawData,
|
FileBuffer + SectionHeader->PointerToRawData,
|
||||||
(VOID*) (UINTN) (ImageContext.ImageAddress + SectionHeader->VirtualAddress),
|
(VOID*) (UINTN) (ImageContext.ImageAddress + SectionHeader->VirtualAddress),
|
||||||
SectionHeader->SizeOfRawData
|
SectionHeader->SizeOfRawData
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -2186,7 +2186,7 @@ Returns:
|
|||||||
goto Finish;
|
goto Finish;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NegativeAddr) {
|
if (NegativeAddr) {
|
||||||
//
|
//
|
||||||
// Set Base Address to a negative value.
|
// Set Base Address to a negative value.
|
||||||
@@ -2534,7 +2534,7 @@ Returns:
|
|||||||
(TEImageHeader.DataDirectory[EFI_TE_IMAGE_DIRECTORY_ENTRY_BASERELOC].VirtualAddress == 0) && \
|
(TEImageHeader.DataDirectory[EFI_TE_IMAGE_DIRECTORY_ENTRY_BASERELOC].VirtualAddress == 0) && \
|
||||||
(TEImageHeader.DataDirectory[EFI_TE_IMAGE_DIRECTORY_ENTRY_BASERELOC].Size == 0)) {
|
(TEImageHeader.DataDirectory[EFI_TE_IMAGE_DIRECTORY_ENTRY_BASERELOC].Size == 0)) {
|
||||||
//
|
//
|
||||||
// PeImage can be loaded into memory, but it has no relocation section.
|
// PeImage can be loaded into memory, but it has no relocation section.
|
||||||
// Fix TeImage Header to set VA of relocation data directory to not zero, the size is still zero.
|
// Fix TeImage Header to set VA of relocation data directory to not zero, the size is still zero.
|
||||||
//
|
//
|
||||||
if (Optional32 != NULL) {
|
if (Optional32 != NULL) {
|
||||||
@@ -2716,7 +2716,7 @@ Finish:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (InputFileBuffer != NULL) {
|
if (InputFileBuffer != NULL) {
|
||||||
free (InputFileBuffer);
|
free (InputFileBuffer);
|
||||||
}
|
}
|
||||||
@@ -2735,7 +2735,7 @@ Finish:
|
|||||||
ReportFileName = (CHAR8 *) malloc (FileLen + 1);
|
ReportFileName = (CHAR8 *) malloc (FileLen + 1);
|
||||||
if (ReportFileName != NULL) {
|
if (ReportFileName != NULL) {
|
||||||
strcpy (ReportFileName, OutImageName);
|
strcpy (ReportFileName, OutImageName);
|
||||||
strcpy (ReportFileName + (FileLen - 4), ".txt");
|
strcpy (ReportFileName + (FileLen - 4), ".txt");
|
||||||
ReportFile = fopen (LongFilePath (ReportFileName), "w+");
|
ReportFile = fopen (LongFilePath (ReportFileName), "w+");
|
||||||
if (ReportFile != NULL) {
|
if (ReportFile != NULL) {
|
||||||
fprintf (ReportFile, "MODULE_SIZE = %u\n", (unsigned) mImageSize);
|
fprintf (ReportFile, "MODULE_SIZE = %u\n", (unsigned) mImageSize);
|
||||||
@@ -2789,7 +2789,7 @@ Returns:
|
|||||||
EFI_IMAGE_SECTION_HEADER *SectionHeader;
|
EFI_IMAGE_SECTION_HEADER *SectionHeader;
|
||||||
EFI_IMAGE_DEBUG_DIRECTORY_ENTRY *DebugEntry;
|
EFI_IMAGE_DEBUG_DIRECTORY_ENTRY *DebugEntry;
|
||||||
EFI_IMAGE_DEBUG_CODEVIEW_RSDS_ENTRY *RsdsEntry;
|
EFI_IMAGE_DEBUG_CODEVIEW_RSDS_ENTRY *RsdsEntry;
|
||||||
UINT32 *NewTimeStamp;
|
UINT32 *NewTimeStamp;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Init variable.
|
// Init variable.
|
||||||
@@ -2968,7 +2968,7 @@ Returns:
|
|||||||
EFI_IMAGE_OPTIONAL_HEADER64 *Optional64Hdr;
|
EFI_IMAGE_OPTIONAL_HEADER64 *Optional64Hdr;
|
||||||
EFI_IMAGE_SECTION_HEADER *SectionHeader;
|
EFI_IMAGE_SECTION_HEADER *SectionHeader;
|
||||||
UINT32 *NewTimeStamp;
|
UINT32 *NewTimeStamp;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Init variable.
|
// Init variable.
|
||||||
//
|
//
|
||||||
|
@@ -1,11 +1,11 @@
|
|||||||
/** @file
|
/** @file
|
||||||
Header file for GenFw
|
Header file for GenFw
|
||||||
|
|
||||||
Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
|
|
||||||
This program and the accompanying materials are licensed and made available
|
This program and the accompanying materials are licensed and made available
|
||||||
under the terms and conditions of the BSD License which accompanies this
|
under the terms and conditions of the BSD License which accompanies this
|
||||||
distribution. The full text of the license may be found at
|
distribution. The full text of the license may be found at
|
||||||
http://opensource.org/licenses/bsd-license.php
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
|
@@ -48,38 +48,38 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||||||
* ELF definitions common to all 32-bit architectures.
|
* ELF definitions common to all 32-bit architectures.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
typedef UINT32 Elf32_Addr;
|
typedef UINT32 Elf32_Addr;
|
||||||
typedef UINT16 Elf32_Half;
|
typedef UINT16 Elf32_Half;
|
||||||
typedef UINT32 Elf32_Off;
|
typedef UINT32 Elf32_Off;
|
||||||
typedef INT32 Elf32_Sword;
|
typedef INT32 Elf32_Sword;
|
||||||
typedef UINT32 Elf32_Word;
|
typedef UINT32 Elf32_Word;
|
||||||
typedef UINT64 Elf32_Lword;
|
typedef UINT64 Elf32_Lword;
|
||||||
|
|
||||||
typedef Elf32_Word Elf32_Hashelt;
|
typedef Elf32_Word Elf32_Hashelt;
|
||||||
|
|
||||||
/* Non-standard class-dependent datatype used for abstraction. */
|
/* Non-standard class-dependent datatype used for abstraction. */
|
||||||
typedef Elf32_Word Elf32_Size;
|
typedef Elf32_Word Elf32_Size;
|
||||||
typedef Elf32_Sword Elf32_Ssize;
|
typedef Elf32_Sword Elf32_Ssize;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ELF header.
|
* ELF header.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
unsigned char e_ident[EI_NIDENT]; /* File identification. */
|
unsigned char e_ident[EI_NIDENT]; /* File identification. */
|
||||||
Elf32_Half e_type; /* File type. */
|
Elf32_Half e_type; /* File type. */
|
||||||
Elf32_Half e_machine; /* Machine architecture. */
|
Elf32_Half e_machine; /* Machine architecture. */
|
||||||
Elf32_Word e_version; /* ELF format version. */
|
Elf32_Word e_version; /* ELF format version. */
|
||||||
Elf32_Addr e_entry; /* Entry point. */
|
Elf32_Addr e_entry; /* Entry point. */
|
||||||
Elf32_Off e_phoff; /* Program header file offset. */
|
Elf32_Off e_phoff; /* Program header file offset. */
|
||||||
Elf32_Off e_shoff; /* Section header file offset. */
|
Elf32_Off e_shoff; /* Section header file offset. */
|
||||||
Elf32_Word e_flags; /* Architecture-specific flags. */
|
Elf32_Word e_flags; /* Architecture-specific flags. */
|
||||||
Elf32_Half e_ehsize; /* Size of ELF header in bytes. */
|
Elf32_Half e_ehsize; /* Size of ELF header in bytes. */
|
||||||
Elf32_Half e_phentsize; /* Size of program header entry. */
|
Elf32_Half e_phentsize; /* Size of program header entry. */
|
||||||
Elf32_Half e_phnum; /* Number of program header entries. */
|
Elf32_Half e_phnum; /* Number of program header entries. */
|
||||||
Elf32_Half e_shentsize; /* Size of section header entry. */
|
Elf32_Half e_shentsize; /* Size of section header entry. */
|
||||||
Elf32_Half e_shnum; /* Number of section header entries. */
|
Elf32_Half e_shnum; /* Number of section header entries. */
|
||||||
Elf32_Half e_shstrndx; /* Section name strings section. */
|
Elf32_Half e_shstrndx; /* Section name strings section. */
|
||||||
} Elf32_Ehdr;
|
} Elf32_Ehdr;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -87,17 +87,17 @@ typedef struct {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
Elf32_Word sh_name; /* Section name (index into the
|
Elf32_Word sh_name; /* Section name (index into the
|
||||||
section header string table). */
|
section header string table). */
|
||||||
Elf32_Word sh_type; /* Section type. */
|
Elf32_Word sh_type; /* Section type. */
|
||||||
Elf32_Word sh_flags; /* Section flags. */
|
Elf32_Word sh_flags; /* Section flags. */
|
||||||
Elf32_Addr sh_addr; /* Address in memory image. */
|
Elf32_Addr sh_addr; /* Address in memory image. */
|
||||||
Elf32_Off sh_offset; /* Offset in file. */
|
Elf32_Off sh_offset; /* Offset in file. */
|
||||||
Elf32_Word sh_size; /* Size in bytes. */
|
Elf32_Word sh_size; /* Size in bytes. */
|
||||||
Elf32_Word sh_link; /* Index of a related section. */
|
Elf32_Word sh_link; /* Index of a related section. */
|
||||||
Elf32_Word sh_info; /* Depends on section type. */
|
Elf32_Word sh_info; /* Depends on section type. */
|
||||||
Elf32_Word sh_addralign; /* Alignment in bytes. */
|
Elf32_Word sh_addralign; /* Alignment in bytes. */
|
||||||
Elf32_Word sh_entsize; /* Size of each entry in section. */
|
Elf32_Word sh_entsize; /* Size of each entry in section. */
|
||||||
} Elf32_Shdr;
|
} Elf32_Shdr;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -105,14 +105,14 @@ typedef struct {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
Elf32_Word p_type; /* Entry type. */
|
Elf32_Word p_type; /* Entry type. */
|
||||||
Elf32_Off p_offset; /* File offset of contents. */
|
Elf32_Off p_offset; /* File offset of contents. */
|
||||||
Elf32_Addr p_vaddr; /* Virtual address in memory image. */
|
Elf32_Addr p_vaddr; /* Virtual address in memory image. */
|
||||||
Elf32_Addr p_paddr; /* Physical address (not used). */
|
Elf32_Addr p_paddr; /* Physical address (not used). */
|
||||||
Elf32_Word p_filesz; /* Size of contents in file. */
|
Elf32_Word p_filesz; /* Size of contents in file. */
|
||||||
Elf32_Word p_memsz; /* Size of contents in memory. */
|
Elf32_Word p_memsz; /* Size of contents in memory. */
|
||||||
Elf32_Word p_flags; /* Access permission flags. */
|
Elf32_Word p_flags; /* Access permission flags. */
|
||||||
Elf32_Word p_align; /* Alignment in memory and file. */
|
Elf32_Word p_align; /* Alignment in memory and file. */
|
||||||
} Elf32_Phdr;
|
} Elf32_Phdr;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -120,11 +120,11 @@ typedef struct {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
Elf32_Sword d_tag; /* Entry type. */
|
Elf32_Sword d_tag; /* Entry type. */
|
||||||
union {
|
union {
|
||||||
Elf32_Word d_val; /* Integer value. */
|
Elf32_Word d_val; /* Integer value. */
|
||||||
Elf32_Addr d_ptr; /* Address value. */
|
Elf32_Addr d_ptr; /* Address value. */
|
||||||
} d_un;
|
} d_un;
|
||||||
} Elf32_Dyn;
|
} Elf32_Dyn;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -133,60 +133,60 @@ typedef struct {
|
|||||||
|
|
||||||
/* Relocations that don't need an addend field. */
|
/* Relocations that don't need an addend field. */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
Elf32_Addr r_offset; /* Location to be relocated. */
|
Elf32_Addr r_offset; /* Location to be relocated. */
|
||||||
Elf32_Word r_info; /* Relocation type and symbol index. */
|
Elf32_Word r_info; /* Relocation type and symbol index. */
|
||||||
} Elf32_Rel;
|
} Elf32_Rel;
|
||||||
|
|
||||||
/* Relocations that need an addend field. */
|
/* Relocations that need an addend field. */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
Elf32_Addr r_offset; /* Location to be relocated. */
|
Elf32_Addr r_offset; /* Location to be relocated. */
|
||||||
Elf32_Word r_info; /* Relocation type and symbol index. */
|
Elf32_Word r_info; /* Relocation type and symbol index. */
|
||||||
Elf32_Sword r_addend; /* Addend. */
|
Elf32_Sword r_addend; /* Addend. */
|
||||||
} Elf32_Rela;
|
} Elf32_Rela;
|
||||||
|
|
||||||
/* Macros for accessing the fields of r_info. */
|
/* Macros for accessing the fields of r_info. */
|
||||||
#define ELF32_R_SYM(info) ((info) >> 8)
|
#define ELF32_R_SYM(info) ((info) >> 8)
|
||||||
#define ELF32_R_TYPE(info) ((unsigned char)(info))
|
#define ELF32_R_TYPE(info) ((unsigned char)(info))
|
||||||
|
|
||||||
/* Macro for constructing r_info from field values. */
|
/* Macro for constructing r_info from field values. */
|
||||||
#define ELF32_R_INFO(sym, type) (((sym) << 8) + (unsigned char)(type))
|
#define ELF32_R_INFO(sym, type) (((sym) << 8) + (unsigned char)(type))
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Note entry header
|
* Note entry header
|
||||||
*/
|
*/
|
||||||
typedef Elf_Note Elf32_Nhdr;
|
typedef Elf_Note Elf32_Nhdr;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Move entry
|
* Move entry
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
Elf32_Lword m_value; /* symbol value */
|
Elf32_Lword m_value; /* symbol value */
|
||||||
Elf32_Word m_info; /* size + index */
|
Elf32_Word m_info; /* size + index */
|
||||||
Elf32_Word m_poffset; /* symbol offset */
|
Elf32_Word m_poffset; /* symbol offset */
|
||||||
Elf32_Half m_repeat; /* repeat count */
|
Elf32_Half m_repeat; /* repeat count */
|
||||||
Elf32_Half m_stride; /* stride info */
|
Elf32_Half m_stride; /* stride info */
|
||||||
} Elf32_Move;
|
} Elf32_Move;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The macros compose and decompose values for Move.r_info
|
* The macros compose and decompose values for Move.r_info
|
||||||
*
|
*
|
||||||
* sym = ELF32_M_SYM(M.m_info)
|
* sym = ELF32_M_SYM(M.m_info)
|
||||||
* size = ELF32_M_SIZE(M.m_info)
|
* size = ELF32_M_SIZE(M.m_info)
|
||||||
* M.m_info = ELF32_M_INFO(sym, size)
|
* M.m_info = ELF32_M_INFO(sym, size)
|
||||||
*/
|
*/
|
||||||
#define ELF32_M_SYM(info) ((info)>>8)
|
#define ELF32_M_SYM(info) ((info)>>8)
|
||||||
#define ELF32_M_SIZE(info) ((unsigned char)(info))
|
#define ELF32_M_SIZE(info) ((unsigned char)(info))
|
||||||
#define ELF32_M_INFO(sym, size) (((sym)<<8)+(unsigned char)(size))
|
#define ELF32_M_INFO(sym, size) (((sym)<<8)+(unsigned char)(size))
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Hardware/Software capabilities entry
|
* Hardware/Software capabilities entry
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
Elf32_Word c_tag; /* how to interpret value */
|
Elf32_Word c_tag; /* how to interpret value */
|
||||||
union {
|
union {
|
||||||
Elf32_Word c_val;
|
Elf32_Word c_val;
|
||||||
Elf32_Addr c_ptr;
|
Elf32_Addr c_ptr;
|
||||||
} c_un;
|
} c_un;
|
||||||
} Elf32_Cap;
|
} Elf32_Cap;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -194,65 +194,65 @@ typedef struct {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
Elf32_Word st_name; /* String table index of name. */
|
Elf32_Word st_name; /* String table index of name. */
|
||||||
Elf32_Addr st_value; /* Symbol value. */
|
Elf32_Addr st_value; /* Symbol value. */
|
||||||
Elf32_Word st_size; /* Size of associated object. */
|
Elf32_Word st_size; /* Size of associated object. */
|
||||||
unsigned char st_info; /* Type and binding information. */
|
unsigned char st_info; /* Type and binding information. */
|
||||||
unsigned char st_other; /* Reserved (not used). */
|
unsigned char st_other; /* Reserved (not used). */
|
||||||
Elf32_Half st_shndx; /* Section index of symbol. */
|
Elf32_Half st_shndx; /* Section index of symbol. */
|
||||||
} Elf32_Sym;
|
} Elf32_Sym;
|
||||||
|
|
||||||
/* Macros for accessing the fields of st_info. */
|
/* Macros for accessing the fields of st_info. */
|
||||||
#define ELF32_ST_BIND(info) ((info) >> 4)
|
#define ELF32_ST_BIND(info) ((info) >> 4)
|
||||||
#define ELF32_ST_TYPE(info) ((info) & 0xf)
|
#define ELF32_ST_TYPE(info) ((info) & 0xf)
|
||||||
|
|
||||||
/* Macro for constructing st_info from field values. */
|
/* Macro for constructing st_info from field values. */
|
||||||
#define ELF32_ST_INFO(bind, type) (((bind) << 4) + ((type) & 0xf))
|
#define ELF32_ST_INFO(bind, type) (((bind) << 4) + ((type) & 0xf))
|
||||||
|
|
||||||
/* Macro for accessing the fields of st_other. */
|
/* Macro for accessing the fields of st_other. */
|
||||||
#define ELF32_ST_VISIBILITY(oth) ((oth) & 0x3)
|
#define ELF32_ST_VISIBILITY(oth) ((oth) & 0x3)
|
||||||
|
|
||||||
/* Structures used by Sun & GNU symbol versioning. */
|
/* Structures used by Sun & GNU symbol versioning. */
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
Elf32_Half vd_version;
|
Elf32_Half vd_version;
|
||||||
Elf32_Half vd_flags;
|
Elf32_Half vd_flags;
|
||||||
Elf32_Half vd_ndx;
|
Elf32_Half vd_ndx;
|
||||||
Elf32_Half vd_cnt;
|
Elf32_Half vd_cnt;
|
||||||
Elf32_Word vd_hash;
|
Elf32_Word vd_hash;
|
||||||
Elf32_Word vd_aux;
|
Elf32_Word vd_aux;
|
||||||
Elf32_Word vd_next;
|
Elf32_Word vd_next;
|
||||||
} Elf32_Verdef;
|
} Elf32_Verdef;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
Elf32_Word vda_name;
|
Elf32_Word vda_name;
|
||||||
Elf32_Word vda_next;
|
Elf32_Word vda_next;
|
||||||
} Elf32_Verdaux;
|
} Elf32_Verdaux;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
Elf32_Half vn_version;
|
Elf32_Half vn_version;
|
||||||
Elf32_Half vn_cnt;
|
Elf32_Half vn_cnt;
|
||||||
Elf32_Word vn_file;
|
Elf32_Word vn_file;
|
||||||
Elf32_Word vn_aux;
|
Elf32_Word vn_aux;
|
||||||
Elf32_Word vn_next;
|
Elf32_Word vn_next;
|
||||||
} Elf32_Verneed;
|
} Elf32_Verneed;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
Elf32_Word vna_hash;
|
Elf32_Word vna_hash;
|
||||||
Elf32_Half vna_flags;
|
Elf32_Half vna_flags;
|
||||||
Elf32_Half vna_other;
|
Elf32_Half vna_other;
|
||||||
Elf32_Word vna_name;
|
Elf32_Word vna_name;
|
||||||
Elf32_Word vna_next;
|
Elf32_Word vna_next;
|
||||||
} Elf32_Vernaux;
|
} Elf32_Vernaux;
|
||||||
|
|
||||||
typedef Elf32_Half Elf32_Versym;
|
typedef Elf32_Half Elf32_Versym;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
Elf32_Half si_boundto; /* direct bindings - symbol bound to */
|
Elf32_Half si_boundto; /* direct bindings - symbol bound to */
|
||||||
Elf32_Half si_flags; /* per symbol flags */
|
Elf32_Half si_flags; /* per symbol flags */
|
||||||
} Elf32_Syminfo;
|
} Elf32_Syminfo;
|
||||||
|
|
||||||
#endif /* !_SYS_ELF32_H_ */
|
#endif /* !_SYS_ELF32_H_ */
|
||||||
|
@@ -47,14 +47,14 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||||||
* ELF definitions common to all 64-bit architectures.
|
* ELF definitions common to all 64-bit architectures.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
typedef UINT64 Elf64_Addr;
|
typedef UINT64 Elf64_Addr;
|
||||||
typedef UINT16 Elf64_Half;
|
typedef UINT16 Elf64_Half;
|
||||||
typedef UINT64 Elf64_Off;
|
typedef UINT64 Elf64_Off;
|
||||||
typedef INT32 Elf64_Sword;
|
typedef INT32 Elf64_Sword;
|
||||||
typedef INT64 Elf64_Sxword;
|
typedef INT64 Elf64_Sxword;
|
||||||
typedef UINT32 Elf64_Word;
|
typedef UINT32 Elf64_Word;
|
||||||
typedef UINT64 Elf64_Lword;
|
typedef UINT64 Elf64_Lword;
|
||||||
typedef UINT64 Elf64_Xword;
|
typedef UINT64 Elf64_Xword;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Types of dynamic symbol hash table bucket and chain elements.
|
* Types of dynamic symbol hash table bucket and chain elements.
|
||||||
@@ -63,31 +63,31 @@ typedef UINT64 Elf64_Xword;
|
|||||||
* typedef is required.
|
* typedef is required.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
typedef Elf64_Word Elf64_Hashelt;
|
typedef Elf64_Word Elf64_Hashelt;
|
||||||
|
|
||||||
/* Non-standard class-dependent datatype used for abstraction. */
|
/* Non-standard class-dependent datatype used for abstraction. */
|
||||||
typedef Elf64_Xword Elf64_Size;
|
typedef Elf64_Xword Elf64_Size;
|
||||||
typedef Elf64_Sxword Elf64_Ssize;
|
typedef Elf64_Sxword Elf64_Ssize;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ELF header.
|
* ELF header.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
unsigned char e_ident[EI_NIDENT]; /* File identification. */
|
unsigned char e_ident[EI_NIDENT]; /* File identification. */
|
||||||
Elf64_Half e_type; /* File type. */
|
Elf64_Half e_type; /* File type. */
|
||||||
Elf64_Half e_machine; /* Machine architecture. */
|
Elf64_Half e_machine; /* Machine architecture. */
|
||||||
Elf64_Word e_version; /* ELF format version. */
|
Elf64_Word e_version; /* ELF format version. */
|
||||||
Elf64_Addr e_entry; /* Entry point. */
|
Elf64_Addr e_entry; /* Entry point. */
|
||||||
Elf64_Off e_phoff; /* Program header file offset. */
|
Elf64_Off e_phoff; /* Program header file offset. */
|
||||||
Elf64_Off e_shoff; /* Section header file offset. */
|
Elf64_Off e_shoff; /* Section header file offset. */
|
||||||
Elf64_Word e_flags; /* Architecture-specific flags. */
|
Elf64_Word e_flags; /* Architecture-specific flags. */
|
||||||
Elf64_Half e_ehsize; /* Size of ELF header in bytes. */
|
Elf64_Half e_ehsize; /* Size of ELF header in bytes. */
|
||||||
Elf64_Half e_phentsize; /* Size of program header entry. */
|
Elf64_Half e_phentsize; /* Size of program header entry. */
|
||||||
Elf64_Half e_phnum; /* Number of program header entries. */
|
Elf64_Half e_phnum; /* Number of program header entries. */
|
||||||
Elf64_Half e_shentsize; /* Size of section header entry. */
|
Elf64_Half e_shentsize; /* Size of section header entry. */
|
||||||
Elf64_Half e_shnum; /* Number of section header entries. */
|
Elf64_Half e_shnum; /* Number of section header entries. */
|
||||||
Elf64_Half e_shstrndx; /* Section name strings section. */
|
Elf64_Half e_shstrndx; /* Section name strings section. */
|
||||||
} Elf64_Ehdr;
|
} Elf64_Ehdr;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -95,17 +95,17 @@ typedef struct {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
Elf64_Word sh_name; /* Section name (index into the
|
Elf64_Word sh_name; /* Section name (index into the
|
||||||
section header string table). */
|
section header string table). */
|
||||||
Elf64_Word sh_type; /* Section type. */
|
Elf64_Word sh_type; /* Section type. */
|
||||||
Elf64_Xword sh_flags; /* Section flags. */
|
Elf64_Xword sh_flags; /* Section flags. */
|
||||||
Elf64_Addr sh_addr; /* Address in memory image. */
|
Elf64_Addr sh_addr; /* Address in memory image. */
|
||||||
Elf64_Off sh_offset; /* Offset in file. */
|
Elf64_Off sh_offset; /* Offset in file. */
|
||||||
Elf64_Xword sh_size; /* Size in bytes. */
|
Elf64_Xword sh_size; /* Size in bytes. */
|
||||||
Elf64_Word sh_link; /* Index of a related section. */
|
Elf64_Word sh_link; /* Index of a related section. */
|
||||||
Elf64_Word sh_info; /* Depends on section type. */
|
Elf64_Word sh_info; /* Depends on section type. */
|
||||||
Elf64_Xword sh_addralign; /* Alignment in bytes. */
|
Elf64_Xword sh_addralign; /* Alignment in bytes. */
|
||||||
Elf64_Xword sh_entsize; /* Size of each entry in section. */
|
Elf64_Xword sh_entsize; /* Size of each entry in section. */
|
||||||
} Elf64_Shdr;
|
} Elf64_Shdr;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -113,14 +113,14 @@ typedef struct {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
Elf64_Word p_type; /* Entry type. */
|
Elf64_Word p_type; /* Entry type. */
|
||||||
Elf64_Word p_flags; /* Access permission flags. */
|
Elf64_Word p_flags; /* Access permission flags. */
|
||||||
Elf64_Off p_offset; /* File offset of contents. */
|
Elf64_Off p_offset; /* File offset of contents. */
|
||||||
Elf64_Addr p_vaddr; /* Virtual address in memory image. */
|
Elf64_Addr p_vaddr; /* Virtual address in memory image. */
|
||||||
Elf64_Addr p_paddr; /* Physical address (not used). */
|
Elf64_Addr p_paddr; /* Physical address (not used). */
|
||||||
Elf64_Xword p_filesz; /* Size of contents in file. */
|
Elf64_Xword p_filesz; /* Size of contents in file. */
|
||||||
Elf64_Xword p_memsz; /* Size of contents in memory. */
|
Elf64_Xword p_memsz; /* Size of contents in memory. */
|
||||||
Elf64_Xword p_align; /* Alignment in memory and file. */
|
Elf64_Xword p_align; /* Alignment in memory and file. */
|
||||||
} Elf64_Phdr;
|
} Elf64_Phdr;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -128,11 +128,11 @@ typedef struct {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
Elf64_Sxword d_tag; /* Entry type. */
|
Elf64_Sxword d_tag; /* Entry type. */
|
||||||
union {
|
union {
|
||||||
Elf64_Xword d_val; /* Integer value. */
|
Elf64_Xword d_val; /* Integer value. */
|
||||||
Elf64_Addr d_ptr; /* Address value. */
|
Elf64_Addr d_ptr; /* Address value. */
|
||||||
} d_un;
|
} d_un;
|
||||||
} Elf64_Dyn;
|
} Elf64_Dyn;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -141,58 +141,58 @@ typedef struct {
|
|||||||
|
|
||||||
/* Relocations that don't need an addend field. */
|
/* Relocations that don't need an addend field. */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
Elf64_Addr r_offset; /* Location to be relocated. */
|
Elf64_Addr r_offset; /* Location to be relocated. */
|
||||||
Elf64_Xword r_info; /* Relocation type and symbol index. */
|
Elf64_Xword r_info; /* Relocation type and symbol index. */
|
||||||
} Elf64_Rel;
|
} Elf64_Rel;
|
||||||
|
|
||||||
/* Relocations that need an addend field. */
|
/* Relocations that need an addend field. */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
Elf64_Addr r_offset; /* Location to be relocated. */
|
Elf64_Addr r_offset; /* Location to be relocated. */
|
||||||
Elf64_Xword r_info; /* Relocation type and symbol index. */
|
Elf64_Xword r_info; /* Relocation type and symbol index. */
|
||||||
Elf64_Sxword r_addend; /* Addend. */
|
Elf64_Sxword r_addend; /* Addend. */
|
||||||
} Elf64_Rela;
|
} Elf64_Rela;
|
||||||
|
|
||||||
/* Macros for accessing the fields of r_info. */
|
/* Macros for accessing the fields of r_info. */
|
||||||
#define ELF64_R_SYM(info) ((info) >> 32)
|
#define ELF64_R_SYM(info) ((info) >> 32)
|
||||||
#define ELF64_R_TYPE(info) ((info) & 0xffffffffL)
|
#define ELF64_R_TYPE(info) ((info) & 0xffffffffL)
|
||||||
|
|
||||||
/* Macro for constructing r_info from field values. */
|
/* Macro for constructing r_info from field values. */
|
||||||
#define ELF64_R_INFO(sym, type) (((sym) << 32) + ((type) & 0xffffffffL))
|
#define ELF64_R_INFO(sym, type) (((sym) << 32) + ((type) & 0xffffffffL))
|
||||||
|
|
||||||
#define ELF64_R_TYPE_DATA(info) (((Elf64_Xword)(info)<<32)>>40)
|
#define ELF64_R_TYPE_DATA(info) (((Elf64_Xword)(info)<<32)>>40)
|
||||||
#define ELF64_R_TYPE_ID(info) (((Elf64_Xword)(info)<<56)>>56)
|
#define ELF64_R_TYPE_ID(info) (((Elf64_Xword)(info)<<56)>>56)
|
||||||
#define ELF64_R_TYPE_INFO(data, type) \
|
#define ELF64_R_TYPE_INFO(data, type) \
|
||||||
(((Elf64_Xword)(data)<<8)+(Elf64_Xword)(type))
|
(((Elf64_Xword)(data)<<8)+(Elf64_Xword)(type))
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Note entry header
|
* Note entry header
|
||||||
*/
|
*/
|
||||||
typedef Elf_Note Elf64_Nhdr;
|
typedef Elf_Note Elf64_Nhdr;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Move entry
|
* Move entry
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
Elf64_Lword m_value; /* symbol value */
|
Elf64_Lword m_value; /* symbol value */
|
||||||
Elf64_Xword m_info; /* size + index */
|
Elf64_Xword m_info; /* size + index */
|
||||||
Elf64_Xword m_poffset; /* symbol offset */
|
Elf64_Xword m_poffset; /* symbol offset */
|
||||||
Elf64_Half m_repeat; /* repeat count */
|
Elf64_Half m_repeat; /* repeat count */
|
||||||
Elf64_Half m_stride; /* stride info */
|
Elf64_Half m_stride; /* stride info */
|
||||||
} Elf64_Move;
|
} Elf64_Move;
|
||||||
|
|
||||||
#define ELF64_M_SYM(info) ((info)>>8)
|
#define ELF64_M_SYM(info) ((info)>>8)
|
||||||
#define ELF64_M_SIZE(info) ((unsigned char)(info))
|
#define ELF64_M_SIZE(info) ((unsigned char)(info))
|
||||||
#define ELF64_M_INFO(sym, size) (((sym)<<8)+(unsigned char)(size))
|
#define ELF64_M_INFO(sym, size) (((sym)<<8)+(unsigned char)(size))
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Hardware/Software capabilities entry
|
* Hardware/Software capabilities entry
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
Elf64_Xword c_tag; /* how to interpret value */
|
Elf64_Xword c_tag; /* how to interpret value */
|
||||||
union {
|
union {
|
||||||
Elf64_Xword c_val;
|
Elf64_Xword c_val;
|
||||||
Elf64_Addr c_ptr;
|
Elf64_Addr c_ptr;
|
||||||
} c_un;
|
} c_un;
|
||||||
} Elf64_Cap;
|
} Elf64_Cap;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -200,61 +200,61 @@ typedef struct {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
Elf64_Word st_name; /* String table index of name. */
|
Elf64_Word st_name; /* String table index of name. */
|
||||||
unsigned char st_info; /* Type and binding information. */
|
unsigned char st_info; /* Type and binding information. */
|
||||||
unsigned char st_other; /* Reserved (not used). */
|
unsigned char st_other; /* Reserved (not used). */
|
||||||
Elf64_Half st_shndx; /* Section index of symbol. */
|
Elf64_Half st_shndx; /* Section index of symbol. */
|
||||||
Elf64_Addr st_value; /* Symbol value. */
|
Elf64_Addr st_value; /* Symbol value. */
|
||||||
Elf64_Xword st_size; /* Size of associated object. */
|
Elf64_Xword st_size; /* Size of associated object. */
|
||||||
} Elf64_Sym;
|
} Elf64_Sym;
|
||||||
|
|
||||||
/* Macros for accessing the fields of st_info. */
|
/* Macros for accessing the fields of st_info. */
|
||||||
#define ELF64_ST_BIND(info) ((info) >> 4)
|
#define ELF64_ST_BIND(info) ((info) >> 4)
|
||||||
#define ELF64_ST_TYPE(info) ((info) & 0xf)
|
#define ELF64_ST_TYPE(info) ((info) & 0xf)
|
||||||
|
|
||||||
/* Macro for constructing st_info from field values. */
|
/* Macro for constructing st_info from field values. */
|
||||||
#define ELF64_ST_INFO(bind, type) (((bind) << 4) + ((type) & 0xf))
|
#define ELF64_ST_INFO(bind, type) (((bind) << 4) + ((type) & 0xf))
|
||||||
|
|
||||||
/* Macro for accessing the fields of st_other. */
|
/* Macro for accessing the fields of st_other. */
|
||||||
#define ELF64_ST_VISIBILITY(oth) ((oth) & 0x3)
|
#define ELF64_ST_VISIBILITY(oth) ((oth) & 0x3)
|
||||||
|
|
||||||
/* Structures used by Sun & GNU-style symbol versioning. */
|
/* Structures used by Sun & GNU-style symbol versioning. */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
Elf64_Half vd_version;
|
Elf64_Half vd_version;
|
||||||
Elf64_Half vd_flags;
|
Elf64_Half vd_flags;
|
||||||
Elf64_Half vd_ndx;
|
Elf64_Half vd_ndx;
|
||||||
Elf64_Half vd_cnt;
|
Elf64_Half vd_cnt;
|
||||||
Elf64_Word vd_hash;
|
Elf64_Word vd_hash;
|
||||||
Elf64_Word vd_aux;
|
Elf64_Word vd_aux;
|
||||||
Elf64_Word vd_next;
|
Elf64_Word vd_next;
|
||||||
} Elf64_Verdef;
|
} Elf64_Verdef;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
Elf64_Word vda_name;
|
Elf64_Word vda_name;
|
||||||
Elf64_Word vda_next;
|
Elf64_Word vda_next;
|
||||||
} Elf64_Verdaux;
|
} Elf64_Verdaux;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
Elf64_Half vn_version;
|
Elf64_Half vn_version;
|
||||||
Elf64_Half vn_cnt;
|
Elf64_Half vn_cnt;
|
||||||
Elf64_Word vn_file;
|
Elf64_Word vn_file;
|
||||||
Elf64_Word vn_aux;
|
Elf64_Word vn_aux;
|
||||||
Elf64_Word vn_next;
|
Elf64_Word vn_next;
|
||||||
} Elf64_Verneed;
|
} Elf64_Verneed;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
Elf64_Word vna_hash;
|
Elf64_Word vna_hash;
|
||||||
Elf64_Half vna_flags;
|
Elf64_Half vna_flags;
|
||||||
Elf64_Half vna_other;
|
Elf64_Half vna_other;
|
||||||
Elf64_Word vna_name;
|
Elf64_Word vna_name;
|
||||||
Elf64_Word vna_next;
|
Elf64_Word vna_next;
|
||||||
} Elf64_Vernaux;
|
} Elf64_Vernaux;
|
||||||
|
|
||||||
typedef Elf64_Half Elf64_Versym;
|
typedef Elf64_Half Elf64_Versym;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
Elf64_Half si_boundto; /* direct bindings - symbol bound to */
|
Elf64_Half si_boundto; /* direct bindings - symbol bound to */
|
||||||
Elf64_Half si_flags; /* per symbol flags */
|
Elf64_Half si_flags; /* per symbol flags */
|
||||||
} Elf64_Syminfo;
|
} Elf64_Syminfo;
|
||||||
|
|
||||||
#endif /* !_SYS_ELF64_H_ */
|
#endif /* !_SYS_ELF64_H_ */
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -1,9 +1,9 @@
|
|||||||
/** @file
|
/** @file
|
||||||
Pre-Create a 4G page table (2M pages).
|
Pre-Create a 4G page table (2M pages).
|
||||||
It's used in DUET x64 build needed to enter LongMode.
|
It's used in DUET x64 build needed to enter LongMode.
|
||||||
|
|
||||||
Create 4G page table (2M pages)
|
Create 4G page table (2M pages)
|
||||||
|
|
||||||
Linear Address
|
Linear Address
|
||||||
63 48 47 39 38 30 29 21 20 0
|
63 48 47 39 38 30 29 21 20 0
|
||||||
+--------+-------+---------------+-----------+-----------------------------+
|
+--------+-------+---------------+-----------+-----------------------------+
|
||||||
@@ -15,14 +15,14 @@
|
|||||||
Directory-Ptr Directory {512}
|
Directory-Ptr Directory {512}
|
||||||
) {4}
|
) {4}
|
||||||
|
|
||||||
Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
http://opensource.org/licenses/bsd-license.php
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
@@ -96,7 +96,7 @@ Usage (
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
printf ("Usage: GenPage.exe [options] EfiLoaderImageName \n\n\
|
printf ("Usage: GenPage.exe [options] EfiLoaderImageName \n\n\
|
||||||
Copyright (c) 2008 - 2014, Intel Corporation. All rights reserved.\n\n\
|
Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.\n\n\
|
||||||
Utility to generate the EfiLoader image containing a page table.\n\n\
|
Utility to generate the EfiLoader image containing a page table.\n\n\
|
||||||
optional arguments:\n\
|
optional arguments:\n\
|
||||||
-h, --help Show this help message and exit\n\
|
-h, --help Show this help message and exit\n\
|
||||||
@@ -170,7 +170,7 @@ Return:
|
|||||||
for (PML4Index = 0; PML4Index < EFI_PML4_ENTRY_NUM; PML4Index++, PageMapLevel4Entry++) {
|
for (PML4Index = 0; PML4Index < EFI_PML4_ENTRY_NUM; PML4Index++, PageMapLevel4Entry++) {
|
||||||
//
|
//
|
||||||
// Each Page-Map-Level-4-Table Entry points to the base address of a Page-Directory-Pointer-Table Entry
|
// Each Page-Map-Level-4-Table Entry points to the base address of a Page-Directory-Pointer-Table Entry
|
||||||
//
|
//
|
||||||
PageTablePtr += EFI_SIZE_OF_PAGE;
|
PageTablePtr += EFI_SIZE_OF_PAGE;
|
||||||
PageDirectoryPointerEntry = (X64_PAGE_MAP_AND_DIRECTORY_POINTER_2MB_4K *)PageTablePtr;
|
PageDirectoryPointerEntry = (X64_PAGE_MAP_AND_DIRECTORY_POINTER_2MB_4K *)PageTablePtr;
|
||||||
|
|
||||||
@@ -184,7 +184,7 @@ Return:
|
|||||||
for (PDPTEIndex = 0; PDPTEIndex < EFI_PDPTE_ENTRY_NUM; PDPTEIndex++, PageDirectoryPointerEntry++) {
|
for (PDPTEIndex = 0; PDPTEIndex < EFI_PDPTE_ENTRY_NUM; PDPTEIndex++, PageDirectoryPointerEntry++) {
|
||||||
//
|
//
|
||||||
// Each Page-Directory-Pointer-Table Entry points to the base address of a Page-Directory Entry
|
// Each Page-Directory-Pointer-Table Entry points to the base address of a Page-Directory Entry
|
||||||
//
|
//
|
||||||
PageTablePtr += EFI_SIZE_OF_PAGE;
|
PageTablePtr += EFI_SIZE_OF_PAGE;
|
||||||
PageDirectoryEntry2MB = (X64_PAGE_TABLE_ENTRY_2M *)PageTablePtr;
|
PageDirectoryEntry2MB = (X64_PAGE_TABLE_ENTRY_2M *)PageTablePtr;
|
||||||
|
|
||||||
@@ -310,20 +310,20 @@ main (
|
|||||||
Usage();
|
Usage();
|
||||||
return STATUS_ERROR;
|
return STATUS_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
argc --;
|
argc --;
|
||||||
argv ++;
|
argv ++;
|
||||||
|
|
||||||
if ((stricmp (argv[0], "-h") == 0) || (stricmp (argv[0], "--help") == 0)) {
|
if ((stricmp (argv[0], "-h") == 0) || (stricmp (argv[0], "--help") == 0)) {
|
||||||
Usage();
|
Usage();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stricmp (argv[0], "--version") == 0) {
|
if (stricmp (argv[0], "--version") == 0) {
|
||||||
Version();
|
Version();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (argc > 0) {
|
while (argc > 0) {
|
||||||
if ((stricmp (argv[0], "-o") == 0) || (stricmp (argv[0], "--output") == 0)) {
|
if ((stricmp (argv[0], "-o") == 0) || (stricmp (argv[0], "--output") == 0)) {
|
||||||
if (argv[1] == NULL || argv[1][0] == '-') {
|
if (argv[1] == NULL || argv[1][0] == '-') {
|
||||||
@@ -333,9 +333,9 @@ main (
|
|||||||
OutputFile = argv[1];
|
OutputFile = argv[1];
|
||||||
argc -= 2;
|
argc -= 2;
|
||||||
argv += 2;
|
argv += 2;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((stricmp (argv[0], "-b") == 0) || (stricmp (argv[0], "--baseaddr") == 0)) {
|
if ((stricmp (argv[0], "-b") == 0) || (stricmp (argv[0], "--baseaddr") == 0)) {
|
||||||
if (argv[1] == NULL || argv[1][0] == '-') {
|
if (argv[1] == NULL || argv[1][0] == '-') {
|
||||||
Error (NULL, 0, 1003, "Invalid option value", "Base address is missing for -b option");
|
Error (NULL, 0, 1003, "Invalid option value", "Base address is missing for -b option");
|
||||||
@@ -349,9 +349,9 @@ main (
|
|||||||
gPageTableBaseAddress = (UINT32) TempValue;
|
gPageTableBaseAddress = (UINT32) TempValue;
|
||||||
argc -= 2;
|
argc -= 2;
|
||||||
argv += 2;
|
argv += 2;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((stricmp (argv[0], "-f") == 0) || (stricmp (argv[0], "--offset") == 0)) {
|
if ((stricmp (argv[0], "-f") == 0) || (stricmp (argv[0], "--offset") == 0)) {
|
||||||
if (argv[1] == NULL || argv[1][0] == '-') {
|
if (argv[1] == NULL || argv[1][0] == '-') {
|
||||||
Error (NULL, 0, 1003, "Invalid option value", "Offset is missing for -f option");
|
Error (NULL, 0, 1003, "Invalid option value", "Offset is missing for -f option");
|
||||||
@@ -365,21 +365,21 @@ main (
|
|||||||
gPageTableOffsetInFile = (UINT32) TempValue;
|
gPageTableOffsetInFile = (UINT32) TempValue;
|
||||||
argc -= 2;
|
argc -= 2;
|
||||||
argv += 2;
|
argv += 2;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((stricmp (argv[0], "-q") == 0) || (stricmp (argv[0], "--quiet") == 0)) {
|
if ((stricmp (argv[0], "-q") == 0) || (stricmp (argv[0], "--quiet") == 0)) {
|
||||||
argc --;
|
argc --;
|
||||||
argv ++;
|
argv ++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((stricmp (argv[0], "-v") ==0) || (stricmp (argv[0], "--verbose") == 0)) {
|
if ((stricmp (argv[0], "-v") ==0) || (stricmp (argv[0], "--verbose") == 0)) {
|
||||||
argc --;
|
argc --;
|
||||||
argv ++;
|
argv ++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((stricmp (argv[0], "-d") == 0) || (stricmp (argv[0], "--debug") == 0)) {
|
if ((stricmp (argv[0], "-d") == 0) || (stricmp (argv[0], "--debug") == 0)) {
|
||||||
if (argv[1] == NULL || argv[1][0] == '-') {
|
if (argv[1] == NULL || argv[1][0] == '-') {
|
||||||
Error (NULL, 0, 1003, "Invalid option value", "Debug Level is not specified.");
|
Error (NULL, 0, 1003, "Invalid option value", "Debug Level is not specified.");
|
||||||
@@ -396,14 +396,14 @@ main (
|
|||||||
}
|
}
|
||||||
argc -= 2;
|
argc -= 2;
|
||||||
argv += 2;
|
argv += 2;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (argv[0][0] == '-') {
|
if (argv[0][0] == '-') {
|
||||||
Error (NULL, 0, 1000, "Unknown option", argv[0]);
|
Error (NULL, 0, 1000, "Unknown option", argv[0]);
|
||||||
return STATUS_ERROR;
|
return STATUS_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Don't recognize the parameter.
|
// Don't recognize the parameter.
|
||||||
//
|
//
|
||||||
@@ -411,12 +411,12 @@ main (
|
|||||||
argc--;
|
argc--;
|
||||||
argv++;
|
argv++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (InputFile == NULL) {
|
if (InputFile == NULL) {
|
||||||
Error (NULL, 0, 1003, "Invalid option value", "Input file is not specified");
|
Error (NULL, 0, 1003, "Invalid option value", "Input file is not specified");
|
||||||
return STATUS_ERROR;
|
return STATUS_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Create X64 page table
|
// Create X64 page table
|
||||||
//
|
//
|
||||||
|
@@ -1,21 +1,21 @@
|
|||||||
/** @file
|
/** @file
|
||||||
x64 Long Mode Virtual Memory Management Definitions
|
x64 Long Mode Virtual Memory Management Definitions
|
||||||
|
|
||||||
References:
|
References:
|
||||||
1) IA-32 Intel(R) Atchitecture Software Developer's Manual Volume 1:Basic Architecture, Intel
|
1) IA-32 Intel(R) Atchitecture Software Developer's Manual Volume 1:Basic Architecture, Intel
|
||||||
2) IA-32 Intel(R) Atchitecture Software Developer's Manual Volume 2:Instruction Set Reference, Intel
|
2) IA-32 Intel(R) Atchitecture Software Developer's Manual Volume 2:Instruction Set Reference, Intel
|
||||||
3) IA-32 Intel(R) Atchitecture Software Developer's Manual Volume 3:System Programmer's Guide, Intel
|
3) IA-32 Intel(R) Atchitecture Software Developer's Manual Volume 3:System Programmer's Guide, Intel
|
||||||
4) AMD64 Architecture Programmer's Manual Volume 2: System Programming
|
4) AMD64 Architecture Programmer's Manual Volume 2: System Programming
|
||||||
|
|
||||||
Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
http://opensource.org/licenses/bsd-license.php
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
#ifndef _VIRTUAL_MEMORY_H_
|
#ifndef _VIRTUAL_MEMORY_H_
|
||||||
@@ -82,7 +82,7 @@ typedef union {
|
|||||||
UINT64 CacheDisabled:1; // 0 = Cached, 1=Non-Cached
|
UINT64 CacheDisabled:1; // 0 = Cached, 1=Non-Cached
|
||||||
UINT64 Accessed:1; // 0 = Not accessed, 1 = Accessed (set by CPU)
|
UINT64 Accessed:1; // 0 = Not accessed, 1 = Accessed (set by CPU)
|
||||||
UINT64 Dirty:1; // 0 = Not Dirty, 1 = written by processor on access to page
|
UINT64 Dirty:1; // 0 = Not Dirty, 1 = written by processor on access to page
|
||||||
UINT64 PAT:1; // 0 = Ignore Page Attribute Table
|
UINT64 PAT:1; // 0 = Ignore Page Attribute Table
|
||||||
UINT64 Global:1; // 0 = Not global page, 1 = global page TLB not cleared on CR3 write
|
UINT64 Global:1; // 0 = Not global page, 1 = global page TLB not cleared on CR3 write
|
||||||
UINT64 Available:3; // Available for use by system software
|
UINT64 Available:3; // Available for use by system software
|
||||||
UINT64 PageTableBaseAddress:40; // Page Table Base Address
|
UINT64 PageTableBaseAddress:40; // Page Table Base Address
|
||||||
@@ -105,7 +105,7 @@ typedef union {
|
|||||||
UINT64 CacheDisabled:1; // 0 = Cached, 1=Non-Cached
|
UINT64 CacheDisabled:1; // 0 = Cached, 1=Non-Cached
|
||||||
UINT64 Accessed:1; // 0 = Not accessed, 1 = Accessed (set by CPU)
|
UINT64 Accessed:1; // 0 = Not accessed, 1 = Accessed (set by CPU)
|
||||||
UINT64 Dirty:1; // 0 = Not Dirty, 1 = written by processor on access to page
|
UINT64 Dirty:1; // 0 = Not Dirty, 1 = written by processor on access to page
|
||||||
UINT64 MustBe1:1; // Must be 1
|
UINT64 MustBe1:1; // Must be 1
|
||||||
UINT64 Global:1; // 0 = Not global page, 1 = global page TLB not cleared on CR3 write
|
UINT64 Global:1; // 0 = Not global page, 1 = global page TLB not cleared on CR3 write
|
||||||
UINT64 Available:3; // Available for use by system software
|
UINT64 Available:3; // Available for use by system software
|
||||||
UINT64 PAT:1; //
|
UINT64 PAT:1; //
|
||||||
@@ -119,4 +119,4 @@ typedef union {
|
|||||||
|
|
||||||
#pragma pack()
|
#pragma pack()
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -2,13 +2,13 @@
|
|||||||
Creates output file that is a properly formed section per the PI spec.
|
Creates output file that is a properly formed section per the PI spec.
|
||||||
|
|
||||||
Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
http://opensource.org/licenses/bsd-license.php
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
#ifndef __GNUC__
|
#ifndef __GNUC__
|
||||||
@@ -103,7 +103,7 @@ STATIC EFI_GUID mZeroGuid = {0x0, 0x0, 0x0, {0x0, 0x0, 0x0, 0x0
|
|||||||
STATIC EFI_GUID mEfiCrc32SectionGuid = EFI_CRC32_GUIDED_SECTION_EXTRACTION_PROTOCOL_GUID;
|
STATIC EFI_GUID mEfiCrc32SectionGuid = EFI_CRC32_GUIDED_SECTION_EXTRACTION_PROTOCOL_GUID;
|
||||||
|
|
||||||
STATIC
|
STATIC
|
||||||
VOID
|
VOID
|
||||||
Version (
|
Version (
|
||||||
VOID
|
VOID
|
||||||
)
|
)
|
||||||
@@ -116,12 +116,12 @@ Routine Description:
|
|||||||
Arguments:
|
Arguments:
|
||||||
|
|
||||||
None
|
None
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
|
|
||||||
None
|
None
|
||||||
|
|
||||||
--*/
|
--*/
|
||||||
{
|
{
|
||||||
fprintf (stdout, "%s Version %d.%d %s \n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION, __BUILD_VERSION);
|
fprintf (stdout, "%s Version %d.%d %s \n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION, __BUILD_VERSION);
|
||||||
}
|
}
|
||||||
@@ -151,11 +151,11 @@ Returns:
|
|||||||
// Summary usage
|
// Summary usage
|
||||||
//
|
//
|
||||||
fprintf (stdout, "\nUsage: %s [options] [input_file]\n\n", UTILITY_NAME);
|
fprintf (stdout, "\nUsage: %s [options] [input_file]\n\n", UTILITY_NAME);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Copyright declaration
|
// Copyright declaration
|
||||||
//
|
//
|
||||||
fprintf (stdout, "Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.\n\n");
|
fprintf (stdout, "Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.\n\n");
|
||||||
|
|
||||||
//
|
//
|
||||||
// Details Option
|
// Details Option
|
||||||
@@ -176,7 +176,7 @@ Returns:
|
|||||||
EFI_SECTION_ALL is default section type.\n");
|
EFI_SECTION_ALL is default section type.\n");
|
||||||
fprintf (stdout, " -c [Type], --compress [Type]\n\
|
fprintf (stdout, " -c [Type], --compress [Type]\n\
|
||||||
Compress method type can be PI_NONE or PI_STD.\n\
|
Compress method type can be PI_NONE or PI_STD.\n\
|
||||||
if -c option is not given, PI_STD is default type.\n");
|
if -c option is not given, PI_STD is default type.\n");
|
||||||
fprintf (stdout, " -g GuidValue, --vendor GuidValue\n\
|
fprintf (stdout, " -g GuidValue, --vendor GuidValue\n\
|
||||||
GuidValue is one specific vendor guid value.\n\
|
GuidValue is one specific vendor guid value.\n\
|
||||||
Its format is xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\n");
|
Its format is xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\n");
|
||||||
@@ -215,7 +215,7 @@ Ascii2UnicodeString (
|
|||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
|
|
||||||
Write ascii string as unicode string format to FILE
|
Write ascii string as unicode string format to FILE
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
|
|
||||||
@@ -235,7 +235,7 @@ Returns:
|
|||||||
// End the UniString with a NULL.
|
// End the UniString with a NULL.
|
||||||
//
|
//
|
||||||
*UniString = '\0';
|
*UniString = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
STATUS
|
STATUS
|
||||||
GenSectionCommonLeafSection (
|
GenSectionCommonLeafSection (
|
||||||
@@ -245,19 +245,19 @@ GenSectionCommonLeafSection (
|
|||||||
UINT8 **OutFileBuffer
|
UINT8 **OutFileBuffer
|
||||||
)
|
)
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
|
|
||||||
Generate a leaf section of type other than EFI_SECTION_VERSION
|
Generate a leaf section of type other than EFI_SECTION_VERSION
|
||||||
and EFI_SECTION_USER_INTERFACE. Input file must be well formed.
|
and EFI_SECTION_USER_INTERFACE. Input file must be well formed.
|
||||||
The function won't validate the input file's contents. For
|
The function won't validate the input file's contents. For
|
||||||
common leaf sections, the input file may be a binary file.
|
common leaf sections, the input file may be a binary file.
|
||||||
The utility will add section header to the file.
|
The utility will add section header to the file.
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
|
|
||||||
InputFileName - Name of the input file.
|
InputFileName - Name of the input file.
|
||||||
|
|
||||||
InputFileNum - Number of input files. Should be 1 for leaf section.
|
InputFileNum - Number of input files. Should be 1 for leaf section.
|
||||||
|
|
||||||
SectionType - A valid section type string
|
SectionType - A valid section type string
|
||||||
@@ -265,7 +265,7 @@ Arguments:
|
|||||||
OutFileBuffer - Buffer pointer to Output file contents
|
OutFileBuffer - Buffer pointer to Output file contents
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
|
|
||||||
STATUS_ERROR - can't continue
|
STATUS_ERROR - can't continue
|
||||||
STATUS_SUCCESS - successful return
|
STATUS_SUCCESS - successful return
|
||||||
|
|
||||||
@@ -323,7 +323,7 @@ Returns:
|
|||||||
//
|
//
|
||||||
Buffer = (UINT8 *) malloc ((size_t) TotalLength);
|
Buffer = (UINT8 *) malloc ((size_t) TotalLength);
|
||||||
if (Buffer == NULL) {
|
if (Buffer == NULL) {
|
||||||
Error (NULL, 0, 4001, "Resource", "memory cannot be allcoated");
|
Error (NULL, 0, 4001, "Resource", "memory cannot be allcoated");
|
||||||
goto Done;
|
goto Done;
|
||||||
}
|
}
|
||||||
CommonSect = (EFI_COMMON_SECTION_HEADER *) Buffer;
|
CommonSect = (EFI_COMMON_SECTION_HEADER *) Buffer;
|
||||||
@@ -336,7 +336,7 @@ Returns:
|
|||||||
memset(CommonSect->Size, 0xff, sizeof(UINT8) * 3);
|
memset(CommonSect->Size, 0xff, sizeof(UINT8) * 3);
|
||||||
((EFI_COMMON_SECTION_HEADER2 *)CommonSect)->ExtendedSize = TotalLength;
|
((EFI_COMMON_SECTION_HEADER2 *)CommonSect)->ExtendedSize = TotalLength;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// read data from the input file.
|
// read data from the input file.
|
||||||
//
|
//
|
||||||
@@ -348,7 +348,7 @@ Returns:
|
|||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Set OutFileBuffer
|
// Set OutFileBuffer
|
||||||
//
|
//
|
||||||
*OutFileBuffer = Buffer;
|
*OutFileBuffer = Buffer;
|
||||||
Status = STATUS_SUCCESS;
|
Status = STATUS_SUCCESS;
|
||||||
@@ -408,14 +408,14 @@ GetSectionContents (
|
|||||||
UINT32 *BufferLength
|
UINT32 *BufferLength
|
||||||
)
|
)
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
|
|
||||||
Get the contents of all section files specified in InputFileName
|
Get the contents of all section files specified in InputFileName
|
||||||
into FileBuffer.
|
into FileBuffer.
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
|
|
||||||
InputFileName - Name of the input file.
|
InputFileName - Name of the input file.
|
||||||
|
|
||||||
InputFileAlign - Alignment required by the input file data.
|
InputFileAlign - Alignment required by the input file data.
|
||||||
@@ -424,11 +424,11 @@ Arguments:
|
|||||||
|
|
||||||
FileBuffer - Output buffer to contain data
|
FileBuffer - Output buffer to contain data
|
||||||
|
|
||||||
BufferLength - On input, this is size of the FileBuffer.
|
BufferLength - On input, this is size of the FileBuffer.
|
||||||
On output, this is the actual length of the data.
|
On output, this is the actual length of the data.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
|
|
||||||
EFI_SUCCESS on successful return
|
EFI_SUCCESS on successful return
|
||||||
EFI_INVALID_PARAMETER if InputFileNum is less than 1 or BufferLength point is NULL.
|
EFI_INVALID_PARAMETER if InputFileNum is less than 1 or BufferLength point is NULL.
|
||||||
EFI_ABORTED if unable to open input file.
|
EFI_ABORTED if unable to open input file.
|
||||||
@@ -475,8 +475,8 @@ Returns:
|
|||||||
}
|
}
|
||||||
Size++;
|
Size++;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Open file and read contents
|
// Open file and read contents
|
||||||
//
|
//
|
||||||
InFile = fopen (LongFilePath (InputFileName[Index]), "rb");
|
InFile = fopen (LongFilePath (InputFileName[Index]), "rb");
|
||||||
@@ -488,7 +488,7 @@ Returns:
|
|||||||
fseek (InFile, 0, SEEK_END);
|
fseek (InFile, 0, SEEK_END);
|
||||||
FileSize = ftell (InFile);
|
FileSize = ftell (InFile);
|
||||||
fseek (InFile, 0, SEEK_SET);
|
fseek (InFile, 0, SEEK_SET);
|
||||||
DebugMsg (NULL, 0, 9, "Input files", "the input file name is %s and the size is %u bytes", InputFileName[Index], (unsigned) FileSize);
|
DebugMsg (NULL, 0, 9, "Input files", "the input file name is %s and the size is %u bytes", InputFileName[Index], (unsigned) FileSize);
|
||||||
//
|
//
|
||||||
// Adjust section buffer when section alignment is required.
|
// Adjust section buffer when section alignment is required.
|
||||||
//
|
//
|
||||||
@@ -525,7 +525,7 @@ Returns:
|
|||||||
HeaderSize = GuidSectHeader.DataOffset;
|
HeaderSize = GuidSectHeader.DataOffset;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fseek (InFile, 0, SEEK_SET);
|
fseek (InFile, 0, SEEK_SET);
|
||||||
|
|
||||||
@@ -544,7 +544,7 @@ Returns:
|
|||||||
if ((InputFileAlign [Index] != 0) && (((Size + HeaderSize + TeOffset) % InputFileAlign [Index]) != 0)) {
|
if ((InputFileAlign [Index] != 0) && (((Size + HeaderSize + TeOffset) % InputFileAlign [Index]) != 0)) {
|
||||||
Offset = (Size + sizeof (EFI_COMMON_SECTION_HEADER) + HeaderSize + TeOffset + InputFileAlign [Index] - 1) & ~(InputFileAlign [Index] - 1);
|
Offset = (Size + sizeof (EFI_COMMON_SECTION_HEADER) + HeaderSize + TeOffset + InputFileAlign [Index] - 1) & ~(InputFileAlign [Index] - 1);
|
||||||
Offset = Offset - Size - HeaderSize - TeOffset;
|
Offset = Offset - Size - HeaderSize - TeOffset;
|
||||||
|
|
||||||
if (FileBuffer != NULL && ((Size + Offset) < *BufferLength)) {
|
if (FileBuffer != NULL && ((Size + Offset) < *BufferLength)) {
|
||||||
//
|
//
|
||||||
// The maximal alignment is 64K, the raw section size must be less than 0xffffff
|
// The maximal alignment is 64K, the raw section size must be less than 0xffffff
|
||||||
@@ -577,7 +577,7 @@ Returns:
|
|||||||
fclose (InFile);
|
fclose (InFile);
|
||||||
Size += FileSize;
|
Size += FileSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Set the real required buffer size.
|
// Set the real required buffer size.
|
||||||
//
|
//
|
||||||
@@ -599,28 +599,28 @@ GenSectionCompressionSection (
|
|||||||
UINT8 **OutFileBuffer
|
UINT8 **OutFileBuffer
|
||||||
)
|
)
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
|
|
||||||
Generate an encapsulating section of type EFI_SECTION_COMPRESSION
|
Generate an encapsulating section of type EFI_SECTION_COMPRESSION
|
||||||
Input file must be already sectioned. The function won't validate
|
Input file must be already sectioned. The function won't validate
|
||||||
the input files' contents. Caller should hand in files already
|
the input files' contents. Caller should hand in files already
|
||||||
with section header.
|
with section header.
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
|
|
||||||
InputFileName - Name of the input file.
|
InputFileName - Name of the input file.
|
||||||
|
|
||||||
InputFileAlign - Alignment required by the input file data.
|
InputFileAlign - Alignment required by the input file data.
|
||||||
|
|
||||||
InputFileNum - Number of input files. Should be at least 1.
|
InputFileNum - Number of input files. Should be at least 1.
|
||||||
|
|
||||||
SectCompSubType - Specify the compression algorithm requested.
|
SectCompSubType - Specify the compression algorithm requested.
|
||||||
|
|
||||||
OutFileBuffer - Buffer pointer to Output file contents
|
OutFileBuffer - Buffer pointer to Output file contents
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
|
|
||||||
EFI_SUCCESS on successful return
|
EFI_SUCCESS on successful return
|
||||||
EFI_INVALID_PARAMETER if InputFileNum is less than 1
|
EFI_INVALID_PARAMETER if InputFileNum is less than 1
|
||||||
EFI_ABORTED if unable to open input file.
|
EFI_ABORTED if unable to open input file.
|
||||||
@@ -754,7 +754,7 @@ Returns:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DebugMsg (NULL, 0, 9, "comprss file size",
|
DebugMsg (NULL, 0, 9, "comprss file size",
|
||||||
"the original section size is %d bytes and the compressed section size is %u bytes", (unsigned) InputLength, (unsigned) CompressedLength);
|
"the original section size is %d bytes and the compressed section size is %u bytes", (unsigned) InputLength, (unsigned) CompressedLength);
|
||||||
|
|
||||||
//if (TotalLength >= MAX_SECTION_SIZE) {
|
//if (TotalLength >= MAX_SECTION_SIZE) {
|
||||||
@@ -782,7 +782,7 @@ Returns:
|
|||||||
CompressionSect2->UncompressedLength = InputLength;
|
CompressionSect2->UncompressedLength = InputLength;
|
||||||
} else {
|
} else {
|
||||||
CompressionSect = (EFI_COMPRESSION_SECTION *) FileBuffer;
|
CompressionSect = (EFI_COMPRESSION_SECTION *) FileBuffer;
|
||||||
|
|
||||||
CompressionSect->CommonHeader.Type = EFI_SECTION_COMPRESSION;
|
CompressionSect->CommonHeader.Type = EFI_SECTION_COMPRESSION;
|
||||||
CompressionSect->CommonHeader.Size[0] = (UINT8) (TotalLength & 0xff);
|
CompressionSect->CommonHeader.Size[0] = (UINT8) (TotalLength & 0xff);
|
||||||
CompressionSect->CommonHeader.Size[1] = (UINT8) ((TotalLength & 0xff00) >> 8);
|
CompressionSect->CommonHeader.Size[1] = (UINT8) ((TotalLength & 0xff00) >> 8);
|
||||||
@@ -792,7 +792,7 @@ Returns:
|
|||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Set OutFileBuffer
|
// Set OutFileBuffer
|
||||||
//
|
//
|
||||||
*OutFileBuffer = FileBuffer;
|
*OutFileBuffer = FileBuffer;
|
||||||
|
|
||||||
@@ -810,32 +810,32 @@ GenSectionGuidDefinedSection (
|
|||||||
UINT8 **OutFileBuffer
|
UINT8 **OutFileBuffer
|
||||||
)
|
)
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
|
|
||||||
Generate an encapsulating section of type EFI_SECTION_GUID_DEFINED
|
Generate an encapsulating section of type EFI_SECTION_GUID_DEFINED
|
||||||
Input file must be already sectioned. The function won't validate
|
Input file must be already sectioned. The function won't validate
|
||||||
the input files' contents. Caller should hand in files already
|
the input files' contents. Caller should hand in files already
|
||||||
with section header.
|
with section header.
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
|
|
||||||
InputFileName - Name of the input file.
|
InputFileName - Name of the input file.
|
||||||
|
|
||||||
InputFileAlign - Alignment required by the input file data.
|
InputFileAlign - Alignment required by the input file data.
|
||||||
|
|
||||||
InputFileNum - Number of input files. Should be at least 1.
|
InputFileNum - Number of input files. Should be at least 1.
|
||||||
|
|
||||||
VendorGuid - Specify vendor guid value.
|
VendorGuid - Specify vendor guid value.
|
||||||
|
|
||||||
DataAttribute - Specify attribute for the vendor guid data.
|
DataAttribute - Specify attribute for the vendor guid data.
|
||||||
|
|
||||||
DataHeaderSize- Guided Data Header Size
|
DataHeaderSize- Guided Data Header Size
|
||||||
|
|
||||||
OutFileBuffer - Buffer pointer to Output file contents
|
OutFileBuffer - Buffer pointer to Output file contents
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
|
|
||||||
EFI_SUCCESS on successful return
|
EFI_SUCCESS on successful return
|
||||||
EFI_INVALID_PARAMETER if InputFileNum is less than 1
|
EFI_INVALID_PARAMETER if InputFileNum is less than 1
|
||||||
EFI_ABORTED if unable to open input file.
|
EFI_ABORTED if unable to open input file.
|
||||||
@@ -935,7 +935,7 @@ Returns:
|
|||||||
//
|
//
|
||||||
Crc32Checksum = 0;
|
Crc32Checksum = 0;
|
||||||
CalculateCrc32 (FileBuffer + Offset, InputLength, &Crc32Checksum);
|
CalculateCrc32 (FileBuffer + Offset, InputLength, &Crc32Checksum);
|
||||||
|
|
||||||
if (TotalLength >= MAX_SECTION_SIZE) {
|
if (TotalLength >= MAX_SECTION_SIZE) {
|
||||||
Crc32GuidSect2 = (CRC32_SECTION_HEADER2 *) FileBuffer;
|
Crc32GuidSect2 = (CRC32_SECTION_HEADER2 *) FileBuffer;
|
||||||
Crc32GuidSect2->GuidSectionHeader.CommonHeader.Type = EFI_SECTION_GUID_DEFINED;
|
Crc32GuidSect2->GuidSectionHeader.CommonHeader.Type = EFI_SECTION_GUID_DEFINED;
|
||||||
@@ -985,9 +985,9 @@ Returns:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
VerboseMsg ("the size of the created section file is %u bytes", (unsigned) TotalLength);
|
VerboseMsg ("the size of the created section file is %u bytes", (unsigned) TotalLength);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Set OutFileBuffer
|
// Set OutFileBuffer
|
||||||
//
|
//
|
||||||
*OutFileBuffer = FileBuffer;
|
*OutFileBuffer = FileBuffer;
|
||||||
|
|
||||||
@@ -1126,7 +1126,7 @@ Returns:
|
|||||||
int VersionNumber;
|
int VersionNumber;
|
||||||
UINT8 SectType;
|
UINT8 SectType;
|
||||||
UINT8 SectCompSubType;
|
UINT8 SectCompSubType;
|
||||||
UINT16 SectGuidAttribute;
|
UINT16 SectGuidAttribute;
|
||||||
UINT64 SectGuidHeaderLength;
|
UINT64 SectGuidHeaderLength;
|
||||||
EFI_VERSION_SECTION *VersionSect;
|
EFI_VERSION_SECTION *VersionSect;
|
||||||
EFI_USER_INTERFACE_SECTION *UiSect;
|
EFI_USER_INTERFACE_SECTION *UiSect;
|
||||||
@@ -1172,9 +1172,9 @@ Returns:
|
|||||||
InFile = NULL;
|
InFile = NULL;
|
||||||
InFileSize = 0;
|
InFileSize = 0;
|
||||||
InFileBuffer = NULL;
|
InFileBuffer = NULL;
|
||||||
|
|
||||||
SetUtilityName (UTILITY_NAME);
|
SetUtilityName (UTILITY_NAME);
|
||||||
|
|
||||||
if (argc == 1) {
|
if (argc == 1) {
|
||||||
Error (NULL, 0, 1001, "Missing options", "No options input");
|
Error (NULL, 0, 1001, "Missing options", "No options input");
|
||||||
Usage ();
|
Usage ();
|
||||||
@@ -1190,12 +1190,12 @@ Returns:
|
|||||||
if ((stricmp (argv[0], "-h") == 0) || (stricmp (argv[0], "--help") == 0)) {
|
if ((stricmp (argv[0], "-h") == 0) || (stricmp (argv[0], "--help") == 0)) {
|
||||||
Version ();
|
Version ();
|
||||||
Usage ();
|
Usage ();
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stricmp (argv[0], "--version") == 0) {
|
if (stricmp (argv[0], "--version") == 0) {
|
||||||
Version ();
|
Version ();
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (argc > 0) {
|
while (argc > 0) {
|
||||||
@@ -1207,7 +1207,7 @@ Returns:
|
|||||||
}
|
}
|
||||||
argc -= 2;
|
argc -= 2;
|
||||||
argv += 2;
|
argv += 2;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((stricmp (argv[0], "-o") == 0) || (stricmp (argv[0], "--outputfile") == 0)) {
|
if ((stricmp (argv[0], "-o") == 0) || (stricmp (argv[0], "--outputfile") == 0)) {
|
||||||
@@ -1218,7 +1218,7 @@ Returns:
|
|||||||
}
|
}
|
||||||
argc -= 2;
|
argc -= 2;
|
||||||
argv += 2;
|
argv += 2;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((stricmp (argv[0], "-c") == 0) || (stricmp (argv[0], "--compress") == 0)) {
|
if ((stricmp (argv[0], "-c") == 0) || (stricmp (argv[0], "--compress") == 0)) {
|
||||||
@@ -1387,7 +1387,7 @@ Returns:
|
|||||||
argc -= 2;
|
argc -= 2;
|
||||||
argv += 2;
|
argv += 2;
|
||||||
InputFileAlignNum ++;
|
InputFileAlignNum ++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -1529,14 +1529,14 @@ Returns:
|
|||||||
VerboseMsg ("Compress method is %s", mCompressionTypeName [SectCompSubType]);
|
VerboseMsg ("Compress method is %s", mCompressionTypeName [SectCompSubType]);
|
||||||
} else if (stricmp (SectionName, mSectionTypeName[EFI_SECTION_GUID_DEFINED]) == 0) {
|
} else if (stricmp (SectionName, mSectionTypeName[EFI_SECTION_GUID_DEFINED]) == 0) {
|
||||||
SectType = EFI_SECTION_GUID_DEFINED;
|
SectType = EFI_SECTION_GUID_DEFINED;
|
||||||
|
|
||||||
if ((SectGuidAttribute & EFI_GUIDED_SECTION_NONE) != 0) {
|
if ((SectGuidAttribute & EFI_GUIDED_SECTION_NONE) != 0) {
|
||||||
//
|
//
|
||||||
// NONE attribute, clear attribute value.
|
// NONE attribute, clear attribute value.
|
||||||
//
|
//
|
||||||
SectGuidAttribute = SectGuidAttribute & ~EFI_GUIDED_SECTION_NONE;
|
SectGuidAttribute = SectGuidAttribute & ~EFI_GUIDED_SECTION_NONE;
|
||||||
}
|
}
|
||||||
VerboseMsg ("Vendor Guid is %08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X",
|
VerboseMsg ("Vendor Guid is %08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X",
|
||||||
(unsigned) VendorGuid.Data1,
|
(unsigned) VendorGuid.Data1,
|
||||||
VendorGuid.Data2,
|
VendorGuid.Data2,
|
||||||
VendorGuid.Data3,
|
VendorGuid.Data3,
|
||||||
@@ -1595,7 +1595,7 @@ Returns:
|
|||||||
Error (NULL, 0, 1003, "Invalid option value", "SectionType = %s", SectionName);
|
Error (NULL, 0, 1003, "Invalid option value", "SectionType = %s", SectionName);
|
||||||
goto Finish;
|
goto Finish;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// GuidValue is only required by Guided section.
|
// GuidValue is only required by Guided section.
|
||||||
//
|
//
|
||||||
@@ -1604,10 +1604,10 @@ Returns:
|
|||||||
(CompareGuid (&VendorGuid, &mZeroGuid) != 0)) {
|
(CompareGuid (&VendorGuid, &mZeroGuid) != 0)) {
|
||||||
fprintf (stdout, "Warning: the input guid value is not required for this section type %s\n", SectionName);
|
fprintf (stdout, "Warning: the input guid value is not required for this section type %s\n", SectionName);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Check whether there is input file
|
// Check whether there is input file
|
||||||
//
|
//
|
||||||
if ((SectType != EFI_SECTION_VERSION) && (SectType != EFI_SECTION_USER_INTERFACE)) {
|
if ((SectType != EFI_SECTION_VERSION) && (SectType != EFI_SECTION_USER_INTERFACE)) {
|
||||||
//
|
//
|
||||||
// The input file are required for other section type.
|
// The input file are required for other section type.
|
||||||
@@ -1730,7 +1730,7 @@ Returns:
|
|||||||
OutFileBuffer,
|
OutFileBuffer,
|
||||||
&InputLength
|
&InputLength
|
||||||
);
|
);
|
||||||
|
|
||||||
if (Status == EFI_BUFFER_TOO_SMALL) {
|
if (Status == EFI_BUFFER_TOO_SMALL) {
|
||||||
OutFileBuffer = (UINT8 *) malloc (InputLength);
|
OutFileBuffer = (UINT8 *) malloc (InputLength);
|
||||||
if (OutFileBuffer == NULL) {
|
if (OutFileBuffer == NULL) {
|
||||||
@@ -1762,10 +1762,10 @@ Returns:
|
|||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Status != EFI_SUCCESS || OutFileBuffer == NULL) {
|
if (Status != EFI_SUCCESS || OutFileBuffer == NULL) {
|
||||||
Error (NULL, 0, 2000, "Status is not successful", "Status value is 0x%X", (int) Status);
|
Error (NULL, 0, 2000, "Status is not successful", "Status value is 0x%X", (int) Status);
|
||||||
goto Finish;
|
goto Finish;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -1778,7 +1778,7 @@ Returns:
|
|||||||
InputLength = ((EFI_COMMON_SECTION_HEADER2 *)SectionHeader)->ExtendedSize;
|
InputLength = ((EFI_COMMON_SECTION_HEADER2 *)SectionHeader)->ExtendedSize;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Write the output file
|
// Write the output file
|
||||||
//
|
//
|
||||||
|
@@ -1,10 +1,10 @@
|
|||||||
/** @file
|
/** @file
|
||||||
This file contains functions required to generate a boot strap file (BSF) also
|
This file contains functions required to generate a boot strap file (BSF) also
|
||||||
known as the Volume Top File (VTF)
|
known as the Volume Top File (VTF)
|
||||||
|
|
||||||
Copyright (c) 1999 - 2017, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 1999 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials are licensed and made available
|
This program and the accompanying materials are licensed and made available
|
||||||
under the terms and conditions of the BSD License which accompanies this
|
under the terms and conditions of the BSD License which accompanies this
|
||||||
distribution. The full text of the license may be found at
|
distribution. The full text of the license may be found at
|
||||||
http://opensource.org/licenses/bsd-license.php
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
@@ -133,7 +133,7 @@ Returns:
|
|||||||
} else {
|
} else {
|
||||||
memcpy (TemStr, Str + Length - 4, 4);
|
memcpy (TemStr, Str + Length - 4, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
sscanf (
|
sscanf (
|
||||||
TemStr,
|
TemStr,
|
||||||
"%02x%02x",
|
"%02x%02x",
|
||||||
@@ -2362,7 +2362,7 @@ Returns:
|
|||||||
TokenAddress += BaseAddress &~IPF_CACHE_BIT;
|
TokenAddress += BaseAddress &~IPF_CACHE_BIT;
|
||||||
|
|
||||||
fprintf (DestFile, "%s | %016llX | ", Type, (unsigned long long) TokenAddress);
|
fprintf (DestFile, "%s | %016llX | ", Type, (unsigned long long) TokenAddress);
|
||||||
fprintf (DestFile, "%s | %s\n %s\n", Section, Token, BaseToken);
|
fprintf (DestFile, "%s | %s\n %s\n", Section, Token, BaseToken);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2479,7 +2479,7 @@ Returns:
|
|||||||
//
|
//
|
||||||
// Copyright declaration
|
// Copyright declaration
|
||||||
//
|
//
|
||||||
fprintf (stdout, "Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.\n\n");
|
fprintf (stdout, "Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.\n\n");
|
||||||
//
|
//
|
||||||
// Details Option
|
// Details Option
|
||||||
//
|
//
|
||||||
@@ -2628,7 +2628,7 @@ Returns:
|
|||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((stricmp (argv[Index], "-r") == 0) || (stricmp (argv[Index], "--baseaddr") == 0)) {
|
if ((stricmp (argv[Index], "-r") == 0) || (stricmp (argv[Index], "--baseaddr") == 0)) {
|
||||||
if (FirstRoundB) {
|
if (FirstRoundB) {
|
||||||
Status = AsciiStringToUint64 (argv[Index + 1], FALSE, &StartAddress1);
|
Status = AsciiStringToUint64 (argv[Index + 1], FALSE, &StartAddress1);
|
||||||
@@ -2639,7 +2639,7 @@ Returns:
|
|||||||
if (Status != EFI_SUCCESS) {
|
if (Status != EFI_SUCCESS) {
|
||||||
Error (NULL, 0, 2000, "Invalid option value", "%s is Bad FV start address.", argv[Index + 1]);
|
Error (NULL, 0, 2000, "Invalid option value", "%s is Bad FV start address.", argv[Index + 1]);
|
||||||
goto ERROR;
|
goto ERROR;
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2649,7 +2649,7 @@ Returns:
|
|||||||
FirstRoundS = FALSE;
|
FirstRoundS = FALSE;
|
||||||
} else {
|
} else {
|
||||||
Status = AsciiStringToUint64 (argv[Index + 1], FALSE, &FwVolSize2);
|
Status = AsciiStringToUint64 (argv[Index + 1], FALSE, &FwVolSize2);
|
||||||
SecondVTF = TRUE;
|
SecondVTF = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Status != EFI_SUCCESS) {
|
if (Status != EFI_SUCCESS) {
|
||||||
@@ -2660,8 +2660,8 @@ Returns:
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ((stricmp (argv[Index], "-v") == 0) || (stricmp (argv[Index], "--verbose") == 0)) {
|
if ((stricmp (argv[Index], "-v") == 0) || (stricmp (argv[Index], "--verbose") == 0)) {
|
||||||
VerboseMode = TRUE;
|
VerboseMode = TRUE;
|
||||||
Index--;
|
Index--;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2729,7 +2729,7 @@ Returns:
|
|||||||
if (SecondVTF == TRUE) {
|
if (SecondVTF == TRUE) {
|
||||||
OutFileName1 = VTF_OUTPUT_FILE1;
|
OutFileName1 = VTF_OUTPUT_FILE1;
|
||||||
OutFileName2 = VTF_OUTPUT_FILE2;
|
OutFileName2 = VTF_OUTPUT_FILE2;
|
||||||
} else {
|
} else {
|
||||||
OutFileName1 = VTF_OUTPUT_FILE1;
|
OutFileName1 = VTF_OUTPUT_FILE1;
|
||||||
}
|
}
|
||||||
SymFileName = VTF_SYM_FILE;
|
SymFileName = VTF_SYM_FILE;
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
/** @file
|
/** @file
|
||||||
This file contains the relevant declarations required to generate Boot Strap File
|
This file contains the relevant declarations required to generate Boot Strap File
|
||||||
|
|
||||||
Copyright (c) 1999 - 2014, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 1999 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials are licensed and made available
|
This program and the accompanying materials are licensed and made available
|
||||||
under the terms and conditions of the BSD License which accompanies this
|
under the terms and conditions of the BSD License which accompanies this
|
||||||
distribution. The full text of the license may be found at
|
distribution. The full text of the license may be found at
|
||||||
http://opensource.org/licenses/bsd-license.php
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
@@ -80,7 +80,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||||||
#define SIZE_IA32_RESET_VECT 0x10 // 16 Bytes
|
#define SIZE_IA32_RESET_VECT 0x10 // 16 Bytes
|
||||||
#define SIZE_SALE_ENTRY_POINT 0x08 // 8 Byte
|
#define SIZE_SALE_ENTRY_POINT 0x08 // 8 Byte
|
||||||
#define SIZE_FIT_TABLE_ADD 0x08 // 8 Byte
|
#define SIZE_FIT_TABLE_ADD 0x08 // 8 Byte
|
||||||
#define SIZE_FIT_TABLE_PAL_A 0x10
|
#define SIZE_FIT_TABLE_PAL_A 0x10
|
||||||
#define SIZE_RESERVED 0x10
|
#define SIZE_RESERVED 0x10
|
||||||
|
|
||||||
|
|
||||||
@@ -116,7 +116,7 @@ static BOOLEAN VerboseMode = FALSE;
|
|||||||
//
|
//
|
||||||
// Internal Data Structure
|
// Internal Data Structure
|
||||||
//
|
//
|
||||||
typedef enum _LOC_TYPE
|
typedef enum _LOC_TYPE
|
||||||
{
|
{
|
||||||
NONE, // In case there is - INF file
|
NONE, // In case there is - INF file
|
||||||
FIRST_VTF, // First VTF
|
FIRST_VTF, // First VTF
|
||||||
@@ -174,18 +174,18 @@ UpdateVtfBuffer(
|
|||||||
Routine Description:
|
Routine Description:
|
||||||
|
|
||||||
Update the Firmware Volume Buffer with requested buffer data
|
Update the Firmware Volume Buffer with requested buffer data
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
|
|
||||||
StartAddress - StartAddress in buffer. This number will automatically
|
StartAddress - StartAddress in buffer. This number will automatically
|
||||||
point to right address in buffer where data needed
|
point to right address in buffer where data needed
|
||||||
to be updated.
|
to be updated.
|
||||||
Buffer - Buffer pointer from data will be copied to memory mapped buffer.
|
Buffer - Buffer pointer from data will be copied to memory mapped buffer.
|
||||||
DataSize - Size of the data needed to be copied.
|
DataSize - Size of the data needed to be copied.
|
||||||
LocType - The type of the VTF
|
LocType - The type of the VTF
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
|
|
||||||
EFI_ABORTED - The input parameter is error
|
EFI_ABORTED - The input parameter is error
|
||||||
EFI_SUCCESS - The function completed successfully
|
EFI_SUCCESS - The function completed successfully
|
||||||
|
|
||||||
@@ -227,22 +227,22 @@ CalculateFitTableChecksum (
|
|||||||
VOID
|
VOID
|
||||||
)
|
)
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
|
|
||||||
This function will perform byte checksum on the FIT table, if the the checksum required
|
This function will perform byte checksum on the FIT table, if the the checksum required
|
||||||
field is set to CheckSum required. If the checksum is not required then checksum byte
|
field is set to CheckSum required. If the checksum is not required then checksum byte
|
||||||
will have value as 0;.
|
will have value as 0;.
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
|
|
||||||
NONE
|
NONE
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
|
|
||||||
Status - Value returned by call to CalculateChecksum8 ()
|
Status - Value returned by call to CalculateChecksum8 ()
|
||||||
EFI_SUCCESS - The function completed successfully
|
EFI_SUCCESS - The function completed successfully
|
||||||
|
|
||||||
--*/
|
--*/
|
||||||
;
|
;
|
||||||
|
|
||||||
@@ -262,22 +262,22 @@ Routine Description:
|
|||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
|
|
||||||
StartAddress1 - The start address of the first VTF
|
StartAddress1 - The start address of the first VTF
|
||||||
Size1 - The size of the first VTF
|
Size1 - The size of the first VTF
|
||||||
StartAddress2 - The start address of the second VTF
|
StartAddress2 - The start address of the second VTF
|
||||||
Size2 - The size of the second VTF
|
Size2 - The size of the second VTF
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
|
|
||||||
EFI_OUT_OF_RESOURCES - Can not allocate memory
|
EFI_OUT_OF_RESOURCES - Can not allocate memory
|
||||||
The return value can be any of the values
|
The return value can be any of the values
|
||||||
returned by the calls to following functions:
|
returned by the calls to following functions:
|
||||||
GetVtfRelatedInfoFromInfFile
|
GetVtfRelatedInfoFromInfFile
|
||||||
ProcessAndCreateVtf
|
ProcessAndCreateVtf
|
||||||
UpdateIA32ResetVector
|
UpdateIA32ResetVector
|
||||||
UpdateFfsHeader
|
UpdateFfsHeader
|
||||||
WriteVtfBinary
|
WriteVtfBinary
|
||||||
|
|
||||||
--*/
|
--*/
|
||||||
;
|
;
|
||||||
|
|
||||||
@@ -294,11 +294,11 @@ Routine Description:
|
|||||||
Arguments:
|
Arguments:
|
||||||
|
|
||||||
StartAddress - StartAddress for PEIM.....
|
StartAddress - StartAddress for PEIM.....
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
|
|
||||||
EFI_SUCCESS - The function completed successfully
|
EFI_SUCCESS - The function completed successfully
|
||||||
EFI_ABORTED - Error Opening File
|
EFI_ABORTED - Error Opening File
|
||||||
|
|
||||||
--*/
|
--*/
|
||||||
;
|
;
|
||||||
|
@@ -2,14 +2,14 @@
|
|||||||
|
|
||||||
Fat file system structure and definition.
|
Fat file system structure and definition.
|
||||||
|
|
||||||
Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
http://opensource.org/licenses/bsd-license.php
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
--*/
|
--*/
|
||||||
|
|
||||||
|
@@ -3,15 +3,15 @@ Reading/writing MBR/DBR.
|
|||||||
NOTE:
|
NOTE:
|
||||||
If we write MBR to disk, we just update the MBR code and the partition table wouldn't be over written.
|
If we write MBR to disk, we just update the MBR code and the partition table wouldn't be over written.
|
||||||
If we process DBR, we will patch MBR to set first partition active if no active partition exists.
|
If we process DBR, we will patch MBR to set first partition active if no active partition exists.
|
||||||
|
|
||||||
Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
http://opensource.org/licenses/bsd-license.php
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
@@ -132,21 +132,21 @@ GetPathInfo (
|
|||||||
if (strncmp(PathInfo->Path, "/dev/", 5) == 0) {
|
if (strncmp(PathInfo->Path, "/dev/", 5) == 0) {
|
||||||
//
|
//
|
||||||
// Process disk path here.
|
// Process disk path here.
|
||||||
//
|
//
|
||||||
|
|
||||||
// Process floppy disk
|
// Process floppy disk
|
||||||
if (PathInfo->Path[5] == 'f' && PathInfo->Path[6] == 'd' && PathInfo->Path[8] == '\0') {
|
if (PathInfo->Path[5] == 'f' && PathInfo->Path[6] == 'd' && PathInfo->Path[8] == '\0') {
|
||||||
PathInfo->Type = PathFloppy;
|
PathInfo->Type = PathFloppy;
|
||||||
strcpy (PathInfo->PhysicalPath, PathInfo->Path);
|
strcpy (PathInfo->PhysicalPath, PathInfo->Path);
|
||||||
|
|
||||||
return ErrorSuccess;
|
return ErrorSuccess;
|
||||||
} else {
|
} else {
|
||||||
// Other disk types is not supported yet.
|
// Other disk types is not supported yet.
|
||||||
fprintf (stderr, "ERROR: It's not a floppy disk!\n");
|
fprintf (stderr, "ERROR: It's not a floppy disk!\n");
|
||||||
return ErrorPath;
|
return ErrorPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try to open the device.
|
// Try to open the device.
|
||||||
f = fopen (LongFilePath (PathInfo->Path),"r");
|
f = fopen (LongFilePath (PathInfo->Path),"r");
|
||||||
if (f == NULL) {
|
if (f == NULL) {
|
||||||
printf ("error :open device failed!\n");
|
printf ("error :open device failed!\n");
|
||||||
@@ -155,7 +155,7 @@ GetPathInfo (
|
|||||||
fclose (f);
|
fclose (f);
|
||||||
return ErrorSuccess;
|
return ErrorSuccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Process file path here.
|
// Process file path here.
|
||||||
PathInfo->Type = PathFile;
|
PathInfo->Type = PathFile;
|
||||||
if (PathInfo->Input) {
|
if (PathInfo->Input) {
|
||||||
@@ -183,12 +183,12 @@ ListDrive (
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Writing or reading boot sector or MBR according to the argument.
|
Writing or reading boot sector or MBR according to the argument.
|
||||||
|
|
||||||
@param InputInfo PATH_INFO instance for input path
|
@param InputInfo PATH_INFO instance for input path
|
||||||
@param OutputInfo PATH_INFO instance for output path
|
@param OutputInfo PATH_INFO instance for output path
|
||||||
@param ProcessMbr TRUE is to process MBR, otherwise, processing boot sector
|
@param ProcessMbr TRUE is to process MBR, otherwise, processing boot sector
|
||||||
|
|
||||||
@return ERROR_STATUS
|
@return ERROR_STATUS
|
||||||
**/
|
**/
|
||||||
ERROR_STATUS
|
ERROR_STATUS
|
||||||
@@ -200,34 +200,34 @@ ProcessBsOrMbr (
|
|||||||
{
|
{
|
||||||
CHAR8 FirstSector[0x200] = {0};
|
CHAR8 FirstSector[0x200] = {0};
|
||||||
CHAR8 FirstSectorBackup[0x200] = {0};
|
CHAR8 FirstSectorBackup[0x200] = {0};
|
||||||
|
|
||||||
FILE *InputFile;
|
FILE *InputFile;
|
||||||
FILE *OutputFile;
|
FILE *OutputFile;
|
||||||
|
|
||||||
|
|
||||||
InputFile = fopen (LongFilePath (InputInfo->PhysicalPath), "r");
|
InputFile = fopen (LongFilePath (InputInfo->PhysicalPath), "r");
|
||||||
if (InputFile == NULL) {
|
if (InputFile == NULL) {
|
||||||
return ErrorFileReadWrite;
|
return ErrorFileReadWrite;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (0x200 != fread(FirstSector, 1, 0x200, InputFile)) {
|
if (0x200 != fread(FirstSector, 1, 0x200, InputFile)) {
|
||||||
fclose(InputFile);
|
fclose(InputFile);
|
||||||
return ErrorFileReadWrite;
|
return ErrorFileReadWrite;
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose(InputFile);
|
fclose(InputFile);
|
||||||
|
|
||||||
//Not support USB and IDE.
|
//Not support USB and IDE.
|
||||||
if (InputInfo->Type == PathUsb) {
|
if (InputInfo->Type == PathUsb) {
|
||||||
printf("USB has not been supported yet!");
|
printf("USB has not been supported yet!");
|
||||||
return ErrorSuccess;
|
return ErrorSuccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (InputInfo->Type == PathIde) {
|
if (InputInfo->Type == PathIde) {
|
||||||
printf("IDE has not been supported yet!");
|
printf("IDE has not been supported yet!");
|
||||||
return ErrorSuccess;
|
return ErrorSuccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Process Floppy Disk
|
//Process Floppy Disk
|
||||||
OutputFile = fopen (LongFilePath (OutputInfo->PhysicalPath), "r+");
|
OutputFile = fopen (LongFilePath (OutputInfo->PhysicalPath), "r+");
|
||||||
if (OutputFile == NULL) {
|
if (OutputFile == NULL) {
|
||||||
@@ -236,7 +236,7 @@ ProcessBsOrMbr (
|
|||||||
return ErrorFileReadWrite;
|
return ErrorFileReadWrite;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (OutputInfo->Type != PathFile) {
|
if (OutputInfo->Type != PathFile) {
|
||||||
if (ProcessMbr) {
|
if (ProcessMbr) {
|
||||||
//
|
//
|
||||||
@@ -244,16 +244,16 @@ ProcessBsOrMbr (
|
|||||||
//
|
//
|
||||||
if (0x200 != fread (FirstSectorBackup, 1, 0x200, OutputFile)) {
|
if (0x200 != fread (FirstSectorBackup, 1, 0x200, OutputFile)) {
|
||||||
fclose(OutputFile);
|
fclose(OutputFile);
|
||||||
return ErrorFileReadWrite;
|
return ErrorFileReadWrite;
|
||||||
}
|
}
|
||||||
memcpy (FirstSector + 0x1BE, FirstSectorBackup + 0x1BE, 0x40);
|
memcpy (FirstSector + 0x1BE, FirstSectorBackup + 0x1BE, 0x40);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(0x200 != fwrite(FirstSector, 1, 0x200, OutputFile)) {
|
if(0x200 != fwrite(FirstSector, 1, 0x200, OutputFile)) {
|
||||||
fclose(OutputFile);
|
fclose(OutputFile);
|
||||||
return ErrorFileReadWrite;
|
return ErrorFileReadWrite;
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose(OutputFile);
|
fclose(OutputFile);
|
||||||
return ErrorSuccess;
|
return ErrorSuccess;
|
||||||
}
|
}
|
||||||
@@ -308,20 +308,20 @@ main (
|
|||||||
UINT64 LogLevel;
|
UINT64 LogLevel;
|
||||||
|
|
||||||
SetUtilityName (UTILITY_NAME);
|
SetUtilityName (UTILITY_NAME);
|
||||||
|
|
||||||
ZeroMem(&InputPathInfo, sizeof(PATH_INFO));
|
ZeroMem(&InputPathInfo, sizeof(PATH_INFO));
|
||||||
ZeroMem(&OutputPathInfo, sizeof(PATH_INFO));
|
ZeroMem(&OutputPathInfo, sizeof(PATH_INFO));
|
||||||
|
|
||||||
argv ++;
|
argv ++;
|
||||||
argc --;
|
argc --;
|
||||||
|
|
||||||
ProcessMbr = FALSE;
|
ProcessMbr = FALSE;
|
||||||
|
|
||||||
if (argc == 0) {
|
if (argc == 0) {
|
||||||
PrintUsage();
|
PrintUsage();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Parse command line
|
// Parse command line
|
||||||
//
|
//
|
||||||
@@ -329,61 +329,61 @@ main (
|
|||||||
if ((stricmp (argv[Index], "-l") == 0) || (stricmp (argv[Index], "--list") == 0)) {
|
if ((stricmp (argv[Index], "-l") == 0) || (stricmp (argv[Index], "--list") == 0)) {
|
||||||
ListDrive ();
|
ListDrive ();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((stricmp (argv[Index], "-m") == 0) || (stricmp (argv[Index], "--mbr") == 0)) {
|
if ((stricmp (argv[Index], "-m") == 0) || (stricmp (argv[Index], "--mbr") == 0)) {
|
||||||
ProcessMbr = TRUE;
|
ProcessMbr = TRUE;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((stricmp (argv[Index], "-i") == 0) || (stricmp (argv[Index], "--input") == 0)) {
|
if ((stricmp (argv[Index], "-i") == 0) || (stricmp (argv[Index], "--input") == 0)) {
|
||||||
InputPathInfo.Path = argv[Index + 1];
|
InputPathInfo.Path = argv[Index + 1];
|
||||||
InputPathInfo.Input = TRUE;
|
InputPathInfo.Input = TRUE;
|
||||||
if (InputPathInfo.Path == NULL) {
|
if (InputPathInfo.Path == NULL) {
|
||||||
Error (NULL, 0, 1003, "Invalid option value", "Input file name can't be NULL");
|
Error (NULL, 0, 1003, "Invalid option value", "Input file name can't be NULL");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if (InputPathInfo.Path[0] == '-') {
|
if (InputPathInfo.Path[0] == '-') {
|
||||||
Error (NULL, 0, 1003, "Invalid option value", "Input file is missing");
|
Error (NULL, 0, 1003, "Invalid option value", "Input file is missing");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
++Index;
|
++Index;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((stricmp (argv[Index], "-o") == 0) || (stricmp (argv[Index], "--output") == 0)) {
|
if ((stricmp (argv[Index], "-o") == 0) || (stricmp (argv[Index], "--output") == 0)) {
|
||||||
OutputPathInfo.Path = argv[Index + 1];
|
OutputPathInfo.Path = argv[Index + 1];
|
||||||
OutputPathInfo.Input = FALSE;
|
OutputPathInfo.Input = FALSE;
|
||||||
if (OutputPathInfo.Path == NULL) {
|
if (OutputPathInfo.Path == NULL) {
|
||||||
Error (NULL, 0, 1003, "Invalid option value", "Output file name can't be NULL");
|
Error (NULL, 0, 1003, "Invalid option value", "Output file name can't be NULL");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if (OutputPathInfo.Path[0] == '-') {
|
if (OutputPathInfo.Path[0] == '-') {
|
||||||
Error (NULL, 0, 1003, "Invalid option value", "Output file is missing");
|
Error (NULL, 0, 1003, "Invalid option value", "Output file is missing");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
++Index;
|
++Index;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((stricmp (argv[Index], "-h") == 0) || (stricmp (argv[Index], "--help") == 0)) {
|
if ((stricmp (argv[Index], "-h") == 0) || (stricmp (argv[Index], "--help") == 0)) {
|
||||||
PrintUsage ();
|
PrintUsage ();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stricmp (argv[Index], "--version") == 0) {
|
if (stricmp (argv[Index], "--version") == 0) {
|
||||||
Version ();
|
Version ();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((stricmp (argv[Index], "-v") == 0) || (stricmp (argv[Index], "--verbose") == 0)) {
|
if ((stricmp (argv[Index], "-v") == 0) || (stricmp (argv[Index], "--verbose") == 0)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((stricmp (argv[Index], "-q") == 0) || (stricmp (argv[Index], "--quiet") == 0)) {
|
if ((stricmp (argv[Index], "-q") == 0) || (stricmp (argv[Index], "--quiet") == 0)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((stricmp (argv[Index], "-d") == 0) || (stricmp (argv[Index], "--debug") == 0)) {
|
if ((stricmp (argv[Index], "-d") == 0) || (stricmp (argv[Index], "--debug") == 0)) {
|
||||||
EfiStatus = AsciiStringToUint64 (argv[Index + 1], FALSE, &LogLevel);
|
EfiStatus = AsciiStringToUint64 (argv[Index + 1], FALSE, &LogLevel);
|
||||||
if (EFI_ERROR (EfiStatus)) {
|
if (EFI_ERROR (EfiStatus)) {
|
||||||
@@ -406,7 +406,7 @@ main (
|
|||||||
Error (NULL, 0, 1000, "Unknown option", "%s", argv[Index]);
|
Error (NULL, 0, 1000, "Unknown option", "%s", argv[Index]);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (InputPathInfo.Path == NULL) {
|
if (InputPathInfo.Path == NULL) {
|
||||||
Error (NULL, 0, 1001, "Missing options", "Input file is missing");
|
Error (NULL, 0, 1001, "Missing options", "Input file is missing");
|
||||||
return 1;
|
return 1;
|
||||||
@@ -416,7 +416,7 @@ main (
|
|||||||
Error (NULL, 0, 1001, "Missing options", "Output file is missing");
|
Error (NULL, 0, 1001, "Missing options", "Output file is missing");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GetPathInfo(&InputPathInfo) != ErrorSuccess) {
|
if (GetPathInfo(&InputPathInfo) != ErrorSuccess) {
|
||||||
Error (NULL, 0, 1003, "Invalid option value", "Input file can't be found.");
|
Error (NULL, 0, 1003, "Invalid option value", "Input file can't be found.");
|
||||||
return 1;
|
return 1;
|
||||||
@@ -426,7 +426,7 @@ main (
|
|||||||
Error (NULL, 0, 1003, "Invalid option value", "Output file can't be found.");
|
Error (NULL, 0, 1003, "Invalid option value", "Output file can't be found.");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Process DBR (Patch or Read)
|
// Process DBR (Patch or Read)
|
||||||
//
|
//
|
||||||
@@ -434,21 +434,21 @@ main (
|
|||||||
|
|
||||||
if (Status == ErrorSuccess) {
|
if (Status == ErrorSuccess) {
|
||||||
fprintf (
|
fprintf (
|
||||||
stdout,
|
stdout,
|
||||||
"%s %s: successful!\n",
|
"%s %s: successful!\n",
|
||||||
(OutputPathInfo.Type != PathFile) ? "Write" : "Read",
|
(OutputPathInfo.Type != PathFile) ? "Write" : "Read",
|
||||||
ProcessMbr ? "MBR" : "DBR"
|
ProcessMbr ? "MBR" : "DBR"
|
||||||
);
|
);
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
fprintf (
|
fprintf (
|
||||||
stderr,
|
stderr,
|
||||||
"%s: %s %s: failed - %s (LastError: 0x%x)!\n",
|
"%s: %s %s: failed - %s (LastError: 0x%x)!\n",
|
||||||
(Status == ErrorNoMbr) ? "WARNING" : "ERROR",
|
(Status == ErrorNoMbr) ? "WARNING" : "ERROR",
|
||||||
(OutputPathInfo.Type != PathFile) ? "Write" : "Read",
|
(OutputPathInfo.Type != PathFile) ? "Write" : "Read",
|
||||||
ProcessMbr ? "MBR" : "DBR",
|
ProcessMbr ? "MBR" : "DBR",
|
||||||
ErrorStatusDesc[Status],
|
ErrorStatusDesc[Status],
|
||||||
errno
|
errno
|
||||||
);
|
);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
/** @file
|
/** @file
|
||||||
Processor or Compiler specific defines and types for AArch64.
|
Processor or Compiler specific defines and types for AArch64.
|
||||||
|
|
||||||
Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
Portions copyright (c) 2008 - 2009, Apple Inc. 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>
|
Portions copyright (c) 2013, ARM Ltd. All rights reserved.<BR>
|
||||||
|
|
||||||
@@ -32,7 +32,7 @@
|
|||||||
|
|
||||||
#if _MSC_EXTENSIONS
|
#if _MSC_EXTENSIONS
|
||||||
//
|
//
|
||||||
// use Microsoft* C complier dependent integer width types
|
// use Microsoft* C complier dependent integer width types
|
||||||
//
|
//
|
||||||
typedef unsigned __int64 UINT64;
|
typedef unsigned __int64 UINT64;
|
||||||
typedef __int64 INT64;
|
typedef __int64 INT64;
|
||||||
@@ -124,21 +124,21 @@ typedef INT64 INTN;
|
|||||||
|
|
||||||
#define GCC_ASM_EXPORT(func__) \
|
#define GCC_ASM_EXPORT(func__) \
|
||||||
.global _CONCATENATE (__USER_LABEL_PREFIX__, func__) ;\
|
.global _CONCATENATE (__USER_LABEL_PREFIX__, func__) ;\
|
||||||
.type ASM_PFX(func__), %function
|
.type ASM_PFX(func__), %function
|
||||||
|
|
||||||
#define GCC_ASM_IMPORT(func__) \
|
#define GCC_ASM_IMPORT(func__) \
|
||||||
.extern _CONCATENATE (__USER_LABEL_PREFIX__, func__)
|
.extern _CONCATENATE (__USER_LABEL_PREFIX__, func__)
|
||||||
|
|
||||||
#else
|
#else
|
||||||
//
|
//
|
||||||
// .type not supported by Apple Xcode tools
|
// .type not supported by Apple Xcode tools
|
||||||
//
|
//
|
||||||
#define INTERWORK_FUNC(func__)
|
#define INTERWORK_FUNC(func__)
|
||||||
|
|
||||||
#define GCC_ASM_EXPORT(func__) \
|
#define GCC_ASM_EXPORT(func__) \
|
||||||
.globl _CONCATENATE (__USER_LABEL_PREFIX__, func__) \
|
.globl _CONCATENATE (__USER_LABEL_PREFIX__, func__) \
|
||||||
|
|
||||||
#define GCC_ASM_IMPORT(name)
|
#define GCC_ASM_IMPORT(name)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
@@ -1,15 +1,15 @@
|
|||||||
/** @file
|
/** @file
|
||||||
Processor or Compiler specific defines and types for ARM.
|
Processor or Compiler specific defines and types for ARM.
|
||||||
|
|
||||||
Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
|
Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
http://opensource.org/licenses/bsd-license.php
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
@@ -28,9 +28,9 @@
|
|||||||
#pragma pack()
|
#pragma pack()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if _MSC_EXTENSIONS
|
#if _MSC_EXTENSIONS
|
||||||
//
|
//
|
||||||
// use Microsoft* C complier dependent integer width types
|
// use Microsoft* C complier dependent integer width types
|
||||||
//
|
//
|
||||||
typedef unsigned __int64 UINT64;
|
typedef unsigned __int64 UINT64;
|
||||||
typedef __int64 INT64;
|
typedef __int64 INT64;
|
||||||
@@ -45,7 +45,7 @@
|
|||||||
typedef signed char INT8;
|
typedef signed char INT8;
|
||||||
#else
|
#else
|
||||||
//
|
//
|
||||||
// Assume standard ARM alignment.
|
// Assume standard ARM alignment.
|
||||||
//
|
//
|
||||||
typedef unsigned long long UINT64;
|
typedef unsigned long long UINT64;
|
||||||
typedef long long INT64;
|
typedef long long INT64;
|
||||||
@@ -103,7 +103,7 @@ typedef INT32 INTN;
|
|||||||
// use the correct C calling convention. All protocol member functions and
|
// use the correct C calling convention. All protocol member functions and
|
||||||
// EFI intrinsics are required to modify their member functions with EFIAPI.
|
// EFI intrinsics are required to modify their member functions with EFIAPI.
|
||||||
//
|
//
|
||||||
#define EFIAPI
|
#define EFIAPI
|
||||||
|
|
||||||
#if defined(__GNUC__)
|
#if defined(__GNUC__)
|
||||||
///
|
///
|
||||||
@@ -122,34 +122,34 @@ typedef INT32 INTN;
|
|||||||
|
|
||||||
#define GCC_ASM_EXPORT(func__) \
|
#define GCC_ASM_EXPORT(func__) \
|
||||||
.global _CONCATENATE (__USER_LABEL_PREFIX__, func__) ;\
|
.global _CONCATENATE (__USER_LABEL_PREFIX__, func__) ;\
|
||||||
.type ASM_PFX(func__), %function
|
.type ASM_PFX(func__), %function
|
||||||
|
|
||||||
#define GCC_ASM_IMPORT(func__) \
|
#define GCC_ASM_IMPORT(func__) \
|
||||||
.extern _CONCATENATE (__USER_LABEL_PREFIX__, func__)
|
.extern _CONCATENATE (__USER_LABEL_PREFIX__, func__)
|
||||||
|
|
||||||
#else
|
#else
|
||||||
//
|
//
|
||||||
// .type not supported by Apple Xcode tools
|
// .type not supported by Apple Xcode tools
|
||||||
//
|
//
|
||||||
#define INTERWORK_FUNC(func__)
|
#define INTERWORK_FUNC(func__)
|
||||||
|
|
||||||
#define GCC_ASM_EXPORT(func__) \
|
#define GCC_ASM_EXPORT(func__) \
|
||||||
.globl _CONCATENATE (__USER_LABEL_PREFIX__, func__) \
|
.globl _CONCATENATE (__USER_LABEL_PREFIX__, func__) \
|
||||||
|
|
||||||
#define GCC_ASM_IMPORT(name)
|
#define GCC_ASM_IMPORT(name)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Return the pointer to the first instruction of a function given a function pointer.
|
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,
|
On ARM CPU architectures, these two pointer values are the same,
|
||||||
so the implementation of this macro is very simple.
|
so the implementation of this macro is very simple.
|
||||||
|
|
||||||
@param FunctionPointer A pointer to a function.
|
@param FunctionPointer A pointer to a function.
|
||||||
|
|
||||||
@return The pointer to the first instruction of a function given a function pointer.
|
@return The pointer to the first instruction of a function given a function pointer.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
#define FUNCTION_ENTRY_POINT(FunctionPointer) (VOID *)(UINTN)(FunctionPointer)
|
#define FUNCTION_ENTRY_POINT(FunctionPointer) (VOID *)(UINTN)(FunctionPointer)
|
||||||
|
|
||||||
|
@@ -1,16 +1,16 @@
|
|||||||
/** @file
|
/** @file
|
||||||
Processor or Compiler specific defines for all supported processors.
|
Processor or Compiler specific defines for all supported processors.
|
||||||
|
|
||||||
This file is stand alone self consistent set of definitions.
|
This file is stand alone self consistent set of definitions.
|
||||||
|
|
||||||
Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
http://opensource.org/licenses/bsd-license.php
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
@@ -49,7 +49,7 @@
|
|||||||
//
|
//
|
||||||
#ifndef TRUE
|
#ifndef TRUE
|
||||||
//
|
//
|
||||||
// BugBug: UEFI specification claims 1 and 0. We are concerned about the
|
// BugBug: UEFI specification claims 1 and 0. We are concerned about the
|
||||||
// complier portability so we did it this way.
|
// complier portability so we did it this way.
|
||||||
//
|
//
|
||||||
#define TRUE ((BOOLEAN)(1==1))
|
#define TRUE ((BOOLEAN)(1==1))
|
||||||
@@ -65,7 +65,7 @@
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Support for variable length argument lists using the ANSI standard.
|
// Support for variable length argument lists using the ANSI standard.
|
||||||
//
|
//
|
||||||
// Since we are using the ANSI standard we used the standard naming and
|
// Since we are using the ANSI standard we used the standard naming and
|
||||||
// did not follow the coding convention
|
// did not follow the coding convention
|
||||||
//
|
//
|
||||||
@@ -151,7 +151,7 @@ typedef struct {
|
|||||||
} IPv6_ADDRESS;
|
} IPv6_ADDRESS;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Macro that returns the byte offset of a field in a data structure.
|
// Macro that returns the byte offset of a field in a data structure.
|
||||||
//
|
//
|
||||||
#define OFFSET_OF(TYPE, Field) ((UINTN) &(((TYPE *)0)->Field))
|
#define OFFSET_OF(TYPE, Field) ((UINTN) &(((TYPE *)0)->Field))
|
||||||
|
|
||||||
@@ -177,8 +177,8 @@ typedef struct {
|
|||||||
(Value) = (UINTN)((UINTN) (Value) + (UINTN) (Adjustment))
|
(Value) = (UINTN)((UINTN) (Value) + (UINTN) (Adjustment))
|
||||||
|
|
||||||
//
|
//
|
||||||
// Return the maximum of two operands.
|
// Return the maximum of two operands.
|
||||||
// This macro returns the maximum of two operand specified by a and b.
|
// This macro returns the maximum of two operand specified by a and b.
|
||||||
// Both a and b must be the same numerical types, signed or unsigned.
|
// Both a and b must be the same numerical types, signed or unsigned.
|
||||||
//
|
//
|
||||||
#define MAX(a, b) \
|
#define MAX(a, b) \
|
||||||
@@ -186,8 +186,8 @@ typedef struct {
|
|||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Return the minimum of two operands.
|
// Return the minimum of two operands.
|
||||||
// This macro returns the minimal of two operand specified by a and b.
|
// This macro returns the minimal of two operand specified by a and b.
|
||||||
// Both a and b must be the same numerical types, signed or unsigned.
|
// Both a and b must be the same numerical types, signed or unsigned.
|
||||||
//
|
//
|
||||||
#define MIN(a, b) \
|
#define MIN(a, b) \
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
/** @file
|
/** @file
|
||||||
This file is for build version number auto generation
|
This file is for build version number auto generation
|
||||||
|
|
||||||
Copyright (c) 2011 - 2014, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
@@ -12,4 +12,4 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
#define __BUILD_VERSION ""
|
#define __BUILD_VERSION "Developer Build based on Revision: Unknown"
|
||||||
|
@@ -1,10 +1,10 @@
|
|||||||
/** @file
|
/** @file
|
||||||
The firmware file related definitions in PI.
|
The firmware file related definitions in PI.
|
||||||
|
|
||||||
@par Revision Reference:
|
@par Revision Reference:
|
||||||
Version 1.4.
|
Version 1.4.
|
||||||
|
|
||||||
Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
|
|
||||||
This program and the accompanying materials are licensed and made available
|
This program and the accompanying materials are licensed and made available
|
||||||
under the terms and conditions of the BSD License which accompanies this
|
under the terms and conditions of the BSD License which accompanies this
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
#pragma pack(1)
|
#pragma pack(1)
|
||||||
//
|
//
|
||||||
// Used to verify the integrity of the file.
|
// Used to verify the integrity of the file.
|
||||||
//
|
//
|
||||||
typedef union {
|
typedef union {
|
||||||
struct {
|
struct {
|
||||||
UINT8 Header;
|
UINT8 Header;
|
||||||
@@ -37,7 +37,7 @@ typedef UINT8 EFI_FFS_FILE_STATE;
|
|||||||
|
|
||||||
//
|
//
|
||||||
// File Types Definitions
|
// File Types Definitions
|
||||||
//
|
//
|
||||||
#define EFI_FV_FILETYPE_ALL 0x00
|
#define EFI_FV_FILETYPE_ALL 0x00
|
||||||
#define EFI_FV_FILETYPE_RAW 0x01
|
#define EFI_FV_FILETYPE_RAW 0x01
|
||||||
#define EFI_FV_FILETYPE_FREEFORM 0x02
|
#define EFI_FV_FILETYPE_FREEFORM 0x02
|
||||||
@@ -61,9 +61,9 @@ typedef UINT8 EFI_FFS_FILE_STATE;
|
|||||||
#define EFI_FV_FILETYPE_FFS_MIN 0xf0
|
#define EFI_FV_FILETYPE_FFS_MIN 0xf0
|
||||||
#define EFI_FV_FILETYPE_FFS_MAX 0xff
|
#define EFI_FV_FILETYPE_FFS_MAX 0xff
|
||||||
#define EFI_FV_FILETYPE_FFS_PAD 0xf0
|
#define EFI_FV_FILETYPE_FFS_PAD 0xf0
|
||||||
//
|
//
|
||||||
// FFS File Attributes.
|
// FFS File Attributes.
|
||||||
//
|
//
|
||||||
#define FFS_ATTRIB_LARGE_FILE 0x01
|
#define FFS_ATTRIB_LARGE_FILE 0x01
|
||||||
#define FFS_ATTRIB_DATA_ALIGNMENT2 0x02
|
#define FFS_ATTRIB_DATA_ALIGNMENT2 0x02
|
||||||
#define FFS_ATTRIB_FIXED 0x04
|
#define FFS_ATTRIB_FIXED 0x04
|
||||||
@@ -75,9 +75,9 @@ typedef UINT8 EFI_FFS_FILE_STATE;
|
|||||||
//
|
//
|
||||||
#define FFS_FIXED_CHECKSUM 0xAA
|
#define FFS_FIXED_CHECKSUM 0xAA
|
||||||
|
|
||||||
//
|
//
|
||||||
// FFS File State Bits.
|
// FFS File State Bits.
|
||||||
//
|
//
|
||||||
#define EFI_FILE_HEADER_CONSTRUCTION 0x01
|
#define EFI_FILE_HEADER_CONSTRUCTION 0x01
|
||||||
#define EFI_FILE_HEADER_VALID 0x02
|
#define EFI_FILE_HEADER_VALID 0x02
|
||||||
#define EFI_FILE_DATA_VALID 0x04
|
#define EFI_FILE_DATA_VALID 0x04
|
||||||
@@ -94,9 +94,9 @@ typedef UINT8 EFI_FFS_FILE_STATE;
|
|||||||
)
|
)
|
||||||
|
|
||||||
//
|
//
|
||||||
// Each file begins with the header that describe the
|
// Each file begins with the header that describe the
|
||||||
// contents and state of the files.
|
// contents and state of the files.
|
||||||
//
|
//
|
||||||
typedef struct {
|
typedef struct {
|
||||||
EFI_GUID Name;
|
EFI_GUID Name;
|
||||||
EFI_FFS_INTEGRITY_CHECK IntegrityCheck;
|
EFI_FFS_INTEGRITY_CHECK IntegrityCheck;
|
||||||
@@ -164,21 +164,21 @@ typedef struct {
|
|||||||
#define MAX_SECTION_SIZE 0x1000000
|
#define MAX_SECTION_SIZE 0x1000000
|
||||||
|
|
||||||
//
|
//
|
||||||
// Leaf section type that contains an
|
// Leaf section type that contains an
|
||||||
// IA-32 16-bit executable image.
|
// IA-32 16-bit executable image.
|
||||||
//
|
//
|
||||||
typedef EFI_COMMON_SECTION_HEADER EFI_COMPATIBILITY16_SECTION;
|
typedef EFI_COMMON_SECTION_HEADER EFI_COMPATIBILITY16_SECTION;
|
||||||
typedef EFI_COMMON_SECTION_HEADER2 EFI_COMPATIBILITY16_SECTION2;
|
typedef EFI_COMMON_SECTION_HEADER2 EFI_COMPATIBILITY16_SECTION2;
|
||||||
|
|
||||||
//
|
//
|
||||||
// CompressionType of EFI_COMPRESSION_SECTION.
|
// CompressionType of EFI_COMPRESSION_SECTION.
|
||||||
//
|
//
|
||||||
#define EFI_NOT_COMPRESSED 0x00
|
#define EFI_NOT_COMPRESSED 0x00
|
||||||
#define EFI_STANDARD_COMPRESSION 0x01
|
#define EFI_STANDARD_COMPRESSION 0x01
|
||||||
//
|
//
|
||||||
// An encapsulation section type in which the
|
// An encapsulation section type in which the
|
||||||
// section data is compressed.
|
// section data is compressed.
|
||||||
//
|
//
|
||||||
typedef struct {
|
typedef struct {
|
||||||
EFI_COMMON_SECTION_HEADER CommonHeader;
|
EFI_COMMON_SECTION_HEADER CommonHeader;
|
||||||
UINT32 UncompressedLength;
|
UINT32 UncompressedLength;
|
||||||
@@ -193,19 +193,19 @@ typedef struct {
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Leaf section which could be used to determine the dispatch order of DXEs.
|
// Leaf section which could be used to determine the dispatch order of DXEs.
|
||||||
//
|
//
|
||||||
typedef EFI_COMMON_SECTION_HEADER EFI_DXE_DEPEX_SECTION;
|
typedef EFI_COMMON_SECTION_HEADER EFI_DXE_DEPEX_SECTION;
|
||||||
typedef EFI_COMMON_SECTION_HEADER2 EFI_DXE_DEPEX_SECTION2;
|
typedef EFI_COMMON_SECTION_HEADER2 EFI_DXE_DEPEX_SECTION2;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Leaf section witch contains a PI FV.
|
// Leaf section witch contains a PI FV.
|
||||||
//
|
//
|
||||||
typedef EFI_COMMON_SECTION_HEADER EFI_FIRMWARE_VOLUME_IMAGE_SECTION;
|
typedef EFI_COMMON_SECTION_HEADER EFI_FIRMWARE_VOLUME_IMAGE_SECTION;
|
||||||
typedef EFI_COMMON_SECTION_HEADER2 EFI_FIRMWARE_VOLUME_IMAGE_SECTION2;
|
typedef EFI_COMMON_SECTION_HEADER2 EFI_FIRMWARE_VOLUME_IMAGE_SECTION2;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Leaf section which contains a single GUID.
|
// Leaf section which contains a single GUID.
|
||||||
//
|
//
|
||||||
typedef struct {
|
typedef struct {
|
||||||
EFI_COMMON_SECTION_HEADER CommonHeader;
|
EFI_COMMON_SECTION_HEADER CommonHeader;
|
||||||
EFI_GUID SubTypeGuid;
|
EFI_GUID SubTypeGuid;
|
||||||
@@ -218,12 +218,12 @@ typedef struct {
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Attributes of EFI_GUID_DEFINED_SECTION
|
// Attributes of EFI_GUID_DEFINED_SECTION
|
||||||
//
|
//
|
||||||
#define EFI_GUIDED_SECTION_PROCESSING_REQUIRED 0x01
|
#define EFI_GUIDED_SECTION_PROCESSING_REQUIRED 0x01
|
||||||
#define EFI_GUIDED_SECTION_AUTH_STATUS_VALID 0x02
|
#define EFI_GUIDED_SECTION_AUTH_STATUS_VALID 0x02
|
||||||
//
|
//
|
||||||
// Leaf section which is encapsulation defined by specific GUID
|
// Leaf section which is encapsulation defined by specific GUID
|
||||||
//
|
//
|
||||||
typedef struct {
|
typedef struct {
|
||||||
EFI_COMMON_SECTION_HEADER CommonHeader;
|
EFI_COMMON_SECTION_HEADER CommonHeader;
|
||||||
EFI_GUID SectionDefinitionGuid;
|
EFI_GUID SectionDefinitionGuid;
|
||||||
@@ -240,44 +240,44 @@ typedef struct {
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Leaf section which contains PE32+ image.
|
// Leaf section which contains PE32+ image.
|
||||||
//
|
//
|
||||||
typedef EFI_COMMON_SECTION_HEADER EFI_PE32_SECTION;
|
typedef EFI_COMMON_SECTION_HEADER EFI_PE32_SECTION;
|
||||||
typedef EFI_COMMON_SECTION_HEADER2 EFI_PE32_SECTION2;
|
typedef EFI_COMMON_SECTION_HEADER2 EFI_PE32_SECTION2;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Leaf section which contains PIC image.
|
// Leaf section which contains PIC image.
|
||||||
//
|
//
|
||||||
typedef EFI_COMMON_SECTION_HEADER EFI_PIC_SECTION;
|
typedef EFI_COMMON_SECTION_HEADER EFI_PIC_SECTION;
|
||||||
typedef EFI_COMMON_SECTION_HEADER2 EFI_PIC_SECTION2;
|
typedef EFI_COMMON_SECTION_HEADER2 EFI_PIC_SECTION2;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Leaf section which used to determine the dispatch order of PEIMs.
|
// Leaf section which used to determine the dispatch order of PEIMs.
|
||||||
//
|
//
|
||||||
typedef EFI_COMMON_SECTION_HEADER EFI_PEI_DEPEX_SECTION;
|
typedef EFI_COMMON_SECTION_HEADER EFI_PEI_DEPEX_SECTION;
|
||||||
typedef EFI_COMMON_SECTION_HEADER2 EFI_PEI_DEPEX_SECTION2;
|
typedef EFI_COMMON_SECTION_HEADER2 EFI_PEI_DEPEX_SECTION2;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Leaf section which constains the position-independent-code image.
|
// Leaf section which constains the position-independent-code image.
|
||||||
//
|
//
|
||||||
typedef EFI_COMMON_SECTION_HEADER EFI_TE_SECTION;
|
typedef EFI_COMMON_SECTION_HEADER EFI_TE_SECTION;
|
||||||
typedef EFI_COMMON_SECTION_HEADER2 EFI_TE_SECTION2;
|
typedef EFI_COMMON_SECTION_HEADER2 EFI_TE_SECTION2;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Leaf section which contains an array of zero or more bytes.
|
// Leaf section which contains an array of zero or more bytes.
|
||||||
//
|
//
|
||||||
typedef EFI_COMMON_SECTION_HEADER EFI_RAW_SECTION;
|
typedef EFI_COMMON_SECTION_HEADER EFI_RAW_SECTION;
|
||||||
typedef EFI_COMMON_SECTION_HEADER2 EFI_RAW_SECTION2;
|
typedef EFI_COMMON_SECTION_HEADER2 EFI_RAW_SECTION2;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Leaf section which contains a unicode string that
|
// Leaf section which contains a unicode string that
|
||||||
// is human readable file name.
|
// is human readable file name.
|
||||||
//
|
//
|
||||||
typedef struct {
|
typedef struct {
|
||||||
EFI_COMMON_SECTION_HEADER CommonHeader;
|
EFI_COMMON_SECTION_HEADER CommonHeader;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Array of unicode string.
|
// Array of unicode string.
|
||||||
//
|
//
|
||||||
CHAR16 FileNameString[1];
|
CHAR16 FileNameString[1];
|
||||||
} EFI_USER_INTERFACE_SECTION;
|
} EFI_USER_INTERFACE_SECTION;
|
||||||
|
|
||||||
@@ -286,14 +286,14 @@ typedef struct {
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Array of unicode string.
|
// Array of unicode string.
|
||||||
//
|
//
|
||||||
CHAR16 FileNameString[1];
|
CHAR16 FileNameString[1];
|
||||||
} EFI_USER_INTERFACE_SECTION2;
|
} EFI_USER_INTERFACE_SECTION2;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Leaf section which contains a numeric build number and
|
// Leaf section which contains a numeric build number and
|
||||||
// an optional unicode string that represent the file revision.
|
// an optional unicode string that represent the file revision.
|
||||||
//
|
//
|
||||||
typedef struct {
|
typedef struct {
|
||||||
EFI_COMMON_SECTION_HEADER CommonHeader;
|
EFI_COMMON_SECTION_HEADER CommonHeader;
|
||||||
UINT16 BuildNumber;
|
UINT16 BuildNumber;
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
@par Revision Reference:
|
@par Revision Reference:
|
||||||
Version 1.2C
|
Version 1.2C
|
||||||
|
|
||||||
Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
|
|
||||||
This program and the accompanying materials are licensed and made available
|
This program and the accompanying materials are licensed and made available
|
||||||
under the terms and conditions of the BSD License which accompanies this
|
under the terms and conditions of the BSD License which accompanies this
|
||||||
@@ -26,16 +26,16 @@ typedef UINT32 EFI_FV_FILE_ATTRIBUTES;
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Value of EFI_FV_FILE_ATTRIBUTES.
|
// Value of EFI_FV_FILE_ATTRIBUTES.
|
||||||
//
|
//
|
||||||
#define EFI_FV_FILE_ATTRIB_ALIGNMENT 0x0000001F
|
#define EFI_FV_FILE_ATTRIB_ALIGNMENT 0x0000001F
|
||||||
#define EFI_FV_FILE_ATTRIB_FIXED 0x00000100
|
#define EFI_FV_FILE_ATTRIB_FIXED 0x00000100
|
||||||
#define EFI_FV_FILE_ATTRIB_MEMORY_MAPPED 0x00000200
|
#define EFI_FV_FILE_ATTRIB_MEMORY_MAPPED 0x00000200
|
||||||
|
|
||||||
typedef UINT32 EFI_FVB_ATTRIBUTES_2;
|
typedef UINT32 EFI_FVB_ATTRIBUTES_2;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Attributes bit definitions
|
// Attributes bit definitions
|
||||||
//
|
//
|
||||||
#define EFI_FVB2_READ_DISABLED_CAP 0x00000001
|
#define EFI_FVB2_READ_DISABLED_CAP 0x00000001
|
||||||
#define EFI_FVB2_READ_ENABLED_CAP 0x00000002
|
#define EFI_FVB2_READ_ENABLED_CAP 0x00000002
|
||||||
#define EFI_FVB2_READ_STATUS 0x00000004
|
#define EFI_FVB2_READ_STATUS 0x00000004
|
||||||
@@ -118,7 +118,7 @@ typedef struct {
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Extension header pointed by ExtHeaderOffset of volume header.
|
// Extension header pointed by ExtHeaderOffset of volume header.
|
||||||
//
|
//
|
||||||
typedef struct {
|
typedef struct {
|
||||||
EFI_GUID FvName;
|
EFI_GUID FvName;
|
||||||
UINT32 ExtHeaderSize;
|
UINT32 ExtHeaderSize;
|
||||||
@@ -135,9 +135,9 @@ typedef struct {
|
|||||||
UINT32 TypeMask;
|
UINT32 TypeMask;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Array of GUIDs.
|
// Array of GUIDs.
|
||||||
// Each GUID represents an OEM file type.
|
// Each GUID represents an OEM file type.
|
||||||
//
|
//
|
||||||
// EFI_GUID Types[1];
|
// EFI_GUID Types[1];
|
||||||
//
|
//
|
||||||
} EFI_FIRMWARE_VOLUME_EXT_ENTRY_OEM_TYPE;
|
} EFI_FIRMWARE_VOLUME_EXT_ENTRY_OEM_TYPE;
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
/** @file
|
/** @file
|
||||||
Defines data types and constants introduced in UEFI.
|
Defines data types and constants introduced in UEFI.
|
||||||
|
|
||||||
Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
|
|
||||||
This program and the accompanying materials are licensed and made available
|
This program and the accompanying materials are licensed and made available
|
||||||
under the terms and conditions of the BSD License which accompanies this
|
under the terms and conditions of the BSD License which accompanies this
|
||||||
@@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Basical data type definitions introduced in UEFI.
|
// Basical data type definitions introduced in UEFI.
|
||||||
//
|
//
|
||||||
typedef struct {
|
typedef struct {
|
||||||
UINT32 Data1;
|
UINT32 Data1;
|
||||||
UINT16 Data2;
|
UINT16 Data2;
|
||||||
@@ -94,41 +94,41 @@ typedef union {
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Enumeration of EFI_STATUS.
|
// Enumeration of EFI_STATUS.
|
||||||
//
|
//
|
||||||
#define EFI_SUCCESS RETURN_SUCCESS
|
#define EFI_SUCCESS RETURN_SUCCESS
|
||||||
#define EFI_LOAD_ERROR RETURN_LOAD_ERROR
|
#define EFI_LOAD_ERROR RETURN_LOAD_ERROR
|
||||||
#define EFI_INVALID_PARAMETER RETURN_INVALID_PARAMETER
|
#define EFI_INVALID_PARAMETER RETURN_INVALID_PARAMETER
|
||||||
#define EFI_UNSUPPORTED RETURN_UNSUPPORTED
|
#define EFI_UNSUPPORTED RETURN_UNSUPPORTED
|
||||||
#define EFI_BAD_BUFFER_SIZE RETURN_BAD_BUFFER_SIZE
|
#define EFI_BAD_BUFFER_SIZE RETURN_BAD_BUFFER_SIZE
|
||||||
#define EFI_BUFFER_TOO_SMALL RETURN_BUFFER_TOO_SMALL
|
#define EFI_BUFFER_TOO_SMALL RETURN_BUFFER_TOO_SMALL
|
||||||
#define EFI_NOT_READY RETURN_NOT_READY
|
#define EFI_NOT_READY RETURN_NOT_READY
|
||||||
#define EFI_DEVICE_ERROR RETURN_DEVICE_ERROR
|
#define EFI_DEVICE_ERROR RETURN_DEVICE_ERROR
|
||||||
#define EFI_WRITE_PROTECTED RETURN_WRITE_PROTECTED
|
#define EFI_WRITE_PROTECTED RETURN_WRITE_PROTECTED
|
||||||
#define EFI_OUT_OF_RESOURCES RETURN_OUT_OF_RESOURCES
|
#define EFI_OUT_OF_RESOURCES RETURN_OUT_OF_RESOURCES
|
||||||
#define EFI_VOLUME_CORRUPTED RETURN_VOLUME_CORRUPTED
|
#define EFI_VOLUME_CORRUPTED RETURN_VOLUME_CORRUPTED
|
||||||
#define EFI_VOLUME_FULL RETURN_VOLUME_FULL
|
#define EFI_VOLUME_FULL RETURN_VOLUME_FULL
|
||||||
#define EFI_NO_MEDIA RETURN_NO_MEDIA
|
#define EFI_NO_MEDIA RETURN_NO_MEDIA
|
||||||
#define EFI_MEDIA_CHANGED RETURN_MEDIA_CHANGED
|
#define EFI_MEDIA_CHANGED RETURN_MEDIA_CHANGED
|
||||||
#define EFI_NOT_FOUND RETURN_NOT_FOUND
|
#define EFI_NOT_FOUND RETURN_NOT_FOUND
|
||||||
#define EFI_ACCESS_DENIED RETURN_ACCESS_DENIED
|
#define EFI_ACCESS_DENIED RETURN_ACCESS_DENIED
|
||||||
#define EFI_NO_RESPONSE RETURN_NO_RESPONSE
|
#define EFI_NO_RESPONSE RETURN_NO_RESPONSE
|
||||||
#define EFI_NO_MAPPING RETURN_NO_MAPPING
|
#define EFI_NO_MAPPING RETURN_NO_MAPPING
|
||||||
#define EFI_TIMEOUT RETURN_TIMEOUT
|
#define EFI_TIMEOUT RETURN_TIMEOUT
|
||||||
#define EFI_NOT_STARTED RETURN_NOT_STARTED
|
#define EFI_NOT_STARTED RETURN_NOT_STARTED
|
||||||
#define EFI_ALREADY_STARTED RETURN_ALREADY_STARTED
|
#define EFI_ALREADY_STARTED RETURN_ALREADY_STARTED
|
||||||
#define EFI_ABORTED RETURN_ABORTED
|
#define EFI_ABORTED RETURN_ABORTED
|
||||||
#define EFI_ICMP_ERROR RETURN_ICMP_ERROR
|
#define EFI_ICMP_ERROR RETURN_ICMP_ERROR
|
||||||
#define EFI_TFTP_ERROR RETURN_TFTP_ERROR
|
#define EFI_TFTP_ERROR RETURN_TFTP_ERROR
|
||||||
#define EFI_PROTOCOL_ERROR RETURN_PROTOCOL_ERROR
|
#define EFI_PROTOCOL_ERROR RETURN_PROTOCOL_ERROR
|
||||||
#define EFI_INCOMPATIBLE_VERSION RETURN_INCOMPATIBLE_VERSION
|
#define EFI_INCOMPATIBLE_VERSION RETURN_INCOMPATIBLE_VERSION
|
||||||
#define EFI_SECURITY_VIOLATION RETURN_SECURITY_VIOLATION
|
#define EFI_SECURITY_VIOLATION RETURN_SECURITY_VIOLATION
|
||||||
#define EFI_CRC_ERROR RETURN_CRC_ERROR
|
#define EFI_CRC_ERROR RETURN_CRC_ERROR
|
||||||
#define EFI_END_OF_MEDIA RETURN_END_OF_MEDIA
|
#define EFI_END_OF_MEDIA RETURN_END_OF_MEDIA
|
||||||
#define EFI_END_OF_FILE RETURN_END_OF_FILE
|
#define EFI_END_OF_FILE RETURN_END_OF_FILE
|
||||||
|
|
||||||
#define EFI_WARN_UNKNOWN_GLYPH RETURN_WARN_UNKNOWN_GLYPH
|
#define EFI_WARN_UNKNOWN_GLYPH RETURN_WARN_UNKNOWN_GLYPH
|
||||||
#define EFI_WARN_DELETE_FAILURE RETURN_WARN_DELETE_FAILURE
|
#define EFI_WARN_DELETE_FAILURE RETURN_WARN_DELETE_FAILURE
|
||||||
#define EFI_WARN_WRITE_FAILURE RETURN_WARN_WRITE_FAILURE
|
#define EFI_WARN_WRITE_FAILURE RETURN_WARN_WRITE_FAILURE
|
||||||
#define EFI_WARN_BUFFER_TOO_SMALL RETURN_WARN_BUFFER_TOO_SMALL
|
#define EFI_WARN_BUFFER_TOO_SMALL RETURN_WARN_BUFFER_TOO_SMALL
|
||||||
|
|
||||||
|
|
||||||
@@ -136,7 +136,7 @@ typedef union {
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Define macro to encode the status code.
|
// Define macro to encode the status code.
|
||||||
//
|
//
|
||||||
#define EFIERR(_a) ENCODE_ERROR(_a)
|
#define EFIERR(_a) ENCODE_ERROR(_a)
|
||||||
|
|
||||||
#define EFI_ERROR(A) RETURN_ERROR(A)
|
#define EFI_ERROR(A) RETURN_ERROR(A)
|
||||||
|
@@ -3,7 +3,7 @@
|
|||||||
IFR is primarily consumed by the EFI presentation engine, and produced by EFI
|
IFR is primarily consumed by the EFI presentation engine, and produced by EFI
|
||||||
internal application and drivers as well as all add-in card option-ROM drivers
|
internal application and drivers as well as all add-in card option-ROM drivers
|
||||||
|
|
||||||
Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
(C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
|
(C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
|
||||||
|
|
||||||
This program and the accompanying materials are licensed and made available
|
This program and the accompanying materials are licensed and made available
|
||||||
@@ -55,27 +55,27 @@ typedef struct {
|
|||||||
} EFI_HII_PACKAGE_LIST_HEADER;
|
} EFI_HII_PACKAGE_LIST_HEADER;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
||||||
Each package starts with a header, as defined above, which
|
Each package starts with a header, as defined above, which
|
||||||
indicates the size and type of the package. When added to a
|
indicates the size and type of the package. When added to a
|
||||||
pointer pointing to the start of the header, Length points at
|
pointer pointing to the start of the header, Length points at
|
||||||
the next package. The package lists form a package list when
|
the next package. The package lists form a package list when
|
||||||
concatenated together and terminated with an
|
concatenated together and terminated with an
|
||||||
EFI_HII_PACKAGE_HEADER with a Type of EFI_HII_PACKAGE_END. The
|
EFI_HII_PACKAGE_HEADER with a Type of EFI_HII_PACKAGE_END. The
|
||||||
type EFI_HII_PACKAGE_TYPE_GUID is used for vendor-defined HII
|
type EFI_HII_PACKAGE_TYPE_GUID is used for vendor-defined HII
|
||||||
packages, whose contents are determined by the Guid. The range
|
packages, whose contents are determined by the Guid. The range
|
||||||
of package types starting with EFI_HII_PACKAGE_TYPE_SYSTEM_BEGIN
|
of package types starting with EFI_HII_PACKAGE_TYPE_SYSTEM_BEGIN
|
||||||
through EFI_HII_PACKAGE_TYPE_SYSTEM_END are reserved for system
|
through EFI_HII_PACKAGE_TYPE_SYSTEM_END are reserved for system
|
||||||
firmware implementers.
|
firmware implementers.
|
||||||
|
|
||||||
@param Length The size of the package in bytes.
|
@param Length The size of the package in bytes.
|
||||||
|
|
||||||
@param Type The package type. See EFI_HII_PACKAGE_TYPE_x,
|
@param Type The package type. See EFI_HII_PACKAGE_TYPE_x,
|
||||||
below.
|
below.
|
||||||
|
|
||||||
@param Data The package data, the format of which is
|
@param Data The package data, the format of which is
|
||||||
determined by Type.
|
determined by Type.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
UINT32 Length:24;
|
UINT32 Length:24;
|
||||||
@@ -85,7 +85,7 @@ typedef struct {
|
|||||||
|
|
||||||
//
|
//
|
||||||
// EFI_HII_PACKAGE_TYPE_x.
|
// EFI_HII_PACKAGE_TYPE_x.
|
||||||
//
|
//
|
||||||
#define EFI_HII_PACKAGE_TYPE_ALL 0x00
|
#define EFI_HII_PACKAGE_TYPE_ALL 0x00
|
||||||
#define EFI_HII_PACKAGE_TYPE_GUID 0x01
|
#define EFI_HII_PACKAGE_TYPE_GUID 0x01
|
||||||
#define EFI_HII_PACKAGE_FORM 0x02
|
#define EFI_HII_PACKAGE_FORM 0x02
|
||||||
@@ -222,7 +222,7 @@ typedef struct _EFI_HII_GIBT_GLYPH_BLOCK {
|
|||||||
typedef struct _EFI_HII_GIBT_GLYPHS_BLOCK {
|
typedef struct _EFI_HII_GIBT_GLYPHS_BLOCK {
|
||||||
EFI_HII_GLYPH_BLOCK Header;
|
EFI_HII_GLYPH_BLOCK Header;
|
||||||
EFI_HII_GLYPH_INFO Cell;
|
EFI_HII_GLYPH_INFO Cell;
|
||||||
UINT16 Count;
|
UINT16 Count;
|
||||||
UINT8 BitmapData[1]; // the number of bytes per bitmap can be calculated by ((Cell.Width+7)/8)*Cell.Height
|
UINT8 BitmapData[1]; // the number of bytes per bitmap can be calculated by ((Cell.Width+7)/8)*Cell.Height
|
||||||
} EFI_HII_GIBT_GLYPHS_BLOCK;
|
} EFI_HII_GIBT_GLYPHS_BLOCK;
|
||||||
|
|
||||||
@@ -1360,12 +1360,12 @@ typedef struct _EFI_IFR_SECURITY {
|
|||||||
|
|
||||||
typedef struct _EFI_IFR_FORM_MAP_METHOD {
|
typedef struct _EFI_IFR_FORM_MAP_METHOD {
|
||||||
///
|
///
|
||||||
/// The string identifier which provides the human-readable name of
|
/// The string identifier which provides the human-readable name of
|
||||||
/// the configuration method for this standards map form.
|
/// the configuration method for this standards map form.
|
||||||
///
|
///
|
||||||
EFI_STRING_ID MethodTitle;
|
EFI_STRING_ID MethodTitle;
|
||||||
///
|
///
|
||||||
/// Identifier which uniquely specifies the configuration methods
|
/// Identifier which uniquely specifies the configuration methods
|
||||||
/// associated with this standards map form.
|
/// associated with this standards map form.
|
||||||
///
|
///
|
||||||
EFI_GUID MethodIdentifier;
|
EFI_GUID MethodIdentifier;
|
||||||
@@ -1373,8 +1373,8 @@ typedef struct _EFI_IFR_FORM_MAP_METHOD {
|
|||||||
|
|
||||||
typedef struct _EFI_IFR_FORM_MAP {
|
typedef struct _EFI_IFR_FORM_MAP {
|
||||||
///
|
///
|
||||||
/// The sequence that defines the type of opcode as well as the length
|
/// The sequence that defines the type of opcode as well as the length
|
||||||
/// of the opcode being defined. Header.OpCode = EFI_IFR_FORM_MAP_OP.
|
/// of the opcode being defined. Header.OpCode = EFI_IFR_FORM_MAP_OP.
|
||||||
///
|
///
|
||||||
EFI_IFR_OP_HEADER Header;
|
EFI_IFR_OP_HEADER Header;
|
||||||
///
|
///
|
||||||
@@ -1389,13 +1389,13 @@ typedef struct _EFI_IFR_FORM_MAP {
|
|||||||
|
|
||||||
typedef struct _EFI_IFR_SET {
|
typedef struct _EFI_IFR_SET {
|
||||||
///
|
///
|
||||||
/// The sequence that defines the type of opcode as well as the length
|
/// The sequence that defines the type of opcode as well as the length
|
||||||
/// of the opcode being defined. Header.OpCode = EFI_IFR_SET_OP.
|
/// of the opcode being defined. Header.OpCode = EFI_IFR_SET_OP.
|
||||||
///
|
///
|
||||||
EFI_IFR_OP_HEADER Header;
|
EFI_IFR_OP_HEADER Header;
|
||||||
///
|
///
|
||||||
/// Specifies the identifier of a previously declared variable store to
|
/// Specifies the identifier of a previously declared variable store to
|
||||||
/// use when storing the question's value.
|
/// use when storing the question's value.
|
||||||
///
|
///
|
||||||
EFI_VARSTORE_ID VarStoreId;
|
EFI_VARSTORE_ID VarStoreId;
|
||||||
union {
|
union {
|
||||||
@@ -1409,20 +1409,20 @@ typedef struct _EFI_IFR_SET {
|
|||||||
UINT16 VarOffset;
|
UINT16 VarOffset;
|
||||||
} VarStoreInfo;
|
} VarStoreInfo;
|
||||||
///
|
///
|
||||||
/// Specifies the type used for storage.
|
/// Specifies the type used for storage.
|
||||||
///
|
///
|
||||||
UINT8 VarStoreType;
|
UINT8 VarStoreType;
|
||||||
} EFI_IFR_SET;
|
} EFI_IFR_SET;
|
||||||
|
|
||||||
typedef struct _EFI_IFR_GET {
|
typedef struct _EFI_IFR_GET {
|
||||||
///
|
///
|
||||||
/// The sequence that defines the type of opcode as well as the length
|
/// The sequence that defines the type of opcode as well as the length
|
||||||
/// of the opcode being defined. Header.OpCode = EFI_IFR_GET_OP.
|
/// of the opcode being defined. Header.OpCode = EFI_IFR_GET_OP.
|
||||||
///
|
///
|
||||||
EFI_IFR_OP_HEADER Header;
|
EFI_IFR_OP_HEADER Header;
|
||||||
///
|
///
|
||||||
/// Specifies the identifier of a previously declared variable store to
|
/// Specifies the identifier of a previously declared variable store to
|
||||||
/// use when retrieving the value.
|
/// use when retrieving the value.
|
||||||
///
|
///
|
||||||
EFI_VARSTORE_ID VarStoreId;
|
EFI_VARSTORE_ID VarStoreId;
|
||||||
union {
|
union {
|
||||||
@@ -1436,7 +1436,7 @@ typedef struct _EFI_IFR_GET {
|
|||||||
UINT16 VarOffset;
|
UINT16 VarOffset;
|
||||||
} VarStoreInfo;
|
} VarStoreInfo;
|
||||||
///
|
///
|
||||||
/// Specifies the type used for storage.
|
/// Specifies the type used for storage.
|
||||||
///
|
///
|
||||||
UINT8 VarStoreType;
|
UINT8 VarStoreType;
|
||||||
} EFI_IFR_GET;
|
} EFI_IFR_GET;
|
||||||
@@ -1456,9 +1456,9 @@ typedef struct _EFI_IFR_MAP {
|
|||||||
// Keyboard Package
|
// Keyboard Package
|
||||||
//
|
//
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
EfiKeyLCtrl,
|
EfiKeyLCtrl,
|
||||||
EfiKeyA0,
|
EfiKeyA0,
|
||||||
EfiKeyLAlt,
|
EfiKeyLAlt,
|
||||||
EfiKeySpaceBar,
|
EfiKeySpaceBar,
|
||||||
EfiKeyA2,
|
EfiKeyA2,
|
||||||
@@ -1575,7 +1575,7 @@ typedef struct {
|
|||||||
} EFI_KEY_DESCRIPTOR;
|
} EFI_KEY_DESCRIPTOR;
|
||||||
|
|
||||||
//
|
//
|
||||||
// A key which is affected by all the standard shift modifiers.
|
// A key which is affected by all the standard shift modifiers.
|
||||||
// Most keys would be expected to have this bit active.
|
// Most keys would be expected to have this bit active.
|
||||||
//
|
//
|
||||||
#define EFI_AFFECTED_BY_STANDARD_SHIFT 0x0001
|
#define EFI_AFFECTED_BY_STANDARD_SHIFT 0x0001
|
||||||
@@ -1677,7 +1677,7 @@ typedef struct {
|
|||||||
// token usages.
|
// token usages.
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
// STRING_TOKEN is not defined in UEFI specification. But it is placed
|
// STRING_TOKEN is not defined in UEFI specification. But it is placed
|
||||||
// here for the easy access by C files and VFR source files.
|
// here for the easy access by C files and VFR source files.
|
||||||
//
|
//
|
||||||
#define STRING_TOKEN(t) t
|
#define STRING_TOKEN(t) t
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/** @file
|
/** @file
|
||||||
This includes some definitions introduced in UEFI that will be used in both PEI
|
This includes some definitions introduced in UEFI that will be used in both PEI
|
||||||
and DXE phases.
|
and DXE phases.
|
||||||
|
|
||||||
(C) Copyright 2015 Hewlett-Packard Development Company, L.P.<BR>
|
(C) Copyright 2015 Hewlett-Packard Development Company, L.P.<BR>
|
||||||
@@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Enumeration of memory types introduced in UEFI.
|
// Enumeration of memory types introduced in UEFI.
|
||||||
//
|
//
|
||||||
typedef enum {
|
typedef enum {
|
||||||
EfiReservedMemoryType,
|
EfiReservedMemoryType,
|
||||||
EfiLoaderCode,
|
EfiLoaderCode,
|
||||||
@@ -43,7 +43,7 @@ typedef enum {
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Data structure that precedes all of the standard EFI table types.
|
// Data structure that precedes all of the standard EFI table types.
|
||||||
//
|
//
|
||||||
typedef struct {
|
typedef struct {
|
||||||
UINT64 Signature;
|
UINT64 Signature;
|
||||||
UINT32 Revision;
|
UINT32 Revision;
|
||||||
@@ -54,28 +54,28 @@ typedef struct {
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Attributes of variable.
|
// Attributes of variable.
|
||||||
//
|
//
|
||||||
#define EFI_VARIABLE_NON_VOLATILE 0x00000001
|
#define EFI_VARIABLE_NON_VOLATILE 0x00000001
|
||||||
#define EFI_VARIABLE_BOOTSERVICE_ACCESS 0x00000002
|
#define EFI_VARIABLE_BOOTSERVICE_ACCESS 0x00000002
|
||||||
#define EFI_VARIABLE_RUNTIME_ACCESS 0x00000004
|
#define EFI_VARIABLE_RUNTIME_ACCESS 0x00000004
|
||||||
#define EFI_VARIABLE_HARDWARE_ERROR_RECORD 0x00000008
|
#define EFI_VARIABLE_HARDWARE_ERROR_RECORD 0x00000008
|
||||||
|
|
||||||
//
|
//
|
||||||
// This attribute is identified by the mnemonic 'HR'
|
// This attribute is identified by the mnemonic 'HR'
|
||||||
// elsewhere in this specification.
|
// elsewhere in this specification.
|
||||||
//
|
//
|
||||||
#define EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS 0x00000010
|
#define EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS 0x00000010
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// _WIN_CERTIFICATE.wCertificateType
|
// _WIN_CERTIFICATE.wCertificateType
|
||||||
//
|
//
|
||||||
#define WIN_CERT_TYPE_EFI_PKCS115 0x0EF0
|
#define WIN_CERT_TYPE_EFI_PKCS115 0x0EF0
|
||||||
#define WIN_CERT_TYPE_EFI_GUID 0x0EF1
|
#define WIN_CERT_TYPE_EFI_GUID 0x0EF1
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
||||||
The WIN_CERTIFICATE structure is part of the PE/COFF
|
The WIN_CERTIFICATE structure is part of the PE/COFF
|
||||||
specification and has the following definition:
|
specification and has the following definition:
|
||||||
|
|
||||||
@@ -110,13 +110,13 @@ typedef struct _WIN_CERTIFICATE {
|
|||||||
|
|
||||||
//
|
//
|
||||||
// WIN_CERTIFICATE_UEFI_GUID.CertType
|
// WIN_CERTIFICATE_UEFI_GUID.CertType
|
||||||
//
|
//
|
||||||
#define EFI_CERT_TYPE_RSA2048_SHA256_GUID \
|
#define EFI_CERT_TYPE_RSA2048_SHA256_GUID \
|
||||||
{0xa7717414, 0xc616, 0x4977, {0x94, 0x20, 0x84, 0x47, 0x12, 0xa7, 0x35, 0xbf } }
|
{0xa7717414, 0xc616, 0x4977, {0x94, 0x20, 0x84, 0x47, 0x12, 0xa7, 0x35, 0xbf } }
|
||||||
|
|
||||||
//
|
//
|
||||||
// WIN_CERTIFICATE_UEFI_GUID.CertData
|
// WIN_CERTIFICATE_UEFI_GUID.CertData
|
||||||
//
|
//
|
||||||
typedef struct _EFI_CERT_BLOCK_RSA_2048_SHA256 {
|
typedef struct _EFI_CERT_BLOCK_RSA_2048_SHA256 {
|
||||||
EFI_GUID HashType;
|
EFI_GUID HashType;
|
||||||
UINT8 PublicKey[256];
|
UINT8 PublicKey[256];
|
||||||
@@ -125,7 +125,7 @@ typedef struct _EFI_CERT_BLOCK_RSA_2048_SHA256 {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
||||||
@param Hdr This is the standard WIN_CERTIFICATE header, where
|
@param Hdr This is the standard WIN_CERTIFICATE header, where
|
||||||
wCertificateType is set to
|
wCertificateType is set to
|
||||||
WIN_CERT_TYPE_EFI_GUID.
|
WIN_CERT_TYPE_EFI_GUID.
|
||||||
@@ -158,26 +158,26 @@ typedef struct _WIN_CERTIFICATE_UEFI_GUID {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
||||||
Certificate which encapsulates the RSASSA_PKCS1-v1_5 digital
|
Certificate which encapsulates the RSASSA_PKCS1-v1_5 digital
|
||||||
signature.
|
signature.
|
||||||
|
|
||||||
The WIN_CERTIFICATE_UEFI_PKCS1_15 structure is derived from
|
The WIN_CERTIFICATE_UEFI_PKCS1_15 structure is derived from
|
||||||
WIN_CERTIFICATE and encapsulate the information needed to
|
WIN_CERTIFICATE and encapsulate the information needed to
|
||||||
implement the RSASSA-PKCS1-v1_5 digital signature algorithm as
|
implement the RSASSA-PKCS1-v1_5 digital signature algorithm as
|
||||||
specified in RFC2437.
|
specified in RFC2437.
|
||||||
|
|
||||||
@param Hdr This is the standard WIN_CERTIFICATE header, where
|
@param Hdr This is the standard WIN_CERTIFICATE header, where
|
||||||
wCertificateType is set to
|
wCertificateType is set to
|
||||||
WIN_CERT_TYPE_UEFI_PKCS1_15.
|
WIN_CERT_TYPE_UEFI_PKCS1_15.
|
||||||
|
|
||||||
@param HashAlgorithm This is the hashing algorithm which was
|
@param HashAlgorithm This is the hashing algorithm which was
|
||||||
performed on the UEFI executable when
|
performed on the UEFI executable when
|
||||||
creating the digital signature. It is
|
creating the digital signature. It is
|
||||||
one of the enumerated values pre-defined
|
one of the enumerated values pre-defined
|
||||||
in Section 26.4.1. See
|
in Section 26.4.1. See
|
||||||
EFI_HASH_ALGORITHM_x.
|
EFI_HASH_ALGORITHM_x.
|
||||||
|
|
||||||
@param Signature This is the actual digital signature. The
|
@param Signature This is the actual digital signature. The
|
||||||
size of the signature is the same size as
|
size of the signature is the same size as
|
||||||
the key (1024-bit key is 128 bytes) and can
|
the key (1024-bit key is 128 bytes) and can
|
||||||
@@ -195,7 +195,7 @@ typedef struct _WIN_CERTIFICATE_EFI_PKCS1_15 {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
||||||
AuthInfo is a WIN_CERTIFICATE using the wCertificateType
|
AuthInfo is a WIN_CERTIFICATE using the wCertificateType
|
||||||
WIN_CERTIFICATE_UEFI_GUID and the CertType
|
WIN_CERTIFICATE_UEFI_GUID and the CertType
|
||||||
EFI_CERT_TYPE_RSA2048_SHA256. If the attribute specifies
|
EFI_CERT_TYPE_RSA2048_SHA256. If the attribute specifies
|
||||||
@@ -209,12 +209,12 @@ typedef struct _WIN_CERTIFICATE_EFI_PKCS1_15 {
|
|||||||
WIN_CERTIFICATE shall be used to describe the signature of the
|
WIN_CERTIFICATE shall be used to describe the signature of the
|
||||||
Variable data *Data. In addition, the signature will also
|
Variable data *Data. In addition, the signature will also
|
||||||
include the MonotonicCount value to guard against replay attacks
|
include the MonotonicCount value to guard against replay attacks
|
||||||
|
|
||||||
@param MonotonicCount Included in the signature of
|
@param MonotonicCount Included in the signature of
|
||||||
AuthInfo.Used to ensure freshness/no
|
AuthInfo.Used to ensure freshness/no
|
||||||
replay. Incremented during each
|
replay. Incremented during each
|
||||||
"Write" access.
|
"Write" access.
|
||||||
|
|
||||||
@param AuthInfo Provides the authorization for the variable
|
@param AuthInfo Provides the authorization for the variable
|
||||||
access. It is a signature across the
|
access. It is a signature across the
|
||||||
variable data and the Monotonic Count
|
variable data and the Monotonic Count
|
||||||
|
@@ -1,13 +1,13 @@
|
|||||||
/**@file
|
/**@file
|
||||||
Header file for EFI Variable Services.
|
Header file for EFI Variable Services.
|
||||||
|
|
||||||
Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
|
|
||||||
This program and the accompanying materials are licensed and made available
|
This program and the accompanying materials are licensed and made available
|
||||||
under the terms and conditions of the BSD License which accompanies this
|
under the terms and conditions of the BSD License which accompanies this
|
||||||
distribution. The full text of the license may be found at
|
distribution. The full text of the license may be found at
|
||||||
http://opensource.org/licenses/bsd-license.php
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
|
@@ -2,8 +2,8 @@
|
|||||||
Terminal Device Path Vendor Guid.
|
Terminal Device Path Vendor Guid.
|
||||||
@par Revision Reference:
|
@par Revision Reference:
|
||||||
GUIDs defined in UEFI 2.0 spec.
|
GUIDs defined in UEFI 2.0 spec.
|
||||||
|
|
||||||
Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
|
|
||||||
This program and the accompanying materials are licensed and made available
|
This program and the accompanying materials are licensed and made available
|
||||||
under the terms and conditions of the BSD License which accompanies this
|
under the terms and conditions of the BSD License which accompanies this
|
||||||
@@ -42,7 +42,7 @@
|
|||||||
{ \
|
{ \
|
||||||
0x37499a9d, 0x542f, 0x4c89, {0xa0, 0x26, 0x35, 0xda, 0x14, 0x20, 0x94, 0xe4 } \
|
0x37499a9d, 0x542f, 0x4c89, {0xa0, 0x26, 0x35, 0xda, 0x14, 0x20, 0x94, 0xe4 } \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define EFI_SAS_DEVICE_PATH_GUID \
|
#define EFI_SAS_DEVICE_PATH_GUID \
|
||||||
{ \
|
{ \
|
||||||
0xd487ddb4, 0x008b, 0x11d9, {0xaf, 0xdc, 0x00, 0x10, 0x83, 0xff, 0xca, 0x4d } \
|
0xd487ddb4, 0x008b, 0x11d9, {0xaf, 0xdc, 0x00, 0x10, 0x83, 0xff, 0xca, 0x4d } \
|
||||||
|
@@ -1,11 +1,11 @@
|
|||||||
/** @file
|
/** @file
|
||||||
Guid used to define the Firmware File System. See PI spec volume 3 for more
|
Guid used to define the Firmware File System. See PI spec volume 3 for more
|
||||||
details.
|
details.
|
||||||
|
|
||||||
@par Revision Reference:
|
@par Revision Reference:
|
||||||
Guids defined in PI Spec Volume 3
|
Guids defined in PI Spec Volume 3
|
||||||
|
|
||||||
Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
|
|
||||||
This program and the accompanying materials are licensed and made available
|
This program and the accompanying materials are licensed and made available
|
||||||
under the terms and conditions of the BSD License which accompanies this
|
under the terms and conditions of the BSD License which accompanies this
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
/** @file
|
/** @file
|
||||||
Processor or Compiler specific defines and types for x64.
|
Processor or Compiler specific defines and types for x64.
|
||||||
|
|
||||||
Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
|
|
||||||
This program and the accompanying materials are licensed and made available
|
This program and the accompanying materials are licensed and made available
|
||||||
under the terms and conditions of the BSD License which accompanies this
|
under the terms and conditions of the BSD License which accompanies this
|
||||||
@@ -64,11 +64,11 @@
|
|||||||
//
|
//
|
||||||
// No ANSI C 2000 stdint.h integer width declarations, so define equivalents
|
// No ANSI C 2000 stdint.h integer width declarations, so define equivalents
|
||||||
//
|
//
|
||||||
|
|
||||||
#if _MSC_EXTENSIONS
|
#if _MSC_EXTENSIONS
|
||||||
|
|
||||||
//
|
//
|
||||||
// use Microsoft* C complier dependent integer width types
|
// use Microsoft* C complier dependent integer width types
|
||||||
//
|
//
|
||||||
typedef unsigned __int64 UINT64;
|
typedef unsigned __int64 UINT64;
|
||||||
typedef __int64 INT64;
|
typedef __int64 INT64;
|
||||||
@@ -84,7 +84,7 @@
|
|||||||
#else
|
#else
|
||||||
|
|
||||||
//
|
//
|
||||||
// Assume standard IA-32 alignment.
|
// Assume standard IA-32 alignment.
|
||||||
// BugBug: Need to check portability of long long
|
// BugBug: Need to check portability of long long
|
||||||
//
|
//
|
||||||
typedef unsigned long long UINT64;
|
typedef unsigned long long UINT64;
|
||||||
@@ -144,17 +144,17 @@ typedef INT32 INTN;
|
|||||||
#if _MSC_EXTENSIONS
|
#if _MSC_EXTENSIONS
|
||||||
//
|
//
|
||||||
// Microsoft* compiler requires _EFIAPI useage, __cdecl is Microsoft* specific C.
|
// Microsoft* compiler requires _EFIAPI useage, __cdecl is Microsoft* specific C.
|
||||||
//
|
//
|
||||||
#define EFIAPI __cdecl
|
#define EFIAPI __cdecl
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if __GNUC__
|
#if __GNUC__
|
||||||
#define EFIAPI __attribute__((cdecl))
|
#define EFIAPI __attribute__((cdecl))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
// The Microsoft* C compiler can removed references to unreferenced data items
|
// The Microsoft* C compiler can removed references to unreferenced data items
|
||||||
// if the /OPT:REF linker option is used. We defined a macro as this is a
|
// if the /OPT:REF linker option is used. We defined a macro as this is a
|
||||||
// a non standard extension
|
// a non standard extension
|
||||||
//
|
//
|
||||||
#if _MSC_EXTENSIONS
|
#if _MSC_EXTENSIONS
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
/** @file
|
/** @file
|
||||||
ACPI memory mapped configuration space access table definition, defined at
|
ACPI memory mapped configuration space access table definition, defined at
|
||||||
in the PCI Firmware Specification, version 3.0 draft version 0.5.
|
in the PCI Firmware Specification, version 3.0 draft version 0.5.
|
||||||
Specification is available at http://www.pcisig.com.
|
Specification is available at http://www.pcisig.com.
|
||||||
|
|
||||||
Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
|
|
||||||
This program and the accompanying materials are licensed and made available
|
This program and the accompanying materials are licensed and made available
|
||||||
under the terms and conditions of the BSD License which accompanies this
|
under the terms and conditions of the BSD License which accompanies this
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
@bug Fix text - doc as defined in MSFT EFI specification.
|
@bug Fix text - doc as defined in MSFT EFI specification.
|
||||||
|
|
||||||
Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
Portions copyright (c) 2011 - 2013, ARM Ltd. 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
|
This program and the accompanying materials are licensed and made available
|
||||||
@@ -52,10 +52,10 @@
|
|||||||
//
|
//
|
||||||
// Support old names for backward compatible
|
// Support old names for backward compatible
|
||||||
//
|
//
|
||||||
#define EFI_IMAGE_MACHINE_IA32 IMAGE_FILE_MACHINE_I386
|
#define EFI_IMAGE_MACHINE_IA32 IMAGE_FILE_MACHINE_I386
|
||||||
#define EFI_IMAGE_MACHINE_IA64 IMAGE_FILE_MACHINE_IA64
|
#define EFI_IMAGE_MACHINE_IA64 IMAGE_FILE_MACHINE_IA64
|
||||||
#define EFI_IMAGE_MACHINE_IPF IMAGE_FILE_MACHINE_IA64
|
#define EFI_IMAGE_MACHINE_IPF IMAGE_FILE_MACHINE_IA64
|
||||||
#define EFI_IMAGE_MACHINE_EBC IMAGE_FILE_MACHINE_EBC
|
#define EFI_IMAGE_MACHINE_EBC IMAGE_FILE_MACHINE_EBC
|
||||||
#define EFI_IMAGE_MACHINE_X64 IMAGE_FILE_MACHINE_X64
|
#define EFI_IMAGE_MACHINE_X64 IMAGE_FILE_MACHINE_X64
|
||||||
#define EFI_IMAGE_MACHINE_ARMT IMAGE_FILE_MACHINE_ARMT
|
#define EFI_IMAGE_MACHINE_ARMT IMAGE_FILE_MACHINE_ARMT
|
||||||
#define EFI_IMAGE_MACHINE_AARCH64 IMAGE_FILE_MACHINE_ARM64
|
#define EFI_IMAGE_MACHINE_AARCH64 IMAGE_FILE_MACHINE_ARM64
|
||||||
@@ -475,23 +475,23 @@ typedef struct {
|
|||||||
//
|
//
|
||||||
// x64 processor relocation types.
|
// x64 processor relocation types.
|
||||||
//
|
//
|
||||||
#define IMAGE_REL_AMD64_ABSOLUTE 0x0000
|
#define IMAGE_REL_AMD64_ABSOLUTE 0x0000
|
||||||
#define IMAGE_REL_AMD64_ADDR64 0x0001
|
#define IMAGE_REL_AMD64_ADDR64 0x0001
|
||||||
#define IMAGE_REL_AMD64_ADDR32 0x0002
|
#define IMAGE_REL_AMD64_ADDR32 0x0002
|
||||||
#define IMAGE_REL_AMD64_ADDR32NB 0x0003
|
#define IMAGE_REL_AMD64_ADDR32NB 0x0003
|
||||||
#define IMAGE_REL_AMD64_REL32 0x0004
|
#define IMAGE_REL_AMD64_REL32 0x0004
|
||||||
#define IMAGE_REL_AMD64_REL32_1 0x0005
|
#define IMAGE_REL_AMD64_REL32_1 0x0005
|
||||||
#define IMAGE_REL_AMD64_REL32_2 0x0006
|
#define IMAGE_REL_AMD64_REL32_2 0x0006
|
||||||
#define IMAGE_REL_AMD64_REL32_3 0x0007
|
#define IMAGE_REL_AMD64_REL32_3 0x0007
|
||||||
#define IMAGE_REL_AMD64_REL32_4 0x0008
|
#define IMAGE_REL_AMD64_REL32_4 0x0008
|
||||||
#define IMAGE_REL_AMD64_REL32_5 0x0009
|
#define IMAGE_REL_AMD64_REL32_5 0x0009
|
||||||
#define IMAGE_REL_AMD64_SECTION 0x000A
|
#define IMAGE_REL_AMD64_SECTION 0x000A
|
||||||
#define IMAGE_REL_AMD64_SECREL 0x000B
|
#define IMAGE_REL_AMD64_SECREL 0x000B
|
||||||
#define IMAGE_REL_AMD64_SECREL7 0x000C
|
#define IMAGE_REL_AMD64_SECREL7 0x000C
|
||||||
#define IMAGE_REL_AMD64_TOKEN 0x000D
|
#define IMAGE_REL_AMD64_TOKEN 0x000D
|
||||||
#define IMAGE_REL_AMD64_SREL32 0x000E
|
#define IMAGE_REL_AMD64_SREL32 0x000E
|
||||||
#define IMAGE_REL_AMD64_PAIR 0x000F
|
#define IMAGE_REL_AMD64_PAIR 0x000F
|
||||||
#define IMAGE_REL_AMD64_SSPAN32 0x0010
|
#define IMAGE_REL_AMD64_SSPAN32 0x0010
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Based relocation format.
|
/// Based relocation format.
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
/** @file
|
/** @file
|
||||||
Support for PCI 2.2 standard.
|
Support for PCI 2.2 standard.
|
||||||
|
|
||||||
Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
|
|
||||||
This program and the accompanying materials are licensed and made available
|
This program and the accompanying materials are licensed and made available
|
||||||
under the terms and conditions of the BSD License which accompanies this
|
under the terms and conditions of the BSD License which accompanies this
|
||||||
@@ -168,7 +168,7 @@ typedef struct {
|
|||||||
#define PCI_CLASS_BRIDGE_ISA_PDECODE 0x80
|
#define PCI_CLASS_BRIDGE_ISA_PDECODE 0x80
|
||||||
#define PCI_CLASS_ISA_POSITIVE_DECODE 0x80 // obsolete
|
#define PCI_CLASS_ISA_POSITIVE_DECODE 0x80 // obsolete
|
||||||
|
|
||||||
#define PCI_CLASS_SCC 0x07 // Simple communications controllers
|
#define PCI_CLASS_SCC 0x07 // Simple communications controllers
|
||||||
#define PCI_SUBCLASS_SERIAL 0x00
|
#define PCI_SUBCLASS_SERIAL 0x00
|
||||||
#define PCI_IF_GENERIC_XT 0x00
|
#define PCI_IF_GENERIC_XT 0x00
|
||||||
#define PCI_IF_16450 0x01
|
#define PCI_IF_16450 0x01
|
||||||
@@ -197,8 +197,8 @@ typedef struct {
|
|||||||
#define PCI_IF_8259_PIC 0x00
|
#define PCI_IF_8259_PIC 0x00
|
||||||
#define PCI_IF_ISA_PIC 0x01
|
#define PCI_IF_ISA_PIC 0x01
|
||||||
#define PCI_IF_EISA_PIC 0x02
|
#define PCI_IF_EISA_PIC 0x02
|
||||||
#define PCI_IF_APIC_CONTROLLER 0x10 // I/O APIC interrupt controller , 32 bye none-prefectable memory.
|
#define PCI_IF_APIC_CONTROLLER 0x10 // I/O APIC interrupt controller , 32 bye none-prefectable memory.
|
||||||
#define PCI_IF_APIC_CONTROLLER2 0x20
|
#define PCI_IF_APIC_CONTROLLER2 0x20
|
||||||
#define PCI_SUBCLASS_TIMER 0x02
|
#define PCI_SUBCLASS_TIMER 0x02
|
||||||
#define PCI_IF_8254_TIMER 0x00
|
#define PCI_IF_8254_TIMER 0x00
|
||||||
#define PCI_IF_ISA_TIMER 0x01
|
#define PCI_IF_ISA_TIMER 0x01
|
||||||
@@ -249,7 +249,7 @@ typedef struct {
|
|||||||
|
|
||||||
#define PCI_SECURITY_CONTROLLER 0x10 // Encryption and decryption controller
|
#define PCI_SECURITY_CONTROLLER 0x10 // Encryption and decryption controller
|
||||||
#define PCI_SUBCLASS_NET_COMPUT 0x00
|
#define PCI_SUBCLASS_NET_COMPUT 0x00
|
||||||
#define PCI_SUBCLASS_ENTERTAINMENT 0x10
|
#define PCI_SUBCLASS_ENTERTAINMENT 0x10
|
||||||
|
|
||||||
#define PCI_CLASS_DPIO 0x11
|
#define PCI_CLASS_DPIO 0x11
|
||||||
|
|
||||||
|
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
Abstraction of a very simple graphics device.
|
Abstraction of a very simple graphics device.
|
||||||
|
|
||||||
Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
|
|
||||||
This program and the accompanying materials are licensed and made available
|
This program and the accompanying materials are licensed and made available
|
||||||
under the terms and conditions of the BSD License which accompanies this
|
under the terms and conditions of the BSD License which accompanies this
|
||||||
@@ -108,7 +108,7 @@ typedef union {
|
|||||||
typedef enum {
|
typedef enum {
|
||||||
EfiBltVideoFill,
|
EfiBltVideoFill,
|
||||||
EfiBltVideoToBltBuffer,
|
EfiBltVideoToBltBuffer,
|
||||||
EfiBltBufferToVideo,
|
EfiBltBufferToVideo,
|
||||||
EfiBltVideoToVideo,
|
EfiBltVideoToVideo,
|
||||||
EfiGraphicsOutputBltOperationMax
|
EfiGraphicsOutputBltOperationMax
|
||||||
} EFI_GRAPHICS_OUTPUT_BLT_OPERATION;
|
} EFI_GRAPHICS_OUTPUT_BLT_OPERATION;
|
||||||
@@ -116,28 +116,28 @@ typedef enum {
|
|||||||
/**
|
/**
|
||||||
The following table defines actions for BltOperations:
|
The following table defines actions for BltOperations:
|
||||||
|
|
||||||
<B>EfiBltVideoFill</B> - Write data from the BltBuffer pixel (SourceX, SourceY)
|
<B>EfiBltVideoFill</B> - Write data from the BltBuffer pixel (SourceX, SourceY)
|
||||||
directly to every pixel of the video display rectangle
|
directly to every pixel of the video display rectangle
|
||||||
(DestinationX, DestinationY) (DestinationX + Width, DestinationY + Height).
|
(DestinationX, DestinationY) (DestinationX + Width, DestinationY + Height).
|
||||||
Only one pixel will be used from the BltBuffer. Delta is NOT used.
|
Only one pixel will be used from the BltBuffer. Delta is NOT used.
|
||||||
|
|
||||||
<B>EfiBltVideoToBltBuffer</B> - Read data from the video display rectangle
|
<B>EfiBltVideoToBltBuffer</B> - Read data from the video display rectangle
|
||||||
(SourceX, SourceY) (SourceX + Width, SourceY + Height) and place it in
|
(SourceX, SourceY) (SourceX + Width, SourceY + Height) and place it in
|
||||||
the BltBuffer rectangle (DestinationX, DestinationY )
|
the BltBuffer rectangle (DestinationX, DestinationY )
|
||||||
(DestinationX + Width, DestinationY + Height). If DestinationX or
|
(DestinationX + Width, DestinationY + Height). If DestinationX or
|
||||||
DestinationY is not zero then Delta must be set to the length in bytes
|
DestinationY is not zero then Delta must be set to the length in bytes
|
||||||
of a row in the BltBuffer.
|
of a row in the BltBuffer.
|
||||||
|
|
||||||
<B>EfiBltBufferToVideo</B> - Write data from the BltBuffer rectangle
|
<B>EfiBltBufferToVideo</B> - Write data from the BltBuffer rectangle
|
||||||
(SourceX, SourceY) (SourceX + Width, SourceY + Height) directly to the
|
(SourceX, SourceY) (SourceX + Width, SourceY + Height) directly to the
|
||||||
video display rectangle (DestinationX, DestinationY)
|
video display rectangle (DestinationX, DestinationY)
|
||||||
(DestinationX + Width, DestinationY + Height). If SourceX or SourceY is
|
(DestinationX + Width, DestinationY + Height). If SourceX or SourceY is
|
||||||
not zero then Delta must be set to the length in bytes of a row in the
|
not zero then Delta must be set to the length in bytes of a row in the
|
||||||
BltBuffer.
|
BltBuffer.
|
||||||
|
|
||||||
<B>EfiBltVideoToVideo</B> - Copy from the video display rectangle (SourceX, SourceY)
|
<B>EfiBltVideoToVideo</B> - Copy from the video display rectangle (SourceX, SourceY)
|
||||||
(SourceX + Width, SourceY + Height) .to the video display rectangle
|
(SourceX + Width, SourceY + Height) .to the video display rectangle
|
||||||
(DestinationX, DestinationY) (DestinationX + Width, DestinationY + Height).
|
(DestinationX, DestinationY) (DestinationX + Width, DestinationY + Height).
|
||||||
The BltBuffer and Delta are not used in this mode.
|
The BltBuffer and Delta are not used in this mode.
|
||||||
|
|
||||||
@param This Protocol instance pointer.
|
@param This Protocol instance pointer.
|
||||||
|
@@ -1,15 +1,15 @@
|
|||||||
/** @file
|
/** @file
|
||||||
This file declares GUIDed section extraction protocol.
|
This file declares GUIDed section extraction protocol.
|
||||||
|
|
||||||
This interface provides a means of decoding a GUID defined encapsulation
|
This interface provides a means of decoding a GUID defined encapsulation
|
||||||
section. There may be multiple different GUIDs associated with the GUIDed
|
section. There may be multiple different GUIDs associated with the GUIDed
|
||||||
section extraction protocol. That is, all instances of the GUIDed section
|
section extraction protocol. That is, all instances of the GUIDed section
|
||||||
extraction protocol must have the same interface structure.
|
extraction protocol must have the same interface structure.
|
||||||
|
|
||||||
@par Revision Reference: PI
|
@par Revision Reference: PI
|
||||||
Version 1.00.
|
Version 1.00.
|
||||||
|
|
||||||
Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
|
|
||||||
This program and the accompanying materials are licensed and made available
|
This program and the accompanying materials are licensed and made available
|
||||||
under the terms and conditions of the BSD License which accompanies this
|
under the terms and conditions of the BSD License which accompanies this
|
||||||
@@ -56,10 +56,10 @@ typedef struct _EFI_GUIDED_SECTION_EXTRACTION_PROTOCOL EFI_GUIDED_SECTION_EXTRAC
|
|||||||
EFI_TPL above TPL_NOTIFY is undefined. Type EFI_TPL is
|
EFI_TPL above TPL_NOTIFY is undefined. Type EFI_TPL is
|
||||||
defined in RaiseTPL() in the UEFI 2.0 specification.
|
defined in RaiseTPL() in the UEFI 2.0 specification.
|
||||||
|
|
||||||
|
|
||||||
@param This Indicates the
|
@param This Indicates the
|
||||||
EFI_GUIDED_SECTION_EXTRACTION_PROTOCOL instance.
|
EFI_GUIDED_SECTION_EXTRACTION_PROTOCOL instance.
|
||||||
|
|
||||||
@param InputSection Buffer containing the input GUIDed section
|
@param InputSection Buffer containing the input GUIDed section
|
||||||
to be processed. OutputBuffer OutputBuffer
|
to be processed. OutputBuffer OutputBuffer
|
||||||
is allocated from boot services pool
|
is allocated from boot services pool
|
||||||
@@ -124,7 +124,7 @@ EFI_STATUS
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
||||||
Takes the GUIDed section as input and produces the section
|
Takes the GUIDed section as input and produces the section
|
||||||
stream data. See the ExtractSection() function description.
|
stream data. See the ExtractSection() function description.
|
||||||
|
|
||||||
|
@@ -2,11 +2,11 @@
|
|||||||
This file defines the Human Interface Infrastructure protocol which will
|
This file defines the Human Interface Infrastructure protocol which will
|
||||||
be used by resources which want to publish IFR/Font/String data and have it
|
be used by resources which want to publish IFR/Font/String data and have it
|
||||||
collected by the Configuration engine.
|
collected by the Configuration engine.
|
||||||
|
|
||||||
@par Revision Reference:
|
@par Revision Reference:
|
||||||
This protocol is defined in HII spec 0.92.
|
This protocol is defined in HII spec 0.92.
|
||||||
|
|
||||||
Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
|
|
||||||
This program and the accompanying materials are licensed and made available
|
This program and the accompanying materials are licensed and made available
|
||||||
under the terms and conditions of the BSD License which accompanies this
|
under the terms and conditions of the BSD License which accompanies this
|
||||||
|
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
Abstraction of a very simple graphics device.
|
Abstraction of a very simple graphics device.
|
||||||
|
|
||||||
Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
|
|
||||||
This program and the accompanying materials are licensed and made available
|
This program and the accompanying materials are licensed and made available
|
||||||
under the terms and conditions of the BSD License which accompanies this
|
under the terms and conditions of the BSD License which accompanies this
|
||||||
@@ -99,33 +99,33 @@ typedef enum {
|
|||||||
|
|
||||||
The following table defines actions for BltOperations:
|
The following table defines actions for BltOperations:
|
||||||
|
|
||||||
<B>EfiUgaVideoFill</B> - Write data from the BltBuffer pixel (SourceX, SourceY)
|
<B>EfiUgaVideoFill</B> - Write data from the BltBuffer pixel (SourceX, SourceY)
|
||||||
directly to every pixel of the video display rectangle
|
directly to every pixel of the video display rectangle
|
||||||
(DestinationX, DestinationY) (DestinationX + Width, DestinationY + Height).
|
(DestinationX, DestinationY) (DestinationX + Width, DestinationY + Height).
|
||||||
Only one pixel will be used from the BltBuffer. Delta is NOT used.
|
Only one pixel will be used from the BltBuffer. Delta is NOT used.
|
||||||
|
|
||||||
<B>EfiUgaVideoToBltBuffer</B> - Read data from the video display rectangle
|
<B>EfiUgaVideoToBltBuffer</B> - Read data from the video display rectangle
|
||||||
(SourceX, SourceY) (SourceX + Width, SourceY + Height) and place it in
|
(SourceX, SourceY) (SourceX + Width, SourceY + Height) and place it in
|
||||||
the BltBuffer rectangle (DestinationX, DestinationY )
|
the BltBuffer rectangle (DestinationX, DestinationY )
|
||||||
(DestinationX + Width, DestinationY + Height). If DestinationX or
|
(DestinationX + Width, DestinationY + Height). If DestinationX or
|
||||||
DestinationY is not zero then Delta must be set to the length in bytes
|
DestinationY is not zero then Delta must be set to the length in bytes
|
||||||
of a row in the BltBuffer.
|
of a row in the BltBuffer.
|
||||||
|
|
||||||
<B>EfiUgaBltBufferToVideo</B> - Write data from the BltBuffer rectangle
|
<B>EfiUgaBltBufferToVideo</B> - Write data from the BltBuffer rectangle
|
||||||
(SourceX, SourceY) (SourceX + Width, SourceY + Height) directly to the
|
(SourceX, SourceY) (SourceX + Width, SourceY + Height) directly to the
|
||||||
video display rectangle (DestinationX, DestinationY)
|
video display rectangle (DestinationX, DestinationY)
|
||||||
(DestinationX + Width, DestinationY + Height). If SourceX or SourceY is
|
(DestinationX + Width, DestinationY + Height). If SourceX or SourceY is
|
||||||
not zero then Delta must be set to the length in bytes of a row in the
|
not zero then Delta must be set to the length in bytes of a row in the
|
||||||
BltBuffer.
|
BltBuffer.
|
||||||
|
|
||||||
<B>EfiUgaVideoToVideo</B> - Copy from the video display rectangle (SourceX, SourceY)
|
<B>EfiUgaVideoToVideo</B> - Copy from the video display rectangle (SourceX, SourceY)
|
||||||
(SourceX + Width, SourceY + Height) .to the video display rectangle
|
(SourceX + Width, SourceY + Height) .to the video display rectangle
|
||||||
(DestinationX, DestinationY) (DestinationX + Width, DestinationY + Height).
|
(DestinationX, DestinationY) (DestinationX + Width, DestinationY + Height).
|
||||||
The BltBuffer and Delta are not used in this mode.
|
The BltBuffer and Delta are not used in this mode.
|
||||||
|
|
||||||
|
|
||||||
@param[in] This - Protocol instance pointer.
|
@param[in] This - Protocol instance pointer.
|
||||||
@param[in] BltBuffer - Buffer containing data to blit into video buffer. This
|
@param[in] BltBuffer - Buffer containing data to blit into video buffer. This
|
||||||
buffer has a size of Width*Height*sizeof(EFI_UGA_PIXEL)
|
buffer has a size of Width*Height*sizeof(EFI_UGA_PIXEL)
|
||||||
@param[in] BltOperation - Operation to perform on BlitBuffer and video memory
|
@param[in] BltOperation - Operation to perform on BlitBuffer and video memory
|
||||||
@param[in] SourceX - X coordinate of source for the BltBuffer.
|
@param[in] SourceX - X coordinate of source for the BltBuffer.
|
||||||
@@ -135,7 +135,7 @@ typedef enum {
|
|||||||
@param[in] Width - Width of rectangle in BltBuffer in pixels.
|
@param[in] Width - Width of rectangle in BltBuffer in pixels.
|
||||||
@param[in] Height - Hight of rectangle in BltBuffer in pixels.
|
@param[in] Height - Hight of rectangle in BltBuffer in pixels.
|
||||||
@param[in] Delta - OPTIONAL
|
@param[in] Delta - OPTIONAL
|
||||||
|
|
||||||
@retval EFI_SUCCESS - The Blt operation completed.
|
@retval EFI_SUCCESS - The Blt operation completed.
|
||||||
@retval EFI_INVALID_PARAMETER - BltOperation is not valid.
|
@retval EFI_INVALID_PARAMETER - BltOperation is not valid.
|
||||||
@retval EFI_DEVICE_ERROR - A hardware error occured writting to the video buffer.
|
@retval EFI_DEVICE_ERROR - A hardware error occured writting to the video buffer.
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
/** @file
|
/** @file
|
||||||
Processor or Compiler specific defines and types x64 (Intel(r) EM64T, AMD64).
|
Processor or Compiler specific defines and types x64 (Intel(r) EM64T, AMD64).
|
||||||
|
|
||||||
Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
|
|
||||||
This program and the accompanying materials are licensed and made available
|
This program and the accompanying materials are licensed and made available
|
||||||
under the terms and conditions of the BSD License which accompanies this
|
under the terms and conditions of the BSD License which accompanies this
|
||||||
@@ -30,8 +30,8 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#if _MSC_EXTENSIONS
|
#if _MSC_EXTENSIONS
|
||||||
|
|
||||||
//
|
//
|
||||||
// Disable warning that make it impossible to compile at /W4
|
// Disable warning that make it impossible to compile at /W4
|
||||||
// This only works for Microsoft* tools
|
// This only works for Microsoft* tools
|
||||||
@@ -66,12 +66,12 @@
|
|||||||
//
|
//
|
||||||
// No ANSI C 2000 stdint.h integer width declarations, so define equivalents
|
// No ANSI C 2000 stdint.h integer width declarations, so define equivalents
|
||||||
//
|
//
|
||||||
|
|
||||||
#if _MSC_EXTENSIONS
|
#if _MSC_EXTENSIONS
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// use Microsoft C complier dependent integer width types
|
// use Microsoft C complier dependent integer width types
|
||||||
//
|
//
|
||||||
typedef unsigned __int64 UINT64;
|
typedef unsigned __int64 UINT64;
|
||||||
typedef __int64 INT64;
|
typedef __int64 INT64;
|
||||||
@@ -85,9 +85,9 @@
|
|||||||
typedef char CHAR8;
|
typedef char CHAR8;
|
||||||
typedef char INT8;
|
typedef char INT8;
|
||||||
#else
|
#else
|
||||||
#ifdef _EFI_P64
|
#ifdef _EFI_P64
|
||||||
//
|
//
|
||||||
// P64 - is Intel Itanium(TM) speak for pointers being 64-bit and longs and ints
|
// P64 - is Intel Itanium(TM) speak for pointers being 64-bit and longs and ints
|
||||||
// are 32-bits
|
// are 32-bits
|
||||||
//
|
//
|
||||||
typedef unsigned long long UINT64;
|
typedef unsigned long long UINT64;
|
||||||
@@ -160,28 +160,28 @@ typedef INT64 INTN;
|
|||||||
// use the correct C calling convention. All protocol member functions and
|
// use the correct C calling convention. All protocol member functions and
|
||||||
// EFI intrinsics are required to modify thier member functions with EFIAPI.
|
// EFI intrinsics are required to modify thier member functions with EFIAPI.
|
||||||
//
|
//
|
||||||
#if _MSC_EXTENSIONS
|
#if _MSC_EXTENSIONS
|
||||||
///
|
///
|
||||||
/// Define the standard calling convention reguardless of optimization level.
|
/// Define the standard calling convention reguardless of optimization level.
|
||||||
/// __cdecl is Microsoft* specific C extension.
|
/// __cdecl is Microsoft* specific C extension.
|
||||||
///
|
///
|
||||||
#define EFIAPI __cdecl
|
#define EFIAPI __cdecl
|
||||||
#elif __GNUC__
|
#elif __GNUC__
|
||||||
///
|
///
|
||||||
/// Define the standard calling convention reguardless of optimization level.
|
/// Define the standard calling convention reguardless of optimization level.
|
||||||
/// efidecl is an extension to GCC that supports the differnece between x64
|
/// efidecl is an extension to GCC that supports the differnece between x64
|
||||||
/// GCC ABI and x64 Microsoft* ABI. EFI is closer to the Microsoft* ABI and
|
/// GCC ABI and x64 Microsoft* ABI. EFI is closer to the Microsoft* ABI and
|
||||||
/// EFIAPI makes sure the right ABI is used for public interfaces.
|
/// EFIAPI makes sure the right ABI is used for public interfaces.
|
||||||
/// eficecl is a work in progress and we do not yet have the compiler
|
/// eficecl is a work in progress and we do not yet have the compiler
|
||||||
///
|
///
|
||||||
#define EFIAPI
|
#define EFIAPI
|
||||||
#else
|
#else
|
||||||
#define EFIAPI
|
#define EFIAPI
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
// The Microsoft* C compiler can removed references to unreferenced data items
|
// The Microsoft* C compiler can removed references to unreferenced data items
|
||||||
// if the /OPT:REF linker option is used. We defined a macro as this is a
|
// if the /OPT:REF linker option is used. We defined a macro as this is a
|
||||||
// a non standard extension
|
// a non standard extension
|
||||||
//
|
//
|
||||||
#if _MSC_EXTENSIONS
|
#if _MSC_EXTENSIONS
|
||||||
|
@@ -1,3 +1,3 @@
|
|||||||
LzmaCompress is based on the LZMA SDK 16.04. LZMA SDK 16.04
|
LzmaCompress is based on the LZMA SDK 16.04. LZMA SDK 16.04
|
||||||
was placed in the public domain on 2016-10-04. It was
|
was placed in the public domain on 2016-10-04. It was
|
||||||
released on the http://www.7-zip.org/sdk.html website.
|
released on the http://www.7-zip.org/sdk.html website.
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
LzmaUtil.c -- Test application for LZMA compression
|
LzmaUtil.c -- Test application for LZMA compression
|
||||||
2016-10-04 : Igor Pavlov : Public domain
|
2016-10-04 : Igor Pavlov : Public domain
|
||||||
|
|
||||||
Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
@@ -33,7 +33,7 @@
|
|||||||
#define LZMA_HEADER_SIZE (LZMA_PROPS_SIZE + 8)
|
#define LZMA_HEADER_SIZE (LZMA_PROPS_SIZE + 8)
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
NoConverter,
|
NoConverter,
|
||||||
X86Converter,
|
X86Converter,
|
||||||
MaxConverter
|
MaxConverter
|
||||||
} CONVERTER_TYPE;
|
} CONVERTER_TYPE;
|
||||||
@@ -50,7 +50,7 @@ static CONVERTER_TYPE mConType = NoConverter;
|
|||||||
#define UTILITY_MAJOR_VERSION 0
|
#define UTILITY_MAJOR_VERSION 0
|
||||||
#define UTILITY_MINOR_VERSION 2
|
#define UTILITY_MINOR_VERSION 2
|
||||||
#define INTEL_COPYRIGHT \
|
#define INTEL_COPYRIGHT \
|
||||||
"Copyright (c) 2009-2016, Intel Corporation. All rights reserved."
|
"Copyright (c) 2009-2018, Intel Corporation. All rights reserved."
|
||||||
void PrintHelp(char *buffer)
|
void PrintHelp(char *buffer)
|
||||||
{
|
{
|
||||||
strcat(buffer,
|
strcat(buffer,
|
||||||
@@ -113,7 +113,7 @@ static SRes Encode(ISeqOutStream *outStream, ISeqInStream *inStream, UInt64 file
|
|||||||
} else {
|
} else {
|
||||||
return SZ_ERROR_INPUT_EOF;
|
return SZ_ERROR_INPUT_EOF;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SeqInStream_Read(inStream, inBuffer, inSize) != SZ_OK) {
|
if (SeqInStream_Read(inStream, inBuffer, inSize) != SZ_OK) {
|
||||||
res = SZ_ERROR_READ;
|
res = SZ_ERROR_READ;
|
||||||
goto Done;
|
goto Done;
|
||||||
@@ -126,7 +126,7 @@ static SRes Encode(ISeqOutStream *outStream, ISeqInStream *inStream, UInt64 file
|
|||||||
res = SZ_ERROR_MEM;
|
res = SZ_ERROR_MEM;
|
||||||
goto Done;
|
goto Done;
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < 8; i++)
|
for (i = 0; i < 8; i++)
|
||||||
@@ -141,7 +141,7 @@ static SRes Encode(ISeqOutStream *outStream, ISeqInStream *inStream, UInt64 file
|
|||||||
goto Done;
|
goto Done;
|
||||||
}
|
}
|
||||||
memcpy(filteredStream, inBuffer, inSize);
|
memcpy(filteredStream, inBuffer, inSize);
|
||||||
|
|
||||||
if (mConType == X86Converter) {
|
if (mConType == X86Converter) {
|
||||||
{
|
{
|
||||||
UInt32 x86State;
|
UInt32 x86State;
|
||||||
@@ -154,12 +154,12 @@ static SRes Encode(ISeqOutStream *outStream, ISeqInStream *inStream, UInt64 file
|
|||||||
{
|
{
|
||||||
size_t outSizeProcessed = outSize - LZMA_HEADER_SIZE;
|
size_t outSizeProcessed = outSize - LZMA_HEADER_SIZE;
|
||||||
size_t outPropsSize = LZMA_PROPS_SIZE;
|
size_t outPropsSize = LZMA_PROPS_SIZE;
|
||||||
|
|
||||||
res = LzmaEncode(outBuffer + LZMA_HEADER_SIZE, &outSizeProcessed,
|
res = LzmaEncode(outBuffer + LZMA_HEADER_SIZE, &outSizeProcessed,
|
||||||
mConType != NoConverter ? filteredStream : inBuffer, inSize,
|
mConType != NoConverter ? filteredStream : inBuffer, inSize,
|
||||||
&props, outBuffer, &outPropsSize, 0,
|
&props, outBuffer, &outPropsSize, 0,
|
||||||
NULL, &g_Alloc, &g_Alloc);
|
NULL, &g_Alloc, &g_Alloc);
|
||||||
|
|
||||||
if (res != SZ_OK)
|
if (res != SZ_OK)
|
||||||
goto Done;
|
goto Done;
|
||||||
|
|
||||||
@@ -190,13 +190,13 @@ static SRes Decode(ISeqOutStream *outStream, ISeqInStream *inStream, UInt64 file
|
|||||||
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (inSize < LZMA_HEADER_SIZE)
|
if (inSize < LZMA_HEADER_SIZE)
|
||||||
return SZ_ERROR_INPUT_EOF;
|
return SZ_ERROR_INPUT_EOF;
|
||||||
|
|
||||||
inBuffer = (Byte *)MyAlloc(inSize);
|
inBuffer = (Byte *)MyAlloc(inSize);
|
||||||
if (inBuffer == 0)
|
if (inBuffer == 0)
|
||||||
return SZ_ERROR_MEM;
|
return SZ_ERROR_MEM;
|
||||||
|
|
||||||
if (SeqInStream_Read(inStream, inBuffer, inSize) != SZ_OK) {
|
if (SeqInStream_Read(inStream, inBuffer, inSize) != SZ_OK) {
|
||||||
res = SZ_ERROR_READ;
|
res = SZ_ERROR_READ;
|
||||||
goto Done;
|
goto Done;
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
@REM @file
|
@REM @file
|
||||||
@REM This script will exec LzmaCompress tool with --f86 option that enables
|
@REM This script will exec LzmaCompress tool with --f86 option that enables
|
||||||
@REM converter for x86 code.
|
@REM converter for x86 code.
|
||||||
@REM
|
@REM
|
||||||
@REM Copyright (c) 2012 - 2014, Intel Corporation. All rights reserved.<BR>
|
@REM Copyright (c) 2012 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
@REM This program and the accompanying materials
|
@REM This program and the accompanying materials
|
||||||
@REM are licensed and made available under the terms and conditions of the BSD License
|
@REM are licensed and made available under the terms and conditions of the BSD License
|
||||||
@REM which accompanies this distribution. The full text of the license may be found at
|
@REM which accompanies this distribution. The full text of the license may be found at
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
@REM ## @file
|
@REM ## @file
|
||||||
@REM # Makefile
|
@REM # Makefile
|
||||||
@REM #
|
@REM #
|
||||||
@REM # Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR>
|
@REM # Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
@REM # This program and the accompanying materials
|
@REM # This program and the accompanying materials
|
||||||
@REM # are licensed and made available under the terms and conditions of the BSD License
|
@REM # are licensed and made available under the terms and conditions of the BSD License
|
||||||
@REM # which accompanies this distribution. The full text of the license may be found at
|
@REM # which accompanies this distribution. The full text of the license may be found at
|
||||||
@@ -9,7 +9,7 @@
|
|||||||
@REM #
|
@REM #
|
||||||
@REM # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
@REM # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
@REM # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
@REM # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
@REM #
|
@REM #
|
||||||
|
|
||||||
@echo off
|
@echo off
|
||||||
setlocal
|
setlocal
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
/** @file
|
/** @file
|
||||||
Efi Compressor
|
Efi Compressor
|
||||||
|
|
||||||
Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials are licensed and made available
|
This program and the accompanying materials are licensed and made available
|
||||||
under the terms and conditions of the BSD License which accompanies this
|
under the terms and conditions of the BSD License which accompanies this
|
||||||
distribution. The full text of the license may be found at
|
distribution. The full text of the license may be found at
|
||||||
http://opensource.org/licenses/bsd-license.php
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
/** @file
|
/** @file
|
||||||
Python Utility
|
Python Utility
|
||||||
|
|
||||||
Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials are licensed and made available
|
This program and the accompanying materials are licensed and made available
|
||||||
under the terms and conditions of the BSD License which accompanies this
|
under the terms and conditions of the BSD License which accompanies this
|
||||||
distribution. The full text of the license may be found at
|
distribution. The full text of the license may be found at
|
||||||
http://opensource.org/licenses/bsd-license.php
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
@@ -75,9 +75,9 @@ SaveFileToDisk (
|
|||||||
goto Done;
|
goto Done;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Flush buffer may slow down the whole build performance (average 10s slower)
|
// Flush buffer may slow down the whole build performance (average 10s slower)
|
||||||
//
|
//
|
||||||
//if (!FlushFileBuffers(FileHandle)) {
|
//if (!FlushFileBuffers(FileHandle)) {
|
||||||
// PyErr_SetString(PyExc_Exception, "File flush failure");
|
// PyErr_SetString(PyExc_Exception, "File flush failure");
|
||||||
// goto Done;
|
// goto Done;
|
||||||
|
@@ -1,18 +1,18 @@
|
|||||||
/** @file
|
/** @file
|
||||||
Compression routine. The compression algorithm is a mixture of LZ77 and Huffman
|
Compression routine. The compression algorithm is a mixture of LZ77 and Huffman
|
||||||
coding. LZ77 transforms the source data into a sequence of Original Characters
|
coding. LZ77 transforms the source data into a sequence of Original Characters
|
||||||
and Pointers to repeated strings.
|
and Pointers to repeated strings.
|
||||||
This sequence is further divided into Blocks and Huffman codings are applied to
|
This sequence is further divided into Blocks and Huffman codings are applied to
|
||||||
each Block.
|
each Block.
|
||||||
|
|
||||||
Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
http://opensource.org/licenses/bsd-license.php
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
@@ -100,7 +100,7 @@ Arguments:
|
|||||||
SrcBuffer - The buffer storing the source data
|
SrcBuffer - The buffer storing the source data
|
||||||
SrcSize - The size of source data
|
SrcSize - The size of source data
|
||||||
DstBuffer - The buffer to store the compressed data
|
DstBuffer - The buffer to store the compressed data
|
||||||
|
|
||||||
Version - The version of de/compression algorithm.
|
Version - The version of de/compression algorithm.
|
||||||
Version 1 for EFI 1.1 de/compression algorithm.
|
Version 1 for EFI 1.1 de/compression algorithm.
|
||||||
Version 2 for Tiano de/compression algorithm.
|
Version 2 for Tiano de/compression algorithm.
|
||||||
@@ -135,12 +135,12 @@ Returns:
|
|||||||
mSrcUpperLimit = mSrc + SrcSize;
|
mSrcUpperLimit = mSrc + SrcSize;
|
||||||
mDst = DstBuffer;
|
mDst = DstBuffer;
|
||||||
mDstUpperLimit = mDst +*DstSize;
|
mDstUpperLimit = mDst +*DstSize;
|
||||||
|
|
||||||
PutDword (0L);
|
PutDword (0L);
|
||||||
PutDword (0L);
|
PutDword (0L);
|
||||||
|
|
||||||
MakeCrcTable ();
|
MakeCrcTable ();
|
||||||
|
|
||||||
mOrigSize = mCompSize = 0;
|
mOrigSize = mCompSize = 0;
|
||||||
mCrc = INIT_CRC;
|
mCrc = INIT_CRC;
|
||||||
|
|
||||||
@@ -151,7 +151,7 @@ Returns:
|
|||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Null terminate the compressed data
|
// Null terminate the compressed data
|
||||||
//
|
//
|
||||||
@@ -163,8 +163,8 @@ Returns:
|
|||||||
//
|
//
|
||||||
// Fill in compressed size and original size
|
// Fill in compressed size and original size
|
||||||
//
|
//
|
||||||
mDst = DstBuffer;
|
mDst = DstBuffer;
|
||||||
|
|
||||||
PutDword (mCompSize + 1);
|
PutDword (mCompSize + 1);
|
||||||
PutDword (mOrigSize);
|
PutDword (mOrigSize);
|
||||||
//
|
//
|
||||||
@@ -172,10 +172,10 @@ Returns:
|
|||||||
//
|
//
|
||||||
|
|
||||||
if (mCompSize + 1 + 8 > *DstSize) {
|
if (mCompSize + 1 + 8 > *DstSize) {
|
||||||
*DstSize = mCompSize + 1 + 8;
|
*DstSize = mCompSize + 1 + 8;
|
||||||
return EFI_BUFFER_TOO_SMALL;
|
return EFI_BUFFER_TOO_SMALL;
|
||||||
} else {
|
} else {
|
||||||
*DstSize = mCompSize + 1 + 8;
|
*DstSize = mCompSize + 1 + 8;
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -190,13 +190,13 @@ PutDword (
|
|||||||
Routine Description:
|
Routine Description:
|
||||||
|
|
||||||
Put a dword to output stream
|
Put a dword to output stream
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
|
|
||||||
Data - the dword to put
|
Data - the dword to put
|
||||||
|
|
||||||
Returns: (VOID)
|
Returns: (VOID)
|
||||||
|
|
||||||
--*/
|
--*/
|
||||||
{
|
{
|
||||||
if (mDst < mDstUpperLimit) {
|
if (mDst < mDstUpperLimit) {
|
||||||
@@ -226,8 +226,8 @@ AllocateMemory (
|
|||||||
Routine Description:
|
Routine Description:
|
||||||
|
|
||||||
Allocate memory spaces for data structures used in compression process
|
Allocate memory spaces for data structures used in compression process
|
||||||
|
|
||||||
Argements:
|
Argements:
|
||||||
VOID
|
VOID
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
@@ -285,7 +285,7 @@ FreeMemory (
|
|||||||
Routine Description:
|
Routine Description:
|
||||||
|
|
||||||
Called when compression is completed to free memory previously allocated.
|
Called when compression is completed to free memory previously allocated.
|
||||||
|
|
||||||
Arguments: (VOID)
|
Arguments: (VOID)
|
||||||
|
|
||||||
Returns: (VOID)
|
Returns: (VOID)
|
||||||
@@ -337,7 +337,7 @@ InitSlide (
|
|||||||
Routine Description:
|
Routine Description:
|
||||||
|
|
||||||
Initialize String Info Log data structures
|
Initialize String Info Log data structures
|
||||||
|
|
||||||
Arguments: (VOID)
|
Arguments: (VOID)
|
||||||
|
|
||||||
Returns: (VOID)
|
Returns: (VOID)
|
||||||
@@ -377,16 +377,16 @@ Child (
|
|||||||
Routine Description:
|
Routine Description:
|
||||||
|
|
||||||
Find child node given the parent node and the edge character
|
Find child node given the parent node and the edge character
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
|
|
||||||
NodeQ - the parent node
|
NodeQ - the parent node
|
||||||
CharC - the edge character
|
CharC - the edge character
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
|
|
||||||
The child node (NIL if not found)
|
The child node (NIL if not found)
|
||||||
|
|
||||||
--*/
|
--*/
|
||||||
{
|
{
|
||||||
NODE NodeR;
|
NODE NodeR;
|
||||||
@@ -415,13 +415,13 @@ MakeChild (
|
|||||||
Routine Description:
|
Routine Description:
|
||||||
|
|
||||||
Create a new child for a given parent node.
|
Create a new child for a given parent node.
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
|
|
||||||
Parent - the parent node
|
Parent - the parent node
|
||||||
CharC - the edge character
|
CharC - the edge character
|
||||||
Child - the child node
|
Child - the child node
|
||||||
|
|
||||||
Returns: (VOID)
|
Returns: (VOID)
|
||||||
|
|
||||||
--*/
|
--*/
|
||||||
@@ -449,11 +449,11 @@ Split (
|
|||||||
Routine Description:
|
Routine Description:
|
||||||
|
|
||||||
Split a node.
|
Split a node.
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
|
|
||||||
Old - the node to split
|
Old - the node to split
|
||||||
|
|
||||||
Returns: (VOID)
|
Returns: (VOID)
|
||||||
|
|
||||||
--*/
|
--*/
|
||||||
@@ -487,7 +487,7 @@ InsertNode (
|
|||||||
Routine Description:
|
Routine Description:
|
||||||
|
|
||||||
Insert string info for current position into the String Info Log
|
Insert string info for current position into the String Info Log
|
||||||
|
|
||||||
Arguments: (VOID)
|
Arguments: (VOID)
|
||||||
|
|
||||||
Returns: (VOID)
|
Returns: (VOID)
|
||||||
@@ -620,7 +620,7 @@ Routine Description:
|
|||||||
|
|
||||||
Delete outdated string info. (The Usage of PERC_FLAG
|
Delete outdated string info. (The Usage of PERC_FLAG
|
||||||
ensures a clean deletion)
|
ensures a clean deletion)
|
||||||
|
|
||||||
Arguments: (VOID)
|
Arguments: (VOID)
|
||||||
|
|
||||||
Returns: (VOID)
|
Returns: (VOID)
|
||||||
@@ -751,7 +751,7 @@ Routine Description:
|
|||||||
Arguments: (VOID)
|
Arguments: (VOID)
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
|
|
||||||
EFI_SUCCESS - The compression is successful
|
EFI_SUCCESS - The compression is successful
|
||||||
EFI_OUT_0F_RESOURCES - Not enough memory for compression process
|
EFI_OUT_0F_RESOURCES - Not enough memory for compression process
|
||||||
|
|
||||||
@@ -837,7 +837,7 @@ CountTFreq (
|
|||||||
Routine Description:
|
Routine Description:
|
||||||
|
|
||||||
Count the frequencies for the Extra Set
|
Count the frequencies for the Extra Set
|
||||||
|
|
||||||
Arguments: (VOID)
|
Arguments: (VOID)
|
||||||
|
|
||||||
Returns: (VOID)
|
Returns: (VOID)
|
||||||
@@ -896,13 +896,13 @@ WritePTLen (
|
|||||||
Routine Description:
|
Routine Description:
|
||||||
|
|
||||||
Outputs the code length array for the Extra Set or the Position Set.
|
Outputs the code length array for the Extra Set or the Position Set.
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
|
|
||||||
Number - the number of symbols
|
Number - the number of symbols
|
||||||
nbit - the number of bits needed to represent 'n'
|
nbit - the number of bits needed to represent 'n'
|
||||||
Special - the special symbol that needs to be take care of
|
Special - the special symbol that needs to be take care of
|
||||||
|
|
||||||
Returns: (VOID)
|
Returns: (VOID)
|
||||||
|
|
||||||
--*/
|
--*/
|
||||||
@@ -944,7 +944,7 @@ WriteCLen (
|
|||||||
Routine Description:
|
Routine Description:
|
||||||
|
|
||||||
Outputs the code length array for Char&Length Set
|
Outputs the code length array for Char&Length Set
|
||||||
|
|
||||||
Arguments: (VOID)
|
Arguments: (VOID)
|
||||||
|
|
||||||
Returns: (VOID)
|
Returns: (VOID)
|
||||||
@@ -1034,11 +1034,11 @@ SendBlock (
|
|||||||
Routine Description:
|
Routine Description:
|
||||||
|
|
||||||
Huffman code the block and output it.
|
Huffman code the block and output it.
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
(VOID)
|
(VOID)
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
(VOID)
|
(VOID)
|
||||||
|
|
||||||
--*/
|
--*/
|
||||||
@@ -1246,7 +1246,7 @@ Routine Description:
|
|||||||
Arguments:
|
Arguments:
|
||||||
|
|
||||||
Number - the rightmost n bits of the data is used
|
Number - the rightmost n bits of the data is used
|
||||||
x - the data
|
x - the data
|
||||||
|
|
||||||
Returns: (VOID)
|
Returns: (VOID)
|
||||||
|
|
||||||
@@ -1283,7 +1283,7 @@ FreadCrc (
|
|||||||
Routine Description:
|
Routine Description:
|
||||||
|
|
||||||
Read in source data
|
Read in source data
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
|
|
||||||
Pointer - the buffer to hold the data
|
Pointer - the buffer to hold the data
|
||||||
@@ -1292,7 +1292,7 @@ Arguments:
|
|||||||
Returns:
|
Returns:
|
||||||
|
|
||||||
number of bytes actually read
|
number of bytes actually read
|
||||||
|
|
||||||
--*/
|
--*/
|
||||||
{
|
{
|
||||||
INT32 Index;
|
INT32 Index;
|
||||||
@@ -1335,11 +1335,11 @@ CountLen (
|
|||||||
Routine Description:
|
Routine Description:
|
||||||
|
|
||||||
Count the number of each code length for a Huffman tree.
|
Count the number of each code length for a Huffman tree.
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
|
|
||||||
Index - the top node
|
Index - the top node
|
||||||
|
|
||||||
Returns: (VOID)
|
Returns: (VOID)
|
||||||
|
|
||||||
--*/
|
--*/
|
||||||
@@ -1366,11 +1366,11 @@ MakeLen (
|
|||||||
Routine Description:
|
Routine Description:
|
||||||
|
|
||||||
Create code length array for a Huffman tree
|
Create code length array for a Huffman tree
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
|
|
||||||
Root - the root of the tree
|
Root - the root of the tree
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
@@ -1462,7 +1462,7 @@ MakeCode (
|
|||||||
Routine Description:
|
Routine Description:
|
||||||
|
|
||||||
Assign code to each symbol based on the code length array
|
Assign code to each symbol based on the code length array
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
|
|
||||||
Number - number of symbols
|
Number - number of symbols
|
||||||
@@ -1499,18 +1499,18 @@ MakeTree (
|
|||||||
Routine Description:
|
Routine Description:
|
||||||
|
|
||||||
Generates Huffman codes given a frequency distribution of symbols
|
Generates Huffman codes given a frequency distribution of symbols
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
|
|
||||||
NParm - number of symbols
|
NParm - number of symbols
|
||||||
FreqParm - frequency of each symbol
|
FreqParm - frequency of each symbol
|
||||||
LenParm - code length for each symbol
|
LenParm - code length for each symbol
|
||||||
CodeParm - code for each symbol
|
CodeParm - code for each symbol
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
|
|
||||||
Root of the Huffman tree.
|
Root of the Huffman tree.
|
||||||
|
|
||||||
--*/
|
--*/
|
||||||
{
|
{
|
||||||
INT32 Index;
|
INT32 Index;
|
||||||
@@ -1586,22 +1586,22 @@ GetFileContents (
|
|||||||
OUT UINT32 *BufferLength
|
OUT UINT32 *BufferLength
|
||||||
)
|
)
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
|
|
||||||
Get the contents of file specified in InputFileName
|
Get the contents of file specified in InputFileName
|
||||||
into FileBuffer.
|
into FileBuffer.
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
|
|
||||||
InputFileName - Name of the input file.
|
InputFileName - Name of the input file.
|
||||||
|
|
||||||
FileBuffer - Output buffer to contain data
|
FileBuffer - Output buffer to contain data
|
||||||
|
|
||||||
BufferLength - Actual length of the data
|
BufferLength - Actual length of the data
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
|
|
||||||
EFI_SUCCESS on successful return
|
EFI_SUCCESS on successful return
|
||||||
EFI_ABORTED if unable to open input file.
|
EFI_ABORTED if unable to open input file.
|
||||||
|
|
||||||
@@ -1620,13 +1620,13 @@ Returns:
|
|||||||
Error (NULL, 0, 0001, "Error opening file: %s", InputFileName);
|
Error (NULL, 0, 0001, "Error opening file: %s", InputFileName);
|
||||||
return EFI_ABORTED;
|
return EFI_ABORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
fseek (InputFile, 0, SEEK_END);
|
fseek (InputFile, 0, SEEK_END);
|
||||||
FileSize = ftell (InputFile);
|
FileSize = ftell (InputFile);
|
||||||
fseek (InputFile, 0, SEEK_SET);
|
fseek (InputFile, 0, SEEK_SET);
|
||||||
//
|
//
|
||||||
// Now read the contents of the file into the buffer
|
// Now read the contents of the file into the buffer
|
||||||
//
|
//
|
||||||
if (FileSize > 0 && FileBuffer != NULL) {
|
if (FileSize > 0 && FileBuffer != NULL) {
|
||||||
if (fread (FileBuffer, FileSize, 1, InputFile) != 1) {
|
if (fread (FileBuffer, FileSize, 1, InputFile) != 1) {
|
||||||
Error (NULL, 0, 0004, "Error reading contents of input file: %s", InputFileName);
|
Error (NULL, 0, 0004, "Error reading contents of input file: %s", InputFileName);
|
||||||
@@ -1638,7 +1638,7 @@ Returns:
|
|||||||
fclose (InputFile);
|
fclose (InputFile);
|
||||||
Size += (UINTN) FileSize;
|
Size += (UINTN) FileSize;
|
||||||
*BufferLength = Size;
|
*BufferLength = Size;
|
||||||
|
|
||||||
if (FileBuffer != NULL) {
|
if (FileBuffer != NULL) {
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
} else {
|
} else {
|
||||||
@@ -1693,11 +1693,11 @@ Returns:
|
|||||||
// Summary usage
|
// Summary usage
|
||||||
//
|
//
|
||||||
fprintf (stdout, "Usage: %s -e|-d [options] <input_file>\n\n", UTILITY_NAME);
|
fprintf (stdout, "Usage: %s -e|-d [options] <input_file>\n\n", UTILITY_NAME);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Copyright declaration
|
// Copyright declaration
|
||||||
//
|
//
|
||||||
fprintf (stdout, "Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.\n\n");
|
fprintf (stdout, "Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.\n\n");
|
||||||
|
|
||||||
//
|
//
|
||||||
// Details Option
|
// Details Option
|
||||||
@@ -1739,7 +1739,7 @@ Returns:
|
|||||||
EFI_ABORTED Could not generate the section
|
EFI_ABORTED Could not generate the section
|
||||||
EFI_OUT_OF_RESOURCES No resource to complete the operation.
|
EFI_OUT_OF_RESOURCES No resource to complete the operation.
|
||||||
|
|
||||||
--*/
|
--*/
|
||||||
{
|
{
|
||||||
FILE *OutputFile;
|
FILE *OutputFile;
|
||||||
char *OutputFileName;
|
char *OutputFileName;
|
||||||
@@ -1755,7 +1755,7 @@ Returns:
|
|||||||
UINT32 OrigSize;
|
UINT32 OrigSize;
|
||||||
|
|
||||||
SetUtilityName(UTILITY_NAME);
|
SetUtilityName(UTILITY_NAME);
|
||||||
|
|
||||||
FileBuffer = NULL;
|
FileBuffer = NULL;
|
||||||
Src = NULL;
|
Src = NULL;
|
||||||
OutBuffer = NULL;
|
OutBuffer = NULL;
|
||||||
@@ -1778,12 +1778,12 @@ Returns:
|
|||||||
Usage();
|
Usage();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((strcmp(argv[1], "-h") == 0) || (strcmp(argv[1], "--help") == 0)) {
|
if ((strcmp(argv[1], "-h") == 0) || (strcmp(argv[1], "--help") == 0)) {
|
||||||
Usage();
|
Usage();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((strcmp(argv[1], "--version") == 0)) {
|
if ((strcmp(argv[1], "--version") == 0)) {
|
||||||
Version();
|
Version();
|
||||||
return 0;
|
return 0;
|
||||||
@@ -1854,7 +1854,7 @@ Returns:
|
|||||||
OutputFileName = argv[1];
|
OutputFileName = argv[1];
|
||||||
argc -=2;
|
argc -=2;
|
||||||
argv +=2;
|
argv +=2;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (argv[0][0]!='-') {
|
if (argv[0][0]!='-') {
|
||||||
@@ -1865,7 +1865,7 @@ Returns:
|
|||||||
}
|
}
|
||||||
|
|
||||||
Error (NULL, 0, 1000, "Unknown option", argv[0]);
|
Error (NULL, 0, 1000, "Unknown option", argv[0]);
|
||||||
goto ERROR;
|
goto ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (InputFileName == NULL) {
|
if (InputFileName == NULL) {
|
||||||
@@ -1883,7 +1883,7 @@ Returns:
|
|||||||
} else if (DebugMode) {
|
} else if (DebugMode) {
|
||||||
SetPrintLevel(DebugLevel);
|
SetPrintLevel(DebugLevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (VerboseMode) {
|
if (VerboseMode) {
|
||||||
VerboseMsg("%s tool start.\n", UTILITY_NAME);
|
VerboseMsg("%s tool start.\n", UTILITY_NAME);
|
||||||
}
|
}
|
||||||
@@ -1892,13 +1892,13 @@ Returns:
|
|||||||
Error (NULL, 0, 4001, "Resource:", "Memory cannot be allocated!");
|
Error (NULL, 0, 4001, "Resource:", "Memory cannot be allocated!");
|
||||||
goto ERROR;
|
goto ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
InputFile = fopen (LongFilePath (InputFileName), "rb");
|
InputFile = fopen (LongFilePath (InputFileName), "rb");
|
||||||
if (InputFile == NULL) {
|
if (InputFile == NULL) {
|
||||||
Error (NULL, 0, 0001, "Error opening input file", InputFileName);
|
Error (NULL, 0, 0001, "Error opening input file", InputFileName);
|
||||||
goto ERROR;
|
goto ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = GetFileContents(
|
Status = GetFileContents(
|
||||||
InputFileName,
|
InputFileName,
|
||||||
FileBuffer,
|
FileBuffer,
|
||||||
@@ -1931,7 +1931,7 @@ Returns:
|
|||||||
Error (NULL, 0, 0001, "Error opening output file for writing", OutputFileName);
|
Error (NULL, 0, 0001, "Error opening output file for writing", OutputFileName);
|
||||||
goto ERROR;
|
goto ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ENCODE) {
|
if (ENCODE) {
|
||||||
//
|
//
|
||||||
// First call TianoCompress to get DstSize
|
// First call TianoCompress to get DstSize
|
||||||
@@ -1940,7 +1940,7 @@ Returns:
|
|||||||
DebugMsg(UTILITY_NAME, 0, DebugLevel, "Encoding", NULL);
|
DebugMsg(UTILITY_NAME, 0, DebugLevel, "Encoding", NULL);
|
||||||
}
|
}
|
||||||
Status = TianoCompress ((UINT8 *)FileBuffer, InputLength, OutBuffer, &DstSize);
|
Status = TianoCompress ((UINT8 *)FileBuffer, InputLength, OutBuffer, &DstSize);
|
||||||
|
|
||||||
if (Status == EFI_BUFFER_TOO_SMALL) {
|
if (Status == EFI_BUFFER_TOO_SMALL) {
|
||||||
OutBuffer = (UINT8 *) malloc (DstSize);
|
OutBuffer = (UINT8 *) malloc (DstSize);
|
||||||
if (OutBuffer == NULL) {
|
if (OutBuffer == NULL) {
|
||||||
@@ -1973,7 +1973,7 @@ Returns:
|
|||||||
if (VerboseMode) {
|
if (VerboseMode) {
|
||||||
VerboseMsg("Encoding successful\n");
|
VerboseMsg("Encoding successful\n");
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else if (DECODE) {
|
else if (DECODE) {
|
||||||
if (DebugMode) {
|
if (DebugMode) {
|
||||||
@@ -1981,10 +1981,10 @@ Returns:
|
|||||||
}
|
}
|
||||||
//
|
//
|
||||||
// Get Compressed file original size
|
// Get Compressed file original size
|
||||||
//
|
//
|
||||||
Src = (UINT8 *)FileBuffer;
|
Src = (UINT8 *)FileBuffer;
|
||||||
OrigSize = Src[4] + (Src[5] << 8) + (Src[6] << 16) + (Src[7] << 24);
|
OrigSize = Src[4] + (Src[5] << 8) + (Src[6] << 16) + (Src[7] << 24);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Allocate OutputBuffer
|
// Allocate OutputBuffer
|
||||||
//
|
//
|
||||||
@@ -1992,11 +1992,11 @@ Returns:
|
|||||||
if (OutBuffer == NULL) {
|
if (OutBuffer == NULL) {
|
||||||
Error (NULL, 0, 4001, "Resource:", "Memory cannot be allocated!");
|
Error (NULL, 0, 4001, "Resource:", "Memory cannot be allocated!");
|
||||||
goto ERROR;
|
goto ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = Decompress((VOID *)FileBuffer, (VOID *)OutBuffer, (VOID *)Scratch, 2);
|
Status = Decompress((VOID *)FileBuffer, (VOID *)OutBuffer, (VOID *)Scratch, 2);
|
||||||
if (Status != EFI_SUCCESS) {
|
if (Status != EFI_SUCCESS) {
|
||||||
goto ERROR;
|
goto ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
fwrite(OutBuffer, (size_t)(Scratch->mOrigSize), 1, OutputFile);
|
fwrite(OutBuffer, (size_t)(Scratch->mOrigSize), 1, OutputFile);
|
||||||
@@ -2009,13 +2009,13 @@ Returns:
|
|||||||
if (DebugMode) {
|
if (DebugMode) {
|
||||||
DebugMsg(UTILITY_NAME, 0, DebugLevel, "Encoding successful!\n", NULL);
|
DebugMsg(UTILITY_NAME, 0, DebugLevel, "Encoding successful!\n", NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (VerboseMode) {
|
if (VerboseMode) {
|
||||||
VerboseMsg("Decoding successful\n");
|
VerboseMsg("Decoding successful\n");
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ERROR:
|
ERROR:
|
||||||
if (DebugMode) {
|
if (DebugMode) {
|
||||||
if (ENCODE) {
|
if (ENCODE) {
|
||||||
@@ -2039,7 +2039,7 @@ ERROR:
|
|||||||
if (OutBuffer != NULL) {
|
if (OutBuffer != NULL) {
|
||||||
free(OutBuffer);
|
free(OutBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (VerboseMode) {
|
if (VerboseMode) {
|
||||||
VerboseMsg("%s tool done with return code is 0x%x.\n", UTILITY_NAME, GetUtilityStatus ());
|
VerboseMsg("%s tool done with return code is 0x%x.\n", UTILITY_NAME, GetUtilityStatus ());
|
||||||
}
|
}
|
||||||
@@ -2104,8 +2104,8 @@ GetBits (
|
|||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
|
|
||||||
Get NumOfBits of bits out from mBitBuf. Fill mBitBuf with subsequent
|
Get NumOfBits of bits out from mBitBuf. Fill mBitBuf with subsequent
|
||||||
NumOfBits of bits from source. Returns NumOfBits of bits that are
|
NumOfBits of bits from source. Returns NumOfBits of bits that are
|
||||||
popped out.
|
popped out.
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
@@ -2149,9 +2149,9 @@ Arguments:
|
|||||||
BitLen - Code length array
|
BitLen - Code length array
|
||||||
TableBits - The width of the mapping table
|
TableBits - The width of the mapping table
|
||||||
Table - The table
|
Table - The table
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
|
|
||||||
0 - OK.
|
0 - OK.
|
||||||
BAD_TABLE - The table is corrupted.
|
BAD_TABLE - The table is corrupted.
|
||||||
|
|
||||||
@@ -2341,7 +2341,7 @@ Arguments:
|
|||||||
Sd - The global scratch data
|
Sd - The global scratch data
|
||||||
nn - Number of symbols
|
nn - Number of symbols
|
||||||
nbit - Number of bits needed to represent nn
|
nbit - Number of bits needed to represent nn
|
||||||
Special - The special symbol that needs to be taken care of
|
Special - The special symbol that needs to be taken care of
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
|
|
||||||
@@ -2673,14 +2673,14 @@ Returns:
|
|||||||
assert(Source);
|
assert(Source);
|
||||||
// assert(Destination);
|
// assert(Destination);
|
||||||
assert(Scratch);
|
assert(Scratch);
|
||||||
|
|
||||||
Src = (UINT8 *)Source;
|
Src = (UINT8 *)Source;
|
||||||
Dst = (UINT8 *)Destination;
|
Dst = (UINT8 *)Destination;
|
||||||
|
|
||||||
Sd = (SCRATCH_DATA *) Scratch;
|
Sd = (SCRATCH_DATA *) Scratch;
|
||||||
CompSize = Src[0] + (Src[1] << 8) + (Src[2] << 16) + (Src[3] << 24);
|
CompSize = Src[0] + (Src[1] << 8) + (Src[2] << 16) + (Src[3] << 24);
|
||||||
OrigSize = Src[4] + (Src[5] << 8) + (Src[6] << 16) + (Src[7] << 24);
|
OrigSize = Src[4] + (Src[5] << 8) + (Src[6] << 16) + (Src[7] << 24);
|
||||||
|
|
||||||
//
|
//
|
||||||
// If compressed file size is 0, return
|
// If compressed file size is 0, return
|
||||||
//
|
//
|
||||||
@@ -2721,9 +2721,9 @@ Returns:
|
|||||||
//
|
//
|
||||||
// Decompress it
|
// Decompress it
|
||||||
//
|
//
|
||||||
|
|
||||||
Decode (Sd);
|
Decode (Sd);
|
||||||
|
|
||||||
if (Sd->mBadTableFlag != 0) {
|
if (Sd->mBadTableFlag != 0) {
|
||||||
//
|
//
|
||||||
// Something wrong with the source
|
// Something wrong with the source
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
/** @file
|
/** @file
|
||||||
Internal include file for Tiano Decompress Library.
|
Internal include file for Tiano Decompress Library.
|
||||||
|
|
||||||
Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
@@ -95,7 +95,7 @@ GetFileContents (
|
|||||||
OUT UINT8 *FileBuffer,
|
OUT UINT8 *FileBuffer,
|
||||||
OUT UINT32 *BufferLength
|
OUT UINT32 *BufferLength
|
||||||
);
|
);
|
||||||
|
|
||||||
STATIC
|
STATIC
|
||||||
VOID
|
VOID
|
||||||
PutDword(
|
PutDword(
|
||||||
@@ -228,7 +228,7 @@ MakeCrcTable (
|
|||||||
VOID
|
VOID
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
STATIC
|
STATIC
|
||||||
VOID
|
VOID
|
||||||
PutBits (
|
PutBits (
|
||||||
@@ -283,7 +283,7 @@ MakeTree (
|
|||||||
OUT UINT8 LenParm[ ],
|
OUT UINT8 LenParm[ ],
|
||||||
OUT UINT16 CodeParm[]
|
OUT UINT16 CodeParm[]
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Read NumOfBit of bits from source into mBitBuf
|
Read NumOfBit of bits from source into mBitBuf
|
||||||
|
|
||||||
@@ -302,8 +302,8 @@ FillBuf (
|
|||||||
/**
|
/**
|
||||||
Get NumOfBits of bits out from mBitBuf
|
Get NumOfBits of bits out from mBitBuf
|
||||||
|
|
||||||
Get NumOfBits of bits out from mBitBuf. Fill mBitBuf with subsequent
|
Get NumOfBits of bits out from mBitBuf. Fill mBitBuf with subsequent
|
||||||
NumOfBits of bits from source. Returns NumOfBits of bits that are
|
NumOfBits of bits from source. Returns NumOfBits of bits that are
|
||||||
popped out.
|
popped out.
|
||||||
|
|
||||||
@param Sd The global scratch data.
|
@param Sd The global scratch data.
|
||||||
@@ -321,7 +321,7 @@ GetBits (
|
|||||||
/**
|
/**
|
||||||
Creates Huffman Code mapping table according to code length array.
|
Creates Huffman Code mapping table according to code length array.
|
||||||
|
|
||||||
Creates Huffman Code mapping table for Extra Set, Char&Len Set
|
Creates Huffman Code mapping table for Extra Set, Char&Len Set
|
||||||
and Position Set according to code length array.
|
and Position Set according to code length array.
|
||||||
|
|
||||||
@param Sd The global scratch data
|
@param Sd The global scratch data
|
||||||
@@ -347,7 +347,7 @@ MakeTable (
|
|||||||
Decodes a position value.
|
Decodes a position value.
|
||||||
|
|
||||||
Get a position value according to Position Huffman Table.
|
Get a position value according to Position Huffman Table.
|
||||||
|
|
||||||
@param Sd the global scratch data
|
@param Sd the global scratch data
|
||||||
|
|
||||||
@return The position value decoded.
|
@return The position value decoded.
|
||||||
@@ -383,7 +383,7 @@ ReadPTLen (
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
Reads code lengths for Char&Len Set.
|
Reads code lengths for Char&Len Set.
|
||||||
|
|
||||||
Read in and decode the Char&Len Set Code Length Array, then
|
Read in and decode the Char&Len Set Code Length Array, then
|
||||||
generate the Huffman Code mapping table for the Char&Len Set.
|
generate the Huffman Code mapping table for the Char&Len Set.
|
||||||
|
|
||||||
@@ -397,7 +397,7 @@ ReadCLen (
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
Decode a character/length value.
|
Decode a character/length value.
|
||||||
|
|
||||||
Read one value from mBitBuf, Get one code from mBitBuf. If it is at block boundary, generates
|
Read one value from mBitBuf, Get one code from mBitBuf. If it is at block boundary, generates
|
||||||
Huffman code mapping table for Extra Set, Code&Len Set and
|
Huffman code mapping table for Extra Set, Code&Len Set and
|
||||||
Position Set.
|
Position Set.
|
||||||
@@ -416,7 +416,7 @@ DecodeC (
|
|||||||
Decode the source data and put the resulting data into the destination buffer.
|
Decode the source data and put the resulting data into the destination buffer.
|
||||||
|
|
||||||
Decode the source data and put the resulting data into the destination buffer.
|
Decode the source data and put the resulting data into the destination buffer.
|
||||||
|
|
||||||
@param Sd The global scratch data
|
@param Sd The global scratch data
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
@@ -1,15 +1,15 @@
|
|||||||
/** @file
|
/** @file
|
||||||
Defines and prototypes for the UEFI VFR compiler internal use.
|
Defines and prototypes for the UEFI VFR compiler internal use.
|
||||||
|
|
||||||
Copyright (c) 2004 - 2017, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
http://opensource.org/licenses/bsd-license.php
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
#ifndef _EFIVFR_H_
|
#ifndef _EFIVFR_H_
|
||||||
|
@@ -1,15 +1,15 @@
|
|||||||
/** @file
|
/** @file
|
||||||
|
|
||||||
VfrCompiler main class and main function.
|
VfrCompiler main class and main function.
|
||||||
|
|
||||||
Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
http://opensource.org/licenses/bsd-license.php
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
@@ -24,7 +24,7 @@ PACKAGE_DATA gCBuffer;
|
|||||||
PACKAGE_DATA gRBuffer;
|
PACKAGE_DATA gRBuffer;
|
||||||
CVfrStringDB gCVfrStringDB;
|
CVfrStringDB gCVfrStringDB;
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
CVfrCompiler::DebugError (
|
CVfrCompiler::DebugError (
|
||||||
IN CHAR8 *FileName,
|
IN CHAR8 *FileName,
|
||||||
IN UINT32 LineNumber,
|
IN UINT32 LineNumber,
|
||||||
@@ -32,7 +32,7 @@ CVfrCompiler::DebugError (
|
|||||||
IN CONST CHAR8 *Text,
|
IN CONST CHAR8 *Text,
|
||||||
IN CONST CHAR8 *MsgFmt,
|
IN CONST CHAR8 *MsgFmt,
|
||||||
...
|
...
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
va_list List;
|
va_list List;
|
||||||
va_start (List, MsgFmt);
|
va_start (List, MsgFmt);
|
||||||
@@ -58,7 +58,7 @@ CVfrCompiler::IS_RUN_STATUS (
|
|||||||
|
|
||||||
VOID
|
VOID
|
||||||
CVfrCompiler::OptionInitialization (
|
CVfrCompiler::OptionInitialization (
|
||||||
IN INT32 Argc,
|
IN INT32 Argc,
|
||||||
IN CHAR8 **Argv
|
IN CHAR8 **Argv
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@@ -86,7 +86,7 @@ CVfrCompiler::OptionInitialization (
|
|||||||
mOptions.AutoDefault = FALSE;
|
mOptions.AutoDefault = FALSE;
|
||||||
mOptions.CheckDefault = FALSE;
|
mOptions.CheckDefault = FALSE;
|
||||||
memset (&mOptions.OverrideClassGuid, 0, sizeof (EFI_GUID));
|
memset (&mOptions.OverrideClassGuid, 0, sizeof (EFI_GUID));
|
||||||
|
|
||||||
if (Argc == 1) {
|
if (Argc == 1) {
|
||||||
Usage ();
|
Usage ();
|
||||||
SET_RUN_STATUS (STATUS_DEAD);
|
SET_RUN_STATUS (STATUS_DEAD);
|
||||||
@@ -108,7 +108,7 @@ CVfrCompiler::OptionInitialization (
|
|||||||
} else if (stricmp(Argv[Index], "-i") == 0) {
|
} else if (stricmp(Argv[Index], "-i") == 0) {
|
||||||
Index++;
|
Index++;
|
||||||
if ((Index >= Argc) || (Argv[Index][0] == '-')) {
|
if ((Index >= Argc) || (Argv[Index][0] == '-')) {
|
||||||
DebugError (NULL, 0, 1001, "Missing option", "-i missing path argument");
|
DebugError (NULL, 0, 1001, "Missing option", "-i missing path argument");
|
||||||
goto Fail;
|
goto Fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -126,7 +126,7 @@ CVfrCompiler::OptionInitialization (
|
|||||||
goto Fail;
|
goto Fail;
|
||||||
}
|
}
|
||||||
strcpy (mOptions.OutputDirectory, Argv[Index]);
|
strcpy (mOptions.OutputDirectory, Argv[Index]);
|
||||||
|
|
||||||
CHAR8 lastChar = mOptions.OutputDirectory[strlen(mOptions.OutputDirectory) - 1];
|
CHAR8 lastChar = mOptions.OutputDirectory[strlen(mOptions.OutputDirectory) - 1];
|
||||||
if ((lastChar != '/') && (lastChar != '\\')) {
|
if ((lastChar != '/') && (lastChar != '\\')) {
|
||||||
if (strchr(mOptions.OutputDirectory, '/') != NULL) {
|
if (strchr(mOptions.OutputDirectory, '/') != NULL) {
|
||||||
@@ -253,7 +253,7 @@ Fail:
|
|||||||
if (mOptions.IncludePaths != NULL) {
|
if (mOptions.IncludePaths != NULL) {
|
||||||
delete mOptions.IncludePaths;
|
delete mOptions.IncludePaths;
|
||||||
mOptions.IncludePaths = NULL;
|
mOptions.IncludePaths = NULL;
|
||||||
}
|
}
|
||||||
if (mOptions.CPreprocessorOptions != NULL) {
|
if (mOptions.CPreprocessorOptions != NULL) {
|
||||||
delete mOptions.CPreprocessorOptions;
|
delete mOptions.CPreprocessorOptions;
|
||||||
mOptions.CPreprocessorOptions = NULL;
|
mOptions.CPreprocessorOptions = NULL;
|
||||||
@@ -473,7 +473,7 @@ CVfrCompiler::SetRecordListFileName (
|
|||||||
}
|
}
|
||||||
|
|
||||||
CVfrCompiler::CVfrCompiler (
|
CVfrCompiler::CVfrCompiler (
|
||||||
IN INT32 Argc,
|
IN INT32 Argc,
|
||||||
IN CHAR8 **Argv
|
IN CHAR8 **Argv
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@@ -543,14 +543,14 @@ CVfrCompiler::~CVfrCompiler (
|
|||||||
SET_RUN_STATUS(STATUS_DEAD);
|
SET_RUN_STATUS(STATUS_DEAD);
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
CVfrCompiler::Usage (
|
CVfrCompiler::Usage (
|
||||||
VOID
|
VOID
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
UINT32 Index;
|
UINT32 Index;
|
||||||
CONST CHAR8 *Help[] = {
|
CONST CHAR8 *Help[] = {
|
||||||
" ",
|
" ",
|
||||||
"VfrCompile version " VFR_COMPILER_VERSION "Build " __BUILD_VERSION,
|
"VfrCompile version " VFR_COMPILER_VERSION "Build " __BUILD_VERSION,
|
||||||
"Copyright (c) 2004-2016 Intel Corporation. All rights reserved.",
|
"Copyright (c) 2004-2016 Intel Corporation. All rights reserved.",
|
||||||
" ",
|
" ",
|
||||||
@@ -585,7 +585,7 @@ CVfrCompiler::Usage (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
CVfrCompiler::Version (
|
CVfrCompiler::Version (
|
||||||
VOID
|
VOID
|
||||||
)
|
)
|
||||||
@@ -623,8 +623,8 @@ CVfrCompiler::PreProcess (
|
|||||||
}
|
}
|
||||||
fclose (pVfrFile);
|
fclose (pVfrFile);
|
||||||
|
|
||||||
CmdLen = strlen (mPreProcessCmd) + strlen (mPreProcessOpt) +
|
CmdLen = strlen (mPreProcessCmd) + strlen (mPreProcessOpt) +
|
||||||
strlen (mOptions.VfrFileName) + strlen (mOptions.PreprocessorOutputFileName);
|
strlen (mOptions.VfrFileName) + strlen (mOptions.PreprocessorOutputFileName);
|
||||||
if (mOptions.CPreprocessorOptions != NULL) {
|
if (mOptions.CPreprocessorOptions != NULL) {
|
||||||
CmdLen += strlen (mOptions.CPreprocessorOptions);
|
CmdLen += strlen (mOptions.CPreprocessorOptions);
|
||||||
}
|
}
|
||||||
@@ -756,7 +756,7 @@ CVfrCompiler::AdjustBin (
|
|||||||
// Get Package Data and IfrRecord Data
|
// Get Package Data and IfrRecord Data
|
||||||
//
|
//
|
||||||
gCFormPkg.BuildPkg (gCBuffer);
|
gCFormPkg.BuildPkg (gCBuffer);
|
||||||
gCIfrRecordInfoDB.IfrRecordOutput (gRBuffer);
|
gCIfrRecordInfoDB.IfrRecordOutput (gRBuffer);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Compare Form and Record data
|
// Compare Form and Record data
|
||||||
@@ -799,7 +799,7 @@ CVfrCompiler::AdjustBin (
|
|||||||
//
|
//
|
||||||
// Re get the IfrRecord Buffer.
|
// Re get the IfrRecord Buffer.
|
||||||
//
|
//
|
||||||
gCIfrRecordInfoDB.IfrRecordOutput (gRBuffer);
|
gCIfrRecordInfoDB.IfrRecordOutput (gRBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@@ -858,7 +858,7 @@ CVfrCompiler::GenCFile (
|
|||||||
if (!IS_RUN_STATUS(STATUS_GENBINARY)) {
|
if (!IS_RUN_STATUS(STATUS_GENBINARY)) {
|
||||||
goto Fail;
|
goto Fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!mOptions.CreateIfrPkgFile || mOptions.CompatibleMode) {
|
if (!mOptions.CreateIfrPkgFile || mOptions.CompatibleMode) {
|
||||||
if ((pFile = fopen (LongFilePath (mOptions.COutputFileName), "w")) == NULL) {
|
if ((pFile = fopen (LongFilePath (mOptions.COutputFileName), "w")) == NULL) {
|
||||||
DebugError (NULL, 0, 0001, "Error opening output C file", "%s", mOptions.COutputFileName);
|
DebugError (NULL, 0, 0001, "Error opening output C file", "%s", mOptions.COutputFileName);
|
||||||
@@ -869,7 +869,7 @@ CVfrCompiler::GenCFile (
|
|||||||
fprintf (pFile, "%s\n", gSourceFileHeader[Index]);
|
fprintf (pFile, "%s\n", gSourceFileHeader[Index]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mOptions.CompatibleMode) {
|
if (mOptions.CompatibleMode) {
|
||||||
gCVfrBufferConfig.OutputCFile (pFile, mOptions.VfrBaseFileName);
|
gCVfrBufferConfig.OutputCFile (pFile, mOptions.VfrBaseFileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -926,7 +926,7 @@ CVfrCompiler::GenRecordListFile (
|
|||||||
gCIfrRecordInfoDB.IfrRecordOutput (pOutFile, LineNo);
|
gCIfrRecordInfoDB.IfrRecordOutput (pOutFile, LineNo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf (pOutFile, "\n//\n// All Opcode Record List \n//\n");
|
fprintf (pOutFile, "\n//\n// All Opcode Record List \n//\n");
|
||||||
gCIfrRecordInfoDB.IfrRecordOutput (pOutFile, 0);
|
gCIfrRecordInfoDB.IfrRecordOutput (pOutFile, 0);
|
||||||
gCVfrVarDataTypeDB.Dump(pOutFile);
|
gCVfrVarDataTypeDB.Dump(pOutFile);
|
||||||
@@ -943,7 +943,7 @@ Err1:
|
|||||||
|
|
||||||
int
|
int
|
||||||
main (
|
main (
|
||||||
IN int Argc,
|
IN int Argc,
|
||||||
IN char **Argv
|
IN char **Argv
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@@ -951,7 +951,7 @@ main (
|
|||||||
|
|
||||||
SetPrintLevel(WARNING_LOG_LEVEL);
|
SetPrintLevel(WARNING_LOG_LEVEL);
|
||||||
CVfrCompiler Compiler(Argc, Argv);
|
CVfrCompiler Compiler(Argc, Argv);
|
||||||
|
|
||||||
Compiler.PreProcess();
|
Compiler.PreProcess();
|
||||||
Compiler.Compile();
|
Compiler.Compile();
|
||||||
Compiler.AdjustBin();
|
Compiler.AdjustBin();
|
||||||
@@ -967,7 +967,7 @@ main (
|
|||||||
if (gCBuffer.Buffer != NULL) {
|
if (gCBuffer.Buffer != NULL) {
|
||||||
delete[] gCBuffer.Buffer;
|
delete[] gCBuffer.Buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gRBuffer.Buffer != NULL) {
|
if (gRBuffer.Buffer != NULL) {
|
||||||
delete[] gRBuffer.Buffer;
|
delete[] gRBuffer.Buffer;
|
||||||
}
|
}
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user