46 Commits

Author SHA1 Message Date
Sachin Kamat
93bde08c2c fix: [Common] Fix kernel panic issue
Recent Android support cleanup patch introduced a regression with
OsLoader. Kernel panic was seen while booting Ubuntu using
container. This was because, earlier the function used to return
after adding OS Mender boot info parameter for non-Android OS.
With the Android support removed, the dead code (for non-Android
cases) started getting executed causing regression. This patch
removes this code which never got executed earlier in non-Android
cases and fixes this regression.

Signed-off-by: Sachin Kamat <sachin.kamat@intel.com>
2025-03-20 10:34:35 -07:00
Sachin Kamat
268248986a fix: [Common] Remove Android OS support
Android OS support code is not used. Clean it up.

Signed-off-by: Sachin Kamat <sachin.kamat@intel.com>
2025-02-11 13:37:50 -07:00
Sachin Kamat
13997bd3f2 fix: [Common] Remove Trusty OS support
Trusty OS is not used. Clean up the code.

Signed-off-by: Sachin Kamat <sachin.kamat@intel.com>
2025-02-10 15:50:54 -07:00
Guo Dong
7db779439b [ADL/RPL] Update reset reason
Add reset reason caused by S4.
Update ADL to set reset reason.

Signed-off-by: Guo Dong <guo.dong@intel.com>
2023-09-26 09:18:00 -07:00
Guo Dong
cf38997cca Fix windows build failure
Previous patch used GCC extension "attribute__((packed))" which
caused windows build failure. This patch fixes it by using
#pragma pack().

Signed-off-by: Guo Dong <guo.dong@intel.com>
2023-09-20 14:57:31 -07:00
jizhenlo
4e3cfe8eb9 AbSupportLib: Align with Android Boot Control Block 1.1
Boot Control Block (BCB) is stored at the "misc" partition which is
used for implementing A/B boot in bootloader. This patch updates
AB_SLOT_DATA and AB_BOOT_INFO struct to align it with Android[1] and
kernelflinger[2] of project celadon.

[1] https://android.googlesource.com/platform/hardware/interfaces/+/refs/heads/main/boot/1.1/default/boot_control/include/private/boot_control_definition.h
[2] https://github.com/projectceladon/kernelflinger/blob/master/avb/libavb_ab/avb_ab_flow.h

Signed-off-by: jizhenlo <zhenlong.z.ji@intel.com>
Signed-off-by: Jiaqing Zhao <jiaqing.zhao@intel.com>
2023-09-19 17:58:18 -07:00
Jiaqing Zhao
b17d6f8c2f Fix typo EnumImageTypeAdroid
"Adroid" should be "Android".

Signed-off-by: Jiaqing Zhao <jiaqing.zhao@intel.com>
2023-09-05 20:36:54 -07:00
tsaikevin
0d45c3e60a fix: [Common] Fix Coverity issues (#1958)
Fixed dead default in switch and logically dead code (CWE 561)

Signed-off-by: Kevin Tsai <kevin.tsai@intel.com>
2023-07-19 14:03:41 -07:00
Guo Dong
42492ffea9 feat: Fix the HelloWorld build failure
When building HelloWorld, it would build failure since SBL core
package is missing in PayloadPkg.dsc since
In general, the payload should not depend on BootloaderCorePkg.
Currently PcdAcpiEnabled is used in the payload entry module and
it is defined in the BootloaderCorePkg. This patch updates the
code to remove the dependency.

Signed-off-by: Guo Dong <guo.dong@intel.com>
Signed-off-by: Atharva Lele <atharva.lele@intel.com>
2023-04-11 11:05:29 -07:00
Stanley Chang
847c12d38a OSLoader: Append mender command line only if not exist
This patch fixes the issue that OS Loader appends an unwanted
mender setting (i.e., root=PARTLABEL=primary/secondary) to Linux
kernel command line when the mender setting already exists.

With the patch, the mender setting is appended to kernel command line
only if BOOT_FLAGS_MENDER AND no existing mender setting.

Signed-off-by: Stanley Chang <stanley.chang@intel.com>
2022-11-21 10:15:54 -07:00
Randy Lin
f641779277 [Common] Fix Osloader hang when HAVE_ACPI_TABLE=0
Verified on EHL

Signed-off-by: Randy Lin <randy.lin@intel.com>
2022-08-31 16:25:53 -07:00
Maurice Ma
2c82ec68c3 Use Universal Payload hobs for serial port info
Universal Payload defined new HOBs for serial port information.
This patch switched to use the new hob instead of the old one to
retrieve serial port information.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2022-03-03 08:22:31 -08: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
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
21917377c8 Change GetSerialPortBase() API to return 64bit address
When UART bar is alloaced to 64 bit address, the current SBL API
GetSerialPortBase() only returns the lower 32 bit address, which will
cause problem for UART access. This patch fixed this issue.

Please note the patch did not change the payload HOB interface for
UART info. That needs to be updated to 64bit base address too. But this
patch does not cover that.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2021-10-21 10:09:20 -07:00
Maurice Ma
7392f16005 Move paging table build from OsLoader to Stage2
Current SBL will build full address paging table supported by CPU
only at the beginning of the OsLoader. It is better to move it to
Stage2 so that all payloads can have the full range address support
in x64 mode. It also allows Stage2 platform code to access 64bit
PCI resource.  This patch addressed this issue.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2021-10-18 08:17:30 -07:00
Aiden Park
2e9d97de20 Fix a bug in PAE 2MB paging
This will fix invalid PDP/PDE generation with PAE 2MB Pages,
and high bit calculation at PayloadEntry additionally.

Signed-off-by: Aiden Park <aiden.park@intel.com>
2021-01-23 07:42:19 -08:00
Maurice Ma
5d573cf55e Fix paging issue when PCI PMEM64 resource exists
In 32 bit SBL, when PCI PMEM64 exists, the OsLoader will hang
during boot in CreateIdentityMappingPageTables().  The function
is inteneded to be used in X64 mode only, and cannot handle
32bit well. So OsLoader should not call it for 32 bit build.

This patch also zeroed the allcated memory to ensure the unused
entries are all 0.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2021-01-21 14:08:53 -08:00
Aiden Park
02e43b4760 PayloadPkg: Build paging table to cover high MMIO region
A device in boot options can have a BAR greater than 4GB depending on PCI
64Mem/PMem resource policy.
This will allow Payload to build a paging table to cover high MMIO area.

Signed-off-by: Aiden Park <aiden.park@intel.com>
2020-09-01 17:58:58 -07:00
Maurice Ma
162b849e11 Add HelloWorld payload example
This patch added an example on how to build a HelloWorld payload
from separate DSC file.

To build a standalone HelloWorld payload, use the following command:
  BuildLoader.py build_dsc -p PayloadPkg\PayloadPkg.dsc

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2020-08-12 12:33:20 -07:00
Aiden Park
3ec0361920 Fix pointer type cast errors from Visual Studio (#617)
Visual Studio reports more pointer type cast errors with 64-bit build.
This will cover the issue on the existing targets.

Signed-off-by: Aiden Park <aiden.park@intel.com>
2020-03-27 11:03:28 -07:00
Aiden Park
29446a1c2a Pointer type cast for both 32/64-bit operation (#615)
This patch allows both 32/64-bit addressing properly.
- Pointer type cast with UINTN
- Add missing EFIAPI for APIs

Signed-off-by: Aiden Park <aiden.park@intel.com>
2020-03-26 17:30:55 -07:00
Maurice Ma
5c95bd52d8 Simply VtdPmrLib API interface
As part of the DMA memory protection, it needs API to enable/disable
DMA protection. This patch simplified the API to do that using
SetDmaProtection().

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2020-03-17 18:04:44 -07:00
Maurice Ma
0e1098d7b2 Add DMA protection in core code
This patch added DMA memory type into memory allocation pool for payloads.
This DMA memory buffer with PcdDmaBufferSize is located at address
aligned at PcdDmaBufferAlignment after Payload reserved memory. Memory
type EfiRuntimeServicesData is used to indicate DMA memory type.

Stage1B calculates the DMA memory location using fixed PCDs so that
platform can set up DMA protection as early as possible after memory is
ready. In Stage1B or Stage2 platform code should use platform VTd
information to setup PMR to protect all low memory except for the DMA
buffer range. DMA memory will be added into memory pool at the entry
point of the payload. Before transfering to OS, the DMA memory protection
can be disabled, and the DMA memory pool can be reclaimed for OS usage.

Currently only boot media device will utilize the DMA buffer range for
block access operations. So it should only be required by payloads. GFX,
when enabled, will also use DMA. It will be targeted to the system stolen
memory which is not protected by PMR.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2020-03-17 18:04:44 -07:00
Maurice Ma
a1d5f5ea0c Change AddMemoryResourceRange API interface
Current SBL AddMemoryResourceRange() API interface is not scalable.
If more memory type needs to be added, the interface does not allow
to do that. This patch changed the interface to use array and entry
count as parameter so that more ranges can be passed in using the
standard interfaces.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2020-03-16 17:05:37 -07:00