Compare commits
3 Commits
edk2-stabl
...
intel-fsp-
Author | SHA1 | Date | |
---|---|---|---|
|
8674aecb6a | ||
|
563bd1f035 | ||
|
2415686bbc |
@@ -51,12 +51,6 @@ steps:
|
|||||||
# Set default
|
# Set default
|
||||||
- bash: echo "##vso[task.setvariable variable=pkg_count]${{ 1 }}"
|
- bash: echo "##vso[task.setvariable variable=pkg_count]${{ 1 }}"
|
||||||
|
|
||||||
# Fetch the target branch so that pr_eval can diff them.
|
|
||||||
# Seems like azure pipelines/github changed checkout process in nov 2020.
|
|
||||||
- script: git fetch origin $(System.PullRequest.targetBranch)
|
|
||||||
displayName: fetch target branch
|
|
||||||
condition: eq(variables['Build.Reason'], 'PullRequest')
|
|
||||||
|
|
||||||
# trim the package list if this is a PR
|
# trim the package list if this is a PR
|
||||||
- task: CmdLine@1
|
- task: CmdLine@1
|
||||||
displayName: Check if ${{ parameters.build_pkg }} need testing
|
displayName: Check if ${{ parameters.build_pkg }} need testing
|
||||||
|
@@ -4,7 +4,6 @@
|
|||||||
# template file used to build supported packages.
|
# template file used to build supported packages.
|
||||||
#
|
#
|
||||||
# Copyright (c) Microsoft Corporation.
|
# Copyright (c) Microsoft Corporation.
|
||||||
# Copyright (c) 2020, ARM Limited. All rights reserved.<BR>
|
|
||||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||||
##
|
##
|
||||||
|
|
||||||
@@ -31,17 +30,17 @@ jobs:
|
|||||||
Build.Pkgs: 'MdeModulePkg'
|
Build.Pkgs: 'MdeModulePkg'
|
||||||
Build.Targets: 'RELEASE,NO-TARGET'
|
Build.Targets: 'RELEASE,NO-TARGET'
|
||||||
TARGET_NETWORK:
|
TARGET_NETWORK:
|
||||||
Build.Pkgs: 'NetworkPkg,RedfishPkg'
|
Build.Pkgs: 'NetworkPkg'
|
||||||
Build.Targets: 'DEBUG,RELEASE,NO-TARGET'
|
Build.Targets: 'DEBUG,RELEASE,NO-TARGET'
|
||||||
TARGET_OTHER:
|
TARGET_OTHER:
|
||||||
Build.Pkgs: 'PcAtChipsetPkg,ShellPkg'
|
Build.Pkgs: 'PcAtChipsetPkg,ShellPkg'
|
||||||
Build.Targets: 'DEBUG,RELEASE,NO-TARGET'
|
Build.Targets: 'DEBUG,RELEASE,NO-TARGET'
|
||||||
TARGET_FMP_FAT_TEST:
|
TARGET_FMP_FAT_TEST:
|
||||||
Build.Pkgs: 'FmpDevicePkg,FatPkg,UnitTestFrameworkPkg,DynamicTablesPkg'
|
Build.Pkgs: 'FmpDevicePkg,FatPkg,UnitTestFrameworkPkg'
|
||||||
Build.Targets: 'DEBUG,RELEASE,NO-TARGET,NOOPT'
|
Build.Targets: 'DEBUG,RELEASE,NO-TARGET,NOOPT'
|
||||||
TARGET_CRYPTO:
|
TARGET_CRYPTO:
|
||||||
Build.Pkgs: 'CryptoPkg'
|
Build.Pkgs: 'CryptoPkg'
|
||||||
Build.Targets: 'DEBUG,RELEASE,NO-TARGET,NOOPT'
|
Build.Targets: 'DEBUG,RELEASE,NO-TARGET'
|
||||||
TARGET_SECURITY:
|
TARGET_SECURITY:
|
||||||
Build.Pkgs: 'SecurityPkg'
|
Build.Pkgs: 'SecurityPkg'
|
||||||
Build.Targets: 'DEBUG,RELEASE,NO-TARGET'
|
Build.Targets: 'DEBUG,RELEASE,NO-TARGET'
|
||||||
|
@@ -31,12 +31,6 @@ steps:
|
|||||||
echo "##vso[task.setvariable variable=pkgs_to_build]${{ parameters.build_pkgs }}"
|
echo "##vso[task.setvariable variable=pkgs_to_build]${{ parameters.build_pkgs }}"
|
||||||
echo "##vso[task.setvariable variable=pkg_count]${{ 1 }}"
|
echo "##vso[task.setvariable variable=pkg_count]${{ 1 }}"
|
||||||
|
|
||||||
# Fetch the target branch so that pr_eval can diff them.
|
|
||||||
# Seems like azure pipelines/github changed checkout process in nov 2020.
|
|
||||||
- script: git fetch origin $(System.PullRequest.targetBranch)
|
|
||||||
displayName: fetch target branch
|
|
||||||
condition: eq(variables['Build.Reason'], 'PullRequest')
|
|
||||||
|
|
||||||
# trim the package list if this is a PR
|
# trim the package list if this is a PR
|
||||||
- task: CmdLine@1
|
- task: CmdLine@1
|
||||||
displayName: Check if ${{ parameters.build_pkgs }} need testing
|
displayName: Check if ${{ parameters.build_pkgs }} need testing
|
||||||
|
8
.mailmap
8
.mailmap
@@ -38,7 +38,6 @@ Jim Dailey <Jim.Dailey@Dell.com>
|
|||||||
Jim Dailey <Jim.Dailey@Dell.com> <Jim_Dailey@Dell.com>
|
Jim Dailey <Jim.Dailey@Dell.com> <Jim_Dailey@Dell.com>
|
||||||
Laszlo Ersek <lersek@redhat.com> <lersek@6f19259b-4bc3-4df7-8a09-765794883524>
|
Laszlo Ersek <lersek@redhat.com> <lersek@6f19259b-4bc3-4df7-8a09-765794883524>
|
||||||
Laszlo Ersek <lersek@redhat.com> <lersek@Edk2>
|
Laszlo Ersek <lersek@redhat.com> <lersek@Edk2>
|
||||||
Liming Gao <gaoliming@byosoft.com.cn>
|
|
||||||
Liming Gao <liming.gao@intel.com> <Gao, Liming liming.gao@intel.com>
|
Liming Gao <liming.gao@intel.com> <Gao, Liming liming.gao@intel.com>
|
||||||
Liming Gao <liming.gao@intel.com> <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>
|
Liming Gao <liming.gao@intel.com> <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>
|
||||||
Liming Gao <liming.gao@intel.com> <lgao4@Edk2>
|
Liming Gao <liming.gao@intel.com> <lgao4@Edk2>
|
||||||
@@ -48,7 +47,6 @@ Marc-André Lureau <marcandre.lureau@redhat.com> <marcandre.lureau@redhat.com>
|
|||||||
Marvin Häuser <Marvin.Haeuser@outlook.com>
|
Marvin Häuser <Marvin.Haeuser@outlook.com>
|
||||||
Marvin Häuser <Marvin.Haeuser@outlook.com> edk2-devel <edk2-devel-bounces@lists.01.org>
|
Marvin Häuser <Marvin.Haeuser@outlook.com> edk2-devel <edk2-devel-bounces@lists.01.org>
|
||||||
Marvin Häuser <mhaeuser@outlook.de>
|
Marvin Häuser <mhaeuser@outlook.de>
|
||||||
Matt DeVillier <matt.devillier@gmail.com>
|
|
||||||
Maurice Ma <maurice.ma@intel.com>
|
Maurice Ma <maurice.ma@intel.com>
|
||||||
Michael Kubacki <michael.a.kubacki@intel.com>
|
Michael Kubacki <michael.a.kubacki@intel.com>
|
||||||
Michael Kubacki <michael.a.kubacki@intel.com> </o=Intel/ou=External (FYDIBOHF25SPDLT)/cn=Recipients/cn=3c8b0226e75f4ab08d20c151cb7a8a72>
|
Michael Kubacki <michael.a.kubacki@intel.com> </o=Intel/ou=External (FYDIBOHF25SPDLT)/cn=Recipients/cn=3c8b0226e75f4ab08d20c151cb7a8a72>
|
||||||
@@ -62,20 +60,14 @@ Ray Ni <ray.ni@intel.com> <niruiyu@Edk2>
|
|||||||
Ray Ni <ray.ni@intel.com> <ruiyu.ni@intel.com>
|
Ray Ni <ray.ni@intel.com> <ruiyu.ni@intel.com>
|
||||||
Ray Ni <ray.ni@intel.com> <Ruiyu.ni@Intel.com>
|
Ray Ni <ray.ni@intel.com> <Ruiyu.ni@Intel.com>
|
||||||
Ray Ni <ray.ni@intel.com> <ruyu.ni@intel.com>
|
Ray Ni <ray.ni@intel.com> <ruyu.ni@intel.com>
|
||||||
Rebecca Cran <rebecca@bluestop.org>
|
|
||||||
Rebecca Cran <rebecca@bsdio.com>
|
|
||||||
Samer El-Haj-Mahmoud <samer@elhajmahmoud.com> <elhaj@hpe.com>
|
Samer El-Haj-Mahmoud <samer@elhajmahmoud.com> <elhaj@hpe.com>
|
||||||
Samer El-Haj-Mahmoud <samer@elhajmahmoud.com> <Samer El-Haj-Mahmoud elhaj@hp.com>
|
Samer El-Haj-Mahmoud <samer@elhajmahmoud.com> <Samer El-Haj-Mahmoud elhaj@hp.com>
|
||||||
Shenglei Zhang <shenglei.zhang@intel.com>
|
Shenglei Zhang <shenglei.zhang@intel.com>
|
||||||
Star Zeng <star.zeng@intel.com>
|
Star Zeng <star.zeng@intel.com>
|
||||||
Star Zeng <star.zeng@intel.com> <lzeng14@6f19259b-4bc3-4df7-8a09-765794883524>
|
Star Zeng <star.zeng@intel.com> <lzeng14@6f19259b-4bc3-4df7-8a09-765794883524>
|
||||||
Star Zeng <star.zeng@intel.com> <lzeng14@Edk2>
|
Star Zeng <star.zeng@intel.com> <lzeng14@Edk2>
|
||||||
Tom Lendacky <thomas.lendacky@amd.com>
|
|
||||||
Vitaly Cheptsov <vit9696@protonmail.com> Vitaly Cheptsov via Groups.Io <vit9696=protonmail.com@groups.io>
|
Vitaly Cheptsov <vit9696@protonmail.com> Vitaly Cheptsov via Groups.Io <vit9696=protonmail.com@groups.io>
|
||||||
Vladimir Olovyannikov <vladimir.olovyannikov@broadcom.com> Vladimir Olovyannikov via edk2-devel <edk2-devel@lists.01.org>
|
Vladimir Olovyannikov <vladimir.olovyannikov@broadcom.com> Vladimir Olovyannikov via edk2-devel <edk2-devel@lists.01.org>
|
||||||
Wei6 Xu <wei6.xu@intel.com>
|
|
||||||
Yonghong Zhu <yonghong.zhu@intel.com>
|
Yonghong Zhu <yonghong.zhu@intel.com>
|
||||||
Yonghong Zhu <yonghong.zhu@intel.com> <yzhu52@Edk2>
|
Yonghong Zhu <yonghong.zhu@intel.com> <yzhu52@Edk2>
|
||||||
Yu-Chen Lin <yuchenlin@synology.com>
|
Yu-Chen Lin <yuchenlin@synology.com>
|
||||||
Zhichao Gao <zhichao.gao@intel.com>
|
|
||||||
Zhiguang Liu <zhiguang.liu@intel.com>
|
|
||||||
|
@@ -2,7 +2,6 @@
|
|||||||
#
|
#
|
||||||
# Copyright (c) Microsoft Corporation.
|
# Copyright (c) Microsoft Corporation.
|
||||||
# Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights reserved.<BR>
|
# 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
|
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||||
##
|
##
|
||||||
import os
|
import os
|
||||||
@@ -42,7 +41,6 @@ class Settings(CiBuildSettingsManager, UpdateSettingsManager, SetupSettingsManag
|
|||||||
These should be edk2 workspace relative paths '''
|
These should be edk2 workspace relative paths '''
|
||||||
|
|
||||||
return ("ArmVirtPkg",
|
return ("ArmVirtPkg",
|
||||||
"DynamicTablesPkg",
|
|
||||||
"EmulatorPkg",
|
"EmulatorPkg",
|
||||||
"MdePkg",
|
"MdePkg",
|
||||||
"MdeModulePkg",
|
"MdeModulePkg",
|
||||||
@@ -55,8 +53,7 @@ class Settings(CiBuildSettingsManager, UpdateSettingsManager, SetupSettingsManag
|
|||||||
"FatPkg",
|
"FatPkg",
|
||||||
"CryptoPkg",
|
"CryptoPkg",
|
||||||
"UnitTestFrameworkPkg",
|
"UnitTestFrameworkPkg",
|
||||||
"OvmfPkg",
|
"OvmfPkg"
|
||||||
"RedfishPkg"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
def GetArchitecturesSupported(self):
|
def GetArchitecturesSupported(self):
|
||||||
|
@@ -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.
|
|
@@ -178,6 +178,5 @@
|
|||||||
"vcruntimed",
|
"vcruntimed",
|
||||||
"ucrtd",
|
"ucrtd",
|
||||||
"msvcrtd",
|
"msvcrtd",
|
||||||
"XIPFLAGS"
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@@ -8,7 +8,7 @@
|
|||||||
| ArmPlatformPkg |
|
| ArmPlatformPkg |
|
||||||
| ArmVirtPkg | SEE PACKAGE README | SEE PACKAGE README |
|
| ArmVirtPkg | SEE PACKAGE README | SEE PACKAGE README |
|
||||||
| CryptoPkg | :heavy_check_mark: | :heavy_check_mark: | Spell checking in audit mode
|
| CryptoPkg | :heavy_check_mark: | :heavy_check_mark: | Spell checking in audit mode
|
||||||
| DynamicTablesPkg | | :heavy_check_mark: |
|
| DynamicTablesPkg |
|
||||||
| EmbeddedPkg |
|
| EmbeddedPkg |
|
||||||
| EmulatorPkg | SEE PACKAGE README | SEE PACKAGE README | Spell checking in audit mode
|
| EmulatorPkg | SEE PACKAGE README | SEE PACKAGE README | Spell checking in audit mode
|
||||||
| FatPkg | :heavy_check_mark: | :heavy_check_mark: |
|
| FatPkg | :heavy_check_mark: | :heavy_check_mark: |
|
||||||
|
@@ -29,9 +29,6 @@
|
|||||||
RELEASE_*_*_CC_FLAGS = -DMDEPKG_NDEBUG
|
RELEASE_*_*_CC_FLAGS = -DMDEPKG_NDEBUG
|
||||||
*_*_*_CC_FLAGS = -DDISABLE_NEW_DEPRECATED_INTERFACES
|
*_*_*_CC_FLAGS = -DDISABLE_NEW_DEPRECATED_INTERFACES
|
||||||
|
|
||||||
[PcdsFixedAtBuild]
|
|
||||||
gEfiMdePkgTokenSpaceGuid.PcdDefaultTerminalType|4
|
|
||||||
|
|
||||||
[LibraryClasses.common]
|
[LibraryClasses.common]
|
||||||
BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
|
BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
|
||||||
BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
|
BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
|
||||||
@@ -145,8 +142,8 @@
|
|||||||
|
|
||||||
ArmPkg/Drivers/ArmCrashDumpDxe/ArmCrashDumpDxe.inf
|
ArmPkg/Drivers/ArmCrashDumpDxe/ArmCrashDumpDxe.inf
|
||||||
ArmPkg/Drivers/ArmScmiDxe/ArmScmiDxe.inf
|
ArmPkg/Drivers/ArmScmiDxe/ArmScmiDxe.inf
|
||||||
|
ArmPkg/Drivers/MmCommunicationDxe/MmCommunication.inf
|
||||||
|
|
||||||
[Components.AARCH64]
|
[Components.AARCH64]
|
||||||
ArmPkg/Drivers/MmCommunicationDxe/MmCommunication.inf
|
|
||||||
ArmPkg/Library/ArmMmuLib/ArmMmuPeiLib.inf
|
ArmPkg/Library/ArmMmuLib/ArmMmuPeiLib.inf
|
||||||
ArmPkg/Library/StandaloneMmMmuLib/ArmMmuStandaloneMmLib.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;
|
PHYSICAL_ADDRESS gExceptionVectorAlignmentMask = ARM_VECTOR_TABLE_ALIGNMENT;
|
||||||
UINTN gDebuggerNoHandlerValue = 0; // todo: define for AArch64
|
UINTN gDebuggerNoHandlerValue = 0; // todo: define for AArch64
|
||||||
|
|
||||||
#define EL0_STACK_SIZE EFI_PAGES_TO_SIZE(2)
|
#define EL0_STACK_PAGES 2
|
||||||
STATIC UINTN mNewStackBase[EL0_STACK_SIZE / sizeof (UINTN)];
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
RegisterEl0Stack (
|
RegisterEl0Stack (
|
||||||
@@ -32,11 +31,14 @@ RETURN_STATUS ArchVectorConfig(
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
UINTN HcrReg;
|
UINTN HcrReg;
|
||||||
|
UINT8 *Stack;
|
||||||
|
|
||||||
// Round down sp by 16 bytes alignment
|
Stack = AllocatePages (EL0_STACK_PAGES);
|
||||||
RegisterEl0Stack (
|
if (Stack == NULL) {
|
||||||
(VOID *)(((UINTN)mNewStackBase + EL0_STACK_SIZE) & ~0xFUL)
|
return RETURN_OUT_OF_RESOURCES;
|
||||||
);
|
}
|
||||||
|
|
||||||
|
RegisterEl0Stack ((UINT8 *)Stack + EFI_PAGES_TO_SIZE (EL0_STACK_PAGES));
|
||||||
|
|
||||||
if (ArmReadCurrentEL() == AARCH64_EL2) {
|
if (ArmReadCurrentEL() == AARCH64_EL2) {
|
||||||
HcrReg = ArmReadHcr();
|
HcrReg = ArmReadHcr();
|
||||||
|
@@ -649,7 +649,7 @@ ArmMmuBaseLibConstructor (
|
|||||||
// The ArmReplaceLiveTranslationEntry () helper function may be invoked
|
// The ArmReplaceLiveTranslationEntry () helper function may be invoked
|
||||||
// with the MMU off so we have to ensure that it gets cleaned to the PoC
|
// with the MMU off so we have to ensure that it gets cleaned to the PoC
|
||||||
//
|
//
|
||||||
WriteBackDataCacheRange ((VOID *)(UINTN)ArmReplaceLiveTranslationEntry,
|
WriteBackDataCacheRange (ArmReplaceLiveTranslationEntry,
|
||||||
ArmReplaceLiveTranslationEntrySize);
|
ArmReplaceLiveTranslationEntrySize);
|
||||||
|
|
||||||
return RETURN_SUCCESS;
|
return RETURN_SUCCESS;
|
||||||
|
@@ -47,7 +47,7 @@ ArmMmuPeiLibConstructor (
|
|||||||
// The ArmReplaceLiveTranslationEntry () helper function may be invoked
|
// The ArmReplaceLiveTranslationEntry () helper function may be invoked
|
||||||
// with the MMU off so we have to ensure that it gets cleaned to the PoC
|
// with the MMU off so we have to ensure that it gets cleaned to the PoC
|
||||||
//
|
//
|
||||||
WriteBackDataCacheRange ((VOID *)(UINTN)ArmReplaceLiveTranslationEntry,
|
WriteBackDataCacheRange (ArmReplaceLiveTranslationEntry,
|
||||||
ArmReplaceLiveTranslationEntrySize);
|
ArmReplaceLiveTranslationEntrySize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -225,7 +225,7 @@ FillTranslationTable (
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
PhysicalBase = (UINT32)MemoryRegion->PhysicalBase;
|
PhysicalBase = MemoryRegion->PhysicalBase;
|
||||||
RemainLength = MIN(MemoryRegion->Length, SIZE_4GB - PhysicalBase);
|
RemainLength = MIN(MemoryRegion->Length, SIZE_4GB - PhysicalBase);
|
||||||
|
|
||||||
switch (MemoryRegion->Attributes) {
|
switch (MemoryRegion->Attributes) {
|
||||||
@@ -291,7 +291,7 @@ FillTranslationTable (
|
|||||||
PhysicalBase += TT_DESCRIPTOR_SECTION_SIZE;
|
PhysicalBase += TT_DESCRIPTOR_SECTION_SIZE;
|
||||||
RemainLength -= TT_DESCRIPTOR_SECTION_SIZE;
|
RemainLength -= TT_DESCRIPTOR_SECTION_SIZE;
|
||||||
} else {
|
} else {
|
||||||
PageMapLength = MIN ((UINT32)RemainLength, TT_DESCRIPTOR_SECTION_SIZE -
|
PageMapLength = MIN (RemainLength, TT_DESCRIPTOR_SECTION_SIZE -
|
||||||
(PhysicalBase % TT_DESCRIPTOR_SECTION_SIZE));
|
(PhysicalBase % TT_DESCRIPTOR_SECTION_SIZE));
|
||||||
|
|
||||||
// Case: Physical address aligned on the Section Size (1MB) && the length
|
// Case: Physical address aligned on the Section Size (1MB) && the length
|
||||||
|
@@ -152,7 +152,7 @@ UpdatePageEntries (
|
|||||||
FirstLevelTable = (ARM_FIRST_LEVEL_DESCRIPTOR *)ArmGetTTBR0BaseAddress ();
|
FirstLevelTable = (ARM_FIRST_LEVEL_DESCRIPTOR *)ArmGetTTBR0BaseAddress ();
|
||||||
|
|
||||||
// Calculate number of 4KB page table entries to change
|
// Calculate number of 4KB page table entries to change
|
||||||
NumPageEntries = (UINT32)(Length / TT_DESCRIPTOR_PAGE_SIZE);
|
NumPageEntries = Length / TT_DESCRIPTOR_PAGE_SIZE;
|
||||||
|
|
||||||
// Iterate for the number of 4KB pages to change
|
// Iterate for the number of 4KB pages to change
|
||||||
Offset = 0;
|
Offset = 0;
|
||||||
@@ -288,7 +288,7 @@ UpdateSectionEntries (
|
|||||||
ASSERT (FirstLevelIdx < TRANSLATION_TABLE_SECTION_COUNT);
|
ASSERT (FirstLevelIdx < TRANSLATION_TABLE_SECTION_COUNT);
|
||||||
|
|
||||||
// calculate number of 1MB first level entries this applies to
|
// calculate number of 1MB first level entries this applies to
|
||||||
NumSections = (UINT32)(Length / TT_DESCRIPTOR_SECTION_SIZE);
|
NumSections = Length / TT_DESCRIPTOR_SECTION_SIZE;
|
||||||
|
|
||||||
// iterate through each descriptor
|
// iterate through each descriptor
|
||||||
for(i=0; i<NumSections; i++) {
|
for(i=0; i<NumSections; i++) {
|
||||||
|
@@ -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
|
// SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||||
//
|
//
|
||||||
@@ -25,9 +25,6 @@ ASM_PFX(ArmCallSvc):
|
|||||||
ldp x0, x1, [x0, #0]
|
ldp x0, x1, [x0, #0]
|
||||||
|
|
||||||
svc #0
|
svc #0
|
||||||
// Prevent speculative execution beyond svc instruction
|
|
||||||
dsb nsh
|
|
||||||
isb
|
|
||||||
|
|
||||||
// Pop the ARM_SVC_ARGS structure address from the stack into x9
|
// Pop the ARM_SVC_ARGS structure address from the stack into x9
|
||||||
ldr x9, [sp, #16]
|
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
|
// SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||||
//
|
//
|
||||||
@@ -18,9 +18,6 @@ ASM_PFX(ArmCallSvc):
|
|||||||
ldm r0, {r0-r7}
|
ldm r0, {r0-r7}
|
||||||
|
|
||||||
svc #0
|
svc #0
|
||||||
// Prevent speculative execution beyond svc instruction
|
|
||||||
dsb nsh
|
|
||||||
isb
|
|
||||||
|
|
||||||
// Load the ARM_SVC_ARGS structure address from the stack into r8
|
// Load the ARM_SVC_ARGS structure address from the stack into r8
|
||||||
ldr r8, [sp]
|
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
|
// SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||||
//
|
//
|
||||||
@@ -16,9 +16,6 @@
|
|||||||
ldm r0, {r0-r7}
|
ldm r0, {r0-r7}
|
||||||
|
|
||||||
svc #0
|
svc #0
|
||||||
// Prevent speculative execution beyond svc instruction
|
|
||||||
dsb nsh
|
|
||||||
isb
|
|
||||||
|
|
||||||
// Load the ARM_SVC_ARGS structure address from the stack into r8
|
// Load the ARM_SVC_ARGS structure address from the stack into r8
|
||||||
ldr r8, [sp]
|
ldr r8, [sp]
|
||||||
|
@@ -23,12 +23,10 @@
|
|||||||
#include <Protocol/EsrtManagement.h>
|
#include <Protocol/EsrtManagement.h>
|
||||||
#include <Protocol/GraphicsOutput.h>
|
#include <Protocol/GraphicsOutput.h>
|
||||||
#include <Protocol/LoadedImage.h>
|
#include <Protocol/LoadedImage.h>
|
||||||
#include <Protocol/NonDiscoverableDevice.h>
|
|
||||||
#include <Protocol/PciIo.h>
|
#include <Protocol/PciIo.h>
|
||||||
#include <Protocol/PciRootBridgeIo.h>
|
#include <Protocol/PciRootBridgeIo.h>
|
||||||
#include <Protocol/PlatformBootManager.h>
|
#include <Protocol/PlatformBootManager.h>
|
||||||
#include <Guid/EventGroup.h>
|
#include <Guid/EventGroup.h>
|
||||||
#include <Guid/NonDiscoverableDevice.h>
|
|
||||||
#include <Guid/TtyTerm.h>
|
#include <Guid/TtyTerm.h>
|
||||||
#include <Guid/SerialPortLibVendor.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
|
This CALLBACK_FUNCTION attempts to connect a handle non-recursively, asking
|
||||||
the matching driver to produce all first-level child handles.
|
the matching driver to produce all first-level child handles.
|
||||||
@@ -357,8 +324,7 @@ VOID
|
|||||||
PlatformRegisterFvBootOption (
|
PlatformRegisterFvBootOption (
|
||||||
CONST EFI_GUID *FileGuid,
|
CONST EFI_GUID *FileGuid,
|
||||||
CHAR16 *Description,
|
CHAR16 *Description,
|
||||||
UINT32 Attributes,
|
UINT32 Attributes
|
||||||
EFI_INPUT_KEY *Key
|
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
@@ -410,9 +376,6 @@ PlatformRegisterFvBootOption (
|
|||||||
if (OptionIndex == -1) {
|
if (OptionIndex == -1) {
|
||||||
Status = EfiBootManagerAddLoadOptionVariable (&NewOption, MAX_UINTN);
|
Status = EfiBootManagerAddLoadOptionVariable (&NewOption, MAX_UINTN);
|
||||||
ASSERT_EFI_ERROR (Status);
|
ASSERT_EFI_ERROR (Status);
|
||||||
Status = EfiBootManagerAddKeyOptionVariable (NULL,
|
|
||||||
(UINT16)NewOption.OptionNumber, 0, Key, NULL);
|
|
||||||
ASSERT (Status == EFI_SUCCESS || Status == EFI_ALREADY_STARTED);
|
|
||||||
}
|
}
|
||||||
EfiBootManagerFreeLoadOption (&NewOption);
|
EfiBootManagerFreeLoadOption (&NewOption);
|
||||||
EfiBootManagerFreeLoadOptions (BootOptions, BootOptionCount);
|
EfiBootManagerFreeLoadOptions (BootOptions, BootOptionCount);
|
||||||
@@ -611,15 +574,6 @@ PlatformBootManagerBeforeConsole (
|
|||||||
//
|
//
|
||||||
FilterAndProcess (&gEfiGraphicsOutputProtocolGuid, NULL, AddOutput);
|
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.
|
// 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.
|
// Add the hardcoded serial console device path to ConIn, ConOut, ErrOut.
|
||||||
//
|
//
|
||||||
STATIC_ASSERT (FixedPcdGet8 (PcdDefaultTerminalType) == 4,
|
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'");
|
|
||||||
|
|
||||||
CopyGuid (&mSerialConsole.TermType.Guid, &gEfiTtyTermGuid);
|
CopyGuid (&mSerialConsole.TermType.Guid, &gEfiTtyTermGuid);
|
||||||
|
|
||||||
EfiBootManagerUpdateConsoleVariable (ConIn,
|
EfiBootManagerUpdateConsoleVariable (ConIn,
|
||||||
@@ -725,7 +673,6 @@ PlatformBootManagerAfterConsole (
|
|||||||
UINTN FirmwareVerLength;
|
UINTN FirmwareVerLength;
|
||||||
UINTN PosX;
|
UINTN PosX;
|
||||||
UINTN PosY;
|
UINTN PosY;
|
||||||
EFI_INPUT_KEY Key;
|
|
||||||
|
|
||||||
FirmwareVerLength = StrLen (PcdGetPtr (PcdFirmwareVersionString));
|
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
|
// On ARM, there is currently no reason to use the phased capsule
|
||||||
// update approach where some capsules are dispatched before EndOfDxe
|
// update approach where some capsules are dispatched before EndOfDxe
|
||||||
@@ -762,12 +714,17 @@ PlatformBootManagerAfterConsole (
|
|||||||
//
|
//
|
||||||
HandleCapsules ();
|
HandleCapsules ();
|
||||||
|
|
||||||
|
//
|
||||||
|
// Enumerate all possible boot options.
|
||||||
|
//
|
||||||
|
EfiBootManagerRefreshAllBootOption ();
|
||||||
|
|
||||||
//
|
//
|
||||||
// Register UEFI Shell
|
// Register UEFI Shell
|
||||||
//
|
//
|
||||||
Key.ScanCode = SCAN_NULL;
|
PlatformRegisterFvBootOption (
|
||||||
Key.UnicodeChar = L's';
|
&gUefiShellFileGuid, L"UEFI Shell", LOAD_OPTION_ACTIVE
|
||||||
PlatformRegisterFvBootOption (&gUefiShellFileGuid, L"UEFI Shell", 0, &Key);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -818,49 +775,5 @@ PlatformBootManagerUnableToBoot (
|
|||||||
VOID
|
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;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
for (;;) {
|
|
||||||
EfiBootManagerBoot (&BootManagerMenu);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -66,9 +66,6 @@
|
|||||||
gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut
|
gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut
|
||||||
|
|
||||||
[Guids]
|
[Guids]
|
||||||
gEdkiiNonDiscoverableEhciDeviceGuid
|
|
||||||
gEdkiiNonDiscoverableUhciDeviceGuid
|
|
||||||
gEdkiiNonDiscoverableXhciDeviceGuid
|
|
||||||
gEfiFileInfoGuid
|
gEfiFileInfoGuid
|
||||||
gEfiFileSystemInfoGuid
|
gEfiFileSystemInfoGuid
|
||||||
gEfiFileSystemVolumeLabelInfoIdGuid
|
gEfiFileSystemVolumeLabelInfoIdGuid
|
||||||
@@ -77,7 +74,6 @@
|
|||||||
gUefiShellFileGuid
|
gUefiShellFileGuid
|
||||||
|
|
||||||
[Protocols]
|
[Protocols]
|
||||||
gEdkiiNonDiscoverableDeviceProtocolGuid
|
|
||||||
gEfiDevicePathProtocolGuid
|
gEfiDevicePathProtocolGuid
|
||||||
gEfiGraphicsOutputProtocolGuid
|
gEfiGraphicsOutputProtocolGuid
|
||||||
gEfiLoadedImageProtocolGuid
|
gEfiLoadedImageProtocolGuid
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*++ @file NorFlashFvbDxe.c
|
/*++ @file NorFlashFvbDxe.c
|
||||||
|
|
||||||
Copyright (c) 2011 - 2020, ARM Ltd. All rights reserved.<BR>
|
Copyright (c) 2011 - 2014, ARM Ltd. All rights reserved.<BR>
|
||||||
|
|
||||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||||
|
|
||||||
@@ -736,7 +736,7 @@ NorFlashFvbInitialize (
|
|||||||
EFI_MEMORY_UC | EFI_MEMORY_RUNTIME);
|
EFI_MEMORY_UC | EFI_MEMORY_RUNTIME);
|
||||||
ASSERT_EFI_ERROR (Status);
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
|
||||||
mFlashNvStorageVariableBase = PcdGet32 (PcdFlashNvStorageVariableBase);
|
mFlashNvStorageVariableBase = FixedPcdGet32 (PcdFlashNvStorageVariableBase);
|
||||||
|
|
||||||
// Set the index of the first LBA for the FVB
|
// Set the index of the first LBA for the FVB
|
||||||
Instance->StartLba = (PcdGet32 (PcdFlashNvStorageVariableBase) - Instance->RegionBaseAddress) / Instance->Media.BlockSize;
|
Instance->StartLba = (PcdGet32 (PcdFlashNvStorageVariableBase) - Instance->RegionBaseAddress) / Instance->Media.BlockSize;
|
||||||
|
@@ -78,14 +78,10 @@ PL011UartInitializePort (
|
|||||||
UINT32 Integer;
|
UINT32 Integer;
|
||||||
UINT32 Fractional;
|
UINT32 Fractional;
|
||||||
UINT32 HardwareFifoDepth;
|
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
|
// 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
|
// 1 char buffer as the minimum FIFO size. Because everything can be rounded
|
||||||
// down, there is no maximum FIFO size.
|
// down, there is no maximum FIFO size.
|
||||||
|
@@ -30,7 +30,6 @@
|
|||||||
ArmPlatformPkg/ArmPlatformPkg.dec
|
ArmPlatformPkg/ArmPlatformPkg.dec
|
||||||
|
|
||||||
[FixedPcd]
|
[FixedPcd]
|
||||||
gEfiMdePkgTokenSpaceGuid.PcdUartDefaultReceiveFifoDepth
|
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdSerialBaudRate
|
gEfiMdeModulePkgTokenSpaceGuid.PcdSerialBaudRate
|
||||||
|
|
||||||
gArmPlatformTokenSpaceGuid.PL011UartInteger
|
gArmPlatformTokenSpaceGuid.PL011UartInteger
|
||||||
|
@@ -2,7 +2,6 @@
|
|||||||
# Copyright (c) 2011-2015, ARM Limited. All rights reserved.
|
# Copyright (c) 2011-2015, ARM Limited. All rights reserved.
|
||||||
# Copyright (c) 2014, Linaro Limited. All rights reserved.
|
# Copyright (c) 2014, Linaro Limited. All rights reserved.
|
||||||
# Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.
|
# Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.
|
||||||
# Copyright (c) Microsoft Corporation.
|
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||||
#
|
#
|
||||||
@@ -161,7 +160,6 @@
|
|||||||
OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf
|
OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf
|
||||||
!endif
|
!endif
|
||||||
BaseCryptLib|CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf
|
BaseCryptLib|CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf
|
||||||
RngLib|MdePkg/Library/BaseRngLibTimerLib/BaseRngLibTimerLib.inf
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Secure Boot dependencies
|
# Secure Boot dependencies
|
||||||
@@ -175,8 +173,6 @@
|
|||||||
AuthVariableLib|MdeModulePkg/Library/AuthVariableLibNull/AuthVariableLibNull.inf
|
AuthVariableLib|MdeModulePkg/Library/AuthVariableLibNull/AuthVariableLibNull.inf
|
||||||
!endif
|
!endif
|
||||||
VarCheckLib|MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf
|
VarCheckLib|MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf
|
||||||
VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLib.inf
|
|
||||||
VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.inf
|
|
||||||
UefiBootManagerLib|MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf
|
UefiBootManagerLib|MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf
|
||||||
|
|
||||||
ReportStatusCodeLib|MdePkg/Library/BaseReportStatusCodeLibNull/BaseReportStatusCodeLibNull.inf
|
ReportStatusCodeLib|MdePkg/Library/BaseReportStatusCodeLibNull/BaseReportStatusCodeLibNull.inf
|
||||||
@@ -250,7 +246,6 @@
|
|||||||
!if $(TARGET) != RELEASE
|
!if $(TARGET) != RELEASE
|
||||||
DebugLib|MdePkg/Library/DxeRuntimeDebugLibSerialPort/DxeRuntimeDebugLibSerialPort.inf
|
DebugLib|MdePkg/Library/DxeRuntimeDebugLibSerialPort/DxeRuntimeDebugLibSerialPort.inf
|
||||||
!endif
|
!endif
|
||||||
VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLibRuntimeDxe.inf
|
|
||||||
|
|
||||||
!if $(SECURE_BOOT_ENABLE) == TRUE
|
!if $(SECURE_BOOT_ENABLE) == TRUE
|
||||||
BaseCryptLib|CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf
|
BaseCryptLib|CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf
|
||||||
@@ -382,10 +377,6 @@
|
|||||||
<PcdsFixedAtBuild>
|
<PcdsFixedAtBuild>
|
||||||
gEfiShellPkgTokenSpaceGuid.PcdShellLibAutoInitialize|FALSE
|
gEfiShellPkgTokenSpaceGuid.PcdShellLibAutoInitialize|FALSE
|
||||||
}
|
}
|
||||||
ShellPkg/DynamicCommand/HttpDynamicCommand/HttpDynamicCommand.inf {
|
|
||||||
<PcdsFixedAtBuild>
|
|
||||||
gEfiShellPkgTokenSpaceGuid.PcdShellLibAutoInitialize|FALSE
|
|
||||||
}
|
|
||||||
OvmfPkg/LinuxInitrdDynamicShellCommand/LinuxInitrdDynamicShellCommand.inf {
|
OvmfPkg/LinuxInitrdDynamicShellCommand/LinuxInitrdDynamicShellCommand.inf {
|
||||||
<PcdsFixedAtBuild>
|
<PcdsFixedAtBuild>
|
||||||
gEfiShellPkgTokenSpaceGuid.PcdShellLibAutoInitialize|FALSE
|
gEfiShellPkgTokenSpaceGuid.PcdShellLibAutoInitialize|FALSE
|
||||||
|
@@ -1,321 +0,0 @@
|
|||||||
# @file
|
|
||||||
# Workspace file for KVMTool virtual platform.
|
|
||||||
#
|
|
||||||
# Copyright (c) 2018 - 2020, ARM Limited. All rights reserved.
|
|
||||||
#
|
|
||||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
|
||||||
#
|
|
||||||
#
|
|
||||||
|
|
||||||
################################################################################
|
|
||||||
#
|
|
||||||
# Defines Section - statements that will be processed to create a Makefile.
|
|
||||||
#
|
|
||||||
################################################################################
|
|
||||||
[Defines]
|
|
||||||
PLATFORM_NAME = ArmVirtKvmTool
|
|
||||||
PLATFORM_GUID = 4CB2C61E-FA32-4130-8E37-54ABC71A1A43
|
|
||||||
PLATFORM_VERSION = 0.1
|
|
||||||
DSC_SPECIFICATION = 0x0001001B
|
|
||||||
!ifdef $(EDK2_OUT_DIR)
|
|
||||||
OUTPUT_DIRECTORY = $(EDK2_OUT_DIR)
|
|
||||||
!else
|
|
||||||
OUTPUT_DIRECTORY = Build/ArmVirtKvmTool-$(ARCH)
|
|
||||||
!endif
|
|
||||||
SUPPORTED_ARCHITECTURES = AARCH64|ARM
|
|
||||||
BUILD_TARGETS = DEBUG|RELEASE
|
|
||||||
SKUID_IDENTIFIER = DEFAULT
|
|
||||||
FLASH_DEFINITION = ArmVirtPkg/ArmVirtKvmTool.fdf
|
|
||||||
|
|
||||||
!include ArmVirtPkg/ArmVirt.dsc.inc
|
|
||||||
|
|
||||||
[LibraryClasses.common]
|
|
||||||
ArmLib|ArmPkg/Library/ArmLib/ArmBaseLib.inf
|
|
||||||
ArmMmuLib|ArmPkg/Library/ArmMmuLib/ArmMmuBaseLib.inf
|
|
||||||
|
|
||||||
# Virtio Support
|
|
||||||
VirtioLib|OvmfPkg/Library/VirtioLib/VirtioLib.inf
|
|
||||||
VirtioMmioDeviceLib|OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDeviceLib.inf
|
|
||||||
|
|
||||||
ArmPlatformLib|ArmPlatformPkg/Library/ArmPlatformLibNull/ArmPlatformLibNull.inf
|
|
||||||
ArmVirtMemInfoLib|ArmVirtPkg/Library/KvmtoolVirtMemInfoLib/KvmtoolVirtMemInfoLib.inf
|
|
||||||
|
|
||||||
TimerLib|ArmPkg/Library/ArmArchTimerLib/ArmArchTimerLib.inf
|
|
||||||
NorFlashPlatformLib|ArmVirtPkg/Library/NorFlashKvmtoolLib/NorFlashKvmtoolLib.inf
|
|
||||||
|
|
||||||
CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf
|
|
||||||
|
|
||||||
# BDS Libraries
|
|
||||||
UefiBootManagerLib|MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf
|
|
||||||
PlatformBootManagerLib|ArmPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
|
|
||||||
BootLogoLib|MdeModulePkg/Library/BootLogoLib/BootLogoLib.inf
|
|
||||||
|
|
||||||
CustomizedDisplayLib|MdeModulePkg/Library/CustomizedDisplayLib/CustomizedDisplayLib.inf
|
|
||||||
FrameBufferBltLib|MdeModulePkg/Library/FrameBufferBltLib/FrameBufferBltLib.inf
|
|
||||||
|
|
||||||
FileExplorerLib|MdeModulePkg/Library/FileExplorerLib/FileExplorerLib.inf
|
|
||||||
|
|
||||||
PciPcdProducerLib|ArmVirtPkg/Library/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf
|
|
||||||
PciSegmentLib|MdePkg/Library/BasePciSegmentLibPci/BasePciSegmentLibPci.inf
|
|
||||||
PciHostBridgeLib|ArmVirtPkg/Library/FdtPciHostBridgeLib/FdtPciHostBridgeLib.inf
|
|
||||||
|
|
||||||
TpmMeasurementLib|MdeModulePkg/Library/TpmMeasurementLibNull/TpmMeasurementLibNull.inf
|
|
||||||
AuthVariableLib|MdeModulePkg/Library/AuthVariableLibNull/AuthVariableLibNull.inf
|
|
||||||
|
|
||||||
PlatformPeiLib|ArmVirtPkg/Library/KvmtoolPlatformPeiLib/KvmtoolPlatformPeiLib.inf
|
|
||||||
|
|
||||||
PciExpressLib|MdePkg/Library/BasePciExpressLib/BasePciExpressLib.inf
|
|
||||||
PlatformHookLib|ArmVirtPkg/Library/Fdt16550SerialPortHookLib/Fdt16550SerialPortHookLib.inf
|
|
||||||
SerialPortLib|MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.inf
|
|
||||||
|
|
||||||
[LibraryClasses.common.SEC, LibraryClasses.common.PEI_CORE, LibraryClasses.common.PEIM]
|
|
||||||
PciExpressLib|MdePkg/Library/BasePciExpressLib/BasePciExpressLib.inf
|
|
||||||
PlatformHookLib|ArmVirtPkg/Library/Fdt16550SerialPortHookLib/EarlyFdt16550SerialPortHookLib.inf
|
|
||||||
SerialPortLib|MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.inf
|
|
||||||
|
|
||||||
[LibraryClasses.common.UEFI_DRIVER]
|
|
||||||
UefiScsiLib|MdePkg/Library/UefiScsiLib/UefiScsiLib.inf
|
|
||||||
|
|
||||||
[BuildOptions]
|
|
||||||
*_*_*_CC_FLAGS = -D DISABLE_NEW_DEPRECATED_INTERFACES
|
|
||||||
#
|
|
||||||
# We need to avoid jump tables in SEC and BASE modules, so that the PE/COFF
|
|
||||||
# self-relocation code itself is guaranteed to be position independent.
|
|
||||||
#
|
|
||||||
GCC:*_*_*_CC_XIPFLAGS = -fno-jump-tables
|
|
||||||
|
|
||||||
################################################################################
|
|
||||||
#
|
|
||||||
# Pcd Section - list of all EDK II PCD Entries defined by this Platform
|
|
||||||
#
|
|
||||||
################################################################################
|
|
||||||
|
|
||||||
[PcdsFeatureFlag.common]
|
|
||||||
## If TRUE, Graphics Output Protocol will be installed on virtual handle created by ConsplitterDxe.
|
|
||||||
# It could be set FALSE to save size.
|
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdConOutGopSupport|TRUE
|
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdConOutUgaSupport|FALSE
|
|
||||||
|
|
||||||
# Use MMIO for accessing RTC controller registers.
|
|
||||||
gPcAtChipsetPkgTokenSpaceGuid.PcdRtcUseMmio|TRUE
|
|
||||||
|
|
||||||
[PcdsFixedAtBuild.common]
|
|
||||||
gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|0x8000000F
|
|
||||||
|
|
||||||
gArmPlatformTokenSpaceGuid.PcdCoreCount|1
|
|
||||||
|
|
||||||
!if $(ARCH) == AARCH64
|
|
||||||
gArmTokenSpaceGuid.PcdVFPEnabled|1
|
|
||||||
!endif
|
|
||||||
|
|
||||||
gArmPlatformTokenSpaceGuid.PcdCPUCorePrimaryStackSize|0x4000
|
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVariableSize|0x2000
|
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdMaxAuthVariableSize|0x2800
|
|
||||||
|
|
||||||
# Size of the region used by UEFI in permanent memory (Reserved 64MB)
|
|
||||||
gArmPlatformTokenSpaceGuid.PcdSystemMemoryUefiRegionSize|0x04000000
|
|
||||||
|
|
||||||
#
|
|
||||||
# TTY Terminal Type
|
|
||||||
# 0-PCANSI, 1-VT100, 2-VT00+, 3-UTF8, 4-TTYTERM
|
|
||||||
gEfiMdePkgTokenSpaceGuid.PcdDefaultTerminalType|4
|
|
||||||
|
|
||||||
#
|
|
||||||
# ARM Virtual Architectural Timer -- fetch frequency from KVM
|
|
||||||
#
|
|
||||||
gArmTokenSpaceGuid.PcdArmArchTimerFreqInHz|0
|
|
||||||
|
|
||||||
# Use MMIO for accessing Serial port registers.
|
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdSerialUseMmio|TRUE
|
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdSerialPciDeviceInfo|{0xFF}
|
|
||||||
|
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdResetOnMemoryTypeInformationChange|FALSE
|
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdBootManagerMenuFile|{ 0x21, 0xaa, 0x2c, 0x46, 0x14, 0x76, 0x03, 0x45, 0x83, 0x6e, 0x8a, 0xb6, 0xf4, 0x66, 0x23, 0x31 }
|
|
||||||
|
|
||||||
#
|
|
||||||
# The maximum physical I/O addressability of the processor, set with
|
|
||||||
# BuildCpuHob().
|
|
||||||
#
|
|
||||||
gEmbeddedTokenSpaceGuid.PcdPrePiCpuIoSize|16
|
|
||||||
|
|
||||||
[PcdsPatchableInModule.common]
|
|
||||||
#
|
|
||||||
# This will be overridden in the code
|
|
||||||
#
|
|
||||||
gArmTokenSpaceGuid.PcdSystemMemoryBase|0x0
|
|
||||||
gArmTokenSpaceGuid.PcdSystemMemorySize|0x0
|
|
||||||
|
|
||||||
#
|
|
||||||
# The device tree base address is handed off by kvmtool.
|
|
||||||
# We are booting from RAM using the Linux kernel boot protocol,
|
|
||||||
# x0 will point to the DTB image in memory.
|
|
||||||
#
|
|
||||||
gArmVirtTokenSpaceGuid.PcdDeviceTreeInitialBaseAddress|0x0
|
|
||||||
|
|
||||||
gArmTokenSpaceGuid.PcdFdBaseAddress|0x0
|
|
||||||
gArmTokenSpaceGuid.PcdFvBaseAddress|0x0
|
|
||||||
|
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterBase|0x0
|
|
||||||
|
|
||||||
[PcdsDynamicDefault.common]
|
|
||||||
gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut|3
|
|
||||||
|
|
||||||
gArmTokenSpaceGuid.PcdArmArchTimerSecIntrNum|0x0
|
|
||||||
gArmTokenSpaceGuid.PcdArmArchTimerIntrNum|0x0
|
|
||||||
gArmTokenSpaceGuid.PcdArmArchTimerVirtIntrNum|0x0
|
|
||||||
gArmTokenSpaceGuid.PcdArmArchTimerHypIntrNum|0x0
|
|
||||||
|
|
||||||
#
|
|
||||||
# ARM General Interrupt Controller
|
|
||||||
#
|
|
||||||
gArmTokenSpaceGuid.PcdGicDistributorBase|0x0
|
|
||||||
gArmTokenSpaceGuid.PcdGicRedistributorsBase|0x0
|
|
||||||
gArmTokenSpaceGuid.PcdGicInterruptInterfaceBase|0x0
|
|
||||||
|
|
||||||
#
|
|
||||||
# Set video resolution for boot options and for text setup.
|
|
||||||
# PlatformDxe can set the former at runtime.
|
|
||||||
#
|
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdVideoHorizontalResolution|800
|
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdVideoVerticalResolution|600
|
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdSetupVideoHorizontalResolution|640
|
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdSetupVideoVerticalResolution|480
|
|
||||||
|
|
||||||
## Force DTB
|
|
||||||
gArmVirtTokenSpaceGuid.PcdForceNoAcpi|TRUE
|
|
||||||
|
|
||||||
# Setup Flash storage variables
|
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase|0
|
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize|0x40000
|
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase|0
|
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize|0x40000
|
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase|0
|
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize|0x40000
|
|
||||||
|
|
||||||
## RTC Register address in MMIO space.
|
|
||||||
gPcAtChipsetPkgTokenSpaceGuid.PcdRtcIndexRegister64|0x0
|
|
||||||
gPcAtChipsetPkgTokenSpaceGuid.PcdRtcTargetRegister64|0x0
|
|
||||||
|
|
||||||
################################################################################
|
|
||||||
#
|
|
||||||
# Components Section - list of all EDK II Modules needed by this Platform
|
|
||||||
#
|
|
||||||
################################################################################
|
|
||||||
[Components.common]
|
|
||||||
#
|
|
||||||
# PEI Phase modules
|
|
||||||
#
|
|
||||||
ArmVirtPkg/PrePi/ArmVirtPrePiUniCoreRelocatable.inf {
|
|
||||||
<LibraryClasses>
|
|
||||||
ExtractGuidedSectionLib|EmbeddedPkg/Library/PrePiExtractGuidedSectionLib/PrePiExtractGuidedSectionLib.inf
|
|
||||||
LzmaDecompressLib|MdeModulePkg/Library/LzmaCustomDecompressLib/LzmaCustomDecompressLib.inf
|
|
||||||
PrePiLib|EmbeddedPkg/Library/PrePiLib/PrePiLib.inf
|
|
||||||
HobLib|EmbeddedPkg/Library/PrePiHobLib/PrePiHobLib.inf
|
|
||||||
PrePiHobListPointerLib|ArmPlatformPkg/Library/PrePiHobListPointerLib/PrePiHobListPointerLib.inf
|
|
||||||
MemoryAllocationLib|EmbeddedPkg/Library/PrePiMemoryAllocationLib/PrePiMemoryAllocationLib.inf
|
|
||||||
}
|
|
||||||
|
|
||||||
#
|
|
||||||
# DXE
|
|
||||||
#
|
|
||||||
MdeModulePkg/Core/Dxe/DxeMain.inf {
|
|
||||||
<LibraryClasses>
|
|
||||||
NULL|MdeModulePkg/Library/DxeCrc32GuidedSectionExtractLib/DxeCrc32GuidedSectionExtractLib.inf
|
|
||||||
DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
|
|
||||||
}
|
|
||||||
MdeModulePkg/Universal/PCD/Dxe/Pcd.inf {
|
|
||||||
<LibraryClasses>
|
|
||||||
PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
|
|
||||||
}
|
|
||||||
|
|
||||||
#
|
|
||||||
# Architectural Protocols
|
|
||||||
#
|
|
||||||
ArmPkg/Drivers/CpuDxe/CpuDxe.inf
|
|
||||||
MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
|
|
||||||
MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf {
|
|
||||||
<LibraryClasses>
|
|
||||||
NULL|MdeModulePkg/Library/VarCheckUefiLib/VarCheckUefiLib.inf
|
|
||||||
NULL|EmbeddedPkg/Library/NvVarStoreFormattedLib/NvVarStoreFormattedLib.inf
|
|
||||||
BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
|
|
||||||
}
|
|
||||||
|
|
||||||
MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
|
|
||||||
MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf
|
|
||||||
MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf {
|
|
||||||
<LibraryClasses>
|
|
||||||
NULL|ArmVirtPkg/Library/NorFlashKvmtoolLib/NorFlashKvmtoolLib.inf
|
|
||||||
}
|
|
||||||
|
|
||||||
MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntimeDxe.inf
|
|
||||||
MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystemRuntimeDxe.inf
|
|
||||||
MdeModulePkg/Universal/Metronome/Metronome.inf
|
|
||||||
PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcatRealTimeClockRuntimeDxe.inf {
|
|
||||||
<LibraryClasses>
|
|
||||||
NULL|ArmVirtPkg/Library/KvmtoolRtcFdtClientLib/KvmtoolRtcFdtClientLib.inf
|
|
||||||
}
|
|
||||||
|
|
||||||
MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf
|
|
||||||
MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf
|
|
||||||
MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.inf
|
|
||||||
MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf
|
|
||||||
MdeModulePkg/Universal/SerialDxe/SerialDxe.inf
|
|
||||||
|
|
||||||
MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf
|
|
||||||
|
|
||||||
ArmPkg/Drivers/ArmGic/ArmGicDxe.inf
|
|
||||||
ArmPkg/Drivers/TimerDxe/TimerDxe.inf {
|
|
||||||
<LibraryClasses>
|
|
||||||
NULL|ArmVirtPkg/Library/ArmVirtTimerFdtClientLib/ArmVirtTimerFdtClientLib.inf
|
|
||||||
}
|
|
||||||
|
|
||||||
ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.inf
|
|
||||||
|
|
||||||
MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf
|
|
||||||
|
|
||||||
#
|
|
||||||
# Platform Driver
|
|
||||||
#
|
|
||||||
ArmVirtPkg/KvmtoolPlatformDxe/KvmtoolPlatformDxe.inf
|
|
||||||
ArmVirtPkg/VirtioFdtDxe/VirtioFdtDxe.inf
|
|
||||||
ArmVirtPkg/FdtClientDxe/FdtClientDxe.inf
|
|
||||||
ArmVirtPkg/HighMemDxe/HighMemDxe.inf
|
|
||||||
OvmfPkg/VirtioBlkDxe/VirtioBlk.inf
|
|
||||||
OvmfPkg/VirtioScsiDxe/VirtioScsi.inf
|
|
||||||
OvmfPkg/VirtioNetDxe/VirtioNet.inf
|
|
||||||
OvmfPkg/VirtioRngDxe/VirtioRng.inf
|
|
||||||
|
|
||||||
#
|
|
||||||
# FAT filesystem + GPT/MBR partitioning + UDF filesystem
|
|
||||||
#
|
|
||||||
MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf
|
|
||||||
MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf
|
|
||||||
MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf
|
|
||||||
FatPkg/EnhancedFatDxe/Fat.inf
|
|
||||||
MdeModulePkg/Universal/Disk/UdfDxe/UdfDxe.inf
|
|
||||||
|
|
||||||
#
|
|
||||||
# Bds
|
|
||||||
#
|
|
||||||
MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf {
|
|
||||||
<LibraryClasses>
|
|
||||||
DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
|
|
||||||
PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
|
|
||||||
}
|
|
||||||
MdeModulePkg/Universal/DisplayEngineDxe/DisplayEngineDxe.inf
|
|
||||||
MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf
|
|
||||||
MdeModulePkg/Universal/DriverHealthManagerDxe/DriverHealthManagerDxe.inf
|
|
||||||
MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
|
|
||||||
MdeModulePkg/Logo/LogoDxe.inf
|
|
||||||
MdeModulePkg/Application/UiApp/UiApp.inf {
|
|
||||||
<LibraryClasses>
|
|
||||||
NULL|MdeModulePkg/Library/DeviceManagerUiLib/DeviceManagerUiLib.inf
|
|
||||||
NULL|MdeModulePkg/Library/BootManagerUiLib/BootManagerUiLib.inf
|
|
||||||
NULL|MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerUiLib.inf
|
|
||||||
}
|
|
||||||
|
|
||||||
#
|
|
||||||
# SCSI Bus and Disk Driver
|
|
||||||
#
|
|
||||||
MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBusDxe.inf
|
|
||||||
MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDiskDxe.inf
|
|
@@ -1,234 +0,0 @@
|
|||||||
#
|
|
||||||
# Copyright (c) 2018 - 2020, ARM Limited. All rights reserved.
|
|
||||||
#
|
|
||||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
|
||||||
#
|
|
||||||
#
|
|
||||||
|
|
||||||
################################################################################
|
|
||||||
#
|
|
||||||
# FD Section
|
|
||||||
# The [FD] Section is made up of the definition statements and a
|
|
||||||
# description of what goes into the Flash Device Image. Each FD section
|
|
||||||
# defines one flash "device" image. A flash device image may be one of
|
|
||||||
# the following: Removable media bootable image (like a boot floppy
|
|
||||||
# image,) an Option ROM image (that would be "flashed" into an add-in
|
|
||||||
# card,) a System "Flash" image (that would be burned into a system's
|
|
||||||
# flash) or an Update ("Capsule") image that will be used to update and
|
|
||||||
# existing system flash.
|
|
||||||
#
|
|
||||||
################################################################################
|
|
||||||
|
|
||||||
[FD.KVMTOOL_EFI]
|
|
||||||
BaseAddress = 0x00000000|gArmTokenSpaceGuid.PcdFdBaseAddress
|
|
||||||
# The size in bytes of the FLASH Device
|
|
||||||
Size = 0x00200000|gArmTokenSpaceGuid.PcdFdSize
|
|
||||||
ErasePolarity = 1
|
|
||||||
|
|
||||||
# This one is tricky, it must be: BlockSize * NumBlocks = Size
|
|
||||||
BlockSize = 0x00001000
|
|
||||||
NumBlocks = 0x200
|
|
||||||
|
|
||||||
################################################################################
|
|
||||||
#
|
|
||||||
# Following are lists of FD Region layout which correspond to the locations of different
|
|
||||||
# images within the flash device.
|
|
||||||
#
|
|
||||||
# Regions must be defined in ascending order and may not overlap.
|
|
||||||
#
|
|
||||||
# A Layout Region start with a eight digit hex offset (leading "0x" required) followed by
|
|
||||||
# the pipe "|" character, followed by the size of the region, also in hex with the leading
|
|
||||||
# "0x" characters. Like:
|
|
||||||
# Offset|Size
|
|
||||||
# PcdOffsetCName|PcdSizeCName
|
|
||||||
# RegionType <FV, DATA, or FILE>
|
|
||||||
#
|
|
||||||
################################################################################
|
|
||||||
|
|
||||||
#
|
|
||||||
# Implement the Linux kernel header layout so that the loader will identify
|
|
||||||
# it as something bootable, and execute it with a FDT pointer in x0 or r2.
|
|
||||||
# This area will be reused to store a copy of the FDT so round it up to 32 KB.
|
|
||||||
#
|
|
||||||
0x00000000|0x00008000
|
|
||||||
DATA = {
|
|
||||||
!if $(ARCH) == AARCH64
|
|
||||||
0x01, 0x00, 0x00, 0x10, # code0: adr x1, .
|
|
||||||
0xff, 0x1f, 0x00, 0x14, # code1: b 0x8000
|
|
||||||
0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, # text_offset: 512 KB
|
|
||||||
0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, # image_size: 2 MB
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, # flags
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, # res2
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, # res3
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, # res4
|
|
||||||
0x41, 0x52, 0x4d, 0x64, # magic: "ARM\x64"
|
|
||||||
0x00, 0x00, 0x00, 0x00 # res5
|
|
||||||
!else
|
|
||||||
0x08, 0x10, 0x4f, 0xe2, # adr r1, .
|
|
||||||
0x02, 0x00, 0xa0, 0xe1, # mov r0, r2 (DTB)
|
|
||||||
0x00, 0x00, 0xa0, 0xe1, # nop
|
|
||||||
0x00, 0x00, 0xa0, 0xe1, # nop
|
|
||||||
0x00, 0x00, 0xa0, 0xe1, # nop
|
|
||||||
0x00, 0x00, 0xa0, 0xe1, # nop
|
|
||||||
0x00, 0x00, 0xa0, 0xe1, # nop
|
|
||||||
0x00, 0x00, 0xa0, 0xe1, # nop
|
|
||||||
|
|
||||||
0xf6, 0x1f, 0x00, 0xea, # b 0x8000
|
|
||||||
0x18, 0x28, 0x6f, 0x01, # magic
|
|
||||||
0x00, 0x00, 0x00, 0x00, # start
|
|
||||||
0x00, 0x00, 0x20, 0x00, # image size: 2 MB
|
|
||||||
0x01, 0x02, 0x03, 0x04 # endiannness flag
|
|
||||||
!endif
|
|
||||||
}
|
|
||||||
|
|
||||||
0x00008000|0x001f8000
|
|
||||||
gArmTokenSpaceGuid.PcdFvBaseAddress|gArmTokenSpaceGuid.PcdFvSize
|
|
||||||
FV = FVMAIN_COMPACT
|
|
||||||
|
|
||||||
################################################################################
|
|
||||||
#
|
|
||||||
# FV Section
|
|
||||||
#
|
|
||||||
# [FV] section is used to define what components or modules are placed within a flash
|
|
||||||
# device file. This section also defines order the components and modules are positioned
|
|
||||||
# within the image. The [FV] section consists of define statements, set statements and
|
|
||||||
# module statements.
|
|
||||||
#
|
|
||||||
################################################################################
|
|
||||||
|
|
||||||
[FV.FvMain]
|
|
||||||
FvNameGuid = 8A91C08E-7D9D-4933-84D6-901D26D0766E
|
|
||||||
BlockSize = 0x40
|
|
||||||
NumBlocks = 0 # This FV gets compressed so make it just big enough
|
|
||||||
FvAlignment = 16 # FV alignment and FV attributes setting.
|
|
||||||
ERASE_POLARITY = 1
|
|
||||||
MEMORY_MAPPED = TRUE
|
|
||||||
STICKY_WRITE = TRUE
|
|
||||||
LOCK_CAP = TRUE
|
|
||||||
LOCK_STATUS = TRUE
|
|
||||||
WRITE_DISABLED_CAP = TRUE
|
|
||||||
WRITE_ENABLED_CAP = TRUE
|
|
||||||
WRITE_STATUS = TRUE
|
|
||||||
WRITE_LOCK_CAP = TRUE
|
|
||||||
WRITE_LOCK_STATUS = TRUE
|
|
||||||
READ_DISABLED_CAP = TRUE
|
|
||||||
READ_ENABLED_CAP = TRUE
|
|
||||||
READ_STATUS = TRUE
|
|
||||||
READ_LOCK_CAP = TRUE
|
|
||||||
READ_LOCK_STATUS = TRUE
|
|
||||||
|
|
||||||
INF MdeModulePkg/Core/Dxe/DxeMain.inf
|
|
||||||
INF MdeModulePkg/Universal/PCD/Dxe/Pcd.inf
|
|
||||||
INF ArmVirtPkg/VirtioFdtDxe/VirtioFdtDxe.inf
|
|
||||||
INF ArmVirtPkg/FdtClientDxe/FdtClientDxe.inf
|
|
||||||
INF ArmVirtPkg/KvmtoolPlatformDxe/KvmtoolPlatformDxe.inf
|
|
||||||
INF ArmVirtPkg/HighMemDxe/HighMemDxe.inf
|
|
||||||
|
|
||||||
#
|
|
||||||
# PI DXE Drivers producing Architectural Protocols (EFI Services)
|
|
||||||
#
|
|
||||||
INF ArmPkg/Drivers/CpuDxe/CpuDxe.inf
|
|
||||||
INF MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
|
|
||||||
INF MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
|
|
||||||
INF MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf
|
|
||||||
INF MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf
|
|
||||||
INF MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf
|
|
||||||
|
|
||||||
INF MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntimeDxe.inf
|
|
||||||
INF MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystemRuntimeDxe.inf
|
|
||||||
|
|
||||||
INF MdeModulePkg/Universal/Metronome/Metronome.inf
|
|
||||||
INF PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcatRealTimeClockRuntimeDxe.inf
|
|
||||||
|
|
||||||
INF MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf
|
|
||||||
|
|
||||||
#
|
|
||||||
# Multiple Console IO support
|
|
||||||
#
|
|
||||||
INF MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf
|
|
||||||
INF MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf
|
|
||||||
INF MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.inf
|
|
||||||
INF MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf
|
|
||||||
INF MdeModulePkg/Universal/SerialDxe/SerialDxe.inf
|
|
||||||
|
|
||||||
INF ArmPkg/Drivers/ArmGic/ArmGicDxe.inf
|
|
||||||
INF ArmPkg/Drivers/TimerDxe/TimerDxe.inf
|
|
||||||
INF MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf
|
|
||||||
INF ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.inf
|
|
||||||
|
|
||||||
#
|
|
||||||
# FAT filesystem + GPT/MBR partitioning + UDF filesystem
|
|
||||||
#
|
|
||||||
INF MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf
|
|
||||||
INF MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf
|
|
||||||
INF FatPkg/EnhancedFatDxe/Fat.inf
|
|
||||||
INF MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf
|
|
||||||
INF MdeModulePkg/Universal/Disk/UdfDxe/UdfDxe.inf
|
|
||||||
|
|
||||||
#
|
|
||||||
# Platform Driver
|
|
||||||
#
|
|
||||||
INF OvmfPkg/VirtioBlkDxe/VirtioBlk.inf
|
|
||||||
INF OvmfPkg/VirtioNetDxe/VirtioNet.inf
|
|
||||||
INF OvmfPkg/VirtioScsiDxe/VirtioScsi.inf
|
|
||||||
INF OvmfPkg/VirtioRngDxe/VirtioRng.inf
|
|
||||||
|
|
||||||
#
|
|
||||||
# UEFI application (Shell Embedded Boot Loader)
|
|
||||||
#
|
|
||||||
INF ShellPkg/Application/Shell/Shell.inf
|
|
||||||
INF ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf
|
|
||||||
|
|
||||||
#
|
|
||||||
# Bds
|
|
||||||
#
|
|
||||||
INF MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf
|
|
||||||
INF MdeModulePkg/Universal/DisplayEngineDxe/DisplayEngineDxe.inf
|
|
||||||
INF MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf
|
|
||||||
INF MdeModulePkg/Universal/DriverHealthManagerDxe/DriverHealthManagerDxe.inf
|
|
||||||
INF MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
|
|
||||||
INF MdeModulePkg/Application/UiApp/UiApp.inf
|
|
||||||
|
|
||||||
#
|
|
||||||
# SCSI Bus and Disk Driver
|
|
||||||
#
|
|
||||||
INF MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBusDxe.inf
|
|
||||||
INF MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDiskDxe.inf
|
|
||||||
|
|
||||||
#
|
|
||||||
# TianoCore logo (splash screen)
|
|
||||||
#
|
|
||||||
INF MdeModulePkg/Logo/LogoDxe.inf
|
|
||||||
|
|
||||||
#
|
|
||||||
# Ramdisk support
|
|
||||||
#
|
|
||||||
INF MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskDxe.inf
|
|
||||||
|
|
||||||
[FV.FVMAIN_COMPACT]
|
|
||||||
FvAlignment = 16
|
|
||||||
ERASE_POLARITY = 1
|
|
||||||
MEMORY_MAPPED = TRUE
|
|
||||||
STICKY_WRITE = TRUE
|
|
||||||
LOCK_CAP = TRUE
|
|
||||||
LOCK_STATUS = TRUE
|
|
||||||
WRITE_DISABLED_CAP = TRUE
|
|
||||||
WRITE_ENABLED_CAP = TRUE
|
|
||||||
WRITE_STATUS = TRUE
|
|
||||||
WRITE_LOCK_CAP = TRUE
|
|
||||||
WRITE_LOCK_STATUS = TRUE
|
|
||||||
READ_DISABLED_CAP = TRUE
|
|
||||||
READ_ENABLED_CAP = TRUE
|
|
||||||
READ_STATUS = TRUE
|
|
||||||
READ_LOCK_CAP = TRUE
|
|
||||||
READ_LOCK_STATUS = TRUE
|
|
||||||
|
|
||||||
INF RuleOverride = SELF_RELOC ArmVirtPkg/PrePi/ArmVirtPrePiUniCoreRelocatable.inf
|
|
||||||
|
|
||||||
FILE FV_IMAGE = 9E21FD93-9C72-4c15-8C4B-E77F1DB2D792 {
|
|
||||||
SECTION GUIDED EE4E5898-3914-4259-9D6E-DC7BD79403CF PROCESSING_REQUIRED = TRUE {
|
|
||||||
SECTION FV_IMAGE = FVMAIN
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
!include ArmVirtRules.fdf.inc
|
|
@@ -5,27 +5,9 @@
|
|||||||
# used for code analysis.
|
# used for code analysis.
|
||||||
#
|
#
|
||||||
# Copyright (c) Microsoft Corporation
|
# Copyright (c) Microsoft Corporation
|
||||||
# Copyright (c) 2020, Intel Corporation. All rights reserved.<BR>
|
|
||||||
# Copyright (c) 2020, ARM Limited. All rights reserved.
|
|
||||||
#
|
|
||||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
# 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
|
## options defined .pytool/Plugin/CompilerPlugin
|
||||||
"CompilerPlugin": {
|
"CompilerPlugin": {
|
||||||
"DscPath": "" # Don't support this test
|
"DscPath": "" # Don't support this test
|
||||||
@@ -52,7 +34,6 @@
|
|||||||
"OvmfPkg/OvmfPkg.dec",
|
"OvmfPkg/OvmfPkg.dec",
|
||||||
"EmbeddedPkg/EmbeddedPkg.dec",
|
"EmbeddedPkg/EmbeddedPkg.dec",
|
||||||
"ArmPlatformPkg/ArmPlatformPkg.dec",
|
"ArmPlatformPkg/ArmPlatformPkg.dec",
|
||||||
"PcAtChipsetPkg/PcAtChipsetPkg.dec",
|
|
||||||
"SecurityPkg/SecurityPkg.dec",
|
"SecurityPkg/SecurityPkg.dec",
|
||||||
"ShellPkg/ShellPkg.dec" #Is this ok?
|
"ShellPkg/ShellPkg.dec" #Is this ok?
|
||||||
],
|
],
|
||||||
@@ -114,8 +95,7 @@
|
|||||||
"unbootable",
|
"unbootable",
|
||||||
"virt's",
|
"virt's",
|
||||||
"werror",
|
"werror",
|
||||||
"xenio",
|
"xenio"
|
||||||
"kvmtool"
|
|
||||||
], # words to extend to the dictionary for this package
|
], # words to extend to the dictionary for this package
|
||||||
"IgnoreStandardPaths": [], # Standard Plugin defined paths that should be ignore
|
"IgnoreStandardPaths": [], # Standard Plugin defined paths that should be ignore
|
||||||
"AdditionalIncludePaths": [] # Additional paths to spell check (wildcards supported)
|
"AdditionalIncludePaths": [] # Additional paths to spell check (wildcards supported)
|
||||||
|
@@ -1,7 +1,6 @@
|
|||||||
#/** @file
|
#/** @file
|
||||||
#
|
#
|
||||||
# Copyright (c) 2014, Linaro Limited. All rights reserved.
|
# Copyright (c) 2014, Linaro Limited. All rights reserved.
|
||||||
# Copyright (c) 2020, ARM Limited. All rights reserved.
|
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||||
#
|
#
|
||||||
@@ -31,7 +30,6 @@
|
|||||||
[Guids.common]
|
[Guids.common]
|
||||||
gArmVirtTokenSpaceGuid = { 0x0B6F5CA7, 0x4F53, 0x445A, { 0xB7, 0x6E, 0x2E, 0x36, 0x5B, 0x80, 0x63, 0x66 } }
|
gArmVirtTokenSpaceGuid = { 0x0B6F5CA7, 0x4F53, 0x445A, { 0xB7, 0x6E, 0x2E, 0x36, 0x5B, 0x80, 0x63, 0x66 } }
|
||||||
gEarlyPL011BaseAddressGuid = { 0xB199DEA9, 0xFD5C, 0x4A84, { 0x80, 0x82, 0x2F, 0x41, 0x70, 0x78, 0x03, 0x05 } }
|
gEarlyPL011BaseAddressGuid = { 0xB199DEA9, 0xFD5C, 0x4A84, { 0x80, 0x82, 0x2F, 0x41, 0x70, 0x78, 0x03, 0x05 } }
|
||||||
gEarly16550UartBaseAddressGuid = { 0xea67ca3e, 0x1f54, 0x436b, { 0x97, 0x88, 0xd4, 0xeb, 0x29, 0xc3, 0x42, 0x67 } }
|
|
||||||
|
|
||||||
gArmVirtVariableGuid = { 0x50bea1e5, 0xa2c5, 0x46e9, { 0x9b, 0x3a, 0x59, 0x59, 0x65, 0x16, 0xb0, 0x0a } }
|
gArmVirtVariableGuid = { 0x50bea1e5, 0xa2c5, 0x46e9, { 0x9b, 0x3a, 0x59, 0x59, 0x65, 0x16, 0xb0, 0x0a } }
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# Copyright (c) 2011-2015, ARM Limited. All rights reserved.
|
# Copyright (c) 2011-2015, ARM Limited. All rights reserved.
|
||||||
# Copyright (c) 2014, Linaro Limited. All rights reserved.
|
# Copyright (c) 2014, Linaro Limited. All rights reserved.
|
||||||
# Copyright (c) 2015 - 2020, Intel Corporation. All rights reserved.
|
# Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||||
#
|
#
|
||||||
@@ -40,7 +40,6 @@
|
|||||||
DEFINE NETWORK_SNP_ENABLE = FALSE
|
DEFINE NETWORK_SNP_ENABLE = FALSE
|
||||||
DEFINE NETWORK_TLS_ENABLE = FALSE
|
DEFINE NETWORK_TLS_ENABLE = FALSE
|
||||||
DEFINE NETWORK_ALLOW_HTTP_CONNECTIONS = TRUE
|
DEFINE NETWORK_ALLOW_HTTP_CONNECTIONS = TRUE
|
||||||
DEFINE NETWORK_ISCSI_ENABLE = TRUE
|
|
||||||
|
|
||||||
!if $(NETWORK_SNP_ENABLE) == TRUE
|
!if $(NETWORK_SNP_ENABLE) == TRUE
|
||||||
!error "NETWORK_SNP_ENABLE is IA32/X64/EBC only"
|
!error "NETWORK_SNP_ENABLE is IA32/X64/EBC only"
|
||||||
@@ -106,9 +105,6 @@
|
|||||||
[LibraryClasses.common.UEFI_DRIVER]
|
[LibraryClasses.common.UEFI_DRIVER]
|
||||||
UefiScsiLib|MdePkg/Library/UefiScsiLib/UefiScsiLib.inf
|
UefiScsiLib|MdePkg/Library/UefiScsiLib/UefiScsiLib.inf
|
||||||
|
|
||||||
[BuildOptions]
|
|
||||||
!include NetworkPkg/NetworkBuildOptions.dsc.inc
|
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
#
|
#
|
||||||
# Pcd Section - list of all EDK II PCD Entries defined by this Platform
|
# Pcd Section - list of all EDK II PCD Entries defined by this Platform
|
||||||
|
@@ -103,7 +103,6 @@ READ_LOCK_STATUS = TRUE
|
|||||||
#
|
#
|
||||||
INF ShellPkg/Application/Shell/Shell.inf
|
INF ShellPkg/Application/Shell/Shell.inf
|
||||||
INF ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf
|
INF ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf
|
||||||
INF ShellPkg/DynamicCommand/HttpDynamicCommand/HttpDynamicCommand.inf
|
|
||||||
INF OvmfPkg/LinuxInitrdDynamicShellCommand/LinuxInitrdDynamicShellCommand.inf
|
INF OvmfPkg/LinuxInitrdDynamicShellCommand/LinuxInitrdDynamicShellCommand.inf
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# Copyright (c) 2011-2015, ARM Limited. All rights reserved.
|
# Copyright (c) 2011-2015, ARM Limited. All rights reserved.
|
||||||
# Copyright (c) 2014, Linaro Limited. All rights reserved.
|
# Copyright (c) 2014, Linaro Limited. All rights reserved.
|
||||||
# Copyright (c) 2015 - 2020, Intel Corporation. All rights reserved.
|
# Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||||
#
|
#
|
||||||
@@ -38,7 +38,6 @@
|
|||||||
DEFINE NETWORK_SNP_ENABLE = FALSE
|
DEFINE NETWORK_SNP_ENABLE = FALSE
|
||||||
DEFINE NETWORK_TLS_ENABLE = FALSE
|
DEFINE NETWORK_TLS_ENABLE = FALSE
|
||||||
DEFINE NETWORK_ALLOW_HTTP_CONNECTIONS = TRUE
|
DEFINE NETWORK_ALLOW_HTTP_CONNECTIONS = TRUE
|
||||||
DEFINE NETWORK_ISCSI_ENABLE = TRUE
|
|
||||||
|
|
||||||
!if $(NETWORK_SNP_ENABLE) == TRUE
|
!if $(NETWORK_SNP_ENABLE) == TRUE
|
||||||
!error "NETWORK_SNP_ENABLE is IA32/X64/EBC only"
|
!error "NETWORK_SNP_ENABLE is IA32/X64/EBC only"
|
||||||
@@ -84,14 +83,14 @@
|
|||||||
[LibraryClasses.common.UEFI_DRIVER]
|
[LibraryClasses.common.UEFI_DRIVER]
|
||||||
UefiScsiLib|MdePkg/Library/UefiScsiLib/UefiScsiLib.inf
|
UefiScsiLib|MdePkg/Library/UefiScsiLib/UefiScsiLib.inf
|
||||||
|
|
||||||
[BuildOptions]
|
[BuildOptions.common.EDKII.SEC, BuildOptions.common.EDKII.BASE]
|
||||||
!include NetworkPkg/NetworkBuildOptions.dsc.inc
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# We need to avoid jump tables in SEC modules, so that the PE/COFF
|
# CLANG38 with LTO support enabled uses the GNU GOLD linker, which insists
|
||||||
# self-relocation code itself is guaranteed to be position independent.
|
# 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_CAP = TRUE
|
||||||
READ_LOCK_STATUS = 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 {
|
FILE FV_IMAGE = 9E21FD93-9C72-4c15-8C4B-E77F1DB2D792 {
|
||||||
SECTION GUIDED EE4E5898-3914-4259-9D6E-DC7BD79403CF PROCESSING_REQUIRED = TRUE {
|
SECTION GUIDED EE4E5898-3914-4259-9D6E-DC7BD79403CF PROCESSING_REQUIRED = TRUE {
|
||||||
|
@@ -39,11 +39,6 @@
|
|||||||
TE TE Align = Auto $(INF_OUTPUT)/$(MODULE_NAME).efi
|
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]
|
[Rule.Common.PEI_CORE]
|
||||||
FILE PEI_CORE = $(NAMED_GUID) FIXED {
|
FILE PEI_CORE = $(NAMED_GUID) FIXED {
|
||||||
TE TE Align = Auto $(INF_OUTPUT)/$(MODULE_NAME).efi
|
TE TE Align = Auto $(INF_OUTPUT)/$(MODULE_NAME).efi
|
||||||
|
@@ -52,12 +52,14 @@
|
|||||||
[LibraryClasses.common.UEFI_DRIVER]
|
[LibraryClasses.common.UEFI_DRIVER]
|
||||||
UefiScsiLib|MdePkg/Library/UefiScsiLib/UefiScsiLib.inf
|
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
|
# CLANG38 with LTO support enabled uses the GNU GOLD linker, which insists
|
||||||
# self-relocation code itself is guaranteed to be position independent.
|
# 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
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
#
|
#
|
||||||
|
@@ -182,7 +182,6 @@ READ_LOCK_STATUS = TRUE
|
|||||||
#
|
#
|
||||||
INF ShellPkg/Application/Shell/Shell.inf
|
INF ShellPkg/Application/Shell/Shell.inf
|
||||||
INF ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf
|
INF ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf
|
||||||
INF ShellPkg/DynamicCommand/HttpDynamicCommand/HttpDynamicCommand.inf
|
|
||||||
INF OvmfPkg/LinuxInitrdDynamicShellCommand/LinuxInitrdDynamicShellCommand.inf
|
INF OvmfPkg/LinuxInitrdDynamicShellCommand/LinuxInitrdDynamicShellCommand.inf
|
||||||
|
|
||||||
#
|
#
|
||||||
@@ -234,7 +233,7 @@ READ_STATUS = TRUE
|
|||||||
READ_LOCK_CAP = TRUE
|
READ_LOCK_CAP = TRUE
|
||||||
READ_LOCK_STATUS = 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 {
|
FILE FV_IMAGE = 9E21FD93-9C72-4c15-8C4B-E77F1DB2D792 {
|
||||||
SECTION GUIDED EE4E5898-3914-4259-9D6E-DC7BD79403CF PROCESSING_REQUIRED = TRUE {
|
SECTION GUIDED EE4E5898-3914-4259-9D6E-DC7BD79403CF PROCESSING_REQUIRED = TRUE {
|
||||||
|
@@ -1,22 +0,0 @@
|
|||||||
/** @file
|
|
||||||
GUID for the HOB that caches the base address of the 16550 serial port, for
|
|
||||||
when PCD access is not available.
|
|
||||||
|
|
||||||
Copyright (c) 2020, ARM Limited. All rights reserved.
|
|
||||||
|
|
||||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
|
||||||
|
|
||||||
**/
|
|
||||||
|
|
||||||
#ifndef EARLY_16550_UART_BASE_ADDRESS_H__
|
|
||||||
#define EARLY_16550_UART_BASE_ADDRESS_H__
|
|
||||||
|
|
||||||
#define EARLY_16550_UART_BASE_ADDRESS_GUID { \
|
|
||||||
0xea67ca3e, 0x1f54, 0x436b, { \
|
|
||||||
0x97, 0x88, 0xd4, 0xeb, 0x29, 0xc3, 0x42, 0x67 \
|
|
||||||
} \
|
|
||||||
}
|
|
||||||
|
|
||||||
extern EFI_GUID gEarly16550UartBaseAddressGuid;
|
|
||||||
|
|
||||||
#endif // EARLY_16550_UART_BASE_ADDRESS_H__
|
|
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
|
@@ -1,82 +0,0 @@
|
|||||||
/** @file
|
|
||||||
|
|
||||||
The KvmtoolPlatformDxe performs the platform specific initialization like:
|
|
||||||
- It decides if the firmware should expose ACPI or Device Tree-based
|
|
||||||
hardware description to the operating system.
|
|
||||||
|
|
||||||
Copyright (c) 2018 - 2020, ARM Limited. All rights reserved.
|
|
||||||
|
|
||||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
|
||||||
|
|
||||||
**/
|
|
||||||
|
|
||||||
#include <Guid/VariableFormat.h>
|
|
||||||
#include <Library/BaseLib.h>
|
|
||||||
#include <Library/DebugLib.h>
|
|
||||||
#include <Library/UefiBootServicesTableLib.h>
|
|
||||||
#include <Protocol/FdtClient.h>
|
|
||||||
|
|
||||||
/** Decide if the firmware should expose ACPI tables or Device Tree and
|
|
||||||
install the appropriate protocol interface.
|
|
||||||
|
|
||||||
Note: This function is derived from "ArmVirtPkg/PlatformHasAcpiDtDxe",
|
|
||||||
by dropping the word size check, and the fw_cfg check.
|
|
||||||
|
|
||||||
@param [in] ImageHandle Handle for this image.
|
|
||||||
|
|
||||||
@retval EFI_SUCCESS Success.
|
|
||||||
@retval EFI_OUT_OF_RESOURCES There was not enough memory to install the
|
|
||||||
protocols.
|
|
||||||
@retval EFI_INVALID_PARAMETER A parameter is invalid.
|
|
||||||
|
|
||||||
**/
|
|
||||||
STATIC
|
|
||||||
EFI_STATUS
|
|
||||||
PlatformHasAcpiDt (
|
|
||||||
IN EFI_HANDLE ImageHandle
|
|
||||||
)
|
|
||||||
{
|
|
||||||
if (!PcdGetBool (PcdForceNoAcpi)) {
|
|
||||||
// Expose ACPI tables
|
|
||||||
return gBS->InstallProtocolInterface (
|
|
||||||
&ImageHandle,
|
|
||||||
&gEdkiiPlatformHasAcpiGuid,
|
|
||||||
EFI_NATIVE_INTERFACE,
|
|
||||||
NULL
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Expose the Device Tree.
|
|
||||||
return gBS->InstallProtocolInterface (
|
|
||||||
&ImageHandle,
|
|
||||||
&gEdkiiPlatformHasDeviceTreeGuid,
|
|
||||||
EFI_NATIVE_INTERFACE,
|
|
||||||
NULL
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Entry point for Kvmtool Platform Dxe
|
|
||||||
|
|
||||||
@param [in] ImageHandle Handle for this image.
|
|
||||||
@param [in] SystemTable Pointer to the EFI system table.
|
|
||||||
|
|
||||||
@retval EFI_SUCCESS Success.
|
|
||||||
@retval EFI_OUT_OF_RESOURCES There was not enough memory to install the
|
|
||||||
protocols.
|
|
||||||
@retval EFI_INVALID_PARAMETER A parameter is invalid.
|
|
||||||
|
|
||||||
**/
|
|
||||||
EFI_STATUS
|
|
||||||
EFIAPI
|
|
||||||
KvmtoolPlatformDxeEntryPoint (
|
|
||||||
IN EFI_HANDLE ImageHandle,
|
|
||||||
IN EFI_SYSTEM_TABLE *SystemTable
|
|
||||||
)
|
|
||||||
{
|
|
||||||
EFI_STATUS Status;
|
|
||||||
|
|
||||||
Status = PlatformHasAcpiDt (ImageHandle);
|
|
||||||
ASSERT_EFI_ERROR (Status);
|
|
||||||
|
|
||||||
return Status;
|
|
||||||
}
|
|
@@ -1,43 +0,0 @@
|
|||||||
## @file
|
|
||||||
# The KvmtoolPlatformDxe performs the platform specific initialization like:
|
|
||||||
# - It decides if the firmware should expose ACPI or Device Tree-based
|
|
||||||
# hardware description to the operating system.
|
|
||||||
#
|
|
||||||
# Copyright (c) 2018 - 2020, ARM Limited. All rights reserved.
|
|
||||||
#
|
|
||||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
|
||||||
#
|
|
||||||
##
|
|
||||||
|
|
||||||
[Defines]
|
|
||||||
INF_VERSION = 0x0001001B
|
|
||||||
BASE_NAME = KvmtoolPlatformDxe
|
|
||||||
FILE_GUID = 7479CCCD-D721-442A-8C73-A72DBB886669
|
|
||||||
MODULE_TYPE = DXE_DRIVER
|
|
||||||
VERSION_STRING = 1.0
|
|
||||||
ENTRY_POINT = KvmtoolPlatformDxeEntryPoint
|
|
||||||
|
|
||||||
[Sources]
|
|
||||||
KvmtoolPlatformDxe.c
|
|
||||||
|
|
||||||
[Packages]
|
|
||||||
ArmVirtPkg/ArmVirtPkg.dec
|
|
||||||
EmbeddedPkg/EmbeddedPkg.dec
|
|
||||||
MdePkg/MdePkg.dec
|
|
||||||
MdeModulePkg/MdeModulePkg.dec
|
|
||||||
|
|
||||||
[LibraryClasses]
|
|
||||||
BaseLib
|
|
||||||
DebugLib
|
|
||||||
UefiBootServicesTableLib
|
|
||||||
UefiDriverEntryPoint
|
|
||||||
|
|
||||||
[Guids]
|
|
||||||
gEdkiiPlatformHasAcpiGuid ## SOMETIMES_PRODUCES ## PROTOCOL
|
|
||||||
gEdkiiPlatformHasDeviceTreeGuid ## SOMETIMES_PRODUCES ## PROTOCOL
|
|
||||||
|
|
||||||
[Pcd]
|
|
||||||
gArmVirtTokenSpaceGuid.PcdForceNoAcpi
|
|
||||||
|
|
||||||
[Depex]
|
|
||||||
TRUE
|
|
@@ -1,137 +0,0 @@
|
|||||||
/** @file
|
|
||||||
Early Platform Hook Library instance for 16550 Uart.
|
|
||||||
|
|
||||||
Copyright (c) 2020, ARM Ltd. All rights reserved.<BR>
|
|
||||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
|
||||||
|
|
||||||
**/
|
|
||||||
|
|
||||||
#include <Base.h>
|
|
||||||
#include <Uefi.h>
|
|
||||||
|
|
||||||
#include <Pi/PiBootMode.h>
|
|
||||||
#include <Pi/PiHob.h>
|
|
||||||
|
|
||||||
#include <Library/BaseLib.h>
|
|
||||||
#include <Library/DebugLib.h>
|
|
||||||
#include <Library/HobLib.h>
|
|
||||||
#include <Library/PcdLib.h>
|
|
||||||
#include <Library/PlatformHookLib.h>
|
|
||||||
#include <libfdt.h>
|
|
||||||
|
|
||||||
/** Get the UART base address of the console serial-port from the DT.
|
|
||||||
|
|
||||||
This function fetches the node referenced in the "stdout-path"
|
|
||||||
property of the "chosen" node and returns the base address of
|
|
||||||
the console UART.
|
|
||||||
|
|
||||||
@param [in] Fdt Pointer to a Flattened Device Tree (Fdt).
|
|
||||||
@param [out] SerialConsoleAddress If success, contains the base address
|
|
||||||
of the console serial-port.
|
|
||||||
|
|
||||||
@retval EFI_SUCCESS The function completed successfully.
|
|
||||||
@retval EFI_NOT_FOUND Console serial-port info not found in DT.
|
|
||||||
@retval EFI_INVALID_PARAMETER Invalid parameter.
|
|
||||||
**/
|
|
||||||
STATIC
|
|
||||||
EFI_STATUS
|
|
||||||
EFIAPI
|
|
||||||
GetSerialConsolePortAddress (
|
|
||||||
IN CONST VOID *Fdt,
|
|
||||||
OUT UINT64 *SerialConsoleAddress
|
|
||||||
)
|
|
||||||
{
|
|
||||||
CONST CHAR8 *Prop;
|
|
||||||
INT32 PropSize;
|
|
||||||
CONST CHAR8 *Path;
|
|
||||||
INT32 PathLen;
|
|
||||||
INT32 ChosenNode;
|
|
||||||
INT32 SerialConsoleNode;
|
|
||||||
INT32 Len;
|
|
||||||
CONST CHAR8 *NodeStatus;
|
|
||||||
CONST UINT64 *RegProperty;
|
|
||||||
|
|
||||||
if ((Fdt == NULL) || (fdt_check_header (Fdt) != 0)) {
|
|
||||||
return EFI_INVALID_PARAMETER;
|
|
||||||
}
|
|
||||||
|
|
||||||
// The "chosen" node resides at the the root of the DT. Fetch it.
|
|
||||||
ChosenNode = fdt_path_offset (Fdt, "/chosen");
|
|
||||||
if (ChosenNode < 0) {
|
|
||||||
return EFI_NOT_FOUND;
|
|
||||||
}
|
|
||||||
|
|
||||||
Prop = fdt_getprop (Fdt, ChosenNode, "stdout-path", &PropSize);
|
|
||||||
if (PropSize < 0) {
|
|
||||||
return EFI_NOT_FOUND;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Determine the actual path length, as a colon terminates the path.
|
|
||||||
Path = ScanMem8 (Prop, ':', PropSize);
|
|
||||||
if (Path == NULL) {
|
|
||||||
PathLen = AsciiStrLen (Prop);
|
|
||||||
} else {
|
|
||||||
PathLen = Path - Prop;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Aliases cannot start with a '/', so it must be the actual path.
|
|
||||||
if (Prop[0] == '/') {
|
|
||||||
SerialConsoleNode = fdt_path_offset_namelen (Fdt, Prop, PathLen);
|
|
||||||
} else {
|
|
||||||
// Lookup the alias, as this contains the actual path.
|
|
||||||
Path = fdt_get_alias_namelen (Fdt, Prop, PathLen);
|
|
||||||
if (Path == NULL) {
|
|
||||||
return EFI_NOT_FOUND;
|
|
||||||
}
|
|
||||||
SerialConsoleNode = fdt_path_offset (Fdt, Path);
|
|
||||||
}
|
|
||||||
|
|
||||||
NodeStatus = fdt_getprop (Fdt, SerialConsoleNode, "status", &Len);
|
|
||||||
if ((NodeStatus != NULL) && (AsciiStrCmp (NodeStatus, "okay") != 0)) {
|
|
||||||
return EFI_NOT_FOUND;
|
|
||||||
}
|
|
||||||
|
|
||||||
RegProperty = fdt_getprop (Fdt, SerialConsoleNode, "reg", &Len);
|
|
||||||
if (Len != 16) {
|
|
||||||
return EFI_INVALID_PARAMETER;
|
|
||||||
}
|
|
||||||
|
|
||||||
*SerialConsoleAddress = fdt64_to_cpu (ReadUnaligned64 (RegProperty));
|
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Platform hook to retrieve the 16550 UART base address from the platform
|
|
||||||
Device tree and store it in PcdSerialRegisterBase.
|
|
||||||
|
|
||||||
@retval RETURN_SUCCESS Success.
|
|
||||||
@retval RETURN_INVALID_PARAMETER A parameter was invalid.
|
|
||||||
@retval RETURN_NOT_FOUND Serial port information not found.
|
|
||||||
|
|
||||||
**/
|
|
||||||
RETURN_STATUS
|
|
||||||
EFIAPI
|
|
||||||
PlatformHookSerialPortInitialize (
|
|
||||||
VOID
|
|
||||||
)
|
|
||||||
{
|
|
||||||
RETURN_STATUS Status;
|
|
||||||
VOID *DeviceTreeBase;
|
|
||||||
UINT64 SerialConsoleAddress;
|
|
||||||
|
|
||||||
if (PcdGet64 (PcdSerialRegisterBase) != 0) {
|
|
||||||
return RETURN_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
DeviceTreeBase = (VOID *)(UINTN)PcdGet64 (PcdDeviceTreeInitialBaseAddress);
|
|
||||||
if (DeviceTreeBase == NULL) {
|
|
||||||
return RETURN_NOT_FOUND;
|
|
||||||
}
|
|
||||||
|
|
||||||
Status = GetSerialConsolePortAddress (DeviceTreeBase, &SerialConsoleAddress);
|
|
||||||
if (RETURN_ERROR (Status)) {
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (EFI_STATUS)PcdSet64S (PcdSerialRegisterBase, SerialConsoleAddress);
|
|
||||||
}
|
|
@@ -1,36 +0,0 @@
|
|||||||
## @file
|
|
||||||
# Early Platform Hook Library instance for 16550 Uart.
|
|
||||||
#
|
|
||||||
# Copyright (c) 2020, ARM Ltd. All rights reserved.<BR>
|
|
||||||
#
|
|
||||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
|
||||||
#
|
|
||||||
##
|
|
||||||
|
|
||||||
[Defines]
|
|
||||||
INF_VERSION = 0x0001001B
|
|
||||||
BASE_NAME = EarlyFdt16550SerialPortHookLib
|
|
||||||
MODULE_UNI_FILE = Fdt16550SerialPortHookLib.uni
|
|
||||||
FILE_GUID = FFB19961-79CC-4684-84A8-C31B0A2BBE82
|
|
||||||
MODULE_TYPE = BASE
|
|
||||||
VERSION_STRING = 1.0
|
|
||||||
LIBRARY_CLASS = PlatformHookLib|SEC PEI_CORE PEIM
|
|
||||||
|
|
||||||
[Sources]
|
|
||||||
EarlyFdt16550SerialPortHookLib.c
|
|
||||||
|
|
||||||
[LibraryClasses]
|
|
||||||
BaseLib
|
|
||||||
PcdLib
|
|
||||||
FdtLib
|
|
||||||
HobLib
|
|
||||||
|
|
||||||
[Packages]
|
|
||||||
ArmVirtPkg/ArmVirtPkg.dec
|
|
||||||
EmbeddedPkg/EmbeddedPkg.dec
|
|
||||||
MdeModulePkg/MdeModulePkg.dec
|
|
||||||
MdePkg/MdePkg.dec
|
|
||||||
|
|
||||||
[Pcd]
|
|
||||||
gArmVirtTokenSpaceGuid.PcdDeviceTreeInitialBaseAddress
|
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterBase
|
|
@@ -1,56 +0,0 @@
|
|||||||
/** @file
|
|
||||||
Platform Hook Library instance for 16550 Uart.
|
|
||||||
|
|
||||||
Copyright (c) 2020, ARM Ltd. All rights reserved.<BR>
|
|
||||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
|
||||||
|
|
||||||
**/
|
|
||||||
|
|
||||||
#include <Base.h>
|
|
||||||
#include <Uefi.h>
|
|
||||||
|
|
||||||
#include <Pi/PiBootMode.h>
|
|
||||||
#include <Pi/PiHob.h>
|
|
||||||
|
|
||||||
#include <Guid/Early16550UartBaseAddress.h>
|
|
||||||
#include <Guid/Fdt.h>
|
|
||||||
#include <Guid/FdtHob.h>
|
|
||||||
|
|
||||||
#include <Library/BaseLib.h>
|
|
||||||
#include <Library/HobLib.h>
|
|
||||||
#include <Library/PcdLib.h>
|
|
||||||
#include <Library/PlatformHookLib.h>
|
|
||||||
|
|
||||||
/** Platform hook to retrieve the 16550 UART base address from the GUID Hob
|
|
||||||
that caches the UART base address from early boot stage and store it in
|
|
||||||
PcdSerialRegisterBase.
|
|
||||||
|
|
||||||
@retval RETURN_SUCCESS Success.
|
|
||||||
@retval RETURN_NOT_FOUND Serial Port information not found.
|
|
||||||
|
|
||||||
**/
|
|
||||||
RETURN_STATUS
|
|
||||||
EFIAPI
|
|
||||||
PlatformHookSerialPortInitialize (
|
|
||||||
VOID
|
|
||||||
)
|
|
||||||
{
|
|
||||||
VOID *Hob;
|
|
||||||
UINT64 *UartBase;
|
|
||||||
|
|
||||||
if (PcdGet64 (PcdSerialRegisterBase) != 0) {
|
|
||||||
return RETURN_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
Hob = GetFirstGuidHob (&gEarly16550UartBaseAddressGuid);
|
|
||||||
if ((Hob == NULL) || (GET_GUID_HOB_DATA_SIZE (Hob) != sizeof (*UartBase))) {
|
|
||||||
return RETURN_NOT_FOUND;
|
|
||||||
}
|
|
||||||
|
|
||||||
UartBase = GET_GUID_HOB_DATA (Hob);
|
|
||||||
if ((UINTN)*UartBase == 0) {
|
|
||||||
return RETURN_NOT_FOUND;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (RETURN_STATUS)PcdSet64S (PcdSerialRegisterBase, (UINTN)*UartBase);
|
|
||||||
}
|
|
@@ -1,38 +0,0 @@
|
|||||||
## @file
|
|
||||||
# Platform Hook Library instance for 16550 Uart.
|
|
||||||
#
|
|
||||||
# Copyright (c) 2020, ARM Ltd. All rights reserved.<BR>
|
|
||||||
#
|
|
||||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
|
||||||
#
|
|
||||||
##
|
|
||||||
|
|
||||||
[Defines]
|
|
||||||
INF_VERSION = 0x0001001B
|
|
||||||
BASE_NAME = Fdt16550SerialPortHookLib
|
|
||||||
MODULE_UNI_FILE = Fdt16550SerialPortHookLib.uni
|
|
||||||
FILE_GUID = C6DFD3F0-179D-4376-89A5-F641A2E7EFB5
|
|
||||||
MODULE_TYPE = BASE
|
|
||||||
VERSION_STRING = 1.0
|
|
||||||
LIBRARY_CLASS = PlatformHookLib|DXE_CORE DXE_DRIVER UEFI_DRIVER DXE_RUNTIME_DRIVER UEFI_APPLICATION
|
|
||||||
CONSTRUCTOR = PlatformHookSerialPortInitialize
|
|
||||||
|
|
||||||
[Sources]
|
|
||||||
Fdt16550SerialPortHookLib.c
|
|
||||||
|
|
||||||
[LibraryClasses]
|
|
||||||
BaseLib
|
|
||||||
PcdLib
|
|
||||||
HobLib
|
|
||||||
|
|
||||||
[Packages]
|
|
||||||
ArmVirtPkg/ArmVirtPkg.dec
|
|
||||||
EmbeddedPkg/EmbeddedPkg.dec
|
|
||||||
MdeModulePkg/MdeModulePkg.dec
|
|
||||||
MdePkg/MdePkg.dec
|
|
||||||
|
|
||||||
[Pcd]
|
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterBase
|
|
||||||
|
|
||||||
[Guids]
|
|
||||||
gEarly16550UartBaseAddressGuid
|
|
@@ -1,13 +0,0 @@
|
|||||||
// /** @file
|
|
||||||
// Platform Hook Library instance for 16550 Uart.
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// Copyright (c) 2020, ARM Ltd. All rights reserved.<BR>
|
|
||||||
//
|
|
||||||
// SPDX-License-Identifier: BSD-2-Clause-Patent
|
|
||||||
//
|
|
||||||
// **/
|
|
||||||
|
|
||||||
#string STR_MODULE_ABSTRACT #language en-US "Platform Hook Library instance for 16550 Uart."
|
|
||||||
|
|
||||||
#string STR_MODULE_DESCRIPTION #language en-US "Platform Hook Library instance for 16550 Uart."
|
|
@@ -1,79 +0,0 @@
|
|||||||
/** @file
|
|
||||||
Kvmtool platform PEI library.
|
|
||||||
|
|
||||||
Copyright (c) 2020, ARM Limited. All rights reserved.
|
|
||||||
|
|
||||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
|
||||||
|
|
||||||
**/
|
|
||||||
|
|
||||||
#include <PiPei.h>
|
|
||||||
|
|
||||||
#include <Guid/Early16550UartBaseAddress.h>
|
|
||||||
#include <Guid/FdtHob.h>
|
|
||||||
|
|
||||||
#include <Library/MemoryAllocationLib.h>
|
|
||||||
#include <Library/DebugLib.h>
|
|
||||||
#include <Library/HobLib.h>
|
|
||||||
#include <Library/PcdLib.h>
|
|
||||||
#include <Library/PeiServicesLib.h>
|
|
||||||
#include <libfdt.h>
|
|
||||||
|
|
||||||
/** Initialise Platform HOBs
|
|
||||||
|
|
||||||
@retval EFI_SUCCESS Success.
|
|
||||||
@retval EFI_INVALID_PARAMETER A parameter is invalid.
|
|
||||||
@retval EFI_OUT_OF_RESOURCES Out of resources.
|
|
||||||
**/
|
|
||||||
EFI_STATUS
|
|
||||||
EFIAPI
|
|
||||||
PlatformPeim (
|
|
||||||
VOID
|
|
||||||
)
|
|
||||||
{
|
|
||||||
VOID *Base;
|
|
||||||
VOID *NewBase;
|
|
||||||
UINTN FdtSize;
|
|
||||||
UINTN FdtPages;
|
|
||||||
UINT64 *FdtHobData;
|
|
||||||
UINT64 *UartHobData;
|
|
||||||
|
|
||||||
Base = (VOID*)(UINTN)PcdGet64 (PcdDeviceTreeInitialBaseAddress);
|
|
||||||
if ((Base == NULL) || (fdt_check_header (Base) != 0)) {
|
|
||||||
ASSERT (0);
|
|
||||||
return EFI_INVALID_PARAMETER;
|
|
||||||
}
|
|
||||||
|
|
||||||
FdtSize = fdt_totalsize (Base) + PcdGet32 (PcdDeviceTreeAllocationPadding);
|
|
||||||
FdtPages = EFI_SIZE_TO_PAGES (FdtSize);
|
|
||||||
NewBase = AllocatePages (FdtPages);
|
|
||||||
if (NewBase == NULL) {
|
|
||||||
ASSERT (0);
|
|
||||||
return EFI_OUT_OF_RESOURCES;
|
|
||||||
}
|
|
||||||
|
|
||||||
fdt_open_into (Base, NewBase, EFI_PAGES_TO_SIZE (FdtPages));
|
|
||||||
|
|
||||||
FdtHobData = BuildGuidHob (&gFdtHobGuid, sizeof (*FdtHobData));
|
|
||||||
if (FdtHobData == NULL) {
|
|
||||||
ASSERT (0);
|
|
||||||
return EFI_OUT_OF_RESOURCES;
|
|
||||||
}
|
|
||||||
|
|
||||||
*FdtHobData = (UINTN)NewBase;
|
|
||||||
|
|
||||||
UartHobData = BuildGuidHob (
|
|
||||||
&gEarly16550UartBaseAddressGuid,
|
|
||||||
sizeof (*UartHobData)
|
|
||||||
);
|
|
||||||
if (UartHobData == NULL) {
|
|
||||||
ASSERT (0);
|
|
||||||
return EFI_OUT_OF_RESOURCES;
|
|
||||||
}
|
|
||||||
|
|
||||||
*UartHobData = PcdGet64 (PcdSerialRegisterBase);
|
|
||||||
|
|
||||||
BuildFvHob (PcdGet64 (PcdFvBaseAddress), PcdGet32 (PcdFvSize));
|
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
|
||||||
}
|
|
@@ -1,49 +0,0 @@
|
|||||||
## @file
|
|
||||||
# Kvmtool platform PEI library.
|
|
||||||
#
|
|
||||||
# Copyright (c) 2020, ARM Limited. All rights reserved.
|
|
||||||
#
|
|
||||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
|
||||||
#
|
|
||||||
##
|
|
||||||
|
|
||||||
[Defines]
|
|
||||||
INF_VERSION = 0x0001001B
|
|
||||||
BASE_NAME = PlatformPeiLib
|
|
||||||
FILE_GUID = 21073FB3-BA6F-43EB-83F0-4A840C648165
|
|
||||||
MODULE_TYPE = BASE
|
|
||||||
VERSION_STRING = 1.0
|
|
||||||
LIBRARY_CLASS = KvmtoolPlatformPeiLib
|
|
||||||
|
|
||||||
[Sources]
|
|
||||||
KvmtoolPlatformPeiLib.c
|
|
||||||
|
|
||||||
[Packages]
|
|
||||||
ArmPkg/ArmPkg.dec
|
|
||||||
ArmVirtPkg/ArmVirtPkg.dec
|
|
||||||
EmbeddedPkg/EmbeddedPkg.dec
|
|
||||||
MdeModulePkg/MdeModulePkg.dec
|
|
||||||
MdePkg/MdePkg.dec
|
|
||||||
|
|
||||||
[LibraryClasses]
|
|
||||||
DebugLib
|
|
||||||
HobLib
|
|
||||||
FdtLib
|
|
||||||
PcdLib
|
|
||||||
PeiServicesLib
|
|
||||||
|
|
||||||
[FixedPcd]
|
|
||||||
gArmTokenSpaceGuid.PcdFvSize
|
|
||||||
gArmVirtTokenSpaceGuid.PcdDeviceTreeAllocationPadding
|
|
||||||
|
|
||||||
[Pcd]
|
|
||||||
gArmTokenSpaceGuid.PcdFvBaseAddress
|
|
||||||
gArmVirtTokenSpaceGuid.PcdDeviceTreeInitialBaseAddress
|
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterBase
|
|
||||||
|
|
||||||
[Guids]
|
|
||||||
gFdtHobGuid
|
|
||||||
gEarly16550UartBaseAddressGuid
|
|
||||||
|
|
||||||
[Depex]
|
|
||||||
gEfiPeiMemoryDiscoveredPpiGuid
|
|
@@ -1,230 +0,0 @@
|
|||||||
/** @file
|
|
||||||
FDT client library for motorola,mc146818 RTC driver
|
|
||||||
|
|
||||||
Copyright (c) 2020, ARM Limited. All rights reserved.<BR>
|
|
||||||
|
|
||||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
|
||||||
|
|
||||||
**/
|
|
||||||
|
|
||||||
#include <Library/BaseLib.h>
|
|
||||||
#include <Library/DebugLib.h>
|
|
||||||
#include <Library/DxeServicesTableLib.h>
|
|
||||||
#include <Library/PcdLib.h>
|
|
||||||
#include <Library/UefiBootServicesTableLib.h>
|
|
||||||
#include <Protocol/FdtClient.h>
|
|
||||||
|
|
||||||
/** RTC Index register is at offset 0x0
|
|
||||||
*/
|
|
||||||
#define RTC_INDEX_REG_OFFSET 0x0ULL
|
|
||||||
|
|
||||||
/** RTC Target register is at offset 0x1
|
|
||||||
*/
|
|
||||||
#define RTC_TARGET_REG_OFFSET 0x1ULL
|
|
||||||
|
|
||||||
/** Add the RTC controller address range to the memory map.
|
|
||||||
|
|
||||||
@param [in] ImageHandle The handle to the image.
|
|
||||||
@param [in] RtcPageBase Base address of the RTC controller.
|
|
||||||
|
|
||||||
@retval EFI_SUCCESS Success.
|
|
||||||
@retval EFI_INVALID_PARAMETER A parameter is invalid.
|
|
||||||
@retval EFI_NOT_FOUND Flash device not found.
|
|
||||||
**/
|
|
||||||
STATIC
|
|
||||||
EFI_STATUS
|
|
||||||
KvmtoolRtcMapMemory (
|
|
||||||
IN EFI_HANDLE ImageHandle,
|
|
||||||
IN EFI_PHYSICAL_ADDRESS RtcPageBase
|
|
||||||
)
|
|
||||||
{
|
|
||||||
EFI_STATUS Status;
|
|
||||||
|
|
||||||
Status = gDS->AddMemorySpace (
|
|
||||||
EfiGcdMemoryTypeMemoryMappedIo,
|
|
||||||
RtcPageBase,
|
|
||||||
EFI_PAGE_SIZE,
|
|
||||||
EFI_MEMORY_UC | EFI_MEMORY_RUNTIME
|
|
||||||
);
|
|
||||||
if (EFI_ERROR (Status)) {
|
|
||||||
DEBUG ((
|
|
||||||
DEBUG_ERROR, "Failed to add memory space. Status = %r\n",
|
|
||||||
Status
|
|
||||||
));
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
Status = gDS->AllocateMemorySpace (
|
|
||||||
EfiGcdAllocateAddress,
|
|
||||||
EfiGcdMemoryTypeMemoryMappedIo,
|
|
||||||
0,
|
|
||||||
EFI_PAGE_SIZE,
|
|
||||||
&RtcPageBase,
|
|
||||||
ImageHandle,
|
|
||||||
NULL
|
|
||||||
);
|
|
||||||
if (EFI_ERROR (Status)) {
|
|
||||||
DEBUG ((
|
|
||||||
DEBUG_ERROR,
|
|
||||||
"Failed to allocate memory space. Status = %r\n",
|
|
||||||
Status
|
|
||||||
));
|
|
||||||
gDS->RemoveMemorySpace (
|
|
||||||
RtcPageBase,
|
|
||||||
EFI_PAGE_SIZE
|
|
||||||
);
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
Status = gDS->SetMemorySpaceAttributes (
|
|
||||||
RtcPageBase,
|
|
||||||
EFI_PAGE_SIZE,
|
|
||||||
EFI_MEMORY_UC | EFI_MEMORY_RUNTIME
|
|
||||||
);
|
|
||||||
if (EFI_ERROR (Status)) {
|
|
||||||
DEBUG ((
|
|
||||||
DEBUG_ERROR,
|
|
||||||
"Failed to set memory attributes. Status = %r\n",
|
|
||||||
Status
|
|
||||||
));
|
|
||||||
gDS->FreeMemorySpace (
|
|
||||||
RtcPageBase,
|
|
||||||
EFI_PAGE_SIZE
|
|
||||||
);
|
|
||||||
gDS->RemoveMemorySpace (
|
|
||||||
RtcPageBase,
|
|
||||||
EFI_PAGE_SIZE
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Entrypoint for KvmtoolRtcFdtClientLib.
|
|
||||||
|
|
||||||
Locate the RTC node in the DT and update the Index and
|
|
||||||
Target register base addresses in the respective PCDs.
|
|
||||||
Add the RTC memory region to the memory map.
|
|
||||||
Disable the RTC node as the RTC is owned by UEFI.
|
|
||||||
|
|
||||||
@param [in] ImageHandle The handle to the image.
|
|
||||||
@param [in] SystemTable Pointer to the System Table.
|
|
||||||
|
|
||||||
@retval EFI_SUCCESS Success.
|
|
||||||
@retval EFI_INVALID_PARAMETER A parameter is invalid.
|
|
||||||
@retval EFI_NOT_FOUND Flash device not found.
|
|
||||||
**/
|
|
||||||
EFI_STATUS
|
|
||||||
EFIAPI
|
|
||||||
KvmtoolRtcFdtClientLibConstructor (
|
|
||||||
IN EFI_HANDLE ImageHandle,
|
|
||||||
IN EFI_SYSTEM_TABLE *SystemTable
|
|
||||||
)
|
|
||||||
{
|
|
||||||
EFI_STATUS Status;
|
|
||||||
FDT_CLIENT_PROTOCOL *FdtClient;
|
|
||||||
INT32 Node;
|
|
||||||
CONST UINT32 *Reg;
|
|
||||||
UINT32 RegSize;
|
|
||||||
UINT64 RegBase;
|
|
||||||
UINT64 Range;
|
|
||||||
RETURN_STATUS PcdStatus;
|
|
||||||
|
|
||||||
Status = gBS->LocateProtocol (
|
|
||||||
&gFdtClientProtocolGuid,
|
|
||||||
NULL,
|
|
||||||
(VOID **)&FdtClient
|
|
||||||
);
|
|
||||||
ASSERT_EFI_ERROR (Status);
|
|
||||||
|
|
||||||
Status = FdtClient->FindCompatibleNode (
|
|
||||||
FdtClient,
|
|
||||||
"motorola,mc146818",
|
|
||||||
&Node
|
|
||||||
);
|
|
||||||
if (EFI_ERROR (Status)) {
|
|
||||||
DEBUG ((
|
|
||||||
DEBUG_ERROR,
|
|
||||||
"%a: No 'motorola,mc146818' compatible DT node found\n",
|
|
||||||
__FUNCTION__
|
|
||||||
));
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
Status = FdtClient->GetNodeProperty (
|
|
||||||
FdtClient,
|
|
||||||
Node,
|
|
||||||
"reg",
|
|
||||||
(CONST VOID **)&Reg,
|
|
||||||
&RegSize
|
|
||||||
);
|
|
||||||
if (EFI_ERROR (Status)) {
|
|
||||||
DEBUG ((
|
|
||||||
DEBUG_ERROR,
|
|
||||||
"%a: No 'reg' property found in 'motorola,mc146818' compatible DT node\n",
|
|
||||||
__FUNCTION__
|
|
||||||
));
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
ASSERT (RegSize == 16);
|
|
||||||
|
|
||||||
RegBase = SwapBytes64 (ReadUnaligned64 ((VOID *)&Reg[0]));
|
|
||||||
Range = SwapBytes64 (ReadUnaligned64 ((VOID *)&Reg[2]));
|
|
||||||
DEBUG ((
|
|
||||||
DEBUG_INFO,
|
|
||||||
"Found motorola,mc146818 RTC @ 0x%Lx Range = 0x%x\n",
|
|
||||||
RegBase,
|
|
||||||
Range
|
|
||||||
));
|
|
||||||
|
|
||||||
// The address range must cover the RTC Index and the Target registers.
|
|
||||||
ASSERT (Range >= 0x2);
|
|
||||||
|
|
||||||
// RTC Index register is at offset 0x0
|
|
||||||
PcdStatus = PcdSet64S (
|
|
||||||
PcdRtcIndexRegister64,
|
|
||||||
(RegBase + RTC_INDEX_REG_OFFSET)
|
|
||||||
);
|
|
||||||
ASSERT_RETURN_ERROR (PcdStatus);
|
|
||||||
|
|
||||||
// RTC Target register is at offset 0x1
|
|
||||||
PcdStatus = PcdSet64S (
|
|
||||||
PcdRtcTargetRegister64,
|
|
||||||
(RegBase + RTC_TARGET_REG_OFFSET)
|
|
||||||
);
|
|
||||||
ASSERT_RETURN_ERROR (PcdStatus);
|
|
||||||
|
|
||||||
Status = KvmtoolRtcMapMemory (ImageHandle, (RegBase & ~EFI_PAGE_MASK));
|
|
||||||
if (EFI_ERROR (Status)) {
|
|
||||||
DEBUG ((
|
|
||||||
DEBUG_ERROR,
|
|
||||||
"Failed to map memory for motorola,mc146818. Status = %r\n",
|
|
||||||
Status
|
|
||||||
));
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// UEFI takes ownership of the RTC hardware, and exposes its functionality
|
|
||||||
// through the UEFI Runtime Services GetTime, SetTime, etc. This means we
|
|
||||||
// need to disable it in the device tree to prevent the OS from attaching
|
|
||||||
// its device driver as well.
|
|
||||||
//
|
|
||||||
Status = FdtClient->SetNodeProperty (
|
|
||||||
FdtClient,
|
|
||||||
Node,
|
|
||||||
"status",
|
|
||||||
"disabled",
|
|
||||||
sizeof ("disabled")
|
|
||||||
);
|
|
||||||
if (EFI_ERROR (Status)) {
|
|
||||||
DEBUG ((
|
|
||||||
DEBUG_WARN,
|
|
||||||
"Failed to set motorola,mc146818 status to 'disabled', Status = %r\n",
|
|
||||||
Status
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
|
||||||
}
|
|
@@ -1,42 +0,0 @@
|
|||||||
## @file
|
|
||||||
# FDT client library for motorola,mc146818 RTC driver
|
|
||||||
#
|
|
||||||
# Copyright (c) 2020, ARM Limited. All rights reserved.<BR>
|
|
||||||
#
|
|
||||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
|
||||||
#
|
|
||||||
##
|
|
||||||
|
|
||||||
[Defines]
|
|
||||||
INF_VERSION = 0x0001001B
|
|
||||||
BASE_NAME = KvmtoolRtcFdtClientLib
|
|
||||||
FILE_GUID = 3254B4F7-30B5-48C6-B06A-D8FF97F3EF95
|
|
||||||
MODULE_TYPE = DXE_DRIVER
|
|
||||||
VERSION_STRING = 1.0
|
|
||||||
LIBRARY_CLASS = KvmtoolRtcFdtClientLib|DXE_DRIVER DXE_RUNTIME_DRIVER
|
|
||||||
CONSTRUCTOR = KvmtoolRtcFdtClientLibConstructor
|
|
||||||
|
|
||||||
[Sources]
|
|
||||||
KvmtoolRtcFdtClientLib.c
|
|
||||||
|
|
||||||
[Packages]
|
|
||||||
ArmVirtPkg/ArmVirtPkg.dec
|
|
||||||
MdePkg/MdePkg.dec
|
|
||||||
PcAtChipsetPkg/PcAtChipsetPkg.dec
|
|
||||||
|
|
||||||
[LibraryClasses]
|
|
||||||
BaseLib
|
|
||||||
DebugLib
|
|
||||||
PcdLib
|
|
||||||
UefiBootServicesTableLib
|
|
||||||
DxeServicesTableLib
|
|
||||||
|
|
||||||
[Protocols]
|
|
||||||
gFdtClientProtocolGuid ## CONSUMES
|
|
||||||
|
|
||||||
[Pcd]
|
|
||||||
gPcAtChipsetPkgTokenSpaceGuid.PcdRtcIndexRegister64
|
|
||||||
gPcAtChipsetPkgTokenSpaceGuid.PcdRtcTargetRegister64
|
|
||||||
|
|
||||||
[Depex]
|
|
||||||
gFdtClientProtocolGuid
|
|
@@ -1,98 +0,0 @@
|
|||||||
/** @file
|
|
||||||
Kvmtool virtual memory map library.
|
|
||||||
|
|
||||||
Copyright (c) 2018 - 2020, ARM Limited. All rights reserved.
|
|
||||||
|
|
||||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
|
||||||
|
|
||||||
**/
|
|
||||||
|
|
||||||
#include <Base.h>
|
|
||||||
#include <Library/ArmLib.h>
|
|
||||||
#include <Library/BaseLib.h>
|
|
||||||
#include <Library/BaseMemoryLib.h>
|
|
||||||
#include <Library/DebugLib.h>
|
|
||||||
#include <Library/MemoryAllocationLib.h>
|
|
||||||
|
|
||||||
// Number of Virtual Memory Map Descriptors
|
|
||||||
#define MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS 5
|
|
||||||
|
|
||||||
/**
|
|
||||||
Return the Virtual Memory Map of your platform
|
|
||||||
|
|
||||||
This Virtual Memory Map is used by MemoryInitPei Module to initialize the MMU
|
|
||||||
on your platform.
|
|
||||||
|
|
||||||
@param[out] VirtualMemoryMap Array of ARM_MEMORY_REGION_DESCRIPTOR
|
|
||||||
describing a Physical-to-Virtual Memory
|
|
||||||
mapping. This array must be ended by a
|
|
||||||
zero-filled entry. The allocated memory
|
|
||||||
will not be freed.
|
|
||||||
|
|
||||||
**/
|
|
||||||
VOID
|
|
||||||
ArmVirtGetMemoryMap (
|
|
||||||
OUT ARM_MEMORY_REGION_DESCRIPTOR **VirtualMemoryMap
|
|
||||||
)
|
|
||||||
{
|
|
||||||
ARM_MEMORY_REGION_DESCRIPTOR *VirtualMemoryTable;
|
|
||||||
UINTN Idx;
|
|
||||||
EFI_PHYSICAL_ADDRESS TopOfAddressSpace;
|
|
||||||
|
|
||||||
ASSERT (VirtualMemoryMap != NULL);
|
|
||||||
|
|
||||||
TopOfAddressSpace = LShiftU64 (1ULL, ArmGetPhysicalAddressBits ());
|
|
||||||
|
|
||||||
VirtualMemoryTable = (ARM_MEMORY_REGION_DESCRIPTOR*)
|
|
||||||
AllocatePages (
|
|
||||||
EFI_SIZE_TO_PAGES (
|
|
||||||
sizeof (ARM_MEMORY_REGION_DESCRIPTOR) *
|
|
||||||
MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS
|
|
||||||
)
|
|
||||||
);
|
|
||||||
if (VirtualMemoryTable == NULL) {
|
|
||||||
DEBUG ((
|
|
||||||
DEBUG_ERROR,
|
|
||||||
"%a: Error: Failed to Allocate Pages\n",
|
|
||||||
__FUNCTION__
|
|
||||||
));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Idx = 0;
|
|
||||||
// System DRAM
|
|
||||||
VirtualMemoryTable[Idx].PhysicalBase = PcdGet64 (PcdSystemMemoryBase);
|
|
||||||
VirtualMemoryTable[Idx].VirtualBase = VirtualMemoryTable[Idx].PhysicalBase;
|
|
||||||
VirtualMemoryTable[Idx].Length = PcdGet64 (PcdSystemMemorySize);
|
|
||||||
VirtualMemoryTable[Idx].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK;
|
|
||||||
|
|
||||||
// Peripheral space before DRAM
|
|
||||||
VirtualMemoryTable[++Idx].PhysicalBase = 0x0;
|
|
||||||
VirtualMemoryTable[Idx].VirtualBase = 0x0;
|
|
||||||
VirtualMemoryTable[Idx].Length = PcdGet64 (PcdSystemMemoryBase);
|
|
||||||
VirtualMemoryTable[Idx].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE;
|
|
||||||
|
|
||||||
// Peripheral space after DRAM
|
|
||||||
VirtualMemoryTable[++Idx].PhysicalBase = PcdGet64 (PcdSystemMemoryBase) +
|
|
||||||
PcdGet64 (PcdSystemMemorySize);
|
|
||||||
VirtualMemoryTable[Idx].VirtualBase = VirtualMemoryTable[Idx].PhysicalBase;
|
|
||||||
VirtualMemoryTable[Idx].Length = TopOfAddressSpace -
|
|
||||||
VirtualMemoryTable[Idx].PhysicalBase;
|
|
||||||
VirtualMemoryTable[Idx].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE;
|
|
||||||
|
|
||||||
// Map the FV region as normal executable memory
|
|
||||||
VirtualMemoryTable[++Idx].PhysicalBase = PcdGet64 (PcdFvBaseAddress);
|
|
||||||
VirtualMemoryTable[Idx].VirtualBase = VirtualMemoryTable[Idx].PhysicalBase;
|
|
||||||
VirtualMemoryTable[Idx].Length = FixedPcdGet32 (PcdFvSize);
|
|
||||||
VirtualMemoryTable[Idx].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK;
|
|
||||||
|
|
||||||
// End of Table
|
|
||||||
VirtualMemoryTable[++Idx].PhysicalBase = 0;
|
|
||||||
VirtualMemoryTable[Idx].VirtualBase = 0;
|
|
||||||
VirtualMemoryTable[Idx].Length = 0;
|
|
||||||
VirtualMemoryTable[Idx].Attributes = (ARM_MEMORY_REGION_ATTRIBUTES)0;
|
|
||||||
|
|
||||||
ASSERT((Idx + 1) <= MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS);
|
|
||||||
|
|
||||||
*VirtualMemoryMap = VirtualMemoryTable;
|
|
||||||
}
|
|
@@ -1,42 +0,0 @@
|
|||||||
## @file
|
|
||||||
# Kvmtool virtual memory map library.
|
|
||||||
#
|
|
||||||
# Copyright (c) 2018, ARM Limited. All rights reserved.
|
|
||||||
#
|
|
||||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
|
||||||
#
|
|
||||||
##
|
|
||||||
|
|
||||||
[Defines]
|
|
||||||
INF_VERSION = 0x0001001B
|
|
||||||
BASE_NAME = KvmtoolVirtMemInfoLib
|
|
||||||
FILE_GUID = B752E953-394F-462C-811C-F8BE35C8C071
|
|
||||||
MODULE_TYPE = BASE
|
|
||||||
VERSION_STRING = 1.0
|
|
||||||
LIBRARY_CLASS = ArmVirtMemInfoLib
|
|
||||||
|
|
||||||
[Sources]
|
|
||||||
KvmtoolVirtMemInfoLib.c
|
|
||||||
|
|
||||||
[Packages]
|
|
||||||
ArmPkg/ArmPkg.dec
|
|
||||||
ArmVirtPkg/ArmVirtPkg.dec
|
|
||||||
EmbeddedPkg/EmbeddedPkg.dec
|
|
||||||
MdeModulePkg/MdeModulePkg.dec
|
|
||||||
MdePkg/MdePkg.dec
|
|
||||||
|
|
||||||
[LibraryClasses]
|
|
||||||
ArmLib
|
|
||||||
BaseLib
|
|
||||||
BaseMemoryLib
|
|
||||||
DebugLib
|
|
||||||
MemoryAllocationLib
|
|
||||||
PcdLib
|
|
||||||
|
|
||||||
[Pcd]
|
|
||||||
gArmTokenSpaceGuid.PcdFvBaseAddress
|
|
||||||
gArmTokenSpaceGuid.PcdSystemMemoryBase
|
|
||||||
gArmTokenSpaceGuid.PcdSystemMemorySize
|
|
||||||
|
|
||||||
[FixedPcd]
|
|
||||||
gArmTokenSpaceGuid.PcdFvSize
|
|
@@ -1,335 +0,0 @@
|
|||||||
/** @file
|
|
||||||
An instance of the NorFlashPlatformLib for Kvmtool platform.
|
|
||||||
|
|
||||||
Copyright (c) 2020, ARM Ltd. All rights reserved.<BR>
|
|
||||||
|
|
||||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
|
||||||
|
|
||||||
**/
|
|
||||||
|
|
||||||
#include <Library/BaseLib.h>
|
|
||||||
#include <Library/DebugLib.h>
|
|
||||||
#include <Library/NorFlashPlatformLib.h>
|
|
||||||
#include <Library/UefiBootServicesTableLib.h>
|
|
||||||
#include <Protocol/FdtClient.h>
|
|
||||||
|
|
||||||
/** Macro defining the NOR block size configured in Kvmtool.
|
|
||||||
*/
|
|
||||||
#define KVMTOOL_NOR_BLOCK_SIZE SIZE_64KB
|
|
||||||
|
|
||||||
/** Macro defining the maximum number of Flash devices.
|
|
||||||
*/
|
|
||||||
#define MAX_FLASH_DEVICES 4
|
|
||||||
|
|
||||||
/** Macro defining the cfi-flash label describing the UEFI variable store.
|
|
||||||
*/
|
|
||||||
#define LABEL_UEFI_VAR_STORE "System-firmware"
|
|
||||||
|
|
||||||
STATIC NOR_FLASH_DESCRIPTION mNorFlashDevices[MAX_FLASH_DEVICES];
|
|
||||||
STATIC UINTN mNorFlashDeviceCount = 0;
|
|
||||||
STATIC INT32 mUefiVarStoreNode = MAX_INT32;
|
|
||||||
STATIC FDT_CLIENT_PROTOCOL *mFdtClient;
|
|
||||||
|
|
||||||
/** This function performs platform specific actions to initialise
|
|
||||||
the NOR flash, if required.
|
|
||||||
|
|
||||||
@retval EFI_SUCCESS Success.
|
|
||||||
**/
|
|
||||||
EFI_STATUS
|
|
||||||
NorFlashPlatformInitialization (
|
|
||||||
VOID
|
|
||||||
)
|
|
||||||
{
|
|
||||||
EFI_STATUS Status;
|
|
||||||
|
|
||||||
DEBUG ((DEBUG_INFO, "NorFlashPlatformInitialization\n"));
|
|
||||||
|
|
||||||
if ((mNorFlashDeviceCount > 0) && (mUefiVarStoreNode != MAX_INT32)) {
|
|
||||||
//
|
|
||||||
// UEFI takes ownership of the cfi-flash hardware, and exposes its
|
|
||||||
// functionality through the UEFI Runtime Variable Service. This means we
|
|
||||||
// need to disable it in the device tree to prevent the OS from attaching
|
|
||||||
// its device driver as well.
|
|
||||||
// Note: This library is loaded twice. First by FaultTolerantWriteDxe to
|
|
||||||
// setup the PcdFlashNvStorageFtw* and later by NorFlashDxe to provide the
|
|
||||||
// NorFlashPlatformLib interfaces. If the node is disabled when the library
|
|
||||||
// is first loaded, then during the subsequent loading of the library the
|
|
||||||
// call to FindNextCompatibleNode() from the library constructor skips the
|
|
||||||
// FDT node used for UEFI storage variable. Due to this we cannot setup the
|
|
||||||
// NOR flash device description i.e. mNorFlashDevices[].
|
|
||||||
// Since NorFlashPlatformInitialization() is called only by NorFlashDxe,
|
|
||||||
// we know it is safe to disable the node here.
|
|
||||||
//
|
|
||||||
Status = mFdtClient->SetNodeProperty (
|
|
||||||
mFdtClient,
|
|
||||||
mUefiVarStoreNode,
|
|
||||||
"status",
|
|
||||||
"disabled",
|
|
||||||
sizeof ("disabled")
|
|
||||||
);
|
|
||||||
if (EFI_ERROR (Status)) {
|
|
||||||
DEBUG ((DEBUG_WARN, "Failed to set cfi-flash status to 'disabled'\n"));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Status = EFI_NOT_FOUND;
|
|
||||||
DEBUG ((DEBUG_ERROR, "Flash device for UEFI variable storage not found\n"));
|
|
||||||
}
|
|
||||||
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Initialise Non volatile Flash storage variables.
|
|
||||||
|
|
||||||
@param [in] FlashDevice Pointer to the NOR Flash device.
|
|
||||||
|
|
||||||
@retval EFI_SUCCESS Success.
|
|
||||||
@retval EFI_INVALID_PARAMETER A parameter is invalid.
|
|
||||||
@retval EFI_OUT_OF_RESOURCES Insufficient flash storage space.
|
|
||||||
**/
|
|
||||||
STATIC
|
|
||||||
EFI_STATUS
|
|
||||||
SetupVariableStore (
|
|
||||||
IN NOR_FLASH_DESCRIPTION * FlashDevice
|
|
||||||
)
|
|
||||||
{
|
|
||||||
UINTN FlashRegion;
|
|
||||||
UINTN FlashNvStorageVariableBase;
|
|
||||||
UINTN FlashNvStorageFtwWorkingBase;
|
|
||||||
UINTN FlashNvStorageFtwSpareBase;
|
|
||||||
UINTN FlashNvStorageVariableSize;
|
|
||||||
UINTN FlashNvStorageFtwWorkingSize;
|
|
||||||
UINTN FlashNvStorageFtwSpareSize;
|
|
||||||
|
|
||||||
FlashNvStorageVariableSize = PcdGet32 (PcdFlashNvStorageVariableSize);
|
|
||||||
FlashNvStorageFtwWorkingSize = PcdGet32 (PcdFlashNvStorageFtwWorkingSize);
|
|
||||||
FlashNvStorageFtwSpareSize = PcdGet32 (PcdFlashNvStorageFtwSpareSize);
|
|
||||||
|
|
||||||
if ((FlashNvStorageVariableSize == 0) ||
|
|
||||||
(FlashNvStorageFtwWorkingSize == 0) ||
|
|
||||||
(FlashNvStorageFtwSpareSize == 0)) {
|
|
||||||
DEBUG ((DEBUG_ERROR, "FlashNvStorage size not defined\n"));
|
|
||||||
return EFI_INVALID_PARAMETER;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Setup the variable store
|
|
||||||
FlashRegion = FlashDevice->DeviceBaseAddress;
|
|
||||||
|
|
||||||
FlashNvStorageVariableBase = FlashRegion;
|
|
||||||
FlashRegion += PcdGet32 (PcdFlashNvStorageVariableSize);
|
|
||||||
|
|
||||||
FlashNvStorageFtwWorkingBase = FlashRegion;
|
|
||||||
FlashRegion += PcdGet32 (PcdFlashNvStorageFtwWorkingSize);
|
|
||||||
|
|
||||||
FlashNvStorageFtwSpareBase = FlashRegion;
|
|
||||||
FlashRegion += PcdGet32 (PcdFlashNvStorageFtwSpareSize);
|
|
||||||
|
|
||||||
if (FlashRegion > (FlashDevice->DeviceBaseAddress + FlashDevice->Size)) {
|
|
||||||
DEBUG ((DEBUG_ERROR, "Insufficient flash storage size\n"));
|
|
||||||
return EFI_OUT_OF_RESOURCES;
|
|
||||||
}
|
|
||||||
|
|
||||||
PcdSet32S (
|
|
||||||
PcdFlashNvStorageVariableBase,
|
|
||||||
FlashNvStorageVariableBase
|
|
||||||
);
|
|
||||||
|
|
||||||
PcdSet32S (
|
|
||||||
PcdFlashNvStorageFtwWorkingBase,
|
|
||||||
FlashNvStorageFtwWorkingBase
|
|
||||||
);
|
|
||||||
|
|
||||||
PcdSet32S (
|
|
||||||
PcdFlashNvStorageFtwSpareBase,
|
|
||||||
FlashNvStorageFtwSpareBase
|
|
||||||
);
|
|
||||||
|
|
||||||
DEBUG ((
|
|
||||||
DEBUG_INFO,
|
|
||||||
"PcdFlashNvStorageVariableBase = 0x%x\n",
|
|
||||||
FlashNvStorageVariableBase
|
|
||||||
));
|
|
||||||
DEBUG ((
|
|
||||||
DEBUG_INFO,
|
|
||||||
"PcdFlashNvStorageVariableSize = 0x%x\n",
|
|
||||||
FlashNvStorageVariableSize
|
|
||||||
));
|
|
||||||
DEBUG ((
|
|
||||||
DEBUG_INFO,
|
|
||||||
"PcdFlashNvStorageFtwWorkingBase = 0x%x\n",
|
|
||||||
FlashNvStorageFtwWorkingBase
|
|
||||||
));
|
|
||||||
DEBUG ((
|
|
||||||
DEBUG_INFO,
|
|
||||||
"PcdFlashNvStorageFtwWorkingSize = 0x%x\n",
|
|
||||||
FlashNvStorageFtwWorkingSize
|
|
||||||
));
|
|
||||||
DEBUG ((
|
|
||||||
DEBUG_INFO,
|
|
||||||
"PcdFlashNvStorageFtwSpareBase = 0x%x\n",
|
|
||||||
FlashNvStorageFtwSpareBase
|
|
||||||
));
|
|
||||||
DEBUG ((
|
|
||||||
DEBUG_INFO,
|
|
||||||
"PcdFlashNvStorageFtwSpareSize = 0x%x\n",
|
|
||||||
FlashNvStorageFtwSpareSize
|
|
||||||
));
|
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Return the Flash devices on the platform.
|
|
||||||
|
|
||||||
@param [out] NorFlashDescriptions Pointer to the Flash device description.
|
|
||||||
@param [out] Count Number of Flash devices.
|
|
||||||
|
|
||||||
@retval EFI_SUCCESS Success.
|
|
||||||
@retval EFI_NOT_FOUND Flash device not found.
|
|
||||||
**/
|
|
||||||
EFI_STATUS
|
|
||||||
NorFlashPlatformGetDevices (
|
|
||||||
OUT NOR_FLASH_DESCRIPTION **NorFlashDescriptions,
|
|
||||||
OUT UINT32 *Count
|
|
||||||
)
|
|
||||||
{
|
|
||||||
if (mNorFlashDeviceCount > 0) {
|
|
||||||
*NorFlashDescriptions = mNorFlashDevices;
|
|
||||||
*Count = mNorFlashDeviceCount;
|
|
||||||
return EFI_SUCCESS;
|
|
||||||
}
|
|
||||||
return EFI_NOT_FOUND;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Entrypoint for NorFlashPlatformLib.
|
|
||||||
|
|
||||||
@param [in] ImageHandle The handle to the image.
|
|
||||||
@param [in] SystemTable Pointer to the System Table.
|
|
||||||
|
|
||||||
@retval EFI_SUCCESS Success.
|
|
||||||
@retval EFI_INVALID_PARAMETER A parameter is invalid.
|
|
||||||
@retval EFI_NOT_FOUND Flash device not found.
|
|
||||||
**/
|
|
||||||
EFI_STATUS
|
|
||||||
EFIAPI
|
|
||||||
NorFlashPlatformLibConstructor (
|
|
||||||
IN EFI_HANDLE ImageHandle,
|
|
||||||
IN EFI_SYSTEM_TABLE * SystemTable
|
|
||||||
)
|
|
||||||
{
|
|
||||||
INT32 Node;
|
|
||||||
EFI_STATUS Status;
|
|
||||||
EFI_STATUS FindNodeStatus;
|
|
||||||
CONST UINT32 *Reg;
|
|
||||||
UINT32 PropSize;
|
|
||||||
UINT64 Base;
|
|
||||||
UINT64 Size;
|
|
||||||
UINTN UefiVarStoreIndex;
|
|
||||||
CONST CHAR8 *Label;
|
|
||||||
UINT32 LabelLen;
|
|
||||||
|
|
||||||
if (mNorFlashDeviceCount != 0) {
|
|
||||||
return EFI_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
Status = gBS->LocateProtocol (
|
|
||||||
&gFdtClientProtocolGuid,
|
|
||||||
NULL,
|
|
||||||
(VOID **)&mFdtClient
|
|
||||||
);
|
|
||||||
ASSERT_EFI_ERROR (Status);
|
|
||||||
|
|
||||||
UefiVarStoreIndex = MAX_UINTN;
|
|
||||||
for (FindNodeStatus = mFdtClient->FindCompatibleNode (
|
|
||||||
mFdtClient,
|
|
||||||
"cfi-flash",
|
|
||||||
&Node
|
|
||||||
);
|
|
||||||
!EFI_ERROR (FindNodeStatus) &&
|
|
||||||
(mNorFlashDeviceCount < MAX_FLASH_DEVICES);
|
|
||||||
FindNodeStatus = mFdtClient->FindNextCompatibleNode (
|
|
||||||
mFdtClient,
|
|
||||||
"cfi-flash",
|
|
||||||
Node,
|
|
||||||
&Node
|
|
||||||
)) {
|
|
||||||
Status = mFdtClient->GetNodeProperty (
|
|
||||||
mFdtClient,
|
|
||||||
Node,
|
|
||||||
"label",
|
|
||||||
(CONST VOID **)&Label,
|
|
||||||
&LabelLen
|
|
||||||
);
|
|
||||||
if (EFI_ERROR (Status)) {
|
|
||||||
DEBUG ((
|
|
||||||
DEBUG_ERROR,
|
|
||||||
"%a: GetNodeProperty ('label') failed (Status == %r)\n",
|
|
||||||
__FUNCTION__,
|
|
||||||
Status
|
|
||||||
));
|
|
||||||
} else if (AsciiStrCmp (Label, LABEL_UEFI_VAR_STORE) == 0) {
|
|
||||||
UefiVarStoreIndex = mNorFlashDeviceCount;
|
|
||||||
mUefiVarStoreNode = Node;
|
|
||||||
}
|
|
||||||
|
|
||||||
Status = mFdtClient->GetNodeProperty (
|
|
||||||
mFdtClient,
|
|
||||||
Node,
|
|
||||||
"reg",
|
|
||||||
(CONST VOID **)&Reg,
|
|
||||||
&PropSize
|
|
||||||
);
|
|
||||||
if (EFI_ERROR (Status)) {
|
|
||||||
DEBUG ((DEBUG_ERROR, "%a: GetNodeProperty () failed (Status == %r)\n",
|
|
||||||
__FUNCTION__, Status));
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
ASSERT ((PropSize % (4 * sizeof (UINT32))) == 0);
|
|
||||||
|
|
||||||
while ((PropSize >= (4 * sizeof (UINT32))) &&
|
|
||||||
(mNorFlashDeviceCount < MAX_FLASH_DEVICES)) {
|
|
||||||
Base = SwapBytes64 (ReadUnaligned64 ((VOID *)&Reg[0]));
|
|
||||||
Size = SwapBytes64 (ReadUnaligned64 ((VOID *)&Reg[2]));
|
|
||||||
Reg += 4;
|
|
||||||
|
|
||||||
PropSize -= 4 * sizeof (UINT32);
|
|
||||||
|
|
||||||
//
|
|
||||||
// Disregard any flash devices that overlap with the primary FV.
|
|
||||||
// The firmware is not updatable from inside the guest anyway.
|
|
||||||
//
|
|
||||||
if ((PcdGet64 (PcdFvBaseAddress) + PcdGet32 (PcdFvSize) > Base) &&
|
|
||||||
(Base + Size) > PcdGet64 (PcdFvBaseAddress)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
DEBUG ((
|
|
||||||
DEBUG_INFO,
|
|
||||||
"NOR%d : Base = 0x%lx, Size = 0x%lx\n",
|
|
||||||
mNorFlashDeviceCount,
|
|
||||||
Base,
|
|
||||||
Size
|
|
||||||
));
|
|
||||||
|
|
||||||
mNorFlashDevices[mNorFlashDeviceCount].DeviceBaseAddress = (UINTN)Base;
|
|
||||||
mNorFlashDevices[mNorFlashDeviceCount].RegionBaseAddress = (UINTN)Base;
|
|
||||||
mNorFlashDevices[mNorFlashDeviceCount].Size = (UINTN)Size;
|
|
||||||
mNorFlashDevices[mNorFlashDeviceCount].BlockSize = KVMTOOL_NOR_BLOCK_SIZE;
|
|
||||||
mNorFlashDeviceCount++;
|
|
||||||
}
|
|
||||||
} // for
|
|
||||||
|
|
||||||
// Setup the variable store in the last device
|
|
||||||
if (mNorFlashDeviceCount > 0) {
|
|
||||||
if (UefiVarStoreIndex == MAX_UINTN) {
|
|
||||||
// We did not find a label matching the UEFI Variable store. Default to
|
|
||||||
// using the last cfi-flash device as the variable store.
|
|
||||||
UefiVarStoreIndex = mNorFlashDeviceCount - 1;
|
|
||||||
mUefiVarStoreNode = Node;
|
|
||||||
}
|
|
||||||
if (mNorFlashDevices[UefiVarStoreIndex].DeviceBaseAddress != 0) {
|
|
||||||
return SetupVariableStore (&mNorFlashDevices[UefiVarStoreIndex]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return EFI_NOT_FOUND;
|
|
||||||
}
|
|
@@ -1,49 +0,0 @@
|
|||||||
## @file
|
|
||||||
# Nor Flash library for Kvmtool.
|
|
||||||
#
|
|
||||||
# Copyright (c) 2020, ARM Ltd. All rights reserved.<BR>
|
|
||||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
|
||||||
#
|
|
||||||
##
|
|
||||||
|
|
||||||
[Defines]
|
|
||||||
INF_VERSION = 0x0001001B
|
|
||||||
BASE_NAME = NorFlashKvmtoolLib
|
|
||||||
FILE_GUID = E75F07A1-B160-4893-BDD4-09E32FF847DC
|
|
||||||
MODULE_TYPE = DXE_DRIVER
|
|
||||||
VERSION_STRING = 1.0
|
|
||||||
LIBRARY_CLASS = NorFlashPlatformLib
|
|
||||||
CONSTRUCTOR = NorFlashPlatformLibConstructor
|
|
||||||
|
|
||||||
[Sources.common]
|
|
||||||
NorFlashKvmtool.c
|
|
||||||
|
|
||||||
[Packages]
|
|
||||||
ArmPkg/ArmPkg.dec
|
|
||||||
ArmPlatformPkg/ArmPlatformPkg.dec
|
|
||||||
ArmVirtPkg/ArmVirtPkg.dec
|
|
||||||
MdePkg/MdePkg.dec
|
|
||||||
MdeModulePkg/MdeModulePkg.dec
|
|
||||||
|
|
||||||
[LibraryClasses]
|
|
||||||
BaseLib
|
|
||||||
DebugLib
|
|
||||||
PcdLib
|
|
||||||
UefiBootServicesTableLib
|
|
||||||
|
|
||||||
[Protocols]
|
|
||||||
gFdtClientProtocolGuid ## CONSUMES
|
|
||||||
|
|
||||||
[Pcd]
|
|
||||||
gArmTokenSpaceGuid.PcdFvBaseAddress
|
|
||||||
gArmTokenSpaceGuid.PcdFvSize
|
|
||||||
|
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase
|
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize
|
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase
|
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize
|
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase
|
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize
|
|
||||||
|
|
||||||
[Depex]
|
|
||||||
gFdtClientProtocolGuid
|
|
@@ -86,22 +86,6 @@ NorFlashPlatformGetDevices (
|
|||||||
mNorFlashDevices[Num].BlockSize = QEMU_NOR_BLOCK_SIZE;
|
mNorFlashDevices[Num].BlockSize = QEMU_NOR_BLOCK_SIZE;
|
||||||
Num++;
|
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;
|
*NorFlashDescriptions = mNorFlashDevices;
|
||||||
|
@@ -9,6 +9,40 @@
|
|||||||
#include <AsmMacroIoLibV8.h>
|
#include <AsmMacroIoLibV8.h>
|
||||||
|
|
||||||
ASM_FUNC(_ModuleEntryPoint)
|
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)
|
bl ASM_PFX(DiscoverDramFromDt)
|
||||||
|
|
||||||
// Get ID of this CPU in Multicore system
|
// Get ID of this CPU in Multicore system
|
||||||
@@ -136,24 +170,15 @@ ASM_PFX(DiscoverDramFromDt):
|
|||||||
str x1, [x8]
|
str x1, [x8]
|
||||||
str x7, [x9]
|
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
|
// 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
|
// 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 x1, PcdGet64 (PcdSystemMemoryBase)
|
||||||
adr x2, PcdGet64 (PcdSystemMemorySize)
|
adr x2, PcdGet64 (PcdSystemMemorySize)
|
||||||
|
mov sp, x7
|
||||||
bl FindMemnode
|
bl FindMemnode
|
||||||
cbz x0, .Lout
|
cbz x0, .Lout
|
||||||
|
|
||||||
|
@@ -9,6 +9,38 @@
|
|||||||
#include <AsmMacroIoLib.h>
|
#include <AsmMacroIoLib.h>
|
||||||
|
|
||||||
ASM_FUNC(_ModuleEntryPoint)
|
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
|
// Do early platform specific actions
|
||||||
bl ASM_PFX(ArmPlatformPeiBootAction)
|
bl ASM_PFX(ArmPlatformPeiBootAction)
|
||||||
|
|
||||||
@@ -140,24 +172,15 @@ ASM_PFX(ArmPlatformPeiBootAction):
|
|||||||
str r1, [r8]
|
str r1, [r8]
|
||||||
str r5, [r7]
|
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
|
// 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
|
// 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 (r1, PcdGet64 (PcdSystemMemoryBase))
|
||||||
ADRL (r2, PcdGet64 (PcdSystemMemorySize))
|
ADRL (r2, PcdGet64 (PcdSystemMemorySize))
|
||||||
|
mov sp, r5
|
||||||
bl FindMemnode
|
bl FindMemnode
|
||||||
teq r0, #0
|
teq r0, #0
|
||||||
beq .Lout
|
beq .Lout
|
||||||
|
@@ -46,7 +46,6 @@
|
|||||||
SerialPortLib
|
SerialPortLib
|
||||||
ExtractGuidedSectionLib
|
ExtractGuidedSectionLib
|
||||||
LzmaDecompressLib
|
LzmaDecompressLib
|
||||||
PeCoffLib
|
|
||||||
PrePiLib
|
PrePiLib
|
||||||
MemoryAllocationLib
|
MemoryAllocationLib
|
||||||
HobLib
|
HobLib
|
||||||
@@ -96,3 +95,6 @@
|
|||||||
gArmVirtTokenSpaceGuid.PcdDeviceTreeInitialBaseAddress
|
gArmVirtTokenSpaceGuid.PcdDeviceTreeInitialBaseAddress
|
||||||
gArmTokenSpaceGuid.PcdFdBaseAddress
|
gArmTokenSpaceGuid.PcdFdBaseAddress
|
||||||
gArmTokenSpaceGuid.PcdFvBaseAddress
|
gArmTokenSpaceGuid.PcdFvBaseAddress
|
||||||
|
|
||||||
|
[BuildOptions]
|
||||||
|
GCC:*_*_*_DLINK_FLAGS = -Wl,-Bsymbolic,-pie,-T,$(MODULE_DIR)/Scripts/PrePi-PIE.lds
|
||||||
|
@@ -9,7 +9,6 @@
|
|||||||
#include <PiPei.h>
|
#include <PiPei.h>
|
||||||
#include <Pi/PiBootMode.h>
|
#include <Pi/PiBootMode.h>
|
||||||
|
|
||||||
#include <Library/PeCoffLib.h>
|
|
||||||
#include <Library/PrePiLib.h>
|
#include <Library/PrePiLib.h>
|
||||||
#include <Library/PrintLib.h>
|
#include <Library/PrintLib.h>
|
||||||
#include <Library/PrePiHobListPointerLib.h>
|
#include <Library/PrePiHobListPointerLib.h>
|
||||||
@@ -129,37 +128,3 @@ CEntryPoint (
|
|||||||
// DXE Core should always load and never return
|
// DXE Core should always load and never return
|
||||||
ASSERT (FALSE);
|
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)
|
||||||
|
}
|
||||||
|
}
|
@@ -14,8 +14,8 @@
|
|||||||
"id": "iasl-ci-1",
|
"id": "iasl-ci-1",
|
||||||
"scope": "cibuild",
|
"scope": "cibuild",
|
||||||
"type": "nuget",
|
"type": "nuget",
|
||||||
"name": "edk2-acpica-iasl",
|
"name": "iasl",
|
||||||
"source": "https://pkgs.dev.azure.com/projectmu/acpica/_packaging/mu_iasl/nuget/v3/index.json",
|
"source": "https://api.nuget.org/v3/index.json",
|
||||||
"version": "20200717.0.0",
|
"version": "20190215.0.0",
|
||||||
"flags": ["set_path", "host_specific"]
|
"flags": ["set_path", "host_specific"]
|
||||||
}
|
}
|
||||||
|
55
BaseTools/BinWrappers/WindowsLike/BrotliCompress.bat
Normal file
55
BaseTools/BinWrappers/WindowsLike/BrotliCompress.bat
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
@REM @file
|
||||||
|
@REM This script will exec Brotli tool with -e/-d options.
|
||||||
|
@REM
|
||||||
|
@REM Copyright (c) 2017 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
|
@REM SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||||
|
@REM
|
||||||
|
|
||||||
|
@echo off
|
||||||
|
@setlocal
|
||||||
|
|
||||||
|
set QLT=-q 9 -w 22
|
||||||
|
set ARGS=
|
||||||
|
|
||||||
|
:Begin
|
||||||
|
if "%1"=="" goto End
|
||||||
|
|
||||||
|
if "%1"=="-d" (
|
||||||
|
set ARGS=%ARGS% %1
|
||||||
|
shift
|
||||||
|
goto Begin
|
||||||
|
)
|
||||||
|
|
||||||
|
if "%1"=="-e" (
|
||||||
|
shift
|
||||||
|
goto Begin
|
||||||
|
)
|
||||||
|
|
||||||
|
if "%1"=="-g" (
|
||||||
|
set ARGS=%ARGS% %1 %2
|
||||||
|
shift
|
||||||
|
shift
|
||||||
|
goto Begin
|
||||||
|
)
|
||||||
|
|
||||||
|
if "%1"=="-o" (
|
||||||
|
set ARGS=%ARGS% %1 %2
|
||||||
|
shift
|
||||||
|
shift
|
||||||
|
goto Begin
|
||||||
|
)
|
||||||
|
|
||||||
|
if "%1"=="-q" (
|
||||||
|
set QLT=%1 %2
|
||||||
|
shift
|
||||||
|
shift
|
||||||
|
goto Begin
|
||||||
|
)
|
||||||
|
|
||||||
|
set ARGS=%ARGS% %1
|
||||||
|
shift
|
||||||
|
goto Begin
|
||||||
|
|
||||||
|
:End
|
||||||
|
Brotli %QLT% %ARGS%
|
||||||
|
@echo on
|
@@ -419,7 +419,6 @@
|
|||||||
|
|
||||||
<OutputFile>
|
<OutputFile>
|
||||||
$(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.aml
|
$(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.aml
|
||||||
$(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.amli
|
|
||||||
|
|
||||||
<ExtraDependency>
|
<ExtraDependency>
|
||||||
$(MAKE_FILE)
|
$(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
|
"$(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
|
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
|
"$(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>
|
<Command.GCC>
|
||||||
Trim --asl-file --asl-deps -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.i -i $(INC_LIST) ${src}
|
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
|
"$(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
|
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
|
"$(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
|
||||||
|
|
||||||
[Acpi-Machine-Language-File-to-C.DXE_DRIVER]
|
|
||||||
<InputFile>
|
|
||||||
?.amli
|
|
||||||
|
|
||||||
<OutputFile>
|
|
||||||
${s_path}(+)${s_base}.c
|
|
||||||
|
|
||||||
<Command>
|
|
||||||
-AmlToC ${src}
|
|
||||||
|
|
||||||
[C-Code-File.AcpiTable]
|
[C-Code-File.AcpiTable]
|
||||||
<InputFile>
|
<InputFile>
|
||||||
@@ -515,7 +504,7 @@
|
|||||||
"$(PP)" $(DEPS_FLAGS) $(PP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.ii
|
"$(PP)" $(DEPS_FLAGS) $(PP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.ii
|
||||||
Trim --source-code --convert-hex --trim-long -o ${d_path}(+)${s_base}.iii ${d_path}(+)${s_base}.ii
|
Trim --source-code --convert-hex --trim-long -o ${d_path}(+)${s_base}.iii ${d_path}(+)${s_base}.ii
|
||||||
cd $(OUTPUT_DIR)(+)${s_dir}
|
cd $(OUTPUT_DIR)(+)${s_dir}
|
||||||
"$(ASM16)" /nologo /c /omf $(ASM16_FLAGS) $(INC) /Fo$(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj ${d_path}(+)${s_base}.iii
|
"$(ASM16)" /nologo /c /omf $(INC) /Fo$(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj ${d_path}(+)${s_base}.iii
|
||||||
"$(ASMLINK)" $(ASMLINK_FLAGS) $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj,${dst},,,,
|
"$(ASMLINK)" $(ASMLINK_FLAGS) $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj,${dst},,,,
|
||||||
|
|
||||||
<Command.GCC>
|
<Command.GCC>
|
||||||
|
@@ -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
|
# GCC Build Flag for included header file list generation
|
||||||
DEFINE GCC_DEPS_FLAGS = -MMD -MF $@.deps
|
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_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_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
|
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_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_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 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) 2015 - 2020, Intel Corporation. All rights reserved.<BR>
|
||||||
# Copyright (C) 2020, Red Hat, Inc.<BR>
|
# Copyright (C) 2020, Red Hat, Inc.<BR>
|
||||||
# Copyright (c) 2020, ARM Ltd. All rights reserved.<BR>
|
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||||
#
|
#
|
||||||
@@ -20,8 +19,6 @@ import re
|
|||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
import email.header
|
|
||||||
|
|
||||||
class Verbose:
|
class Verbose:
|
||||||
SILENT, ONELINE, NORMAL = range(3)
|
SILENT, ONELINE, NORMAL = range(3)
|
||||||
level = NORMAL
|
level = NORMAL
|
||||||
@@ -268,14 +265,7 @@ class CommitMessageCheck:
|
|||||||
for i in range(2, count):
|
for i in range(2, count):
|
||||||
if (len(lines[i]) >= 76 and
|
if (len(lines[i]) >= 76 and
|
||||||
len(lines[i].split()) > 1 and
|
len(lines[i].split()) > 1 and
|
||||||
not lines[i].startswith('git-svn-id:') and
|
not lines[i].startswith('git-svn-id:')):
|
||||||
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:')):
|
|
||||||
#
|
#
|
||||||
# Print a warning if body line is longer than 75 characters
|
# Print a warning if body line is longer than 75 characters
|
||||||
#
|
#
|
||||||
@@ -357,22 +347,16 @@ class GitDiffCheck:
|
|||||||
self.is_newfile = False
|
self.is_newfile = False
|
||||||
self.force_crlf = True
|
self.force_crlf = True
|
||||||
self.force_notabs = True
|
self.force_notabs = True
|
||||||
if self.filename.endswith('.sh') or \
|
if self.filename.endswith('.sh'):
|
||||||
self.filename.startswith('BaseTools/BinWrappers/PosixLike/') or \
|
|
||||||
self.filename.startswith('BaseTools/Bin/CYGWIN_NT-5.1-i686/') or \
|
|
||||||
self.filename == 'BaseTools/BuildEnv':
|
|
||||||
#
|
#
|
||||||
# Do not enforce CR/LF line endings for linux shell scripts.
|
# 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
|
self.force_crlf = False
|
||||||
if self.filename == '.gitmodules' or \
|
if self.filename == '.gitmodules':
|
||||||
self.filename == 'BaseTools/Conf/diff.order':
|
|
||||||
#
|
#
|
||||||
# .gitmodules and diff orderfiles are used internally by git
|
# .gitmodules is updated by git and uses tabs and LF line
|
||||||
# use tabs and LF line endings. Do not enforce no tabs and
|
# endings. Do not enforce no tabs and do not enforce
|
||||||
# do not enforce CR/LF line endings.
|
# CR/LF line endings.
|
||||||
#
|
#
|
||||||
self.force_crlf = False
|
self.force_crlf = False
|
||||||
self.force_notabs = False
|
self.force_notabs = False
|
||||||
@@ -465,7 +449,7 @@ class GitDiffCheck:
|
|||||||
|
|
||||||
stripped = line.rstrip()
|
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),
|
self.added_line_error('Line ending (%s) is not CRLF' % repr(eol),
|
||||||
line)
|
line)
|
||||||
if self.force_notabs and '\t' in line:
|
if self.force_notabs and '\t' in line:
|
||||||
|
@@ -1,572 +0,0 @@
|
|||||||
/** @file
|
|
||||||
BrotliCompress Compress/Decompress tool (BrotliCompress)
|
|
||||||
|
|
||||||
Copyright (c) 2020, ByoSoft Corporation. All rights reserved.<BR>
|
|
||||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
|
||||||
|
|
||||||
**/
|
|
||||||
|
|
||||||
/* Command line interface for Brotli library. */
|
|
||||||
|
|
||||||
#include <errno.h>
|
|
||||||
#include <fcntl.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <sys/stat.h>
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <time.h>
|
|
||||||
|
|
||||||
#include "./brotli/c/common/constants.h"
|
|
||||||
#include "./brotli/c/common/version.h"
|
|
||||||
#include <brotli/decode.h>
|
|
||||||
#include <brotli/encode.h>
|
|
||||||
|
|
||||||
#if !defined(_WIN32)
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <utime.h>
|
|
||||||
#else
|
|
||||||
#include <io.h>
|
|
||||||
#include <share.h>
|
|
||||||
#include <sys/utime.h>
|
|
||||||
|
|
||||||
#if !defined(__MINGW32__)
|
|
||||||
#define STDIN_FILENO _fileno(stdin)
|
|
||||||
#define STDOUT_FILENO _fileno(stdout)
|
|
||||||
#define S_IRUSR S_IREAD
|
|
||||||
#define S_IWUSR S_IWRITE
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define fopen ms_fopen
|
|
||||||
#define open ms_open
|
|
||||||
|
|
||||||
#if defined(_MSC_VER) && (_MSC_VER >= 1400)
|
|
||||||
#define fseek _fseeki64
|
|
||||||
#define ftell _ftelli64
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static FILE* ms_fopen(const char* FileName, const char* Mode) {
|
|
||||||
FILE* Result;
|
|
||||||
Result = NULL;
|
|
||||||
fopen_s(&Result, FileName, Mode);
|
|
||||||
return Result;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int ms_open(const char* FileName, int Oflag, int Pmode) {
|
|
||||||
int Result;
|
|
||||||
Result = -1;
|
|
||||||
_sopen_s(&Result, FileName, Oflag | O_BINARY, _SH_DENYNO, Pmode);
|
|
||||||
return Result;
|
|
||||||
}
|
|
||||||
#endif /* WIN32 */
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef _MAX_PATH
|
|
||||||
#define _MAX_PATH 500
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define DEFAULT_LGWIN 22
|
|
||||||
#define DECODE_HEADER_SIZE 0x10
|
|
||||||
#define GAP_MEM_BLOCK 0x1000
|
|
||||||
size_t ScratchBufferSize = 0;
|
|
||||||
static const size_t kFileBufferSize = 1 << 19;
|
|
||||||
|
|
||||||
static void Version(void) {
|
|
||||||
int Major;
|
|
||||||
int Minor;
|
|
||||||
int Patch;
|
|
||||||
Major = BROTLI_VERSION >> 24;
|
|
||||||
Minor = (BROTLI_VERSION >> 12) & 0xFFF;
|
|
||||||
Patch = BROTLI_VERSION & 0xFFF;
|
|
||||||
printf("BrotliCompress %d.%d.%d\n", Major, Minor, Patch);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void Usage() {
|
|
||||||
printf("Usage: %s [OPTION]... [FILE]...\n", __FILE__);
|
|
||||||
printf(
|
|
||||||
"Options:\n"
|
|
||||||
" -e, --compress compress\n"
|
|
||||||
" -d, --decompress decompress\n"
|
|
||||||
" -h, --help display this help and exit\n");
|
|
||||||
printf(
|
|
||||||
" -o FILE, --output=FILE output file (only if 1 input file)\n");
|
|
||||||
printf(
|
|
||||||
" -g NUM, --gap=NUM scratch memory gap level (1-16)\n");
|
|
||||||
printf(
|
|
||||||
" -q NUM, --quality=NUM compression level (%d-%d)\n",
|
|
||||||
BROTLI_MIN_QUALITY, BROTLI_MAX_QUALITY);
|
|
||||||
printf(
|
|
||||||
" -v, --version display version and exit\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
static int64_t FileSize(const char* Path) {
|
|
||||||
FILE *FileHandle;
|
|
||||||
int64_t RetVal;
|
|
||||||
FileHandle = fopen(Path, "rb");
|
|
||||||
|
|
||||||
if (FileHandle == NULL) {
|
|
||||||
printf ("Failed to open file [%s]\n", Path);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
if (fseek(FileHandle, 0L, SEEK_END) != 0) {
|
|
||||||
printf ("Failed to seek file [%s]\n", Path);
|
|
||||||
fclose(FileHandle);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
RetVal = ftell(FileHandle);
|
|
||||||
if (fclose(FileHandle) != 0) {
|
|
||||||
printf ("Failed to close file [%s]\n", Path);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
return RetVal;
|
|
||||||
}
|
|
||||||
|
|
||||||
static BROTLI_BOOL HasMoreInput(FILE *FileHandle) {
|
|
||||||
return feof(FileHandle) ? BROTLI_FALSE : BROTLI_TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
int OpenFiles(char *InputFile, FILE **InHandle, char *OutputFile, FILE **OutHandle) {
|
|
||||||
*InHandle = NULL;
|
|
||||||
*OutHandle = NULL;
|
|
||||||
*InHandle = fopen(InputFile, "rb");
|
|
||||||
if (*InHandle == NULL) {
|
|
||||||
printf("Failed to open input file [%s]\n", InputFile);
|
|
||||||
return BROTLI_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
*OutHandle = fopen(OutputFile, "wb+");
|
|
||||||
if (*OutHandle == NULL) {
|
|
||||||
printf("Failed to open output file [%s]\n", OutputFile);
|
|
||||||
fclose(*InHandle);
|
|
||||||
return BROTLI_FALSE;
|
|
||||||
}
|
|
||||||
return BROTLI_TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
int CompressFile(char *InputFile, uint8_t *InputBuffer, char *OutputFile, uint8_t *OutputBuffer, int Quality, int Gap) {
|
|
||||||
int64_t InputFileSize;
|
|
||||||
FILE *InputFileHandle;
|
|
||||||
FILE *OutputFileHandle;
|
|
||||||
BrotliEncoderState *EncodeState;
|
|
||||||
uint32_t LgWin;
|
|
||||||
BROTLI_BOOL IsEof;
|
|
||||||
size_t AvailableIn;
|
|
||||||
const uint8_t *NextIn;
|
|
||||||
size_t AvailableOut;
|
|
||||||
uint8_t *NextOut;
|
|
||||||
uint8_t *Input;
|
|
||||||
uint8_t *Output;
|
|
||||||
size_t OutSize;
|
|
||||||
uint32_t SizeHint;
|
|
||||||
BROTLI_BOOL IsOk;
|
|
||||||
AvailableIn = 0;
|
|
||||||
IsEof = BROTLI_FALSE;
|
|
||||||
Input = InputBuffer;
|
|
||||||
Output = OutputBuffer;
|
|
||||||
IsOk = BROTLI_TRUE;
|
|
||||||
LgWin = DEFAULT_LGWIN;
|
|
||||||
|
|
||||||
InputFileSize = FileSize(InputFile);
|
|
||||||
|
|
||||||
IsOk = OpenFiles(InputFile, &InputFileHandle, OutputFile, &OutputFileHandle);
|
|
||||||
if (!IsOk) {
|
|
||||||
return IsOk;
|
|
||||||
}
|
|
||||||
|
|
||||||
fseek (OutputFileHandle, DECODE_HEADER_SIZE, SEEK_SET);
|
|
||||||
|
|
||||||
EncodeState = BrotliEncoderCreateInstance(NULL, NULL, NULL);
|
|
||||||
if (!EncodeState) {
|
|
||||||
printf("Out of memory\n");
|
|
||||||
IsOk = BROTLI_FALSE;
|
|
||||||
goto Finish;
|
|
||||||
}
|
|
||||||
BrotliEncoderSetParameter(EncodeState, BROTLI_PARAM_QUALITY, (uint32_t)Quality);
|
|
||||||
|
|
||||||
if (InputFileSize >= 0) {
|
|
||||||
LgWin = BROTLI_MIN_WINDOW_BITS;
|
|
||||||
while (BROTLI_MAX_BACKWARD_LIMIT(LgWin) < InputFileSize) {
|
|
||||||
LgWin++;
|
|
||||||
if (LgWin == BROTLI_MAX_WINDOW_BITS) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
BrotliEncoderSetParameter(EncodeState, BROTLI_PARAM_LGWIN, LgWin);
|
|
||||||
if (InputFileSize > 0) {
|
|
||||||
SizeHint = InputFileSize < (1 << 30)? (uint32_t)InputFileSize : (1u << 30);
|
|
||||||
BrotliEncoderSetParameter(EncodeState, BROTLI_PARAM_SIZE_HINT, SizeHint);
|
|
||||||
}
|
|
||||||
|
|
||||||
AvailableIn = 0;
|
|
||||||
NextIn = NULL;
|
|
||||||
AvailableOut = kFileBufferSize;
|
|
||||||
NextOut = Output;
|
|
||||||
for (;;) {
|
|
||||||
if (AvailableIn == 0 && !IsEof) {
|
|
||||||
AvailableIn = fread(Input, 1, kFileBufferSize, InputFileHandle);
|
|
||||||
NextIn = Input;
|
|
||||||
if (ferror(InputFileHandle)) {
|
|
||||||
printf("Failed to read input [%s]\n", InputFile);
|
|
||||||
IsOk = BROTLI_FALSE;
|
|
||||||
goto Finish;
|
|
||||||
}
|
|
||||||
IsEof = !HasMoreInput(InputFileHandle);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!BrotliEncoderCompressStream(EncodeState,
|
|
||||||
IsEof ? BROTLI_OPERATION_FINISH : BROTLI_OPERATION_PROCESS,
|
|
||||||
&AvailableIn, &NextIn, &AvailableOut, &NextOut, NULL)) {
|
|
||||||
printf("Failed to compress data [%s]\n", InputFile);
|
|
||||||
IsOk = BROTLI_FALSE;
|
|
||||||
goto Finish;
|
|
||||||
}
|
|
||||||
if (AvailableOut == 0) {
|
|
||||||
OutSize = (size_t)(NextOut - Output);
|
|
||||||
if (OutSize > 0) {
|
|
||||||
fwrite(Output, 1, OutSize, OutputFileHandle);
|
|
||||||
if (ferror(OutputFileHandle)) {
|
|
||||||
printf("Failed to write output [%s]\n", OutputFile);
|
|
||||||
IsOk = BROTLI_FALSE;
|
|
||||||
goto Finish;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
AvailableOut = kFileBufferSize;
|
|
||||||
NextOut = Output;
|
|
||||||
}
|
|
||||||
if (BrotliEncoderIsFinished(EncodeState)) {
|
|
||||||
OutSize = (size_t)(NextOut - Output);
|
|
||||||
if (OutSize > 0) {
|
|
||||||
fwrite(Output, 1, OutSize, OutputFileHandle);
|
|
||||||
if (ferror(OutputFileHandle)) {
|
|
||||||
printf("Failed to write output [%s]\n", OutputFile);
|
|
||||||
IsOk = BROTLI_FALSE;
|
|
||||||
goto Finish;
|
|
||||||
}
|
|
||||||
AvailableOut = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (IsEof) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Finish:
|
|
||||||
if (EncodeState) {
|
|
||||||
BrotliEncoderDestroyInstance(EncodeState);
|
|
||||||
}
|
|
||||||
if (InputFileHandle) {
|
|
||||||
fclose(InputFileHandle);
|
|
||||||
}
|
|
||||||
if (OutputFileHandle) {
|
|
||||||
fclose(OutputFileHandle);
|
|
||||||
}
|
|
||||||
return IsOk;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Default BrotliAllocFunc */
|
|
||||||
void* BrotliAllocFunc(void* Opaque, size_t Size) {
|
|
||||||
*(size_t *)Opaque = *(size_t *) Opaque + Size;
|
|
||||||
return malloc(Size);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Default BrotliFreeFunc */
|
|
||||||
void BrotliFreeFunc(void* Opaque, void* Address) {
|
|
||||||
free(Address);
|
|
||||||
}
|
|
||||||
|
|
||||||
int DecompressFile(char *InputFile, uint8_t *InputBuffer, char *OutputFile, uint8_t *OutputBuffer, int Quality, int Gap) {
|
|
||||||
FILE *InputFileHandle;
|
|
||||||
FILE *OutputFileHandle;
|
|
||||||
BrotliDecoderState *DecoderState;
|
|
||||||
BrotliDecoderResult Result;
|
|
||||||
size_t AvailableIn;
|
|
||||||
const uint8_t *NextIn;
|
|
||||||
size_t AvailableOut;
|
|
||||||
uint8_t *NextOut;
|
|
||||||
uint8_t *Input;
|
|
||||||
uint8_t *Output;
|
|
||||||
size_t OutSize;
|
|
||||||
BROTLI_BOOL IsOk;
|
|
||||||
AvailableIn = 0;
|
|
||||||
Input = InputBuffer;
|
|
||||||
Output = OutputBuffer;
|
|
||||||
IsOk = BROTLI_TRUE;
|
|
||||||
|
|
||||||
IsOk = OpenFiles(InputFile, &InputFileHandle, OutputFile, &OutputFileHandle);
|
|
||||||
if (!IsOk) {
|
|
||||||
return IsOk;
|
|
||||||
}
|
|
||||||
fseek(InputFileHandle, DECODE_HEADER_SIZE, SEEK_SET);
|
|
||||||
|
|
||||||
DecoderState = BrotliDecoderCreateInstance(BrotliAllocFunc, BrotliFreeFunc, &ScratchBufferSize);
|
|
||||||
if (!DecoderState) {
|
|
||||||
printf("Out of memory\n");
|
|
||||||
IsOk = BROTLI_FALSE;
|
|
||||||
goto Finish;
|
|
||||||
}
|
|
||||||
/* This allows decoding "large-window" streams. Though it creates
|
|
||||||
fragmentation (new builds decode streams that old builds don't),
|
|
||||||
it is better from used experience perspective. */
|
|
||||||
BrotliDecoderSetParameter(DecoderState, BROTLI_DECODER_PARAM_LARGE_WINDOW, 1u);
|
|
||||||
|
|
||||||
AvailableIn = 0;
|
|
||||||
NextIn = NULL;
|
|
||||||
AvailableOut = kFileBufferSize;
|
|
||||||
NextOut = Output;
|
|
||||||
Result = BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT;
|
|
||||||
for (;;) {
|
|
||||||
if (Result == BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT) {
|
|
||||||
if (!HasMoreInput(InputFileHandle)) {
|
|
||||||
printf("Corrupt input [%s]\n", InputFile);
|
|
||||||
IsOk = BROTLI_FALSE;
|
|
||||||
goto Finish;
|
|
||||||
}
|
|
||||||
AvailableIn = fread(Input, 1, kFileBufferSize, InputFileHandle);
|
|
||||||
NextIn = Input;
|
|
||||||
if (ferror(InputFileHandle)) {
|
|
||||||
printf("Failed to read input [%s]\n", InputFile);
|
|
||||||
IsOk = BROTLI_FALSE;
|
|
||||||
goto Finish;
|
|
||||||
}
|
|
||||||
} else if (Result == BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT) {
|
|
||||||
OutSize = (size_t) (NextOut - Output);
|
|
||||||
if (OutSize > 0) {
|
|
||||||
fwrite(Output, 1, OutSize, OutputFileHandle);
|
|
||||||
if (ferror(OutputFileHandle)) {
|
|
||||||
printf("Failed to write output [%s]\n", OutputFile);
|
|
||||||
IsOk = BROTLI_FALSE;
|
|
||||||
goto Finish;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
AvailableOut = kFileBufferSize;
|
|
||||||
NextOut = Output;
|
|
||||||
} else if (Result == BROTLI_DECODER_RESULT_SUCCESS) {
|
|
||||||
OutSize = (size_t) (NextOut - Output);
|
|
||||||
if (OutSize > 0) {
|
|
||||||
fwrite(Output, 1, OutSize, OutputFileHandle);
|
|
||||||
if (ferror(OutputFileHandle)) {
|
|
||||||
printf("Failed to write output [%s]\n", OutputFile);
|
|
||||||
IsOk = BROTLI_FALSE;
|
|
||||||
goto Finish;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
AvailableOut = 0;
|
|
||||||
if (AvailableIn != 0 || HasMoreInput(InputFileHandle)) {
|
|
||||||
printf("Corrupt input [%s]\n", InputFile);
|
|
||||||
IsOk = BROTLI_FALSE;
|
|
||||||
goto Finish;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
printf("Corrupt input [%s]\n", InputFile);
|
|
||||||
IsOk = BROTLI_FALSE;
|
|
||||||
goto Finish;
|
|
||||||
}
|
|
||||||
if (!HasMoreInput(InputFileHandle) && Result == BROTLI_DECODER_RESULT_SUCCESS ) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
Result = BrotliDecoderDecompressStream(DecoderState, &AvailableIn, &NextIn, &AvailableOut, &NextOut, 0);
|
|
||||||
}
|
|
||||||
Finish:
|
|
||||||
if (DecoderState) {
|
|
||||||
BrotliDecoderDestroyInstance(DecoderState);
|
|
||||||
}
|
|
||||||
if (InputFileHandle) {
|
|
||||||
fclose(InputFileHandle);
|
|
||||||
}
|
|
||||||
if (OutputFileHandle) {
|
|
||||||
fclose(OutputFileHandle);
|
|
||||||
}
|
|
||||||
return IsOk;
|
|
||||||
}
|
|
||||||
|
|
||||||
int main(int argc, char** argv) {
|
|
||||||
BROTLI_BOOL CompressBool;
|
|
||||||
BROTLI_BOOL DecompressBool;
|
|
||||||
char *OutputFile;
|
|
||||||
char *InputFile;
|
|
||||||
char OutputTmpFile[_MAX_PATH];
|
|
||||||
FILE *OutputHandle;
|
|
||||||
int Quality;
|
|
||||||
int Gap;
|
|
||||||
int OutputFileLength;
|
|
||||||
int InputFileLength;
|
|
||||||
int Ret;
|
|
||||||
size_t InputFileSize;
|
|
||||||
uint8_t *Buffer;
|
|
||||||
uint8_t *InputBuffer;
|
|
||||||
uint8_t *OutputBuffer;
|
|
||||||
int64_t Size;
|
|
||||||
|
|
||||||
InputFile = NULL;
|
|
||||||
OutputFile = NULL;
|
|
||||||
CompressBool = BROTLI_FALSE;
|
|
||||||
DecompressBool = BROTLI_FALSE;
|
|
||||||
//
|
|
||||||
//Set default Quality and Gap
|
|
||||||
//
|
|
||||||
Quality = 9;
|
|
||||||
Gap = 1;
|
|
||||||
InputFileSize = 0;
|
|
||||||
Ret = 0;
|
|
||||||
|
|
||||||
if (argc < 2) {
|
|
||||||
Usage();
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
if (strcmp(argv[1], "-h") == 0 || strcmp (argv[1], "--help") == 0 ) {
|
|
||||||
Usage();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
if (strcmp(argv[1], "-v") == 0 || strcmp (argv[1], "--version") == 0 ) {
|
|
||||||
Version();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
while (argc > 1) {
|
|
||||||
if (strcmp(argv[1], "-e") == 0 || strcmp(argv[1], "--compress") == 0 ) {
|
|
||||||
CompressBool = BROTLI_TRUE;
|
|
||||||
if (DecompressBool) {
|
|
||||||
printf("Can't use -e/--compress with -d/--decompess on the same time\n");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
argc--;
|
|
||||||
argv++;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (strcmp(argv[1], "-d") == 0 || strcmp(argv[1], "--decompress") == 0 ) {
|
|
||||||
DecompressBool = BROTLI_TRUE;
|
|
||||||
if (CompressBool) {
|
|
||||||
printf("Can't use -e/--compress with -d/--decompess on the same time\n");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
argc--;
|
|
||||||
argv++;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (strcmp(argv[1], "-o") == 0 || strncmp(argv[1], "--output", 8) == 0) {
|
|
||||||
if (strcmp(argv[1], "-o") == 0) {
|
|
||||||
OutputFileLength = strlen(argv[2]);
|
|
||||||
if (OutputFileLength > _MAX_PATH) {
|
|
||||||
printf ("The file path %s is too long\n", argv[2]);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
OutputFile = argv[2];
|
|
||||||
if (OutputFile == NULL) {
|
|
||||||
fprintf(stderr, "Input file can't be null\n");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
argc--;
|
|
||||||
argv++;
|
|
||||||
} else {
|
|
||||||
OutputFileLength = strlen(argv[1] - 9);
|
|
||||||
OutputFile = (char *)argv[1] + 9;
|
|
||||||
}
|
|
||||||
argc--;
|
|
||||||
argv++;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (strcmp(argv[1], "-q") == 0 || strncmp(argv[1], "--quality", 9) == 0) {
|
|
||||||
if (strcmp(argv[1], "-q") == 0) {
|
|
||||||
Quality = strtol(argv[2], NULL, 16);
|
|
||||||
argc--;
|
|
||||||
argv++;
|
|
||||||
} else {
|
|
||||||
Quality = strtol((char *)argv[1] + 10, NULL, 16);
|
|
||||||
}
|
|
||||||
argc--;
|
|
||||||
argv++;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (strcmp(argv[1], "-g") == 0 || strncmp(argv[1], "--gap", 5) == 0) {
|
|
||||||
if (strcmp(argv[1], "-g") == 0) {
|
|
||||||
Gap = strtol(argv[2], NULL, 16);
|
|
||||||
argc--;
|
|
||||||
argv++;
|
|
||||||
} else {
|
|
||||||
Gap = strtol((char *)argv[1] + 6, NULL, 16);
|
|
||||||
}
|
|
||||||
argc--;
|
|
||||||
argv++;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (argc > 1) {
|
|
||||||
InputFileLength = strlen(argv[1]);
|
|
||||||
if (InputFileLength > _MAX_PATH - 1) {
|
|
||||||
printf ("The file path %s is too long\n", argv[2]);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
InputFile = argv[1];
|
|
||||||
if (InputFile == NULL) {
|
|
||||||
printf("Input file can't be null\n");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
argc--;
|
|
||||||
argv++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Buffer = (uint8_t*)malloc(kFileBufferSize * 2);
|
|
||||||
if (!Buffer) {
|
|
||||||
printf("Out of memory\n");
|
|
||||||
goto Finish;
|
|
||||||
}
|
|
||||||
memset(Buffer, 0, kFileBufferSize*2);
|
|
||||||
InputBuffer = Buffer;
|
|
||||||
OutputBuffer = Buffer + kFileBufferSize;
|
|
||||||
if (CompressBool) {
|
|
||||||
//
|
|
||||||
// Compress file
|
|
||||||
//
|
|
||||||
Ret = CompressFile(InputFile, InputBuffer, OutputFile, OutputBuffer, Quality, Gap);
|
|
||||||
if (!Ret) {
|
|
||||||
printf ("Failed to compress file [%s]\n", InputFile);
|
|
||||||
goto Finish;
|
|
||||||
}
|
|
||||||
//
|
|
||||||
// Decompress file for get Outputfile size
|
|
||||||
//
|
|
||||||
strcpy (OutputTmpFile, OutputFile);
|
|
||||||
if (strlen(InputFile) + strlen(".tmp") < _MAX_PATH) {
|
|
||||||
strcat(OutputTmpFile, ".tmp");
|
|
||||||
} else {
|
|
||||||
printf ("Output file path is too long[%s]\n", OutputFile);
|
|
||||||
Ret = BROTLI_FALSE;
|
|
||||||
goto Finish;
|
|
||||||
}
|
|
||||||
memset(Buffer, 0, kFileBufferSize*2);
|
|
||||||
Ret = DecompressFile(OutputFile, InputBuffer, OutputTmpFile, OutputBuffer, Quality, Gap);
|
|
||||||
if (!Ret) {
|
|
||||||
printf ("Failed to decompress file [%s]\n", OutputFile);
|
|
||||||
goto Finish;
|
|
||||||
}
|
|
||||||
remove (OutputTmpFile);
|
|
||||||
|
|
||||||
//
|
|
||||||
// fill decoder header
|
|
||||||
//
|
|
||||||
InputFileSize = FileSize(InputFile);
|
|
||||||
Size = (int64_t)InputFileSize;
|
|
||||||
OutputHandle = fopen(OutputFile, "rb+"); /* open output_path file and add in head info */
|
|
||||||
fwrite(&Size, 1, sizeof(int64_t), OutputHandle);
|
|
||||||
ScratchBufferSize += Gap * GAP_MEM_BLOCK; /* there is a memory gap between IA32 and X64 environment*/
|
|
||||||
ScratchBufferSize += kFileBufferSize * 2;
|
|
||||||
Size = (int64_t) ScratchBufferSize;
|
|
||||||
fwrite(&Size, 1, sizeof(int64_t), OutputHandle);
|
|
||||||
if (fclose(OutputHandle) != 0) {
|
|
||||||
printf("Failed to close output file [%s]\n", OutputFile);
|
|
||||||
Ret = BROTLI_FALSE;
|
|
||||||
goto Finish;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Ret = DecompressFile(InputFile, InputBuffer, OutputFile, OutputBuffer, Quality, Gap);
|
|
||||||
if (!Ret) {
|
|
||||||
printf ("Failed to decompress file [%s]\n", InputFile);
|
|
||||||
goto Finish;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Finish:
|
|
||||||
if (Buffer != NULL) {
|
|
||||||
free (Buffer);
|
|
||||||
}
|
|
||||||
return !Ret;
|
|
||||||
}
|
|
@@ -6,10 +6,10 @@
|
|||||||
#
|
#
|
||||||
MAKEROOT ?= ..
|
MAKEROOT ?= ..
|
||||||
|
|
||||||
APPNAME = BrotliCompress
|
APPNAME = Brotli
|
||||||
|
|
||||||
OBJECTS = \
|
OBJECTS = \
|
||||||
BrotliCompress.o \
|
brotli/c/tools/brotli.o \
|
||||||
brotli/c/common/dictionary.o \
|
brotli/c/common/dictionary.o \
|
||||||
brotli/c/common/transform.o \
|
brotli/c/common/transform.o \
|
||||||
brotli/c/dec/bit_reader.o \
|
brotli/c/dec/bit_reader.o \
|
||||||
|
@@ -9,7 +9,7 @@
|
|||||||
INC = -I .\brotli\c\include $(INC)
|
INC = -I .\brotli\c\include $(INC)
|
||||||
CFLAGS = $(CFLAGS) /W2
|
CFLAGS = $(CFLAGS) /W2
|
||||||
|
|
||||||
APPNAME = BrotliCompress
|
APPNAME = Brotli
|
||||||
|
|
||||||
#LIBS = $(LIB_PATH)\Common.lib
|
#LIBS = $(LIB_PATH)\Common.lib
|
||||||
|
|
||||||
@@ -40,7 +40,7 @@ ENC_OBJ = \
|
|||||||
brotli\c\enc\utf8_util.obj
|
brotli\c\enc\utf8_util.obj
|
||||||
|
|
||||||
OBJECTS = \
|
OBJECTS = \
|
||||||
BrotliCompress.obj \
|
brotli\c\tools\brotli.obj \
|
||||||
$(COMMON_OBJ) \
|
$(COMMON_OBJ) \
|
||||||
$(DEC_OBJ) \
|
$(DEC_OBJ) \
|
||||||
$(ENC_OBJ)
|
$(ENC_OBJ)
|
||||||
|
@@ -14,7 +14,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
|||||||
|
|
||||||
#define __FIELD_SIZE(TYPE, Field) (sizeof((TYPE *)0)->Field)
|
#define __FIELD_SIZE(TYPE, Field) (sizeof((TYPE *)0)->Field)
|
||||||
#define __ARRAY_ELEMENT_SIZE(TYPE, Field) (sizeof((TYPE *)0)->Field[0])
|
#define __ARRAY_ELEMENT_SIZE(TYPE, Field) (sizeof((TYPE *)0)->Field[0])
|
||||||
#define __OFFSET_OF(TYPE, Field) ((UINT32)(size_t) &(((TYPE *)0)->Field))
|
#define __OFFSET_OF(TYPE, Field) ((UINT32) &(((TYPE *)0)->Field))
|
||||||
#define __FLEXIBLE_SIZE(Size, TYPE, Field, MaxIndex) if (__FIELD_SIZE(TYPE, Field) == 0) Size = MAX((__OFFSET_OF(TYPE, Field) + __ARRAY_ELEMENT_SIZE(TYPE, Field) * (MaxIndex)), Size)
|
#define __FLEXIBLE_SIZE(Size, TYPE, Field, MaxIndex) if (__FIELD_SIZE(TYPE, Field) == 0) Size = MAX((__OFFSET_OF(TYPE, Field) + __ARRAY_ELEMENT_SIZE(TYPE, Field) * (MaxIndex)), Size)
|
||||||
#define __ARRAY_SIZE(Array) (sizeof(Array)/sizeof(Array[0]))
|
#define __ARRAY_SIZE(Array) (sizeof(Array)/sizeof(Array[0]))
|
||||||
|
|
||||||
|
@@ -127,7 +127,10 @@ PeCoffLoaderRelocateRiscVImage (
|
|||||||
{
|
{
|
||||||
UINT32 Value;
|
UINT32 Value;
|
||||||
UINT32 Value2;
|
UINT32 Value2;
|
||||||
|
UINT32 OrgValue;
|
||||||
|
|
||||||
|
OrgValue = *(UINT32 *) Fixup;
|
||||||
|
OrgValue = OrgValue;
|
||||||
switch ((*Reloc) >> 12) {
|
switch ((*Reloc) >> 12) {
|
||||||
case EFI_IMAGE_REL_BASED_RISCV_HI20:
|
case EFI_IMAGE_REL_BASED_RISCV_HI20:
|
||||||
RiscVHi20Fixup = (UINT32 *) Fixup;
|
RiscVHi20Fixup = (UINT32 *) Fixup;
|
||||||
|
@@ -26,9 +26,6 @@ ifndef HOST_ARCH
|
|||||||
else ifneq (,$(findstring arm,$(uname_m)))
|
else ifneq (,$(findstring arm,$(uname_m)))
|
||||||
HOST_ARCH=ARM
|
HOST_ARCH=ARM
|
||||||
endif
|
endif
|
||||||
ifneq (,$(findstring riscv64,$(uname_m)))
|
|
||||||
HOST_ARCH=RISCV64
|
|
||||||
endif
|
|
||||||
ifndef HOST_ARCH
|
ifndef HOST_ARCH
|
||||||
$(info Could not detected HOST_ARCH from uname results)
|
$(info Could not detected HOST_ARCH from uname results)
|
||||||
$(error HOST_ARCH is not defined!)
|
$(error HOST_ARCH is not defined!)
|
||||||
|
@@ -903,12 +903,7 @@ Returns:
|
|||||||
fprintf (FvMapFile, "BaseAddress=0x%010llx, ", (unsigned long long) (ImageBaseAddress + Offset));
|
fprintf (FvMapFile, "BaseAddress=0x%010llx, ", (unsigned long long) (ImageBaseAddress + Offset));
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf (FvMapFile, "EntryPoint=0x%010llx, ", (unsigned long long) (ImageBaseAddress + AddressOfEntryPoint));
|
fprintf (FvMapFile, "EntryPoint=0x%010llx", (unsigned long long) (ImageBaseAddress + AddressOfEntryPoint));
|
||||||
if (!pImageContext->IsTeImage) {
|
|
||||||
fprintf (FvMapFile, "Type=PE");
|
|
||||||
} else {
|
|
||||||
fprintf (FvMapFile, "Type=TE");
|
|
||||||
}
|
|
||||||
fprintf (FvMapFile, ")\n");
|
fprintf (FvMapFile, ")\n");
|
||||||
|
|
||||||
fprintf (FvMapFile, "(GUID=%s", FileGuidName);
|
fprintf (FvMapFile, "(GUID=%s", FileGuidName);
|
||||||
@@ -3145,7 +3140,6 @@ Returns:
|
|||||||
--*/
|
--*/
|
||||||
{
|
{
|
||||||
UINTN CurrentOffset;
|
UINTN CurrentOffset;
|
||||||
UINTN OrigOffset;
|
|
||||||
UINTN Index;
|
UINTN Index;
|
||||||
FILE *fpin;
|
FILE *fpin;
|
||||||
UINTN FfsFileSize;
|
UINTN FfsFileSize;
|
||||||
@@ -3154,10 +3148,8 @@ Returns:
|
|||||||
UINT32 FfsHeaderSize;
|
UINT32 FfsHeaderSize;
|
||||||
EFI_FFS_FILE_HEADER FfsHeader;
|
EFI_FFS_FILE_HEADER FfsHeader;
|
||||||
UINTN VtfFileSize;
|
UINTN VtfFileSize;
|
||||||
UINTN MaxPadFileSize;
|
|
||||||
|
|
||||||
FvExtendHeaderSize = 0;
|
FvExtendHeaderSize = 0;
|
||||||
MaxPadFileSize = 0;
|
|
||||||
VtfFileSize = 0;
|
VtfFileSize = 0;
|
||||||
fpin = NULL;
|
fpin = NULL;
|
||||||
Index = 0;
|
Index = 0;
|
||||||
@@ -3266,12 +3258,8 @@ Returns:
|
|||||||
//
|
//
|
||||||
// Only EFI_FFS_FILE_HEADER is needed for a pad section.
|
// 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 = (CurrentOffset + FfsHeaderSize + sizeof(EFI_FFS_FILE_HEADER) + FfsAlignment - 1) & ~(FfsAlignment - 1);
|
||||||
CurrentOffset -= FfsHeaderSize;
|
CurrentOffset -= FfsHeaderSize;
|
||||||
if ((CurrentOffset - OrigOffset) > MaxPadFileSize) {
|
|
||||||
MaxPadFileSize = CurrentOffset - OrigOffset;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3315,12 +3303,6 @@ Returns:
|
|||||||
//
|
//
|
||||||
mFvTotalSize = FvInfoPtr->Size;
|
mFvTotalSize = FvInfoPtr->Size;
|
||||||
mFvTakenSize = CurrentOffset;
|
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;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@@ -177,7 +177,7 @@ Returns:
|
|||||||
fprintf (stdout, " -l GuidHeaderLength, --HeaderLength GuidHeaderLength\n\
|
fprintf (stdout, " -l GuidHeaderLength, --HeaderLength GuidHeaderLength\n\
|
||||||
GuidHeaderLength is the size of header of guided data\n");
|
GuidHeaderLength is the size of header of guided data\n");
|
||||||
fprintf (stdout, " -r GuidAttr, --attributes GuidAttr\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\
|
PROCESSING_REQUIRED, AUTH_STATUS_VALID and NONE. \n\
|
||||||
if -r option is not given, default PROCESSING_REQUIRED\n");
|
if -r option is not given, default PROCESSING_REQUIRED\n");
|
||||||
fprintf (stdout, " -n String, --name String\n\
|
fprintf (stdout, " -n String, --name String\n\
|
||||||
|
@@ -57,16 +57,6 @@
|
|||||||
#define NULL ((VOID *) 0)
|
#define NULL ((VOID *) 0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __CC_ARM
|
|
||||||
//
|
|
||||||
// Older RVCT ARM compilers don't fully support #pragma pack and require __packed
|
|
||||||
// as a prefix for the structure.
|
|
||||||
//
|
|
||||||
#define PACKED __packed
|
|
||||||
#else
|
|
||||||
#define PACKED
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Support for variable length argument lists using the ANSI standard.
|
// Support for variable length argument lists using the ANSI standard.
|
||||||
//
|
//
|
||||||
|
@@ -1,85 +0,0 @@
|
|||||||
/** @file
|
|
||||||
Processor or Compiler specific defines and types for RISC-V.
|
|
||||||
|
|
||||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
|
||||||
|
|
||||||
**/
|
|
||||||
|
|
||||||
#ifndef __PROCESSOR_BIND_H__
|
|
||||||
#define __PROCESSOR_BIND_H__
|
|
||||||
|
|
||||||
//
|
|
||||||
// Define the processor type so other code can make processor based choices
|
|
||||||
//
|
|
||||||
#define MDE_CPU_RISCV64
|
|
||||||
|
|
||||||
//
|
|
||||||
// Make sure we are using the correct packing rules per EFI specification
|
|
||||||
//
|
|
||||||
#ifndef __GNUC__
|
|
||||||
#pragma pack()
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//
|
|
||||||
// Use ANSI C 2000 stdint.h integer width declarations
|
|
||||||
//
|
|
||||||
#include <stdint.h>
|
|
||||||
typedef uint8_t BOOLEAN;
|
|
||||||
typedef int8_t INT8;
|
|
||||||
typedef uint8_t UINT8;
|
|
||||||
typedef int16_t INT16;
|
|
||||||
typedef uint16_t UINT16;
|
|
||||||
typedef int32_t INT32;
|
|
||||||
typedef uint32_t UINT32;
|
|
||||||
typedef int64_t INT64;
|
|
||||||
typedef uint64_t UINT64;
|
|
||||||
typedef char CHAR8;
|
|
||||||
typedef uint16_t CHAR16;
|
|
||||||
|
|
||||||
//
|
|
||||||
// Unsigned value of native width. (4 bytes on supported 32-bit processor instructions,
|
|
||||||
// 8 bytes on supported 64-bit processor instructions)
|
|
||||||
//
|
|
||||||
typedef UINT64 UINTN;
|
|
||||||
|
|
||||||
//
|
|
||||||
// Signed value of native width. (4 bytes on supported 32-bit processor instructions,
|
|
||||||
// 8 bytes on supported 64-bit processor instructions)
|
|
||||||
//
|
|
||||||
typedef INT64 INTN;
|
|
||||||
|
|
||||||
//
|
|
||||||
// Processor specific defines
|
|
||||||
//
|
|
||||||
|
|
||||||
//
|
|
||||||
// A value of native width with the highest bit set.
|
|
||||||
//
|
|
||||||
#define MAX_BIT 0x8000000000000000
|
|
||||||
|
|
||||||
//
|
|
||||||
// A value of native width with the two highest bits set.
|
|
||||||
//
|
|
||||||
#define MAX_2_BITS 0xC000000000000000
|
|
||||||
|
|
||||||
//
|
|
||||||
// The stack alignment required for RISC-V
|
|
||||||
//
|
|
||||||
#define CPU_STACK_ALIGNMENT 16
|
|
||||||
|
|
||||||
//
|
|
||||||
// Modifier to ensure that all protocol member functions and EFI intrinsics
|
|
||||||
// use the correct C calling convention. All protocol member functions and
|
|
||||||
// EFI intrinsics are required to modify their member functions with EFIAPI.
|
|
||||||
//
|
|
||||||
#define EFIAPI
|
|
||||||
|
|
||||||
#if defined(__GNUC__)
|
|
||||||
//
|
|
||||||
// For GNU assembly code, .global or .globl can declare global symbols.
|
|
||||||
// Define this macro to unify the usage.
|
|
||||||
//
|
|
||||||
#define ASM_GLOBAL .globl
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
|
@@ -45,10 +45,7 @@ def RunCommand(WorkDir=None, *Args, **kwargs):
|
|||||||
|
|
||||||
output_lock.acquire(True)
|
output_lock.acquire(True)
|
||||||
print("execute command \"{0}\" in directory {1}".format(" ".join(Args), WorkDir))
|
print("execute command \"{0}\" in directory {1}".format(" ".join(Args), WorkDir))
|
||||||
try:
|
|
||||||
print(message)
|
print(message)
|
||||||
except:
|
|
||||||
pass
|
|
||||||
output_lock.release()
|
output_lock.release()
|
||||||
|
|
||||||
return p.returncode, stdout
|
return p.returncode, stdout
|
||||||
|
@@ -28,9 +28,6 @@ ifndef HOST_ARCH
|
|||||||
else ifneq (,$(findstring arm,$(uname_m)))
|
else ifneq (,$(findstring arm,$(uname_m)))
|
||||||
HOST_ARCH=ARM
|
HOST_ARCH=ARM
|
||||||
endif
|
endif
|
||||||
ifneq (,$(findstring riscv64,$(uname_m)))
|
|
||||||
HOST_ARCH=RISCV64
|
|
||||||
endif
|
|
||||||
ifndef HOST_ARCH
|
ifndef HOST_ARCH
|
||||||
$(info Could not detected HOST_ARCH from uname results)
|
$(info Could not detected HOST_ARCH from uname results)
|
||||||
$(error HOST_ARCH is not defined!)
|
$(error HOST_ARCH is not defined!)
|
||||||
@@ -41,19 +38,12 @@ endif
|
|||||||
CYGWIN:=$(findstring CYGWIN, $(shell uname -s))
|
CYGWIN:=$(findstring CYGWIN, $(shell uname -s))
|
||||||
LINUX:=$(findstring Linux, $(shell uname -s))
|
LINUX:=$(findstring Linux, $(shell uname -s))
|
||||||
DARWIN:=$(findstring Darwin, $(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_CC ?= gcc
|
||||||
BUILD_CXX ?= g++
|
BUILD_CXX ?= g++
|
||||||
BUILD_AS ?= gcc
|
BUILD_AS ?= gcc
|
||||||
BUILD_AR ?= ar
|
BUILD_AR ?= ar
|
||||||
BUILD_LD ?= ld
|
BUILD_LD ?= ld
|
||||||
endif
|
|
||||||
LINKER ?= $(BUILD_CC)
|
LINKER ?= $(BUILD_CC)
|
||||||
ifeq ($(HOST_ARCH), IA32)
|
ifeq ($(HOST_ARCH), IA32)
|
||||||
ARCH_INCLUDE = -I $(MAKEROOT)/Include/Ia32/
|
ARCH_INCLUDE = -I $(MAKEROOT)/Include/Ia32/
|
||||||
@@ -67,9 +57,6 @@ ARCH_INCLUDE = -I $(MAKEROOT)/Include/Arm/
|
|||||||
else ifeq ($(HOST_ARCH), AARCH64)
|
else ifeq ($(HOST_ARCH), AARCH64)
|
||||||
ARCH_INCLUDE = -I $(MAKEROOT)/Include/AArch64/
|
ARCH_INCLUDE = -I $(MAKEROOT)/Include/AArch64/
|
||||||
|
|
||||||
else ifeq ($(HOST_ARCH), RISCV64)
|
|
||||||
ARCH_INCLUDE = -I $(MAKEROOT)/Include/RiscV64/
|
|
||||||
|
|
||||||
else
|
else
|
||||||
$(error Bad HOST_ARCH)
|
$(error Bad HOST_ARCH)
|
||||||
endif
|
endif
|
||||||
@@ -85,25 +72,14 @@ ifeq ($(DARWIN),Darwin)
|
|||||||
BUILD_CFLAGS = -MD -fshort-wchar -fno-strict-aliasing -Wall -Werror \
|
BUILD_CFLAGS = -MD -fshort-wchar -fno-strict-aliasing -Wall -Werror \
|
||||||
-Wno-deprecated-declarations -Wno-self-assign -Wno-unused-result -nostdlib -g
|
-Wno-deprecated-declarations -Wno-self-assign -Wno-unused-result -nostdlib -g
|
||||||
else
|
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 \
|
BUILD_CFLAGS = -MD -fshort-wchar -fno-strict-aliasing -fwrapv \
|
||||||
-fno-delete-null-pointer-checks -Wall -Werror \
|
-fno-delete-null-pointer-checks -Wall -Werror \
|
||||||
-Wno-deprecated-declarations -Wno-stringop-truncation -Wno-restrict \
|
-Wno-deprecated-declarations -Wno-stringop-truncation -Wno-restrict \
|
||||||
-Wno-unused-result -nostdlib -g
|
-Wno-unused-result -nostdlib -g
|
||||||
endif
|
endif
|
||||||
endif
|
|
||||||
ifeq ($(CXX), llvm)
|
|
||||||
BUILD_LFLAGS =
|
|
||||||
BUILD_CXXFLAGS = -Wno-deprecated-register -Wno-unused-result
|
|
||||||
else
|
|
||||||
BUILD_LFLAGS =
|
BUILD_LFLAGS =
|
||||||
BUILD_CXXFLAGS = -Wno-unused-result
|
BUILD_CXXFLAGS = -Wno-unused-result
|
||||||
endif
|
|
||||||
ifeq ($(HOST_ARCH), IA32)
|
ifeq ($(HOST_ARCH), IA32)
|
||||||
#
|
#
|
||||||
# Snow Leopard is a 32-bit and 64-bit environment. uname -m returns i386, but gcc defaults
|
# Snow Leopard is a 32-bit and 64-bit environment. uname -m returns i386, but gcc defaults
|
||||||
|
@@ -55,7 +55,7 @@ AR = lib.exe
|
|||||||
LD = link.exe
|
LD = link.exe
|
||||||
LINKER = $(LD)
|
LINKER = $(LD)
|
||||||
|
|
||||||
INC = $(INC) -I . -I $(SOURCE_PATH)\Include -I $(ARCH_INCLUDE) -I $(SOURCE_PATH)\Common
|
INC = -I . -I $(SOURCE_PATH)\Include -I $(ARCH_INCLUDE) -I $(SOURCE_PATH)\Common $(INC)
|
||||||
|
|
||||||
CFLAGS = $(CFLAGS) /nologo /Zi /c /O2 /MT /W4 /WX /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE
|
CFLAGS = $(CFLAGS) /nologo /Zi /c /O2 /MT /W4 /WX /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE
|
||||||
CPPFLAGS = $(CPPFLAGS) /EHsc /nologo /Zi /c /O2 /MT /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE
|
CPPFLAGS = $(CPPFLAGS) /EHsc /nologo /Zi /c /O2 /MT /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE
|
||||||
|
@@ -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 = 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 \
|
OBJECTS = AParser.o DLexerBase.o ATokenBuffer.o EfiVfrParser.o VfrLexer.o VfrSyntax.o \
|
||||||
VfrFormPkg.o VfrError.o VfrUtilityLib.o VfrCompiler.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)
|
VFR_CPPFLAGS = -DPCCTS_USE_NAMESPACE_STD $(BUILD_CPPFLAGS)
|
||||||
endif
|
|
||||||
# keep BUILD_OPTFLAGS last
|
# keep BUILD_OPTFLAGS last
|
||||||
VFR_CXXFLAGS = $(BUILD_OPTFLAGS)
|
VFR_CXXFLAGS = $(BUILD_OPTFLAGS)
|
||||||
|
|
||||||
|
@@ -164,11 +164,7 @@ PCCTS_H=../h
|
|||||||
#
|
#
|
||||||
# UNIX (default)
|
# UNIX (default)
|
||||||
#
|
#
|
||||||
ifeq ($(CXX), llvm)
|
|
||||||
BUILD_CC?=$(CLANG_BIN)clang
|
|
||||||
else
|
|
||||||
BUILD_CC?=gcc
|
BUILD_CC?=gcc
|
||||||
endif
|
|
||||||
COPT=-O
|
COPT=-O
|
||||||
ANTLR=${BIN_DIR}/antlr
|
ANTLR=${BIN_DIR}/antlr
|
||||||
DLG=${BIN_DIR}/dlg
|
DLG=${BIN_DIR}/dlg
|
||||||
|
@@ -114,11 +114,7 @@ PCCTS_H=../h
|
|||||||
#
|
#
|
||||||
# UNIX
|
# UNIX
|
||||||
#
|
#
|
||||||
ifeq ($(CXX), llvm)
|
|
||||||
BUILD_CC?=$(CLANG_BIN)clang
|
|
||||||
else
|
|
||||||
BUILD_CC?=cc
|
BUILD_CC?=cc
|
||||||
endif
|
|
||||||
COPT=-O
|
COPT=-O
|
||||||
ANTLR=${BIN_DIR}/antlr
|
ANTLR=${BIN_DIR}/antlr
|
||||||
DLG=${BIN_DIR}/dlg
|
DLG=${BIN_DIR}/dlg
|
||||||
|
@@ -192,7 +192,6 @@ VfrParserStart (
|
|||||||
#token LateCheckFlag("LATE_CHECK") "LATE_CHECK"
|
#token LateCheckFlag("LATE_CHECK") "LATE_CHECK"
|
||||||
#token ReadOnlyFlag("READ_ONLY") "READ_ONLY"
|
#token ReadOnlyFlag("READ_ONLY") "READ_ONLY"
|
||||||
#token OptionOnlyFlag("OPTIONS_ONLY") "OPTIONS_ONLY"
|
#token OptionOnlyFlag("OPTIONS_ONLY") "OPTIONS_ONLY"
|
||||||
#token RestStyleFlag("REST_STYLE") "REST_STYLE"
|
|
||||||
#token Class("class") "class"
|
#token Class("class") "class"
|
||||||
#token Subclass("subclass") "subclass"
|
#token Subclass("subclass") "subclass"
|
||||||
#token ClassGuid("classguid") "classguid"
|
#token ClassGuid("classguid") "classguid"
|
||||||
@@ -585,7 +584,7 @@ vfrFormSetDefinition :
|
|||||||
<<
|
<<
|
||||||
EFI_GUID Guid;
|
EFI_GUID Guid;
|
||||||
EFI_GUID DefaultClassGuid = EFI_HII_PLATFORM_SETUP_FORMSET_GUID;
|
EFI_GUID DefaultClassGuid = EFI_HII_PLATFORM_SETUP_FORMSET_GUID;
|
||||||
EFI_GUID ClassGuid1, ClassGuid2, ClassGuid3, ClassGuid4;
|
EFI_GUID ClassGuid1, ClassGuid2, ClassGuid3;
|
||||||
UINT8 ClassGuidNum = 0;
|
UINT8 ClassGuidNum = 0;
|
||||||
CIfrFormSet *FSObj = NULL;
|
CIfrFormSet *FSObj = NULL;
|
||||||
UINT16 C, SC;
|
UINT16 C, SC;
|
||||||
@@ -601,16 +600,13 @@ vfrFormSetDefinition :
|
|||||||
"\|" guidDefinition[ClassGuid2] << ++ClassGuidNum; >>
|
"\|" guidDefinition[ClassGuid2] << ++ClassGuidNum; >>
|
||||||
{
|
{
|
||||||
"\|" guidDefinition[ClassGuid3] << ++ClassGuidNum; >>
|
"\|" guidDefinition[ClassGuid3] << ++ClassGuidNum; >>
|
||||||
{
|
|
||||||
"\|" guidDefinition[ClassGuid4] << ++ClassGuidNum; >>
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
","
|
","
|
||||||
}
|
}
|
||||||
<<
|
<<
|
||||||
if (mOverrideClassGuid != NULL && ClassGuidNum >= 4) {
|
if (mOverrideClassGuid != NULL && ClassGuidNum >= 3) {
|
||||||
_PCATCH (VFR_RETURN_INVALID_PARAMETER, L->getLine(), "Already has 4 class guids, can't add extra class guid!");
|
_PCATCH (VFR_RETURN_INVALID_PARAMETER, L->getLine(), "Already has 3 class guids, can't add extra class guid!");
|
||||||
}
|
}
|
||||||
switch (ClassGuidNum) {
|
switch (ClassGuidNum) {
|
||||||
case 0:
|
case 0:
|
||||||
@@ -647,23 +643,10 @@ vfrFormSetDefinition :
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
if (mOverrideClassGuid != NULL) {
|
|
||||||
ClassGuidNum ++;
|
|
||||||
}
|
|
||||||
FSObj = new CIfrFormSet(sizeof(EFI_IFR_FORM_SET) + ClassGuidNum * sizeof(EFI_GUID));
|
FSObj = new CIfrFormSet(sizeof(EFI_IFR_FORM_SET) + ClassGuidNum * sizeof(EFI_GUID));
|
||||||
FSObj->SetClassGuid(&ClassGuid1);
|
FSObj->SetClassGuid(&ClassGuid1);
|
||||||
FSObj->SetClassGuid(&ClassGuid2);
|
FSObj->SetClassGuid(&ClassGuid2);
|
||||||
FSObj->SetClassGuid(&ClassGuid3);
|
FSObj->SetClassGuid(&ClassGuid3);
|
||||||
if (mOverrideClassGuid != NULL) {
|
|
||||||
FSObj->SetClassGuid(mOverrideClassGuid);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
FSObj = new CIfrFormSet(sizeof(EFI_IFR_FORM_SET) + ClassGuidNum * sizeof(EFI_GUID));
|
|
||||||
FSObj->SetClassGuid(&ClassGuid1);
|
|
||||||
FSObj->SetClassGuid(&ClassGuid2);
|
|
||||||
FSObj->SetClassGuid(&ClassGuid3);
|
|
||||||
FSObj->SetClassGuid(&ClassGuid4);
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@@ -1338,7 +1321,6 @@ questionheaderFlagsField[UINT8 & Flags] :
|
|||||||
ReadOnlyFlag << $Flags |= 0x01; >>
|
ReadOnlyFlag << $Flags |= 0x01; >>
|
||||||
| InteractiveFlag << $Flags |= 0x04; >>
|
| InteractiveFlag << $Flags |= 0x04; >>
|
||||||
| ResetRequiredFlag << $Flags |= 0x10; >>
|
| ResetRequiredFlag << $Flags |= 0x10; >>
|
||||||
| RestStyleFlag << $Flags |= 0x20; >>
|
|
||||||
| ReconnectRequiredFlag << $Flags |= 0x40; >>
|
| ReconnectRequiredFlag << $Flags |= 0x40; >>
|
||||||
| O:OptionOnlyFlag <<
|
| O:OptionOnlyFlag <<
|
||||||
gCVfrErrorHandle.HandleWarning (
|
gCVfrErrorHandle.HandleWarning (
|
||||||
@@ -3784,7 +3766,6 @@ oneofoptionFlagsField [UINT8 & HFlags, UINT8 & LFlags] :
|
|||||||
| "OPTION_DEFAULT_MFG" << $LFlags |= 0x20; >>
|
| "OPTION_DEFAULT_MFG" << $LFlags |= 0x20; >>
|
||||||
| InteractiveFlag << $HFlags |= 0x04; >>
|
| InteractiveFlag << $HFlags |= 0x04; >>
|
||||||
| ResetRequiredFlag << $HFlags |= 0x10; >>
|
| ResetRequiredFlag << $HFlags |= 0x10; >>
|
||||||
| RestStyleFlag << $HFlags |= 0x20; >>
|
|
||||||
| ReconnectRequiredFlag << $HFlags |= 0x40; >>
|
| ReconnectRequiredFlag << $HFlags |= 0x40; >>
|
||||||
| ManufacturingFlag << $LFlags |= 0x20; >>
|
| ManufacturingFlag << $LFlags |= 0x20; >>
|
||||||
| DefaultFlag << $LFlags |= 0x10; >>
|
| DefaultFlag << $LFlags |= 0x10; >>
|
||||||
|
@@ -1077,7 +1077,7 @@ Returns:
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (VolumeHeader.FvLength != Size) {
|
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;
|
return EFI_ABORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
## @file
|
## @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.
|
# C array.
|
||||||
# By default, "Tables\Dsdt.aml" will generate "Tables\Dsdt.c".
|
# By default, "Tables\Dsdt.aml" will generate "Tables\Dsdt.hex".
|
||||||
# "Tables\Dsdt.c" will contain a C array named "dsdt_aml_code" that contains
|
# "Tables\Dsdt.hex" will contain a C array named "dsdt_aml_code" that contains
|
||||||
# the AML bytecode.
|
# the AML bytecode.
|
||||||
#
|
#
|
||||||
# Copyright (c) 2020, ARM Limited. All rights reserved.<BR>
|
# Copyright (c) 2020, ARM Limited. All rights reserved.<BR>
|
||||||
@@ -17,26 +17,31 @@ from Common.BuildToolError import *
|
|||||||
import sys
|
import sys
|
||||||
import os
|
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.
|
## Parse the command line arguments.
|
||||||
#
|
#
|
||||||
# @retval A argparse.NameSpace instance, containing parsed values.
|
# @retval A argparse.NameSpace instance, containing parsed values.
|
||||||
#
|
#
|
||||||
def ParseArgs():
|
def ParseArgs():
|
||||||
# Initialize the parser.
|
# 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.
|
# Define the possible arguments.
|
||||||
Parser.add_argument(dest="InputFile",
|
Parser.add_argument(
|
||||||
help="Path to an input AML file to generate a .c file from.")
|
dest="InputFile",
|
||||||
Parser.add_argument("-o", "--out-dir", dest="OutDir",
|
help="Path to an input AML file to generate a .hex file from."
|
||||||
help="Output directory where the .c file will be generated. Default is the input file's directory.")
|
)
|
||||||
|
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.
|
# Parse the input arguments.
|
||||||
Args = Parser.parse_args()
|
Args = Parser.parse_args()
|
||||||
@@ -50,7 +55,9 @@ def ParseArgs():
|
|||||||
with open(Args.InputFile, "rb") as fIn:
|
with open(Args.InputFile, "rb") as fIn:
|
||||||
Signature = str(fIn.read(4))
|
Signature = str(fIn.read(4))
|
||||||
if ("DSDT" not in Signature) and ("SSDT" not in Signature):
|
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
|
return None
|
||||||
|
|
||||||
# Get the basename of the input file.
|
# 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 no output directory is specified, output to the input directory.
|
||||||
if not Args.OutDir:
|
if not Args.OutDir:
|
||||||
Args.OutputFile = os.path.join(os.path.dirname(Args.InputFile),
|
Args.OutputFile = os.path.join(
|
||||||
BaseName + ".c")
|
os.path.dirname(Args.InputFile),
|
||||||
|
BaseName + ".hex"
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
if not os.path.exists(Args.OutDir):
|
if not os.path.exists(Args.OutDir):
|
||||||
os.mkdir(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
|
Args.BaseName = BaseName
|
||||||
|
|
||||||
return Args
|
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.
|
# in a C array.
|
||||||
#
|
#
|
||||||
# @param InputFile Path to the input AML file.
|
# @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.
|
# @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"
|
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:
|
with open(InputFile, "rb") as fIn, open(OutputFile, "w") as fOut:
|
||||||
# Write header.
|
# 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.
|
# Write the array and its content.
|
||||||
fOut.write("unsigned char {}[] = {{\n ".format(ArrayName))
|
fOut.write("unsigned char {}[] = {{\n ".format(ArrayName))
|
||||||
@@ -105,12 +115,15 @@ def AmlToC(InputFile, OutputFile, BaseName):
|
|||||||
byte = fIn.read(1)
|
byte = fIn.read(1)
|
||||||
fOut.write("\n};\n")
|
fOut.write("\n};\n")
|
||||||
|
|
||||||
|
# Write footer.
|
||||||
|
fOut.write("#endif // {}\n".format(MacroName))
|
||||||
|
|
||||||
## Main method
|
## Main method
|
||||||
#
|
#
|
||||||
# This method:
|
# This method:
|
||||||
# 1- Initialize an EdkLogger instance.
|
# 1- Initialize an EdkLogger instance.
|
||||||
# 2- Parses the input arguments.
|
# 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.
|
# in a C array.
|
||||||
#
|
#
|
||||||
# @retval 0 Success.
|
# @retval 0 Success.
|
||||||
@@ -126,9 +139,10 @@ def Main():
|
|||||||
if not CommandArguments:
|
if not CommandArguments:
|
||||||
return 1
|
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.
|
# in a C array.
|
||||||
AmlToC(CommandArguments.InputFile, CommandArguments.OutputFile, CommandArguments.BaseName)
|
AmlToHex(CommandArguments.InputFile, CommandArguments.OutputFile,
|
||||||
|
CommandArguments.BaseName)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(e)
|
print(e)
|
||||||
return 1
|
return 1
|
@@ -24,7 +24,6 @@ import traceback
|
|||||||
import sys
|
import sys
|
||||||
from AutoGen.DataPipe import MemoryDataPipe
|
from AutoGen.DataPipe import MemoryDataPipe
|
||||||
import logging
|
import logging
|
||||||
import time
|
|
||||||
|
|
||||||
def clearQ(q):
|
def clearQ(q):
|
||||||
try:
|
try:
|
||||||
@@ -112,11 +111,7 @@ class AutoGenManager(threading.Thread):
|
|||||||
break
|
break
|
||||||
if badnews == "Done":
|
if badnews == "Done":
|
||||||
fin_num += 1
|
fin_num += 1
|
||||||
elif badnews == "QueueEmpty":
|
|
||||||
EdkLogger.debug(EdkLogger.DEBUG_9, "Worker %s: %s" % (os.getpid(), badnews))
|
|
||||||
self.TerminateWorkers()
|
|
||||||
else:
|
else:
|
||||||
EdkLogger.debug(EdkLogger.DEBUG_9, "Worker %s: %s" % (os.getpid(), badnews))
|
|
||||||
self.Status = False
|
self.Status = False
|
||||||
self.TerminateWorkers()
|
self.TerminateWorkers()
|
||||||
if fin_num == len(self.autogen_workers):
|
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"),
|
PlatformMetaFile = self.GetPlatformMetaFile(self.data_pipe.Get("P_Info").get("ActivePlatform"),
|
||||||
self.data_pipe.Get("P_Info").get("WorkspaceDir"))
|
self.data_pipe.Get("P_Info").get("WorkspaceDir"))
|
||||||
while True:
|
while True:
|
||||||
|
if self.module_queue.empty():
|
||||||
|
break
|
||||||
if self.error_event.is_set():
|
if self.error_event.is_set():
|
||||||
break
|
break
|
||||||
module_count += 1
|
module_count += 1
|
||||||
try:
|
|
||||||
module_file,module_root,module_path,module_basename,module_originalpath,module_arch,IsLib = self.module_queue.get_nowait()
|
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
|
|
||||||
|
|
||||||
modulefullpath = os.path.join(module_root,module_file)
|
modulefullpath = os.path.join(module_root,module_file)
|
||||||
taskname = " : ".join((modulefullpath,module_arch))
|
taskname = " : ".join((modulefullpath,module_arch))
|
||||||
module_metafile = PathClass(module_file,module_root)
|
module_metafile = PathClass(module_file,module_root)
|
||||||
@@ -280,7 +266,7 @@ class AutoGenWorkerInProcess(mp.Process):
|
|||||||
|
|
||||||
Ma.CreateCodeFile(False)
|
Ma.CreateCodeFile(False)
|
||||||
Ma.CreateMakeFile(False,GenFfsList=FfsCmd.get((Ma.MetaFile.Path, Ma.Arch),[]))
|
Ma.CreateMakeFile(False,GenFfsList=FfsCmd.get((Ma.MetaFile.Path, Ma.Arch),[]))
|
||||||
Ma.CreateAsBuiltInf()
|
|
||||||
if GlobalData.gBinCacheSource and CommandTarget in [None, "", "all"]:
|
if GlobalData.gBinCacheSource and CommandTarget in [None, "", "all"]:
|
||||||
try:
|
try:
|
||||||
CacheResult = Ma.CanSkipbyMakeCache()
|
CacheResult = Ma.CanSkipbyMakeCache()
|
||||||
@@ -294,11 +280,11 @@ class AutoGenWorkerInProcess(mp.Process):
|
|||||||
else:
|
else:
|
||||||
self.cache_q.put((Ma.MetaFile.Path, Ma.Arch, "MakeCache", False))
|
self.cache_q.put((Ma.MetaFile.Path, Ma.Arch, "MakeCache", False))
|
||||||
|
|
||||||
except Exception as e:
|
except Empty:
|
||||||
EdkLogger.debug(EdkLogger.DEBUG_9, "Worker %s: %s" % (os.getpid(), str(e)))
|
pass
|
||||||
|
except:
|
||||||
self.feedback_q.put(taskname)
|
self.feedback_q.put(taskname)
|
||||||
finally:
|
finally:
|
||||||
EdkLogger.debug(EdkLogger.DEBUG_9, "Worker %s: %s" % (os.getpid(), "Done"))
|
|
||||||
self.feedback_q.put("Done")
|
self.feedback_q.put("Done")
|
||||||
self.cache_q.put("CacheDone")
|
self.cache_q.put("CacheDone")
|
||||||
|
|
||||||
|
@@ -172,7 +172,7 @@ class FileBuildRule:
|
|||||||
def __str__(self):
|
def __str__(self):
|
||||||
SourceString = ""
|
SourceString = ""
|
||||||
SourceString += " %s %s %s" % (self.SourceFileType, " ".join(self.SourceFileExtList), self.ExtraSourceFileList)
|
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)
|
CommandString = "\n\t".join(self.CommandList)
|
||||||
return "%s : %s\n\t%s" % (DestString, SourceString, CommandString)
|
return "%s : %s\n\t%s" % (DestString, SourceString, CommandString)
|
||||||
|
|
||||||
|
@@ -72,10 +72,9 @@ class MemoryDataPipe(DataPipe):
|
|||||||
#Platform Module Pcds
|
#Platform Module Pcds
|
||||||
ModulePcds = {}
|
ModulePcds = {}
|
||||||
for m in PlatformInfo.Platform.Modules:
|
for m in PlatformInfo.Platform.Modules:
|
||||||
module = PlatformInfo.Platform.Modules[m]
|
m_pcds = PlatformInfo.Platform.Modules[m].Pcds
|
||||||
m_pcds = module.Pcds
|
|
||||||
if m_pcds:
|
if m_pcds:
|
||||||
ModulePcds[module.Guid] = [PCD_DATA(
|
ModulePcds[(m.File,m.Root,m.Arch)] = [PCD_DATA(
|
||||||
pcd.TokenCName,pcd.TokenSpaceGuidCName,pcd.Type,
|
pcd.TokenCName,pcd.TokenSpaceGuidCName,pcd.Type,
|
||||||
pcd.DatumType,pcd.SkuInfoList,pcd.DefaultValue,
|
pcd.DatumType,pcd.SkuInfoList,pcd.DefaultValue,
|
||||||
pcd.MaxDatumSize,pcd.UserDefinedDefaultStoresFlag,pcd.validateranges,
|
pcd.MaxDatumSize,pcd.UserDefinedDefaultStoresFlag,pcd.validateranges,
|
||||||
|
@@ -1980,14 +1980,12 @@ def CreateHeaderCode(Info, AutoGenC, AutoGenH):
|
|||||||
AutoGenH.Append("#include <Library/PcdLib.h>\n")
|
AutoGenH.Append("#include <Library/PcdLib.h>\n")
|
||||||
|
|
||||||
AutoGenH.Append('\nextern GUID gEfiCallerIdGuid;')
|
AutoGenH.Append('\nextern GUID gEfiCallerIdGuid;')
|
||||||
AutoGenH.Append('\nextern GUID gEdkiiDscPlatformGuid;')
|
|
||||||
AutoGenH.Append('\nextern CHAR8 *gEfiCallerBaseName;\n\n')
|
AutoGenH.Append('\nextern CHAR8 *gEfiCallerBaseName;\n\n')
|
||||||
|
|
||||||
if Info.IsLibrary:
|
if Info.IsLibrary:
|
||||||
return
|
return
|
||||||
|
|
||||||
AutoGenH.Append("#define EFI_CALLER_ID_GUID \\\n %s\n" % GuidStringToGuidStructureString(Info.Guid))
|
AutoGenH.Append("#define EFI_CALLER_ID_GUID \\\n %s\n" % GuidStringToGuidStructureString(Info.Guid))
|
||||||
AutoGenH.Append("#define EDKII_DSC_PLATFORM_GUID \\\n %s\n" % GuidStringToGuidStructureString(Info.PlatformInfo.Guid))
|
|
||||||
|
|
||||||
if Info.IsLibrary:
|
if Info.IsLibrary:
|
||||||
return
|
return
|
||||||
@@ -2004,7 +2002,6 @@ def CreateHeaderCode(Info, AutoGenC, AutoGenH):
|
|||||||
# Publish the CallerId Guid
|
# Publish the CallerId Guid
|
||||||
#
|
#
|
||||||
AutoGenC.Append('\nGLOBAL_REMOVE_IF_UNREFERENCED GUID gEfiCallerIdGuid = %s;\n' % GuidStringToGuidStructureString(Info.Guid))
|
AutoGenC.Append('\nGLOBAL_REMOVE_IF_UNREFERENCED GUID gEfiCallerIdGuid = %s;\n' % GuidStringToGuidStructureString(Info.Guid))
|
||||||
AutoGenC.Append('\nGLOBAL_REMOVE_IF_UNREFERENCED GUID gEdkiiDscPlatformGuid = %s;\n' % GuidStringToGuidStructureString(Info.PlatformInfo.Guid))
|
|
||||||
AutoGenC.Append('\nGLOBAL_REMOVE_IF_UNREFERENCED CHAR8 *gEfiCallerBaseName = "%s";\n' % Info.Name)
|
AutoGenC.Append('\nGLOBAL_REMOVE_IF_UNREFERENCED CHAR8 *gEfiCallerBaseName = "%s";\n' % Info.Name)
|
||||||
|
|
||||||
## Create common code for header file
|
## Create common code for header file
|
||||||
|
@@ -576,7 +576,7 @@ cleanlib:
|
|||||||
EdkLogger.error("build", AUTOGEN_ERROR, "Nothing to build",
|
EdkLogger.error("build", AUTOGEN_ERROR, "Nothing to build",
|
||||||
ExtraData="[%s]" % str(MyAgo))
|
ExtraData="[%s]" % str(MyAgo))
|
||||||
|
|
||||||
self.ProcessBuildTargetList(MyAgo.OutputDir, ToolsDef)
|
self.ProcessBuildTargetList()
|
||||||
self.ParserGenerateFfsCmd()
|
self.ParserGenerateFfsCmd()
|
||||||
|
|
||||||
# Generate macros used to represent input files
|
# Generate macros used to represent input files
|
||||||
@@ -786,10 +786,8 @@ cleanlib:
|
|||||||
|
|
||||||
def ReplaceMacro(self, str):
|
def ReplaceMacro(self, str):
|
||||||
for Macro in self.MacroList:
|
for Macro in self.MacroList:
|
||||||
if self._AutoGenObject.Macros[Macro] and os.path.normcase(self._AutoGenObject.Macros[Macro]) in os.path.normcase(str):
|
if self._AutoGenObject.Macros[Macro] and self._AutoGenObject.Macros[Macro] in str:
|
||||||
replace_dir = str[os.path.normcase(str).index(os.path.normcase(self._AutoGenObject.Macros[Macro])): os.path.normcase(str).index(
|
str = str.replace(self._AutoGenObject.Macros[Macro], '$(' + Macro + ')')
|
||||||
os.path.normcase(self._AutoGenObject.Macros[Macro])) + len(self._AutoGenObject.Macros[Macro])]
|
|
||||||
str = str.replace(replace_dir, '$(' + Macro + ')')
|
|
||||||
return str
|
return str
|
||||||
|
|
||||||
def CommandExceedLimit(self):
|
def CommandExceedLimit(self):
|
||||||
@@ -903,7 +901,7 @@ cleanlib:
|
|||||||
BuildTargets[Target].Commands[i] = SingleCommand.replace('$(INC)', '').replace(FlagDict[Flag]['Macro'], RespMacro)
|
BuildTargets[Target].Commands[i] = SingleCommand.replace('$(INC)', '').replace(FlagDict[Flag]['Macro'], RespMacro)
|
||||||
return RespDict
|
return RespDict
|
||||||
|
|
||||||
def ProcessBuildTargetList(self, RespFile, ToolsDef):
|
def ProcessBuildTargetList(self):
|
||||||
#
|
#
|
||||||
# Search dependency file list for each source file
|
# Search dependency file list for each source file
|
||||||
#
|
#
|
||||||
@@ -1004,7 +1002,6 @@ cleanlib:
|
|||||||
self.ObjTargetDict[T.Target.SubDir] = set()
|
self.ObjTargetDict[T.Target.SubDir] = set()
|
||||||
self.ObjTargetDict[T.Target.SubDir].add(NewFile)
|
self.ObjTargetDict[T.Target.SubDir].add(NewFile)
|
||||||
for Type in self._AutoGenObject.Targets:
|
for Type in self._AutoGenObject.Targets:
|
||||||
resp_file_number = 0
|
|
||||||
for T in self._AutoGenObject.Targets[Type]:
|
for T in self._AutoGenObject.Targets[Type]:
|
||||||
# Generate related macros if needed
|
# Generate related macros if needed
|
||||||
if T.GenFileListMacro and T.FileListMacro not in self.FileListMacros:
|
if T.GenFileListMacro and T.FileListMacro not in self.FileListMacros:
|
||||||
@@ -1046,10 +1043,7 @@ cleanlib:
|
|||||||
Deps.append("$(%s)" % T.ListFileMacro)
|
Deps.append("$(%s)" % T.ListFileMacro)
|
||||||
|
|
||||||
if self._AutoGenObject.BuildRuleFamily == TAB_COMPILER_MSFT and Type == TAB_C_CODE_FILE:
|
if self._AutoGenObject.BuildRuleFamily == TAB_COMPILER_MSFT and Type == TAB_C_CODE_FILE:
|
||||||
T, CmdTarget, CmdTargetDict, CmdCppDict = self.ParserCCodeFile(T, Type, CmdSumDict, CmdTargetDict,
|
T, CmdTarget, CmdTargetDict, CmdCppDict = self.ParserCCodeFile(T, Type, CmdSumDict, CmdTargetDict, CmdCppDict, DependencyDict)
|
||||||
CmdCppDict, DependencyDict, RespFile,
|
|
||||||
ToolsDef, resp_file_number)
|
|
||||||
resp_file_number += 1
|
|
||||||
TargetDict = {"target": self.PlaceMacro(T.Target.Path, self.Macros), "cmd": "\n\t".join(T.Commands),"deps": CCodeDeps}
|
TargetDict = {"target": self.PlaceMacro(T.Target.Path, self.Macros), "cmd": "\n\t".join(T.Commands),"deps": CCodeDeps}
|
||||||
CmdLine = self._BUILD_TARGET_TEMPLATE.Replace(TargetDict).rstrip().replace('\t$(OBJLIST', '$(OBJLIST')
|
CmdLine = self._BUILD_TARGET_TEMPLATE.Replace(TargetDict).rstrip().replace('\t$(OBJLIST', '$(OBJLIST')
|
||||||
if T.Commands:
|
if T.Commands:
|
||||||
@@ -1060,15 +1054,7 @@ cleanlib:
|
|||||||
TargetDict = {"target": self.PlaceMacro(T.Target.Path, self.Macros), "cmd": "\n\t".join(T.Commands),"deps": Deps}
|
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))
|
self.BuildTargetList.append(self._BUILD_TARGET_TEMPLATE.Replace(TargetDict))
|
||||||
|
|
||||||
# Add a Makefile rule for targets generating multiple files.
|
def ParserCCodeFile(self, T, Type, CmdSumDict, CmdTargetDict, CmdCppDict, DependencyDict):
|
||||||
# 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, RespFile, ToolsDef,
|
|
||||||
resp_file_number):
|
|
||||||
SaveFilePath = os.path.join(RespFile, "cc_resp_%s.txt" % resp_file_number)
|
|
||||||
if not CmdSumDict:
|
if not CmdSumDict:
|
||||||
for item in self._AutoGenObject.Targets[Type]:
|
for item in self._AutoGenObject.Targets[Type]:
|
||||||
CmdSumDict[item.Target.SubDir] = item.Target.BaseName
|
CmdSumDict[item.Target.SubDir] = item.Target.BaseName
|
||||||
@@ -1095,36 +1081,17 @@ cleanlib:
|
|||||||
if Temp.startswith('/Fo'):
|
if Temp.startswith('/Fo'):
|
||||||
CmdSign = '%s%s' % (Temp.rsplit(TAB_SLASH, 1)[0], TAB_SLASH)
|
CmdSign = '%s%s' % (Temp.rsplit(TAB_SLASH, 1)[0], TAB_SLASH)
|
||||||
break
|
break
|
||||||
else:
|
else: continue
|
||||||
continue
|
|
||||||
if CmdSign not in list(CmdTargetDict.keys()):
|
if CmdSign not in list(CmdTargetDict.keys()):
|
||||||
cmd = Item.replace(Temp, CmdSign)
|
CmdTargetDict[CmdSign] = Item.replace(Temp, CmdSign)
|
||||||
if SingleCommandList[-1] in cmd:
|
|
||||||
CmdTargetDict[CmdSign] = [cmd.replace(SingleCommandList[-1], "").rstrip(), SingleCommandList[-1]]
|
|
||||||
else:
|
else:
|
||||||
# CmdTargetDict[CmdSign] = "%s %s" % (CmdTargetDict[CmdSign], SingleCommandList[-1])
|
CmdTargetDict[CmdSign] = "%s %s" % (CmdTargetDict[CmdSign], SingleCommandList[-1])
|
||||||
CmdTargetDict[CmdSign].append(SingleCommandList[-1])
|
|
||||||
Index = CommandList.index(Item)
|
Index = CommandList.index(Item)
|
||||||
CommandList.pop(Index)
|
CommandList.pop(Index)
|
||||||
if SingleCommandList[-1].endswith("%s%s.c" % (TAB_SLASH, CmdSumDict[CmdSign[3:].rsplit(TAB_SLASH, 1)[0]])):
|
if SingleCommandList[-1].endswith("%s%s.c" % (TAB_SLASH, CmdSumDict[CmdSign[3:].rsplit(TAB_SLASH, 1)[0]])):
|
||||||
Cpplist = CmdCppDict[T.Target.SubDir]
|
Cpplist = CmdCppDict[T.Target.SubDir]
|
||||||
Cpplist.insert(0, '$(OBJLIST_%d): ' % list(self.ObjTargetDict.keys()).index(T.Target.SubDir))
|
Cpplist.insert(0, '$(OBJLIST_%d): ' % list(self.ObjTargetDict.keys()).index(T.Target.SubDir))
|
||||||
source_files = CmdTargetDict[CmdSign][1:]
|
T.Commands[Index] = '%s\n\t%s' % (' \\\n\t'.join(Cpplist), CmdTargetDict[CmdSign])
|
||||||
source_files.insert(0, " ")
|
|
||||||
if len(source_files)>2:
|
|
||||||
SaveFileOnChange(SaveFilePath, " ".join(source_files), False)
|
|
||||||
T.Commands[Index] = '%s\n\t%s $(cc_resp_%s)' % (
|
|
||||||
' \\\n\t'.join(Cpplist), CmdTargetDict[CmdSign][0], resp_file_number)
|
|
||||||
ToolsDef.append("cc_resp_%s = @%s" % (resp_file_number, SaveFilePath))
|
|
||||||
|
|
||||||
elif len(source_files)<=2 and len(" ".join(CmdTargetDict[CmdSign][:2]))>GlobalData.gCommandMaxLength:
|
|
||||||
SaveFileOnChange(SaveFilePath, " ".join(source_files), False)
|
|
||||||
T.Commands[Index] = '%s\n\t%s $(cc_resp_%s)' % (
|
|
||||||
' \\\n\t'.join(Cpplist), CmdTargetDict[CmdSign][0], resp_file_number)
|
|
||||||
ToolsDef.append("cc_resp_%s = @%s" % (resp_file_number, SaveFilePath))
|
|
||||||
|
|
||||||
else:
|
|
||||||
T.Commands[Index] = '%s\n\t%s' % (' \\\n\t'.join(Cpplist), " ".join(CmdTargetDict[CmdSign]))
|
|
||||||
else:
|
else:
|
||||||
T.Commands.pop(Index)
|
T.Commands.pop(Index)
|
||||||
return T, CmdSumDict, CmdTargetDict, CmdCppDict
|
return T, CmdSumDict, CmdTargetDict, CmdCppDict
|
||||||
|
@@ -103,7 +103,7 @@ ${END}
|
|||||||
if os.path.normpath(dependency_file +".deps") == abspath:
|
if os.path.normpath(dependency_file +".deps") == abspath:
|
||||||
continue
|
continue
|
||||||
filename = os.path.basename(dependency_file).strip()
|
filename = os.path.basename(dependency_file).strip()
|
||||||
if filename not in targetname:
|
if filename not in self.SourceFileList and filename not in targetname:
|
||||||
includes.add(dependency_file.strip())
|
includes.add(dependency_file.strip())
|
||||||
|
|
||||||
for item in lines[1:]:
|
for item in lines[1:]:
|
||||||
@@ -116,6 +116,8 @@ ${END}
|
|||||||
if os.path.normpath(dependency_file +".deps") == abspath:
|
if os.path.normpath(dependency_file +".deps") == abspath:
|
||||||
continue
|
continue
|
||||||
filename = os.path.basename(dependency_file).strip()
|
filename = os.path.basename(dependency_file).strip()
|
||||||
|
if filename in self.SourceFileList:
|
||||||
|
continue
|
||||||
if filename in targetname:
|
if filename in targetname:
|
||||||
continue
|
continue
|
||||||
includes.add(dependency_file.strip())
|
includes.add(dependency_file.strip())
|
||||||
@@ -201,17 +203,7 @@ ${END}
|
|||||||
cc_options = line[len(cc_cmd)+2:].split()
|
cc_options = line[len(cc_cmd)+2:].split()
|
||||||
else:
|
else:
|
||||||
cc_options = line[len(cc_cmd):].split()
|
cc_options = line[len(cc_cmd):].split()
|
||||||
for item in cc_options:
|
SourceFileAbsPathMap = {os.path.basename(item):item for item in cc_options if not item.startswith("/") and os.path.exists(item)}
|
||||||
if not item.startswith("/"):
|
|
||||||
if item.endswith(".txt") and item.startswith("@"):
|
|
||||||
with open(item[1:], "r") as file:
|
|
||||||
source_files = file.readlines()[0].split()
|
|
||||||
SourceFileAbsPathMap = {os.path.basename(file): file for file in source_files if
|
|
||||||
os.path.exists(file)}
|
|
||||||
else:
|
|
||||||
if os.path.exists(item):
|
|
||||||
SourceFileAbsPathMap.update({os.path.basename(item): item.strip()})
|
|
||||||
# SourceFileAbsPathMap = {os.path.basename(item):item for item in cc_options if not item.startswith("/") and os.path.exists(item)}
|
|
||||||
if line in SourceFileAbsPathMap:
|
if line in SourceFileAbsPathMap:
|
||||||
current_source = line
|
current_source = line
|
||||||
if current_source not in ModuleDepDict:
|
if current_source not in ModuleDepDict:
|
||||||
@@ -291,7 +283,6 @@ ${END}
|
|||||||
targetitem = self.GetRealTarget(source_abs.strip(" :"))
|
targetitem = self.GetRealTarget(source_abs.strip(" :"))
|
||||||
|
|
||||||
targetitem += ": "
|
targetitem += ": "
|
||||||
if len(lines)>=2:
|
|
||||||
targetitem += lines[1]
|
targetitem += lines[1]
|
||||||
newcontent.append(targetitem)
|
newcontent.append(targetitem)
|
||||||
newcontent.extend(lines[2:])
|
newcontent.extend(lines[2:])
|
||||||
|
@@ -860,8 +860,7 @@ class ModuleAutoGen(AutoGen):
|
|||||||
SubDirectory = os.path.join(self.OutputDir, File.SubDir)
|
SubDirectory = os.path.join(self.OutputDir, File.SubDir)
|
||||||
if not os.path.exists(SubDirectory):
|
if not os.path.exists(SubDirectory):
|
||||||
CreateDirectory(SubDirectory)
|
CreateDirectory(SubDirectory)
|
||||||
TargetList = set()
|
LastTarget = None
|
||||||
FinalTargetName = set()
|
|
||||||
RuleChain = set()
|
RuleChain = set()
|
||||||
SourceList = [File]
|
SourceList = [File]
|
||||||
Index = 0
|
Index = 0
|
||||||
@@ -871,9 +870,6 @@ class ModuleAutoGen(AutoGen):
|
|||||||
self.BuildOption
|
self.BuildOption
|
||||||
|
|
||||||
while Index < len(SourceList):
|
while Index < len(SourceList):
|
||||||
# Reset the FileType if not the first iteration.
|
|
||||||
if Index > 0:
|
|
||||||
FileType = TAB_UNKNOWN_FILE
|
|
||||||
Source = SourceList[Index]
|
Source = SourceList[Index]
|
||||||
Index = Index + 1
|
Index = Index + 1
|
||||||
|
|
||||||
@@ -890,25 +886,29 @@ class ModuleAutoGen(AutoGen):
|
|||||||
elif Source.Ext in self.BuildRules:
|
elif Source.Ext in self.BuildRules:
|
||||||
RuleObject = self.BuildRules[Source.Ext]
|
RuleObject = self.BuildRules[Source.Ext]
|
||||||
else:
|
else:
|
||||||
# No more rule to apply: Source is a final target.
|
# stop at no more rules
|
||||||
FinalTargetName.add(Source)
|
if LastTarget:
|
||||||
continue
|
self._FinalBuildTargetList.add(LastTarget)
|
||||||
|
break
|
||||||
|
|
||||||
FileType = RuleObject.SourceFileType
|
FileType = RuleObject.SourceFileType
|
||||||
self._FileTypes[FileType].add(Source)
|
self._FileTypes[FileType].add(Source)
|
||||||
|
|
||||||
# stop at STATIC_LIBRARY for library
|
# stop at STATIC_LIBRARY for library
|
||||||
if self.IsLibrary and FileType == TAB_STATIC_LIBRARY:
|
if self.IsLibrary and FileType == TAB_STATIC_LIBRARY:
|
||||||
FinalTargetName.add(Source)
|
if LastTarget:
|
||||||
continue
|
self._FinalBuildTargetList.add(LastTarget)
|
||||||
|
break
|
||||||
|
|
||||||
Target = RuleObject.Apply(Source, self.BuildRuleOrder)
|
Target = RuleObject.Apply(Source, self.BuildRuleOrder)
|
||||||
if not Target:
|
if not Target:
|
||||||
# No Target: Source is a final target.
|
if LastTarget:
|
||||||
FinalTargetName.add(Source)
|
self._FinalBuildTargetList.add(LastTarget)
|
||||||
continue
|
break
|
||||||
|
elif not Target.Outputs:
|
||||||
|
# Only do build for target with outputs
|
||||||
|
self._FinalBuildTargetList.add(Target)
|
||||||
|
|
||||||
TargetList.add(Target)
|
|
||||||
self._BuildTargets[FileType].add(Target)
|
self._BuildTargets[FileType].add(Target)
|
||||||
|
|
||||||
if not Source.IsBinary and Source == File:
|
if not Source.IsBinary and Source == File:
|
||||||
@@ -916,16 +916,12 @@ class ModuleAutoGen(AutoGen):
|
|||||||
|
|
||||||
# to avoid cyclic rule
|
# to avoid cyclic rule
|
||||||
if FileType in RuleChain:
|
if FileType in RuleChain:
|
||||||
EdkLogger.error("build", ERROR_STATEMENT, "Cyclic dependency detected while generating rule for %s" % str(Source))
|
break
|
||||||
|
|
||||||
RuleChain.add(FileType)
|
RuleChain.add(FileType)
|
||||||
SourceList.extend(Target.Outputs)
|
SourceList.extend(Target.Outputs)
|
||||||
|
LastTarget = Target
|
||||||
# For each final target name, retrieve the corresponding TargetDescBlock instance.
|
FileType = TAB_UNKNOWN_FILE
|
||||||
for FTargetName in FinalTargetName:
|
|
||||||
for Target in TargetList:
|
|
||||||
if FTargetName == Target.Target:
|
|
||||||
self._FinalBuildTargetList.add(Target)
|
|
||||||
|
|
||||||
@cached_property
|
@cached_property
|
||||||
def Targets(self):
|
def Targets(self):
|
||||||
@@ -1032,7 +1028,7 @@ class ModuleAutoGen(AutoGen):
|
|||||||
@cached_property
|
@cached_property
|
||||||
def ModulePcdList(self):
|
def ModulePcdList(self):
|
||||||
# apply PCD settings from platform
|
# apply PCD settings from platform
|
||||||
RetVal = self.PlatformInfo.ApplyPcdSetting(self, self.Module.Pcds)
|
RetVal = self.PlatformInfo.ApplyPcdSetting(self.Module, self.Module.Pcds)
|
||||||
|
|
||||||
return RetVal
|
return RetVal
|
||||||
@cached_property
|
@cached_property
|
||||||
@@ -1063,7 +1059,7 @@ class ModuleAutoGen(AutoGen):
|
|||||||
continue
|
continue
|
||||||
Pcds.add(Key)
|
Pcds.add(Key)
|
||||||
PcdsInLibrary[Key] = copy.copy(Library.Pcds[Key])
|
PcdsInLibrary[Key] = copy.copy(Library.Pcds[Key])
|
||||||
RetVal.extend(self.PlatformInfo.ApplyPcdSetting(self, PcdsInLibrary, Library=Library))
|
RetVal.extend(self.PlatformInfo.ApplyPcdSetting(self.Module, PcdsInLibrary, Library=Library))
|
||||||
return RetVal
|
return RetVal
|
||||||
|
|
||||||
## Get the GUID value mapping
|
## Get the GUID value mapping
|
||||||
@@ -1822,6 +1818,9 @@ class ModuleAutoGen(AutoGen):
|
|||||||
for LibraryAutoGen in self.LibraryAutoGenList:
|
for LibraryAutoGen in self.LibraryAutoGenList:
|
||||||
LibraryAutoGen.CreateCodeFile()
|
LibraryAutoGen.CreateCodeFile()
|
||||||
|
|
||||||
|
# CanSkip uses timestamps to determine build skipping
|
||||||
|
if self.CanSkip():
|
||||||
|
return
|
||||||
self.LibraryAutoGenList
|
self.LibraryAutoGenList
|
||||||
AutoGenList = []
|
AutoGenList = []
|
||||||
IgoredAutoGenList = []
|
IgoredAutoGenList = []
|
||||||
|
@@ -479,9 +479,8 @@ class PlatformInfo(AutoGenInfo):
|
|||||||
SkuName : SkuInfoClass(SkuName, self.Platform.SkuIds[SkuName][0], '', '', '', '', '', ToPcd.DefaultValue)
|
SkuName : SkuInfoClass(SkuName, self.Platform.SkuIds[SkuName][0], '', '', '', '', '', ToPcd.DefaultValue)
|
||||||
}
|
}
|
||||||
|
|
||||||
def ApplyPcdSetting(self, Ma, Pcds, Library=""):
|
def ApplyPcdSetting(self, Module, Pcds, Library=""):
|
||||||
# for each PCD in module
|
# for each PCD in module
|
||||||
Module=Ma.Module
|
|
||||||
for Name, Guid in Pcds:
|
for Name, Guid in Pcds:
|
||||||
PcdInModule = Pcds[Name, Guid]
|
PcdInModule = Pcds[Name, Guid]
|
||||||
# find out the PCD setting in platform
|
# find out the PCD setting in platform
|
||||||
@@ -508,12 +507,9 @@ class PlatformInfo(AutoGenInfo):
|
|||||||
)
|
)
|
||||||
|
|
||||||
# override PCD settings with module specific setting
|
# override PCD settings with module specific setting
|
||||||
ModuleScopePcds = self.DataPipe.Get("MOL_PCDS")
|
|
||||||
if Module in self.Platform.Modules:
|
if Module in self.Platform.Modules:
|
||||||
PlatformModule = self.Platform.Modules[str(Module)]
|
PlatformModule = self.Platform.Modules[str(Module)]
|
||||||
PCD_DATA = ModuleScopePcds.get(Ma.Guid,{})
|
for Key in PlatformModule.Pcds:
|
||||||
mPcds = {(pcd.TokenCName,pcd.TokenSpaceGuidCName): pcd for pcd in PCD_DATA}
|
|
||||||
for Key in mPcds:
|
|
||||||
if self.BuildOptionPcd:
|
if self.BuildOptionPcd:
|
||||||
for pcd in self.BuildOptionPcd:
|
for pcd in self.BuildOptionPcd:
|
||||||
(TokenSpaceGuidCName, TokenCName, FieldName, pcdvalue, _) = pcd
|
(TokenSpaceGuidCName, TokenCName, FieldName, pcdvalue, _) = pcd
|
||||||
@@ -532,7 +528,7 @@ class PlatformInfo(AutoGenInfo):
|
|||||||
Flag = True
|
Flag = True
|
||||||
break
|
break
|
||||||
if Flag:
|
if Flag:
|
||||||
self._OverridePcd(ToPcd, mPcds[Key], Module, Msg="DSC Components Module scoped PCD section", Library=Library)
|
self._OverridePcd(ToPcd, PlatformModule.Pcds[Key], Module, Msg="DSC Components Module scoped PCD section", Library=Library)
|
||||||
# use PCD value to calculate the MaxDatumSize when it is not specified
|
# use PCD value to calculate the MaxDatumSize when it is not specified
|
||||||
for Name, Guid in Pcds:
|
for Name, Guid in Pcds:
|
||||||
Pcd = Pcds[Name, Guid]
|
Pcd = Pcds[Name, Guid]
|
||||||
|
@@ -253,7 +253,7 @@ class PlatformAutoGen(AutoGen):
|
|||||||
VariableInfo.SetVpdRegionMaxSize(VpdRegionSize)
|
VariableInfo.SetVpdRegionMaxSize(VpdRegionSize)
|
||||||
VariableInfo.SetVpdRegionOffset(VpdRegionBase)
|
VariableInfo.SetVpdRegionOffset(VpdRegionBase)
|
||||||
Index = 0
|
Index = 0
|
||||||
for Pcd in sorted(DynamicPcdSet):
|
for Pcd in DynamicPcdSet:
|
||||||
pcdname = ".".join((Pcd.TokenSpaceGuidCName, Pcd.TokenCName))
|
pcdname = ".".join((Pcd.TokenSpaceGuidCName, Pcd.TokenCName))
|
||||||
for SkuName in Pcd.SkuInfoList:
|
for SkuName in Pcd.SkuInfoList:
|
||||||
Sku = Pcd.SkuInfoList[SkuName]
|
Sku = Pcd.SkuInfoList[SkuName]
|
||||||
@@ -1043,13 +1043,7 @@ class PlatformAutoGen(AutoGen):
|
|||||||
|
|
||||||
@cached_property
|
@cached_property
|
||||||
def _MbList(self):
|
def _MbList(self):
|
||||||
ModuleList = []
|
return [self.BuildDatabase[m, self.Arch, self.BuildTarget, self.ToolChain] for m in self.Platform.Modules]
|
||||||
for m in self.Platform.Modules:
|
|
||||||
component = self.Platform.Modules[m]
|
|
||||||
module = self.BuildDatabase[m, self.Arch, self.BuildTarget, self.ToolChain]
|
|
||||||
module.Guid = component.Guid
|
|
||||||
ModuleList.append(module)
|
|
||||||
return ModuleList
|
|
||||||
|
|
||||||
@cached_property
|
@cached_property
|
||||||
def _MaList(self):
|
def _MaList(self):
|
||||||
|
@@ -108,10 +108,6 @@ class WorkspaceAutoGen(AutoGen):
|
|||||||
#
|
#
|
||||||
# Mark now build in AutoGen Phase
|
# Mark now build in AutoGen Phase
|
||||||
#
|
#
|
||||||
#
|
|
||||||
# Collect Platform Guids to support Guid name in Fdfparser.
|
|
||||||
#
|
|
||||||
self.CollectPlatformGuids()
|
|
||||||
GlobalData.gAutoGenPhase = True
|
GlobalData.gAutoGenPhase = True
|
||||||
self.ProcessModuleFromPdf()
|
self.ProcessModuleFromPdf()
|
||||||
self.ProcessPcdType()
|
self.ProcessPcdType()
|
||||||
@@ -157,26 +153,6 @@ class WorkspaceAutoGen(AutoGen):
|
|||||||
EdkLogger.error("build", PARAMETER_INVALID,
|
EdkLogger.error("build", PARAMETER_INVALID,
|
||||||
ExtraData="Build target [%s] is not supported by the platform. [Valid target: %s]"
|
ExtraData="Build target [%s] is not supported by the platform. [Valid target: %s]"
|
||||||
% (self.BuildTarget, " ".join(self.Platform.BuildTargets)))
|
% (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
|
@cached_property
|
||||||
def FdfProfile(self):
|
def FdfProfile(self):
|
||||||
if not self.FdfFile:
|
if not self.FdfFile:
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user