summaryrefslogtreecommitdiffstats
path: root/ArmPkg
Commit message (Collapse)AuthorAgeFilesLines
* ArmPkg: Avoid building ArmCrashDumpDxe on ARMArd Biesheuvel2024-09-161-1/+1
| | | | | | | | | | | For reasons that are unclear, the Linaro EDK2 CI is throwing errors when building ArmCrashDumpDxe with CLANGDWARF, as the resulting build contains non-adjacet MOVW/MOVT pairs, which cannot be relocated correctly in PE/COFF. Let's build it only for AARCH64 - its utility on ARM is doubtful anyway. Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
* ArmPkg: Remove Deprecated Stack Check LibOliver Smith-Denny2024-09-132-6/+4
| | | | | | | Remove the old stack check lib now that MdeLibs.inc includes the new one. Signed-off-by: Oliver Smith-Denny <osde@linux.microsoft.com>
* ArmPkg/ArmLib: Drop set/way Dcache operationsArd Biesheuvel2024-09-136-306/+0
| | | | | | | | | | | | | | | | Cache maintenance operations by set/way are not broadcast, and operate on individual architected caches, making them suitable only for en/disabling cache levels, which is the job of secure firmware, to be carried out while the CPU in question is not taking part in the cache coherency protocol. Managing the clean/dirty state of a memory range can only be done using cache maintenance by virtual address. So drop the set/way handling from ArmLib for ARM and AARCH64, as there is no context where it can be used correctly from EDK2. Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
* MdePkg: Move CompilerIntrinsicsLib from ArmPkgOliver Smith-Denny2024-09-1246-2767/+0
| | | | | | | | | | | | | | | | | | | | As per the emailed RFC in https://edk2.groups.io/g/devel/topic/rfc_move/107675828, this patch moves CompilerIntrinsicsLib from ArmPkg to MdePkg as this library provides compiler intrinsics, which are industry standard. This aligns with the goal of integrating ArmPkg into existing packages: https://bugzilla.tianocore.org/show_bug.cgi?id=4121. The newly placed CompilerIntrinsicsLib is added to MdeLibs.dsc.inc as every DSC that builds ARM/AARCH64 needs this library added. The old location is removed from every DSC in edk2 in this commit also to not break bisectability with minimal hoop jumping. Continuous-integration-options: PatchCheck.ignore-multi-package Signed-off-by: Oliver Smith-Denny <osde@linux.microsoft.com>
* MdePkg: Move AsmMacroIoLib*.h from ArmPkgOliver Smith-Denny2024-09-1254-178/+51
| | | | | | | | | | | | | | | | | | | AsmMacroIoLib.h and AsmMacroIoLibV8.h are used by the CompilerIntrinsicsLib, which is moving to MdePkg. These functions provide standard definitions for ARM/AARCH64 assembly code, respectively, and so are moved to the arch directories in MdePkg to avoid MdePkg having a dependency on ArmPkg. Now that the files are in Arm/ and AArch64/ directories, the filenames are changed to AsmMacroLib.h as we can distinguish the architecture from the path. AsmMacroIoLib.inc is unused and so is removed. Continuous-integration-options: PatchCheck.ignore-multi-package Signed-off-by: Oliver Smith-Denny <osde@linux.microsoft.com>
* ArmPkg: CompilerIntrinsicsLib: Use AsmMacroIoLibV8.h for AARCH64 ASMOliver Smith-Denny2024-09-121-1/+1
| | | | | | | | | AArch64/ashlti3.S was using AsmMacroIoLib.h which is the ARM version of these definitions. AsmMacroIoLibV8.h is the AARCH64 version of these defintions. This patch moves that file to use the proper arch file. Signed-off-by: Oliver Smith-Denny <osde@linux.microsoft.com>
* ArmPkg/ArmPsciMpServices: GetProcessorInfo copies incorrect structureVishal Oliyil Kunnil2024-09-101-1/+1
| | | | | | | | | GetProcessorInfo copies CpuData instead of CpuData.Info. The OUT parameter ProcessorInfoBuffer is of type EFI_PROCESSOR_INFORMATION, not CPU_AP_DATA. Fix it to copy the correct member CpuData.Info. Signed-off-by: Vishal Oliyil Kunnil <quic_vishalo@quicinc.com>
* ArmPkg/ArmPkg.ci.yaml: Add PrEval CI configJoey Vagedes2024-09-021-0/+3
| | | | | | | | | | | Adds an entry to the package's CI configuration file that enable policy 5 for stuart_pr_eval. With this Policy, all INFs used by the package are extracted from the provided DSC file and compared against the list of changed *.inf (INF) files in the PR. If there is a match, stuart_pr_eval will specify that this package is affected by the PR and needs to be tested. Signed-off-by: Joey Vagedes <joey.vagedes@gmail.com>
* ArmPkg: Fix timer wrap-aroundCarsten Haitzler2024-09-011-4/+10
| | | | | | | | The timer counter register can wrap around and when this happens, we'll get misbehavior for any MicroSecondDelay() calls. This adds handling for that. Signed-off-by: Carsten Haitzler <carsten.haitzler@foss.arm.com>
* Sync AARCH64 GCD Capabilities with Page TableOliver Smith-Denny2024-08-301-6/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On AARCH64 systems, the GCD is not fully synced with the page table. On x86 systems, the GCD is synced by adding `EFI_MEMORY_RO`, `EFI_MEMORY_RP`, and `EFI_MEMORY_XP` to the current capabilities of the GCD, then the page table attributes are set on the GCD attributes. However, on AARCH64, the GCD capabilities do not get updated, instead only the attributes from the page table are masked by the existing GCD capabilities, which means that any new page table attribute which are already set are dropped and the GCD does not reflect the state of the system. This has been seen to cause issues where memory in the page table that was marked `EFI_MEMORY_XP` had an additional attribute set using the GCD capabilities, which did not include `EFI_MEMORY_XP`, this caused the page table to be updated to lose `EFI_MEMORY_XP`, which is a potential security issue. The existing behavior on AARCH64 systems is an implementation error, it assumes one of two things: - The page table attributes must be a subset of the GCD capabilities - The GCD does not need to have its capabilities synced to what the page table attributes are The first is incorrect as important attributes such as `EFI_MEMORY_XP` do not get applied to the GCD capabilities by default and therefore must be synced back. This comment from ArmPkg's CpuDxe driver helps explain: ```c // The GCD implementation maintains its own copy of the state of memory // space attributes. GCD needs to know what the initial memory space // attributes are. The CPU Arch. Protocol does not provide a // GetMemoryAttributes function for GCD to get this so we must resort to // calling GCD (as if we were a client) to update its copy of the // attributes. This is bad architecture and should be replaced with a // way for GCD to query the CPU Arch. driver of the existing memory // space attributes instead. ``` However, this comment misses that updating the capabilities is critical to updating the attributes. The second is incorrect because significant pieces of core code reference the GCD attributes instead of the page table attributes. For example, NonDiscoverablePciDeviceDxe uses the GCD capabilities and attributes when interacting with a non-discoverable PCI device. When the GCD is not synced to the page table, we get the errors and security concerns listed above. Signed-off-by: Oliver Smith-Denny <osde@linux.microsoft.com>
* ArmPkg/GenericWatchdogDxe: Disable WDOG before the protocol installedNhi Pham2024-08-281-2/+2
| | | | | | | | | This moves the WatchdogDisable() function before the installation of the gEfiWatchdogTimerArchProtocolGuid protocol. It allows a platform to promptly carry out platform specific configurations, such as UEFI boot monitoring, by registering the protocol installation callback. Signed-off-by: Nhi Pham <nhi@os.amperecomputing.com>
* ArmPkg/ArmArchTimerLib: Drop pointless constructorArd Biesheuvel2024-08-012-25/+2
| | | | | | | | | | | | Drop the pointless constructor in ArmArchTimerLib, which does nothing useful, especially because AArch64 mandates the presence of the generic timer, and 32-bit ARM is mostly obsolete these days. To preserve the existing behavior in DEBUG builds when actually using the timer, move the ASSERT () on a non-zero frequency to the associated accessor helper function. Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
* ArmPkg: Retire ArmSmcPsciResetSystemLibArd Biesheuvel2024-07-273-180/+0
| | | | | | | This library is no longer used, and has been superseded by ArmPsciResetSystemLib based on ArmMonitorLib. So delete it. Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
* ArmPkg/ArmMonitorLib: Implement SMCCC protocol correctly and directlyArd Biesheuvel2024-07-255-40/+145
| | | | | | | | | | | | | | | | | | | | | | The SMCCC protocol stipulates the following: - on AARCH64, 18 arguments can be passed, and 18 values can be returned, via registers X0-x17; - on ARM, 8 arguments can be passed, and 8 values can be returned. This makes ArmSmcLib and ArmHvcLib as implemented currently unsuitable for use with SMCCC services in general, although for PSCI in particular, they work fine. The dependency on both ArmSmcLib and ArmHvcLib is also impractical because it requires every platform that consumes ArmMonitorLib to provide resolutions for each, even though most platforms will only ever need one of these (and the choice is made at compile time) So let's drop these dependencies, and re-implement the asm helpers from scratch. Note that the only difference is the actual instruction used -HVC vs SMC- and so all other code can be shared. Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
* ArmPkg: Convert PcdMonitorConduitHvc to FixedAtBuildArd Biesheuvel2024-07-252-6/+6
| | | | | | | | | | Feature PCDs and fixed-at-build PCDs are identical in concept, but the latter are accessible from assembler, whereas the former are not. So convert the SMCCC conduit selection PCD to fixed-at-build so we can make use of this in a subsequent patch. Continuous-integration-options: PatchCheck.ignore-multi-package Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
* ArmPkg: Introduce ResetSystemLib implementation based on ArmMonitorLibArd Biesheuvel2024-07-243-0/+209
| | | | | | | | | The ARM SMCCC specification stipulates that the conduit for ARM monitor calls can be determined by taking the conduit for PSCI calls. The converse is also true, and so we can implement ResetSystemLib for PSCI using ArmMonitorLib to choose between SMC and HVC instructions. Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
* ArmPkg: Disable AuditOnly mode for uncrustifyArd Biesheuvel2024-07-243-10/+7
| | | | | | | | Fix up a handful of uncrustify infractions and drop the AuditOnly override for uncrustify so we get the same uncrustify CI coverage as other packages. Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
* ArmPkg: Remove Deprecated ArmPsciResetSystemLibOliver Smith-Denny2024-07-233-123/+0
| | | | | | | | | | | ArmPsciResetSystemLib has been deprecated since commit b2c55e732888fd721f5235a820b1d1c45209992d in 2017. The lib itself has not been meaningfully updated in 10 years. This commit removes the library to complete the deprecation process and remove confusion over which library to use for resetting an ARM platform. Signed-off-by: Oliver Smith-Denny <osde@linux.microsoft.com>
* BaseTools: Move GnuNoteBti.bin to BaseToolsOliver Smith-Denny2024-07-231-0/+0
| | | | | | | | | This patch moves GnuNoteBti.bin from ArmPkg to BaseTools as it is used during the build by GCC. This removes an unnecessary dependency on ArmPkg from BaseTools and keeps build related files in BaseTools. Signed-off-by: Oliver Smith-Denny <osde@linux.microsoft.com>
* BaseTools: Move GccLto Files to BaseToolsOliver Smith-Denny2024-07-234-76/+0
| | | | | | | | | This moves the GccLto files from ArmPkg to BaseTools as they are files that are only used in the build. This removes an artificial dependency on ArmPkg from BaseTools and keeps build related files in BaseTools. Signed-off-by: Oliver Smith-Denny <osde@linux.microsoft.com>
* ArmPkg: ArmMmuLib: Add AARCH64 Memory Attribute Update Failure LogOliver Smith-Denny2024-07-231-0/+7
| | | | | | | | | | This adds logging in failure cases of SetMemoryAttributes. This is useful generally as if an attribute update fails, code will typically break, but is added in particular to make debugging incorrect bootloader usage of the Memory Attribute Protocol. This patch updates the AARCH64 UpdateRegionMapping. Signed-off-by: Oliver Smith-Denny <osde@linux.microsoft.com>
* ArmPkg: ArmMmuLib: Add ARM32 Memory Attribute Update Failure LoggingOliver Smith-Denny2024-07-231-0/+15
| | | | | | | | | | This adds logging in failure cases of SetMemoryAttributes. This is useful generally as if an attribute update fails, code will typically break, but is added in particular to make debugging incorrect bootloader usage of the Memory Attribute Protocol. This patch updates the ARM32 SetMemoryAttributes. Signed-off-by: Oliver Smith-Denny <osde@linux.microsoft.com>
* ArmPkg: CpuDxe: Add Memory Attribute Protocol LoggingOliver Smith-Denny2024-07-231-0/+21
| | | | | | | | | | | | | The memory attribute protocol is primarily used by bootloaders and there are many released bootloaders who use the protocol incorrectly. It is challenging to debug these situations because the bootloaders are generally black boxes and we silently fail on the FW side. This patch adds logging to some common memory attribute protocol failures in CpuDxe. Signed-off-by: Oliver Smith-Denny <osde@linux.microsoft.com>
* ArmPkg: delete PcdArmArchTimerFreqInHzLeif Lindholm2024-06-263-24/+2
| | | | | | | | | | | PcdArmArchTimerFreqInHz lets platforms override the architectural timer frequency, but this really isn't supported in hardware by anything lower than EL3. And we no longer support running edk2 at EL3. So drop this Pcd and update ArmArchTimerLib to unconditionally use ArmGenericTimerGetTimerFreq () instead. Signed-off-by: Leif Lindholm <quic_llindhol@quicinc.com>
* ArmPkg: drop manual ARM programming of generic timer frequencyLeif Lindholm2024-06-261-13/+0
| | | | | | | | | | | | | | | | | | | | There is a bit of legacy code in ArmArchTimerLib that attempts to program the generic timer based on a Pcd. This was only ever done for (32-bit) ARM in case the cpu lacked the Security Extensions (because if they were there, Secure firmware would be expected to have configured this before switching to Non-secure state). We don't support operation without Secure firmware anymore, but also the code has been incorrectly invoked only on platforms that *do* implement the Security Extensions since December 2020 and commit 0dd0d42ab5b6 ("ArmPkg: use helper to check for Security extensions in ArmArchTimerLib") As a result, edk2 has been overriding any programming done by Secure Firmware on ARM platforms. Which is wrong. Drop this programming in preparation for deleting the Pcd completely. Signed-off-by: Leif Lindholm <quic_llindhol@quicinc.com>
* ArmPkg/ArmLib ArmMmuLib: Drop support for EL3/MON executionArd Biesheuvel2024-06-197-163/+36
| | | | | | | | | | | | | | Drop logic from the ARM architectural support libraries that can only execute in EL3 on AArch64 or Monitor mode on 32-bit ARM. While early 32-bit ports (and even some early 64-bit code) included some monitor logic in EDK2, UEFI per the spec runs in non-secure execution contexts only, and secure monitor and other secure world duties are usually delegated to TF-A (Trusted Firmware for the A profile). Since there are no longer users of this code in EDK2 or the edk2-platforms tree, let's remove it from the core support libraries. Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
* ArmPkg/ProcessorSubClassDxe: Limit values to 0xFFJeff Brasen2024-06-171-3/+3
| | | | | | | | The CoreCount, EnabledCore and ThreadCount counts should be set to 0xFF if value is greater than 255 per the SMBIOS specification. Signed-off-by: Jeff Brasen <jbrasen@nvidia.com>
* ArmPkg/CompilerIntrinsicsLib: provide __ashlti3Jeff Brasen2024-06-152-0/+34
| | | | | | | | The compiler will use this function if it is left shifting a 128 bit value. Seen when updating OpenSSL. Signed-off-by: Jeff Brasen <jbrasen@nvidia.com>
* ArmPkg,MdePkg: Move ArmPkg/Chipset/Aarch64[|Mmu].h to MdePkgPierre Gondois2024-06-157-343/+5
| | | | | | | | | | | | | | Following the discussion at [1] and as the ArmLib relies on them, move ArmPkg/Chipset/Aarch64[|Mmu].h files to the MdePkg. Update the path to correctly include the moved files. [1] https://edk2.groups.io/g/devel/message/111566 Continuous-integration-options: PatchCheck.ignore-multi-package Signed-off-by: Pierre Gondois <pierre.gondois@arm.com> Acked-by: Ard Biesheuvel <ardb@kernel.org> Reviewed-by: Leif Lindholm <quic_llindhol@quicinc.com>
* ArmPkg,MdePkg: Move ArmPkg/Chipset/ArmV7[|Mmu].h to MdePkgPierre Gondois2024-06-157-452/+5
| | | | | | | | | | | | | | Following the discussion at [1] and as the ArmLib relies on them, move ArmPkg/Chipset/ArmV7[|Mmu].h files to the MdePkg. Update the path to correctly include the moved files. [1] https://edk2.groups.io/g/devel/message/111566 Continuous-integration-options: PatchCheck.ignore-multi-package Signed-off-by: Pierre Gondois <pierre.gondois@arm.com> Acked-by: Ard Biesheuvel <ardb@kernel.org> Reviewed-by: Leif Lindholm <quic_llindhol@quicinc.com>
* ArmPkg,MdePkg: move ArmLib.h to MdePkgLeif Lindholm2024-06-152-833/+0
| | | | | | | | | | | | | | | | | | | | | Related to https://bugzilla.tianocore.org/show_bug.cgi?id=4121, but not resolving it. (Nearly?) all of ArmPkg describes industry standard behaviour, and hence according to general rules, ought to live in MdePkg. Addressing this will however be a substantial task. Take a first step by moving the ArmLib interface definition to MdePkg, as discussed in https://edk2.groups.io/g/devel/topic/patch_v5_2_6/102725178 Continuous-integration-options: PatchCheck.ignore-multi-package Cc: Pierre Gondois <pierre.gondois@arm.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Sami Mujawar <sami.mujawar@arm.com> Cc: Zhiguang Liu <zhiguang.liu@intel.com> Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
* ArmPkg: Revert "Allow SMC/HVC monitor conduit to be specified at runtime"Ard Biesheuvel2024-06-102-6/+6
| | | | | | | | | This reverts commit 32460bb5b17b5caec29037a4e9462ca149a190e6, which is no longer needed as ArmVirtQemu now has its own special implementation for ArmMonitorLib. Continuous-integration-options: PatchCheck.ignore-multi-package Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
* ArmPkg: Set BIOS Segment to 0 in SMBIOS Type 0 tableRebecca Cran2024-06-032-2/+1
| | | | | | | According to the SMBIOS specification, on UEFI systems the BIOS Segment field in the Type 0 table isn't relevant and should be set to 0. Signed-off-by: Rebecca Cran <rebecca@bsdio.com>
* ArmPkg: Allow SMC/HVC monitor conduit to be specified at runtimeArd Biesheuvel2024-05-242-6/+6
| | | | | | | | | | | | | | | | | | ArmVirtQemu may execute at EL2, in which case monitor calls are generally made using SMC instructions instead of HVC instructions. Whether or not this is the case can only be decided at runtime, and so the associated PCD needs to be settable at runtime, if the platform definition chooses so. This implies a boolean PCD, given that a feature PCD is build-time configurable only. Cc: Leif Lindholm <quic_llindhol@quicinc.com> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org> Cc: Sami Mujawar <sami.mujawar@arm.com> Committed-by: Ard Biesheuvel <ardb@kernel.org> Signed-off-by: Doug Flick [MSFT] <doug.edk2@gmail.com> Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
* ArmPkg: Remove ArmCortexA9.hPierre Gondois2024-04-051-57/+0
| | | | | | | | | | | | | | | | | The last reference to ArmCortexA9.h in the edk2 repository was removed in: a913ad02479d ("ArmPlatformPkg: remove ArmVExpressPkg") The last reference to the file in the edk2-platforms repository was agreed to be dropped: https://edk2.groups.io/g/devel/message/115378 Cc: Leif Lindholm <quic_llindhol@quicinc.com> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org> Cc: Sami Mujawar <sami.mujawar@arm.com> Signed-off-by: Pierre Gondois <pierre.gondois@arm.com> Reviewed-by: Ard Biesheuvel <ardb@kernel.org> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
* ArmPkg: Remove ArmCortexA5x.hPierre Gondois2024-04-051-44/+0
| | | | | | | | | | | | | | | The last reference to ArmCortexA5x.h was removed in: commit: cffa7925a293 ("ArmPkg: remove ArmCpuLib header and implementations") There are no reference to the file in the edk2-platforms repository. Remove the file. Cc: Leif Lindholm <quic_llindhol@quicinc.com> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org> Cc: Sami Mujawar <sami.mujawar@arm.com> Signed-off-by: Pierre Gondois <pierre.gondois@arm.com> Reviewed-by: Ard Biesheuvel <ardb@kernel.org> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
* ArmPkg/ArmGicArchLib: Add macros for SPI and extended SPI rangesHimanshu Sharma2024-03-041-0/+14
| | | | | | | | | | | | | | | Taking reference from Table 2-1 of the Arm Generic Interrupt Controller Architecture Specification, Issue H, January 2022, add macros for the SPI and extended SPI ranges with the purpose of reusability on including the ArmPkg. Cc: Leif Lindholm <quic_llindhol@quicinc.com> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org> Cc: Sami Mujawar <sami.mujawar@arm.com> Signed-off-by: Himanshu Sharma <Himanshu.Sharma@arm.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com> Reviewed-by: Pierre Gondois <pierre.gondois@arm.com> Acked-by: Ard Biesheuvel <ardb@kernel.org>
* ArmPkg: Disable watchdog interaction after exiting boot servicesRebecca Cran2024-01-301-4/+17
| | | | | | | | | Update GenericWatchdogDxe to disable watchdog interaction after exiting boot services. Also, move the mEfiExitBootServicesEvent event to the top of the file with the other static variables. Signed-off-by: Rebecca Cran <rebecca@os.amperecomputing.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
* ArmPkg: Introduce global mTimerPeriod and remove calculationRebecca Cran2024-01-301-18/+14
| | | | | | | | | | The calculation of the timer period was broken. Introduce a global mTimerPeriod so the calculation can be removed. Since mTimerFrequencyHz is only used in one place, remove the global and make it a local variable. Do the same with mNumTimerTicks. Signed-off-by: Rebecca Cran <rebecca@os.amperecomputing.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
* ArmPkg: Update GenericWatchdogDxe to allow setting full 48-bit offsetRebecca Cran2024-01-302-7/+52
| | | | | | | | | | | | The generic watchdog offset register is 48 bits wide, and can be set by performing two 32-bit writes. Add support for writing the high 16 bits of the offset register and update the signature of the WatchdogWriteOffsetRegister function to take a UINT64 value. Signed-off-by: Rebecca Cran <rebecca@os.amperecomputing.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
* ArmPkg/ArmScmiDxe: Add PERFORMANCE_DESCRIBE_FASTCHANNEL supportPierre Gondois2024-01-292-14/+154
| | | | | | | | | | | | | | | | The PERFORMANCE_DESCRIBE_FASTCHANNEL Scmi command is available since SCMI v2.0 and allows to query information about the supported fast-channels of the Scmi performance protocol. Add support for this command. Also move SCMI_MESSAGE_ID_PERFORMANCE enum definition up in the file to use it in SCMI_PERFORMANCE_DESCRIBE_FASTCHANNEL function declaration. Reviewed-by: Leif Lindholm <quic_llindhol@quicinc.com> Acked-by: Ard Biesheuvel <ardb@kernel.org> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com> Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
* ArmPkg/ArmScmiDxe: Rename PERFORMANCE_PROTOCOL_VERSIONPierre Gondois2024-01-291-5/+8
| | | | | | | | | | | Rename PERFORMANCE_PROTOCOL_VERSION to reflect the different versions of the protocol. The macro is neither used in edk2 nor in edk2-platforms. Reviewed-by: Leif Lindholm <quic_llindhol@quicinc.com> Acked-by: Ard Biesheuvel <ardb@kernel.org> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com> Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
* ArmPkg/DebugPeCoffExtraActionLib: Drop RVCT and Cygwin supportArd Biesheuvel2023-12-141-69/+31
| | | | | | | | | | | | | | | | | The DebugPeCoffExtraActionLib implemention in ArmPkg contains some cruft that dates back to the original RVCT based ARM port, and support for RVCT was dropped a while ago. Also drop the handling of Cygwin specific paths, which is highly unlikely to be still depended upon by anyone. Tweak the logic so that only two versions of the DEBUG() invocations remain: one for __GNUC__ when PdbPointer is set, and the fallback that just prints the image address and the address of the entrypoint. Signed-off-by: Ard Biesheuvel <ardb@kernel.org> Reviewed-by: Leif Lindholm <quic_llindhol@quicinc.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
* ArmPkg/Drivers/CpuDxe: Use lower and upper attributesMichael Kubacki2023-11-281-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | GetNextEntryAttribute() is currently applying a 64-bit mask (TT_ATTRIBUTES_MASK) to a 32-bit descriptor value (EntryType). The original descriptor was 64 bits containing the upper and lower attributes which are included in TT_ATTRIBUTES_MASK. The PrevEntryAttribute parameter is also a UINT32, but passed to PageAttributeToGcdAttribute() for a UINT64 parameter where the function checks masks in the upper 32 bits of the integer value: PageAttributeToGcdAttribute (*PrevEntryAttribute) ... STATIC UINT64 PageAttributeToGcdAttribute ( IN UINT64 PageAttributes ) ... if ((PageAttributes & (TT_PXN_MASK | TT_UXN_MASK)) != 0) { GcdAttributes |= EFI_MEMORY_XP; } ... #define TT_PXN_MASK BIT53 #define TT_UXN_MASK BIT54 // EL1&0 This change removes UINT32 intermediary values. For EntryType, eliminating an unncessary cast. For EntryAttribute, preserving the upper and lower attributes for evaluation in PageAttributeToGcdAttribute(). This also resolves the following compiler warning previously present on Visual Studio for the assignment to the previously 32-bit local variables. '=': conversion from 'UINT64' to 'UINT32', possible loss of data Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com> Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
* ArmPkg/ArmMmuLib: Use function pointer typeMichael Kubacki2023-11-285-13/+33
| | | | | | | | | | | | | | | | | | | mReplaceLiveEntryFunc is a function pointer but assigned as a VOID* pointer: mReplaceLiveEntryFunc = *(VOID **)GET_GUID_HOB_DATA (Hob); This leads to the Visual Studio warning: nonstandard extension, function/data pointer conversion in expression This change updates the assignment to avoid using a data pointer and defines a type for the function pointer to succinctly and accurately refer to the type when it is used in the library code. Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com> Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
* ArmPkg/ArmLib: Add ArmHasEte () helper functionSami Mujawar2023-10-303-1/+30
| | | | | | | | | | | | | Create a helper function to query whether ID_AA64MFR1_EL1 indicates presence of the Embedded Trace Extension (ETE). This feature is only visible in AARCH64 state. Cc: Ard Biesheuvel <ardb+tianocore@kernel.org> Cc: Leif Lindholm <quic_llindhol@quicinc.com> Cc: Pierre Gondois <pierre.gondois@arm.com> Signed-off-by: Sami Mujawar <sami.mujawar@arm.com> Reviewed-by: Leif Lindholm <quic_llindhol@quicinc.com> Reviewed-by: Pierre Gondois <pierre.gondois@arm.com>
* ArmPkg/ArmLib: Add ArmHasTrbe () helper functionSami Mujawar2023-10-303-0/+31
| | | | | | | | | | | | | Create a helper function to query whether ID_AA64MFR1_EL1 indicates presence of the Trace Buffer Extension (TRBE). This feature is only visible in AARCH64 state. Cc: Ard Biesheuvel <ardb+tianocore@kernel.org> Cc: Leif Lindholm <quic_llindhol@quicinc.com> Cc: Pierre Gondois <pierre.gondois@arm.com> Signed-off-by: Sami Mujawar <sami.mujawar@arm.com> Reviewed-by: Leif Lindholm <quic_llindhol@quicinc.com> Reviewed-by: Pierre Gondois <pierre.gondois@arm.com>
* ArmPkg/ArmPsciMpServices: Add EFI_NOT_READY returnJeff Brasen via groups.io2023-10-181-1/+3
| | | | | | | | | | | Add EFI_NOT_READY return if the CPU can not be enabled because the processor is already on. This can occur in normal use if the CPU is still being turned off from a previous call when this is called again. Signed-off-by: Jeff Brasen <jbrasen@nvidia.com> Reviewed-by: Rebecca Cran <rebecca@bsdio.com>
* ArmPkg/ArmLib: Add ArmHasVhe () helper functionLeif Lindholm2023-09-203-0/+36
| | | | | | | | | | | | | Create a helper function to query whether ID_AA64MFR1_EL1 indicates presence of the Virtualization Host Extensions. This feature is only visible in AARCH64 state. Signed-off-by: Leif Lindholm <quic_llindhol@quicinc.com> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org> Cc: Sami Mujawar <sami.mujawar@arm.com> Cc: Marcin Juszkiewicz <marcin.juszkiewicz@linaro.org> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com> Tested-by: Marcin Juszkiewicz <marcin.juszkiewicz@linaro.org>
* ArmPkg: add EL2 virtual timer interrupt PcdLeif Lindholm2023-09-191-0/+1
| | | | | | | | | | | | | | PcdArmArchTimerHypVirtIntrNum, defaults to 28 as defined in Arm's Base System Architecture (current version DEN0094C 1.0C). Relevant for systems implementing FEAT_VHE, added in ARMv8.1. Signed-off-by: Leif Lindholm <quic_llindhol@quicinc.com> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org> Cc: Sami Mujawar <sami.mujawar@arm.com> Signed-off-by: Leif Lindholm <quic_llindhol@quicinc.com> Reviewed-by: Ard Biesheuvel <ardb@kernel.org>