summaryrefslogtreecommitdiffstats
path: root/MdePkg
Commit message (Collapse)AuthorAgeFilesLines
* MdePkg/DynamicStackCookieEntryPointLib: Drop execute-in-place versionsArd Biesheuvel11 days8-297/+6
| | | | | | | | | | | | | | SEC, PEI_CORE and PEIM type modules generally execute in place from memory that is not writable. This means that it is not generally possible to use an entrypoint implementation that stores a dynamically generated stack cookie into a global variable. For PEIMs in particular, there may be other options, such as a DEPEX on the permanent memory PPI, but the current dynamic implementations of the stack checking library entrypoints for PEI_CORE and PEIM modules must not be used as-is. So remove them, and update the readme accordingly. Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
* MdePkg/DynamicStackCookieEntryPointLib: Remove unused filesArd Biesheuvel11 days3-162/+0
| | | | | | | Remove some source files that were part of an earlier incarnation of DynamicStackCookieEntryPointLib but are no longer actually in use. Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
* MdePkg: Add Dynamic Stack Cookie SupportOliver Smith-Denny2025-02-0731-74/+1779
| | | | | | | | | | | | | | Adds dynamic stack cookies in the form of copies of the entry point libraries that use shared logic to update stack cookies at runtime. This relies on RDRAND on IA32/X64 and RNDR on AARCH64 to get a random number to apply to the stack cookie on module entry point. This simplifies the logic a platform must do to include stack check functionality. Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
* MdePkg: Move StackCheckLibStaticInit to StackCheckLibOliver Smith-Denny2025-02-079-8/+11
| | | | | | | | | | | | | | | 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>
* MdePkg: Add StandaloneMmCoreEntryPoint for X64Oliver Smith-Denny2025-02-075-0/+200
| | | | | | | | | | | | | Moves StandaloneMmCoreEntryPoint for X64 to MdePkg to live with the other entry point libs. It does not move the ARM64 version, as this was just moved to ArmPkg due to its heavy coupling with ArmPkg code. This will need to be revisited when dynamic stack cookie support is added to ARM64 StMM. This commit just adds the library in MdePkg, a separate commit will remove it from StandaloneMmPkg to make it easier to consume. Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
* MdePkg: Add StackCheckLib Library ClassOliver Smith-Denny2025-02-076-0/+87
| | | | | | | | | | | StackCheckLib defines the interface between a compiler and the stack checking code. It is being converted from a NULL library class to an actual library class to make it easier to use for a platform and be easier to define the expected interface with a compiler, so if there is a compiler change it can be tracked and caught. Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
* MdePkg: Centralize RNDR Register DefinitionOliver Smith-Denny2025-02-075-9/+8
| | | | | | | | | | RNDR is a standard register defined in the ARM ARM for AARCH64. Move the definition from BaseRngLib to AArch64.h. Furthermore, move the inclusion of this register definition to the ARM specific header file. Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
* MdePkg: Add PeiRngLibMichael Kubacki2025-02-064-0/+283
| | | | | | | | | | | | | REF:https://github.com/tianocore/edk2/issues/10529 Adds a new PEI library instance for RngLib that uses the RNG services provided by the RNG PPI. This library instance will add a DEPEX on gEfiRngPpiGuid on modules it links against. It can be used to allow PEIMs to get RNG support over a dynamic interface. Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
* MdePkg: Add Random Number Generator (RNG) PPIMichael Kubacki2025-02-062-0/+30
| | | | | | | | | | REF:https://github.com/tianocore/edk2/issues/10529 Adds a new PPI that serves the same purpose as EFI_RNG_PROTOCOL in DXE. This PPI can be produced by a PEIM to provide a dynamic interface to RNG services in PEI. Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
* MdePkg: Split RNG protocol definitionsMichael Kubacki2025-02-062-137/+160
| | | | | | | | | | | | Move the structure definition to a common location that can be shared with the RNG PPI. Move the algorithms to a common header that can be referenced independent of the protocol. Include the algorithm header in the interface header since the algorithms are directly used in the interface and for compatibility with existing code. Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
* MdePkg/IndustryStandard: add definitions for CXL CEDTYuquan Wang2025-02-033-0/+147
| | | | | | | This adds #defines and struct typedefs for the various structure types in the CXL Early Discovery Table (CEDT). Signed-off-by: Yuquan Wang <wangyuquan1236@phytium.com.cn>
* MdePkg: Add Hot pluggable resource attributeINDIA\sachinganesh2025-01-311-1/+2
| | | | | | PI 1.9 Specification defines new memory resource attribute for hot plug. Signed-off-by: Sachin Ganesh <sachinganesh@ami.com>
* MdePkg: Add UEFI 2.11 specification macroINDIA\sachinganesh2025-01-311-0/+1
| | | | | | Add macro for UEFI 2.11 Specification support Signed-off-by: Sachin Ganesh <sachinganesh@ami.com>
* MdePkg: Add Confidential Computing Extension for RISC-V AP-TEEINDIA\sachinganesh2025-01-311-3/+4
| | | | | | | UEFI 2.11 Specification adds RISC-V AP-TEE Confidential Computing Extension Signed-off-by: Sachin Ganesh <sachinganesh@ami.com>
* MdePkg: Add HotPlug Memory AttributeINDIA\sachinganesh2025-01-311-0/+10
| | | | | | UEFI 2.11 Specification defines new memory attribute for hot plug. Signed-off-by: Sachin Ganesh <sachinganesh@ami.com>
* MdePkg/BaseFdtLib: fix build with gcc 15Gerd Hoffmann2025-01-311-9/+13
| | | | | | | | gcc 15 switched to use the new ISO C23 standard by default. 'bool', 'true' and 'false' are keywords in C23, so do not try to define them. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* MdePkg: Add SM3 crypto algorithm GUID definitionLiming Gao2025-01-312-0/+39
| | | | | | | UEFI 2.11 has been published on https://uefi.org/specifications It defines SM3 crypto algorithm GUID and structure. Signed-off-by: Liming Gao <gaoliming@byosoft.com.cn>
* MdePkg/BasePeCoffLib: Remove DEBUG() statements from runtime codeArd Biesheuvel2025-01-291-2/+6
| | | | | | | | | | | | | PeCoffLoaderRelocateImageForRuntime() executes after boot services, and so it should not use DEBUG() prints at all, given that these may rely on MMIO mappings or other boot time facilities that are no longer available. So revert the changes in aedcaa3df8a2 ("MdePkg: Fix overflow issue in PeCoffLoaderRelocateImageForRuntime") that replaced code comments with DBEUG() statements. Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
* MdePkg: Fix Clang Build ErrorINDIA\sachinganesh2025-01-281-5/+2
| | | | | | | Fixed Clang build error introduced by unintialized variables in https://github.com/tianocore/edk2/commit/6278bbb89822c598fcd0637ae74174e367895c84 Signed-off-by: Sachin Ganesh <sachinganesh@ami.com>
* MdePkg: Use SafeIntLib to handle overflowINDIA\sachinganesh2025-01-261-7/+13
| | | | | | | Used SafeIntLib to handle the overflow check in PeCoffLoaderRelocateImage Signed-off-by: Sachin Ganesh <sachinganesh@ami.com>
* MdePkg: Fix overflow issue in PeCoffLoaderRelocateImageForRuntimeINDIA\sachinganesh2025-01-262-12/+14
| | | | | | | | | | RelocDir->Size is a UINT32 value, and RelocDir->VirtualAddress is also a UINT32 value. The current code in PeCoffLoaderRelocateImageForRuntime does not check for overflow when adding RelocDir->Size to RelocDir->VirtualAddress. This patch uses SafeIntLib to ensure that the addition does not overflow. Signed-off-by: Sachin Ganesh <sachinganesh@ami.com>
* MdePkg/Base: Don't error out on missing compiler CPP macrosArd Biesheuvel2025-01-171-2/+0
| | | | | | | | | | | | | | | STATIC_ASSERT is #define'd to a compiler specific value, based on built-in macros exposed by those compilers. If none of those are found, an #error is raised. This breaks the DTCPP build rule, which relies on the C preprocessor for header file inclusion and value substitution, but doesn't define any of the compiler macros we look for. So drop the error case. If STATIC_ASSERT is used without a definition, an error will be raised anyway. Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
* MdePkg: Add manageability status code defined in PI 1.9 Spec.Nickle Wang2025-01-171-0/+12
| | | | | | | | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4483 This change introduces EFI_COMPUTING_UNIT_MANAGEABILITY status code. EFI_COMPUTING_UNIT_MANAGEABILITY is created as one of the subclasses in computing unit class. EFI_COMPUTING_UNIT_MANAGEABILITY will be used in edk2 RedfishPkg and edk2-redfish-client RedfishClientPkg to report Redfish operation errors. It will also be used to report errors in edk2-platforms ManageabilityPkg. PI 1.9 specification, 6.4.1.4.9. Manageability Subclass: * https://uefi.org/specs/PI/1.9/V3_Status_Codes.html#manageability-subclass RFC: * https://edk2.groups.io/g/devel/message/105525 * https://edk2.groups.io/g/devel/message/105595 * https://edk2.groups.io/g/rfc/message/802 Signed-off-by: Nickle Wang <nicklew@nvidia.com>
* MdePkg/Include: Use _Static_assert for clang and GNUCMichael D Kinney2025-01-161-4/+6
| | | | | | | | | | | The clang compiler generates the following error error: use of 'static_assert' without inclusion of <assert.h> This is due to the use of the MSC Extension static_assert. Use _Static_assert instead for clang and GNUC compilers. Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
* MdePkg: Tpm2Acpi.h: Add defines for TPM2 ACPI table revision 5Sarah Walker2025-01-091-0/+3
| | | | Signed-off-by: Sarah Walker <Sarah.Walker2@arm.com>
* MdePkg: Update AtaPassThru header to UEFI 2.10AINDIA\sachinganesh2025-01-091-0/+4
| | | | | | | | UEFI 2.10A Specification has added a new error case to EFI_ATA_PASS_THRU_PROTOCOL.GetNextDevice API which handles port multiplier not being connected to the Port. Signed-off-by: Sachin Ganesh <sachinganesh@ami.com>
* MdePkg: Add UEFI Specification macrosINDIA\sachinganesh2025-01-091-15/+17
| | | | | | Add macros for UEFI 2.9 and UEFI 2.10 Specifications Signed-off-by: Sachin Ganesh <sachinganesh@ami.com>
* MdePkg: Clarify return status of FMP Protocol GetImage()INDIA\sachinganesh2025-01-091-1/+4
| | | | | | | Clarifed the return status of EFI_FIRMWARE_MANAGEMENT_PROTOCOL.GetImage(). As intended in UEFI 2.10 Specification. Signed-off-by: Sachin Ganesh <sachinganesh@ami.com>
* MdePkg: Update Default IP TTLINDIA\sachinganesh2025-01-091-1/+1
| | | | | | | | | Default IP TTL (Time to Live) has been updated in UEFI 2.10 A Specification. To comply with IANA recommendations. REF: https://www.iana.org/assignments/ip-parameters/ip-parameters.xhtml#ip-parameters-2 Signed-off-by: Sachin Ganesh <sachinganesh@ami.com>
* MdePkg: Update BASE_CR macro in Base.h for a Coverity errorPhil Noh2025-01-071-1/+1
| | | | | | | | Coverity is a static analysis tool. It detects the macro as an error (case to incompatible type, cert_exp39_c_violation). The update resolves the error and supports compliance with the static analysis tool. Signed-off-by: Phil Noh <Phil.Noh@amd.com>
* MdePkg: UefiDevicePathLib: Add Display Only format for Hard Drive.Huang Yuqi2024-12-251-4/+8
| | | | | | Ref: UEFI Specification Version 2.1 (Errata D) (released October 2008) Signed-off-by: Huang Yuqi <huangyq13@lenovo.com>
* MdePkg BootManagerPolicy.h: Define GUID for connecting storage devices.Chris Fernald2024-12-172-0/+15
| | | | | | | | | Some platforms require connecting storage media while booting to network, or require enumerating storage protocols that were not initially enumerated during BDS. This change adds a GUID to allow implementation of boot manager's ConnectDeviceClass to connect storage media. Signed-off-by: Aaron Pop <aaronpop@microsoft.com>
* MdePkg/Ufs.h: Update to UFS 4.0Christopher Zurcher2024-12-161-92/+278
| | | | Signed-off-by: Christopher Zurcher <christopher.zurcher@microsoft.com>
* MdePkg/IndustryStandard: Add UFS definitionsChristopher Zurcher2024-12-162-0/+1369
| | | | | | | | These files are direct ports from the (identical) files: MdeModulePkg\Bus\Ufs\UfsBlockIoPei\UfsHci.h MdeModulePkg\Bus\Ufs\UfsPassThruDxe\UfsPassThruHci.h Signed-off-by: Christopher Zurcher <christopher.zurcher@microsoft.com>
* Retrieve the USB class specific data from the configuration descriptorOleg Ilyasov2024-12-134-0/+669
| | | | | | | | | | | | | | | | If USB device reports class specific descriptors, it is currently the job of device driver to parse the configuration to find the class specific data. The new library functions parse the configuration descriptor and return class specific interface and class specific endpoint descriptors. Also, these new functions allow to retrieve the data from non-default alternate settings without performing a switch to this setting. Switching to the alternate setting currently implies the execution of UsbSetInterface function that performs USB control trnasfer. In some cases this switch is not desirable so the new functions UsbGetInterfaceDescriptorSetting and UsbGetEndpointDescriptorSetting come in handy. Signed-off-by: Oleg Ilyasov <olegi@ami.com>
* MdePkg: Synchronize UEFI2.11 LoongArch64 DebugSupportLib definitionChao Li2024-12-121-26/+37
| | | | | | | | | Synchronize the changes about LoongArch64 in section 18.2.5 of UEFI2.11. Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Zhiguang Liu <zhiguang.liu@intel.com> Signed-off-by: Chao Li <lichao@loongson.cn>
* MdePkg: Allows loading X64 and ARM64 OPROM images on LoongArch64Chao Li2024-12-121-1/+9
| | | | | | | | | | | Enable foreign images loading on LoongArch64 if the EDKII_PECOFF_IMAGE_EMULATOR_PROTOCOL is present. Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Zhiguang Liu <zhiguang.liu@intel.com> Signed-off-by: Chao Li <lichao@loongson.cn> Co-Authored-by: Dongyan Qian <qiandongyan@loongson.cn>
* MdePkg: ArmLib: Return UINT32 for ArmCacheWritebackGranuleKun Qin2024-12-111-1/+1
| | | | | | | | | | | | | ArmCacheWritebackGranule should not return value higher than MAX_UINT32. This change will allow the usage without architecture depenedent return size. Cc: Leif Lindholm <quic_llindhol@quicinc.com> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org> Cc: Sami Mujawar <sami.mujawar@arm.com> Signed-off-by: Kun Qin <kun.qin@microsoft.com>
* MdePkg: Add Google Mock Library for SafeIntLibTsunFeng2024-12-114-0/+1151
| | | | Signed-off-by: TsunFeng <v-tshuang@microsoft.com>
* MdePkg: Update StatusCodeDataTypeId.hRaymond Yang2024-12-111-0/+6
| | | | | | | Refine comments for EFI_STATUS_CODE_SPECIFIC_DATA_GUID . Add the structs defined in this file for EFI_STATUS_CODE_SPECIFIC_DATA_GUID to comment. Signed-off-by: Raymond Yang <yangrongwei@hotmail.com>
* MdePkg: Add new PCDs for IPMI SerialJohn Chung2024-12-091-0/+28
| | | | | | | | | This change adds new PCDs for IPMI Serial. Specification reference: https://www.intel.com/content/www/us/en/products/docs/servers/ipmi/ipmi-second-gen-interface-spec-v2-rev1-1.html Signed-off-by: John Chung <john.chung@arm.com>
* MdePkg/IndustryStandard: Add definitions for IPMI SerialJohn Chung2024-12-091-0/+66
| | | | | | | | | Add IPMI Serial definitions Specification reference: https://www.intel.com/content/www/us/en/products/docs/servers/ipmi/ipmi-second-gen-interface-spec-v2-rev1-1.html Signed-off-by: John Chung <john.chung@arm.com>
* DxeRngLib: GetRandomNumber spurious successDoug Cook (WINDOWS)2024-12-061-1/+4
| | | | | | | | | | | | | | | | | | | | The GetRandomNumber functions in DxeRngLib can return success without actually generating a random number. This occurs because there are code paths through `GenerateRandomNumberViaNist800Algorithm` that do not initialize the `Status` variable. - Assume mFirstAlgo == MAX_UINTN (no secure algorithms available) - Assume none of the secure algorithms have `Available` set. - Assume PcdEnforceSecureRngAlgorithms is TRUE. In this condition, the `Status` variable is never initialized, `Buffer` data is never touched. It is fairly likely that Status is 0, so we can return EFI_SUCCESS without writing anything to Buffer. Fix is to set `Status = error_code` in this code path. `EFI_SECURITY_VIOLATION` seems appropriate. Signed-off-by: Doug Cook <idigdoug@gmail.com>
* MdePkg: Improve comments on DebugLib PCDsDoug Cook (WINDOWS)2024-12-061-9/+29
| | | | | | | | DebugLib PCDs are very important, but they're confusing and not well-explained anywhere. Improve the documentation comments for them to explain how they work and how they relate to each other. Signed-off-by: Doug Cook <idigdoug@gmail.com>
* MdePkg/DxeRngLib: drop GLOBAL_REMOVE_IF_UNREFERENCEDGerd Hoffmann2024-12-041-1/+1
| | | | | | | | With mSecureHashAlgorithms being static this should not be needed any more. Suggested-by: Ard Biesheuvel <ardb@kernel.org> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* MdePkg/Include/IndustryStandard: Address C++ keyword collisionsMichael D Kinney2024-12-032-42/+3
| | | | | | | | | | | | | | | | | | | Update Tpm12.h and Tpm20.h and not use c++ reserved keywords operator and xor in C structures to support use of these include files when building with a C++ compiler. This patch removes the temporary use of anonymous unions and warning 4201 disable for VS20xx tool chains to complete the following field name changes: * operator -> operator_ * xor -> xor_ NOTE: This is a non-backwards compatible change to Tpm12.h and Tmp20.h. And consumers of these include files that access the "operator" or "xor" fields must be updated. Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
* MdePkg/Include/IndustryStandard: Add operator_ and xor_ field namesMichael D Kinney2024-12-032-4/+43
| | | | | | | | | | | | | | | Update Tpm12.h and Tpm20.h and not use c++ reserved keywords operator and xor in C structures to support use of these include files when building with a C++ compiler. This patch temporarily introduces an anonymous union to add operator_ and xor_ fields to support migration from the current field names to the new field names. Warning 4201 is disabled for VS20xx tool chains is a temporary change to allow the use of anonymous unions. Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
* MdePkg/AArch64: Add some missing MMU related constantsArd Biesheuvel2024-11-262-0/+2
| | | | | | | Add definitions for the non-global page tables descriptor attribute, as well as the E2H TCR bit, so that we can use them in the MMU code. Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
* MdePkg/BaseRngLib: Remove global variable for RDRAND state updatePhil Noh2024-11-221-20/+17
| | | | | | | | | | | | | | | | As a BASE type library, some PEI drivers could link and use it. Tcg2Pei.inf is an example. On edk2-stable202408 version, PEI drivers that link the library include the global variable of mRdRandSupported. The previous commit (c3a8ca7) that refers to the global variable actually is found to influence the link status. Updating the global variable in PEI drivers could affect the following issues. PEI ROM Boot : Global variable is not updated PEI RAM Boot : PEI FV integration/security check is failed To address these issues, remove the global variable usage. Signed-off-by: Phil Noh <Phil.Noh@amd.com>
* MdePkg/SmmPciExpressLib: Ensure gBS variable for the constructorPhil Noh2024-11-221-0/+1
| | | | | | | | | | | The PCD token, PcdPciExpressBaseAddress is referred in the constructor. If the token is defined as PcdsDynamic type, the PCD function that gets the token value uses the gBS service to locate PCD protocol internally. In this case, it is possible for the function to be called before initializing gBS variable, then cause a system hang due to gBS variable. Need to ensure the availability of gBS variable. Signed-off-by: Phil Noh <Phil.Noh@amd.com>