Commit Graph

32873 Commits

Author SHA1 Message Date
Sami Mujawar cb3c2362cd DynamicTablesPkg: Introduce ObjectId to validate CmObject Parser Array
Add ObjectId to CM_OBJ_PARSER_ARRAY so that the code can validate
the entries in the Cm object parser array. Also introduce helper
macros to populate the Cm Object Parser Arrays.

Cc: Pierre Gondois <Pierre.Gondois@arm.com>
Cc: Yeo Reum Yun <YeoReum.Yun@arm.com>
Cc: AbdulLateef Attar <AbdulLateef.Attar@amd.com>
Cc: Jeshua Smith <jeshuas@nvidia.com>
Cc: Jeff Brasen <jbrasen@nvidia.com>
Cc: Girish Mahadevan <gmahadevan@nvidia.com>
Cc: Leif Lindholm <quic_llindhol@quicinc.com>
Cc: Meenakshi Aggarwal <meenakshi.aggarwal@nxp.com>
Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
Reviewed-by: Sunil V L <sunilvl@ventanamicro.com>
2024-07-29 13:44:55 +00:00
Sami Mujawar 991b70c0da DynamicTablesPkg: Replace ProcNodeIdInfo with EArmObjReserved29
The CM_ARM_PROC_NODE_ID_INFO was dropped by the patch at
"b2bbe3df5470 DynamicTablesPkg: Remove PPTT ID structure
from ACPI 6.4 generator" and the EArmObjProcNodeIdInfo was
made EArmObjReserved29.

Since ProcNodeIdInfo is no longer used drop the CM object
parser code from EArmObjProcNodeIdInfo and specify a null
entry for EArmObjReserved29.

Cc: Pierre Gondois <Pierre.Gondois@arm.com>
Cc: Yeo Reum Yun <YeoReum.Yun@arm.com>
Cc: AbdulLateef Attar <AbdulLateef.Attar@amd.com>
Cc: Jeshua Smith <jeshuas@nvidia.com>
Cc: Jeff Brasen <jbrasen@nvidia.com>
Cc: Girish Mahadevan <gmahadevan@nvidia.com>
Cc: Leif Lindholm <quic_llindhol@quicinc.com>
Cc: Meenakshi Aggarwal <meenakshi.aggarwal@nxp.com>
Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
Reviewed-by: Sunil V L <sunilvl@ventanamicro.com>
2024-07-29 13:44:55 +00:00
Pierre Gondois 6fb4e7b4ad DynamicTablesPkg/SsdtCpuTopology: Update function's parameter description
The parameters of CreateAmlProcessorContainer() were not
updated in:
commit 5fb3f5723a ("DynamicTablesPkg: Allow for specified CPU names")

This causes the EccCheck CI test to fail. Fix this.

Cc: Pierre Gondois <Pierre.Gondois@arm.com>
Cc: Yeo Reum Yun <YeoReum.Yun@arm.com>
Cc: AbdulLateef Attar <AbdulLateef.Attar@amd.com>
Cc: Jeshua Smith <jeshuas@nvidia.com>
Cc: Jeff Brasen <jbrasen@nvidia.com>
Cc: Girish Mahadevan <gmahadevan@nvidia.com>
Cc: Leif Lindholm <quic_llindhol@quicinc.com>
Cc: Meenakshi Aggarwal <meenakshi.aggarwal@nxp.com>
Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
Reviewed-by: Sunil V L <sunilvl@ventanamicro.com>
2024-07-29 13:44:55 +00:00
Sami Mujawar 0dacb43505 DynamicTablesPkg: Introduce an Arch Common Namespace
Introduce an Arch Common Namespace so that the common
architectural objects can be defined under this namespace
in the Configuration manager. Also rearrange the namespace
IDs so that the Arch Common Namespace has a value of 0x1,
the Arm Namespace ID has a value of 0x2, and the Custom/OEM
namespace ID has a value of 0xF. Also introduce a helper
macro to create configuration manager objects in the Arch
Common Namespace.

The Arch Common Namespace shall contain objects like
Serial Port, PCI Bus information etc. It must not contain
Architecture specific components e.g. GICC which is Arm
architecture specific component and therefore must be
defined in the Arm Namespace.

Cc: Pierre Gondois <Pierre.Gondois@arm.com>
Cc: Yeo Reum Yun <YeoReum.Yun@arm.com>
Cc: AbdulLateef Attar <AbdulLateef.Attar@amd.com>
Cc: Jeshua Smith <jeshuas@nvidia.com>
Cc: Jeff Brasen <jbrasen@nvidia.com>
Cc: Girish Mahadevan <gmahadevan@nvidia.com>
Cc: Leif Lindholm <quic_llindhol@quicinc.com>
Cc: Meenakshi Aggarwal <meenakshi.aggarwal@nxp.com>
Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Reviewed-by: Sunil V L <sunilvl@ventanamicro.com>
2024-07-29 13:44:55 +00:00
Dun Tan 43e2395c1b MdeModulePkg: fix issue caused by uninitialized variable
This patch is to fix issue caused by uninitialized local
variable in Pei/Variable.c.

In the fucntion CalculateHobVariableCacheSize(), the local
variable VARIABLE_STORE_INFO StoreInfo is used without
initialization. When the uninitialized variable is passed
to CalculateAuthVarStorageSize() and GetNextVariablePtr(),
the field StoreInfo->FtwLastWriteData might be a uninitialized
non-zero value. Then the code execution will access the
invalid address StoreInfo->FtwLastWriteData->TargetAddress.
This might cause issue.

So in this commit, the local variable VARIABLE_STORE_INFO
StoreInfo is initialized by a ZeroMem() before use.

Signed-off-by: Dun Tan <dun.tan@intel.com>
2024-07-29 06:43:27 +00:00
Dun Tan 51edd4830d UefiCpuPkg: fix issue when SMM profile is enabled
This commit is to fix smm code assert issue when SMM Profile
is enabled.

When SMM Profile is enabled, the function InitProtectedMemRange()
retrives MMIO ranges from GCD and store the MMIO ranges in the
mProtectionMemRange. When ReadyToLock, the function InitPaging()
modifies the page table based on the mProtectionMemRange. If the
MMIO ranges in mProtectionMemRange is not 4k aligned, code will
assert when modifying page table.

In this commit, we skip the MMIO ranges that BaseAddress and Length
are not 4k aligned when creating mProtectionMemRange. This will only
cause each access to the skipped MMIO range to be logged. In current
failure case on QEMU and QSP SimicsOpenBoard, the skipped MMIO range
is [0xFED00000, 0xFED00400] for HPET. Considering that the probability
of HPET MMIO range being accessed is very small in SMM, the solution
in this commit is acceptable and simple.

Signed-off-by: Dun Tan <dun.tan@intel.com>
2024-07-29 03:48:53 +00:00
Ard Biesheuvel ecb1d67775 BaseTools/tools_def CLANGDWARF: Always use -Oz in RELEASE mode
GCC5 and CLANGDWARF for IA32/X64 use -Os or -Oz as the optimization
level, which agressively optimizes for the smallest possible object
code.

On AARCH64, RISCV64 and ARM, we use -O3 instead, which results in
considerable image bloat, to the point where the Raspberry Pi 4 build in
edk2-platforms does not even build with -D SECURE_BOOT_ENABLE.

So let's align CLANGDWARF across all architectures, and use -Oz
throughout.

Note that O3 is still used for the linker, which build in LTO mode and
therefore performs some code generation as well. This is deliberate: LLD
does not support the Os/Oz optimization levels at all, and using Oz for
the compile pass is sufficient to reduce the code size substantially.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
2024-07-28 20:45:13 +00:00
Bret Barkelew b7f963d570 FmpDevicePkg: Assert on PcdFmpDeviceImageTypeIdGuid Size Mismatch
This patch adds an assert to FmpDxe.c to catch a platform
misconfiguration of PcdFmpDeviceImageTypeIdGuid.

Signed-off-by: Oliver Smith-Denny <osde@linux.microsoft.com>
2024-07-27 23:28:50 +00:00
Ard Biesheuvel 52eb643d07 ArmVirtPkg/ArmVirtQemu: Switch to generic ResetSystemLib
Retire the special ResetSystemLib implementation for the PEI phase on
virtual platforms, which has been superseded by the generic version
combined with a PEI-compatible implementation of ArmMonitorLib.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
2024-07-27 15:51:27 +00:00
Ard Biesheuvel 08c60b40da ArmVirtPkg: Implement DT-based ArmMonitorLib for the PEI phase
The TPM2 related PEIMs depend on ResetSystemLib too, and so in order to
be able to switch to the generic ArmPkg implementation which relies on
ArmMonitorLib, the latter library class requires a PEIM-compatible
implementation too.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
2024-07-27 15:51:27 +00:00
Ard Biesheuvel 358b19e6bf ArmVirtPkg: Move to generic ArmPsciResetSystemLib
Switch to the new, generic ArmPsciResetSystemLib implementation that
obtains the conduit using ArmMonitorLib, of which a version already
exists that determines the conduit by looking up the PSCI DT node.
This permits the removal of the ArmVirtPkg specific implementation of
ResetSystemLib, which essentially does the exact same thing, but in a
single library.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
2024-07-27 15:51:27 +00:00
Ard Biesheuvel 418b8176b8 ArmPkg: Retire ArmSmcPsciResetSystemLib
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>
2024-07-27 11:45:30 +00:00
Michael Kubacki 0343e75233 .github/request-reviews.yml: Switch to pull_request_target
This change simply moves the trigger to `pull_request_target`. The
rest of this message contains verbose details related to that.

`pull_request_target` is used instead of `pull_request` since the
default GitHub token cannot pick up write permissions with the
`pull_request` type on PRs from public forks. Write permission is
needed to add reviewrs. This was previously tested on an edk2 fork
where PRs were not from other public forks into the fork being used
for testing but directly on the fork itself.

Because `pull_request_target` runs the pull request in the context
of the base branch (not the PR branch) some logic needs slightly
modified. The main change is that the GitHub context will no longer
give the PR branch HEAD as the PR commit SHA (i.e.
`github.event.pull_request.head.sha`). The SHA will be the base
branch (`master`) SHA as that is what is checked out for the
workflow run. SO, the actual PR SHA is now fetched separately.

Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
2024-07-27 05:59:14 +00:00
Michael Kubacki 7868d509dd .azurepipelines: Disable the PR gate code coverage job
REF:https://bugzilla.tianocore.org/show_bug.cgi?id=4819

Code Coverage was added to PR pipelines in 89c5d90 and is currently
running on every pull request. It is run in a separate job that is
queued after all builds from the build matrix have completed. This
means it extends the entire pipeline run by placing it at the
beginning of the build queue right when it should be finished.

In turn, pipeline runs that should finish in 30 minutes are taking
over 3 hours.

This has a substantial impact on the developer efficiency of the
entire community. This patch disables code coverage until a more
sustainable solution can be swapped in.

Users can still get code coverage locally.

Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
2024-07-27 03:06:53 +00:00
Sean Brogan d7e36ccbbd MdeModulePkg: Add NVMe Long Delay Time Events
Fire an event if a long delay occurs when starting an NVMe device.
This can be used by platforms to draw pictures on the screen or
take other actions to notify a user or move boot forward.

Signed-off-by: Oliver Smith-Denny <osde@linux.microsoft.com>
2024-07-27 01:32:21 +00:00
George Liao 03ad59e631 MdeModulePkg: Consume SOC related ACPI table from ACPI Silicon HOB
REF : https://bugzilla.tianocore.org/show_bug.cgi?id=4787

If ACPI Silicon Hob has been found from entry of AcpiTableDxe driver,
that means SOC related ACPI tables been pass to the DXE phase by HOB.
Each SOC related ACPI tables will be install.

Signed-off-by: George Liao <george.liao@intel.com>
2024-07-26 17:12:18 +00:00
Michael Kubacki 6589843cc6 BaseTools/codeql: Update to CodeQL 2.18.1
Updates to the latest CodeQL version to resolve query dependencies.

Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
2024-07-26 08:17:11 +00:00
Michael Kubacki 6830074642 ShellPkg: Add missing apps
ShellPkg.dsc is missing a few applications in the package. They are
added to the DSC in this change to include the ShellPkg build.

Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
2024-07-26 05:35:08 +00:00
Dmitry Antipov ffc09b51cb MdeModulePkg: Remove EFI_MEMORY_* Defines
Now that all of the EFI_MEMORY_* defines live in the
EFI_MEMORY_TYPE enum, remove the old defines.

Signed-off-by: Oliver Smith-Denny <osde@linux.microsoft.com>
2024-07-26 03:08:20 +00:00
Dmitry Antipov c82ca2bb44 MdePkg: Move MEMORY_TYPE_* Defines to EFI_MEMORY_TYPE Enum
Per TCBZ2372, clang on Linux emits a warning if an enum-typed variable
is compared with a constant outside of the range of the enum. Such
comparisons are performed in multiple locations in DXE core on
variables of type EFI_MEMORY_TYPE. This patch moves the OEM and OS
reserved types into the EFI_MEMORY_TYPE enum itself to resolve this
issue and improve readability. This commit does this for the MdePkg
copy of this enum.

Signed-off-by: Oliver Smith-Denny <osde@linux.microsoft.com>
2024-07-26 03:08:20 +00:00
Dmitry Antipov 41426040da BaseTools: Move MEMORY_TYPE_* Defines to EFI_MEMORY_TYPE Enum
Per TCBZ2372, clang on Linux emits a warning if an enum-typed variable
is compared with a constant outside of the range of the enum. Such
comparisons are performed in multiple locations in DXE core on
variables of type EFI_MEMORY_TYPE. This patch moves the OEM and OS
reserved types into the EFI_MEMORY_TYPE enum itself to resolve this
issue and improve readability. This commit does this for the BaseTools
copy of this enum.

Signed-off-by: Oliver Smith-Denny <osde@linux.microsoft.com>
2024-07-26 03:08:20 +00:00
Ard Biesheuvel b1bce5e564 ArmPkg/ArmMonitorLib: Implement SMCCC protocol correctly and directly
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>
2024-07-25 14:41:09 +00:00
Ard Biesheuvel 43130ae403 ArmPkg: Convert PcdMonitorConduitHvc to FixedAtBuild
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>
2024-07-25 14:41:09 +00:00
HoraceX Lien 8665187b01 ShellPkg: Correct smbiosview strings for SMBIOS Type0
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4813

Some strings not match SMBIOS specification definition,
include uppercase and lowercase, wrong characters, extra words,...etc

Signed-off-by: HoraceX Lien <horacex.lien@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
2024-07-25 09:21:39 +00:00
Dongyan Qian 556640bcea UefiCpuPkg/MpInitLib: Reduce compiler dependencies for LoongArch
Structure assignment may depend on the compiler to expand to memcpy.
For this, we may need to add -mno-memcpy to the compilation flag.
Here, we reduce dependencies and use CopyMem for data conversion without
memcpy.

Cc: Ray Ni <ray.ni@intel.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Cc: Chao Li <lichao@loongson.cn>
Signed-off-by: Dongyan Qian <qiandongyan@loongson.cn>
Co-authored-by: Chao Li <lichao@loongson.cn>
2024-07-25 06:17:09 +00:00
Michael Kubacki 6271b617b4 .github/workflows/request-reviews.yml: Add workflow
Adds a new GitHub workflow to automatically add reviewers to pull
requests when they are opened, reopened, synchronized, and if a draft
pull request is marked as ready for review. The workflow will not
run on draft pull requests.

The workflow is meant to be simple to understand and modify, relying
on existing logic in GetMaintainer.py to determine the relevant
reviewers and using simple Python GitHub REST API wrappers with the
default GitHub token for authentication.

Future changes may optimize the workflow.

Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
2024-07-25 02:28:49 +00:00
Michael Kubacki 89a06a245b .github: Add GitHub helper python script
Adds a script that provides GitHub API helpers for workflows and
other GitHub automation in the repository.

Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
2024-07-25 02:28:49 +00:00
Michael Kubacki 3f0c4cee94 BaseTools/GetMaintainer.py: Add GitHub username argument
Adds a new `-g` parameter so that output will also include the GitHub
username.

This change uses a simple regular expression as opposed to directly
returning the original line from the file to make the extraction of
GitHub usernames more robust to other changes on the line in the
maintainers text file.

Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
2024-07-25 02:28:49 +00:00
Taylor Beebe a96d2a8f2d PrmPkg: Don't Set Access Attributes of Runtime MMIO Ranges
Passing in access attributes to SetMemorySpaceAttributes() will cause
the existing attributes to be overwritten. The MMIO region should have
the appropriate attributes applied during memory protection
initialization and the attributes of the memory space descriptor are
inaccurate. Don't pass in any CPU arch attributes so
SetMemorySpaceAttributes() doesn't subsequently call
gCpu->SetMemoryAttributes().

Signed-off-by: Oliver Smith-Denny <osde@linux.microsoft.com>
2024-07-24 21:13:52 +00:00
Ard Biesheuvel a7abb77c59 ArmPkg: Introduce ResetSystemLib implementation based on ArmMonitorLib
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>
2024-07-24 19:58:01 +00:00
Ard Biesheuvel a9c8c47d53 ArmPkg: Disable AuditOnly mode for uncrustify
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>
2024-07-24 10:21:47 +00:00
Dongyan Qian d4ae23b1e6 ShellPkg: Support parser of MADT for LoongArch64
Parse CORE_PIC, LIO_PIC, HT_PIC, EIO_PIC, MSI_PIC, BIO_PIC and LPC_PIC
tables in ACPI SPEC 6.5.

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

Cc: Zhichao Gao <zhichao.gao@intel.com>
Cc: Chao Li <lichao@loongson.cn>
Signed-off-by: Dongyan Qian <qiandongyan@loongson.cn>
Co-authored-by: Jinwei Wang <wangjinwei@loongson.cn>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
Reviewed-by: Chao Li <lichao@loongson.cn>
2024-07-24 08:00:05 +00:00
Zhiguang Liu 9bc7a36120 UefiCpuPkg: Removing redundant parameter in RestoreVolatileRegisters
Given that the second parameter can be universally set to TRUE across
all use cases, its removal simplifies the function interface and the
associated code paths.

Signed-off-by: Zhiguang Liu <zhiguang.liu@intel.com>
2024-07-24 02:47:34 +00:00
Zhiguang Liu 6fe3137fe5 UefiCpuPkg: Change RestoreVolatileRegisters second parameter
Analysis of the current usage patterns revealed that this parameter
should consistently set to TRUE.

Specifically, the parameter was found to be False in the following
scenarios:
1. During the initial volatile register setup for the first AP wake-up
in both the PEI and DXE phases. In these instances, the volatile
registers are pre-initialized in MpInitLibInitialize(),
and manually setting them to zero does not require altering the DR
state.
2. When switching the BSP, the new BSP does not synchronize the DR.
This behavior is now adjusted to ensure the DR state is synchronized,
aligning with a more logical and expected behavior when transitioning
BSP roles.

Signed-off-by: Zhiguang Liu <zhiguang.liu@intel.com>
2024-07-24 02:47:34 +00:00
Zhiguang Liu 3912aa3d32 UefiCpuPkg: Combine the code to set ApInitDone
In previoud commit, we remove the ApInitReconfig status. Now there
are only two status ApInitConfig and ApInitDone.
Only the very first waking up AP needs to set ApInitConfig status.
Therefore, if this is not the first wake up, set ApInitDone status

Signed-off-by: Zhiguang Liu <zhiguang.liu@intel.com>
2024-07-24 02:47:34 +00:00
Zhiguang Liu 9f06e5c702 UefiCpuPkg: Remove ApInitReconfig status
ApInitReconfig status is used to indicate that when AP wakes up, AP
need to restore volatile registers from BSP and use InitSipiSipi. Since
we handle the volatile registers well, we can use WakeUpByInitSipiSipi
flag to replace ApInitReconfig. Avoid using ApInitReconfig can simplify
code.

Signed-off-by: Zhiguang Liu <zhiguang.liu@intel.com>
2024-07-24 02:47:34 +00:00
Zhiguang Liu 4a0c77be68 UefiCpuPkg: Let AP always save/restore volatile registers
When enable stack guard, APs needs separate GDTs.
In current code, APs will lose their separate GDTs when AP get disabled
and later re-enabled. This is because when re-enabling AP, AP restores
volatile registers from BSP.
This patch updates the AP management to ensure that each AP saves and
restores its own set of volatile registers to solve this issue.

Key changes include:
- APs now maintain their own volatile register space, eliminating
dependency on the BSP's register state.
- Special handling is implemented for the first AP wake-up during the
PEI and DXE phases, where the volatile registers are synchronized from
the BSP.
- When switching BSP, remove manual handling the global variable
CpuMpData->CpuData[Index].VolatileRegisters. The manually handling
in previous code is because, old BSP may not save volatile registers
after the AP procedure and new BSP's VolatileRegisters buffer may be
used by other APs. Now, since AP always save/restore volatile registers
from their own buffer, no need to do the special handling.

Signed-off-by: Zhiguang Liu <zhiguang.liu@intel.com>
2024-07-24 02:47:34 +00:00
Zhiguang Liu 7fc08c68cd UefiCpuPkg: Sync the init timer count instead of current timer count
BSP should save and sync to AP the init timer count instead of
current timer count.
Also, BSP can check the init timer count to know if the local apic
timer is enabled. Only sync the setting when it is enabled.

Signed-off-by: Zhiguang Liu <zhiguang.liu@intel.com>
2024-07-24 02:47:34 +00:00
Zhiguang Liu 7033f359a9 UefiCpuPkg: Preserve Local APIC Timer Settings During BSP Switch
This update ensures the consistency of Local APIC timer settings across
all processors when a BSP switch occurs.
The Local APIC timer is utilized in two distinct scenarios:
1. As a delay mechanism within the timer library.
2. To generate periodic timer interrupts during the DXE phase.

For scenario 1, APs can simply inherit the initial settings from the
BSP. Even the local APIC timer setting is changed by BSP later, AP
can still use the old setting. Therefore, the code to save the Local
APIC timer can be moved to MpInitLibInitialize().

For scenario 2, because normal AP doesn't enable timer interrupt, we
only need to care SwitchBsp case. It is crucial that the periodic
timer interrupts remain operational after BSP is switched. To achieve
this, the Local APIC timer settings on old BSP are now preserved and
synced to new BSP.

Signed-off-by: Zhiguang Liu <zhiguang.liu@intel.com>
2024-07-24 02:47:34 +00:00
Zhiguang Liu 76f441c57c UefiCpuPkg: Also exchange CPU_AP_DATA in SortApicId()
CPU_AP_DATA contains AP's information such as CpuHealthy and
VolatileRegisters. Exchange the whole CPU_AP_DATA buffer instead
some fields to make code more simple.

Signed-off-by: Zhiguang Liu <zhiguang.liu@intel.com>
2024-07-24 02:47:34 +00:00
Oliver Smith-Denny f5901ff2a4 ArmPkg: Remove Deprecated ArmPsciResetSystemLib
ArmPsciResetSystemLib has been deprecated since commit
b2c55e7328 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>
2024-07-23 16:04:35 +00:00
Oliver Smith-Denny da591416ee BaseTools: Move GnuNoteBti.bin to BaseTools
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>
2024-07-23 15:07:41 +00:00
Oliver Smith-Denny 990bc4e562 BaseTools: Move GccLto Files to BaseTools
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>
2024-07-23 15:07:41 +00:00
levi.yun f96298d75c ShellPkg/Acpiview: Add HEST Parser
Add a new pareser for the Hardware Error Source Table (HEST).

The HEST table is used to describe a system's hardware error sources
to OSPM.

Cc: Zhichao Gao <zhichao.gao@intel.com>
Cc: Sami Mujawar <sami.mujawar@arm.com>
Cc: Pierre Gondois <pierre.gondois@arm.com>
Signed-off-by: levi.yun <yeoreum.yun@arm.com>
2024-07-23 11:07:42 +00:00
Dun Tan 32e7f9aa6c UefiCpuPkg: Revert "UefiCpuPkg/PiSmmCpuDxeSmm:Map SMRAM in 4K..."
This reverts commit ae59b8ba41.
The commit ae59b8ba41 was added to modify the GenSmmPageTable()
to map SMRAM in 4K page granularity. It was to urgently fix a
smm hang issue by avoiding page split in paging structures that
covers SMRAM range when SMI happens. But finally the smm hang
issue was root caused and fixed by commit 839bd17973.

Meanwhile a smm page table creation related issue was introduced
by commit ae59b8ba41:
In the function GenSmmPageTable(), the paging level for the range
outside SMRAM is depend on the Input parameter PagingMode. However,
the paging level for SMRAM range is depend on m5LevelPagingNeeded.
If the two paging levels are different, then the smm page table is
created incorrectly.

So let's revert the commit "UefiCpuPkg/PiSmmCpuDxeSmm:Map SMRAM
in 4K page granularity"

Signed-off-by: Dun Tan <dun.tan@intel.com>
2024-07-23 09:38:47 +00:00
Shenbagadevi R 46eb0ca29b ShellPkg: Changes to print Type17 in Smbiosview
Add changes to print PMIC and RCD details of Smbios Type17 in Shell
smbiosview command.

Cc: Gaoliming <gaoliming@byosoft.com.cn>
Cc: Sainadh N <sainadhn@ami.com>
Cc: Sundaresan S <sundaresans@ami.com>
Cc: Srinivasan M <srinivasanm@ami.com>
Cc: Ramesh R <rameshr@ami.com>
Cc: Karthika R <karthikar@ami.com>

Signed-off-by: Shenbagadevi R <shenbagadevir@ami.com>
Reviewed-by: Giri Mudusuru <girimudusuru@microsoft.com>
2024-07-23 08:31:44 +00:00
Oliver Smith-Denny c5ab17430b ArmPlatformPkg: PL031RealTimeClockLib: Set MMIO Memory XP
PL031RealTimeClockLib will clear EFI_MEMORY_XP if a platform
has set it for MMIO memory when it does not include that bit
in its SetMemoryAttributes call. This region is not intended
to be executed from and as such the lib should explicitly set
EFI_MEMORY_XP to this region.

Signed-off-by: Oliver Smith-Denny <osde@linux.microsoft.com>
2024-07-23 06:07:45 +00:00
Oliver Smith-Denny 1b8ca81133 ArmVirtPkg: KvmtoolRtcFdtClientLib: Set MMIO Memory NX
When setting memory attributes on its MMIO region,
KvmtoolRtcFdtClientLib will clear EFI_MEMORY_XP from
the region if a platform has it set. This MMIO region is
not intended to be executed from, so fix this by explicitly
setting EFI_MEMORY_XP on this region in the lib.

Signed-off-by: Oliver Smith-Denny <osde@linux.microsoft.com>
2024-07-23 06:07:45 +00:00
Oliver Smith-Denny e10de1cb03 ArmPkg: ArmMmuLib: Add AARCH64 Memory Attribute Update Failure Log
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>
2024-07-23 03:32:41 +00:00
Oliver Smith-Denny 74833ca459 ArmPkg: ArmMmuLib: Add ARM32 Memory Attribute Update Failure Logging
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>
2024-07-23 03:32:41 +00:00