Commit Graph

240 Commits

Author SHA1 Message Date
Maurice Ma 0311566858 Use container format for key hash store
This patch converted key hash store in SBL image into container
format. In this way unified data structure can be used to
simplify code.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2020-06-16 11:20:12 -07:00
Aiden Park 2045b00eef Remove wbinvd() in warm reset
The unnecessary wbinvd() is removed from the common ResetSystemLib,
and it moves to a platform specific reset routine.

Signed-off-by: Aiden Park <aiden.park@intel.com>
2020-06-11 10:17:15 -07:00
Mutha f254d2762d Booting linux from BIOS and PDR region.
SPI driver is updated to support read linux from
BIOS and PDR region, When boot device SPI is
selected.

Signed-off-by: Mutha <naga.naveen.mutha@intel.com>
2020-06-08 11:52:40 -07:00
Maurice Ma 8eb31ee3f6 [APL] Fix SD card boot issue on Intel CRB boards
This patch fixed OsLoader boot from SD card issue on Intel APL CRB
borads. The SD/eMMC library was updated to follow the proper sequence
for SD card. Also platform code was updated to detect SD card and
apply SD card power using proper GPIO pins.

It fixed #729.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2020-06-01 10:08:51 -07:00
Guo Dong 7edce89fb1
Support X64 UEFI payload (#728)
IA32 UEFI payload uses PE format and X64 UEFI payload uses
PE+ format. So update LitePeCofflib to support both PE and
PE+.

Signed-off-by: Guo Dong <guo.dong@intel.com>
2020-05-29 10:15:12 -07:00
Maurice Ma e0c4326b81 Fixed several Klocwork scanning issue
Fixed several Klocwork issues reported for CFL build.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2020-05-28 09:43:12 -07:00
Aiden Park 2f076387a0 Check SATA controller at Ahci Init
This will fix an unexpected exception when AhciHcPciBase is invalid
or the PCI config space is not enabled.

Signed-off-by: Aiden Park <aiden.park@intel.com>
2020-05-22 12:20:57 -07:00
Maurice Ma fc6aa78708 Add OEM container verification support
Current SBL supports container header verification. If the container
signature is BOOT, it will use HASH_USAGE_PUBKEY_OS. Otherwise, it
will use HASH_USAGE_PUBKEY_CONTAINER_DEF. This patch added OEM signed
container support. If a container signature between OEM0 to OEM7 is
found, it will be verified use HASH_USAGE_PUBKEY_OEM(x) where x is 0
to 7. To add an OEM public key hash, it can be done by updating
pub_key_list in GetKeyHashList() in file BoardConfig.py.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2020-05-22 12:19:50 -07:00
Subash Lakkimsetti 1ac8e390c4 Firmware update in command mode
This patch adds generic functionality to
process Flash descriptor lock. It follows
Capsule Firmware update flow and interface
is updated. Command (CMDI) interface is added
to GenCapsuleFirmware which takes file with
command as input.

Sample Command format in text file input,
{FLASHDESCLOCK}
{Command2}
{Command3}

Firmware update lib handler parses high level commands
Specific command process and functionlity would be
performed by platform specific libraries.

Signed-off-by: Subash Lakkimsetti <subash.lakkimsetti@intel.com>
2020-05-20 09:38:47 -07:00
Subash Lakkimsetti 47a15937a1 String function Support library
Add string functionality in Osloader to a
common library

Signed-off-by: Subash Lakkimsetti <subash.lakkimsetti@intel.com>
2020-05-13 08:34:20 -07:00
Maurice Ma 248f4985e8 Fix build warning for missing header files
This patch added missing C header files in INF file. It fixed the
build warning message.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2020-05-12 14:32:40 -07:00
Sai Talamudupula 12a613a831 Fix Klockwork issue flagged in PagingMap lib
Klocwork reports a potential dereferencing of a NULL
pointer. This patch addresses the issue.

Signed-off-by: Sai Talamudupula <sai.kiran.talamudupula@intel.com>
2020-05-11 17:04:34 -07:00
Vegnish Rao 1deb84fcfa
Fix Klockwork issue flagged in BootloaderCommonPkg (#705)
Fix for: Klockwork flags multiple variables being used uninitialized

Signed-off-by: Vegnish Rao <vegnish.rao.paramesura.rao@intel.com>
2020-05-08 09:06:22 -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
Himanshu Sahdev aka CunningLearner 74aa53e77a TpmLib: Add appropriate comparison checks
Signed-off-by: Himanshu Sahdev aka CunningLearner <sahdev.himan@gmail.com>
2020-05-05 15:04:20 -07:00
Himanshu Sahdev aka CunningLearner f11d4be58e TpmLib/Tpm2Capability.c: Fix typos
Signed-off-by: Himanshu Sahdev aka CunningLearner <sahdev.himan@gmail.com>
2020-05-05 15:04:20 -07:00
Aiden Park e99762353a
Introduce CONSOLE_PRINT macro (#701)
This will allow necessary messages to be printed to consoles.

These macros will redirect debug message to consoles.
  CONSOLE_PRINT
  CONSOLE_PRINT_UNICODE

These conditional macros will redirect debug message to consoles or
DEBUG(). The PrintLevel is valid only when redirected to DEBUG().
  CONSOLE_PRINT_CONDITION
  CONSOLE_PRINT_UNICODE_CONDITION

Signed-off-by: Aiden Park <aiden.park@intel.com>
2020-05-04 14:53:08 -07:00
Guo Dong 82eb72c9a7
Add MtrrLib with a MTRR display function (#693)
To help debug boot performance, add a MTRR print function.
This function could be invoked multiple times with different
string to know where this MTRR data is printed.

Signed-off-by: Guo Dong <guo.dong@intel.com>
2020-04-30 22:08:05 -07:00
stalamudupula ee26b02df5
Support paging for Above4Gb addresses (#692)
This patch enhances MapMemoryRegion subroutine to
add PDP entries for mapping addresses > 4GiB.
Only 1:1 mapping is provided for Above4Gb addresses.
And linear addresses are mapped to 1GiB pages.

Signed-off-by: Sai Talamudupula <sai.kiran.talamudupula@intel.com>
2020-04-30 22:05:54 -07:00
Aiden Park 57bea9118d
Enhance debug log buffer as ring buffer (#699)
This will allow debug log buffer to record logs in ring buffer
if the buffer is full.

Signed-off-by: Aiden Park <aiden.park@intel.com>
2020-04-30 11:56:39 -07:00
Aiden Park b884702aca
Fix ELF image loading failure (#700)
This will fix invalid offset calculation of ELF program header.

Signed-off-by: Aiden Park <aiden.park@intel.com>
2020-04-29 23:07:11 -07:00
Aiden Park 5d37a25284 [X64] Fix XHCI init failure
This issue is seen on a WHL board on X64 build when high 32-bit
BAR does not exist. In that case, MmioRead64 returns (UINT64)(-1).
To avoid this, read high 32-bit BAR only if BAR type is 64-bit
address space.

Signed-off-by: Aiden Park <aiden.park@intel.com>
2020-04-29 21:52:11 -07:00
Maurice Ma 86566d4196 Move container initialization earlier
Current container library cannot be used before memory is initialized
because the structure will only be initialized after memory. This
patch moved the initialization into Stage1A so that the library can be
used much earlier. The containers registered before memory will be
migrated into memory automatically post memory initialization. In this
way it avoids duplicated header authentication.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2020-04-24 08:06:05 -07:00
Aiden Park 70af774d71
Support 64-bit ELF loading (#687)
This will load and execute 64-bit ELF image.
- Load image from ELF program header
- 32-bit ELF on IA32 only. 64-bit ELF on X64 only
- TBD: Relocate ELF

Signed-off-by: Aiden Park <aiden.park@intel.com>
2020-04-20 16:58:49 -07:00
Maurice Ma cd40ed449c Add keypad arrow key support
This patch added support for arrow keys on PS2 numeric keypad.
The original code only supports the dedicated arrow keys.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2020-04-20 09:43:22 -07:00
Maurice Ma 16fe767e67 Add media DeInit for Shell FS command
In Shell FS after media initialization,  the de-initialization
should be called to free all allocated memory.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2020-04-20 09:41:32 -07:00
Aiden Park 0b31b6b2a6
Add 'acpi_rsdp' Linux kernel parameter in cmdline (#679)
Recent Linux kernel accepts acpi_rsdp=0x.. in kernel command line.
This will make Linux kernel look for ACPI RSDP address in the kernel
commad line first prior to in DMI or F-segment.

Signed-off-by: Aiden Park <aiden.park@intel.com>
2020-04-17 16:14:47 -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
Maurice Ma b05a73f24b Upgrade LZ4 to 1.7.4
This patch upgraded the LZ4 from 1.4.0 to 1.7.4. The size will
increase around 300 bytes. Performance is still very similar.
But when trying to use more recent LZ4 version 1.9, noticed
significant performance degration. So keep to 1.7.4 for now.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2020-04-15 17:54:26 -07:00
stalamudupula 6cfe319efc
Support 64-bit XHCI MMIO address (#675)
If Platform code assigns 64-bit BAR address to XHCI,
get the full 64-bit address to access MMIO space.
Behavior is undefined if building IA32 and assigning
64-bit XHCI resources.

Signed-off-by: Sai Talamudupula <sai.kiran.talamudupula@intel.com>
2020-04-15 14:02:29 -07:00
Maurice Ma c94fccb54a
Fix XHCI library memory de-allocation issue (#668)
* Fix XHCI library memory de-allocation issue

This patch added code to XHCI de-initialization funciton to free
all used memory.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>

* Enhance USB De-initialization flow

This patch enhanced the USB De-initializaiton flow by trying to
call de-init functions in the full USB driver stack including XHCI,
UsbBus, UsbBot, etc.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2020-04-14 11:08:00 -07:00
Maurice Ma cacc215ea8
Fix NVMe library memory de-allocation issue (#667)
This patch added NVMe de-initialization function to stop the controller
and de-allocate all memory allocated.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2020-04-14 10:26:09 -07:00
Maurice Ma 6f64735000
Add USB BOT device memory de-allocation (#669)
This patch added UsbDeInitBot() to de-allocation memory allocated in
UsbBlockIoLib.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2020-04-14 10:23:11 -07:00
Maurice Ma 3de944a360
Add function to free UsbBusLib allocated memory (#670)
This patch added function UsbDeinitDevice() in UsbBusLib to free
memory allocated for all USB devices.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2020-04-14 10:23:00 -07:00
Maurice Ma 8e08ccc5f2
Add support to report free memory resource (#665)
This patch added support to report free memory resource lenghth.
It will search for all used memory pages and add them together.
The "virtual" free address will be returned to indicate the
virtual start point of the free memory top. It is virtual since the
memory allocation can be fragmented. This is just an indicator to
calculate the actual used memory size:
  UsedMemSize = EndAddr - FreeAddr

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2020-04-13 17:38:28 -07:00
Maurice Ma 58ef188a07
Fix AHCI library memory de-allocation issue (#666)
This patch fixed AHCI memory de-allocation issue by checking the
correct pointer before calling FreePool/FreePages.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2020-04-13 17:37:36 -07:00
Maurice Ma 970153f09d
[Shell] Add memory de-allocation for Shell commands (#662)
SBL Shell allocated memory during the command registeration phase.
However, these memory is not de-allocated after Shell exits. This
patch added code to de-allocate the memory. It also rearranged the
code a little bit so that function declarations are not required
any more.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2020-04-13 17:37:04 -07:00
Maurice Ma 359a9465dc
Fix USB boot assertion (#660)
Assertion will occur when booting from USB behind hubs. This was
caused by duplicated freeing the same address page. The for loop
in UsbHcFreeMemPool() does not move to next node in the list. The
similar bug exists in UFS driver. This patch fixed both.

It fixed #659.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2020-04-12 22:27:33 -07:00
Subash Lakkimsetti 85617ef888
RSA PSS scheme in signing tools (#641)
Added an build config _SIGNING_SCHEME for
selection of signing schmemes. Updated tools
with param for selecting the signing scheme when
they are run in stand alone mode. Authtypes in
container are updated.

Supported Signing schemes - RSA_PCKS_1_5, RSA_PSS
Intel Crypto recommends PSS and same defaulted in
SlimBoot.

Signed-off-by: Subash Lakkimsetti <subash.lakkimsetti@intel.com>
2020-04-10 17:25:58 -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 26a6fbe7cb Fix VS2017 build failure
Lastest SBL IA32 build failed with VS2017 due to typecasting issue.
This patch fixed it.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2020-04-08 08:25:29 -07:00
Maurice Ma 50cb798001
Fix stage unmaping issue (#644)
In X64 mode, current stage unmapping implementation does not
restore the original identical address mapping. It will cause
issue in some condition. This patch fixed this unmapping issue.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2020-04-07 17:22:36 -07:00
Vegnish Rao de49b23c7e
Fix Klockwork issue flagged in BootloaderCommonPkg (#646)
Fix for: Klockwork flags possible null pointer variable 'CompressHdr'
being dereferenced.

Signed-off-by: Vegnish Rao <vegnish.rao.paramesura.rao@intel.com>

Co-authored-by: Vegnish Rao <vegnish.rao.paramesura.rao@intel.com>
2020-04-07 17:22:24 -07:00
Maurice Ma 5ba433ed48
Ported IPP X64 Crypto ASM code (#635)
This patch ported the X64 ASM code from the latest IPP github repo.
All 4 algorithms have been tested.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2020-04-03 15:50:23 -07:00
Vegnish Rao 02eb402864
Fix Klockwork issues flagged in BootloaderCommonPkg (#634)
Fix for: Klockwork flags variable 'CompLoc' for being used uninitialized.

Signed-off-by: Vegnish Rao <vegnish.rao.paramesura.rao@intel.com>

Co-authored-by: Vegnish Rao <vegnish.rao.paramesura.rao@intel.com>
2020-04-03 11:21:57 -07:00
Maurice Ma 762eee35b7 Common code change for QEMU x64 boot
This patch added additional changes for QEMU x64 boot.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2020-04-02 09:00:14 -07:00
Maurice Ma 72cb08ee7d Enable QEMU Stage1A boot in X64 mode (#621)
* [QEMU] Enable Stage1A boot in X64 mode

This patch added necessary changes to enable QEMU boot through
Stage1A in SBL X64 build.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>

* [QEMU] Enable QEMU Linux boot in X64 mode

This patch enabled SBL X64 boot for Linux. At this moment, since
FSP is still in 32 bit mode, it is required to thunk back into
32 bit mode to call FSP APIs.
It fixed #622.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2020-04-02 07:30:43 -07:00
Maurice Ma d3c42e575d Fix GCC build issue in x64 (#620)
Due to missing normal function implementations in some x64 code, GCC
optimized many code off from the final image which caused synbol
patching issue later on. This patch fixed this.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2020-04-02 07:28:57 -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