130 Commits
Author SHA1 Message Date
Stanley Chang 9240705ab8 fix: [ADL] Refactor the UpdateResetReason #2442
This commit refines the UpdateResetReason for ADL with the following improvements:
1. Replacing IsRebootByWdt with WasBootCausedByTcoTimeout. Previously, ADL utilized
   IsRebootByWdt, which was incorrect and redundant. The incorrect aspect involved
   checking a non-existent bit field (TCO_STS_NO_REBOOT), while the redundancy lay
   in its functionality being identical to WasBootCausedByTcoTimeout(). Consequently,
   this commit removes IsRebootByWdt and substitutes IsRebootByWdt with
   WasBootCausedByTcoTimeout.

2. Prioritizing S3/S4 for RstCause assignment in UpdateResetReason. The original code
   assigned ResetWakeS3 or ResetWakeS4 or S3/S4 resume at the end of the check logic.
   However, ResetWakeS3 and ResetWakeS4 already imply a successful resume, allowing us
   to move these checks to the beginning of the function.

3. Setting ResetUnknown for MMIO failure.

4. Setting ResetUnknown for B_PMC_PWRM_GEN_PMCON_A_PWR_FLR. This should be an independent
   check, rather than an "else-if" check as in the original code.

5. Simplifying the check for ResetWarm and ResetCold, as both are held when
   B_PMC_PWRM_GEN_PMCON_A_HOST_RST_STS is set.

Additionally, the commit skips ResetWakeS4 for crash mode in GetCurrentBootOption.
Finally, it removes the UpdateResetReason from TGL and EHL as it is unused.

Signed-off-by: Stanley Chang <stanley.chang@intel.com>
2025-05-20 10:36:20 -07:00
Bejean Mosher 7f169cb0a5 fix: PayloadMod stack base alignment in x64.
RSP must be 16 byte aligned in x64.

Signed-off-by: Bejean Mosher <bejean.mosher@intel.com>
2025-02-18 18:56:50 -07:00
Sachin Kamat 71ebc9a812 fix: [Common] Remove Clear Linux support
Clear Linux support code is not used. Clean it up.

Signed-off-by: Sachin Kamat <sachin.kamat@intel.com>
2025-02-12 13:49:03 -07:00
Chirag Vijay Kolhe a41dc0aad4 fix: [Common] Remove IAS boot image support
IAS boot image format is deprecated; it is recommended to use container
boot image.

 - Removed references,files related to IAS image.
 - Replaced IAS image boot options with container type image.

Signed-off-by: Chirag Vijay Kolhe <chirag.vijay.kolhe@intel.com>
2025-02-11 13:45:09 -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
Sachin Kamat 5beedb6ee6 fix: [Common] Remove ACRN support
ACRN is not used. Clean up the code.

Signed-off-by: Sachin Kamat <sachin.kamat@intel.com>
2025-02-06 10:13:26 -07:00
Jiaqing Zhao 33060efdc6 OsLoader: Handle module align flag for multiboot images in ELF format
There is a flag in both multiboot and multiboot2 image indicating
modules must be loaded to page boundaries. Currently this flag is not
handled when loading multiboot images in ELF format. Check this flag
and move the loaded modules if needed before SetupMultibootInfo().

Signed-off-by: Jiaqing Zhao <jiaqing.zhao@intel.com>
2024-06-24 06:54:21 -07:00
Biswas Arghya f8bfe71c06 feat:[Common] boot from an image from memory
Add a new entry in CfgData_BootOption.yaml to boot from memory. The boot
device must be 7 (MEMORY), and the address of the container boot image
(CONTAINER_BOOT_SIGNATURE) can be placed at an address specified by
LBA format (i.e., use HEX prefix. EX: #0x12345678).

Example entry of CfgData_BootOption.yaml:
!expand { BOOT_OPTION_TMPL : [ 0 , 0,  0,  7,   0 ,   0 ,   0xFF ,   1 , '#0x47A31000'] }

If the address is not predefined then it can be updated in run time from
SBL shell boot option table.

Validated by loading a container image to the memory by using 'fs load'
command in SBL shell and update the load image address in boot option table.

Signed-off-by: Biswas Arghya <arghya.biswas@intel.com>
2024-03-18 10:04:41 -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
Jiaqing Zhao 338ba840bf OsLoader: Print misc image info in Shell
Add support to print misc image info in shell. Misc image will only be
printed when BOOT_FLAGS_MISC is set.

Also fixes some minor bugs in 5968cfa919 ("OsLoader: Print all extra
images")

Signed-off-by: Jiaqing Zhao <jiaqing.zhao@intel.com>
2023-09-19 17:58:18 -07:00
Jiaqing Zhao c65cd572d2 OsLoader: Print all extra images
Currently only PreOs and Extra0 image info is printed in boot options
list, this patch prints all of them.

Signed-off-by: Jiaqing Zhao <jiaqing.zhao@intel.com>
2023-09-12 13:55:06 -07:00
Jiaqing Zhao 5968cfa919 OsLoader: Shell support for FILE_IMAGE_LOCATION
Support printing and modifying boot file info in FILE_IMAGE_LOCATION
struct in OsLoader shell.

Signed-off-by: Jiaqing Zhao <jiaqing.zhao@intel.com>
2023-09-12 13:55:06 -07:00
Jiaqing Zhao c6ee0e7859 OsLoader: Add MULTIBOOT_MODULE container support
MULTIBOOT_MODULE container is handled in a similar way as modules in
MULTIBOOT container when loading and parsing. If the normal image is
multiboot/multiboot2 format, these modules in extra images will be
appended to it in SetupBootImages().

Signed-off-by: Jiaqing Zhao <jiaqing.zhao@intel.com>
2023-09-12 13:55:06 -07:00
Jiaqing Zhao fe9d1a195a OsLoader: Add A/B support for GetBootImageFromFs()
Adds A/B support for GetBootImageFromFs(), the behavior is the same as
GetBootImageFromRawPartition(). When loading from B partition, it will
load the container file at the sampe path from next SwPart.

Signed-off-by: Jiaqing Zhao <jiaqing.zhao@intel.com>
2023-09-12 13:55:06 -07:00
Jiaqing Zhao 49f5ae55ea OsLoader: Support loading extra images from other partitions
This patch adds a new struct FILE_IMAGE_LOCATION in BOOT_IMAGE to store
the SwPart and FsType of image file. This enables loading extra images
from a partition different than normal image.

Signed-off-by: Jiaqing Zhao <jiaqing.zhao@intel.com>
2023-09-12 13:55:06 -07:00
Jiaqing Zhao 77c6c82c82 OsLoader: Initialize SwPart in LoadBootImages()
Move the initialization process of SwPart to support loading extra
images from other partitions in future.

Signed-off-by: Jiaqing Zhao <jiaqing.zhao@intel.com>
2023-09-12 13:55:06 -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 462a0c32ea fix: [Common] Fix coverity issues (#1989)
Addressed coverity issues
- Untrusted loop bound (CWE 606)
- Uninitialized pointer read (CWE 457)
Defined Elf file max section, program numbers and size

Signed-off-by: Kevin Tsai <kevin.tsai@intel.com>
2023-08-10 17:46:46 -07:00
tsaikevin d952b1487c fix: [Common] Fix Coverity issues (#1978)
Fixed Untrusted loop bound (CWE 606)

Signed-off-by: Kevin Tsai <kevin.tsai@intel.com>
2023-07-31 16:06:00 -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
Stanley Chang c9d70e74dc fix: multiboot mod string in zero-terminated ASCII format #1913
Required by multiboot spec (*1), a mod string is a zero-terminated
ASCII string. The patch introduces LoadMultibootModString to load
mod string from a IMAGE_DATA (allocating a new buffer when requiring
to append zero-terminated char).

The patch does not reuse GetFromConfigFile because GetFromConfigFile
was designed to be compatible with legacy format (e.g., EOF signature)
and truncates newline chars (which is not required by multiboot mod).

For performance, the patch does not run "isascii" check.

Minor changes:
  - Fix typo error (InitMultibootMmap)
  - Declare FreeImageData in Library/IasImageLib.h
  - Dump mod string for debug build

Reference:
1. https://www.gnu.org/software/grub/manual/multiboot/multiboot.html

Verify: EHL CRB

Acked-by: Jiaqing Zhao <jiaqing.zhao@intel.com>
Signed-off-by: Stanley Chang <stanley.chang@intel.com>
2023-06-07 14:27:22 -07:00
Atharva Lele 3422681785 feat: add SBL boot performance data to FPDT (#1890)
Adds SBL boot performance data (Stage1 time, Stage 2 time, OsLoader time)
to the FPDT with type 0x3000 (Reserved for platform firmware Vendor usage)

Other fixes:
- Move logging of measure point 40F0 inside the condition for measured boot
- Add missing call to log measure point 40E0 used to log kernel setup print
  time

Signed-off-by: Atharva Lele <atharva.lele@intel.com>
2023-05-23 10:26:34 -07:00
Guo Dong 474fb76f1d feat: Update the lite variable usage
Since lite variable API change, this patch Update
the caller to align with variable library.

Signed-off-by: Guo Dong <guo.dong@intel.com>
2023-05-10 12:16:57 -07:00
Sean McGinn f4d890a479 Remove unnecessary packages/includes from OsLoader
Signed-off-by: Sean McGinn <sean.mcginn@intel.com>
2023-05-04 13:25:07 -07:00