| Age | Commit message (Collapse) | Author | Files | Lines |
|
This change adds dynamic initialization of gHobList in GetHobList() to handle cases where library constructors are executed before DxeHobListLibConstructor.
Issue:
On ARM platforms using ArmMmuBaseLib, the ArmMmuBaseLibConstructor calls GetFirstGuidHob() before xeHobListLibConstructor has initialized gHobList, causing an ASSERT.
Root Cause:
ArmMmuBaseLib's constructor uses HobLib functions, but UefiPayloadPkg's DxeHobLib assumes gHobList is already initialized by DxeHobListLib's constructor.
Solution:
Add the same lazy initialization pattern already used in MdePkg/Library/DxeHobLib, which dynamically retrieves the HOB list from the System Configuration Table if gHobList is NULL.
This change:
- Aligns behavior with MdePkg/Library/DxeHobLib
- Has no impact on existing functionality
- Improves robustness for ARM platforms
Signed-off-by: Jared Pan <jared.pan@dell.com>
|
|
GptLib is a new library class consumed both by PartitionDxe (built by
essentially every platform) and by DxeTpm2MeasureBootLib. Any platform DSC
that builds either module must resolve the GptLib library class, otherwise
the build fails with "Instance of library class [GptLib] is not found".
Resolve GptLib in UefiPayloadPkg/UefiPayloadPkg.dsc, which builds
PartitionDxe.
Out-of-tree platforms consuming either module need the same one-line
resolution.
Signed-off-by: Richard Lyu <richard.lyu@suse.com>
|
|
In arguments of EFI_PCI_IO_PROTOCOL member functions, replace the
EfiPciWidth* enum literals from
EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH with the matching
EfiPciIoWidth* values from EFI_PCI_IO_PROTOCOL_WIDTH.
This keeps the call sites aligned with the protocol they actually use.
The old values were copied from EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL code,
so they obscured the intent of the calls and relied on an explicit
cast.
This mimics commit 8ba64a9a9417 ("UefiPayloadPkg: Fix build failure with
CLANGPDB").
Generated by coccinelle script.
``` smpl
@initialize:python@
@@
def to_pci_io_width(name):
return name.replace("EfiPciWidth", "EfiPciIoWidth", 1)
@normalize@
typedef EFI_PCI_IO_PROTOCOL;
typedef EDKII_PCI_DEVICE_PPI;
type T =~ "^EFI_PCI_IO_PROTOCOL_WIDTH$";
EFI_PCI_IO_PROTOCOL *x;
EDKII_PCI_DEVICE_PPI *y;
identifier bad =~ "EfiPciWidth(Uint|FifoUint|FillUint)(8|16|32|64)";
identifier top_op =~ "^(PollMem|PollIo|CopyMem)$";
identifier space =~ "^(Mem|Io|Pci)$";
identifier rw =~ "^(Read|Write)$";
fresh identifier good = script:python(bad) { to_pci_io_width(bad) };
expression first;
expression list rest;
@@
(
x->top_op
|
y->PciIo.top_op
|
x->space.rw
|
y->PciIo.space.rw
) (
first,
- (T)bad
+ good
,
rest
)
```
Verified with:
- `build -p UefiPayloadPkg/UefiPayloadPkg.dsc -a IA32 -a X64 -b DEBUG -t GCC -D BOOTLOADER=SBL`
- temporary IA32 PEIM harness that compiled X86_BuildFdtLib.c
Signed-off-by: Mingjie Shen <shen497@purdue.edu>
|
|
This library class is called ResetSystemLib, not EfiResetSystemLib.
Fix this, making resets generated by UEFI and through the runtime service
work as expected.
Signed-off-by: Benjamin Doron <benjamin.doron@9elements.com>
|
|
Replace manual alignment checks with IS_ALIGNED() and
ADDRESS_IS_ALIGNED().
Convert the following bitmask and modulo forms:
- ((E & ((PowOf2Expr) - ONE)) == ZERO)
- ((E & ((PowOf2Expr) - ONE)) != ZERO)
- ((E % (PowOf2Expr)) == ZERO)
- ((E % (PowOf2Expr)) != ZERO)
to the corresponding helper macro forms:
+ IS_ALIGNED (E, PowOf2Expr)
+ !IS_ALIGNED (E, PowOf2Expr)
PowOf2Expr is limited to known power-of-two expressions, including
SIZE_* and BASE_* macros, EFI_PAGE_SIZE, CPU_STACK_ALIGNMENT,
RUNTIME_PAGE_ALLOCATION_GRANULARITY, sizeof() of UEFI integer types
(e.g. BOOLEAN, CHAR16, UINT32, UINTN) and pointer types, and 1 << E1
expressions.
Address checks that cast the checked value to UINTN are written with
ADDRESS_IS_ALIGNED().
The change was generated with the Coccinelle semantic patch below.
```smpl
@power_of_2_expr@
expression PowOf2Expr;
expression E1;
typedef BOOLEAN, CHAR8, CHAR16, INT8, UINT8, INT16, UINT16, INT32, UINT32, INT64, UINT64, INTN, UINTN;
type ScalarType = { BOOLEAN, CHAR8, CHAR16, INT8, UINT8, INT16, UINT16, INT32, UINT32, INT64, UINT64, INTN, UINTN };
type AnyType;
type PointerType = AnyType *;
idexpression ScalarType ScalarValue;
idexpression PointerType PointerValue;
constant SizeBase =~ "^(SIZE|BASE)_(1|2|4|8|16|32|64|128|256|512)[KMGTPE]B$";
constant NamedPowerOf2 =~ "^(EFI_PAGE_SIZE|CPU_STACK_ALIGNMENT|RUNTIME_PAGE_ALLOCATION_GRANULARITY)$";
constant ONE = {1, 1U, 1u};
@@
(
(
SizeBase
|
NamedPowerOf2
|
ONE << E1
|
sizeof (ScalarType)
|
sizeof (PointerType)
|
sizeof (ScalarValue)
|
sizeof (PointerValue)
)
&
PowOf2Expr
)
@aligned depends on power_of_2_expr disable is_zero,isnt_zero@
expression E;
expression power_of_2_expr.PowOf2Expr;
constant ONE = {1, 1U, 1u};
constant ZERO = {0, 0U, 0u};
@@
(
((E & (E - ONE)) == ZERO)
|
- ((E & ((PowOf2Expr) - ONE)) == ZERO)
+ IS_ALIGNED (E, PowOf2Expr)
|
((E & (E - ONE)) != ZERO)
|
- ((E & ((PowOf2Expr) - ONE)) != ZERO)
+ !IS_ALIGNED (E, PowOf2Expr)
|
- ((E % (PowOf2Expr)) == ZERO)
+ IS_ALIGNED (E, PowOf2Expr)
|
- ((E % (PowOf2Expr)) != ZERO)
+ !IS_ALIGNED (E, PowOf2Expr)
)
@address_is_aligned@
typedef UINTN;
expression *Address;
expression Alignment;
@@
- IS_ALIGNED ((UINTN) Address, Alignment)
+ ADDRESS_IS_ALIGNED (Address, Alignment)
@normalize_aligned disable paren expression@
expression E, SZ;
@@
(
- (IS_ALIGNED (E, SZ))
+ IS_ALIGNED (E, SZ)
|
- (!IS_ALIGNED (E, SZ))
+ !IS_ALIGNED (E, SZ)
)
@normalize_macro_args disable paren expression@
expression E, SZ;
@@
(
- IS_ALIGNED ((E), SZ)
+ IS_ALIGNED (E, SZ)
|
- IS_ALIGNED (E, (SZ))
+ IS_ALIGNED (E, SZ)
)
```
Signed-off-by: Mingjie Shen <shen497@purdue.edu>
|
|
Merge DefaultExceptionHandlerLib into CpuExceptionHandlerLib.
Continuous-integration-options: PatchCheck.ignore-multi-package
Signed-off-by: Vishal Oliyil Kunnil <vishalo@qti.qualcomm.com>
|
|
Merge ArmExceptionLib into CpuExceptionHandlerLib.
Continuous-integration-options: PatchCheck.ignore-multi-package
Signed-off-by: Vishal Oliyil Kunnil <vishalo@qti.qualcomm.com>
|
|
In SpiFlashLib driver, BaseLib appears twice in [LibraryClasses]
section, so remove the duplicate one.
In PayloadLoaderPeim driver, ElfLib/ElfLibInternal.h appears twice in
[Sources] section, so remove the duplicate one.
Signed-off-by: Qihang Gao <gaoqihang@loongson.cn>
|
|
Per
https://edk2.groups.io/g/devel/topic/move_armlib_to_baselib/118541649,
this commit moves ArmLib to MdePkg and updates all consumers.
The only change to ArmLib itself is to remove ArmPkg.dec from
the inf.
Continuous-integration-options: PatchCheck.ignore-multi-package
Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
|
|
MR-IOV was actually not used in MdeModulePkg and it has been
deprecated in PCIe 6.0 specification, so remove it.
Signed-off-by: Jacek Kolakowski <Jacek.Kolakowski@intel.com>
|
|
Add PcdPcieResizableBarMaxSize to UefiPayloadPkg so that
it can be also controlled with a configuration knob.
Signed-off-by: Jacek Kolakowski <Jacek.Kolakowski@intel.com>
|
|
Replace traditional `#ifndef`/`#define`/`#endif` include guards with
`#pragma` once.
`#pragma once` is a widely supported preprocessor directive that
prevents header files from being included multiple times. It is
supported by all toolchains used to build edk2: GCC, Clang/LLVM, and
MSVC.
Compared to macro-based include guards, `#pragma once`:
- Eliminates the risk of macro name collisions or copy/paste errors
where two headers inadvertently use the same guard macro.
- Eliminate inconsistency in the way include guard macros are named
(e.g., some files use `__FILE_H__`, others use `FILE_H_`, etc.).
- Reduces boilerplate (three lines replaced by one).
- Avoids polluting the macro namespace with guard symbols.
- Can improve build times as the preprocessor can skip re-opening the
file entirely, rather than re-reading it to find the matching
`#endif` ("multiple-include optimization").
- Note that some compilers may already optimize traditional include
guards, by recognzining the idiomatic pattern.
This change is made acknowledging that overall portability of the
code will technically be reduced, as `#pragma once` is not part of the
C/C++ standards.
However, this is considered acceptable given:
1. edk2 already defines a subset of supported compilers in
BaseTools/Conf/tools_def.template, all of which have supported
`#pragma once` for over two decades.
2. There have been concerns raised to the project about inconsistent
include guard naming and potential macro collisions.
Approximate compiler support dates:
- MSVC: Supported since Visual C++ 4.2 (1996)
- GCC: Supported since 3.4 (2004)
(http://gnu.ist.utl.pt/software/gcc/gcc-3.4/changes.html)
- Clang (LLVM based): Since initial release in 2007
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
|
|
The wiki has moved and this change updates links in UefiPayloadPkg to
refer to the new location.
- New location: https://github.com/tianocore/tianocore-wiki.github.io
- Rendered version: https://www.tianocore.org/tianocore-wiki.github.io/
- Old location: https://github.com/tianocore/tianocore.github.io/wiki
More details: https://github.com/tianocore/edk2/discussions/11969
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
|
|
Hexadecimal is more convenient when using this script, so add various
number bases support
Signed-off-by: Xiang W <wangxiang@iscas.ac.cn>
|
|
The `fit` file generated by `MkFitImage.py` outputs a warning when
processed by the dtc. This issue has be fixed.
Signed-off-by: Xiang W <wangxiang@iscas.ac.cn>
|
|
EFI_PCI_IO_PROTOCOL->Pci services (Read and Write) take
EFI_PCI_IO_PROTOCOL_WIDTH as second argument. However in PciPlatformDxe
enum argument of EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH is usedwhich caused
build to fail.
Use EfiPciWidthUint32 which is enum member of EFI_PCI_IO_PROTOCOL_WIDTH.
Signed-off-by: Khalid Ali <khaliidcaliy@gmail.com>
|
|
PCI Root Bridge is allowed to allocate DMA memory below 4GB by default,
this policy does not applicable to all platform. For instance, QEMU
SBSA refernce platform configure system memory base to be 0x10000000000,
it makes all available memory resides above 0x10000000000.
To make DmaAbove4G member of structure RootBridge flexible, use PCD to
control behavior of DmaAbove4G.
Signed-off-by: Ajan Zhong <ajan.zhong@newfw.com>
|
|
Remove fixed serial port settings, it allows serial port settings
can be configured by bootloader to adapt actual platform hardware
configuration.
Signed-off-by: Ajan Zhong <ajan.zhong@newfw.com>
|
|
Add missing EFIAPI to BL_CAPSULE_CALLBACK to fix build issue.
Fixes: cc149a8e
Signed-off-by: Khalid Ali <khaliidcaliy@gmail.com>
|
|
There are multiple implementations of HandOffToDxeCore; remove one.
Signed-off-by: Xiang W <wangxiang@iscas.ac.cn>
|
|
Remove unused functions. There are multiple implementations of
HandOffToDxeCore; remove one.
Signed-off-by: Xiang W <wangxiang@iscas.ac.cn>
|
|
UefiPayloadPkg needed two fixes for CLANGPDB AARCH64:
- Don't use the tiny code model for CLANGPDB, it is not
supported. This is only for CI build anyway.
- CLANGPDB caught that there were undefined references to
a function in the entry, this was because in the non-Fit
entry point INFs, they were still including the AARCH64
Fit entry point files, which are not needed.
Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
|
|
For nebulous reasons, the original ELF psABI deviated from common sense,
and decided to #define R_AARCH64_NONE as '256', in spite of the fact
that no other architecture uses anything other than 0x0.
This has now been fixed in the psABI, so fix it in our code as well.
Continuous-integration-options: PatchCheck.ignore-multi-package
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
|
|
Variable ChildBusAddress is not used in function ParsePciRootBridge, it
triggers build error on GCC version gcc version 13.3.0.
Remove this variable to fix build error.
Signed-off-by: Ajan Zhong <ajan.zhong@newfw.com>
|
|
Separate Exception Stacks has been enabled by default in
commit [1], in this case, TSS will be appended to original GDT.
As secondary bootloader, UniversalPayload solution has different
boot flow from original EDK2. When DxeMain tries to append TSS
after original GDT, the original GDT is empty. It leads to system
reboot when DxeMain tries to install new GDT which is appended with
TSS.
To fix this issue, set up temporary GDT with 64-bit code and data
descriptors.
[1] https://github.com/tianocore/edk2/commit/cec2c6
Signed-off-by: Ajan Zhong <ajan.zhong@newfw.com>
|
|
With certain combinations of memory when special-purpose memory
shows up first during the parsing, it is used for HOB creation
and other UEFI memory map requirements which is not desired. So
now we check if the parent node is reserved node, do not use it
for HOB.
Signed-off-by: Akshay Behl <cap2k4@rivosinc.com>
Co-authored-by: Dhaval Sharma <dhaval@rivosinc.com>
|
|
Add support to check the DMA ranges to determine support
for DMA above 4G.
This change implements parsing of the "dma-ranges" property
from the device tree.
Reference:
https://devicetree-specification.readthedocs.io/en/latest/chapter2-devicetree-basics.html#dma-ranges
Signed-off-by: Akshay Behl <cap2k4@rivosinc.com>
Co-authored-by: Dhaval Sharma <dhaval@rivosinc.com>
|
|
This change updates the UefiPayloadEntry modules to consume the memory
allocation logic through the MemoryAllocationLib.
This will allow other library classes to consume the same logic through
standard defined memory allocation routines.
Signed-off-by: Kun Qin <kun.qin@microsoft.com>
|
|
This change creates a new library instance for UefiPayloadPkg. The
implementation is inherited from UefiPayloadEntry.
It will allow the UefiPayloadEntry to consume memory allocation logic
from this instance instead of its own carried copy.
Signed-off-by: Kun Qin <kun.qin@microsoft.com>
|
|
This change updates the HobLib for UefiPayloadPkg to use the newly
introduced hob creation interface.
It also pave ways to separate the memory allocation logic into its
designated library classes.
Signed-off-by: Kun Qin <kun.qin@microsoft.com>
|
|
This is a newly added helper library to help providing utilities common
to UefiPayloadPkg.
This change will pave ways to separating standard services such as
"MemoryAllocation" into its own library classes.
Signed-off-by: Kun Qin <kun.qin@microsoft.com>
|
|
Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de>
|
|
edk2 is dropping support for the ARM32 architecture. This commit
removes ARM32 support from UefiPayloadPkg. It removes irrelevant
VALID_ARCHITECTURES comments from infs that are not arch
specific.
Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
|
|
Fixing a licensing typo in UefiPayloadEntry/RiscV64/DxeLoadFuncFit.c
Signed-off-by: Akshay Behl <cap2k4@rivosinc.com>
|
|
Signed-off-by: Akshay Behl <cap2k4@rivosinc.com>
Co-authored-by: Dhaval Sharma <dhaval@rivosinc.com>
|
|
Part of the functions of the library are left unimplemented (return
EFI_UNSUPPORTED) the rest use information about current firmware
obtained from CBMEM (at this point available in a HOB) and SMMSTOREv2 to
perform flashing.
Flashing is slightly optimized: FmpDeviceSetImageWithStatus() first
reads a block and checks that it differs from the new contents before
initiating erase and write.
On successful flashing runtime APIs for dealing with EFI variables are
replaced with stubs to prevent accesses to SMMSTORE from the currently
running firmware. The SMMSTORE region's contents and possibly location
and size have been changed as a result of the update and continued use
of it can have unpredictable consequences including corruption of the
newly written firmware image. A capsule mode always ends with a reboot,
so the variable services are unavailable only for a very short period
after a successful flashing.
Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
|
|
This allows reusing SMMSTORE protocol for the purpose of firmware
updates.
Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
|
|
This is using test certificate stored in this repository. Building
additionally requires setting CAPSULE_FIRMWARE_GUID to firmware GUID in
string form.
FDF file is not updated because FMP driver is to be embedded into update
capsule.
Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
|
|
Make UefiPayloadPkg.dsc add required libraries/DXEs/PCDs when
CAPSULE_SUPPORT define is set to TRUE.
UefiPayloadEntry now parses firmware information from a bootloader and
switches boot mode to BOOT_ON_FLASH_UPDATE if there are any capsules.
It's not guarded by any PCD under the assumption that bootloader won't
pass capsules if EDK shouldn't be handling them.
EsrtDxe is enabled to manage ESRT entries and it consumes the firmware
information HOB created by UefiPayloadEntry. ProcessCapsules()
internally looks up EsrtManagementProtocol and calls SyncEsrtFmp() to
import data from available FMP instances.
PlatformBootManagerLib was made to call ProcessCapsules() twice: before
and after end-of-DXE.
Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
|
|
The implementation is for CbParseLib, SblParseLib returns success while
doing nothing.
The HOBs created by BuildCvHob() will be eventually picked up and
processed in DXE phase by
MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleProcessLib.c
Because multiple capsules can be chained (simply by placing them one
after another), coreboot passes them as a single memory range which can
provide tenths of capsules.
coreboot won't pass any capsules unless it finds CapsuleUpdateData*
EFI variables and is able to parse memory ranges they point to as
scatter-gather lists of pages containing capsules.
Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
|
|
Use firmware information passed by a bootloader and parsed by BlParseLib
to make a single-element ESRT. This informs operating systems and EDK
itself about which capsules are applicable for the current firmware.
Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
|
|
The implementation is for CbParseLib, SblParseLib returns an error.
coreboot's CB_TAG_FW_INFO is a machine-friendly version of a system
firmware component. A component is identified by a GUID. This is meant
to be primarily a source of information for ESRT.
The following coreboot options translate directly into fields of the
structure with information:
- CONFIG_DRIVERS_EFI_MAIN_FW_GUID
- CONFIG_DRIVERS_EFI_MAIN_FW_VERSION
- CONFIG_DRIVERS_EFI_MAIN_FW_LSV
- CONFIG_ROM_SIZE
The first 3 options depend on CONFIG_DRIVERS_EFI_FW_INFO.
Version as a string depends on CONFIG_LOCALVERSION as well as version of
the code base (misnamed as KERNELVERSION in coreboot's build system).
Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
|
|
They are used in SblParseLib.c (ParseSmbiosTable() and
ParseAcpiTableInfo() functions) but weren't declared as such.
Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
|
|
Since on UefiPayload the full PCI enumeration isn't run, the light
enumeration won't find Option ROMs. The introduced PciPlatform
driver relies on completed PCI enumeration and assumes that all
ROM bars have been properly assigned a free MMIO window.
Installs the gPciPlatformProtocol to scan for Option ROMs during
PCI enumeration light and copies found Option ROMs to runtime allocated
buffers. Only for work devices that have a ROMBAR, but doesn't for
devices that need a VBIOS loaded from SPI flash.
TEST: QEMU can enumerate Option ROMs on VGA and NIC on UefiPayloadPkg.
Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
|
|
The entrypoint module should do this programmatically using resources
passed by the bootloader. Under UPL, bootloaders are expected to pass
such ranges in the FDT.
Signed-off-by: Benjamin Doron <benjamin.doron@9elements.com>
|
|
When register a root SMI handler, it is expected to use windows calling
convention for the SMI handler. This patch adds missing EFIAPI for the
SMI handler SmmSwDispatcher to avoid potential issue from Linux build.
Signed-off-by: Guo Dong <guo.dong@intel.com>
|
|
The Universal Graphics Adapter (UGA) is a graphic abstraction.
The UGA I/O and Draw protocols are deprecated since UEFI 2.0 was
introduced. Cf. the UEFI spec v2.9:
"Appendix L - EFI 1.10 Protocol Changes and Deprecation List"
section L.2 "Deprecated Protocols"
Remove the UGA support.
Signed-off-by: GuoMinJ <newexplorerj@gmail.com>
Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
|
|
UefiPayloadPkg has copied the MdeModulePkg DxeIpl behavior to
create a memory allocation HOB for page 0. That is being changed
(see that commit for details), so also remove it here.
Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
|
|
Introduce AArch64 architecture support in BlSupportDxe. Translation
table would be created based on the memory maps, which is provided
by bootloader, in case MMU is disabled when execution is handed
over to Universal Payload.
Signed-off-by: Ajan Zhong <ajan.zhong@newfw.com>
|
|
Move IA32 and X64 architectures specified code to corresponding files.
Signed-off-by: Ajan Zhong <ajan.zhong@newfw.com>
|