275 Commits

Author SHA1 Message Date
Mike Beaton
9cdba17a1a IntrinsicLib: Move from CryptoPkg to MdePkg 2025-04-07 12:32:50 +03:00
Mikhail Krichanov
ba561ef7ff Fixed compilation of all packages tracked by CI after rebasing upon edk2-stable202405 tag. 2025-04-07 12:32:50 +03:00
Mikhail Krichanov
0d9d6f987b Fixed compilation of all packages tracked by CI after rebasing upon edk2-stable202311. 2025-04-07 12:32:50 +03:00
Mikhail Krichanov
992385e15e SecurePE: Defined new PcdImageProtectionPolicy. 2025-04-07 12:30:28 +03:00
Mikhail Krichanov
48b806f46f UE: Support UE generation and consumption. 2025-04-07 12:24:28 +03:00
Mikhail Krichanov
e46d356fc9 MdePkg/UefiImageLib: Support multi-format and multi-source architecture
Signed-off-by: Marvin Häuser <mhaeuser@posteo.de>
2025-04-07 12:24:27 +03:00
Mikhail Krichanov
20dd836214 MdeModulePkg/Core/Dxe: Integrate CPU Architectural producer
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3223

In the current design, memory protection is not available till CpuDxe
is loaded. To resolve this, introduce CpuArchLib to move the
CPU Architectural initialization to DxeCore.

Cc: Eric Dong <eric.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
Cc: Vitaly Cheptsov <vit9696@protonmail.com>
Signed-off-by: Marvin Häuser <mhaeuser@posteo.de>
2025-04-07 12:23:28 +03:00
Marvin Häuser
c4c7783b5c UefiPayloadPkg/UefiPayloadEntry: Return image destination size as UINT32 2025-04-07 12:18:22 +03:00
Mikhail Krichanov
6b652ab025 MdePkg/MemoryAllocationLib: Add Allocate(Aligned)CodePages 2025-04-07 12:16:51 +03:00
Mikhail Krichanov
a52efcc86a MdePkg: Introduce CommonMemoryAllocationLib 2025-04-07 12:13:58 +03:00
Mikhail Krichanov
5d894921a3 BaseTools: Replaced GenFw with ImageTool and MicroTool. 2025-04-07 12:13:57 +03:00
Mikhail Krichanov
09a0c067d0 SecurePE: Replaced old PE loader with Secure one. 2025-04-07 12:12:35 +03:00
Savva Mitrofanov
0c8a45ff10 UefiPayloadPkg/PchSmiDispatchSmm: Add missing EFIAPI modifiers
Added missing EFIAPI modifier to SmmSwDispatcher function which passed into gSmst->SmiHandlerRegister routine.

Signed-off-by: Savva Mitrofanov <sk.mitrofanov@ispras.ru>
Reviewed-by: Vitaly Cheptsov <cheptsov@ispras.ru>
2025-04-07 12:02:07 +03:00
Ajan Zhong
23007f7ae2 UefiPayloadPkg: Add StackCheckLib to fix FIT build issue
Commit efbf5ed moves StackCheckLibStaticInit to StackCheckLib,
and each SEC module has a dependency on StackCheckLib now.

Add StackCheckLib in FitUniversalPayloadEntry.inf to fix build
issue.

Signed-off-by: Ajan Zhong <ajan.zhong@newfw.com>
2025-02-11 19:09:23 +00:00
Oliver Smith-Denny
efbf5ed08c MdePkg: Move StackCheckLibStaticInit to StackCheckLib
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>
2025-02-07 02:23:11 +00:00
Chasel Chiu
0664c4e3b9 UefiPayloadPkg: Revert 4KB alignment of CLANGDWARF build
With the latest GccBase.lds combining with CLANG build, there is no
need to enforce 4KB alignment of in UPL CLANGDWARF build.

This reverts commit b3bfb8f22d43bd9577df85bec20e75eb2f659990.

Signed-off-by: Chasel Chiu <chasel.chiu@intel.com>
2025-02-03 17:00:46 +00:00
Chasel Chiu
7fd3c89ff4 UefiPayloadPkg: Update Elf segment/section syncup process
Original ELF segment/section syncup process having layout assumption
which has caused build failure when layout changing.

New process will parse both existing segments and sections firstly to
support different layout.

Signed-off-by: Chasel Chiu <chasel.chiu@intel.com>
2025-02-02 07:45:14 +00:00
Chasel Chiu
b3bfb8f22d UefiPayloadPkg: Add 4KB align to CLANGDWARF build.
After commit aca75d3 the PayloadEntry ELF header will miss dynamic
section which caused PEI_ASSERT in PayloadLoader rebasing code.

This commit adding common-page-size=0x1000 to CLANGDWARF_DLINK_FLAGS
to overcome the ELF header generation issue.

Signed-off-by: Chasel Chiu <chasel.chiu@intel.com>
2025-01-25 19:52:25 +00:00
Linus Liu
a2263cb201 UefiPayloadpkg Add Missing part back
Add back reg attribute of pcirootbridge

Signed-off-by: Linus Liu <linus.liu@intel.com>
2024-12-30 16:49:59 +00:00
Linus Liu
105a62d3ac UefiPayloadPkg :Update RetrieveMultiSegmentInfoFromHob
Merge the PCI root bridge with the same segment address within one.
PciSegment element.

UefiPayloadPkg/Library/PciSegmentInfoLibAcpiBoardInfo/PciSegmentInfoLibAcpiBoardInfo.c

Signed-off-by: Linus Liu <linus.liu@intel.com>
2024-12-30 16:49:59 +00:00
Ajan Zhong
f39b121066 UefiPayloadPkg: Align base address for ACPI region
In platform which support ACPI 2.0 only, the base address of ACPI region
is not page aligned. This unalinged base address leads to failure at
BuildMemoryAllocationHob when parsing ACPI node in FdtParserLib, before
building gUniversalPayloadAcpiTableGuid GUID HOB.

Align base address of ACPI region down to EFI_PAGE_SIZE to make sure
base address always aligned.

Signed-off-by: Ajan Zhong <ajan.zhong@newfw.com>
2024-12-25 04:11:32 +00:00
Ajan Zhong
e8c7b14da0 UefiPayloadPkg: Set PixelsPerScanLine property in GraphicInfo HOB
PixelsPerScanLine is required in some UEFI capable OS distribution.
To align with simple-framebuffer definition in kernel Documentation:
devicetree/bindings/display/simple-framebuffer.txt, no property node
will be introduced for PixelsPerScanLine.

Set value of PixelsPerScanLine to HorizontalResolution, as they are
identical in most cases.

Signed-off-by: Ajan Zhong <ajan.zhong@newfw.com>
2024-12-24 03:18:31 +00:00
Guo Dong
4af5849556 UefiPayloadPkg: Fix the issue detected by Uncrustify
Signed-off-by: Guo Dong <guo.dong@intel.com>
2024-12-19 02:25:24 +00:00
Guo Dong
c5811ef1b3 UefiPayloadPkg: Enhance universal payload build
If there is no relocation in the payload it would build failure.
This will fix the build failure.

Signed-off-by: Guo Dong <guo.dong@intel.com>
2024-12-19 02:25:24 +00:00
Guo Dong
72b65146bf UefiPayloadPkg: Enhance Universal payload serial port node
Current implementation only supports serial port sub-node under
PCI root bridge node.

This enhancement support serial port node regardless it is under
root node or PCI root bridge node using a single FDT passing function.

Signed-off-by: Guo Dong <guo.dong@intel.com>
2024-12-19 02:25:24 +00:00
Ajan Zhong
694cc9f100 UefiPayloadPkg: Update ReadUnaligned64 in ACPI parsing
According to ACPI Specification, 64 bit physical address of the XSDT
provides indentical functionality to the RSDT but accommodates physical
address of description headers that are larger than 32 bits.

In this case physical address of XSDT table is 64 bit aligned, however
size of ACPI description tabled header is not 64 bit aligned. It leads
to the entry of other description headers are not 64 bit aligned. In
AARCH64 architecture, deference non-aligned 64 bit address to fetch
64-bit data will trigger Alignment fault. Use ReadUnaligned64 method
to fix this unaligned data access issue.

Signed-off-by: Ajan Zhong <ajan.zhong@newfw.com>
2024-12-09 02:23:28 +00:00
Ajan Zhong
ddb4ea681b UefiPayloadPkg: Update FDT parser logic for unaligned data access
If alignment check is enabled in AARCH64 platform, FDT parser might
dereference non-aligned 64-bit address to fetch 64-bit data.
Use unaligned data read to avoid triggering unaligned data access.

Signed-off-by: Ajan Zhong <ajan.zhong@newfw.com>
2024-12-09 02:23:28 +00:00
Ajan Zhong
2d6d03056a UefiPayloadPkg: Add AARCH64 support on FdtParserLib
Add AARCH64 support on FdtParserLib.

Signed-off-by: Ajan Zhong <ajan.zhong@newfw.com>
2024-12-09 02:23:28 +00:00
Ning Feng
0f3867fa6e UefiPayloadPkg/UefiPayloadEntry: Fix PT protection in 5 level paging
REF:https://bugzilla.tianocore.org/show_bug.cgi?id=4873

Currently the function does not cover the 5 level paging case. it will
casued pagetable protection region set incorrectly. This patch do the
enhancemant and with the patch protection region has been set correctly.

Signed-off-by: Ning Feng <ning.feng@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
2024-11-17 20:52:10 +00:00
Oliver Smith-Denny
ef4f3aa3f7 MdePkg: MdeLibs.dsc.inc: Apply StackCheckLibNull to All Module Types
Now that the ResetVectors are USER_DEFINED modules, they will not
be linked against StackCheckLibNull, which were the only modules
causing issues. So, we can now remove the kludge we had before
and the requirement for every DSC to include StackCheckLibNull
for SEC modules and just apply StackCheckLibNull globally.

This also changes every DSC to drop the SEC definition of
StackCheckLibNull.

Continuous-integration-options: PatchCheck.ignore-multi-package

Signed-off-by: Oliver Smith-Denny <osde@linux.microsoft.com>
2024-11-13 21:01:46 +00:00
Linus Liu
d13f31c3fe UefiPayloadPkg :ACPI memory node
There are couples of gUniversalPayloadAcpiTableGuid in
payload , only build one
gUniversalPayloadAcpiTableGuid hob and acpi memory hob.
when the reserved memory address matched the rsdp.

Signed-off-by: Linus Liu <linus.liu@intel.com>
2024-10-31 17:02:52 +00:00
Linus Liu
60c6486f79 UefiPayloadPkg:Add SMBIOS node.
Per other platform request , need to add SMBIOS device node into FDT.
In the current phase(1) , only supporting SM3EntryPoint structure.

Signed-off-by: Linus Liu <linus.liu@intel.com>
2024-10-31 17:02:52 +00:00
Linus Liu
de19273e89 UefiPayloadPkg: Modify PCI root reg .
Per Spec updated , update DMA Reg property filed
with each root bridge bus base and its bus limit.

Signed-off-by: Linus Liu <linus.liu@intel.com>
2024-10-31 17:02:52 +00:00
Sean Rhodes
da1c6dd62a UefiPayloadPkg: Add Secure Boot support
Introduce Secure Boot functionality within UefiPayloadPkg by adding
necessary modules and configurations. A new build flag,
`SECURE_BOOT_ENABLE`, is introduced to control the activation of
Secure Boot.

This patch also overrides values in SecurityPkg to enforce image
verification from all sources.

A new FV (`SECURITY_FV`) for security modules is added for components
and the firmware volume sizes to accommodate additional Secure Boot
components.

Cc: Guo Dong <guo.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: James Lu <james.lu@intel.com>
Cc: Gua Guo <gua.guo@intel.com>
Signed-off-by: Sean Rhodes <sean@starlabs.systems>
2024-10-09 19:14:11 +00:00
Linus Liu
550c38a299 UefiPayloadPkg : Roll back the sequence of gEfiEndOfPeiSignalPpiGuid.
Adjust the sequence of gEfiEndOfPeiSignalPpiGuid notify function
when FDT is disabled , or some of notify functions won't work
cause the debug message print twice.

Signed-off-by: Linus Liu <linus.liu@intel.com>
2024-10-08 02:30:21 +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
Gua Guo
4c3bffaeb3 UefiPayloadPkg: Enhance ReadMe.md for ELF and FIT
Enhance and introduce environment construction and
build step for ELF and FIT format payload

Signed-off-by: Gua Guo <gua.guo@intel.com>
2024-09-23 15:30:20 +00:00
Zhou Jianfeng
0354e89fc9 UefiPayloadPkg: Add LOCKBOX_SUPPORT in UPL and set it as FALSE in default
S3 performance table is saved to LockBox. Without LockBox, S3 performance
data will lost.

Add LOCKBOX_SUPPORT to optionally select LockBox libary instance,
default value is FALSE.

Signed-off-by: Zhou Jianfeng <jianfeng.zhou@intel.com>
2024-09-23 02:40:32 +00:00
Gua Guo
14bfcc4021 UefiPayloadPkg: Align relocation item with spec
Currently, FIT Payload data relocation data has
some minor error with Universal Payload
Specification v0.9.1 section 2.4.3.

Signed-off-by: Gua Guo <gua.guo@intel.com>
2024-09-23 09:47:47 +08:00
Matt DeVillier
c358009352 Set PcdSerialClockRate from SerialPortInfo in UefiPayloadEntry
Signed-off-by: Matt DeVillier <matt.devillier@gmail.com>
2024-09-20 03:13:11 +00:00
Chasel Chiu
670e263419 UefiPayloadPkg: Move FADT check to consumer coode.
ACPI FADT HW register interface fields are
optional but current UPL common entry code made it
as mandatory which caused compatibility issue on
some platforms.

Solution is to move those FADT HW register fields
check code to consumer code so only ASSERT when
those fields are consumed with error.

Currently only AcpiTimerLib and ResetSystemLib
consuming those register fields so if platforms
configured UPL to different library instances the
FADT HW register fields are not consumed thus will
not cause ASSERT.

Signed-off-by: Chasel Chiu <chasel.chiu@intel.com>
2024-09-16 16:34:04 +00:00
Dhaval
1f32b5a30e UefiPayloadPkg: Handle simple reserved ranges from DT
DT has a way to provide reserved images in a simpler tabular
manner. UPL should be able to support that.

Signed-off-by: Dhaval Sharma <dhaval@rivosinc.com>
2024-09-14 03:38:47 +00:00
Dhaval
099aff9137 UefiPayloadPkg: Add support for Root bridge parser
In order to properly enable multisegment RB, we need
to grab ecam data from the FDT for each bridge.
Current UNIVERSAL_PAYLOAD_PCI_ROOT_BRIDGES struct from
MdeModulePkg does not include definition for ecam. In
order to maintain backward compatibility and also avoid
diverging too much from core, we are going to define a
new HOB for UPL segment information and pass it to
GetPciSegmentInfo function. Ths function then grabs specifically
ecam info from the segment hob along with other rb specific
information to create final RB info required by multi segment
PCI driver.

Additionally we would like to support legacy implementations which
rely on ACPIBoard HOB to fill up segment info. So if UplSegmentInfo Hob
is not found we try and look for other hob.

Signed-off-by: Dhaval Sharma <dhaval@rivosinc.com>
Signed-off-by: Chasel Chiu <chasel.chiu@intel.com>
2024-09-14 03:38:47 +00:00
Dhaval
c511663cfa UefiPayloadPkg: Add support for Special Purpose memory
We need to let UEFI know that there are cetain memory types
which are special purpose (CXL/HBM) etc and we may want to
avoid using them for UEFI purposes. Hence UPL needs to know
about such memory types.

Signed-off-by: Dhaval Sharma <dhaval@rivosinc.com>
2024-09-14 03:38:47 +00:00
Dhaval
5cd9e7ce87 UefiPayloadPkg: Remove unnecessary ACPI checks
We do not need to go deep into verifying all ACPI tables
at this stage. TODO: Just a simple ACPI header signature
check should be good enough. For now just commenting out
asserts that mandate one to have various tables which is
not applicable to all platforms.

Signed-off-by: Dhaval Sharma <dhaval@rivosinc.com>
2024-09-14 03:38:47 +00:00
Dhaval
7fdb360046 UefiPayloadPkg: Enable RiscV64 entry point to UPL
As per specification we are going to accept only one argument
at the entry point which is FDT pointer. Grab that and call
the entry point.

Signed-off-by: Dhaval Sharma <dhaval@rivosinc.com>
2024-09-14 03:38:47 +00:00
Dhaval
1f4ae34f13 UniversalPayload: Add RISC-V support for UPL PCDs
Expose UPL required PCDs for RISC-V Arch

Signed-off-by: Dhaval Sharma <dhaval@rivosinc.com>
2024-09-14 03:38:47 +00:00
Dhaval
9fff9912fd UefiPayloadPkg: Parse fdt and create smbios table
Signed-off-by: Dhaval Sharma <dhaval@rivosinc.com>
2024-09-14 03:38:47 +00:00
Dhaval
4d35077048 UefiPayloadPkg: Bugfix: Do not parse NULL nodes
Not every node has compatible property; avoid parsing nodes
which return NULL.

Signed-off-by: Dhaval Sharma <dhaval@rivosinc.com>
2024-09-14 03:38:47 +00:00