Commit Graph

257 Commits

Author SHA1 Message Date
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
Dhaval ed665ef38c UefiPayloadPkg: Handle ordering issue with option node
Option node provides info that is to be consumed by during
metadata creation for other nodes like root bridge; pci-enum-done
etc. Handle that dependency by storing option values in a variable
and then apply it during post processing. Ideally such cross node
dependency should be avoided in design. Scope for futher improvements.

Signed-off-by: Dhaval Sharma <dhaval@rivosinc.com>
2024-09-14 03:38:47 +00:00
Oliver Smith-Denny 17744fc9ce UefiPayloadPkg: Add StackCheckLib
Add null implementation of StackCheckLib

Signed-off-by: Oliver Smith-Denny <osde@linux.microsoft.com>
2024-09-13 03:58:46 +00:00
Joey Vagedes 5b6ec1a7f4 UefiPayloadPkg/UefiPayloadPkg.ci.yaml: Add PrEval CI config
Adds an entry to the package's CI configuration file that enable policy
5 for stuart_pr_eval. With this Policy, all INFs used by the package are
extracted from the provided DSC file and compared against the list of
changed *.inf (INF) files in the PR. If there is a match, stuart_pr_eval
will specify that this package is affected by the PR and needs to be
tested.

Signed-off-by: Joey Vagedes <joey.vagedes@gmail.com>
2024-09-02 23:20:35 +00:00
Linus Liu a0ac7cf67a UefiPayloadPkg: Update UefiPayload driver for FDT support.
REF:https://bugzilla.tianocore.org/show_bug.cgi?id=4786

Add FDT detection and comsume FDT when needed.
Move some x86 specific function in the x86 folder.
Create HandOffHob via FDT memory node.

Signed-off-by: Linus Liu <linus.liu@intel.com>
2024-08-28 11:39:12 +00:00
Linus Liu 0c4d6bb405 UefiPayloadPkg: Update PayloadLoader to suport FDT.
REF:https://bugzilla.tianocore.org/show_bug.cgi?id=4786

Create FDT nodes (reserved-memory, serial, pci-rb, options) in
FdtPpiNotifyCallback function right after gEfiEndOfPeiSignalPpiGuid.

Signed-off-by: Linus Liu <linus.liu@intel.com>
2024-08-28 11:39:12 +00:00
Linus Liu b0c6b049c4 UefiPayloadPkg: Add FDT Paser relative LIBs.
REF:https://bugzilla.tianocore.org/show_bug.cgi?id=4786

Add FDTParser and CustomFdtNodePaser
to retrive all FDT node and create the relate hobs.

Signed-off-by: Linus Liu <linus.liu@intel.com>
2024-08-28 11:39:12 +00:00
Linus Liu a297b81b62 UefiPayloadPkg: Support Debug function when Hob was not available.
REF:https://bugzilla.tianocore.org/show_bug.cgi?id=4786

Initialize mUartInfo with PCD for debug message
when Hob was not available.

Signed-off-by: Linus Liu <linus.liu@intel.com>
2024-08-28 11:39:12 +00:00
Linus Liu 04d8d94a42 UefiPayloadPkg: Addd header files for FDT structure and function.
REF:https://bugzilla.tianocore.org/show_bug.cgi?id=4786

Add Library header, DeviceTree hob header and PCD definitions.

Signed-off-by: Linus Liu <linus.liu@intel.com>
2024-08-28 11:39:12 +00:00
Rebecca Cran 669c5aa240 UefiPayloadPkg: 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 UefiPayloadPkg.

Signed-off-by: Rebecca Cran <rebecca@bsdio.com>
2024-08-01 19:53:47 +00:00
KasimX Liu 807ab61359 UefiPayloadPkg:Modify the PCD PcieResizableBar to dynamic PCD
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4808

Synchronize the use of the PCD PcieResizableBar
attribute state

Signed-off-by: KasimX Liu <kasimx.liu@intel.com>
2024-07-12 11:08:36 +00:00
Wei6 Xu e94cbfc845 UefiPayloadPkg/UefiPayloadEntry: Use HobPrintLib to dump HOBs
Leverage generic HOB print code in MdeModulePkg/Library/HobPrintLib.
Print UefiPayload specified GUID HOB info as custom HOB print handler
when calling the PrintHobList() interface.

Cc: Guo Dong <guo.dong@intel.com>
Cc: Sean Rhodes <sean@starlabs.systems>
Cc: James Lu <james.lu@intel.com>
Cc: Gua Guo <gua.guo@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Signed-off-by: Wei6 Xu <wei6.xu@intel.com>
2024-07-07 10:12:36 +00:00
Dhaval 0982da4f50 UefiPayloadPkg: Enable UPL FIT build config from cmdline
Provide commandline configuration to select proper platform file.

Cc: Gua Guo <gua.guo@intel.com>
Cc: Guo Dong <guo.dong@intel.com>
Cc: James Lu <james.lu@intel.com>
Cc: Sean Rhodes <sean@starlabs.systems>

Signed-off-by: Dhaval Sharma <dhaval@rivosinc.com>
2024-06-11 17:40:56 +08:00
Sebastian Witt 6d15276ced UefiPayloadPkg: Fix LoadDxeCore for payload size > 16MB
Fix calculation of first section in FileFindSection for FILE2 headers
in UefiPayloadEntry module.

Signed-off-by: Sebastian Witt <sebastian.witt@siemens.com>
Reviewed-by: Guo Dong <guo.dong@intel.com>
Cc: Sean Rhodes <sean@starlabs.systems>
Cc: James Lu <james.lu@intel.com>
Reviewed-by: Gua Guo <gua.guo@intel.com>
2024-06-10 15:53:15 +00:00
Gua Guo cd4cebabf5 UefiPayloadPkg: Update ReadMe.md to swig install
Update ReadMe.md for swig install process in
windows OS.

Cc: Chasel Chiu <chasel.chiu@intel.com>
Cc: Guo Dong <guo.dong@intel.com>
Cc: Sean Rhodes <sean@starlabs.systems>
Cc: James Lu <james.lu@intel.com>
Cc: Gua Guo <gua.guo@intel.com>

Signed-off-by: Gua Guo <gua.guo@intel.com>
Reviewed-by: Guo Dong <guo.dong@intel.com>
2024-05-30 05:17:27 +00:00
Jiaxin Wu 23ed7f209c UefiPayloadPkg/UefiPayloadPkg.dsc: Include SmmRelocationLib
This patch just includes SmmRelocationLib in UefiPayloadPkg.

Cc: Guo Dong <guo.dong@intel.com>
Cc: Sean Rhodes <sean@starlabs.systems>
Cc: James Lu <james.lu@intel.com>
Cc: Gua Guo <gua.guo@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com>
Reviewed-by: Gua Guo <gua.guo@intel.com>
Reviewed-by: Guo Dong <guo.dong@intel.com>
2024-05-08 01:53:58 +00:00
Tom Lendacky d2b18e6bc2 UefiPayloadPkg: Prepare UefiPayloadPkg to use the AmdSvsmLib library
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=4654

The MpInitLib library will be updated to use the new AmdSvsmLib library.
To prevent any build breakage, update the UefiPayloadPkg DSC file to
include the AmdSvsmLib NULL library.

Cc: Gua Guo <gua.guo@intel.com>
Cc: Guo Dong <guo.dong@intel.com>
Cc: James Lu <james.lu@intel.com>
Cc: Sean Rhodes <sean@starlabs.systems>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
Reviewed-by: Guo Dong <guo.dong@intel.com>
2024-04-17 18:30:03 +00:00
Laszlo Ersek 1c0db23151 UefiPayloadPkg: auto-generate SEC ProcessLibraryConstructorList() decl
Rely on AutoGen for declaring ProcessLibraryConstructorList().

Build-tested with:

  python UefiPayloadPkg/UniversalPayloadBuild.py -a X64 -b DEBUG -t GCC5

  python UefiPayloadPkg/UniversalPayloadBuild.py -a X64 -b DEBUG -f \
    -t GCC5

  build -a X64 -b DEBUG -p UefiPayloadPkg/UefiPayloadPkg.dsc -t GCC5 \
    -D BUILD_ARCH=X64

Cc: Gua Guo <gua.guo@intel.com>
Cc: Guo Dong <guo.dong@intel.com>
Cc: James Lu <james.lu@intel.com>
Cc: Sean Rhodes <sean@starlabs.systems>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=990
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20240305113843.68812-11-lersek@redhat.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
2024-03-08 09:09:22 +00:00
Dhaval e60529df58 UefiPayloadPkg: Make Dsc accomodative of other archs
Current DSC files contains a lot of files which are
specific to X86 arch. Need to move around files under
arch specific sections.

Cc: Guo Dong <guo.dong@intel.com>
Cc: Sean Rhodes <sean@starlabs.systems>
Cc: James Lu <james.lu@intel.com>
Cc: Gua Guo <gua.guo@intel.com>
Signed-off-by: Dhaval Sharma <dhaval@rivosinc.com>
Reviewed-by: Gua Guo <gua.guo@intel.com>
2024-03-06 03:15:21 +00:00