Compare commits

...

25 Commits

Author SHA1 Message Date
Stewart, Chris (SW Architect) via groups.io
7b4a99be8a CryptoPkg: BaseCryptLib fix incorrect param order
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3550

Function ConvertAsn1TimeToEfiTime initializes timestamp to zeroes with
SetMem, but the actual parameters are out of order. The result is
the SetMem operation has no effect. The fix is to put the actual
parameters in the correct order.

Signed-off-by: Chris Stewart <chris.stewart@hp.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com>
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>
2021-08-24 00:35:06 +00:00
Jason
8dd4fc5be6 UefiCpuPkg/CpuCacheInfoLib: Correct logical for identifying cache type
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3265

Correct the logical for identifying "Direct mapped" cache type.

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-08-23 07:49:17 +00:00
Jeremy Linton
ef56f55d19 EmbeddedPkg/NonCoherentDmaLib: Avoid dereferencing unset Map field
Map->Operation is used to select whether a DMA region that
is being bounced has the source buffer copied to it. Except
Map->Operation isn't yet set, so the behavior is somewhat
random. Instead use the passed in Operation parameter.

Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
2021-08-17 14:01:19 +00:00
Yeh, GregX
6fdd1c13a7 MdeModulePkg PCD: Reinstall PCD service PPIS when memory available
https://bugzilla.tianocore.org/show_bug.cgi?id=3525

After PciSegmentLib using Dynamic PCD for Pcie base address such
long delay found in FSP. The root cause is some of the PCD service
PPIs not shadowed to memory and flash cache may have been disabled
in NotifyPhase stage. Solution is to shadow all PCD service PPIs
to memory.

Signed-off-by: GregX Yeh <gregx.yeh@intel.com>
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>
Reviewed-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Jian J Wang <jian.j.wang@intel.com>
2021-08-13 01:44:41 +00:00
Wenyi Xie
ac826886c9 MdeModulePkg/UefiSortLib:Add UefiSortLib unit test
Adding two unit test case for UefiSortLib. One is a test on
sorting an array of UINT32 by using PerformQuickSort, another
is a test on comparing the same buffer by using StringCompare.
Add 'main' function name to ECC exception list to avoid ECC
error.

Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Signed-off-by: Wenyi Xie <xiewenyi2@huawei.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
2021-08-12 08:34:04 +00:00
Etienne Carriere
a776bbabd9 StandaloneMmPkg: build for 32bit arm machines
This change allows to build StandaloneMmPkg components for 32bit Arm
StandaloneMm firmware.

This change mainly moves AArch64/ source files to Arm/ side directory
for several components:  StandaloneMmCpu, StandaloneMmCoreEntryPoint
and StandaloneMmMemLib. The source file is built for both 32b and 64b
Arm targets.

Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
2021-08-11 11:32:32 +00:00
Etienne Carriere
b7f0226a46 StandaloneMmPkg: fix pointer/int casts against 32bit architectures
Use intermediate (UINTN) cast when casting int from/to pointer. This
is needed as UINT64 values cast from/to 32bit pointer for 32bit
architectures.

Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
Acked-by: Jiewen Yao <Jiewen.yao@intel.com>
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
2021-08-11 11:32:32 +00:00
Etienne Carriere
ca1773878d GenFv: Arm: support images entered in Thumb mode
Change GenFv for Arm architecture to generate a specific jump
instruction as image entry instruction, when the target entry label
is assembled with Thumb instruction set. This is possible since
SecCoreEntryAddress value fetched from the PE32 has its LSBit set when
the entry instruction executes in Thumb mode.

Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
Acked-by: Liming Gao <gaoliming@byosoft.com.cn>
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
2021-08-11 11:32:32 +00:00
Etienne Carriere
aee0098faf ArmPkg: prepare 32bit ARM build of StandaloneMmPkg
Changes in ArmPkg to prepare building StandaloneMm firmware for
32bit Arm architectures.

Adds ArmmmuStandaloneMmLib library to the list of the standard
components build for ArmPkg on when ARM architectures.

Changes path of source file AArch64/ArmMmuStandaloneMmLib.c
and compile it for both 32bit and 64bit architectures.

Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
2021-08-11 11:32:32 +00:00
Etienne Carriere
03e19e6bc8 ArmPkg/IndustryStandard: 32b/64b agnostic FF-A, Mm SVC and Std SMC IDs
Defines ARM_SVC_ID_FFA_* and ARM_SVC_ID_SP_* identifiers for 32bit
function IDs as per SMCCC specification. Defines also generic ARM
SVC identifier macros to wrap 32bit or 64bit identifiers upon target
built architecture.

Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
2021-08-11 11:32:32 +00:00
Abner Chang
7311e96417 RedfishPkg/RefishCrtLib: Public RefishCrtLib
Public the header file, move RefishCrtLib.h from PrivateInclude/
to Include/.
RefishCrtLib.lib will be public later. (Moved out from PrivateLibrary/)

Signed-off-by: Abner Chang <abner.chang@hpe.com>
Cc: Nickle Wang <nickle.wang@hpe.com>
Reviewed-by: Nickle Wang <nickle.wang@hpe.com>
2021-08-11 05:03:31 +00:00
Chris Jones
3d359ff905 MdePkg: Fix broken coding style in Acpi64.h
Bugzilla: 3516 (https://bugzilla.tianocore.org/show_bug.cgi?id=3516)

Fix a coding style issue raised by EccCheck. This issue (error code
7008) has been fixed by moving a nested union out of its structure.

Also add Acpi64.h to the "IgnoreFiles" list to stop the CI flagging
naming errors present prior to ACPI 64.

Signed-off-by: Chris Jones <christopher.jones@arm.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
2021-08-11 01:53:28 +00:00
Chris Jones
605c4a1ff2 MdePkg: Add Cache ID to PPTT
Bugzilla: 3516 (https://bugzilla.tianocore.org/show_bug.cgi?id=3516)

Make changes to ACPI 6.4 header according to the latest specification:
- ACPI 6.4 January 2021, Table 5.137, Table 5.140, Table 5.141
- Mantis ID 2138 (https://mantis.uefi.org/mantis/view.php?id=2138)

Signed-off-by: Chris Jones <christopher.jones@arm.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
2021-08-11 01:53:28 +00:00
Chris Jones
1803757a9b MdePkg: Add Secure Access Components in the SDEV table
Bugzilla: 3516 (https://bugzilla.tianocore.org/show_bug.cgi?id=3516)

Make changes to ACPI 6.4 header according to the latest specification:
- ACPI 6.4 January 2021, Section 5.2.26.1.1
- Mantis ID 2111 (https://mantis.uefi.org/mantis/view.php?id=2111)

Signed-off-by: Chris Jones <christopher.jones@arm.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
2021-08-11 01:53:28 +00:00
Chris Jones
75c4a8e10d MdePkg: Add the Platform Health Assessment Table (PHAT)
Bugzilla: 3516 (https://bugzilla.tianocore.org/show_bug.cgi?id=3516)

Make changes to ACPI 6.4 header according to the latest specification:
- ACPI 6.4 January 2021, Table 5.5, Section 5.2.30
- Mantis ID 2094 (https://mantis.uefi.org/mantis/view.php?id=2094)

Signed-off-by: Chris Jones <christopher.jones@arm.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
2021-08-11 01:53:28 +00:00
Chris Jones
0938f9235c MdePkg: Add Multiprocessor Wakeup structure
Bugzilla: 3516 (https://bugzilla.tianocore.org/show_bug.cgi?id=3516)

Make changes to ACPI 6.4 header according to the latest specification:
- ACPI 6.4 January 2021, Table 5.21, Section 5.2.12.19
- Mantis ID 2087 (https://mantis.uefi.org/mantis/view.php?id=2087)

Signed-off-by: Chris Jones <christopher.jones@arm.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
2021-08-11 01:53:28 +00:00
Chris Jones
7b17bcd9a0 MdePkg: Add 'Type 5' PCC structure
Bugzilla: 3516 (https://bugzilla.tianocore.org/show_bug.cgi?id=3516)

Make changes to ACPI 6.4 header according to the latest specification:
- ACPI 6.4 January 2021, Section 14.1.7, Section 14.4
- Mantis ID 2010 (https://mantis.uefi.org/mantis/view.php?id=2010)

Signed-off-by: Chris Jones <christopher.jones@arm.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
2021-08-11 01:53:28 +00:00
Chris Jones
357383bc4f MdePkg: Add flags and MinTransferSize to Generic Initiator
Bugzilla: 3516 (https://bugzilla.tianocore.org/show_bug.cgi?id=3516)

Make changes to ACPI 6.4 header according to the latest specification:
- ACPI 6.4 January 2021, Table 5.59, Section 5.2.27.1 & Section 5.2.27.4
- Mantis ID 1991 (https://mantis.uefi.org/mantis/view.php?id=1991)

Signed-off-by: Chris Jones <christopher.jones@arm.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
2021-08-11 01:53:28 +00:00
Chris Jones
c82d6dd4a3 MdePkg: Remove DPPT table
Bugzilla: 3516 (https://bugzilla.tianocore.org/show_bug.cgi?id=3516)

Make changes to ACPI 6.4 header according to the latest specification:
- ACPI 6.4 January 2021, Table 5.5
- Mantis ID 2133 (https://mantis.uefi.org/mantis/view.php?id=2133)

Signed-off-by: Chris Jones <christopher.jones@arm.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
2021-08-11 01:53:28 +00:00
Chris Jones
ced4cb7609 MdePkg: Add SPA Location Cookie field to SPA Range structure
Bugzilla: 3516 (https://bugzilla.tianocore.org/show_bug.cgi?id=3516)

Make changes to ACPI 6.4 header according to the latest specification:
- ACPI 6.4 January 2021, Section 5.2.25.2 System Physical Address (SPA)
  Range Structure, Table 5.109
- Mantis ID 1988 (https://mantis.uefi.org/mantis/view.php?id=1988)

Also added a blank line between #defines and structure definitions to
improve readability.

Signed-off-by: Chris Jones <christopher.jones@arm.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
2021-08-11 01:53:28 +00:00
Chris Jones
ad3dea9861 MdePkg: Update PMTT to ACPI 6.4
Bugzilla: 3516 (https://bugzilla.tianocore.org/show_bug.cgi?id=3516)

Make changes to ACPI 6.4 header according to the latest specification:
- ACPI 6.4 January 2021, Section 5.2.21.12
- Mantis ID 1975 (https://mantis.uefi.org/mantis/view.php?id=1975)

Signed-off-by: Chris Jones <christopher.jones@arm.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
2021-08-11 01:53:28 +00:00
Chris Jones
d910e83299 MdePkg: Rename SBSA Generic Watchdog to Arm Generic Watchdog
Bugzilla: 3516 (https://bugzilla.tianocore.org/show_bug.cgi?id=3516)

Make changes to ACPI 6.4 header according to the latest specification:
- ACPI 6.4 January 2021, Section 5.2.24, Table 5.100 & Section 5.2.24.2
- Mantis ID 2126 (https://mantis.uefi.org/mantis/view.php?id=2126)

Signed-off-by: Chris Jones <christopher.jones@arm.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
2021-08-11 01:53:28 +00:00
Chris Jones
4d7137f261 MdePkg: Increment FADT version
Bugzilla: 3516 (https://bugzilla.tianocore.org/show_bug.cgi?id=3516)

Make changes to ACPI 6.4 header according to the latest specification:
- ACPI 6.4 January 2021, Table 5-9
- Mantis ID 2105 (https://mantis.uefi.org/mantis/view.php?id=2105)

Signed-off-by: Chris Jones <christopher.jones@arm.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
2021-08-11 01:53:28 +00:00
Chris Jones
5963ce5d28 MdePkg: Add ACPI 6.4 header file
Bugzilla: 3516 (https://bugzilla.tianocore.org/show_bug.cgi?id=3516)

This patch introduces a header file for the ACPI specification version
6.4. Currently it is based on the Acpi63.h header file however makes
six changes:

1. Replace all occurences of "6_3"/"6.3" with "6_4/6.4".
2. Remove the trailing underscore from the header guard in accordance
   with the EDK2 coding standards, section 5.3.5.
3. Make Acpi64.h the latest ACPI definition included by Acpi.h.
4. Fix the BGRT Status field comment to match the ACPI 6.3A spec.
5. Fix several typos where definitions were named "PMMT" when it should
   be "PMTT".
6. Fix a typo: "PPTT Platform Communication Channel" should be "PDTT
   Platform Communication Channel".

Signed-off-by: Chris Jones <christopher.jones@arm.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
2021-08-11 01:53:28 +00:00
Abner Chang
a7ddc7847c RedfishPkg/JsonLib: Add more JsonLib functions
Signed-off-by: Abner Chang <abner.chang@hpe.com>
Cc: Nickle Wang <nickle.wang@hpe.com>
Reviewed-by: Nickle Wang <nickle.wang@hpe.com>
2021-08-10 09:59:05 -07:00
45 changed files with 3877 additions and 103 deletions

View File

@@ -137,7 +137,7 @@
# hardware coherency (i.e., no virtualization or cache coherent DMA) # hardware coherency (i.e., no virtualization or cache coherent DMA)
gArmTokenSpaceGuid.PcdNormalMemoryNonshareableOverride|FALSE|BOOLEAN|0x00000043 gArmTokenSpaceGuid.PcdNormalMemoryNonshareableOverride|FALSE|BOOLEAN|0x00000043
[PcdsFeatureFlag.AARCH64] [PcdsFeatureFlag.AARCH64, PcdsFeatureFlag.ARM]
## Used to select method for requesting services from S-EL1.<BR><BR> ## Used to select method for requesting services from S-EL1.<BR><BR>
# TRUE - Selects FF-A calls for communication between S-EL0 and SPMC.<BR> # TRUE - Selects FF-A calls for communication between S-EL0 and SPMC.<BR>
# FALSE - Selects SVC calls for communication between S-EL0 and SPMC.<BR> # FALSE - Selects SVC calls for communication between S-EL0 and SPMC.<BR>

View File

@@ -161,4 +161,6 @@
[Components.AARCH64] [Components.AARCH64]
ArmPkg/Drivers/MmCommunicationDxe/MmCommunication.inf ArmPkg/Drivers/MmCommunicationDxe/MmCommunication.inf
ArmPkg/Library/ArmMmuLib/ArmMmuPeiLib.inf ArmPkg/Library/ArmMmuLib/ArmMmuPeiLib.inf
[Components.AARCH64, Components.ARM]
ArmPkg/Library/StandaloneMmMmuLib/ArmMmuStandaloneMmLib.inf ArmPkg/Library/StandaloneMmMmuLib/ArmMmuStandaloneMmLib.inf

View File

@@ -17,9 +17,21 @@
#define ARM_FFA_SVC_H_ #define ARM_FFA_SVC_H_
#define ARM_SVC_ID_FFA_VERSION_AARCH32 0x84000063 #define ARM_SVC_ID_FFA_VERSION_AARCH32 0x84000063
#define ARM_SVC_ID_FFA_MSG_SEND_DIRECT_REQ_AARCH32 0x8400006F
#define ARM_SVC_ID_FFA_MSG_SEND_DIRECT_RESP_AARCH32 0x84000070
#define ARM_SVC_ID_FFA_MSG_SEND_DIRECT_REQ_AARCH64 0xC400006F #define ARM_SVC_ID_FFA_MSG_SEND_DIRECT_REQ_AARCH64 0xC400006F
#define ARM_SVC_ID_FFA_MSG_SEND_DIRECT_RESP_AARCH64 0xC4000070 #define ARM_SVC_ID_FFA_MSG_SEND_DIRECT_RESP_AARCH64 0xC4000070
/* Generic IDs when using AArch32 or AArch64 execution state */
#ifdef MDE_CPU_AARCH64
#define ARM_SVC_ID_FFA_MSG_SEND_DIRECT_REQ ARM_SVC_ID_FFA_MSG_SEND_DIRECT_REQ_AARCH64
#define ARM_SVC_ID_FFA_MSG_SEND_DIRECT_RESP ARM_SVC_ID_FFA_MSG_SEND_DIRECT_RESP_AARCH64
#endif
#ifdef MDE_CPU_ARM
#define ARM_SVC_ID_FFA_MSG_SEND_DIRECT_REQ ARM_SVC_ID_FFA_MSG_SEND_DIRECT_REQ_AARCH32
#define ARM_SVC_ID_FFA_MSG_SEND_DIRECT_RESP ARM_SVC_ID_FFA_MSG_SEND_DIRECT_RESP_AARCH32
#endif
#define SPM_MAJOR_VERSION_FFA 1 #define SPM_MAJOR_VERSION_FFA 1
#define SPM_MINOR_VERSION_FFA 0 #define SPM_MINOR_VERSION_FFA 0

View File

@@ -15,10 +15,25 @@
* privileged operations on its behalf. * privileged operations on its behalf.
*/ */
#define ARM_SVC_ID_SPM_VERSION_AARCH32 0x84000060 #define ARM_SVC_ID_SPM_VERSION_AARCH32 0x84000060
#define ARM_SVC_ID_SP_EVENT_COMPLETE_AARCH32 0x84000061
#define ARM_SVC_ID_SP_GET_MEM_ATTRIBUTES_AARCH32 0x84000064
#define ARM_SVC_ID_SP_SET_MEM_ATTRIBUTES_AARCH32 0x84000065
#define ARM_SVC_ID_SP_EVENT_COMPLETE_AARCH64 0xC4000061 #define ARM_SVC_ID_SP_EVENT_COMPLETE_AARCH64 0xC4000061
#define ARM_SVC_ID_SP_GET_MEM_ATTRIBUTES_AARCH64 0xC4000064 #define ARM_SVC_ID_SP_GET_MEM_ATTRIBUTES_AARCH64 0xC4000064
#define ARM_SVC_ID_SP_SET_MEM_ATTRIBUTES_AARCH64 0xC4000065 #define ARM_SVC_ID_SP_SET_MEM_ATTRIBUTES_AARCH64 0xC4000065
/* Generic IDs when using AArch32 or AArch64 execution state */
#ifdef MDE_CPU_AARCH64
#define ARM_SVC_ID_SP_EVENT_COMPLETE ARM_SVC_ID_SP_EVENT_COMPLETE_AARCH64
#define ARM_SVC_ID_SP_GET_MEM_ATTRIBUTES ARM_SVC_ID_SP_GET_MEM_ATTRIBUTES_AARCH64
#define ARM_SVC_ID_SP_SET_MEM_ATTRIBUTES ARM_SVC_ID_SP_SET_MEM_ATTRIBUTES_AARCH64
#endif
#ifdef MDE_CPU_ARM
#define ARM_SVC_ID_SP_EVENT_COMPLETE ARM_SVC_ID_SP_EVENT_COMPLETE_AARCH32
#define ARM_SVC_ID_SP_GET_MEM_ATTRIBUTES ARM_SVC_ID_SP_GET_MEM_ATTRIBUTES_AARCH32
#define ARM_SVC_ID_SP_SET_MEM_ATTRIBUTES ARM_SVC_ID_SP_SET_MEM_ATTRIBUTES_AARCH32
#endif
#define SET_MEM_ATTR_DATA_PERM_MASK 0x3 #define SET_MEM_ATTR_DATA_PERM_MASK 0x3
#define SET_MEM_ATTR_DATA_PERM_SHIFT 0 #define SET_MEM_ATTR_DATA_PERM_SHIFT 0
#define SET_MEM_ATTR_DATA_PERM_NO_ACCESS 0 #define SET_MEM_ATTR_DATA_PERM_NO_ACCESS 0

View File

@@ -49,6 +49,14 @@
#define ARM_SMC_ID_MM_COMMUNICATE_AARCH32 0x84000041 #define ARM_SMC_ID_MM_COMMUNICATE_AARCH32 0x84000041
#define ARM_SMC_ID_MM_COMMUNICATE_AARCH64 0xC4000041 #define ARM_SMC_ID_MM_COMMUNICATE_AARCH64 0xC4000041
/* Generic ID when using AArch32 or AArch64 execution state */
#ifdef MDE_CPU_AARCH64
#define ARM_SMC_ID_MM_COMMUNICATE ARM_SMC_ID_MM_COMMUNICATE_AARCH64
#endif
#ifdef MDE_CPU_ARM
#define ARM_SMC_ID_MM_COMMUNICATE ARM_SMC_ID_MM_COMMUNICATE_AARCH32
#endif
/* MM return error codes */ /* MM return error codes */
#define ARM_SMC_MM_RET_SUCCESS 0 #define ARM_SMC_MM_RET_SUCCESS 0
#define ARM_SMC_MM_RET_NOT_SUPPORTED -1 #define ARM_SMC_MM_RET_NOT_SUPPORTED -1

View File

@@ -2,6 +2,7 @@
File managing the MMU for ARMv8 architecture in S-EL0 File managing the MMU for ARMv8 architecture in S-EL0
Copyright (c) 2017 - 2021, Arm Limited. All rights reserved.<BR> Copyright (c) 2017 - 2021, Arm Limited. All rights reserved.<BR>
Copyright (c) 2021, Linaro Limited
SPDX-License-Identifier: BSD-2-Clause-Patent SPDX-License-Identifier: BSD-2-Clause-Patent
@par Reference(s): @par Reference(s):
@@ -62,7 +63,7 @@ SendMemoryPermissionRequest (
// for other Direct Request calls which are not atomic // for other Direct Request calls which are not atomic
// We therefore check only for Direct Response by the // We therefore check only for Direct Response by the
// callee. // callee.
if (SvcArgs->Arg0 == ARM_SVC_ID_FFA_MSG_SEND_DIRECT_RESP_AARCH64) { if (SvcArgs->Arg0 == ARM_SVC_ID_FFA_MSG_SEND_DIRECT_RESP) {
// A Direct Response means FF-A success // A Direct Response means FF-A success
// Now check the payload for errors // Now check the payload for errors
// The callee sends back the return value // The callee sends back the return value
@@ -164,13 +165,13 @@ GetMemoryPermissions (
ZeroMem (&SvcArgs, sizeof (ARM_SVC_ARGS)); ZeroMem (&SvcArgs, sizeof (ARM_SVC_ARGS));
if (FeaturePcdGet (PcdFfaEnable)) { if (FeaturePcdGet (PcdFfaEnable)) {
// See [2], Section 10.2 FFA_MSG_SEND_DIRECT_REQ. // See [2], Section 10.2 FFA_MSG_SEND_DIRECT_REQ.
SvcArgs.Arg0 = ARM_SVC_ID_FFA_MSG_SEND_DIRECT_REQ_AARCH64; SvcArgs.Arg0 = ARM_SVC_ID_FFA_MSG_SEND_DIRECT_REQ;
SvcArgs.Arg1 = ARM_FFA_DESTINATION_ENDPOINT_ID; SvcArgs.Arg1 = ARM_FFA_DESTINATION_ENDPOINT_ID;
SvcArgs.Arg2 = 0; SvcArgs.Arg2 = 0;
SvcArgs.Arg3 = ARM_SVC_ID_SP_GET_MEM_ATTRIBUTES_AARCH64; SvcArgs.Arg3 = ARM_SVC_ID_SP_GET_MEM_ATTRIBUTES;
SvcArgs.Arg4 = BaseAddress; SvcArgs.Arg4 = BaseAddress;
} else { } else {
SvcArgs.Arg0 = ARM_SVC_ID_SP_GET_MEM_ATTRIBUTES_AARCH64; SvcArgs.Arg0 = ARM_SVC_ID_SP_GET_MEM_ATTRIBUTES;
SvcArgs.Arg1 = BaseAddress; SvcArgs.Arg1 = BaseAddress;
SvcArgs.Arg2 = 0; SvcArgs.Arg2 = 0;
SvcArgs.Arg3 = 0; SvcArgs.Arg3 = 0;
@@ -219,15 +220,15 @@ RequestMemoryPermissionChange (
ZeroMem (&SvcArgs, sizeof (ARM_SVC_ARGS)); ZeroMem (&SvcArgs, sizeof (ARM_SVC_ARGS));
if (FeaturePcdGet (PcdFfaEnable)) { if (FeaturePcdGet (PcdFfaEnable)) {
// See [2], Section 10.2 FFA_MSG_SEND_DIRECT_REQ. // See [2], Section 10.2 FFA_MSG_SEND_DIRECT_REQ.
SvcArgs.Arg0 = ARM_SVC_ID_FFA_MSG_SEND_DIRECT_REQ_AARCH64; SvcArgs.Arg0 = ARM_SVC_ID_FFA_MSG_SEND_DIRECT_REQ;
SvcArgs.Arg1 = ARM_FFA_DESTINATION_ENDPOINT_ID; SvcArgs.Arg1 = ARM_FFA_DESTINATION_ENDPOINT_ID;
SvcArgs.Arg2 = 0; SvcArgs.Arg2 = 0;
SvcArgs.Arg3 = ARM_SVC_ID_SP_SET_MEM_ATTRIBUTES_AARCH64; SvcArgs.Arg3 = ARM_SVC_ID_SP_SET_MEM_ATTRIBUTES;
SvcArgs.Arg4 = BaseAddress; SvcArgs.Arg4 = BaseAddress;
SvcArgs.Arg5 = EFI_SIZE_TO_PAGES (Length); SvcArgs.Arg5 = EFI_SIZE_TO_PAGES (Length);
SvcArgs.Arg6 = Permissions; SvcArgs.Arg6 = Permissions;
} else { } else {
SvcArgs.Arg0 = ARM_SVC_ID_SP_SET_MEM_ATTRIBUTES_AARCH64; SvcArgs.Arg0 = ARM_SVC_ID_SP_SET_MEM_ATTRIBUTES;
SvcArgs.Arg1 = BaseAddress; SvcArgs.Arg1 = BaseAddress;
SvcArgs.Arg2 = EFI_SIZE_TO_PAGES (Length); SvcArgs.Arg2 = EFI_SIZE_TO_PAGES (Length);
SvcArgs.Arg3 = Permissions; SvcArgs.Arg3 = Permissions;

View File

@@ -16,14 +16,14 @@
LIBRARY_CLASS = StandaloneMmMmuLib LIBRARY_CLASS = StandaloneMmMmuLib
PI_SPECIFICATION_VERSION = 0x00010032 PI_SPECIFICATION_VERSION = 0x00010032
[Sources.AARCH64] [Sources]
AArch64/ArmMmuStandaloneMmLib.c ArmMmuStandaloneMmLib.c
[Packages] [Packages]
ArmPkg/ArmPkg.dec ArmPkg/ArmPkg.dec
MdePkg/MdePkg.dec MdePkg/MdePkg.dec
[FeaturePcd.AARCH64] [FeaturePcd.ARM, FeaturePcd.AARCH64]
gArmTokenSpaceGuid.PcdFfaEnable gArmTokenSpaceGuid.PcdFfaEnable
[LibraryClasses] [LibraryClasses]

View File

@@ -34,9 +34,27 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include "FvLib.h" #include "FvLib.h"
#include "PeCoffLib.h" #include "PeCoffLib.h"
#define ARMT_UNCONDITIONAL_JUMP_INSTRUCTION 0xEB000000
#define ARM64_UNCONDITIONAL_JUMP_INSTRUCTION 0x14000000 #define ARM64_UNCONDITIONAL_JUMP_INSTRUCTION 0x14000000
/*
* Arm instruction to jump to Fv entry instruction in Arm or Thumb mode.
* From ARM Arch Ref Manual versions b/c/d, section A8.8.25 BL, BLX (immediate)
* BLX (encoding A2) branches to offset in Thumb instruction set mode.
* BL (encoding A1) branches to offset in Arm instruction set mode.
*/
#define ARM_JUMP_OFFSET_MAX 0xffffff
#define ARM_JUMP_TO_ARM(Offset) (0xeb000000 | ((Offset - 8) >> 2))
#define _ARM_JUMP_TO_THUMB(Imm32) (0xfa000000 | \
(((Imm32) & (1 << 1)) << (24 - 1)) | \
(((Imm32) >> 2) & 0x7fffff))
#define ARM_JUMP_TO_THUMB(Offset) _ARM_JUMP_TO_THUMB((Offset) - 8)
/*
* Arm instruction to return from exception (MOVS PC, LR)
*/
#define ARM_RETURN_FROM_EXCEPTION 0xE1B0F07E
BOOLEAN mArm = FALSE; BOOLEAN mArm = FALSE;
BOOLEAN mRiscV = FALSE; BOOLEAN mRiscV = FALSE;
STATIC UINT32 MaxFfsAlignment = 0; STATIC UINT32 MaxFfsAlignment = 0;
@@ -2203,23 +2221,25 @@ Returns:
// if we found an SEC core entry point then generate a branch instruction // if we found an SEC core entry point then generate a branch instruction
// to it and populate a debugger SWI entry as well // to it and populate a debugger SWI entry as well
if (UpdateVectorSec) { if (UpdateVectorSec) {
UINT32 EntryOffset;
VerboseMsg("UpdateArmResetVectorIfNeeded updating ARM SEC vector"); VerboseMsg("UpdateArmResetVectorIfNeeded updating ARM SEC vector");
// B SecEntryPoint - signed_immed_24 part +/-32MB offset EntryOffset = (INT32)(SecCoreEntryAddress - FvInfo->BaseAddress);
// on ARM, the PC is always 8 ahead, so we're not really jumping from the base address, but from base address + 8
ResetVector[0] = (INT32)(SecCoreEntryAddress - FvInfo->BaseAddress - 8) >> 2;
if (ResetVector[0] > 0x00FFFFFF) { if (EntryOffset > ARM_JUMP_OFFSET_MAX) {
Error(NULL, 0, 3000, "Invalid", "SEC Entry point must be within 32MB of the start of the FV"); Error(NULL, 0, 3000, "Invalid", "SEC Entry point offset above 1MB of the start of the FV");
return EFI_ABORTED; return EFI_ABORTED;
} }
// Add opcode for an unconditional branch with no link. i.e.: " B SecEntryPoint" if ((SecCoreEntryAddress & 1) != 0) {
ResetVector[0] |= ARMT_UNCONDITIONAL_JUMP_INSTRUCTION; ResetVector[0] = ARM_JUMP_TO_THUMB(EntryOffset);
} else {
ResetVector[0] = ARM_JUMP_TO_ARM(EntryOffset);
}
// SWI handler movs pc,lr. Just in case a debugger uses SWI // SWI handler movs pc,lr. Just in case a debugger uses SWI
ResetVector[2] = 0xE1B0F07E; ResetVector[2] = ARM_RETURN_FROM_EXCEPTION;
// Place holder to support a common interrupt handler from ROM. // Place holder to support a common interrupt handler from ROM.
// Currently not supported. For this to be used the reset vector would not be in this FV // Currently not supported. For this to be used the reset vector would not be in this FV

View File

@@ -155,7 +155,7 @@ ConvertAsn1TimeToEfiTime (
} }
Str = (CONST CHAR8*)Asn1Time->data; Str = (CONST CHAR8*)Asn1Time->data;
SetMem (EfiTime, 0, sizeof (EFI_TIME)); SetMem (EfiTime, sizeof (EFI_TIME), 0);
Index = 0; Index = 0;
if (Asn1Time->type == V_ASN1_UTCTIME) { /* two digit year */ if (Asn1Time->type == V_ASN1_UTCTIME) { /* two digit year */

View File

@@ -224,7 +224,7 @@ DmaMap (
goto FreeMapInfo; goto FreeMapInfo;
} }
if (Map->Operation == MapOperationBusMasterRead) { if (Operation == MapOperationBusMasterRead) {
CopyMem (Map->BufferAddress, (VOID *)(UINTN)HostAddress, *NumberOfBytes); CopyMem (Map->BufferAddress, (VOID *)(UINTN)HostAddress, *NumberOfBytes);
} }
mCpu->FlushDataCache (mCpu, (UINTN)Map->BufferAddress, AllocSize, mCpu->FlushDataCache (mCpu, (UINTN)Map->BufferAddress, AllocSize,

View File

@@ -0,0 +1,207 @@
/** @file
Unit tests of the UefiSortLib
Copyright (C) Huawei Technologies Co., Ltd. All rights reserved
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#include <stdio.h>
#include <string.h>
#include <stdarg.h>
#include <stddef.h>
#include <setjmp.h>
#include <cmocka.h>
#include <Uefi.h>
#include <Library/BaseLib.h>
#include <Library/DebugLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/UnitTestLib.h>
#include <Library/SortLib.h>
#define UNIT_TEST_APP_NAME "UefiSortLib Unit Tests"
#define UNIT_TEST_APP_VERSION "1.0"
#define TEST_ARRAY_SIZE_9 9
/**
The function is called by PerformQuickSort to compare int values.
@param[in] Left The pointer to first buffer.
@param[in] Right The pointer to second buffer.
@retval 0 Buffer1 equal to Buffer2.
@return <0 Buffer1 is less than Buffer2.
@return >0 Buffer1 is greater than Buffer2.
**/
INTN
EFIAPI
TestCompareFunction (
IN CONST VOID *Left,
IN CONST VOID *Right
)
{
if (*(UINT32*)Right > *(UINT32*)Left) {
return 1;
} else if (*(UINT32*)Right < *(UINT32*)Left) {
return -1;
}
return 0;
}
/**
Unit test for PerformQuickSort () API of the UefiSortLib.
@param[in] Context [Optional] An optional parameter that enables:
1) test-case reuse with varied parameters and
2) test-case re-entry for Target tests that need a
reboot. This parameter is a VOID* and it is the
responsibility of the test author to ensure that the
contents are well understood by all test cases that may
consume it.
@retval UNIT_TEST_PASSED The Unit test has completed and the test
case was successful.
@retval UNIT_TEST_ERROR_TEST_FAILED A test case assertion has failed.
**/
UNIT_TEST_STATUS
EFIAPI
SortUINT32ArrayShouldSucceed (
IN UNIT_TEST_CONTEXT Context
)
{
UINTN TestCount;
UINT32 Index;
UINT32 TestBuffer[TEST_ARRAY_SIZE_9];
UINT32 TestResult[TEST_ARRAY_SIZE_9];
TestCount = TEST_ARRAY_SIZE_9;
for (Index = 0; Index < TEST_ARRAY_SIZE_9; Index++) {
TestBuffer[Index] = Index + 1;
TestResult[Index] = TEST_ARRAY_SIZE_9 - Index;
}
PerformQuickSort (TestBuffer, TestCount, sizeof (UINT32), (SORT_COMPARE)TestCompareFunction);
UT_ASSERT_MEM_EQUAL (TestBuffer, TestResult, sizeof (UINT32) * TEST_ARRAY_SIZE_9);
return UNIT_TEST_PASSED;
}
/**
Unit test for StringCompare () API of the UefiSortLib.
@param[in] Context [Optional] An optional parameter that enables:
1) test-case reuse with varied parameters and
2) test-case re-entry for Target tests that need a
reboot. This parameter is a VOID* and it is the
responsibility of the test author to ensure that the
contents are well understood by all test cases that may
consume it.
@retval UNIT_TEST_PASSED The Unit test has completed and the test
case was successful.
@retval UNIT_TEST_ERROR_TEST_FAILED A test case assertion has failed.
**/
UNIT_TEST_STATUS
EFIAPI
CompareSameBufferShouldSucceed (
IN UNIT_TEST_CONTEXT Context
)
{
INTN retval;
CONST CHAR16* TestBuffer[] = { L"abcdefg" };
retval = StringCompare (TestBuffer, TestBuffer);
UT_ASSERT_TRUE (retval == 0);
return UNIT_TEST_PASSED;
}
/**
Initialze the unit test framework, suite, and unit tests for the
UefiSortLib and run the UefiSortLib unit test.
@retval EFI_SUCCESS All test cases were dispatched.
@retval EFI_OUT_OF_RESOURCES There are not enough resources available to
initialize the unit tests.
**/
STATIC
EFI_STATUS
EFIAPI
UnitTestingEntry (
VOID
)
{
EFI_STATUS Status;
UNIT_TEST_FRAMEWORK_HANDLE Framework;
UNIT_TEST_SUITE_HANDLE SortTests;
Framework = NULL;
DEBUG(( DEBUG_INFO, "%a v%a\n", UNIT_TEST_APP_NAME, UNIT_TEST_APP_VERSION ));
//
// Start setting up the test framework for running the tests.
//
Status = InitUnitTestFramework (&Framework, UNIT_TEST_APP_NAME, gEfiCallerBaseName, UNIT_TEST_APP_VERSION);
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "Failed in InitUnitTestFramework. Status = %r\n", Status));
goto EXIT;
}
//
// Populate the UefiSortLib Unit Test Suite.
//
Status = CreateUnitTestSuite (&SortTests, Framework, "UefiSortLib Sort Tests", "UefiSortLib.SortLib", NULL, NULL);
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "Failed in CreateUnitTestSuite for UefiSortLib API Tests\n"));
Status = EFI_OUT_OF_RESOURCES;
goto EXIT;
}
//
// --------------Suite--------Description------------Name--------------Function----------------Pre---Post---Context-----------
//
AddTestCase (SortTests, "Sort the Array", "Sort", SortUINT32ArrayShouldSucceed, NULL, NULL, NULL);
AddTestCase (SortTests, "Compare the Buffer", "Compare", CompareSameBufferShouldSucceed, NULL, NULL, NULL);
//
// Execute the tests.
//
Status = RunAllTestSuites (Framework);
EXIT:
if (Framework) {
FreeUnitTestFramework (Framework);
}
return Status;
}
///
/// Avoid ECC error for function name that starts with lower case letter
///
#define UefiSortLibUnitTestMain main
/**
Standard POSIX C entry point for host based unit test execution.
@param[in] Argc Number of arguments
@param[in] Argv Array of pointers to arguments
@retval 0 Success
@retval other Error
**/
INT32
UefiSortLibUnitTestMain (
IN INT32 Argc,
IN CHAR8 *Argv[]
)
{
UnitTestingEntry ();
return 0;
}

View File

@@ -0,0 +1,32 @@
## @file
# This is a unit test for the UefiSortLib.
#
# Copyright (C) Huawei Technologies Co., Ltd. All rights reserved
# SPDX-License-Identifier: BSD-2-Clause-Patent
##
[Defines]
INF_VERSION = 0x00010017
BASE_NAME = UefiSortLibUnitTest
FILE_GUID = 271337A3-0D79-BA3E-BC03-714E518E3B1B
VERSION_STRING = 1.0
MODULE_TYPE = HOST_APPLICATION
#
# The following information is for reference only and not required by the build tools.
#
# VALID_ARCHITECTURES = IA32 X64
#
[Sources]
UefiSortLibUnitTest.c
[Packages]
MdePkg/MdePkg.dec
MdeModulePkg/MdeModulePkg.dec
UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec
[LibraryClasses]
UnitTestLib
DebugLib
UefiSortLib

View File

@@ -19,6 +19,7 @@
"ExceptionList": [ "ExceptionList": [
"8005", "UNIVERSAL_PAYLOAD_PCI_ROOT_BRIDGE.UID", "8005", "UNIVERSAL_PAYLOAD_PCI_ROOT_BRIDGE.UID",
"8005", "UNIVERSAL_PAYLOAD_PCI_ROOT_BRIDGE.HID", "8005", "UNIVERSAL_PAYLOAD_PCI_ROOT_BRIDGE.HID",
"8001", "UefiSortLibUnitTestMain",
], ],
## Both file path and directory path are accepted. ## Both file path and directory path are accepted.
"IgnoreFiles": [ "IgnoreFiles": [

View File

@@ -41,3 +41,9 @@
<PcdsFixedAtBuild> <PcdsFixedAtBuild>
gEfiMdeModulePkgTokenSpaceGuid.PcdAllowVariablePolicyEnforcementDisable|TRUE gEfiMdeModulePkgTokenSpaceGuid.PcdAllowVariablePolicyEnforcementDisable|TRUE
} }
MdeModulePkg/Library/UefiSortLib/UnitTest/UefiSortLibUnitTest.inf {
<LibraryClasses>
UefiSortLib|MdeModulePkg/Library/UefiSortLib/UefiSortLib.inf
DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
}

View File

@@ -1,7 +1,7 @@
/** @file /** @file
All Pcd Ppi services are implemented here. All Pcd Ppi services are implemented here.
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR> Copyright (c) 2006 - 2021, Intel Corporation. All rights reserved.<BR>
(C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR> (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent SPDX-License-Identifier: BSD-2-Clause-Patent
@@ -339,6 +339,75 @@ PcdPeimInit (
{ {
EFI_STATUS Status; EFI_STATUS Status;
Status = PeiServicesRegisterForShadow (FileHandle);
if (Status == EFI_ALREADY_STARTED) {
//
// This is now starting in memory, the second time starting.
//
EFI_PEI_PPI_DESCRIPTOR *OldPpiList;
EFI_PEI_PPI_DESCRIPTOR *OldPpiList2;
VOID *Ppi;
VOID *Ppi2;
OldPpiList = NULL;
Status = PeiServicesLocatePpi (
&gPcdPpiGuid,
0,
&OldPpiList,
&Ppi
);
ASSERT_EFI_ERROR (Status);
if (OldPpiList != NULL) {
Status = PeiServicesReInstallPpi (OldPpiList, &mPpiList[0]);
ASSERT_EFI_ERROR (Status);
}
OldPpiList2 = NULL;
Status = PeiServicesLocatePpi (
&gGetPcdInfoPpiGuid,
0,
&OldPpiList2,
&Ppi2
);
ASSERT_EFI_ERROR (Status);
if (OldPpiList2 != NULL) {
Status = PeiServicesReInstallPpi (OldPpiList2, &mPpiList2[0]);
ASSERT_EFI_ERROR (Status);
}
OldPpiList = NULL;
Status = PeiServicesLocatePpi (
&gEfiPeiPcdPpiGuid,
0,
&OldPpiList,
&Ppi
);
ASSERT_EFI_ERROR (Status);
if (OldPpiList != NULL) {
Status = PeiServicesReInstallPpi (OldPpiList, &mPpiList[1]);
ASSERT_EFI_ERROR (Status);
}
OldPpiList2 = NULL;
Status = PeiServicesLocatePpi (
&gEfiGetPcdInfoPpiGuid,
0,
&OldPpiList2,
&Ppi2
);
ASSERT_EFI_ERROR (Status);
if (OldPpiList2 != NULL) {
Status = PeiServicesReInstallPpi (OldPpiList2, &mPpiList2[1]);
ASSERT_EFI_ERROR (Status);
}
return Status;
}
BuildPcdDatabase (FileHandle); BuildPcdDatabase (FileHandle);
// //

View File

@@ -3,7 +3,7 @@
consumed by drivers that do not care about ACPI versions. consumed by drivers that do not care about ACPI versions.
Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR> Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2019, ARM Ltd. All rights reserved.<BR> Copyright (c) 2019 - 2021, ARM Ltd. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent SPDX-License-Identifier: BSD-2-Clause-Patent
**/ **/
@@ -11,6 +11,6 @@
#ifndef _ACPI_H_ #ifndef _ACPI_H_
#define _ACPI_H_ #define _ACPI_H_
#include <IndustryStandard/Acpi63.h> #include <IndustryStandard/Acpi64.h>
#endif #endif

File diff suppressed because it is too large Load Diff

View File

@@ -3,6 +3,7 @@
# #
# Copyright (c) Microsoft Corporation # Copyright (c) Microsoft Corporation
# Copyright (c) 2020, Intel Corporation. All rights reserved.<BR> # Copyright (c) 2020, Intel Corporation. All rights reserved.<BR>
# Copyright (c) 2021, Arm Limited. All rights reserved.<BR>
# SPDX-License-Identifier: BSD-2-Clause-Patent # SPDX-License-Identifier: BSD-2-Clause-Patent
## ##
{ {
@@ -19,6 +20,7 @@
], ],
## Both file path and directory path are accepted. ## Both file path and directory path are accepted.
"IgnoreFiles": [ "IgnoreFiles": [
"Include/IndustryStandard/Acpi64.h"
] ]
}, },
## options defined ci/Plugin/CompilerPlugin ## options defined ci/Plugin/CompilerPlugin

View File

@@ -2,7 +2,7 @@
APIs for JSON operations. APIs for JSON operations.
Copyright (c) 2019, Intel Corporation. All rights reserved.<BR> Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
(C) Copyright 2020 Hewlett Packard Enterprise Development LP<BR> (C) Copyright 2021 Hewlett Packard Enterprise Development LP<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent SPDX-License-Identifier: BSD-2-Clause-Patent
@@ -53,6 +53,13 @@ typedef INT64 EDKII_JSON_INT_T; // #JSON_INTEGER_IS_LONG_LONG is set to 1
Index < JsonArrayCount(Array) && (Value = JsonArrayGetValue(Array, Index)); \ Index < JsonArrayCount(Array) && (Value = JsonArrayGetValue(Array, Index)); \
Index++) Index++)
#define EDKII_JSON_OBJECT_FOREACH_SAFE(Object, N, Key, Value) \
for (Key = JsonObjectIteratorKey(JsonObjectIterator(Object)), \
N = JsonObjectIteratorNext(Object, JsonObjectKeyToIterator(Key)); \
Key && (Value = JsonObjectIteratorValue(JsonObjectKeyToIterator(Key))); \
Key = JsonObjectIteratorKey(N), \
N = JsonObjectIteratorNext(Object, JsonObjectKeyToIterator(Key)))
/// ///
/// Map to the json_error_t in jansson.h /// Map to the json_error_t in jansson.h
/// ///
@@ -177,12 +184,12 @@ JsonValueInitUnicodeString (
@param[in] Value The integer to initialize to JSON value @param[in] Value The integer to initialize to JSON value
@retval The created JSON value which contains a JSON number or NULL. @retval The created JSON value which contains a JSON integer or NULL.
**/ **/
EDKII_JSON_VALUE EDKII_JSON_VALUE
EFIAPI EFIAPI
JsonValueInitNumber ( JsonValueInitInteger (
IN INT64 Value IN INT64 Value
); );
@@ -218,6 +225,36 @@ JsonValueInitNull (
VOID VOID
); );
/**
The function is used to initialize a JSON value which contains a TRUE JSON value,
or NULL on error.
NULL JSON value is kept as static value, and no need to do any cleanup work.
@retval The created JSON TRUE value.
**/
EDKII_JSON_VALUE
EFIAPI
JsonValueInitTrue (
VOID
);
/**
The function is used to initialize a JSON value which contains a FALSE JSON value,
or NULL on error.
NULL JSON value is kept as static value, and no need to do any cleanup work.
@retval The created JSON FALSE value.
**/
EDKII_JSON_VALUE
EFIAPI
JsonValueInitFalse (
VOID
);
/** /**
The function is used to decrease the reference count of a JSON value by one, and once The function is used to decrease the reference count of a JSON value by one, and once
this reference count drops to zero, the value is destroyed and it can no longer be used. this reference count drops to zero, the value is destroyed and it can no longer be used.
@@ -313,6 +350,21 @@ JsonValueIsString (
IN EDKII_JSON_VALUE Json IN EDKII_JSON_VALUE Json
); );
/**
The function is used to return if the provided JSON value contains a JSON integer.
@param[in] Json The provided JSON value.
@retval TRUE The JSON value is contains JSON integer.
@retval FALSE The JSON value doesn't contain a JSON integer.
**/
BOOLEAN
EFIAPI
JsonValueIsInteger (
IN EDKII_JSON_VALUE Json
);
/** /**
The function is used to return if the provided JSON value contains a JSON number. The function is used to return if the provided JSON value contains a JSON number.
@@ -343,6 +395,36 @@ JsonValueIsBoolean (
IN EDKII_JSON_VALUE Json IN EDKII_JSON_VALUE Json
); );
/**
The function is used to return if the provided JSON value contains a TRUE value.
@param[in] Json The provided JSON value.
@retval TRUE The JSON value contains a TRUE value.
@retval FALSE The JSON value doesn't contain a TRUE value.
**/
BOOLEAN
EFIAPI
JsonValueIsTrue (
IN EDKII_JSON_VALUE Json
);
/**
The function is used to return if the provided JSON value contains a FALSE value.
@param[in] Json The provided JSON value.
@retval TRUE The JSON value contains a FALSE value.
@retval FALSE The JSON value doesn't contain a FALSE value.
**/
BOOLEAN
EFIAPI
JsonValueIsFalse (
IN EDKII_JSON_VALUE Json
);
/** /**
The function is used to return if the provided JSON value contains a JSON NULL. The function is used to return if the provided JSON value contains a JSON NULL.
@@ -424,19 +506,19 @@ JsonValueGetUnicodeString (
); );
/** /**
The function is used to retrieve the associated integer in a number type JSON value. The function is used to retrieve the associated integer in a integer type JSON value.
The input JSON value should not be NULL or contain no JSON number, otherwise it will The input JSON value should not be NULL or contain no JSON Integer, otherwise it will
ASSERT() and return 0. ASSERT() and return 0.
@param[in] Json The provided JSON value. @param[in] Json The provided JSON value.
@retval Return the associated number in JSON value. @retval Return the associated Integer in JSON value.
**/ **/
INT64 INT64
EFIAPI EFIAPI
JsonValueGetNumber ( JsonValueGetInteger (
IN EDKII_JSON_VALUE Json IN EDKII_JSON_VALUE Json
); );
@@ -675,6 +757,8 @@ JsonDumpString (
Caller needs to cleanup the root value by calling JsonValueFree(). Caller needs to cleanup the root value by calling JsonValueFree().
@param[in] String The NULL terminated CHAR8 string to convert. @param[in] String The NULL terminated CHAR8 string to convert.
@param[in] Flags Flags for loading JSON string.
@param[in] Error Returned error status.
@retval Array JSON value or object JSON value, or NULL when any error occurs. @retval Array JSON value or object JSON value, or NULL when any error occurs.
@@ -682,7 +766,9 @@ JsonDumpString (
EDKII_JSON_VALUE EDKII_JSON_VALUE
EFIAPI EFIAPI
JsonLoadString ( JsonLoadString (
IN CONST CHAR8* String IN CONST CHAR8* String,
IN UINT64 Flags,
IN EDKII_JSON_ERROR *Error
); );
/** /**
@@ -781,11 +867,36 @@ JsonObjectIteratorValue (
@retval Iterator pointer @retval Iterator pointer
**/ **/
VOID * VOID *
EFIAPI
JsonObjectIteratorNext ( JsonObjectIteratorNext (
IN EDKII_JSON_VALUE JsonValue, IN EDKII_JSON_VALUE JsonValue,
IN VOID *Iterator IN VOID *Iterator
); );
/**
Returns the key of iterator pointing
@param[in] Iterator Iterator pointer
@retval Key
**/
CHAR8 *
EFIAPI
JsonObjectIteratorKey (
IN VOID *Iterator
);
/**
Returns the pointer of iterator by key.
@param[in] Key The key of interator pointer.
@retval Pointer to interator
**/
VOID *
EFIAPI
JsonObjectKeyToIterator (
IN CHAR8 *Key
);
/** /**
Returns the json type of this json value Returns the json type of this json value

View File

@@ -2,7 +2,7 @@
Redfish CRT wrapper functions. Redfish CRT wrapper functions.
Copyright (c) 2019, Intel Corporation. All rights reserved.<BR> Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
(C) Copyright 2020 Hewlett Packard Enterprise Development LP<BR> (C) Copyright 2021 Hewlett Packard Enterprise Development LP<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent SPDX-License-Identifier: BSD-2-Clause-Patent

View File

@@ -5,7 +5,7 @@
https://jansson.readthedocs.io/en/2.13/apiref.html https://jansson.readthedocs.io/en/2.13/apiref.html
Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.<BR> Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.<BR>
(C) Copyright 2020 Hewlett Packard Enterprise Development LP<BR> (C) Copyright 2021 Hewlett Packard Enterprise Development LP<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent SPDX-License-Identifier: BSD-2-Clause-Patent
**/ **/
@@ -154,12 +154,12 @@ JsonValueInitUnicodeString (
@param[in] Value The integer to initialize to JSON value @param[in] Value The integer to initialize to JSON value
@retval The created JSON value which contains a JSON number or NULL. @retval The created JSON value which contains a JSON integer or NULL.
**/ **/
EDKII_JSON_VALUE EDKII_JSON_VALUE
EFIAPI EFIAPI
JsonValueInitNumber ( JsonValueInitInteger (
IN INT64 Value IN INT64 Value
) )
{ {
@@ -186,6 +186,42 @@ JsonValueInitBoolean (
return (EDKII_JSON_VALUE)json_boolean (Value); return (EDKII_JSON_VALUE)json_boolean (Value);
} }
/**
The function is used to initialize a JSON value which contains a TRUE JSON value,
or NULL on error.
NULL JSON value is kept as static value, and no need to do any cleanup work.
@retval The created JSON TRUE value.
**/
EDKII_JSON_VALUE
EFIAPI
JsonValueInitTrue (
VOID
)
{
return (EDKII_JSON_VALUE)json_true();
}
/**
The function is used to initialize a JSON value which contains a FALSE JSON value,
or NULL on error.
NULL JSON value is kept as static value, and no need to do any cleanup work.
@retval The created JSON FALSE value.
**/
EDKII_JSON_VALUE
EFIAPI
JsonValueInitFalse (
VOID
)
{
return (EDKII_JSON_VALUE)json_false();
}
/** /**
The function is used to initialize a JSON value which contains a new JSON NULL, The function is used to initialize a JSON value which contains a new JSON NULL,
or NULL on error. or NULL on error.
@@ -314,6 +350,24 @@ JsonValueIsString (
return json_is_string ((json_t *) Json); return json_is_string ((json_t *) Json);
} }
/**
The function is used to return if the provided JSON value contains a JSON integer.
@param[in] Json The provided JSON value.
@retval TRUE The JSON value is contains JSON integer.
@retval FALSE The JSON value doesn't contain a JSON integer.
**/
BOOLEAN
EFIAPI
JsonValueIsInteger (
IN EDKII_JSON_VALUE Json
)
{
return json_is_integer ((json_t *) Json);
}
/** /**
The function is used to return if the provided JSON value contains a JSON number. The function is used to return if the provided JSON value contains a JSON number.
@@ -329,7 +383,7 @@ JsonValueIsNumber (
IN EDKII_JSON_VALUE Json IN EDKII_JSON_VALUE Json
) )
{ {
return json_is_integer ((json_t *) Json); return json_is_number ((json_t *) Json);
} }
/** /**
@@ -350,6 +404,47 @@ JsonValueIsBoolean (
return json_is_boolean ((json_t *) Json); return json_is_boolean ((json_t *) Json);
} }
/**
The function is used to return if the provided JSON value contains a TRUE value.
@param[in] Json The provided JSON value.
@retval TRUE The JSON value contains a TRUE value.
@retval FALSE The JSON value doesn't contain a TRUE value.
**/
BOOLEAN
EFIAPI
JsonValueIsTrue (
IN EDKII_JSON_VALUE Json
)
{
if (json_is_true ((json_t *)Json)) {
return TRUE;
}
return FALSE;
}
/**
The function is used to return if the provided JSON value contains a FALSE value.
@param[in] Json The provided JSON value.
@retval TRUE The JSON value contains a FALSE value.
@retval FALSE The JSON value doesn't contain a FALSE value.
**/
BOOLEAN
EFIAPI
JsonValueIsFalse (
IN EDKII_JSON_VALUE Json
)
{
if (json_is_false ((json_t *)Json)) {
return TRUE;
}
return FALSE;
}
/** /**
The function is used to return if the provided JSON value contains a JSON NULL. The function is used to return if the provided JSON value contains a JSON NULL.
@@ -485,24 +580,24 @@ JsonValueGetUnicodeString (
} }
/** /**
The function is used to retrieve the associated integer in a number type JSON value. The function is used to retrieve the associated integer in a integer type JSON value.
The input JSON value should not be NULL or contain no JSON number, otherwise it will The input JSON value should not be NULL or contain no JSON integer, otherwise it will
ASSERT() and return 0. ASSERT() and return 0.
@param[in] Json The provided JSON value. @param[in] Json The provided JSON value.
@retval Return the associated number in JSON value. @retval Return the associated integer in JSON value.
**/ **/
INT64 INT64
EFIAPI EFIAPI
JsonValueGetNumber ( JsonValueGetInteger (
IN EDKII_JSON_VALUE Json IN EDKII_JSON_VALUE Json
) )
{ {
ASSERT (Json != NULL && JsonValueIsNumber (Json)); ASSERT (Json != NULL && JsonValueIsInteger (Json));
if (Json == NULL || !JsonValueIsNumber (Json)) { if (Json == NULL || !JsonValueIsInteger (Json)) {
return 0; return 0;
} }
@@ -830,6 +925,8 @@ JsonDumpString (
Caller needs to cleanup the root value by calling JsonValueFree(). Caller needs to cleanup the root value by calling JsonValueFree().
@param[in] String The NULL terminated CHAR8 string to convert. @param[in] String The NULL terminated CHAR8 string to convert.
@param[in] Flags Flags for loading JSON string.
@param[in] Error Returned error status.
@retval Array JSON value or object JSON value, or NULL when any error occurs. @retval Array JSON value or object JSON value, or NULL when any error occurs.
@@ -837,12 +934,12 @@ JsonDumpString (
EDKII_JSON_VALUE EDKII_JSON_VALUE
EFIAPI EFIAPI
JsonLoadString ( JsonLoadString (
IN CONST CHAR8* String IN CONST CHAR8* String,
IN UINT64 Flags,
IN EDKII_JSON_ERROR *Error
) )
{ {
json_error_t JsonError; return (EDKII_JSON_VALUE) json_loads ((const char *)String, Flags, (json_error_t *)Error);
return (EDKII_JSON_VALUE) json_loads ((const char *)String, 0, &JsonError);
} }
/** /**
@@ -959,6 +1056,7 @@ JsonObjectIteratorValue (
@retval Iterator pointer @retval Iterator pointer
**/ **/
VOID * VOID *
EFIAPI
JsonObjectIteratorNext ( JsonObjectIteratorNext (
IN EDKII_JSON_VALUE JsonValue, IN EDKII_JSON_VALUE JsonValue,
IN VOID *Iterator IN VOID *Iterator
@@ -967,6 +1065,36 @@ JsonObjectIteratorNext (
return json_object_iter_next(JsonValue, Iterator); return json_object_iter_next(JsonValue, Iterator);
} }
/**
Returns the key of iterator pointing.
@param[in] Iterator Iterator pointer
@retval Key
**/
CHAR8 *
EFIAPI
JsonObjectIteratorKey (
IN VOID *Iterator
)
{
return (CHAR8 *)json_object_iter_key(Iterator);
}
/**
Returns the pointer of iterator by key.
@param[in] Key The key of interator pointer.
@retval Pointer to interator
**/
VOID *
EFIAPI
JsonObjectKeyToIterator (
IN CHAR8 *Key
)
{
return json_object_key_to_iter(Key);
}
/** /**
Returns the json type of this json value. Returns the json type of this json value.

View File

@@ -17,7 +17,7 @@
#ifndef LIBREDFISH_REDFISH_PAYLOAD_H_ #ifndef LIBREDFISH_REDFISH_PAYLOAD_H_
#define LIBREDFISH_REDFISH_PAYLOAD_H_ #define LIBREDFISH_REDFISH_PAYLOAD_H_
#include <PrivateInclude/Library/RedfishCrtLib.h> #include <Include/Library/RedfishCrtLib.h>
#include <jansson.h> #include <jansson.h>
#include <redfishService.h> #include <redfishService.h>

View File

@@ -30,7 +30,7 @@
#include <Library/UefiRuntimeServicesTableLib.h> #include <Library/UefiRuntimeServicesTableLib.h>
#include <Library/UefiBootServicesTableLib.h> #include <Library/UefiBootServicesTableLib.h>
#include <PrivateInclude/Library/RedfishCrtLib.h> #include <Include/Library/RedfishCrtLib.h>
#include <Protocol/EdkIIRedfishConfigHandler.h> #include <Protocol/EdkIIRedfishConfigHandler.h>
#include <Protocol/RestEx.h> #include <Protocol/RestEx.h>

View File

@@ -17,7 +17,7 @@
#ifndef LIBREDFISH_REDPATH_H_ #ifndef LIBREDFISH_REDPATH_H_
#define LIBREDFISH_REDPATH_H_ #define LIBREDFISH_REDPATH_H_
#include <PrivateInclude/Library/RedfishCrtLib.h> #include <Include/Library/RedfishCrtLib.h>
#include <jansson.h> #include <jansson.h>

View File

@@ -34,8 +34,8 @@
"PrivateInclude/Crt/stdlib.h", "PrivateInclude/Crt/stdlib.h",
"PrivateInclude/Crt/string.h", "PrivateInclude/Crt/string.h",
"PrivateInclude/Crt/time.h", "PrivateInclude/Crt/time.h",
"PrivateInclude/Library/RedfishCrtLib.h",
"PrivateLibrary/RedfishCrtLib/RedfishCrtLib.c", "PrivateLibrary/RedfishCrtLib/RedfishCrtLib.c",
"Include/Library/RedfishCrtLib.h",
## ##
## For jansson library open source ## For jansson library open source
## load.c is overrided from open source. ## load.c is overrided from open source.

View File

@@ -60,7 +60,7 @@
# CRT library is currently used by edk2 JsonLib (open source # CRT library is currently used by edk2 JsonLib (open source
# jansson project) and edk2 RedfishLib (libredfish open source # jansson project) and edk2 RedfishLib (libredfish open source
# project). # project).
RedfishCrtLib|PrivateInclude/Library/RedfishCrtLib.h RedfishCrtLib|Include/Library/RedfishCrtLib.h
## @libraryclass Redfish Helper Library ## @libraryclass Redfish Helper Library
# Library provides Redfish helper functions. # Library provides Redfish helper functions.

View File

@@ -17,7 +17,7 @@
PI_SPECIFICATION_VERSION = 0x00010032 PI_SPECIFICATION_VERSION = 0x00010032
ENTRY_POINT = StandaloneMmMain ENTRY_POINT = StandaloneMmMain
# VALID_ARCHITECTURES = IA32 X64 AARCH64 # VALID_ARCHITECTURES = IA32 X64 AARCH64 ARM
[Sources] [Sources]
StandaloneMmCore.c StandaloneMmCore.c

View File

@@ -2,6 +2,7 @@
Copyright (c) 2016 HP Development Company, L.P. Copyright (c) 2016 HP Development Company, L.P.
Copyright (c) 2016 - 2021, Arm Limited. All rights reserved. Copyright (c) 2016 - 2021, Arm Limited. All rights reserved.
Copyright (c) 2021, Linaro Limited
SPDX-License-Identifier: BSD-2-Clause-Patent SPDX-License-Identifier: BSD-2-Clause-Patent
@@ -92,8 +93,8 @@ PiMmStandaloneArmTfCpuDriverEntry (
// receipt of a synchronous MM request. Use the Event ID to distinguish // receipt of a synchronous MM request. Use the Event ID to distinguish
// between synchronous and asynchronous events. // between synchronous and asynchronous events.
// //
if ((ARM_SMC_ID_MM_COMMUNICATE_AARCH64 != EventId) && if ((ARM_SMC_ID_MM_COMMUNICATE != EventId) &&
(ARM_SVC_ID_FFA_MSG_SEND_DIRECT_REQ_AARCH64 != EventId)) { (ARM_SVC_ID_FFA_MSG_SEND_DIRECT_REQ != EventId)) {
DEBUG ((DEBUG_INFO, "UnRecognized Event - 0x%x\n", EventId)); DEBUG ((DEBUG_INFO, "UnRecognized Event - 0x%x\n", EventId));
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }

View File

@@ -10,7 +10,7 @@
#include <Base.h> #include <Base.h>
#include <Pi/PiMmCis.h> #include <Pi/PiMmCis.h>
#include <Library/AArch64/StandaloneMmCoreEntryPoint.h> #include <Library/Arm/StandaloneMmCoreEntryPoint.h>
#include <Library/DebugLib.h> #include <Library/DebugLib.h>
#include <Library/ArmSvcLib.h> #include <Library/ArmSvcLib.h>
#include <Library/ArmLib.h> #include <Library/ArmLib.h>
@@ -164,8 +164,8 @@ StandaloneMmCpuInitialize (
// Share the entry point of the CPU driver // Share the entry point of the CPU driver
DEBUG ((DEBUG_INFO, "Sharing Cpu Driver EP *0x%lx = 0x%lx\n", DEBUG ((DEBUG_INFO, "Sharing Cpu Driver EP *0x%lx = 0x%lx\n",
(UINT64) CpuDriverEntryPointDesc->ArmTfCpuDriverEpPtr, (UINTN) CpuDriverEntryPointDesc->ArmTfCpuDriverEpPtr,
(UINT64) PiMmStandaloneArmTfCpuDriverEntry)); (UINTN) PiMmStandaloneArmTfCpuDriverEntry));
*(CpuDriverEntryPointDesc->ArmTfCpuDriverEpPtr) = PiMmStandaloneArmTfCpuDriverEntry; *(CpuDriverEntryPointDesc->ArmTfCpuDriverEpPtr) = PiMmStandaloneArmTfCpuDriverEntry;
// Find the descriptor that contains the whereabouts of the buffer for // Find the descriptor that contains the whereabouts of the buffer for
@@ -180,8 +180,8 @@ StandaloneMmCpuInitialize (
return Status; return Status;
} }
DEBUG ((DEBUG_INFO, "mNsCommBuffer.PhysicalStart - 0x%lx\n", (UINT64) NsCommBufMmramRange->PhysicalStart)); DEBUG ((DEBUG_INFO, "mNsCommBuffer.PhysicalStart - 0x%lx\n", (UINTN) NsCommBufMmramRange->PhysicalStart));
DEBUG ((DEBUG_INFO, "mNsCommBuffer.PhysicalSize - 0x%lx\n", (UINT64) NsCommBufMmramRange->PhysicalSize)); DEBUG ((DEBUG_INFO, "mNsCommBuffer.PhysicalSize - 0x%lx\n", (UINTN) NsCommBufMmramRange->PhysicalSize));
CopyMem (&mNsCommBuffer, NsCommBufMmramRange, sizeof(EFI_MMRAM_DESCRIPTOR)); CopyMem (&mNsCommBuffer, NsCommBufMmramRange, sizeof(EFI_MMRAM_DESCRIPTOR));
DEBUG ((DEBUG_INFO, "mNsCommBuffer: 0x%016lx - 0x%lx\n", mNsCommBuffer.CpuStart, mNsCommBuffer.PhysicalSize)); DEBUG ((DEBUG_INFO, "mNsCommBuffer: 0x%016lx - 0x%lx\n", mNsCommBuffer.CpuStart, mNsCommBuffer.PhysicalSize));

View File

@@ -14,7 +14,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include <Guid/MmramMemoryReserve.h> #include <Guid/MmramMemoryReserve.h>
#include <Guid/MpInformation.h> #include <Guid/MpInformation.h>
#include <Library/AArch64/StandaloneMmCoreEntryPoint.h> #include <Library/Arm/StandaloneMmCoreEntryPoint.h>
#include <Library/ArmMmuLib.h> #include <Library/ArmMmuLib.h>
#include <Library/ArmSvcLib.h> #include <Library/ArmSvcLib.h>
#include <Library/DebugLib.h> #include <Library/DebugLib.h>
@@ -72,14 +72,14 @@ CreateHobListFromBootInfo (
// Create a hoblist with a PHIT and EOH // Create a hoblist with a PHIT and EOH
HobStart = HobConstructor ( HobStart = HobConstructor (
(VOID *) PayloadBootInfo->SpMemBase, (VOID *) (UINTN) PayloadBootInfo->SpMemBase,
(UINTN) PayloadBootInfo->SpMemLimit - PayloadBootInfo->SpMemBase, (UINTN) PayloadBootInfo->SpMemLimit - PayloadBootInfo->SpMemBase,
(VOID *) PayloadBootInfo->SpHeapBase, (VOID *) (UINTN) PayloadBootInfo->SpHeapBase,
(VOID *) (PayloadBootInfo->SpHeapBase + PayloadBootInfo->SpHeapSize) (VOID *) (UINTN) (PayloadBootInfo->SpHeapBase + PayloadBootInfo->SpHeapSize)
); );
// Check that the Hoblist starts at the bottom of the Heap // Check that the Hoblist starts at the bottom of the Heap
ASSERT (HobStart == (VOID *) PayloadBootInfo->SpHeapBase); ASSERT (HobStart == (VOID *) (UINTN) PayloadBootInfo->SpHeapBase);
// Build a Boot Firmware Volume HOB // Build a Boot Firmware Volume HOB
BuildFvHob (PayloadBootInfo->SpImageBase, PayloadBootInfo->SpImageSize); BuildFvHob (PayloadBootInfo->SpImageBase, PayloadBootInfo->SpImageSize);
@@ -190,9 +190,9 @@ CreateHobListFromBootInfo (
MmramRanges[3].RegionState = EFI_CACHEABLE | EFI_ALLOCATED; MmramRanges[3].RegionState = EFI_CACHEABLE | EFI_ALLOCATED;
// Base and size of heap memory shared by all cpus // Base and size of heap memory shared by all cpus
MmramRanges[4].PhysicalStart = (EFI_PHYSICAL_ADDRESS) HobStart; MmramRanges[4].PhysicalStart = (EFI_PHYSICAL_ADDRESS) (UINTN) HobStart;
MmramRanges[4].CpuStart = (EFI_PHYSICAL_ADDRESS) HobStart; MmramRanges[4].CpuStart = (EFI_PHYSICAL_ADDRESS) (UINTN) HobStart;
MmramRanges[4].PhysicalSize = HobStart->EfiFreeMemoryBottom - (EFI_PHYSICAL_ADDRESS) HobStart; MmramRanges[4].PhysicalSize = HobStart->EfiFreeMemoryBottom - (EFI_PHYSICAL_ADDRESS) (UINTN) HobStart;
MmramRanges[4].RegionState = EFI_CACHEABLE | EFI_ALLOCATED; MmramRanges[4].RegionState = EFI_CACHEABLE | EFI_ALLOCATED;
// Base and size of heap memory shared by all cpus // Base and size of heap memory shared by all cpus

View File

@@ -14,7 +14,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include <Guid/MmramMemoryReserve.h> #include <Guid/MmramMemoryReserve.h>
#include <Guid/MpInformation.h> #include <Guid/MpInformation.h>
#include <Library/AArch64/StandaloneMmCoreEntryPoint.h> #include <Library/Arm/StandaloneMmCoreEntryPoint.h>
#include <Library/ArmMmuLib.h> #include <Library/ArmMmuLib.h>
#include <Library/ArmSvcLib.h> #include <Library/ArmSvcLib.h>
#include <Library/DebugLib.h> #include <Library/DebugLib.h>

View File

@@ -10,7 +10,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include <PiMm.h> #include <PiMm.h>
#include <Library/AArch64/StandaloneMmCoreEntryPoint.h> #include <Library/Arm/StandaloneMmCoreEntryPoint.h>
#include <PiPei.h> #include <PiPei.h>
#include <Guid/MmramMemoryReserve.h> #include <Guid/MmramMemoryReserve.h>
@@ -182,13 +182,13 @@ DelegatedEventLoop (
} }
if (FfaEnabled) { if (FfaEnabled) {
EventCompleteSvcArgs->Arg0 = ARM_SVC_ID_FFA_MSG_SEND_DIRECT_RESP_AARCH64; EventCompleteSvcArgs->Arg0 = ARM_SVC_ID_FFA_MSG_SEND_DIRECT_RESP;
EventCompleteSvcArgs->Arg1 = 0; EventCompleteSvcArgs->Arg1 = 0;
EventCompleteSvcArgs->Arg2 = 0; EventCompleteSvcArgs->Arg2 = 0;
EventCompleteSvcArgs->Arg3 = ARM_SVC_ID_SP_EVENT_COMPLETE_AARCH64; EventCompleteSvcArgs->Arg3 = ARM_SVC_ID_SP_EVENT_COMPLETE;
EventCompleteSvcArgs->Arg4 = SvcStatus; EventCompleteSvcArgs->Arg4 = SvcStatus;
} else { } else {
EventCompleteSvcArgs->Arg0 = ARM_SVC_ID_SP_EVENT_COMPLETE_AARCH64; EventCompleteSvcArgs->Arg0 = ARM_SVC_ID_SP_EVENT_COMPLETE;
EventCompleteSvcArgs->Arg1 = SvcStatus; EventCompleteSvcArgs->Arg1 = SvcStatus;
} }
} }
@@ -273,13 +273,13 @@ InitArmSvcArgs (
) )
{ {
if (FeaturePcdGet (PcdFfaEnable)) { if (FeaturePcdGet (PcdFfaEnable)) {
InitMmFoundationSvcArgs->Arg0 = ARM_SVC_ID_FFA_MSG_SEND_DIRECT_RESP_AARCH64; InitMmFoundationSvcArgs->Arg0 = ARM_SVC_ID_FFA_MSG_SEND_DIRECT_RESP;
InitMmFoundationSvcArgs->Arg1 = 0; InitMmFoundationSvcArgs->Arg1 = 0;
InitMmFoundationSvcArgs->Arg2 = 0; InitMmFoundationSvcArgs->Arg2 = 0;
InitMmFoundationSvcArgs->Arg3 = ARM_SVC_ID_SP_EVENT_COMPLETE_AARCH64; InitMmFoundationSvcArgs->Arg3 = ARM_SVC_ID_SP_EVENT_COMPLETE;
InitMmFoundationSvcArgs->Arg4 = *Ret; InitMmFoundationSvcArgs->Arg4 = *Ret;
} else { } else {
InitMmFoundationSvcArgs->Arg0 = ARM_SVC_ID_SP_EVENT_COMPLETE_AARCH64; InitMmFoundationSvcArgs->Arg0 = ARM_SVC_ID_SP_EVENT_COMPLETE;
InitMmFoundationSvcArgs->Arg1 = *Ret; InitMmFoundationSvcArgs->Arg1 = *Ret;
} }
} }
@@ -328,7 +328,7 @@ _ModuleEntryPoint (
// Locate PE/COFF File information for the Standalone MM core module // Locate PE/COFF File information for the Standalone MM core module
Status = LocateStandaloneMmCorePeCoffData ( Status = LocateStandaloneMmCorePeCoffData (
(EFI_FIRMWARE_VOLUME_HEADER *) PayloadBootInfo->SpImageBase, (EFI_FIRMWARE_VOLUME_HEADER *) (UINTN) PayloadBootInfo->SpImageBase,
&TeData, &TeData,
&TeDataSize &TeDataSize
); );
@@ -395,7 +395,7 @@ _ModuleEntryPoint (
// //
ProcessModuleEntryPointList (HobStart); ProcessModuleEntryPointList (HobStart);
DEBUG ((DEBUG_INFO, "Shared Cpu Driver EP 0x%lx\n", (UINT64) CpuDriverEntryPoint)); DEBUG ((DEBUG_INFO, "Shared Cpu Driver EP %p\n", (VOID *) CpuDriverEntryPoint));
finish: finish:
if (Status == RETURN_UNSUPPORTED) { if (Status == RETURN_UNSUPPORTED) {

View File

@@ -21,10 +21,10 @@
# VALID_ARCHITECTURES = IA32 X64 IPF EBC (EBC is for build only) # VALID_ARCHITECTURES = IA32 X64 IPF EBC (EBC is for build only)
# #
[Sources.AARCH64] [Sources.AARCH64, Sources.ARM]
AArch64/StandaloneMmCoreEntryPoint.c Arm/StandaloneMmCoreEntryPoint.c
AArch64/SetPermissions.c Arm/SetPermissions.c
AArch64/CreateHobList.c Arm/CreateHobList.c
[Sources.X64] [Sources.X64]
X64/StandaloneMmCoreEntryPoint.c X64/StandaloneMmCoreEntryPoint.c
@@ -34,14 +34,14 @@
MdeModulePkg/MdeModulePkg.dec MdeModulePkg/MdeModulePkg.dec
StandaloneMmPkg/StandaloneMmPkg.dec StandaloneMmPkg/StandaloneMmPkg.dec
[Packages.AARCH64] [Packages.ARM, Packages.AARCH64]
ArmPkg/ArmPkg.dec ArmPkg/ArmPkg.dec
[LibraryClasses] [LibraryClasses]
BaseLib BaseLib
DebugLib DebugLib
[LibraryClasses.AARCH64] [LibraryClasses.ARM, LibraryClasses.AARCH64]
StandaloneMmMmuLib StandaloneMmMmuLib
ArmSvcLib ArmSvcLib
@@ -51,7 +51,7 @@
gEfiStandaloneMmNonSecureBufferGuid gEfiStandaloneMmNonSecureBufferGuid
gEfiArmTfCpuDriverEpDescriptorGuid gEfiArmTfCpuDriverEpDescriptorGuid
[FeaturePcd.AARCH64] [FeaturePcd.ARM, FeaturePcd.AARCH64]
gArmTokenSpaceGuid.PcdFfaEnable gArmTokenSpaceGuid.PcdFfaEnable
[BuildOptions] [BuildOptions]

View File

@@ -22,7 +22,7 @@
LIBRARY_CLASS = HobLib|MM_CORE_STANDALONE LIBRARY_CLASS = HobLib|MM_CORE_STANDALONE
# #
# VALID_ARCHITECTURES = X64 AARCH64 # VALID_ARCHITECTURES = X64 AARCH64 ARM
# #
[Sources.common] [Sources.common]
Common.c Common.c
@@ -30,9 +30,9 @@
[Sources.X64] [Sources.X64]
X64/StandaloneMmCoreHobLib.c X64/StandaloneMmCoreHobLib.c
[Sources.AARCH64] [Sources.AARCH64, Sources.ARM]
AArch64/StandaloneMmCoreHobLib.c Arm/StandaloneMmCoreHobLib.c
AArch64/StandaloneMmCoreHobLibInternal.c Arm/StandaloneMmCoreHobLibInternal.c
[Packages] [Packages]
MdePkg/MdePkg.dec MdePkg/MdePkg.dec

View File

@@ -20,6 +20,13 @@
// //
extern EFI_PHYSICAL_ADDRESS mMmMemLibInternalMaximumSupportAddress; extern EFI_PHYSICAL_ADDRESS mMmMemLibInternalMaximumSupportAddress;
#ifdef MDE_CPU_AARCH64
#define ARM_PHYSICAL_ADDRESS_BITS 36
#endif
#ifdef MDE_CPU_ARM
#define ARM_PHYSICAL_ADDRESS_BITS 32
#endif
/** /**
Calculate and save the maximum support address. Calculate and save the maximum support address.
@@ -31,7 +38,7 @@ MmMemLibInternalCalculateMaximumSupportAddress (
{ {
UINT8 PhysicalAddressBits; UINT8 PhysicalAddressBits;
PhysicalAddressBits = 36; PhysicalAddressBits = ARM_PHYSICAL_ADDRESS_BITS;
// //
// Save the maximum support address in one global variable // Save the maximum support address in one global variable

View File

@@ -28,7 +28,7 @@
# #
# The following information is for reference only and not required by the build tools. # The following information is for reference only and not required by the build tools.
# #
# VALID_ARCHITECTURES = IA32 X64 AARCH64 # VALID_ARCHITECTURES = IA32 X64 AARCH64 ARM
# #
[Sources.Common] [Sources.Common]
@@ -37,8 +37,8 @@
[Sources.IA32, Sources.X64] [Sources.IA32, Sources.X64]
X86StandaloneMmMemLibInternal.c X86StandaloneMmMemLibInternal.c
[Sources.AARCH64] [Sources.AARCH64, Sources.ARM]
AArch64/StandaloneMmMemLibInternal.c ArmStandaloneMmMemLibInternal.c
[Packages] [Packages]
MdePkg/MdePkg.dec MdePkg/MdePkg.dec

View File

@@ -20,7 +20,7 @@
# #
# The following information is for reference only and not required by the build tools. # The following information is for reference only and not required by the build tools.
# #
# VALID_ARCHITECTURES = AARCH64 # VALID_ARCHITECTURES = AARCH64|ARM
# #
# #

View File

@@ -29,10 +29,10 @@
## MM Memory Operation. ## MM Memory Operation.
MemLib|Include/Library/StandaloneMmMemLib.h MemLib|Include/Library/StandaloneMmMemLib.h
[LibraryClasses.AArch64] [LibraryClasses.AArch64, LibraryClasses.ARM]
## @libraryclass Defines a set of interfaces for the MM core entrypoint for ## @libraryclass Defines a set of interfaces for the MM core entrypoint for
## AArch64. ## AArch64 and ARM.
StandaloneMmCoreEntryPoint|Include/Library/AArch64/StandaloneMmCoreEntryPoint.h StandaloneMmCoreEntryPoint|Include/Library/Arm/StandaloneMmCoreEntryPoint.h
[Guids] [Guids]
gStandaloneMmPkgTokenSpaceGuid = { 0x18fe7632, 0xf5c8, 0x4e63, { 0x8d, 0xe8, 0x17, 0xa5, 0x5c, 0x59, 0x13, 0xbd }} gStandaloneMmPkgTokenSpaceGuid = { 0x18fe7632, 0xf5c8, 0x4e63, { 0x8d, 0xe8, 0x17, 0xa5, 0x5c, 0x59, 0x13, 0xbd }}

View File

@@ -20,7 +20,7 @@
PLATFORM_VERSION = 1.0 PLATFORM_VERSION = 1.0
DSC_SPECIFICATION = 0x00010011 DSC_SPECIFICATION = 0x00010011
OUTPUT_DIRECTORY = Build/StandaloneMm OUTPUT_DIRECTORY = Build/StandaloneMm
SUPPORTED_ARCHITECTURES = AARCH64|X64 SUPPORTED_ARCHITECTURES = AARCH64|X64|ARM
BUILD_TARGETS = DEBUG|RELEASE BUILD_TARGETS = DEBUG|RELEASE
SKUID_IDENTIFIER = DEFAULT SKUID_IDENTIFIER = DEFAULT
@@ -60,7 +60,7 @@
StandaloneMmDriverEntryPoint|MdePkg/Library/StandaloneMmDriverEntryPoint/StandaloneMmDriverEntryPoint.inf StandaloneMmDriverEntryPoint|MdePkg/Library/StandaloneMmDriverEntryPoint/StandaloneMmDriverEntryPoint.inf
VariableMmDependency|StandaloneMmPkg/Library/VariableMmDependency/VariableMmDependency.inf VariableMmDependency|StandaloneMmPkg/Library/VariableMmDependency/VariableMmDependency.inf
[LibraryClasses.AARCH64] [LibraryClasses.AARCH64, LibraryClasses.ARM]
ArmLib|ArmPkg/Library/ArmLib/ArmBaseLib.inf ArmLib|ArmPkg/Library/ArmLib/ArmBaseLib.inf
StandaloneMmMmuLib|ArmPkg/Library/StandaloneMmMmuLib/ArmMmuStandaloneMmLib.inf StandaloneMmMmuLib|ArmPkg/Library/StandaloneMmMmuLib/ArmMmuStandaloneMmLib.inf
ArmSvcLib|ArmPkg/Library/ArmSvcLib/ArmSvcLib.inf ArmSvcLib|ArmPkg/Library/ArmSvcLib/ArmSvcLib.inf
@@ -118,8 +118,8 @@
StandaloneMmPkg/Library/StandaloneMmMemoryAllocationLib/StandaloneMmMemoryAllocationLib.inf StandaloneMmPkg/Library/StandaloneMmMemoryAllocationLib/StandaloneMmMemoryAllocationLib.inf
StandaloneMmPkg/Library/VariableMmDependency/VariableMmDependency.inf StandaloneMmPkg/Library/VariableMmDependency/VariableMmDependency.inf
[Components.AARCH64] [Components.AARCH64, Components.ARM]
StandaloneMmPkg/Drivers/StandaloneMmCpu/AArch64/StandaloneMmCpu.inf StandaloneMmPkg/Drivers/StandaloneMmCpu/StandaloneMmCpu.inf
StandaloneMmPkg/Library/StandaloneMmPeCoffExtraActionLib/StandaloneMmPeCoffExtraActionLib.inf StandaloneMmPkg/Library/StandaloneMmPeCoffExtraActionLib/StandaloneMmPeCoffExtraActionLib.inf
################################################################################################### ###################################################################################################
@@ -135,6 +135,10 @@
GCC:*_*_*_DLINK_FLAGS = -z common-page-size=0x1000 -march=armv8-a+nofp -mstrict-align GCC:*_*_*_DLINK_FLAGS = -z common-page-size=0x1000 -march=armv8-a+nofp -mstrict-align
GCC:*_*_*_CC_FLAGS = -mstrict-align GCC:*_*_*_CC_FLAGS = -mstrict-align
[BuildOptions.ARM]
GCC:*_*_*_DLINK_FLAGS = -z common-page-size=0x1000 -march=armv7-a
GCC:*_*_*_CC_FLAGS = -fno-stack-protector
[BuildOptions.X64] [BuildOptions.X64]
MSFT:*_*_*_DLINK_FLAGS = /ALIGN:4096 MSFT:*_*_*_DLINK_FLAGS = /ALIGN:4096
GCC:*_GCC*_*_DLINK_FLAGS = -z common-page-size=0x1000 GCC:*_GCC*_*_DLINK_FLAGS = -z common-page-size=0x1000

View File

@@ -237,7 +237,7 @@ CpuCacheInfoCollectCoreAndCacheData (
CacheData[CacheParamLeafIndex].CacheType = (UINT8)CacheParamEax.Bits.CacheType; CacheData[CacheParamLeafIndex].CacheType = (UINT8)CacheParamEax.Bits.CacheType;
CacheData[CacheParamLeafIndex].CacheWays = (UINT16)CacheParamEbx.Bits.Ways; CacheData[CacheParamLeafIndex].CacheWays = (UINT16)CacheParamEbx.Bits.Ways;
CacheData[CacheParamLeafIndex].FullyAssociativeCache = (UINT8)CacheParamEax.Bits.FullyAssociativeCache; CacheData[CacheParamLeafIndex].FullyAssociativeCache = (UINT8)CacheParamEax.Bits.FullyAssociativeCache;
CacheData[CacheParamLeafIndex].DirectMappedCache = (UINT8)CacheParamEdx.Bits.ComplexCacheIndexing; CacheData[CacheParamLeafIndex].DirectMappedCache = (UINT8)(CacheParamEdx.Bits.ComplexCacheIndexing == 0);
CacheData[CacheParamLeafIndex].CacheShareBits = (UINT16)CacheParamEax.Bits.MaximumAddressableIdsForLogicalProcessors; CacheData[CacheParamLeafIndex].CacheShareBits = (UINT16)CacheParamEax.Bits.MaximumAddressableIdsForLogicalProcessors;
CacheData[CacheParamLeafIndex].CacheSizeinKB = (CacheParamEbx.Bits.Ways + 1) * CacheData[CacheParamLeafIndex].CacheSizeinKB = (CacheParamEbx.Bits.Ways + 1) *
(CacheParamEbx.Bits.LinePartitions + 1) * (CacheParamEbx.Bits.LineSize + 1) * (CacheParamEcx + 1) / SIZE_1KB; (CacheParamEbx.Bits.LinePartitions + 1) * (CacheParamEbx.Bits.LineSize + 1) * (CacheParamEcx + 1) / SIZE_1KB;