summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* DynamicTablesPkg: Add StackCheckLibNullOliver Smith-Denny2024-09-131-1/+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>
* CryptoPkg: Add StackCheckLibOliver Smith-Denny2024-09-132-7/+2
| | | | | | | Remove the old stack check lib now that MdeLibs.inc includes the new one. Signed-off-by: Oliver Smith-Denny <osde@linux.microsoft.com>
* ArmVirtPkg: Add Null Stack Check LibOliver Smith-Denny2024-09-131-3/+3
| | | | | | | Remove the old stack check lib now that MdeLibs.inc includes the new one. Signed-off-by: Oliver Smith-Denny <osde@linux.microsoft.com>
* ArmPlatformPkg: Add Null Stack Check LibOliver Smith-Denny2024-09-131-2/+3
| | | | | | | 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: 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>
* MdePkg: Create Stack Check LibTaylor Beebe2024-09-1312-0/+464
| | | | | | | | | | | | | | | | | | StackCheckLib contains the required functionality for initializing the stack cookie value, checking the value, and triggering an interrupt when a mismatch occurs. The stack cookie is a random value placed on the stack between the stack variables and the return address so that continuously writing past the stack variables will cause the stack cookie to be overwritten. Before the function returns, the stack cookie value will be checked and if there is a mismatch then StackCheckLib handles the failure. Because UEFI doesn't use the C runtime libraries provided by MSVC, the stack check code is written in assembly within this library. GCC and Clang compilers have built-in support for stack cookie checking, so this library only handles failures. Signed-off-by: Oliver Smith-Denny <osde@linux.microsoft.com>
* MdePkg: Create Stack Check Null LibsTaylor Beebe2024-09-1315-1/+252
| | | | | | | | | | | | | | | | | | | | | Add Null libs for Stack Check and Stack Check Failure Hook Lib that allow a platform to opt out of stack checks and the stack check failure hook lib. StackCheckLib allows implementation (or in this case null implementation) of stack checks on binaries. There is a Host Application specific version of this null lib because MSVC host applications must not be linked against our lib (so the file here is a no-op but that doesn't cause the build system to fail the build for not building a file for MSVC) as it links against the MSVC C runtime lib that provides the stack cookie definitions. GCC host applications do not link against such a C runtime lib and must be linked against our version. StackCheckFailureHookLib lets a platform do custom functionality when a stack check failure occurs (such as log it to a platform defined mechanism). The null lib simply returns. Signed-off-by: Oliver Smith-Denny <osde@linux.microsoft.com>
* MdePkg: Add Stack Cookie Interrupt Vector PCDOliver Smith-Denny2024-09-131-0/+3
| | | | | | | | | | | This patch adds a PCD allowing a platform to specify the interrupt vector to trigger on a stack check failure. On x86, this is an offset into the IDT. On ARM/AARCH64, this triggers a software interrupt that can be decoded to indicate this was a stack check failure. Signed-off-by: Oliver Smith-Denny <osde@linux.microsoft.com>
* UnitTestFrameworkPkg: Move common includes to their own fileBret Barkelew2024-09-133-12/+25
| | | | | | | | | | | | Previously, the UnitTestFrameworkPkgHost.dsc.inc included the entire UnitTestFrameworkPkgTarget.dsc.inc file. This is unnecessary for most configurations, so copy the relevant common components to a separate file. This is required for stack cookies so that we can have stack cookies on target based test apps but not on host base test apps. Signed-off-by: Oliver Smith-Denny <osde@linux.microsoft.com>
* NetworkPkg: PxeBcDhcp6GoogleTest: Fix Stack Smashing Unit TestOliver Smith-Denny2024-09-131-8/+17
| | | | | | | | | | | | PxeBcDhcp6GoogleTest's MultipleDnsEntries test started to fail with stack cookies added for host applications. Debugging this showed that the test was attempting to copy two UINT16s to a UINT8 Data[1] array allocated on the stack. This was moved to a heap based allocation for a UINT32 to accommodate the proper size. After this fix, the unit test passed with stack cookies enabled. 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/ArmLib: Drop routines that maintain the entire D-cacheArd Biesheuvel2024-09-131-18/+0
| | | | | | | | Cache maintenance on the D-cache hierarchy as a whole is not supported by the ARM architecture, so drop the routines from ArmLib that pretend to implement it. Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
* ArmVirtPkg: Fix unable to build with -D NETWORK_ENABLE=0Mike Beaton2024-09-122-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | https://bugzilla.tianocore.org/show_bug.cgi?id=4829 7f17a15 (2024/02/22) "OvmfPkg: Shell*.inc: allow building without network support" breaks building OVMF with `-D NETWORK_ENABLE=0`. Before this commit we could build OVMF e.g. with the following command in the OvmfPkg directory: ./build.sh -D NETWORK_ENABLE=0 After the commit the same command fails early with: /home/user/OpenSource/edk2/OvmfPkg/OvmfPkgX64.dsc(15): error F001: Pcd (gEfiNetworkPkgTokenSpaceGuid.PcdAllowHttpConnections) defined in DSC is not declared in DEC files referenced in INF files in FDF. Arch: ['X64'] This problem also applies in the ArmVirtPkg platforms which are modified here, but is currently masked by another issue, namely that these platforms incorrectly still include some network packages when most are disabled. (A fix for this was previously applied, for OvmfPkg Intel platforms only, by d933ec1 followed by 7f17a15 .) This commit was created at the same time as the commits resolving this issue in NetworkPkg and OvmfPkg. It makes conditional the Pcd references in ArmVirtPkg platforms which will become references to undefined Pcds as and when the other issue mentioned above is fixed. Signed-off-by: Mike Beaton <mjsbeaton@gmail.com>
* OvmfPkg: Fix unable to build OVMF with -D NETWORK_ENABLE=0Mike Beaton2024-09-127-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | https://bugzilla.tianocore.org/show_bug.cgi?id=4829 7f17a15 (2024/02/22) "OvmfPkg: Shell*.inc: allow building without network support" breaks building OVMF with `-D NETWORK_ENABLE=0`. Before this commit we could build OVMF e.g. with the following command in the OvmfPkg directory: ./build.sh -D NETWORK_ENABLE=0 After the commit the same command fails early with: /home/user/OpenSource/edk2/OvmfPkg/OvmfPkgX64.dsc(15): error F001: Pcd (gEfiNetworkPkgTokenSpaceGuid.PcdAllowHttpConnections) defined in DSC is not declared in DEC files referenced in INF files in FDF. Arch: ['X64'] The problem applies in Intel OvmfPkg platforms. Additionally, it applies in various other OvmfPkg platforms, but is masked buy another issue; namely that these platforms incorrectly still include some network packages when most are disabled. (A fix for that issue has previously been made, in OvmfPkg Intel platforms only, by d933ec1 followed by 7f17a15 .) This commit conditionally removes the undefined Pcd references in all OvmfPkg platforms which are now affected by this issue, and in all those which would be affected as and when the other issue mentioned above is fixed. Signed-off-by: Mike Beaton <mjsbeaton@gmail.com>
* NetworkPkg: Fix unable to build OVMF with -D NETWORK_ENABLE=0Mike Beaton2024-09-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | https://bugzilla.tianocore.org/show_bug.cgi?id=4829 7f17a15 (2024/02/22) "OvmfPkg: Shell*.inc: allow building without network support" breaks building OVMF with `-D NETWORK_ENABLE=0`. Before this commit we could build OVMF e.g. with the following command in the OvmfPkg directory: ./build.sh -D NETWORK_ENABLE=0 After the commit the same command fails early with: /home/user/OpenSource/edk2/OvmfPkg/OvmfPkgX64.dsc(15): error F001: Pcd (gEfiNetworkPkgTokenSpaceGuid.PcdAllowHttpConnections) defined in DSC is not declared in DEC files referenced in INF files in FDF. Arch: ['X64'] This commit conditionally removes the undefined Pcd reference in NetworkPkg which is part of this issue. Similar changes are needed in separate commits for OvmfPkg (and for ArmVirtPkg, since the issue also exists there, although masked by another issue). Signed-off-by: Mike Beaton <mjsbeaton@gmail.com>
* MdePkg: Move CompilerIntrinsicsLib from ArmPkgOliver Smith-Denny2024-09-1267-95/+19
| | | | | | | | | | | | | | | | | | | | 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-1268-98/+65
| | | | | | | | | | | | | | | | | | | 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>
* OvmfPkg/LoongArchVirt: Modify loongarch uefi firmware sizeXianglai Li2024-09-121-11/+1
| | | | | | | | | | | | | | | | | | | | After the loongarch flash block size is changed from 128K to 256K, qemu requires that the UEFI firmware size be aligned with the flash block size(256K). Otherwise, the firmware cannot be loaded, Use the following code to resolve the old firmware loading problem: mv QEMU_EFI.fd QEMU_EFI.fd-bak cat QEMU_EFI.fd-bak /dev/zero | head -c 16m > ./QEMU_EFI.fd mv QEMU_VARS.fd QEMU_VARS.fd-bak cat QEMU_VARS.fd-bak /dev/zero | head -c 16m > ./QEMU_VARS.fd For the new firmware, we refer to other architecture UEFI and set the UEFI firmware size to align with the flash block size(256K). So for this patch, we set the UEFI firmware size to 256K alignment. Cc: Bibo Mao <maobibo@loongson.cn> Cc: Chao Li <lichao@loongson.cn> Signed-off-by: Xianglai Li <lixianglai@loongson.cn>
* ShellPkg/AcpiView: RAS2 ParserCarsten Haitzler2024-09-124-0/+143
| | | | | | Add a new parser for the RAS2 Table as specified in ACPI6.5 Signed-off-by: Carsten Haitzler <carsten.haitzler@foss.arm.com>
* MdePkg/Acpi65.h: Add RAS2 table defs and signature as in ACPI 6.5Carsten Haitzler2024-09-121-0/+25
| | | | | | | Add EFI_ACPI_RAS2_PCC_DESCRIPTOR, EFI_ACPI_6_5_RAS2_FEATURE_TABLE and EFI_ACPI_6_5_ACPI_RAS2_FEATURE_TABLE_SIGNATURE. Signed-off-by: Carsten Haitzler <carsten.haitzler@foss.arm.com>
* MdeModulePkg: Enable Data Terminal at end of serialKen Lautner2024-09-121-0/+4
| | | | | | | | | When a Serial device resets, the Modem Control Register Data Terminal Ready and Request to Send need to be cleared also. Otherwise the registers will be left in their previous state, and the connected device will not be able to transmit data. Signed-off-by: Kenneth Lautner <kenlautner3@gmail.com>
* MdePkg/IpmiNetFnGroupExtension.h: Enforce structure alignmentNhi Pham2024-09-121-0/+8
| | | | | | | | The natural aligmenent seems to be failed on some cases. So, this patch intends to add the pack(1) to ensure the structure aligned with a one-byte boundary. Signed-off-by: Nhi Pham <nhi@os.amperecomputing.com>
* Refactor SetMemWrapper to reduce binary sizeAshraf Ali2024-09-1121-246/+392
| | | | | | | | | | | | Moved SetMemN API to a separate file to eliminate unnecessary inclusion of InternalMemSetMem64 and InternalMemSetMem32 APIs in driver binary. When the compiler linking the Object files it may not remove all the unused from NASM OBJs. This change is to reorganize the C files to minimize the impact of the NASM behavior resulting is code size reduction. Signed-off-by: Ashraf Ali <ashraf.ali.s@intel.com>
* MdeModulePkg/DxeCapsuleLibFmp: Check BootService Status to Use ESRT CacheJason1 Lin2024-09-113-31/+23
| | | | | | | | | | | | | | | | | - In c36414b131dfd0a1ca51f10f87a18955bc110ff2 change, it was introduced the ReadyToBoot event check to prevent the boot service got called in runtime to cause the issue. - In this patch introduced the ExitBootService event to replace it. It would be better to base on the BootService status to decide the source of ESRT table. - Based on the BootService availability to decide, - Exit : Use cache ESRT table in IF-condition - Not Exit: Use boot service to locate protocol in ELSE-condition Co-authored-by: Dakota Chiang <dakota.chiang@intel.com> Signed-off-by: Jason1 Lin <jason1.lin@intel.com>
* MdeModulePkg/DxeCapsuleLibFmp: Change the Event Notify to Cache ESRT TableJason1 Lin2024-09-111-8/+52
| | | | | | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4831 In this patch introduced the below changes, [1] Add the event of system resource table installed callback. - Register the event in DxeRuntimeCapsuleLibConstructor () - Unregister the event in DxeRuntimeCapsuleLibDestructor () [2] Migrate the event to update the module variable to cache ESRT table from ReadyToBoot to system resource table installed. [3] Add the condition to free the pool of buffer when the "mEsrtTable" is not NULL. Co-authored-by: Dakota Chiang <dakota.chiang@intel.com> Signed-off-by: Jason1 Lin <jason1.lin@intel.com>
* NetworkPkg/MnpDxe: Convert TX buffer allocation messages to DEBUG_VERBOSEMike Beaton2024-09-111-1/+1
| | | | | | | | | | Under normal operation, some 30 or so of these lines logged as DEBUG_INFO on first transmit. This is not relevant information for users of the driver, so convert these messages to VERBOSE. Signed-off-by: Mike Beaton <mjsbeaton@gmail.com>
* Support Report Status Code in the UefiPxe driver.yhsu32024-09-114-0/+16
| | | | | | | | | | | Report PXE error status via Status Code, with this design, it will be flexible to register a status code handler via gEfiRscHandlerProtocolGuid to output the customized error code to other telemetry service. The subclass code is `EFI_IO_BUS_IP_NETWORK` Signed-off-by: Ethan Hsu <Eathonhsu@gmail.com>
* StandaloneMmPkg/MmIpl: Correct unblocked memory regions attributeHongbin1 Zhang2024-09-111-27/+87
| | | | | | | | | | | | | | | When CPU smm profile feature was enabled, unblocked memory should not set logging attribute when building resource HOB. Signed-off-by: Hongbin1 Zhang <hongbin1.zhang@intel.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Ray Ni <ray.ni@intel.com> Cc: Star Zeng <star.zeng@intel.com> Cc: Jiaxin Wu <jiaxin.wu@intel.com> Cc: Wei6 Xu <wei6.xu@intel.com> Cc: Sami Mujawar <sami.mujawar@arm.com> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org> Cc: Supreeth Venkatesh <supreeth.venkatesh@arm.com>
* IntelFsp2Pkg: Support FSP API to save and restore page tableZhiguang Liu2024-09-1111-30/+382
| | | | | | | | | | | | | A potential issue may happen when FSP creates/changes page table while bootloader doesn't expect page table being changed in FSP. Current, FSP API support to save/restore stack, IDT and general purpose registers. Following the same pattern, add save/restore page table support to solve this issue. Note that this feature only impacts FSP API mode, and is controlled by PCD PcdFspSaveRestorePageTableEnable. For compatibility, the PCD default value is set as FALSE. Signed-off-by: Zhiguang Liu <zhiguang.liu@intel.com>
* .pytool/EccCheck: Trim leading path to modified directoryAbdul Lateef Attar2024-09-111-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The code changes in the patch is for trimming the leading path to the modified directory in the .pytool/EccCheck script. This is necessary when running Ecc on other repositories, such as edk2-platforms, where the platform package is located in a subfolder, like Platform/AMD/AmdPlatformPkg. The EccCheck script checks for modified directories and expects them to start with the package name. # # Skip directory names that do not start with the package being scanned. # if file_dir.split('/')[0] != pkg: continue However, if the package name is in a subfolder, the "git diff" command gives a relative path, like Platform/AMD, which causes the condition to be false. "M Platform/AMD/AmdPlatformPkg/Universal/LogoDxe/Logo.c" As a result, EccCheck does not happen on modified files. To fix this issue, the leading path needs to be trimmed so that it starts from the directory name. This change will not affect the existing check for the edk2 repository, where all package names are at the first level directory. Cc: Sean Brogan <sean.brogan@microsoft.com> Cc: Joey Vagedes <joey.vagedes@gmail.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Signed-off-by: Abdul Lateef Attar <AbdulLateef.Attar@amd.com>
* MdeModulePkg/VariableRuntimeDxe: Fix VariablePolicyProtocol PRODUCESMike Beaton2024-09-111-1/+1
| | | | | | | | | | | | If we search the codebase for &gEdkiiVariablePolicyProtocolGuid we can find two drivers which install this policy: VariableRuntimeDxe (installed in VariableDxe.c) and VariableSmmRuntimeDxe (installed in VariablePolicySmmDxe.c). The .inf file for VariableRuntimeDxe incorrectly lists the protocol as CONSUMES in the comment, so change this to PRODUCES. Signed-off-by: Mike Beaton <mjsbeaton@gmail.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>
* BaseTools: Remove Pip BaseToolsOliver Smith-Denny2024-09-1053-761/+1
| | | | | | | | | | | | | | | | | | | | | | | | BaseTools was moved out to a separate repo and consumed as a pip module by edk2 CI. This process has not led to the desired goals of doing so, so this patch removes the pip based BaseTools from edk2 CI. The original goal of moving BaseTools to a pip module was primarily to speed up the development process, as the old edk2 mailing list was slow. However, with edk2 moving to PRs, it now actually slows the BaseTools development process to have to do a PR in another repo, publish the module, and then make a PR in edk2 to consume the new BaseTools. It also holds up using the features in a new BaseTools in other PRs. There were other goals of moving, such as allowing projects to use the BaseTools outside of edk2. This can still be accomplished outside of this PR, this PR simply stops edk2 CI from using the pip module. Continuous-integration-options: PatchCheck.ignore-multi-package Signed-off-by: Oliver Smith-Denny <osde@linux.microsoft.com>
* NetworkPkg/DxeNetLib: Update misleading commentMike Beaton2024-09-091-4/+10
| | | | | | | | | | | | | | | Commit 6862b9d538d96363635677198899e1669e591259 makes more explicit the previous logic of the code anyway, which is that it is (and was) only a fatal error if all secure algorithms fail. However the comment updated by this commit seems somewhat incompatible with that change, and even with the previous code (which operated as now, just logging different error messages). This updates the comment to be more compatible with how the code operates. Signed-off-by: Mike Beaton <mjsbeaton@gmail.com>
* OvmfPkg/QemuFwCfgS3Lib: Disable S3 detection in TDVFCeping Sun2024-09-091-0/+5
| | | | | | | | | | | | | | | | | Refer to the section 2.1 of tdx-virtual-firmware-design-guide spec, APCI S3 is not supported in TDVF. Therefore, TDVF should not read the S3 status via fw_cfg and always set it as unsupported. spec: https://cdrdv2.intel.com/v1/dl/getContent/733585 Cc: Erdem Aktas <erdemaktas@google.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Min Xu <min.m.xu@intel.com> Cc: Gerd Hoffmann <kraxel@redhat.com> Cc: Elena Reshetova <elena.reshetova@intel.com> Signed-off-by: Ceping Sun <cepingx.sun@intel.com>
* MdePkg/BaseLib: Add NULL version Tdx functions for other architecturesCeping Sun2024-09-092-4/+5
| | | | | | | | | | | | | | Currently, the NULL version Tdx functions are only built for Ia32. In BaseLib, the others architectures also need such NULL version Tdx functions. Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Zhiguang Liu <zhiguang.liu@intel.com> Cc: Gerd Hoffmann <kraxel@redhat.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Min Xu <min.m.xu@intel.com> Signed-off-by: Ceping Sun <cepingx.sun@intel.com>
* UefiCpuPkg/PiSmmCpuDxeSmm: Remove RestrictedMemoryAccess check for MM CPUJiaxin Wu2024-09-066-31/+46
| | | | | | | | | | | | | | The PcdCpuSmmRestrictedMemoryAccess is declared as either a dynamic or fixed PCD. It is not recommended for use in the MM CPU driver. Furthermore, IsRestrictedMemoryAccess() is only needed for SMM. Therefor, there is no need for MM to consume the PcdCpuSmmRestrictedMemoryAccess. So, this patch is to add the SMM specific file for its own functions, with the change, the dependency of the MM CPU driver on PcdCpuSmmRestrictedMemoryAccess can be removed. Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com>
* UefiCpuPkg/PiSmmCpuDxeSmm: Clean mCpuSmmRestrictedMemoryAccessJiaxin Wu2024-09-061-7/+4
| | | | | | | | | | Currently, mCpuSmmRestrictedMemoryAccess is only used by the IsRestrictedMemoryAccess(). And IsRestrictedMemoryAccess() can consume the PcdCpuSmmRestrictedMemoryAccess directly. Therefore, mCpuSmmRestrictedMemoryAccess can be cleaned to simply the code logic. Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com>
* UefiCpuPkg/PiSmmCpuDxeSmm: Update IfReadOnlyPageTableNeededJiaxin Wu2024-09-061-18/+1
| | | | | | | | | | After the 9f29fbd3, full mapping SMM page table is always created regardless the value of the PcdCpuSmmRestrictedMemoryAccess. If so, SMM PageTable Attributes can be set to ready-only since there is no need to update it. So, this patch is to remove restricted memory access check when setting the SMM PageTable attributes. Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com>
* UefiCpuPkg/PiSmmCpuDxeSmm: Correct SetPageTableAttributes func usageJiaxin Wu2024-09-062-12/+8
| | | | | | | | | | | SetPageTableAttributes() will use the IfReadOnlyPageTableNeeded() to determine whether it is necessary to set the page table itself to read-only. And IfReadOnlyPageTableNeeded() has already token into account the status of IsRestrictedMemoryAccess(). Therefore, there is no need for an additional call to IsRestrictedMemoryAccess() before calling the SetPageTableAttributes(). Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com>
* UefiCpuPkg/PiSmmCpuDxeSmm: Deadloop if PFAddr is not supported by systemJiaxin Wu2024-09-061-1/+1
| | | | | | | Deadloop if PFAddr is not supported by system, no need check SMM CPU RestrictedMemory access enable or not. Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com>
* UefiCpuPkg/PiSmmCpuDxeSmm: Always save and restore CR2Jiaxin Wu2024-09-061-14/+4
| | | | | | | | | | | | | | | | | Following the commit 9f29fbd3, full mapping SMM page table is always created regardless the value of the PcdCpuSmmRestrictedMemoryAccess. Consequently, a page fault (#PF) that triggers an update to the page table occurs only when SmiProfile is enabled. Therefore, it is necessary to save and restore the CR2 register when SmiProfile is configured to be enabled. And the operation of saving and restoring CR2 is considered to be not heavy operation compared to the saving and restoring of CR3. As a result, the condition check for SmiProfile has been removed, and CR2 is now saved and restored unconditionally, without the need for additional condition checks. Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com>
* UefiCpuPkg/PiSmmCpuDxeSmm: Fix IsSmmCommBufferForbiddenAddress checkJiaxin Wu2024-09-062-1/+5
| | | | | | | | | | | | | | | | SmiPFHandler depends on the IsSmmCommBufferForbiddenAddress() to do the forbidden address check: For SMM, verifying whether an address is forbidden is necessary only when RestrictedMemoryAccess is enabled. For MM, all accessible address is recorded in the ResourceDescriptor HOB, so no need check the RestrictedMemoryAccess is enabled or not. This patch is to move RestrictedMemoryAccess check into SMM IsSmmCommBufferForbiddenAddress to align with above behavior. With the change, SmiPFHandler doesn't need to check the RestrictedMemoryAccess enable or not. Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com>
* UefiCpuPkg/PiSmmCpuDxeSmm: Avoid to access MCA_CAP if CPU does not supportJiaxin Wu2024-09-061-5/+3
| | | | | | Do not access MCA_CAP MSR unless the CPU supports the SmmRegFeatureControl Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com>
* MdeModulePkg/Core/Pei: Add error handling for Section Lengthragavarshinib2024-09-061-0/+12
| | | | | | | | | This patch breaks the section processing loop if an invalid section with zero SectionLength is encountered. Signed-off-by: Ragavarshini B <ragavarshinib@ami.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Dhanaraj V <vdhanaraj@ami.com> Cc: Sachin Ganesh <sachinganesh@ami.com>
* MdePkg/IndustryStandard: Add definitions for IPMI Boot Progress CodeNhi Pham2024-09-061-0/+69
| | | | | | | | | | This adds constants and structure definitions for Send/Get Boot Progress Code through IPMI, according to Server Base Manageability Requirements (SBMR) [1], Appendix F. [1] https://developer.arm.com/documentation/den0069 Signed-off-by: Nhi Pham <nhi@os.amperecomputing.com>
* BaseTools: Disable MSVC volatileMetadata for VS2019 and VS2022 for X64Ashraf Ali2024-09-061-6/+6
| | | | | | | | | | | | | | | Starting with Visual Studio 2019 version 16.10, the /volatileMetadata option is enabled by default when generating x64 code. This patch disables the /volatileMetadata option for x64 builds in both VS2019 and VS2022. We observed a slight increase in used space for the Firmware volumes in VS2019. Upon investigation, we found that VS2019 version 16.10 enabled this feature by default. Disabling /volatileMetadata helps reduce the used space by approximately 3.5KB by considering the 2 Firmware volumes (2KB uncompressed FV and 1.5KB of compressed FV) Signed-off-by: Ashraf Ali <ashraf.ali.s@intel.com>
* EmbeddedPkg/PrePiHobLib: Fix SetBootMode return valueVishal Oliyil Kunnil2024-09-051-1/+1
| | | | | | | After updating Doxygen, we can see that SetBootMode returns the BootMode instead of status code as it should, fix it to return status. Signed-off-by: Vishal Oliyil Kunnil <quic_vishalo@quicinc.com>
* EmbeddedPkg/PrePiHobLib: Align Doxygen comment between code and headerVishal Oliyil Kunnil2024-09-051-12/+5
| | | | | | | | The Doxygen comment for SetBootMode and GetBootMode in PrePiHobLib/Hob.c does not match declaration in PrePiLib.h. The C file has it wrong. Align the text to match the header. Signed-off-by: Vishal Oliyil Kunnil <quic_vishalo@quicinc.com>