Compare commits
3 Commits
edk2-stabl
...
intel-fsp-
Author | SHA1 | Date | |
---|---|---|---|
|
8674aecb6a | ||
|
563bd1f035 | ||
|
2415686bbc |
@@ -4,7 +4,6 @@
|
||||
# template file used to build supported packages.
|
||||
#
|
||||
# Copyright (c) Microsoft Corporation.
|
||||
# Copyright (c) 2020, ARM Limited. All rights reserved.<BR>
|
||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
##
|
||||
|
||||
@@ -37,7 +36,7 @@ jobs:
|
||||
Build.Pkgs: 'PcAtChipsetPkg,ShellPkg'
|
||||
Build.Targets: 'DEBUG,RELEASE,NO-TARGET'
|
||||
TARGET_FMP_FAT_TEST:
|
||||
Build.Pkgs: 'FmpDevicePkg,FatPkg,UnitTestFrameworkPkg,DynamicTablesPkg'
|
||||
Build.Pkgs: 'FmpDevicePkg,FatPkg,UnitTestFrameworkPkg'
|
||||
Build.Targets: 'DEBUG,RELEASE,NO-TARGET,NOOPT'
|
||||
TARGET_CRYPTO:
|
||||
Build.Pkgs: 'CryptoPkg'
|
||||
|
@@ -2,7 +2,6 @@
|
||||
#
|
||||
# Copyright (c) Microsoft Corporation.
|
||||
# Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights reserved.<BR>
|
||||
# Copyright (c) 2020, ARM Limited. All rights reserved.<BR>
|
||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
##
|
||||
import os
|
||||
@@ -42,7 +41,6 @@ class Settings(CiBuildSettingsManager, UpdateSettingsManager, SetupSettingsManag
|
||||
These should be edk2 workspace relative paths '''
|
||||
|
||||
return ("ArmVirtPkg",
|
||||
"DynamicTablesPkg",
|
||||
"EmulatorPkg",
|
||||
"MdePkg",
|
||||
"MdeModulePkg",
|
||||
|
@@ -1,309 +0,0 @@
|
||||
# @file EccCheck.py
|
||||
#
|
||||
# Copyright (c) 2020, Intel Corporation. All rights reserved.<BR>
|
||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
##
|
||||
|
||||
import os
|
||||
import shutil
|
||||
import re
|
||||
import csv
|
||||
import xml.dom.minidom
|
||||
from typing import List, Dict, Tuple
|
||||
import logging
|
||||
from io import StringIO
|
||||
from edk2toolext.environment import shell_environment
|
||||
from edk2toolext.environment.plugintypes.ci_build_plugin import ICiBuildPlugin
|
||||
from edk2toolext.environment.var_dict import VarDict
|
||||
from edk2toollib.utility_functions import RunCmd
|
||||
|
||||
|
||||
class EccCheck(ICiBuildPlugin):
|
||||
"""
|
||||
A CiBuildPlugin that finds the Ecc issues of newly added code in pull request.
|
||||
|
||||
Configuration options:
|
||||
"EccCheck": {
|
||||
"ExceptionList": [],
|
||||
"IgnoreFiles": []
|
||||
},
|
||||
"""
|
||||
|
||||
ReModifyFile = re.compile(r'[B-Q,S-Z]+[\d]*\t(.*)')
|
||||
FindModifyFile = re.compile(r'\+\+\+ b\/(.*)')
|
||||
LineScopePattern = (r'@@ -\d*\,*\d* \+\d*\,*\d* @@.*')
|
||||
LineNumRange = re.compile(r'@@ -\d*\,*\d* \+(\d*)\,*(\d*) @@.*')
|
||||
|
||||
def GetTestName(self, packagename: str, environment: VarDict) -> tuple:
|
||||
""" Provide the testcase name and classname for use in reporting
|
||||
testclassname: a descriptive string for the testcase can include whitespace
|
||||
classname: should be patterned <packagename>.<plugin>.<optionally any unique condition>
|
||||
|
||||
Args:
|
||||
packagename: string containing name of package to build
|
||||
environment: The VarDict for the test to run in
|
||||
Returns:
|
||||
a tuple containing the testcase name and the classname
|
||||
(testcasename, classname)
|
||||
"""
|
||||
return ("Check for efi coding style for " + packagename, packagename + ".EccCheck")
|
||||
|
||||
##
|
||||
# External function of plugin. This function is used to perform the task of the ci_build_plugin Plugin
|
||||
#
|
||||
# - package is the edk2 path to package. This means workspace/packagepath relative.
|
||||
# - edk2path object configured with workspace and packages path
|
||||
# - PkgConfig Object (dict) for the pkg
|
||||
# - EnvConfig Object
|
||||
# - Plugin Manager Instance
|
||||
# - Plugin Helper Obj Instance
|
||||
# - Junit Logger
|
||||
# - output_stream the StringIO output stream from this plugin via logging
|
||||
def RunBuildPlugin(self, packagename, Edk2pathObj, pkgconfig, environment, PLM, PLMHelper, tc, output_stream=None):
|
||||
edk2_path = Edk2pathObj.WorkspacePath
|
||||
python_path = os.path.join(edk2_path, "BaseTools", "Source", "Python")
|
||||
env = shell_environment.GetEnvironment()
|
||||
env.set_shell_var('PYTHONPATH', python_path)
|
||||
env.set_shell_var('WORKSPACE', edk2_path)
|
||||
self.ECC_PASS = True
|
||||
self.ApplyConfig(pkgconfig, edk2_path, packagename)
|
||||
modify_dir_list = self.GetModifyDir(packagename)
|
||||
patch = self.GetDiff(packagename)
|
||||
ecc_diff_range = self.GetDiffRange(patch, packagename, edk2_path)
|
||||
self.GenerateEccReport(modify_dir_list, ecc_diff_range, edk2_path)
|
||||
ecc_log = os.path.join(edk2_path, "Ecc.log")
|
||||
self.RevertCode()
|
||||
if self.ECC_PASS:
|
||||
tc.SetSuccess()
|
||||
self.RemoveFile(ecc_log)
|
||||
return 0
|
||||
else:
|
||||
with open(ecc_log, encoding='utf8') as output:
|
||||
ecc_output = output.readlines()
|
||||
for line in ecc_output:
|
||||
logging.error(line.strip())
|
||||
self.RemoveFile(ecc_log)
|
||||
tc.SetFailed("EccCheck failed for {0}".format(packagename), "Ecc detected issues")
|
||||
return 1
|
||||
|
||||
def RevertCode(self) -> None:
|
||||
submoudle_params = "submodule update --init"
|
||||
RunCmd("git", submoudle_params)
|
||||
reset_params = "reset HEAD --hard"
|
||||
RunCmd("git", reset_params)
|
||||
|
||||
def GetDiff(self, pkg: str) -> List[str]:
|
||||
return_buffer = StringIO()
|
||||
params = "diff --unified=0 origin/master HEAD"
|
||||
RunCmd("git", params, outstream=return_buffer)
|
||||
p = return_buffer.getvalue().strip()
|
||||
patch = p.split("\n")
|
||||
return_buffer.close()
|
||||
|
||||
return patch
|
||||
|
||||
def RemoveFile(self, file: str) -> None:
|
||||
if os.path.exists(file):
|
||||
os.remove(file)
|
||||
return
|
||||
|
||||
def GetModifyDir(self, pkg: str) -> List[str]:
|
||||
return_buffer = StringIO()
|
||||
params = "diff --name-status" + ' HEAD' + ' origin/master'
|
||||
RunCmd("git", params, outstream=return_buffer)
|
||||
p1 = return_buffer.getvalue().strip()
|
||||
dir_list = p1.split("\n")
|
||||
return_buffer.close()
|
||||
modify_dir_list = []
|
||||
for modify_dir in dir_list:
|
||||
file_path = self.ReModifyFile.findall(modify_dir)
|
||||
if file_path:
|
||||
file_dir = os.path.dirname(file_path[0])
|
||||
else:
|
||||
continue
|
||||
if pkg in file_dir and file_dir != pkg:
|
||||
modify_dir_list.append('%s' % file_dir)
|
||||
else:
|
||||
continue
|
||||
|
||||
modify_dir_list = list(set(modify_dir_list))
|
||||
return modify_dir_list
|
||||
|
||||
def GetDiffRange(self, patch_diff: List[str], pkg: str, workingdir: str) -> Dict[str, List[Tuple[int, int]]]:
|
||||
IsDelete = True
|
||||
StartCheck = False
|
||||
range_directory: Dict[str, List[Tuple[int, int]]] = {}
|
||||
for line in patch_diff:
|
||||
modify_file = self.FindModifyFile.findall(line)
|
||||
if modify_file and pkg in modify_file[0] and not StartCheck and os.path.isfile(modify_file[0]):
|
||||
modify_file_comment_dic = self.GetCommentRange(modify_file[0], workingdir)
|
||||
IsDelete = False
|
||||
StartCheck = True
|
||||
modify_file_dic = modify_file[0]
|
||||
modify_file_dic = modify_file_dic.replace("/", os.sep)
|
||||
range_directory[modify_file_dic] = []
|
||||
elif line.startswith('--- '):
|
||||
StartCheck = False
|
||||
elif re.match(self.LineScopePattern, line, re.I) and not IsDelete and StartCheck:
|
||||
start_line = self.LineNumRange.search(line).group(1)
|
||||
line_range = self.LineNumRange.search(line).group(2)
|
||||
if not line_range:
|
||||
line_range = '1'
|
||||
range_directory[modify_file_dic].append((int(start_line), int(start_line) + int(line_range) - 1))
|
||||
for i in modify_file_comment_dic:
|
||||
if int(i[0]) <= int(start_line) <= int(i[1]):
|
||||
range_directory[modify_file_dic].append(i)
|
||||
return range_directory
|
||||
|
||||
def GetCommentRange(self, modify_file: str, workingdir: str) -> List[Tuple[int, int]]:
|
||||
modify_file_path = os.path.join(workingdir, modify_file)
|
||||
with open(modify_file_path) as f:
|
||||
line_no = 1
|
||||
comment_range: List[Tuple[int, int]] = []
|
||||
Start = False
|
||||
for line in f:
|
||||
if line.startswith('/**'):
|
||||
start_no = line_no
|
||||
Start = True
|
||||
if line.startswith('**/') and Start:
|
||||
end_no = line_no
|
||||
Start = False
|
||||
comment_range.append((int(start_no), int(end_no)))
|
||||
line_no += 1
|
||||
|
||||
if comment_range and comment_range[0][0] == 1:
|
||||
del comment_range[0]
|
||||
return comment_range
|
||||
|
||||
def GenerateEccReport(self, modify_dir_list: List[str], ecc_diff_range: Dict[str, List[Tuple[int, int]]],
|
||||
edk2_path: str) -> None:
|
||||
ecc_need = False
|
||||
ecc_run = True
|
||||
config = os.path.join(edk2_path, "BaseTools", "Source", "Python", "Ecc", "config.ini")
|
||||
exception = os.path.join(edk2_path, "BaseTools", "Source", "Python", "Ecc", "exception.xml")
|
||||
report = os.path.join(edk2_path, "Ecc.csv")
|
||||
for modify_dir in modify_dir_list:
|
||||
target = os.path.join(edk2_path, modify_dir)
|
||||
logging.info('Run ECC tool for the commit in %s' % modify_dir)
|
||||
ecc_need = True
|
||||
ecc_params = "-c {0} -e {1} -t {2} -r {3}".format(config, exception, target, report)
|
||||
return_code = RunCmd("Ecc", ecc_params, workingdir=edk2_path)
|
||||
if return_code != 0:
|
||||
ecc_run = False
|
||||
break
|
||||
if not ecc_run:
|
||||
logging.error('Fail to run ECC tool')
|
||||
self.ParseEccReport(ecc_diff_range, edk2_path)
|
||||
|
||||
if not ecc_need:
|
||||
logging.info("Doesn't need run ECC check")
|
||||
|
||||
revert_params = "checkout -- {}".format(exception)
|
||||
RunCmd("git", revert_params)
|
||||
return
|
||||
|
||||
def ParseEccReport(self, ecc_diff_range: Dict[str, List[Tuple[int, int]]], edk2_path: str) -> None:
|
||||
ecc_log = os.path.join(edk2_path, "Ecc.log")
|
||||
ecc_csv = "Ecc.csv"
|
||||
file = os.listdir(edk2_path)
|
||||
row_lines = []
|
||||
ignore_error_code = self.GetIgnoreErrorCode()
|
||||
if ecc_csv in file:
|
||||
with open(ecc_csv) as csv_file:
|
||||
reader = csv.reader(csv_file)
|
||||
for row in reader:
|
||||
for modify_file in ecc_diff_range:
|
||||
if modify_file in row[3]:
|
||||
for i in ecc_diff_range[modify_file]:
|
||||
line_no = int(row[4])
|
||||
if i[0] <= line_no <= i[1] and row[1] not in ignore_error_code:
|
||||
row[0] = '\nEFI coding style error'
|
||||
row[1] = 'Error code: ' + row[1]
|
||||
row[3] = 'file: ' + row[3]
|
||||
row[4] = 'Line number: ' + row[4]
|
||||
row_line = '\n *'.join(row)
|
||||
row_lines.append(row_line)
|
||||
break
|
||||
break
|
||||
if row_lines:
|
||||
self.ECC_PASS = False
|
||||
|
||||
with open(ecc_log, 'a') as log:
|
||||
all_line = '\n'.join(row_lines)
|
||||
all_line = all_line + '\n'
|
||||
log.writelines(all_line)
|
||||
return
|
||||
|
||||
def ApplyConfig(self, pkgconfig: Dict[str, List[str]], edk2_path: str, pkg: str) -> None:
|
||||
if "IgnoreFiles" in pkgconfig:
|
||||
for a in pkgconfig["IgnoreFiles"]:
|
||||
a = os.path.join(edk2_path, pkg, a)
|
||||
a = a.replace(os.sep, "/")
|
||||
|
||||
logging.info("Ignoring Files {0}".format(a))
|
||||
if os.path.exists(a):
|
||||
if os.path.isfile(a):
|
||||
self.RemoveFile(a)
|
||||
elif os.path.isdir(a):
|
||||
shutil.rmtree(a)
|
||||
else:
|
||||
logging.error("EccCheck.IgnoreInf -> {0} not found in filesystem. Invalid ignore files".format(a))
|
||||
|
||||
if "ExceptionList" in pkgconfig:
|
||||
exception_list = pkgconfig["ExceptionList"]
|
||||
exception_xml = os.path.join(edk2_path, "BaseTools", "Source", "Python", "Ecc", "exception.xml")
|
||||
try:
|
||||
logging.info("Appending exceptions")
|
||||
self.AppendException(exception_list, exception_xml)
|
||||
except Exception as e:
|
||||
logging.error("Fail to apply exceptions")
|
||||
raise e
|
||||
return
|
||||
|
||||
def AppendException(self, exception_list: List[str], exception_xml: str) -> None:
|
||||
error_code_list = exception_list[::2]
|
||||
keyword_list = exception_list[1::2]
|
||||
dom_tree = xml.dom.minidom.parse(exception_xml)
|
||||
root_node = dom_tree.documentElement
|
||||
for error_code, keyword in zip(error_code_list, keyword_list):
|
||||
customer_node = dom_tree.createElement("Exception")
|
||||
keyword_node = dom_tree.createElement("KeyWord")
|
||||
keyword_node_text_value = dom_tree.createTextNode(keyword)
|
||||
keyword_node.appendChild(keyword_node_text_value)
|
||||
customer_node.appendChild(keyword_node)
|
||||
error_code_node = dom_tree.createElement("ErrorID")
|
||||
error_code_text_value = dom_tree.createTextNode(error_code)
|
||||
error_code_node.appendChild(error_code_text_value)
|
||||
customer_node.appendChild(error_code_node)
|
||||
root_node.appendChild(customer_node)
|
||||
with open(exception_xml, 'w') as f:
|
||||
dom_tree.writexml(f, indent='', addindent='', newl='\n', encoding='UTF-8')
|
||||
return
|
||||
|
||||
def GetIgnoreErrorCode(self) -> set:
|
||||
"""
|
||||
Below are kinds of error code that are accurate in ecc scanning of edk2 level.
|
||||
But EccCheck plugin is partial scanning so they are always false positive issues.
|
||||
The mapping relationship of error code and error message is listed BaseTools/Sourc/Python/Ecc/EccToolError.py
|
||||
"""
|
||||
ignore_error_code = {
|
||||
"10000",
|
||||
"10001",
|
||||
"10002",
|
||||
"10003",
|
||||
"10004",
|
||||
"10005",
|
||||
"10006",
|
||||
"10007",
|
||||
"10008",
|
||||
"10009",
|
||||
"10010",
|
||||
"10011",
|
||||
"10012",
|
||||
"10013",
|
||||
"10015",
|
||||
"10016",
|
||||
"10017",
|
||||
"10022",
|
||||
}
|
||||
return ignore_error_code
|
@@ -1,11 +0,0 @@
|
||||
## @file
|
||||
# CiBuildPlugin used to check Ecc issues
|
||||
#
|
||||
# Copyright (c) 2020, Intel Corporation. All rights reserved.<BR>
|
||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
##
|
||||
{
|
||||
"scope": "cibuild",
|
||||
"name": "EccCheck Test",
|
||||
"module": "EccCheck"
|
||||
}
|
@@ -1,15 +0,0 @@
|
||||
# EFI Coding style Check Plugin
|
||||
|
||||
This CiBuildPlugin finds the Ecc issues of newly added code in pull request.
|
||||
|
||||
## Configuration
|
||||
|
||||
The plugin can be configured to ignore certain files and issues.
|
||||
|
||||
"EccCheck": {
|
||||
"ExceptionList": [],
|
||||
"IgnoreFiles": []
|
||||
},
|
||||
"""
|
||||
|
||||
OPTIONAL List of file to ignore.
|
@@ -1,115 +0,0 @@
|
||||
# @file LicenseCheck.py
|
||||
#
|
||||
# Copyright (c) 2020, Intel Corporation. All rights reserved.<BR>
|
||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
##
|
||||
|
||||
import os
|
||||
import logging
|
||||
import re
|
||||
from io import StringIO
|
||||
from typing import List, Tuple
|
||||
from edk2toolext.environment.plugintypes.ci_build_plugin import ICiBuildPlugin
|
||||
from edk2toolext.environment.var_dict import VarDict
|
||||
from edk2toollib.utility_functions import RunCmd
|
||||
|
||||
|
||||
class LicenseCheck(ICiBuildPlugin):
|
||||
|
||||
"""
|
||||
A CiBuildPlugin to check the license for new added files.
|
||||
|
||||
Configuration options:
|
||||
"LicenseCheck": {
|
||||
"IgnoreFiles": []
|
||||
},
|
||||
"""
|
||||
|
||||
license_format_preflix = 'SPDX-License-Identifier'
|
||||
|
||||
bsd2_patent = 'BSD-2-Clause-Patent'
|
||||
|
||||
Readdedfileformat = re.compile(r'\+\+\+ b\/(.*)')
|
||||
|
||||
file_extension_list = [".c", ".h", ".inf", ".dsc", ".dec", ".py", ".bat", ".sh", ".uni", ".yaml",
|
||||
".fdf", ".inc", "yml", ".asm", ".asm16", ".asl", ".vfr", ".s", ".S", ".aslc",
|
||||
".nasm", ".nasmb", ".idf", ".Vfr", ".H"]
|
||||
|
||||
def GetTestName(self, packagename: str, environment: VarDict) -> tuple:
|
||||
""" Provide the testcase name and classname for use in reporting
|
||||
testclassname: a descriptive string for the testcase can include whitespace
|
||||
classname: should be patterned <packagename>.<plugin>.<optionally any unique condition>
|
||||
|
||||
Args:
|
||||
packagename: string containing name of package to build
|
||||
environment: The VarDict for the test to run in
|
||||
Returns:
|
||||
a tuple containing the testcase name and the classname
|
||||
(testcasename, classname)
|
||||
"""
|
||||
return ("Check for license for " + packagename, packagename + ".LicenseCheck")
|
||||
|
||||
##
|
||||
# External function of plugin. This function is used to perform the task of the ci_build_plugin Plugin
|
||||
#
|
||||
# - package is the edk2 path to package. This means workspace/packagepath relative.
|
||||
# - edk2path object configured with workspace and packages path
|
||||
# - PkgConfig Object (dict) for the pkg
|
||||
# - EnvConfig Object
|
||||
# - Plugin Manager Instance
|
||||
# - Plugin Helper Obj Instance
|
||||
# - Junit Logger
|
||||
# - output_stream the StringIO output stream from this plugin via logging
|
||||
def RunBuildPlugin(self, packagename, Edk2pathObj, pkgconfig, environment, PLM, PLMHelper, tc, output_stream=None):
|
||||
return_buffer = StringIO()
|
||||
params = "diff --unified=0 origin/master HEAD"
|
||||
RunCmd("git", params, outstream=return_buffer)
|
||||
p = return_buffer.getvalue().strip()
|
||||
patch = p.split("\n")
|
||||
return_buffer.close()
|
||||
|
||||
ignore_files = []
|
||||
if "IgnoreFiles" in pkgconfig:
|
||||
ignore_files = pkgconfig["IgnoreFiles"]
|
||||
|
||||
self.ok = True
|
||||
self.startcheck = False
|
||||
self.license = True
|
||||
self.all_file_pass = True
|
||||
count = len(patch)
|
||||
line_index = 0
|
||||
for line in patch:
|
||||
if line.startswith('--- /dev/null'):
|
||||
nextline = patch[line_index + 1]
|
||||
added_file = self.Readdedfileformat.search(nextline).group(1)
|
||||
added_file_extension = os.path.splitext(added_file)[1]
|
||||
if added_file_extension in self.file_extension_list and packagename in added_file:
|
||||
if (self.IsIgnoreFile(added_file, ignore_files)):
|
||||
line_index = line_index + 1
|
||||
continue
|
||||
self.startcheck = True
|
||||
self.license = False
|
||||
if self.startcheck and self.license_format_preflix in line:
|
||||
if self.bsd2_patent in line:
|
||||
self.license = True
|
||||
if line_index + 1 == count or patch[line_index + 1].startswith('diff --') and self.startcheck:
|
||||
if not self.license:
|
||||
self.all_file_pass = False
|
||||
error_message = "Invalid license in: " + added_file + " Hint: Only BSD-2-Clause-Patent is accepted."
|
||||
logging.error(error_message)
|
||||
self.startcheck = False
|
||||
self.license = True
|
||||
line_index = line_index + 1
|
||||
|
||||
if self.all_file_pass:
|
||||
tc.SetSuccess()
|
||||
return 0
|
||||
else:
|
||||
tc.SetFailed("License Check {0} Failed. ".format(packagename), "LICENSE_CHECK_FAILED")
|
||||
return 1
|
||||
|
||||
def IsIgnoreFile(self, file: str, ignore_files: List[str]) -> bool:
|
||||
for f in ignore_files:
|
||||
if f in file:
|
||||
return True
|
||||
return False
|
@@ -1,11 +0,0 @@
|
||||
## @file
|
||||
# CiBuildPlugin used to check license issues for new added files
|
||||
#
|
||||
# Copyright (c) 2020, Intel Corporation. All rights reserved.
|
||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
##
|
||||
{
|
||||
"scope": "cibuild",
|
||||
"name": "License Check Test",
|
||||
"module": "LicenseCheck"
|
||||
}
|
@@ -1,17 +0,0 @@
|
||||
# License Check Plugin
|
||||
|
||||
This CiBuildPlugin scans all new added files in a package to make sure code
|
||||
is contributed under BSD-2-Clause-Patent.
|
||||
|
||||
## Configuration
|
||||
|
||||
The plugin can be configured to ignore certain files.
|
||||
|
||||
``` yaml
|
||||
"LicenseCheck": {
|
||||
"IgnoreFiles": []
|
||||
}
|
||||
```
|
||||
### IgnoreFiles
|
||||
|
||||
OPTIONAL List of file to ignore.
|
@@ -8,7 +8,7 @@
|
||||
| ArmPlatformPkg |
|
||||
| ArmVirtPkg | SEE PACKAGE README | SEE PACKAGE README |
|
||||
| CryptoPkg | :heavy_check_mark: | :heavy_check_mark: | Spell checking in audit mode
|
||||
| DynamicTablesPkg | | :heavy_check_mark: |
|
||||
| DynamicTablesPkg |
|
||||
| EmbeddedPkg |
|
||||
| EmulatorPkg | SEE PACKAGE README | SEE PACKAGE README | Spell checking in audit mode
|
||||
| FatPkg | :heavy_check_mark: | :heavy_check_mark: |
|
||||
|
@@ -29,9 +29,6 @@
|
||||
RELEASE_*_*_CC_FLAGS = -DMDEPKG_NDEBUG
|
||||
*_*_*_CC_FLAGS = -DDISABLE_NEW_DEPRECATED_INTERFACES
|
||||
|
||||
[PcdsFixedAtBuild]
|
||||
gEfiMdePkgTokenSpaceGuid.PcdDefaultTerminalType|4
|
||||
|
||||
[LibraryClasses.common]
|
||||
BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
|
||||
BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
|
||||
@@ -145,8 +142,8 @@
|
||||
|
||||
ArmPkg/Drivers/ArmCrashDumpDxe/ArmCrashDumpDxe.inf
|
||||
ArmPkg/Drivers/ArmScmiDxe/ArmScmiDxe.inf
|
||||
ArmPkg/Drivers/MmCommunicationDxe/MmCommunication.inf
|
||||
|
||||
[Components.AARCH64]
|
||||
ArmPkg/Drivers/MmCommunicationDxe/MmCommunication.inf
|
||||
ArmPkg/Library/ArmMmuLib/ArmMmuPeiLib.inf
|
||||
ArmPkg/Library/StandaloneMmMmuLib/ArmMmuStandaloneMmLib.inf
|
||||
|
@@ -19,8 +19,7 @@ EFI_EXCEPTION_CALLBACK gDebuggerExceptionHandlers[MAX_AARCH64_EXCEPTION + 1] =
|
||||
PHYSICAL_ADDRESS gExceptionVectorAlignmentMask = ARM_VECTOR_TABLE_ALIGNMENT;
|
||||
UINTN gDebuggerNoHandlerValue = 0; // todo: define for AArch64
|
||||
|
||||
#define EL0_STACK_SIZE EFI_PAGES_TO_SIZE(2)
|
||||
STATIC UINTN mNewStackBase[EL0_STACK_SIZE / sizeof (UINTN)];
|
||||
#define EL0_STACK_PAGES 2
|
||||
|
||||
VOID
|
||||
RegisterEl0Stack (
|
||||
@@ -32,11 +31,14 @@ RETURN_STATUS ArchVectorConfig(
|
||||
)
|
||||
{
|
||||
UINTN HcrReg;
|
||||
UINT8 *Stack;
|
||||
|
||||
// Round down sp by 16 bytes alignment
|
||||
RegisterEl0Stack (
|
||||
(VOID *)(((UINTN)mNewStackBase + EL0_STACK_SIZE) & ~0xFUL)
|
||||
);
|
||||
Stack = AllocatePages (EL0_STACK_PAGES);
|
||||
if (Stack == NULL) {
|
||||
return RETURN_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
RegisterEl0Stack ((UINT8 *)Stack + EFI_PAGES_TO_SIZE (EL0_STACK_PAGES));
|
||||
|
||||
if (ArmReadCurrentEL() == AARCH64_EL2) {
|
||||
HcrReg = ArmReadHcr();
|
||||
|
@@ -649,7 +649,7 @@ ArmMmuBaseLibConstructor (
|
||||
// The ArmReplaceLiveTranslationEntry () helper function may be invoked
|
||||
// with the MMU off so we have to ensure that it gets cleaned to the PoC
|
||||
//
|
||||
WriteBackDataCacheRange ((VOID *)(UINTN)ArmReplaceLiveTranslationEntry,
|
||||
WriteBackDataCacheRange (ArmReplaceLiveTranslationEntry,
|
||||
ArmReplaceLiveTranslationEntrySize);
|
||||
|
||||
return RETURN_SUCCESS;
|
||||
|
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (c) 2012 - 2020, ARM Limited. All rights reserved.
|
||||
// Copyright (c) 2012 - 2017, ARM Limited. All rights reserved.
|
||||
//
|
||||
// SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
//
|
||||
@@ -25,9 +25,6 @@ ASM_PFX(ArmCallSvc):
|
||||
ldp x0, x1, [x0, #0]
|
||||
|
||||
svc #0
|
||||
// Prevent speculative execution beyond svc instruction
|
||||
dsb nsh
|
||||
isb
|
||||
|
||||
// Pop the ARM_SVC_ARGS structure address from the stack into x9
|
||||
ldr x9, [sp, #16]
|
||||
|
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (c) 2016 - 2020, ARM Limited. All rights reserved.
|
||||
// Copyright (c) 2016 - 2017, ARM Limited. All rights reserved.
|
||||
//
|
||||
// SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
//
|
||||
@@ -18,9 +18,6 @@ ASM_PFX(ArmCallSvc):
|
||||
ldm r0, {r0-r7}
|
||||
|
||||
svc #0
|
||||
// Prevent speculative execution beyond svc instruction
|
||||
dsb nsh
|
||||
isb
|
||||
|
||||
// Load the ARM_SVC_ARGS structure address from the stack into r8
|
||||
ldr r8, [sp]
|
||||
|
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (c) 2016 - 2020, ARM Limited. All rights reserved.
|
||||
// Copyright (c) 2016 - 2017, ARM Limited. All rights reserved.
|
||||
//
|
||||
// SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
//
|
||||
@@ -16,9 +16,6 @@
|
||||
ldm r0, {r0-r7}
|
||||
|
||||
svc #0
|
||||
// Prevent speculative execution beyond svc instruction
|
||||
dsb nsh
|
||||
isb
|
||||
|
||||
// Load the ARM_SVC_ARGS structure address from the stack into r8
|
||||
ldr r8, [sp]
|
||||
|
@@ -23,12 +23,10 @@
|
||||
#include <Protocol/EsrtManagement.h>
|
||||
#include <Protocol/GraphicsOutput.h>
|
||||
#include <Protocol/LoadedImage.h>
|
||||
#include <Protocol/NonDiscoverableDevice.h>
|
||||
#include <Protocol/PciIo.h>
|
||||
#include <Protocol/PciRootBridgeIo.h>
|
||||
#include <Protocol/PlatformBootManager.h>
|
||||
#include <Guid/EventGroup.h>
|
||||
#include <Guid/NonDiscoverableDevice.h>
|
||||
#include <Guid/TtyTerm.h>
|
||||
#include <Guid/SerialPortLibVendor.h>
|
||||
|
||||
@@ -256,37 +254,6 @@ IsPciDisplay (
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
This FILTER_FUNCTION checks if a handle corresponds to a non-discoverable
|
||||
USB host controller.
|
||||
**/
|
||||
STATIC
|
||||
BOOLEAN
|
||||
EFIAPI
|
||||
IsUsbHost (
|
||||
IN EFI_HANDLE Handle,
|
||||
IN CONST CHAR16 *ReportText
|
||||
)
|
||||
{
|
||||
NON_DISCOVERABLE_DEVICE *Device;
|
||||
EFI_STATUS Status;
|
||||
|
||||
Status = gBS->HandleProtocol (Handle,
|
||||
&gEdkiiNonDiscoverableDeviceProtocolGuid,
|
||||
(VOID **)&Device);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (CompareGuid (Device->Type, &gEdkiiNonDiscoverableUhciDeviceGuid) ||
|
||||
CompareGuid (Device->Type, &gEdkiiNonDiscoverableEhciDeviceGuid) ||
|
||||
CompareGuid (Device->Type, &gEdkiiNonDiscoverableXhciDeviceGuid)) {
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
This CALLBACK_FUNCTION attempts to connect a handle non-recursively, asking
|
||||
the matching driver to produce all first-level child handles.
|
||||
@@ -357,8 +324,7 @@ VOID
|
||||
PlatformRegisterFvBootOption (
|
||||
CONST EFI_GUID *FileGuid,
|
||||
CHAR16 *Description,
|
||||
UINT32 Attributes,
|
||||
EFI_INPUT_KEY *Key
|
||||
UINT32 Attributes
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
@@ -410,9 +376,6 @@ PlatformRegisterFvBootOption (
|
||||
if (OptionIndex == -1) {
|
||||
Status = EfiBootManagerAddLoadOptionVariable (&NewOption, MAX_UINTN);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
Status = EfiBootManagerAddKeyOptionVariable (NULL,
|
||||
(UINT16)NewOption.OptionNumber, 0, Key, NULL);
|
||||
ASSERT (Status == EFI_SUCCESS || Status == EFI_ALREADY_STARTED);
|
||||
}
|
||||
EfiBootManagerFreeLoadOption (&NewOption);
|
||||
EfiBootManagerFreeLoadOptions (BootOptions, BootOptionCount);
|
||||
@@ -611,15 +574,6 @@ PlatformBootManagerBeforeConsole (
|
||||
//
|
||||
FilterAndProcess (&gEfiGraphicsOutputProtocolGuid, NULL, AddOutput);
|
||||
|
||||
//
|
||||
// The core BDS code connects short-form USB device paths by explicitly
|
||||
// looking for handles with PCI I/O installed, and checking the PCI class
|
||||
// code whether it matches the one for a USB host controller. This means
|
||||
// non-discoverable USB host controllers need to have the non-discoverable
|
||||
// PCI driver attached first.
|
||||
//
|
||||
FilterAndProcess (&gEdkiiNonDiscoverableDeviceProtocolGuid, IsUsbHost, Connect);
|
||||
|
||||
//
|
||||
// Add the hardcoded short-form USB keyboard device path to ConIn.
|
||||
//
|
||||
@@ -629,13 +583,7 @@ PlatformBootManagerBeforeConsole (
|
||||
//
|
||||
// Add the hardcoded serial console device path to ConIn, ConOut, ErrOut.
|
||||
//
|
||||
STATIC_ASSERT (FixedPcdGet8 (PcdDefaultTerminalType) == 4,
|
||||
"PcdDefaultTerminalType must be TTYTERM");
|
||||
STATIC_ASSERT (FixedPcdGet8 (PcdUartDefaultParity) != 0,
|
||||
"PcdUartDefaultParity must be set to an actual value, not 'default'");
|
||||
STATIC_ASSERT (FixedPcdGet8 (PcdUartDefaultStopBits) != 0,
|
||||
"PcdUartDefaultStopBits must be set to an actual value, not 'default'");
|
||||
|
||||
ASSERT (FixedPcdGet8 (PcdDefaultTerminalType) == 4);
|
||||
CopyGuid (&mSerialConsole.TermType.Guid, &gEfiTtyTermGuid);
|
||||
|
||||
EfiBootManagerUpdateConsoleVariable (ConIn,
|
||||
@@ -725,7 +673,6 @@ PlatformBootManagerAfterConsole (
|
||||
UINTN FirmwareVerLength;
|
||||
UINTN PosX;
|
||||
UINTN PosY;
|
||||
EFI_INPUT_KEY Key;
|
||||
|
||||
FirmwareVerLength = StrLen (PcdGetPtr (PcdFirmwareVersionString));
|
||||
|
||||
@@ -753,6 +700,11 @@ PlatformBootManagerAfterConsole (
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Connect the rest of the devices.
|
||||
//
|
||||
EfiBootManagerConnectAll ();
|
||||
|
||||
//
|
||||
// On ARM, there is currently no reason to use the phased capsule
|
||||
// update approach where some capsules are dispatched before EndOfDxe
|
||||
@@ -762,12 +714,17 @@ PlatformBootManagerAfterConsole (
|
||||
//
|
||||
HandleCapsules ();
|
||||
|
||||
//
|
||||
// Enumerate all possible boot options.
|
||||
//
|
||||
EfiBootManagerRefreshAllBootOption ();
|
||||
|
||||
//
|
||||
// Register UEFI Shell
|
||||
//
|
||||
Key.ScanCode = SCAN_NULL;
|
||||
Key.UnicodeChar = L's';
|
||||
PlatformRegisterFvBootOption (&gUefiShellFileGuid, L"UEFI Shell", 0, &Key);
|
||||
PlatformRegisterFvBootOption (
|
||||
&gUefiShellFileGuid, L"UEFI Shell", LOAD_OPTION_ACTIVE
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -818,49 +775,5 @@ PlatformBootManagerUnableToBoot (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_BOOT_MANAGER_LOAD_OPTION BootManagerMenu;
|
||||
EFI_BOOT_MANAGER_LOAD_OPTION *BootOptions;
|
||||
UINTN OldBootOptionCount;
|
||||
UINTN NewBootOptionCount;
|
||||
|
||||
//
|
||||
// Record the total number of boot configured boot options
|
||||
//
|
||||
BootOptions = EfiBootManagerGetLoadOptions (&OldBootOptionCount,
|
||||
LoadOptionTypeBoot);
|
||||
EfiBootManagerFreeLoadOptions (BootOptions, OldBootOptionCount);
|
||||
|
||||
//
|
||||
// Connect all devices, and regenerate all boot options
|
||||
//
|
||||
EfiBootManagerConnectAll ();
|
||||
EfiBootManagerRefreshAllBootOption ();
|
||||
|
||||
//
|
||||
// Record the updated number of boot configured boot options
|
||||
//
|
||||
BootOptions = EfiBootManagerGetLoadOptions (&NewBootOptionCount,
|
||||
LoadOptionTypeBoot);
|
||||
EfiBootManagerFreeLoadOptions (BootOptions, NewBootOptionCount);
|
||||
|
||||
//
|
||||
// If the number of configured boot options has changed, reboot
|
||||
// the system so the new boot options will be taken into account
|
||||
// while executing the ordinary BDS bootflow sequence.
|
||||
//
|
||||
if (NewBootOptionCount != OldBootOptionCount) {
|
||||
DEBUG ((DEBUG_WARN, "%a: rebooting after refreshing all boot options\n",
|
||||
__FUNCTION__));
|
||||
gRT->ResetSystem (EfiResetCold, EFI_SUCCESS, 0, NULL);
|
||||
}
|
||||
|
||||
Status = EfiBootManagerGetBootManagerMenu (&BootManagerMenu);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (;;) {
|
||||
EfiBootManagerBoot (&BootManagerMenu);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@@ -66,9 +66,6 @@
|
||||
gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut
|
||||
|
||||
[Guids]
|
||||
gEdkiiNonDiscoverableEhciDeviceGuid
|
||||
gEdkiiNonDiscoverableUhciDeviceGuid
|
||||
gEdkiiNonDiscoverableXhciDeviceGuid
|
||||
gEfiFileInfoGuid
|
||||
gEfiFileSystemInfoGuid
|
||||
gEfiFileSystemVolumeLabelInfoIdGuid
|
||||
@@ -77,7 +74,6 @@
|
||||
gUefiShellFileGuid
|
||||
|
||||
[Protocols]
|
||||
gEdkiiNonDiscoverableDeviceProtocolGuid
|
||||
gEfiDevicePathProtocolGuid
|
||||
gEfiGraphicsOutputProtocolGuid
|
||||
gEfiLoadedImageProtocolGuid
|
||||
|
@@ -78,14 +78,10 @@ PL011UartInitializePort (
|
||||
UINT32 Integer;
|
||||
UINT32 Fractional;
|
||||
UINT32 HardwareFifoDepth;
|
||||
UINT32 UartPid2;
|
||||
|
||||
HardwareFifoDepth = FixedPcdGet16 (PcdUartDefaultReceiveFifoDepth);
|
||||
if (HardwareFifoDepth == 0) {
|
||||
UartPid2 = MmioRead32 (UartBase + UARTPID2);
|
||||
HardwareFifoDepth = (PL011_UARTPID2_VER (UartPid2) > PL011_VER_R1P4) ? 32 : 16;
|
||||
}
|
||||
|
||||
HardwareFifoDepth = (PL011_UARTPID2_VER (MmioRead32 (UartBase + UARTPID2)) \
|
||||
> PL011_VER_R1P4) \
|
||||
? 32 : 16 ;
|
||||
// The PL011 supports a buffer of 1, 16 or 32 chars. Therefore we can accept
|
||||
// 1 char buffer as the minimum FIFO size. Because everything can be rounded
|
||||
// down, there is no maximum FIFO size.
|
||||
|
@@ -30,7 +30,6 @@
|
||||
ArmPlatformPkg/ArmPlatformPkg.dec
|
||||
|
||||
[FixedPcd]
|
||||
gEfiMdePkgTokenSpaceGuid.PcdUartDefaultReceiveFifoDepth
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdSerialBaudRate
|
||||
|
||||
gArmPlatformTokenSpaceGuid.PL011UartInteger
|
||||
|
@@ -5,25 +5,9 @@
|
||||
# used for code analysis.
|
||||
#
|
||||
# Copyright (c) Microsoft Corporation
|
||||
# Copyright (c) 2020, Intel Corporation. All rights reserved.<BR>
|
||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
##
|
||||
{
|
||||
## options defined .pytool/Plugin/LicenseCheck
|
||||
"LicenseCheck": {
|
||||
"IgnoreFiles": []
|
||||
},
|
||||
"EccCheck": {
|
||||
## Exception sample looks like below:
|
||||
## "ExceptionList": [
|
||||
## "<ErrorID>", "<KeyWord>"
|
||||
## ]
|
||||
"ExceptionList": [
|
||||
],
|
||||
## Both file path and directory path are accepted.
|
||||
"IgnoreFiles": [
|
||||
]
|
||||
},
|
||||
## options defined .pytool/Plugin/CompilerPlugin
|
||||
"CompilerPlugin": {
|
||||
"DscPath": "" # Don't support this test
|
||||
|
@@ -83,12 +83,14 @@
|
||||
[LibraryClasses.common.UEFI_DRIVER]
|
||||
UefiScsiLib|MdePkg/Library/UefiScsiLib/UefiScsiLib.inf
|
||||
|
||||
[BuildOptions]
|
||||
[BuildOptions.common.EDKII.SEC, BuildOptions.common.EDKII.BASE]
|
||||
#
|
||||
# We need to avoid jump tables in SEC modules, so that the PE/COFF
|
||||
# self-relocation code itself is guaranteed to be position independent.
|
||||
# CLANG38 with LTO support enabled uses the GNU GOLD linker, which insists
|
||||
# on emitting GOT based symbol references when running in shared mode, unless
|
||||
# we override visibility to 'hidden' in all modules that make up the PrePi
|
||||
# build.
|
||||
#
|
||||
GCC:*_*_*_CC_FLAGS = -fno-jump-tables
|
||||
GCC:*_CLANG38_*_CC_FLAGS = -include $(WORKSPACE)/ArmVirtPkg/Include/Platform/Hidden.h
|
||||
|
||||
################################################################################
|
||||
#
|
||||
|
@@ -136,7 +136,7 @@ READ_STATUS = TRUE
|
||||
READ_LOCK_CAP = TRUE
|
||||
READ_LOCK_STATUS = TRUE
|
||||
|
||||
INF RuleOverride = SELF_RELOC ArmVirtPkg/PrePi/ArmVirtPrePiUniCoreRelocatable.inf
|
||||
INF ArmVirtPkg/PrePi/ArmVirtPrePiUniCoreRelocatable.inf
|
||||
|
||||
FILE FV_IMAGE = 9E21FD93-9C72-4c15-8C4B-E77F1DB2D792 {
|
||||
SECTION GUIDED EE4E5898-3914-4259-9D6E-DC7BD79403CF PROCESSING_REQUIRED = TRUE {
|
||||
|
@@ -39,11 +39,6 @@
|
||||
TE TE Align = Auto $(INF_OUTPUT)/$(MODULE_NAME).efi
|
||||
}
|
||||
|
||||
[Rule.Common.SEC.SELF_RELOC]
|
||||
FILE SEC = $(NAMED_GUID) {
|
||||
TE TE Align = Auto $(INF_OUTPUT)/$(MODULE_NAME).efi
|
||||
}
|
||||
|
||||
[Rule.Common.PEI_CORE]
|
||||
FILE PEI_CORE = $(NAMED_GUID) FIXED {
|
||||
TE TE Align = Auto $(INF_OUTPUT)/$(MODULE_NAME).efi
|
||||
|
@@ -52,12 +52,14 @@
|
||||
[LibraryClasses.common.UEFI_DRIVER]
|
||||
UefiScsiLib|MdePkg/Library/UefiScsiLib/UefiScsiLib.inf
|
||||
|
||||
[BuildOptions]
|
||||
[BuildOptions.common.EDKII.SEC, BuildOptions.common.EDKII.BASE]
|
||||
#
|
||||
# We need to avoid jump tables in SEC modules, so that the PE/COFF
|
||||
# self-relocation code itself is guaranteed to be position independent.
|
||||
# CLANG38 with LTO support enabled uses the GNU GOLD linker, which insists
|
||||
# on emitting GOT based symbol references when running in shared mode, unless
|
||||
# we override visibility to 'hidden' in all modules that make up the PrePi
|
||||
# build.
|
||||
#
|
||||
GCC:*_*_*_CC_FLAGS = -fno-jump-tables
|
||||
GCC:*_CLANG38_*_CC_FLAGS = -include $(WORKSPACE)/ArmVirtPkg/Include/Platform/Hidden.h
|
||||
|
||||
################################################################################
|
||||
#
|
||||
|
@@ -233,7 +233,7 @@ READ_STATUS = TRUE
|
||||
READ_LOCK_CAP = TRUE
|
||||
READ_LOCK_STATUS = TRUE
|
||||
|
||||
INF RuleOverride = SELF_RELOC ArmVirtPkg/PrePi/ArmVirtPrePiUniCoreRelocatable.inf
|
||||
INF ArmVirtPkg/PrePi/ArmVirtPrePiUniCoreRelocatable.inf
|
||||
|
||||
FILE FV_IMAGE = 9E21FD93-9C72-4c15-8C4B-E77F1DB2D792 {
|
||||
SECTION GUIDED EE4E5898-3914-4259-9D6E-DC7BD79403CF PROCESSING_REQUIRED = TRUE {
|
||||
|
22
ArmVirtPkg/Include/Platform/Hidden.h
Normal file
22
ArmVirtPkg/Include/Platform/Hidden.h
Normal file
@@ -0,0 +1,22 @@
|
||||
/** @file
|
||||
|
||||
Copyright (c) 2018, Linaro Limited. All rights reserved.
|
||||
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
**/
|
||||
|
||||
#ifndef __PLATFORM_HIDDEN_H
|
||||
#define __PLATFORM_HIDDEN_H
|
||||
|
||||
//
|
||||
// Setting the GCC -fvisibility=hidden command line option is not quite the same
|
||||
// as setting the pragma below: the former only affects definitions, whereas the
|
||||
// pragma affects extern declarations as well. So if we want to ensure that no
|
||||
// GOT indirected symbol references are emitted, we need to use the pragma, or
|
||||
// GOT based cross object references could be emitted, e.g., in libraries, and
|
||||
// these cannot be relaxed to ordinary symbol references at link time.
|
||||
//
|
||||
#pragma GCC visibility push (hidden)
|
||||
|
||||
#endif
|
@@ -86,22 +86,6 @@ NorFlashPlatformGetDevices (
|
||||
mNorFlashDevices[Num].BlockSize = QEMU_NOR_BLOCK_SIZE;
|
||||
Num++;
|
||||
}
|
||||
|
||||
//
|
||||
// UEFI takes ownership of the NOR flash, and exposes its functionality
|
||||
// through the UEFI Runtime Services GetVariable, SetVariable, etc. This
|
||||
// means we need to disable it in the device tree to prevent the OS from
|
||||
// attaching its device driver as well.
|
||||
// Note that this also hides other flash banks, but the only other flash
|
||||
// bank we expect to encounter is the one that carries the UEFI executable
|
||||
// code, which is not intended to be guest updatable, and is usually backed
|
||||
// in a readonly manner by QEMU anyway.
|
||||
//
|
||||
Status = FdtClient->SetNodeProperty (FdtClient, Node, "status",
|
||||
"disabled", sizeof ("disabled"));
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_WARN, "Failed to set NOR flash status to 'disabled'\n"));
|
||||
}
|
||||
}
|
||||
|
||||
*NorFlashDescriptions = mNorFlashDevices;
|
||||
|
@@ -9,6 +9,40 @@
|
||||
#include <AsmMacroIoLibV8.h>
|
||||
|
||||
ASM_FUNC(_ModuleEntryPoint)
|
||||
//
|
||||
// We are built as a ET_DYN PIE executable, so we need to process all
|
||||
// relative relocations regardless of whether or not we are executing from
|
||||
// the same offset we were linked at. This is only possible if we are
|
||||
// running from RAM.
|
||||
//
|
||||
adr x8, __reloc_base
|
||||
adr x9, __reloc_start
|
||||
adr x10, __reloc_end
|
||||
|
||||
.Lreloc_loop:
|
||||
cmp x9, x10
|
||||
bhs .Lreloc_done
|
||||
|
||||
//
|
||||
// AArch64 uses the ELF64 RELA format, which means each entry in the
|
||||
// relocation table consists of
|
||||
//
|
||||
// UINT64 offset : the relative offset of the value that needs to
|
||||
// be relocated
|
||||
// UINT64 info : relocation type and symbol index (the latter is
|
||||
// not used for R_AARCH64_RELATIVE relocations)
|
||||
// UINT64 addend : value to be added to the value being relocated
|
||||
//
|
||||
ldp x11, x12, [x9], #24 // read offset into x11 and info into x12
|
||||
cmp x12, #0x403 // check info == R_AARCH64_RELATIVE?
|
||||
bne .Lreloc_loop // not a relative relocation? then skip
|
||||
|
||||
ldr x12, [x9, #-8] // read addend into x12
|
||||
add x12, x12, x8 // add reloc base to addend to get relocated value
|
||||
str x12, [x11, x8] // write relocated value at offset
|
||||
b .Lreloc_loop
|
||||
.Lreloc_done:
|
||||
|
||||
bl ASM_PFX(DiscoverDramFromDt)
|
||||
|
||||
// Get ID of this CPU in Multicore system
|
||||
@@ -136,24 +170,15 @@ ASM_PFX(DiscoverDramFromDt):
|
||||
str x1, [x8]
|
||||
str x7, [x9]
|
||||
|
||||
//
|
||||
// The runtime address may be different from the link time address so fix
|
||||
// up the PE/COFF relocations. Since we are calling a C function, use the
|
||||
// window at the beginning of the FD image as a temp stack.
|
||||
//
|
||||
mov x0, x7
|
||||
adr x1, PeCoffLoaderImageReadFromMemory
|
||||
mov sp, x7
|
||||
bl RelocatePeCoffImage
|
||||
|
||||
//
|
||||
// Discover the memory size and offset from the DTB, and record in the
|
||||
// respective PCDs. This will also return false if a corrupt DTB is
|
||||
// encountered.
|
||||
// encountered. Since we are calling a C function, use the window at the
|
||||
// beginning of the FD image as a temp stack.
|
||||
//
|
||||
mov x0, x28
|
||||
adr x1, PcdGet64 (PcdSystemMemoryBase)
|
||||
adr x2, PcdGet64 (PcdSystemMemorySize)
|
||||
mov sp, x7
|
||||
bl FindMemnode
|
||||
cbz x0, .Lout
|
||||
|
||||
|
@@ -9,6 +9,38 @@
|
||||
#include <AsmMacroIoLib.h>
|
||||
|
||||
ASM_FUNC(_ModuleEntryPoint)
|
||||
//
|
||||
// We are built as a ET_DYN PIE executable, so we need to process all
|
||||
// relative relocations if we are executing from a different offset than we
|
||||
// were linked at. This is only possible if we are running from RAM.
|
||||
//
|
||||
ADRL (r4, __reloc_base)
|
||||
ADRL (r5, __reloc_start)
|
||||
ADRL (r6, __reloc_end)
|
||||
|
||||
.Lreloc_loop:
|
||||
cmp r5, r6
|
||||
bhs .Lreloc_done
|
||||
|
||||
//
|
||||
// AArch32 uses the ELF32 REL format, which means each entry in the
|
||||
// relocation table consists of
|
||||
//
|
||||
// UINT32 offset : the relative offset of the value that needs to
|
||||
// be relocated
|
||||
// UINT32 info : relocation type and symbol index (the latter is
|
||||
// not used for R_ARM_RELATIVE relocations)
|
||||
//
|
||||
ldrd r8, r9, [r5], #8 // read offset into r8 and info into r9
|
||||
cmp r9, #23 // check info == R_ARM_RELATIVE?
|
||||
bne .Lreloc_loop // not a relative relocation? then skip
|
||||
|
||||
ldr r9, [r8, r4] // read addend into r9
|
||||
add r9, r9, r1 // add image base to addend to get relocated value
|
||||
str r9, [r8, r4] // write relocated value at offset
|
||||
b .Lreloc_loop
|
||||
.Lreloc_done:
|
||||
|
||||
// Do early platform specific actions
|
||||
bl ASM_PFX(ArmPlatformPeiBootAction)
|
||||
|
||||
@@ -140,24 +172,15 @@ ASM_PFX(ArmPlatformPeiBootAction):
|
||||
str r1, [r8]
|
||||
str r5, [r7]
|
||||
|
||||
//
|
||||
// The runtime address may be different from the link time address so fix
|
||||
// up the PE/COFF relocations. Since we are calling a C function, use the
|
||||
// window at the beginning of the FD image as a temp stack.
|
||||
//
|
||||
mov r0, r5
|
||||
ADRL (r1, PeCoffLoaderImageReadFromMemory)
|
||||
mov sp, r5
|
||||
bl RelocatePeCoffImage
|
||||
|
||||
//
|
||||
// Discover the memory size and offset from the DTB, and record in the
|
||||
// respective PCDs. This will also return false if a corrupt DTB is
|
||||
// encountered.
|
||||
// encountered. Since we are calling a C function, use the window at the
|
||||
// beginning of the FD image as a temp stack.
|
||||
//
|
||||
mov r0, r10
|
||||
ADRL (r1, PcdGet64 (PcdSystemMemoryBase))
|
||||
ADRL (r2, PcdGet64 (PcdSystemMemorySize))
|
||||
mov sp, r5
|
||||
bl FindMemnode
|
||||
teq r0, #0
|
||||
beq .Lout
|
||||
|
@@ -46,7 +46,6 @@
|
||||
SerialPortLib
|
||||
ExtractGuidedSectionLib
|
||||
LzmaDecompressLib
|
||||
PeCoffLib
|
||||
PrePiLib
|
||||
MemoryAllocationLib
|
||||
HobLib
|
||||
@@ -96,3 +95,6 @@
|
||||
gArmVirtTokenSpaceGuid.PcdDeviceTreeInitialBaseAddress
|
||||
gArmTokenSpaceGuid.PcdFdBaseAddress
|
||||
gArmTokenSpaceGuid.PcdFvBaseAddress
|
||||
|
||||
[BuildOptions]
|
||||
GCC:*_*_*_DLINK_FLAGS = -Wl,-Bsymbolic,-pie,-T,$(MODULE_DIR)/Scripts/PrePi-PIE.lds
|
||||
|
@@ -9,7 +9,6 @@
|
||||
#include <PiPei.h>
|
||||
#include <Pi/PiBootMode.h>
|
||||
|
||||
#include <Library/PeCoffLib.h>
|
||||
#include <Library/PrePiLib.h>
|
||||
#include <Library/PrintLib.h>
|
||||
#include <Library/PrePiHobListPointerLib.h>
|
||||
@@ -129,37 +128,3 @@ CEntryPoint (
|
||||
// DXE Core should always load and never return
|
||||
ASSERT (FALSE);
|
||||
}
|
||||
|
||||
VOID
|
||||
RelocatePeCoffImage (
|
||||
IN EFI_PEI_FV_HANDLE FwVolHeader,
|
||||
IN PE_COFF_LOADER_READ_FILE ImageRead
|
||||
)
|
||||
{
|
||||
EFI_PEI_FILE_HANDLE FileHandle;
|
||||
VOID *SectionData;
|
||||
PE_COFF_LOADER_IMAGE_CONTEXT ImageContext;
|
||||
EFI_STATUS Status;
|
||||
|
||||
FileHandle = NULL;
|
||||
Status = FfsFindNextFile (EFI_FV_FILETYPE_SECURITY_CORE, FwVolHeader,
|
||||
&FileHandle);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
Status = FfsFindSectionData (EFI_SECTION_PE32, FileHandle, &SectionData);
|
||||
if (EFI_ERROR (Status)) {
|
||||
Status = FfsFindSectionData (EFI_SECTION_TE, FileHandle, &SectionData);
|
||||
}
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
ZeroMem (&ImageContext, sizeof ImageContext);
|
||||
|
||||
ImageContext.Handle = (EFI_HANDLE)SectionData;
|
||||
ImageContext.ImageRead = ImageRead;
|
||||
PeCoffLoaderGetImageInfo (&ImageContext);
|
||||
|
||||
if (ImageContext.ImageAddress != (UINTN)SectionData) {
|
||||
ImageContext.ImageAddress = (UINTN)SectionData;
|
||||
PeCoffLoaderRelocateImage (&ImageContext);
|
||||
}
|
||||
}
|
||||
|
41
ArmVirtPkg/PrePi/Scripts/PrePi-PIE.lds
Normal file
41
ArmVirtPkg/PrePi/Scripts/PrePi-PIE.lds
Normal file
@@ -0,0 +1,41 @@
|
||||
/** @file
|
||||
|
||||
Copyright (c) 2015, Linaro Ltd. All rights reserved.<BR>
|
||||
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
**/
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
PROVIDE(__reloc_base = .);
|
||||
|
||||
. = PECOFF_HEADER_SIZE;
|
||||
.text : ALIGN(CONSTANT(COMMONPAGESIZE)) {
|
||||
*(.text .text*)
|
||||
*(.got .got*)
|
||||
*(.rodata .rodata*)
|
||||
*(.data .data*)
|
||||
*(.bss .bss*)
|
||||
|
||||
. = ALIGN(0x20);
|
||||
PROVIDE(__reloc_start = .);
|
||||
*(.rel .rel.*)
|
||||
*(.rela .rela.*)
|
||||
PROVIDE(__reloc_end = .);
|
||||
}
|
||||
|
||||
.note (INFO) : { *(.note.gnu.build-id) }
|
||||
|
||||
/DISCARD/ : {
|
||||
*(.note.GNU-stack)
|
||||
*(.gnu.hash)
|
||||
*(.gnu_debuglink)
|
||||
*(.interp)
|
||||
*(.dynamic)
|
||||
*(.dynsym)
|
||||
*(.dynstr)
|
||||
*(.hash)
|
||||
*(.comment)
|
||||
}
|
||||
}
|
@@ -419,7 +419,6 @@
|
||||
|
||||
<OutputFile>
|
||||
$(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.aml
|
||||
$(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.amli
|
||||
|
||||
<ExtraDependency>
|
||||
$(MAKE_FILE)
|
||||
@@ -429,24 +428,14 @@
|
||||
"$(ASLPP)" $(DEPS_FLAGS) $(ASLPP_FLAGS) $(INC) /I${s_path} $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.i > $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iii
|
||||
Trim --source-code -l -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iiii $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iii
|
||||
"$(ASL)" $(ASL_FLAGS) $(ASL_OUTFLAGS)${dst} $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iiii
|
||||
$(CP) $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.aml $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.amli
|
||||
-AmlToHex $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.aml
|
||||
|
||||
<Command.GCC>
|
||||
Trim --asl-file --asl-deps -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.i -i $(INC_LIST) ${src}
|
||||
"$(ASLPP)" $(DEPS_FLAGS) $(ASLPP_FLAGS) $(INC) -I${s_path} $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.i > $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iii
|
||||
Trim --source-code -l -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iiii $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iii
|
||||
"$(ASL)" $(ASL_FLAGS) $(ASL_OUTFLAGS)${dst} $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iiii
|
||||
$(CP) $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.aml $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.amli
|
||||
|
||||
[Acpi-Machine-Language-File-to-C.DXE_DRIVER]
|
||||
<InputFile>
|
||||
?.amli
|
||||
|
||||
<OutputFile>
|
||||
${s_path}(+)${s_base}.c
|
||||
|
||||
<Command>
|
||||
-AmlToC ${src}
|
||||
-AmlToHex $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.aml
|
||||
|
||||
[C-Code-File.AcpiTable]
|
||||
<InputFile>
|
||||
|
@@ -1952,7 +1952,7 @@ DEFINE GCC_RISCV64_RC_FLAGS = -I binary -O elf64-littleriscv -B riscv
|
||||
# GCC Build Flag for included header file list generation
|
||||
DEFINE GCC_DEPS_FLAGS = -MMD -MF $@.deps
|
||||
|
||||
DEFINE GCC48_ALL_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -ffunction-sections -fdata-sections -DSTRING_ARRAY_NAME=$(BASE_NAME)Strings
|
||||
DEFINE GCC48_ALL_CC_FLAGS = -g -fshort-wchar -fno-builtin -fno-strict-aliasing -Wall -Werror -Wno-array-bounds -ffunction-sections -fdata-sections -include AutoGen.h -fno-common -DSTRING_ARRAY_NAME=$(BASE_NAME)Strings
|
||||
DEFINE GCC48_IA32_X64_DLINK_COMMON = -nostdlib -Wl,-n,-q,--gc-sections -z common-page-size=0x20
|
||||
DEFINE GCC48_IA32_CC_FLAGS = DEF(GCC48_ALL_CC_FLAGS) -m32 -march=i586 -malign-double -fno-stack-protector -D EFI32 -fno-asynchronous-unwind-tables -Wno-address
|
||||
DEFINE GCC48_X64_CC_FLAGS = DEF(GCC48_ALL_CC_FLAGS) -m64 -fno-stack-protector "-DEFIAPI=__attribute__((ms_abi))" -maccumulate-outgoing-args -mno-red-zone -Wno-address -mcmodel=small -fpie -fno-asynchronous-unwind-tables -Wno-address
|
||||
@@ -2037,7 +2037,6 @@ DEFINE GCC5_RISCV64_CC_FLAGS = DEF(GCC5_RISCV_ALL_CC_FLAGS) DEF(GC
|
||||
DEFINE GCC5_RISCV64_DLINK_FLAGS = DEF(GCC5_RISCV_ALL_DLINK_FLAGS) -Wl,-melf64lriscv,--oformat=elf64-littleriscv,--no-relax
|
||||
DEFINE GCC5_RISCV64_DLINK2_FLAGS = DEF(GCC5_RISCV_ALL_DLINK2_FLAGS)
|
||||
DEFINE GCC5_RISCV64_ASM_FLAGS = DEF(GCC5_RISCV_ALL_ASM_FLAGS) -march=DEF(GCC5_RISCV64_ARCH) -mcmodel=medany -mabi=lp64
|
||||
DEFINE GCC_PP_FLAGS = -E -x assembler-with-cpp -include AutoGen.h DEF(GCC5_RISCV_OPENSBI_TYPES)
|
||||
|
||||
####################################################################################
|
||||
#
|
||||
|
@@ -1,41 +0,0 @@
|
||||
This directory contains the EDK II build tools and template files.
|
||||
Templates are located in the Conf directory, while the tools executables for
|
||||
Microsoft Windows Operating Systems are located in the Bin\\Win32 directory, other
|
||||
directory contains tools source.
|
||||
|
||||
Build step to generate the binary tools
|
||||
---------------------------------------
|
||||
|
||||
Windows/Visual Studio Notes
|
||||
===========================
|
||||
|
||||
To build the BaseTools, you should run the standard vsvars32.bat script
|
||||
from your preferred Visual Studio installation or you can run get_vsvars.bat
|
||||
to use latest automatically detected version.
|
||||
|
||||
In addition to this, you should set the following environment variables::
|
||||
|
||||
* EDK_TOOLS_PATH - Path to the BaseTools sub directory under the edk2 tree
|
||||
* BASE_TOOLS_PATH - The directory where the BaseTools source is located.
|
||||
(It is the same directory where this README.rst is located.)
|
||||
|
||||
After this, you can run the toolsetup.bat file, which is in the same
|
||||
directory as this file. It should setup the remainder of the environment,
|
||||
and build the tools if necessary.
|
||||
|
||||
Please also refer to the ``BuildNotes.txt`` file for more information on
|
||||
building under Windows.
|
||||
|
||||
Unix-like operating systems
|
||||
===========================
|
||||
|
||||
To build on Unix-like operating systems, you only need to type ``make`` in
|
||||
the base directory of the project.
|
||||
|
||||
Ubuntu Notes
|
||||
============
|
||||
|
||||
On Ubuntu, the following command should install all the necessary build
|
||||
packages to build all the C BaseTools::
|
||||
|
||||
sudo apt install build-essential uuid-dev
|
47
BaseTools/ReadMe.txt
Normal file
47
BaseTools/ReadMe.txt
Normal file
@@ -0,0 +1,47 @@
|
||||
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
|
||||
Microsoft Windows 32-bit Operating Systems are located in the Bin\Win32 directory, other
|
||||
directory contains tools source.
|
||||
|
||||
1. Build step to generate the binary tools.
|
||||
|
||||
=== Windows/Visual Studio Notes ===
|
||||
|
||||
To build the BaseTools, you should run the standard vsvars32.bat script
|
||||
from your preferred Visual Studio installation or you can run get_vsvars.bat
|
||||
to use latest automatically detected version.
|
||||
|
||||
In addition to this, you should set the following environment variables:
|
||||
|
||||
* EDK_TOOLS_PATH - Path to the BaseTools sub directory under the edk2 tree
|
||||
* BASE_TOOLS_PATH - The directory where the BaseTools source is located.
|
||||
(It is the same directory where this README.txt is located.)
|
||||
|
||||
After this, you can run the toolsetup.bat file, which is in the same
|
||||
directory as this file. It should setup the remainder of the environment,
|
||||
and build the tools if necessary.
|
||||
|
||||
Please also refer to the 'BuildNotes.txt' file for more information on
|
||||
building under Windows.
|
||||
|
||||
=== Unix-like operating systems ===
|
||||
|
||||
To build on Unix-like operating systems, you only need to type 'make' in
|
||||
the base directory of the project.
|
||||
|
||||
=== Ubuntu Notes ===
|
||||
|
||||
On Ubuntu, the following command should install all the necessary build
|
||||
packages to build all the C BaseTools:
|
||||
|
||||
sudo apt-get install build-essential uuid-dev
|
||||
|
||||
=== Python sqlite3 module ===
|
||||
On Windows, the cx_freeze will not copy the sqlite3.dll to the frozen
|
||||
binary directory (the same directory as build.exe and GenFds.exe).
|
||||
Please copy it manually from <PythonHome>\DLLs.
|
||||
|
||||
The Python distributed with most recent Linux will have sqlite3 module
|
||||
built in. If not, please install sqlit3 package separately.
|
||||
|
||||
26-OCT-2011
|
@@ -3,7 +3,6 @@
|
||||
#
|
||||
# Copyright (c) 2015 - 2020, Intel Corporation. All rights reserved.<BR>
|
||||
# Copyright (C) 2020, Red Hat, Inc.<BR>
|
||||
# Copyright (c) 2020, ARM Ltd. All rights reserved.<BR>
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#
|
||||
@@ -20,8 +19,6 @@ import re
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
import email.header
|
||||
|
||||
class Verbose:
|
||||
SILENT, ONELINE, NORMAL = range(3)
|
||||
level = NORMAL
|
||||
@@ -268,14 +265,7 @@ class CommitMessageCheck:
|
||||
for i in range(2, count):
|
||||
if (len(lines[i]) >= 76 and
|
||||
len(lines[i].split()) > 1 and
|
||||
not lines[i].startswith('git-svn-id:') and
|
||||
not lines[i].startswith('Reviewed-by') and
|
||||
not lines[i].startswith('Acked-by:') and
|
||||
not lines[i].startswith('Tested-by:') and
|
||||
not lines[i].startswith('Reported-by:') and
|
||||
not lines[i].startswith('Suggested-by:') and
|
||||
not lines[i].startswith('Signed-off-by:') and
|
||||
not lines[i].startswith('Cc:')):
|
||||
not lines[i].startswith('git-svn-id:')):
|
||||
#
|
||||
# Print a warning if body line is longer than 75 characters
|
||||
#
|
||||
@@ -357,22 +347,16 @@ class GitDiffCheck:
|
||||
self.is_newfile = False
|
||||
self.force_crlf = True
|
||||
self.force_notabs = True
|
||||
if self.filename.endswith('.sh') or \
|
||||
self.filename.startswith('BaseTools/BinWrappers/PosixLike/') or \
|
||||
self.filename.startswith('BaseTools/Bin/CYGWIN_NT-5.1-i686/') or \
|
||||
self.filename == 'BaseTools/BuildEnv':
|
||||
if self.filename.endswith('.sh'):
|
||||
#
|
||||
# Do not enforce CR/LF line endings for linux shell scripts.
|
||||
# Some linux shell scripts don't end with the ".sh" extension,
|
||||
# they are identified by their path.
|
||||
#
|
||||
self.force_crlf = False
|
||||
if self.filename == '.gitmodules' or \
|
||||
self.filename == 'BaseTools/Conf/diff.order':
|
||||
if self.filename == '.gitmodules':
|
||||
#
|
||||
# .gitmodules and diff orderfiles are used internally by git
|
||||
# use tabs and LF line endings. Do not enforce no tabs and
|
||||
# do not enforce CR/LF line endings.
|
||||
# .gitmodules is updated by git and uses tabs and LF line
|
||||
# endings. Do not enforce no tabs and do not enforce
|
||||
# CR/LF line endings.
|
||||
#
|
||||
self.force_crlf = False
|
||||
self.force_notabs = False
|
||||
@@ -465,7 +449,7 @@ class GitDiffCheck:
|
||||
|
||||
stripped = line.rstrip()
|
||||
|
||||
if self.force_crlf and eol != '\r\n' and (line.find('Subproject commit') == -1):
|
||||
if self.force_crlf and eol != '\r\n':
|
||||
self.added_line_error('Line ending (%s) is not CRLF' % repr(eol),
|
||||
line)
|
||||
if self.force_notabs and '\t' in line:
|
||||
|
@@ -127,7 +127,10 @@ PeCoffLoaderRelocateRiscVImage (
|
||||
{
|
||||
UINT32 Value;
|
||||
UINT32 Value2;
|
||||
UINT32 OrgValue;
|
||||
|
||||
OrgValue = *(UINT32 *) Fixup;
|
||||
OrgValue = OrgValue;
|
||||
switch ((*Reloc) >> 12) {
|
||||
case EFI_IMAGE_REL_BASED_RISCV_HI20:
|
||||
RiscVHi20Fixup = (UINT32 *) Fixup;
|
||||
|
@@ -3140,7 +3140,6 @@ Returns:
|
||||
--*/
|
||||
{
|
||||
UINTN CurrentOffset;
|
||||
UINTN OrigOffset;
|
||||
UINTN Index;
|
||||
FILE *fpin;
|
||||
UINTN FfsFileSize;
|
||||
@@ -3149,10 +3148,8 @@ Returns:
|
||||
UINT32 FfsHeaderSize;
|
||||
EFI_FFS_FILE_HEADER FfsHeader;
|
||||
UINTN VtfFileSize;
|
||||
UINTN MaxPadFileSize;
|
||||
|
||||
FvExtendHeaderSize = 0;
|
||||
MaxPadFileSize = 0;
|
||||
VtfFileSize = 0;
|
||||
fpin = NULL;
|
||||
Index = 0;
|
||||
@@ -3261,12 +3258,8 @@ Returns:
|
||||
//
|
||||
// Only EFI_FFS_FILE_HEADER is needed for a pad section.
|
||||
//
|
||||
OrigOffset = CurrentOffset;
|
||||
CurrentOffset = (CurrentOffset + FfsHeaderSize + sizeof(EFI_FFS_FILE_HEADER) + FfsAlignment - 1) & ~(FfsAlignment - 1);
|
||||
CurrentOffset -= FfsHeaderSize;
|
||||
if ((CurrentOffset - OrigOffset) > MaxPadFileSize) {
|
||||
MaxPadFileSize = CurrentOffset - OrigOffset;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3310,12 +3303,6 @@ Returns:
|
||||
//
|
||||
mFvTotalSize = FvInfoPtr->Size;
|
||||
mFvTakenSize = CurrentOffset;
|
||||
if ((mFvTakenSize == mFvTotalSize) && (MaxPadFileSize > 0)) {
|
||||
//
|
||||
// This FV means TOP FFS has been taken. Then, check whether there is padding data for use.
|
||||
//
|
||||
mFvTakenSize = mFvTakenSize - MaxPadFileSize;
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
@@ -177,7 +177,7 @@ Returns:
|
||||
fprintf (stdout, " -l GuidHeaderLength, --HeaderLength GuidHeaderLength\n\
|
||||
GuidHeaderLength is the size of header of guided data\n");
|
||||
fprintf (stdout, " -r GuidAttr, --attributes GuidAttr\n\
|
||||
GuidAttr is guid section attributes, which may be\n\
|
||||
GuidAttr is guid section atttributes, which may be\n\
|
||||
PROCESSING_REQUIRED, AUTH_STATUS_VALID and NONE. \n\
|
||||
if -r option is not given, default PROCESSING_REQUIRED\n");
|
||||
fprintf (stdout, " -n String, --name String\n\
|
||||
|
@@ -38,19 +38,12 @@ endif
|
||||
CYGWIN:=$(findstring CYGWIN, $(shell uname -s))
|
||||
LINUX:=$(findstring Linux, $(shell uname -s))
|
||||
DARWIN:=$(findstring Darwin, $(shell uname -s))
|
||||
ifeq ($(CXX), llvm)
|
||||
BUILD_CC ?= $(CLANG_BIN)clang
|
||||
BUILD_CXX ?= $(CLANG_BIN)clang++
|
||||
BUILD_AS ?= $(CLANG_BIN)clang
|
||||
BUILD_AR ?= $(CLANG_BIN)llvm-ar
|
||||
BUILD_LD ?= $(CLANG_BIN)llvm-ld
|
||||
else
|
||||
|
||||
BUILD_CC ?= gcc
|
||||
BUILD_CXX ?= g++
|
||||
BUILD_AS ?= gcc
|
||||
BUILD_AR ?= ar
|
||||
BUILD_LD ?= ld
|
||||
endif
|
||||
LINKER ?= $(BUILD_CC)
|
||||
ifeq ($(HOST_ARCH), IA32)
|
||||
ARCH_INCLUDE = -I $(MAKEROOT)/Include/Ia32/
|
||||
@@ -79,25 +72,14 @@ ifeq ($(DARWIN),Darwin)
|
||||
BUILD_CFLAGS = -MD -fshort-wchar -fno-strict-aliasing -Wall -Werror \
|
||||
-Wno-deprecated-declarations -Wno-self-assign -Wno-unused-result -nostdlib -g
|
||||
else
|
||||
ifeq ($(CXX), llvm)
|
||||
BUILD_CFLAGS = -MD -fshort-wchar -fno-strict-aliasing -fwrapv \
|
||||
-fno-delete-null-pointer-checks -Wall -Werror \
|
||||
-Wno-deprecated-declarations -Wno-self-assign \
|
||||
-Wno-unused-result -nostdlib -g
|
||||
else
|
||||
BUILD_CFLAGS = -MD -fshort-wchar -fno-strict-aliasing -fwrapv \
|
||||
-fno-delete-null-pointer-checks -Wall -Werror \
|
||||
-Wno-deprecated-declarations -Wno-stringop-truncation -Wno-restrict \
|
||||
-Wno-unused-result -nostdlib -g
|
||||
endif
|
||||
endif
|
||||
ifeq ($(CXX), llvm)
|
||||
BUILD_LFLAGS =
|
||||
BUILD_CXXFLAGS = -Wno-deprecated-register -Wno-unused-result
|
||||
else
|
||||
BUILD_LFLAGS =
|
||||
BUILD_CXXFLAGS = -Wno-unused-result
|
||||
endif
|
||||
|
||||
ifeq ($(HOST_ARCH), IA32)
|
||||
#
|
||||
# Snow Leopard is a 32-bit and 64-bit environment. uname -m returns i386, but gcc defaults
|
||||
|
@@ -16,11 +16,9 @@ TOOL_INCLUDE = -I Pccts/h
|
||||
#OBJECTS = VfrSyntax.o VfrServices.o DLGLexer.o EfiVfrParser.o ATokenBuffer.o DLexerBase.o AParser.o
|
||||
OBJECTS = AParser.o DLexerBase.o ATokenBuffer.o EfiVfrParser.o VfrLexer.o VfrSyntax.o \
|
||||
VfrFormPkg.o VfrError.o VfrUtilityLib.o VfrCompiler.o
|
||||
ifeq ($(CXX), llvm)
|
||||
VFR_CPPFLAGS = -Wno-deprecated-register -DPCCTS_USE_NAMESPACE_STD $(BUILD_CPPFLAGS)
|
||||
else
|
||||
|
||||
VFR_CPPFLAGS = -DPCCTS_USE_NAMESPACE_STD $(BUILD_CPPFLAGS)
|
||||
endif
|
||||
|
||||
# keep BUILD_OPTFLAGS last
|
||||
VFR_CXXFLAGS = $(BUILD_OPTFLAGS)
|
||||
|
||||
|
@@ -164,11 +164,7 @@ PCCTS_H=../h
|
||||
#
|
||||
# UNIX (default)
|
||||
#
|
||||
ifeq ($(CXX), llvm)
|
||||
BUILD_CC?=$(CLANG_BIN)clang
|
||||
else
|
||||
BUILD_CC?=gcc
|
||||
endif
|
||||
COPT=-O
|
||||
ANTLR=${BIN_DIR}/antlr
|
||||
DLG=${BIN_DIR}/dlg
|
||||
|
@@ -114,11 +114,7 @@ PCCTS_H=../h
|
||||
#
|
||||
# UNIX
|
||||
#
|
||||
ifeq ($(CXX), llvm)
|
||||
BUILD_CC?=$(CLANG_BIN)clang
|
||||
else
|
||||
BUILD_CC?=cc
|
||||
endif
|
||||
COPT=-O
|
||||
ANTLR=${BIN_DIR}/antlr
|
||||
DLG=${BIN_DIR}/dlg
|
||||
|
@@ -1077,7 +1077,7 @@ Returns:
|
||||
}
|
||||
|
||||
if (VolumeHeader.FvLength != Size) {
|
||||
printf ("ERROR: Volume Size not consistent with Block Maps!\n");
|
||||
printf ("ERROR: Volume Size not consistant with Block Maps!\n");
|
||||
return EFI_ABORTED;
|
||||
}
|
||||
|
||||
|
@@ -1,9 +1,9 @@
|
||||
## @file
|
||||
#
|
||||
# Convert an AML file to a .c file containing the AML bytecode stored in a
|
||||
# Convert an AML file to a .hex file containing the AML bytecode stored in a
|
||||
# C array.
|
||||
# By default, "Tables\Dsdt.aml" will generate "Tables\Dsdt.c".
|
||||
# "Tables\Dsdt.c" will contain a C array named "dsdt_aml_code" that contains
|
||||
# By default, "Tables\Dsdt.aml" will generate "Tables\Dsdt.hex".
|
||||
# "Tables\Dsdt.hex" will contain a C array named "dsdt_aml_code" that contains
|
||||
# the AML bytecode.
|
||||
#
|
||||
# Copyright (c) 2020, ARM Limited. All rights reserved.<BR>
|
||||
@@ -17,26 +17,31 @@ from Common.BuildToolError import *
|
||||
import sys
|
||||
import os
|
||||
|
||||
__description__ = """
|
||||
Convert an AML file to a .c file containing the AML bytecode stored in a C
|
||||
array. By default, Tables\Dsdt.aml will generate Tables\Dsdt.c.
|
||||
Tables\Dsdt.c will contain a C array named "dsdt_aml_code" that contains
|
||||
the AML bytecode.
|
||||
"""
|
||||
|
||||
## Parse the command line arguments.
|
||||
#
|
||||
# @retval A argparse.NameSpace instance, containing parsed values.
|
||||
#
|
||||
def ParseArgs():
|
||||
# Initialize the parser.
|
||||
Parser = argparse.ArgumentParser(description=__description__)
|
||||
Parser = argparse.ArgumentParser(
|
||||
description="Convert an AML file to a .hex file containing the AML " + \
|
||||
"bytecode stored in a C array. By default, " + \
|
||||
"\"Tables\\Dsdt.aml\" will generate" + \
|
||||
"\"Tables\\Dsdt.hex\". \"Tables\\Dsdt.hex\" will " + \
|
||||
"contain a C array named \"dsdt_aml_code\" that " + \
|
||||
"contains the AML bytecode."
|
||||
)
|
||||
|
||||
# Define the possible arguments.
|
||||
Parser.add_argument(dest="InputFile",
|
||||
help="Path to an input AML file to generate a .c file from.")
|
||||
Parser.add_argument("-o", "--out-dir", dest="OutDir",
|
||||
help="Output directory where the .c file will be generated. Default is the input file's directory.")
|
||||
Parser.add_argument(
|
||||
dest="InputFile",
|
||||
help="Path to an input AML file to generate a .hex file from."
|
||||
)
|
||||
Parser.add_argument(
|
||||
"-o", "--out-dir", dest="OutDir",
|
||||
help="Output directory where the .hex file will be generated. " + \
|
||||
"Default is the input file's directory."
|
||||
)
|
||||
|
||||
# Parse the input arguments.
|
||||
Args = Parser.parse_args()
|
||||
@@ -50,7 +55,9 @@ def ParseArgs():
|
||||
with open(Args.InputFile, "rb") as fIn:
|
||||
Signature = str(fIn.read(4))
|
||||
if ("DSDT" not in Signature) and ("SSDT" not in Signature):
|
||||
EdkLogger.info("Invalid file type. File does not have a valid DSDT or SSDT signature: {}".format(Args.InputFile))
|
||||
EdkLogger.info("Invalid file type. " + \
|
||||
"File does not have a valid " + \
|
||||
"DSDT or SSDT signature: %s" % Args.InputFile)
|
||||
return None
|
||||
|
||||
# Get the basename of the input file.
|
||||
@@ -59,39 +66,42 @@ def ParseArgs():
|
||||
|
||||
# If no output directory is specified, output to the input directory.
|
||||
if not Args.OutDir:
|
||||
Args.OutputFile = os.path.join(os.path.dirname(Args.InputFile),
|
||||
BaseName + ".c")
|
||||
Args.OutputFile = os.path.join(
|
||||
os.path.dirname(Args.InputFile),
|
||||
BaseName + ".hex"
|
||||
)
|
||||
else:
|
||||
if not os.path.exists(Args.OutDir):
|
||||
os.mkdir(Args.OutDir)
|
||||
Args.OutputFile = os.path.join(Args.OutDir, BaseName + ".c")
|
||||
Args.OutputFile = os.path.join(Args.OutDir, BaseName + ".hex")
|
||||
|
||||
Args.BaseName = BaseName
|
||||
|
||||
return Args
|
||||
|
||||
## Convert an AML file to a .c file containing the AML bytecode stored
|
||||
## Convert an AML file to a .hex file containing the AML bytecode stored
|
||||
# in a C array.
|
||||
#
|
||||
# @param InputFile Path to the input AML file.
|
||||
# @param OutputFile Path to the output .c file to generate.
|
||||
# @param OutputFile Path to the output .hex file to generate.
|
||||
# @param BaseName Base name of the input file.
|
||||
# This is also the name of the generated .c file.
|
||||
# This is also the name of the generated .hex file.
|
||||
#
|
||||
def AmlToC(InputFile, OutputFile, BaseName):
|
||||
def AmlToHex(InputFile, OutputFile, BaseName):
|
||||
|
||||
MacroName = "__{}_HEX__".format(BaseName.upper())
|
||||
ArrayName = BaseName.lower() + "_aml_code"
|
||||
FileHeader =\
|
||||
"""
|
||||
// This file has been generated from:
|
||||
// -Python script: {}
|
||||
// -Input AML file: {}
|
||||
|
||||
"""
|
||||
|
||||
with open(InputFile, "rb") as fIn, open(OutputFile, "w") as fOut:
|
||||
# Write header.
|
||||
fOut.write(FileHeader.format(os.path.abspath(InputFile), os.path.abspath(__file__)))
|
||||
fOut.write("// This file has been generated from:\n" + \
|
||||
"// \tPython script: " + \
|
||||
os.path.abspath(__file__) + "\n" + \
|
||||
"// \tInput AML file: " + \
|
||||
os.path.abspath(InputFile) + "\n\n" + \
|
||||
"#ifndef {}\n".format(MacroName) + \
|
||||
"#define {}\n\n".format(MacroName)
|
||||
)
|
||||
|
||||
# Write the array and its content.
|
||||
fOut.write("unsigned char {}[] = {{\n ".format(ArrayName))
|
||||
@@ -105,12 +115,15 @@ def AmlToC(InputFile, OutputFile, BaseName):
|
||||
byte = fIn.read(1)
|
||||
fOut.write("\n};\n")
|
||||
|
||||
# Write footer.
|
||||
fOut.write("#endif // {}\n".format(MacroName))
|
||||
|
||||
## Main method
|
||||
#
|
||||
# This method:
|
||||
# 1- Initialize an EdkLogger instance.
|
||||
# 2- Parses the input arguments.
|
||||
# 3- Converts an AML file to a .c file containing the AML bytecode stored
|
||||
# 3- Converts an AML file to a .hex file containing the AML bytecode stored
|
||||
# in a C array.
|
||||
#
|
||||
# @retval 0 Success.
|
||||
@@ -126,9 +139,10 @@ def Main():
|
||||
if not CommandArguments:
|
||||
return 1
|
||||
|
||||
# Convert an AML file to a .c file containing the AML bytecode stored
|
||||
# Convert an AML file to a .hex file containing the AML bytecode stored
|
||||
# in a C array.
|
||||
AmlToC(CommandArguments.InputFile, CommandArguments.OutputFile, CommandArguments.BaseName)
|
||||
AmlToHex(CommandArguments.InputFile, CommandArguments.OutputFile,
|
||||
CommandArguments.BaseName)
|
||||
except Exception as e:
|
||||
print(e)
|
||||
return 1
|
@@ -24,7 +24,6 @@ import traceback
|
||||
import sys
|
||||
from AutoGen.DataPipe import MemoryDataPipe
|
||||
import logging
|
||||
import time
|
||||
|
||||
def clearQ(q):
|
||||
try:
|
||||
@@ -112,11 +111,7 @@ class AutoGenManager(threading.Thread):
|
||||
break
|
||||
if badnews == "Done":
|
||||
fin_num += 1
|
||||
elif badnews == "QueueEmpty":
|
||||
EdkLogger.debug(EdkLogger.DEBUG_9, "Worker %s: %s" % (os.getpid(), badnews))
|
||||
self.TerminateWorkers()
|
||||
else:
|
||||
EdkLogger.debug(EdkLogger.DEBUG_9, "Worker %s: %s" % (os.getpid(), badnews))
|
||||
self.Status = False
|
||||
self.TerminateWorkers()
|
||||
if fin_num == len(self.autogen_workers):
|
||||
@@ -232,21 +227,12 @@ class AutoGenWorkerInProcess(mp.Process):
|
||||
PlatformMetaFile = self.GetPlatformMetaFile(self.data_pipe.Get("P_Info").get("ActivePlatform"),
|
||||
self.data_pipe.Get("P_Info").get("WorkspaceDir"))
|
||||
while True:
|
||||
if self.module_queue.empty():
|
||||
break
|
||||
if self.error_event.is_set():
|
||||
break
|
||||
module_count += 1
|
||||
try:
|
||||
module_file,module_root,module_path,module_basename,module_originalpath,module_arch,IsLib = self.module_queue.get_nowait()
|
||||
except Empty:
|
||||
EdkLogger.debug(EdkLogger.DEBUG_9, "Worker %s: %s" % (os.getpid(), "Fake Empty."))
|
||||
time.sleep(0.01)
|
||||
continue
|
||||
if module_file is None:
|
||||
EdkLogger.debug(EdkLogger.DEBUG_9, "Worker %s: %s" % (os.getpid(), "Worker get the last item in the queue."))
|
||||
self.feedback_q.put("QueueEmpty")
|
||||
time.sleep(0.01)
|
||||
continue
|
||||
|
||||
module_file,module_root,module_path,module_basename,module_originalpath,module_arch,IsLib = self.module_queue.get_nowait()
|
||||
modulefullpath = os.path.join(module_root,module_file)
|
||||
taskname = " : ".join((modulefullpath,module_arch))
|
||||
module_metafile = PathClass(module_file,module_root)
|
||||
@@ -280,7 +266,7 @@ class AutoGenWorkerInProcess(mp.Process):
|
||||
|
||||
Ma.CreateCodeFile(False)
|
||||
Ma.CreateMakeFile(False,GenFfsList=FfsCmd.get((Ma.MetaFile.Path, Ma.Arch),[]))
|
||||
Ma.CreateAsBuiltInf()
|
||||
|
||||
if GlobalData.gBinCacheSource and CommandTarget in [None, "", "all"]:
|
||||
try:
|
||||
CacheResult = Ma.CanSkipbyMakeCache()
|
||||
@@ -294,11 +280,11 @@ class AutoGenWorkerInProcess(mp.Process):
|
||||
else:
|
||||
self.cache_q.put((Ma.MetaFile.Path, Ma.Arch, "MakeCache", False))
|
||||
|
||||
except Exception as e:
|
||||
EdkLogger.debug(EdkLogger.DEBUG_9, "Worker %s: %s" % (os.getpid(), str(e)))
|
||||
except Empty:
|
||||
pass
|
||||
except:
|
||||
self.feedback_q.put(taskname)
|
||||
finally:
|
||||
EdkLogger.debug(EdkLogger.DEBUG_9, "Worker %s: %s" % (os.getpid(), "Done"))
|
||||
self.feedback_q.put("Done")
|
||||
self.cache_q.put("CacheDone")
|
||||
|
||||
|
@@ -172,7 +172,7 @@ class FileBuildRule:
|
||||
def __str__(self):
|
||||
SourceString = ""
|
||||
SourceString += " %s %s %s" % (self.SourceFileType, " ".join(self.SourceFileExtList), self.ExtraSourceFileList)
|
||||
DestString = ", ".join([str(i) for i in self.DestFileList])
|
||||
DestString = ", ".join(self.DestFileList)
|
||||
CommandString = "\n\t".join(self.CommandList)
|
||||
return "%s : %s\n\t%s" % (DestString, SourceString, CommandString)
|
||||
|
||||
|
@@ -1054,12 +1054,6 @@ cleanlib:
|
||||
TargetDict = {"target": self.PlaceMacro(T.Target.Path, self.Macros), "cmd": "\n\t".join(T.Commands),"deps": Deps}
|
||||
self.BuildTargetList.append(self._BUILD_TARGET_TEMPLATE.Replace(TargetDict))
|
||||
|
||||
# Add a Makefile rule for targets generating multiple files.
|
||||
# The main output is a prerequisite for the other output files.
|
||||
for i in T.Outputs[1:]:
|
||||
AnnexeTargetDict = {"target": self.PlaceMacro(i.Path, self.Macros), "cmd": "", "deps": self.PlaceMacro(T.Target.Path, self.Macros)}
|
||||
self.BuildTargetList.append(self._BUILD_TARGET_TEMPLATE.Replace(AnnexeTargetDict))
|
||||
|
||||
def ParserCCodeFile(self, T, Type, CmdSumDict, CmdTargetDict, CmdCppDict, DependencyDict):
|
||||
if not CmdSumDict:
|
||||
for item in self._AutoGenObject.Targets[Type]:
|
||||
|
@@ -860,8 +860,7 @@ class ModuleAutoGen(AutoGen):
|
||||
SubDirectory = os.path.join(self.OutputDir, File.SubDir)
|
||||
if not os.path.exists(SubDirectory):
|
||||
CreateDirectory(SubDirectory)
|
||||
TargetList = set()
|
||||
FinalTargetName = set()
|
||||
LastTarget = None
|
||||
RuleChain = set()
|
||||
SourceList = [File]
|
||||
Index = 0
|
||||
@@ -871,9 +870,6 @@ class ModuleAutoGen(AutoGen):
|
||||
self.BuildOption
|
||||
|
||||
while Index < len(SourceList):
|
||||
# Reset the FileType if not the first iteration.
|
||||
if Index > 0:
|
||||
FileType = TAB_UNKNOWN_FILE
|
||||
Source = SourceList[Index]
|
||||
Index = Index + 1
|
||||
|
||||
@@ -890,25 +886,29 @@ class ModuleAutoGen(AutoGen):
|
||||
elif Source.Ext in self.BuildRules:
|
||||
RuleObject = self.BuildRules[Source.Ext]
|
||||
else:
|
||||
# No more rule to apply: Source is a final target.
|
||||
FinalTargetName.add(Source)
|
||||
continue
|
||||
# stop at no more rules
|
||||
if LastTarget:
|
||||
self._FinalBuildTargetList.add(LastTarget)
|
||||
break
|
||||
|
||||
FileType = RuleObject.SourceFileType
|
||||
self._FileTypes[FileType].add(Source)
|
||||
|
||||
# stop at STATIC_LIBRARY for library
|
||||
if self.IsLibrary and FileType == TAB_STATIC_LIBRARY:
|
||||
FinalTargetName.add(Source)
|
||||
continue
|
||||
if LastTarget:
|
||||
self._FinalBuildTargetList.add(LastTarget)
|
||||
break
|
||||
|
||||
Target = RuleObject.Apply(Source, self.BuildRuleOrder)
|
||||
if not Target:
|
||||
# No Target: Source is a final target.
|
||||
FinalTargetName.add(Source)
|
||||
continue
|
||||
if LastTarget:
|
||||
self._FinalBuildTargetList.add(LastTarget)
|
||||
break
|
||||
elif not Target.Outputs:
|
||||
# Only do build for target with outputs
|
||||
self._FinalBuildTargetList.add(Target)
|
||||
|
||||
TargetList.add(Target)
|
||||
self._BuildTargets[FileType].add(Target)
|
||||
|
||||
if not Source.IsBinary and Source == File:
|
||||
@@ -916,16 +916,12 @@ class ModuleAutoGen(AutoGen):
|
||||
|
||||
# to avoid cyclic rule
|
||||
if FileType in RuleChain:
|
||||
EdkLogger.error("build", ERROR_STATEMENT, "Cyclic dependency detected while generating rule for %s" % str(Source))
|
||||
break
|
||||
|
||||
RuleChain.add(FileType)
|
||||
SourceList.extend(Target.Outputs)
|
||||
|
||||
# For each final target name, retrieve the corresponding TargetDescBlock instance.
|
||||
for FTargetName in FinalTargetName:
|
||||
for Target in TargetList:
|
||||
if FTargetName == Target.Target:
|
||||
self._FinalBuildTargetList.add(Target)
|
||||
LastTarget = Target
|
||||
FileType = TAB_UNKNOWN_FILE
|
||||
|
||||
@cached_property
|
||||
def Targets(self):
|
||||
|
@@ -108,10 +108,6 @@ class WorkspaceAutoGen(AutoGen):
|
||||
#
|
||||
# Mark now build in AutoGen Phase
|
||||
#
|
||||
#
|
||||
# Collect Platform Guids to support Guid name in Fdfparser.
|
||||
#
|
||||
self.CollectPlatformGuids()
|
||||
GlobalData.gAutoGenPhase = True
|
||||
self.ProcessModuleFromPdf()
|
||||
self.ProcessPcdType()
|
||||
@@ -157,26 +153,6 @@ class WorkspaceAutoGen(AutoGen):
|
||||
EdkLogger.error("build", PARAMETER_INVALID,
|
||||
ExtraData="Build target [%s] is not supported by the platform. [Valid target: %s]"
|
||||
% (self.BuildTarget, " ".join(self.Platform.BuildTargets)))
|
||||
|
||||
def CollectPlatformGuids(self):
|
||||
oriInfList = []
|
||||
oriPkgSet = set()
|
||||
PlatformPkg = set()
|
||||
for Arch in self.ArchList:
|
||||
Platform = self.BuildDatabase[self.MetaFile, Arch, self.BuildTarget, self.ToolChain]
|
||||
oriInfList = Platform.Modules
|
||||
for ModuleFile in oriInfList:
|
||||
ModuleData = self.BuildDatabase[ModuleFile, Platform._Arch, Platform._Target, Platform._Toolchain]
|
||||
oriPkgSet.update(ModuleData.Packages)
|
||||
for Pkg in oriPkgSet:
|
||||
Guids = Pkg.Guids
|
||||
GlobalData.gGuidDict.update(Guids)
|
||||
if Platform.Packages:
|
||||
PlatformPkg.update(Platform.Packages)
|
||||
for Pkg in PlatformPkg:
|
||||
Guids = Pkg.Guids
|
||||
GlobalData.gGuidDict.update(Guids)
|
||||
|
||||
@cached_property
|
||||
def FdfProfile(self):
|
||||
if not self.FdfFile:
|
||||
|
@@ -29,7 +29,6 @@ gProcessingFile = ''
|
||||
gBuildingModule = ''
|
||||
gSkuids = []
|
||||
gDefaultStores = []
|
||||
gGuidDict = {}
|
||||
|
||||
# definition for a MACRO name. used to create regular expressions below.
|
||||
_MacroNamePattern = "[A-Z][A-Z0-9_]*"
|
||||
|
@@ -1103,11 +1103,11 @@ class Check(object):
|
||||
InfPathList.append(Item[0])
|
||||
SqlCommand = """
|
||||
select ID, Path, FullPath from File where upper(FullPath) not in
|
||||
(select upper(A.Path) || '%s' || upper(B.Value1) from File as A, INF as B
|
||||
(select upper(A.Path) || '\\' || upper(B.Value1) from File as A, INF as B
|
||||
where A.ID in (select BelongsToFile from INF where Model = %s group by BelongsToFile) and
|
||||
B.BelongsToFile = A.ID and B.Model = %s)
|
||||
and (Model = %s or Model = %s)
|
||||
""" % (os.sep, MODEL_EFI_SOURCE_FILE, MODEL_EFI_SOURCE_FILE, MODEL_FILE_C, MODEL_FILE_H)
|
||||
""" % (MODEL_EFI_SOURCE_FILE, MODEL_EFI_SOURCE_FILE, MODEL_FILE_C, MODEL_FILE_H)
|
||||
RecordSet = EccGlobalData.gDb.TblInf.Exec(SqlCommand)
|
||||
for Record in RecordSet:
|
||||
Path = Record[1]
|
||||
@@ -1132,9 +1132,9 @@ class Check(object):
|
||||
BelongsToFile = Pcd[4]
|
||||
SqlCommand = """
|
||||
select ID from File where FullPath in
|
||||
(select B.Path || '%s' || A.Value1 from INF as A, File as B where A.Model = %s and A.BelongsToFile = %s
|
||||
(select B.Path || '\\' || A.Value1 from INF as A, File as B where A.Model = %s and A.BelongsToFile = %s
|
||||
and B.ID = %s and (B.Model = %s or B.Model = %s))
|
||||
""" % (os.sep, MODEL_EFI_SOURCE_FILE, BelongsToFile, BelongsToFile, MODEL_FILE_C, MODEL_FILE_H)
|
||||
""" % (MODEL_EFI_SOURCE_FILE, BelongsToFile, BelongsToFile, MODEL_FILE_C, MODEL_FILE_H)
|
||||
TableSet = EccGlobalData.gDb.TblFile.Exec(SqlCommand)
|
||||
for Tbl in TableSet:
|
||||
TblName = 'Identifier' + str(Tbl[0])
|
||||
|
@@ -268,7 +268,7 @@ class EfiSection (EfiSectionClassObject):
|
||||
else:
|
||||
Align = str (ImageObj.SectionAlignment // 0x100000) + 'M'
|
||||
|
||||
if File[(len(File)-4):] == '.efi' and FfsInf.InfModule.BaseName == os.path.basename(File)[:-4]:
|
||||
if File[(len(File)-4):] == '.efi':
|
||||
MapFile = File.replace('.efi', '.map')
|
||||
CopyMapFile = os.path.join(OutputPath, ModuleName + '.map')
|
||||
if IsMakefile:
|
||||
|
@@ -18,7 +18,7 @@ from uuid import UUID
|
||||
|
||||
from Common.BuildToolError import *
|
||||
from Common import EdkLogger
|
||||
from Common.Misc import PathClass, tdict, ProcessDuplicatedInf, GuidStructureStringToGuidString
|
||||
from Common.Misc import PathClass, tdict, ProcessDuplicatedInf
|
||||
from Common.StringUtils import NormPath, ReplaceMacro
|
||||
from Common import GlobalData
|
||||
from Common.Expression import *
|
||||
@@ -1087,8 +1087,6 @@ class FdfParser:
|
||||
return False
|
||||
if GlobalData.gGuidPattern.match(self._Token) is not None:
|
||||
return True
|
||||
elif self._Token in GlobalData.gGuidDict:
|
||||
return True
|
||||
else:
|
||||
self._UndoToken()
|
||||
return False
|
||||
@@ -2250,8 +2248,6 @@ class FdfParser:
|
||||
|
||||
if not self._GetNextGuid():
|
||||
raise Warning.Expected("GUID value", self.FileName, self.CurrentLineNumber)
|
||||
if self._Token in GlobalData.gGuidDict:
|
||||
self._Token = GuidStructureStringToGuidString(GlobalData.gGuidDict[self._Token]).upper()
|
||||
|
||||
FvObj.FvNameGuid = self._Token
|
||||
|
||||
@@ -2463,8 +2459,6 @@ class FdfParser:
|
||||
raise Warning.ExpectedEquals(self.FileName, self.CurrentLineNumber)
|
||||
if not self._GetNextGuid():
|
||||
raise Warning.Expected("GUID value", self.FileName, self.CurrentLineNumber)
|
||||
if self._Token in GlobalData.gGuidDict:
|
||||
self._Token = GuidStructureStringToGuidString(GlobalData.gGuidDict[self._Token]).upper()
|
||||
FfsInfObj.OverrideGuid = self._Token
|
||||
|
||||
if self._IsKeyword("RuleOverride"):
|
||||
@@ -2556,8 +2550,6 @@ class FdfParser:
|
||||
raise Warning.Expected("')'", self.FileName, self.CurrentLineNumber)
|
||||
self._Token = 'PCD('+PcdPair[1]+TAB_SPLIT+PcdPair[0]+')'
|
||||
|
||||
if self._Token in GlobalData.gGuidDict:
|
||||
self._Token = GuidStructureStringToGuidString(GlobalData.gGuidDict[self._Token]).upper()
|
||||
FfsFileObj.NameGuid = self._Token
|
||||
|
||||
self._GetFilePart(FfsFileObj)
|
||||
@@ -2988,8 +2980,6 @@ class FdfParser:
|
||||
elif self._IsKeyword("GUIDED"):
|
||||
GuidValue = None
|
||||
if self._GetNextGuid():
|
||||
if self._Token in GlobalData.gGuidDict:
|
||||
self._Token = GuidStructureStringToGuidString(GlobalData.gGuidDict[self._Token]).upper()
|
||||
GuidValue = self._Token
|
||||
|
||||
AttribDict = self._GetGuidAttrib()
|
||||
@@ -4059,8 +4049,6 @@ class FdfParser:
|
||||
elif self._IsKeyword("GUIDED"):
|
||||
GuidValue = None
|
||||
if self._GetNextGuid():
|
||||
if self._Token in GlobalData.gGuidDict:
|
||||
self._Token = GuidStructureStringToGuidString(GlobalData.gGuidDict[self._Token]).upper()
|
||||
GuidValue = self._Token
|
||||
|
||||
if self._IsKeyword("$(NAMED_GUID)"):
|
||||
|
@@ -27,10 +27,11 @@ from Common.TargetTxtClassObject import TargetTxtDict
|
||||
from Common.ToolDefClassObject import ToolDefDict
|
||||
from AutoGen.BuildEngine import ToolBuildRule
|
||||
import Common.DataType as DataType
|
||||
from Common.Misc import PathClass
|
||||
from Common.Misc import PathClass,CreateDirectory
|
||||
from Common.LongFilePathSupport import OpenLongFilePath as open
|
||||
from Common.MultipleWorkspace import MultipleWorkspace as mws
|
||||
import Common.GlobalData as GlobalData
|
||||
from Common.BuildToolError import *
|
||||
|
||||
## Global variables
|
||||
#
|
||||
@@ -463,12 +464,28 @@ class GenFdsGlobalVariable:
|
||||
GenFdsGlobalVariable.SecCmdList.append(' '.join(Cmd).strip())
|
||||
else:
|
||||
SectionData = array('B', [0, 0, 0, 0])
|
||||
SectionData.fromstring(Ui.encode("utf_16_le"))
|
||||
SectionData.fromlist(array('B',Ui.encode('utf-16-le')).tolist())
|
||||
SectionData.append(0)
|
||||
SectionData.append(0)
|
||||
Len = len(SectionData)
|
||||
GenFdsGlobalVariable.SectionHeader.pack_into(SectionData, 0, Len & 0xff, (Len >> 8) & 0xff, (Len >> 16) & 0xff, 0x15)
|
||||
SaveFileOnChange(Output, SectionData.tostring())
|
||||
|
||||
|
||||
DirName = os.path.dirname(Output)
|
||||
if not CreateDirectory(DirName):
|
||||
EdkLogger.error(None, FILE_CREATE_FAILURE, "Could not create directory %s" % DirName)
|
||||
else:
|
||||
if DirName == '':
|
||||
DirName = os.getcwd()
|
||||
if not os.access(DirName, os.W_OK):
|
||||
EdkLogger.error(None, PERMISSION_FAILURE, "Do not have write permission on directory %s" % DirName)
|
||||
|
||||
try:
|
||||
with open(Output, "wb") as Fd:
|
||||
SectionData.tofile(Fd)
|
||||
Fd.flush()
|
||||
except IOError as X:
|
||||
EdkLogger.error(None, FILE_CREATE_FAILURE, ExtraData='IOError %s' % X)
|
||||
|
||||
elif Ver:
|
||||
Cmd += ("-n", Ver)
|
||||
|
@@ -281,11 +281,9 @@ def DoInclude(Source, Indent='', IncludePathList=[], LocalSearchPath=None, Inclu
|
||||
F = File.readlines()
|
||||
break
|
||||
else:
|
||||
EdkLogger.warn("Trim", "Failed to find include file %s" % Source)
|
||||
return []
|
||||
EdkLogger.error("Trim", "Failed to find include file %s" % Source)
|
||||
except:
|
||||
EdkLogger.warn("Trim", FILE_OPEN_FAILURE, ExtraData=Source)
|
||||
return []
|
||||
EdkLogger.error("Trim", FILE_OPEN_FAILURE, ExtraData=Source)
|
||||
|
||||
|
||||
# avoid A "include" B and B "include" A
|
||||
|
@@ -46,17 +46,25 @@ class MetaFileTable():
|
||||
self.TableName = "_%s_%s" % (FileType, len(DB.TblFile))
|
||||
|
||||
def IsIntegrity(self):
|
||||
Result = False
|
||||
try:
|
||||
TimeStamp = self.MetaFile.TimeStamp
|
||||
if not self.CurrentContent:
|
||||
Result = False
|
||||
else:
|
||||
Result = self.CurrentContent[-1][0] < 0
|
||||
if not Result:
|
||||
# update the timestamp in database
|
||||
self.DB.SetFileTimeStamp(self.FileId, TimeStamp)
|
||||
return False
|
||||
|
||||
if TimeStamp != self.DB.GetFileTimeStamp(self.FileId):
|
||||
# update the timestamp in database
|
||||
self.DB.SetFileTimeStamp(self.FileId, TimeStamp)
|
||||
return False
|
||||
except Exception as Exc:
|
||||
EdkLogger.debug(EdkLogger.DEBUG_5, str(Exc))
|
||||
return False
|
||||
return Result
|
||||
return True
|
||||
|
||||
def SetEndFlag(self):
|
||||
self.CurrentContent.append(self._DUMMY_)
|
||||
|
@@ -1,7 +1,7 @@
|
||||
## @file
|
||||
# Common routines used by workspace
|
||||
#
|
||||
# Copyright (c) 2012 - 2020, Intel Corporation. All rights reserved.<BR>
|
||||
# Copyright (c) 2012 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#
|
||||
|
||||
@@ -100,7 +100,7 @@ def GetModuleLibInstances(Module, Platform, BuildDatabase, Arch, Target, Toolcha
|
||||
# If a module has a MODULE_TYPE of USER_DEFINED,
|
||||
# do not link in NULL library class instances from the global [LibraryClasses.*] sections.
|
||||
#
|
||||
if Module.ModuleType != SUP_MODULE_USER_DEFINED:
|
||||
if Module.ModuleType != SUP_MODULE_USER_DEFINED and Module.ModuleType != SUP_MODULE_HOST_APPLICATION:
|
||||
for LibraryClass in Platform.LibraryClasses.GetKeys():
|
||||
if LibraryClass.startswith("NULL") and Platform.LibraryClasses[LibraryClass, Module.ModuleType]:
|
||||
Module.LibraryClasses[LibraryClass] = Platform.LibraryClasses[LibraryClass, Module.ModuleType]
|
||||
|
@@ -158,6 +158,12 @@ class WorkspaceDatabase(object):
|
||||
self.BuildObject = WorkspaceDatabase.BuildObjectFactory(self)
|
||||
self.TransformObject = WorkspaceDatabase.TransformObjectFactory(self)
|
||||
|
||||
def SetFileTimeStamp(self,FileId,TimeStamp):
|
||||
self.TblFile[FileId-1][6] = TimeStamp
|
||||
|
||||
def GetFileTimeStamp(self,FileId):
|
||||
return self.TblFile[FileId-1][6]
|
||||
|
||||
|
||||
## Summarize all packages in the database
|
||||
def GetPackageList(self, Platform, Arch, TargetName, ToolChainTag):
|
||||
@@ -187,6 +193,16 @@ class WorkspaceDatabase(object):
|
||||
|
||||
return PackageList
|
||||
|
||||
## Summarize all platforms in the database
|
||||
def PlatformList(self):
|
||||
RetVal = []
|
||||
for PlatformFile in [item[3] for item in self.TblFile if item[5] == MODEL_FILE_DSC]:
|
||||
try:
|
||||
RetVal.append(self.BuildObject[PathClass(PlatformFile), TAB_COMMON])
|
||||
except:
|
||||
pass
|
||||
return RetVal
|
||||
|
||||
def MapPlatform(self, Dscfile):
|
||||
Platform = self.BuildObject[PathClass(Dscfile), TAB_COMMON]
|
||||
if Platform is None:
|
||||
|
@@ -873,17 +873,14 @@ class Build():
|
||||
|
||||
PcdMa.CreateCodeFile(False)
|
||||
PcdMa.CreateMakeFile(False,GenFfsList = DataPipe.Get("FfsCommand").get((PcdMa.MetaFile.Path, PcdMa.Arch),[]))
|
||||
PcdMa.CreateAsBuiltInf()
|
||||
|
||||
# Force cache miss for PCD driver
|
||||
if GlobalData.gBinCacheSource and self.Target in [None, "", "all"]:
|
||||
cqueue.put((PcdMa.MetaFile.Path, PcdMa.Arch, "MakeCache", False))
|
||||
|
||||
self.AutoGenMgr.join()
|
||||
rt = self.AutoGenMgr.Status
|
||||
err = 0
|
||||
if not rt:
|
||||
err = UNKNOWN_ERROR
|
||||
return rt, err
|
||||
return rt, 0
|
||||
except FatalError as e:
|
||||
return False, e.args[0]
|
||||
except:
|
||||
@@ -1217,7 +1214,7 @@ class Build():
|
||||
mqueue = mp.Queue()
|
||||
for m in AutoGenObject.GetAllModuleInfo:
|
||||
mqueue.put(m)
|
||||
mqueue.put((None,None,None,None,None,None,None))
|
||||
|
||||
AutoGenObject.DataPipe.DataContainer = {"CommandTarget": self.Target}
|
||||
AutoGenObject.DataPipe.DataContainer = {"Workspace_timestamp": AutoGenObject.Workspace._SrcTimeStamp}
|
||||
AutoGenObject.CreateLibModuelDirs()
|
||||
@@ -1265,6 +1262,7 @@ class Build():
|
||||
if BuildModule:
|
||||
BuildCommand = BuildCommand + [Target]
|
||||
LaunchCommand(BuildCommand, AutoGenObject.MakeFileDir)
|
||||
self.CreateAsBuiltInf()
|
||||
if GlobalData.gBinCacheDest:
|
||||
self.GenDestCache()
|
||||
elif GlobalData.gUseHashCache and not GlobalData.gBinCacheSource:
|
||||
@@ -2173,7 +2171,6 @@ class Build():
|
||||
data_pipe_file = os.path.join(Pa.BuildDir, "GlobalVar_%s_%s.bin" % (str(Pa.Guid),Pa.Arch))
|
||||
Pa.DataPipe.dump(data_pipe_file)
|
||||
|
||||
mqueue.put((None,None,None,None,None,None,None))
|
||||
autogen_rt, errorcode = self.StartAutoGen(mqueue, Pa.DataPipe, self.SkipAutoGen, PcdMaList, cqueue)
|
||||
|
||||
if not autogen_rt:
|
||||
@@ -2275,6 +2272,7 @@ class Build():
|
||||
#
|
||||
ExitFlag.set()
|
||||
BuildTask.WaitForComplete()
|
||||
self.CreateAsBuiltInf()
|
||||
if GlobalData.gBinCacheDest:
|
||||
self.GenDestCache()
|
||||
elif GlobalData.gUseHashCache and not GlobalData.gBinCacheSource:
|
||||
@@ -2726,3 +2724,4 @@ if __name__ == '__main__':
|
||||
## 0-127 is a safe return range, and 1 is a standard default error
|
||||
if r < 0 or r > 127: r = 1
|
||||
sys.exit(r)
|
||||
|
||||
|
@@ -3,7 +3,7 @@
|
||||
@REM however it may be executed directly from the BaseTools project folder
|
||||
@REM if the file is not executed within a WORKSPACE\BaseTools folder.
|
||||
@REM
|
||||
@REM Copyright (c) 2016-2020, Intel Corporation. All rights reserved.<BR>
|
||||
@REM Copyright (c) 2016-2019, Intel Corporation. All rights reserved.<BR>
|
||||
@REM
|
||||
@REM SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
@REM
|
||||
@@ -108,72 +108,8 @@ if defined VS140COMNTOOLS (
|
||||
)
|
||||
if /I "%1"=="VS2015" goto SetWinDDK
|
||||
|
||||
:SetVS2017
|
||||
if not defined VS150COMNTOOLS (
|
||||
@REM clear two envs so that vcvars32.bat can run successfully.
|
||||
set VSINSTALLDIR=
|
||||
set VCToolsVersion=
|
||||
if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" (
|
||||
if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2017\BuildTools" (
|
||||
call "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -products Microsoft.VisualStudio.Product.BuildTools -version 15,16 > vswhereInfo
|
||||
for /f "usebackq tokens=1* delims=: " %%i in (vswhereInfo) do (
|
||||
if /i "%%i"=="installationPath" call "%%j\VC\Auxiliary\Build\vcvars32.bat"
|
||||
)
|
||||
del vswhereInfo
|
||||
) else (
|
||||
call "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -version 15,16 > vswhereInfo
|
||||
for /f "usebackq tokens=1* delims=: " %%i in (vswhereInfo) do (
|
||||
if /i "%%i"=="installationPath" call "%%j\VC\Auxiliary\Build\vcvars32.bat"
|
||||
)
|
||||
del vswhereInfo
|
||||
)
|
||||
) else if exist "%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe" (
|
||||
if exist "%ProgramFiles%\Microsoft Visual Studio\2017\BuildTools" (
|
||||
call "%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe" -products Microsoft.VisualStudio.Product.BuildTools -version 15,16 > vswhereInfo
|
||||
for /f "usebackq tokens=1* delims=: " %%i in (vswhereInfo) do (
|
||||
if /i "%%i"=="installationPath" call "%%j\VC\Auxiliary\Build\vcvars32.bat"
|
||||
)
|
||||
del vswhereInfo
|
||||
) else (
|
||||
call "%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe" -version 15,16 > vswhereInfo
|
||||
for /f "usebackq tokens=1* delims=: " %%i in (vswhereInfo) do (
|
||||
if /i "%%i"=="installationPath" call "%%j\VC\Auxiliary\Build\vcvars32.bat"
|
||||
)
|
||||
del vswhereInfo
|
||||
)
|
||||
) else (
|
||||
if /I "%1"=="VS2017" goto ToolNotInstall
|
||||
goto SetWinDDK
|
||||
)
|
||||
)
|
||||
|
||||
if defined VCToolsInstallDir (
|
||||
if not defined VS2017_PREFIX (
|
||||
set "VS2017_PREFIX=%VCToolsInstallDir%"
|
||||
)
|
||||
if not defined WINSDK10_PREFIX (
|
||||
if defined WindowsSdkVerBinPath (
|
||||
set "WINSDK10_PREFIX=%WindowsSdkVerBinPath%"
|
||||
) else if exist "%ProgramFiles(x86)%\Windows Kits\10\bin" (
|
||||
set "WINSDK10_PREFIX=%ProgramFiles(x86)%\Windows Kits\10\bin\"
|
||||
) else if exist "%ProgramFiles%\Windows Kits\10\bin" (
|
||||
set "WINSDK10_PREFIX=%ProgramFiles%\Windows Kits\10\bin\"
|
||||
)
|
||||
)
|
||||
)
|
||||
if not defined WINSDK_PATH_FOR_RC_EXE (
|
||||
if defined WINSDK10_PREFIX (
|
||||
set "WINSDK_PATH_FOR_RC_EXE=%WINSDK10_PREFIX%x86"
|
||||
)
|
||||
)
|
||||
|
||||
if /I "%1"=="VS2017" goto SetWinDDK
|
||||
|
||||
:SetVS2019
|
||||
if not defined VS160COMNTOOLS (
|
||||
@REM clear two envs so that vcvars32.bat can run successfully.
|
||||
set VSINSTALLDIR=
|
||||
set VCToolsVersion=
|
||||
if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" (
|
||||
if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2019\BuildTools" (
|
||||
call "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -products Microsoft.VisualStudio.Product.BuildTools -version 16,17 > vswhereInfo
|
||||
@@ -228,7 +164,61 @@ if not defined WINSDK_PATH_FOR_RC_EXE (
|
||||
)
|
||||
)
|
||||
|
||||
if /I "%1"=="VS2019" goto SetWinDDK
|
||||
:SetVS2017
|
||||
if not defined VS150COMNTOOLS (
|
||||
if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" (
|
||||
if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2017\BuildTools" (
|
||||
call "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -products Microsoft.VisualStudio.Product.BuildTools -version 15,16 > vswhereInfo
|
||||
for /f "usebackq tokens=1* delims=: " %%i in (vswhereInfo) do (
|
||||
if /i "%%i"=="installationPath" call "%%j\VC\Auxiliary\Build\vcvars32.bat"
|
||||
)
|
||||
del vswhereInfo
|
||||
) else (
|
||||
call "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -version 15,16 > vswhereInfo
|
||||
for /f "usebackq tokens=1* delims=: " %%i in (vswhereInfo) do (
|
||||
if /i "%%i"=="installationPath" call "%%j\VC\Auxiliary\Build\vcvars32.bat"
|
||||
)
|
||||
del vswhereInfo
|
||||
)
|
||||
) else if exist "%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe" (
|
||||
if exist "%ProgramFiles%\Microsoft Visual Studio\2017\BuildTools" (
|
||||
call "%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe" -products Microsoft.VisualStudio.Product.BuildTools -version 15,16 > vswhereInfo
|
||||
for /f "usebackq tokens=1* delims=: " %%i in (vswhereInfo) do (
|
||||
if /i "%%i"=="installationPath" call "%%j\VC\Auxiliary\Build\vcvars32.bat"
|
||||
)
|
||||
del vswhereInfo
|
||||
) else (
|
||||
call "%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe" -version 15,16 > vswhereInfo
|
||||
for /f "usebackq tokens=1* delims=: " %%i in (vswhereInfo) do (
|
||||
if /i "%%i"=="installationPath" call "%%j\VC\Auxiliary\Build\vcvars32.bat"
|
||||
)
|
||||
del vswhereInfo
|
||||
)
|
||||
) else (
|
||||
if /I "%1"=="VS2017" goto ToolNotInstall
|
||||
goto SetWinDDK
|
||||
)
|
||||
)
|
||||
|
||||
if defined VCToolsInstallDir (
|
||||
if not defined VS2017_PREFIX (
|
||||
set "VS2017_PREFIX=%VCToolsInstallDir%"
|
||||
)
|
||||
if not defined WINSDK10_PREFIX (
|
||||
if defined WindowsSdkVerBinPath (
|
||||
set "WINSDK10_PREFIX=%WindowsSdkVerBinPath%"
|
||||
) else if exist "%ProgramFiles(x86)%\Windows Kits\10\bin" (
|
||||
set "WINSDK10_PREFIX=%ProgramFiles(x86)%\Windows Kits\10\bin\"
|
||||
) else if exist "%ProgramFiles%\Windows Kits\10\bin" (
|
||||
set "WINSDK10_PREFIX=%ProgramFiles%\Windows Kits\10\bin\"
|
||||
)
|
||||
)
|
||||
)
|
||||
if not defined WINSDK_PATH_FOR_RC_EXE (
|
||||
if defined WINSDK10_PREFIX (
|
||||
set "WINSDK_PATH_FOR_RC_EXE=%WINSDK10_PREFIX%x86"
|
||||
)
|
||||
)
|
||||
|
||||
:SetWinDDK
|
||||
if not defined WINDDK3790_PREFIX (
|
||||
|
@@ -1,3 +0,0 @@
|
||||
# Contributing to EDK2
|
||||
|
||||
Contributor documentation is maintained on the wiki: https://github.com/tianocore/tianocore.github.io/wiki/EDK-II-Development-Process
|
@@ -2,25 +2,9 @@
|
||||
# CI configuration for CryptoPkg
|
||||
#
|
||||
# Copyright (c) Microsoft Corporation
|
||||
# Copyright (c) 2020, Intel Corporation. All rights reserved.<BR>
|
||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
##
|
||||
{
|
||||
"LicenseCheck": {
|
||||
"IgnoreFiles": []
|
||||
},
|
||||
"EccCheck": {
|
||||
## Exception sample looks like below:
|
||||
## "ExceptionList": [
|
||||
## "<ErrorID>", "<KeyWord>"
|
||||
## ]
|
||||
"ExceptionList": [
|
||||
],
|
||||
## Both file path and directory path are accepted.
|
||||
"IgnoreFiles": [
|
||||
"Library/OpensslLib/openssl"
|
||||
]
|
||||
},
|
||||
"CompilerPlugin": {
|
||||
"DscPath": "CryptoPkg.dsc"
|
||||
},
|
||||
|
@@ -23,6 +23,7 @@
|
||||
Private
|
||||
Library/Include
|
||||
Library/OpensslLib/openssl/include
|
||||
Library/OpensslLib/openssl/crypto/include
|
||||
|
||||
[LibraryClasses]
|
||||
## @libraryclass Provides basic library functions for cryptographic primitives.
|
||||
|
@@ -243,154 +243,6 @@ DeprecatedCryptoServiceMd4HashAll (
|
||||
return BaseCryptLibServiceDeprecated ("Md4HashAll"), FALSE;
|
||||
}
|
||||
|
||||
#ifdef DISABLE_MD5_DEPRECATED_INTERFACES
|
||||
/**
|
||||
Retrieves the size, in bytes, of the context buffer required for MD5 hash operations.
|
||||
|
||||
If this interface is not supported, then return zero.
|
||||
|
||||
@retval 0 This interface is not supported.
|
||||
|
||||
**/
|
||||
UINTN
|
||||
EFIAPI
|
||||
DeprecatedCryptoServiceMd5GetContextSize (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
return BaseCryptLibServiceDeprecated ("Md5GetContextSize"), 0;
|
||||
}
|
||||
|
||||
/**
|
||||
Initializes user-supplied memory pointed by Md5Context as MD5 hash context for
|
||||
subsequent use.
|
||||
|
||||
If Md5Context is NULL, then return FALSE.
|
||||
If this interface is not supported, then return FALSE.
|
||||
|
||||
@param[out] Md5Context Pointer to MD5 context being initialized.
|
||||
|
||||
@retval FALSE This interface is not supported.
|
||||
|
||||
**/
|
||||
BOOLEAN
|
||||
EFIAPI
|
||||
DeprecatedCryptoServiceMd5Init (
|
||||
OUT VOID *Md5Context
|
||||
)
|
||||
{
|
||||
return BaseCryptLibServiceDeprecated ("Md5Init"), FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
Makes a copy of an existing MD5 context.
|
||||
|
||||
If Md5Context is NULL, then return FALSE.
|
||||
If NewMd5Context is NULL, then return FALSE.
|
||||
If this interface is not supported, then return FALSE.
|
||||
|
||||
@param[in] Md5Context Pointer to MD5 context being copied.
|
||||
@param[out] NewMd5Context Pointer to new MD5 context.
|
||||
|
||||
@retval FALSE This interface is not supported.
|
||||
|
||||
**/
|
||||
BOOLEAN
|
||||
EFIAPI
|
||||
DeprecatedCryptoServiceMd5Duplicate (
|
||||
IN CONST VOID *Md5Context,
|
||||
OUT VOID *NewMd5Context
|
||||
)
|
||||
{
|
||||
return BaseCryptLibServiceDeprecated ("Md5Init"), FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
Digests the input data and updates MD5 context.
|
||||
|
||||
This function performs MD5 digest on a data buffer of the specified size.
|
||||
It can be called multiple times to compute the digest of long or discontinuous data streams.
|
||||
MD5 context should be already correctly initialized by Md5Init(), and should not be finalized
|
||||
by Md5Final(). Behavior with invalid context is undefined.
|
||||
|
||||
If Md5Context is NULL, then return FALSE.
|
||||
If this interface is not supported, then return FALSE.
|
||||
|
||||
@param[in, out] Md5Context Pointer to the MD5 context.
|
||||
@param[in] Data Pointer to the buffer containing the data to be hashed.
|
||||
@param[in] DataSize Size of Data buffer in bytes.
|
||||
|
||||
@retval FALSE This interface is not supported.
|
||||
|
||||
**/
|
||||
BOOLEAN
|
||||
EFIAPI
|
||||
DeprecatedCryptoServiceMd5Update (
|
||||
IN OUT VOID *Md5Context,
|
||||
IN CONST VOID *Data,
|
||||
IN UINTN DataSize
|
||||
)
|
||||
{
|
||||
return BaseCryptLibServiceDeprecated ("Md5Init"), FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
Completes computation of the MD5 digest value.
|
||||
|
||||
This function completes MD5 hash computation and retrieves the digest value into
|
||||
the specified memory. After this function has been called, the MD5 context cannot
|
||||
be used again.
|
||||
MD5 context should be already correctly initialized by Md5Init(), and should not be
|
||||
finalized by Md5Final(). Behavior with invalid MD5 context is undefined.
|
||||
|
||||
If Md5Context is NULL, then return FALSE.
|
||||
If HashValue is NULL, then return FALSE.
|
||||
If this interface is not supported, then return FALSE.
|
||||
|
||||
@param[in, out] Md5Context Pointer to the MD5 context.
|
||||
@param[out] HashValue Pointer to a buffer that receives the MD5 digest
|
||||
value (16 bytes).
|
||||
|
||||
@retval FALSE This interface is not supported.
|
||||
|
||||
**/
|
||||
BOOLEAN
|
||||
EFIAPI
|
||||
DeprecatedCryptoServiceMd5Final (
|
||||
IN OUT VOID *Md5Context,
|
||||
OUT UINT8 *HashValue
|
||||
)
|
||||
{
|
||||
return BaseCryptLibServiceDeprecated ("Md5Final"), FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
Computes the MD5 message digest of a input data buffer.
|
||||
|
||||
This function performs the MD5 message digest of a given data buffer, and places
|
||||
the digest value into the specified memory.
|
||||
|
||||
If this interface is not supported, then return FALSE.
|
||||
|
||||
@param[in] Data Pointer to the buffer containing the data to be hashed.
|
||||
@param[in] DataSize Size of Data buffer in bytes.
|
||||
@param[out] HashValue Pointer to a buffer that receives the MD5 digest
|
||||
value (16 bytes).
|
||||
|
||||
@retval FALSE This interface is not supported.
|
||||
|
||||
**/
|
||||
BOOLEAN
|
||||
EFIAPI
|
||||
DeprecatedCryptoServiceMd5HashAll (
|
||||
IN CONST VOID *Data,
|
||||
IN UINTN DataSize,
|
||||
OUT UINT8 *HashValue
|
||||
)
|
||||
{
|
||||
return BaseCryptLibServiceDeprecated ("Md5HashAll"), FALSE;
|
||||
}
|
||||
#else
|
||||
/**
|
||||
Retrieves the size, in bytes, of the context buffer required for MD5 hash operations.
|
||||
|
||||
@@ -548,158 +400,7 @@ CryptoServiceMd5HashAll (
|
||||
{
|
||||
return CALL_BASECRYPTLIB (Md5.Services.HashAll, Md5HashAll, (Data, DataSize, HashValue), FALSE);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef DISABLE_SHA1_DEPRECATED_INTERFACES
|
||||
/**
|
||||
Retrieves the size, in bytes, of the context buffer required for SHA-1 hash operations.
|
||||
|
||||
If this interface is not supported, then return zero.
|
||||
|
||||
@retval 0 This interface is not supported.
|
||||
|
||||
**/
|
||||
UINTN
|
||||
EFIAPI
|
||||
DeprecatedCryptoServiceSha1GetContextSize (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
return BaseCryptLibServiceDeprecated ("Sha1GetContextSize"), 0;
|
||||
}
|
||||
|
||||
/**
|
||||
Initializes user-supplied memory pointed by Sha1Context as SHA-1 hash context for
|
||||
subsequent use.
|
||||
|
||||
If Sha1Context is NULL, then return FALSE.
|
||||
If this interface is not supported, then return FALSE.
|
||||
|
||||
@param[out] Sha1Context Pointer to SHA-1 context being initialized.
|
||||
|
||||
@retval TRUE SHA-1 context initialization succeeded.
|
||||
@retval FALSE SHA-1 context initialization failed.
|
||||
@retval FALSE This interface is not supported.
|
||||
|
||||
**/
|
||||
BOOLEAN
|
||||
EFIAPI
|
||||
DeprecatedCryptoServiceSha1Init (
|
||||
OUT VOID *Sha1Context
|
||||
)
|
||||
{
|
||||
return BaseCryptLibServiceDeprecated ("Sha1Init"), FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
Makes a copy of an existing SHA-1 context.
|
||||
|
||||
If Sha1Context is NULL, then return FALSE.
|
||||
If NewSha1Context is NULL, then return FALSE.
|
||||
If this interface is not supported, then return FALSE.
|
||||
|
||||
@param[in] Sha1Context Pointer to SHA-1 context being copied.
|
||||
@param[out] NewSha1Context Pointer to new SHA-1 context.
|
||||
|
||||
@retval FALSE This interface is not supported.
|
||||
|
||||
**/
|
||||
BOOLEAN
|
||||
EFIAPI
|
||||
DeprecatedCryptoServiceSha1Duplicate (
|
||||
IN CONST VOID *Sha1Context,
|
||||
OUT VOID *NewSha1Context
|
||||
)
|
||||
{
|
||||
return BaseCryptLibServiceDeprecated ("Sha1Duplicate"), FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
Digests the input data and updates SHA-1 context.
|
||||
|
||||
This function performs SHA-1 digest on a data buffer of the specified size.
|
||||
It can be called multiple times to compute the digest of long or discontinuous data streams.
|
||||
SHA-1 context should be already correctly initialized by Sha1Init(), and should not be finalized
|
||||
by Sha1Final(). Behavior with invalid context is undefined.
|
||||
|
||||
If Sha1Context is NULL, then return FALSE.
|
||||
If this interface is not supported, then return FALSE.
|
||||
|
||||
@param[in, out] Sha1Context Pointer to the SHA-1 context.
|
||||
@param[in] Data Pointer to the buffer containing the data to be hashed.
|
||||
@param[in] DataSize Size of Data buffer in bytes.
|
||||
|
||||
@retval FALSE This interface is not supported.
|
||||
|
||||
**/
|
||||
BOOLEAN
|
||||
EFIAPI
|
||||
DeprecatedCryptoServiceSha1Update (
|
||||
IN OUT VOID *Sha1Context,
|
||||
IN CONST VOID *Data,
|
||||
IN UINTN DataSize
|
||||
)
|
||||
{
|
||||
return BaseCryptLibServiceDeprecated ("Sha1Update"), FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
Completes computation of the SHA-1 digest value.
|
||||
|
||||
This function completes SHA-1 hash computation and retrieves the digest value into
|
||||
the specified memory. After this function has been called, the SHA-1 context cannot
|
||||
be used again.
|
||||
SHA-1 context should be already correctly initialized by Sha1Init(), and should not be
|
||||
finalized by Sha1Final(). Behavior with invalid SHA-1 context is undefined.
|
||||
|
||||
If Sha1Context is NULL, then return FALSE.
|
||||
If HashValue is NULL, then return FALSE.
|
||||
If this interface is not supported, then return FALSE.
|
||||
|
||||
@param[in, out] Sha1Context Pointer to the SHA-1 context.
|
||||
@param[out] HashValue Pointer to a buffer that receives the SHA-1 digest
|
||||
value (20 bytes).
|
||||
|
||||
@retval FALSE This interface is not supported.
|
||||
|
||||
**/
|
||||
BOOLEAN
|
||||
EFIAPI
|
||||
DeprecatedCryptoServiceSha1Final (
|
||||
IN OUT VOID *Sha1Context,
|
||||
OUT UINT8 *HashValue
|
||||
)
|
||||
{
|
||||
return BaseCryptLibServiceDeprecated ("Sha1Final"), FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
Computes the SHA-1 message digest of a input data buffer.
|
||||
|
||||
This function performs the SHA-1 message digest of a given data buffer, and places
|
||||
the digest value into the specified memory.
|
||||
|
||||
If this interface is not supported, then return FALSE.
|
||||
|
||||
@param[in] Data Pointer to the buffer containing the data to be hashed.
|
||||
@param[in] DataSize Size of Data buffer in bytes.
|
||||
@param[out] HashValue Pointer to a buffer that receives the SHA-1 digest
|
||||
value (20 bytes).
|
||||
|
||||
@retval FALSE This interface is not supported.
|
||||
|
||||
**/
|
||||
BOOLEAN
|
||||
EFIAPI
|
||||
DeprecatedCryptoServiceSha1HashAll (
|
||||
IN CONST VOID *Data,
|
||||
IN UINTN DataSize,
|
||||
OUT UINT8 *HashValue
|
||||
)
|
||||
{
|
||||
return BaseCryptLibServiceDeprecated ("Sha1HashAll"), FALSE;
|
||||
}
|
||||
#else
|
||||
/**
|
||||
Retrieves the size, in bytes, of the context buffer required for SHA-1 hash operations.
|
||||
|
||||
@@ -857,7 +558,6 @@ CryptoServiceSha1HashAll (
|
||||
{
|
||||
return CALL_BASECRYPTLIB (Sha1.Services.HashAll, Sha1HashAll, (Data, DataSize, HashValue), FALSE);
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
Retrieves the size, in bytes, of the context buffer required for SHA-256 hash operations.
|
||||
@@ -4494,15 +4194,6 @@ const EDKII_CRYPTO_PROTOCOL mEdkiiCrypto = {
|
||||
DeprecatedCryptoServiceMd4Update,
|
||||
DeprecatedCryptoServiceMd4Final,
|
||||
DeprecatedCryptoServiceMd4HashAll,
|
||||
#ifdef DISABLE_MD5_DEPRECATED_INTERFACES
|
||||
/// Md5 - deprecated and unsupported
|
||||
DeprecatedCryptoServiceMd5GetContextSize,
|
||||
DeprecatedCryptoServiceMd5Init,
|
||||
DeprecatedCryptoServiceMd5Duplicate,
|
||||
DeprecatedCryptoServiceMd5Update,
|
||||
DeprecatedCryptoServiceMd5Final,
|
||||
DeprecatedCryptoServiceMd5HashAll,
|
||||
#else
|
||||
/// Md5
|
||||
CryptoServiceMd5GetContextSize,
|
||||
CryptoServiceMd5Init,
|
||||
@@ -4510,7 +4201,6 @@ const EDKII_CRYPTO_PROTOCOL mEdkiiCrypto = {
|
||||
CryptoServiceMd5Update,
|
||||
CryptoServiceMd5Final,
|
||||
CryptoServiceMd5HashAll,
|
||||
#endif
|
||||
/// Pkcs
|
||||
CryptoServicePkcs1v2Encrypt,
|
||||
CryptoServicePkcs5HashPassword,
|
||||
@@ -4545,15 +4235,6 @@ const EDKII_CRYPTO_PROTOCOL mEdkiiCrypto = {
|
||||
CryptoServiceRsaPkcs1Verify,
|
||||
CryptoServiceRsaGetPrivateKeyFromPem,
|
||||
CryptoServiceRsaGetPublicKeyFromX509,
|
||||
#ifdef DISABLE_SHA1_DEPRECATED_INTERFACES
|
||||
/// Sha1 - deprecated and unsupported
|
||||
DeprecatedCryptoServiceSha1GetContextSize,
|
||||
DeprecatedCryptoServiceSha1Init,
|
||||
DeprecatedCryptoServiceSha1Duplicate,
|
||||
DeprecatedCryptoServiceSha1Update,
|
||||
DeprecatedCryptoServiceSha1Final,
|
||||
DeprecatedCryptoServiceSha1HashAll,
|
||||
#else
|
||||
/// Sha1
|
||||
CryptoServiceSha1GetContextSize,
|
||||
CryptoServiceSha1Init,
|
||||
@@ -4561,7 +4242,6 @@ const EDKII_CRYPTO_PROTOCOL mEdkiiCrypto = {
|
||||
CryptoServiceSha1Update,
|
||||
CryptoServiceSha1Final,
|
||||
CryptoServiceSha1HashAll,
|
||||
#endif
|
||||
/// Sha256
|
||||
CryptoServiceSha256GetContextSize,
|
||||
CryptoServiceSha256Init,
|
||||
|
@@ -72,7 +72,6 @@ typedef enum {
|
||||
// One-Way Cryptographic Hash Primitives
|
||||
//=====================================================================================
|
||||
|
||||
#ifndef DISABLE_MD5_DEPRECATED_INTERFACES
|
||||
/**
|
||||
Retrieves the size, in bytes, of the context buffer required for MD5 hash operations.
|
||||
|
||||
@@ -212,9 +211,7 @@ Md5HashAll (
|
||||
IN UINTN DataSize,
|
||||
OUT UINT8 *HashValue
|
||||
);
|
||||
#endif
|
||||
|
||||
#ifndef DISABLE_SHA1_DEPRECATED_INTERFACES
|
||||
/**
|
||||
Retrieves the size, in bytes, of the context buffer required for SHA-1 hash operations.
|
||||
|
||||
@@ -354,7 +351,6 @@ Sha1HashAll (
|
||||
IN UINTN DataSize,
|
||||
OUT UINT8 *HashValue
|
||||
);
|
||||
#endif
|
||||
|
||||
/**
|
||||
Retrieves the size, in bytes, of the context buffer required for SHA-256 hash operations.
|
||||
|
@@ -9,7 +9,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#include "InternalCryptLib.h"
|
||||
#include <openssl/md5.h>
|
||||
|
||||
#ifndef DISABLE_MD5_DEPRECATED_INTERFACES
|
||||
|
||||
/**
|
||||
Retrieves the size, in bytes, of the context buffer required for MD5 hash operations.
|
||||
|
||||
@@ -223,4 +223,3 @@ Md5HashAll (
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@@ -9,7 +9,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#include "InternalCryptLib.h"
|
||||
#include <openssl/sha.h>
|
||||
|
||||
#ifndef DISABLE_SHA1_DEPRECATED_INTERFACES
|
||||
|
||||
/**
|
||||
Retrieves the size, in bytes, of the context buffer required for SHA-1 hash operations.
|
||||
|
||||
@@ -222,4 +222,3 @@ Sha1HashAll (
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@@ -7,7 +7,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
**/
|
||||
|
||||
#include "InternalCryptLib.h"
|
||||
#include "crypto/sm3.h"
|
||||
#include "internal/sm3.h"
|
||||
|
||||
/**
|
||||
Retrieves the size, in bytes, of the context buffer required for SM3 hash operations.
|
||||
|
@@ -15,13 +15,13 @@
|
||||
#include <openssl/asn1.h>
|
||||
#include <openssl/x509.h>
|
||||
#include <openssl/bio.h>
|
||||
#include <crypto/x509.h>
|
||||
#include <internal/x509_int.h>
|
||||
#include <openssl/pkcs7.h>
|
||||
#include <openssl/bn.h>
|
||||
#include <openssl/x509_vfy.h>
|
||||
#include <openssl/pem.h>
|
||||
#include <openssl/evp.h>
|
||||
#include <crypto/asn1.h>
|
||||
#include <internal/asn1_int.h>
|
||||
|
||||
/**
|
||||
This function will return the leaf signer certificate in a chain. This is
|
||||
|
@@ -99,7 +99,6 @@ CryptoServiceNotAvailable (
|
||||
// One-Way Cryptographic Hash Primitives
|
||||
//=====================================================================================
|
||||
|
||||
#ifndef DISABLE_MD5_DEPRECATED_INTERFACES
|
||||
/**
|
||||
Retrieves the size, in bytes, of the context buffer required for MD5 hash operations.
|
||||
|
||||
@@ -257,9 +256,7 @@ Md5HashAll (
|
||||
{
|
||||
CALL_CRYPTO_SERVICE (Md5HashAll, (Data, DataSize, HashValue), FALSE);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef DISABLE_SHA1_DEPRECATED_INTERFACES
|
||||
/**
|
||||
Retrieves the size, in bytes, of the context buffer required for SHA-1 hash operations.
|
||||
|
||||
@@ -417,7 +414,6 @@ Sha1HashAll (
|
||||
{
|
||||
CALL_CRYPTO_SERVICE (Sha1HashAll, (Data, DataSize, HashValue), FALSE);
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
Retrieves the size, in bytes, of the context buffer required for SHA-256 hash operations.
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/* WARNING: do not edit! */
|
||||
/* Generated from include/crypto/dso_conf.h.in */
|
||||
/* Generated from crypto/include/internal/dso_conf.h.in */
|
||||
/*
|
||||
* Copyright 2016-2019 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
@@ -9,8 +9,8 @@
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef OSSL_CRYPTO_DSO_CONF_H
|
||||
# define OSSL_CRYPTO_DSO_CONF_H
|
||||
#ifndef HEADER_DSO_CONF_H
|
||||
# define HEADER_DSO_CONF_H
|
||||
# define DSO_NONE
|
||||
# define DSO_EXTENSION ".so"
|
||||
#endif
|
@@ -247,6 +247,9 @@ extern "C" {
|
||||
#ifndef OPENSSL_NO_DYNAMIC_ENGINE
|
||||
# define OPENSSL_NO_DYNAMIC_ENGINE
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_AFALGENG
|
||||
# define OPENSSL_NO_AFALGENG
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
|
@@ -477,45 +477,45 @@
|
||||
$(OPENSSL_PATH)/crypto/s390x_arch.h
|
||||
$(OPENSSL_PATH)/crypto/sparc_arch.h
|
||||
$(OPENSSL_PATH)/crypto/vms_rms.h
|
||||
$(OPENSSL_PATH)/crypto/aes/aes_local.h
|
||||
$(OPENSSL_PATH)/crypto/aes/aes_locl.h
|
||||
$(OPENSSL_PATH)/crypto/asn1/asn1_item_list.h
|
||||
$(OPENSSL_PATH)/crypto/asn1/asn1_local.h
|
||||
$(OPENSSL_PATH)/crypto/asn1/asn1_locl.h
|
||||
$(OPENSSL_PATH)/crypto/asn1/charmap.h
|
||||
$(OPENSSL_PATH)/crypto/asn1/standard_methods.h
|
||||
$(OPENSSL_PATH)/crypto/asn1/tbl_standard.h
|
||||
$(OPENSSL_PATH)/crypto/async/async_local.h
|
||||
$(OPENSSL_PATH)/crypto/async/async_locl.h
|
||||
$(OPENSSL_PATH)/crypto/async/arch/async_null.h
|
||||
$(OPENSSL_PATH)/crypto/async/arch/async_posix.h
|
||||
$(OPENSSL_PATH)/crypto/async/arch/async_win.h
|
||||
$(OPENSSL_PATH)/crypto/bio/bio_local.h
|
||||
$(OPENSSL_PATH)/crypto/bn/bn_local.h
|
||||
$(OPENSSL_PATH)/crypto/bio/bio_lcl.h
|
||||
$(OPENSSL_PATH)/crypto/bn/bn_lcl.h
|
||||
$(OPENSSL_PATH)/crypto/bn/bn_prime.h
|
||||
$(OPENSSL_PATH)/crypto/bn/rsaz_exp.h
|
||||
$(OPENSSL_PATH)/crypto/comp/comp_local.h
|
||||
$(OPENSSL_PATH)/crypto/comp/comp_lcl.h
|
||||
$(OPENSSL_PATH)/crypto/conf/conf_def.h
|
||||
$(OPENSSL_PATH)/crypto/conf/conf_local.h
|
||||
$(OPENSSL_PATH)/crypto/dh/dh_local.h
|
||||
$(OPENSSL_PATH)/crypto/dso/dso_local.h
|
||||
$(OPENSSL_PATH)/crypto/evp/evp_local.h
|
||||
$(OPENSSL_PATH)/crypto/hmac/hmac_local.h
|
||||
$(OPENSSL_PATH)/crypto/lhash/lhash_local.h
|
||||
$(OPENSSL_PATH)/crypto/md5/md5_local.h
|
||||
$(OPENSSL_PATH)/crypto/modes/modes_local.h
|
||||
$(OPENSSL_PATH)/crypto/conf/conf_lcl.h
|
||||
$(OPENSSL_PATH)/crypto/dh/dh_locl.h
|
||||
$(OPENSSL_PATH)/crypto/dso/dso_locl.h
|
||||
$(OPENSSL_PATH)/crypto/evp/evp_locl.h
|
||||
$(OPENSSL_PATH)/crypto/hmac/hmac_lcl.h
|
||||
$(OPENSSL_PATH)/crypto/lhash/lhash_lcl.h
|
||||
$(OPENSSL_PATH)/crypto/md5/md5_locl.h
|
||||
$(OPENSSL_PATH)/crypto/modes/modes_lcl.h
|
||||
$(OPENSSL_PATH)/crypto/objects/obj_dat.h
|
||||
$(OPENSSL_PATH)/crypto/objects/obj_local.h
|
||||
$(OPENSSL_PATH)/crypto/objects/obj_lcl.h
|
||||
$(OPENSSL_PATH)/crypto/objects/obj_xref.h
|
||||
$(OPENSSL_PATH)/crypto/ocsp/ocsp_local.h
|
||||
$(OPENSSL_PATH)/crypto/pkcs12/p12_local.h
|
||||
$(OPENSSL_PATH)/crypto/rand/rand_local.h
|
||||
$(OPENSSL_PATH)/crypto/rsa/rsa_local.h
|
||||
$(OPENSSL_PATH)/crypto/sha/sha_local.h
|
||||
$(OPENSSL_PATH)/crypto/ocsp/ocsp_lcl.h
|
||||
$(OPENSSL_PATH)/crypto/pkcs12/p12_lcl.h
|
||||
$(OPENSSL_PATH)/crypto/rand/rand_lcl.h
|
||||
$(OPENSSL_PATH)/crypto/rsa/rsa_locl.h
|
||||
$(OPENSSL_PATH)/crypto/sha/sha_locl.h
|
||||
$(OPENSSL_PATH)/crypto/siphash/siphash_local.h
|
||||
$(OPENSSL_PATH)/crypto/sm3/sm3_local.h
|
||||
$(OPENSSL_PATH)/crypto/store/store_local.h
|
||||
$(OPENSSL_PATH)/crypto/ui/ui_local.h
|
||||
$(OPENSSL_PATH)/crypto/x509/x509_local.h
|
||||
$(OPENSSL_PATH)/crypto/sm3/sm3_locl.h
|
||||
$(OPENSSL_PATH)/crypto/store/store_locl.h
|
||||
$(OPENSSL_PATH)/crypto/ui/ui_locl.h
|
||||
$(OPENSSL_PATH)/crypto/x509/x509_lcl.h
|
||||
$(OPENSSL_PATH)/crypto/x509v3/ext_dat.h
|
||||
$(OPENSSL_PATH)/crypto/x509v3/pcy_local.h
|
||||
$(OPENSSL_PATH)/crypto/x509v3/pcy_int.h
|
||||
$(OPENSSL_PATH)/crypto/x509v3/standard_exts.h
|
||||
$(OPENSSL_PATH)/crypto/x509v3/v3_admis.h
|
||||
$(OPENSSL_PATH)/ssl/bio_ssl.c
|
||||
@@ -562,13 +562,13 @@
|
||||
$(OPENSSL_PATH)/ssl/t1_trce.c
|
||||
$(OPENSSL_PATH)/ssl/tls13_enc.c
|
||||
$(OPENSSL_PATH)/ssl/tls_srp.c
|
||||
$(OPENSSL_PATH)/ssl/packet_local.h
|
||||
$(OPENSSL_PATH)/ssl/packet_locl.h
|
||||
$(OPENSSL_PATH)/ssl/ssl_cert_table.h
|
||||
$(OPENSSL_PATH)/ssl/ssl_local.h
|
||||
$(OPENSSL_PATH)/ssl/ssl_locl.h
|
||||
$(OPENSSL_PATH)/ssl/record/record.h
|
||||
$(OPENSSL_PATH)/ssl/record/record_local.h
|
||||
$(OPENSSL_PATH)/ssl/record/record_locl.h
|
||||
$(OPENSSL_PATH)/ssl/statem/statem.h
|
||||
$(OPENSSL_PATH)/ssl/statem/statem_local.h
|
||||
$(OPENSSL_PATH)/ssl/statem/statem_locl.h
|
||||
# Autogenerated files list ends here
|
||||
buildinf.h
|
||||
rand_pool_noise.h
|
||||
@@ -634,7 +634,7 @@
|
||||
GCC:*_*_X64_CC_FLAGS = -U_WIN32 -U_WIN64 $(OPENSSL_FLAGS) -Wno-error=maybe-uninitialized -Wno-error=format -Wno-format -Wno-error=unused-but-set-variable -DNO_MSABI_VA_FUNCS
|
||||
GCC:*_*_ARM_CC_FLAGS = $(OPENSSL_FLAGS) -Wno-error=maybe-uninitialized -Wno-error=unused-but-set-variable
|
||||
GCC:*_*_AARCH64_CC_FLAGS = $(OPENSSL_FLAGS) -Wno-error=maybe-uninitialized -Wno-format -Wno-error=unused-but-set-variable
|
||||
GCC:*_*_RISCV64_CC_FLAGS = $(OPENSSL_FLAGS) -Wno-error=maybe-uninitialized -Wno-format -Wno-error=unused-but-set-variable
|
||||
GCC:*_*_RISCV64_CC_FLAGS = $(OPENSSL_FLAGS) -Wno-error=format -Wno-error=maybe-uninitialized -Wno-format -Wno-error=unused-but-set-variable
|
||||
GCC:*_CLANG35_*_CC_FLAGS = -std=c99 -Wno-error=uninitialized
|
||||
GCC:*_CLANG38_*_CC_FLAGS = -std=c99 -Wno-error=uninitialized
|
||||
GCC:*_CLANGPDB_*_CC_FLAGS = -std=c99 -Wno-error=uninitialized -Wno-error=incompatible-pointer-types -Wno-error=pointer-sign -Wno-error=implicit-function-declaration -Wno-error=ignored-pragma-optimize
|
||||
|
@@ -477,45 +477,45 @@
|
||||
$(OPENSSL_PATH)/crypto/s390x_arch.h
|
||||
$(OPENSSL_PATH)/crypto/sparc_arch.h
|
||||
$(OPENSSL_PATH)/crypto/vms_rms.h
|
||||
$(OPENSSL_PATH)/crypto/aes/aes_local.h
|
||||
$(OPENSSL_PATH)/crypto/aes/aes_locl.h
|
||||
$(OPENSSL_PATH)/crypto/asn1/asn1_item_list.h
|
||||
$(OPENSSL_PATH)/crypto/asn1/asn1_local.h
|
||||
$(OPENSSL_PATH)/crypto/asn1/asn1_locl.h
|
||||
$(OPENSSL_PATH)/crypto/asn1/charmap.h
|
||||
$(OPENSSL_PATH)/crypto/asn1/standard_methods.h
|
||||
$(OPENSSL_PATH)/crypto/asn1/tbl_standard.h
|
||||
$(OPENSSL_PATH)/crypto/async/async_local.h
|
||||
$(OPENSSL_PATH)/crypto/async/async_locl.h
|
||||
$(OPENSSL_PATH)/crypto/async/arch/async_null.h
|
||||
$(OPENSSL_PATH)/crypto/async/arch/async_posix.h
|
||||
$(OPENSSL_PATH)/crypto/async/arch/async_win.h
|
||||
$(OPENSSL_PATH)/crypto/bio/bio_local.h
|
||||
$(OPENSSL_PATH)/crypto/bn/bn_local.h
|
||||
$(OPENSSL_PATH)/crypto/bio/bio_lcl.h
|
||||
$(OPENSSL_PATH)/crypto/bn/bn_lcl.h
|
||||
$(OPENSSL_PATH)/crypto/bn/bn_prime.h
|
||||
$(OPENSSL_PATH)/crypto/bn/rsaz_exp.h
|
||||
$(OPENSSL_PATH)/crypto/comp/comp_local.h
|
||||
$(OPENSSL_PATH)/crypto/comp/comp_lcl.h
|
||||
$(OPENSSL_PATH)/crypto/conf/conf_def.h
|
||||
$(OPENSSL_PATH)/crypto/conf/conf_local.h
|
||||
$(OPENSSL_PATH)/crypto/dh/dh_local.h
|
||||
$(OPENSSL_PATH)/crypto/dso/dso_local.h
|
||||
$(OPENSSL_PATH)/crypto/evp/evp_local.h
|
||||
$(OPENSSL_PATH)/crypto/hmac/hmac_local.h
|
||||
$(OPENSSL_PATH)/crypto/lhash/lhash_local.h
|
||||
$(OPENSSL_PATH)/crypto/md5/md5_local.h
|
||||
$(OPENSSL_PATH)/crypto/modes/modes_local.h
|
||||
$(OPENSSL_PATH)/crypto/conf/conf_lcl.h
|
||||
$(OPENSSL_PATH)/crypto/dh/dh_locl.h
|
||||
$(OPENSSL_PATH)/crypto/dso/dso_locl.h
|
||||
$(OPENSSL_PATH)/crypto/evp/evp_locl.h
|
||||
$(OPENSSL_PATH)/crypto/hmac/hmac_lcl.h
|
||||
$(OPENSSL_PATH)/crypto/lhash/lhash_lcl.h
|
||||
$(OPENSSL_PATH)/crypto/md5/md5_locl.h
|
||||
$(OPENSSL_PATH)/crypto/modes/modes_lcl.h
|
||||
$(OPENSSL_PATH)/crypto/objects/obj_dat.h
|
||||
$(OPENSSL_PATH)/crypto/objects/obj_local.h
|
||||
$(OPENSSL_PATH)/crypto/objects/obj_lcl.h
|
||||
$(OPENSSL_PATH)/crypto/objects/obj_xref.h
|
||||
$(OPENSSL_PATH)/crypto/ocsp/ocsp_local.h
|
||||
$(OPENSSL_PATH)/crypto/pkcs12/p12_local.h
|
||||
$(OPENSSL_PATH)/crypto/rand/rand_local.h
|
||||
$(OPENSSL_PATH)/crypto/rsa/rsa_local.h
|
||||
$(OPENSSL_PATH)/crypto/sha/sha_local.h
|
||||
$(OPENSSL_PATH)/crypto/ocsp/ocsp_lcl.h
|
||||
$(OPENSSL_PATH)/crypto/pkcs12/p12_lcl.h
|
||||
$(OPENSSL_PATH)/crypto/rand/rand_lcl.h
|
||||
$(OPENSSL_PATH)/crypto/rsa/rsa_locl.h
|
||||
$(OPENSSL_PATH)/crypto/sha/sha_locl.h
|
||||
$(OPENSSL_PATH)/crypto/siphash/siphash_local.h
|
||||
$(OPENSSL_PATH)/crypto/sm3/sm3_local.h
|
||||
$(OPENSSL_PATH)/crypto/store/store_local.h
|
||||
$(OPENSSL_PATH)/crypto/ui/ui_local.h
|
||||
$(OPENSSL_PATH)/crypto/x509/x509_local.h
|
||||
$(OPENSSL_PATH)/crypto/sm3/sm3_locl.h
|
||||
$(OPENSSL_PATH)/crypto/store/store_locl.h
|
||||
$(OPENSSL_PATH)/crypto/ui/ui_locl.h
|
||||
$(OPENSSL_PATH)/crypto/x509/x509_lcl.h
|
||||
$(OPENSSL_PATH)/crypto/x509v3/ext_dat.h
|
||||
$(OPENSSL_PATH)/crypto/x509v3/pcy_local.h
|
||||
$(OPENSSL_PATH)/crypto/x509v3/pcy_int.h
|
||||
$(OPENSSL_PATH)/crypto/x509v3/standard_exts.h
|
||||
$(OPENSSL_PATH)/crypto/x509v3/v3_admis.h
|
||||
# Autogenerated files list ends here
|
||||
|
Submodule CryptoPkg/Library/OpensslLib/openssl updated: e2e09d9fba...c3656cc594
@@ -111,8 +111,8 @@ BEGIN {
|
||||
# Generate dso_conf.h per config data
|
||||
system(
|
||||
"perl -I. -Mconfigdata util/dofile.pl " .
|
||||
"include/crypto/dso_conf.h.in " .
|
||||
"> include/crypto/dso_conf.h"
|
||||
"crypto/include/internal/dso_conf.h.in " .
|
||||
"> include/internal/dso_conf.h"
|
||||
) == 0 ||
|
||||
die "Failed to generate dso_conf.h!\n";
|
||||
|
||||
@@ -263,21 +263,14 @@ print "Done!";
|
||||
# Copy opensslconf.h and dso_conf.h generated from OpenSSL Configuration
|
||||
#
|
||||
print "\n--> Duplicating opensslconf.h into Include/openssl ... ";
|
||||
system(
|
||||
"perl -pe 's/\\n/\\r\\n/' " .
|
||||
"< " . $OPENSSL_PATH . "/include/openssl/opensslconf.h " .
|
||||
"> " . $OPENSSL_PATH . "/../../Include/openssl/opensslconf.h"
|
||||
) == 0 ||
|
||||
die "Cannot copy opensslconf.h!";
|
||||
copy($OPENSSL_PATH . "/include/openssl/opensslconf.h",
|
||||
$OPENSSL_PATH . "/../../Include/openssl/") ||
|
||||
die "Cannot copy opensslconf.h!";
|
||||
print "Done!";
|
||||
|
||||
print "\n--> Duplicating dso_conf.h into Include/crypto ... ";
|
||||
system(
|
||||
"perl -pe 's/\\n/\\r\\n/' " .
|
||||
"< " . $OPENSSL_PATH . "/include/crypto/dso_conf.h" .
|
||||
"> " . $OPENSSL_PATH . "/../../Include/crypto/dso_conf.h"
|
||||
) == 0 ||
|
||||
die "Cannot copy dso_conf.h!";
|
||||
print "\n--> Duplicating dso_conf.h into Include/internal ... ";
|
||||
copy($OPENSSL_PATH . "/include/internal/dso_conf.h",
|
||||
$OPENSSL_PATH . "/../../Include/internal/") ||
|
||||
die "Cannot copy dso_conf.h!";
|
||||
print "Done!\n";
|
||||
|
||||
print "\nProcessing Files Done!\n";
|
||||
|
@@ -7,7 +7,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
**/
|
||||
|
||||
#include "crypto/rand.h"
|
||||
#include "internal/rand_int.h"
|
||||
#include <openssl/aes.h>
|
||||
|
||||
#include <Uefi.h>
|
||||
|
@@ -1,7 +1,7 @@
|
||||
## @file
|
||||
# Dsc include file for Dynamic Tables Framework.
|
||||
#
|
||||
# Copyright (c) 2017 - 2020, Arm Limited. All rights reserved.<BR>
|
||||
# Copyright (c) 2017 - 2019, ARM Limited. All rights reserved.<BR>
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#
|
||||
@@ -10,31 +10,12 @@
|
||||
[Defines]
|
||||
|
||||
[BuildOptions]
|
||||
RELEASE_*_*_CC_FLAGS = -DMDEPKG_NDEBUG
|
||||
*_*_*_ASL_FLAGS = -tc -li -so
|
||||
|
||||
[LibraryClasses.common]
|
||||
AmlLib|DynamicTablesPkg/Library/Common/AmlLib/AmlLib.inf
|
||||
SsdtSerialPortFixupLib|DynamicTablesPkg/Library/Common/SsdtSerialPortFixupLib/SsdtSerialPortFixupLib.inf
|
||||
TableHelperLib|DynamicTablesPkg/Library/Common/TableHelperLib/TableHelperLib.inf
|
||||
|
||||
[Components.common]
|
||||
#
|
||||
# Generators
|
||||
#
|
||||
DynamicTablesPkg/Library/Acpi/Arm/AcpiDbg2LibArm/AcpiDbg2LibArm.inf
|
||||
DynamicTablesPkg/Library/Acpi/Arm/AcpiFadtLibArm/AcpiFadtLibArm.inf
|
||||
DynamicTablesPkg/Library/Acpi/Arm/AcpiGtdtLibArm/AcpiGtdtLibArm.inf
|
||||
DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/AcpiIortLibArm.inf
|
||||
DynamicTablesPkg/Library/Acpi/Arm/AcpiMadtLibArm/AcpiMadtLibArm.inf
|
||||
DynamicTablesPkg/Library/Acpi/Arm/AcpiMcfgLibArm/AcpiMcfgLibArm.inf
|
||||
DynamicTablesPkg/Library/Acpi/Arm/AcpiPpttLibArm/AcpiPpttLibArm.inf
|
||||
DynamicTablesPkg/Library/Acpi/Arm/AcpiRawLibArm/AcpiRawLibArm.inf
|
||||
DynamicTablesPkg/Library/Acpi/Arm/AcpiSpcrLibArm/AcpiSpcrLibArm.inf
|
||||
DynamicTablesPkg/Library/Acpi/Arm/AcpiSratLibArm/AcpiSratLibArm.inf
|
||||
|
||||
# AML Fixup
|
||||
DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtSerialPortLibArm/SsdtSerialPortLibArm.inf
|
||||
|
||||
#
|
||||
# Dynamic Table Factory Dxe
|
||||
#
|
||||
@@ -50,9 +31,6 @@
|
||||
NULL|DynamicTablesPkg/Library/Acpi/Arm/AcpiRawLibArm/AcpiRawLibArm.inf
|
||||
NULL|DynamicTablesPkg/Library/Acpi/Arm/AcpiSpcrLibArm/AcpiSpcrLibArm.inf
|
||||
NULL|DynamicTablesPkg/Library/Acpi/Arm/AcpiSratLibArm/AcpiSratLibArm.inf
|
||||
|
||||
# AML Fixup
|
||||
NULL|DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtSerialPortLibArm/SsdtSerialPortLibArm.inf
|
||||
}
|
||||
|
||||
#
|
||||
|
@@ -1,99 +0,0 @@
|
||||
## @file
|
||||
# CI configuration for DynamicTablesPkg
|
||||
#
|
||||
# Copyright (c) 2020, Arm Limited. All rights reserved.<BR>
|
||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
##
|
||||
{
|
||||
## options defined .pytool/Plugin/CompilerPlugin
|
||||
"CompilerPlugin": {
|
||||
"DscPath": "DynamicTablesPkg.dsc"
|
||||
},
|
||||
|
||||
## options defined .pytool/Plugin/HostUnitTestCompilerPlugin
|
||||
"HostUnitTestCompilerPlugin": {
|
||||
"DscPath": "" # Don't support this test
|
||||
},
|
||||
|
||||
## options defined .pytool/Plugin/CharEncodingCheck
|
||||
"CharEncodingCheck": {
|
||||
"IgnoreFiles": []
|
||||
},
|
||||
|
||||
## options defined .pytool/Plugin/DependencyCheck
|
||||
"DependencyCheck": {
|
||||
"AcceptableDependencies": [
|
||||
"ArmPlatformPkg/ArmPlatformPkg.dec",
|
||||
"EmbeddedPkg/EmbeddedPkg.dec",
|
||||
"DynamicTablesPkg/DynamicTablesPkg.dec",
|
||||
"MdeModulePkg/MdeModulePkg.dec",
|
||||
"MdePkg/MdePkg.dec"
|
||||
],
|
||||
# For host based unit tests
|
||||
"AcceptableDependencies-HOST_APPLICATION":[
|
||||
"UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec"
|
||||
],
|
||||
# For UEFI shell based apps
|
||||
"AcceptableDependencies-UEFI_APPLICATION":[],
|
||||
"IgnoreInf": []
|
||||
},
|
||||
|
||||
## options defined .pytool/Plugin/DscCompleteCheck
|
||||
"DscCompleteCheck": {
|
||||
"IgnoreInf": [],
|
||||
"DscPath": "DynamicTablesPkg.dsc"
|
||||
},
|
||||
|
||||
## options defined .pytool/Plugin/HostUnitTestDscCompleteCheck
|
||||
"HostUnitTestDscCompleteCheck": {
|
||||
"IgnoreInf": [""],
|
||||
"DscPath": "" # Don't support this test
|
||||
},
|
||||
|
||||
## options defined .pytool/Plugin/GuidCheck
|
||||
"GuidCheck": {
|
||||
"IgnoreGuidName": [],
|
||||
"IgnoreGuidValue": [],
|
||||
"IgnoreFoldersAndFiles": [],
|
||||
"IgnoreDuplicates": [],
|
||||
},
|
||||
|
||||
## options defined .pytool/Plugin/LibraryClassCheck
|
||||
"LibraryClassCheck": {
|
||||
"IgnoreHeaderFile": []
|
||||
},
|
||||
|
||||
## options defined .pytool/Plugin/SpellCheck
|
||||
"SpellCheck": {
|
||||
"AuditOnly": False,
|
||||
"IgnoreFiles": [], # use gitignore syntax to ignore errors
|
||||
# in matching files
|
||||
"ExtendWords": [
|
||||
"ARMHB", # ARMHB000
|
||||
"ARMLTD",
|
||||
"EISAID",
|
||||
"CCIDX",
|
||||
"CCSIDR",
|
||||
"countof",
|
||||
"EOBJECT",
|
||||
"invoc",
|
||||
"GTBLOCK",
|
||||
"lgreater",
|
||||
"lless",
|
||||
"MPIDR",
|
||||
"pytool",
|
||||
"Roadmap",
|
||||
"ssdtserialporttemplate",
|
||||
"SMMUV",
|
||||
"standardised",
|
||||
"TABLEEX",
|
||||
"TNSID",
|
||||
"Vatos",
|
||||
"WBINVD"
|
||||
], # words to extend to the dictionary for this package
|
||||
"IgnoreStandardPaths": [], # Standard Plugin defined paths that
|
||||
# should be ignore
|
||||
"AdditionalIncludePaths": [] # Additional paths to spell check
|
||||
# (wildcards supported)
|
||||
}
|
||||
}
|
@@ -1,7 +1,7 @@
|
||||
## @file
|
||||
# dec file for Dynamic Tables Framework.
|
||||
#
|
||||
# Copyright (c) 2017 - 2020, Arm Limited. All rights reserved.<BR>
|
||||
# Copyright (c) 2017 - 2018, ARM Limited. All rights reserved.<BR>
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#
|
||||
@@ -16,17 +16,8 @@
|
||||
[Includes]
|
||||
Include
|
||||
|
||||
[LibraryClasses]
|
||||
## @libraryclass Defines a set of APIs for Dynamic AML generation.
|
||||
AmlLib|Include/Library/AmlLib/AmlLib.h
|
||||
|
||||
## @libraryclass Defines a set of methods for fixing up a SSDT Serial Port.
|
||||
SsdtSerialPortFixupLib|Include/Library/SsdtSerialPortFixupLib.h
|
||||
|
||||
## @libraryclass Defines a set of helper methods.
|
||||
TableHelperLib|Include/Library/TableHelperLib.h
|
||||
|
||||
[Protocols]
|
||||
|
||||
# Configuration Manager Protocol GUID
|
||||
gEdkiiConfigurationManagerProtocolGuid = { 0xd85a4835, 0x5a82, 0x4894, { 0xac, 0x2, 0x70, 0x6f, 0x43, 0xd5, 0x97, 0x8e } }
|
||||
|
||||
|
@@ -2,7 +2,7 @@
|
||||
# Dsc file for Dynamic Tables Framework.
|
||||
#
|
||||
# Copyright (c) 2019, Linaro Limited. All rights reserved.<BR>
|
||||
# Copyright (c) 2019 - 2020, Arm Limited. All rights reserved.<BR>
|
||||
# Copyright (c) 2019, ARM Limited. All rights reserved.<BR>
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#
|
||||
@@ -36,12 +36,10 @@
|
||||
PL011UartLib|ArmPlatformPkg/Library/PL011UartLib/PL011UartLib.inf
|
||||
|
||||
[Components.common]
|
||||
DynamicTablesPkg/Library/Common/AmlLib/AmlLib.inf
|
||||
DynamicTablesPkg/Library/Common/SsdtSerialPortFixupLib/SsdtSerialPortFixupLib.inf
|
||||
DynamicTablesPkg/Library/Common/TableHelperLib/TableHelperLib.inf
|
||||
|
||||
[BuildOptions]
|
||||
*_*_*_CC_FLAGS = -D DISABLE_NEW_DEPRECATED_INTERFACES
|
||||
*_*_*_CC_FLAGS = -DDISABLE_NEW_DEPRECATED_INTERFACES
|
||||
|
||||
!ifdef STATIC_ANALYSIS
|
||||
# Check all rules
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/** @file
|
||||
|
||||
Copyright (c) 2017 - 2020, Arm Limited. All rights reserved.<BR>
|
||||
Copyright (c) 2017 - 2019, ARM Limited. All rights reserved.
|
||||
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
@@ -55,10 +55,6 @@ The Dynamic Tables Framework implements the following ACPI table generators:
|
||||
the Configuration Manager and builds the PPTT table.
|
||||
- SRAT : The SRAT generator collates the system resource affinity information
|
||||
from the Configuration Manager and builds the SRAT table.
|
||||
- SSDT Serial-Port:
|
||||
The SSDT Serial generator collates the Serial port information
|
||||
from the Configuration Manager and patches the SSDT Serial Port
|
||||
template to build the SSDT Serial port table.
|
||||
*/
|
||||
|
||||
/** The ACPI_TABLE_GENERATOR_ID type describes ACPI table generator ID.
|
||||
@@ -82,7 +78,6 @@ typedef enum StdAcpiTableId {
|
||||
EStdAcpiTableIdIort, ///< IORT Generator
|
||||
EStdAcpiTableIdPptt, ///< PPTT Generator
|
||||
EStdAcpiTableIdSrat, ///< SRAT Generator
|
||||
EStdAcpiTableIdSsdtSerialPort, ///< SSDT Serial-Port Generator
|
||||
EStdAcpiTableIdMax
|
||||
} ESTD_ACPI_TABLE_ID;
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/** @file
|
||||
|
||||
Copyright (c) 2017 - 2020, Arm Limited. All rights reserved.<BR>
|
||||
Copyright (c) 2017 - 2019, ARM Limited. All rights reserved.
|
||||
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
@@ -56,7 +56,6 @@ typedef enum ArmObjectID {
|
||||
EArmObjDeviceHandleAcpi, ///< 32 - Device Handle Acpi
|
||||
EArmObjDeviceHandlePci, ///< 33 - Device Handle Pci
|
||||
EArmObjGenericInitiatorAffinityInfo, ///< 34 - Generic Initiator Affinity
|
||||
EArmObjSerialPortInfo, ///< 35 - Generic Serial Port Info
|
||||
EArmObjMax
|
||||
} EARM_OBJECT_ID;
|
||||
|
||||
@@ -271,8 +270,7 @@ typedef struct CmArmGicItsInfo {
|
||||
Serial Port information for the Platform.
|
||||
|
||||
ID: EArmObjSerialConsolePortInfo or
|
||||
EArmObjSerialDebugPortInfo or
|
||||
EArmObjSerialPortInfo
|
||||
EArmObjSerialDebugPortInfo
|
||||
*/
|
||||
typedef struct CmArmSerialPortInfo {
|
||||
/// The physical base address for the serial port
|
||||
@@ -289,9 +287,6 @@ typedef struct CmArmSerialPortInfo {
|
||||
|
||||
/// Serial Port subtype
|
||||
UINT16 PortSubtype;
|
||||
|
||||
/// The Base address length
|
||||
UINT64 BaseAddressLength;
|
||||
} CM_ARM_SERIAL_PORT_INFO;
|
||||
|
||||
/** A structure that describes the
|
||||
@@ -687,7 +682,7 @@ typedef struct CmArmProcHierarchyInfo {
|
||||
UINT32 NoOfPrivateResources;
|
||||
/// Token of the array which contains references to the resources private to
|
||||
/// this CM_ARM_PROC_HIERARCHY_INFO instance. This field is ignored if
|
||||
/// the NoOfPrivateResources is 0, in which case it is recommended to set
|
||||
/// the NoOfPrivateResources is 0, in which case it is recomended to set
|
||||
/// this field to CM_NULL_TOKEN.
|
||||
CM_OBJECT_TOKEN PrivateResourcesArrayToken;
|
||||
} CM_ARM_PROC_HIERARCHY_INFO;
|
||||
@@ -800,7 +795,7 @@ typedef struct CmArmDeviceHandlePci {
|
||||
/// PCI Bus Number - Max 256 busses (Bits 15:8 of BDF)
|
||||
UINT8 BusNumber;
|
||||
|
||||
/// PCI Device Number - Max 32 devices (Bits 7:3 of BDF)
|
||||
/// PCI Device Mumber - Max 32 devices (Bits 7:3 of BDF)
|
||||
UINT8 DeviceNumber;
|
||||
|
||||
/// PCI Function Number - Max 8 functions (Bits 2:0 of BDF)
|
||||
|
@@ -1,631 +0,0 @@
|
||||
/** @file
|
||||
AML Lib.
|
||||
|
||||
Copyright (c) 2019 - 2020, Arm Limited. All rights reserved.<BR>
|
||||
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
**/
|
||||
|
||||
#ifndef AML_LIB_H_
|
||||
#define AML_LIB_H_
|
||||
|
||||
/**
|
||||
@mainpage Dynamic AML Generation
|
||||
@{
|
||||
@par Summary
|
||||
@{
|
||||
ACPI tables are categorized as data tables and definition block
|
||||
tables. Dynamic Tables Framework currently supports generation of ACPI
|
||||
data tables. Generation of definition block tables is difficult as these
|
||||
tables are encoded in ACPI Machine Language (AML), which has a complex
|
||||
grammar.
|
||||
|
||||
Dynamic AML Generation is an extension to the Dynamic tables Framework.
|
||||
One of the techniques used to simplify definition block generation is to
|
||||
fixup a template SSDT table.
|
||||
|
||||
Dynamic AML aims to provide a framework that allows fixing up of an ACPI
|
||||
SSDT template with appropriate information about the hardware.
|
||||
|
||||
This framework consists of an:
|
||||
- AMLLib core that implements a rich set of interfaces to parse, traverse
|
||||
and update AML data.
|
||||
- AMLLib library APIs that provides interfaces to search and updates nodes
|
||||
in the AML namespace.
|
||||
@}
|
||||
@}
|
||||
*/
|
||||
|
||||
#include <IndustryStandard/Acpi.h>
|
||||
|
||||
#ifndef AML_HANDLE
|
||||
|
||||
/** Node handle.
|
||||
*/
|
||||
typedef void* AML_NODE_HANDLE;
|
||||
|
||||
/** Root Node handle.
|
||||
*/
|
||||
typedef void* AML_ROOT_NODE_HANDLE;
|
||||
|
||||
/** Object Node handle.
|
||||
*/
|
||||
typedef void* AML_OBJECT_NODE_HANDLE;
|
||||
|
||||
/** Data Node handle.
|
||||
*/
|
||||
typedef void* AML_DATA_NODE_HANDLE;
|
||||
|
||||
#endif // AML_HANDLE
|
||||
|
||||
/** Parse the definition block.
|
||||
|
||||
The function parses the whole AML blob. It starts with the ACPI DSDT/SSDT
|
||||
header and then parses the AML bytestream.
|
||||
A tree structure is returned via the RootPtr.
|
||||
The tree must be deleted with the AmlDeleteTree function.
|
||||
|
||||
@ingroup UserApis
|
||||
|
||||
@param [in] DefinitionBlock Pointer to the definition block.
|
||||
@param [out] RootPtr Pointer to the root node of the AML tree.
|
||||
|
||||
@retval EFI_SUCCESS The function completed successfully.
|
||||
@retval EFI_BUFFER_TOO_SMALL No space left in the buffer.
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter.
|
||||
@retval EFI_OUT_OF_RESOURCES Could not allocate memory.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AmlParseDefinitionBlock (
|
||||
IN CONST EFI_ACPI_DESCRIPTION_HEADER * DefinitionBlock,
|
||||
OUT AML_ROOT_NODE_HANDLE * RootPtr
|
||||
);
|
||||
|
||||
/** Serialize an AML definition block.
|
||||
|
||||
This functions allocates memory with the "AllocateZeroPool ()"
|
||||
function. This memory is used to serialize the AML tree and is
|
||||
returned in the Table.
|
||||
|
||||
@ingroup UserApis
|
||||
|
||||
@param [in] RootNode Root node of the tree.
|
||||
@param [out] Table On return, hold the serialized
|
||||
definition block.
|
||||
|
||||
@retval EFI_SUCCESS The function completed successfully.
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter.
|
||||
@retval EFI_OUT_OF_RESOURCES Could not allocate memory.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AmlSerializeDefinitionBlock (
|
||||
IN AML_ROOT_NODE_HANDLE RootNode,
|
||||
OUT EFI_ACPI_DESCRIPTION_HEADER ** Table
|
||||
);
|
||||
|
||||
/** Clone a node and its children (clone a tree branch).
|
||||
|
||||
The cloned branch returned is not attached to any tree.
|
||||
|
||||
@ingroup UserApis
|
||||
|
||||
@param [in] Node Pointer to a node.
|
||||
Node is the head of the branch to clone.
|
||||
@param [out] ClonedNode Pointer holding the head of the created cloned
|
||||
branch.
|
||||
|
||||
@retval EFI_SUCCESS The function completed successfully.
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter.
|
||||
@retval EFI_OUT_OF_RESOURCES Could not allocate memory.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AmlCloneTree (
|
||||
IN AML_NODE_HANDLE Node,
|
||||
OUT AML_NODE_HANDLE * ClonedNode
|
||||
);
|
||||
|
||||
/** Delete a Node and its children.
|
||||
|
||||
The Node must be removed from the tree first,
|
||||
or must be the root node.
|
||||
|
||||
@ingroup UserApis
|
||||
|
||||
@param [in] Node Pointer to the node to delete.
|
||||
|
||||
@retval EFI_SUCCESS The function completed successfully.
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AmlDeleteTree (
|
||||
IN AML_NODE_HANDLE Node
|
||||
);
|
||||
|
||||
/** Detach the Node from the tree.
|
||||
|
||||
The function will fail if the Node is in its parent's fixed
|
||||
argument list.
|
||||
The Node is not deleted. The deletion is done separately
|
||||
from the removal.
|
||||
|
||||
@ingroup UserApis
|
||||
|
||||
@param [in] Node Pointer to a Node.
|
||||
Must be a data node or an object node.
|
||||
|
||||
@retval EFI_SUCCESS The function completed successfully.
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AmlDetachNode (
|
||||
IN AML_NODE_HANDLE Node
|
||||
);
|
||||
|
||||
/** Find a node in the AML namespace, given an ASL path and a reference Node.
|
||||
|
||||
- The AslPath can be an absolute path, or a relative path from the
|
||||
reference Node;
|
||||
- Node must be a root node or a namespace node;
|
||||
- A root node is expected to be at the top of the tree.
|
||||
|
||||
E.g.:
|
||||
For the following AML namespace, with the ReferenceNode being the node with
|
||||
the name "AAAA":
|
||||
- the node with the name "BBBB" can be found by looking for the ASL
|
||||
path "BBBB";
|
||||
- the root node can be found by looking for the ASL relative path "^",
|
||||
or the absolute path "\\".
|
||||
|
||||
AML namespace:
|
||||
\
|
||||
\-AAAA <- ReferenceNode
|
||||
\-BBBB
|
||||
|
||||
@ingroup NameSpaceApis
|
||||
|
||||
@param [in] ReferenceNode Reference node.
|
||||
If a relative path is given, the
|
||||
search is done from this node. If
|
||||
an absolute path is given, the
|
||||
search is done from the root node.
|
||||
Must be a root node or an object
|
||||
node which is part of the
|
||||
namespace.
|
||||
@param [in] AslPath ASL path to the searched node in
|
||||
the namespace. An ASL path name is
|
||||
NULL terminated. Can be a relative
|
||||
or absolute path.
|
||||
E.g.: "\\_SB.CLU0.CPU0" or "^CPU0"
|
||||
@param [out] OutNode Pointer to the found node.
|
||||
Contains NULL if not found.
|
||||
|
||||
@retval EFI_SUCCESS The function completed successfully.
|
||||
@retval EFI_BUFFER_TOO_SMALL No space left in the buffer.
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter.
|
||||
@retval EFI_OUT_OF_RESOURCES Out of memory.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AmlFindNode (
|
||||
IN AML_NODE_HANDLE ReferenceNode,
|
||||
IN CHAR8 * AslPath,
|
||||
OUT AML_NODE_HANDLE * OutNode
|
||||
);
|
||||
|
||||
/**
|
||||
@defgroup UserApis User APIs
|
||||
@{
|
||||
User APIs are implemented to ease most common actions that might be done
|
||||
using the AmlLib. They allow to find specific objects like "_UID" or
|
||||
"_CRS" and to update their value. It also shows what can be done using
|
||||
AmlLib functions.
|
||||
@}
|
||||
*/
|
||||
|
||||
/** Update the name of a DeviceOp object node.
|
||||
|
||||
@ingroup UserApis
|
||||
|
||||
@param [in] DeviceOpNode Object node representing a Device.
|
||||
Must have an OpCode=AML_NAME_OP, SubOpCode=0.
|
||||
OpCode/SubOpCode.
|
||||
DeviceOp object nodes are defined in ASL
|
||||
using the "Device ()" function.
|
||||
@param [in] NewNameString The new Device's name.
|
||||
Must be a NULL-terminated ASL NameString
|
||||
e.g.: "DEV0", "DV15.DEV0", etc.
|
||||
The input string is copied.
|
||||
|
||||
@retval EFI_SUCCESS The function completed successfully.
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AmlDeviceOpUpdateName (
|
||||
IN AML_OBJECT_NODE_HANDLE DeviceOpNode,
|
||||
IN CHAR8 * NewNameString
|
||||
);
|
||||
|
||||
/** Update an integer value defined by a NameOp object node.
|
||||
|
||||
For compatibility reasons, the NameOpNode must initially
|
||||
contain an integer.
|
||||
|
||||
@ingroup UserApis
|
||||
|
||||
@param [in] NameOpNode NameOp object node.
|
||||
Must have an OpCode=AML_NAME_OP, SubOpCode=0.
|
||||
NameOp object nodes are defined in ASL
|
||||
using the "Name ()" function.
|
||||
@param [in] NewInt New Integer value to assign.
|
||||
Must be a UINT64.
|
||||
|
||||
@retval EFI_SUCCESS The function completed successfully.
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AmlNameOpUpdateInteger (
|
||||
IN AML_OBJECT_NODE_HANDLE NameOpNode,
|
||||
IN UINT64 NewInt
|
||||
);
|
||||
|
||||
/** Update a string value defined by a NameOp object node.
|
||||
|
||||
The NameOpNode must initially contain a string.
|
||||
The EISAID ASL macro converts a string to an integer. This, it is
|
||||
not accepted.
|
||||
|
||||
@ingroup UserApis
|
||||
|
||||
@param [in] NameOpNode NameOp object node.
|
||||
Must have an OpCode=AML_NAME_OP, SubOpCode=0.
|
||||
NameOp object nodes are defined in ASL
|
||||
using the "Name ()" function.
|
||||
@param [in] NewName New NULL terminated string to assign to
|
||||
the NameOpNode.
|
||||
The input string is copied.
|
||||
|
||||
@retval EFI_SUCCESS The function completed successfully.
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AmlNameOpUpdateString (
|
||||
IN AML_OBJECT_NODE_HANDLE NameOpNode,
|
||||
IN CONST CHAR8 * NewName
|
||||
);
|
||||
|
||||
/** Get the first Resource Data element contained in a "_CRS" object.
|
||||
|
||||
In the following ASL code, the function will return the Resource Data
|
||||
node corresponding to the "QWordMemory ()" ASL macro.
|
||||
Name (_CRS, ResourceTemplate() {
|
||||
QWordMemory (...) {...},
|
||||
Interrupt (...) {...}
|
||||
}
|
||||
)
|
||||
|
||||
Note:
|
||||
- The "_CRS" object must be declared using ASL "Name (Declare Named Object)".
|
||||
- "_CRS" declared using ASL "Method (Declare Control Method)" is not
|
||||
supported.
|
||||
|
||||
@ingroup UserApis
|
||||
|
||||
@param [in] NameOpCrsNode NameOp object node defining a "_CRS" object.
|
||||
Must have an OpCode=AML_NAME_OP, SubOpCode=0.
|
||||
NameOp object nodes are defined in ASL
|
||||
using the "Name ()" function.
|
||||
@param [out] OutRdNode Pointer to the first Resource Data element of
|
||||
the "_CRS" object. A Resource Data element
|
||||
is stored in a data node.
|
||||
|
||||
@retval EFI_SUCCESS The function completed successfully.
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AmlNameOpCrsGetFirstRdNode (
|
||||
IN AML_OBJECT_NODE_HANDLE NameOpCrsNode,
|
||||
OUT AML_DATA_NODE_HANDLE * OutRdNode
|
||||
);
|
||||
|
||||
/** Get the Resource Data element following the CurrRdNode Resource Data.
|
||||
|
||||
In the following ASL code, if CurrRdNode corresponds to the first
|
||||
"QWordMemory ()" ASL macro, the function will return the Resource Data
|
||||
node corresponding to the "Interrupt ()" ASL macro.
|
||||
Name (_CRS, ResourceTemplate() {
|
||||
QwordMemory (...) {...},
|
||||
Interrupt (...) {...}
|
||||
}
|
||||
)
|
||||
|
||||
The CurrRdNode Resource Data node must be defined in an object named "_CRS"
|
||||
and defined by a "Name ()" ASL function.
|
||||
|
||||
@ingroup UserApis
|
||||
|
||||
@param [in] CurrRdNode Pointer to the current Resource Data element of
|
||||
the "_CRS" variable.
|
||||
@param [out] OutRdNode Pointer to the Resource Data element following
|
||||
the CurrRdNode.
|
||||
Contain a NULL pointer if CurrRdNode is the
|
||||
last Resource Data element in the list.
|
||||
The "End Tag" is not considered as a resource
|
||||
data element and is not returned.
|
||||
|
||||
@retval EFI_SUCCESS The function completed successfully.
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AmlNameOpCrsGetNextRdNode (
|
||||
IN AML_DATA_NODE_HANDLE CurrRdNode,
|
||||
OUT AML_DATA_NODE_HANDLE * OutRdNode
|
||||
);
|
||||
|
||||
/** Update the first interrupt of an Interrupt resource data node.
|
||||
|
||||
The flags of the Interrupt resource data are left unchanged.
|
||||
|
||||
The InterruptRdNode corresponds to the Resource Data created by the
|
||||
"Interrupt ()" ASL macro. It is an Extended Interrupt Resource Data.
|
||||
See ACPI 6.3 specification, s6.4.3.6 "Extended Interrupt Descriptor"
|
||||
for more information about Extended Interrupt Resource Data.
|
||||
|
||||
@ingroup UserApis
|
||||
|
||||
@param [in] InterruptRdNode Pointer to the an extended interrupt
|
||||
resource data node.
|
||||
@param [in] Irq Interrupt value to update.
|
||||
|
||||
@retval EFI_SUCCESS The function completed successfully.
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter.
|
||||
@retval EFI_OUT_OF_RESOURCES Out of resources.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AmlUpdateRdInterrupt (
|
||||
IN AML_DATA_NODE_HANDLE InterruptRdNode,
|
||||
IN UINT32 Irq
|
||||
);
|
||||
|
||||
/** Update the base address and length of a QWord resource data node.
|
||||
|
||||
@ingroup UserApis
|
||||
|
||||
@param [in] QWordRdNode Pointer a QWord resource data
|
||||
node.
|
||||
@param [in] BaseAddress Base address.
|
||||
@param [in] BaseAddressLength Base address length.
|
||||
|
||||
@retval EFI_SUCCESS The function completed successfully.
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter.
|
||||
@retval EFI_OUT_OF_RESOURCES Out of resources.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AmlUpdateRdQWord (
|
||||
IN AML_DATA_NODE_HANDLE QWordRdNode,
|
||||
IN UINT64 BaseAddress,
|
||||
IN UINT64 BaseAddressLength
|
||||
);
|
||||
|
||||
/** Add an Interrupt Resource Data node.
|
||||
|
||||
This function creates a Resource Data element corresponding to the
|
||||
"Interrupt ()" ASL function, stores it in an AML Data Node.
|
||||
|
||||
It then adds it after the input CurrRdNode in the list of resource data
|
||||
element.
|
||||
|
||||
The Resource Data effectively created is an Extended Interrupt Resource
|
||||
Data. See ACPI 6.3 specification, s6.4.3.6 "Extended Interrupt Descriptor"
|
||||
for more information about Extended Interrupt Resource Data.
|
||||
|
||||
The Extended Interrupt contains one single interrupt.
|
||||
|
||||
This function allocates memory to create a data node. It is the caller's
|
||||
responsibility to either:
|
||||
- attach this node to an AML tree;
|
||||
- delete this node.
|
||||
|
||||
Note: The _CRS node must be defined using the ASL Name () function.
|
||||
e.g. Name (_CRS, ResourceTemplate () {
|
||||
...
|
||||
}
|
||||
|
||||
@ingroup UserApis
|
||||
|
||||
@param [in] NameOpCrsNode NameOp object node defining a "_CRS" object.
|
||||
Must have an OpCode=AML_NAME_OP, SubOpCode=0.
|
||||
NameOp object nodes are defined in ASL
|
||||
using the "Name ()" function.
|
||||
@param [in] ResourceConsumer The device consumes the specified interrupt
|
||||
or produces it for use by a child device.
|
||||
@param [in] EdgeTriggered The interrupt is edge triggered or
|
||||
level triggered.
|
||||
@param [in] ActiveLow The interrupt is active-high or active-low.
|
||||
@param [in] Shared The interrupt can be shared with other
|
||||
devices or not (Exclusive).
|
||||
@param [in] IrqList Interrupt list. Must be non-NULL.
|
||||
@param [in] IrqCount Interrupt count. Must be non-zero.
|
||||
|
||||
|
||||
@retval EFI_SUCCESS The function completed successfully.
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter.
|
||||
@retval EFI_OUT_OF_RESOURCES Could not allocate memory.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AmlCodeGenCrsAddRdInterrupt (
|
||||
IN AML_OBJECT_NODE_HANDLE NameOpCrsNode,
|
||||
IN BOOLEAN ResourceConsumer,
|
||||
IN BOOLEAN EdgeTriggered,
|
||||
IN BOOLEAN ActiveLow,
|
||||
IN BOOLEAN Shared,
|
||||
IN UINT32 * IrqList,
|
||||
IN UINT8 IrqCount
|
||||
);
|
||||
|
||||
/** AML code generation for DefinitionBlock.
|
||||
|
||||
Create a Root Node handle.
|
||||
It is the caller's responsibility to free the allocated memory
|
||||
with the AmlDeleteTree function.
|
||||
|
||||
AmlCodeGenDefinitionBlock (TableSignature, OemId, TableID, OEMRevision) is
|
||||
equivalent to the following ASL code:
|
||||
DefinitionBlock (AMLFileName, TableSignature, ComplianceRevision,
|
||||
OemId, TableID, OEMRevision) {}
|
||||
with the ComplianceRevision set to 2 and the AMLFileName is ignored.
|
||||
|
||||
@ingroup CodeGenApis
|
||||
|
||||
@param[in] TableSignature 4-character ACPI signature.
|
||||
Must be 'DSDT' or 'SSDT'.
|
||||
@param[in] OemId 6-character string OEM identifier.
|
||||
@param[in] OemTableId 8-character string OEM table identifier.
|
||||
@param[in] OemRevision OEM revision number.
|
||||
@param[out] DefinitionBlockTerm The ASL Term handle representing a
|
||||
Definition Block.
|
||||
|
||||
@retval EFI_SUCCESS Success.
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter.
|
||||
@retval EFI_OUT_OF_RESOURCES Failed to allocate memory.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AmlCodeGenDefinitionBlock (
|
||||
IN CONST CHAR8 * TableSignature,
|
||||
IN CONST CHAR8 * OemId,
|
||||
IN CONST CHAR8 * OemTableId,
|
||||
IN UINT32 OemRevision,
|
||||
OUT AML_ROOT_NODE_HANDLE * NewRootNode
|
||||
);
|
||||
|
||||
/** AML code generation for a Name object node, containing a String.
|
||||
|
||||
AmlCodeGenNameString ("_HID", "HID0000", ParentNode, NewObjectNode) is
|
||||
equivalent of the following ASL code:
|
||||
Name(_HID, "HID0000")
|
||||
|
||||
@ingroup CodeGenApis
|
||||
|
||||
@param [in] NameString The new variable name.
|
||||
Must be a NULL-terminated ASL NameString
|
||||
e.g.: "DEV0", "DV15.DEV0", etc.
|
||||
The input string is copied.
|
||||
@param [in] String NULL terminated String to associate to the
|
||||
NameString.
|
||||
@param [in] ParentNode If provided, set ParentNode as the parent
|
||||
of the node created.
|
||||
@param [out] NewObjectNode If success, contains the created node.
|
||||
|
||||
@retval EFI_SUCCESS Success.
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter.
|
||||
@retval EFI_OUT_OF_RESOURCES Failed to allocate memory.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AmlCodeGenNameString (
|
||||
IN CONST CHAR8 * NameString,
|
||||
IN CHAR8 * String,
|
||||
IN AML_NODE_HANDLE ParentNode, OPTIONAL
|
||||
OUT AML_OBJECT_NODE_HANDLE * NewObjectNode OPTIONAL
|
||||
);
|
||||
|
||||
/** AML code generation for a Name object node, containing an Integer.
|
||||
|
||||
AmlCodeGenNameInteger ("_UID", 1, ParentNode, NewObjectNode) is
|
||||
equivalent of the following ASL code:
|
||||
Name(_UID, One)
|
||||
|
||||
@ingroup CodeGenApis
|
||||
|
||||
@param [in] NameString The new variable name.
|
||||
Must be a NULL-terminated ASL NameString
|
||||
e.g.: "DEV0", "DV15.DEV0", etc.
|
||||
The input string is copied.
|
||||
@param [in] Integer Integer to associate to the NameString.
|
||||
@param [in] ParentNode If provided, set ParentNode as the parent
|
||||
of the node created.
|
||||
@param [out] NewObjectNode If success, contains the created node.
|
||||
|
||||
@retval EFI_SUCCESS Success.
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter.
|
||||
@retval EFI_OUT_OF_RESOURCES Failed to allocate memory.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AmlCodeGenNameInteger (
|
||||
IN CONST CHAR8 * NameString,
|
||||
IN UINT64 Integer,
|
||||
IN AML_NODE_HANDLE ParentNode, OPTIONAL
|
||||
OUT AML_OBJECT_NODE_HANDLE * NewObjectNode OPTIONAL
|
||||
);
|
||||
|
||||
/** AML code generation for a Device object node.
|
||||
|
||||
AmlCodeGenDevice ("COM0", ParentNode, NewObjectNode) is
|
||||
equivalent of the following ASL code:
|
||||
Device(COM0) {}
|
||||
|
||||
@ingroup CodeGenApis
|
||||
|
||||
@param [in] NameString The new Device's name.
|
||||
Must be a NULL-terminated ASL NameString
|
||||
e.g.: "DEV0", "DV15.DEV0", etc.
|
||||
The input string is copied.
|
||||
@param [in] ParentNode If provided, set ParentNode as the parent
|
||||
of the node created.
|
||||
@param [out] NewObjectNode If success, contains the created node.
|
||||
|
||||
@retval EFI_SUCCESS Success.
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter.
|
||||
@retval EFI_OUT_OF_RESOURCES Failed to allocate memory.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AmlCodeGenDevice (
|
||||
IN CONST CHAR8 * NameString,
|
||||
IN AML_NODE_HANDLE ParentNode, OPTIONAL
|
||||
OUT AML_OBJECT_NODE_HANDLE * NewObjectNode OPTIONAL
|
||||
);
|
||||
|
||||
/** AML code generation for a Scope object node.
|
||||
|
||||
AmlCodeGenScope ("_SB", ParentNode, NewObjectNode) is
|
||||
equivalent of the following ASL code:
|
||||
Scope(_SB) {}
|
||||
|
||||
@ingroup CodeGenApis
|
||||
|
||||
@param [in] NameString The new Scope's name.
|
||||
Must be a NULL-terminated ASL NameString
|
||||
e.g.: "DEV0", "DV15.DEV0", etc.
|
||||
The input string is copied.
|
||||
@param [in] ParentNode If provided, set ParentNode as the parent
|
||||
of the node created.
|
||||
@param [out] NewObjectNode If success, contains the created node.
|
||||
|
||||
@retval EFI_SUCCESS Success.
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter.
|
||||
@retval EFI_OUT_OF_RESOURCES Failed to allocate memory.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AmlCodeGenScope (
|
||||
IN CONST CHAR8 * NameString,
|
||||
IN AML_NODE_HANDLE ParentNode, OPTIONAL
|
||||
OUT AML_OBJECT_NODE_HANDLE * NewObjectNode OPTIONAL
|
||||
);
|
||||
|
||||
#endif // AML_LIB_H_
|
@@ -1,68 +0,0 @@
|
||||
/** @file
|
||||
Ssdt Serial Port Fixup Library
|
||||
|
||||
Copyright (c) 2020, Arm Limited. All rights reserved.<BR>
|
||||
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
**/
|
||||
|
||||
#ifndef SSDT_SERIAL_PORT_LIB_H_
|
||||
#define SSDT_SERIAL_PORT_LIB_H_
|
||||
|
||||
/** Build a SSDT table describing the input serial port.
|
||||
|
||||
The table created by this function must be freed by FreeSsdtSerialTable.
|
||||
|
||||
@param [in] AcpiTableInfo Pointer to the ACPI table information.
|
||||
@param [in] SerialPortInfo Serial port to describe in the SSDT table.
|
||||
@param [in] Name The Name to give to the Device.
|
||||
Must be a NULL-terminated ASL NameString
|
||||
e.g.: "DEV0", "DV15.DEV0", etc.
|
||||
@param [in] Uid UID for the Serial Port.
|
||||
@param [out] Table If success, pointer to the created SSDT table.
|
||||
|
||||
@retval EFI_SUCCESS Table generated successfully.
|
||||
@retval EFI_INVALID_PARAMETER A parameter is invalid.
|
||||
@retval EFI_NOT_FOUND Could not find information.
|
||||
@retval EFI_OUT_OF_RESOURCES Could not allocate memory.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
BuildSsdtSerialPortTable (
|
||||
IN CONST CM_STD_OBJ_ACPI_TABLE_INFO * AcpiTableInfo,
|
||||
IN CONST CM_ARM_SERIAL_PORT_INFO * SerialPortInfo,
|
||||
IN CONST CHAR8 * Name,
|
||||
IN CONST UINT64 Uid,
|
||||
OUT EFI_ACPI_DESCRIPTION_HEADER ** Table
|
||||
);
|
||||
|
||||
/** Free an SSDT table previously created by
|
||||
the BuildSsdtSerialTable function.
|
||||
|
||||
@param [in] Table Pointer to a SSDT table allocated by
|
||||
the BuildSsdtSerialTable function.
|
||||
|
||||
@retval EFI_SUCCESS Success.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
FreeSsdtSerialPortTable (
|
||||
IN EFI_ACPI_DESCRIPTION_HEADER * Table
|
||||
);
|
||||
|
||||
/** Validate the Serial Port Information.
|
||||
|
||||
@param [in] SerialPortInfoTable Table of CM_ARM_SERIAL_PORT_INFO.
|
||||
@param [in] SerialPortCount Count of SerialPort in the table.
|
||||
|
||||
@retval EFI_SUCCESS Success.
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
ValidateSerialPortInfo (
|
||||
IN CONST CM_ARM_SERIAL_PORT_INFO * SerialPortInfoTable,
|
||||
IN UINT32 SerialPortCount
|
||||
);
|
||||
|
||||
#endif // SSDT_SERIAL_PORT_LIB_H_
|
@@ -1,6 +1,6 @@
|
||||
/** @file
|
||||
|
||||
Copyright (c) 2017 - 2020, Arm Limited. All rights reserved.<BR>
|
||||
Copyright (c) 2017 - 2019, ARM Limited. All rights reserved.
|
||||
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
@@ -107,17 +107,4 @@ FindDuplicateValue (
|
||||
IN PFN_IS_EQUAL EqualTestFunction
|
||||
);
|
||||
|
||||
/** Convert a hex number to its ASCII code.
|
||||
|
||||
@param [in] x Hex number to convert.
|
||||
Must be 0 <= x < 16.
|
||||
|
||||
@return The ASCII code corresponding to x.
|
||||
**/
|
||||
UINT8
|
||||
EFIAPI
|
||||
AsciiFromHex (
|
||||
IN UINT8 x
|
||||
);
|
||||
|
||||
#endif // TABLE_HELPER_LIB_H_
|
||||
|
@@ -1,7 +1,7 @@
|
||||
## @file
|
||||
# DBG2 Table Generator
|
||||
#
|
||||
# Copyright (c) 2017 - 2020, Arm Limited. All rights reserved.<BR>
|
||||
# Copyright (c) 2017 - 2018, ARM Limited. All rights reserved.
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
##
|
||||
@@ -29,7 +29,6 @@
|
||||
[LibraryClasses]
|
||||
BaseLib
|
||||
PL011UartLib
|
||||
SsdtSerialPortFixupLib
|
||||
|
||||
[FixedPcd]
|
||||
gEfiMdePkgTokenSpaceGuid.PcdUartDefaultBaudRate
|
||||
|
@@ -1,8 +1,7 @@
|
||||
/** @file
|
||||
DBG2 Table Generator
|
||||
|
||||
Copyright (c) 2017 - 2020, Arm Limited. All rights reserved.<BR>
|
||||
|
||||
Copyright (c) 2017 - 2019, ARM Limited. All rights reserved.
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
@par Reference(s):
|
||||
@@ -13,7 +12,6 @@
|
||||
#include <IndustryStandard/DebugPort2Table.h>
|
||||
#include <Library/AcpiLib.h>
|
||||
#include <Library/DebugLib.h>
|
||||
#include <Library/MemoryAllocationLib.h>
|
||||
#include <Library/PL011UartLib.h>
|
||||
#include <Protocol/AcpiTable.h>
|
||||
#include <Protocol/SerialIo.h>
|
||||
@@ -22,7 +20,6 @@
|
||||
#include <AcpiTableGenerator.h>
|
||||
#include <ConfigurationManagerObject.h>
|
||||
#include <ConfigurationManagerHelper.h>
|
||||
#include <Library/SsdtSerialPortFixupLib.h>
|
||||
#include <Library/TableHelperLib.h>
|
||||
#include <Protocol/ConfigurationManagerProtocol.h>
|
||||
|
||||
@@ -47,21 +44,17 @@ Requirements:
|
||||
*/
|
||||
#define DBG2_NUMBER_OF_GENERIC_ADDRESS_REGISTERS 1
|
||||
|
||||
/** The index for the debug port 0 in the Debug port information list.
|
||||
/** The index for the debug port 1 in the Debug port information list.
|
||||
*/
|
||||
#define INDEX_DBG_PORT0 0
|
||||
#define DBG_PORT_INDEX_PORT1 0
|
||||
|
||||
/** A string representing the name of the debug port 0.
|
||||
/** A string representing the name of the debug port 1.
|
||||
*/
|
||||
#define NAME_STR_DBG_PORT0 "COM0"
|
||||
|
||||
/** An UID representing the debug port 0.
|
||||
*/
|
||||
#define UID_DBG_PORT0 0
|
||||
#define NAME_STR_PORT1 "COM1"
|
||||
|
||||
/** The length of the namespace string.
|
||||
*/
|
||||
#define DBG2_NAMESPACESTRING_FIELD_SIZE sizeof (NAME_STR_DBG_PORT0)
|
||||
#define DBG2_NAMESPACESTRING_FIELD_SIZE sizeof (NAME_STR_PORT1)
|
||||
|
||||
/** The PL011 UART address range length.
|
||||
*/
|
||||
@@ -166,7 +159,7 @@ DBG2_TABLE AcpiDbg2 = {
|
||||
0, // {Template}: Serial Port Subtype
|
||||
0, // {Template}: Serial Port Base Address
|
||||
PL011_UART_LENGTH,
|
||||
NAME_STR_DBG_PORT0
|
||||
NAME_STR_PORT1
|
||||
)
|
||||
}
|
||||
};
|
||||
@@ -224,115 +217,58 @@ SetupDebugUart (
|
||||
&StopBits
|
||||
);
|
||||
|
||||
DEBUG ((DEBUG_INFO, "Debug UART Configuration:\n"));
|
||||
DEBUG ((DEBUG_INFO, "UART Base = 0x%lx\n", SerialPortInfo->BaseAddress));
|
||||
DEBUG ((DEBUG_INFO, "Clock = %d\n", SerialPortInfo->Clock));
|
||||
DEBUG ((DEBUG_INFO, "Baudrate = %ld\n", BaudRate));
|
||||
DEBUG ((DEBUG_INFO, "Configuring Debug UART. Status = %r\n", Status));
|
||||
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
return Status;
|
||||
}
|
||||
|
||||
/** Free any resources allocated for constructing the tables.
|
||||
/** Construct the DBG2 ACPI table
|
||||
|
||||
@param [in] This Pointer to the ACPI table generator.
|
||||
@param [in] AcpiTableInfo Pointer to the ACPI Table Info.
|
||||
@param [in] CfgMgrProtocol Pointer to the Configuration Manager
|
||||
Protocol Interface.
|
||||
@param [in, out] Table Pointer to an array of pointers
|
||||
to ACPI Table(s).
|
||||
@param [in] TableCount Number of ACPI table(s).
|
||||
|
||||
@retval EFI_SUCCESS The resources were freed successfully.
|
||||
@retval EFI_INVALID_PARAMETER The table pointer is NULL or invalid.
|
||||
**/
|
||||
STATIC
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
FreeDbg2TableEx (
|
||||
IN CONST ACPI_TABLE_GENERATOR * CONST This,
|
||||
IN CONST CM_STD_OBJ_ACPI_TABLE_INFO * CONST AcpiTableInfo,
|
||||
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol,
|
||||
IN OUT EFI_ACPI_DESCRIPTION_HEADER *** CONST Table,
|
||||
IN CONST UINTN TableCount
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_ACPI_DESCRIPTION_HEADER ** TableList;
|
||||
|
||||
ASSERT (This != NULL);
|
||||
ASSERT (AcpiTableInfo != NULL);
|
||||
ASSERT (CfgMgrProtocol != NULL);
|
||||
ASSERT (AcpiTableInfo->TableGeneratorId == This->GeneratorID);
|
||||
ASSERT (AcpiTableInfo->AcpiTableSignature == This->AcpiTableSignature);
|
||||
|
||||
if ((Table == NULL) ||
|
||||
(*Table == NULL) ||
|
||||
(TableCount != 2)) {
|
||||
DEBUG ((DEBUG_ERROR, "ERROR: DBG2: Invalid Table Pointer\n"));
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
TableList = *Table;
|
||||
|
||||
if ((TableList[1] == NULL) ||
|
||||
(TableList[1]->Signature !=
|
||||
EFI_ACPI_6_3_SECONDARY_SYSTEM_DESCRIPTION_TABLE_SIGNATURE)) {
|
||||
DEBUG ((DEBUG_ERROR, "ERROR: DBG2: Invalid SSDT table pointer.\n"));
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
// Only need to free the SSDT table at index 1. The DBG2 table is static.
|
||||
Status = FreeSsdtSerialPortTable (TableList[1]);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
// Free the table list.
|
||||
FreePool (*Table);
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
/** Construct the DBG2 ACPI table and its associated SSDT table.
|
||||
The BuildDbg2Table function is called by the Dynamic Table Manager
|
||||
to construct the DBG2 ACPI table.
|
||||
|
||||
This function invokes the Configuration Manager protocol interface
|
||||
to get the required hardware information for generating the ACPI
|
||||
table.
|
||||
|
||||
If this function allocates any resources then they must be freed
|
||||
in the FreeXXXXTableResourcesEx function.
|
||||
in the FreeXXXXTableResources function.
|
||||
|
||||
@param [in] This Pointer to the ACPI table generator.
|
||||
@param [in] AcpiTableInfo Pointer to the ACPI table information.
|
||||
@param [in] CfgMgrProtocol Pointer to the Configuration Manager
|
||||
Protocol interface.
|
||||
@param [out] Table Pointer to a list of generated ACPI table(s).
|
||||
@param [out] TableCount Number of generated ACPI table(s).
|
||||
@param [in] This Pointer to the table generator.
|
||||
@param [in] AcpiTableInfo Pointer to the ACPI Table Info.
|
||||
@param [in] CfgMgrProtocol Pointer to the Configuration Manager
|
||||
Protocol Interface.
|
||||
@param [out] Table Pointer to the constructed ACPI Table.
|
||||
|
||||
@retval EFI_SUCCESS Table generated successfully.
|
||||
@retval EFI_BAD_BUFFER_SIZE The size returned by the Configuration
|
||||
Manager is less than the Object size for
|
||||
the requested object.
|
||||
@retval EFI_INVALID_PARAMETER A parameter is invalid.
|
||||
@retval EFI_NOT_FOUND Could not find information.
|
||||
@retval EFI_OUT_OF_RESOURCES Could not allocate memory.
|
||||
@retval EFI_UNSUPPORTED Unsupported configuration.
|
||||
@retval EFI_SUCCESS Table generated successfully.
|
||||
@retval EFI_INVALID_PARAMETER A parameter is invalid.
|
||||
@retval EFI_NOT_FOUND The required object was not found.
|
||||
@retval EFI_BAD_BUFFER_SIZE The size returned by the Configuration
|
||||
Manager is less than the Object size for the
|
||||
requested object.
|
||||
**/
|
||||
STATIC
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
BuildDbg2TableEx (
|
||||
IN CONST ACPI_TABLE_GENERATOR * This,
|
||||
IN CONST CM_STD_OBJ_ACPI_TABLE_INFO * CONST AcpiTableInfo,
|
||||
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol,
|
||||
OUT EFI_ACPI_DESCRIPTION_HEADER *** Table,
|
||||
OUT UINTN * CONST TableCount
|
||||
BuildDbg2Table (
|
||||
IN CONST ACPI_TABLE_GENERATOR * CONST This,
|
||||
IN CONST CM_STD_OBJ_ACPI_TABLE_INFO * CONST AcpiTableInfo,
|
||||
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol,
|
||||
OUT EFI_ACPI_DESCRIPTION_HEADER ** CONST Table
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
CM_ARM_SERIAL_PORT_INFO * SerialPortInfo;
|
||||
UINT32 SerialPortCount;
|
||||
EFI_ACPI_DESCRIPTION_HEADER ** TableList;
|
||||
EFI_STATUS Status;
|
||||
CM_ARM_SERIAL_PORT_INFO * SerialPortInfo;
|
||||
|
||||
ASSERT (This != NULL);
|
||||
ASSERT (AcpiTableInfo != NULL);
|
||||
ASSERT (CfgMgrProtocol != NULL);
|
||||
ASSERT (Table != NULL);
|
||||
ASSERT (TableCount != NULL);
|
||||
ASSERT (AcpiTableInfo->TableGeneratorId == This->GeneratorID);
|
||||
ASSERT (AcpiTableInfo->AcpiTableSignature == This->AcpiTableSignature);
|
||||
|
||||
@@ -355,7 +291,7 @@ BuildDbg2TableEx (
|
||||
CfgMgrProtocol,
|
||||
CM_NULL_TOKEN,
|
||||
&SerialPortInfo,
|
||||
&SerialPortCount
|
||||
NULL
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((
|
||||
@@ -363,41 +299,34 @@ BuildDbg2TableEx (
|
||||
"ERROR: DBG2: Failed to get serial port information. Status = %r\n",
|
||||
Status
|
||||
));
|
||||
return Status;
|
||||
goto error_handler;
|
||||
}
|
||||
|
||||
if (SerialPortCount == 0) {
|
||||
if (SerialPortInfo->BaseAddress == 0) {
|
||||
Status = EFI_INVALID_PARAMETER;
|
||||
DEBUG ((
|
||||
DEBUG_ERROR,
|
||||
"ERROR: DBG2: Serial port information not found. Status = %r\n",
|
||||
EFI_NOT_FOUND
|
||||
"ERROR: DBG2: Uart port base address is invalid. BaseAddress = 0x%lx\n",
|
||||
SerialPortInfo->BaseAddress
|
||||
));
|
||||
return EFI_NOT_FOUND;
|
||||
goto error_handler;
|
||||
}
|
||||
|
||||
// Only use the first DBG2 port information.
|
||||
Status = ValidateSerialPortInfo (SerialPortInfo, 1);
|
||||
if (EFI_ERROR (Status)) {
|
||||
if ((SerialPortInfo->PortSubtype !=
|
||||
EFI_ACPI_DBG2_PORT_SUBTYPE_SERIAL_ARM_PL011_UART) &&
|
||||
(SerialPortInfo->PortSubtype !=
|
||||
EFI_ACPI_DBG2_PORT_SUBTYPE_SERIAL_ARM_SBSA_GENERIC_UART_2X) &&
|
||||
(SerialPortInfo->PortSubtype !=
|
||||
EFI_ACPI_DBG2_PORT_SUBTYPE_SERIAL_ARM_SBSA_GENERIC_UART) &&
|
||||
(SerialPortInfo->PortSubtype !=
|
||||
EFI_ACPI_DBG2_PORT_SUBTYPE_SERIAL_DCC)) {
|
||||
Status = EFI_INVALID_PARAMETER;
|
||||
DEBUG ((
|
||||
DEBUG_ERROR,
|
||||
"ERROR: DBG2: Invalid serial port information. Status = %r\n",
|
||||
Status
|
||||
"ERROR: DBG2: Uart port sybtype is invalid. PortSubtype = 0x%x\n",
|
||||
SerialPortInfo->PortSubtype
|
||||
));
|
||||
return Status;
|
||||
}
|
||||
|
||||
// Allocate a table to store pointers to the DBG2 and SSDT tables.
|
||||
TableList = (EFI_ACPI_DESCRIPTION_HEADER**)
|
||||
AllocateZeroPool (sizeof (EFI_ACPI_DESCRIPTION_HEADER*) * 2);
|
||||
if (TableList == NULL) {
|
||||
Status = EFI_OUT_OF_RESOURCES;
|
||||
DEBUG ((
|
||||
DEBUG_ERROR,
|
||||
"ERROR: DBG2: Failed to allocate memory for Table List," \
|
||||
" Status = %r\n",
|
||||
Status
|
||||
));
|
||||
return Status;
|
||||
goto error_handler;
|
||||
}
|
||||
|
||||
Status = AddAcpiHeader (
|
||||
@@ -417,11 +346,11 @@ BuildDbg2TableEx (
|
||||
}
|
||||
|
||||
// Update the base address
|
||||
AcpiDbg2.Dbg2DeviceInfo[INDEX_DBG_PORT0].BaseAddressRegister.Address =
|
||||
AcpiDbg2.Dbg2DeviceInfo[DBG_PORT_INDEX_PORT1].BaseAddressRegister.Address =
|
||||
SerialPortInfo->BaseAddress;
|
||||
|
||||
// Update the serial port subtype
|
||||
AcpiDbg2.Dbg2DeviceInfo[INDEX_DBG_PORT0].Dbg2Device.PortSubtype =
|
||||
AcpiDbg2.Dbg2DeviceInfo[DBG_PORT_INDEX_PORT1].Dbg2Device.PortSubtype =
|
||||
SerialPortInfo->PortSubtype;
|
||||
|
||||
if ((SerialPortInfo->PortSubtype ==
|
||||
@@ -442,35 +371,9 @@ BuildDbg2TableEx (
|
||||
}
|
||||
}
|
||||
|
||||
TableList[0] = (EFI_ACPI_DESCRIPTION_HEADER*)&AcpiDbg2;
|
||||
|
||||
// Build a SSDT table describing the serial port.
|
||||
Status = BuildSsdtSerialPortTable (
|
||||
AcpiTableInfo,
|
||||
SerialPortInfo,
|
||||
NAME_STR_DBG_PORT0,
|
||||
UID_DBG_PORT0,
|
||||
&TableList[1]
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((
|
||||
DEBUG_ERROR,
|
||||
"ERROR: DBG2: Failed to build associated SSDT table. Status = %r\n",
|
||||
Status
|
||||
));
|
||||
goto error_handler;
|
||||
}
|
||||
|
||||
*TableCount = 2;
|
||||
*Table = TableList;
|
||||
|
||||
return Status;
|
||||
*Table = (EFI_ACPI_DESCRIPTION_HEADER*)&AcpiDbg2;
|
||||
|
||||
error_handler:
|
||||
if (TableList != NULL) {
|
||||
FreePool (TableList);
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
@@ -488,7 +391,7 @@ ACPI_TABLE_GENERATOR Dbg2Generator = {
|
||||
// Generator Description
|
||||
L"ACPI.STD.DBG2.GENERATOR",
|
||||
// ACPI Table Signature
|
||||
EFI_ACPI_6_3_DEBUG_PORT_2_TABLE_SIGNATURE,
|
||||
EFI_ACPI_6_2_DEBUG_PORT_2_TABLE_SIGNATURE,
|
||||
// ACPI Table Revision supported by this Generator
|
||||
EFI_ACPI_DBG2_DEBUG_DEVICE_INFORMATION_STRUCT_REVISION,
|
||||
// Minimum supported ACPI Table Revision
|
||||
@@ -497,14 +400,16 @@ ACPI_TABLE_GENERATOR Dbg2Generator = {
|
||||
TABLE_GENERATOR_CREATOR_ID_ARM,
|
||||
// Creator Revision
|
||||
DBG2_GENERATOR_REVISION,
|
||||
// Build table function. Use the extended version instead.
|
||||
// Build Table function
|
||||
BuildDbg2Table,
|
||||
// No additional resources are allocated by the generator.
|
||||
// Hence the Free Resource function is not required.
|
||||
NULL,
|
||||
// Free table function. Use the extended version instead.
|
||||
// Extended build function not needed
|
||||
NULL,
|
||||
// Extended Build table function.
|
||||
BuildDbg2TableEx,
|
||||
// Extended free function.
|
||||
FreeDbg2TableEx
|
||||
// Extended build function not implemented by the generator.
|
||||
// Hence extended free resource function is not required.
|
||||
NULL
|
||||
};
|
||||
|
||||
/** Register the Generator with the ACPI Table Factory.
|
||||
@@ -528,6 +433,7 @@ AcpiDbg2LibConstructor (
|
||||
Status = RegisterAcpiTableGenerator (&Dbg2Generator);
|
||||
DEBUG ((DEBUG_INFO, "DBG2: Register Generator. Status = %r\n", Status));
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/** @file
|
||||
IORT Table Generator
|
||||
|
||||
Copyright (c) 2017 - 2020, ARM Limited. All rights reserved.
|
||||
Copyright (c) 2017 - 2019, ARM Limited. All rights reserved.
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
@par Reference(s):
|
||||
@@ -1053,7 +1053,7 @@ AddRootComplexNodes (
|
||||
**/
|
||||
STATIC
|
||||
EFI_STATUS
|
||||
AddSmmuInterruptArray (
|
||||
AddSmmuInterrruptArray (
|
||||
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol,
|
||||
IN OUT EFI_ACPI_6_0_IO_REMAPPING_SMMU_INT * InterruptArray,
|
||||
IN UINT32 InterruptCount,
|
||||
@@ -1199,7 +1199,7 @@ AddSmmuV1V2Nodes (
|
||||
SmmuNode->SMMU_NSgCfgIrptFlags = NodeList->SMMU_NSgCfgIrptFlags;
|
||||
|
||||
// Add Context Interrupt Array
|
||||
Status = AddSmmuInterruptArray (
|
||||
Status = AddSmmuInterrruptArray (
|
||||
CfgMgrProtocol,
|
||||
ContextInterruptArray,
|
||||
SmmuNode->NumContextInterrupts,
|
||||
@@ -1217,7 +1217,7 @@ AddSmmuV1V2Nodes (
|
||||
// Add PMU Interrupt Array
|
||||
if ((SmmuNode->NumPmuInterrupts > 0) &&
|
||||
(NodeList->PmuInterruptToken != CM_NULL_TOKEN)) {
|
||||
Status = AddSmmuInterruptArray (
|
||||
Status = AddSmmuInterrruptArray (
|
||||
CfgMgrProtocol,
|
||||
PmuInterruptArray,
|
||||
SmmuNode->NumPmuInterrupts,
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/** @file
|
||||
MADT Table Generator
|
||||
|
||||
Copyright (c) 2017 - 2020, ARM Limited. All rights reserved.
|
||||
Copyright (c) 2017 - 2019, ARM Limited. All rights reserved.
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
@par Reference(s):
|
||||
@@ -332,24 +332,24 @@ AddGICMsiFrameInfoList (
|
||||
/** Update the GIC Redistributor Information.
|
||||
|
||||
@param [in] Gicr Pointer to GIC Redistributor structure.
|
||||
@param [in] GicRedistributorInfo Pointer to the GIC Redistributor Info.
|
||||
@param [in] GicRedisributorInfo Pointer to the GIC Redistributor Info.
|
||||
**/
|
||||
STATIC
|
||||
VOID
|
||||
AddGICRedistributor (
|
||||
IN EFI_ACPI_6_3_GICR_STRUCTURE * CONST Gicr,
|
||||
IN CONST CM_ARM_GIC_REDIST_INFO * CONST GicRedistributorInfo
|
||||
IN CONST CM_ARM_GIC_REDIST_INFO * CONST GicRedisributorInfo
|
||||
)
|
||||
{
|
||||
ASSERT (Gicr != NULL);
|
||||
ASSERT (GicRedistributorInfo != NULL);
|
||||
ASSERT (GicRedisributorInfo != NULL);
|
||||
|
||||
Gicr->Type = EFI_ACPI_6_3_GICR;
|
||||
Gicr->Length = sizeof (EFI_ACPI_6_3_GICR_STRUCTURE);
|
||||
Gicr->Reserved = EFI_ACPI_RESERVED_WORD;
|
||||
Gicr->DiscoveryRangeBaseAddress =
|
||||
GicRedistributorInfo->DiscoveryRangeBaseAddress;
|
||||
Gicr->DiscoveryRangeLength = GicRedistributorInfo->DiscoveryRangeLength;
|
||||
GicRedisributorInfo->DiscoveryRangeBaseAddress;
|
||||
Gicr->DiscoveryRangeLength = GicRedisributorInfo->DiscoveryRangeLength;
|
||||
}
|
||||
|
||||
/** Add the GIC Redistributor Information to the MADT Table.
|
||||
|
@@ -1,7 +1,7 @@
|
||||
## @file
|
||||
# SPCR Table Generator
|
||||
#
|
||||
# Copyright (c) 2017 - 2020, Arm Limited. All rights reserved.<BR>
|
||||
# Copyright (c) 2017 - 2018, ARM Limited. All rights reserved.
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
##
|
||||
@@ -27,7 +27,6 @@
|
||||
|
||||
[LibraryClasses]
|
||||
BaseLib
|
||||
SsdtSerialPortFixupLib
|
||||
|
||||
[Pcd]
|
||||
|
||||
|
@@ -1,8 +1,7 @@
|
||||
/** @file
|
||||
SPCR Table Generator
|
||||
|
||||
Copyright (c) 2017 - 2020, Arm Limited. All rights reserved.<BR>
|
||||
|
||||
Copyright (c) 2017 - 2019, ARM Limited. All rights reserved.
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
@par Reference(s):
|
||||
@@ -15,14 +14,12 @@
|
||||
#include <IndustryStandard/SerialPortConsoleRedirectionTable.h>
|
||||
#include <Library/AcpiLib.h>
|
||||
#include <Library/DebugLib.h>
|
||||
#include <Library/MemoryAllocationLib.h>
|
||||
#include <Protocol/AcpiTable.h>
|
||||
|
||||
// Module specific include files.
|
||||
#include <AcpiTableGenerator.h>
|
||||
#include <ConfigurationManagerObject.h>
|
||||
#include <ConfigurationManagerHelper.h>
|
||||
#include <Library/SsdtSerialPortFixupLib.h>
|
||||
#include <Library/TableHelperLib.h>
|
||||
#include <Protocol/ConfigurationManagerProtocol.h>
|
||||
|
||||
@@ -43,14 +40,6 @@ NOTE: This implementation ignores the possibility that the Serial settings may
|
||||
|
||||
#pragma pack(1)
|
||||
|
||||
/** A string representing the name of the SPCR port.
|
||||
*/
|
||||
#define NAME_STR_SPCR_PORT "COM1"
|
||||
|
||||
/** An UID representing the SPCR port.
|
||||
*/
|
||||
#define UID_SPCR_PORT 1
|
||||
|
||||
/** This macro defines the no flow control option.
|
||||
*/
|
||||
#define SPCR_FLOW_CONTROL_NONE 0
|
||||
@@ -103,111 +92,47 @@ GET_OBJECT_LIST (
|
||||
CM_ARM_SERIAL_PORT_INFO
|
||||
)
|
||||
|
||||
/** Free any resources allocated for constructing the tables.
|
||||
|
||||
@param [in] This Pointer to the ACPI table generator.
|
||||
@param [in] AcpiTableInfo Pointer to the ACPI Table Info.
|
||||
@param [in] CfgMgrProtocol Pointer to the Configuration Manager
|
||||
Protocol Interface.
|
||||
@param [in, out] Table Pointer to an array of pointers
|
||||
to ACPI Table(s).
|
||||
@param [in] TableCount Number of ACPI table(s).
|
||||
|
||||
@retval EFI_SUCCESS The resources were freed successfully.
|
||||
@retval EFI_INVALID_PARAMETER The table pointer is NULL or invalid.
|
||||
**/
|
||||
STATIC
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
FreeSpcrTableEx (
|
||||
IN CONST ACPI_TABLE_GENERATOR * CONST This,
|
||||
IN CONST CM_STD_OBJ_ACPI_TABLE_INFO * CONST AcpiTableInfo,
|
||||
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol,
|
||||
IN OUT EFI_ACPI_DESCRIPTION_HEADER *** CONST Table,
|
||||
IN CONST UINTN TableCount
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_ACPI_DESCRIPTION_HEADER ** TableList;
|
||||
|
||||
ASSERT (This != NULL);
|
||||
ASSERT (AcpiTableInfo != NULL);
|
||||
ASSERT (CfgMgrProtocol != NULL);
|
||||
ASSERT (AcpiTableInfo->TableGeneratorId == This->GeneratorID);
|
||||
ASSERT (AcpiTableInfo->AcpiTableSignature == This->AcpiTableSignature);
|
||||
|
||||
if ((Table == NULL) ||
|
||||
(*Table == NULL) ||
|
||||
(TableCount != 2)) {
|
||||
DEBUG ((DEBUG_ERROR, "ERROR: SPCR: Invalid Table Pointer\n"));
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
TableList = *Table;
|
||||
|
||||
if ((TableList[1] == NULL) ||
|
||||
(TableList[1]->Signature !=
|
||||
EFI_ACPI_6_3_SECONDARY_SYSTEM_DESCRIPTION_TABLE_SIGNATURE)) {
|
||||
DEBUG ((DEBUG_ERROR, "ERROR: SPCR: Invalid SSDT table pointer.\n"));
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
// Only need to free the SSDT table at index 1. The SPCR table is static.
|
||||
Status = FreeSsdtSerialPortTable (TableList[1]);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
// Free the table list.
|
||||
FreePool (*Table);
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
/** Construct the SPCR ACPI table and its associated SSDT table.
|
||||
/** Construct the SPCR ACPI table.
|
||||
|
||||
This function invokes the Configuration Manager protocol interface
|
||||
to get the required hardware information for generating the ACPI
|
||||
table.
|
||||
|
||||
If this function allocates any resources then they must be freed
|
||||
in the FreeXXXXTableResourcesEx function.
|
||||
in the FreeXXXXTableResources function.
|
||||
|
||||
@param [in] This Pointer to the ACPI table generator.
|
||||
@param [in] AcpiTableInfo Pointer to the ACPI table information.
|
||||
@param [in] CfgMgrProtocol Pointer to the Configuration Manager
|
||||
Protocol interface.
|
||||
@param [out] Table Pointer to a list of generated ACPI table(s).
|
||||
@param [out] TableCount Number of generated ACPI table(s).
|
||||
@param [in] This Pointer to the table generator.
|
||||
@param [in] AcpiTableInfo Pointer to the ACPI Table Info.
|
||||
@param [in] CfgMgrProtocol Pointer to the Configuration Manager
|
||||
Protocol Interface.
|
||||
@param [out] Table Pointer to the constructed ACPI Table.
|
||||
|
||||
@retval EFI_SUCCESS Table generated successfully.
|
||||
@retval EFI_BAD_BUFFER_SIZE The size returned by the Configuration
|
||||
Manager is less than the Object size for
|
||||
the requested object.
|
||||
@retval EFI_INVALID_PARAMETER A parameter is invalid.
|
||||
@retval EFI_NOT_FOUND Could not find information.
|
||||
@retval EFI_OUT_OF_RESOURCES Could not allocate memory.
|
||||
@retval EFI_UNSUPPORTED Unsupported configuration.
|
||||
@retval EFI_SUCCESS Table generated successfully.
|
||||
@retval EFI_INVALID_PARAMETER A parameter is invalid.
|
||||
@retval EFI_NOT_FOUND The required object was not found.
|
||||
@retval EFI_UNSUPPORTED An unsupported baudrate was specified by the
|
||||
Configuration Manager.
|
||||
@retval EFI_BAD_BUFFER_SIZE The size returned by the Configuration
|
||||
Manager is less than the Object size for the
|
||||
requested object.
|
||||
**/
|
||||
STATIC
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
BuildSpcrTableEx (
|
||||
IN CONST ACPI_TABLE_GENERATOR * This,
|
||||
IN CONST CM_STD_OBJ_ACPI_TABLE_INFO * CONST AcpiTableInfo,
|
||||
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol,
|
||||
OUT EFI_ACPI_DESCRIPTION_HEADER *** Table,
|
||||
OUT UINTN * CONST TableCount
|
||||
BuildSpcrTable (
|
||||
IN CONST ACPI_TABLE_GENERATOR * CONST This,
|
||||
IN CONST CM_STD_OBJ_ACPI_TABLE_INFO * CONST AcpiTableInfo,
|
||||
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol,
|
||||
OUT EFI_ACPI_DESCRIPTION_HEADER ** CONST Table
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
CM_ARM_SERIAL_PORT_INFO * SerialPortInfo;
|
||||
UINT32 SerialPortCount;
|
||||
EFI_ACPI_DESCRIPTION_HEADER ** TableList;
|
||||
EFI_STATUS Status;
|
||||
CM_ARM_SERIAL_PORT_INFO * SerialPortInfo;
|
||||
|
||||
ASSERT (This != NULL);
|
||||
ASSERT (AcpiTableInfo != NULL);
|
||||
ASSERT (CfgMgrProtocol != NULL);
|
||||
ASSERT (Table != NULL);
|
||||
ASSERT (TableCount != NULL);
|
||||
ASSERT (AcpiTableInfo->TableGeneratorId == This->GeneratorID);
|
||||
ASSERT (AcpiTableInfo->AcpiTableSignature == This->AcpiTableSignature);
|
||||
|
||||
@@ -230,7 +155,7 @@ BuildSpcrTableEx (
|
||||
CfgMgrProtocol,
|
||||
CM_NULL_TOKEN,
|
||||
&SerialPortInfo,
|
||||
&SerialPortCount
|
||||
NULL
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((
|
||||
@@ -238,46 +163,44 @@ BuildSpcrTableEx (
|
||||
"ERROR: SPCR: Failed to get serial port information. Status = %r\n",
|
||||
Status
|
||||
));
|
||||
return Status;
|
||||
goto error_handler;
|
||||
}
|
||||
|
||||
if (SerialPortCount == 0) {
|
||||
if (SerialPortInfo->BaseAddress == 0) {
|
||||
Status = EFI_INVALID_PARAMETER;
|
||||
DEBUG ((
|
||||
DEBUG_ERROR,
|
||||
"ERROR: SPCR: Serial port information not found. Status = %r\n",
|
||||
EFI_NOT_FOUND
|
||||
"ERROR: SPCR: Uart port base address is invalid. BaseAddress = 0x%lx\n",
|
||||
SerialPortInfo->BaseAddress
|
||||
));
|
||||
return EFI_NOT_FOUND;
|
||||
goto error_handler;
|
||||
}
|
||||
|
||||
// Validate the SerialPort info. Only one SPCR port can be described.
|
||||
// If platform provides description for multiple SPCR ports, use the
|
||||
// first SPCR port information.
|
||||
Status = ValidateSerialPortInfo (SerialPortInfo, 1);
|
||||
if (EFI_ERROR (Status)) {
|
||||
if ((SerialPortInfo->PortSubtype !=
|
||||
EFI_ACPI_DBG2_PORT_SUBTYPE_SERIAL_ARM_PL011_UART) &&
|
||||
(SerialPortInfo->PortSubtype !=
|
||||
EFI_ACPI_DBG2_PORT_SUBTYPE_SERIAL_ARM_SBSA_GENERIC_UART_2X) &&
|
||||
(SerialPortInfo->PortSubtype !=
|
||||
EFI_ACPI_DBG2_PORT_SUBTYPE_SERIAL_ARM_SBSA_GENERIC_UART) &&
|
||||
(SerialPortInfo->PortSubtype !=
|
||||
EFI_ACPI_DBG2_PORT_SUBTYPE_SERIAL_FULL_16550) &&
|
||||
(SerialPortInfo->PortSubtype !=
|
||||
EFI_ACPI_DBG2_PORT_SUBTYPE_SERIAL_DCC)) {
|
||||
Status = EFI_INVALID_PARAMETER;
|
||||
DEBUG ((
|
||||
DEBUG_ERROR,
|
||||
"ERROR: SPCR: Invalid serial port information. Status = %r\n",
|
||||
Status
|
||||
"ERROR: SPCR: Uart port sybtype is invalid. PortSubtype = 0x%x\n",
|
||||
SerialPortInfo->PortSubtype
|
||||
));
|
||||
return Status;
|
||||
goto error_handler;
|
||||
}
|
||||
|
||||
// Allocate a table to store pointers to the SPCR and SSDT tables.
|
||||
TableList = (EFI_ACPI_DESCRIPTION_HEADER**)
|
||||
AllocateZeroPool (sizeof (EFI_ACPI_DESCRIPTION_HEADER*) * 2);
|
||||
if (TableList == NULL) {
|
||||
Status = EFI_OUT_OF_RESOURCES;
|
||||
DEBUG ((
|
||||
DEBUG_ERROR,
|
||||
"ERROR: SPCR: Failed to allocate memory for Table List," \
|
||||
" Status = %r\n",
|
||||
Status
|
||||
));
|
||||
return Status;
|
||||
}
|
||||
DEBUG ((DEBUG_INFO, "SPCR UART Configuration:\n"));
|
||||
DEBUG ((DEBUG_INFO, " UART Base = 0x%lx\n", SerialPortInfo->BaseAddress));
|
||||
DEBUG ((DEBUG_INFO, " Clock = %d\n", SerialPortInfo->Clock));
|
||||
DEBUG ((DEBUG_INFO, " Baudrate = %ld\n", SerialPortInfo->BaudRate));
|
||||
DEBUG ((DEBUG_INFO, " Interrupt = %d\n", SerialPortInfo->Interrupt));
|
||||
|
||||
// Build SPCR table.
|
||||
Status = AddAcpiHeader (
|
||||
CfgMgrProtocol,
|
||||
This,
|
||||
@@ -301,7 +224,7 @@ BuildSpcrTableEx (
|
||||
Status = EFI_INVALID_PARAMETER;
|
||||
DEBUG ((
|
||||
DEBUG_ERROR,
|
||||
"ERROR: SPCR: Invalid Port subtype (must be < 256). Status = %r\n",
|
||||
"ERROR: SPCR: Invalid Port Sybtype (must be < 256). Status = %r\n",
|
||||
Status
|
||||
));
|
||||
goto error_handler;
|
||||
@@ -344,35 +267,9 @@ BuildSpcrTableEx (
|
||||
goto error_handler;
|
||||
} // switch
|
||||
|
||||
TableList[0] = (EFI_ACPI_DESCRIPTION_HEADER*)&AcpiSpcr;
|
||||
|
||||
// Build a SSDT table describing the serial port.
|
||||
Status = BuildSsdtSerialPortTable (
|
||||
AcpiTableInfo,
|
||||
SerialPortInfo,
|
||||
NAME_STR_SPCR_PORT,
|
||||
UID_SPCR_PORT,
|
||||
&TableList[1]
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((
|
||||
DEBUG_ERROR,
|
||||
"ERROR: SPCR: Failed to build associated SSDT table. Status = %r\n",
|
||||
Status
|
||||
));
|
||||
goto error_handler;
|
||||
}
|
||||
|
||||
*TableCount = 2;
|
||||
*Table = TableList;
|
||||
|
||||
return Status;
|
||||
*Table = (EFI_ACPI_DESCRIPTION_HEADER*)&AcpiSpcr;
|
||||
|
||||
error_handler:
|
||||
if (TableList != NULL) {
|
||||
FreePool (TableList);
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
@@ -390,7 +287,7 @@ ACPI_TABLE_GENERATOR SpcrGenerator = {
|
||||
// Generator Description
|
||||
L"ACPI.STD.SPCR.GENERATOR",
|
||||
// ACPI Table Signature
|
||||
EFI_ACPI_6_3_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_SIGNATURE,
|
||||
EFI_ACPI_6_2_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_SIGNATURE,
|
||||
// ACPI Table Revision supported by this Generator
|
||||
EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_REVISION,
|
||||
// Minimum supported ACPI Table Revision
|
||||
@@ -399,14 +296,16 @@ ACPI_TABLE_GENERATOR SpcrGenerator = {
|
||||
TABLE_GENERATOR_CREATOR_ID_ARM,
|
||||
// Creator Revision
|
||||
SPCR_GENERATOR_REVISION,
|
||||
// Build table function. Use the extended version instead.
|
||||
// Build Table function
|
||||
BuildSpcrTable,
|
||||
// No additional resources are allocated by the generator.
|
||||
// Hence the Free Resource function is not required.
|
||||
NULL,
|
||||
// Free table function. Use the extended version instead.
|
||||
// Extended build function not needed
|
||||
NULL,
|
||||
// Extended Build table function.
|
||||
BuildSpcrTableEx,
|
||||
// Extended free function.
|
||||
FreeSpcrTableEx
|
||||
// Extended build function not implemented by the generator.
|
||||
// Hence extended free resource function is not required.
|
||||
NULL
|
||||
};
|
||||
|
||||
/** Register the Generator with the ACPI Table Factory.
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/** @file
|
||||
SRAT Table Generator
|
||||
|
||||
Copyright (c) 2019 - 2020, ARM Limited. All rights reserved.
|
||||
Copyright (c) 2019, ARM Limited. All rights reserved.
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
@par Reference(s):
|
||||
@@ -101,7 +101,7 @@ GET_OBJECT_LIST (
|
||||
/** Return the PCI Device information in BDF format
|
||||
|
||||
PCI Bus Number - Max 256 busses (Bits 15:8 of BDF)
|
||||
PCI Device Number - Max 32 devices (Bits 7:3 of BDF)
|
||||
PCI Device Mumber - Max 32 devices (Bits 7:3 of BDF)
|
||||
PCI Function Number - Max 8 functions (Bits 2:0 of BDF)
|
||||
|
||||
@param [in] DeviceHandlePci Pointer to the PCI Device Handle.
|
||||
|
@@ -1,367 +0,0 @@
|
||||
/** @file
|
||||
SSDT Serial Port Table Generator.
|
||||
|
||||
Copyright (c) 2020, Arm Limited. All rights reserved.<BR>
|
||||
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
**/
|
||||
|
||||
#include <IndustryStandard/DebugPort2Table.h>
|
||||
#include <Library/AcpiLib.h>
|
||||
#include <Library/BaseLib.h>
|
||||
#include <Library/BaseMemoryLib.h>
|
||||
#include <Library/DebugLib.h>
|
||||
#include <Library/MemoryAllocationLib.h>
|
||||
#include <Library/UefiBootServicesTableLib.h>
|
||||
#include <Protocol/AcpiTable.h>
|
||||
|
||||
// Module specific include files.
|
||||
#include <AcpiTableGenerator.h>
|
||||
#include <ConfigurationManagerObject.h>
|
||||
#include <ConfigurationManagerHelper.h>
|
||||
#include <Library/SsdtSerialPortFixupLib.h>
|
||||
#include <Library/TableHelperLib.h>
|
||||
#include <Protocol/ConfigurationManagerProtocol.h>
|
||||
|
||||
/** ARM standard SSDT Serial Port Table Generator
|
||||
|
||||
Constructs SSDT tables describing serial ports (other than the serial ports
|
||||
used by the SPCR or DBG2 tables).
|
||||
|
||||
Requirements:
|
||||
The following Configuration Manager Object(s) are required by
|
||||
this Generator:
|
||||
- EArmObjSerialPortInfo
|
||||
*/
|
||||
|
||||
/** This macro expands to a function that retrieves the Serial-port
|
||||
information from the Configuration Manager.
|
||||
*/
|
||||
GET_OBJECT_LIST (
|
||||
EObjNameSpaceArm,
|
||||
EArmObjSerialPortInfo,
|
||||
CM_ARM_SERIAL_PORT_INFO
|
||||
);
|
||||
|
||||
/** Starting value for the UID to represent the serial ports.
|
||||
Note: The UID 0 and 1 are reserved for use by DBG2 port and SPCR
|
||||
respectively. So, the UIDs for serial ports for general use
|
||||
start at 2.
|
||||
*/
|
||||
#define SERIAL_PORT_START_UID 2
|
||||
|
||||
/** Maximum serial ports supported by this generator.
|
||||
This generator supports a maximum of 14 (16 - 2) serial ports.
|
||||
The -2 here reflects the reservation for serial ports for the DBG2
|
||||
and SPCR ports regardless of whether the DBG2 or SPCR port is enabled.
|
||||
Note: This is not a hard limitation and can be extended if needed.
|
||||
Corresponding changes would be needed to support the Name and
|
||||
UID fields describing the serial port.
|
||||
|
||||
*/
|
||||
#define MAX_SERIAL_PORTS_SUPPORTED 14
|
||||
|
||||
/** Free any resources allocated for constructing the tables.
|
||||
|
||||
@param [in] This Pointer to the ACPI table generator.
|
||||
@param [in] AcpiTableInfo Pointer to the ACPI Table Info.
|
||||
@param [in] CfgMgrProtocol Pointer to the Configuration Manager
|
||||
Protocol Interface.
|
||||
@param [in, out] Table Pointer to an array of pointers
|
||||
to ACPI Table(s).
|
||||
@param [in] TableCount Number of ACPI table(s).
|
||||
|
||||
@retval EFI_SUCCESS The resources were freed successfully.
|
||||
@retval EFI_INVALID_PARAMETER The table pointer is NULL or invalid.
|
||||
**/
|
||||
STATIC
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
FreeSsdtSerialPortTableEx (
|
||||
IN CONST ACPI_TABLE_GENERATOR * CONST This,
|
||||
IN CONST CM_STD_OBJ_ACPI_TABLE_INFO * CONST AcpiTableInfo,
|
||||
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol,
|
||||
IN OUT EFI_ACPI_DESCRIPTION_HEADER *** CONST Table,
|
||||
IN CONST UINTN TableCount
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_ACPI_DESCRIPTION_HEADER ** TableList;
|
||||
UINTN Index;
|
||||
|
||||
ASSERT (This != NULL);
|
||||
ASSERT (AcpiTableInfo->TableGeneratorId == This->GeneratorID);
|
||||
ASSERT (AcpiTableInfo->AcpiTableSignature == This->AcpiTableSignature);
|
||||
ASSERT (CfgMgrProtocol != NULL);
|
||||
ASSERT (AcpiTableInfo != NULL);
|
||||
|
||||
if ((Table == NULL) ||
|
||||
(*Table == NULL) ||
|
||||
(TableCount == 0)) {
|
||||
DEBUG ((DEBUG_ERROR, "ERROR: SSDT-SERIAL-PORT: Invalid Table Pointer\n"));
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
TableList = *Table;
|
||||
|
||||
for (Index = 0; Index < TableCount; Index++) {
|
||||
if ((TableList[Index] != NULL) &&
|
||||
(TableList[Index]->Signature ==
|
||||
EFI_ACPI_6_3_SECONDARY_SYSTEM_DESCRIPTION_TABLE_SIGNATURE)) {
|
||||
Status = FreeSsdtSerialPortTable (TableList[Index]);
|
||||
} else {
|
||||
Status = EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((
|
||||
DEBUG_ERROR,
|
||||
"ERROR: SSDT-SERIAL-PORT: Could not free SSDT table at index %d."
|
||||
" Status = %r\n",
|
||||
Index,
|
||||
Status
|
||||
));
|
||||
return Status;
|
||||
}
|
||||
} //for
|
||||
|
||||
// Free the table list.
|
||||
FreePool (*Table);
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
/** Construct SSDT tables describing serial-ports.
|
||||
|
||||
This function invokes the Configuration Manager protocol interface
|
||||
to get the required hardware information for generating the ACPI
|
||||
table.
|
||||
|
||||
If this function allocates any resources then they must be freed
|
||||
in the FreeXXXXTableResourcesEx function.
|
||||
|
||||
@param [in] This Pointer to the ACPI table generator.
|
||||
@param [in] AcpiTableInfo Pointer to the ACPI table information.
|
||||
@param [in] CfgMgrProtocol Pointer to the Configuration Manager
|
||||
Protocol interface.
|
||||
@param [out] Table Pointer to a list of generated ACPI table(s).
|
||||
@param [out] TableCount Number of generated ACPI table(s).
|
||||
|
||||
@retval EFI_SUCCESS Table generated successfully.
|
||||
@retval EFI_BAD_BUFFER_SIZE The size returned by the Configuration
|
||||
Manager is less than the Object size for
|
||||
the requested object.
|
||||
@retval EFI_INVALID_PARAMETER A parameter is invalid.
|
||||
@retval EFI_NOT_FOUND Could not find information.
|
||||
@retval EFI_OUT_OF_RESOURCES Could not allocate memory.
|
||||
@retval EFI_UNSUPPORTED Unsupported configuration.
|
||||
**/
|
||||
STATIC
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
BuildSsdtSerialPortTableEx (
|
||||
IN CONST ACPI_TABLE_GENERATOR * This,
|
||||
IN CONST CM_STD_OBJ_ACPI_TABLE_INFO * CONST AcpiTableInfo,
|
||||
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol,
|
||||
OUT EFI_ACPI_DESCRIPTION_HEADER *** Table,
|
||||
OUT UINTN * CONST TableCount
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
CM_ARM_SERIAL_PORT_INFO * SerialPortInfo;
|
||||
UINT32 SerialPortCount;
|
||||
UINTN Index;
|
||||
CHAR8 NewName[] = "COMx";
|
||||
UINT64 Uid;
|
||||
EFI_ACPI_DESCRIPTION_HEADER ** TableList;
|
||||
|
||||
ASSERT (This != NULL);
|
||||
ASSERT (AcpiTableInfo != NULL);
|
||||
ASSERT (CfgMgrProtocol != NULL);
|
||||
ASSERT (Table != NULL);
|
||||
ASSERT (TableCount != NULL);
|
||||
ASSERT (AcpiTableInfo->TableGeneratorId == This->GeneratorID);
|
||||
ASSERT (AcpiTableInfo->AcpiTableSignature == This->AcpiTableSignature);
|
||||
|
||||
*Table = NULL;
|
||||
|
||||
Status = GetEArmObjSerialPortInfo (
|
||||
CfgMgrProtocol,
|
||||
CM_NULL_TOKEN,
|
||||
&SerialPortInfo,
|
||||
&SerialPortCount
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((
|
||||
DEBUG_ERROR,
|
||||
"ERROR: SSDT-SERIAL-PORT: Failed to get serial port information."
|
||||
" Status = %r\n",
|
||||
Status
|
||||
));
|
||||
return Status;
|
||||
}
|
||||
|
||||
if (SerialPortCount > MAX_SERIAL_PORTS_SUPPORTED) {
|
||||
DEBUG ((
|
||||
DEBUG_ERROR,
|
||||
"ERROR: SSDT-SERIAL-PORT: Too many serial ports: %d."
|
||||
" Maximum serial ports supported = %d.\n",
|
||||
SerialPortCount,
|
||||
MAX_SERIAL_PORTS_SUPPORTED
|
||||
));
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
// Validate the SerialPort info.
|
||||
Status = ValidateSerialPortInfo (SerialPortInfo, SerialPortCount);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((
|
||||
DEBUG_ERROR,
|
||||
"ERROR: SSDT-SERIAL-PORT: Invalid serial port information. Status = %r\n",
|
||||
Status
|
||||
));
|
||||
return Status;
|
||||
}
|
||||
|
||||
// Allocate a table to store pointers to the SSDT tables.
|
||||
TableList = (EFI_ACPI_DESCRIPTION_HEADER**)
|
||||
AllocateZeroPool (
|
||||
(sizeof (EFI_ACPI_DESCRIPTION_HEADER*) * SerialPortCount)
|
||||
);
|
||||
if (TableList == NULL) {
|
||||
Status = EFI_OUT_OF_RESOURCES;
|
||||
DEBUG ((
|
||||
DEBUG_ERROR,
|
||||
"ERROR: SSDT-SERIAL-PORT: Failed to allocate memory for Table List."
|
||||
" Status = %r\n",
|
||||
Status
|
||||
));
|
||||
return Status;
|
||||
}
|
||||
|
||||
// Setup the table list early so that that appropriate cleanup
|
||||
// can be done in case of failure.
|
||||
*Table = TableList;
|
||||
|
||||
for (Index = 0; Index < SerialPortCount; Index++) {
|
||||
Uid = SERIAL_PORT_START_UID + Index;
|
||||
NewName[3] = AsciiFromHex ((UINT8)(Uid));
|
||||
|
||||
// Build a SSDT table describing the serial port.
|
||||
Status = BuildSsdtSerialPortTable (
|
||||
AcpiTableInfo,
|
||||
&SerialPortInfo[Index],
|
||||
NewName,
|
||||
Uid,
|
||||
&TableList[Index]
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((
|
||||
DEBUG_ERROR,
|
||||
"ERROR: SSDT-SERIAL-PORT: Failed to build associated SSDT table."
|
||||
" Status = %r\n",
|
||||
Status
|
||||
));
|
||||
goto error_handler;
|
||||
}
|
||||
|
||||
// Increment the table count here so that appropriate cleanup
|
||||
// can be done in case of failure.
|
||||
*TableCount += 1;
|
||||
} // for
|
||||
|
||||
error_handler:
|
||||
// Note: Table list and Serial port count has been setup. The
|
||||
// error handler does nothing here as the framework will invoke
|
||||
// FreeSsdtSerialPortTableEx() even on failure.
|
||||
return Status;
|
||||
}
|
||||
|
||||
/** This macro defines the SSDT Serial Port Table Generator revision.
|
||||
*/
|
||||
#define SSDT_SERIAL_GENERATOR_REVISION CREATE_REVISION (1, 0)
|
||||
|
||||
/** The interface for the SSDT Serial Port Table Generator.
|
||||
*/
|
||||
STATIC
|
||||
CONST
|
||||
ACPI_TABLE_GENERATOR SsdtSerialPortGenerator = {
|
||||
// Generator ID
|
||||
CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdSsdtSerialPort),
|
||||
// Generator Description
|
||||
L"ACPI.STD.SSDT.SERIAL.PORT.GENERATOR",
|
||||
// ACPI Table Signature
|
||||
EFI_ACPI_6_3_SECONDARY_SYSTEM_DESCRIPTION_TABLE_SIGNATURE,
|
||||
// ACPI Table Revision - Unused
|
||||
0,
|
||||
// Minimum ACPI Table Revision - Unused
|
||||
0,
|
||||
// Creator ID
|
||||
TABLE_GENERATOR_CREATOR_ID_ARM,
|
||||
// Creator Revision
|
||||
SSDT_SERIAL_GENERATOR_REVISION,
|
||||
// Build table function. Use the extended version instead.
|
||||
NULL,
|
||||
// Free table function. Use the extended version instead.
|
||||
NULL,
|
||||
// Extended Build table function.
|
||||
BuildSsdtSerialPortTableEx,
|
||||
// Extended free function.
|
||||
FreeSsdtSerialPortTableEx
|
||||
};
|
||||
|
||||
/** Register the Generator with the ACPI Table Factory.
|
||||
|
||||
@param [in] ImageHandle The handle to the image.
|
||||
@param [in] SystemTable Pointer to the System Table.
|
||||
|
||||
@retval EFI_SUCCESS The Generator is registered.
|
||||
@retval EFI_INVALID_PARAMETER A parameter is invalid.
|
||||
@retval EFI_ALREADY_STARTED The Generator for the Table ID
|
||||
is already registered.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AcpiSsdtSerialPortLibConstructor (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE * SystemTable
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
Status = RegisterAcpiTableGenerator (&SsdtSerialPortGenerator);
|
||||
DEBUG ((
|
||||
DEBUG_INFO,
|
||||
"SSDT-SERIAL-PORT: Register Generator. Status = %r\n",
|
||||
Status
|
||||
));
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
/** Deregister the Generator from the ACPI Table Factory.
|
||||
|
||||
@param [in] ImageHandle The handle to the image.
|
||||
@param [in] SystemTable Pointer to the System Table.
|
||||
|
||||
@retval EFI_SUCCESS The Generator is deregistered.
|
||||
@retval EFI_INVALID_PARAMETER A parameter is invalid.
|
||||
@retval EFI_NOT_FOUND The Generator is not registered.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AcpiSsdtSerialPortLibDestructor (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE * SystemTable
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
Status = DeregisterAcpiTableGenerator (&SsdtSerialPortGenerator);
|
||||
DEBUG ((
|
||||
DEBUG_INFO,
|
||||
"SSDT-SERIAL-PORT: Deregister Generator. Status = %r\n",
|
||||
Status
|
||||
));
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
return Status;
|
||||
}
|
@@ -1,33 +0,0 @@
|
||||
## @file
|
||||
# Ssdt Serial Port Table Generator
|
||||
#
|
||||
# Copyright (c) 2019 - 2020, Arm Limited. All rights reserved.<BR>
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
##
|
||||
|
||||
[Defines]
|
||||
INF_VERSION = 0x0001001B
|
||||
BASE_NAME = SsdtSerialPortLibArm
|
||||
FILE_GUID = D1F92325-2DFB-435C-9B4C-A6B864F19230
|
||||
VERSION_STRING = 1.0
|
||||
MODULE_TYPE = DXE_DRIVER
|
||||
LIBRARY_CLASS = NULL|DXE_DRIVER
|
||||
CONSTRUCTOR = AcpiSsdtSerialPortLibConstructor
|
||||
DESTRUCTOR = AcpiSsdtSerialPortLibDestructor
|
||||
|
||||
[Sources]
|
||||
SsdtSerialPortGenerator.c
|
||||
|
||||
[Packages]
|
||||
MdePkg/MdePkg.dec
|
||||
MdeModulePkg/MdeModulePkg.dec
|
||||
EmbeddedPkg/EmbeddedPkg.dec
|
||||
ArmPlatformPkg/ArmPlatformPkg.dec
|
||||
DynamicTablesPkg/DynamicTablesPkg.dec
|
||||
|
||||
[LibraryClasses]
|
||||
AmlLib
|
||||
BaseLib
|
||||
TableHelperLib
|
||||
SsdtSerialPortFixupLib
|
@@ -1,767 +0,0 @@
|
||||
/** @file
|
||||
AML Core Interface.
|
||||
|
||||
Copyright (c) 2019 - 2020, Arm Limited. All rights reserved.<BR>
|
||||
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
**/
|
||||
|
||||
#ifndef AML_CORE_INTERFACE_H_
|
||||
#define AML_CORE_INTERFACE_H_
|
||||
|
||||
/* This header file does not include internal Node definition,
|
||||
i.e. AML_ROOT_NODE, AML_OBJECT_NODE, etc. The node definitions
|
||||
must be included by the caller file. The function prototypes must
|
||||
only expose AML_NODE_HANDLE, AML_ROOT_NODE_HANDLE, etc. node
|
||||
definitions.
|
||||
This allows to keep the functions defined here both internal and
|
||||
potentially external. If necessary, any function of this file can
|
||||
be exposed externally.
|
||||
The Api folder is internal to the AmlLib, but should only use these
|
||||
functions. They provide a "safe" way to interact with the AmlLib.
|
||||
*/
|
||||
|
||||
#include <AmlDefines.h>
|
||||
#include <Include/Library/AmlLib/AmlLib.h>
|
||||
#include <ResourceData/AmlResourceData.h>
|
||||
|
||||
/**
|
||||
@defgroup CoreApis Core APIs
|
||||
@ingroup AMLLib
|
||||
@{
|
||||
Core APIs are the main APIs of the library. They allow to:
|
||||
- Create an AML tree;
|
||||
- Delete an AML tree;
|
||||
- Clone an AML tree/node;
|
||||
- Serialize an AML tree (convert the tree to a DSDT/SSDT table).
|
||||
@}
|
||||
*/
|
||||
|
||||
/** Serialize a tree to create a DSDT/SSDT table.
|
||||
|
||||
If:
|
||||
- the content of BufferSize is >= to the size needed to serialize the
|
||||
definition block;
|
||||
- Buffer is not NULL;
|
||||
first serialize the ACPI DSDT/SSDT header from the root node,
|
||||
then serialize the AML blob from the rest of the tree.
|
||||
|
||||
The content of BufferSize is always updated to the size needed to
|
||||
serialize the definition block.
|
||||
|
||||
@ingroup CoreApis
|
||||
|
||||
@param [in] RootNode Pointer to a root node.
|
||||
@param [in] Buffer Buffer to write the DSDT/SSDT table to.
|
||||
If Buffer is NULL, the size needed to
|
||||
serialize the DSDT/SSDT table is returned
|
||||
in BufferSize.
|
||||
@param [in, out] BufferSize Pointer holding the size of the Buffer.
|
||||
Its content is always updated to the size
|
||||
needed to serialize the DSDT/SSDT table.
|
||||
|
||||
@retval EFI_SUCCESS The function completed successfully.
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter.
|
||||
@retval EFI_BUFFER_TOO_SMALL No space left in the buffer.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AmlSerializeTree (
|
||||
IN AML_ROOT_NODE_HANDLE RootNode,
|
||||
IN UINT8 * Buffer, OPTIONAL
|
||||
IN OUT UINT32 * BufferSize
|
||||
);
|
||||
|
||||
/** Clone a node.
|
||||
|
||||
This function does not clone the children nodes.
|
||||
The cloned node returned is not attached to any tree.
|
||||
|
||||
@ingroup CoreApis
|
||||
|
||||
@param [in] Node Pointer to a node.
|
||||
@param [out] ClonedNode Pointer holding the cloned node.
|
||||
|
||||
@retval EFI_SUCCESS The function completed successfully.
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter.
|
||||
@retval EFI_OUT_OF_RESOURCES Could not allocate memory.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AmlCloneNode (
|
||||
IN AML_NODE_HANDLE Node,
|
||||
OUT AML_NODE_HANDLE * ClonedNode
|
||||
);
|
||||
|
||||
/**
|
||||
@defgroup TreeModificationApis Tree modification APIs
|
||||
@ingroup AMLLib
|
||||
@{
|
||||
Tree modification APIs allow to add/remove/replace nodes that are in a
|
||||
variable list of arguments.
|
||||
|
||||
No interface is provided to add/remove/replace nodes that are in a fixed
|
||||
list of arguments. Indeed, these nodes are the spine of the tree and a
|
||||
mismanipulation would make the tree inconsistent.
|
||||
|
||||
It is however possible to modify the content of fixed argument nodes via
|
||||
@ref NodeInterfaceApis APIs.
|
||||
@}
|
||||
*/
|
||||
|
||||
/** Remove the Node from its parent's variable list of arguments.
|
||||
|
||||
The function will fail if the Node is in its parent's fixed
|
||||
argument list.
|
||||
The Node is not deleted. The deletion is done separately
|
||||
from the removal.
|
||||
|
||||
@ingroup TreeModificationApis
|
||||
|
||||
@param [in] Node Pointer to a Node.
|
||||
Must be a data node or an object node.
|
||||
|
||||
@retval EFI_SUCCESS The function completed successfully.
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AmlRemoveNodeFromVarArgList (
|
||||
IN AML_NODE_HANDLE Node
|
||||
);
|
||||
|
||||
/** Add the NewNode to the head of the variable list of arguments
|
||||
of the ParentNode.
|
||||
|
||||
@ingroup TreeModificationApis
|
||||
|
||||
@param [in] ParentNode Pointer to the parent node.
|
||||
Must be a root or an object node.
|
||||
@param [in] NewNode Pointer to the node to add.
|
||||
|
||||
@retval EFI_SUCCESS The function completed successfully.
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AmlVarListAddHead (
|
||||
IN AML_NODE_HANDLE ParentNode,
|
||||
IN AML_NODE_HANDLE NewNode
|
||||
);
|
||||
|
||||
/** Add the NewNode to the tail of the variable list of arguments
|
||||
of the ParentNode.
|
||||
|
||||
@ingroup TreeModificationApis
|
||||
|
||||
@param [in] ParentNode Pointer to the parent node.
|
||||
Must be a root or an object node.
|
||||
@param [in] NewNode Pointer to the node to add.
|
||||
|
||||
@retval EFI_SUCCESS The function completed successfully.
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AmlVarListAddTail (
|
||||
IN AML_NODE_HANDLE ParentNode,
|
||||
IN AML_NODE_HANDLE NewNode
|
||||
);
|
||||
|
||||
/** Add the NewNode before the Node in the list of variable
|
||||
arguments of the Node's parent.
|
||||
|
||||
@ingroup TreeModificationApis
|
||||
|
||||
@param [in] Node Pointer to a node.
|
||||
Must be a root or an object node.
|
||||
@param [in] NewNode Pointer to the node to add.
|
||||
|
||||
@retval EFI_SUCCESS The function completed successfully.
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AmlVarListAddBefore (
|
||||
IN AML_NODE_HANDLE Node,
|
||||
IN AML_NODE_HANDLE NewNode
|
||||
);
|
||||
|
||||
/** Add the NewNode after the Node in the variable list of arguments
|
||||
of the Node's parent.
|
||||
|
||||
@ingroup TreeModificationApis
|
||||
|
||||
@param [in] Node Pointer to a node.
|
||||
Must be a root or an object node.
|
||||
@param [in] NewNode Pointer to the node to add.
|
||||
|
||||
@retval EFI_SUCCESS The function completed successfully.
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AmlVarListAddAfter (
|
||||
IN AML_NODE_HANDLE Node,
|
||||
IN AML_NODE_HANDLE NewNode
|
||||
);
|
||||
|
||||
/** Append a Resource Data node to the BufferOpNode.
|
||||
|
||||
The Resource Data node is added at the end of the variable
|
||||
list of arguments of the BufferOpNode, but before the End Tag.
|
||||
If no End Tag is found, the function returns an error.
|
||||
|
||||
@param [in] BufferOpNode Buffer node containing resource data elements.
|
||||
@param [in] NewRdNode The new Resource Data node to add.
|
||||
|
||||
@retval EFI_SUCCESS The function completed successfully.
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AmlAppendRdNode (
|
||||
IN AML_OBJECT_NODE_HANDLE BufferOpNode,
|
||||
IN AML_DATA_NODE_HANDLE NewRdNode
|
||||
);
|
||||
|
||||
/** Replace the OldNode, which is in a variable list of arguments,
|
||||
with the NewNode.
|
||||
|
||||
Note: This function unlinks the OldNode from the tree. It is the callers
|
||||
responsibility to delete the OldNode if needed.
|
||||
|
||||
@ingroup TreeModificationApis
|
||||
|
||||
@param [in] OldNode Pointer to the node to replace.
|
||||
Must be a data node or an object node.
|
||||
@param [in] NewNode The new node to insert.
|
||||
Must be a data node or an object node.
|
||||
|
||||
@retval EFI_SUCCESS The function completed successfully.
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AmlReplaceVariableArgument (
|
||||
IN AML_NODE_HANDLE OldNode,
|
||||
IN AML_NODE_HANDLE NewNode
|
||||
);
|
||||
|
||||
/**
|
||||
@defgroup NodeInterfaceApis Node Interface APIs
|
||||
@ingroup AMLLib
|
||||
@{
|
||||
Node Interface APIs allow to query information from a node. Some functions
|
||||
expect a specific node type among the root/object/data node types.
|
||||
|
||||
For instance, AmlGetRootNodeInfo expects to receive a root node.
|
||||
|
||||
E.g.: Query the node type, the ACPI header stored in the root node,
|
||||
the OpCode/SubOpCode/PkgLen of an object node, the type of data
|
||||
stored in a data node, etc.
|
||||
|
||||
These APIs also allow to update some information.
|
||||
|
||||
E.g.: The ACPI header stored in the root node, the buffer of a data node.
|
||||
|
||||
The information of object nodes and the data type of data nodes cannot be
|
||||
modified. This prevents the creation of an inconsistent tree.
|
||||
|
||||
It is however possible to remove a node from a variable list of arguments
|
||||
and replace it. Use the @ref TreeModificationApis APIs for this.
|
||||
@}
|
||||
*/
|
||||
|
||||
/** Returns the tree node type (Root/Object/Data).
|
||||
|
||||
@ingroup NodeInterfaceApis
|
||||
|
||||
@param [in] Node Pointer to a Node.
|
||||
|
||||
@return The node type.
|
||||
EAmlNodeUnknown if invalid parameter.
|
||||
**/
|
||||
EAML_NODE_TYPE
|
||||
EFIAPI
|
||||
AmlGetNodeType (
|
||||
IN AML_NODE_HANDLE Node
|
||||
);
|
||||
|
||||
/** Get the RootNode information.
|
||||
The Node must be a root node.
|
||||
|
||||
@ingroup NodeInterfaceApis
|
||||
|
||||
@param [in] RootNode Pointer to a root node.
|
||||
@param [out] SdtHeaderBuffer Buffer to copy the ACPI DSDT/SSDT header to.
|
||||
|
||||
@retval EFI_SUCCESS The function completed successfully.
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AmlGetRootNodeInfo (
|
||||
IN AML_ROOT_NODE_HANDLE RootNode,
|
||||
OUT EFI_ACPI_DESCRIPTION_HEADER * SdtHeaderBuffer
|
||||
);
|
||||
|
||||
/** Get the ObjectNode information.
|
||||
The Node must be an object node.
|
||||
|
||||
@ingroup NodeInterfaceApis
|
||||
|
||||
@param [in] ObjectNode Pointer to an object node.
|
||||
@param [out] OpCode Pointer holding the OpCode.
|
||||
Optional, can be NULL.
|
||||
@param [out] SubOpCode Pointer holding the SubOpCode.
|
||||
Optional, can be NULL.
|
||||
@param [out] PkgLen Pointer holding the PkgLen.
|
||||
The PkgLen is 0 for nodes
|
||||
not having the Pkglen attribute.
|
||||
Optional, can be NULL.
|
||||
@param [out] IsNameSpaceNode Pointer holding TRUE if the node is defining
|
||||
or changing the NameSpace scope.
|
||||
E.g.: The "Name ()" and "Scope ()" ASL
|
||||
statements add/modify the NameSpace scope.
|
||||
Their corresponding node are NameSpace nodes.
|
||||
Optional, can be NULL.
|
||||
|
||||
@retval EFI_SUCCESS The function completed successfully.
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AmlGetObjectNodeInfo (
|
||||
IN AML_OBJECT_NODE_HANDLE ObjectNode,
|
||||
OUT UINT8 * OpCode, OPTIONAL
|
||||
OUT UINT8 * SubOpCode, OPTIONAL
|
||||
OUT UINT32 * PkgLen, OPTIONAL
|
||||
OUT BOOLEAN * IsNameSpaceNode OPTIONAL
|
||||
);
|
||||
|
||||
/** Returns the count of the fixed arguments for the input Node.
|
||||
|
||||
@ingroup NodeInterfaceApis
|
||||
|
||||
@param [in] Node Pointer to an object node.
|
||||
|
||||
@return Number of fixed arguments of the object node.
|
||||
Return 0 if the node is not an object node.
|
||||
**/
|
||||
UINT8
|
||||
AmlGetFixedArgumentCount (
|
||||
IN AML_OBJECT_NODE_HANDLE Node
|
||||
);
|
||||
|
||||
/** Get the data type of the DataNode.
|
||||
The Node must be a data node.
|
||||
|
||||
@ingroup NodeInterfaceApis
|
||||
|
||||
@param [in] DataNode Pointer to a data node.
|
||||
@param [out] DataType Pointer holding the data type of the data buffer.
|
||||
|
||||
@retval EFI_SUCCESS The function completed successfully.
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AmlGetNodeDataType (
|
||||
IN AML_DATA_NODE_HANDLE DataNode,
|
||||
OUT EAML_NODE_DATA_TYPE * DataType
|
||||
);
|
||||
|
||||
/** Get the descriptor Id of the resource data element
|
||||
contained in the DataNode.
|
||||
|
||||
The Node must be a data node.
|
||||
The Node must have the resource data type, i.e. have the
|
||||
EAmlNodeDataTypeResourceData data type.
|
||||
|
||||
@ingroup NodeInterfaceApis
|
||||
|
||||
@param [in] DataNode Pointer to a data node containing a
|
||||
resource data element.
|
||||
@param [out] ResourceDataType Pointer holding the descriptor Id of
|
||||
the resource data.
|
||||
|
||||
@retval EFI_SUCCESS The function completed successfully.
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AmlGetResourceDataType (
|
||||
IN AML_DATA_NODE_HANDLE DataNode,
|
||||
OUT AML_RD_HEADER * ResourceDataType
|
||||
);
|
||||
|
||||
/** Get the data buffer and size of the DataNode.
|
||||
The Node must be a data node.
|
||||
|
||||
BufferSize is always updated to the size of buffer of the DataNode.
|
||||
|
||||
If:
|
||||
- the content of BufferSize is >= to the DataNode's buffer size;
|
||||
- Buffer is not NULL;
|
||||
then copy the content of the DataNode's buffer in Buffer.
|
||||
|
||||
@ingroup NodeInterfaceApis
|
||||
|
||||
@param [in] DataNode Pointer to a data node.
|
||||
@param [out] Buffer Buffer to write the data to.
|
||||
Optional, if NULL, only update BufferSize.
|
||||
@param [in, out] BufferSize Pointer holding:
|
||||
- At entry, the size of the Buffer;
|
||||
- At exit, the size of the DataNode's
|
||||
buffer size.
|
||||
|
||||
@retval EFI_SUCCESS The function completed successfully.
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AmlGetDataNodeBuffer (
|
||||
IN AML_DATA_NODE_HANDLE DataNode,
|
||||
OUT UINT8 * Buffer, OPTIONAL
|
||||
IN OUT UINT32 * BufferSize
|
||||
);
|
||||
|
||||
/** Update the ACPI DSDT/SSDT table header.
|
||||
|
||||
The input SdtHeader information is copied to the tree RootNode.
|
||||
The table Length field is automatically updated.
|
||||
The checksum field is only updated when serializing the tree.
|
||||
|
||||
@ingroup NodeInterfaceApis
|
||||
|
||||
@param [in] RootNode Pointer to a root node.
|
||||
@param [in] SdtHeader Pointer to an ACPI DSDT/SSDT table header.
|
||||
|
||||
@retval EFI_SUCCESS The function completed successfully.
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AmlUpdateRootNode (
|
||||
IN AML_ROOT_NODE_HANDLE RootNode,
|
||||
IN CONST EFI_ACPI_DESCRIPTION_HEADER * SdtHeader
|
||||
);
|
||||
|
||||
/** Update an object node representing an integer with a new value.
|
||||
|
||||
The object node must have one of the following OpCodes:
|
||||
- AML_BYTE_PREFIX
|
||||
- AML_WORD_PREFIX
|
||||
- AML_DWORD_PREFIX
|
||||
- AML_QWORD_PREFIX
|
||||
- AML_ZERO_OP
|
||||
- AML_ONE_OP
|
||||
|
||||
The following OpCode is not supported:
|
||||
- AML_ONES_OP
|
||||
|
||||
@param [in] IntegerOpNode Pointer an object node containing an integer.
|
||||
Must not be an object node with an AML_ONES_OP
|
||||
OpCode.
|
||||
@param [in] NewInteger New integer value to set.
|
||||
|
||||
@retval EFI_SUCCESS The function completed successfully.
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AmlUpdateInteger (
|
||||
IN AML_OBJECT_NODE_HANDLE IntegerOpNode,
|
||||
IN UINT64 NewInteger
|
||||
);
|
||||
|
||||
/** Update the buffer of a data node.
|
||||
|
||||
Note: The data type of the buffer's content must match the data type of the
|
||||
DataNode. This is a hard restriction to prevent undesired behaviour.
|
||||
|
||||
@ingroup NodeInterfaceApis
|
||||
|
||||
@param [in] DataNode Pointer to a data node.
|
||||
@param [in] DataType Data type of the Buffer's content.
|
||||
@param [in] Buffer Buffer containing the new data. The content of
|
||||
the Buffer is copied.
|
||||
@param [in] Size Size of the Buffer.
|
||||
|
||||
@retval EFI_SUCCESS The function completed successfully.
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter.
|
||||
@retval EFI_UNSUPPORTED Operation not supporter.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AmlUpdateDataNode (
|
||||
IN AML_DATA_NODE_HANDLE DataNode,
|
||||
IN EAML_NODE_DATA_TYPE DataType,
|
||||
IN UINT8 * Buffer,
|
||||
IN UINT32 Size
|
||||
);
|
||||
|
||||
/**
|
||||
@defgroup NavigationApis Navigation APIs
|
||||
@ingroup AMLLib
|
||||
@{
|
||||
Navigation APIs allow to navigate in the AML tree. There are different
|
||||
ways to navigate in the tree by:
|
||||
- Direct relation (@ref CoreNavigationApis);
|
||||
- Enumeration: enumerate all the nodes and call a callback function
|
||||
(@ref EnumerationApis);
|
||||
- Iteration: instantiate an iterator and use it to navigate
|
||||
(@ref IteratorApis);
|
||||
- NameSpace path: use the AML namespace to navigate the tree
|
||||
(@ref NameSpaceApis).
|
||||
@}
|
||||
*/
|
||||
|
||||
/**
|
||||
@defgroup CoreNavigationApis Core Navigation APIs
|
||||
@ingroup NavigationApis
|
||||
@{
|
||||
Core Navigation APIs allow to get a node by specifying a relation.
|
||||
|
||||
E.g.: Get the parent, the n-th fixed argument, the next variable
|
||||
argument, etc.
|
||||
@}
|
||||
*/
|
||||
|
||||
/** Get the parent node of the input Node.
|
||||
|
||||
@ingroup CoreNavigationApis
|
||||
|
||||
@param [in] Node Pointer to a node.
|
||||
|
||||
@return The parent node of the input Node.
|
||||
NULL otherwise.
|
||||
**/
|
||||
AML_NODE_HANDLE
|
||||
EFIAPI
|
||||
AmlGetParent (
|
||||
IN AML_NODE_HANDLE Node
|
||||
);
|
||||
|
||||
/** Get the node at the input Index in the fixed argument list of the input
|
||||
ObjectNode.
|
||||
|
||||
@ingroup CoreNavigationApis
|
||||
|
||||
@param [in] ObjectNode Pointer to an object node.
|
||||
@param [in] Index The Index of the fixed argument to get.
|
||||
|
||||
@return The node at the input Index in the fixed argument list
|
||||
of the input ObjectNode.
|
||||
NULL otherwise, e.g. if the node is not an object node, or no
|
||||
node is available at this Index.
|
||||
**/
|
||||
AML_NODE_HANDLE
|
||||
EFIAPI
|
||||
AmlGetFixedArgument (
|
||||
IN AML_OBJECT_NODE_HANDLE ObjectNode,
|
||||
IN EAML_PARSE_INDEX Index
|
||||
);
|
||||
|
||||
/** Get the sibling node among the nodes being in
|
||||
the same variable argument list.
|
||||
|
||||
(ParentNode) /-i # Child of fixed argument b
|
||||
\ /
|
||||
|- [a][b][c][d] # Fixed Arguments
|
||||
|- {(VarArgNode)->(f)->(g)} # Variable Arguments
|
||||
\
|
||||
\-h # Child of variable argument e
|
||||
|
||||
Node must be in a variable list of arguments.
|
||||
Traversal Order: VarArgNode, f, g, NULL
|
||||
|
||||
@ingroup CoreNavigationApis
|
||||
|
||||
@param [in] VarArgNode Pointer to a node.
|
||||
Must be in a variable list of arguments.
|
||||
|
||||
@return The next node after VarArgNode in the variable list of arguments.
|
||||
Return NULL if
|
||||
- VarArgNode is the last node of the list, or
|
||||
- VarArgNode is not part of a variable list of arguments.
|
||||
**/
|
||||
AML_NODE_HANDLE
|
||||
EFIAPI
|
||||
AmlGetSiblingVariableArgument (
|
||||
IN AML_NODE_HANDLE VarArgNode
|
||||
);
|
||||
|
||||
/** Get the next variable argument.
|
||||
|
||||
(Node) /-i # Child of fixed argument b
|
||||
\ /
|
||||
|- [a][b][c][d] # Fixed Arguments
|
||||
|- {(e)->(f)->(g)} # Variable Arguments
|
||||
\
|
||||
\-h # Child of variable argument e
|
||||
|
||||
Traversal Order: e, f, g, NULL
|
||||
|
||||
@ingroup CoreNavigationApis
|
||||
|
||||
@param [in] Node Pointer to a Root node or Object Node.
|
||||
@param [in] CurrVarArg Pointer to the Current Variable Argument.
|
||||
|
||||
@return The node after the CurrVarArg in the variable list of arguments.
|
||||
If CurrVarArg is NULL, return the first node of the
|
||||
variable argument list.
|
||||
Return NULL if
|
||||
- CurrVarArg is the last node of the list, or
|
||||
- Node does not have a variable list of arguments.
|
||||
**/
|
||||
AML_NODE_HANDLE
|
||||
EFIAPI
|
||||
AmlGetNextVariableArgument (
|
||||
IN AML_NODE_HANDLE Node,
|
||||
IN AML_NODE_HANDLE CurrVarArg
|
||||
);
|
||||
|
||||
/** Get the previous variable argument.
|
||||
|
||||
(Node) /-i # Child of fixed argument b
|
||||
\ /
|
||||
|- [a][b][c][d] # Fixed Arguments
|
||||
|- {(e)->(f)->(g)} # Variable Arguments
|
||||
\
|
||||
\-h # Child of variable argument e
|
||||
|
||||
Traversal Order: g, f, e, NULL
|
||||
|
||||
@ingroup CoreNavigationApis
|
||||
|
||||
@param [in] Node Pointer to a root node or an object node.
|
||||
@param [in] CurrVarArg Pointer to the Current Variable Argument.
|
||||
|
||||
@return The node before the CurrVarArg in the variable list of
|
||||
arguments.
|
||||
If CurrVarArg is NULL, return the last node of the
|
||||
variable list of arguments.
|
||||
Return NULL if:
|
||||
- CurrVarArg is the first node of the list, or
|
||||
- Node doesn't have a variable list of arguments.
|
||||
**/
|
||||
AML_NODE_HANDLE
|
||||
EFIAPI
|
||||
AmlGetPreviousVariableArgument (
|
||||
IN AML_NODE_HANDLE Node,
|
||||
IN AML_NODE_HANDLE CurrVarArg
|
||||
);
|
||||
|
||||
/**
|
||||
@defgroup EnumerationApis Enumeration APIs
|
||||
@ingroup NavigationApis
|
||||
@{
|
||||
Enumeration APIs are navigation APIs, allowing to call a callback function
|
||||
on each node enumerated. Nodes are enumerated in the AML bytestream order,
|
||||
i.e. in a depth first order.
|
||||
@}
|
||||
*/
|
||||
|
||||
/**
|
||||
Callback function prototype used when iterating through the tree.
|
||||
|
||||
@ingroup EnumerationApis
|
||||
|
||||
@param [in] Node The Node currently being processed.
|
||||
@param [in, out] Context A context for the callback function.
|
||||
Can be optional.
|
||||
@param [in, out] Status End the enumeration if pointing to a value
|
||||
evaluated to TRUE.
|
||||
Can be optional.
|
||||
|
||||
@retval TRUE if the enumeration can continue or has finished without
|
||||
interruption.
|
||||
@retval FALSE if the enumeration needs to stopped or has stopped.
|
||||
**/
|
||||
typedef
|
||||
BOOLEAN
|
||||
(EFIAPI * EDKII_AML_TREE_ENUM_CALLBACK) (
|
||||
IN AML_NODE_HANDLE Node,
|
||||
IN OUT VOID * Context, OPTIONAL
|
||||
IN OUT EFI_STATUS * Status OPTIONAL
|
||||
);
|
||||
|
||||
/** Enumerate all nodes of the subtree under the input Node in the AML
|
||||
bytestream order (i.e. in a depth first order), and call the CallBack
|
||||
function with the input Context.
|
||||
The prototype of the Callback function is EDKII_AML_TREE_ENUM_CALLBACK.
|
||||
|
||||
@ingroup EnumerationApis
|
||||
|
||||
@param [in] Node Enumerate nodes of the subtree under this Node.
|
||||
Must be a valid node.
|
||||
@param [in] CallBack Callback function to call on each node.
|
||||
@param [in, out] Context Void pointer used to pass some information
|
||||
to the Callback function.
|
||||
Optional, can be NULL.
|
||||
@param [out] Status Optional parameter that can be used to get
|
||||
the status of the Callback function.
|
||||
If used, need to be init to EFI_SUCCESS.
|
||||
|
||||
@retval TRUE if the enumeration can continue or has finished without
|
||||
interruption.
|
||||
@retval FALSE if the enumeration needs to stopped or has stopped.
|
||||
**/
|
||||
BOOLEAN
|
||||
EFIAPI
|
||||
AmlEnumTree (
|
||||
IN AML_NODE_HANDLE Node,
|
||||
IN EDKII_AML_TREE_ENUM_CALLBACK CallBack,
|
||||
IN OUT VOID * Context, OPTIONAL
|
||||
OUT EFI_STATUS * Status OPTIONAL
|
||||
);
|
||||
|
||||
/**
|
||||
@defgroup NameSpaceApis NameSpace APIs
|
||||
@ingroup NavigationApis
|
||||
@{
|
||||
NameSpace APIs allow to find a node from an AML path, and reciprocally
|
||||
get the AML path of a node.
|
||||
|
||||
These APIs only operate on "NameSpace nodes", i.e. nodes that are
|
||||
part of the AML namespace. These are the root node and object nodes
|
||||
acknowledged by AmlGetObjectNodeInfo in @ref NodeInterfaceApis.
|
||||
@}
|
||||
*/
|
||||
|
||||
/** Build the absolute ASL pathname to Node.
|
||||
|
||||
BufferSize is always updated to the size of the pathname.
|
||||
|
||||
If:
|
||||
- the content of BufferSize is >= to the size of the pathname AND;
|
||||
- Buffer is not NULL;
|
||||
then copy the pathname in the Buffer. A buffer of the size
|
||||
MAX_ASL_NAMESTRING_SIZE is big enough to receive any ASL pathname.
|
||||
|
||||
@ingroup NameSpaceApis
|
||||
|
||||
@param [in] Node Node to build the absolute path to.
|
||||
Must be a root node, or a namespace node.
|
||||
@param [out] Buffer Buffer to write the path to.
|
||||
If NULL, only update *BufferSize.
|
||||
@param [in, out] BufferSize Pointer holding:
|
||||
- At entry, the size of the Buffer;
|
||||
- At exit, the size of the pathname.
|
||||
|
||||
@retval EFI_SUCCESS The function completed successfully.
|
||||
@retval EFI_BUFFER_TOO_SMALL No space left in the buffer.
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter.
|
||||
@retval EFI_OUT_OF_RESOURCES Out of memory.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AmlGetAslPathName (
|
||||
IN AML_NODE_HANDLE Node,
|
||||
OUT CHAR8 * Buffer,
|
||||
IN OUT UINT32 * BufferSize
|
||||
);
|
||||
|
||||
#endif // AML_CORE_INTERFACE_H_
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user