35 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
tsaikevin fc11630e3b fix: [Common] Fix coverity issues (#2152)
Address following coverity issues
1. Untrusted loop bound (CWE 606)
2. Dereference after and before null check (CWE 476)
3. Out-of-bounds read (CWD 125)

Signed-off-by: Kevin Tsai <kevin.tsai@intel.com>
2024-03-08 16:32:25 -05: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
Kevin Tsai fdb6714ea2 fix: [Common] Fix Coverity issues
Fixed CWE 476 NULL Pointer Dereference
Prevent DebugAssert from Coverity scan

Signed-off-by: Kevin Tsai <kevin.tsai@intel.com>
2023-06-21 10:07:32 -07:00
Kevin Tsai b7804ddaf7 fix: [Common] Fix Coverity issues
Fixed CWE 476 NULL Pointer Dereference

Signed-off-by: Kevin Tsai <kevin.tsai@intel.com>
2023-06-20 14:13:31 -07:00
bejeanmo 82d0a283c9 feat: [ADL/RPL] Add core changes to allow for platform CrashLog support. (#1760)
- Added ADL BERT table template
- Added CrashLogLib calls from ADL board init lib  at PostMemInit and
    PlatformUpdateAcpiTable
- Added CrashLogLib header and Null Lib
- Added header file for Common Platform Error Record definitions.

Signed-off-by: Bejean Mosher <bejean.mosher@intel.com>

Signed-off-by: Bejean Mosher <bejean.mosher@intel.com>
2022-11-21 12:16:48 -05: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
Sean McGinn 82e1f4988d Amend SmbusLib for SBL resiliency
Signed-off-by: Sean McGinn <sean.mcginn@intel.com>
2022-08-07 17:21:33 -07:00
Maurice Ma 6eb006beea Add MP service for payload
This patch adds a MpServiceLib for payload so that a payload
can utilize this library to run tasks on specified processor.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2022-03-02 09:04:08 -08: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
Guo Dong 5d0195f962 Build SMM HOBs for universal payload
UEFI payload built from open sourced EDK2 supports SMM variable now.
So build the required HOBs to work with EDK2.
This patch just changed the common SBL code, so there is no platform
change required.
This patch also added a PCD PcdBuildSmmHobs for old SMM HOBs and new
SMM HOBs. Late old SMM HOBs might be dropped.

Signed-off-by: Guo Dong <guo.dong@intel.com>
2021-11-04 11:50:00 -07: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
Maurice Ma cf5293c55c Restruct MpInit NASM code
This patch restructed MP init library so that more code can be
common between 32bit and 64bit. It is much easier to maintain the
code after the restructure.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2021-04-19 08:53:55 -07:00
Guo Dong 91d4104ff0 Add LowPowerIdleTable header file
this header file is copied from EDK2 MdePkg and used for low power support.

Signed-off-by: Guo Dong <guo.dong@intel.com>
2020-07-16 13:47:23 -07:00
Subash Lakkimsetti 5804d9a18a Measure firmware debugger launch
Platform debug mode is extended to PCR[7]
as part of secure boot policy. Updated bit setting
to LoaderPlatformInfo for payloads to consume.
Debug mode is checked in payload.

ArchitecturalMsr.h ported fom EDK2 repo.

Signed-off-by: Subash Lakkimsetti <subash.lakkimsetti@intel.com>
2020-05-05 15:07:15 -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