Compare commits

...

243 Commits

Author SHA1 Message Date
bb1bba3d77 NetworkPkg: Fix invalid pointer for DNS response token on error
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3719

This issue is introduced by the commit 43d7e607.
Token->RspData.H2AData is de-allocated on error but it is not
set to NULL. HTTP module attempts to free again and cause assert.

Signed-off-by: Baraneedharan Anbazhagan <anbazhagan@hp.com>
Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com>
2021-11-26 16:54:49 +08:00
4c7ce0d285 MdeModulePkg AtaAtapiPassThru: Skip the potential NULL pointer access
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3732
Recent change c9742578 exposes this potential issue.

Signed-off-by: Liming Gao <gaoliming@byosoft.com.cn>
Acked-by: Rebecca Cran <rebecca@nuviainc.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
2021-11-24 15:25:07 +00:00
e1e7306b54 OvmfPkg/Library/ResetSystemLib: Fix Microvm VS2019 NOOPT build issue
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3731

Fix VS2019 NOOPT build issues with OvmfPkg/Microvm/MicrovmX64.dsc
by fixing typecast of MICROVM_GED_MMIO_BASE_REGS to a VOID *.

Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
2021-11-12 19:32:48 +00:00
455b0347a7 UefiCpuPkg/PiSmmCpuDxeSmm: Use SMM Interrupt Shadow Stack
When CET shadow stack feature is enabled, it needs to use IST for the
 exceptions, and uses interrupt shadow stack for the stack switch.
Shadow stack should be 32 bytes aligned.
Check IST field, when clear shadow stack token busy bit when using retf.

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3728

Signed-off-by: Sheng Wei <w.sheng@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
2021-11-12 12:50:19 +00:00
466ebdd2e0 MdeModulePkg/FPDT: Lock boot performance table address variable at EndOfDxe
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2957

1. Allocate performance data table at EndOfDxe and then lock the varible
   which store the table address at EndOfDxe.

2. Enlarge PCD gEfiMdeModulePkgTokenSpaceGuid.PcdExtFpdtBootRecordPadSize
   from 0x20000 to 0x30000 in order to hold the Delta performance data
   between EndOfDxe and ReadyToBoot.

3. SMM performance data is collected by DXE modules through SMM communication
   at ReadyToBoot before.
   Now to do SMM communication twice, one for allocating the performance
   size at EndOfDxe, another is at ReadyToBoot to get SMM performance data.

4. Make SmmCorePerformanceLib rather than FirmwarePerformanceSmm to communicate
   with DxeCorePerformanceLib for SMM performance data and size.

Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
2021-11-12 07:36:23 +00:00
4c495e5e3d OvmfPkg/Bhyve/PlatformPei: Fix VS2019 X64 NOOPT build issue
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3724

Add typecast to fix build error with VS2019 X64 NOOPT converting
a UINT64 value to UINT32 value.

Cc: Rebecca Cran <rebecca@bsdio.com>
Cc: Peter Grehan <grehan@freebsd.org>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Rebecca Cran <rebecca@bsdio.com>
Acked-by: Peter Grehan <grehan@freebsd.org>
2021-11-11 23:23:00 +00:00
a92559671a OvmfPkg/Xen: Fix VS2019 build issues
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3722

Fix VS2019 NOOPT build issues related to converting
a larger integer value to a smaller integer value.

Cc: Anthony Perard <anthony.perard@citrix.com>
Cc: Julien Grall <julien@xen.org>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com>
2021-11-11 22:46:59 +00:00
22c3b5a865 BaseTools: Add authenticated variable store support
In order to support secure boot with authenticated type variable store
and non secure boot with normal type variable store, add one flag to
switch them.

User can append '-D VPD_AUTHENTICATED_VARIABLE_STORE' to build command
to enable authenticated type varaible store.

Also, user can add 'VPD_AUTHENTICATED_VARIABLE_STORE = TRUE/FALSE' to the
defines section of Dsc file to switch authenticated/normal type variable
store.

VPD_AUTHENTICATED_VARIABLE_STORE is a new reserved key word for this function.

Signed-off-by: Chen Lin Z <lin.z.chen@intel.com>
Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
2021-11-11 08:12:19 +00:00
8c8867c5da MdeModulePkg/DxeCapsuleLibFmp: Use new Variable Lock interface
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3699
The code in MdeModulePkg\Library\DxeCapsuleLibFmp call the deprecated=20
interface VariableLockRequestToLock.c. So I changed the code in
FmpDevicePkg using RegisterBasicVariablePolicy, instead of the=20
deprecated interface.

Signed-off-by: Yang Jie <jie.yang@intel.com>
Cc: Guomin Jiang <guomin.jiang@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Jian J Wang <jian.j.wang@intel.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
Reviewed-by: Jian J Wang <jian.j.wang@intel.com>
2021-11-10 09:27:33 +00:00
f826b20811 UefiCpuPkg/UefiCpuLib: Add GetCpuFamilyModel and GetCpuSteppingId
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3698

Lots of code relies on CPU Family/Model/Stepping for different logics.

The change adds two APIs for such needs.

Signed-off-by: Ray Ni <ray.ni@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
2021-11-10 04:28:08 +00:00
a7b35aae13 MdeModulePkg\UfsBlockIoPei: UFS MMIO address size support both 32/64 bits
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3703

MMIO base address size will overflow while finding two or more Host
controller in the system. Correct it and support 32 and 64 bits address
space.

Signed-off-by: Ian Chiu <ian.chiu@intel.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
Cc: Maggie Chu <maggie.chu@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
2021-11-10 02:57:54 +00:00
aab6bb3d32 MdeModulePkg/DxeCapsuleLibFmp: Capsule on Disk file name capsule
Enhance RelocateCapsuleToRam() to skip creation of the Capsule on Disk
file name capsule if PcdSupportUpdateCapsuleReset feature is not enabled.
This avoids an EFI_UNSUPPORTED return status from UpdateCapsule() when the
file name capsule is encountered and PcdSupportUpdateCapsuleReset is FALSE.

Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Guomin Jiang <guomin.jiang@intel.com>
Signed-off-by: Bob Morgan <bobm@nvidia.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
2021-11-10 02:21:50 +00:00
c974257821 MdeModulePkg AtaAtapiPassThru: Always do S.M.A.R.T. check if device support
If S.M.A.R.T. is supported, it can be checked.

Signed-off-by: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
2021-11-09 15:00:52 +08:00
d6e6337cd6 MdePkg: Fix ACPI memory aggregator/device type mismatch
Bugzilla: 3578 (https://bugzilla.tianocore.org/show_bug.cgi?id=3579)

Since the Common Memory Device (formerly Memory Aggregator Device) was
introduced in ACPI 5.0, the edk2 type values have not matched the
values defined in the ACPI specification.

Fix this discrepancy by aligning the code to match the specification.

Signed-off-by: Chris Jones <christopher.jones@arm.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
2021-11-09 05:30:11 +00:00
8c1b1fe634 ShellPkg: Add comment that ItemPtr is set after validation
Add a comment to clarify that in Acpiview the ItemPtr is not set until
after the FieldValidator has been called.

Signed-off-by: Chris Jones <christopher.jones@arm.com>
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
2021-11-09 01:24:41 +00:00
fd42dcb1fc OvmfPkg: Reproduce builds across source format changes
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3688

Use DEBUG_LINE_NUMBER instead of __LINE__.

Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Michael Kubacki <michael.kubacki@microsoft.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com>
Tested-by: Michael Kubacki <michael.kubacki@microsoft.com>
2021-11-08 18:01:35 +00:00
d939a25d41 SecurityPkg: Reproduce builds across source format changes
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3688

Use DEBUG_LINE_NUMBER instead of __LINE__.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Michael Kubacki <michael.kubacki@microsoft.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com>
Tested-by: Michael Kubacki <michael.kubacki@microsoft.com>
2021-11-08 18:01:35 +00:00
45137bca2f NetworkPkg: Reproduce builds across source format changes
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3688

Use DEBUG_LINE_NUMBER instead of __LINE__.

Cc: Maciej Rabeda <maciej.rabeda@linux.intel.com>
Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Cc: Siyuan Fu <siyuan.fu@intel.com>
Cc: Michael Kubacki <michael.kubacki@microsoft.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Maciej Rabeda <maciej.rabeda@linux.intel.com>
Tested-by: Michael Kubacki <michael.kubacki@microsoft.com>
2021-11-08 18:01:35 +00:00
77dcd03ecf MdeModulePkg: Reproduce builds across source format changes
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3688

Use DEBUG_LINE_NUMBER instead of __LINE__.

Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Michael Kubacki <michael.kubacki@microsoft.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
Tested-by: Michael Kubacki <michael.kubacki@microsoft.com>
2021-11-08 18:01:35 +00:00
f331310a10 ArmPkg: Reproduce builds across source format changes
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3688

Use DEBUG_LINE_NUMBER instead of __LINE__.

Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Michael Kubacki <michael.kubacki@microsoft.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Leif Lindholm <leif@nuviainc.com>
Tested-by: Michael Kubacki <michael.kubacki@microsoft.com>
2021-11-08 18:01:35 +00:00
5948ec3647 MdePkg: Reproduce builds across source format changes
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3688

* Use DEBUG_LINE_NUMBER instead of __LINE__.
* Use DEBUG_EXPRESSION_STRING instead of #Expression.

Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
Cc: Michael Kubacki <michael.kubacki@microsoft.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Tested-by: Michael Kubacki <michael.kubacki@microsoft.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
2021-11-08 18:01:35 +00:00
48452993ad MdePkg/Include: Enhance DebugLib to support reproduce builds
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3688

* Add DEBUG_LINE_NUMBER define to DebugLib.h that is
  by default mapped to __LINE__.  A build can define
  DEBUG_LINE_NUMBER to use a fixed value.
* Add DEBUG_EXPRESSION_STRING(Expression) macros to
  DebugLib.h that is by default mapped to #Expression.
  A build can define DEBUG_EXPRESSION_STRING_VALUE to
  set all expression strings to a fixed string value.

Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
Cc: Michael Kubacki <michael.kubacki@microsoft.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Tested-by: Michael Kubacki <michael.kubacki@microsoft.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
2021-11-08 18:01:35 +00:00
b5d4a35d90 MdeModulePkg/XhciSched: Fix missing DEBUG arguments
REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3662

Two DEBUG macros in XhciDxe/XhciSched.c are missing the argument
that should be passed for the print specifier.

In addition, this change updates the print level to "DEBUG_ERROR"
and prints the status as well.

Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
2021-11-08 04:08:08 +00:00
d79df34beb BaseTools: Fix StructurePcd offset error.
Currently when parse VFR files to get the struct info,
BOOLEAN type struct is ignored, which caused offset errors.
This patch fixed these bugs.

Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Signed-off-by: Yuwei Chen <yuwei.chen@intel.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
2021-11-08 03:18:54 +00:00
4050c873b5 MdeModulePkg/Variable/RuntimeDxeUnitTest: Fix 32-bit GCC builds
When using will_return() on a pointer value, it must be
cast to UINTN to be compatible with 32-bit GCC builds.
This uses the same approach in samples provided in the
UnitTestFramworkPkg when passing pointer values to
UT_ASSERT_EQUAL().

Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
Reviewed-by: Bret Barkelew <bret.barkelew@microsoft.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
2021-11-05 19:44:11 +00:00
15e635d1b5 UefiCpuPkg/MtrrLib/UnitTest: Fix 32-bit GCC build issues
When using UT_ASSERT_EQUAL() on a pointer value, it must be
cast to UINTN.  This follows the samples provided with the
UnitTestFrameworkPkg.

Cc: Eric Dong <eric.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
2021-11-05 19:44:11 +00:00
b0a03ca4a9 SignedCapsulePkg/SignedCapsulePkg.dsc: Add RngLib mapping
Fix build breaks for all architectures by adding RngLib mapping.

Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Abner Chang <abner.chang@hpe.com>
Cc: Daniel Schaefer <daniel.schaefer@hpe.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Daniel Schaefer <daniel.schaefer@hpe.com>
Acked-by: Abner Chang <abner.chang@hpe.com>
2021-11-05 19:44:11 +00:00
c1f2287635 SecurityPkg/SecurityPkg.dsc: Add missing RngLib for ARM and RISCV64
Fix SecurityPkg build breaks for ARM and RISCV64 by adding RngLib
mapping.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Abner Chang <abner.chang@hpe.com>
Cc: Daniel Schaefer <daniel.schaefer@hpe.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Acked-by: Jiewen Yao <Jiewen.yao@intel.com>
Acked-by: Abner Chang <abner.chang@hpe.com>
Reviewed-by: Daniel Schaefer <daniel.schaefer@hpe.com>
2021-11-05 19:44:11 +00:00
e13e53cb2f NetworkPkg/NetworkPkg.dsc: Add RngLib mapping for ARM and RISCV64
Fix NetworkPkg build breaks for ARM and RISCV64 by adding RngLib
mapping.

Cc: Maciej Rabeda <maciej.rabeda@linux.intel.com>
Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Cc: Siyuan Fu <siyuan.fu@intel.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Abner Chang <abner.chang@hpe.com>
Cc: Daniel Schaefer <daniel.schaefer@hpe.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Daniel Schaefer <daniel.schaefer@hpe.com>
Reviewed-by: Maciej Rabeda <maciej.rabeda@linux.intel.com>
Acked-by: Abner Chang <abner.chang@hpe.com>
2021-11-05 19:44:11 +00:00
0f4cdad25b DynamicTablesPkg: Add missing BaseStackCheckLib instance
Fix ARM and AARCH64 build issues by adding the BaseStackCheckLib
instance.

Cc: Sami Mujawar <Sami.Mujawar@arm.com>
Cc: Alexei Fedorov <Alexei.Fedorov@arm.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
2021-11-05 19:44:11 +00:00
b258f12889 BaseTools/VrfCompile: Fix uninitialized field from unnamed field
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3687

If a C structure parsed by the VFR compiler contains an unnamed
field, then mFieldName is left uninitialized, which generates
random data in the VFR compiler output file.

If the FieldName is NULL, then initialize pNewField->mFieldName
to a Null-terminated empty string.

Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Yuwei Chen <yuwei.chen@intel.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
2021-11-03 23:43:46 +00:00
6f9e83f757 NetworkPkg/HttpDxe: Enable wildcard host name matching for HTTP+TLS.
The current UEFI implementation of HTTPS during its TLS configuration
uses
EFI_TLS_VERIFY_FLAG_NO_WILDCARDS for host name verification. As per the
spec
this flag does is "to disable the match of any wildcards in the host
name". So,
certificates which are issued with wildcards(*.dm.corp.net etc) in it
will fail
the TLS host name matching. On the other hand,
EFI_TLS_VERIFY_FLAG_NONE(misnomer) means "no additional flags set for
hostname
validation. Wildcards are supported and they match only in the left-most
label."
this behavior/definition is coming from openssl's X509_check_host() api
https://www.openssl.org/docs/man1.1.0/man3/X509_check_host.html

Without EFI_TLS_VERIFY_FLAG_NONE any UEFI application using certificates
issued
with wildcards in them would fail to match while trying to communicate
with
HTTPS endpoint.

BugZilla: https://bugzilla.tianocore.org/show_bug.cgi?id=3691

Signed-off-by: Vineel Kovvuri <vineelko@microsoft.com>
Cc: Maciej Rabeda <maciej.rabeda@linux.intel.com>
Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Cc: Siyuan Fu <siyuan.fu@intel.com>
Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com>
Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com>
Reviewed-by: Maciej Rabeda <maciej.rabeda@linux.intel.com>
2021-11-03 21:26:27 +00:00
939c2355da IntelFsp2Pkg SplitFspBin.py: Correct file name in file header
Cc: Maurice Ma <maurice.ma@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Chasel Chiu <chasel.chiu@intel.com>
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Chasel Chiu <chasel.chiu@intel.com>
Reviewed-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
2021-11-01 04:32:36 +00:00
c8594a5311 SecurityPkg/FvReportPei: Remove the ASSERT to allow neither M nor V
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2673

M mean that Measured Boot, V mean that Verified Boot.

The FvReport do below:
1. Do nothing if neither M nor V
2. Allocate pages to save the firmware volume and use it to install
   firmware info Ppi
3. Install PreHashFv Ppi if the FV need measurement.
4. Verify the Hash if the FV need verification

Notes:
1. The component is used to verify the FV or measure the FV
2. Copy action is just for security purpose but not main purpose.
3. If you use this component, Doesn't need to copy in other compoent
   which result time consumption.

Signed-off-by: Guomin Jiang <guomin.jiang@intel.com>
Reviewed-by: Jian J Wang <jian.j.wang@intel.com>
2021-10-31 16:52:12 +00:00
91b772ab62 RedfishPkg: Add more information to Readme.md
Add more information of network settings for EDK2
Redfish service on EmulatorPkg.

Signed-off-by: Abner Chang <abner.chang@hpe.com>
Cc: Nickle Wang <nickle.wang@hpe.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Reviewed-by: Nickle Wang <nickle.wang@hpe.com>
2021-10-30 16:09:03 +00:00
e7663fdd82 UefiPayloadPkg: Remove SystemTableInfo GUID.
SystemTableInfo GUID is not a Spec defined GUID.
The latest SBL and CBL produces ACPI and SMBIOS table information.
So removing the SystemTableInfo GUID implementation.

Cc: Maurice Ma <maurice.ma@intel.com>
Cc: Guo Dong <guo.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Benjamin You <benjamin.you@intel.com>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>

Signed-off-by: Guo Dong <guo.dong@intel.com>
Signed-off-by: Thiyagu Kesavan Balakrishnan <thiyagux.kesavan.balakrishnan@intel.com>
Reviewed-by: Guo Dong <guo.dong@intel.com>
2021-10-30 15:00:58 +00:00
1bc232aae3 RedfishPkg: Update link to staging/RedfishClientPkg in Readme.md
Redfish feature DXE drivers are contributed to staging/RedfishClientPkg.
Add link to Readme.md in staging/RedfishClientPkg.

Signed-off-by: Nickle Wang <nickle.wang@hpe.com>
Cc: Abner Chang <abner.chang@hpe.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Reviewed-by: Abner Chang <abner.chang@hpe.com>
2021-10-29 07:56:11 +00:00
bb146ce32d MdePkg Cpuid.h: Define CPUID.(EAX=7,ECX=0):EDX[30]
This patch follows new Intel SDM to define CPUID.(EAX=7,ECX=0):EDX[30].

Signed-off-by: Star Zeng <star.zeng@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
Reviewed-by: Ray Ni <ray.ni@intel.com>
2021-10-28 02:30:46 +00:00
9a95d11023 IntelFsp2Pkg/SplitFspBin.py: adopt FSP 2.3 specification.
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3705

FSP 2.3 has updated FSP_INFO_HEADER to support ExtendedImageRevision
and SplitFspBin.py needs to support it.

Also updated script to display integer value basing on length.

Cc: Maurice Ma <maurice.ma@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Signed-off-by: Chasel Chiu <chasel.chiu@intel.com>
Reviewed-by: Maurice Ma <maurice.ma@intel.com>
Reviewed-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
2021-10-27 11:54:06 +00:00
2f6f3329ad FmpDevicePkg/FmpDxe: Use new Variable Lock interface
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3655
The code in FmpDevicePkg call the deprecated interface
VariableLockRequestToLockc. So I changed the code in
FmpDevicePkg using RegisterBasicVariablePolicy, instead
of the deprecated interface.

Signed-off-by: Yang Jie <jie.yang@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Guomin Jiang <guomin.jiang@intel.com>
Cc: Wei6 Xu <wei6.xu@intel.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
Reviewed-by: Wei6 Xu <wei6.xu@intel.com>
2021-10-26 05:19:17 +00:00
b80c17b62d UefiPayloadPkg: Add SMM support and SMM variable support
Add SMM variable support for universal UEFI payload.
By default they are disabled.

Signed-off-by: Guo Dong <guo.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Maurice Ma <maurice.ma@intel.com>
Cc: Benjamin You <benjamin.you@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Reviewed-by: Benjamin You <benjamin.you@intel.com>
2021-10-25 17:28:21 +00:00
242dcfe30f UefiPayloadPkg: Add a SMM dispatch module
PCH SMM module would install SMM SW dispatch2 protocol.
And it supports to register SMI handlers based on SMI APM
interrupt from the bootloader information gSmmRegisterInfoGuid.
It is possible to extend bootloader HOB to pass other information
to support more SMI sources.
If this module is not required by bootloader for some reason, the
bootloader could skip this HOB or build a HOB without EOS info.

Signed-off-by: Guo Dong <guo.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Maurice Ma <maurice.ma@intel.com>
Cc: Benjamin You <benjamin.you@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Reviewed-by: Benjamin You <benjamin.you@intel.com>
2021-10-25 17:28:21 +00:00
ae8acce8ae UefiPayloadPkg: Add a common FVB SMM module
This FVB module is used to initialize NV variable region
and provide SMM FVB protocol to read/write SPI variable region.

This module consume HOB gNvVariableInfoGuid and depends on
FlashDeviceLib for the actual SPI device operate.

During FVB initialization, it will initialize the variable region
if the variable region is not valid. And it support to write initial
variable data from FFS file if it is found.

Signed-off-by: Guo Dong <guo.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Maurice Ma <maurice.ma@intel.com>
Cc: Benjamin You <benjamin.you@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Reviewed-by: Benjamin You <benjamin.you@intel.com>
2021-10-25 17:28:21 +00:00
04714cef46 UefiPayloadPkg: Add FlashDeviceLib
This library provides FlashDeviceLib APIs based on
SpiFlashLib and consumed by FVB driver.

Signed-off-by: Guo Dong <guo.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Maurice Ma <maurice.ma@intel.com>
Cc: Benjamin You <benjamin.you@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Reviewed-by: Benjamin You <benjamin.you@intel.com>
2021-10-25 17:28:21 +00:00
1d66480aa4 UefiPayloadPkg: Add SpiFlashLib
This is a common SPI Flash library used for the Intel platform that
supports SPI hardware sequence. This library provides actual SPI flash
operation via Intel PCH SPI controller.

Signed-off-by: Guo Dong <guo.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Maurice Ma <maurice.ma@intel.com>
Cc: Benjamin You <benjamin.you@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Reviewed-by: Benjamin You <benjamin.you@intel.com>
2021-10-25 17:28:21 +00:00
bed990aae6 UefiPayloadPkg: Add bootloader SMM support module
This module is only used for SMM S3 support for the bootloader that
doesn't support SMM.
The payload would save SMM rebase info to SMM communication area in
normal boot and expect the bootloader in S3 path to rebase the SMM
and trigger SMI by writing 0xB2 port with the given value from SMM
communication area. The payload SMM handler would get chance to
restore some registers in S3 path.

Signed-off-by: Guo Dong <guo.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Maurice Ma <maurice.ma@intel.com>
Cc: Benjamin You <benjamin.you@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Reviewed-by: Benjamin You <benjamin.you@intel.com>
2021-10-25 17:28:21 +00:00
e7e8ea27d4 UefiPayloadPkg: Add a common SMM control Runtime DXE module
This module consumes SMM Registers HOB (SMI_GBL_EN and SMI_APM_EN) to
install SMM control 2 protocol gEfiSmmControl2ProtocolGuid.
The protocol activate() would set SMI_GBL_EN and SMI_APM_EN and trigger
SMI by writing to IO port 0xB3 and 0xB2.

Signed-off-by: Guo Dong <guo.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Maurice Ma <maurice.ma@intel.com>
Cc: Benjamin You <benjamin.you@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Reviewed-by: Benjamin You <benjamin.you@intel.com>
2021-10-25 17:28:21 +00:00
87a34ca0cf UefiPayloadPkg: Add a common SmmAccessDxe module
SmmAccessDxe module would consume EFI_SMRAM_HOB_DESCRIPTOR_BLOCK HOB to
produce SMM access protocol gEfiSmmAccess2ProtocolGuid (open, close, lock,
and GetCapabilities.)

Signed-off-by: Guo Dong <guo.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Maurice Ma <maurice.ma@intel.com>
Cc: Benjamin You <benjamin.you@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Reviewed-by: Benjamin You <benjamin.you@intel.com>
2021-10-25 17:28:21 +00:00
8b76f23534 OvmfPkg: Enable TDX in ResetVector
RFC: https://bugzilla.tianocore.org/show_bug.cgi?id=3429

Intel's Trust Domain Extensions (Intel TDX) refers to an Intel technology
that extends Virtual Machines Extensions (VMX) and Multi-Key Total Memory
Encryption (MKTME) with a new kind of virutal machines guest called a
Trust Domain (TD). A TD is desinged to run in a CPU mode that protects the
confidentiality of TD memory contents and the TD's CPU state from other
software, including the hosting Virtual-Machine Monitor (VMM), unless
explicitly shared by the TD itself.

Note: Intel TDX is only available on X64, so the Tdx related changes are
in X64 path. In IA32 path, there may be null stub to make the build
success.

This patch includes below major changes.

1. Ia32/IntelTdx.asm
IntelTdx.asm includes below routines used in ResetVector
 - IsTdx
   Check if the running system is Tdx guest.

 - InitTdxWorkarea
   It initialize the TDX_WORK_AREA. Because it is called by both BSP and
   APs and to avoid the race condition, only BSP can initialize the
   WORK_AREA. AP will wait until the field of TDX_WORK_AREA_PGTBL_READY
   is set.

 - ReloadFlat32
   After reset all CPUs in TDX are initialized to 32-bit protected mode.
   But GDT register is not set. So this routine loads the GDT then jump
   to Flat 32 protected mode again.

 - InitTdx
   This routine wrap above 3 routines together to do Tdx initialization
   in ResetVector phase.

 - IsTdxEnabled
   It is a OneTimeCall to probe if TDX is enabled by checking the
   CC_WORK_AREA.

 - CheckTdxFeaturesBeforeBuildPagetables
   This routine is called to check if it is Non-TDX guest, TDX-Bsp or
   TDX-APs. Because in TDX guest all the initialization is done by BSP
   (including the page tables). APs should not build the tables.

 - TdxPostBuildPageTables
   It is called after Page Tables are built by BSP.
   byte[TDX_WORK_AREA_PGTBL_READY] is set by BSP to indicate APs can
   leave spin and go.

2. Ia32/PageTables64.asm
As described above only the TDX BSP build the page tables. So
PageTables64.asm is updated to make sure only TDX BSP build the
PageTables. TDX APs will skip the page table building and set Cr3
directly.

3. Ia16/ResetVectorVtf0.asm
In Tdx all CPUs "reset" to run on 32-bit protected mode with flat
descriptor (paging disabled). But in Non-Td guest the initial state of
CPUs is 16-bit real mode. To resolve this conflict, BITS 16/32 is used
in the ResetVectorVtf0.asm. It checks the 32-bit protected mode or 16-bit
real mode, then jump to the corresponding entry point.

Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Brijesh Singh <brijesh.singh@amd.com>
Cc: Erdem Aktas <erdemaktas@google.com>
Cc: James Bottomley <jejb@linux.ibm.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: Min Xu <min.m.xu@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
2021-10-24 02:09:27 +00:00
c9ec74a198 OvmfPkg: Add IntelTdxMetadata.asm
RFC: https://bugzilla.tianocore.org/show_bug.cgi?id=3429

In TDX when host VMM creates a new guest TD, some initial set of
TD-private pages are added using the TDH.MEM.PAGE.ADD function. These
pages typically contain Virtual BIOS code and data along with some clear
pages for stacks and heap. In the meanwhile, some configuration data
need be measured by host VMM. Tdx Metadata is designed for this purpose
to indicate host VMM how to do the above tasks.

More detailed information of Metadata is in [TDVF] Section 11.

Tdx Metadata describes the information about the image for VMM use.
For example, the base address and length of the TdHob, Bfv, Cfv, etc.
The offset of the Metadata is stored in a GUID-ed structure which is
appended in the GUID-ed chain from a fixed GPA (0xffffffd0).

In this commit there are 2 new definitions of BFV & CFV.
Tdx Virtual Firmware (TDVF) includes one Firmware Volume (FV) known
as the Boot Firmware Volume (BFV). The FV format is defined in the
UEFI Platform Initialization (PI) spec. BFV includes all TDVF
components required during boot.

TDVF also include a configuration firmware volume (CFV) that is
separated from the BFV. The reason is because the CFV is measured in
RTMR, while the BFV is measured in MRTD.

In practice BFV is the code part of Ovmf image (OVMF_CODE.fd). CFV is
the vars part of Ovmf image (OVMF_VARS.fd).

Since AMD SEV has already defined some SEV specific memory region in
MEMFD. TDX re-uses some of the memory regions defined by SEV.
 - MailBox : PcdOvmfSecGhcbBackupBase|PcdOvmfSecGhcbBackupSize
 - TdHob   : PcdOvmfSecGhcbBase|PcdOvmfSecGhcbSize

[TDVF] https://software.intel.com/content/dam/develop/external/us/en/
documents/tdx-virtual-firmware-design-guide-rev-1.pdf

Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Brijesh Singh <brijesh.singh@amd.com>
Cc: Erdem Aktas <erdemaktas@google.com>
Cc: James Bottomley <jejb@linux.ibm.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Tom Lendacky <thomas.lendacky@amd.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Min Xu <min.m.xu@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
2021-10-24 02:09:27 +00:00
5a2411784b OvmfPkg: Clear WORK_AREA_GUEST_TYPE in Main.asm
RFC: https://bugzilla.tianocore.org/show_bug.cgi?id=3429

Previously WORK_AREA_GUEST_TYPE was cleared in SetCr3ForPageTables64.
This is workable for Legacy guest and SEV guest. But it doesn't work
after Intel TDX is introduced. It is because all TDX CPUs (BSP and APs)
start to run from 0xfffffff0, thus WORK_AREA_GUEST_TYPE will be cleared
multi-times if it is TDX guest. So the clearance of WORK_AREA_GUEST_TYPE
is moved to Main16 entry point in Main.asm.
Note: WORK_AREA_GUEST_TYPE is only defined for ARCH_X64.

For Intel TDX, its corresponding entry point is Main32 (which will be
introduced in next commit in this patch-set). WORK_AREA_GUEST_TYPE will
be cleared there.

Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Brijesh Singh <brijesh.singh@amd.com>
Cc: Erdem Aktas <erdemaktas@google.com>
Cc: James Bottomley <jejb@linux.ibm.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: Min Xu <min.m.xu@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
2021-10-24 02:09:27 +00:00
f079e9b450 OvmfPkg: Copy Main.asm from UefiCpuPkg to OvmfPkg's ResetVector
RFC: https://bugzilla.tianocore.org/show_bug.cgi?id=3429

Previously OvmfPkg/ResetVector uses the Main.asm in
UefiCpuPkg/ReseteVector/Vtf0. In this Main.asm there is only Main16
entry point.

This patch-set is to introduce Intel TDX into Ovmf. Main32 entry point
is needed in Main.asm by Intel TDX. To reduce the complexity of Main.asm
in UefiCpuPkg, OvmfPkg create its own Main.asm to meet the requirement
of Intel TDX. This Main.asm is an unmodified copy (so no functional
change) and the actual changes for tdx come as incremental patches.

UefiCpuPkg/ResetVector/Vtf0/main.asm -> OvmfPkg/ResetVector/Main.asm

Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Brijesh Singh <brijesh.singh@amd.com>
Cc: Erdem Aktas <erdemaktas@google.com>
Cc: James Bottomley <jejb@linux.ibm.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Tom Lendacky <thomas.lendacky@amd.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Min Xu <min.m.xu@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
2021-10-24 02:09:27 +00:00
6254037223 ArmPkg: Implement PlatformBootManagerLib for LinuxBoot
LinuxBoot is a firmware that replaces specific firmware functionality
like the UEFI DXE phase with a Linux kernel and runtime. It is built-in
UEFI image like an application, which is executed at the end of DXE
phase.

To achieve the LinuxBoot boot flow "SEC->PEI->DXE->BDS->LinuxBoot",
today we use the common well-known GUID of UEFI Shell for LinuxBoot
payload, so LinuxBoot developers can effortlessly find the UEFI Shell
Application and replace it with the LinuxBoot payload without
recompiling platform EDK2 (There might be an issue with a few systems
that don't have a UEFI Shell). Also, we have a hard requirement to force
the BDS to boot into the LinuxBoot as it is essentially required that
only the LinuxBoot boot option is permissible and UEFI is an
intermediate bootstrap phase. Considering all the above, it is
reasonable to just have a new GUID for LinuxBoot and require a LinuxBoot
specific BDS implementation. In addition, with making the BDS
implementation simpler, we can reduce many DXE drivers which we think it
is not necessary for LinuxBoot booting.

This patch adds a new PlatformBootManagerLib implementation which
registers only the gArmTokenSpaceGuid.PcdLinuxBootFileGuid for LinuxBoot
payload as an active boot option. It allows BDS to jump to the LinuxBoot
quickly by skipping the UiApp and UEFI Shell.

The PlatformBootManagerLib library derived from
ArmPkg/Library/PlatformBootManagerLib.

Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>

Signed-off-by: Nhi Pham <nhi@os.amperecomputing.com>
Acked-by: Ard Biesheuvel <ardb@kernel.org>
Acked-by: Samer El-Haj-Mahmoud <Samer.El-Haj-Mahmoud@arm.com>
Acked-by: Moritz Fischer <moritzf@google.com>
2021-10-23 08:38:20 +00:00
bd5ec03d87 NetworkPkg/HttpBootDxe: make file extension check case-insensitive
https://bugzilla.tianocore.org/show_bug.cgi?id=3694

HttpBootCheckImageType() was using the case-sensitive AsciiStrCmp() to
check the file extensions and this could reject the images with
upper-case file names. Using the case-insensitive AsciiStriCmp() to
avoid the issue.

Cc: Maciej Rabeda <maciej.rabeda@linux.intel.com>
Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Cc: Siyuan Fu <siyuan.fu@intel.com>
Signed-off-by: Gary Lin <gary.lin@hpe.com>
Reviewed-by: Maciej Rabeda <maciej.rabeda@linux.intel.com>
2021-10-22 10:04:10 +00:00
2f286930a8 ShellPkg: Parse I/O APIC and x2APIC structure
Parse and print the below interrupt structures
  - I/O APIC Structure
  - Interrupt Source Override Structure
  - Processor Local x2APIC Structure
  - Local x2APIC NMI Structure

Signed-off-by: Abdul Lateef Attar <AbdulLateef.Attar@amd.com>
Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
2021-10-21 05:46:17 +00:00
305fd6bee0 UefiCpuPkg/CpuCacheInfoLib: Add QuickSort function on BaseLib
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3675

Remove MdeModulePkg dependency

Cc: Eric Dong <eric.dong@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
Signed-off-by: IanX Kuo <ianx.kuo@intel.com>
2021-10-21 03:23:04 +00:00
99325a8b65 MdeModulePkg/SortLib: Add QuickSort function on BaseLib
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3675

Use QuickSort instead of QuickSortWorker

Cc: Ray Ni <ray.ni@intel.com>
Reviewed-by: Jian J Wang <jian.j.wang@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Signed-off-by: IanX Kuo <ianx.kuo@intel.com>
2021-10-21 03:23:04 +00:00
6893865b30 DynamicTablesPkg: Fix void pointer arithmetic
Building the DynamicTablesPkg with the additional
-Wpointer-arith flag triggers the following error:
  "pointer of type ‘void *’ used in arithmetic
  [-Werror=pointer-arith]"

Cast the void pointer to fix the error.

Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
2021-10-20 10:38:30 +00:00
4fdf843c75 DynamicTablesPkg: Fix unitialized variable use
In the success case we should return EFI_SUCCESS rather than returning
a potentially unitialized value of Status.

Cc: Sami Mujawar <Sami.Mujawar@arm.com>
Cc: Alexei Fedorov <Alexei.Fedorov@arm.com>
Signed-off-by: Moritz Fischer <moritzf@google.com>
2021-10-20 09:55:52 +00:00
37a33f02aa UefiCpuPkg: Cpu feature data stored in memory may be migrated
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3634

The memory allocated through "PeiAllocatePool" is located in HOB, and
in DXE phase, the HOB will be migrated to a different location.
After the migration, the data stored in the HOB stays the same, but the
address of pointer to the memory(such as the pointers in ACPI_CPU_DATA
structure) changes, which may cause "PiSmmCpuDxeSmm" driver can't find
the memory(the pointers in ACPI_CPU_DATA structure) that allocated in
"PeiRegisterCpuFeaturesLib", so use "PeiAllocatePages" to allocate
memory instead.

Signed-off-by: Jason Lou <yun.lou@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
2021-10-20 06:43:42 +00:00
90246a6d9f UefiPayloadPkg: Fix the build failure for non-universal payload
Applied an old patch which caused non-universal payload build failed
since that code was added after the old patch.
This patch fixed the build failure.

Signed-off-by: Guo Dong <guo.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Maurice Ma <maurice.ma@intel.com>
Cc: Benjamin You <benjamin.you@intel.com>
Reviewed-by: Zhiguang Liu <zhiguang.liu@intel.com>
2021-10-19 06:35:00 +00:00
6ef5797447 UefiPayloadPkg: Fix ECC reported issues
V2: Fix more header files on #ifdef variable

ECC reported some issues on UefiPayloadPkg, this patch fixed
most of them except several files including ElfLib\Elf32.h,
coreboot.h, CbParseLib.c, etc.
It also removed unused functions in ResetSystemLib and Hob.c.

Signed-off-by: Guo Dong <guo.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Maurice Ma <maurice.ma@intel.com>
Cc: Benjamin You <benjamin.you@intel.com>
Reviewed-by: Maurice Ma <maurice.ma@intel.com>
2021-10-19 04:27:41 +00:00
91a978ce7e UefiPayloadPkg: Replace MEMROY_ENTRY by MEMORY_ENTRY
Fixes simple typo, no behavioral change.

Cc: Maurice Ma <maurice.ma@intel.com>
Cc: Guo Dong <guo.dong@intel.com>
Cc: Benjamin You <benjamin.you@intel.com>
Signed-off-by: Moritz Fischer <moritzf@google.com>
Reviewed-by: Guo Dong <guo.dong@intel.com>
2021-10-19 03:48:42 +00:00
36b561623a OvmfPkg/AmdSev: update the fdf to use new workarea PCD
The commit 80e67af9af added support for the generic work area concept
used mainly by the encrypted VMs but missed update the AmdSev package.

Fixes: 80e67af9af ("OvmfPkg: introduce a common work area")
Cc: James Bottomley <jejb@linux.ibm.com>
Cc: Min Xu <min.m.xu@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Tom Lendacky <thomas.lendacky@amd.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Erdem Aktas <erdemaktas@google.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Reported-by: Dov Murik <dovmurik@linux.ibm.com>
Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Dov Murik <dovmurik@linux.ibm.com>
Tested-by: Dov Murik <dovmurik@linux.ibm.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
2021-10-19 01:36:52 +00:00
11a4af85a4 Ovmfpkg: update Ia32 build to use new work area
The commit 80e67af9af added support for the generic work area concept
used mainly by the encrypted VMs. In the past, the work area was
preliminary used by the SEV-ES VMs. The SEV-ES support is available for
the X64 builds only. But now, that work area header contains fields that
nonencrypted VMs and SEV VMs can use. They can be built for IA32. So,
moving the work area defines outside of X64.

Fixes: 80e67af9af ("OvmfPkg: introduce a common work area")
Cc: James Bottomley <jejb@linux.ibm.com>
Cc: Min Xu <min.m.xu@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Tom Lendacky <thomas.lendacky@amd.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Erdem Aktas <erdemaktas@google.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
2021-10-19 01:36:52 +00:00
2108698346 StandaloneMmPkg: Support CLANGPDB builds
Currently, the flag "-fpie" is passed for all builds with a GCC
family toolchain, including CLANGPDB. CLANGPDB however does not
support this flag as it generates PE/COFF files directly.

As the flag is mostly required for ARM-specific self-relocation, drop
it for other architectures and document the limitation to enable e.g.
X64 CLANGPDB builds of StandaloneMmCore.

Signed-off-by: Marvin Häuser <mhaeuser@posteo.de>
Acked-by: Shi Steven <steven.shi@intel.com>
2021-10-18 13:32:39 +00:00
f10a112f08 UefiPayloadPkg: Fix the build issue for coreboot
V2: Fix GCC build issue.
There is typo in previous change caused coreboot build failure.
This patch fixed the build issue.

Cc: Ray Ni <ray.ni@intel.com>
Cc: Maurice Ma <maurice.ma@intel.com>
Cc: Benjamin You <benjamin.you@intel.com>
Signed-off-by: Guo Dong <guo.dong@intel.com>
Reviewed-by: Maurice Ma <maurice.ma@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
2021-10-15 14:21:45 +00:00
7e43d3e086 ArmPkg/Smbios: Fix max cache size 2 wrong issue
As SMBIOS spec, bit-31 of maximum cache size 2 should be 1
for 64K granularity.

Signed-off-by: Ming Huang <huangming@linux.alibaba.com>
Reviewed-by: Rebecca Cran <rebecca@nuviainc.com>
Acked-by: Leif Lindholm <leif@nuviainc.com>
2021-10-15 10:47:50 +00:00
785cfd3305 UefiPayloadPkg: Use SECURITY_STUB_ENABLE to control the SecurityStubDxe
The SecurityStubDxe driver may be provided by platform payload.
In UefiPayloadPkg\UefiPayloadPkg.fdf file, SecurityStubDxe should only
be included if SECURITY_STUB_ENABLE is TRUE

Cc: Guo Dong <guo.dong@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Cc: Maurice Ma <maurice.ma@intel.com>
Cc: Benjamin You <benjamin.you@intel.com>

Signed-off-by: Zhiguang Liu <zhiguang.liu@intel.com>
2021-10-14 09:53:05 +00:00
f2400e06db BaseTools: add edk2-test repo to SetupGit.py
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3066

The SctPkg is managed in repository
https://github.com/tianocore/edk2-test.

Make SetupGit.py usable for this repository.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Yuwei Chen <yuwei.chen@intel.com>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
2021-10-14 08:25:50 +00:00
e0c23cba5e ArmVirtPkg/VirtioFdtDxe: Relocate VirtioFdtDxe to OvmfPkg/Fdt
Relocate VirtioFdtDxe to OvmfPkg/Fdt, this driver is leverage by
both ARM and RISC-V archs.

Signed-off-by: Abner Chang <abner.chang@hpe.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Sami Mujawar <sami.mujawar@arm.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Daniel Schaefer <daniel.schaefer@hpe.com>
Cc: Sunil V L <sunilvl@ventanamicro.com>
Reviewed-by: Daniel Schaefer <daniel.schaefer@hpe.com>
Reviewed-by: Sunil V L <sunilvl@ventanamicro.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Jiewen Yao <jiewen.yao@intel.com>
2021-10-14 06:25:52 +00:00
b21c6794de OvmfPkg/FdtPciHostBridgeLib: Add RISC-V in the supported arch.
Signed-off-by: Abner Chang <abner.chang@hpe.com>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Daniel Schaefer <daniel.schaefer@hpe.com>
Cc: Sunil V L <sunilvl@ventanamicro.com>
Reviewed-by: Daniel Schaefer <daniel.schaefer@hpe.com>
Reviewed-by: Sunil V L <sunilvl@ventanamicro.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Jiewen Yao <jiewen.yao@intel.com>
2021-10-14 06:25:52 +00:00
9a7509e465 ArmVirtPkg/FdtPciHostBridgeLib: Relocate FdtPciHostBridgeLib to OvmfPkg/Fdt
Relocate FdtPciHostBridgeLib to OvmfPkg/Fdt, this library is
leverage by both ARM and RISC-V archs. Also use
PcdPciMmio32Translation and PcdPciMmio64Translation
PCDs provided by MdePkg instead of ArmPkg.

Signed-off-by: Abner Chang <abner.chang@hpe.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Sami Mujawar <sami.mujawar@arm.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Daniel Schaefer <daniel.schaefer@hpe.com>
Cc: Sunil V L <sunilvl@ventanamicro.com>
Reviewed-by: Daniel Schaefer <daniel.schaefer@hpe.com>
Reviewed-by: Sunil V L <sunilvl@ventanamicro.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Jiewen Yao <jiewen.yao@intel.com>
2021-10-14 06:25:52 +00:00
c6770f4b88 MdePkg: Add PcdPciMmio32(64)Translation PCDs
PcdPciMmio32Translation and PcdPciMmio64Translation PCDs are added
to MdePkg as the common PCDs for ARM and RSIC-V archs.

The one under ArmPkg is removed in the next patch.

Signed-off-by: Abner Chang <abner.chang@hpe.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Sami Mujawar <sami.mujawar@arm.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Daniel Schaefer <daniel.schaefer@hpe.com>
Cc: Sunil V L <sunilvl@ventanamicro.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
Reviewed-by: Daniel Schaefer <daniel.schaefer@hpe.com>
Reviewed-by: Sunil V L <sunilvl@ventanamicro.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
2021-10-14 06:25:52 +00:00
26aa241d2f OvmfPkg/QemuFwCfgLibMmio: Add RISC-V arch support
Signed-off-by: Abner Chang <abner.chang@hpe.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Daniel Schaefer <daniel.schaefer@hpe.com>
Cc: Sunil V L <sunilvl@ventanamicro.com>
Reviewed-by: Daniel Schaefer <daniel.schaefer@hpe.com>
Reviewed-by: Sunil V L <sunilvl@ventanamicro.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Jiewen Yao <jiewen.yao@intel.com>
2021-10-14 06:25:52 +00:00
f8d0501ded ArmVirtPkg/QemuFwCfgLib: Relocate QemuFwCfgLib to OvmfPkg
Relocate QemuFwCfgLib to OvmfPkg/Library/QemuFwCfgLib and rename
it to QemuFwCfgLibMmio, this library is leverage by both ARM and
RISC-V archs.

Signed-off-by: Abner Chang <abner.chang@hpe.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Sami Mujawar <sami.mujawar@arm.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Daniel Schaefer <daniel.schaefer@hpe.com>
Cc: Sunil V L <sunilvl@ventanamicro.com>
Reviewed-by: Daniel Schaefer <daniel.schaefer@hpe.com>
Reviewed-by: Sunil V L <sunilvl@ventanamicro.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Jiewen Yao <jiewen.yao@intel.com>
2021-10-14 06:25:52 +00:00
47bd85e9f9 OvmfPkg/HighMemDxe: Add RISC-V in the supported arch.
Add RISC-V VM in the file header.
Add RISC-V to the supported arch.

Signed-off-by: Abner Chang <abner.chang@hpe.com>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Daniel Schaefer <daniel.schaefer@hpe.com>
Cc: Sunil V L <sunilvl@ventanamicro.com>
Reviewed-by: Daniel Schaefer <daniel.schaefer@hpe.com>
Reviewed-by: Sunil V L <sunilvl@ventanamicro.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Jiewen Yao <jiewen.yao@intel.com>
2021-10-14 06:25:52 +00:00
d881c6ddf5 ArmVirtPkg/HighMemDxe: Relocate HighMemDxe to OvmfPkg
Relocate HighMemDxe to OvmfPkg/Fdt, this library is leverage by
both ARM and RISC-V archs.

Signed-off-by: Abner Chang <abner.chang@hpe.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Sami Mujawar <sami.mujawar@arm.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Daniel Schaefer <daniel.schaefer@hpe.com>
Cc: Sunil V L <sunilvl@ventanamicro.com>
Reviewed-by: Daniel Schaefer <daniel.schaefer@hpe.com>
Reviewed-by: Sunil V L <sunilvl@ventanamicro.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
2021-10-14 06:25:52 +00:00
77e9b3a7c6 ArmVirtPkg/FdtPciPcdProducerLib: Relocate PciPcdProducerLib to OvmfPkg
Relocate PciPcdProducerLib to OvmfPkg/Fdt, this library is
leverage by both ARM and RISC-V archs.

Add OvmfPkg/Fdt maintainers in Maintainers.txt

Signed-off-by: Abner Chang <abner.chang@hpe.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Sami Mujawar <sami.mujawar@arm.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Daniel Schaefer <daniel.schaefer@hpe.com>
Cc: Sunil V L <sunilvl@ventanamicro.com>
Reviewed-by: Daniel Schaefer <daniel.schaefer@hpe.com>
Reviewed-by: Sunil V L <sunilvl@ventanamicro.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
2021-10-14 06:25:52 +00:00
7d78a86ecf ArmPkg: Use PcdPciIoTranslation PCD from MdePkg
PcdPciIoTranslation PCD is relocated to MdePkg and leveraged by
both ARM and RISC-V arch. This patch removes the one from ArmPkg
and address the corresponding changes required for other modules
under ArmVirtPkg.

Signed-off-by: Abner Chang <abner.chang@hpe.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Sami Mujawar <sami.mujawar@arm.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Daniel Schaefer <daniel.schaefer@hpe.com>
Cc: Sunil V L <sunilvl@ventanamicro.com>
Reviewed-by: Daniel Schaefer <daniel.schaefer@hpe.com>
Reviewed-by: Sunil V L <sunilvl@ventanamicro.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
2021-10-14 06:25:52 +00:00
fb759b8b73 MdePkg: Add PcdPciIoTranslation PCD
This PCD is moved from ArmPkg that is used to set the base address
of PCI MMIO window that provides I/O access. We relocate this PCD
because this PCD is common to ARM and RSIC-V arch.

Signed-off-by: Abner Chang <abner.chang@hpe.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Sami Mujawar <sami.mujawar@arm.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Daniel Schaefer <daniel.schaefer@hpe.com>
Cc: Sunil V L <sunilvl@ventanamicro.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
Reviewed-by: Daniel Schaefer <daniel.schaefer@hpe.com>
Reviewed-by: Sunil V L <sunilvl@ventanamicro.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
2021-10-14 06:25:52 +00:00
e40fefafa9 ArmVirtPkg/FdtClintDxe: Move FdtClientDxe to EmbeddedPkg
This is one of the series patches to restructure the location of modules under
ArmVirtPkg for RiscVVirtPkg. RiscVVirtPkg leverage FDT Client protocol to
parse FDT nodes.

Signed-off-by: Abner Chang <abner.chang@hpe.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Sami Mujawar <sami.mujawar@arm.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Daniel Schaefer <daniel.schaefer@hpe.com>
Cc: Sunil V L <sunilvl@ventanamicro.com>
Reviewed-by: Daniel Schaefer <daniel.schaefer@hpe.com>
Reviewed-by: Sunil V L <sunilvl@ventanamicro.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
2021-10-14 06:25:52 +00:00
a7fcab7aa3 MdeModulePkg/Core/Dxe: Acquire a lock when iterating gHandleList
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3680

This patch fixes the following issue:

The global variable gHandleList is a linked list.
This list is locked when a entry is added or removed from the list,
but there is no lock when iterating this list in function
CoreValidateHandle().
It can lead to "Handle.c (76): CR has Bad Signature" assertion if the
iterated entry in the list is just removed by other task during iterating.

Currently some caller functions of CoreValidateHandle() have
CoreAcquireProtocolLock(), but some caller functions of
CoreValidateHandle() do not CoreAcquireProtocolLock().
Add CoreAcquireProtocolLock() always when CoreValidateHandle() is called,
Also, A lock check is added in the CoreValidateHandle().

Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Dandan Bi <dandan.bi@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Signed-off-by: Hua Ma <hua.ma@intel.com>
Reviewed-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Jian J Wang <jian.j.wang@intel.com>
2021-10-14 03:27:20 +00:00
43b3840873 MdeModulePkg/Sd: Corrections for Extra.uni files
Add correct content to the 'SdDxeExtra.uni' file.
Include 'EmmcDxeExtra.uni' and 'SdDxeExtra.uni' files to their
appropriate INF files.

Signed-off-by: Konstantin Aladyshev <aladyshev22@gmail.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
2021-10-14 00:13:17 +00:00
978d428ec3 UefiPayloadPkg: Add PCI root bridge info hob support for SBL
Current UefiPayloadPkg can suport PCI root bridge info HOB
provided by bootloader. For UniversalPayload, bootloader can
directly provide this HOB for payload consumption. However,
for legacy UEFI payload, it is required to migrate the HOB
information from bootloader HOB space to UEFI payload HOB
space. This patch added the missing part for the bootloader
ParseLib in order to support both legacy and universal UEFI
payload.

This patch was tested on Slim Bootloader with latest UEFI
payload, and it worked as expected.

Cc: Ray Ni <ray.ni@intel.com>
Cc: Guo Dong <guo.dong@intel.com>
Cc: Benjamin You <benjamin.you@intel.com>
Signed-off-by: Maurice Ma <maurice.ma@intel.com>
Reviewed-by: Guo Dong <guo.dong@intel.com>
2021-10-13 23:03:50 +00:00
6ed6abd6c1 BaseTools: Change RealPath to AbsPath
Currently the realpath is used when parse modules, which shows the
path with a drive letter in build log. In Windows 'subst' comand is
used to associates a path with a drive letter, when use the mapped
drive letter for build, with realpath function the build log will
have different disk letter info which will cause confusion. In this
situation, if use adspath function to show the path info, it will keep
same letter with the mapped drive letter, which avoids confusion.
This patch modifies the realpath to abspath.

Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Signed-off-by: Yuwei Chen <yuwei.chen@intel.com>
Reviewed-by: Bob Feng <bob.c.feng@Intel.com>
2021-10-13 09:07:16 +00:00
4225a464c6 MdePkg/BaseLib: Add QuickSort function on BaseLib
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3675

Add QuickSort function into BaseLib

Reviewed-by: Ray Ni <ray.ni@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
Signed-off-by: IanX Kuo <ianx.kuo@intel.com>
2021-10-13 02:37:37 +00:00
f22feb0e3b CryptoPkg/BaseCryptLib: Eliminate extra buffer copy in Pkcs7Verify()
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3617

Create a read-only openSSL BIO wrapper for the existing input
buffer passed to Pkcs7Verify() instead of copying the buffer
into an empty writable BIO which causes memory allocations
within openSSL.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Xiaoyu Lu <xiaoyux.lu@intel.com>
Cc: Guomin Jiang <guomin.jiang@intel.com>
Signed-off-by: Bob Morgan <bobm@nvidia.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
2021-10-13 01:45:18 +00:00
ba4ae92234 ShellPkg: Support ProcessorUpgradeSocketLGA4677 from SMBIOS 3.5.0
The patch adds entry into QueryTable.c for ProcessorUpgradeSocketLGA4677
from SMBIOS 3.5.0.
It also adds entries into QueryTable.c for ProcessorUpgradeSocketLGA4189
and ProcessorUpgradeSocketLGA1200 from SMBIOS 3.4.0.

Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
2021-10-12 05:41:25 +00:00
782d018703 MdePkg: Add ProcessorUpgradeSocketLGA4677 from SMBIOS 3.5.0
This patch adds ProcessorUpgradeSocketLGA4677 definition into Smbios.h
from SMBIOS 3.5.0.
It also adds ProcessorUpgradeSocketLGA4189 and ProcessorUpgradeSocketLGA1200
definitions into from SMBIOS 3.4.0.

Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
2021-10-12 05:41:25 +00:00
19ee56c4b3 UefiPayloadPkg: Add a macro to select the SecurityStubDxe driver.
The SecurityStubDxe driver may be provided by platform payload.

Cc: Guo Dong <guo.dong@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Cc: Maurice Ma <maurice.ma@intel.com>
Cc: Benjamin You <benjamin.you@intel.com>

Signed-off-by: Zhiguang Liu <zhiguang.liu@intel.com>
2021-10-11 05:54:11 +00:00
769e63999f DynamicTablesPkg: SSDT CPU topology and LPI state generator
In the GIC interrupt model, logical processors are required to
have a Processor Device object in the DSDT and must convey each
processor's GIC information to the OS using the GICC structure.
Additionally, _LPI objects may be needed as they provide a method
to describe Low Power Idle states that defines the local power
states for each node in a hierarchical processor topology.

Therefore, add support to generate the CPU topology and the LPI
state information in an SSDT table.

Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
2021-10-08 15:39:42 +00:00
f17ef10e63 DynamicTablesPkg: Add CM_ARM_LPI_INFO object
Introduce the CM_ARM_LPI_INFO CmObj in the ArmNameSpaceObjects.
This allows to describe LPI state information, as described in
ACPI 6.4, s8.4.4.3 "_LPI (Low Power Idle States)".

Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
2021-10-08 15:39:42 +00:00
a5e36ad9bc DynamicTablesPkg: AML code generation to add an _LPI state
Add AmlAddLpiState() to generates AML code to add an _LPI state
to an _LPI object created using AmlCreateLpiNode().

AmlAddLpiState increments the count of LPI states in the LPI
node by one, and adds the following package:
  Package() {
    MinResidency,
    WorstCaseWakeLatency,
    Flags,
    ArchFlags,
    ResCntFreq,
    EnableParentState,
    (GenericRegisterDescriptor != NULL) ?           // Entry method. If a
      ResourceTemplate(GenericRegisterDescriptor) : // Register is given,
      Integer,                                      // use it. Use the
                                                    // Integer otherwise
    ResourceTemplate() {                            // NULL Residency
      Register (SystemMemory, 0, 0, 0, 0)           // Counter
    },
    ResourceTemplate() {                            // NULL Usage Counter
      Register (SystemMemory, 0, 0, 0, 0)
    },
    ""                                              // NULL State Name
  },

Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
2021-10-08 15:39:42 +00:00
018a962d92 DynamicTablesPkg: AML code generation for a _LPI object
_LPI object provides a method to describe Low Power Idle
states that define the local power states for each node
in a hierarchical processor topology.

Therefore, add AmlCreateLpiNode() to generate code for a
_LPI object.

AmlCreateLpiNode ("_LPI", 0, 1, ParentNode, &LpiNode) is
equivalent of the following ASL code:
  Name (_LPI, Package (
		0,  // Revision
		1,  // LevelId
		0   // Count
		))

Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
2021-10-08 15:39:42 +00:00
3e958e93ce DynamicTablesPkg: AML code generation for a Method returning a NS
Add AmlCodeGenMethodRetNameString() to generate AML code to create
a Method returning a NameString (NS).

AmlCodeGenMethodRetNameString (
  "MET0", "_CRS", 1, TRUE, 3, ParentNode, NewObjectNode
  );
is equivalent of the following ASL code:
Method(MET0, 1, Serialized, 3) {
  Return (_CRS)
}

Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
2021-10-08 15:39:42 +00:00
e2d7b4950b DynamicTablesPkg: AML code generation to Return a NameString
Add AmlCodeGenReturnNameString() to generate AML code for a
Return object node, returning the object as a NameString.

AmlCodeGenReturn ("NAM1", ParentNode, NewObjectNode) is
equivalent of the following ASL code:
  Return(NAM1)

Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
2021-10-08 15:39:42 +00:00
de62ccbf4f DynamicTablesPkg: AML code generation for a Method
Add AmlCodeGenMethod() to generate code for a control method.

AmlCodeGenMethod ("MET0", 1, TRUE, 3, ParentNode, NewObjectNode)
is equivalent of the following ASL code:
    Method(MET0, 1, Serialized, 3) {}

Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
2021-10-08 15:39:42 +00:00
ce15936f2f DynamicTablesPkg: AML code generation for a ResourceTemplate
ASL provides a ResourceTemplate macro that creates a Buffer in which
resource descriptor macros can be listed. The ResourceTemplate macro
automatically generates an End descriptor and calculates the checksum
for the resource template.

Therefore, add AmlCodeGenResourceTemplate() to generate AML code for
the ResourceTemplate() macro. This function generates a Buffer node
with an EndTag resource data descriptor, which is similar to the ASL
ResourceTemplate() macro.

Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
2021-10-08 15:39:42 +00:00
12e65fd258 DynamicTablesPkg: Helper function to compute package length
Some AML object have a PkgLen which indicates the size of the
AML object. The package length can be encoded in 1 to 4 bytes.
The bytes used to encode the PkgLen is itself counted in the
PkgLen value. So, if an AML object's size increments/decrements,
the number of bytes used to encode the PkgLen value can itself
increment/decrement.

Therefore, a helper function AmlComputePkgLength() is introduced
to simply computation of the PkgLen.

Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
2021-10-08 15:39:42 +00:00
1e33479b39 DynamicTablesPkg: AML code generation for a Package
Add AmlCodeGenPackage() to generate AML code for declaring
a Package() object. This function generates an empty package
node. New elements can then be added to the package's variable
argument list.

Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
2021-10-08 15:39:42 +00:00
9454d1ebcb DynamicTablesPkg: AML Code generation for Resource data EndTag
Add a helper function AmlCodeGenEndTag() to generate AML Resource Data
EndTag. The EndTag resource data is automatically generated by the ASL
compiler at the end of a list of resource data elements. Therefore, an
equivalent function is not present in ASL.

However, AmlCodeGenEndTag() is useful when generating AML code for the
ResourceTemplate() macro.

Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
2021-10-08 15:39:42 +00:00
f995f8672b DynamicTablesPkg: AML Code generation for Register()
Add AmlCodeGenRegister() to generate AML code for the
Generic Register Resource Descriptor. This function is
equivalent to the ASL macro Register().

Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
2021-10-08 15:39:42 +00:00
6d2777d85f DynamicTablesPkg: Make AmlNodeGetIntegerValue public
Remove the STATIC qualifier for the AmlUtility function
AmlNodeGetIntegerValue() and add the definition to the
header file so that it can be used by other AmlLib
sub-modules.

Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
2021-10-08 15:39:42 +00:00
37bd08176c DynamicTablesPkg: Update error handling for node creation
The node creation functions:
- AmlCreateRootNode()
- AmlCreateObjectNode()
- AmlCreateDataNode()
are now resetting the input pointer where the created node is stored.
Thus, it is not necessary to set some local variables to NULL or
check a node value before trying to delete it.

Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
2021-10-08 15:39:42 +00:00
2dd7dd3952 DynamicTablesPkg: Clear pointer in node creation fcts
The following functions:
- AmlCreateRootNode()
- AmlCreateObjectNode()
- AmlCreateDataNode()
create a node and return it by populating a pointer. This pointer
should only be considered/used if the function returns successfully.
Otherwise, the value stored in this pointer should be ignored.

For their error handling, some other functions assume that this
pointer is reset to NULL if an error occurs during a node creation.
To make this assumption correct, explicitly clear this input pointer.

Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
2021-10-08 15:39:42 +00:00
7b2022d39e DynamicTablesPkg: Set EndTag's Checksum if RdList is modified
ACPI 6.4, s6.4.2.9 "End Tag":
"This checksum is generated such that adding it to the sum of all the data
bytes will produce a zero sum."
"If the checksum field is zero, the resource data is treated as if the
checksum operation succeeded. Configuration proceeds normally."

To avoid re-computing checksums, if a new resource data elements is
added/removed/modified in a list of resource data elements, the AmlLib
resets the checksum to 0.

This patch also refactors the AmlAppendRdNode() function by getting the
last Resource Data node directly instead of iterating over all the
elements of the list of Resource Data node.

Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
2021-10-08 15:39:42 +00:00
74addfeab6 DynamicTablesPkg: Add AmlSetRdListCheckSum()
Lists of Resource Data elements end with an EndTag (most of the time).
This function finds the EndTag (if present) in a list of Resource Data
elements and sets the checksum.

ACPI 6.4, s6.4.2.9 "End Tag":
"This checksum is generated such that adding it to the sum of all the data
bytes will produce a zero sum."
"If the checksum field is zero, the resource data is treated as if the
checksum operation succeeded. Configuration proceeds normally."

Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
2021-10-08 15:39:42 +00:00
28b2df475f DynamicTablesPkg: Add AmlRdSetEndTagChecksum()
Add AmlRdSetEndTagChecksum(), setting the CheckSum value contained in a
Resource Data element.

ACPI 6.4, s6.4.2.9 "End Tag":
"This checksum is generated such that adding it to the sum of all the
data bytes will produce a zero sum."
"If the checksum field is zero, the resource data is treated as if the
checksum operation succeeded. Configuration proceeds normally."

Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
2021-10-08 15:39:42 +00:00
bfaf7c8b9e DynamicTablesPkg: Add AddSsdtAcpiHeader()
To fetch the Oem information from the ConfigurationManagerProtocol
and the AcpiTableInfo, and populate the SSDT ACPI header when
creating a RootNode via the AmlLib, create AddSsdtAcpiHeader().

Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
2021-10-08 15:39:42 +00:00
25cf58a163 DynamicTablesPkg: Add missing parameter check
Add missing check of 'AcpiTableInfo' in AddAcpiHeader().

Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
2021-10-08 15:39:42 +00:00
71c3c9c0c4 DynamicTablesPkg: Remove unnecessary includes
Some includes are not necessary. Remove them.

Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
2021-10-08 15:39:42 +00:00
30400318a2 ShellPkg: Update Acpiview HMAT parser to ACPI spec version 6.4
Add parser support for the new "MinTransferSize" field of the System
Locality, Latency and Bandwidth structure, introduced by the ACPI
specification version 6.4.

Also update the HMAT parser to use the newer ACPI version 6.4
definitions.

Signed-off-by: Chris Jones <christopher.jones@arm.com>
Reviewed-by: Zhichao Gao <zhcihao.gao@intel.com>
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
2021-10-08 15:16:21 +00:00
5ece2ad36c MdeModulePkg/Core/Dxe: Add lock protection in CoreLocateHandleBuffer()
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3666

Currently, CoreLocateHandleBuffer() follows three steps:
1) get the size of protocol database firstly
2) allocate the buffer based on the size
3) get the protocol database into the buffer
There is no lock protection for the whole three steps. If a new protocol
added in step 2) by other task, e.g. (event timer handle USB device
hotplug). The size of protocol database may be increased and cannot fit
into the previous buffer in step 3). The protocol database cannot be
returned successfully, EFI_BUFFER_TOO_SMALL error will be returned.

This patch adds the lock to protect the whole three steps.
It can make sure the correct protocol database be returned.

Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Dandan Bi <dandan.bi@intel.com>
Signed-off-by: Hua Ma <hua.ma@intel.com>
Reviewed-by: Dandan Bi dandan.bi@intel.com
Reviewed-by: Liming Gao gaoliming@byosoft.com.cn
2021-10-08 06:57:55 +00:00
b4da6c29f1 ShellPkg: Add Type 5 PCC Subspace Structure parser
Bugzilla: 3563 (https://bugzilla.tianocore.org/show_bug.cgi?id=3563)

Update the Acpiview PCCT parser with the HW Registers based
Communications Subspace Structure (Type 5) as defined in Section 14.1.7
of the ACPI 6.4 specification.

Signed-off-by: Chris Jones <christopher.jones@arm.com>
Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
Reviewed-by: Sami Mujawar <sami.mujawar <sami.mujawar@arm.com>
2021-10-06 11:20:48 +00:00
80e67bcb23 ShellPkg: Update Acpiview PCCT parser to ACPI 6.4
Bugzilla: 3563 (https://bugzilla.tianocore.org/show_bug.cgi?id=3563)

Update the Acpiview PCCT parser to use Acpi64.h.

Signed-off-by: Chris Jones <christopher.jones@arm.com>
Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
Reviewed-by: Sami Mujawar <sami.mujawar <sami.mujawar@arm.com>
2021-10-06 11:20:48 +00:00
942c9bd357 ShellPkg: Update Acpiview GTDT parser to ACPI 6.4
Bugzilla: 3565 (https://bugzilla.tianocore.org/show_bug.cgi?id=3565)

Update the Acpiview GTDT parser to use Acpi64.h and as such rename all
occurences of "SBSA Generic Watchdog" to "Arm Generic Watchdog".

Signed-off-by: Chris Jones <christopher.jones@arm.com>
Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
2021-10-05 16:04:44 +00:00
f09dbf20b9 DynamicTablesPkg: Rename SBSA generic watchdog
Buzilla: 3565 (https://bugzilla.tianocore.org/show_bug.cgi?id=3565)

As part of the updates to ACPI 6.4 the "SBSA Generic Watchdog" was
renamed to the "Arm Generic Watchdog". This patch implements that
change by updating the GTDT generator to use Acpi64.h and renames
any occurence of "SBSA Generic Watchdog" to "Arm Generic Watchdog".

Signed-off-by: Chris Jones <christopher.jones@arm.com>
Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
2021-10-05 16:04:44 +00:00
06a326caf1 DynamicTablesPkg: Update FADT generator to ACPI 6.4
Bugzilla: 3568 (https://bugzilla.tianocore.org/show_bug.cgi?id=3568)

Update the FADT generator to use Acpi64.h. As the FADT revision tracks
the ACPI revision this updates the minor revision value generated.

Mantis ID for change: https://mantis.uefi.org/mantis/view.php?id=2105

Signed-off-by: Chris Jones <christopher.jones@arm.com>
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
2021-10-05 15:26:40 +00:00
862e814de4 OvmfPkg/Microvm: add Maintainers.txt entry
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3599
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com>
Reviewed-by: Leif Lindholm <leif@nuviainc.com>
2021-10-05 10:55:39 +00:00
55f47d2299 OvmfPkg/Microvm: wire up serial console, drop super-io
Microvm has no LPC bridge, so drop the PciSioSerialDxe driver.
Use SerialDxe instead, with ioport hardcoded to 0x3f8 aka com1 aka ttyS0.

With this tianocore boots to uefi shell prompt on the serial console.
Direct kernel boot can be used too.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3599
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Jiewen Yao <Jiewen.yao@intel.com>
2021-10-05 10:55:39 +00:00
8456785986 OvmfPkg/Microvm: use PciHostBridgeLibNull
Shortcut PCI support for now (proper PCIe
support will be wired up later).

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3599
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Jiewen Yao <Jiewen.yao@intel.com>
2021-10-05 10:55:39 +00:00
2c467c9be2 OvmfPkg/Microvm: BdsPlatform: PciAcpiInitialization tweak.
Nothing to do here ;)

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3599
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Jiewen Yao <Jiewen.yao@intel.com>
2021-10-05 10:55:39 +00:00
1d3e89f349 OvmfPkg/ResetSystemLib: add driver for microvm
Uses the generic event device to reset and poweroff.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3599
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Jiewen Yao <Jiewen.yao@intel.com>
2021-10-05 10:55:39 +00:00
bf02d73e74 OvmfPkg/Microvm: PlatformPei/Platform: add id.
Add + set microvm id for PcdOvmfHostBridgePciDevId.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3599
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Jiewen Yao <Jiewen.yao@intel.com>
2021-10-05 10:55:39 +00:00
8583b57c5c OvmfPkg/Microvm: PlatformPei/Platform memory map tweaks
Microvm needs ioapic hobs only.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3599
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Jiewen Yao <Jiewen.yao@intel.com>
2021-10-05 10:55:39 +00:00
6a8e9ad24b OvmfPkg/Microvm: PlatformPei/MemDetect tweaks
Skip host bridge setup on microvm.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3599
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Jiewen Yao <Jiewen.yao@intel.com>
2021-10-05 10:55:39 +00:00
76602f45dc OvmfPkg/Microvm: use XenTimerDxe (lapic timer)
Microvm has no acpi timer, so go use XenTimerDxe
which uses the local apic instead.

Set PcdFSBClock to 1000 MHz, which is the lapic
timer frequency used by KVM.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3599
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Jiewen Yao <Jiewen.yao@intel.com>
2021-10-05 10:55:39 +00:00
27de86ae41 OvmfPkg/Microvm: use MdePkg/Library/SecPeiDxeTimerLibCpu
Microvm has no acpi timer, so use the generic lib instead.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3599
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Jiewen Yao <Jiewen.yao@intel.com>
2021-10-05 10:55:39 +00:00
b9dd64b80e OvmfPkg/Microvm: no emulated scsi
Microvm focus is virtio, so go drop support
for emulated scsi host adapters.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3599
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Jiewen Yao <Jiewen.yao@intel.com>
2021-10-05 10:55:39 +00:00
6073bf6cd8 OvmfPkg/Microvm: no csm
Guests depending on BIOS will probably not work that well with microvm
due to legacy hardware being not available.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3599
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Jiewen Yao <Jiewen.yao@intel.com>
2021-10-05 10:55:39 +00:00
06fa1f1931 OvmfPkg/Microvm: no sev
Microvm has no SEV support.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3599
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Jiewen Yao <Jiewen.yao@intel.com>
2021-10-05 10:55:39 +00:00
0569c52b15 OvmfPkg/Microvm: no tpm
Microvm has no TPM support.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3599
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
Acked-by: Jiewen Yao <Jiewen.yao@intel.com>
2021-10-05 10:55:39 +00:00
60d55c4156 OvmfPkg/Microvm: no secure boot
Without SMM secure boot isn't actually secure, so drop it too.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3599
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Jiewen Yao <Jiewen.yao@intel.com>
2021-10-05 10:55:39 +00:00
2a49c19b9e OvmfPkg/Microvm: no smm
Microvm has no SMM support.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3599
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Jiewen Yao <Jiewen.yao@intel.com>
2021-10-05 10:55:39 +00:00
4932f05a00 OvmfPkg/Microvm: rename output files, fix includes
Rename the firmware volume files (s/OVMF/MICROVM/).
Fix includes so they work with microvm config being in a subdirectory.
With this patch applied the build works.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3599
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Jiewen Yao <Jiewen.yao@intel.com>
2021-10-05 10:55:39 +00:00
606340fba3 OvmfPkg/Microvm: copy OvmfPkgX64 files as-is
Create Microvm subdirectory.  Copy OvmfPkgX64 .dsc and .fdf files
unmodified as starting point for MicrovmX64.

Changes come as separate patches, to simplify patch review and rebases.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3599
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Jiewen Yao <Jiewen.yao@intel.com>
2021-10-05 10:55:39 +00:00
c806b76865 ArmVirtPkg: Disable the TPM2 platform hierarchy
Disable the TPM2 platform hierarchy by directly calling
ConfigureTpmPlatformHierarchy().

Per the TCG firmware specification "TCG PC Client Platform Firmware Profile
Specification" the TPM 2 platform hierarchy needs to be disabled or a
random password set and discarded before the firmware passes control to the
next stage bootloader or kernel.

Current specs are here:
https://trustedcomputinggroup.org/wp-content/uploads/TCG_PCClient_PFP_r1p05_v23_pub.pdf

Section 11 states:
"Platform Firmware MUST protect access to the Platform Hierarchy
and prevent access to the platform hierarchy by non-manufacturer-
controlled components."

Link: https://bugzilla.tianocore.org/show_bug.cgi?id=3510
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Sami Mujawar <sami.mujawar@arm.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
2021-10-05 09:54:11 +00:00
b3685956d2 ArmVirtPkg: Reference new TPM classes in the build system for compilation
We just added the same functionality to the OvmfPkg. However, on x86, we
could use the notification mechanism around
gEfiDxeSmmReadyToLockProtocolGuid to indirectly invoke
ConfigureTpmPlatformHierarchy(). Since ARM does not have an SMM mode, we
have to use direct invocation of this function at the same place in
PlatformBootManagerBeforeConsole() as it is called on x86.

Link: https://bugzilla.tianocore.org/show_bug.cgi?id=3510
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Sami Mujawar <sami.mujawar@arm.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
2021-10-05 09:54:11 +00:00
282122ec5f ArmVirtPkg/TPM: Add a NULL implementation of TpmPlatformHierarchyLib
Add a NULL implementation of the library class TpmPlatformHierarchyLib.

Link: https://bugzilla.tianocore.org/show_bug.cgi?id=3510
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Sami Mujawar <sami.mujawar@arm.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
2021-10-05 09:54:11 +00:00
c49cb8f30e ArmPkg: SmbiosMiscDxe: Don't populate ExtendedBiosSize when size < 16MB
According to the SMBIOS specification, the ExtendedBiosSize field should
be zero when the BIOS size is less than 16MB:

"Size (n) where 64K * (n+1) is the size of the
physical device containing the BIOS, in
bytes.
FFh - size is 16MB or greater, see Extended
BIOS ROM Size for actual size."

Fix the code in MiscBiosVendorFunction.c to only populate the
ExtendedBiosSize field if the BIOS size is greater than 16MB.

Fix the code to correctly populate the ExtendedBiosSize field with the
unit bits set to MB if the size is between 16MB and 16GB.

Signed-off-by: Rebecca Cran <rebecca@nuviainc.com>
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
Acked-by: Nhi Pham <nhi@os.amperecomputing.com>
2021-10-05 09:25:52 +00:00
4cc1458dbe IntelFsp2Pkg: Adopt FSP 2.3 specification.
REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3674

Add ExtendedImageRevision in FSP_INFO_HEADER structure, also add
FSP_NON_VOLATILE_STORAGE_HOB2 header.

Cc: Maurice Ma <maurice.ma@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Signed-off-by: Chasel Chiu <chasel.chiu@intel.com>
Reviewed-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
2021-10-04 00:57:30 +00:00
22873f58c4 DynamicTablesPkg: Rework AmlResourceDataCodegen.c/h
Rework all the functions to to have a generic prototype:
 - First take take the resource data specific arguments.
   E.g.: for a Register(): the AddressSpace, BitWidth, ...
 - The penultimate parameter is a NameOpNode. The resource data
   created is appended to the ResourceTemplate() contained in the
   NameOpNode.
 - The last parameter is a pointer holding the created resource data.

A least one of the two last parameter must be provided. One of them can
be omitted. This generic interface allows to either:
 - Add the resource data to a NameOpNode. This is a common case for the
   Ssdt tables generator.
 - Get the created resource data and let the caller place it in an AML
   tree.

Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
2021-10-01 10:57:43 +00:00
691c5f7762 DynamicTablesPkg: Deprecate Crs specific methods in AmlLib
Some functions in the AmlLib have 'Crs' in their name and can only
be applied to '_CRS' AML objects. To re-use them on AML objects that
have different names:
 - Rename them and remove the '_CRS' name check.
 - Create aliases having of the 'Crs' function prototypes. These
   aliases are available when DISABLE_NEW_DEPRECATED_INTERFACES
   is not defined. They will be deprecated in a near future.

The deprecated functions are:
- AmlNameOpCrsGetFirstRdNode()
- AmlNameOpCrsGetNextRdNode()
- AmlCodeGenCrsAddRdInterrupt()

Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
2021-10-01 10:57:43 +00:00
7a8c037e9e DynamicTablesPkg: Update DynamicTablesPkg.ci.yaml
To prepare edk2 upstream CI for incoming modifications:
1- Disable the Ecc check 9005:
   "Only Doxygen commands '@bug', '@todo', [...], '@{', '@}'
   are allowed to mark the code Unknown doxygen command [...]"
2- Disable the Ecc check 8003 for the following keyword:
   "DISABLE_NEW_DEPRECATED_INTERFACES"
   Indeed, this error has been corrected on the latest version of
   BaseTools, but is still triggered when using the older python
   packages containing the BaseTools.
3- Add word exceptions for the cspell tool.

Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
2021-10-01 10:57:43 +00:00
235ff9fcd1 DynamicTablesPkg: Use %a formatter in AmlDbgPrint
The correct formatter to print a CHAR8 char in edk2 is '%a'.
Replace the '%s' formatters by '%a'.

Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
2021-10-01 10:57:43 +00:00
96e006b37e DynamicTablesPkg: Add Configuration Manager Object parser
The Platform information repository in the Configuration Manager
may be dynamically populated, for e.g. by a Hardware Information
Parser like FdtHwInfoParser. In such cases it is useful to trace
the CM objects that were populated by the parser.

Therefore, introduce helper functions that can parse and trace
the Configuration Manager Objects.

Reviewed-by: Joey Gouly <joey.gouly@arm.com>
Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
2021-10-01 10:57:43 +00:00
72ab552554 DynamicTablesPkg: Add AmlGetEisaIdFromString() to AcpiHelperLib
Add a function converting a 7 characters string to its UINT32
EISAID. The algorithm used to create the EISAID is described
in the ACPI 6.4 specification, s19.3.4 "ASL Macros".

Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
2021-10-01 10:57:43 +00:00
653113412f DynamicTablesPkg: Add HexFromAscii() to AcpiHelperLib
Add HexFromAscii(), converting an hexadecimal ascii char
to an integer.

Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
2021-10-01 10:57:43 +00:00
1ad5182500 DynamicTablesPkg: Rename single char input parameter
The Ecc tool forbids the usage of one char variable: Ecc error 8007:
"There should be no use of short (single character) variable names"

To follow this policy, rename this one letter parameter.

Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
2021-10-01 10:57:43 +00:00
20775950c6 DynamicTablesPkg: Update TableHelperLib.inf
Update the inf file version and BASE_NAME of the library.
Remove unused sections.

Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
2021-10-01 10:57:43 +00:00
0875443f7e DynamicTablesPkg: Extract AcpiHelperLib from TableHelperLib
The TableHelperLib contains helper functions. Some rely on
DynamicTablesPkg definitions (they use Configuration Manager objects).
Some others are more generic.

To allow using these generic functions without including
DynamicTablesPkg definitions, move them to a new AcpiHelperLib
library.

Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
2021-10-01 10:57:43 +00:00
422e5d2f7f UefiPayloadPkg: Remove asm code and sharing libraries
Remove asm code used for payload entry.
Use patchable PCD instead a fixed PCD PcdPayloadStackTop to avoid
potential conflict.

Based on the removal, use same HobLib regardless UNIVERSAL_PAYLOAD.
Use same PlatformHookLib regardless UNIVERSAL_PAYLOAD. The original
PlatformHookLib was removed and UniversalPayloadPlatformHookLib was
rename to new PlatformHookLib.

Cc: Ray Ni <ray.ni@intel.com>
Cc: Maurice Ma <maurice.ma@intel.com>
Cc: Benjamin You <benjamin.you@intel.com>
Signed-off-by: Guo Dong <guo.dong@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
2021-09-30 16:26:14 +00:00
2273799677 SecurityPkg: Fix SecureBootDefaultKeysDxe failed to start
The dbt and dbx keys are optional, the driver entry should return
EFI_SUCCESS to start if they are not found in the firmware flash. This
patch is to fix it and update the description of retval as well.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Grzegorz Bernacki <gjb@semihalf.com>
Signed-off-by: Nhi Pham <nhi@os.amperecomputing.com>
Reviewed-by: Grzegorz Bernacki <gjb@semihalf.com>
Acked-by: Jiewen Yao <jiewen.yao@intel.com>
2021-09-30 14:56:56 +00:00
9e950cda6a MdeModulePkg: CI YAML: Added new GUID to ignore duplicate list
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3629

SMM Communication PPI GUID from MdeModulePkg is defined the same as MM
Communication PPI GUID from MdePkg, according to PI Spec v1.5 and onward.

After introduction of MM Communication PPI definitions, an update in the
ignore duplicate list is needed to avoid breaking CI build.

Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>

Signed-off-by: Kun Qin <kuqin12@gmail.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
2021-09-30 01:47:50 +00:00
8b4bb94f64 MdePkg: CI YAML: Added new GUID to ignore duplicate list
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3629

SMM Communication PPI GUID from MdeModulePkg is defined the same as MM
Communication PPI GUID from MdePkg, according to PI Spec v1.5 and onward.

After introduction of MM Communication PPI definitions, an update in the
ignore duplicate list is needed to avoid breaking CI build.

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>

Signed-off-by: Kun Qin <kuqin12@gmail.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
2021-09-30 01:47:50 +00:00
f86de75862 MdePkg: MmCommunication: Added definition of MM Communication PPI
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3629

MM Communication PPI was defined in PI Specification since v1.5. This
change added definition of such PPI and related GUIDs into MdePkg.

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
Cc: Sean Brogan <sean.brogan@microsoft.com>

Signed-off-by: Kun Qin <kuqin12@gmail.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
2021-09-30 01:47:50 +00:00
bd298d7593 OvmfPkg: Reference new Tcg2PlatformPei in the build system
Compile the Tcg2PlatformPei related code now to support TPM 2 platform
hierachy disablement if the TPM state cannot be resumed upon S3 resume.

Cc: Rebecca Cran <rebecca@bsdio.com>
Cc: Peter Grehan <grehan@freebsd.org>
Cc: Brijesh Singh <brijesh.singh@amd.com>
Cc: Erdem Aktas <erdemaktas@google.com>
Cc: James Bottomley <jejb@linux.ibm.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Min Xu <min.m.xu@intel.com>
Cc: Tom Lendacky <thomas.lendacky@amd.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com>
2021-09-30 00:00:08 +00:00
8ab8fbc016 OvmfPkg: Reference new Tcg2PlatformDxe in the build system for compilation
Compile the Tcg2PlatformDxe related code now.

Cc: Rebecca Cran <rebecca@bsdio.com>
Cc: Peter Grehan <grehan@freebsd.org>
Cc: Brijesh Singh <brijesh.singh@amd.com>
Cc: Erdem Aktas <erdemaktas@google.com>
Cc: James Bottomley <jejb@linux.ibm.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Min Xu <min.m.xu@intel.com>
Cc: Tom Lendacky <thomas.lendacky@amd.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com>
2021-09-30 00:00:08 +00:00
b8675deaa8 OvmfPkg: Handle TPM 2 physical presence opcodes much earlier
Handle the TPM 2 physical presence interface (PPI) opcodes in
PlatformBootManagerBeforeConsole() before the TPM 2 platform hierarchy
is disabled. Since the handling of the PPI opcodes may require inter-
action with the user, initialize the keyboard before handling PPI codes.

Cc: Rebecca Cran <rebecca@bsdio.com>
Cc: Peter Grehan <grehan@freebsd.org>
Cc: Brijesh Singh <brijesh.singh@amd.com>
Cc: Erdem Aktas <erdemaktas@google.com>
Cc: James Bottomley <jejb@linux.ibm.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Min Xu <min.m.xu@intel.com>
Cc: Tom Lendacky <thomas.lendacky@amd.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com>
2021-09-30 00:00:08 +00:00
499c4608b1 OvmfPkg/TPM PPI: Connect default consoles for user interaction
Activate the default console when user interaction is required for
the processing of TPM 2 physical presence interface opcodes.

Background:
TPM 2 physical presence interface (PPI) opcodes need to be handled before
the TPM 2 platform hierarchy is disabled. Due to this requirement we will
move the function call to handle the PPI opcodes into
PlatformBootManagerBeforeConsole() which runs before the initialization
of the consoles. However, since for interaction with the user we need
the console to be available, activate it now before displaying any message
to the user.

Cc: Rebecca Cran <rebecca@bsdio.com>
Cc: Peter Grehan <grehan@freebsd.org>
Cc: Brijesh Singh <brijesh.singh@amd.com>
Cc: Erdem Aktas <erdemaktas@google.com>
Cc: James Bottomley <jejb@linux.ibm.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Min Xu <min.m.xu@intel.com>
Cc: Tom Lendacky <thomas.lendacky@amd.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com>
2021-09-30 00:00:08 +00:00
442e46d3b6 UefiPayloadPkg: Update maximum logic processor to 256
Signed-off-by: Cheng-Chieh Huang <chengchieh@google.com>
Reviewed-by: Guo Dong <guo.dong@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Cc: Cheng-Chieh Huang <chengchieh@google.com>
Cc: Daniel Schaefer <daniel.schaefer@hpe.com>
Cc: Trammell Hudson <hudson@trmm.net>
Cc: Maurice Ma <maurice.ma@intel.com>
Cc: Guo Dong <guo.dong@intel.com>
Cc: Benjamin You <benjamin.you@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
2021-09-29 17:55:08 +00:00
c7d5b046d9 BaseTools: Remove hard-coded strings for target and tools_def
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3653

The "target.txt" and "tools_def.txt" filenames are hard-coded
at some places when global definitions are available at:
BaseTools/Source/Python/Common/TargetTxtClassObject.py:
DefaultTargetTxtFile
and
BaseTools/Source/Python/Common/ToolDefClassObject.py:
DefaultToolsDefFile

Use these global definitions instead.

Also remove the unused gBuildConfiguration and gToolsDefinition
variables from build.py

Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
Reviewed-by: Chris Jones <christopher.jones@arm.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
2021-09-29 14:31:37 +00:00
445c39f757 BaseTools: Remove Makefile/MakefileName fields
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3653

The Makefile and MakefilName fields are never set/used. Remove them.
To check this, the following commands can be used:
- grep -rIn "\.Makefile"
- grep -rIn "\.MakefileName"

Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
Reviewed-by: Chris Jones <christopher.jones@arm.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
2021-09-29 14:31:37 +00:00
259c184c8f BaseTools/build: Set MakefileName
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3653

Running the following command:
  python3 build/build.py -a AARCH64 -t GCC5
  -p ArmPlatformPkg/ArmPlatformPkg.dsc -b DEBUG libraries
triggers the following error:
  make: *** Build/ArmPlatform/DEBUG_GCC5/AARCH64/MdePkg/Library/
  BasePcdLibNull/BasePcdLibNull: Is a directory.  Stop.

Indeed, MakefileName is set to en empty string. Setting MakefileName
resolves the error.

Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
Reviewed-by: Chris Jones <christopher.jones@arm.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
2021-09-29 14:31:37 +00:00
c214128a38 BaseTools/GenMake: Use ToolDefinition as fallback option
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3653

Use the value set in tools_def.txt when the makefile type is
not explicitly set via BuildOption. This allows to have a
valid default makefile name instead of an empty string.

Also use GMAKE_FILETYPE instead of hard-coded "gmake".

Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
Reviewed-by: Chris Jones <christopher.jones@arm.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
2021-09-29 14:31:37 +00:00
1ce6ceb75b BaseTools: Switch to downloading the AARCH64 compiler from Arm's site
Linaro no longer do gcc releases - they're done by Arm now.

Update gcc_aarch64_linux_ext_dep.yaml to fetch the latest AARCH64 gcc
release (10.3-2021.07) from their site and fix LinuxGcc5ToolChain.py with the
new GCC_AARCH64_PREFIX.

Signed-off-by: Rebecca Cran <rebecca@bsdio.com>
Acked-by: Leif Lindholm <leif@nuviainc.com>
Acked-by: Liming Gao <gaoliming@byosoft.com.cn>
Acked-by: Ard Biesheuvel <ardb@kernel.org>
Reviewed-by: Pierre Gondois <Pierre.Gondois@arm.com>
Acked-by: Bob Feng <bob.c.feng@intel.com>
2021-09-29 11:41:36 +00:00
2ea0a0a414 BaseTools: Switch to downloading the ARM compiler from Arm's site
Linaro no longer do gcc releases - they're done by Arm now.
Update gcc_arm_linux_ext_dep.yaml to fetch the latest ARM gcc release
(10.3-2021.07) from their site and fix LinuxGcc5ToolChain.py with the
new GCC_ARM_PREFIX.

Signed-off-by: Rebecca Cran <rebecca@bsdio.com>
Acked-by: Leif Lindholm <leif@nuviainc.com>
Acked-by: Liming Gao <gaoliming@byosoft.com.cn>
Acked-by: Ard Biesheuvel <ardb@kernel.org>
Reviewed-by: Pierre Gondois <Pierre.Gondois@arm.com>
Acked-by: Bob Feng <bob.c.feng@intel.com>
2021-09-29 11:41:36 +00:00
4a1899dd79 UefiPayloadPkg: Add ".upld_info" in universal payload
V2: Use LittleEndianStructure by review comment.

From the universal scalable firmware payload requirement V0.75,
Payload must have Universal Payload Information Section ".upld_info"
So update the build tool to add this section.

Cc: Ray Ni <ray.ni@intel.com>
Cc: Maurice Ma <maurice.ma@intel.com>
Cc: Benjamin You <benjamin.you@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Signed-off-by: Guo Dong <guo.dong@intel.com>
2021-09-29 05:39:09 +00:00
dc430ccf3f UefiPayloadPkg: Use dummy constructor for PlatformHookLib
The Library constructor is only used for library dependency.
So use a dummy function to make it clear instead of using an
actual function.

Cc: Ray Ni <ray.ni@intel.com>
Cc: Maurice Ma <maurice.ma@intel.com>
Cc: Benjamin You <benjamin.you@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Signed-off-by: Guo Dong <guo.dong@intel.com>
2021-09-29 05:08:50 +00:00
cc5a67269e UefiPayloadPkg: Build a HOB from bootloader ACPI table
V2: Update BuildHobFromAcpi() to return a HOB pointer.

For universal UEFI payload, build a HOB from the ACPI table, so that
other modules could use this info from HOB at very early DXE phase.
This code are shared by universal payload and non universal payload.

Cc: Ray Ni <ray.ni@intel.com>
Cc: Maurice Ma <maurice.ma@intel.com>
Cc: Benjamin You <benjamin.you@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Signed-off-by: Guo Dong <guo.dong@intel.com>
2021-09-29 04:41:08 +00:00
b0f1b1c5fd MdePkg: Fix DEVICE_SECURITY_EVENT_DATA_HEADER version definition
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3646

According to latest TCG PFP spec 1.05 revision 23,
(https://trustedcomputinggroup.org/resource/pc-client-specific
-platform-firmware-profile-specification/),
10.2.7 DEVICE_SECURITY_EVENT_DATA Structure,
the version should be 1.

Signed-off-by: yi1 li <yi1.li@intel.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
2021-09-29 02:36:31 +00:00
f57040b038 MdeModulePkg/BootManagerMenuApp: Limit string drawing within one line
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3590

Limit the draw box always within the screen's column and row.
Limit the string drawing within one line.
For the incompleted string the last 3 characters in one line would
be replaced with "...".

Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Ray Ni <ray.ni@intel.com>
Signed-off-by: Zhichao Gao <zhichao.gao@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
2021-09-29 09:38:58 +08:00
46b4606ba2 MdeModulePkg/PciBusDxe: Improve the flow of testing support attributes
https://bugzilla.tianocore.org/show_bug.cgi?id=3635

Currently, in order to test the supported attributes,
the PciTestSupportedAttribute() will set the command register
to 0x27 (EFI_PCI_COMMAND_IO_SPACE, EFI_PCI_COMMAND_MEMORY_SPACE,
EFI_PCI_COMMAND_BUS_MASTER, EFI_PCI_COMMAND_VGA_PALETTE_SNOOP) firstly,
and then read back to check whether these attributes are
set successfully in the device.
This will cause the other enabled bits
 (other than EFI_PCI_COMMAND_IO_SPACE,EFI_PCI_COMMAND_MEMORY_SPACE,
 EFI_PCI_COMMAND_BUS_MASTER,EFI_PCI_COMMAND_VGA_PALETTE_SNOOP)
 be cleared for a short of time
 This patch fixes this issue by keeping the origina
 enabled bits when setting 0x27.

Signed-off-by: xueshengfeng <xueshengfeng@byosoft.com.cn>
Reviewed-by: Ray <ray.ni@intel.com>
2021-09-26 02:43:46 +00:00
d60915b751 UefiPayloadPkg: Add Macro to enable or disable some drivers.
Add Macro to enable or disable RamDiskDxe and SioBusDxe drivers.

Cc: Guo Dong <guo.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Maurice Ma <maurice.ma@intel.com>
Cc: Benjamin You <benjamin.you@intel.com>
Reviewed-by: Maurice Ma <maurice.ma@intel.com>
Signed-off-by: Zhiguang Liu <zhiguang.liu@intel.com>
2021-09-24 00:22:22 +00:00
7ea7f9c077 EmbeddedPkg: Add LoadFile2 for linux initrd
Add support under a pcd feature for using the new interface to pass
initrd to the linux kernel instead of via device tree.
This feature is also enabled if ACPI tables are present, and will skip
locating and installation of device tree.

Signed-off-by: Jeff Brasen <jbrasen@nvidia.com>
Reviewed-by: Leif Lindholm <leif@nuviainc.com>
2021-09-23 18:36:39 +00:00
c0cd26f43c EmbeddedPkg: Install FDT if UpdateDtb is not present
Currently if mAndroidBootImg->UpdateDtb is not supported on the platform
the device tree updates of the initrd are not made.

Signed-off-by: Jeff Brasen <jbrasen@nvidia.com>
Reviewed-by: Leif Lindholm <leif@nuviainc.com>
2021-09-23 18:36:39 +00:00
f2a7e24e38 EmbeddedPkg: AndroidBootImgBoot error handling updates
Update AndroidBootImgBoot to use a single return point
Make sure Kernel args are freed and Image is unloaded.

Signed-off-by: Jeff Brasen <jbrasen@nvidia.com>
Reviewed-by: Leif Lindholm <leif@nuviainc.com>
2021-09-23 18:36:39 +00:00
fdeff3fdae EmbeddedPkg: Remove duplicate libfdt.h include
Remove duplicate libfdt.h include statement in AndroidBootImgLib

Signed-off-by: Jeff Brasen <jbrasen@nvidia.com>
Reviewed-by: Leif Lindholm <leif@nuviainc.com>
2021-09-23 18:36:39 +00:00
79019c7a42 OvmfPkg: set a default value for the WorkAreaHeader PCD
SEC checks in IsSevGuest if the PCD defined WorkAreaHeader size
matches the size of the WorkAreaHeader struct definition. Set a
default value for the PCD to avoid unnecessary DSC/FDF file
changes in all OVMF DSC/FDF files.

Signed-off-by: Corvin Köhne <c.koehne@beckhoff.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
2021-09-22 09:34:24 +00:00
f334c5a41d IntelFsp2WrapperPkg: Make PcdFspModeSelection dynamic
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3632

PcdFspModeSelection will be used to set FSP mode.
Make PcdFspModeSelection dynamic and set it accordingly.

Signed-off-by: Zhang Xiaoqiang <xiaoqiang.zhang@intel.com>
Cc: Chasel Chiu <chasel.chiu@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Reviewed-by: Chasel Chiu <chasel.chiu@intel.com>
2021-09-22 08:37:09 +00:00
542cba73d2 SecurityPkg: Add debug log for indicating IBB verified OBB successfully
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3615

Debug message should be added for indicating IBB is successfully verifying
the OBB.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Min M Xu <min.m.xu@intel.com>
Cc: Qi Zhang <qi1.zhang@intel.com>
Signed-off-by: Longlong Yang <longlong.yang@intel.com>
Reviewed-by: Min M Xu <min.m.xu@intel.com>
Reviewed-by: Jian J Wang <jian.j.wang@intel.com>
2021-09-18 08:57:46 +00:00
e3e47d7963 UefiCpuPkg: SecCoreNative without ResetVector
REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3492

Currently SecCore.inf having the resetvector code under IA32. if the
user wants to use both SecCore and UefiCpuPkg ResetVector it's not
possible, since SecCore and ResetVector(VTF0.INF/ResetVector.inf)
are sharing the same GUID which is BFV. to overcome this issue we can
create the Duplicate version of the SecCore.inf as SecCoreNative.inf
which contains pure SecCore Native functionality without resetvector.
SecCoreNative.inf should have the Unique GUID so that it can be used
along with UefiCpuPkg ResetVector in there implementation.

Reviewed-by: Ray Ni <ray.ni@intel.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
Cc: Debkumar De <debkumar.de@intel.com>
Cc: Harry Han <harry.han@intel.com>
Cc: Catharine West <catharine.west@intel.com>
Cc: Digant H Solanki <digant.h.solanki@intel.com>
Cc: Sangeetha V <sangeetha.v@intel.com>

Signed-off-by: Ashraf Ali S <ashraf.ali.s@intel.com>
2021-09-18 08:22:52 +00:00
ac6388add4 ArmPkg/ProcessorSubClassDxe: Fix the format of ProcessorId
According to SMBIOS 3.4, section 7.5.3.3 ARM64-class CPUs, if
SMCCC_ARCH_SOC_ID is supported, the first DWORD is the JEP-106 code and
the second DWORD is the SoC revision value. But in the current
implementation, they are set in reverse. This patch is to correct it.

Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Rebecca Cran <rebecca@nuviainc.com>
Signed-off-by: Nhi Pham <nhi@os.amperecomputing.com>
Reviewed-by: Rebecca Cran <rebecca@nuviainc.com>
Acked-by: Leif Lindholm <leif@nuviainc.com>
2021-09-16 14:45:48 +00:00
60d8bb9f28 UefiCpuPkg: VTF0 Linear-Address Translation to a 1-GByte Page till 512GB
REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3473

X64 Reset Vector Code can access the memory range till 4GB using the
Linear-Address Translation to a 2-MByte Page, when user wants to use
more than 4G using 2M Page it will leads to use more number of Page
table entries. using the 1-GByte Page table user can use more than
4G Memory by reducing the page table entries using 1-GByte Page,
this patch attached can access memory range till 512GByte via Linear-
Address Translation to a 1-GByte Page.

Build Tool: if the nasm is not found it will throw Build errors like
FileNotFoundError: [WinError 2]The system cannot find the file specified
run the command wil try except block to get meaningful error message

Test Result: Tested in both Simulation environment and Hardware
both works fine without any issues.

Reviewed-by: Ray Ni <ray.ni@intel.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
Cc: Debkumar De <debkumar.de@intel.com>
Cc: Harry Han <harry.han@intel.com>
Cc: Catharine West <catharine.west@intel.com>
Cc: Sangeetha V <sangeetha.v@intel.com>
Cc: Rangasai V Chaganty <rangasai.v.chaganty@intel.com>
Cc: Sahil Dureja <sahil.dureja@intel.com>
Signed-off-by: Ashraf Ali S <ashraf.ali.s@intel.com>
2021-09-16 14:18:27 +00:00
89f7ed8b29 UefiCpuPkg: Prevent from re-initializing CPU features during S3 resume
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3621
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3631

Current CPU feature initialization design:
During normal boot, CpuFeaturesPei module (inside FSP) initializes the
CPU features. During S3 boot, CpuFeaturesPei module does nothing, and
CpuSmm driver (in SMRAM) initializes CPU features instead.

This code change prevents CpuSmm driver from re-initializing CPU
features during S3 resume if CpuFeaturesPei module has done the same
initialization.

In addition, EDK2 contains DxeIpl PEIM that calls S3RestoreConfig2 PPI
during S3 boot and this PPI eventually calls CpuSmm driver (in SMRAM) to
initialize the CPU features, so "EDK2 + FSP" does not have the CPU
feature initialization issue during S3 boot. But "coreboot" does not
contain DxeIpl PEIM and the issue appears, unless
"PcdCpuFeaturesInitOnS3Resume" is set to TRUE.

Signed-off-by: Jason Lou <yun.lou@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
2021-09-16 12:50:06 +00:00
010753b7e7 UefiCpuPkg: Refactor initialization of CPU features during S3 resume
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3621
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3631

Refactor initialization of CPU features during S3 resume.

In addition, the macro ACPI_CPU_DATA_STRUCTURE_UPDATE is used to fix
incompatibility issue caused by ACPI_CPU_DATA structure update. It will
be removed after all the platform code uses new ACPI_CPU_DATA structure.

Signed-off-by: Jason Lou <yun.lou@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
2021-09-16 12:50:06 +00:00
bda3546c55 UefiPayloadPkg: Fix the warning when building UefiPayloadPkg with IA32+X64
REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3603

Move the unspecified PCDs from .common section. to .X64 section in .dsc file.
The corresponding PCDs are not used in IA32.

Cc: Guo Dong <guo.dong@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Cc: Maurice Ma <maurice.ma@intel.com>
Cc: Benjamin You <benjamin.you@intel.com>

Signed-off-by: Dun Tan <dun.tan@intel.com>
2021-09-16 10:23:29 +00:00
f4e72cf9d6 UefiPayloadPkg: Add script to build UniversalPayload in UefiPayloadPkg
V1: Add script to build UniversalPayload, which can be used after edksetup rebuild
The final UPL.elf will be located at root folder of edk2

V2: Revise the ouput directory of generated files and coding style in the script

Cc: Guo Dong <guo.dong@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Cc: Maurice Ma <maurice.ma@intel.com>
Cc: Benjamin You <benjamin.you@intel.com>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
Cc: Bob Feng <bob.c.feng@intel.com>
Signed-off-by: Dun Tan <dun.tan@intel.com>
2021-09-16 09:37:39 +00:00
c19d18136e MdeModulePkg/Core/Pei: Fix pointer size mismatch in EvacuateTempRam()
REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3512

In 32-bit PEI, the local variable pointers MigratedFvHeader and
RawDataFvHeader in EvacuateTempRam() will be 32-bit in size. The
pointers are currently passed to PeiServicesAllocatePages() which
expects a 64-bit output buffer of type EFI_PHYSICAL_ADDRESS.

When PeiServicesAllocatePages() writes to the buffer, the data
can overflow.

Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Dandan Bi <dandan.bi@intel.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
2021-09-16 01:51:36 +00:00
6f501a7c9b MdeModulePkg/Core/Pei: Make migrated PEIM message verbose
Currently, the debug message that prints the name of a PEIM
being migrated is DEBUG_INFO while similar messages are
DEBUG_VERBOSE. This change updates the print level to
DEBUG_VERBOSE for consistency.

Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Dandan Bi <dandan.bi@intel.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
2021-09-16 01:51:36 +00:00
6c80564b89 MdeModulePkg/Core/Pei: Fix typo in function descriptions
Corrects a typo in the return value description of MigratePeim() and
EvacuateTempRam():
  "Succesfully" to "Successfully"

Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Dandan Bi <dandan.bi@intel.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
2021-09-16 01:51:36 +00:00
3b69fcf5f8 SecurityPkg: Add references to header and inf files to SecurityPkg
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
2021-09-13 16:53:14 +00:00
2fa89c8e11 SecurityPkg/Tcg: Make Tcg2PlatformPei buildable and fix style issues
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
2021-09-13 16:53:14 +00:00
a4867dea2a SecurityPkg/Tcg: Import Tcg2PlatformPei from edk2-platforms
Import Tcg2PlatformPei from edk2-platforms without any modifications.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
2021-09-13 16:53:14 +00:00
f108178c56 SecurityPkg: Introduce new PCD PcdRandomizePlatformHierarchy
Introduce the new PCD
gEfiSecurityPkgTokenSpaceGuid.PcdRandomizePlatformHierarchy.
We need it for TpmPlatformHierarchyLib.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
2021-09-13 16:53:14 +00:00
2906e572c6 SecurityPkg/Tcg: Make Tcg2PlatformDxe buildable and fix style issues
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
2021-09-13 16:53:14 +00:00
ebbc8ab2cd SecrutiyPkg/Tcg: Import Tcg2PlatformDxe from edk2-platforms
Import Tcg2PlatformDxe from edk2-platforms without any modifications.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
2021-09-13 16:53:14 +00:00
4d5f39cd22 SecurityPkg/TPM: Fix bugs in imported PeiDxeTpmPlatformHierarchyLib
Fix some bugs in the original PeiDxeTpmPlatformHierarchyLib.c.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
2021-09-13 16:53:14 +00:00
610d8073f2 SecurityPkg/TPM: Import PeiDxeTpmPlatformHierarchyLib.c from edk2-platforms
Import PeiDxeTpmPlatformHierarchyLib from edk2-platforms without any
modifications.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2021-09-13 16:53:14 +00:00
dcd3d63f4f UefiPayloadPkg: Dump hob info from gEdkiiBootManagerMenuFileGuid
V1: Dump this hob infomation from gEdkiiBootManagerMenuFileGuid
V2: Delete the duplicated assertions
V3: Add input parameter in Comment

Cc: Guo Dong <guo.dong@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Cc: Maurice Ma <maurice.ma@intel.com>
Cc: Benjamin You <benjamin.you@intel.com>
Reviewed-by: Zhiguang Liu <zhiguang.liu@intel.com>
Signed-off-by: Dun Tan <dun.tan@intel.com>
2021-09-10 09:05:45 +00:00
d96df7e993 UefiPayloadPkg: Fix the bug in dump guid HOB info functions
The input HobLength of PrintHandler should be data size instead of whole length of HOB

Cc: Guo Dong <guo.dong@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Cc: Maurice Ma <maurice.ma@intel.com>
Cc: Benjamin You <benjamin.you@intel.com>
Reviewed-by: Zhiguang Liu <zhiguang.liu@intel.com>
Signed-off-by: Dun Tan <dun.tan@intel.com>
2021-09-10 09:05:45 +00:00
cf7c650592 UefiCpuPkg: ResetVector Tool additional debug prints
REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3506

Before executing the nasm command, added print statement to know what
commands are executing.
before printing the output file need check the status of command which
is executed. if the status is 0 then only print the output file name.

Reviewed-by: Ray Ni <ray.ni@intel.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
Cc: Debkumar De <debkumar.de@intel.com>
Cc: Harry Han <harry.han@intel.com>
Cc: Catharine West <catharine.west@intel.com>
Cc: Sangeetha V <sangeetha.v@intel.com>
Signed-off-by: Ashraf Ali S <ashraf.ali.s@intel.com>
2021-09-09 13:16:48 +00:00
6c7d6d4a5e UefiCpuPkg: ResetVector Tool Support for Python 3
REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3506

Build Scrips for Reset Vector currently based on Python 2
which is already EOL, needs to modify the build script based on
Python 3

Reviewed-by: Ray Ni <ray.ni@intel.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
Cc: Debkumar De <debkumar.de@intel.com>
Cc: Harry Han <harry.han@intel.com>
Cc: Catharine West <catharine.west@intel.com>
Cc: Sangeetha V <sangeetha.v@intel.com>

Signed-off-by: Ashraf Ali S <ashraf.ali.s@intel.com>
2021-09-09 13:16:48 +00:00
d248516b3a UefiPayloadPkg: Include Network modules in UefiPayloadPkg.
Include Network modules in UefiPayloadPkg.dsc and UefiPayloadPkg.fdf

Cc: Guo Dong <guo.dong@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Cc: Maurice Ma <maurice.ma@intel.com>
Cc: Benjamin You <benjamin.you@intel.com>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
Signed-off-by: Sravanthi <k.kavyax.sravanthi@intel.com>
2021-09-09 12:53:08 +00:00
851785ea67 UefiPayloadPkg: Include more modules in UefiPayloadPkg.
Include core modules in UefiPayloadPkg.dsc and UefiPayloadPkg.fdf

Cc: Guo Dong <guo.dong@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Cc: Maurice Ma <maurice.ma@intel.com>
Cc: Benjamin You <benjamin.you@intel.com>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
Signed-off-by: Sravanthi <k.kavyax.sravanthi@intel.com>
2021-09-09 12:53:08 +00:00
a7cf2c5664 RedfishPkg: Fix various typos
Fix various typos in comments and documentation.

Signed-off-by: Cheng Zhou <zhoucheng@phytium.com.cn>
Reviewed-by: Nickle Wang <nickle.wang@hpe.com>
Cc: Abner Chang <abner.chang@hpe.com>
Reviewed-by: Abner Chang <abner.chang@hpe.com>
2021-09-07 03:56:13 +00:00
4473834e7d OvmfPkg/OvmfXen: Fix build with QemuKernelLoaderFsDxe
VerifyBlob() has been added recently to QemuKernelLoaderFsDxe, also
QemuKernelLoaderFsDxe has been added recently to OvmfXen but without an
implementation of VerifyBlob().

Fix this by adding the same runes that have been added to
OvmfPkgX64.dsc.

Fixes: 9f3eda177a ("OvmfPkg/OvmfXen: add QemuKernelLoaderFsDxe")
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
2021-09-06 14:32:46 +00:00
edf8bc6d24 SecurityPkg/MemoryOverwriteControl: Add missing argument to DEBUG print
REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3605

The error message is missing the argument for the status code
print specifier.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Qi Zhang <qi1.zhang@intel.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
2021-09-04 09:03:22 +00:00
81d71fb86e Maintainers.txt: Update maintainer/reviewer roles in MdeModulePkg
Remove Hao A Wu as the MdeModulePkg maintainer.
Add Liming Gao as the MdeModulePkg maintainer.
Remove Hao A Wu as the MdeModulePkg: Firmware Update modules reviewer.
Remove Hao A Wu as the MdeModulePkg: Serial modules reviewer.

Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Guomin Jiang <guomin.jiang@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Zhichao Gao <zhichao.gao@intel.com>
Signed-off-by: Hao A Wu <hao.a.wu@intel.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
2021-09-03 03:31:44 +00:00
c5e805ffe1 MdeModulePkg: Fix typo of "memory" in RamDiskDxe debug message
Fix a typo of "memory" in a debug message in RamDiskProtocol.c.

Signed-off-by: Rebecca Cran <rebecca@bsdio.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
2021-09-03 03:10:30 +00:00
b6bc203375 MdeModulePkg/HiiDatabaseDxe:remove dead code block
As the if statement outside has confirmed that
BlockData->Name == NULL, so the if statement inside
is always false.

Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Dandan Bi <dandan.bi@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Signed-off-by: Wenyi Xie <xiewenyi2@huawei.com>
Reviewed-by: Dandan Bi <dandan.bi@intel.com>
2021-09-02 10:42:59 +00:00
e3ee8c8dbd .azurepipelines: Add UefiPayloadPkg in gate-build-job.yml and CISetting.py
Add UefiPayloadPkg in gate-build-job.yml to enable Core ci for UefiPayloadPkg.
Add UefiPayloadPkg to supported Packages in CISettings.

Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Signed-off-by: DunTan <dun.tan@intel.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
2021-09-02 01:46:30 +00:00
63fddc98e0 UefiPayloadPkg: Create .yaml file in UefiPayloadPkg
Create .yaml file in UefiPayloadPkg to enable Core ci for UefiPayloadPkg

Cc: Guo Dong <guo.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Maurice Ma <maurice.ma@intel.com>
Cc: Benjamin You <benjamin.you@intel.com>
Signed-off-by: DunTan <dun.tan@intel.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
2021-09-02 01:46:30 +00:00
12e33dca4c IntelFsp2Pkg: Support Config File and Binary delta comparison
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3567

This patch is to enable config editor to have a new feature that
can spell out the delta between the default configuration files'
data, such as YAML and BSF, against the data stored in the binary.
This can help users understand and track the difference when
modifications are made.

Cc: Maurice Ma <maurice.ma@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Chasel Chiu <chasel.chiu@intel.com>
Signed-off-by: Loo Tung Lun <tung.lun.loo@intel.com>
Reviewed-by: Chasel Chiu <chasel.chiu@intel.com>
2021-09-01 12:40:26 +00:00
b170806518 UefiCpuPkg: Clean up save state boundary checks and comments.
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2956

In functions ReadSaveStateRegisterByIndex and WriteSaveStateRegister:
* check width > 4 instead of >= 4 when writing upper 32 bytes.
  - This improves the code but will not affect functionality.

Cc: Eric Dong <eric.dong@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Signed-off-by: Mark Wilson <Mark.Wilson@amd.com>
2021-09-01 06:07:56 +00:00
3b3f882288 MdeModulePkg/PiSmmCore: Drop deprecated image profiling commands
The legacy codebase allowed SMM images to be registered for profiling
from DXE. Support for this has been dropped entirely, so remove the
remaining handlers.

Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Cc: Vitaly Cheptsov <vit9696@protonmail.com>
Signed-off-by: Marvin H?user <mhaeuser@posteo.de>
2021-09-01 04:58:21 +00:00
cdda3f74a1 UefiPayloadPkg/UefiPayloadEntry: Fix memory corruption
UefiPayloadEntry's AllocatePool() applies the "sizeof" operator to
HOB index rather than the HOB header structure. This yields 4 Bytes
compared to the 8 Bytes the structure header requires. Fix the call
to allocate the required space instead.

Reviewed-by: Guo Dong <guo.dong@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Cc: Maurice Ma <maurice.ma@intel.com>
Cc: Benjamin You <benjamin.you@intel.com>
Cc: Vitaly Cheptsov <vit9696@protonmail.com>
Signed-off-by: Marvin H?user <mhaeuser@posteo.de>
2021-09-01 04:13:50 +00:00
5d34cc49d5 UefiCpuPkg/PiSmmCpuDxeSmm: Update mPatchCetSupported set condition
REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3584

Function AsmCpuid should first check the value for Basic CPUID Information.
The fix is to update the mPatchCetSupported judgment statement.

Signed-off-by: Wenxing Hou <wenxing.hou@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Cc: Eric Dong   <eric.dong@intel.com>
Cc: Ray Ni      <ray.ni@intel.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
Cc: Sheng W     <w.sheng@intel.com>
Cc: Yao Jiewen  <jiewen.yao@intel.com>
2021-09-01 03:38:06 +00:00
f0fe55bca4 UefiPayloadPkg: Fix the build error when enable Core ci for UefiPayloadPkg
V1: Add quotes when using $(ARCH) in .dsc and .fdf file.
The quotes are added due to the way by which Core ci parse the .dsc file.
Add UINTN in Hob.c to fix cast from pointer to integer of different size error.
V2: Delete lines which reference ShellBinPkg.The pkg doesn't exist in edk2.

Cc: Guo Dong <guo.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Maurice Ma <maurice.ma@intel.com>
Cc: Benjamin You <benjamin.you@intel.com>
Signed-off-by: DunTan <dun.tan@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
2021-09-01 03:14:43 +00:00
9f3eda177a OvmfPkg/OvmfXen: add QemuKernelLoaderFsDxe
Without QemuKernelLoaderFsDxe, QemuLoadKernelImage() couldn't download
the kernel, initrd, and kernel command line from QEMU's fw_cfg.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3574
Signed-off-by: Gary Lin <gary.lin@hpe.com>
Acked-by: Anthony PERARD <anthony.perard@citrix.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Tested-by: Jim Fehlig <jfehlig@suse.com>
2021-08-31 11:40:03 +00:00
5b5f10d746 OvmfPkg/SmmControl2Dxe: use PcdAcpiS3Enable to detect S3 support
To avoid the potential inconsistency between PcdAcpiS3Enable and
QemuFwCfgS3Enabled(), this commit modifies SmmControl2Dxe to detect
S3 support by PcdAcpiS3Enable as modules in MdeModulePkg do.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3573
Signed-off-by: Gary Lin <gary.lin@hpe.com>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com>
Tested-by: Jim Fehlig <jfehlig@suse.com>
2021-08-31 11:07:16 +00:00
52e2dabc0f OvmfPkg/PlatformBootManagerLib: use PcdAcpiS3Enable to detect S3 support
To avoid the potential inconsistency between PcdAcpiS3Enable and
QemuFwCfgS3Enabled(), this commit modifies PlatformBootManagerLib to
detect S3 support by PcdAcpiS3Enable as modules in MdeModulePkg do.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3573
Signed-off-by: Gary Lin <gary.lin@hpe.com>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com>
Tested-by: Jim Fehlig <jfehlig@suse.com>
2021-08-31 11:07:16 +00:00
28152333bc OvmfPkg/LockBoxLib: use PcdAcpiS3Enable to detect S3 support
To avoid the potential inconsistency between PcdAcpiS3Enable and
QemuFwCfgS3Enabled(), this commit modifies LockBoxLib to detect
S3 support by PcdAcpiS3Enable as modules in MdeModulePkg do.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3573
Signed-off-by: Gary Lin <gary.lin@hpe.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com>
Tested-by: Jim Fehlig <jfehlig@suse.com>
2021-08-31 11:07:16 +00:00
cb0d24637d OvmfPkg/OvmfXen: set PcdAcpiS3Enable at initialization
There are several functions in OvmfPkg/Library using
QemuFwCfgS3Enabled() to detect the S3 support status. However, in
MdeModulePkg, PcdAcpiS3Enable is used to check S3 support. Since
InitializeXenPlatform() didn't set PcdAcpiS3Enable as
InitializePlatform() did, this made the inconsistency between
drivers/functions.

For example, S3SaveStateDxe checked PcdAcpiS3Enable and skipped
S3BootScript because the default value is FALSE. On the other hand,
PlatformBootManagerBeforeConsole() from OvmfPkg/Library called
QemuFwCfgS3Enabled() and found it returned TRUE, so it invoked
SaveS3BootScript(). However, S3SaveStateDxe skipped S3BootScript, so
SaveS3BootScript() asserted due to EFI_NOT_FOUND.

This issue mainly affects "HVM Direct Kernel Boot". When used,
"fw_cfg" is enabled in QEMU and QemuFwCfgS3Enabled() returns true in
that case.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3573
Signed-off-by: Gary Lin <gary.lin@hpe.com>
Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com>
Tested-by: Jim Fehlig <jfehlig@suse.com>
2021-08-31 11:07:16 +00:00
cae735f613 ArmPkg: Enable boot discovery policy for ARM package.
This commit adds code which check BootDiscoveryPolicy variable and
calls Boot Policy Manager Protocol to connect device specified by
the variable. To enable that mechanism for platform
EfiMdeModulePkgTokenSpaceGuid.PcdBootDiscoveryPolicy PCD must be
added to DSC file and BootDiscoveryPolicyUiLib should be added to
UiApp libraries.

Signed-off-by: Grzegorz Bernacki <gjb@semihalf.com>
Reviewed-by: Sunny Wang <sunny.wang@arm.com>
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
2021-08-30 14:23:14 +00:00
0f11537548 MdeModulePkg:Increase Nvme capacity display
Displays the Nvme total capacity.

Signed-off-by: Cheng Zhou <zhoucheng@phytium.com.cn>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>

Cc: Ray Ni <ray.ni@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
2021-08-30 03:44:08 +00:00
443300be46 MdePkg:Update IndustryStandard/Nvme.h with Nvme amdin controller data
Update Nvme data structure

Signed-off-by: Cheng Zhou <zhoucheng@phytium.com.cn>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
2021-08-30 03:44:08 +00:00
dc995ce906 MdeModulePkg: Add BootDiscoveryPolicyOld variable.
This variable is needed to track the change to
BootDiscoveryPolicy variable. Boot options should
be refreshed only if BootDiscoveryPolicy has been
changed.

Signed-off-by: Grzegorz Bernacki <gjb@semihalf.com>
Reviewed-by: Samer El-Haj-Mahmoud <Samer.El-Haj-Mahmoud@arm.com>
Acked-by: Hao A Wu <hao.a.wu@intel.com>
2021-08-30 02:43:43 +00:00
b04453d36b MdeModulePkg/EbcDxe: Mitigate memcpy intrinsics
Assignments of structure values cause the emission of memcpy()
intrinsics by the CLANG38 toolchain. Substitute the assignments with
calls to CopyMem() to mitigate the issue.

Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Vitaly Cheptsov <vit9696@protonmail.com>
Signed-off-by: Marvin H?user <mhaeuser@posteo.de>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
2021-08-30 01:58:31 +00:00
77d5fa8024 OvmfPkg/VirtioMmioDeviceLib: enable virtio 1.0
Now with everything in place for virtio 1.0 devices we can let
VirtioMmioInit() return SUCCESS.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
2021-08-30 01:05:49 +00:00
ae12188cf8 OvmfPkg/VirtioMmioDeviceLib: virtio 1.0: Adapt feature bit handling
virtio 1.0 has 64 feature bits instead of 32.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
2021-08-30 01:05:49 +00:00
6a3e9576b8 OvmfPkg/VirtioMmioDeviceLib: virtio 1.0: Add default QueueNum
Use QueueNumMax as QueueNum default for drivers which do not
explicitly call VIRTIO_DEVICE_PROTOCOL->SetQueueSize().

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
2021-08-30 01:05:49 +00:00
537a724421 OvmfPkg/VirtioMmioDeviceLib: virtio 1.0: Fix SetQueueAddress
Virtio 1.0 allows a more flexible virtio ring layout, so we have to set
addresses for descriptors avail flags and use flags separately.  We
continue to use a ring layout compatible with virtio 0.9.5 though, so no
other changes are needed to setup the virtio queues.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
2021-08-30 01:05:49 +00:00
212a2b9bb8 OvmfPkg/VirtioMmioDeviceLib: virtio 1.0: Fix SetPageSize.
Nothing to do here for virtio 1.0 devices.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
2021-08-30 01:05:49 +00:00
08293e43da OvmfPkg/VirtioMmioDeviceLib: Add virtio 1.0 detection.
Add #defines for the Version field.  Read and store the version,
log the version found as info message.

Continue to return UNSUPPORTED for now, we need some more patches
to complete virtio 1.0 support first.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
2021-08-30 01:05:49 +00:00
94e465e5cb OvmfPkg/Virtio10: Add virtio-mmio 1.0 defines
Add defines for the config space offsets for virtio 1.0 mmio transport.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
2021-08-30 01:05:49 +00:00
a82bad9730 ArmPkg/GicV3Dxe: Don't signal EOI on arbitrary interrupts
Currently, at ExitBootServices() time, the GICv3 driver signals
End-Of-Interrupt (EOI) on all interrupt lines that are supported by the
interrupt controller. This appears to have been carried over from the
GICv2 version, but has been turned into something that violates the GIC
spec, and may trigger SError exceptions on some implementations.

Marc puts it as follows:

  The GIC interrupt state machine is pretty strict. An interrupt can
  only be deactivated (with or without prior priority drop) if it has
  been acknowledged first. In GIC speak, this means that only the
  following sequences are valid:

  With EOImode==0:
	  x = ICC_IAR{0,1}_EL1;
	  ICC_EOIR{0,1}_EL1 = x;

  With EOImode==1:
	  x = ICC_IAR{0,1}_EL1;
	  ICC_EOIR{0,1}_EL1 = x;
	  ICC_DIR_EL1 = x;

  Any write to ICC_EOIR{0,1}_EL1 that isn't the direct consequence of
  the same value being read from ICC_IAR{0,1}_EL1, and with the correct
  nesting, breaks the state machine and leads to unpredictable results
  that affects *all* interrupts in the system (most likely, the priority
  system is dead). See Figure 4-3 ("Interrupt handling state machine")
  in Arm IHI 0069F for a description of the acceptable transitions.

  Additionally, on implementations that have ICC_CTLR_EL1.SEIS==1, a
  SError may be generated to signal the error. See the various

  <quote>
	  IMPLEMENTATION_DEFINED "SError ....";
  </quote>

  that are all over the pseudocode contained in the same architecture
  spec. Needless to say, this is pretty final for any SW that would do
  silly things on such implementations (which do exist).

Given that in our implementation, every signalled interrupt is acked,
handled and EOId in sequence, there is no reason to EOI all interrupts
at ExitBootServices() time in the first place, so let's just drop this
code. This fixes an issue reported by Marc where an SError is triggered
by this code, bringing down the system.

Reported-by: Marc Zyngier <maz@kernel.org>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Acked-by: Marc Zyngier <maz@kernel.org>
Tested-by: Marc Zyngier <maz@kernel.org>
Reviewed-by: Leif Lindholm <leif@nuviainc.com>
2021-08-27 12:53:36 +00:00
b9af5037b2 OvmfPkg/ResetVector: move the GHCB page setup in AmdSev.asm
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3429

While build the initial page table, the SetCr3ForPageTables64 checks
whether SEV-ES is enabled. If so, clear the page encryption mask from the
GHCB page. Move the logic to clear the page encryption mask in the
AmdSev.asm.

Cc: James Bottomley <jejb@linux.ibm.com>
Cc: Min Xu <min.m.xu@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Tom Lendacky <thomas.lendacky@amd.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Erdem Aktas <erdemaktas@google.com>
Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
Reviewed-by: Min Xu <min.m.xu@intel.com>
Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com>
2021-08-27 12:10:40 +00:00
ab77b6031b OvmfPkg/ResetVector: update SEV support to use new work area format
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3429

Update the SEV support to switch to using the newer work area format.

Cc: James Bottomley <jejb@linux.ibm.com>
Cc: Min Xu <min.m.xu@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Tom Lendacky <thomas.lendacky@amd.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Erdem Aktas <erdemaktas@google.com>
Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
Reviewed-by: Min Xu <min.m.xu@intel.com>
Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com>
2021-08-27 12:10:40 +00:00
80e67af9af OvmfPkg: introduce a common work area
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3429

Both the TDX and SEV support needs to reserve a page in MEMFD as a work
area. The page will contain meta data specific to the guest type.
Currently, the SEV-ES support reserves a page in MEMFD
(PcdSevEsWorkArea) for the work area. This page can be reused as a TDX
work area when Intel TDX is enabled.

Based on the discussion [1], it was agreed to rename the SevEsWorkArea
to the OvmfWorkArea, and add a header that can be used to indicate the
work area type.

[1] https://edk2.groups.io/g/devel/message/78262?p=,,,20,0,0,0::\
    created,0,SNP,20,2,0,84476064

Cc: James Bottomley <jejb@linux.ibm.com>
Cc: Min Xu <min.m.xu@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Tom Lendacky <thomas.lendacky@amd.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Erdem Aktas <erdemaktas@google.com>
Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
Reviewed-by: Min Xu <min.m.xu@intel.com>
Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com>
2021-08-27 12:10:40 +00:00
8b15024dc7 Maintainers: Add kraxel as Reviewer to ArmVirtPkg and OvmfPkg
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com>
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
2021-08-27 10:09:33 +00:00
82f7e315d6 MdeModulePkg/PeiCore: Remove MigrateSecModulesInFv()
REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3564

This function has not been called since it was added in commit
9bedaec. If the function were to remain, it would need to be
re-evaluated and tested. This change removes the function since
it is not being used.

Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Dandan Bi <dandan.bi@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Debkumar De <debkumar.de@intel.com>
Cc: Harry Han <harry.han@intel.com>
Cc: Catharine West <catharine.west@intel.com>
Cc: Marvin H?user <mhaeuser@posteo.de>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
2021-08-27 08:32:20 +00:00
410 changed files with 18631 additions and 2936 deletions

View File

@ -48,6 +48,9 @@ jobs:
TARGET_SECURITY:
Build.Pkgs: 'SecurityPkg'
Build.Targets: 'DEBUG,RELEASE,NO-TARGET'
TARGET_UEFIPAYLOAD:
Build.Pkgs: 'UefiPayloadPkg'
Build.Targets: 'DEBUG,RELEASE,NO-TARGET'
TARGET_PLATFORMS:
# For Platforms only check code. Leave it to Platform CI
# to build them.

View File

@ -67,7 +67,8 @@ class Settings(CiBuildSettingsManager, UpdateSettingsManager, SetupSettingsManag
"CryptoPkg",
"UnitTestFrameworkPkg",
"OvmfPkg",
"RedfishPkg"
"RedfishPkg",
"UefiPayloadPkg"
)
def GetArchitecturesSupported(self):

View File

@ -3,6 +3,7 @@
#
# Copyright (c) 2009 - 2010, Apple Inc. All rights reserved.<BR>
# Copyright (c) 2011 - 2021, ARM Limited. All rights reserved.
# Copyright (c) 2021, Ampere Computing LLC. All rights reserved.
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
@ -337,9 +338,9 @@
# UINT64 Mmio32CpuBase; // mapping target in 64-bit cpu-physical space
# UINT64 Mmio64CpuBase; // mapping target in 64-bit cpu-physical space
#
# PcdPciIoTranslation = IoCpuBase - PcdPciIoBase;
# PcdPciMmio32Translation = Mmio32CpuBase - (UINT64)PcdPciMmio32Base;
# PcdPciMmio64Translation = Mmio64CpuBase - PcdPciMmio64Base;
# gEfiMdePkgTokenSpaceGuid.PcdPciIoTranslation = IoCpuBase - PcdPciIoBase;
# gEfiMdePkgTokenSpaceGuid.PcdPciMmio32Translation = Mmio32CpuBase - (UINT64)PcdPciMmio32Base;
# gEfiMdePkgTokenSpaceGuid.PcdPciMmio64Translation = Mmio64CpuBase - PcdPciMmio64Base;
#
# because (a) the target address space (ie. the cpu-physical space) is
# 64-bit, and (b) the translation values are meant as offsets for *modular*
@ -356,11 +357,11 @@
# UINT64 TranslatedMmio64Address; // output parameter
#
# TranslatedIoAddress = UntranslatedIoAddress +
# PcdPciIoTranslation;
# gEfiMdePkgTokenSpaceGuid.PcdPciIoTranslation;
# TranslatedMmio32Address = (UINT64)UntranslatedMmio32Address +
# PcdPciMmio32Translation;
# gEfiMdePkgTokenSpaceGuid.PcdPciMmio32Translation;
# TranslatedMmio64Address = UntranslatedMmio64Address +
# PcdPciMmio64Translation;
# gEfiMdePkgTokenSpaceGuid.PcdPciMmio64Translation;
#
# The modular arithmetic performed in UINT64 ensures that the translation
# works correctly regardless of the relation between IoCpuBase and
@ -369,16 +370,20 @@
#
gArmTokenSpaceGuid.PcdPciIoBase|0x0|UINT64|0x00000050
gArmTokenSpaceGuid.PcdPciIoSize|0x0|UINT64|0x00000051
gArmTokenSpaceGuid.PcdPciIoTranslation|0x0|UINT64|0x00000052
gArmTokenSpaceGuid.PcdPciMmio32Base|0x0|UINT32|0x00000053
gArmTokenSpaceGuid.PcdPciMmio32Size|0x0|UINT32|0x00000054
gArmTokenSpaceGuid.PcdPciMmio32Translation|0x0|UINT64|0x00000055
gArmTokenSpaceGuid.PcdPciMmio64Base|0x0|UINT64|0x00000056
gArmTokenSpaceGuid.PcdPciMmio64Size|0x0|UINT64|0x00000057
gArmTokenSpaceGuid.PcdPciMmio64Translation|0x0|UINT64|0x00000058
#
# Inclusive range of allowed PCI buses.
#
gArmTokenSpaceGuid.PcdPciBusMin|0x0|UINT32|0x00000059
gArmTokenSpaceGuid.PcdPciBusMax|0x0|UINT32|0x0000005A
[PcdsDynamicEx]
#
# This dynamic PCD hold the GUID of a firmware FFS which contains
# the LinuxBoot payload.
#
gArmTokenSpaceGuid.PcdLinuxBootFileGuid|{0x0}|VOID*|0x0000005C

View File

@ -5,6 +5,7 @@
# Copyright (c) 2011 - 2021, Arm Limited. All rights reserved.<BR>
# Copyright (c) 2016, Linaro Ltd. All rights reserved.<BR>
# Copyright (c) Microsoft Corporation.<BR>
# Copyright (c) 2021, Ampere Computing LLC. All rights reserved.
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
@ -150,6 +151,7 @@
ArmPkg/Library/ArmSmcPsciResetSystemLib/ArmSmcPsciResetSystemLib.inf
ArmPkg/Library/PeiServicesTablePointerLib/PeiServicesTablePointerLib.inf
ArmPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
ArmPkg/Library/LinuxBootBootManagerLib/LinuxBootBootManagerLib.inf
ArmPkg/Drivers/ArmCrashDumpDxe/ArmCrashDumpDxe.inf
ArmPkg/Drivers/ArmScmiDxe/ArmScmiDxe.inf

View File

@ -344,10 +344,6 @@ GicV3ExitBootServicesEvent (
GicV3DisableInterruptSource (&gHardwareInterruptV3Protocol, Index);
}
for (Index = 0; Index < mGicNumInterrupts; Index++) {
GicV3EndOfInterrupt (&gHardwareInterruptV3Protocol, Index);
}
// Disable Gic Interface
ArmGicV3DisableInterruptInterface ();

View File

@ -38,7 +38,7 @@
UefiBootServicesTableLib
[Pcd]
gArmTokenSpaceGuid.PcdPciIoTranslation
gEfiMdePkgTokenSpaceGuid.PcdPciIoTranslation
[Protocols]
gEfiCpuIo2ProtocolGuid ## PRODUCES

View File

@ -0,0 +1,186 @@
/** @file
Implementation for PlatformBootManagerLib library class interfaces.
Copyright (C) 2015-2016, Red Hat, Inc.
Copyright (c) 2014 - 2019, ARM Ltd. All rights reserved.<BR>
Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2016, Linaro Ltd. All rights reserved.<BR>
Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#include <Uefi.h>
#include <Guid/EventGroup.h>
#include <Library/BaseLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/DebugLib.h>
#include <Library/DevicePathLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/PcdLib.h>
#include <Library/UefiBootManagerLib.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/UefiLib.h>
#include <Library/UefiRuntimeServicesTableLib.h>
#include <Protocol/LoadedImage.h>
#include <Protocol/PlatformBootManager.h>
/**
Register a boot option using a file GUID in the FV.
@param FileGuid The file GUID name in the FV.
@param Description The description of the boot option.
@param Attributes The attributes of the boot option.
**/
STATIC
VOID
PlatformRegisterFvBootOption (
CONST EFI_GUID *FileGuid,
CHAR16 *Description,
UINT32 Attributes
)
{
EFI_STATUS Status;
INTN OptionIndex;
EFI_BOOT_MANAGER_LOAD_OPTION NewOption;
EFI_BOOT_MANAGER_LOAD_OPTION *BootOptions;
UINTN BootOptionCount;
MEDIA_FW_VOL_FILEPATH_DEVICE_PATH FileNode;
EFI_LOADED_IMAGE_PROTOCOL *LoadedImage;
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
Status = gBS->HandleProtocol (
gImageHandle,
&gEfiLoadedImageProtocolGuid,
(VOID **)&LoadedImage
);
ASSERT_EFI_ERROR (Status);
EfiInitializeFwVolDevicepathNode (&FileNode, FileGuid);
DevicePath = DevicePathFromHandle (LoadedImage->DeviceHandle);
ASSERT (DevicePath != NULL);
DevicePath = AppendDevicePathNode (
DevicePath,
(EFI_DEVICE_PATH_PROTOCOL *)&FileNode
);
ASSERT (DevicePath != NULL);
Status = EfiBootManagerInitializeLoadOption (
&NewOption,
LoadOptionNumberUnassigned,
LoadOptionTypeBoot,
Attributes,
Description,
DevicePath,
NULL,
0
);
ASSERT_EFI_ERROR (Status);
FreePool (DevicePath);
BootOptions = EfiBootManagerGetLoadOptions (
&BootOptionCount,
LoadOptionTypeBoot
);
OptionIndex = EfiBootManagerFindLoadOption (
&NewOption,
BootOptions,
BootOptionCount
);
if (OptionIndex == -1) {
Status = EfiBootManagerAddLoadOptionVariable (&NewOption, MAX_UINTN);
ASSERT_EFI_ERROR (Status);
}
EfiBootManagerFreeLoadOption (&NewOption);
EfiBootManagerFreeLoadOptions (BootOptions, BootOptionCount);
}
/**
Do the platform specific action before the console is connected.
Such as:
Update console variable;
Register new Driver#### or Boot####;
Signal ReadyToLock event.
**/
VOID
EFIAPI
PlatformBootManagerBeforeConsole (
VOID
)
{
//
// Signal EndOfDxe PI Event
//
EfiEventGroupSignal (&gEfiEndOfDxeEventGroupGuid);
}
/**
Do the platform specific action after the console is connected.
Such as:
Dynamically switch output mode;
Signal console ready platform customized event;
Run diagnostics like memory testing;
Connect certain devices;
Dispatch additional option roms.
**/
VOID
EFIAPI
PlatformBootManagerAfterConsole (
VOID
)
{
EFI_GUID LinuxBootFileGuid;
CopyGuid (&LinuxBootFileGuid, PcdGetPtr (PcdLinuxBootFileGuid));
if (!CompareGuid (&LinuxBootFileGuid, &gZeroGuid)) {
//
// Register LinuxBoot
//
PlatformRegisterFvBootOption (
&LinuxBootFileGuid,
L"LinuxBoot",
LOAD_OPTION_ACTIVE
);
} else {
DEBUG ((DEBUG_ERROR, "%a: PcdLinuxBootFileGuid was not set!\n", __FUNCTION__));
}
}
/**
This function is called each second during the boot manager waits the
timeout.
@param TimeoutRemain The remaining timeout.
**/
VOID
EFIAPI
PlatformBootManagerWaitCallback (
UINT16 TimeoutRemain
)
{
return;
}
/**
The function is called when no boot option could be launched,
including platform recovery options and options pointing to applications
built into firmware volumes.
If this function returns, BDS attempts to enter an infinite loop.
**/
VOID
EFIAPI
PlatformBootManagerUnableToBoot (
VOID
)
{
return;
}

View File

@ -0,0 +1,58 @@
## @file
# Implementation for PlatformBootManagerLib library class interfaces.
#
# Copyright (C) 2015-2016, Red Hat, Inc.
# Copyright (c) 2014, ARM Ltd. All rights reserved.<BR>
# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
# Copyright (c) 2016, Linaro Ltd. All rights reserved.<BR>
# Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.<BR>
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
##
[Defines]
INF_VERSION = 0x0001001B
BASE_NAME = LinuxBootBootManagerLib
FILE_GUID = 1FA91547-DB23-4F6A-8AF8-3B9782A7F917
MODULE_TYPE = DXE_DRIVER
VERSION_STRING = 1.0
LIBRARY_CLASS = PlatformBootManagerLib|DXE_DRIVER
#
# The following information is for reference only and not required by the build tools.
#
# VALID_ARCHITECTURES = ARM AARCH64
#
[Sources]
LinuxBootBm.c
[Packages]
ArmPkg/ArmPkg.dec
MdeModulePkg/MdeModulePkg.dec
MdePkg/MdePkg.dec
ShellPkg/ShellPkg.dec
[LibraryClasses]
BaseLib
BaseMemoryLib
DebugLib
MemoryAllocationLib
PcdLib
PrintLib
UefiBootManagerLib
UefiBootServicesTableLib
UefiLib
UefiRuntimeServicesTableLib
[Pcd]
gArmTokenSpaceGuid.PcdLinuxBootFileGuid
[Guids]
gEfiEndOfDxeEventGroupGuid
gUefiShellFileGuid
gZeroGuid
[Protocols]
gEfiLoadedImageProtocolGuid

View File

@ -2,9 +2,10 @@
Implementation for PlatformBootManagerLib library class interfaces.
Copyright (C) 2015-2016, Red Hat, Inc.
Copyright (c) 2014 - 2019, ARM Ltd. All rights reserved.<BR>
Copyright (c) 2014 - 2021, ARM Ltd. All rights reserved.<BR>
Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2016, Linaro Ltd. All rights reserved.<BR>
Copyright (c) 2021, Semihalf All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
@ -19,6 +20,7 @@
#include <Library/UefiBootManagerLib.h>
#include <Library/UefiLib.h>
#include <Library/UefiRuntimeServicesTableLib.h>
#include <Protocol/BootManagerPolicy.h>
#include <Protocol/DevicePath.h>
#include <Protocol/EsrtManagement.h>
#include <Protocol/GraphicsOutput.h>
@ -27,6 +29,7 @@
#include <Protocol/PciIo.h>
#include <Protocol/PciRootBridgeIo.h>
#include <Protocol/PlatformBootManager.h>
#include <Guid/BootDiscoveryPolicy.h>
#include <Guid/EventGroup.h>
#include <Guid/NonDiscoverableDevice.h>
#include <Guid/TtyTerm.h>
@ -703,6 +706,113 @@ HandleCapsules (
#define VERSION_STRING_PREFIX L"Tianocore/EDK2 firmware version "
/**
This functions checks the value of BootDiscoverPolicy variable and
connect devices of class specified by that variable. Then it refreshes
Boot order for newly discovered boot device.
@retval EFI_SUCCESS Devices connected successfully or connection
not required.
@retval others Return values from GetVariable(), LocateProtocol()
and ConnectDeviceClass().
**/
STATIC
EFI_STATUS
BootDiscoveryPolicyHandler (
VOID
)
{
EFI_STATUS Status;
UINT32 DiscoveryPolicy;
UINT32 DiscoveryPolicyOld;
UINTN Size;
EFI_BOOT_MANAGER_POLICY_PROTOCOL *BMPolicy;
EFI_GUID *Class;
Size = sizeof (DiscoveryPolicy);
Status = gRT->GetVariable (
BOOT_DISCOVERY_POLICY_VAR,
&gBootDiscoveryPolicyMgrFormsetGuid,
NULL,
&Size,
&DiscoveryPolicy
);
if (Status == EFI_NOT_FOUND) {
DiscoveryPolicy = PcdGet32 (PcdBootDiscoveryPolicy);
Status = PcdSet32S (PcdBootDiscoveryPolicy, DiscoveryPolicy);
if (Status == EFI_NOT_FOUND) {
return EFI_SUCCESS;
} else if (EFI_ERROR (Status)) {
return Status;
}
} else if (EFI_ERROR (Status)) {
return Status;
}
if (DiscoveryPolicy == BDP_CONNECT_MINIMAL) {
return EFI_SUCCESS;
}
switch (DiscoveryPolicy) {
case BDP_CONNECT_NET:
Class = &gEfiBootManagerPolicyNetworkGuid;
break;
case BDP_CONNECT_ALL:
Class = &gEfiBootManagerPolicyConnectAllGuid;
break;
default:
DEBUG ((
DEBUG_INFO,
"%a - Unexpected DiscoveryPolicy (0x%x). Run Minimal Discovery Policy\n",
__FUNCTION__,
DiscoveryPolicy
));
return EFI_SUCCESS;
}
Status = gBS->LocateProtocol (
&gEfiBootManagerPolicyProtocolGuid,
NULL,
(VOID **)&BMPolicy
);
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_INFO, "%a - Failed to locate gEfiBootManagerPolicyProtocolGuid."
"Driver connect will be skipped.\n", __FUNCTION__));
return Status;
}
Status = BMPolicy->ConnectDeviceClass (BMPolicy, Class);
if (EFI_ERROR (Status)){
DEBUG ((DEBUG_ERROR, "%a - ConnectDeviceClass returns - %r\n", __FUNCTION__, Status));
return Status;
}
//
// Refresh Boot Options if Boot Discovery Policy has been changed
//
Size = sizeof (DiscoveryPolicyOld);
Status = gRT->GetVariable (
BOOT_DISCOVERY_POLICY_OLD_VAR,
&gBootDiscoveryPolicyMgrFormsetGuid,
NULL,
&Size,
&DiscoveryPolicyOld
);
if ((Status == EFI_NOT_FOUND) || (DiscoveryPolicyOld != DiscoveryPolicy)) {
EfiBootManagerRefreshAllBootOption ();
Status = gRT->SetVariable (
BOOT_DISCOVERY_POLICY_OLD_VAR,
&gBootDiscoveryPolicyMgrFormsetGuid,
EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS,
sizeof (DiscoveryPolicyOld),
&DiscoveryPolicy
);
}
return EFI_SUCCESS;
}
/**
Do the platform specific action after the console is ready
Possible things that can be done in PlatformBootManagerAfterConsole:
@ -753,6 +863,12 @@ PlatformBootManagerAfterConsole (
}
}
//
// Connect device specified by BootDiscoverPolicy variable and
// refresh Boot order for newly discovered boot devices
//
BootDiscoveryPolicyHandler ();
//
// On ARM, there is currently no reason to use the phased capsule
// update approach where some capsules are dispatched before EndOfDxe

View File

@ -65,11 +65,15 @@
[Pcd]
gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut
gEfiMdeModulePkgTokenSpaceGuid.PcdBootDiscoveryPolicy
[Guids]
gBootDiscoveryPolicyMgrFormsetGuid
gEdkiiNonDiscoverableEhciDeviceGuid
gEdkiiNonDiscoverableUhciDeviceGuid
gEdkiiNonDiscoverableXhciDeviceGuid
gEfiBootManagerPolicyNetworkGuid
gEfiBootManagerPolicyConnectAllGuid
gEfiFileInfoGuid
gEfiFileSystemInfoGuid
gEfiFileSystemVolumeLabelInfoIdGuid
@ -79,6 +83,7 @@
[Protocols]
gEdkiiNonDiscoverableDeviceProtocolGuid
gEfiBootManagerPolicyProtocolGuid
gEfiDevicePathProtocolGuid
gEfiGraphicsOutputProtocolGuid
gEfiLoadedImageProtocolGuid

View File

@ -219,7 +219,7 @@ ConfigureCacheArchitectureInformation (
CacheSize32 = CacheSize16;
} else if ((CacheSize64 / 64) < MAX_INT16) {
CacheSize16 = (1 << 15) | (CacheSize64 / 64);
CacheSize32 = CacheSize16;
CacheSize32 = (1 << 31) | (CacheSize64 / 64);
} else {
if ((CacheSize64 / 1024) <= 2047) {
CacheSize32 = CacheSize64;
@ -689,7 +689,7 @@ AddSmbiosProcessorTypeTable (
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "[%a]:[%dL] Smbios Type04 Table Log Failed! %r \n",
__FUNCTION__, __LINE__, Status));
__FUNCTION__, DEBUG_LINE_NUMBER, Status));
}
FreePool (Type4Record);

View File

@ -2,6 +2,7 @@
Functions for processor information common to ARM and AARCH64.
Copyright (c) 2021, NUVIA Inc. All rights reserved.<BR>
Copyright (c) 2021, Ampere Computing LLC. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
@ -171,7 +172,7 @@ SmbiosGetProcessorId (
if (HasSmcArm64SocId ()) {
SmbiosGetSmcArm64SocId (&Jep106Code, &SocRevision);
ProcessorId = ((UINT64)Jep106Code << 32) | SocRevision;
ProcessorId = ((UINT64)SocRevision << 32) | Jep106Code;
} else {
ProcessorId = ArmReadMidr ();
}

View File

@ -240,11 +240,12 @@ SMBIOS_MISC_TABLE_FUNCTION (MiscBiosVendor)
SmbiosRecord->BiosSegment = (UINT16)(FixedPcdGet32 (PcdFdBaseAddress) / SIZE_64KB);
if (BiosPhysicalSize < SIZE_16MB) {
SmbiosRecord->BiosSize = Base2ToByteWith64KUnit (BiosPhysicalSize) - 1;
SmbiosRecord->ExtendedBiosSize.Size = BiosPhysicalSize / SIZE_1MB;
SmbiosRecord->ExtendedBiosSize.Unit = 0; // Size is in MB
} else {
SmbiosRecord->BiosSize = 0xFF;
if (BiosPhysicalSize > 0x3FFF) {
if (BiosPhysicalSize < SIZE_16GB) {
SmbiosRecord->ExtendedBiosSize.Size = BiosPhysicalSize / SIZE_1MB;
SmbiosRecord->ExtendedBiosSize.Unit = 0; // Size is in MB
} else {
SmbiosRecord->ExtendedBiosSize.Size = BiosPhysicalSize / SIZE_1GB;
SmbiosRecord->ExtendedBiosSize.Unit = 1; // Size is in GB
}
@ -270,7 +271,7 @@ SMBIOS_MISC_TABLE_FUNCTION (MiscBiosVendor)
Status = SmbiosMiscAddRecord ((UINT8*)SmbiosRecord, NULL);
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "[%a]:[%dL] Smbios Type00 Table Log Failed! %r \n",
__FUNCTION__, __LINE__, Status));
__FUNCTION__, DEBUG_LINE_NUMBER, Status));
}
FreePool (SmbiosRecord);

View File

@ -162,7 +162,7 @@ SMBIOS_MISC_TABLE_FUNCTION(MiscSystemManufacturer)
Status = SmbiosMiscAddRecord ((UINT8*)SmbiosRecord, NULL);
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "[%a]:[%dL] Smbios Type01 Table Log Failed! %r \n",
__FUNCTION__, __LINE__, Status));
__FUNCTION__, DEBUG_LINE_NUMBER, Status));
}
FreePool (SmbiosRecord);

View File

@ -196,7 +196,7 @@ SMBIOS_MISC_TABLE_FUNCTION(MiscBaseBoardManufacturer)
Status = SmbiosMiscAddRecord ((UINT8 *)SmbiosRecord, NULL);
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "[%a]:[%dL] Smbios Type02 Table Log Failed! %r \n",
__FUNCTION__, __LINE__, Status));
__FUNCTION__, DEBUG_LINE_NUMBER, Status));
}
FreePool (SmbiosRecord);

View File

@ -178,7 +178,7 @@ SMBIOS_MISC_TABLE_FUNCTION(MiscChassisManufacturer)
Status = SmbiosMiscAddRecord ((UINT8*)SmbiosRecord, NULL);
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "[%a]:[%dL] Smbios Type03 Table Log Failed! %r \n",
__FUNCTION__, __LINE__, Status));
__FUNCTION__, DEBUG_LINE_NUMBER, Status));
}
FreePool (SmbiosRecord);

View File

@ -158,7 +158,7 @@ SMBIOS_MISC_TABLE_FUNCTION(MiscNumberOfInstallableLanguages)
Status = SmbiosMiscAddRecord ((UINT8*)SmbiosRecord, NULL);
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "[%a]:[%dL] Smbios Type13 Table Log Failed! %r \n",
__FUNCTION__, __LINE__, Status));
__FUNCTION__, DEBUG_LINE_NUMBER, Status));
}
FreePool (SmbiosRecord);

View File

@ -68,7 +68,7 @@ SMBIOS_MISC_TABLE_FUNCTION(MiscBootInformation)
Status = SmbiosMiscAddRecord ((UINT8*)SmbiosRecord, NULL);
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "[%a]:[%dL] Smbios Type32 Table Log Failed! %r \n",
__FUNCTION__, __LINE__, Status));
__FUNCTION__, DEBUG_LINE_NUMBER, Status));
}
FreePool (SmbiosRecord);

View File

@ -49,12 +49,13 @@
FrameBufferBltLib|MdeModulePkg/Library/FrameBufferBltLib/FrameBufferBltLib.inf
QemuBootOrderLib|OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.inf
FileExplorerLib|MdeModulePkg/Library/FileExplorerLib/FileExplorerLib.inf
PciPcdProducerLib|ArmVirtPkg/Library/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf
PciPcdProducerLib|OvmfPkg/Fdt/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf
PciSegmentLib|MdePkg/Library/BasePciSegmentLibPci/BasePciSegmentLibPci.inf
PciHostBridgeLib|ArmVirtPkg/Library/FdtPciHostBridgeLib/FdtPciHostBridgeLib.inf
PciHostBridgeLib|OvmfPkg/Fdt/FdtPciHostBridgeLib/FdtPciHostBridgeLib.inf
PciHostBridgeUtilityLib|ArmVirtPkg/Library/ArmVirtPciHostBridgeUtilityLib/ArmVirtPciHostBridgeUtilityLib.inf
TpmMeasurementLib|MdeModulePkg/Library/TpmMeasurementLibNull/TpmMeasurementLibNull.inf
TpmPlatformHierarchyLib|SecurityPkg/Library/PeiDxeTpmPlatformHierarchyLibNull/PeiDxeTpmPlatformHierarchyLib.inf
!include MdePkg/MdeLibs.dsc.inc
@ -192,7 +193,7 @@
# PCD and PcdPciDisableBusEnumeration above have not been assigned yet
gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress|0xFFFFFFFFFFFFFFFF
gArmTokenSpaceGuid.PcdPciIoTranslation|0
gEfiMdePkgTokenSpaceGuid.PcdPciIoTranslation|0
gEfiSecurityPkgTokenSpaceGuid.PcdTpmBaseAddress|0x0
@ -292,9 +293,9 @@
#
# Platform Driver
#
ArmVirtPkg/VirtioFdtDxe/VirtioFdtDxe.inf
ArmVirtPkg/FdtClientDxe/FdtClientDxe.inf
ArmVirtPkg/HighMemDxe/HighMemDxe.inf
OvmfPkg/Fdt/VirtioFdtDxe/VirtioFdtDxe.inf
EmbeddedPkg/Drivers/FdtClientDxe/FdtClientDxe.inf
OvmfPkg/Fdt/HighMemDxe/HighMemDxe.inf
OvmfPkg/VirtioBlkDxe/VirtioBlk.inf
OvmfPkg/VirtioScsiDxe/VirtioScsi.inf
OvmfPkg/VirtioNetDxe/VirtioNet.inf
@ -341,12 +342,12 @@
#
ArmPkg/Drivers/ArmPciCpuIo2Dxe/ArmPciCpuIo2Dxe.inf {
<LibraryClasses>
NULL|ArmVirtPkg/Library/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf
NULL|OvmfPkg/Fdt/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf
}
MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf
MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf {
<LibraryClasses>
NULL|ArmVirtPkg/Library/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf
NULL|OvmfPkg/Fdt/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf
}
OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.inf
OvmfPkg/VirtioPciDeviceDxe/VirtioPciDeviceDxe.inf
@ -360,5 +361,5 @@
MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.inf
ArmVirtPkg/CloudHvAcpiPlatformDxe/CloudHvAcpiPlatformDxe.inf {
<LibraryClasses>
NULL|ArmVirtPkg/Library/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf
NULL|OvmfPkg/Fdt/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf
}

View File

@ -105,9 +105,9 @@ 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/HighMemDxe/HighMemDxe.inf
INF OvmfPkg/Fdt/VirtioFdtDxe/VirtioFdtDxe.inf
INF EmbeddedPkg/Drivers/FdtClientDxe/FdtClientDxe.inf
INF OvmfPkg/Fdt/HighMemDxe/HighMemDxe.inf
#
# PI DXE Drivers producing Architectural Protocols (EFI Services)

View File

@ -57,9 +57,9 @@
FileExplorerLib|MdeModulePkg/Library/FileExplorerLib/FileExplorerLib.inf
PciPcdProducerLib|ArmVirtPkg/Library/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf
PciPcdProducerLib|OvmfPkg/Fdt/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf
PciSegmentLib|MdePkg/Library/BasePciSegmentLibPci/BasePciSegmentLibPci.inf
PciHostBridgeLib|ArmVirtPkg/Library/FdtPciHostBridgeLib/FdtPciHostBridgeLib.inf
PciHostBridgeLib|OvmfPkg/Fdt/FdtPciHostBridgeLib/FdtPciHostBridgeLib.inf
PciHostBridgeUtilityLib|ArmVirtPkg/Library/ArmVirtPciHostBridgeUtilityLib/ArmVirtPciHostBridgeUtilityLib.inf
TpmMeasurementLib|MdeModulePkg/Library/TpmMeasurementLibNull/TpmMeasurementLibNull.inf
@ -184,7 +184,7 @@
# PCD and PcdPciDisableBusEnumeration above have not been assigned yet
gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress|0xFFFFFFFFFFFFFFFF
gArmTokenSpaceGuid.PcdPciIoTranslation|0x0
gEfiMdePkgTokenSpaceGuid.PcdPciIoTranslation|0x0
#
# Set video resolution for boot options and for text setup.
@ -291,9 +291,9 @@
# Platform Driver
#
ArmVirtPkg/KvmtoolPlatformDxe/KvmtoolPlatformDxe.inf
ArmVirtPkg/VirtioFdtDxe/VirtioFdtDxe.inf
ArmVirtPkg/FdtClientDxe/FdtClientDxe.inf
ArmVirtPkg/HighMemDxe/HighMemDxe.inf
OvmfPkg/Fdt/VirtioFdtDxe/VirtioFdtDxe.inf
EmbeddedPkg/Drivers/FdtClientDxe/FdtClientDxe.inf
OvmfPkg/Fdt/HighMemDxe/HighMemDxe.inf
OvmfPkg/VirtioBlkDxe/VirtioBlk.inf
OvmfPkg/VirtioScsiDxe/VirtioScsi.inf
OvmfPkg/VirtioNetDxe/VirtioNet.inf
@ -338,17 +338,17 @@
#
ArmPkg/Drivers/ArmPciCpuIo2Dxe/ArmPciCpuIo2Dxe.inf {
<LibraryClasses>
NULL|ArmVirtPkg/Library/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf
NULL|OvmfPkg/Fdt/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf
NULL|ArmVirtPkg/Library/BaseCachingPciExpressLib/BaseCachingPciExpressLib.inf
}
MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf {
<LibraryClasses>
NULL|ArmVirtPkg/Library/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf
NULL|OvmfPkg/Fdt/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf
NULL|ArmVirtPkg/Library/BaseCachingPciExpressLib/BaseCachingPciExpressLib.inf
}
MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf {
<LibraryClasses>
NULL|ArmVirtPkg/Library/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf
NULL|OvmfPkg/Fdt/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf
NULL|ArmVirtPkg/Library/BaseCachingPciExpressLib/BaseCachingPciExpressLib.inf
}
OvmfPkg/VirtioPciDeviceDxe/VirtioPciDeviceDxe.inf

View File

@ -119,10 +119,10 @@ 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 OvmfPkg/Fdt/VirtioFdtDxe/VirtioFdtDxe.inf
INF EmbeddedPkg/Drivers/FdtClientDxe/FdtClientDxe.inf
INF ArmVirtPkg/KvmtoolPlatformDxe/KvmtoolPlatformDxe.inf
INF ArmVirtPkg/HighMemDxe/HighMemDxe.inf
INF OvmfPkg/Fdt/HighMemDxe/HighMemDxe.inf
#
# PI DXE Drivers producing Architectural Protocols (EFI Services)

View File

@ -35,9 +35,6 @@
gArmVirtVariableGuid = { 0x50bea1e5, 0xa2c5, 0x46e9, { 0x9b, 0x3a, 0x59, 0x59, 0x65, 0x16, 0xb0, 0x0a } }
[Protocols]
gFdtClientProtocolGuid = { 0xE11FACA0, 0x4710, 0x4C8E, { 0xA7, 0xA2, 0x01, 0xBA, 0xA2, 0x59, 0x1B, 0x4C } }
[PcdsFeatureFlag]
#
# Feature Flag PCD that defines whether TPM2 support is enabled

View File

@ -59,7 +59,7 @@
# Virtio Support
VirtioLib|OvmfPkg/Library/VirtioLib/VirtioLib.inf
VirtioMmioDeviceLib|OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDeviceLib.inf
QemuFwCfgLib|ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf
QemuFwCfgLib|OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMmio.inf
QemuFwCfgS3Lib|OvmfPkg/Library/QemuFwCfgS3Lib/BaseQemuFwCfgS3LibNull.inf
QemuFwCfgSimpleParserLib|OvmfPkg/Library/QemuFwCfgSimpleParserLib/QemuFwCfgSimpleParserLib.inf
QemuLoadImageLib|OvmfPkg/Library/GenericQemuLoadImageLib/GenericQemuLoadImageLib.inf
@ -77,17 +77,19 @@
FrameBufferBltLib|MdeModulePkg/Library/FrameBufferBltLib/FrameBufferBltLib.inf
QemuBootOrderLib|OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.inf
FileExplorerLib|MdeModulePkg/Library/FileExplorerLib/FileExplorerLib.inf
PciPcdProducerLib|ArmVirtPkg/Library/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf
PciPcdProducerLib|OvmfPkg/Fdt/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf
PciSegmentLib|MdePkg/Library/BasePciSegmentLibPci/BasePciSegmentLibPci.inf
PciHostBridgeLib|ArmVirtPkg/Library/FdtPciHostBridgeLib/FdtPciHostBridgeLib.inf
PciHostBridgeLib|OvmfPkg/Fdt/FdtPciHostBridgeLib/FdtPciHostBridgeLib.inf
PciHostBridgeUtilityLib|OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.inf
!if $(TPM2_ENABLE) == TRUE
Tpm2CommandLib|SecurityPkg/Library/Tpm2CommandLib/Tpm2CommandLib.inf
Tcg2PhysicalPresenceLib|OvmfPkg/Library/Tcg2PhysicalPresenceLibQemu/DxeTcg2PhysicalPresenceLib.inf
TpmMeasurementLib|SecurityPkg/Library/DxeTpmMeasurementLib/DxeTpmMeasurementLib.inf
TpmPlatformHierarchyLib|SecurityPkg/Library/PeiDxeTpmPlatformHierarchyLib/PeiDxeTpmPlatformHierarchyLib.inf
!else
TpmMeasurementLib|MdeModulePkg/Library/TpmMeasurementLibNull/TpmMeasurementLibNull.inf
TpmPlatformHierarchyLib|SecurityPkg/Library/PeiDxeTpmPlatformHierarchyLibNull/PeiDxeTpmPlatformHierarchyLib.inf
!endif
[LibraryClasses.common.PEIM]
@ -247,7 +249,7 @@
# PCD and PcdPciDisableBusEnumeration above have not been assigned yet
gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress|0xFFFFFFFFFFFFFFFF
gArmTokenSpaceGuid.PcdPciIoTranslation|0x0
gEfiMdePkgTokenSpaceGuid.PcdPciIoTranslation|0x0
#
# Set video resolution for boot options and for text setup.
@ -403,9 +405,9 @@
#
# Platform Driver
#
ArmVirtPkg/VirtioFdtDxe/VirtioFdtDxe.inf
ArmVirtPkg/FdtClientDxe/FdtClientDxe.inf
ArmVirtPkg/HighMemDxe/HighMemDxe.inf
OvmfPkg/Fdt/VirtioFdtDxe/VirtioFdtDxe.inf
EmbeddedPkg/Drivers/FdtClientDxe/FdtClientDxe.inf
OvmfPkg/Fdt/HighMemDxe/HighMemDxe.inf
OvmfPkg/VirtioBlkDxe/VirtioBlk.inf
OvmfPkg/VirtioScsiDxe/VirtioScsi.inf
OvmfPkg/VirtioNetDxe/VirtioNet.inf
@ -487,12 +489,12 @@
#
ArmPkg/Drivers/ArmPciCpuIo2Dxe/ArmPciCpuIo2Dxe.inf {
<LibraryClasses>
NULL|ArmVirtPkg/Library/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf
NULL|OvmfPkg/Fdt/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf
}
MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf
MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf {
<LibraryClasses>
NULL|ArmVirtPkg/Library/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf
NULL|OvmfPkg/Fdt/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf
}
OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.inf
OvmfPkg/VirtioPciDeviceDxe/VirtioPciDeviceDxe.inf
@ -543,5 +545,5 @@
MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.inf
OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpiPlatformDxe.inf {
<LibraryClasses>
NULL|ArmVirtPkg/Library/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf
NULL|OvmfPkg/Fdt/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf
}

View File

@ -40,9 +40,9 @@ 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/HighMemDxe/HighMemDxe.inf
INF OvmfPkg/Fdt/VirtioFdtDxe/VirtioFdtDxe.inf
INF EmbeddedPkg/Drivers/FdtClientDxe/FdtClientDxe.inf
INF OvmfPkg/Fdt/HighMemDxe/HighMemDxe.inf
#
# PI DXE Drivers producing Architectural Protocols (EFI Services)

View File

@ -57,7 +57,7 @@
# Virtio Support
VirtioLib|OvmfPkg/Library/VirtioLib/VirtioLib.inf
VirtioMmioDeviceLib|OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDeviceLib.inf
QemuFwCfgLib|ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf
QemuFwCfgLib|OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMmio.inf
QemuFwCfgS3Lib|OvmfPkg/Library/QemuFwCfgS3Lib/BaseQemuFwCfgS3LibNull.inf
QemuFwCfgSimpleParserLib|OvmfPkg/Library/QemuFwCfgSimpleParserLib/QemuFwCfgSimpleParserLib.inf
QemuLoadImageLib|OvmfPkg/Library/GenericQemuLoadImageLib/GenericQemuLoadImageLib.inf
@ -75,11 +75,12 @@
FrameBufferBltLib|MdeModulePkg/Library/FrameBufferBltLib/FrameBufferBltLib.inf
QemuBootOrderLib|OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.inf
FileExplorerLib|MdeModulePkg/Library/FileExplorerLib/FileExplorerLib.inf
PciPcdProducerLib|ArmVirtPkg/Library/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf
PciPcdProducerLib|OvmfPkg/Fdt/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf
PciSegmentLib|MdePkg/Library/BasePciSegmentLibPci/BasePciSegmentLibPci.inf
PciHostBridgeLib|ArmVirtPkg/Library/FdtPciHostBridgeLib/FdtPciHostBridgeLib.inf
PciHostBridgeLib|OvmfPkg/Fdt/FdtPciHostBridgeLib/FdtPciHostBridgeLib.inf
PciHostBridgeUtilityLib|OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.inf
TpmMeasurementLib|MdeModulePkg/Library/TpmMeasurementLibNull/TpmMeasurementLibNull.inf
TpmPlatformHierarchyLib|SecurityPkg/Library/PeiDxeTpmPlatformHierarchyLibNull/PeiDxeTpmPlatformHierarchyLib.inf
[LibraryClasses.common.DXE_DRIVER]
ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/DxeReportStatusCodeLib.inf
@ -227,7 +228,7 @@
# PCD and PcdPciDisableBusEnumeration above have not been assigned yet
gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress|0xFFFFFFFFFFFFFFFF
gArmTokenSpaceGuid.PcdPciIoTranslation|0x0
gEfiMdePkgTokenSpaceGuid.PcdPciIoTranslation|0x0
#
# Set video resolution for boot options and for text setup.
@ -339,9 +340,9 @@
#
# Platform Driver
#
ArmVirtPkg/VirtioFdtDxe/VirtioFdtDxe.inf
ArmVirtPkg/FdtClientDxe/FdtClientDxe.inf
ArmVirtPkg/HighMemDxe/HighMemDxe.inf
OvmfPkg/Fdt/VirtioFdtDxe/VirtioFdtDxe.inf
EmbeddedPkg/Drivers/FdtClientDxe/FdtClientDxe.inf
OvmfPkg/Fdt/HighMemDxe/HighMemDxe.inf
OvmfPkg/VirtioBlkDxe/VirtioBlk.inf
OvmfPkg/VirtioScsiDxe/VirtioScsi.inf
OvmfPkg/VirtioNetDxe/VirtioNet.inf
@ -423,12 +424,12 @@
#
ArmPkg/Drivers/ArmPciCpuIo2Dxe/ArmPciCpuIo2Dxe.inf {
<LibraryClasses>
NULL|ArmVirtPkg/Library/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf
NULL|OvmfPkg/Fdt/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf
}
MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf
MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf {
<LibraryClasses>
NULL|ArmVirtPkg/Library/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf
NULL|OvmfPkg/Fdt/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf
}
OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.inf
OvmfPkg/VirtioPciDeviceDxe/VirtioPciDeviceDxe.inf
@ -459,5 +460,5 @@
MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.inf
OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpiPlatformDxe.inf {
<LibraryClasses>
NULL|ArmVirtPkg/Library/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf
NULL|OvmfPkg/Fdt/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf
}

View File

@ -50,6 +50,7 @@
PlatformBootManagerLib|ArmPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
CustomizedDisplayLib|MdeModulePkg/Library/CustomizedDisplayLib/CustomizedDisplayLib.inf
TpmMeasurementLib|MdeModulePkg/Library/TpmMeasurementLibNull/TpmMeasurementLibNull.inf
TpmPlatformHierarchyLib|SecurityPkg/Library/PeiDxeTpmPlatformHierarchyLibNull/PeiDxeTpmPlatformHierarchyLib.inf
[LibraryClasses.common.UEFI_DRIVER]
UefiScsiLib|MdePkg/Library/UefiScsiLib/UefiScsiLib.inf
@ -196,7 +197,7 @@
# Platform Driver
#
ArmVirtPkg/XenioFdtDxe/XenioFdtDxe.inf
ArmVirtPkg/FdtClientDxe/FdtClientDxe.inf
EmbeddedPkg/Drivers/FdtClientDxe/FdtClientDxe.inf
#
# FAT filesystem + GPT/MBR partitioning + UDF filesystem

View File

@ -139,7 +139,7 @@ READ_LOCK_STATUS = TRUE
INF MdeModulePkg/Core/Dxe/DxeMain.inf
INF MdeModulePkg/Universal/PCD/Dxe/Pcd.inf
INF ArmVirtPkg/XenioFdtDxe/XenioFdtDxe.inf
INF ArmVirtPkg/FdtClientDxe/FdtClientDxe.inf
INF EmbeddedPkg/Drivers/FdtClientDxe/FdtClientDxe.inf
#
# PI DXE Drivers producing Architectural Protocols (EFI Services)

View File

@ -30,6 +30,7 @@
[Packages]
ArmPkg/ArmPkg.dec
ArmVirtPkg/ArmVirtPkg.dec
EmbeddedPkg/EmbeddedPkg.dec
MdePkg/MdePkg.dec
[Protocols]

View File

@ -22,6 +22,7 @@
[Packages]
ArmPlatformPkg/ArmPlatformPkg.dec
ArmVirtPkg/ArmVirtPkg.dec
EmbeddedPkg/EmbeddedPkg.dec
MdePkg/MdePkg.dec
[LibraryClasses]

View File

@ -24,6 +24,7 @@
[Packages]
ArmPkg/ArmPkg.dec
ArmVirtPkg/ArmVirtPkg.dec
EmbeddedPkg/EmbeddedPkg.dec
MdeModulePkg/MdeModulePkg.dec
MdePkg/MdePkg.dec

View File

@ -23,6 +23,7 @@
[Packages]
ArmPkg/ArmPkg.dec
ArmVirtPkg/ArmVirtPkg.dec
EmbeddedPkg/EmbeddedPkg.dec
MdePkg/MdePkg.dec
[LibraryClasses]

View File

@ -21,6 +21,7 @@
[Packages]
ArmVirtPkg/ArmVirtPkg.dec
EmbeddedPkg/EmbeddedPkg.dec
MdePkg/MdePkg.dec
PcAtChipsetPkg/PcAtChipsetPkg.dec

View File

@ -22,6 +22,7 @@
ArmPkg/ArmPkg.dec
ArmPlatformPkg/ArmPlatformPkg.dec
ArmVirtPkg/ArmVirtPkg.dec
EmbeddedPkg/EmbeddedPkg.dec
MdePkg/MdePkg.dec
MdeModulePkg/MdeModulePkg.dec

View File

@ -24,6 +24,7 @@
ArmPlatformPkg/ArmPlatformPkg.dec
ArmPkg/ArmPkg.dec
ArmVirtPkg/ArmVirtPkg.dec
EmbeddedPkg/EmbeddedPkg.dec
[LibraryClasses]
BaseLib

View File

@ -16,6 +16,7 @@
#include <Library/PcdLib.h>
#include <Library/PlatformBmPrintScLib.h>
#include <Library/QemuBootOrderLib.h>
#include <Library/TpmPlatformHierarchyLib.h>
#include <Library/UefiBootManagerLib.h>
#include <Protocol/DevicePath.h>
#include <Protocol/FirmwareVolume2.h>
@ -696,6 +697,11 @@ PlatformBootManagerBeforeConsole (
//
EfiEventGroupSignal (&gEfiEndOfDxeEventGroupGuid);
//
// Disable the TPM 2 platform hierarchy
//
ConfigureTpmPlatformHierarchy ();
//
// Dispatch deferred images after EndOfDxe event.
//

View File

@ -33,6 +33,7 @@
MdeModulePkg/MdeModulePkg.dec
MdePkg/MdePkg.dec
OvmfPkg/OvmfPkg.dec
SecurityPkg/SecurityPkg.dec
ShellPkg/ShellPkg.dec
[LibraryClasses]
@ -47,6 +48,7 @@
QemuBootOrderLib
QemuLoadImageLib
ReportStatusCodeLib
TpmPlatformHierarchyLib
UefiBootManagerLib
UefiBootServicesTableLib
UefiLib

View File

@ -26,6 +26,7 @@
[Packages]
ArmVirtPkg/ArmVirtPkg.dec
EmbeddedPkg/EmbeddedPkg.dec
MdePkg/MdePkg.dec
MdeModulePkg/MdeModulePkg.dec

View File

@ -21,6 +21,7 @@
[Packages]
ArmVirtPkg/ArmVirtPkg.dec
EmbeddedPkg/EmbeddedPkg.dec
MdePkg/MdePkg.dec
OvmfPkg/OvmfPkg.dec

View File

@ -1,5 +1,5 @@
## @file
# Download GCC AARCH64 compiler from Linaro's release site
# Download GCC AARCH64 compiler from Arm's release site
# Set shell variable GCC5_AARCH64_INSTALL to this folder
#
# This is only downloaded when a build activates scope gcc_aarch64_linux
@ -11,11 +11,11 @@
"scope": "gcc_aarch64_linux",
"type": "web",
"name": "gcc_aarch64_linux",
"source": "http://releases.linaro.org/components/toolchain/binaries/7.4-2019.02/aarch64-linux-gnu/gcc-linaro-7.4.1-2019.02-x86_64_aarch64-linux-gnu.tar.xz",
"version": "7.4.1",
"sha256": "27f1dc2c491ed61ae8f0d4b0c11de59cd2f7dd9c94761ee7153006fcac1bf9ab",
"source": "https://developer.arm.com/-/media/Files/downloads/gnu-a/10.3-2021.07/binrel/gcc-arm-10.3-2021.07-x86_64-aarch64-none-linux-gnu.tar.xz",
"version": "10.3-2021.07",
"sha256": "1e33d53dea59c8de823bbdfe0798280bdcd138636c7060da9d77a97ded095a84",
"compression_type": "tar",
"internal_path": "/gcc-linaro-7.4.1-2019.02-x86_64_aarch64-linux-gnu/",
"internal_path": "/gcc-arm-10.3-2021.07-x86_64-aarch64-none-linux-gnu/",
"flags": ["set_shell_var", ],
"var_name": "GCC5_AARCH64_INSTALL"
}

View File

@ -1,5 +1,5 @@
## @file
# Download GCC ARM compiler from Linaro's release site
# Download GCC ARM compiler from Arm's release site
# Set shell variable GCC5_ARM_INSTALL to this folder
#
# This is only downloaded when a build activates scope gcc_arm_linux
@ -11,11 +11,11 @@
"scope": "gcc_arm_linux",
"type": "web",
"name": "gcc_arm_linux",
"source": "https://releases.linaro.org/components/toolchain/binaries/7.4-2019.02/arm-linux-gnueabihf/gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabihf.tar.xz",
"version": "7.4.1",
"sha256": "3C951CF1941D0FA06D64CC0D5E88612B209D8123B273FA26C16D70BD7BC6B163",
"source": "https://developer.arm.com/-/media/Files/downloads/gnu-a/10.3-2021.07/binrel/gcc-arm-10.3-2021.07-x86_64-arm-none-linux-gnueabihf.tar.asc",
"version": "10.3-2021.07",
"sha256": "aa074fa8371a4f73fecbd16bd62c8b1945f23289e26414794f130d6ccdf8e39c",
"compression_type": "tar",
"internal_path": "/gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabihf/",
"internal_path": "/gcc-arm-10.3-2021.07-x86_64-arm-none-linux-gnueabihf/",
"flags": ["set_shell_var", ],
"var_name": "GCC5_ARM_INSTALL"
}

View File

@ -57,7 +57,7 @@ class LinuxGcc5ToolChain(IUefiBuildPlugin):
return 0
# make GCC5_ARM_PREFIX to align with tools_def.txt
prefix = os.path.join(install_path, "bin", "arm-linux-gnueabihf-")
prefix = os.path.join(install_path, "bin", "arm-none-linux-gnueabihf-")
shell_environment.GetEnvironment().set_shell_var("GCC5_ARM_PREFIX", prefix)
# now confirm it exists
@ -80,7 +80,7 @@ class LinuxGcc5ToolChain(IUefiBuildPlugin):
return 0
# make GCC5_AARCH64_PREFIX to align with tools_def.txt
prefix = os.path.join(install_path, "bin", "aarch64-linux-gnu-")
prefix = os.path.join(install_path, "bin", "aarch64-none-linux-gnu-")
shell_environment.GetEnvironment().set_shell_var("GCC5_AARCH64_PREFIX", prefix)
# now confirm it exists

View File

@ -142,7 +142,7 @@ class parser_lst(object):
line.append(struct)
unparse.append(line)
else:
if uint not in ['UINT8', 'UINT16', 'UINT32', 'UINT64']:
if uint not in ['UINT8', 'UINT16', 'UINT32', 'UINT64', 'BOOLEAN']:
line = [offset, t_name, 0, uint]
line.append(struct)
unparse.append(line)
@ -569,7 +569,7 @@ class mainprocess(object):
for i in List:
for j in i:
tmp = j.split("|")
if (('L"' in j) and ("[" in j)) or (tmp[1].strip() == '{0x0, 0x0}'):
if (('L"' in j) and ("[" in j)) or (tmp[1].split("#")[0].strip() == '{0x0, 0x0}'):
tmp[0] = tmp[0][:tmp[0].index('[')]
List[List.index(i)][i.index(j)] = "|".join(tmp)
else:

View File

@ -46,7 +46,10 @@ UPSTREAMS = [
'list': 'devel@edk2.groups.io', 'prefix': 'edk2-platforms'},
{'name': 'edk2-non-osi',
'repo': 'https://github.com/tianocore/edk2-non-osi.git',
'list': 'devel@edk2.groups.io', 'prefix': 'edk2-non-osi'}
'list': 'devel@edk2.groups.io', 'prefix': 'edk2-non-osi'},
{'name': 'edk2-test',
'repo': 'https://github.com/tianocore/edk2-test.git',
'list': 'devel@edk2.groups.io', 'prefix': 'edk2-test'}
]
# The minimum version required for all of the below options to work

View File

@ -1135,6 +1135,8 @@ CVfrVarDataTypeDB::DataTypeAddBitField (
if (FieldName != NULL) {
strncpy (pNewField->mFieldName, FieldName, MAX_NAME_LEN - 1);
pNewField->mFieldName[MAX_NAME_LEN - 1] = 0;
} else {
strncpy (pNewField->mFieldName, "", MAX_NAME_LEN - 1);
}
pNewField->mFieldType = pFieldType;
pNewField->mIsBitField = TRUE;
@ -3916,5 +3918,3 @@ CVfrStringDB::GetUnicodeStringTextSize (
CVfrVarDataTypeDB gCVfrVarDataTypeDB;
CVfrDefaultStore gCVfrDefaultStore;
CVfrDataStorage gCVfrDataStorage;

View File

@ -2,7 +2,7 @@
# Create makefile for MS nmake and GNU make
#
# Copyright (c) 2007 - 2021, Intel Corporation. All rights reserved.<BR>
# Copyright (c) 2020, ARM Limited. All rights reserved.<BR>
# Copyright (c) 2020 - 2021, Arm Limited. All rights reserved.<BR>
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
@ -177,11 +177,11 @@ class BuildFile(object):
MakePath = AutoGenObject.BuildOption.get('MAKE', {}).get('PATH')
if not MakePath:
self._FileType = ""
elif "nmake" in MakePath:
MakePath = AutoGenObject.ToolDefinition.get('MAKE', {}).get('PATH')
if "nmake" in MakePath:
self._FileType = NMAKE_FILETYPE
else:
self._FileType = "gmake"
self._FileType = GMAKE_FILETYPE
if sys.platform == "win32":
self._Platform = WIN32_PLATFORM

View File

@ -15,6 +15,7 @@ from Common.VariableAttributes import VariableAttributes
from Common.Misc import *
import collections
import Common.DataType as DataType
import Common.GlobalData as GlobalData
var_info = collections.namedtuple("uefi_var", "pcdindex,pcdname,defaultstoragename,skuname,var_name, var_guid, var_offset,var_attribute,pcd_default_value, default_value, data_type,PcdDscLine,StructurePcd")
NvStorageHeaderSize = 28
@ -173,11 +174,16 @@ class VariableMgr(object):
offset += VariableHeaderSize + len(default_info.var_name.split(","))
var_data_offset[default_info.pcdindex] = offset
offset += data_size - len(default_info.var_name.split(","))
var_header_buffer = VariableMgr.PACK_VARIABLE_HEADER(var_attr_value, len(default_info.var_name.split(",")), len (default_data), vendorguid)
if GlobalData.gCommandLineDefines.get(TAB_DSC_DEFINES_VPD_AUTHENTICATED_VARIABLE_STORE,"FALSE").upper() == "TRUE":
var_header_buffer = VariableMgr.PACK_AUTHENTICATED_VARIABLE_HEADER(var_attr_value, len(default_info.var_name.split(",")), len (default_data), vendorguid)
else:
var_header_buffer = VariableMgr.PACK_VARIABLE_HEADER(var_attr_value, len(default_info.var_name.split(",")), len (default_data), vendorguid)
NvStoreDataBuffer += (var_header_buffer + DataBuffer)
variable_storage_header_buffer = VariableMgr.PACK_VARIABLE_STORE_HEADER(len(NvStoreDataBuffer) + 28)
if GlobalData.gCommandLineDefines.get(TAB_DSC_DEFINES_VPD_AUTHENTICATED_VARIABLE_STORE,"FALSE").upper() == "TRUE":
variable_storage_header_buffer = VariableMgr.PACK_AUTHENTICATED_VARIABLE_STORE_HEADER(len(NvStoreDataBuffer) + 28)
else:
variable_storage_header_buffer = VariableMgr.PACK_VARIABLE_STORE_HEADER(len(NvStoreDataBuffer) + 28)
nv_default_part = VariableMgr.AlignData(VariableMgr.PACK_DEFAULT_DATA(0, 0, VariableMgr.unpack_data(variable_storage_header_buffer+NvStoreDataBuffer)), 8)
@ -252,6 +258,20 @@ class VariableMgr(object):
return GuidBuffer + SizeBuffer + FormatBuffer + StateBuffer + reservedBuffer
def PACK_AUTHENTICATED_VARIABLE_STORE_HEADER(size):
#Signature: gEfiAuthenticatedVariableGuid
Guid = "{ 0xaaf32c78, 0x947b, 0x439a, { 0xa1, 0x80, 0x2e, 0x14, 0x4e, 0xc3, 0x77, 0x92 }}"
Guid = GuidStructureStringToGuidString(Guid)
GuidBuffer = PackGUID(Guid.split('-'))
SizeBuffer = pack('=L', size)
FormatBuffer = pack('=B', 0x5A)
StateBuffer = pack('=B', 0xFE)
reservedBuffer = pack('=H', 0)
reservedBuffer += pack('=L', 0)
return GuidBuffer + SizeBuffer + FormatBuffer + StateBuffer + reservedBuffer
@staticmethod
def PACK_NV_STORE_DEFAULT_HEADER(size, maxsize):
Signature = pack('=B', ord('N'))
@ -279,6 +299,37 @@ class VariableMgr(object):
return Buffer
@staticmethod
def PACK_AUTHENTICATED_VARIABLE_HEADER(attribute, namesize, datasize, vendorguid):
Buffer = pack('=H', 0x55AA) # pack StartID
Buffer += pack('=B', 0x3F) # pack State
Buffer += pack('=B', 0) # pack reserved
Buffer += pack('=L', attribute)
Buffer += pack('=Q', 0) # pack MonotonicCount
Buffer += pack('=HBBBBBBLhBB', # pack TimeStamp
0, # UINT16 Year
0, # UINT8 Month
0, # UINT8 Day
0, # UINT8 Hour
0, # UINT8 Minute
0, # UINT8 Second
0, # UINT8 Pad1
0, # UINT32 Nanosecond
0, # INT16 TimeZone
0, # UINT8 Daylight
0) # UINT8 Pad2
Buffer += pack('=L', 0) # pack PubKeyIndex
Buffer += pack('=L', namesize)
Buffer += pack('=L', datasize)
Buffer += PackGUID(vendorguid)
return Buffer
@staticmethod
def PACK_VARIABLES_DATA(var_value,data_type, tail = None):
Buffer = bytearray()

View File

@ -254,7 +254,6 @@ class ModuleAutoGen(AutoGen):
self.AutoGenDepSet = set()
self.ReferenceModules = []
self.ConstPcd = {}
self.Makefile = None
self.FileDependCache = {}
def __init_platform_info__(self):

View File

@ -406,6 +406,7 @@ TAB_DSC_DEFINES_SKUID_IDENTIFIER = 'SKUID_IDENTIFIER'
TAB_DSC_DEFINES_PCD_INFO_GENERATION = 'PCD_INFO_GENERATION'
TAB_DSC_DEFINES_PCD_DYNAMIC_AS_DYNAMICEX = 'PCD_DYNAMIC_AS_DYNAMICEX'
TAB_DSC_DEFINES_PCD_VAR_CHECK_GENERATION = 'PCD_VAR_CHECK_GENERATION'
TAB_DSC_DEFINES_VPD_AUTHENTICATED_VARIABLE_STORE = 'VPD_AUTHENTICATED_VARIABLE_STORE'
TAB_DSC_DEFINES_FLASH_DEFINITION = 'FLASH_DEFINITION'
TAB_DSC_DEFINES_BUILD_NUMBER = 'BUILD_NUMBER'
TAB_DSC_DEFINES_MAKEFILE_NAME = 'MAKEFILE_NAME'

View File

@ -105,7 +105,7 @@ class Ecc(object):
def InitDefaultConfigIni(self):
paths = map(lambda p: os.path.join(p, 'Ecc', 'config.ini'), sys.path)
paths = (os.path.realpath('config.ini'),) + tuple(paths)
paths = (os.path.abspath('config.ini'),) + tuple(paths)
for path in paths:
if os.path.exists(path):
self.ConfigFile = path

View File

@ -707,8 +707,8 @@ class FfsInfStatement(FfsInfStatementClassObject):
FileName,
'DEBUG'
)
OutputPath = os.path.realpath(OutputPath)
DebugPath = os.path.realpath(DebugPath)
OutputPath = os.path.abspath(OutputPath)
DebugPath = os.path.abspath(DebugPath)
return OutputPath, DebugPath
## __GenSimpleFileSection__() method

View File

@ -20,7 +20,7 @@ from linecache import getlines
from io import BytesIO
import Common.LongFilePathOs as os
from Common.TargetTxtClassObject import TargetTxtDict
from Common.TargetTxtClassObject import TargetTxtDict,gDefaultTargetTxtFile
from Common.DataType import *
import Common.GlobalData as GlobalData
from Common import EdkLogger
@ -153,7 +153,7 @@ def GenFdsApi(FdsCommandDict, WorkSpaceDataBase=None):
FdfFilename = GenFdsGlobalVariable.ReplaceWorkspaceMacro(FdfFilename)
if FdfFilename[0:2] == '..':
FdfFilename = os.path.realpath(FdfFilename)
FdfFilename = os.path.abspath(FdfFilename)
if not os.path.isabs(FdfFilename):
FdfFilename = mws.join(GenFdsGlobalVariable.WorkSpaceDir, FdfFilename)
if not os.path.exists(FdfFilename):
@ -175,7 +175,7 @@ def GenFdsApi(FdsCommandDict, WorkSpaceDataBase=None):
ActivePlatform = GenFdsGlobalVariable.ReplaceWorkspaceMacro(ActivePlatform)
if ActivePlatform[0:2] == '..':
ActivePlatform = os.path.realpath(ActivePlatform)
ActivePlatform = os.path.abspath(ActivePlatform)
if not os.path.isabs (ActivePlatform):
ActivePlatform = mws.join(GenFdsGlobalVariable.WorkSpaceDir, ActivePlatform)
@ -207,7 +207,7 @@ def GenFdsApi(FdsCommandDict, WorkSpaceDataBase=None):
GenFdsGlobalVariable.ConfDir = ConfDirectoryPath
if not GlobalData.gConfDirectory:
GlobalData.gConfDirectory = GenFdsGlobalVariable.ConfDir
BuildConfigurationFile = os.path.normpath(os.path.join(ConfDirectoryPath, "target.txt"))
BuildConfigurationFile = os.path.normpath(os.path.join(ConfDirectoryPath, gDefaultTargetTxtFile))
if os.path.isfile(BuildConfigurationFile) == True:
# if no build target given in command line, get it from target.txt
TargetObj = TargetTxtDict()
@ -299,7 +299,7 @@ def GenFdsApi(FdsCommandDict, WorkSpaceDataBase=None):
for Key in GenFdsGlobalVariable.OutputDirDict:
OutputDir = GenFdsGlobalVariable.OutputDirDict[Key]
if OutputDir[0:2] == '..':
OutputDir = os.path.realpath(OutputDir)
OutputDir = os.path.abspath(OutputDir)
if OutputDir[1] != ':':
OutputDir = os.path.join (GenFdsGlobalVariable.WorkSpaceDir, OutputDir)

View File

@ -24,7 +24,7 @@ from Common import EdkLogger
from Common.Misc import SaveFileOnChange
from Common.TargetTxtClassObject import TargetTxtDict
from Common.ToolDefClassObject import ToolDefDict
from Common.ToolDefClassObject import ToolDefDict,gDefaultToolsDefFile
from AutoGen.BuildEngine import ToolBuildRule
import Common.DataType as DataType
from Common.Misc import PathClass,CreateDirectory
@ -103,7 +103,7 @@ class GenFdsGlobalVariable:
TargetObj = TargetTxtDict()
ToolDefinitionFile = TargetObj.Target.TargetTxtDictionary[DataType.TAB_TAT_DEFINES_TOOL_CHAIN_CONF]
if ToolDefinitionFile == '':
ToolDefinitionFile = "Conf/tools_def.txt"
ToolDefinitionFile = os.path.join('Conf', gDefaultToolsDefFile)
if os.path.isfile(ToolDefinitionFile):
ToolDefObj = ToolDefDict((os.path.join(os.getenv("WORKSPACE"), "Conf")))
ToolDefinition = ToolDefObj.ToolDef.ToolsDefTxtDatabase

View File

@ -17,6 +17,7 @@ import Common.BuildToolError as BuildToolError
from Common.DataType import *
from Common.BuildVersion import gBUILD_VERSION
from Common.LongFilePathSupport import OpenLongFilePath as open
from Common.TargetTxtClassObject import gDefaultTargetTxtFile
# To Do 1.set clean, 2. add item, if the line is disabled.
@ -25,7 +26,7 @@ class TargetTool():
self.WorkSpace = os.path.normpath(os.getenv('WORKSPACE'))
self.Opt = opt
self.Arg = args[0]
self.FileName = os.path.normpath(os.path.join(self.WorkSpace, 'Conf', 'target.txt'))
self.FileName = os.path.normpath(os.path.join(self.WorkSpace, 'Conf', gDefaultTargetTxtFile))
if os.path.isfile(self.FileName) == False:
print("%s does not exist." % self.FileName)
sys.exit(1)

View File

@ -590,7 +590,6 @@ class PackageBuildClassObject(BuildData):
# @var OutputDirectory: To store value for OutputDirectory
# @var FlashDefinition: To store value for FlashDefinition
# @var BuildNumber: To store value for BuildNumber
# @var MakefileName: To store value for MakefileName
# @var SkuIds: To store value for SkuIds, it is a set structure as
# { 'SkuName' : SkuId, '!include' : includefilename, ...}
# @var Modules: To store value for Modules, it is a list structure as
@ -614,7 +613,6 @@ class PlatformBuildClassObject(BuildData):
self.OutputDirectory = ''
self.FlashDefinition = ''
self.BuildNumber = ''
self.MakefileName = ''
self.SkuIds = {}
self.Modules = []

View File

@ -19,8 +19,8 @@ from Common.Misc import *
from types import *
from Common.Expression import *
from CommonDataClass.CommonClass import SkuInfoClass
from Common.TargetTxtClassObject import TargetTxtDict
from Common.ToolDefClassObject import ToolDefDict
from Common.TargetTxtClassObject import TargetTxtDict,gDefaultTargetTxtFile
from Common.ToolDefClassObject import ToolDefDict,gDefaultToolsDefFile
from .MetaDataTable import *
from .MetaFileTable import *
from .MetaFileParser import *
@ -387,6 +387,10 @@ class DscBuildData(PlatformBuildClassObject):
for i in range(0, len(LanguageCodes), 3):
LanguageList.append(LanguageCodes[i:i + 3])
self._ISOLanguages = LanguageList
elif Name == TAB_DSC_DEFINES_VPD_AUTHENTICATED_VARIABLE_STORE:
if TAB_DSC_DEFINES_VPD_AUTHENTICATED_VARIABLE_STORE not in gCommandLineDefines:
gCommandLineDefines[TAB_DSC_DEFINES_VPD_AUTHENTICATED_VARIABLE_STORE] = Record[2].strip()
elif Name == TAB_DSC_DEFINES_VPD_TOOL_GUID:
#
# try to convert GUID to a real UUID value to see whether the GUID is format
@ -3526,12 +3530,11 @@ class DscBuildData(PlatformBuildClassObject):
self._ToolChainFamily = TAB_COMPILER_MSFT
TargetObj = TargetTxtDict()
TargetTxt = TargetObj.Target
BuildConfigurationFile = os.path.normpath(os.path.join(GlobalData.gConfDirectory, "target.txt"))
BuildConfigurationFile = os.path.normpath(os.path.join(GlobalData.gConfDirectory, gDefaultTargetTxtFile))
if os.path.isfile(BuildConfigurationFile) == True:
ToolDefinitionFile = TargetTxt.TargetTxtDictionary[DataType.TAB_TAT_DEFINES_TOOL_CHAIN_CONF]
if ToolDefinitionFile == '':
ToolDefinitionFile = "tools_def.txt"
ToolDefinitionFile = os.path.normpath(mws.join(self.WorkspaceDir, 'Conf', ToolDefinitionFile))
ToolDefinitionFile = os.path.normpath(mws.join(self.WorkspaceDir, 'Conf', gDefaultToolsDefFile))
if os.path.isfile(ToolDefinitionFile) == True:
ToolDefObj = ToolDefDict((os.path.join(os.getenv("WORKSPACE"), "Conf")))
ToolDefinition = ToolDefObj.ToolDef.ToolsDefTxtDatabase

View File

@ -4,7 +4,7 @@
# Copyright (c) 2014, Hewlett-Packard Development Company, L.P.<BR>
# Copyright (c) 2007 - 2021, Intel Corporation. All rights reserved.<BR>
# Copyright (c) 2018, Hewlett Packard Enterprise Development, L.P.<BR>
# Copyright (c) 2020, ARM Limited. All rights reserved.<BR>
# Copyright (c) 2020 - 2021, ARM Limited. All rights reserved.<BR>
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
@ -67,10 +67,6 @@ from AutoGen.AutoGen import CalculatePriorityValue
## standard targets of build command
gSupportedTarget = ['all', 'genc', 'genmake', 'modules', 'libraries', 'fds', 'clean', 'cleanall', 'cleanlib', 'run']
## build configuration file
gBuildConfiguration = "target.txt"
gToolsDefinition = "tools_def.txt"
TemporaryTablePattern = re.compile(r'^_\d+_\d+_[a-fA-F0-9]+$')
TmpTableDict = {}
@ -1308,6 +1304,9 @@ class Build():
if Target == 'run':
return True
# Fetch the MakeFileName.
self.MakeFileName = AutoGenObject.MakeFileName
# build modules
if BuildModule:
BuildCommand = BuildCommand + [Target]
@ -2183,8 +2182,6 @@ class Build():
Pa.CreateLibModuelDirs()
# Fetch the MakeFileName.
self.MakeFileName = Pa.MakeFileName
if not self.MakeFileName:
self.MakeFileName = Pa.MakeFile
Pa.DataPipe.DataContainer = {"LibraryBuildDirectoryList":Pa.LibraryBuildDirectoryList}
Pa.DataPipe.DataContainer = {"ModuleBuildDirectoryList":Pa.ModuleBuildDirectoryList}

View File

@ -864,15 +864,11 @@ Pkcs7Verify (
// For generic PKCS#7 handling, InData may be NULL if the content is present
// in PKCS#7 structure. So ignore NULL checking here.
//
DataBio = BIO_new (BIO_s_mem ());
DataBio = BIO_new_mem_buf (InData, (int) DataLength);
if (DataBio == NULL) {
goto _Exit;
}
if (BIO_write (DataBio, InData, (int) DataLength) <= 0) {
goto _Exit;
}
//
// Allow partial certificate chains, terminated by a non-self-signed but
// still trusted intermediate certificate. Also disable time checks.

View File

@ -1,7 +1,7 @@
## @file
# Dsc include file for Dynamic Tables Framework.
#
# Copyright (c) 2017 - 2020, Arm Limited. All rights reserved.<BR>
# Copyright (c) 2017 - 2021, Arm Limited. All rights reserved.<BR>
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
@ -13,6 +13,7 @@
RELEASE_*_*_CC_FLAGS = -DMDEPKG_NDEBUG
[LibraryClasses.common]
AcpiHelperLib|DynamicTablesPkg/Library/Common/AcpiHelperLib/AcpiHelperLib.inf
AmlLib|DynamicTablesPkg/Library/Common/AmlLib/AmlLib.inf
SsdtSerialPortFixupLib|DynamicTablesPkg/Library/Common/SsdtSerialPortFixupLib/SsdtSerialPortFixupLib.inf
TableHelperLib|DynamicTablesPkg/Library/Common/TableHelperLib/TableHelperLib.inf
@ -36,6 +37,9 @@
DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtSerialPortLibArm/SsdtSerialPortLibArm.inf
DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtCmn600LibArm/SsdtCmn600LibArm.inf
# AML Codegen
DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtCpuTopologyLibArm/SsdtCpuTopologyLibArm.inf
#
# Dynamic Table Factory Dxe
#
@ -55,6 +59,9 @@
# AML Fixup
NULL|DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtSerialPortLibArm/SsdtSerialPortLibArm.inf
NULL|DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtCmn600LibArm/SsdtCmn600LibArm.inf
# AML Codegen
NULL|DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtCpuTopologyLibArm/SsdtCpuTopologyLibArm.inf
}
#

View File

@ -5,6 +5,28 @@
# SPDX-License-Identifier: BSD-2-Clause-Patent
##
{
"EccCheck": {
## Exception sample looks like below:
## "ExceptionList": [
## "<ErrorID>", "<KeyWord>"
## ]
"ExceptionList": [
# "The #ifndef at the start of an include file should use
# both prefix and postfix underscore characters, '_'"
# This error is not triggered for the latest BaseTools code.
# @TODO The error should be re-enabled when the python packages
# containing the BaseTools are updated to the latest version.
"8003", "DISABLE_NEW_DEPRECATED_INTERFACES",
"9005", "@defgroup", # Use extra Doxygen commands
"9005", "@ingroup", # Use extra Doxygen commands
"9005", "@mainpage", # Use extra Doxygen commands
"9005", "@ref", # Use extra Doxygen commands
],
## Both file path and directory path are accepted.
"IgnoreFiles": [
]
},
## options defined .pytool/Plugin/CompilerPlugin
"CompilerPlugin": {
"DscPath": "DynamicTablesPkg.dsc"
@ -23,6 +45,7 @@
## options defined .pytool/Plugin/DependencyCheck
"DependencyCheck": {
"AcceptableDependencies": [
"ArmPkg/ArmPkg.dec",
"ArmPlatformPkg/ArmPlatformPkg.dec",
"EmbeddedPkg/EmbeddedPkg.dec",
"DynamicTablesPkg/DynamicTablesPkg.dec",
@ -77,19 +100,25 @@
"CCIDX",
"CCSIDR",
"countof",
"edynamic",
"EOBJECT",
"invoc",
"ITARGETSR",
"GTBLOCK",
"lgreater",
"lless",
"MPIDR",
"PERIPHBASE",
"phandle",
"pytool",
"Rdword",
"Roadmap",
"ROOTNODEBASE",
"ssdtcmn",
"ssdtserialporttemplate",
"SMMUV",
"ssdtpcieosctemplate",
"SSDTPC",
"standardised",
"TABLEEX",
"TNSID",

View File

@ -17,6 +17,10 @@
Include
[LibraryClasses]
## @libraryclass Defines a set of Acpi helper methods
# independent from the Dynamic Tables Framework.
AcpiHelperLib|Include/Library/AcpiHelperLib.h
## @libraryclass Defines a set of APIs for Dynamic AML generation.
AmlLib|Include/Library/AmlLib/AmlLib.h

View File

@ -35,9 +35,11 @@
[LibraryClasses.ARM, LibraryClasses.AARCH64]
NULL|ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
NULL|MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib.inf
PL011UartLib|ArmPlatformPkg/Library/PL011UartLib/PL011UartLib.inf
[Components.common]
DynamicTablesPkg/Library/Common/AcpiHelperLib/AcpiHelperLib.inf
DynamicTablesPkg/Library/Common/AmlLib/AmlLib.inf
DynamicTablesPkg/Library/Common/SsdtSerialPortFixupLib/SsdtSerialPortFixupLib.inf
DynamicTablesPkg/Library/Common/TableHelperLib/TableHelperLib.inf
@ -50,4 +52,3 @@
# Inhibit C6305: Potential mismatch between sizeof and countof quantities.
*_VS2017_*_CC_FLAGS = /wd6305 /analyze
!endif

View File

@ -1,6 +1,6 @@
/** @file
Copyright (c) 2017 - 2020, Arm Limited. All rights reserved.<BR>
Copyright (c) 2017 - 2021, Arm Limited. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
@ -63,6 +63,10 @@ The Dynamic Tables Framework implements the following ACPI table generators:
The SSDT CMN-600 generator collates the CMN-600 information
from the Configuration Manager and patches the SSDT CMN-600
template to build the SSDT CMN-600 table.
- SSDT Cpu-Topology:
The SSDT Cpu-Topology generator collates the cpu and LPI
information from the Configuration Manager and generates a
SSDT table describing the CPU hierarchy.
*/
/** The ACPI_TABLE_GENERATOR_ID type describes ACPI table generator ID.
@ -88,6 +92,7 @@ typedef enum StdAcpiTableId {
EStdAcpiTableIdSrat, ///< SRAT Generator
EStdAcpiTableIdSsdtSerialPort, ///< SSDT Serial-Port Generator
EStdAcpiTableIdSsdtCmn600, ///< SSDT Cmn-600 Generator
EStdAcpiTableIdSsdtCpuTopology, ///< SSDT Cpu Topology
EStdAcpiTableIdMax
} ESTD_ACPI_TABLE_ID;

View File

@ -58,6 +58,7 @@ typedef enum ArmObjectID {
EArmObjGenericInitiatorAffinityInfo, ///< 34 - Generic Initiator Affinity
EArmObjSerialPortInfo, ///< 35 - Generic Serial Port Info
EArmObjCmn600Info, ///< 36 - CMN-600 Info
EArmObjLpiInfo, ///< 37 - Lpi Info
EArmObjMax
} EARM_OBJECT_ID;
@ -395,21 +396,21 @@ typedef struct CmArmGTBlockInfo {
} CM_ARM_GTBLOCK_INFO;
/** A structure that describes the
SBSA Generic Watchdog information for the Platform.
Arm Generic Watchdog information for the Platform.
ID: EArmObjPlatformGenericWatchdogInfo
*/
typedef struct CmArmGenericWatchdogInfo {
/// The physical base address of the SBSA Watchdog control frame
/// The physical base address of the Arm Watchdog control frame
UINT64 ControlFrameAddress;
/// The physical base address of the SBSA Watchdog refresh frame
/// The physical base address of the Arm Watchdog refresh frame
UINT64 RefreshFrameAddress;
/// The watchdog interrupt
UINT32 TimerGSIV;
/** The flags for the watchdog as described by the SBSA watchdog
/** The flags for the watchdog as described by the Arm watchdog
structure in the ACPI specification.
*/
UINT32 Flags;
@ -711,6 +712,10 @@ typedef struct CmArmProcHierarchyInfo {
/// the NoOfPrivateResources is 0, in which case it is recommended to set
/// this field to CM_NULL_TOKEN.
CM_OBJECT_TOKEN PrivateResourcesArrayToken;
/// Optional field: Reference Token for the Lpi state of this processor.
/// Token identifying a CM_ARM_OBJ_REF structure, itself referencing
/// CM_ARM_LPI_INFO objects.
CM_OBJECT_TOKEN LpiToken;
} CM_ARM_PROC_HIERARCHY_INFO;
/** A structure that describes the Cache Type Structure (Type 1) in PPTT
@ -878,6 +883,69 @@ typedef struct CmArmCmn600Info {
CM_ARM_EXTENDED_INTERRUPT DtcInterrupt[4];
} CM_ARM_CMN_600_INFO;
/** A structure that describes the Lpi information.
The Low Power Idle states are described in DSDT/SSDT and associated
to cpus/clusters in the cpu topology.
ID: EArmObjLpiInfo
*/
typedef struct CmArmLpiInfo {
/** Minimum Residency. Time in microseconds after which a
state becomes more energy efficient than any shallower state.
*/
UINT32 MinResidency;
/** Worst case time in microseconds from a wake interrupt
being asserted to the return to a running state
*/
UINT32 WorstCaseWakeLatency;
/** Flags.
*/
UINT32 Flags;
/** Architecture specific context loss flags.
*/
UINT32 ArchFlags;
/** Residency counter frequency in cycles-per-second (Hz).
*/
UINT32 ResCntFreq;
/** Every shallower power state in the parent is also enabled.
*/
UINT32 EnableParentState;
/** The EntryMethod _LPI field can be described as an integer
or in a Register resource data descriptor.
If IsInteger is TRUE, the IntegerEntryMethod field is used.
If IsInteger is FALSE, the RegisterEntryMethod field is used.
*/
BOOLEAN IsInteger;
/** EntryMethod described as an Integer.
*/
UINT64 IntegerEntryMethod;
/** EntryMethod described as a EFI_ACPI_GENERIC_REGISTER_DESCRIPTOR.
*/
EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE RegisterEntryMethod;
/** Residency counter register.
*/
EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE ResidencyCounterRegister;
/** Usage counter register.
*/
EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE UsageCounterRegister;
/** String representing the Lpi state
*/
CHAR8 StateName[16];
} CM_ARM_LPI_INFO;
#pragma pack()
#endif // ARM_NAMESPACE_OBJECTS_H_

View File

@ -0,0 +1,93 @@
/** @file
Copyright (c) 2017 - 2021, Arm Limited. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef ACPI_HELPER_LIB_H_
#define ACPI_HELPER_LIB_H_
/** Is a character upper case
*/
#define IS_UPPER_CHAR(x) ((x >= 'A') && (x <= 'Z'))
/** Is a character a decimal digit
*/
#define IS_DIGIT(x) ((x >= '0') && (x <= '9'))
/** Is a character an upper case hexadecimal digit
*/
#define IS_UPPER_HEX(x) (((x >= 'A') && (x <= 'F')) || IS_DIGIT (x))
/** Convert a hex number to its ASCII code.
@param [in] Hex Hex number to convert.
Must be 0 <= x < 16.
@return The ASCII code corresponding to x.
-1 if error.
**/
UINT8
EFIAPI
AsciiFromHex (
IN UINT8 Hex
);
/** Convert an ASCII char representing an hexadecimal number
to its integer value.
@param [in] Char Char to convert.
Must be between '0'-'9' or 'A'-'F' or 'a'-'f'.
@return The corresponding integer (between 0-16).
-1 if error.
**/
UINT8
EFIAPI
HexFromAscii (
IN CHAR8 Char
);
/** Check if a HID is a valid PNP ID.
@param [in] Hid The Hid to validate.
@retval TRUE The Hid is a valid PNP ID.
@retval FALSE The Hid is not a valid PNP ID.
**/
BOOLEAN
IsValidPnpId (
IN CONST CHAR8 * Hid
);
/** Check if a HID is a valid ACPI ID.
@param [in] Hid The Hid to validate.
@retval TRUE The Hid is a valid ACPI ID.
@retval FALSE The Hid is not a valid ACPI ID.
**/
BOOLEAN
IsValidAcpiId (
IN CONST CHAR8 * Hid
);
/** Convert a EisaId string to its compressed UINT32 equivalent.
Cf. ACPI 6.4 specification, s19.3.4 "ASL Macros": "Eisaid"
@param [in] EisaIdStr Input EisaId string.
@param [out] EisaIdInt Output EisaId UINT32 (compressed).
@retval EFI_SUCCESS The function completed successfully.
@retval EFI_INVALID_PARAMETER Invalid parameter.
**/
EFI_STATUS
EFIAPI
AmlGetEisaIdFromString (
IN CONST CHAR8 * EisaIdStr,
OUT UINT32 * EisaIdInt
);
#endif // ACPI_HELPER_LIB_H_

View File

@ -1,7 +1,7 @@
/** @file
AML Lib.
Copyright (c) 2019 - 2020, Arm Limited. All rights reserved.<BR>
Copyright (c) 2019 - 2021, Arm Limited. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
@ -301,7 +301,7 @@ AmlNameOpUpdateString (
IN CONST CHAR8 * NewName
);
/** Get the first Resource Data element contained in a "_CRS" object.
/** Get the first Resource Data element contained in a named object.
In the following ASL code, the function will return the Resource Data
node corresponding to the "QWordMemory ()" ASL macro.
@ -312,27 +312,26 @@ AmlNameOpUpdateString (
)
Note:
- The "_CRS" object must be declared using ASL "Name (Declare Named Object)".
- "_CRS" declared using ASL "Method (Declare Control Method)" is not
supported.
"_CRS" names defined as methods are not handled by this function.
They must be defined as names, using the "Name ()" statement.
@ingroup UserApis
@param [in] NameOpCrsNode NameOp object node defining a "_CRS" object.
Must have an OpCode=AML_NAME_OP, SubOpCode=0.
NameOp object nodes are defined in ASL
using the "Name ()" function.
@param [out] OutRdNode Pointer to the first Resource Data element of
the "_CRS" object. A Resource Data element
is stored in a data node.
@param [in] NameOpNode NameOp object node defining a named object.
Must have an OpCode=AML_NAME_OP, SubOpCode=0.
NameOp object nodes are defined in ASL
using the "Name ()" function.
@param [out] OutRdNode Pointer to the first Resource Data element of
the named object. A Resource Data element
is stored in a data node.
@retval EFI_SUCCESS The function completed successfully.
@retval EFI_INVALID_PARAMETER Invalid parameter.
**/
EFI_STATUS
EFIAPI
AmlNameOpCrsGetFirstRdNode (
IN AML_OBJECT_NODE_HANDLE NameOpCrsNode,
AmlNameOpGetFirstRdNode (
IN AML_OBJECT_NODE_HANDLE NameOpNode,
OUT AML_DATA_NODE_HANDLE * OutRdNode
);
@ -347,13 +346,14 @@ AmlNameOpCrsGetFirstRdNode (
}
)
The CurrRdNode Resource Data node must be defined in an object named "_CRS"
and defined by a "Name ()" ASL function.
Note:
"_CRS" names defined as methods are not handled by this function.
They must be defined as names, using the "Name ()" statement.
@ingroup UserApis
@param [in] CurrRdNode Pointer to the current Resource Data element of
the "_CRS" variable.
the named object.
@param [out] OutRdNode Pointer to the Resource Data element following
the CurrRdNode.
Contain a NULL pointer if CurrRdNode is the
@ -366,7 +366,7 @@ AmlNameOpCrsGetFirstRdNode (
**/
EFI_STATUS
EFIAPI
AmlNameOpCrsGetNextRdNode (
AmlNameOpGetNextRdNode (
IN AML_DATA_NODE_HANDLE CurrRdNode,
OUT AML_DATA_NODE_HANDLE * OutRdNode
);
@ -418,36 +418,21 @@ AmlUpdateRdQWord (
IN UINT64 BaseAddressLength
);
/** Add an Interrupt Resource Data node.
This function creates a Resource Data element corresponding to the
"Interrupt ()" ASL function, stores it in an AML Data Node.
It then adds it after the input CurrRdNode in the list of resource data
element.
/** Code generation for the "Interrupt ()" ASL function.
The Resource Data effectively created is an Extended Interrupt Resource
Data. See ACPI 6.3 specification, s6.4.3.6 "Extended Interrupt Descriptor"
for more information about Extended Interrupt Resource Data.
Data. Cf ACPI 6.4:
- s6.4.3.6 "Extended Interrupt Descriptor"
- s19.6.64 "Interrupt (Interrupt Resource Descriptor Macro)"
The Extended Interrupt contains one single interrupt.
The created resource data node can be:
- appended to the list of resource data elements of the NameOpNode.
In such case NameOpNode must be defined by a the "Name ()" ASL statement
and initially contain a "ResourceTemplate ()".
- returned through the NewRdNode parameter.
This function allocates memory to create a data node. It is the caller's
responsibility to either:
- attach this node to an AML tree;
- delete this node.
@ingroup CodeGenApis
Note: The _CRS node must be defined using the ASL Name () function.
e.g. Name (_CRS, ResourceTemplate () {
...
}
@ingroup UserApis
@param [in] NameOpCrsNode NameOp object node defining a "_CRS" object.
Must have an OpCode=AML_NAME_OP, SubOpCode=0.
NameOp object nodes are defined in ASL
using the "Name ()" function.
@param [in] ResourceConsumer The device consumes the specified interrupt
or produces it for use by a child device.
@param [in] EdgeTriggered The interrupt is edge triggered or
@ -457,7 +442,12 @@ AmlUpdateRdQWord (
devices or not (Exclusive).
@param [in] IrqList Interrupt list. Must be non-NULL.
@param [in] IrqCount Interrupt count. Must be non-zero.
@param [in] NameOpNode NameOp object node defining a named object.
If provided, append the new resource data node
to the list of resource data elements of this
node.
@param [out] NewRdNode If provided and success,
contain the created node.
@retval EFI_SUCCESS The function completed successfully.
@retval EFI_INVALID_PARAMETER Invalid parameter.
@ -465,14 +455,15 @@ AmlUpdateRdQWord (
**/
EFI_STATUS
EFIAPI
AmlCodeGenCrsAddRdInterrupt (
IN AML_OBJECT_NODE_HANDLE NameOpCrsNode,
AmlCodeGenRdInterrupt (
IN BOOLEAN ResourceConsumer,
IN BOOLEAN EdgeTriggered,
IN BOOLEAN ActiveLow,
IN BOOLEAN Shared,
IN UINT32 * IrqList,
IN UINT8 IrqCount
IN UINT32 *IrqList,
IN UINT8 IrqCount,
IN AML_OBJECT_NODE_HANDLE NameOpNode, OPTIONAL
OUT AML_DATA_NODE_HANDLE *NewRdNode OPTIONAL
);
/** AML code generation for DefinitionBlock.
@ -628,4 +619,310 @@ AmlCodeGenScope (
OUT AML_OBJECT_NODE_HANDLE * NewObjectNode OPTIONAL
);
/** AML code generation for a method returning a NameString.
AmlCodeGenMethodRetNameString (
"MET0", "_CRS", 1, TRUE, 3, ParentNode, NewObjectNode
);
is equivalent of the following ASL code:
Method(MET0, 1, Serialized, 3) {
Return (_CRS)
}
The ASL parameters "ReturnType" and "ParameterTypes" are not asked
in this function. They are optional parameters in ASL.
@ingroup CodeGenApis
@param [in] MethodNameString The new Method's name.
Must be a NULL-terminated ASL NameString
e.g.: "MET0", "_SB.MET0", etc.
The input string is copied.
@param [in] ReturnedNameString The name of the object returned by the
method. Optional parameter, can be:
- NULL (ignored).
- A NULL-terminated ASL NameString.
e.g.: "MET0", "_SB.MET0", etc.
The input string is copied.
@param [in] NumArgs Number of arguments.
Must be 0 <= NumArgs <= 6.
@param [in] IsSerialized TRUE is equivalent to Serialized.
FALSE is equivalent to NotSerialized.
Default is NotSerialized in ASL spec.
@param [in] SyncLevel Synchronization level for the method.
Must be 0 <= SyncLevel <= 15.
Default is 0 in ASL.
@param [in] ParentNode If provided, set ParentNode as the parent
of the node created.
@param [out] NewObjectNode If success, contains the created node.
@retval EFI_SUCCESS Success.
@retval EFI_INVALID_PARAMETER Invalid parameter.
@retval EFI_OUT_OF_RESOURCES Failed to allocate memory.
**/
EFI_STATUS
EFIAPI
AmlCodeGenMethodRetNameString (
IN CONST CHAR8 * MethodNameString,
IN CONST CHAR8 * ReturnedNameString, OPTIONAL
IN UINT8 NumArgs,
IN BOOLEAN IsSerialized,
IN UINT8 SyncLevel,
IN AML_NODE_HANDLE ParentNode, OPTIONAL
OUT AML_OBJECT_NODE_HANDLE * NewObjectNode OPTIONAL
);
/** Create a _LPI name.
AmlCreateLpiNode ("_LPI", 0, 1, ParentNode, &LpiNode) is
equivalent of the following ASL code:
Name (_LPI, Package (
0, // Revision
1, // LevelId
0 // Count
))
This function doesn't define any LPI state. As shown above, the count
of _LPI state is set to 0.
The AmlAddLpiState () function must be used to add LPI states.
Cf ACPI 6.3 specification, s8.4.4 "Lower Power Idle States".
@ingroup CodeGenApis
@param [in] LpiNameString The new LPI 's object name.
Must be a NULL-terminated ASL NameString
e.g.: "_LPI", "DEV0.PLPI", etc.
The input string is copied.
@param [in] Revision Revision number of the _LPI states.
@param [in] LevelId A platform defined number that identifies the
level of hierarchy of the processor node to
which the LPI states apply.
@param [in] ParentNode If provided, set ParentNode as the parent
of the node created.
@param [out] NewLpiNode If success, contains the created node.
@retval EFI_SUCCESS The function completed successfully.
@retval EFI_INVALID_PARAMETER Invalid parameter.
@retval EFI_OUT_OF_RESOURCES Failed to allocate memory.
**/
EFI_STATUS
EFIAPI
AmlCreateLpiNode (
IN CONST CHAR8 * LpiNameString,
IN UINT16 Revision,
IN UINT64 LevelId,
IN AML_NODE_HANDLE ParentNode, OPTIONAL
OUT AML_OBJECT_NODE_HANDLE * NewLpiNode OPTIONAL
);
/** Add an _LPI state to a LPI node created using AmlCreateLpiNode ().
AmlAddLpiState () increments the Count of LPI states in the LPI node by one,
and adds the following package:
Package() {
MinResidency,
WorstCaseWakeLatency,
Flags,
ArchFlags,
ResCntFreq,
EnableParentState,
(GenericRegisterDescriptor != NULL) ? // Entry method. If a
ResourceTemplate(GenericRegisterDescriptor) : // Register is given,
Integer, // use it. Use the
// Integer otherwise.
ResourceTemplate() { // NULL Residency Counter
Register (SystemMemory, 0, 0, 0, 0)
},
ResourceTemplate() { // NULL Usage Counter
Register (SystemMemory, 0, 0, 0, 0)
},
"" // NULL State Name
},
Cf ACPI 6.3 specification, s8.4.4 "Lower Power Idle States".
@ingroup CodeGenApis
@param [in] MinResidency Minimum Residency.
@param [in] WorstCaseWakeLatency Worst case wake-up latency.
@param [in] Flags Flags.
@param [in] ArchFlags Architectural flags.
@param [in] ResCntFreq Residency Counter Frequency.
@param [in] EnableParentState Enabled Parent State.
@param [in] GenericRegisterDescriptor Entry Method.
If not NULL, use this Register to
describe the entry method address.
@param [in] Integer Entry Method.
If GenericRegisterDescriptor is NULL,
take this value.
@param [in] ResidencyCounterRegister If not NULL, use it to populate the
residency counter register.
@param [in] UsageCounterRegister If not NULL, use it to populate the
usage counter register.
@param [in] StateName If not NULL, use it to populate the
state name.
@param [in] LpiNode Lpi node created with the function
AmlCreateLpiNode to which the new LPI
state is appended.
@retval EFI_SUCCESS The function completed successfully.
@retval EFI_INVALID_PARAMETER Invalid parameter.
@retval EFI_OUT_OF_RESOURCES Failed to allocate memory.
**/
EFI_STATUS
EFIAPI
AmlAddLpiState (
IN UINT32 MinResidency,
IN UINT32 WorstCaseWakeLatency,
IN UINT32 Flags,
IN UINT32 ArchFlags,
IN UINT32 ResCntFreq,
IN UINT32 EnableParentState,
IN EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE * GenericRegisterDescriptor, OPTIONAL
IN UINT64 Integer, OPTIONAL
IN EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE * ResidencyCounterRegister, OPTIONAL
IN EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE * UsageCounterRegister, OPTIONAL
IN CHAR8 * StateName, OPTIONAL
IN AML_OBJECT_NODE_HANDLE LpiNode
);
// DEPRECATED APIS
#ifndef DISABLE_NEW_DEPRECATED_INTERFACES
/** DEPRECATED API
Get the first Resource Data element contained in a "_CRS" object.
In the following ASL code, the function will return the Resource Data
node corresponding to the "QWordMemory ()" ASL macro.
Name (_CRS, ResourceTemplate() {
QWordMemory (...) {...},
Interrupt (...) {...}
}
)
Note:
- The "_CRS" object must be declared using ASL "Name (Declare Named Object)".
- "_CRS" declared using ASL "Method (Declare Control Method)" is not
supported.
@ingroup UserApis
@param [in] NameOpCrsNode NameOp object node defining a "_CRS" object.
Must have an OpCode=AML_NAME_OP, SubOpCode=0.
NameOp object nodes are defined in ASL
using the "Name ()" function.
@param [out] OutRdNode Pointer to the first Resource Data element of
the "_CRS" object. A Resource Data element
is stored in a data node.
@retval EFI_SUCCESS The function completed successfully.
@retval EFI_INVALID_PARAMETER Invalid parameter.
**/
EFI_STATUS
EFIAPI
AmlNameOpCrsGetFirstRdNode (
IN AML_OBJECT_NODE_HANDLE NameOpCrsNode,
OUT AML_DATA_NODE_HANDLE * OutRdNode
);
/** DEPRECATED API
Get the Resource Data element following the CurrRdNode Resource Data.
In the following ASL code, if CurrRdNode corresponds to the first
"QWordMemory ()" ASL macro, the function will return the Resource Data
node corresponding to the "Interrupt ()" ASL macro.
Name (_CRS, ResourceTemplate() {
QwordMemory (...) {...},
Interrupt (...) {...}
}
)
The CurrRdNode Resource Data node must be defined in an object named "_CRS"
and defined by a "Name ()" ASL function.
@ingroup UserApis
@param [in] CurrRdNode Pointer to the current Resource Data element of
the "_CRS" variable.
@param [out] OutRdNode Pointer to the Resource Data element following
the CurrRdNode.
Contain a NULL pointer if CurrRdNode is the
last Resource Data element in the list.
The "End Tag" is not considered as a resource
data element and is not returned.
@retval EFI_SUCCESS The function completed successfully.
@retval EFI_INVALID_PARAMETER Invalid parameter.
**/
EFI_STATUS
EFIAPI
AmlNameOpCrsGetNextRdNode (
IN AML_DATA_NODE_HANDLE CurrRdNode,
OUT AML_DATA_NODE_HANDLE * OutRdNode
);
/** DEPRECATED API
Add an Interrupt Resource Data node.
This function creates a Resource Data element corresponding to the
"Interrupt ()" ASL function, stores it in an AML Data Node.
It then adds it after the input CurrRdNode in the list of resource data
element.
The Resource Data effectively created is an Extended Interrupt Resource
Data. See ACPI 6.3 specification, s6.4.3.6 "Extended Interrupt Descriptor"
for more information about Extended Interrupt Resource Data.
The Extended Interrupt contains one single interrupt.
This function allocates memory to create a data node. It is the caller's
responsibility to either:
- attach this node to an AML tree;
- delete this node.
Note: The _CRS node must be defined using the ASL Name () function.
e.g. Name (_CRS, ResourceTemplate () {
...
}
@ingroup CodeGenApis
@param [in] NameOpCrsNode NameOp object node defining a "_CRS" object.
Must have an OpCode=AML_NAME_OP, SubOpCode=0.
NameOp object nodes are defined in ASL
using the "Name ()" function.
@param [in] ResourceConsumer The device consumes the specified interrupt
or produces it for use by a child device.
@param [in] EdgeTriggered The interrupt is edge triggered or
level triggered.
@param [in] ActiveLow The interrupt is active-high or active-low.
@param [in] Shared The interrupt can be shared with other
devices or not (Exclusive).
@param [in] IrqList Interrupt list. Must be non-NULL.
@param [in] IrqCount Interrupt count. Must be non-zero.
@retval EFI_SUCCESS The function completed successfully.
@retval EFI_INVALID_PARAMETER Invalid parameter.
@retval EFI_OUT_OF_RESOURCES Could not allocate memory.
**/
EFI_STATUS
EFIAPI
AmlCodeGenCrsAddRdInterrupt (
IN AML_OBJECT_NODE_HANDLE NameOpCrsNode,
IN BOOLEAN ResourceConsumer,
IN BOOLEAN EdgeTriggered,
IN BOOLEAN ActiveLow,
IN BOOLEAN Shared,
IN UINT32 * IrqList,
IN UINT8 IrqCount
);
#endif // DISABLE_NEW_DEPRECATED_INTERFACES
#endif // AML_LIB_H_

View File

@ -12,17 +12,7 @@
#ifndef TABLE_HELPER_LIB_H_
#define TABLE_HELPER_LIB_H_
/** Is a character upper case
*/
#define IS_UPPER_CHAR(x) ((x >= 'A') && (x <= 'Z'))
/** Is a character a decimal digit
*/
#define IS_DIGIT(x) ((x >= '0') && (x <= '9'))
/** Is a character an upper case hexadecimal digit
*/
#define IS_UPPER_HEX(x) (((x >= 'A') && (x <= 'F')) || IS_DIGIT (x))
#include <Library/AmlLib/AmlLib.h>
/** The GetCgfMgrInfo function gets the CM_STD_OBJ_CONFIGURATION_MANAGER_INFO
object from the Configuration Manager.
@ -74,6 +64,39 @@ AddAcpiHeader (
IN CONST UINT32 Length
);
/** Build a RootNode containing SSDT ACPI header information using the AmlLib.
The function utilizes the ACPI table Generator and the Configuration
Manager protocol to obtain any information required for constructing the
header. It then creates a RootNode. The SSDT ACPI header is part of the
RootNode.
This is essentially a wrapper around AmlCodeGenDefinitionBlock ()
from the AmlLib.
@param [in] CfgMgrProtocol Pointer to the Configuration Manager
protocol interface.
@param [in] Generator Pointer to the ACPI table Generator.
@param [in] AcpiTableInfo Pointer to the ACPI table info structure.
@param [out] RootNode If success, contains the created RootNode.
The SSDT ACPI header is part of the RootNode.
@retval EFI_SUCCESS Success.
@retval EFI_INVALID_PARAMETER A parameter is invalid.
@retval EFI_NOT_FOUND The required object information is not found.
@retval EFI_BAD_BUFFER_SIZE The size returned by the Configuration
Manager is less than the Object size for the
requested object.
**/
EFI_STATUS
EFIAPI
AddSsdtAcpiHeader (
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol,
IN CONST ACPI_TABLE_GENERATOR * CONST Generator,
IN CONST CM_STD_OBJ_ACPI_TABLE_INFO * CONST AcpiTableInfo,
OUT AML_ROOT_NODE_HANDLE * RootNode
);
/**
Function prototype for testing if two arbitrary objects are equal.
@ -119,41 +142,14 @@ FindDuplicateValue (
IN PFN_IS_EQUAL EqualTestFunction
);
/** Convert a hex number to its ASCII code.
/** Parse and print a CmObjDesc.
@param [in] x Hex number to convert.
Must be 0 <= x < 16.
@return The ASCII code corresponding to x.
@param [in] CmObjDesc The CmObjDesc to parse and print.
**/
UINT8
VOID
EFIAPI
AsciiFromHex (
IN UINT8 x
);
/** Check if a HID is a valid PNP ID.
@param [in] Hid The Hid to validate.
@retval TRUE The Hid is a valid PNP ID.
@retval FALSE The Hid is not a valid PNP ID.
**/
BOOLEAN
IsValidPnpId (
IN CONST CHAR8 * Hid
);
/** Check if a HID is a valid ACPI ID.
@param [in] Hid The Hid to validate.
@retval TRUE The Hid is a valid ACPI ID.
@retval FALSE The Hid is not a valid ACPI ID.
**/
BOOLEAN
IsValidAcpiId (
IN CONST CHAR8 * Hid
ParseCmObjDesc (
IN CONST CM_OBJ_DESCRIPTOR * CmObjDesc
);
#endif // TABLE_HELPER_LIB_H_

View File

@ -1,11 +1,11 @@
/** @file
FADT Table Generator
Copyright (c) 2017 - 2019, ARM Limited. All rights reserved.
Copyright (c) 2017 - 2021, ARM Limited. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
@par Reference(s):
- ACPI 6.3 Specification, January 2019
- ACPI 6.4 Specification, January 2021
**/
@ -32,8 +32,8 @@ Requirements:
/** This macro defines the FADT flag options for ARM Platforms.
*/
#define FADT_FLAGS (EFI_ACPI_6_3_HW_REDUCED_ACPI | \
EFI_ACPI_6_3_LOW_POWER_S0_IDLE_CAPABLE)
#define FADT_FLAGS (EFI_ACPI_6_4_HW_REDUCED_ACPI | \
EFI_ACPI_6_4_LOW_POWER_S0_IDLE_CAPABLE)
/** This macro defines the valid mask for the FADT flag option
if HW_REDUCED_ACPI flag in the table is set.
@ -42,47 +42,47 @@ Requirements:
22-31 (reserved).
Valid bits are:
EFI_ACPI_6_3_WBINVD BIT0
EFI_ACPI_6_3_PWR_BUTTON BIT4
EFI_ACPI_6_3_SLP_BUTTON BIT5
EFI_ACPI_6_3_FIX_RTC BIT6
EFI_ACPI_6_3_DCK_CAP BIT9
EFI_ACPI_6_3_RESET_REG_SUP BIT10
EFI_ACPI_6_3_SEALED_CASE BIT11
EFI_ACPI_6_3_HEADLESS BIT12
EFI_ACPI_6_3_USE_PLATFORM_CLOCK BIT15
EFI_ACPI_6_3_FORCE_APIC_CLUSTER_MODEL BIT18
EFI_ACPI_6_3_FORCE_APIC_PHYSICAL_DESTINATION_MODE BIT19
EFI_ACPI_6_3_HW_REDUCED_ACPI BIT20
EFI_ACPI_6_3_LOW_POWER_S0_IDLE_CAPABLE BIT21
EFI_ACPI_6_4_WBINVD BIT0
EFI_ACPI_6_4_PWR_BUTTON BIT4
EFI_ACPI_6_4_SLP_BUTTON BIT5
EFI_ACPI_6_4_FIX_RTC BIT6
EFI_ACPI_6_4_DCK_CAP BIT9
EFI_ACPI_6_4_RESET_REG_SUP BIT10
EFI_ACPI_6_4_SEALED_CASE BIT11
EFI_ACPI_6_4_HEADLESS BIT12
EFI_ACPI_6_4_USE_PLATFORM_CLOCK BIT15
EFI_ACPI_6_4_FORCE_APIC_CLUSTER_MODEL BIT18
EFI_ACPI_6_4_FORCE_APIC_PHYSICAL_DESTINATION_MODE BIT19
EFI_ACPI_6_4_HW_REDUCED_ACPI BIT20
EFI_ACPI_6_4_LOW_POWER_S0_IDLE_CAPABLE BIT21
*/
#define VALID_HARDWARE_REDUCED_FLAG_MASK ( \
EFI_ACPI_6_3_WBINVD | \
EFI_ACPI_6_3_PWR_BUTTON | \
EFI_ACPI_6_3_SLP_BUTTON | \
EFI_ACPI_6_3_FIX_RTC | \
EFI_ACPI_6_3_DCK_CAP | \
EFI_ACPI_6_3_RESET_REG_SUP | \
EFI_ACPI_6_3_SEALED_CASE | \
EFI_ACPI_6_3_HEADLESS | \
EFI_ACPI_6_3_USE_PLATFORM_CLOCK | \
EFI_ACPI_6_3_FORCE_APIC_CLUSTER_MODEL | \
EFI_ACPI_6_3_FORCE_APIC_PHYSICAL_DESTINATION_MODE | \
EFI_ACPI_6_3_HW_REDUCED_ACPI | \
EFI_ACPI_6_3_LOW_POWER_S0_IDLE_CAPABLE)
EFI_ACPI_6_4_WBINVD | \
EFI_ACPI_6_4_PWR_BUTTON | \
EFI_ACPI_6_4_SLP_BUTTON | \
EFI_ACPI_6_4_FIX_RTC | \
EFI_ACPI_6_4_DCK_CAP | \
EFI_ACPI_6_4_RESET_REG_SUP | \
EFI_ACPI_6_4_SEALED_CASE | \
EFI_ACPI_6_4_HEADLESS | \
EFI_ACPI_6_4_USE_PLATFORM_CLOCK | \
EFI_ACPI_6_4_FORCE_APIC_CLUSTER_MODEL | \
EFI_ACPI_6_4_FORCE_APIC_PHYSICAL_DESTINATION_MODE | \
EFI_ACPI_6_4_HW_REDUCED_ACPI | \
EFI_ACPI_6_4_LOW_POWER_S0_IDLE_CAPABLE)
#pragma pack(1)
/** The AcpiFadt is a template EFI_ACPI_6_3_FIXED_ACPI_DESCRIPTION_TABLE
/** The AcpiFadt is a template EFI_ACPI_6_4_FIXED_ACPI_DESCRIPTION_TABLE
structure used for generating the FADT Table.
Note: fields marked with "{Template}" will be updated dynamically.
*/
STATIC
EFI_ACPI_6_3_FIXED_ACPI_DESCRIPTION_TABLE AcpiFadt = {
EFI_ACPI_6_4_FIXED_ACPI_DESCRIPTION_TABLE AcpiFadt = {
ACPI_HEADER (
EFI_ACPI_6_3_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE,
EFI_ACPI_6_3_FIXED_ACPI_DESCRIPTION_TABLE,
EFI_ACPI_6_3_FIXED_ACPI_DESCRIPTION_TABLE_REVISION
EFI_ACPI_6_4_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE,
EFI_ACPI_6_4_FIXED_ACPI_DESCRIPTION_TABLE,
EFI_ACPI_6_4_FIXED_ACPI_DESCRIPTION_TABLE_REVISION
),
// UINT32 FirmwareCtrl
0,
@ -91,7 +91,7 @@ EFI_ACPI_6_3_FIXED_ACPI_DESCRIPTION_TABLE AcpiFadt = {
// UINT8 Reserved0
EFI_ACPI_RESERVED_BYTE,
// UINT8 PreferredPmProfile
EFI_ACPI_6_3_PM_PROFILE_UNSPECIFIED, // {Template}: Power Management Profile
EFI_ACPI_6_4_PM_PROFILE_UNSPECIFIED, // {Template}: Power Management Profile
// UINT16 SciInt
0,
// UINT32 SmiCmd
@ -160,37 +160,37 @@ EFI_ACPI_6_3_FIXED_ACPI_DESCRIPTION_TABLE AcpiFadt = {
0,
// UINT32 Flags
FADT_FLAGS,
// EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE ResetReg
// EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE ResetReg
NULL_GAS,
// UINT8 ResetValue
0,
// UINT16 ArmBootArch
EFI_ACPI_6_3_ARM_PSCI_COMPLIANT, // {Template}: ARM Boot Architecture Flags
EFI_ACPI_6_4_ARM_PSCI_COMPLIANT, // {Template}: ARM Boot Architecture Flags
// UINT8 MinorRevision
EFI_ACPI_6_3_FIXED_ACPI_DESCRIPTION_TABLE_MINOR_REVISION,
EFI_ACPI_6_4_FIXED_ACPI_DESCRIPTION_TABLE_MINOR_REVISION,
// UINT64 XFirmwareCtrl
0,
// UINT64 XDsdt
0,
// EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE XPm1aEvtBlk
// EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE XPm1aEvtBlk
NULL_GAS,
// EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE XPm1bEvtBlk
// EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE XPm1bEvtBlk
NULL_GAS,
// EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE XPm1aCntBlk
// EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE XPm1aCntBlk
NULL_GAS,
// EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE XPm1bCntBlk
// EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE XPm1bCntBlk
NULL_GAS,
// EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE XPm2CntBlk
// EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE XPm2CntBlk
NULL_GAS,
// EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE XPmTmrBlk
// EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE XPmTmrBlk
NULL_GAS,
// EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE XGpe0Blk
// EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE XGpe0Blk
NULL_GAS,
// EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE XGpe1Blk
// EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE XGpe1Blk
NULL_GAS,
// EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE SleepControlReg
// EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE SleepControlReg
NULL_GAS,
// EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE SleepStatusReg
// EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE SleepStatusReg
NULL_GAS,
// UINT64 HypervisorVendorIdentity
EFI_ACPI_RESERVED_QWORD // {Template}: Hypervisor Vendor ID
@ -532,7 +532,7 @@ BuildFadtTable (
This,
(EFI_ACPI_DESCRIPTION_HEADER*)&AcpiFadt,
AcpiTableInfo,
sizeof (EFI_ACPI_6_3_FIXED_ACPI_DESCRIPTION_TABLE)
sizeof (EFI_ACPI_6_4_FIXED_ACPI_DESCRIPTION_TABLE)
);
if (EFI_ERROR (Status)) {
DEBUG ((
@ -614,9 +614,9 @@ ACPI_TABLE_GENERATOR FadtGenerator = {
// Generator Description
L"ACPI.STD.FADT.GENERATOR",
// ACPI Table Signature
EFI_ACPI_6_3_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE,
EFI_ACPI_6_4_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE,
// ACPI Table Revision supported by this Generator
EFI_ACPI_6_3_FIXED_ACPI_DESCRIPTION_TABLE_REVISION,
EFI_ACPI_6_4_FIXED_ACPI_DESCRIPTION_TABLE_REVISION,
// Minimum supported ACPI Table Revision
EFI_ACPI_6_2_FIXED_ACPI_DESCRIPTION_TABLE_REVISION,
// Creator ID

View File

@ -1,11 +1,11 @@
/** @file
GTDT Table Generator
Copyright (c) 2017 - 2019, ARM Limited. All rights reserved.
Copyright (c) 2017 - 2021, ARM Limited. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
@par Reference(s):
- ACPI 6.3 Specification - January 2019
- ACPI 6.4 Specification - January 2021
**/
@ -41,7 +41,7 @@ GET_OBJECT_LIST (
CM_ARM_GENERIC_TIMER_INFO
);
/** This macro expands to a function that retrieves the SBSA Generic
/** This macro expands to a function that retrieves the Arm Generic
Watchdog Timer Information from the Configuration Manager.
*/
GET_OBJECT_LIST (
@ -91,7 +91,7 @@ EFI_STATUS
EFIAPI
AddGenericTimerInfo (
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol,
IN EFI_ACPI_6_3_GENERIC_TIMER_DESCRIPTION_TABLE * CONST Gtdt,
IN EFI_ACPI_6_4_GENERIC_TIMER_DESCRIPTION_TABLE * CONST Gtdt,
IN CONST UINT32 PlatformTimerCount,
IN CONST UINT32 AcpiTableRevision
)
@ -133,7 +133,7 @@ AddGenericTimerInfo (
GenericTimerInfo->CounterReadBaseAddress;
Gtdt->PlatformTimerCount = PlatformTimerCount;
Gtdt->PlatformTimerOffset = (PlatformTimerCount == 0) ? 0 :
sizeof (EFI_ACPI_6_3_GENERIC_TIMER_DESCRIPTION_TABLE);
sizeof (EFI_ACPI_6_4_GENERIC_TIMER_DESCRIPTION_TABLE);
if (AcpiTableRevision > EFI_ACPI_6_2_GENERIC_TIMER_DESCRIPTION_TABLE_REVISION) {
Gtdt->VirtualPL2TimerGSIV = GenericTimerInfo->VirtualPL2TimerGSIV;
@ -143,7 +143,7 @@ AddGenericTimerInfo (
return Status;
}
/** Add the SBSA Generic Watchdog Timers to the GTDT table.
/** Add the Arm Generic Watchdog Timers to the GTDT table.
@param [in] Gtdt Pointer to the GTDT Table.
@param [in] WatchdogOffset Offset to the watchdog information in the
@ -154,26 +154,26 @@ AddGenericTimerInfo (
STATIC
VOID
AddGenericWatchdogList (
IN EFI_ACPI_6_3_GENERIC_TIMER_DESCRIPTION_TABLE * CONST Gtdt,
IN EFI_ACPI_6_4_GENERIC_TIMER_DESCRIPTION_TABLE * CONST Gtdt,
IN CONST UINT32 WatchdogOffset,
IN CONST CM_ARM_GENERIC_WATCHDOG_INFO * WatchdogInfoList,
IN UINT32 WatchdogCount
)
{
EFI_ACPI_6_3_GTDT_SBSA_GENERIC_WATCHDOG_STRUCTURE * Watchdog;
EFI_ACPI_6_4_GTDT_ARM_GENERIC_WATCHDOG_STRUCTURE * Watchdog;
ASSERT (Gtdt != NULL);
ASSERT (WatchdogInfoList != NULL);
Watchdog = (EFI_ACPI_6_3_GTDT_SBSA_GENERIC_WATCHDOG_STRUCTURE *)
Watchdog = (EFI_ACPI_6_4_GTDT_ARM_GENERIC_WATCHDOG_STRUCTURE *)
((UINT8*)Gtdt + WatchdogOffset);
while (WatchdogCount-- != 0) {
// Add watchdog entry
DEBUG ((DEBUG_INFO, "GTDT: Watchdog = 0x%p\n", Watchdog));
Watchdog->Type = EFI_ACPI_6_3_GTDT_SBSA_GENERIC_WATCHDOG;
Watchdog->Type = EFI_ACPI_6_4_GTDT_ARM_GENERIC_WATCHDOG;
Watchdog->Length =
sizeof (EFI_ACPI_6_3_GTDT_SBSA_GENERIC_WATCHDOG_STRUCTURE);
sizeof (EFI_ACPI_6_4_GTDT_ARM_GENERIC_WATCHDOG_STRUCTURE);
Watchdog->Reserved = EFI_ACPI_RESERVED_BYTE;
Watchdog->RefreshFramePhysicalAddress =
WatchdogInfoList->RefreshFrameAddress;
@ -249,7 +249,7 @@ IsGtFrameNumberEqual (
STATIC
EFI_STATUS
AddGTBlockTimerFrames (
IN EFI_ACPI_6_3_GTDT_GT_BLOCK_TIMER_STRUCTURE * GtBlockFrame,
IN EFI_ACPI_6_4_GTDT_GT_BLOCK_TIMER_STRUCTURE * GtBlockFrame,
IN CONST CM_ARM_GTBLOCK_TIMER_FRAME_INFO * GTBlockTimerFrameList,
IN UINT32 GTBlockFrameCount
)
@ -329,15 +329,15 @@ STATIC
EFI_STATUS
AddGTBlockList (
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol,
IN EFI_ACPI_6_3_GENERIC_TIMER_DESCRIPTION_TABLE * CONST Gtdt,
IN EFI_ACPI_6_4_GENERIC_TIMER_DESCRIPTION_TABLE * CONST Gtdt,
IN CONST UINT32 GTBlockOffset,
IN CONST CM_ARM_GTBLOCK_INFO * GTBlockInfo,
IN UINT32 BlockTimerCount
)
{
EFI_STATUS Status;
EFI_ACPI_6_3_GTDT_GT_BLOCK_STRUCTURE * GTBlock;
EFI_ACPI_6_3_GTDT_GT_BLOCK_TIMER_STRUCTURE * GtBlockFrame;
EFI_ACPI_6_4_GTDT_GT_BLOCK_STRUCTURE * GTBlock;
EFI_ACPI_6_4_GTDT_GT_BLOCK_TIMER_STRUCTURE * GtBlockFrame;
CM_ARM_GTBLOCK_TIMER_FRAME_INFO * GTBlockTimerFrameList;
UINT32 GTBlockTimerFrameCount;
UINTN Length;
@ -345,7 +345,7 @@ AddGTBlockList (
ASSERT (Gtdt != NULL);
ASSERT (GTBlockInfo != NULL);
GTBlock = (EFI_ACPI_6_3_GTDT_GT_BLOCK_STRUCTURE *)((UINT8*)Gtdt +
GTBlock = (EFI_ACPI_6_4_GTDT_GT_BLOCK_STRUCTURE *)((UINT8*)Gtdt +
GTBlockOffset);
while (BlockTimerCount-- != 0) {
@ -367,8 +367,8 @@ AddGTBlockList (
return Status;
}
Length = sizeof (EFI_ACPI_6_3_GTDT_GT_BLOCK_STRUCTURE) +
(sizeof (EFI_ACPI_6_3_GTDT_GT_BLOCK_TIMER_STRUCTURE) *
Length = sizeof (EFI_ACPI_6_4_GTDT_GT_BLOCK_STRUCTURE) +
(sizeof (EFI_ACPI_6_4_GTDT_GT_BLOCK_TIMER_STRUCTURE) *
GTBlockInfo->GTBlockTimerFrameCount);
// Check that the length of the GT block does not
@ -386,15 +386,15 @@ AddGTBlockList (
return Status;
}
GTBlock->Type = EFI_ACPI_6_3_GTDT_GT_BLOCK;
GTBlock->Type = EFI_ACPI_6_4_GTDT_GT_BLOCK;
GTBlock->Length = (UINT16)Length;
GTBlock->Reserved = EFI_ACPI_RESERVED_BYTE;
GTBlock->CntCtlBase = GTBlockInfo->GTBlockPhysicalAddress;
GTBlock->GTBlockTimerCount = GTBlockInfo->GTBlockTimerFrameCount;
GTBlock->GTBlockTimerOffset =
sizeof (EFI_ACPI_6_3_GTDT_GT_BLOCK_STRUCTURE);
sizeof (EFI_ACPI_6_4_GTDT_GT_BLOCK_STRUCTURE);
GtBlockFrame = (EFI_ACPI_6_3_GTDT_GT_BLOCK_TIMER_STRUCTURE*)
GtBlockFrame = (EFI_ACPI_6_4_GTDT_GT_BLOCK_TIMER_STRUCTURE*)
((UINT8*)GTBlock + GTBlock->GTBlockTimerOffset);
// Add GT Block Timer frames
@ -413,7 +413,7 @@ AddGTBlockList (
}
// Next GTBlock
GTBlock = (EFI_ACPI_6_3_GTDT_GT_BLOCK_STRUCTURE *)((UINT8*)GTBlock +
GTBlock = (EFI_ACPI_6_4_GTDT_GT_BLOCK_STRUCTURE *)((UINT8*)GTBlock +
GTBlock->Length);
GTBlockInfo++;
}// for
@ -460,7 +460,7 @@ BuildGtdtTable (
UINT32 BlockTimerCount;
CM_ARM_GENERIC_WATCHDOG_INFO * WatchdogInfoList;
CM_ARM_GTBLOCK_INFO * GTBlockInfo;
EFI_ACPI_6_3_GENERIC_TIMER_DESCRIPTION_TABLE * Gtdt;
EFI_ACPI_6_4_GENERIC_TIMER_DESCRIPTION_TABLE * Gtdt;
UINT32 Idx;
UINT32 GTBlockOffset;
UINT32 WatchdogOffset;
@ -527,11 +527,11 @@ BuildGtdtTable (
// Calculate the GTDT Table Size
PlatformTimerCount = 0;
TableSize = sizeof (EFI_ACPI_6_3_GENERIC_TIMER_DESCRIPTION_TABLE);
TableSize = sizeof (EFI_ACPI_6_4_GENERIC_TIMER_DESCRIPTION_TABLE);
if (BlockTimerCount != 0) {
GTBlockOffset = TableSize;
PlatformTimerCount += BlockTimerCount;
TableSize += (sizeof (EFI_ACPI_6_3_GTDT_GT_BLOCK_STRUCTURE) *
TableSize += (sizeof (EFI_ACPI_6_4_GTDT_GT_BLOCK_STRUCTURE) *
BlockTimerCount);
for (Idx = 0; Idx < BlockTimerCount; Idx++) {
@ -546,7 +546,7 @@ BuildGtdtTable (
));
goto error_handler;
}
TableSize += (sizeof (EFI_ACPI_6_3_GTDT_GT_BLOCK_TIMER_STRUCTURE) *
TableSize += (sizeof (EFI_ACPI_6_4_GTDT_GT_BLOCK_TIMER_STRUCTURE) *
GTBlockInfo[Idx].GTBlockTimerFrameCount);
}
@ -562,7 +562,7 @@ BuildGtdtTable (
if (WatchdogCount != 0) {
WatchdogOffset = TableSize;
PlatformTimerCount += WatchdogCount;
TableSize += (sizeof (EFI_ACPI_6_3_GTDT_SBSA_GENERIC_WATCHDOG_STRUCTURE) *
TableSize += (sizeof (EFI_ACPI_6_4_GTDT_ARM_GENERIC_WATCHDOG_STRUCTURE) *
WatchdogCount);
DEBUG ((
DEBUG_INFO,
@ -585,7 +585,7 @@ BuildGtdtTable (
goto error_handler;
}
Gtdt = (EFI_ACPI_6_3_GENERIC_TIMER_DESCRIPTION_TABLE*)*Table;
Gtdt = (EFI_ACPI_6_4_GENERIC_TIMER_DESCRIPTION_TABLE*)*Table;
DEBUG ((
DEBUG_INFO,
"GTDT: Gtdt = 0x%p TableSize = 0x%x\n",
@ -712,9 +712,9 @@ ACPI_TABLE_GENERATOR GtdtGenerator = {
// Generator Description
L"ACPI.STD.GTDT.GENERATOR",
// ACPI Table Signature
EFI_ACPI_6_3_GENERIC_TIMER_DESCRIPTION_TABLE_SIGNATURE,
EFI_ACPI_6_4_GENERIC_TIMER_DESCRIPTION_TABLE_SIGNATURE,
// ACPI Table Revision supported by this Generator
EFI_ACPI_6_3_GENERIC_TIMER_DESCRIPTION_TABLE_REVISION,
EFI_ACPI_6_4_GENERIC_TIMER_DESCRIPTION_TABLE_REVISION,
// Minimum ACPI Table Revision supported by this Generator
EFI_ACPI_6_2_GENERIC_TIMER_DESCRIPTION_TABLE_REVISION,
// Creator ID

View File

@ -10,21 +10,19 @@
- Generic ACPI for Arm Components 1.0 Platform Design Document
**/
#include <IndustryStandard/DebugPort2Table.h>
#include <Library/AcpiLib.h>
#include <Library/BaseLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/DebugLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Protocol/AcpiTable.h>
// Module specific include files.
#include <AcpiTableGenerator.h>
#include <ConfigurationManagerObject.h>
#include <ConfigurationManagerHelper.h>
#include <Library/AcpiHelperLib.h>
#include <Library/AmlLib/AmlLib.h>
#include <Library/TableHelperLib.h>
#include <Protocol/ConfigurationManagerProtocol.h>
#include "SsdtCmn600Generator.h"
@ -286,7 +284,7 @@ FixupCmn600Info (
// Get the first Rd node in the "_CRS" object.
// This is the PERIPHBASE node.
Status = AmlNameOpCrsGetFirstRdNode (NameOpCrsNode, &CmnPeriphBaseRdNode);
Status = AmlNameOpGetFirstRdNode (NameOpCrsNode, &CmnPeriphBaseRdNode);
if (EFI_ERROR (Status)) {
goto error_handler;
}
@ -309,7 +307,7 @@ FixupCmn600Info (
// Get the QWord node corresponding to the ROOTNODEBASE.
// It is the second Resource Data element in the BufferNode's
// variable list of arguments.
Status = AmlNameOpCrsGetNextRdNode (
Status = AmlNameOpGetNextRdNode (
CmnPeriphBaseRdNode,
&CmnRootNodeBaseRdNode
);
@ -338,8 +336,8 @@ FixupCmn600Info (
// Resource Data nodes.
for (Index = 0; Index < Cmn600Info->DtcCount; Index++) {
DtcInt = &Cmn600Info->DtcInterrupt[Index];
Status = AmlCodeGenCrsAddRdInterrupt (
NameOpCrsNode,
Status = AmlCodeGenRdInterrupt (
((DtcInt->Flags &
EFI_ACPI_EXTENDED_INTERRUPT_FLAG_PRODUCER_CONSUMER_MASK) != 0),
((DtcInt->Flags &
@ -349,7 +347,9 @@ FixupCmn600Info (
((DtcInt->Flags &
EFI_ACPI_EXTENDED_INTERRUPT_FLAG_SHARABLE_MASK) != 0),
(UINT32*)&DtcInt->Interrupt,
1
1,
NameOpCrsNode,
NULL
);
if (EFI_ERROR (Status)) {
goto error_handler;

View File

@ -1,7 +1,7 @@
## @file
# Ssdt CMN-600 Table Generator
#
# Copyright (c) 2020, Arm Limited. All rights reserved.<BR>
# Copyright (c) 2021, Arm Limited. All rights reserved.<BR>
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
##
@ -29,6 +29,7 @@
DynamicTablesPkg/DynamicTablesPkg.dec
[LibraryClasses]
AcpiHelperLib
AmlLib
BaseLib

View File

@ -0,0 +1,134 @@
/** @file
SSDT Cpu Topology Table Generator.
Copyright (c) 2021, Arm Limited. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
@par Reference(s):
- ACPI 6.3 Specification - January 2019 - s8.4 Declaring Processors
**/
#ifndef SSDT_CPU_TOPOLOGY_GENERATOR_H_
#define SSDT_CPU_TOPOLOGY_GENERATOR_H_
#pragma pack(1)
// Mask for the flags that need to be checked.
#define PPTT_PROCESSOR_MASK ( \
(EFI_ACPI_6_3_PPTT_PACKAGE_PHYSICAL) | \
(EFI_ACPI_6_3_PPTT_PROCESSOR_ID_VALID << 1) | \
(EFI_ACPI_6_3_PPTT_NODE_IS_LEAF << 3))
// Mask for the cpu flags.
#define PPTT_CPU_PROCESSOR_MASK ( \
(EFI_ACPI_6_3_PPTT_PACKAGE_NOT_PHYSICAL) | \
(EFI_ACPI_6_3_PPTT_PROCESSOR_ID_VALID << 1) | \
(EFI_ACPI_6_3_PPTT_NODE_IS_LEAF << 3))
// Mask for the cluster flags.
// Even though a _UID is generated for clusters, it is simpler to use
// EFI_ACPI_6_3_PPTT_PROCESSOR_ID_INVALID and to not match the cluster id of
// the PPTT table (not sure the PPTT table is generated).
#define PPTT_CLUSTER_PROCESSOR_MASK ( \
(EFI_ACPI_6_3_PPTT_PACKAGE_NOT_PHYSICAL) | \
(EFI_ACPI_6_3_PPTT_PROCESSOR_ID_INVALID << 1) | \
(EFI_ACPI_6_3_PPTT_NODE_IS_NOT_LEAF << 3))
/** LPI states are stored in the ASL namespace at '\_SB_.Lxxx',
with xxx being the node index of the LPI state.
*/
#define SB_SCOPE "\\_SB_"
#define SB_SCOPE_PREFIX SB_SCOPE "."
/// Size of the SB_SCOPE_PREFIX string.
#define SB_SCOPE_PREFIX_SIZE sizeof (SB_SCOPE_PREFIX)
/// HID for a processor device.
#define ACPI_HID_PROCESSOR_DEVICE "ACPI0007"
/// HID for a processor container device.
#define ACPI_HID_PROCESSOR_CONTAINER_DEVICE "ACPI0010"
/** Node names of Cpus and Clusters are 'Cxxx', and 'Lxxx' for LPI states.
The 'xxx' is an index on 12 bits is given to node name,
thus the limitation in the number of nodes.
*/
#define MAX_NODE_COUNT (1 << 12)
/** A structure used to handle the Lpi structures referencing.
A CM_ARM_PROC_HIERARCHY_INFO structure references a CM_ARM_OBJ_REF.
This CM_ARM_OBJ_REF references CM_ARM_LPI_INFO structures.
Example:
(Cpu0) (Cpu1)
CM_ARM_PROC_HIERARCHY_INFO CM_ARM_PROC_HIERARCHY_INFO
| |
+----------------------------------------
|
v
(List of references to Lpi states)
CM_ARM_OBJ_REF
|
+----------------------------------------
| |
v v
(A first Lpi state) (A second Lpi state)
CM_ARM_LPI_INFO[0] CM_ARM_LPI_INFO[1]
Here, Cpu0 and Cpu1 have the same Lpi states. Both CM_ARM_PROC_HIERARCHY_INFO
structures reference the same CM_ARM_OBJ_REF. An entry is created in the
TokenTable such as:
0 <-> CM_ARM_OBJ_REF
This will lead to the creation of this pseudo-ASL code where Cpu0 and Cpu1
return the same object at \_SB.L000:
Scope (\_SB) {
Device (C000) {
[...]
Method (_LPI) {
Return (\_SB.L000)
}
} // C000
Device (C001) {
[...]
Method (_LPI) {
Return (\_SB.L000)
}
} // C001
// Lpi states
Name (L000, Package (0x05) {
[...]
}
}
*/
typedef struct TokenTable {
/// TokenTable, a table allowing to map:
/// Index <-> CM_OBJECT_TOKEN (to CM_ARM_LPI_INFO structures).
CM_OBJECT_TOKEN * Table;
/// Last used index of the TokenTable.
/// LastIndex is bound by ProcNodeCount.
UINT32 LastIndex;
} TOKEN_TABLE;
/** A structure holding the Cpu topology generator and additional private data.
*/
typedef struct AcpiCpuTopologyGenerator {
/// ACPI Table generator header
ACPI_TABLE_GENERATOR Header;
// Private fields are defined from here.
/// Private object used to handle token referencing.
TOKEN_TABLE TokenTable;
/// List of CM_ARM_PROC_HIERARCHY_INFO CM objects.
CM_ARM_PROC_HIERARCHY_INFO * ProcNodeList;
/// Count of CM_ARM_PROC_HIERARCHY_INFO CM objects.
UINT32 ProcNodeCount;
} ACPI_CPU_TOPOLOGY_GENERATOR;
#pragma pack()
#endif // SSDT_CPU_TOPOLOGY_GENERATOR_H_

View File

@ -0,0 +1,33 @@
## @file
# Ssdt Cpu Topology Table Generator
#
# Copyright (c) 2021, Arm Limited. All rights reserved.<BR>
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
##
[Defines]
INF_VERSION = 0x0001001B
BASE_NAME = SsdtCpuTopologyLibArm
FILE_GUID = F2835EB6-4B05-48D4-A475-147DA0F3755C
VERSION_STRING = 1.0
MODULE_TYPE = DXE_DRIVER
LIBRARY_CLASS = NULL|DXE_DRIVER
CONSTRUCTOR = AcpiSsdtCpuTopologyLibConstructor
DESTRUCTOR = AcpiSsdtCpuTopologyLibDestructor
[Sources]
SsdtCpuTopologyGenerator.c
SsdtCpuTopologyGenerator.h
[Packages]
MdePkg/MdePkg.dec
MdeModulePkg/MdeModulePkg.dec
EmbeddedPkg/EmbeddedPkg.dec
ArmPlatformPkg/ArmPlatformPkg.dec
DynamicTablesPkg/DynamicTablesPkg.dec
[LibraryClasses]
AcpiHelperLib
AmlLib
BaseLib

View File

@ -6,21 +6,19 @@
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#include <IndustryStandard/DebugPort2Table.h>
#include <Library/AcpiLib.h>
#include <Library/BaseLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/DebugLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Protocol/AcpiTable.h>
// Module specific include files.
#include <AcpiTableGenerator.h>
#include <ConfigurationManagerObject.h>
#include <ConfigurationManagerHelper.h>
#include <Library/AcpiHelperLib.h>
#include <Library/SsdtSerialPortFixupLib.h>
#include <Library/TableHelperLib.h>
#include <Protocol/ConfigurationManagerProtocol.h>
/** ARM standard SSDT Serial Port Table Generator

View File

@ -1,7 +1,7 @@
## @file
# Ssdt Serial Port Table Generator
#
# Copyright (c) 2019 - 2020, Arm Limited. All rights reserved.<BR>
# Copyright (c) 2019 - 2021, Arm Limited. All rights reserved.<BR>
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
##
@ -27,7 +27,7 @@
DynamicTablesPkg/DynamicTablesPkg.dec
[LibraryClasses]
AcpiHelperLib
AmlLib
BaseLib
TableHelperLib
SsdtSerialPortFixupLib

View File

@ -0,0 +1,210 @@
/** @file
Acpi Helper
Copyright (c) 2017 - 2021, Arm Limited. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#include <Library/BaseLib.h>
#include <Library/DebugLib.h>
// Module specific include files.
#include <Library/AcpiHelperLib.h>
/** Convert a hex number to its ASCII code.
@param [in] Hex Hex number to convert.
Must be 0 <= x < 16.
@return The ASCII code corresponding to x.
-1 if error.
**/
UINT8
EFIAPI
AsciiFromHex (
IN UINT8 Hex
)
{
if (Hex < 10) {
return (UINT8)(Hex + '0');
}
if (Hex < 16) {
return (UINT8)(Hex - 10 + 'A');
}
ASSERT (FALSE);
return (UINT8)-1;
}
/** Convert an ASCII char representing an hexadecimal number
to its integer value.
@param [in] Char Char to convert.
Must be between '0'-'9' or 'A'-'F' or 'a'-'f'.
@return The corresponding integer (between 0-16).
-1 if error.
**/
UINT8
EFIAPI
HexFromAscii (
IN CHAR8 Char
)
{
if ((Char >= '0') && (Char <= '9')) {
return (UINT8)(Char - '0');
}
if ((Char >= 'A') && (Char <= 'F')) {
return (UINT8)(Char - 'A' + 10);
}
if ((Char >= 'a') && (Char <= 'f')) {
return (UINT8)(Char - 'a' + 10);
}
ASSERT (FALSE);
return (UINT8)-1;
}
/** Check if a HID is a valid PNP ID.
@param [in] Hid The Hid to validate.
@retval TRUE The Hid is a valid PNP ID.
@retval FALSE The Hid is not a valid PNP ID.
**/
BOOLEAN
IsValidPnpId (
IN CONST CHAR8 * Hid
)
{
UINTN Index;
if (AsciiStrLen (Hid) != 7) {
return FALSE;
}
// A valid PNP ID must be of the form "AAA####"
// where A is an uppercase letter and # is a hex digit.
for (Index = 0; Index < 3; Index++) {
if (!IS_UPPER_CHAR (Hid[Index])) {
return FALSE;
}
}
for (Index = 3; Index < 7; Index++) {
if (!IS_UPPER_HEX (Hid[Index])) {
return FALSE;
}
}
return TRUE;
}
/** Check if a HID is a valid ACPI ID.
@param [in] Hid The Hid to validate.
@retval TRUE The Hid is a valid ACPI ID.
@retval FALSE The Hid is not a valid ACPI ID.
**/
BOOLEAN
IsValidAcpiId (
IN CONST CHAR8 * Hid
)
{
UINTN Index;
if (AsciiStrLen (Hid) != 8) {
return FALSE;
}
// A valid ACPI ID must be of the form "NNNN####"
// where N is an uppercase letter or a digit ('0'-'9')
// and # is a hex digit.
for (Index = 0; Index < 4; Index++) {
if (!(IS_UPPER_CHAR (Hid[Index]) || IS_DIGIT (Hid[Index]))) {
return FALSE;
}
}
for (Index = 4; Index < 8; Index++) {
if (!IS_UPPER_HEX (Hid[Index])) {
return FALSE;
}
}
return TRUE;
}
/** Convert a EisaId string to its compressed UINT32 equivalent.
Cf. ACPI 6.4 specification, s19.3.4 "ASL Macros": "Eisaid"
@param [in] EisaIdStr Input EisaId string.
@param [out] EisaIdInt Output EisaId UINT32 (compressed).
@retval EFI_SUCCESS The function completed successfully.
@retval EFI_INVALID_PARAMETER Invalid parameter.
**/
EFI_STATUS
EFIAPI
AmlGetEisaIdFromString (
IN CONST CHAR8 * EisaIdStr,
OUT UINT32 * EisaIdInt
)
{
if ((EisaIdStr == NULL) ||
(!IsValidPnpId (EisaIdStr)) ||
(EisaIdInt == NULL)) {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
/* Cf. ACPI 6.4 specification, s19.3.4 "ASL Macros": "Eisaid"
Converts and compresses the 7-character text argument into its corresponding
4-byte numeric EISA ID encoding (Integer). This can be used when declaring
IDs for devices that are EISA IDs.
The algorithm used to convert the TextID is as shown in the following
example:
Starting with a seven character input string "PNP0303", we want to create
a DWordConst. This string contains a three character manufacturer code
"PNP", a three character hex product identifier "030", and a one character
revision identifier "3".
The compressed manufacturer code is created as follows:
1) Find hex ASCII value for each letter
2) Subtract 40h from each ASCII value
3) Retain 5 least significant bits for each letter and discard remaining
0's:
Byte 0:
Bit 7: reserved (0)
Bit 6-2: 1st character of compressed mfg code "P"
Bit 1-0: Upper 2 bits of 2nd character of mfg code "N"
Byte 1:
Bit 7-5: Lower 3 bits of 2nd character of mfg code "N"
Bit 4-0: 3rd character of mfg code "P"
Byte 2:
Bit 7-4: 1st hex digit of product number "0"
Bit 3-0: 2nd hex digit of product number "3"
Byte 3:
Bit 7-4: 3rd hex digit of product number "0"
Bit 3-0: 4th hex digit of product number "3"
*/
*EisaIdInt = SwapBytes32 (
((EisaIdStr[0] - 0x40) << 26) |
((EisaIdStr[1] - 0x40) << 21) |
((EisaIdStr[2] - 0x40) << 16) |
(HexFromAscii (EisaIdStr[3]) << 12) |
(HexFromAscii (EisaIdStr[4]) << 8) |
(HexFromAscii (EisaIdStr[5]) << 4) |
(HexFromAscii (EisaIdStr[6]))
);
return EFI_SUCCESS;
}

View File

@ -0,0 +1,25 @@
## @file
# Acpi Helper
#
# Copyright (c) 2021, ARM Limited. All rights reserved.
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
##
[Defines]
INF_VERSION = 0x0001001B
BASE_NAME = AcpiHelperLib
FILE_GUID = 45968FB4-A724-46FC-822D-F9E557601F9B
VERSION_STRING = 1.0
MODULE_TYPE = DXE_DRIVER
LIBRARY_CLASS = AcpiHelperLib
[Sources]
AcpiHelper.c
[Packages]
MdePkg/MdePkg.dec
DynamicTablesPkg/DynamicTablesPkg.dec
[LibraryClasses]
BaseLib

View File

@ -2,7 +2,7 @@
AML Print Function.
Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved. <BR>
Copyright (c) 2019 - 2020, Arm Limited. All rights reserved.<BR>
Copyright (c) 2019 - 2021, Arm Limited. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
@ -199,7 +199,7 @@ AmlDbgPrintNodeHeader (
DEBUG ((
DEBUG_INFO,
"%3d | %-15s | ",
"%3d | %-15a | ",
Level,
NodeTypeStrTbl[Node->NodeType]
));
@ -227,7 +227,7 @@ AmlDbgPrintDataNode (
AmlDbgPrintNodeHeader ((AML_NODE_HEADER*)DataNode, Level);
DEBUG ((DEBUG_INFO, "%-36s | ", NodeDataTypeStrTbl[DataNode->DataType]));
DEBUG ((DEBUG_INFO, "%-36a | ", NodeDataTypeStrTbl[DataNode->DataType]));
DEBUG ((DEBUG_INFO, "0x%04x | ", DataNode->Size));
if ((DataNode->DataType == EAmlNodeDataTypeNameString) ||
@ -300,13 +300,13 @@ AmlDbgPrintObjectNode (
// Print a string corresponding to the field object OpCode/SubOpCode.
if (AmlNodeHasAttribute (ObjectNode, AML_IS_FIELD_ELEMENT)) {
DEBUG ((DEBUG_INFO, "%-15s ", AmlGetFieldOpCodeStr (
DEBUG ((DEBUG_INFO, "%-15a ", AmlGetFieldOpCodeStr (
ObjectNode->AmlByteEncoding->OpCode,
0
)));
} else {
// Print a string corresponding to the object OpCode/SubOpCode.
DEBUG ((DEBUG_INFO, "%-15s | ", AmlGetOpCodeStr (
DEBUG ((DEBUG_INFO, "%-15a | ", AmlGetOpCodeStr (
ObjectNode->AmlByteEncoding->OpCode,
ObjectNode->AmlByteEncoding->SubOpCode)
));
@ -378,19 +378,19 @@ AmlDbgPrintTableHeader (
DEBUG ((DEBUG_INFO, "Lvl | Node Type |\n"));
DEBUG ((
DEBUG_INFO,
" | %-15s | Signature| Length | Rev | CSum | OemId | "
" | %-15a | Signature| Length | Rev | CSum | OemId | "
"OemTableId | OemRev | CreatorId| CreatorRev\n",
NodeTypeStrTbl[EAmlNodeRoot]
));
DEBUG ((
DEBUG_INFO,
" | %-15s | Op | SubOp| OpName | MaxI| Attribute | "
" | %-15a | Op | SubOp| OpName | MaxI| Attribute | "
"PkgLen | NodeName (opt)\n",
NodeTypeStrTbl[EAmlNodeObject]
));
DEBUG ((
DEBUG_INFO,
" | %-15s | Data Type | Size | "
" | %-15a | Data Type | Size | "
"Buffer\n",
NodeTypeStrTbl[EAmlNodeData]
));

View File

@ -2,7 +2,7 @@
AML grammar definitions.
Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved. <BR>
Copyright (c) 2019 - 2020, Arm Limited. All rights reserved.<BR>
Copyright (c) 2019 - 2021, Arm Limited. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
@ -803,3 +803,88 @@ AmlComputePkgLengthWidth (
// Length < 2^6
return 1;
}
/** Given a length, compute the value of a PkgLen.
In AML, some object have a PkgLen, telling the size of the AML object.
It can be encoded in 1 to 4 bytes. The bytes used to encode the PkgLen is
itself counted in the PkgLen value.
This means that if an AML object sees its size increment/decrement,
the number of bytes used to encode the PkgLen value can itself
increment/decrement.
For instance, the AML encoding of a DeviceOp is:
DefDevice := DeviceOp PkgLength NameString TermList
If:
- sizeof (NameString) = 4 (the name is "DEV0" for instance);
- sizeof (TermList) = (2^6-6)
then the PkgLen is encoded on 1 byte. Indeed, its value is:
sizeof (PkgLen) + sizeof (NameString) + sizeof (TermList) =
sizeof (PkgLen) + 4 + (2^6-6)
So:
PkgLen = sizeof (PkgLen) + (2^6-2)
The input arguments Length and PkgLen represent, for the DefDevice:
DefDevice := DeviceOp PkgLength NameString TermList
|------Length-----|
|--------*PgkLength---------|
@param [in] Length The length to encode as a PkgLen.
Length cannot exceed 2^28 - 4 (4 bytes for the
PkgLen encoding).
The size of the PkgLen encoding bytes should not be
counted in this length value.
@param [out] PkgLen If success, contains the value of the PkgLen,
ready to encode in the PkgLen format.
This value takes into account the size of PkgLen
encoding.
@retval EFI_SUCCESS The function completed successfully.
@retval EFI_INVALID_PARAMETER Invalid parameter.
**/
EFI_STATUS
EFIAPI
AmlComputePkgLength (
IN UINT32 Length,
OUT UINT32 * PkgLen
)
{
UINT32 PkgLenWidth;
UINT32 ReComputedPkgLenWidth;
if (PkgLen == NULL) {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
// Compute the PkgLenWidth.
PkgLenWidth = AmlComputePkgLengthWidth (Length);
if (PkgLenWidth == 0) {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
// Add it to the Length.
Length += PkgLenWidth;
// Check that adding the PkgLenWidth didn't trigger a domino effect,
// increasing the encoding width of the PkgLen again.
// The PkgLen is encoded in at most 4 bytes. It is possible to increase
// the PkgLen width if its encoding is less than 3 bytes.
ReComputedPkgLenWidth = AmlComputePkgLengthWidth (Length);
if (ReComputedPkgLenWidth != PkgLenWidth) {
if ((ReComputedPkgLenWidth != 0) &&
(ReComputedPkgLenWidth < 4)) {
// No need to recompute the PkgLen since a new threshold cannot
// be reached by incrementing the value by one.
Length += 1;
} else {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
}
*PkgLen = Length;
return EFI_SUCCESS;
}

View File

@ -2,7 +2,7 @@
AML grammar definitions.
Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved. <BR>
Copyright (c) 2019 - 2020, Arm Limited. All rights reserved.<BR>
Copyright (c) 2019 - 2021, Arm Limited. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
@ -326,5 +326,50 @@ AmlComputePkgLengthWidth (
IN UINT32 Length
);
/** Given a length, compute the value of a PkgLen.
In AML, some object have a PkgLen, telling the size of the AML object.
It can be encoded in 1 to 4 bytes. The bytes used to encode the PkgLen is
itself counted in the PkgLen value.
This means that if an AML object sees its size increment/decrement,
the number of bytes used to encode the PkgLen value can itself
increment/decrement.
For instance, the AML encoding of a DeviceOp is:
DefDevice := DeviceOp PkgLength NameString TermList
If:
- sizeof (NameString) = 4 (the name is "DEV0" for instance);
- sizeof (TermList) = (2^6-6)
then the PkgLen is encoded on 1 byte. Indeed, its value is:
sizeof (PkgLen) + sizeof (NameString) + sizeof (TermList) =
sizeof (PkgLen) + 4 + (2^6-6)
So:
PkgLen = sizeof (PkgLen) + (2^6-2)
The input arguments Length and PkgLen represent, for the DefDevice:
DefDevice := DeviceOp PkgLength NameString TermList
|------Length-----|
|--------*PgkLength---------|
@param [in] Length The length to encode as a PkgLen.
Length cannot exceed 2^28 - 4 (4 bytes for the
PkgLen encoding).
The size of the PkgLen encoding bytes should not be
counted in this length value.
@param [out] PkgLen If success, contains the value of the PkgLen,
ready to encode in the PkgLen format.
This value takes into account the size of PkgLen
encoding.
@retval EFI_SUCCESS The function completed successfully.
@retval EFI_INVALID_PARAMETER Invalid parameter.
**/
EFI_STATUS
EFIAPI
AmlComputePkgLength (
IN UINT32 Length,
OUT UINT32 * PkgLen
);
#endif // AML_H_

View File

@ -1,7 +1,7 @@
## @file
# AML Generation Library
#
# Copyright (c) 2019 - 2020, Arm Limited. All rights reserved.<BR>
# Copyright (c) 2019 - 2021, Arm Limited. All rights reserved.<BR>
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
##
@ -66,6 +66,7 @@
DynamicTablesPkg/DynamicTablesPkg.dec
[LibraryClasses]
AcpiHelperLib
BaseLib
[BuildOptions]

View File

@ -1,7 +1,7 @@
/** @file
AML Api.
Copyright (c) 2020, Arm Limited. All rights reserved.<BR>
Copyright (c) 2020 - 2021, Arm Limited. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
@ -222,7 +222,7 @@ AmlNameOpUpdateString (
return Status;
}
/** Get the first Resource Data element contained in a "_CRS" object.
/** Get the first Resource Data element contained in a named object.
In the following ASL code, the function will return the Resource Data
node corresponding to the "QWordMemory ()" ASL macro.
@ -233,35 +233,33 @@ AmlNameOpUpdateString (
)
Note:
- The "_CRS" object must be declared using ASL "Name (Declare Named Object)".
- "_CRS" declared using ASL "Method (Declare Control Method)" is not
supported.
"_CRS" names defined as methods are not handled by this function.
They must be defined as names, using the "Name ()" statement.
@param [in] NameOpCrsNode NameOp object node defining a "_CRS" object.
Must have an OpCode=AML_NAME_OP, SubOpCode=0.
NameOp object nodes are defined in ASL
using the "Name ()" function.
@param [out] OutRdNode Pointer to the first Resource Data element of
the "_CRS" object. A Resource Data element
is stored in a data node.
@param [in] NameOpNode NameOp object node defining a named object.
Must have an OpCode=AML_NAME_OP, SubOpCode=0.
NameOp object nodes are defined in ASL
using the "Name ()" function.
@param [out] OutRdNode Pointer to the first Resource Data element of
the named object. A Resource Data element
is stored in a data node.
@retval EFI_SUCCESS The function completed successfully.
@retval EFI_INVALID_PARAMETER Invalid parameter.
**/
EFI_STATUS
EFIAPI
AmlNameOpCrsGetFirstRdNode (
IN AML_OBJECT_NODE_HANDLE NameOpCrsNode,
AmlNameOpGetFirstRdNode (
IN AML_OBJECT_NODE_HANDLE NameOpNode,
OUT AML_DATA_NODE_HANDLE * OutRdNode
)
{
AML_OBJECT_NODE_HANDLE BufferOpNode;
AML_DATA_NODE_HANDLE FirstRdNode;
if ((NameOpCrsNode == NULL) ||
(AmlGetNodeType ((AML_NODE_HANDLE)NameOpCrsNode) != EAmlNodeObject) ||
(!AmlNodeHasOpCode (NameOpCrsNode, AML_NAME_OP, 0)) ||
(!AmlNameOpCompareName (NameOpCrsNode, "_CRS")) ||
if ((NameOpNode == NULL) ||
(AmlGetNodeType ((AML_NODE_HANDLE)NameOpNode) != EAmlNodeObject) ||
(!AmlNodeHasOpCode (NameOpNode, AML_NAME_OP, 0)) ||
(OutRdNode == NULL)) {
ASSERT (0);
return EFI_INVALID_PARAMETER;
@ -269,10 +267,10 @@ AmlNameOpCrsGetFirstRdNode (
*OutRdNode = NULL;
// Get the _CRS value which is represented as a BufferOp object node
// which is the 2nd fixed argument (i.e. index 1).
// Get the value of the variable which is represented as a BufferOp object
// node which is the 2nd fixed argument (i.e. index 1).
BufferOpNode = (AML_OBJECT_NODE_HANDLE)AmlGetFixedArgument (
NameOpCrsNode,
NameOpNode,
EAmlParseIndexTerm1
);
if ((BufferOpNode == NULL) ||
@ -310,11 +308,12 @@ AmlNameOpCrsGetFirstRdNode (
}
)
The CurrRdNode Resource Data node must be defined in an object named "_CRS"
and defined by a "Name ()" ASL function.
Note:
"_CRS" names defined as methods are not handled by this function.
They must be defined as names, using the "Name ()" statement.
@param [in] CurrRdNode Pointer to the current Resource Data element of
the "_CRS" object.
the named object.
@param [out] OutRdNode Pointer to the Resource Data element following
the CurrRdNode.
Contain a NULL pointer if CurrRdNode is the
@ -327,12 +326,12 @@ AmlNameOpCrsGetFirstRdNode (
**/
EFI_STATUS
EFIAPI
AmlNameOpCrsGetNextRdNode (
AmlNameOpGetNextRdNode (
IN AML_DATA_NODE_HANDLE CurrRdNode,
OUT AML_DATA_NODE_HANDLE * OutRdNode
)
{
AML_OBJECT_NODE_HANDLE NameOpCrsNode;
AML_OBJECT_NODE_HANDLE NameOpNode;
AML_OBJECT_NODE_HANDLE BufferOpNode;
if ((CurrRdNode == NULL) ||
@ -356,12 +355,11 @@ AmlNameOpCrsGetNextRdNode (
}
// The parent of the BufferOpNode must be a NameOp node.
NameOpCrsNode = (AML_OBJECT_NODE_HANDLE)AmlGetParent (
(AML_NODE_HANDLE)BufferOpNode
);
if ((NameOpCrsNode == NULL) ||
(!AmlNodeHasOpCode (NameOpCrsNode, AML_NAME_OP, 0)) ||
(!AmlNameOpCompareName (NameOpCrsNode, "_CRS"))) {
NameOpNode = (AML_OBJECT_NODE_HANDLE)AmlGetParent (
(AML_NODE_HANDLE)BufferOpNode
);
if ((NameOpNode == NULL) ||
(!AmlNodeHasOpCode (NameOpNode, AML_NAME_OP, 0))) {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@ -380,3 +378,88 @@ AmlNameOpCrsGetNextRdNode (
return EFI_SUCCESS;
}
// DEPRECATED APIS
#ifndef DISABLE_NEW_DEPRECATED_INTERFACES
/** DEPRECATED API
Get the first Resource Data element contained in a "_CRS" object.
In the following ASL code, the function will return the Resource Data
node corresponding to the "QWordMemory ()" ASL macro.
Name (_CRS, ResourceTemplate() {
QWordMemory (...) {...},
Interrupt (...) {...}
}
)
Note:
- The "_CRS" object must be declared using ASL "Name (Declare Named Object)".
- "_CRS" declared using ASL "Method (Declare Control Method)" is not
supported.
@ingroup UserApis
@param [in] NameOpCrsNode NameOp object node defining a "_CRS" object.
Must have an OpCode=AML_NAME_OP, SubOpCode=0.
NameOp object nodes are defined in ASL
using the "Name ()" function.
@param [out] OutRdNode Pointer to the first Resource Data element of
the "_CRS" object. A Resource Data element
is stored in a data node.
@retval EFI_SUCCESS The function completed successfully.
@retval EFI_INVALID_PARAMETER Invalid parameter.
**/
EFI_STATUS
EFIAPI
AmlNameOpCrsGetFirstRdNode (
IN AML_OBJECT_NODE_HANDLE NameOpCrsNode,
OUT AML_DATA_NODE_HANDLE * OutRdNode
)
{
return AmlNameOpGetFirstRdNode (NameOpCrsNode, OutRdNode);
}
/** DEPRECATED API
Get the Resource Data element following the CurrRdNode Resource Data.
In the following ASL code, if CurrRdNode corresponds to the first
"QWordMemory ()" ASL macro, the function will return the Resource Data
node corresponding to the "Interrupt ()" ASL macro.
Name (_CRS, ResourceTemplate() {
QwordMemory (...) {...},
Interrupt (...) {...}
}
)
The CurrRdNode Resource Data node must be defined in an object named "_CRS"
and defined by a "Name ()" ASL function.
@ingroup UserApis
@param [in] CurrRdNode Pointer to the current Resource Data element of
the "_CRS" variable.
@param [out] OutRdNode Pointer to the Resource Data element following
the CurrRdNode.
Contain a NULL pointer if CurrRdNode is the
last Resource Data element in the list.
The "End Tag" is not considered as a resource
data element and is not returned.
@retval EFI_SUCCESS The function completed successfully.
@retval EFI_INVALID_PARAMETER Invalid parameter.
**/
EFI_STATUS
EFIAPI
AmlNameOpCrsGetNextRdNode (
IN AML_DATA_NODE_HANDLE CurrRdNode,
OUT AML_DATA_NODE_HANDLE * OutRdNode
)
{
return AmlNameOpGetNextRdNode (CurrRdNode, OutRdNode);
}
#endif // DISABLE_NEW_DEPRECATED_INTERFACES

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
/** @file
AML Resource Data Code Generation.
Copyright (c) 2020, Arm Limited. All rights reserved.<BR>
Copyright (c) 2020 - 2021, Arm Limited. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
@ -24,12 +24,18 @@
If NewRdNode is not NULL, update its value to RdNode.
@param [in] RdNode Newly created Resource Data node.
@param [in] ParentNode If not NULL, add the generated node
to the end of the variable list of
argument of the ParentNode, but
before the "End Tag" Resource Data.
Must be a BufferOpNode.
@param [out] NewRdNode If not NULL, update the its value to RdNode.
RdNode is deleted if an error occurs.
@param [in] ParentNode If not NULL, ParentNode must:
- be a NameOp node, i.e. have the AML_NAME_OP
opcode (cf "Name ()" ASL statement)
- contain a list of resource data elements
(cf "ResourceTemplate ()" ASL statement)
RdNode is then added at the end of the variable
list of resource data elements, but before the
"End Tag" Resource Data.
@param [out] NewRdNode If not NULL:
- and Success, contains RdNode.
- and Error, reset to NULL.
@retval EFI_SUCCESS The function completed successfully.
@retval EFI_INVALID_PARAMETER Invalid parameter.
@ -43,57 +49,85 @@ LinkRdNode (
OUT AML_DATA_NODE ** NewRdNode
)
{
EFI_STATUS Status;
EFI_STATUS Status1;
EFI_STATUS Status;
EFI_STATUS Status1;
AML_OBJECT_NODE *BufferOpNode;
if (NewRdNode != NULL) {
*NewRdNode = NULL;
}
if (ParentNode != NULL) {
// Check this is a NameOp node.
if ((!AmlNodeHasOpCode (ParentNode, AML_NAME_OP, 0))) {
ASSERT (0);
Status = EFI_INVALID_PARAMETER;
goto error_handler;
}
// Get the value which is represented as a BufferOp object node
// which is the 2nd fixed argument (i.e. index 1).
BufferOpNode = (AML_OBJECT_NODE_HANDLE)AmlGetFixedArgument (
ParentNode,
EAmlParseIndexTerm1
);
if ((BufferOpNode == NULL) ||
(AmlGetNodeType ((AML_NODE_HANDLE)BufferOpNode) != EAmlNodeObject) ||
(!AmlNodeHasOpCode (BufferOpNode, AML_BUFFER_OP, 0))) {
ASSERT (0);
Status = EFI_INVALID_PARAMETER;
goto error_handler;
}
// Add RdNode as the last element, but before the EndTag.
Status = AmlAppendRdNode (BufferOpNode, RdNode);
if (EFI_ERROR (Status)) {
ASSERT (0);
goto error_handler;
}
}
if (NewRdNode != NULL) {
*NewRdNode = RdNode;
}
// Add RdNode as the last element, but before the EndTag.
if (ParentNode != NULL) {
Status = AmlAppendRdNode (ParentNode, RdNode);
if (EFI_ERROR (Status)) {
ASSERT (0);
Status1 = AmlDeleteTree ((AML_NODE_HEADER*)RdNode);
ASSERT_EFI_ERROR (Status1);
// Return original error.
return Status;
}
}
return EFI_SUCCESS;
error_handler:
Status1 = AmlDeleteTree ((AML_NODE_HEADER*)RdNode);
ASSERT_EFI_ERROR (Status1);
// Return original error.
return Status;
}
/** Code generation for the "Interrupt ()" ASL function.
This function creates a Resource Data element corresponding to the
"Interrupt ()" ASL function and stores it in an AML Data Node.
The Resource Data effectively created is an Extended Interrupt Resource
Data. See ACPI 6.3 specification, s6.4.3.6 "Extended Interrupt Descriptor"
for more information about Extended Interrupt Resource Data.
Data. Cf ACPI 6.4:
- s6.4.3.6 "Extended Interrupt Descriptor"
- s19.6.64 "Interrupt (Interrupt Resource Descriptor Macro)"
This function allocates memory to create a data node. It is the caller's
responsibility to either:
- attach this node to an AML tree;
- delete this node.
The created resource data node can be:
- appended to the list of resource data elements of the NameOpNode.
In such case NameOpNode must be defined by a the "Name ()" ASL statement
and initially contain a "ResourceTemplate ()".
- returned through the NewRdNode parameter.
@param [in] ResourceConsumer The device consumes the specified interrupt
or produces it for use by a child device.
@param [in] EdgeTriggered The interrupt is edge triggered or
level triggered.
@param [in] ActiveLow The interrupt is active-high or active-low.
@param [in] Shared The interrupt can be shared with other
devices or not (Exclusive).
@param [in] IrqList Interrupt list. Must be non-NULL.
@param [in] IrqCount Interrupt count. Must be non-zero.
@param [in] ParentNode If not NULL, add the generated node
to the end of the variable list of
argument of the ParentNode, but
before the "End Tag" Resource Data.
Must be a BufferOpNode.
@param [out] NewRdNode If success, contains the generated node.
@param [in] ResourceConsumer The device consumes the specified interrupt
or produces it for use by a child device.
@param [in] EdgeTriggered The interrupt is edge triggered or
level triggered.
@param [in] ActiveLow The interrupt is active-high or active-low.
@param [in] Shared The interrupt can be shared with other
devices or not (Exclusive).
@param [in] IrqList Interrupt list. Must be non-NULL.
@param [in] IrqCount Interrupt count. Must be non-zero.
@param [in] NameOpNode NameOp object node defining a named object.
If provided, append the new resource data node
to the list of resource data elements of this
node.
@param [out] NewRdNode If provided and success,
contain the created node.
@retval EFI_SUCCESS The function completed successfully.
@retval EFI_INVALID_PARAMETER Invalid parameter.
@ -101,15 +135,15 @@ LinkRdNode (
**/
EFI_STATUS
EFIAPI
AmlCodeGenInterrupt (
IN BOOLEAN ResourceConsumer,
IN BOOLEAN EdgeTriggered,
IN BOOLEAN ActiveLow,
IN BOOLEAN Shared,
IN UINT32 * IrqList,
IN UINT8 IrqCount,
IN AML_OBJECT_NODE * ParentNode, OPTIONAL
OUT AML_DATA_NODE ** NewRdNode OPTIONAL
AmlCodeGenRdInterrupt (
IN BOOLEAN ResourceConsumer,
IN BOOLEAN EdgeTriggered,
IN BOOLEAN ActiveLow,
IN BOOLEAN Shared,
IN UINT32 *IrqList,
IN UINT8 IrqCount,
IN AML_OBJECT_NODE_HANDLE NameOpNode, OPTIONAL
OUT AML_DATA_NODE_HANDLE *NewRdNode OPTIONAL
)
{
EFI_STATUS Status;
@ -120,16 +154,19 @@ AmlCodeGenInterrupt (
if ((IrqList == NULL) ||
(IrqCount == 0) ||
((ParentNode == NULL) && (NewRdNode == NULL))) {
((NameOpNode == NULL) && (NewRdNode == NULL))) {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
// Header
RdInterrupt.Header.Header.Bits.Name =
ACPI_LARGE_EXTENDED_IRQ_DESCRIPTOR_NAME;
RdInterrupt.Header.Header.Bits.Type = ACPI_LARGE_ITEM_FLAG;
RdInterrupt.Header.Length = sizeof (EFI_ACPI_EXTENDED_INTERRUPT_DESCRIPTOR) -
sizeof (ACPI_LARGE_RESOURCE_HEADER);
// Body
RdInterrupt.InterruptVectorFlags = (ResourceConsumer ? BIT0 : 0) |
(EdgeTriggered ? BIT1 : 0) |
(ActiveLow ? BIT2 : 0) |
@ -153,10 +190,215 @@ AmlCodeGenInterrupt (
return Status;
}
return LinkRdNode (RdNode, ParentNode, NewRdNode);
return LinkRdNode (RdNode, NameOpNode, NewRdNode);
}
/** Add an Interrupt Resource Data node.
/** Code generation for the "Register ()" ASL function.
The Resource Data effectively created is a Generic Register Descriptor.
Data. Cf ACPI 6.4:
- s6.4.3.7 "Generic Register Descriptor".
- s19.6.114 "Register".
The created resource data node can be:
- appended to the list of resource data elements of the NameOpNode.
In such case NameOpNode must be defined by a the "Name ()" ASL statement
and initially contain a "ResourceTemplate ()".
- returned through the NewRdNode parameter.
@param [in] AddressSpace Address space where the register exists.
Can be one of I/O space, System Memory, etc.
@param [in] BitWidth Number of bits in the register.
@param [in] BitOffset Offset in bits from the start of the register
indicated by the Address.
@param [in] Address Register address.
@param [in] AccessSize Size of data values used when accessing the
address space. Can be one of:
0 - Undefined, legacy (EFI_ACPI_6_4_UNDEFINED)
1 - Byte access (EFI_ACPI_6_4_BYTE)
2 - Word access (EFI_ACPI_6_4_WORD)
3 - DWord access (EFI_ACPI_6_4_DWORD)
4 - QWord access (EFI_ACPI_6_4_QWORD)
@param [in] NameOpNode NameOp object node defining a named object.
If provided, append the new resource data node
to the list of resource data elements of this
node.
@param [out] NewRdNode If provided and success,
contain the created node.
@retval EFI_SUCCESS The function completed successfully.
@retval EFI_INVALID_PARAMETER Invalid parameter.
@retval EFI_OUT_OF_RESOURCES Could not allocate memory.
**/
EFI_STATUS
EFIAPI
AmlCodeGenRdRegister (
IN UINT8 AddressSpace,
IN UINT8 BitWidth,
IN UINT8 BitOffset,
IN UINT64 Address,
IN UINT8 AccessSize,
IN AML_OBJECT_NODE_HANDLE NameOpNode, OPTIONAL
OUT AML_DATA_NODE_HANDLE *NewRdNode OPTIONAL
)
{
EFI_STATUS Status;
AML_DATA_NODE * RdNode;
EFI_ACPI_GENERIC_REGISTER_DESCRIPTOR RdRegister;
if ((AccessSize > EFI_ACPI_6_4_QWORD) ||
((NameOpNode == NULL) && (NewRdNode == NULL))) {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
// Header
RdRegister.Header.Header.Bits.Name =
ACPI_LARGE_GENERIC_REGISTER_DESCRIPTOR_NAME;
RdRegister.Header.Header.Bits.Type = ACPI_LARGE_ITEM_FLAG;
RdRegister.Header.Length = sizeof (EFI_ACPI_GENERIC_REGISTER_DESCRIPTOR) -
sizeof (ACPI_LARGE_RESOURCE_HEADER);
// Body
RdRegister.AddressSpaceId = AddressSpace;
RdRegister.RegisterBitWidth = BitWidth;
RdRegister.RegisterBitOffset = BitOffset;
RdRegister.AddressSize = AccessSize;
RdRegister.RegisterAddress = Address;
Status = AmlCreateDataNode (
EAmlNodeDataTypeResourceData,
(UINT8*)&RdRegister,
sizeof (EFI_ACPI_GENERIC_REGISTER_DESCRIPTOR),
&RdNode
);
if (EFI_ERROR (Status)) {
ASSERT (0);
return Status;
}
return LinkRdNode (RdNode, NameOpNode, NewRdNode);
}
/** Code generation for the EndTag resource data.
The EndTag resource data is automatically generated by the ASL compiler
at the end of a list of resource data elements. Thus, it doesn't have
a corresponding ASL function.
This function allocates memory to create a data node. It is the caller's
responsibility to either:
- attach this node to an AML tree;
- delete this node.
ACPI 6.4, s6.4.2.9 "End Tag":
"This checksum is generated such that adding it to the sum of all the data
bytes will produce a zero sum."
"If the checksum field is zero, the resource data is treated as if the
checksum operation succeeded. Configuration proceeds normally."
To avoid re-computing checksums, if a new resource data elements is
added/removed/modified in a list of resource data elements, the AmlLib
resets the checksum to 0.
@param [in] CheckSum CheckSum to store in the EndTag.
To ignore/avoid computing the checksum,
give 0.
@param [in] ParentNode If not NULL, add the generated node
to the end of the variable list of
argument of the ParentNode.
The ParentNode must not initially contain
an EndTag resource data element.
@param [out] NewRdNode If success, contains the generated node.
@retval EFI_SUCCESS The function completed successfully.
@retval EFI_INVALID_PARAMETER Invalid parameter.
@retval EFI_OUT_OF_RESOURCES Could not allocate memory.
**/
EFI_STATUS
EFIAPI
AmlCodeGenEndTag (
IN UINT8 CheckSum, OPTIONAL
IN AML_OBJECT_NODE * ParentNode, OPTIONAL
OUT AML_DATA_NODE ** NewRdNode OPTIONAL
)
{
EFI_STATUS Status;
AML_DATA_NODE * RdNode;
EFI_ACPI_END_TAG_DESCRIPTOR EndTag;
ACPI_SMALL_RESOURCE_HEADER SmallResHdr;
if ((ParentNode == NULL) && (NewRdNode == NULL)) {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
RdNode = NULL;
// Header
SmallResHdr.Bits.Length = sizeof (EFI_ACPI_END_TAG_DESCRIPTOR) -
sizeof (ACPI_SMALL_RESOURCE_HEADER);
SmallResHdr.Bits.Name = ACPI_SMALL_END_TAG_DESCRIPTOR_NAME;
SmallResHdr.Bits.Type = ACPI_SMALL_ITEM_FLAG;
// Body
EndTag.Desc = SmallResHdr.Byte;
EndTag.Checksum = CheckSum;
Status = AmlCreateDataNode (
EAmlNodeDataTypeResourceData,
(UINT8*)&EndTag,
sizeof (EFI_ACPI_END_TAG_DESCRIPTOR),
&RdNode
);
if (EFI_ERROR (Status)) {
ASSERT (0);
return Status;
}
if (NewRdNode != NULL) {
*NewRdNode = RdNode;
}
if (ParentNode != NULL) {
// Check the BufferOp doesn't contain any resource data yet.
// This is a hard check: do not allow to add an EndTag if the BufferNode
// already has resource data elements attached. Indeed, the EndTag should
// have already been added.
if (AmlGetNextVariableArgument ((AML_NODE_HEADER*)ParentNode, NULL) !=
NULL) {
ASSERT (0);
Status = EFI_INVALID_PARAMETER;
goto error_handler;
}
// Add the EndTag RdNode. Indeed, the AmlAppendRdNode function
// is looking for an EndTag, which we are adding here.
Status = AmlVarListAddTail (
(AML_NODE_HEADER*)ParentNode,
(AML_NODE_HEADER*)RdNode
);
if (EFI_ERROR (Status)) {
ASSERT (0);
goto error_handler;
}
}
return Status;
error_handler:
if (RdNode != NULL) {
AmlDeleteTree ((AML_NODE_HEADER*)RdNode);
}
return Status;
}
// DEPRECATED APIS
#ifndef DISABLE_NEW_DEPRECATED_INTERFACES
/** DEPRECATED API
Add an Interrupt Resource Data node.
This function creates a Resource Data element corresponding to the
"Interrupt ()" ASL function, stores it in an AML Data Node.
@ -180,6 +422,8 @@ AmlCodeGenInterrupt (
...
}
@ingroup UserApis
@param [in] NameOpCrsNode NameOp object node defining a "_CRS" object.
Must have an OpCode=AML_NAME_OP, SubOpCode=0.
NameOp object nodes are defined in ASL
@ -211,46 +455,16 @@ AmlCodeGenCrsAddRdInterrupt (
IN UINT8 IrqCount
)
{
EFI_STATUS Status;
AML_OBJECT_NODE_HANDLE BufferOpNode;
if ((IrqList == NULL) ||
(IrqCount == 0) ||
(!AmlNodeHasOpCode (NameOpCrsNode, AML_NAME_OP, 0)) ||
(!AmlNameOpCompareName (NameOpCrsNode, "_CRS"))) {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
// Get the _CRS value which is represented as a BufferOp object node
// which is the 2nd fixed argument (i.e. index 1).
BufferOpNode = (AML_OBJECT_NODE_HANDLE)AmlGetFixedArgument (
NameOpCrsNode,
EAmlParseIndexTerm1
);
if ((BufferOpNode == NULL) ||
(AmlGetNodeType ((AML_NODE_HANDLE)BufferOpNode) != EAmlNodeObject) ||
(!AmlNodeHasOpCode (BufferOpNode, AML_BUFFER_OP, 0))) {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
// Generate the Extended Interrupt Resource Data node,
// and attach it as the last variable argument of the BufferOpNode.
Status = AmlCodeGenInterrupt (
ResourceConsumer,
EdgeTriggered,
ActiveLow,
Shared,
IrqList,
IrqCount,
BufferOpNode,
NULL
);
if (EFI_ERROR (Status)) {
ASSERT (0);
}
return Status;
return AmlCodeGenRdInterrupt (
ResourceConsumer,
EdgeTriggered,
ActiveLow,
Shared,
IrqList,
IrqCount,
NameOpCrsNode,
NULL
);
}
#endif // DISABLE_NEW_DEPRECATED_INTERFACES

View File

@ -1,7 +1,7 @@
/** @file
AML Resource Data Code Generation.
Copyright (c) 2019 - 2020, Arm Limited. All rights reserved.<BR>
Copyright (c) 2019 - 2021, Arm Limited. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
@ -11,33 +11,32 @@
/** Code generation for the "Interrupt ()" ASL function.
This function creates a Resource Data element corresponding to the
"Interrupt ()" ASL function and stores it in an AML Data Node.
The Resource Data effectively created is an Extended Interrupt Resource
Data. See ACPI 6.3 specification, s6.4.3.6 "Extended Interrupt Descriptor"
for more information about Extended Interrupt Resource Data.
Data. Cf ACPI 6.4:
- s6.4.3.6 "Extended Interrupt Descriptor"
- s19.6.64 "Interrupt (Interrupt Resource Descriptor Macro)"
This function allocates memory to create a data node. It is the caller's
responsibility to either:
- attach this node to an AML tree;
- delete this node.
The created resource data node can be:
- appended to the list of resource data elements of the NameOpNode.
In such case NameOpNode must be defined by a the "Name ()" ASL statement
and initially contain a "ResourceTemplate ()".
- returned through the NewRdNode parameter.
@param [in] ResourceConsumer The device consumes the specified interrupt
or produces it for use by a child device.
@param [in] EdgeTriggered The interrupt is edge triggered or
level triggered.
@param [in] ActiveLow The interrupt is active-high or active-low.
@param [in] Shared The interrupt can be shared with other
devices or not (Exclusive).
@param [in] IrqList Interrupt list. Must be non-NULL.
@param [in] IrqCount Interrupt count. Must be non-zero.
@param [in] ParentNode If not NULL, add the generated node
to the end of the variable list of
argument of the ParentNode, but
before the "End Tag" Resource Data.
Must be a BufferOpNode.
@param [out] NewRdNode If success, contains the generated node.
@param [in] ResourceConsumer The device consumes the specified interrupt
or produces it for use by a child device.
@param [in] EdgeTriggered The interrupt is edge triggered or
level triggered.
@param [in] ActiveLow The interrupt is active-high or active-low.
@param [in] Shared The interrupt can be shared with other
devices or not (Exclusive).
@param [in] IrqList Interrupt list. Must be non-NULL.
@param [in] IrqCount Interrupt count. Must be non-zero.
@param [in] NameOpNode NameOp object node defining a named object.
If provided, append the new resource data node
to the list of resource data elements of this
node.
@param [out] NewRdNode If provided and success,
contain the created node.
@retval EFI_SUCCESS The function completed successfully.
@retval EFI_INVALID_PARAMETER Invalid parameter.
@ -45,15 +44,107 @@
**/
EFI_STATUS
EFIAPI
AmlCodeGenInterrupt (
IN BOOLEAN ResourceConsumer,
IN BOOLEAN EdgeTriggered,
IN BOOLEAN ActiveLow,
IN BOOLEAN Shared,
IN UINT32 * IrqList,
IN UINT8 IrqCount,
IN AML_OBJECT_NODE * ParentNode, OPTIONAL
OUT AML_DATA_NODE ** NewRdNode OPTIONAL
AmlCodeGenRdInterrupt (
IN BOOLEAN ResourceConsumer,
IN BOOLEAN EdgeTriggered,
IN BOOLEAN ActiveLow,
IN BOOLEAN Shared,
IN UINT32 *IrqList,
IN UINT8 IrqCount,
IN AML_OBJECT_NODE_HANDLE NameOpNode, OPTIONAL
OUT AML_DATA_NODE_HANDLE *NewRdNode OPTIONAL
);
/** Code generation for the "Register ()" ASL function.
The Resource Data effectively created is a Generic Register Descriptor.
Data. Cf ACPI 6.4:
- s6.4.3.7 "Generic Register Descriptor".
- s19.6.114 "Register".
The created resource data node can be:
- appended to the list of resource data elements of the NameOpNode.
In such case NameOpNode must be defined by a the "Name ()" ASL statement
and initially contain a "ResourceTemplate ()".
- returned through the NewRdNode parameter.
@param [in] AddressSpace Address space where the register exists.
Can be one of I/O space, System Memory, etc.
@param [in] BitWidth Number of bits in the register.
@param [in] BitOffset Offset in bits from the start of the register
indicated by the Address.
@param [in] Address Register address.
@param [in] AccessSize Size of data values used when accessing the
address space. Can be one of:
0 - Undefined, legacy (EFI_ACPI_6_4_UNDEFINED)
1 - Byte access (EFI_ACPI_6_4_BYTE)
2 - Word access (EFI_ACPI_6_4_WORD)
3 - DWord access (EFI_ACPI_6_4_DWORD)
4 - QWord access (EFI_ACPI_6_4_QWORD)
@param [in] NameOpNode NameOp object node defining a named object.
If provided, append the new resource data node
to the list of resource data elements of this
node.
@param [out] NewRdNode If provided and success,
contain the created node.
@retval EFI_SUCCESS The function completed successfully.
@retval EFI_INVALID_PARAMETER Invalid parameter.
@retval EFI_OUT_OF_RESOURCES Could not allocate memory.
**/
EFI_STATUS
EFIAPI
AmlCodeGenRdRegister (
IN UINT8 AddressSpace,
IN UINT8 BitWidth,
IN UINT8 BitOffset,
IN UINT64 Address,
IN UINT8 AccessSize,
IN AML_OBJECT_NODE_HANDLE NameOpNode, OPTIONAL
OUT AML_DATA_NODE_HANDLE *NewRdNode OPTIONAL
);
/** Code generation for the EndTag resource data.
The EndTag resource data is automatically generated by the ASL compiler
at the end of a list of resource data elements. Thus, it doesn't have
a corresponding ASL function.
This function allocates memory to create a data node. It is the caller's
responsibility to either:
- attach this node to an AML tree;
- delete this node.
ACPI 6.4, s6.4.2.9 "End Tag":
"This checksum is generated such that adding it to the sum of all the data
bytes will produce a zero sum."
"If the checksum field is zero, the resource data is treated as if the
checksum operation succeeded. Configuration proceeds normally."
To avoid re-computing checksums, if a new resource data elements is
added/removed/modified in a list of resource data elements, the AmlLib
resets the checksum to 0.
@param [in] CheckSum CheckSum to store in the EndTag.
To ignore/avoid computing the checksum,
give 0.
@param [in] ParentNode If not NULL, add the generated node
to the end of the variable list of
argument of the ParentNode.
The ParentNode must not initially contain
an EndTag resource data element.
@param [out] NewRdNode If success, contains the generated node.
@retval EFI_SUCCESS The function completed successfully.
@retval EFI_INVALID_PARAMETER Invalid parameter.
@retval EFI_OUT_OF_RESOURCES Could not allocate memory.
**/
EFI_STATUS
EFIAPI
AmlCodeGenEndTag (
IN UINT8 CheckSum, OPTIONAL
IN AML_OBJECT_NODE * ParentNode, OPTIONAL
OUT AML_DATA_NODE ** NewRdNode OPTIONAL
);
#endif // AML_RESOURCE_DATA_CODE_GEN_H_

View File

@ -101,3 +101,36 @@ AmlRdGetSize (
return ((ACPI_SMALL_RESOURCE_HEADER*)Header)->Bits.Length +
sizeof (ACPI_SMALL_RESOURCE_HEADER);
}
/** Set the Checksum of an EndTag resource data.
ACPI 6.4, s6.4.2.9 "End Tag":
"This checksum is generated such that adding it to the sum of all the data
bytes will produce a zero sum."
"If the checksum field is zero, the resource data is treated as if the
checksum operation succeeded. Configuration proceeds normally."
@param [in] Header Pointer to the first byte of a resource data.
@param [in] CheckSum Checksum value to set.
@retval EFI_SUCCESS The function completed successfully.
@retval EFI_INVALID_PARAMETER Invalid parameter.
**/
EFI_STATUS
EFIAPI
AmlRdSetEndTagChecksum (
IN CONST AML_RD_HEADER * Header,
IN UINT8 CheckSum
)
{
if ((Header == NULL) ||
!AmlRdCompareDescId (
Header,
AML_RD_BUILD_SMALL_DESC_ID (ACPI_SMALL_END_TAG_DESCRIPTOR_NAME))) {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
((EFI_ACPI_END_TAG_DESCRIPTOR*)Header)->Checksum = CheckSum;
return EFI_SUCCESS;
}

View File

@ -171,4 +171,25 @@ AmlRdGetSize (
IN CONST AML_RD_HEADER * Header
);
/** Set the Checksum of an EndTag resource data.
ACPI 6.4, s6.4.2.9 "End Tag":
"This checksum is generated such that adding it to the sum of all the data
bytes will produce a zero sum."
"If the checksum field is zero, the resource data is treated as if the
checksum operation succeeded. Configuration proceeds normally."
@param [in] Header Pointer to the first byte of a resource data.
@param [in] CheckSum Checksum value to set.
@retval EFI_SUCCESS The function completed successfully.
@retval EFI_INVALID_PARAMETER Invalid parameter.
**/
EFI_STATUS
EFIAPI
AmlRdSetEndTagChecksum (
IN CONST AML_RD_HEADER * Header,
IN UINT8 CheckSum
);
#endif // AML_RESOURCE_DATA_H_

View File

@ -43,8 +43,6 @@ AmlCloneNode (
return EFI_INVALID_PARAMETER;
}
*ClonedNode = NULL;
if (IS_AML_DATA_NODE (Node)) {
DataNode = (AML_DATA_NODE*)Node;
Status = AmlCreateDataNode (

View File

@ -79,7 +79,9 @@ AmlDeleteRootNode (
@param [in] SdtHeader Pointer to an ACPI DSDT/SSDT header to copy
the data from.
@param [out] NewRootNodePtr The created AML_ROOT_NODE.
@param [out] NewRootNodePtr If success, contains the created
AML_ROOT_NODE.
Otherwise reset to NULL.
@retval EFI_SUCCESS The function completed successfully.
@retval EFI_INVALID_PARAMETER Invalid parameter.
@ -101,6 +103,8 @@ AmlCreateRootNode (
return EFI_INVALID_PARAMETER;
}
*NewRootNodePtr = NULL;
RootNode = AllocateZeroPool (sizeof (AML_ROOT_NODE));
if (RootNode == NULL) {
ASSERT (0);
@ -163,7 +167,9 @@ AmlDeleteObjectNode (
@param [in] PkgLength PkgLength of the node if the AmlByteEncoding
has the PkgLen attribute.
0 otherwise.
@param [out] NewObjectNodePtr The created AML_OBJECT_NODE.
@param [out] NewObjectNodePtr If success, contains the created
AML_OBJECT_NODE.
Otherwise reset to NULL.
@retval EFI_SUCCESS The function completed successfully.
@retval EFI_INVALID_PARAMETER Invalid parameter.
@ -186,6 +192,8 @@ AmlCreateObjectNode (
return EFI_INVALID_PARAMETER;
}
*NewObjectNodePtr = NULL;
ObjectNode = AllocateZeroPool (sizeof (AML_OBJECT_NODE));
if (ObjectNode == NULL) {
ASSERT (0);
@ -252,7 +260,9 @@ AmlDeleteDataNode (
this node. Data is copied from there.
@param [in] DataSize Number of bytes to consider at the address
pointed by Data.
@param [out] NewDataNodePtr The created AML_DATA_NODE.
@param [out] NewDataNodePtr If success, contains the created
AML_DATA_NODE.
Otherwise reset to NULL.
@retval EFI_SUCCESS The function completed successfully.
@retval EFI_INVALID_PARAMETER Invalid parameter.
@ -284,6 +294,8 @@ AmlCreateDataNode (
return EFI_INVALID_PARAMETER;
}
*NewDataNodePtr = NULL;
DataNode = AllocateZeroPool (sizeof (AML_DATA_NODE));
if (DataNode == NULL) {
ASSERT (0);

View File

@ -17,7 +17,9 @@
@param [in] SdtHeader Pointer to an ACPI DSDT/SSDT header to copy
the data from.
@param [out] NewRootNodePtr The created AML_ROOT_NODE.
@param [out] NewRootNodePtr If success, contains the created
AML_ROOT_NODE.
Otherwise reset to NULL.
@retval EFI_SUCCESS The function completed successfully.
@retval EFI_INVALID_PARAMETER Invalid parameter.
@ -36,7 +38,9 @@ AmlCreateRootNode (
@param [in] PkgLength PkgLength of the node if the AmlByteEncoding
has the PkgLen attribute.
0 otherwise.
@param [out] NewObjectNodePtr The created AML_OBJECT_NODE.
@param [out] NewObjectNodePtr If success, contains the created
AML_OBJECT_NODE.
Otherwise reset to NULL.
@retval EFI_SUCCESS The function completed successfully.
@retval EFI_INVALID_PARAMETER Invalid parameter.
@ -57,7 +61,9 @@ AmlCreateObjectNode (
this node. Data is copied from there.
@param [in] DataSize Number of bytes to consider at the address
pointed by Data.
@param [out] NewDataNodePtr The created AML_DATA_NODE.
@param [out] NewDataNodePtr If success, contains the created
AML_DATA_NODE.
Otherwise reset to NULL.
@retval EFI_SUCCESS The function completed successfully.
@retval EFI_INVALID_PARAMETER Invalid parameter.

View File

@ -513,6 +513,13 @@ AmlUpdateDataNode (
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
Status = AmlSetRdListCheckSum (ParentNode, 0);
if (EFI_ERROR (Status)) {
ASSERT (0);
return Status;
}
break;
}
case EAmlNodeDataTypeFieldPkgLen:

View File

@ -566,8 +566,7 @@ AmlAppendRdNode (
)
{
EFI_STATUS Status;
AML_DATA_NODE * CurrRdNode;
AML_RD_HEADER RdDataType;
AML_DATA_NODE * LastRdNode;
if (!AmlNodeCompareOpCode (BufferOpNode, AML_BUFFER_OP, 0) ||
!IS_AML_DATA_NODE (NewRdNode) ||
@ -576,56 +575,39 @@ AmlAppendRdNode (
return EFI_INVALID_PARAMETER;
}
// Get the first Resource data node in the variable list of
// argument of the BufferOp node.
CurrRdNode = (AML_DATA_NODE*)AmlGetNextVariableArgument (
// To avoid re-computing checksums, if a new resource data elements is
// added/removed/modified in a list of resource data elements, the AmlLib
// resets the checksum to 0.
// It is possible to have only one Resource Data in a BufferOp with
// no EndTag, but it should not be possible to add a new Resource Data
// in the list in this case.
Status = AmlSetRdListCheckSum (BufferOpNode, 0);
if (EFI_ERROR (Status)) {
ASSERT (0);
return Status;
}
// Get the last Resource data node in the variable list of argument of the
// BufferOp node. This must be an EndTag, otherwise setting the checksum
// would have failed.
LastRdNode = (AML_DATA_NODE*)AmlGetPreviousVariableArgument (
(AML_NODE_HEADER*)BufferOpNode,
NULL
);
if ((CurrRdNode == NULL) ||
!IS_AML_DATA_NODE (CurrRdNode) ||
(CurrRdNode->DataType != EAmlNodeDataTypeResourceData)) {
if ((LastRdNode == NULL) ||
!IS_AML_DATA_NODE (LastRdNode) ||
(LastRdNode->DataType != EAmlNodeDataTypeResourceData)) {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
// Iterate through the Resource Data nodes to find the End Tag.
while (TRUE) {
Status = AmlGetResourceDataType (CurrRdNode, &RdDataType);
if (EFI_ERROR (Status)) {
ASSERT (0);
return Status;
}
// If the Resource Data is an End Tag,
// add the new node before and return.
if (AmlRdCompareDescId (
&RdDataType,
AML_RD_BUILD_SMALL_DESC_ID (ACPI_SMALL_END_TAG_DESCRIPTOR_NAME))) {
Status = AmlVarListAddBefore (
(AML_NODE_HEADER*)CurrRdNode,
(AML_NODE_HEADER*)NewRdNode)
;
if (EFI_ERROR (Status)) {
ASSERT (0);
}
return Status;
}
// Get the next Resource Data node.
// If this was the last node and no End Tag was found, return error.
// It is possible to have only one Resource Data in a BufferOp,
// but it should not be possible to add a new Resource Data in the list
// in this case.
CurrRdNode = (AML_DATA_NODE*)AmlGetSiblingVariableArgument (
(AML_NODE_HEADER*)CurrRdNode
);
if (!IS_AML_DATA_NODE (CurrRdNode) ||
(CurrRdNode->DataType != EAmlNodeDataTypeResourceData)) {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
} // while
// Add NewRdNode before the EndTag.
Status = AmlVarListAddBefore (
(AML_NODE_HEADER*)LastRdNode,
(AML_NODE_HEADER*)NewRdNode)
;
ASSERT_EFI_ERROR (Status);
return Status;
}
/** Replace the fixed argument at the Index of the ParentNode with the NewNode.

View File

@ -1,7 +1,7 @@
/** @file
AML Utility.
Copyright (c) 2019 - 2020, Arm Limited. All rights reserved.<BR>
Copyright (c) 2019 - 2021, Arm Limited. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
@ -192,7 +192,6 @@ AmlComputeSize (
@retval EFI_SUCCESS The function completed successfully.
@retval EFI_INVALID_PARAMETER Invalid parameter.
**/
STATIC
EFI_STATUS
EFIAPI
AmlNodeGetIntegerValue (
@ -904,3 +903,79 @@ AmlPropagateInformation (
return EFI_SUCCESS;
}
/** Find and set the EndTag's Checksum of a list of Resource Data elements.
Lists of Resource Data elements end with an EndTag (most of the time). This
function finds the EndTag (if present) in a list of Resource Data elements
and sets the checksum.
ACPI 6.4, s6.4.2.9 "End Tag":
"This checksum is generated such that adding it to the sum of all the data
bytes will produce a zero sum."
"If the checksum field is zero, the resource data is treated as if the
checksum operation succeeded. Configuration proceeds normally."
To avoid re-computing checksums, if a new resource data elements is
added/removed/modified in a list of resource data elements, the AmlLib
resets the checksum to 0.
@param [in] BufferOpNode Node having a list of Resource Data elements.
@param [in] CheckSum CheckSum to store in the EndTag.
To ignore/avoid computing the checksum,
give 0.
@retval EFI_SUCCESS The function completed successfully.
@retval EFI_INVALID_PARAMETER Invalid parameter.
@retval EFI_NOT_FOUND No EndTag found.
**/
EFI_STATUS
EFIAPI
AmlSetRdListCheckSum (
IN AML_OBJECT_NODE * BufferOpNode,
IN UINT8 CheckSum
)
{
EFI_STATUS Status;
AML_DATA_NODE * LastRdNode;
AML_RD_HEADER RdDataType;
if (!AmlNodeCompareOpCode (BufferOpNode, AML_BUFFER_OP, 0)) {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
// Get the last Resource data node in the variable list of
// argument of the BufferOp node.
LastRdNode = (AML_DATA_NODE*)AmlGetPreviousVariableArgument (
(AML_NODE_HEADER*)BufferOpNode,
NULL
);
if ((LastRdNode == NULL) ||
!IS_AML_DATA_NODE (LastRdNode) ||
(LastRdNode->DataType != EAmlNodeDataTypeResourceData)) {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
Status = AmlGetResourceDataType (LastRdNode, &RdDataType);
if (EFI_ERROR (Status)) {
ASSERT (0);
return Status;
}
// Check the LastRdNode is an EndTag.
// It is possible to have only one Resource Data in a BufferOp with
// no EndTag. Return EFI_NOT_FOUND is such case.
if (!AmlRdCompareDescId (
&RdDataType,
AML_RD_BUILD_SMALL_DESC_ID (ACPI_SMALL_END_TAG_DESCRIPTOR_NAME))) {
ASSERT (0);
return EFI_NOT_FOUND;
}
Status = AmlRdSetEndTagChecksum (LastRdNode->Buffer, CheckSum);
ASSERT_EFI_ERROR (Status);
return Status;
}

View File

@ -1,7 +1,7 @@
/** @file
AML Utility.
Copyright (c) 2019 - 2020, Arm Limited. All rights reserved.<BR>
Copyright (c) 2019 - 2021, Arm Limited. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
@ -39,6 +39,22 @@ AmlComputeSize (
IN OUT UINT32 * Size
);
/** Get the value contained in an integer node.
@param [in] Node Pointer to an integer node.
Must be an object node.
@param [out] Value Value contained in the integer node.
@retval EFI_SUCCESS The function completed successfully.
@retval EFI_INVALID_PARAMETER Invalid parameter.
**/
EFI_STATUS
EFIAPI
AmlNodeGetIntegerValue (
IN AML_OBJECT_NODE * Node,
OUT UINT64 * Value
);
/** Set the value contained in an integer node.
The OpCode is updated accordingly to the new value
@ -91,5 +107,37 @@ AmlPropagateInformation (
IN UINT8 NodeCount
);
/** Find and set the EndTag's Checksum of a list of Resource Data elements.
Lists of Resource Data elements end with an EndTag (most of the time). This
function finds the EndTag (if present) in a list of Resource Data elements
and sets the checksum.
ACPI 6.4, s6.4.2.9 "End Tag":
"This checksum is generated such that adding it to the sum of all the data
bytes will produce a zero sum."
"If the checksum field is zero, the resource data is treated as if the
checksum operation succeeded. Configuration proceeds normally."
To avoid re-computing checksums, if a new resource data elements is
added/removed/modified in a list of resource data elements, the AmlLib
resets the checksum to 0.
@param [in] BufferOpNode Node having a list of Resource Data elements.
@param [in] CheckSum CheckSum to store in the EndTag.
To ignore/avoid computing the checksum,
give 0.
@retval EFI_SUCCESS The function completed successfully.
@retval EFI_INVALID_PARAMETER Invalid parameter.
@retval EFI_NOT_FOUND No EndTag found.
**/
EFI_STATUS
EFIAPI
AmlSetRdListCheckSum (
IN AML_OBJECT_NODE * BufferOpNode,
IN UINT8 CheckSum
);
#endif // AML_UTILITY_H_

View File

@ -16,15 +16,14 @@
#include <Library/BaseMemoryLib.h>
#include <Library/DebugLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Protocol/AcpiTable.h>
// Module specific include files.
#include <AcpiTableGenerator.h>
#include <ConfigurationManagerObject.h>
#include <ConfigurationManagerHelper.h>
#include <Library/AcpiHelperLib.h>
#include <Library/AmlLib/AmlLib.h>
#include <Library/TableHelperLib.h>
#include <Protocol/ConfigurationManagerProtocol.h>
/** C array containing the compiled AML template.
@ -275,7 +274,7 @@ FixupCrs (
}
// Get the first Rd node in the "_CRS" object.
Status = AmlNameOpCrsGetFirstRdNode (NameOpCrsNode, &QWordRdNode);
Status = AmlNameOpGetFirstRdNode (NameOpCrsNode, &QWordRdNode);
if (EFI_ERROR (Status)) {
return Status;
}
@ -298,7 +297,7 @@ FixupCrs (
// Get the Interrupt node.
// It is the second Resource Data element in the NameOpCrsNode's
// variable list of arguments.
Status = AmlNameOpCrsGetNextRdNode (QWordRdNode, &InterruptRdNode);
Status = AmlNameOpGetNextRdNode (QWordRdNode, &InterruptRdNode);
if (EFI_ERROR (Status)) {
return Status;
}

View File

@ -25,6 +25,7 @@
DynamicTablesPkg/DynamicTablesPkg.dec
[LibraryClasses]
AcpiHelperLib
AmlLib
BaseLib

View File

@ -0,0 +1,713 @@
/** @file
Configuration Manager Object parser.
Copyright (c) 2021, ARM Limited. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#include <Library/BaseLib.h>
#include <Library/DebugLib.h>
#include <ConfigurationManagerObject.h>
#include "ConfigurationManagerObjectParser.h"
STATIC
VOID
EFIAPI
PrintOemId (
CONST CHAR8* Format,
UINT8* Ptr
);
/** A parser for EArmObjBootArchInfo.
*/
STATIC CONST CM_OBJ_PARSER CmArmBootArchInfoParser[] = {
{"BootArchFlags", 2, "0x%x", NULL}
};
/** A parser for EArmObjPowerManagementProfileInfo.
*/
STATIC CONST CM_OBJ_PARSER CmArmPowerManagementProfileInfoParser[] = {
{"PowerManagementProfile", 1, "0x%x", NULL}
};
/** A parser for EArmObjGicCInfo.
*/
STATIC CONST CM_OBJ_PARSER CmArmGicCInfoParser[] = {
{"CPUInterfaceNumber", 4, "0x%x", NULL},
{"AcpiProcessorUid", 4, "0x%x", NULL},
{"Flags", 4, "0x%x", NULL},
{"ParkingProtocolVersion", 4, "0x%x", NULL},
{"PerformanceInterruptGsiv", 4, "0x%x", NULL},
{"ParkedAddress", 8, "0x%llx", NULL},
{"PhysicalBaseAddress", 8, "0x%llx", NULL},
{"GICV", 8, "0x%llx", NULL},
{"GICH", 8, "0x%llx", NULL},
{"VGICMaintenanceInterrupt", 4, "0x%x", NULL},
{"GICRBaseAddress", 8, "0x%llx", NULL},
{"MPIDR", 8, "0x%llx", NULL},
{"ProcessorPowerEfficiencyClass", 1, "0x%x", NULL},
{"SpeOverflowInterrupt", 2, "0x%x", NULL},
{"ProximityDomain", 4, "0x%x", NULL},
{"ClockDomain", 4, "0x%x", NULL},
{"AffinityFlags", 4, "0x%x", NULL}
};
/** A parser for EArmObjGicDInfo.
*/
STATIC CONST CM_OBJ_PARSER CmArmGicDInfoParser[] = {
{"PhysicalBaseAddress", 8, "0x%llx", NULL},
{"SystemVectorBase", 4, "0x%x", NULL},
{"GicVersion", 1, "0x%x", NULL},
};
/** A parser for EArmObjGicMsiFrameInfo.
*/
STATIC CONST CM_OBJ_PARSER CmArmGicMsiFrameInfoParser[] = {
{"GicMsiFrameId", 4, "0x%x", NULL},
{"PhysicalBaseAddress", 8, "0x%llx", NULL},
{"Flags", 4, "0x%x", NULL},
{"SPICount", 2, "0x%x", NULL},
{"SPIBase", 2, "0x%x", NULL}
};
/** A parser for EArmObjGicRedistributorInfo.
*/
STATIC CONST CM_OBJ_PARSER CmArmGicRedistInfoParser[] = {
{"DiscoveryRangeBaseAddress", 8, "0x%llx", NULL},
{"DiscoveryRangeLength", 4, "0x%x", NULL}
};
/** A parser for EArmObjGicItsInfo.
*/
STATIC CONST CM_OBJ_PARSER CmArmGicItsInfoParser[] = {
{"GicItsId", 4, "0x%x", NULL},
{"PhysicalBaseAddress", 8, "0x%llx", NULL},
{"ProximityDomain", 4, "0x%x", NULL}
};
/** A parser for EArmObjSerialConsolePortInfo,
EArmObjSerialDebugPortInfo and EArmObjSerialPortInfo.
*/
STATIC CONST CM_OBJ_PARSER CmArmSerialPortInfoParser[] = {
{"BaseAddress", 8, "0x%llx", NULL},
{"Interrupt", 4, "0x%x", NULL},
{"BaudRate", 8, "0x%llx", NULL},
{"Clock", 4, "0x%x", NULL},
{"PortSubtype", 2, "0x%x", NULL},
{"BaseAddressLength", 8, "0x%llx", NULL},
{"AccessSize", 1, "0x%d", NULL}
};
/** A parser for EArmObjGenericTimerInfo.
*/
STATIC CONST CM_OBJ_PARSER CmArmGenericTimerInfoParser[] = {
{"CounterControlBaseAddress", 8, "0x%llx", NULL},
{"CounterReadBaseAddress", 8, "0x%llx", NULL},
{"SecurePL1TimerGSIV", 4, "0x%x", NULL},
{"SecurePL1TimerFlags", 4, "0x%x", NULL},
{"NonSecurePL1TimerGSIV", 4, "0x%x", NULL},
{"NonSecurePL1TimerFlags", 4, "0x%x", NULL},
{"VirtualTimerGSIV", 4, "0x%x", NULL},
{"VirtualTimerFlags", 4, "0x%x", NULL},
{"NonSecurePL2TimerGSIV", 4, "0x%x", NULL},
{"NonSecurePL2TimerFlags", 4, "0x%x", NULL},
{"VirtualPL2TimerGSIV", 4, "0x%x", NULL},
{"VirtualPL2TimerFlags", 4, "0x%x", NULL}
};
/** A parser for EArmObjPlatformGTBlockInfo.
*/
STATIC CONST CM_OBJ_PARSER CmArmGTBlockTimerFrameInfoParser[] = {
{"FrameNumber", 1, "0x%x", NULL},
{"PhysicalAddressCntBase", 8, "0x%llx", NULL},
{"PhysicalAddressCntEL0Base", 8, "0x%llx", NULL},
{"PhysicalTimerGSIV", 4, "0x%x", NULL},
{"PhysicalTimerFlags", 4, "0x%x", NULL},
{"VirtualTimerGSIV", 4, "0x%x", NULL},
{"VirtualTimerFlags", 4, "0x%x", NULL},
{"CommonFlags", 4, "0x%x", NULL}
};
/** A parser for EArmObjGTBlockTimerFrameInfo.
*/
STATIC CONST CM_OBJ_PARSER CmArmGTBlockInfoParser[] = {
{"GTBlockPhysicalAddress", 8, "0x%llx", NULL},
{"GTBlockTimerFrameCount", 4, "0x%x", NULL},
{"GTBlockTimerFrameToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL}
};
/** A parser for EArmObjPlatformGenericWatchdogInfo.
*/
STATIC CONST CM_OBJ_PARSER CmArmGenericWatchdogInfoParser[] = {
{"ControlFrameAddress", 8, "0x%llx", NULL},
{"RefreshFrameAddress", 8, "0x%llx", NULL},
{"TimerGSIV", 4, "0x%x", NULL},
{"Flags", 4, "0x%x", NULL}
};
/** A parser for EArmObjPciConfigSpaceInfo.
*/
STATIC CONST CM_OBJ_PARSER CmArmPciConfigSpaceInfoParser[] = {
{"BaseAddress", 8, "0x%llx", NULL},
{"PciSegmentGroupNumber", 2, "0x%x", NULL},
{"StartBusNumber", 1, "0x%x", NULL},
{"EndBusNumber", 1, "0x%x", NULL}
};
/** A parser for EArmObjHypervisorVendorIdentity.
*/
STATIC CONST CM_OBJ_PARSER CmArmHypervisorVendorIdParser[] = {
{"HypervisorVendorId", 8, "0x%llx", NULL}
};
/** A parser for EArmObjFixedFeatureFlags.
*/
STATIC CONST CM_OBJ_PARSER CmArmFixedFeatureFlagsParser[] = {
{"Flags", 4, "0x%x", NULL}
};
/** A parser for EArmObjItsGroup.
*/
STATIC CONST CM_OBJ_PARSER CmArmItsGroupNodeParser[] = {
{"Token", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL},
{"ItsIdCount", 4, "0x%x", NULL},
{"ItsIdToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL}
};
/** A parser for EArmObjNamedComponent.
*/
STATIC CONST CM_OBJ_PARSER CmArmNamedComponentNodeParser[] = {
{"Token", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL},
{"IdMappingCount", 4, "0x%x", NULL},
{"IdMappingToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL},
{"Flags", 4, "0x%x", NULL},
{"CacheCoherent", 4, "0x%x", NULL},
{"AllocationHints", 1, "0x%x", NULL},
{"MemoryAccessFlags", 1, "0x%x", NULL},
{"AddressSizeLimit", 1, "0x%x", NULL},
{"ObjectName", sizeof (CHAR8*), "%a", NULL}
};
/** A parser for EArmObjRootComplex.
*/
STATIC CONST CM_OBJ_PARSER CmArmRootComplexNodeParser[] = {
{"Token", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL},
{"IdMappingCount", 4, "0x%x", NULL},
{"IdMappingToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL},
{"CacheCoherent", 4, "0x%x", NULL},
{"AllocationHints", 1, "0x%x", NULL},
{"MemoryAccessFlags", 1, "0x%x", NULL},
{"AtsAttribute", 4, "0x%x", NULL},
{"PciSegmentNumber", 4, "0x%x", NULL},
{"MemoryAddressSize", 1, "0x%x", NULL}
};
/** A parser for EArmObjSmmuV1SmmuV2.
*/
STATIC CONST CM_OBJ_PARSER CmArmSmmuV1SmmuV2NodeParser[] = {
{"Token", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL},
{"IdMappingCount", 4, "0x%x", NULL},
{"IdMappingToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL},
{"BaseAddress", 8, "0x%llx", NULL},
{"Span", 8, "0x%llx", NULL},
{"Model", 4, "0x%x", NULL},
{"Flags", 4, "0x%x", NULL},
{"ContextInterruptCount", 4, "0x%x", NULL},
{"ContextInterruptToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL},
{"PmuInterruptCount", 4, "0x%x", NULL},
{"PmuInterruptToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL},
{"SMMU_NSgIrpt", 4, "0x%x", NULL},
{"SMMU_NSgIrptFlags", 4, "0x%x", NULL},
{"SMMU_NSgCfgIrpt", 4, "0x%x", NULL},
{"SMMU_NSgCfgIrptFlags", 4, "0x%x", NULL}
};
/** A parser for EArmObjSmmuV3.
*/
STATIC CONST CM_OBJ_PARSER CmArmSmmuV3NodeParser[] = {
{"Token", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL},
{"IdMappingCount", 4, "0x%x", NULL},
{"IdMappingToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL},
{"BaseAddress", 8, "0x%llx", NULL},
{"Flags", 4, "0x%x", NULL},
{"VatosAddress", 8, "0x%llx", NULL},
{"Model", 4, "0x%x", NULL},
{"EventInterrupt", 4, "0x%x", NULL},
{"PriInterrupt", 4, "0x%x", NULL},
{"GerrInterrupt", 4, "0x%x", NULL},
{"SyncInterrupt", 4, "0x%x", NULL},
{"ProximityDomain", 4, "0x%x", NULL},
{"DeviceIdMappingIndex", 4, "0x%x", NULL}
};
/** A parser for EArmObjPmcg.
*/
STATIC CONST CM_OBJ_PARSER CmArmPmcgNodeParser[] = {
{"Token", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL},
{"IdMappingCount", 4, "0x%x", NULL},
{"IdMappingToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL},
{"BaseAddress", 8, "0x%llx", NULL},
{"OverflowInterrupt", 4, "0x%x", NULL},
{"Page1BaseAddress", 8, "0x%llx", NULL},
{"ReferenceToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL}
};
/** A parser for EArmObjGicItsIdentifierArray.
*/
STATIC CONST CM_OBJ_PARSER CmArmGicItsIdentifierParser[] = {
{"ItsId", 4, "0x%x", NULL}
};
/** A parser for EArmObjIdMappingArray.
*/
STATIC CONST CM_OBJ_PARSER CmArmIdMappingParser[] = {
{"InputBase", 4, "0x%x", NULL},
{"NumIds", 4, "0x%x", NULL},
{"OutputBase", 4, "0x%x", NULL},
{"OutputReferenceToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL},
{"Flags", 4, "0x%x", NULL}
};
/** A parser for EArmObjSmmuInterruptArray.
*/
STATIC CONST CM_OBJ_PARSER CmArmGenericInterruptParser[] = {
{"Interrupt", 4, "0x%x", NULL},
{"Flags", 4, "0x%x", NULL}
};
/** A parser for EArmObjProcHierarchyInfo.
*/
STATIC CONST CM_OBJ_PARSER CmArmProcHierarchyInfoParser[] = {
{"Token", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL},
{"Flags", 4, "0x%x", NULL},
{"ParentToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL},
{"GicCToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL},
{"NoOfPrivateResources", 4, "0x%x", NULL},
{"PrivateResourcesArrayToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL}
};
/** A parser for EArmObjCacheInfo.
*/
STATIC CONST CM_OBJ_PARSER CmArmCacheInfoParser[] = {
{"Token", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL},
{"NextLevelOfCacheToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL},
{"Size", 4, "0x%x", NULL},
{"NumberOfSets", 4, "0x%x", NULL},
{"Associativity", 4, "0x%x", NULL},
{"Attributes", 1, "0x%x", NULL},
{"LineSize", 2, "0x%x", NULL}
};
/** A parser for EArmObjProcNodeIdInfo.
*/
STATIC CONST CM_OBJ_PARSER CmArmProcNodeIdInfoParser[] = {
{"Token", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL},
{"VendorId", 4, "0x%p", NULL},
{"Level1Id", 8, "0x%x", NULL},
{"Level2Id", 8, "0x%x", NULL},
{"MajorRev", 2, "0x%x", NULL},
{"MinorRev", 2, "0x%x", NULL},
{"SpinRev", 2, "0x%x", NULL}
};
/** A parser for EArmObjCmRef.
*/
STATIC CONST CM_OBJ_PARSER CmArmObjRefParser[] = {
{"ReferenceToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL}
};
/** A parser for EArmObjMemoryAffinityInfo.
*/
STATIC CONST CM_OBJ_PARSER CmArmMemoryAffinityInfoParser[] = {
{"ProximityDomain", 4, "0x%x", NULL},
{"BaseAddress", 8, "0x%llx", NULL},
{"Length", 8, "0x%llx", NULL},
{"Flags", 4, "0x%x", NULL}
};
/** A parser for EArmObjDeviceHandleAcpi.
*/
STATIC CONST CM_OBJ_PARSER CmArmDeviceHandleAcpiParser[] = {
{"Hid", 8, "0x%llx", NULL},
{"Uid", 4, "0x%x", NULL}
};
/** A parser for EArmObjDeviceHandlePci.
*/
STATIC CONST CM_OBJ_PARSER CmArmDeviceHandlePciParser[] = {
{"SegmentNumber", 2, "0x%x", NULL},
{"BusNumber", 1, "0x%x", NULL},
{"DeviceNumber", 1, "0x%x", NULL},
{"FunctionNumber", 1, "0x%x", NULL}
};
/** A parser for EArmObjGenericInitiatorAffinityInfo.
*/
STATIC CONST CM_OBJ_PARSER CmArmGenericInitiatorAffinityInfoParser[] = {
{"ProximityDomain", 4, "0x%x", NULL},
{"Flags", 4, "0x%x", NULL},
{"DeviceHandleType", 1, "0x%x", NULL},
{"DeviceHandleToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL}
};
/** A parser for EArmObjCmn600Info.
*/
STATIC CONST CM_OBJ_PARSER CmArmCmn600InfoParser[] = {
{"PeriphBaseAddress", 8, "0x%llx", NULL},
{"PeriphBaseAddressLength", 8, "0x%llx", NULL},
{"RootNodeBaseAddress", 8, "0x%llx", NULL},
{"DtcCount", 1, "0x%x", NULL},
{"DtcInterrupt[0]", 4, "0x%x", NULL},
{"DtcFlags[0]", 4, "0x%x", NULL},
{"DtcInterrupt[1]", 4, "0x%x", NULL},
{"DtcFlags[1]", 4, "0x%x", NULL},
{"DtcInterrupt[2]", 4, "0x%x", NULL},
{"DtcFlags[2]", 4, "0x%x", NULL},
{"DtcInterrupt[3]", 4, "0x%x", NULL},
{"DtcFlags[3]", 4, "0x%x", NULL}
};
/** A parser for the EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE structure.
*/
STATIC CONST CM_OBJ_PARSER AcpiGenericAddressParser[] = {
{"AddressSpaceId", 1, "%d", NULL},
{"RegisterBitWidth", 1, "%d", NULL},
{"RegisterBitOffset", 1, "%d", NULL},
{"AccessSize", 1, "%d", NULL},
{"Address", 8, "0x%llx", NULL},
};
/** A parser for EArmObjLpiInfo.
*/
STATIC CONST CM_OBJ_PARSER CmArmLpiInfoParser[] = {
{"MinResidency", 4, "0x%llx", NULL},
{"WorstCaseWakeLatency", 4, "0x%llx", NULL},
{"Flags", 4, "0x%llx", NULL},
{"ArchFlags", 4, "0x%llx", NULL},
{"ResCntFreq", 4, "0x%llx", NULL},
{"EnableParentState", 4, "0x%llx", NULL},
{"IsInteger", 1, "%d", NULL},
{"IntegerEntryMethod", 8, "0x%llx", NULL},
{"RegisterEntryMethod", sizeof (EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE),
NULL, NULL, AcpiGenericAddressParser,
ARRAY_SIZE (AcpiGenericAddressParser)},
{"ResidencyCounterRegister", sizeof (EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE),
NULL, NULL, AcpiGenericAddressParser,
ARRAY_SIZE (AcpiGenericAddressParser)},
{"UsageCounterRegister", sizeof (EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE),
NULL, NULL, AcpiGenericAddressParser,
ARRAY_SIZE (AcpiGenericAddressParser)},
{"StateName", 16, "0x%a", NULL},
};
/** A parser for Arm namespace objects.
*/
STATIC CONST CM_OBJ_PARSER_ARRAY ArmNamespaceObjectParser[] = {
{"EArmObjReserved", NULL, 0},
{"EArmObjBootArchInfo", CmArmBootArchInfoParser,
ARRAY_SIZE (CmArmBootArchInfoParser)},
{"EArmObjCpuInfo", NULL, 0},
{"EArmObjPowerManagementProfileInfo", CmArmPowerManagementProfileInfoParser,
ARRAY_SIZE (CmArmPowerManagementProfileInfoParser)},
{"EArmObjGicCInfo", CmArmGicCInfoParser, ARRAY_SIZE (CmArmGicCInfoParser)},
{"EArmObjGicDInfo", CmArmGicDInfoParser, ARRAY_SIZE (CmArmGicDInfoParser)},
{"EArmObjGicMsiFrameInfo", CmArmGicMsiFrameInfoParser,
ARRAY_SIZE (CmArmGicMsiFrameInfoParser)},
{"EArmObjGicRedistributorInfo", CmArmGicRedistInfoParser,
ARRAY_SIZE (CmArmGicRedistInfoParser)},
{"EArmObjGicItsInfo", CmArmGicItsInfoParser,
ARRAY_SIZE (CmArmGicItsInfoParser)},
{"EArmObjSerialConsolePortInfo", CmArmSerialPortInfoParser,
ARRAY_SIZE (CmArmSerialPortInfoParser)},
{"EArmObjSerialDebugPortInfo", CmArmSerialPortInfoParser,
ARRAY_SIZE (CmArmSerialPortInfoParser)},
{"EArmObjGenericTimerInfo", CmArmGenericTimerInfoParser,
ARRAY_SIZE (CmArmGenericTimerInfoParser)},
{"EArmObjPlatformGTBlockInfo", CmArmGTBlockTimerFrameInfoParser,
ARRAY_SIZE (CmArmGTBlockTimerFrameInfoParser)},
{"EArmObjGTBlockTimerFrameInfo", CmArmGTBlockInfoParser,
ARRAY_SIZE (CmArmGTBlockInfoParser)},
{"EArmObjPlatformGenericWatchdogInfo", CmArmGenericWatchdogInfoParser,
ARRAY_SIZE (CmArmGenericWatchdogInfoParser)},
{"EArmObjPciConfigSpaceInfo", CmArmPciConfigSpaceInfoParser,
ARRAY_SIZE (CmArmPciConfigSpaceInfoParser)},
{"EArmObjHypervisorVendorIdentity", CmArmHypervisorVendorIdParser,
ARRAY_SIZE (CmArmHypervisorVendorIdParser)},
{"EArmObjFixedFeatureFlags", CmArmFixedFeatureFlagsParser,
ARRAY_SIZE (CmArmFixedFeatureFlagsParser)},
{"EArmObjItsGroup", CmArmItsGroupNodeParser,
ARRAY_SIZE (CmArmItsGroupNodeParser)},
{"EArmObjNamedComponent", CmArmNamedComponentNodeParser,
ARRAY_SIZE (CmArmNamedComponentNodeParser)},
{"EArmObjRootComplex", CmArmRootComplexNodeParser,
ARRAY_SIZE (CmArmRootComplexNodeParser)},
{"EArmObjSmmuV1SmmuV2", CmArmSmmuV1SmmuV2NodeParser,
ARRAY_SIZE (CmArmSmmuV1SmmuV2NodeParser)},
{"EArmObjSmmuV3", CmArmSmmuV3NodeParser,
ARRAY_SIZE (CmArmSmmuV3NodeParser)},
{"EArmObjPmcg", CmArmPmcgNodeParser, ARRAY_SIZE (CmArmPmcgNodeParser)},
{"EArmObjGicItsIdentifierArray", CmArmGicItsIdentifierParser,
ARRAY_SIZE (CmArmGicItsIdentifierParser)},
{"EArmObjIdMappingArray", CmArmIdMappingParser,
ARRAY_SIZE (CmArmIdMappingParser)},
{"EArmObjSmmuInterruptArray", CmArmGenericInterruptParser,
ARRAY_SIZE (CmArmGenericInterruptParser)},
{"EArmObjProcHierarchyInfo", CmArmProcHierarchyInfoParser,
ARRAY_SIZE (CmArmProcHierarchyInfoParser)},
{"EArmObjCacheInfo", CmArmCacheInfoParser,
ARRAY_SIZE (CmArmCacheInfoParser)},
{"EArmObjProcNodeIdInfo", CmArmProcNodeIdInfoParser,
ARRAY_SIZE (CmArmProcNodeIdInfoParser)},
{"EArmObjCmRef", CmArmObjRefParser, ARRAY_SIZE (CmArmObjRefParser)},
{"EArmObjMemoryAffinityInfo", CmArmMemoryAffinityInfoParser,
ARRAY_SIZE (CmArmMemoryAffinityInfoParser)},
{"EArmObjDeviceHandleAcpi", CmArmDeviceHandleAcpiParser,
ARRAY_SIZE (CmArmDeviceHandleAcpiParser)},
{"EArmObjDeviceHandlePci", CmArmDeviceHandlePciParser,
ARRAY_SIZE (CmArmDeviceHandlePciParser)},
{"EArmObjGenericInitiatorAffinityInfo",
CmArmGenericInitiatorAffinityInfoParser,
ARRAY_SIZE (CmArmGenericInitiatorAffinityInfoParser)},
{"EArmObjSerialPortInfo", CmArmSerialPortInfoParser,
ARRAY_SIZE (CmArmSerialPortInfoParser)},
{"EArmObjCmn600Info", CmArmCmn600InfoParser,
ARRAY_SIZE (CmArmCmn600InfoParser)},
{"EArmObjLpiInfo", CmArmLpiInfoParser,
ARRAY_SIZE (CmArmLpiInfoParser)},
{"EArmObjMax", NULL, 0},
};
/** A parser for EStdObjCfgMgrInfo.
*/
STATIC CONST CM_OBJ_PARSER StdObjCfgMgrInfoParser[] = {
{"Revision", 4, "0x%x", NULL},
{"OemId[6]", 6, "%C%C%C%C%C%C", PrintOemId}
};
/** A parser for EStdObjAcpiTableList.
*/
STATIC CONST CM_OBJ_PARSER StdObjAcpiTableInfoParser[] = {
{"AcpiTableSignature", 4, "0x%x", NULL},
{"AcpiTableRevision", 1, "%d", NULL},
{"TableGeneratorId", sizeof (ACPI_TABLE_GENERATOR_ID), "0x%x", NULL},
{"AcpiTableData", sizeof (EFI_ACPI_DESCRIPTION_HEADER*), "0x%p", NULL},
{"OemTableId", 8, "0x%LLX", NULL},
{"OemRevision", 4, "0x%x", NULL}
};
/** A parser for EStdObjSmbiosTableList.
*/
STATIC CONST CM_OBJ_PARSER StdObjSmbiosTableInfoParser[] = {
{"TableGeneratorId", sizeof (SMBIOS_TABLE_GENERATOR_ID), "0x%x", NULL},
{"SmbiosTableData", sizeof (SMBIOS_STRUCTURE*), "0x%p", NULL}
};
/** A parser for Standard namespace objects.
*/
STATIC CONST CM_OBJ_PARSER_ARRAY StdNamespaceObjectParser[] = {
{"EStdObjCfgMgrInfo", StdObjCfgMgrInfoParser,
ARRAY_SIZE (StdObjCfgMgrInfoParser)},
{"EStdObjAcpiTableList", StdObjAcpiTableInfoParser,
ARRAY_SIZE (StdObjAcpiTableInfoParser)},
{"EStdObjSmbiosTableList", StdObjSmbiosTableInfoParser,
ARRAY_SIZE (StdObjSmbiosTableInfoParser)},
};
/** Print OEM Id.
@param [in] Format Format to print the Ptr.
@param [in] Ptr Pointer to the OEM Id.
**/
STATIC
VOID
EFIAPI
PrintOemId (
IN CONST CHAR8 * Format,
IN UINT8 * Ptr
)
{
DEBUG ((
DEBUG_ERROR,
(Format != NULL) ? Format : "%C%C%C%C%C%C",
Ptr[0],
Ptr[1],
Ptr[2],
Ptr[3],
Ptr[4],
Ptr[5]
));
}
/** Print fields of the objects.
@param [in] Data Pointer to the object to print.
@param [in] Parser Parser containing the object fields.
@param [in] ItemCount Number of entries/fields in the Parser.
@param [in] RemainingSize Parse at most *RemainingSize bytes.
This function decrements the value
from the number bytes consumed.
@param [in] IndentLevel Indentation to use when printing.
**/
STATIC
VOID
PrintCmObjDesc (
IN VOID *Data,
IN CONST CM_OBJ_PARSER *Parser,
IN UINTN ItemCount,
IN INTN *RemainingSize,
IN UINT32 IndentLevel
)
{
UINT32 Index;
UINT32 IndentIndex;
INTN SubStructSize;
if ((Data == NULL) ||
(Parser == NULL) ||
(ItemCount == 0) ||
(RemainingSize == NULL)) {
ASSERT (0);
return;
}
// Print each field.
for (Index = 0; Index < ItemCount; Index++) {
// Check there is enough space in left.
*RemainingSize -= Parser[Index].Length;
if (*RemainingSize < 0) {
DEBUG ((
DEBUG_ERROR,
"\nERROR: %a: Buffer overrun\n",
Parser[Index].NameStr
));
ASSERT (0);
return;
}
// Indentation
for (IndentIndex = 0; IndentIndex < IndentLevel; IndentIndex++) {
DEBUG ((DEBUG_ERROR, " "));
}
DEBUG ((
DEBUG_ERROR,
"%-*a :",
OUTPUT_FIELD_COLUMN_WIDTH - 2 * IndentLevel,
Parser[Index].NameStr
));
if (Parser[Index].PrintFormatter != NULL) {
Parser[Index].PrintFormatter (Parser[Index].Format, Data);
} else if (Parser[Index].Format != NULL) {
switch (Parser[Index].Length) {
case 1:
DEBUG ((DEBUG_ERROR, Parser[Index].Format, *(UINT8*)Data));
break;
case 2:
DEBUG ((DEBUG_ERROR, Parser[Index].Format, *(UINT16*)Data));
break;
case 4:
DEBUG ((DEBUG_ERROR, Parser[Index].Format, *(UINT32*)Data));
break;
case 8:
DEBUG ((DEBUG_ERROR, Parser[Index].Format, ReadUnaligned64(Data)));
break;
default:
DEBUG ((
DEBUG_ERROR,
"\nERROR: %a: CANNOT PARSE THIS FIELD, Field Length = %d\n",
Parser[Index].NameStr,
Parser[Index].Length
));
} // switch
} else if (Parser[Index].SubObjParser != NULL) {
SubStructSize = Parser[Index].Length;
DEBUG ((DEBUG_ERROR, "\n"));
PrintCmObjDesc (
Data,
Parser[Index].SubObjParser,
Parser[Index].SubObjItemCount,
&SubStructSize,
IndentLevel + 1
);
} else {
ASSERT (0);
DEBUG ((
DEBUG_ERROR,
"\nERROR: %a: CANNOT PARSE THIS FIELD, Field Length = %d\n",
Parser[Index].NameStr,
Parser[Index].Length
));
}
DEBUG ((DEBUG_ERROR, "\n"));
Data = (UINT8*)Data + Parser[Index].Length;
} // for
}
/** Parse and print a CmObjDesc.
@param [in] CmObjDesc The CmObjDesc to parse and print.
**/
VOID
EFIAPI
ParseCmObjDesc (
IN CONST CM_OBJ_DESCRIPTOR * CmObjDesc
)
{
UINTN ObjId;
UINTN NameSpaceId;
UINT32 ObjIndex;
UINT32 ObjectCount;
INTN RemainingSize;
CONST CM_OBJ_PARSER_ARRAY * ParserArray;
if ((CmObjDesc == NULL) || (CmObjDesc->Data == NULL)) {
return;
}
NameSpaceId = GET_CM_NAMESPACE_ID (CmObjDesc->ObjectId);
ObjId = GET_CM_OBJECT_ID (CmObjDesc->ObjectId);
switch (NameSpaceId) {
case EObjNameSpaceStandard:
if (ObjId >= EStdObjMax) {
ASSERT (0);
return;
}
ParserArray = &StdNamespaceObjectParser[ObjId];
break;
case EObjNameSpaceArm:
if (ObjId >= EArmObjMax) {
ASSERT (0);
return;
}
ParserArray = &ArmNamespaceObjectParser[ObjId];
break;
default:
// Not supported
ASSERT (0);
return;
} // switch
ObjectCount = CmObjDesc->Count;
RemainingSize = CmObjDesc->Size;
for (ObjIndex = 0; ObjIndex < ObjectCount; ObjIndex++) {
DEBUG ((
DEBUG_ERROR,
"\n%-*a [%d/%d]:\n",
OUTPUT_FIELD_COLUMN_WIDTH,
ParserArray->ObjectName,
ObjIndex + 1,
ObjectCount
));
PrintCmObjDesc (
CmObjDesc->Data,
ParserArray->Parser,
ParserArray->ItemCount,
&RemainingSize,
1
);
} // for
}

View File

@ -0,0 +1,73 @@
/** @file
Configuration Manager Object parser.
Copyright (c) 2021, ARM Limited. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef CONFIGURATION_MANAGER_OBJECT_PARSER_H_
#define CONFIGURATION_MANAGER_OBJECT_PARSER_H_
#define OUTPUT_FIELD_COLUMN_WIDTH 32
/** Function prototype to format a field print.
@param [in] Format Format string for tracing the data as specified by
the 'Format' member of ACPI_PARSER.
@param [in] Ptr Pointer to the start of the buffer.
**/
typedef VOID (EFIAPI *FNPTR_PRINT_FORMATTER)(CONST CHAR8* Format, UINT8* Ptr);
/**
The CM_OBJ_PARSER structure describes the fields of an CmObject and
provides means for the parser to interpret and trace appropriately.
ParseAcpi() uses the format string specified by 'Format' for tracing
the field data.
*/
typedef struct CmObjParser CM_OBJ_PARSER;
struct CmObjParser {
/// String describing the Cm Object
CONST CHAR8* NameStr;
/// The length of the field.
UINT32 Length;
/// Optional Print() style format string for tracing the data. If not
/// used this must be set to NULL.
CONST CHAR8* Format;
/// Optional pointer to a print formatter function which
/// is typically used to trace complex field information.
/// If not used this must be set to NULL.
/// The Format string is passed to the PrintFormatter function
/// but may be ignored by the implementation code.
FNPTR_PRINT_FORMATTER PrintFormatter;
/// Optional pointer to print the fields of another CM_OBJ_PARSER
/// structure. This is useful to print sub-structures.
CONST CM_OBJ_PARSER *SubObjParser;
/// Count of items in the SubObj.
UINTN SubObjItemCount;
};
/**
A structure mapping an array of Configuration Manager Object parsers
with their object names.
*/
typedef struct CmObjParserArray {
/// Object name
CONST CHAR8 * ObjectName;
/// Function pointer to the parser
CONST CM_OBJ_PARSER * Parser;
/// Count of items
UINTN ItemCount;
} CM_OBJ_PARSER_ARRAY;
#endif // CONFIGURATION_MANAGER_OBJECT_PARSER_H_

View File

@ -122,11 +122,13 @@ AddAcpiHeader (
ASSERT (CfgMgrProtocol != NULL);
ASSERT (Generator != NULL);
ASSERT (AcpiHeader != NULL);
ASSERT (AcpiTableInfo != NULL);
ASSERT (Length >= sizeof (EFI_ACPI_DESCRIPTION_HEADER));
if ((CfgMgrProtocol == NULL) ||
(Generator == NULL) ||
(AcpiHeader == NULL) ||
(AcpiTableInfo == NULL) ||
(Length < sizeof (EFI_ACPI_DESCRIPTION_HEADER))
) {
return EFI_INVALID_PARAMETER;
@ -183,6 +185,93 @@ error_handler:
return Status;
}
/** Build a RootNode containing SSDT ACPI header information using the AmlLib.
The function utilizes the ACPI table Generator and the Configuration
Manager protocol to obtain any information required for constructing the
header. It then creates a RootNode. The SSDT ACPI header is part of the
RootNode.
This is essentially a wrapper around AmlCodeGenDefinitionBlock ()
from the AmlLib.
@param [in] CfgMgrProtocol Pointer to the Configuration Manager
protocol interface.
@param [in] Generator Pointer to the ACPI table Generator.
@param [in] AcpiTableInfo Pointer to the ACPI table info structure.
@param [out] RootNode If success, contains the created RootNode.
The SSDT ACPI header is part of the RootNode.
@retval EFI_SUCCESS Success.
@retval EFI_INVALID_PARAMETER A parameter is invalid.
@retval EFI_NOT_FOUND The required object information is not found.
@retval EFI_BAD_BUFFER_SIZE The size returned by the Configuration
Manager is less than the Object size for the
requested object.
**/
EFI_STATUS
EFIAPI
AddSsdtAcpiHeader (
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol,
IN CONST ACPI_TABLE_GENERATOR * CONST Generator,
IN CONST CM_STD_OBJ_ACPI_TABLE_INFO * CONST AcpiTableInfo,
OUT AML_ROOT_NODE_HANDLE * RootNode
)
{
EFI_STATUS Status;
UINT64 OemTableId;
UINT32 OemRevision;
CM_STD_OBJ_CONFIGURATION_MANAGER_INFO * CfgMfrInfo;
ASSERT (CfgMgrProtocol != NULL);
ASSERT (Generator != NULL);
ASSERT (AcpiTableInfo != NULL);
if ((CfgMgrProtocol == NULL) ||
(Generator == NULL) ||
(AcpiTableInfo == NULL)) {
return EFI_INVALID_PARAMETER;
}
Status = GetCgfMgrInfo (CfgMgrProtocol, &CfgMfrInfo);
if (EFI_ERROR (Status)) {
DEBUG ((
DEBUG_ERROR,
"ERROR: Failed to get Configuration Manager info. Status = %r\n",
Status
));
return Status;
}
if (AcpiTableInfo->OemTableId != 0) {
OemTableId = AcpiTableInfo->OemTableId;
} else {
OemTableId = SIGNATURE_32 (
CfgMfrInfo->OemId[0],
CfgMfrInfo->OemId[1],
CfgMfrInfo->OemId[2],
CfgMfrInfo->OemId[3]
) |
((UINT64)Generator->AcpiTableSignature << 32);
}
if (AcpiTableInfo->OemRevision != 0) {
OemRevision = AcpiTableInfo->OemRevision;
} else {
OemRevision = CfgMfrInfo->Revision;
}
Status = AmlCodeGenDefinitionBlock (
"SSDT",
(CONST CHAR8*)&CfgMfrInfo->OemId,
(CONST CHAR8*)&OemTableId,
OemRevision,
RootNode
);
ASSERT_EFI_ERROR (Status);
return Status;
}
/**
Test and report if a duplicate entry exists in the given array of comparable
elements.
@ -245,99 +334,3 @@ FindDuplicateValue (
}
return FALSE;
}
/** Convert a hex number to its ASCII code.
@param [in] x Hex number to convert.
Must be 0 <= x < 16.
@return The ASCII code corresponding to x.
**/
UINT8
EFIAPI
AsciiFromHex (
IN UINT8 x
)
{
if (x < 10) {
return (UINT8)(x + '0');
}
if (x < 16) {
return (UINT8)(x - 10 + 'A');
}
ASSERT (FALSE);
return (UINT8)0;
}
/** Check if a HID is a valid PNP ID.
@param [in] Hid The Hid to validate.
@retval TRUE The Hid is a valid PNP ID.
@retval FALSE The Hid is not a valid PNP ID.
**/
BOOLEAN
IsValidPnpId (
IN CONST CHAR8 * Hid
)
{
UINTN Index;
if (AsciiStrLen (Hid) != 7) {
return FALSE;
}
// A valid PNP ID must be of the form "AAA####"
// where A is an uppercase letter and # is a hex digit.
for (Index = 0; Index < 3; Index++) {
if (!IS_UPPER_CHAR (Hid[Index])) {
return FALSE;
}
}
for (Index = 3; Index < 7; Index++) {
if (!IS_UPPER_HEX (Hid[Index])) {
return FALSE;
}
}
return TRUE;
}
/** Check if a HID is a valid ACPI ID.
@param [in] Hid The Hid to validate.
@retval TRUE The Hid is a valid ACPI ID.
@retval FALSE The Hid is not a valid ACPI ID.
**/
BOOLEAN
IsValidAcpiId (
IN CONST CHAR8 * Hid
)
{
UINTN Index;
if (AsciiStrLen (Hid) != 8) {
return FALSE;
}
// A valid ACPI ID must be of the form "NNNN####"
// where N is an uppercase letter or a digit ('0'-'9')
// and # is a hex digit.
for (Index = 0; Index < 4; Index++) {
if (!(IS_UPPER_CHAR (Hid[Index]) || IS_DIGIT (Hid[Index]))) {
return FALSE;
}
}
for (Index = 4; Index < 8; Index++) {
if (!IS_UPPER_HEX (Hid[Index])) {
return FALSE;
}
}
return TRUE;
}

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