19 Commits

Author SHA1 Message Date
Guo Dong
801618ebfe Update FdtLib for universal payload support
Sync FdtLib from EDK2

Signed-off-by: Guo Dong <guo.dong@intel.com>
2025-01-10 13:19:29 -07:00
Bruno Achauer
712cb1e867 fix: [common] Fix Coverity issue
Check fdt_getprop_by_offset() return value for NULL pointer (like all
other callers) to prevent a Coverity issue (CWE-476).

Signed-off-by: Bruno Achauer <bruno.achauer@intel.com>
2024-10-22 07:12:34 -07:00
Randy
4cf45340a1 Fix: disable opt build cause error
error log:
MdePkg\Library\BaseFdtLib\libfdt\libfdt\fdt_rw.c(194) : error C2220: the following warning is treated as an error
MdePkg\Library\BaseFdtLib\libfdt\libfdt\fdt_rw.c(111) : warning C4706: assignment within conditional expression
MdePkg\Library\BaseFdtLib\libfdt\libfdt\fdt_rw.c(194) : warning C4706: assignment within conditional expression
MdePkg\Library\BaseFdtLib\libfdt\libfdt\fdt_rw.c(89) : error C2220: the following warning is treated as an error

ref: https://learn.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-4-c4706?view=msvc-170

Signed-off-by: Randy <randy.lin@intel.com>
2024-08-21 08:29:42 -07:00
Guo Dong
bb44e17f86 feat: Add FdtLib
The FdtLib is from EDK2 stable branch 202311.
FdtLib is used to boot FIT image.
Replace tab with space to follow EDK2 coding style.

Signed-off-by: Guo Dong <guo.dong@intel.com>
2024-04-24 09:32:51 -07:00
Vincent Chen
6958e19e06 fix: [Common] build failed with VS2015
The current BaseTools aligned with edk2-stable202311
introduces the replacement of __FUNCTION__ with __func__,
which causes compiler failure if the toolchain is using
VS2015. It is because VS2015 doesn't support __func__.
This patch reverts the change and its checker to continue
the VS2015 support.

Reference commit IDs from edk2 repo: b17a3a1 and c9fb11f

Test command: python BuildLoader.py build xxxx -t VS2015

Signed-off-by: Vincent Chen <vincent.chen@intel.com>
2024-03-29 09:36:07 -07:00
Guo Dong
416f2d95da Sync edk2 basetool mdepkg (#2121)
* Sync BaseTools to align with edk2-stable202311

Keep the SBL specific change (e.g. Lz4).

Signed-off-by: Guo Dong <guo.dong@intel.com>

* feat: Sync MdePkg from EDK2 edk2-stable202311 branch

Only sync required file without any changes to EDK2 files.

Signed-off-by: Guo Dong <guo.dong@intel.com>

* feat: Update MdePkg for SBL after sync from EDK2

Signed-off-by: Guo Dong <guo.dong@intel.com>

* Update SBL after updating Basetool and MdePkg

After Sync BaseTool and MdePkg to edk2-stable202311,
Need update SBL code to align with this change.

Signed-off-by: Guo Dong <guo.dong@intel.com>

* feat: rollback some changes after mdepkg sync

New change from MdePkg requires new NASM version.
To make sure NASM 2.14.02 still works, just rollback
few changes.

Signed-off-by: Guo Dong <guo.dong@intel.com>

* feat: Update component size to fix build failure

After syncing BaseTool and MdePkg, some components would
have a little bigger size. So update the config to fix the
build failure.

Signed-off-by: Guo Dong <guo.dong@intel.com>

* feat: Remove unused asl code

Some ASL files don't exist but they are included in other asl files.
It would cause build failure with new build BaseTool. So just remove
them to fix the build failure.

Signed-off-by: Guo Dong <guo.dong@intel.com>

---------

Signed-off-by: Guo Dong <guo.dong@intel.com>
2024-03-08 13:43:46 -05:00
Kevin Tsai
9cbad7f916 fix: [Common] Fix Coverity issues
Identical code for different branches (CWE 398)
Untrusted loop bound (CWE 606)

Signed-off-by: Kevin Tsai <kevin.tsai@intel.com>
2023-08-10 10:25:15 -07:00
Lennert Buytenhek
7fcab220ed Align the Ia32 Stage1B/Stage2 stack to 16 bytes
Much like the corresponding Stage1A patch, this patch aligns the
Ia32 Stage1B and Stage2 stacks to 16 bytes, like what is already the
case for X64, so that we follow Version 1.0 of the System V Intel386
ABI supplement, and satisfy any expectations our compiler may have
regarding stack alignment.

A nice side effect of this change is that it allows building an Ia32
Slimbootloader with -msse which can run on real hardware, which requires
16-byte stack alignment.  Slimbootloader currently already enables SSE
in XCR0 early on in Stage1A, and it has SSE versions of various helper
functions written in assembly, in other words, it already makes use of
SSE, but allowing the compiler to emit SSE instructions requires 16-byte
stack alignment, because access to unaligned on-stack SSE variables
will throw #GP on real hardware.  (QEMU doesn't seem to enforce the
requirement for natural alignment of SSE memory arguments.)

Suggested-by: Peter Edwards <peadar@arista.com>
Signed-off-by: Lennert Buytenhek <buytenh@arista.com>
2022-09-19 11:27:03 -07:00
Maurice Ma
c7e1623c29 [MdePkg] Update to latest EDK2 stable tag 202111
This patch updated SBL MdePkg to be in sync with EDK2 stable tag
202111.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2021-12-13 14:08:25 -08:00
Lennert Buytenhek
5b51c32146 Align the Ia32 Stage1B/Stage2 stack to 16 bytes
Much like the corresponding Stage1A patch, this patch aligns the
Ia32 Stage1B and Stage2 stacks to 16 bytes, like what is already the
case for X64, so that we follow Version 1.0 of the System V Intel386
ABI supplement, and satisfy any expectations our compiler may have
regarding stack alignment.

A nice side effect of this change is that it allows building an Ia32
Slimbootloader with -msse which can run on real hardware, which requires
16-byte stack alignment.  Slimbootloader currently already enables SSE
in XCR0 early on in Stage1A, and it has SSE versions of various helper
functions written in assembly, in other words, it already makes use of
SSE, but allowing the compiler to emit SSE instructions requires 16-byte
stack alignment, because access to unaligned on-stack SSE variables
will throw #GP on real hardware.  (QEMU doesn't seem to enforce the
requirement for natural alignment of SSE memory arguments.)

Suggested-by: Peter Edwards <peadar@arista.com>
Signed-off-by: Lennert Buytenhek <buytenh@arista.com>
2021-11-19 13:41:33 -08:00
Mike Crowe
990e3e81e6 Use LF line endings in the repository
Convert the line endings stored for all text files in the repository to
LF. The majority previously used DOS-style CRLF line endings. Add a
.gitattributes file to enforce this and treat certain extensions as
never being text files.

Update PatchCheck.py to insist on LF line endings rather than CRLF.
However, its other checks fail on this commit due to lots of
pre-existing complaints that it only notices because the line endings
have changed.

Silicon/QemuSocPkg/FspBin/Patches/0001-Build-QEMU-FSP-2.0-binaries.patch
needs to be treated as binary since it contains a mixture of line
endings.

This change has implications depending on the client platform you are
using the repository from:

* Windows

The usual configuration for Git on Windows means that text files will
be checked out to the work tree with DOS-style CRLF line endings. If
that's not the case then you can configure Git to do so for the entire
machine with:

 git config --global core.autocrlf true

or for just the repository with:

 git config core.autocrlf true

Line endings will be normalised to LF when they are committed to the
repository. If you commit a text file with only LF line endings then it
will be converted to CRLF line endings in your work tree.

* Linux, MacOS and other Unices

The usual configuration for Git on such platforms is to check files out
of the repository with LF line endings. This is probably the right thing
for you. In the unlikely even that you are using Git on Unix but editing
or compiling on Windows for some reason then you may need to tweak your
configuration to force the use of CRLF line endings as described above.

* General

For more information see
https://docs.github.com/en/get-started/getting-started-with-git/configuring-git-to-handle-line-endings .

Fixes: https://github.com/slimbootloader/slimbootloader/issues/1400
Signed-off-by: Mike Crowe <mac@mcrowe.com>
2021-11-10 12:46:42 -08:00
Maurice Ma
3db9baca8d Add PciSegmentLib implementation
This patch added PciSegmentLib implementation from EDK2 MdePkg.
This library can be used by silicon libraries to access PCI
device with multiple segments. As part of this change, the
duplicated files were removed for CML and CMLV.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2021-09-22 08:32:58 -07:00
Aiden Park
6bec45136f Make x64 buildable (#619)
* Add missing X64 MdePkg Library

This adds some missing Library from EDKII Stable201911.
- MdePkg/Library/BaseMemoryLibRepStr/X64
- MdePkg/Library/BaseSynchronizationLib/X64

Signed-off-by: Aiden Park <aiden.park@intel.com>

* Make X64 target buildable

This is just to build X64 target - Not functional.

Signed-off-by: Aiden Park <aiden.park@intel.com>
2020-04-02 07:28:14 -07:00
Aiden Park
560d166792 Add X64 MdePkg Library (#610)
This adds necessary X64 Library from MdePkg
- From EDK2 Stable201911

Signed-off-by: Aiden Park <aiden.park@intel.com>
2020-04-02 07:25:06 -07:00
Maurice Ma
9c372fdf67 Sync IntelFsp2Pkg and MdePkg to EDK2 Stable201911
This patch synced IntelFsp2Pkg and MdePkg to EDK2 Stable201911.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2020-02-19 10:11:36 -08:00
Guo Dong
833ecbc46b Format update by coding style
1)  Replace TAB with spaces
2)  Convert CR, LF or LFCR to CRLF
3)  Remove trailing spaces
4)  Updated below strings:
       "EFI_D_INFO"  -> "DEBUG_INFO",
       "EFI_D_WARN"  -> "DEBUG_WARN",
       "EFI_D_ERROR" -> "DEBUG_ERROR",

Signed-off-by: Guo Dong <guo.dong@intel.com>
2020-02-07 22:43:45 -07:00
Maurice Ma
6f8c44b375 Sync up with EDK2 stable tag edk2-stable201905
Synced up MdePkg, IntelFsp2Pkg and BaseTools to EDK2 stable tag
edk2-stable201905.

There are several changes for MdePkg and BaseTools.
MdePkg:
 - Support light print to reduce SBL size
   MdePkg\Library\BasePrintLib\PrintLibInternal.c
   MdePkg\Include\Library\DebugLib.h
 - TCG TPM2 spec changes and remove dependencies
   MdePkg\Include\IndustryStandard\UefiTcgPlatform.h
   MdePkg\Include\IndustryStandard\Tpm2Acpi.h
 - Use old NVM protocol file
   MdePkg\Include\Protocol\NvmExpressPassthru.h
 - Removed unused files

BaseTools:
 - Added LZ4 support
 - Removed unused files

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2019-06-12 08:29:06 -07:00
James Gutbub
7a325d18ea Add BaseMemoryLibSse2 library
Copying the MdePkg BaseMemoryLibSse2 library into
SBL for faster CopyMem and other routines to improve
boot performance every where except for Stage1A &
Stage1B due to 'movntdq' usage limitation in earlier
stages. Remove all of the X64 files since SBL is compiled
as 32-bit. Also patch PCI enumeration code to perform
manual memory copying (using SSE2 CopyMem gives some
issue as tested on APL).

The BaseMemoryLibSse2 folder was copied from EDK2
GitHub based on the following commit ID:

9344f0921518309295da89c221d10cbead8531aa

Signed-off-by: James Gutbub <james.gutbub@intel.com>
2019-05-14 14:56:29 -07:00
Maurice Ma
c6999f497a Initial check-in for Slim Bootloader source 2018-09-13 16:11:07 -07:00