766 Commits

Author SHA1 Message Date
d52fa6da67 ArmPkg: rename ArmMtlNullLib
By edk2 convention, a NULL library should be called *LibNull.
ArmMtlNullLib did not follow this convention, so rename it
ArmMtlLibNull.

Signed-off-by: Leif Lindholm <leif.lindholm@oss.qualcomm.com>
2025-10-02 15:42:07 +01:00
3916260189 ArmPkg/ArmLib: Add 52-bit VA support helper (LPA2)
Signed-off-by: Sarah Walker <Sarah.Walker2@arm.com>
2025-10-01 11:14:56 +00:00
80de048c1b ArmPkg: Remove ARM32 Support
edk2 is dropping support for the ARM32 architecture. This
commit removes ARM32 code from the remaining parts of ArmPkg.

Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
2025-09-25 22:04:10 +00:00
cdc8858e19 ArmPkg: Remove ARM32 Support from ArmLib
edk2 is dropping support for the ARM32 architecture. This
commit removes ARM32 files from ArmLib.

Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
2025-09-25 22:04:10 +00:00
4261eb1bef ArmPkg: Remove ARM32 Support from ArmHvcLib
edk2 is dropping support for the ARM32 architecture. This
commit removes ARM32 files from ArmHvcLib.

Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
2025-09-25 22:04:10 +00:00
889676ac60 ArmPkg: Remove ARM32 Support from ArmMonitorLib
edk2 is dropping support for the ARM32 architecture. This
commit removes ARM32 files from ArmMonitorLib.

Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
2025-09-25 22:04:10 +00:00
79e9dee6c7 ArmPkg: Remove ARM32 Support from ArmExceptionLib
edk2 is dropping support for the ARM32 architecture. This
commit removes ARM32 files from ArmExceptionLib.

Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
2025-09-25 22:04:10 +00:00
f75198f592 ArmPkg: Remove ARM32 Support from ArmStandaloneMmCoreEntryPoint
edk2 is dropping support for the ARM32 architecture. This
commit removes ARM32 files from ArmStandaloneMmCoreEntryPoint.

Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
2025-09-25 22:04:10 +00:00
88b5cb3e12 ArmPkg: Remove ARM32 Support from DefaultExceptionHandlerLib
edk2 is dropping support for the ARM32 architecture. This
commit removes ARM32 files from DefaultExceptionHandlerLib.

Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
2025-09-25 22:04:10 +00:00
bacb949dd9 ArmPkg: Remove ARM32 Support from SemiHostFs
edk2 is dropping support for the ARM32 architecture. This
commit removes ARM32 files from SemiHostLib and SemiHostFs.

Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
2025-09-25 22:04:10 +00:00
cebf57e701 ArmPkg: Remove ARM32 Comments and Supported Arch
edk2 is dropping support for the ARM32 architecture. This
commit removes comments mentioning ARM32 and ARM32 as a
supported arch in ArmPkg.

Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
2025-09-25 22:04:10 +00:00
5025fc1eda ArmPkg/ArmTransferList: add TPM_EVENT_LOG information
Add TRANSFER_EVENT_LOG information according to firmware hand-off spec[0].
and related helper.

Links: https://github.com/FirmwareHandoff/firmware_handoff/blob/main/source/transfer_list.rst#tpm-event-log-table-entry-layout-xferlist_evlog
Signed-off-by: Yeoreum Yun <yeoreum.yun@arm.com>
2025-08-29 17:37:43 +00:00
a9cad8a1fb ArmPkg/Library/ArmTransferList: add helper to get TransferList
Add helper to get TrnasferList from HOB list.

Signed-off-by: Yeoreum Yun <yeoreum.yun@arm.com>
2025-08-29 17:37:43 +00:00
e841099600 ArmPkg/ArmTransferListLib: Add utility functions
Added functionality TransferList Library

TransferListVerifyChecksum - Verify TransferList CheckSum
TransferListCheckHeader - Check if TransferList header is valid,
 return suitable opcodes validating the header
TransferListFindEntry - Find a specific entry on the TransferList
 using the TagId
TransferListDump - Dump the contents of the TransferList header
 and the entry headers

Signed-off-by: Prachotan Reddy Bathi <Prachotan.Bathi@arm.com>
2025-07-24 05:59:45 +00:00
e1ac8b32a6 ArmPkg: ArmLib: Add functions to read AA64PFR2 and check GICv5 support
Signed-off-by: Sarah Walker <Sarah.Walker2@arm.com>
2025-07-15 02:10:39 +00:00
91a9ad4349 ArmPkg: Remove UGA support
The Universal Graphics Adapter (UGA) is a graphic abstraction.
The UGA I/O and Draw protocols are deprecated since UEFI 2.0 was
introduced. Cf. the UEFI spec v2.9:
"Appendix L - EFI 1.10 Protocol Changes and Deprecation List"
section L.2 "Deprecated Protocols"

Remove the UGA support.

Signed-off-by: GuoMinJ <newexplorerj@gmail.com>
Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2025-07-08 15:42:03 +00:00
5b3bb5939e ArmPkg,MdePkg,UefiCpuPkg,ArmPlatformPkg,ArmVirtPkg,UefiPayloadPkg: Move ArmMmuLib
Move ArmMmuLib from ArmPkg to UefiCpuPkg for easy maintaining.

Continuous-integration-options: PatchCheck.ignore-multi-package
Signed-off-by: Ajan Zhong <ajan.zhong@newfw.com>
2025-07-04 22:39:10 +00:00
07fc968c8f ArmPkg: Drop PcdNormalMemoryNonshareableOverride support
There are no upstream platforms sets this Pcd, this Pcd was
introduced by ArmVExpress-CTA15-A7.

Signed-off-by: Ajan Zhong <ajan.zhong@newfw.com>
2025-07-04 22:39:10 +00:00
4c282b4b4c ArmPkg,ArmPlatformPkg,ArmVirtPkg,UefiCpuPkg: Move ArmMmuLib.h to UefiCpuPkg
Move the ArmMmuLib interface definition to UefiCpuPkg, with this change,
MMU libraries for ARM, AARCH64, RiscV, LongArch64 architectures all
reside in UefiCpuPkg.

Continuous-integration-options: PatchCheck.ignore-multi-package
Signed-off-by: Ajan Zhong <ajan.zhong@newfw.com>
2025-07-04 22:39:10 +00:00
6b7a3e05f0 ArmPkg: ArmStandaloneMmCoreEntryPoint: Add MM communicate v3 support
As the standalone MM core begins supporting MM Communicate v3, this
update extends its functionality to incorporate MM Communicate v3
headers, enabling compatibility with the new protocol.

Signed-off-by: Kun Qin <kun.qin@microsoft.com>
2025-06-26 21:43:56 +00:00
e0852f75d8 ArmPkg: StMM: Use x24 register to store stack address
Now that the use of 18 registers for FF-A is supported. Registers
from x0-x17 can be used by FF-A to return call results. StMM also uses
registers x19-x23 to store SPMC boot information.

Use the x24 register to store the stack address instead of x12
to avoid it being clobbered by FF-A calls.

Signed-off-by: Mohamed Gamal Morsy <mohamed.morsy@arm.com>
2025-06-25 19:12:01 +00:00
215ed375d9 ArmPkg: ArmStandaloneMmCoreEntryPoint: Use common UUID conversion routine
As new interfaces are made available to support UUID-GUID conversion,
this change is made to leverage new interfaces and remove the locally
duplicated code.

Signed-off-by: Kun Qin <kun.qin@microsoft.com>
2025-06-05 05:01:57 +00:00
95f1b10aad ArmPkg: Add HobLib to ArmStandaloneMmCoreEntryPoint.
ArmStandaloneMmCoreEntryPoint makes use of GetNextHob
which comes from HobLib. The inf does not specify
HobLib has one of its library classes. Specify
HobLib in the LibraryClasses section of the
inf.

Signed-off-by: Aaron Pop <aaronpop@microsoft.com>
2025-05-30 18:21:02 +00:00
748bea7171 ArmPkg: ArmPsciResetSystemLib: PSCI warm reset fix
The current warm reset implementation attempts the PSCI SYSTEM_RESET2
command twice without clearing the local variable used for Arg1. This can
result in passing a random value as the reset type, which may cause the
PSCI call to behave unexpectedly and fall back to a cold reset.

This change addresses the issue by:
- Correcting the monitor call function ID.
- Explicitly zeroing the reset type field before invoking the PSCI
interface.

The updated warm reset flow has been tested and confirmed to invoke
SYSTEM_RESET2 as expected.

Signed-off-by: Kun Qin <kun.qin@microsoft.com>
2025-05-28 09:46:07 +00:00
6fde6ec6d8 ArmPkg: Fix typos
Corrects some typos.

Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
2025-05-26 17:27:38 +00:00
7fe2436480 ArmPkg/ArmLib: don't check for FP support on AArch64
UEFI defines that FP support is required, so skip the runtime check
in ArmEnableVFP().

Signed-off-by: Leif Lindholm <leif.lindholm@oss.qualcomm.com>
2025-04-11 12:48:56 +00:00
be03ceb117 ArmPkg: ArmFfaLib: Move ArmFfaLib implementation to MdeModulePkg
ArmFfaLib is an implementation of an industry specification-defined
interface with UEFI specific method of handling Rx/Tx buffer sharing
across multiple boot phases, which is more appropriately placed in
MdeModulePkg.

This update relocates the implementation of ArmFfaLib to MdeModulePkg,
thereby supporting the FFA call primitives for all other packages that
depend on this interface.

Continuous-integration-options: PatchCheck.ignore-multi-package
Signed-off-by: Kun Qin <kun.qin@microsoft.com>
2025-04-10 17:52:48 +00:00
541c46a705 ArmPkg: ArmSvcLib: Move ArmSvcLib to MdePkg
As an implementation of an industry specification-defined interface,
ArmSvcLib is more appropriately placed in MdePkg.

This update relocates both the header definition and the implementation
of ArmSvcLib to MdePkg, thereby supporting the supervisor call primitives
for all other packages that depend on this interface.

Continuous-integration-options: PatchCheck.ignore-multi-package
Signed-off-by: Kun Qin <kun.qin@microsoft.com>
2025-04-10 17:52:48 +00:00
211bb9b839 ArmPkg: ArmSmcLibNull: Move ArmSmcLibNull to MdePkg
ArmSmcLibNull is a null implementation of an industry specification-
defined interface, which is defined in MdePkg.

This update relocates the null implementation of ArmSmcLib to MdePkg,
thereby supporting the monitor call primitives for ARM platforms that
does not have SMC capabilities.

Continuous-integration-options: PatchCheck.ignore-multi-package
Signed-off-by: Kun Qin <kun.qin@microsoft.com>
2025-04-10 17:52:48 +00:00
86099b948b ArmPkg: ArmSmcLib: Move ArmSmcLib to MdePkg
As an implementation of an industry specification-defined interface,
ArmSmcLib is more appropriately placed in MdePkg.

This update relocates both the header definition and the implementation
of ArmSmcLib to MdePkg, thereby supporting the monitor call primitives
for all other packages that depend on this interface.

Continuous-integration-options: PatchCheck.ignore-multi-package
Signed-off-by: Kun Qin <kun.qin@microsoft.com>
2025-04-10 17:52:48 +00:00
8baa1c5120 ArmPkg: ArmStandaloneMmCoreEntryPoint: Support 18 register DIRECT_REQ2
This change added the support for using 18 registers when FF-A
DIRECT_REQ2 is used to communicate with MM core.

This change was tested on QEMU SBSA and booted to Windows.

Signed-off-by: Kun Qin <kun.qin@microsoft.com>
2025-04-02 16:25:45 +00:00
8d03c42d38 ArmPkg: ArmFfaLib: Update FF-A direct message to support 18 registers
This change expands the support of FF-A direct message 2 call to use the
full 18 registers.

It also adds a check in the contructors to ensure the SMCCC meets the
minimal requirement of v1.2 to support FF-A v1.2 usage.

Signed-off-by: Kun Qin <kun.qin@microsoft.com>
2025-04-02 16:25:45 +00:00
47b793f38c ArmPkg: ArmSvcLib: Support all 18 registers
This extends ARM_SVC_ARGS to support all x0-x17 registers use case for
FF-A.

The ArmCallSvc function is also updated to support 18-register usage.

Co-authored-by: Olivier Deprez <Olivier.Deprez@arm.com>
Signed-off-by: Kun Qin <kun.qin@microsoft.com>
2025-04-02 16:25:45 +00:00
c0ecd11e62 ArmPkg: ArmSmcLib: Support all 18 registers
This extends ARM_SMC_ARGS to support all x0-x17 registers use case for
FF-A.

The ArmCallSmc function is also updated to support 18-register usage.

Signed-off-by: Kun Qin <kun.qin@microsoft.com>
2025-04-02 16:25:45 +00:00
20247e2342 ArmPkg/ArmTransferListLib: improve coding style compliance
The existing code was full of abbreviated function/variable names.
Let's nip that in the bud before we add more code to this library.

Update the current only upstream user: ArmStandaloneMmCoreEntryPoint.

Signed-off-by: Leif Lindholm <leif.lindholm@oss.qualcomm.com>
2025-03-06 10:17:25 +00:00
2625e91963 ArmPkg/ArmStandaloneMmCoreEntryPoint: Fix cast on clang
Compilation error:

```
ArmStandaloneMmCoreEntryPoint.c:1041:48: error: cast to smaller
  integer type 'unsigned long' from 'void *'
  [-Werror,-Wvoid-pointer-to-int-cast]

  1041 |   DEBUG ((DEBUG_INFO, "Start Dump Hob: %lx\n",
             (unsigned long)HobStart));
```

The `%p` specifer is now used to print the pointers.

Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
2025-02-24 16:30:19 +00:00
523dbb6d59 ArmPkg: ArmFfaStandaloneMmLib: Fix non-FFA path
ArmFfaLibCommonInit will return EFI_UNSUPPORTED when there is no FFA
supported on the platform. This is expected behavior. However, the return
of error code will incur program asserts.

This change fixed the non-FFA path for the Standalone MM instance.

Signed-off-by: Kun Qin <kun.qin@microsoft.com>
2025-02-11 21:21:40 +00:00
efbf5ed08c MdePkg: Move StackCheckLibStaticInit to StackCheckLib
This commit oves StackCheckLib from a NULL lib to an instance of
StackCheckLib. This requires every entry point to add a library
dependency on StackCheckLib. It also requires every SEC module
to have a dependency on StackCheckLib because there is no
standard SEC entry point.

It allows for greater flexibility for a platform to apply stack
cookies and simplifies DSC logic.

Continuous-integration-options: PatchCheck.ignore-multi-package

Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
2025-02-07 02:23:11 +00:00
62cd7d338b ArmPkg: Retire ArmDisassemblerLib
No longer used anywhere so can be retired.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
2025-01-31 13:50:45 +00:00
ef80dd8fad ArmPkg: Stop using ArmDisassemblerLib
ArmDisassemblerLib is used to pretty print the instruction that
triggered an unhandled exception, but it was never implemented for
AARCH64, and according to the existing file comment, Thumb2 support
(which is used predominantly when building EDK2 for 32-bit ARM due to
its smaller size) is incomplete.

The DEBUG diagnostics that are produced on an unhandled exception are
generally sufficient to dump the entire executable that triggered it,
and so this disassembly is of limited value, especially because it
doesn't work on AARCH64.

So let's start getting rid of it, by dropping references to it in code
and in the various .INF and .DSC files. Once out-of-tree platforms have
been allowed to catch up, we can remove the library implementation and
its class definition entirely.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
2025-01-30 16:01:56 +00:00
74376f0b72 ArmPkg,ArmPkg/ArmExceptionLib: drop vector relocation variant/support
There were several bugs in the vector table relocation code which means
it can't really have been used by anyone on AArch64 in the last decade or
so. So delete the support code from the library, as well as the
ArmRelocateExceptionLib.inf file.

This gets rid of PcdDebuggerExceptionSupport (including a duff reference
in CpuDxe), PcdCpuVectorBaseAddress and PcdRelocateVectorTable.

Signed-off-by: Leif Lindholm <leif.lindholm@oss.qualcomm.com>
2025-01-30 15:09:09 +00:00
eaa60a6b10 ArmPkg/ArmGic: Retire ArmGicArchLib
ArmGicArchLib is no longer use so remove all remaining references and
implementations.

Continuous-integration-options: PatchCheck.ignore-multi-package

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
2025-01-17 18:37:27 +00:00
f0c87b9ef4 StandaloneMmPkg: move core entry point lib and cpu driver to ArmPkg
StandaloneMmCpu driver is only used for Arm architecture and
StandaloneMmCoreEntryPointLib for Arm has specific implementation with
StandaloneMmCpu driver.

Move StandaloneMmCpu Driver and StandaloneMmCoreEntryPointLib for Arm
to ArmPkg.

Continuous-integration-options: PatchCheck.ignore-multi-package
Signed-off-by: Levi Yun <yeoreum.yun@arm.com>
2025-01-17 14:55:42 +00:00
4ca452cf91 ArmPkg/Library: Update StandaloneMmuLib with FF-A v1.2 with page granulirty
The StandaloneMm implementation for Arm sets up the stack in
the early startup code using the data section reserved in the
assembly code.

When TF-A loads the StandaloneMM binary in the DRAM it maps
the entire StandaloneMM memory region as Read Only.

Therefore, the initial startup assembly code updates the mem
permissions of the stack region to Read Write.

However, when the StandaloneMmCore is loaded the function
UpdateMmFoundationPeCoffPermissions() starts applying the
memory permissions based on the PE COFF sections as below:

A. If the section is not executable, it first removes the
executable permission of the section by calling TextUpdate().
TextUpdate() is the StandaloneMM MMU library function
ArmSetMemoryRegionNoExec().

B. It then checks if the section is writable, and if it is
it calls ReadWriteUpdater(), which invokes the StandaloneMM
MMU library function ArmClearMemoryRegionReadOnly() to make
the section writable.

However, this results in the stack being made read-only
between A and B. To understand this please see the following
flow.

1. TF-A sets the entire StandaloneMM region as Read Only.
2. The stack is reserved in the data section by the early
   assembly entry point code.
    +--------------------+   <--- Start of Data Section
    |                    |
    |  Data Section      |
    |                    |
    | +----------------+ |   <--- Stack region
    | |   Stack        | |
    | +----------------+ |
    |                    |
    +--------------------+

3. The StanaloneMM early entry point code updates the
   attributes of the stack to Read Write.
4. When UpdateMmFoundationPeCoffPermissions() sets the
   permission of the data section to remove the Execute
   attribute, it calls ArmSetMemoryRegionNoExec().
5. The ArmSetMemoryRegionNoExec() implementation gets the
   attributes of the first granule which is at the start
   of the data section, then clears the execute permission
   and applies the attribute for the entire data section.
6. Since TF-A has mapped the entire section as read only
   the first granule of the data section is read only and
   therefore the stack region attributes are changed to
   Read Only no execute.
7. Since the stack is read only after point A any updates
   to the stack result in an exception.

To resolve this issue with update the library with FF-A v1.2,
get/set memory permission per page unit.

Links: https://developer.arm.com/documentation/den0140/latest/ [0]
Signed-off-by: Levi Yun <yeoreum.yun@arm.com>
2025-01-17 14:55:42 +00:00
401699c326 ArmPkg: Add ArmFfaLib used in StandaloneMm
Add ArmFfaLib used in StandaloneMmCore/StandaloneMm Driver.

Continuous-integration-options: PatchCheck.ignore-multi-package
Signed-off-by: Levi Yun <yeoreum.yun@arm.com>
2025-01-17 14:55:42 +00:00
166c3b2eb7 ArmPkg: Add ArmFfaLib used in PEIM
Add ArmFfaLib used in PEIM.

Signed-off-by: Levi Yun <yeoreum.yun@arm.com>
2025-01-17 14:55:42 +00:00
5d1b38dd07 ArmPkg: Add ArmFfaLib used in Dxe driver
Add ArmFfaLib used in Dxe driver

Signed-off-by: Levi Yun <yeoreum.yun@arm.com>
2025-01-17 14:55:42 +00:00
30ecebe015 ArmPkg: Remove PcdFfaEnabled
PcdFfaEnabled is no more used because ArmFfaLib could find whether FF-A
is supported dynamically.

This patch removes usage of PcdFfaEnabled.

Continuous-integration-options: PatchCheck.ignore-multi-package
Signed-off-by: Levi Yun <yeoreum.yun@arm.com>
2025-01-17 14:55:42 +00:00
54e394b4a2 ArmPkg/StandaloneMmMmuLib: Introduce a SPM_MM status helper fucntion
Introduce a new helper function SpmMmStatusToEfiStatus() to convert
the SPM_MM status values to EFI_STATUS values.

Signed-off-by: Levi yun <yeoreum.yun@arm.com>
2025-01-17 14:55:42 +00:00
c56856f068 ArmPkg/IndustryStandard: Change naming convention in ArmMmSvc.h
Change naming convention in ArmMmSvc.h with

  MM to SPM_MM

This would make it clear to discern ABI protocol used to communicate
with secure partition.

Continuous-integration-options: PatchCheck.ignore-multi-package
Signed-off-by: Levi Yun <yeoreum.yun@arm.com>
2025-01-17 14:55:42 +00:00