Commit Graph

4220 Commits

Author SHA1 Message Date
INDIA\sachinganesh c80f456ef4 MdePkg: Define PI Specification Version Macro
Defined PI specification version.
Used them to define revisions of PEI/DXE/MM system tables.

Cc: Felix Polyudov <felixp@ami.com>
Cc: Dhanaraj V <vdhanaraj@ami.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Signed-off-by: Sachin Ganesh <sachinganesh@ami.com>
2024-10-16 00:27:51 +00:00
Oliver Smith-Denny d99045f392 MdePkg: DebugLib: Check Signature in CR in Release Builds
The CR macro is used to access an enclosing structure from a
pointer within the structure. In DEBUG builds (i.e. when
MDEPKG_NDEBUG is not set and debug asserts are enabled), this
macro does signature validation checking to ensure that the
structure that has been found is the correct structure, based
on a signature passed in by the caller.

However, if MDEPKG_NDEBUG is set or debug asserts are disabled,
no signature validation is performed, meaning that CR may return
an invalid structure that the caller believes is valid and has had
signature validation on, causing undefined behavior (memory
corruption). We should where at all possible have defined behavior,
particularly in RELEASE builds, which are what typical platforms
will ship to consumers.

This patch updates CR to do the signature validation in all scenarios
to provide defined behavior from the macro. In the event of a
signature failure, CR will either 1) assert if !MDEPKG_NDEBUG and
debug asserts are enabled (existing behavior) or 2) return NULL to
indicate to the caller that signature validation failed.

There exist consumers today who already, erroneously, rely on this
behavior.

Another macro, BASE_CR, exists for callers who do not wish to perform
signature validation. Any code that wishes to avoid the signature
validation should move to this macro.

Signed-off-by: Oliver Smith-Denny <osde@linux.microsoft.com>
2024-10-08 00:31:58 +00:00
Heinrich Schuchardt 28dd588ca8 MdePkg/BaseLib: RISC-V: Add FPU CSR constants
* Define CSR fcsr
* Define bitmasks for vs and fs bit fields in the mstatus register

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2024-10-04 04:53:21 +00:00
Oliver Smith-Denny 7123940665 MdePkg: MdeLibs.dsc.inc: Introduce CUSTOM_STACK_CHECK_LIB Macro
In order to support a platform overriding StackCheckLibNull
provided by MdeLibs.dsc.inc, the CUSTOM_STACK_CHECK_LIB macro
is introduced. If this macro is defined, MdeLibs.dsc.inc will
not link StackCheckLibNull and it is expected that the platform
will link the version(s) of StackCheckLib that it requires.

The StackCheckLib README is also updated in this patch to
document the new macro and provide additional information.

Signed-off-by: Oliver Smith-Denny <osde@linux.microsoft.com>
2024-10-04 00:57:12 +00:00
Abdul Lateef Attar 0958b762fb MdePkg/IndustryStandard: Adds SPMI macros
Adds macro which defines SPMI table revision
and interface type as per the specification.

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
Cc: Sami Mujawar <Sami.Mujawar@arm.com>
Cc: Pierre Gondois <pierre.gondois@arm.com>
Signed-off-by: Abdul Lateef Attar <AbdulLateef.Attar@amd.com>
2024-10-03 08:58:50 +00:00
Doug Flick e73ec56942 MdePkg: Improving readability of CVE patch for PeCoffLoaderRelocateImage
This change adds parantheses to the if condition detecting overflow in
the PeCoffLoaderRelocateImage function to improve readability.

Follow on change for:
    REF!: https://github.com/tianocore/edk2/pull/6249

Signed-off-by: Doug Flick <dougflick@microsoft.com>
2024-10-02 19:45:12 +00:00
Leif Lindholm 9a1d54665c MdePkg: add various additional functions to BaseFdtLib
- FdtOffsetPointer
- FdtParentOffset
- FdtNodeOffsetByPhandle
- FdtStringListContains
- FdtGetAliasNameLen
- FdtPathOffsetNameLen
- FdtPathOffset

Signed-off-by: Leif Lindholm <quic_llindhol@quicinc.com>
2024-10-02 02:58:31 +00:00
Leif Lindholm 450a001c09 MdePkg: export additional Property functions from BaseFdtLib
- FdtSetPropU64
- FdtAppendProp
- FdtDelProp

Signed-off-by: Leif Lindholm <quic_llindhol@quicinc.com>
2024-10-02 02:58:31 +00:00
Leif Lindholm 5bad560935 MdePkg: export FdtAddressCells/FdtSizeCells from BaseFdtLib
Signed-off-by: Leif Lindholm <quic_llindhol@quicinc.com>
2024-10-02 02:58:31 +00:00
Leif Lindholm 9ba11ee131 MdePkg: export FdtOpenInto/FdtPack from BaseFdtLib
Signed-off-by: Leif Lindholm <quic_llindhol@quicinc.com>
2024-10-02 02:58:31 +00:00
Leif Lindholm 9dc9a4bae6 MdePkg: export some additional macros from BaseFdtLib
- FDT_TAGSIZE and FDT_MAX_NCELLS
- FdtGetHeader/FdtTotalSize
- FdtForEachSubnode

Signed-off-by: Leif Lindholm <quic_llindhol@quicinc.com>
2024-10-02 02:58:31 +00:00
Leif Lindholm 0cc9963cc9 MdePkg: align BaseFdtLib function prototypes
FdtLib.h uses CONST FDT_PROPERTY * return values for some wrapper
functions, but the implementation in FdtLib.c used to original
CONST struct fdt_property * instead of the exported typedef.

Import LibFdt.h in the implementation file and make the
implementation consistent with the declaration.

Signed-off-by: Leif Lindholm <quic_llindhol@quicinc.com>
2024-10-02 02:58:31 +00:00
Leif Lindholm 8292296893 MdePkg: add FdtStrerror wrapper to BaseFdtLib
Add a wrapper for fdt_strerror () and add the currently supported error
code defines from submodule.

Signed-off-by: Leif Lindholm <quic_llindhol@quicinc.com>
2024-10-02 02:58:31 +00:00
Leif Lindholm 8040fdbb8b MdePkg: consistently use "Property" in BaseFdtLib
There is currently a mix on functions named as Prop or Property.
The latter is in majority, and the better fit for tianocore coding style,
so rename FdtNodeOffsetByPropValue () and FdtSetProp () for consistency.

To avoid breaking bisect, change existing users in UefiPayloadPkg.

Continuous-integration-options: PatchCheck.ignore-multi-package
Signed-off-by: Leif Lindholm <quic_llindhol@quicinc.com>
2024-10-02 02:58:31 +00:00
Leif Lindholm bf7dbf6380 MdePkg,UefiPayloadPkg: improve BaseFdtLib memreserve helper style
FdtNumRsv and FdtGetMemRsv were added for the benefit of UefiPayloadPkg,
but their naming matches neither upstream libfdt nor tianocore coding
style rules. And there was scope for improvement of the doxygen
descriptions as well.

These functions currently have only one in-tree user, UefiPayloadPkg
FdtParserLib. So rename them more conformant
FdtGetNumberOfReserveMapEntries
and
FdtGetReserveMapEntry
and update the description comment blocks, at the same time as
updating the existing user.

Continuous-integration-options: PatchCheck.ignore-multi-package
Signed-off-by: Leif Lindholm <quic_llindhol@quicinc.com>
2024-10-02 02:58:31 +00:00
Doug Flick c95233b852 MdePkg: Fix overflow issue in BasePeCoffLib
The RelocDir->Size is a UINT32 value, and RelocDir->VirtualAddress is
also a UINT32 value. The current code does not check for overflow when
adding RelocDir->Size to RelocDir->VirtualAddress. This patch adds a
check to ensure that the addition does not overflow.

Signed-off-by: Doug Flick <dougflick@microsoft.com>
Authored-by: sriraamx gobichettipalayam <sri..@intel.com>
2024-09-30 18:12:30 +00:00
Mike Beaton 0aa93aecb7 MdePkg: Fix DEBUG_CODE and PERF_CODE macros for XCODE5
Without these changes, we get the error:

  error: variable '__DebugCodeLocal' set but not used

from the DebugLib.h DEBUG_CODE_BEGIN()/END() macros on XCODE5.

Similarly, in NOOPT builds only, we get:

  error: variable '__PerformanceCodeLocal' set but not used

from the PerformanceLib.h PERF_CODE_BEGIN()/END() macros on XCODE5.

It is important to note that the previous code involving a local
variable was intended to ensure correct behaviour of ; following
the macros, in particular that ; should be required:
 - https://github.com/tianocore/edk2/pull/6226#issuecomment-2364087866
 - https://github.com/tianocore/edk2/pull/6226#issuecomment-2364619759
This converted version repeats the
standard do { ... } while (FALSE) idiom (which is already used in
the END macro) to achieve the same affect.

The modified versions work on all toolchains.

Signed-off-by: Mike Beaton <mjsbeaton@gmail.com>
2024-09-27 16:57:36 +00:00
Dhaval 043045cd6e MdePkg: Add reserved mem fdt helpers
Devicetree defines a short hand way of defining reserved memory
ranges. Add APIs to access such nodes

Signed-off-by: Dhaval Sharma <dhaval@rivosinc.com>
2024-09-14 03:38:47 +00:00
Pierre Gondois 273f43cec9 MdePkg/DxeRngLib: Add gEfiRngAlgorithmArmRndr to the secure algorithms
DxeRngLib iterates over a list of secure algorithms before trying
to use the default algorithm provided by the Rng protocol. Add
gEfiRngAlgorithmArmRndr to this list. The algorithm represented by
this GUID is a secure DRBG of an unknown type, implemented by the
aarch64 RNDR instruction.
On AARCH64 platform, use the RNDR instruction as the first option
if it is available.

Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2024-09-13 14:34:21 +00:00
Pierre Gondois 5ed8f64647 MdePkg/DxeRngLib: Use PcdEnforceSecureRngAlgorithms for default algorithm
Use PcdEnforceSecureRngAlgorithms to allow using the Rng protocol
with the default algorithm. All previous call to the Rng protocol
are requesting a secure Rng algorithm.
Not specifying the Rng algorithm GUID to use is considered unsecure.

Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2024-09-13 14:34:21 +00:00
Pierre Gondois c04c4534c4 MdePkg/DxeRngLib: Refactor Rng algorithm selection
Add a library constructor which:
- locate the RNG prototocol and keep a reference to it in order to avoid
  locating it multiple times (for each random number generation)
- check which secure algorithm is available on the platform.
  This avoids to try each secure algorithm until finding one
  available for each random number generation call.

Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2024-09-13 14:34:21 +00:00
Pierre Gondois bc02b255a8 MdePkg: Move PcdEnforceSecureRngAlgorithms from NetworkPkg
The PcdEnforceSecureRngAlgorithms Pcd enforces the use of RNG
algorithms defined by the UEFI spec. To re-use the Pcd in other
packages and have a generic mean to control the usage of unsecure
algorithms, move the Pcd to the MdePkg.

Continuous-integration-options: PatchCheck.ignore-multi-package
Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2024-09-13 14:34:21 +00:00
Chun-Yi Lee 5c8bdb190f MdePkg DebugLib: Enable FILE NAME as DEBUG ASSERT for GCC12
Using __FILE_NAME__ is useful for reducing the size of debug image and
it's also good for reproducable builds. The gcc-12 also supported this
macro.

Ref: https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=1a9b3f04c11eb467a8dc504a37dad57a371a0d4c

This patch removed the checking of __clang__ when using __FILE_NAME__.

References: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=42579
Signed-off-by: Chun-Yi Lee <jlee@suse.com>
2024-09-13 12:45:29 +00:00
Leandro Becker 5262108822 MdePkg/Http11.h: Add HTTP header definitions.
Added HTTP header definitions for the following headers:
"Content-Range", "Last-Modified" and "If-Unmodified-Since"

Signed-off-by: Leandro Gustavo Biss Becker <lbecker@positivo.com.br>
2024-09-13 10:26:09 +00:00
Oliver Smith-Denny a9b38305b6 MdePkg: Remove Old Stack Check Lib Implementation
Now that the new stack check lib implementation is being used
everywhere, remove the old one.

Signed-off-by: Oliver Smith-Denny <osde@linux.microsoft.com>
2024-09-13 03:58:46 +00:00
Taylor Beebe 5000568969 MdePkg: Create Stack Check Lib
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>
2024-09-13 03:58:46 +00:00
Taylor Beebe ac43bbacde MdePkg: Create Stack Check Null Libs
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>
2024-09-13 03:58:46 +00:00
Oliver Smith-Denny 3a9da5f329 MdePkg: Add Stack Cookie Interrupt Vector PCD
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>
2024-09-13 03:58:46 +00:00
Ard Biesheuvel bec02ea9de MdePkg/ArmLib: Drop routines that maintain the entire D-cache
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>
2024-09-13 00:23:13 +00:00
Oliver Smith-Denny 8f74b95a21 MdePkg: Move CompilerIntrinsicsLib from ArmPkg
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>
2024-09-12 19:36:59 +00:00
Oliver Smith-Denny 734e71f428 MdePkg: Move AsmMacroIoLib*.h from ArmPkg
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>
2024-09-12 19:36:59 +00:00
Carsten Haitzler dfc242c2dd MdePkg/Acpi65.h: Add RAS2 table defs and signature as in ACPI 6.5
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>
2024-09-12 08:51:25 +00:00
Nhi Pham bacee5113e MdePkg/IpmiNetFnGroupExtension.h: Enforce structure alignment
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>
2024-09-12 04:19:18 +00:00
Ashraf Ali e41e728c16 Refactor SetMemWrapper to reduce binary size
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>
2024-09-11 21:50:20 +00:00
Ceping Sun 043615ae8b MdePkg/BaseLib: Add NULL version Tdx functions for other architectures
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>
2024-09-09 02:57:02 +00:00
Nhi Pham 9dabe005f0 MdePkg/IndustryStandard: Add definitions for IPMI Boot Progress Code
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>
2024-09-06 05:36:18 +00:00
Parth 1a89d9887f MdePkg:Update Return Error Macro in Base.h
Fixing RETURN_ERROR macro.
It is causing problem in Coverity Static analysis tool as we are directly converting the UINT value to INTN

Changing value from UINT to INTN might cause problem. Here we know that the values would not be in loss of data.
To increase the code quality and increase the static tool analysis score we have to change it

Cc: Jiangang He <jiangang.he@amd.com>
Cc: Neo Hsueh <Hong-Chih.Hsueh@amd.com>
Signed-off-by: Parth Thakkar <ParthRajeshkumar.Thakkar@amd.com>
2024-09-03 18:42:10 +00:00
Jason Zhao aebe9625c9 MdePkg/SmBios.h: Add new Processor Upgrade definition for SMBIOS Type4
The patch adds ProcessorUpgradeInvalid(0xFF) definition in Processor
Upgrade(Type 4, Offset 19h) for SMBIOS Type4 based on SMBIOS v3.8.0.
Processor Upgrade should be 0xFF when no other valid enumeration is
available.

Signed-off-by: Jason Zhao <jason.zhao@intel.com>
2024-09-03 14:19:55 +00:00
Jason Zhao 7f505d377b MdePkg/SmBios.h: Add new Socket Type for SMBIOS Type4
The patch adds new socket type(Type 4, Offset 32h) for
SMBIOS Type4 based on SMBIOS v3.8.0.

Signed-off-by: Jason Zhao <jason.zhao@intel.com>
2024-09-03 14:19:55 +00:00
John Baldwin a859f4fc03 MdePkg: Fix a buffer overread.
DevPathToTextUsbWWID allocates a separate copy of the SerialNumber
string to append a null terminator if the original string is not null
terminated.  However, by using AllocateCopyPool, it tries to copy
'Length + 1' words from the existing string containing 'Length'
characters into the target string.  Split the copy out to only copy
'Length' characters instead.

This was reported by GCC's -Wstringop-overread when compiling a copy
of this routine included in a library on FreeBSD.

Signed-off-by: John Baldwin <jhb@FreeBSD.org>
2024-09-03 04:09:19 +00:00
Ken Lautner 829f773e5c MdePkg: Add HTTP error 429
Add support for HTTP error 429 in the protocol .h file.

Signed-off-by: Kenneth Lautner <kenlautner3@gmail.com>
2024-09-02 21:17:25 +00:00
Saloni Kasbekar 4ef87f455b MdePkg: Add Reset Reason definitions
Add Reset Reason definitions defined in ACPI 6.5

Signed-off-by: Saloni Kasbekar <saloni.kasbekar@intel.com>
2024-08-31 18:19:17 +00:00
Ashraf Ali baecba68a3 MdePkg: Remove duplicate source from BaseMemoryLib INF files
Signed-off-by: Ashraf Ali <ashraf.ali.s@intel.com>
2024-08-31 06:00:04 +00:00
Chao Li f6092b5e2b MdePkg: Remove the old name of LoongArch CSR 0x20
Since all places where the old name was used for the LoongArch CSR 0x20
regiser have been changed to the new name, the old name is removed.

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>
2024-08-30 19:54:01 +00:00
Chao Li a066ca16d3 MdePkg: Rename the LoongArch CSR 0x20 register
Added a new name for CSR 0x20 because LoongArch SPEC has adjustd the CSR
0x20 register name.

Ref: LoongArch Reference Manual Vol 1, Seciton 7.1.
https://loongson.github.io/LoongArch-Documentation/LoongArch-Vol1-EN.html#control-and-status-registers

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>
2024-08-30 19:54:01 +00:00
Xiaoqiang Zhang f31aa47dee MdePkg: CoreValidateHandle Optimization
REF : https://bugzilla.tianocore.org/show_bug.cgi?id=4817

This commit is to add OrderedCollectionLib in MdePkg for DxeCore usage.

Cc: Ray Ni <ray.ni@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Signed-off-by: Andrew Fish <afish@apple.com>
Tested-by: Xiaoqiang Zhang <xiaoqiang.zhang@intel.com>
2024-08-30 11:42:41 +00:00
Ray Robles 7801fe428b MdePkg Nvme.h: Update fields from 1.4c specification.
Implement 1.4c specification update, specifically for
nvme sanitize capabilities.

Signed-off-by: Aaron Pop <aaronpop@microsoft.com>
2024-08-29 18:51:07 +00:00
Prachotan Reddy Bathi 2fe9b6c22f MdePkg:BaseArmTrngLibNull: Assert causing FVP stalling
FVP Base Revc doesn't support Trng.
ASSERT (FALSE) is causing the boot to stall.
Replacing ASSERT with ERROR log.

Signed-off-by: Prachotan Reddy Bathi <Prachotan.Bathi@arm.com>
2024-08-29 04:00:56 +00:00
Jiaxin Wu 82b1f69196 MdePkg/MdePkg.dec: Add gEfiMmEndOfPeiProtocol definition
This protocol is defined at PI Spec, Vol 4, section 4.
It's a MM Protocol published by a standalone MM Foundation
code if MM Foundation is loaded in PEI phase. This protocol
should be installed immediately after DXE IPL installs
EFI_PEI_END_OF_PEI_PHASE_PPI.

Signed-off-by: Hongbin1 Zhang <hongbin1.zhang@intel.com>
Co-authored-by: Jiaxin Wu <jiaxin.wu@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Wei6 Xu <wei6.xu@intel.com>
Cc: Dun Tan <dun.tan@intel.com>
Cc: Yuanhao Xie <yuanhao.xie@intel.com>
2024-08-28 15:25:27 +00:00
Linus Liu c3997e329a MdePkg: Fix build error after enable FDT support.
REF:https://bugzilla.tianocore.org/show_bug.cgi?id=4786

Disable some compiling warnings caused by submodule code.
Those can be removed later once issues fixed by submodule owner.

Signed-off-by: Linus Liu <linus.liu@intel.com>
2024-08-28 11:39:12 +00:00
Nhi Pham 90d0ec17e7 MdePkg/BaseFdtLib: Add FdtNodeOffsetByCompatible()
This adds FdtNodeOffsetByCompatible() to support finding the offset of
the first node with a given 'compatible' value after an offset.

Signed-off-by: Nhi Pham <nhi@os.amperecomputing.com>
2024-08-28 08:59:22 +00:00
Michael G.A. Holland ccda91c286 MdePkg: Define BrainpoolP512r1
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4837

Add BrainpoolP512R1 definition to TPM20.h

Signed-off-by: Michael G.A. Holland <michael.holland@intel.com>
2024-08-27 08:58:49 +00:00
Dat Mach 2bff58935f MdePkg: Tpm2Acpi.h: Max size for Parameters field
Define macro for the max size of the Start Method Specific Paramemeters
field.

Signed-off-by: Dat Mach <dmach@nvidia.com>
2024-08-08 01:52:47 +00:00
kuqin12 a29a9cce5f MdePkg/BaseLib: Add CRC16 CCITT False Implementation.
This change is added to incorporate basic implementation for
CRC16-CCITT-FALSE algorithm.

This function is useful for providing CRC16 value used in other data
structures that requires CRC16 value that complies with JEDEC SPD
requirements, i.e. BDAT table.

The lookup table is inherited from `https://crccalc.com/` and the result
values are also compared against this site.

Signed-off-by: Aaron Pop <aaronpop@microsoft.com>
2024-08-06 05:18:13 +00:00
joe 5ff99e0dab MdePkg /IoRemappingTable: Define additional IORT SMMUv3 node flags.
The flag for HTTU override in an SMMUv3 node in the IORT table is
defined in MdePkg/Include/IndustryStandard/IoRemappingTable.h as
a single bit. BIT0 or BIT1. The implementation of this field is
actually two bits, with the following mapings:

0b0000: Hardware update of the Access flag and dirty state are not
supported.
0b0001: Support for hardware update of the Access flag for Block and
Page descriptors.
0b0010: As 0b0001, and adds support for hardware update of the Access
flag for Block and Page descriptors. Hardware update of dirty state is
supported.

Referenced in Arm® System Memory Management Unit Architecture Specification
SMMU architecture version 3:
https://documentation-service.arm.com/static/63d7a2d5e4378a55c5e045b9

Signed-off-by: Aaron Pop <aaronpop@microsoft.com>
2024-08-04 09:21:06 +00:00
Rebecca Cran ecb0d1e2cb MdePkg: Fix some spelling mistakes found by cspell
When cspell is installed (via `npm install cspell`), CI checks for
spelling mistakes. There are currently a very large number of them: some
are genuine mistakes while others are words or acryonyms that cspell
doesn't know.

Fix a few of the misspellings in MdePkg.

Signed-off-by: Rebecca Cran <rebecca@bsdio.com>
2024-08-01 19:53:47 +00:00
Rohit Mathew 29619603d2 MdePkg/IndustryStandard: Add definitions for MPAM ACPI specification
Add definitions, macros and types for elements associated with MPAM
ACPI 2.0 specification.

Signed-off-by: Rohit Mathew <rohit.mathew@arm.com>
Cc: James Morse <james.Morse@arm.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Sami Mujawar <sami.mujawar@arm.com>
Cc: Thomas Abraham <thomas.abraham@arm.com>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
Acked-by: Liming Gao <gaoliming@byosoft.com.cn>
Reviewed-by: Pierre Gondois <pierre.gondois@arm.com>
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
2024-08-01 17:20:10 +00:00
Pierre Gondois 1715d67231 MdePkg/BaseRngLib: Prefer ArmReadIdAA64Isar0Reg() over ArmReadIdIsar0()
A ArmReadIdAA64Isar0Reg() function was recently added
to BaseLib. Use it instead of its ArmReadIdIsar0() equivalent,
which was private to the BaseRngLib library.

This also allows to avoid the confusion between the following
registers:
- ID_ISAR0_EL1: allows to probe for Divide instructions, Debug
  instructions, ...
- ID_AA64ISAR0_EL1: AARCH64 specific register allowing to probe
  for AESE, RNDR, ... instructions

Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2024-08-01 13:41:01 +00:00
Pierre Gondois 30e53f8b5e MdePkg/BaseLib: AARCH64: Add ArmReadIdAA64Isar0Reg()
To enable AARCH64 native instruction support for Openssl,
some interfaces must be implemented. OPENSSL_cpuid_setup()
allows to probe the supported features of the platform.

Add ArmReadIdAA64Isar0Reg() to read the AA64Isar0, containing
Arm64 instruction capabilities.
A similar ArmReadIdAA64Isar0() function is available in the ArmPkg,
but the CryptoPkg where OPENSSL_cpuid_setup will reside cannot rely
on the ArmPkg.

Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2024-08-01 13:41:01 +00:00
Pierre Gondois a72d93e163 MdePkg/BaseLib: AARCH64: Add ArmReadCntPctReg()
To enable AARCH64 native instruction support for Openssl,
some interfaces must be implemented. OPENSSL_rdtsc() requests
an access to a counter to get some non-trusted entropy.

Add ArmReadCntPctReg() to read system count.
A similar ArmReadCntPct() function is available in the ArmPkg,
but the CryptoPkg where OPENSSL_rdtsc will reside cannot rely
on the ArmPkg.

Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
2024-08-01 13:41:01 +00:00
Sachin Ganesh 85fad9912c MdePkg: Add PCI Express 6.0 Header Support
PCI Express 6.0 Specification introduces new registers and modifies
fields in existing ones.

This commit syncs PciE headers with the spec update.

Cc: Sergiy Yakovlev <sergiyy@ami.com>
Cc: Felix Polyudov <felixp@ami.com>
Cc: Dhanaraj V <vdhanaraj@ami.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Signed-off-by: Sachin Ganesh <sachinganesh@ami.com>
2024-08-01 08:23:18 +00:00
Michael Kubacki 7e5a5ae154 MdePkg/Acpi65.h: Fix GUID value
Commit c5ef1f0 added Acpi65.h by copying and updating text from
Acpi64.h. In that process, `0x624B` was updated to `0x6.5B` likely
due to a find/replace regex being used.

This restores the value.

Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
2024-08-01 13:07:06 +08:00
Abhishek Mainkar 621a30c676 MdePkg: IORT header update for IORT Rev E.f spec
The IO Remapping Table, Platform Design Document, Revision E.f, April
2024 (https://developer.arm.com/documentation/den0049/ef/) added CANWBS
Memory access flag.

Therefore, update the IORT header file to add support for CANWBS Memory
access flag.

Signed-off-by: Abhishek Mainkar <abmainkar@nvidia.com>
2024-07-30 13:32:06 +08:00
Herman Li 84fc1ec52f MdePkg: Update HEST Revision As 2
This modification come from ACPI 6.5 spec.
Besides, Starting with revision 2 of HEST, the Error Source Structures
must be sorted in Type ascending order for Error Source Structure
Types of less than 12.

Signed-off-by: Herman Li <herman.li@intel.com>
2024-07-30 03:20:59 +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
Dongyan Qian 0adc868b36 MdePkg/BaseLib: Optimize LOONGARCH64 csr usage
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4812

When the Select is out of support, use method break exception
instead of method return -1, avoid unknown errors caused by untimely
detection.

Cc: Chao Li <lichao@loongson.cn>
Signed-off-by: Dongyan Qian <qiandongyan@loongson.cn>
2024-07-17 19:33:57 +00:00
levi.yun 873f35625d MdePkg/IndustryStandard: Update EINJ information according to ACPI 6.5
ACPI 6.5 specification updates EINJ revision to 0x02 and
adds new Error Injection Actions
    - EINJV2_SET_ERROR_TYPE
    - EINJV2_GET_ERROR_TYPE

This patches updates EINJ information based on ACPI 6.5 specification.
Also, add missing Error Injection Actions too.

Cc: Zhiguang Liu <zhiguang.liu@intel.com>
Cc: Dandan Bi <dandan.bi@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
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-17 16:01:23 +00:00
levi.yun 5b429acec7 MdePkg/IndustryStandard: Add GET_EXECUTE_OPERATION_TIMINGS define
GET_EXECUTE_OPERATION_TIMINGS Error Injection Actions was added from
ACPI 6.1 specification.

Update Error Injection Action with the ACPI spec.

Cc: Zhiguang Liu <zhiguang.liu@intel.com>
Cc: Dandan Bi <dandan.bi@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
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-17 16:01:23 +00:00
levi.yun c2d6e2e18a MdePkg/IndustryStandard: Add SET_ERROR_TYPE_WITH_ADDRESS define
SET_ERROR_TYPE_WITH_ADDRESS Error Injection Actions was added from
ACPI 5.1 specification.

Update Error Injection Action with the ACPI spec.

Cc: Zhiguang Liu <zhiguang.liu@intel.com>
Cc: Dandan Bi <dandan.bi@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
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-17 16:01:23 +00:00
Shenbagadevi R dd58d1227c MdePkg: Added support for Smbios 3.7.0 Spec
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4563

As per Smbios 3.7.0 spec, added CXL 3.0 support in Type 9,
also added PMIC & RCD manufacturer ID and Revision information in Type17.

Cc: Sainadh N <sainadhn@ami.com>
Cc: Sundaresan S <sundaresans@ami.com>
Cc: Srinivasan M <srinivasanm@ami.com>
Cc: Ramesh R <rameshr@ami.com>

Signed-off-by: Shenbagadevi R <shenbagadevir@ami.com>
Reviewed-by: Gaoliming <gaoliming@byosoft.com.cn>
2024-07-17 12:46:40 +00:00
Dongyan Qian e32d24ef8c MdePkg: Define SMBIOS Protocol header according IndustryStandard
As the SMBIOS table types belong to the SMBIOS standard,
they were moved from the SMBIOS IndustryStandard into the
SMBIOS Protocol header with the EFI_-prefix.

Filling in definitions facilitates consistent use of header files:
EFI_SMBIOS_TYPE_TPM_DEVICE
EFI_SMBIOS_TYPE_PROCESSOR_ADDITIONAL_INFORMATION
EFI_SMBIOS_TYPE_FIRMWARE_INVENTORY_INFORMATION
EFI_SMBIOS_TYPE_STRING_PROPERTY_INFORMATION

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
Cc: Chao Li <lichao@loongson.cn>
Signed-off-by: Dongyan Qian <qiandongyan@loongson.cn>
2024-07-17 08:35:44 +00:00
Michael Kubacki 55b043732d MdePkg/UefiDebugLibDebugPortProtocol: ExitBootServicesCallback() static
REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3083

Since this is a library, make the function ExitBootServicesCallback()
STATIC to prevent the likelihood that it collides with other symbols.

Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
2024-07-16 23:17:04 +00:00
Dhaval b54bc983c6 MdePkg/Library: Add RISCV64 support to BaseRngLib
The ratified RISC-V crypto scalar extensions provide entropy bits via the
seed CSR, as exposed by the Zkr extension. The Zkr extension is ratified
and provides 16 bits of entropy seed when reading the SEED CSR.
Guarded by a RISCV64 Feature PCD, 64-bit random numbers can be
accumulated from the `seed` CSR. This driver is based on the driver in
the Linux kernel.

Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
Signed-off-by: Dhaval Sharma <dhaval@rivosinc.com>
Co-authored-by: Tim Wawrzynczak <tim@rivosinc.com>
2024-07-15 04:05:56 +00:00
Michael Kubacki 72d6e247b7 MdePkg/StmApi.h: Add SMM_REV_ID definition for STM header
The `SMM_REV_ID` is defined in the STM specification:
https://www.intel.com/content/www/us/en/content-details/671521/smi-transfer-monitor-stm-developer-or-user-guide.html?wapkw=stm,
section 10.1.1.

This adds it into the `StmApi.h` for potential STM usage.

Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
2024-07-12 03:40:55 +00:00
Sam Kaynor 960b6e8309 MdePkg: Adding EBBR EFI_CONFORMANCE_PROFILE_TABLE GUIDs
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4352

Adding additional GUIDs for the EFI_CONFORMANCE_PROFILE_TABLE
that are defined in the Embedded Base Boot Requirments (EBBR)
Specification.

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: Sam Kaynor <Sam.Kaynor@arm.com>
2024-07-10 06:13:07 +00:00
Sam Kaynor 3ad878fde5 MdePkg: Adding support for EFI_CONFORMANCE_PROFILE_TABLE
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4352

Adding support for EFI_CONFORMANCE_PROFILE_TABLE by adding an
associated header file and relevant GUIDs to MdePkg.dec as defined
in the UEFI 2.10 spec.
This table is needed to address changes being made within ShellPkg.

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: Sam Kaynor <Sam.Kaynor@arm.com>
2024-07-10 06:13:07 +00:00
Jiaxin Wu a1d94d9e6e MdePkg/StandaloneMmServicesTableLib: Support MM_CORE_STANDALONE
Support the module type for MM_CORE_STANDALONE

Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com>
2024-07-05 14:52:00 +00:00
Xiaoyao Li 9389b9a208 MdePkg/Tdx.h: Fix the order of NumVcpus and MaxVcpus
For TDCALL leaf TDG.VP.INFO, the bit 31:0 in R8 returns NUM_VCPUS and
bit 63:32 in R8 returns MAX_VCPUS. Current struct
TDCALL_INFO_RETURN_DATA defines them in wrong order.

Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Min Xu <min.m.xu@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Laszlo Ersek <lersek@redhat.com>
2024-07-04 23:05:22 +00:00
Alexey Kardashevskiy 3f28aa2fb0 MdePkg: Add AMD SEV features to PcdConfidentialComputingGuestAttr
PcdConfidentialComputingGuestAttr so far only contained an SEV mode bit
but there are more other features which do not translate to levels
such as DebugVirtualization or SecureTsc.

Add the feature mask and the DebugVirtualization feature bit to the PCD.

Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
Reviewed-by: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: Alexey Kardashevskiy <aik@amd.com>
---
Changes:
v4:
* s/CCAttrFeatureAmdSevDebugSwap/CCAttrFeatureAmdSevEsDebugVirtualization/

v2:
* expanded features mask
* added type mask
2024-07-04 20:39:26 +00:00
Alexey Kardashevskiy bc3a1ec2a2 MdePkg/Register/Amd: Define all bits from MSR_SEV_STATUS_REGISTER
For now we need DebugSwap but others are likely to be needed too.

Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
Reviewed-by: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: Alexey Kardashevskiy <aik@amd.com>
Changes:
v5:
* "rb" from Tom

v4:
* added more from April/2024 APM
2024-07-04 20:39:26 +00:00
Michael Kubacki 8430c69dc1 MdePkg/Nvme.h: Add missing NVMe capability descriptions
Most of the definitions in this file are currently well documented.

This adds documentation for a few missing fields in the NVMe
Controller Capabilities structure.

Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
2024-07-04 18:11:09 +00:00
Dionna Glaze ff1c4fa168 MdePkg: UefiTcgPlatform.h updates
The TCG_Sp800_155_PlatformId_Event2 and 3 structures both list the
platform model string twice, which is incorrect according to the
TCG PC Client Platform Firmware Profile.

Also add constant definitions for the locator types added in the
December 2023 revision.

Signed-off-by: Dionna Glaze <dionnaglaze@google.com>
2024-07-02 16:10:29 +00:00
Gerd Hoffmann 5bef25dca4 MdePkg/ArchitecturalMsr.h: add #defines for MTRR cache types
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2024-06-26 06:04:49 +00:00
Dongyan Qian 2fbaaa96d1 MdePkg/BaseLib: Fix an instruction write width error in LoongArch64
Cpucfg fetch is a 32-bit register, and AsmCpucfg's function
 declaration is a 32-bit address storage operation in BaseLib.h,
So, fix it by replacing stptr.d with stptr.w instrcution.

BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=4797

Cc: Chao Li <lichao@loongson.cn>
Signed-off-by: Dongyan Qian <qiandongyan@loongson.cn>
Co-authored-by: Chao Li <lichao@loongson.cn>
2024-06-26 00:52:39 +00:00
Rebecca Cran 57a890fd03 MdePkg: Check if compiler has __has_builtin before trying to use it
When building AArch64 code, cpp gets run with the `-undef` flag which on
Fedora 40 with gcc version 14.1.1 20240607 (Red Hat 14.1.1-5) causes
__has_builtin to be undefined. When running the check for
__builtin_unreachable in Base.h it causes an error
"missing binary operator before token "("".

Check that we have __has_builtin before trying to use it.

Signed-off-by: Rebecca Cran <rebecca@bsdio.com>
2024-06-20 01:55:03 +00:00
Ard Biesheuvel 95e220e95d MdePkg/ArmLib: Drop obsolete library declarations
Drop obsolete library declarations that are no longer (and should not
be) implemented in EDK2 or UEFI, given that they are specific to the
secure world.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
2024-06-19 17:25:11 +00:00
Paul Grimes 537a81ae81 MdePkg/Include: Update AMD specification references
Update AMD sepcification references (code comments) as part of a refactor of
MSR definitions and SEV-SNP related defines, which aims to remove
family-specific references (filename) as these defines are common to all
modern EPYC Processors.

Signed-off-by: Paul Grimes <paul.grimes@amd.com>
2024-06-18 05:45:15 +00:00
Paul Grimes a9def1ed9d MdePkg/Include: Update Msr.h header guard define
Update the Msr.h eader guard to comply with latest edk2 coding guidelines. This
change is part of a refactor of MSR definitions and SEV-SNP related defines,
which aims to remove family-specific references (filename) as these defines are
common to all modern EPYC Processors.

Signed-off-by: Paul Grimes <paul.grimes@amd.com>
2024-06-18 05:45:15 +00:00
Paul Grimes 17424fae4f MdePkg/Include: Remove deprecated AMD SEV-SNP header file
Delete Fam17Msr.h as part of a refactor of MSR definitions and SEV-SNP related
defines, which aims to remove family-specific references (filename) as these
defines are common to all modern EPYC Processors.

Signed-off-by: Paul Grimes <paul.grimes@amd.com>
2024-06-18 05:45:15 +00:00
Paul Grimes d40c71ef3f MdePkg/Include: Update reference to SEV-SNP header file
Update reference to SevSnpMsr.h as part of a refactor of MSR definitions and
SEV-SNP related defines. Remove family-specific references (filename) as these
defines are common to all modern EPYC Processors.

Signed-off-by: Paul Grimes <paul.grimes@amd.com>
2024-06-18 05:45:15 +00:00
Paul Grimes 6eaeef2c9b MdePkg/Include: Add AMD SEV-SNP header file
Add SevSnpMsr.h as part of a refactor of MSR definitions and SEV-SNP related
defines, which aims to remove family-specific references (filename) as these
defines are common to all modern EPYC Processors.

Signed-off-by: Paul Grimes <paul.grimes@amd.com>
2024-06-18 05:45:15 +00:00
Pierre Gondois cf323e2839 ArmPkg,MdePkg: Move ArmPkg/Chipset/Aarch64[|Mmu].h to MdePkg
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>
2024-06-15 03:57:14 +00:00
Pierre Gondois c68fb69dfe ArmPkg,MdePkg: Move ArmPkg/Chipset/ArmV7[|Mmu].h to MdePkg
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>
2024-06-15 03:57:14 +00:00
Leif Lindholm f2b9d5417d ArmPkg,MdePkg: move ArmLib.h to MdePkg
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>
2024-06-15 03:57:14 +00:00
Gerd Hoffmann 5e776299a2 MdePkg/X86UnitTestHost: set rdrand cpuid bit
Set the rdrand feature bit when faking cpuid for host test cases.
Needed to make the CryptoPkg test cases work.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2024-06-14 13:31:12 +00:00
Pedro Falcato c3a8ca7b54 MdePkg/BaseRngLib: Add a smoketest for RDRAND and check CPUID
RDRAND has notoriously been broken many times over its lifespan.
Add a smoketest to RDRAND, in order to better sniff out potential
security concerns.

Also add a proper CPUID test in order to support older CPUs which may
not have it; it was previously being tested but then promptly ignored.

Testing algorithm inspired by linux's arch/x86/kernel/cpu/rdrand.c
:x86_init_rdrand() per commit 049f9ae9..

Many thanks to Jason Donenfeld for relicensing his linux RDRAND detection
code to MIT and the public domain.

>On Tue, Nov 22, 2022 at 2:21 PM Jason A. Donenfeld <Jason@zx2c4.com> wrote:
  <..>
>    I (re)wrote that function in Linux. I hereby relicense it as MIT, and
>    also place it into public domain. Do with it what you will now.
>
>    Jason

BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=4163

Signed-off-by: Pedro Falcato <pedro.falcato@gmail.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
Cc: Jason A. Donenfeld <Jason@zx2c4.com>
2024-06-13 08:52:48 -07:00
Ray Ni d3b32dca06 MdePkg/BaseLib: Let CpuDeadLoop() be breakable in debugger
Starting from certain version of Visual Studio  C compiler (I don’t
have the exact version. I am using VS2019), CpuDeadLoop is optimized
quite well by compiler.
The compiler does not generate instructions that jump out of the loop
when the "Index" is non-zero.
It becomes harder/impossible for developers to break out of the dead-loop
in debugger.

The new version of CpuDeadLoop() compares a volatile global to a volatile
local. This forces 2 reads and a comparison on every loop iteration.
The local variable can be set to 1 to exit the loop without modifying the
global variable.
Using VS2019 with max opt enabled, The dead-loop can be exit by setting
Index to 1 in a debugger.

Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
2024-06-12 07:18:12 +00:00
Neo Hsueh 10cd8b45ce MdePkg: Remove non-ASCII characters from header file
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4775

Signed-off-by: Neo Hsueh <Hong-Chih.Hsueh@amd.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Jiangang He <jiangang.he@amd.com>
2024-06-05 12:22:53 +00:00
Aaron e2e09d8512 MdePkg: Add Ipmi Net Sensor Thresholds command defines.
Adding definitions for Ipmi Net Sensor Get/Set Thresholds commands and
structures as found in Ipmi specification v2.0

Signed-off-by: Aaron Pop <aaronpop@microsoft.com>
2024-06-05 03:35:32 +00:00
Nickle Wang c695e3182a MdePkg: Add Ipmi definitions header file for OEM net function
Add net function definitions for OEM/Non-IPMI group
request and response

Signed-off-by: Nickle Wang <nicklew@nvidia.com>
Cc: Abner Chang <abner.chang@amd.com>
Cc: Abdul Lateef Attar <AbdulLateef.Attar@amd.com>
Cc: Nick Ramirez <nramirez@nvidia.com>
Reviewed-by: Abner Chang <abner.chang@amd.com>
2024-05-30 08:13:01 +00:00