Commit Graph

33391 Commits

Author SHA1 Message Date
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
Mario Bălănică 2fdc39d09d MdeModulePkg/UefiBootManagerLib: Build proper SD/MMC boot descriptions
This generates boot descriptions for SD/MMC devices in the form of:
  - "UEFI SanDisk SC128 2A2B1E4F SD Device"
  - "UEFI Samsung BJTD4R 7AB3A8DE eMMC User Data"

The manufacturer ID tables are a best-effort, collected from various
places and personal testing. They're not complete and may be inaccurate
for rebranded cards.

Signed-off-by: Mario Bălănică <mariobalanica02@gmail.com>
2024-10-03 20:32:40 +00:00
Abdul Lateef Attar f962adc8a0 DynamicTablesPkg: Adds SPMI table generator
Adds ACPI SPMI table generator library.
Updates acpi standard table enum with spmi.
Updates arch common namespace object and parser.
Updates the Readme.

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
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
Michael Kubacki d2e8118461 StandaloneMmPkg: CodeQL Fixes.
Makes changes to comply with alerts raised by CodeQL.

Most of the issues here fall into the following two categories:

1. Potential use of uninitialized pointer
2. Inconsistent integer width used in loop comparison

Signed-off-by: Oliver Smith-Denny <osde@linux.microsoft.com>
2024-10-03 07:30:55 +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 cac73c45c4 ArmVirtPkg/ArmVirtQemu: avoid unnecessary use of $(ARCH) conditional
ARCH as set by "build" command is not really useful for
conditionals, so move AArch64-specific Pcd to
[PcdsFixedAtBuild.AARCH64].

Signed-off-by: Leif Lindholm <quic_llindhol@quicinc.com>
2024-10-02 07:45:03 +00:00
Leif Lindholm 3297be20bb Maintainers.txt: add Leif Lindholm as additional BaseFdtLib maintainer
Since I have just added a bunch of changes and additions to this library,
add myself as an additional maintainer.

Signed-off-by: Leif Lindholm <quic_llindhol@quicinc.com>
2024-10-02 02:58:31 +00:00
Leif Lindholm eac33b88f4 Maintainers.txt: add all files in BaseFdtLib to component
There are many source files in MdePkg/Library/BaseFdtLib, but only
one of them was highlighted as maintained by the library maintainers.
This feels like an oversight, so change this to be BaseFdtLib/*,
applying to all files in directory.

Signed-off-by: Leif Lindholm <quic_llindhol@quicinc.com>
2024-10-02 02:58:31 +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
Michael Kubacki 4f4673846f .github/GitHub.py: Update bot in redundant comment check
The project moved from using the `github-actions[bot]` bot account to
the `tianocore-assign-reviewers[bot]` account. A check is in place to
prevent the "`WARNING: Cannot add some reviewers`" from appearing
more than once if nothing has changed in the content it would post.

This change updates the bot account to the current one so the check
can work again.

Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
2024-10-01 01:19:00 +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 517019a553 .gitignore: Ignore Python venv files
Since presumably quite a few people will use stuart to build EDK 2,
and since the recommended approach in that case is to use a python
venv, it is much more convenient if these files are ignored by default
in EDK 2, rather than requiring a manual update to .git/info/exclude
each time the repo is cloned, as effectively suggested in the current
How to Build With Stuart instructions on the tianocore wiki.

Signed-off-by: Mike Beaton <mjsbeaton@gmail.com>
2024-09-30 10:24:14 +00:00
Ashraf Ali a6b472131e IntelFsp2Pkg : Refactor BaseFspCommonLib to reduce binary size
Moved FspApiReturnStatusReset API to a separate file to eliminate
unnecessary inclusion of FspApiReturnStatusReset 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-30 08:15:35 +00:00
Oliver Smith-Denny 21e1fc5400 BaseTools: LinuxGcc5ToolChain: Run for GCC Toolchain
The GCC5 TOOL_CHAIN_TAG is being deprecated in favor of
GCC. LinuxGcc5ToolChain.py needs to be updated to find
the correct ARM/AARCH64/RISCV/LOONGARCH64 compilers for
the GCC TOOL_CHAIN_TAG, as well, otherwise it defaults
to the system GCC, which is typically X64 based.

In order to keep this backward and forward compatible,
the plugin now checks for the substring "GCC" in the
TOOL_CHAIN_TAG and will set either the "GCC5" or "GCC"
env variables used by tools_def.template to find the
GCC compiler for the requested architecture.

This plugin is also renamed to drop the old GCC5.

Signed-off-by: Oliver Smith-Denny <osde@linux.microsoft.com>
2024-09-30 02:19:09 +00:00
Michael Kubacki 10783187dd .pytool/UncrustifyCheck: Show errors in output
Shows code formatting errors directly in build output. Previously
only the filenames were in build output and the user had to look
at the test result file either locally or in CI to find details.

It is still recommended that users configure their local environment
to run Uncrustify so it can automatically fix problems as opposed
to manually correcting code based on the output shown in the
terminal. In any case, it is easier to see what is expected now.

Uncrustify reference material:

https://github.com/tianocore/tianocore.github.io/wiki/EDK-II-Code-Formatting
https://github.com/tianocore/edk2/tree/master/.pytool/Plugin/UncrustifyCheck#readme

Some logging levels are also updated to refocus log output by current
message importance and relevance.

Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
2024-09-28 01:39:36 +00:00
Nickle Wang 48b5815d77 RedfishPkg/Include: add common RedfishPkg header file.
IS_EMPTY_STRING macro is defined in multiple drivers in RedfishPkg.
So, I create RedfishCommon.h to keep common macros that we can use
in RedfishPkg.

Signed-off-by: Nickle Wang <nicklew@nvidia.com>
2024-09-27 18:59:04 +00:00
Mike Beaton 8b295e0aad NetworkPkg/Dhcp6Dxe: Fix extraneous parentheses
Without this change we get:

  error: equality comparison with extraneous parentheses

when building with -D NETWORK_IP6_ENABLE on XCODE5.

Signed-off-by: Mike Beaton <mjsbeaton@gmail.com>
2024-09-27 16:57:36 +00:00
Mike Beaton e548e1cd73 CryptoPkg: Fix unused variable in CryptX509.c
Without this change we get:

  error: variable 'Index' set but not used

when building on XCODE5.

Co-authored-by: Savva Mitrofanov <savvamtr@gmail.com>
Signed-off-by: Mike Beaton <mjsbeaton@gmail.com>
2024-09-27 16:57:36 +00:00
Mike Beaton 90fb3c6cfc CryptoPkg/OpensslLib: Fix build on XCODE5
REF: https://edk2.groups.io/g/devel/message/88179

Without this change, we get:

  fatal error: 'Availability.h' file not found

when building on XCODE5.

The workaround uses a define present in openssl/include/crypto/rand.h
which modifies openssl behaviour on Apple only, causing the library
to default to a non-system specific source of entropy in syscall_random()
in rand_unix.c.

Co-authored-by: Savva Mitrofanov <savvamtr@gmail.com>
Signed-off-by: Mike Beaton <mjsbeaton@gmail.com>
2024-09-27 16:57:36 +00:00
Mike Beaton 95292a0f24 MdeModulePkg/VariablePolicyLib: Fix extraneous parentheses
Without this change we get:

  error: equality comparison with extraneous parentheses

when building on XCODE5.

Signed-off-by: Mike Beaton <mjsbeaton@gmail.com>
2024-09-27 16:57:36 +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
Mike Beaton cc47e82703 BaseTools: Fix redefinition of UINT8_MAX in Decompress.c on XCODE5
This is part of a sequence of commits to restore build on the XCODE5
toolchain.

The definition is required on other toolchains, but on XCODE5 results
in a macro redefined error (from the existing value 255) from
/usr/include/stdint.h.

Signed-off-by: Mike Beaton <mjsbeaton@gmail.com>
2024-09-27 16:57:36 +00:00
Leif Lindholm ded3ae2cf4 ArmPkg: drop FdtLib resolution from .dsc
ArmPkg.dsc sets up an FdtLib resolution that is not actually used
by any of the components in it. Since the declared one is going
away, drop the line.

Signed-off-by: Leif Lindholm <quic_llindhol@quicinc.com>
2024-09-27 12:42:07 +00:00
Leif Lindholm 0693c66f76 EmbeddedPkg: add missing BaseLib/BaseMemoryLib declarations
Add missing includes of BaseMemoryLib.h and declaration of
BaseLib/BaseMemoryLib dependencies hidden by use of EmbeddedPkg
FdtLib, which is being deleted.

Signed-off-by: Leif Lindholm <quic_llindhol@quicinc.com>
2024-09-27 12:42:07 +00:00
Leif Lindholm dab548a51b ArmVirtPkg: add QemuVirtMemInfoLib missing dependency/includes
QemuVirtMemInfoLib makes use of BaseLib but never declared the
dependency or included the header. The code still built by
luck and by including the EmbeddedPkg FdtLib. Which is going
away, so add the missing stanzas in preparation.

Signed-off-by: Leif Lindholm <quic_llindhol@quicinc.com>
2024-09-27 12:42:07 +00:00
Leif Lindholm fe93b3745f DynamicTablesPkg/FdtHwInfoParserLib: add missing resolutions/includes
FdtHwInfoParserLib does not explicitly call out its dependencies on
BaseLib/BaseMemoryLib, which is currently hidden when EmbeddedPkg FdtLib
pulls them in instead. But that is going away, so make the necessary
explicit references and add missing include statements.

Signed-off-by: Leif Lindholm <quic_llindhol@quicinc.com>
2024-09-27 07:40:06 +00:00
Li Yi 3ed4f43f83 CryptoPkg: Update generated files based on openssl 3.0.15
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=4842

Signed-off-by: Li Yi <yi1.li@intel.com>
2024-09-27 04:24:25 +00:00
Li Yi c13f9de56d CryptoPkg: Update openssl submodule to 3.0.15
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=4842

CVE-2024-6119 affects TLS-client implementation of EDK2. Fix it by
updating to 3.0.15.

Signed-off-by: Li Yi <yi1.li@intel.com>
2024-09-27 04:24:25 +00:00
Heinrich Schuchardt 2936b7d162 ArmVirtPkg: Correct PcdDxeNxMemoryProtectionPolicy comment
Since commit 2997ae3873 ("ArmVirtPkg: make EFI_LOADER_DATA
non-executable") the comment for PcdDxeNxMemoryProtectionPolicy is
incorrect.

* Remove the incorrect part of the description.
* Describe overriding NX protection by passing a pcd parameter on the
  build command line.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2024-09-26 13:46:45 +00:00
Gerd Hoffmann 39462fcd99 openssl: add Library/OpensslLib/openssl to includes, drop e_os.h hack
Adding $(OPENSSL_PATH)/e_os.h to the list of source files had the effect
that $(OPENSSL_PATH)/ was added to the list of include directories.
With the file being gone in openssl-3.2.x this doesn't work any more.

Add the directory to the [Includes.Common.Private] section instead.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2024-09-25 16:08:35 +00:00
Gerd Hoffmann 67c303cb5f CrtLibSupport: add intptr_t
Will be needed by openssl-3.4.x

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2024-09-25 16:08:35 +00:00
Gerd Hoffmann c371460cb4 CrtLibSupport: add timezone
Will be needed by openssl-3.2.x

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2024-09-25 16:08:35 +00:00
Gerd Hoffmann 0ec54d8d0c CrtLibSupport: add mktime()
Will be needed by openssl-3.2.x

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2024-09-25 16:08:35 +00:00
Gerd Hoffmann af73d37741 CrtLibSupport: factor out EFI_TIME -> time_t calculation to new function
No functional change.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2024-09-25 16:08:35 +00:00
Gerd Hoffmann ebf7daa583 CrtLibSupport: fix gettimeofday()
Turn gettimeofday() into a proper function with return value.

Will be needed by openssl-3.2.x

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2024-09-25 16:08:35 +00:00
Gerd Hoffmann 609c7e8679 CrtLibSupport: add sleep()
Will be needed by openssl-3.2.x

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2024-09-25 16:08:35 +00:00
Heinrich Schuchardt b8122cc9d8 ShellPkg: add missing linefeed in reset message
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4850

When running 'reset -s' no linefeed is printed. This results in the Linux
command line prompt not being printed at the start of a new line:

    Shell> reset -s
    Reset with <null string> (0 bytes)user@workstation:/tmp$

Add the missing linefeed.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2024-09-24 16:46:26 +00:00
Mike Turner a131839a3d FatPkg: Improvements to Fat to Fix File Corruption
This patch improves dirty bit checking in FAT and coalesces multiple
writes to adjacent blocks into a single write.

For good read performance, the Fat code caches 64KB lines from the
file system. Any update to the data will force 64KB writes. Writing
the full 64KB causes collateral blocks (i.e. blocks belonging to
other files) to be written. This is inefficient to write blocks that
are not dirty, the FAT driver should only be writing blocks that have
actually been updated through its cache.

This also resolves an issue with existing bootloaders which have ways
to update files outside of the FAT code and the collateral write can
corrupt those files. One such file is the Windows BCD that gets updated
outside of the FAT code and has been seen to be corrupted by the
collateral writes, causing the OS to fail to boot.

This fix keeps track of physical disk block (LBA) size and will only
mark LBA size zones of the 64KB cache line that are written to. When the
file is closed and the cached data is written, only the dirty LBAs are
written, which avoids the collateral write and therefore the corruption.
In addition, adjacent LBAs will be coalesced into one write for
performance considerations.

Signed-off-by: Oliver Smith-Denny <osde@linux.microsoft.com>
2024-09-23 16:50:39 +00:00
Oliver Smith-Denny 3ef6a71ed1 FatPkg: Check BlockIo Device Has Supported BlockSize
Per the FAT spec, FAT32 supports block sizes of 512B, 1KB, 2KB, or 4KB.
This patch adds a check to the FAT driver initialization to ensure that
the underlying BlockIo device supports one of those block sizes and fails
initialization otherwise. The underlying BlockIo blocksize is used when
we flush the FatDiskCache back to disk and if the block size is an
unsupported size, we could cause file corruption.

Signed-off-by: Oliver Smith-Denny <osde@linux.microsoft.com>
2024-09-23 16:50:39 +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
Ard Biesheuvel 1a89c690a1 CryptoPkg/OpensslLib: Create SM3-only version of the library
Create a special OpensslLib implementation that only exposes the SM3
routines that MbedTlsLib borrows from OpensslLib, to avoid having to
pull in other parts of OpenSSL that are not needed (e.g., via the
library constructor)

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
2024-09-23 06:11:25 +00:00