Commit Graph

46 Commits

Author SHA1 Message Date
Atharva Lele 1c807e51fa
Fix OsLoader handling of non-container images and remove PcdContainerBootEnabled (#1843)
* OsLoader: set default status to EFI_UNSUPPORTED when parsing a boot image

This was set to EFI_SUCCESS which resulted in ParseBootImages() returning
EFI_SUCCESS even if the boot image was not a container or a component.

Thus, the boot would continue and fail at a later stage due to the
LoadedImage structure not being populated correctly.

Setting it to EFI_UNSUPPORTED will result in ParseBootImages() returning
EFI_UNSUPPORTED if a non-supported boot image is provided and OsLoader
will attempt to boot the next entry in the boot options list.

Signed-off-by: Atharva Lele <atharva.lele@intel.com>

* Remove PcdContainerBootEnabled PCD

SBL requires boot images to be packaged as a container or a component

Signed-off-by: Atharva Lele <atharva.lele@intel.com>

---------

Signed-off-by: Atharva Lele <atharva.lele@intel.com>
2023-03-10 14:14:13 -08:00
Sean McGinn ceea7d1d03 Rename PCD for SBL component corruption command
Signed-off-by: Sean McGinn <sean.mcginn@intel.com>
2022-10-17 11:59:04 -07:00
Sean McGinn b82dcd344f Add PCD for enablement of corruptcomp tool
Adds build-time PCD that hides corruptcomp
tool by default
Renames corruptcomponent to corruptcomp
Enhances error checking/logs

Signed-off-by: Sean McGinn <sean.mcginn@intel.com>
2022-10-17 11:59:04 -07:00
bejeanmo 15f365d774
fix: [ADL] TCC was never getting enabled via the board config option. (#1715)
PcdTccEnabled was declared as a FeaturePcd which evaluates to a code symbol
and can't be used in a #if. From the preprocessor perspective it is always
undefined. Changed this pcd to a FixedPcd instead.

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

Signed-off-by: Bejean Mosher <bejean.mosher@intel.com>
2022-10-10 16:42:22 -04:00
Subash Lakkimsetti 0eceb0cfe7
Update Universal payload hob for secure boot. (#1695)
Universal paayload hobs are updated for secure boot
and measured boot. Event logs Hobs are created to consume
by TCG2Dxe in uefi payload.

Signed-off-by: Subash Lakkimsetti <subash.lakkimsetti@intel.com>

Signed-off-by: Subash Lakkimsetti <subash.lakkimsetti@intel.com>
2022-10-06 08:48:06 -07:00
Raghava Gudla 0e6cda520d Add support for getting csme boot time perf data
This patch added support to get csme boot time performance
data and display it in perf command and also before booting
to linux.

Introduced a board config option BOOT_PERFORMANCE_MASK to control
PcdBootPerformanceMask, BIT 2 now enables printing CSME boot
performance data.

Signed-off-by: Raghava Gudla <raghava.gudla@intel.com>
2022-05-11 09:02:52 -07:00
Stanley Chang e9ee58d8ce Add USB command timeout control
A USB disk behind a hub may take longer time to respond command.
Prior to the patch, a magic 2000 ms is set. This patch introduces
a python control (USB_CMD_TIMEOUT) for customizing the timeout if
need. The patch also extends the default timeout to 4196 ms.

This patch does not impact booting time when a platform boots with
a good-conditioning usb disk, because the timeout only takes effect
when a disk does not respond to a USB inquiry for a long time.

Verified: Ehl RVP

Signed-off-by: Stanley Chang <stanley.chang@intel.com>
2022-04-12 08:42:07 -07: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 9f31593b58 Add Universal Payload library support
Universal Payload uses ELF format. As a result, the ELF loading
library has been enhanced to handle more complicated cases. The
Universal Payload library added an abstract layer on top of
ELF lib to make it easer to use by SBL. OsLoader and Stage2 were
modified to work with the new library interfaces.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2021-10-04 11:59:55 -07:00
Maurice Ma 5c98b11ecd Add UniversalPayload header files
This patch added universal payload header files.  Thess files
were copied from EDK2 MdeModulePkg.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2021-09-30 18:19:13 -07:00
Ong Kok Tong b78cbcf128 [EHL] s0ix fix for Fusa sku
Enable s0ix only for Non-Fusa sku
Removed PcdPreOsCheckerEnabled PCD flag

Signed-off-by: Ong Kok Tong <kok.tong.ong@intel.com>
2021-06-22 06:26:34 -07:00
Guo Dong c551826af5 Add TCC V2 support
1) Add PCD PcdTccEnabled so that TCC could build out when disabled
2) Add HOB gTccRtctHobGuid produced by FSP if FSP support TCC V2
3) Add a common TCC config data in common platform package
4) Add a common TCC lib to update TCC RTCT table.

Signed-off-by: Guo Dong <guo.dong@intel.com>
2021-03-30 22:09:00 -07:00
Maurice Ma 04b162e75e Add CPU X2APIC support
This patch added X2APIC support. It is to enable the case when
APIC ID is greater than 255. This patch only handle core wakeup
portion. Platform still needs to handle ACPI related changes for
X2APIC.

X2APIC lib is backward compatible with XAPIC lib. So there is no
need to use XAPIC lib anymore.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2021-02-12 17:20:57 -08:00
Guo Dong 45be2a8daa Build MP CPU TASK info hob
With this hob, user could run a task from AP in Osloader.

Signed-off-by: Guo Dong <guo.dong@intel.com>
2021-02-08 09:31:08 -07:00
Guo Dong 4430620e4b
Add FSP boot performance data (#678)
FSP could produce a FSP boot performance HOB.
So add the capability to print FSP performance data.
Also add a PcdBootPerformanceMask to enable/disable
boot performance data print.

Signed-off-by: Guo Dong <guo.dong@intel.com>
2020-04-16 23:31:35 -07:00
Subash Lakkimsetti ccddad8d2d
RSA PSS verification scheme (#640)
This patch adds support for RSA PSS verification.
Ported IPP Crypto for PSS from latest IPP github repo.
Secure boot lib and RSA wrappers functions are
updated. RSA verfication sheme is would be
based on SigType in Signature Header.

PcdCompSignSchemeSupportedMask indicates the signing
scheme included in IPP lib.

Signed-off-by: Subash Lakkimsetti <subash.lakkimsetti@intel.com>
2020-04-10 16:54:22 -07:00
Aiden Park 123ccd06db
Build PCI Root Bridge Resource Info Hob (#649)
This will create a HOB for PCI Root Bridge Resource information.
The PciRootBridgeInfo Hob can be used to update resource ranges of multiple
root bridges in platform PCI tree ASL.
A payload can also use this info to skip duplicated root bridge scan.

Signed-off-by: Aiden Park <aiden.park@intel.com>
2020-04-09 12:27:26 -07:00
Maurice Ma 211b6019f0
Add multiple USB boot device support (#614)
When multiple USB mass storage boot devices are connected, current
SBL will only boot from the 1st one enumerated by the USB bus. This
patch added support to boot from the remaining devices. This feature
will be controlled by PcdMultiUsbBootDeviceEnabled. And it can be
overridden by board using ENABLE_MULTI_USB_BOOT_DEV. When it is enabled
for USB block IO interface, the hardware partition in boot option
will be used to indicate the index of the USB mass storage devvice.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2020-03-26 17:19:53 -07:00
Maurice Ma 2fab0b7dce Add IoMmuLib implementation
This patch added IoMmuLib support so that device can allocate/free
DMA memory and map/unmap host memory to DMA memory. This lib was
added into AHCI inf file so that it can be tested for build. Later
on more patches will be submitted to enable DMA protection for each
media library such as AHCI, XHCI, eMMC, UFS, NVMe, etc.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2020-03-16 17:06:16 -07:00
Subash Lakkimsetti aefc311823 TPM and Measured boot support SHA384 and SM3
Current Slimbootloader supports only TPM for SHA256 PCR.
This patch introduces flexibility for user to select TPM
PCR bank available while build. Support of SHA384 and
SM3 to TPM measured boot are added.

Added/modified TPMLib APIs to support multiple PCR
usecases. Currently one PCR active bank usecase is supported.

For first boot SHA256/default TPM PCR would be available which
is default for most supported TPM's. Selected TPM PCR will be
available after reboot.

TPM selection would be based on PcdMeasuredBootHashMask set at
build time.

Signed-off-by: Subash Lakkimsetti <subash.lakkimsetti@intel.com>
2020-01-13 08:30:45 -08:00
Subash Lakkimsetti 79abb75ed6 Enable RSA3072 and SHA384 signing support
This patch introduces support for RSA3K and SHA384 signing
And verifications support to Slimbootloader. Component hash
verification is done using PcdCompSignHashAlg.

To enable RSA3072 and SHA384,
 - Signing hash algorithm SIGN_HASH_TYPE should be set to SHA2_384
 - RSA3K private keys should be configured in platform board configs.
 - Set IPP_CRYPTO_ALG_MASK to include SHA2_384
 - Enable required IPP_CRYPTO_OPTIMIZATION_MASK
 - Default siging hash type is set to SHA2_256. Use hash type option
   while using the tools as Gencontainer, CfgDataTool in standalone
   mode.

Signed-off-by: Subash Lakkimsetti <subash.lakkimsetti@intel.com>
2020-01-02 11:23:49 -07:00
Raghava Gudla 76ab33cc94 Skip updating FWST table with csme driver info.
CSME driver is not a component rather it is a driver to
update CSME binary, so it is not required to update status
of the driver to FWST ACPI table.

As part of the above change, gCsmeFWUDriverImageFileGuid is
moved from PayloadPkg.dec to bootloadercommonpkg.dec

Signed-off-by: Raghava Gudla <raghava.gudla@intel.com>
2019-12-19 14:51:41 -07:00
Maurice Ma 12f6f62630 Add MiniShell support for debug purpose
Soemtimes when JTAG based debug is not available, it might be easier
to have Shell access in earlier stage to check lots of platform
settings. Today it is impossible because full Shell has lots of other
dependencies which might not satisfy in early stage. This patch added
a PCD PcdMiniShellEnabled to build a mini Shell with very few
dependencies. This mini Shell can be used in early debug phase for SBL.

To use it, add the following to override the PCD for a specific stage
in BootloaderCorePkg.dsc.
EX:
    $(PLATFORM_PACKAGE)/Stage1B/Stage1B.inf {
      <PcdsFeatureFlag>
        gPlatformCommonLibTokenSpaceGuid.PcdMiniShellEnabled | TRUE
      ...
    }
Then include ShellLib.h in stage C code and add ShellLib in related
stage INF file. If adding it into Stage1A, it needs to be after the
Stage1A banner print out.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2019-12-18 21:29:07 -07:00
Subash Lakkimsetti a3fa16511c Add support for AVX and SSE4 optimizations in IPP SHA384
AVX(G9) and SSE4(W7) is added to IPP crypto lib.
PcdCryptoShaOptEnabled is added to enable optimzations
in IPP SHA256 and SHA384.

Default is set to V8 (SSE3) for SHA256. ENABLE_CRYPTO_SHA_OPT has to
be configured in Platform board config files for optimizations
to be enabled.

Signed-off-by: Subash Lakkimsetti <subashx.lakkimsetti@intel.com>
2019-12-03 21:36:29 -08:00
Aiden Park b24fd2759c Cosmetic: Convert LF to CRLF
This will fully support PatchCheck.py.
- Remove all trailing whitespace
- Convert LF to CRLF by default
- Update EFI_D_* to DEBUG_*
- Re-enable CRLF check in PatchCheck.py

Signed-off-by: Aiden Park <aiden.park@intel.com>
2019-12-02 16:21:19 -08:00
Guo Dong 2b3b41ecf5 Add debug port support
PcdDebugInterfaceFlags and PcdDebugOutputDeviceMask are defined
for debug devices, so removed PcdDebugInterfaceFlags.

Add a new PCD PcdDebugPortNumber to indicate the serial debug
number.

Signed-off-by: Guo Dong <guo.dong@intel.com>
2019-12-02 09:17:05 -07:00
Aiden Park d362ef39ec Cosmetic: Remove TAB characters (Tab to Space)
No code change. To check TABs in PatchCheck.py.

Signed-off-by: Aiden Park <aiden.park@intel.com>
2019-11-21 12:11:37 -08:00
Aiden Park ae9068e80c
Fix no SBL serial output after restart Windows (#459)
SerialPortLib sets UART Scratch Register to a known value at the first
initialization to avoid unnecessary re-initialization afterward. But,
one of Windows driver(SIO) re-configures UART Registers while the Scratch
Register is preserved. As a result, SBL skips serial port initialization
after restarting from Windows.
Therefore, force to initialize Serial Port at Stage1A all the time simply.

Signed-off-by: Aiden Park <aiden.park@intel.com>
2019-11-18 19:14:44 -08:00
Subash Lakkimsetti ae3c5ae9b5 Add SHA384 and SM3 wrapper library support from IPP crypto
Functionality to Crypto Hash function is guarded with an
PcdIppHashLibSupportedMask.

PcdIppHashLibSupportedMask indicates IPP crypto algo supported

Signed-off-by: Subash Lakkimsetti <subashx.lakkimsetti@intel.com>
2019-11-12 09:58:54 +08:00
Aiden Park 70b5afb6b3 [OsLoader] Clean-up PreOsChecker
Split PreOsChecker in a separate file and add minimum APIs
- IsPreOsCheckerLoaded ()
- LoadPreOsChecker ()
- StartPreOsChecker ()

Token space has been changed for PcdPreOsCheckerEnabled
- gPlatformModuleTokenSpaceGuid to gPlatformCommonLibTokenSpaceGuid
- Include/Excluded PreOsChecker according to FeaturePcd

Signed-off-by: Aiden Park <aiden.park@intel.com>
2019-10-16 16:45:53 -07:00
Maurice Ma 14ddaab0a7 Allow platform to degrade eMMC from HS400 to HS200
This patch allows platform to degrade eMMC HS400 to HS200 using
static configuration. To do this, please add the following into
BoardConfig.py:
  self.ENABLE_EMMC_HS400 = 0
This is useful when platform has hardware issue to run at eMMC
HS400 mode.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2019-10-15 08:23:31 -07:00
Sai Talamudupula 709d7c1470 Support boot image from container
Add support to load the boot image from container.
Container must be signed using the same private key
as the key used to sign IAS (i.e. IAS_PRIVATE_KEY).

Signed-off-by: Sai Talamudupula <sai.kiran.talamudupula@intel.com>
2019-10-02 12:18:45 -07:00
Sai Talamudupula f0b5eaf43a Add UEFI Get Variable support
Users might want to have some parameters that can be set
from UEFI environment. UEFI NVRAM variables provide a way
to achieve this functionality. And they require these vars
to be read from bootloader.

This patch provides a library to get read access to the
UEFI variables stored in NV region. The driver was ported
from MdeModulePkg\Universal\Variable\Pei @ EDKII Open Source.

Signed-off-by: Sai Talamudupula <sai.kiran.talamudupula@intel.com>
2019-08-16 07:25:20 -07:00
Maurice Ma 93b2e96d8e Add ContainerLib to support sub-region
This patch added a ContainerLib to support load and location a
component from a specified container. It copies the component
from flash to memory, authenticate it, and then decompress it if
required. It can also be used to support load component from flash
map in SBL stage2 or payload, such as payload or e-payload.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2019-07-31 09:32:00 -07:00
Guo Dong 5e10bd1e07 Update BSD license to BSD+Patent license
To align with EDK2, update file license
to use BSD+Patent license

Signed-off-by: Guo Dong <guo.dong@intel.com>
2019-06-13 10:46:49 -07:00
Guo Dong 5c041c0fe1 Clean up graphics HOBs
Removing the HOB defined by SBL to use generic HOBs from EDK2.
Update GraphicsLib for above HOB change.
Update osloader and multibootLib for hob change.
update APL and Qemu platform for hob change.

Signed-off-by: Guo Dong <guo.dong@intel.com>
2019-04-10 10:23:58 -07:00
Raghava Gudla f514ba35b7 Added support for FWST OEM ACPI table
This patch added support for FWST ACPI table. This table
contains generic address structure which has pointer to the
EFI System Resource Table.

ESRT table for now supports only system firmware. This table
will provide the operating system and tools knowledge of what
is the last attempt status and version of the system firmare
update.

Signed-off-by: Raghava Gudla <raghava.gudla@intel.com>
2019-03-20 16:03:57 -07:00
Guo Dong ee4b3f812f Add SMM support to UEFI payload
Build a new SMM info HOB to payload to report SMM info.
Add UEFI payload variable region into flash map.

TEST=Tested on LeafHill with UEFI payload.

Signed-off-by: Guo Dong <guo.dong@intel.com>
2019-01-22 17:11:54 -07:00
Guo Dong 501be46716 Update file system support
The patch gives the platform the configuration capability to only build
required file system into final image.
This helps to have a smaller image for fast boot.

Signed-off-by: Guo Dong <guo.dong@intel.com>
2018-11-27 15:09:14 -07:00
Guo Dong cd9edfdd8b Add Device table
Update core code to support device table.
Updated boot option to consume device table.
Update firmware update to consume device table.
Update shell command on boot option changes.
Add device table for APL and Qemu.
Remove unnecessary code.

Signed-off-by: Guo Dong <guo.dong@intel.com>
2018-11-12 09:38:59 -07:00
Maurice Ma 697c02302f Enable USB keyboard console support for QEMU
Previous USB keyboard console support commit worked fine on APL real
platform, but it has issue on QEMU. This patch further enables USB
keyboard console support for QEMU. A new PcdUsbKeyboardPollingTimeout
is added. It will be used to control the USB keyboard interrupt
transfer polling timeout. For QEMU, it needs a larger number due to
timing issue. As part of it, booting from USB device is also enabled
by this patch. This patch fixes #30.

To test USB keyboard console in QEMU, please first change
CONSOLE_IN _DEVICE_MASK in BoardConfig.py to 3, and then add the
following in the QEMU command line to add XHCI controller and USB KB:
-device qemu-xhci,id=xhci,bus=pcie.0,addr=4 -device usb-kbd,bus=xhci.0

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2018-10-29 09:39:27 -07:00
Borgerson, Matthew A 2255bc10b0 Enable basic framebuffer text console output
This patch simplifies the GraphicsLib code and adds an abstraction layer
for printing to a virtual "console," through the familier
ConsoleWrite(buffer, len) style function call.

ConsoleWrite can be configured to output to either the serial port, or
the display framebuffer, or both. This primarily enables the command
shell to be used with a display and keyboard.

Signed-off-by: Borgerson, Matthew A <matthew.a.borgerson@intel.com>
2018-10-25 19:25:44 -07:00
Aiden Park b6697f12a8
Enable DebugAgentLib to support source level debug over serial (#18)
* Enable DebugAgentLib to support source level debug over serial

By default, source level debug is NOT enabled. ENABLE_SOURCE_DEBUG
needs to be set to 1 in BoardConfig.py of each Platforms.
- self.ENABLE_SOURCE_DEBUG  = 1

As an initial drop, there are some limitations on APL platform.
- Stage1A does not include DebugAgentLib due to Stage1A size
  limitation(32KB). Further optimization is required.
- DebugAgentLib supports ONLY POSTMEM debugging on APL currently.

Refer to EDKII Debugging:
- https://github.com/tianocore/tianocore.github.io/wiki/EDK-II-Debugging
- https://github.com/tianocore/tianocore.github.io/wiki/SourceLevelDebugPkg

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

* Additional changes for DebugAgent

- Adjust stage size depending on ENABLE_SOURCE_DEBUG Pcd value
- Add PeCoffFindAndReportImageInfo
- Fix debugger hang at Shell

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

* Move PeCoffFindAndReportImageInfo() from LitePeCoffLib to DebugAgentLib

Change-Id: I2c4ab4f9561dfd0536da1820048f0e5f2660e2ab
Signed-off-by: Aiden Park <aiden.park@intel.com>
2018-10-15 10:45:23 -07:00
Maurice Ma bd1ea24cc1 Add ConsoleInLib to abstract console input (#13)
Current implementation assumes serial port is the only input console
device supported.  But other input console devices can be added later
on. This patch added a ConsoleInLib to abstract the input console
interfaces.  It also added PCDs to control enabled input console
devices.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2018-10-05 14:36:29 -07:00
Maurice Ma c6999f497a Initial check-in for Slim Bootloader source 2018-09-13 16:11:07 -07:00