Commit Graph

642 Commits

Author SHA1 Message Date
Subash Lakkimsetti 442cb62fce Validate board config hash types
SIGN_HASH_TYPE and IPP_HASH_LIB_SUPPORTED_MASK are derived from
_SIGN_HASH. AT times only _SIGN_HASH is configured in
BoardConfig.py which causes in incorrect hash set to
respective PCDs.

Signed-off-by: Subash Lakkimsetti <subash.lakkimsetti@intel.com>
2020-05-26 11:49:54 -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
Maurice Ma 0788c6da42 Allow using bootloader stack to call FspMemoryInit
FSP 2.1 introduced new requirement to use bootloader stack for FSP-M. It
will cause issue for SBL since SBL only uses a small stack in Stage1. To
address this issue, a new PCD PcdFSPMStackTop is added to control the
stack settings for FSP-M.
  - If it is 0, it will not switch stack before calling FspMemoryInit API.
  - If it is 0xffffffff, it will switch to the new default FSP stack
    before calling FspMemoryInit API.
  - For other values, it will switch to the new stack at specified value
    before calling FspMemoryInit API.
This PCD will be set automatically by FSP_M_STACK_TOP variable in
BoardConfig.py file.

This code has been tested on UP Extreme board with latest FSP version.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2020-05-21 09:27:59 -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
Aiden Park 9f146afd47
Add PCI SR-IOV Support (#714)
This will support PCI SR-IOV(Single Root I/O Virtualization).
- Controlled by PcdSrIovSupport (SUPPORT_SR_IOV in BoardConfig)
- Disabled by default

Signed-off-by: Aiden Park <aiden.park@intel.com>
2020-05-14 09:57:10 -07:00
Aiden Park 7312a8e3f1
Update Intel FSP git repository URL (#716)
From https://github.com/IntelFsp/FSP.git
To   https://github.com/intel/FSP.git

Signed-off-by: Aiden Park <aiden.park@intel.com>
2020-05-14 00:28:59 -07:00
Raghava Gudla 45e2900164 Reprogram SMRR base and mask on S3 path for CFL
This patch will generate a SW smi on S3 resume path when using
UEFI payload. Handler for this Sw smi in UEFI payload will
program SMRR base and mask for BSP and all AP's.

Signed-off-by: Raghava Gudla <raghava.gudla@intel.com>
2020-05-13 16:51:32 -07:00
Mutha 26499043d2 Config Data name for SPI boot is Updated.
Boot Options updated for selecting boot device as SPI.
Use the “Memory” setting in the ConfigEditor to select
SPI as boot device.

Signed-off-by: Mutha <naga.naveen.mutha@intel.com>
2020-05-13 15:13:36 -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
Aiden Park 163d60408f
Add PCI ARI Support (#712)
This will enable ARI(Alternative Routing-ID Interpretation).
- Controlled by PcdAriSupport (SUPPORT_ARI in BoardConfig)
- Disabled by default

Signed-off-by: Aiden Park <aiden.park@intel.com>
2020-05-12 19:27:24 -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 56d1e5a400 Increase OsLoader FD size
Osloader FD size is increased to 0x0004B000

Signed-off-by: Subash Lakkimsetti <subash.lakkimsetti@intel.com>
2020-05-05 15:07:15 -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 43146f6c7b Fix a typo in board_build_hook
A typo. fix for pre-build:after

Signed-off-by: Aiden Park <aiden.park@intel.com>
2020-05-04 15:57:37 -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
Aiden Park eae81b7bc8
[X64] Support S3 resume on 64-bit build (#698)
This will support S3 resume path on X64 thru 16-bit waking vector.
- Port WakeUp code from EDKII
- Remove duplicated calls of FindS3Info from CpuInit
- Verified with Yocto on a WHL board
- TBD: 64-bit waking vector with supported OS

Signed-off-by: Aiden Park <aiden.park@intel.com>
2020-04-29 21:23:56 -07:00
Aiden Park 17828b4e1d
[X64] Fix MpInit failure (#695)
This will fix MpInit failure on X64 build.
The ApFunc() gets invalid parameters due to mismatched calling convention.
- Add EFIAPI to match calling convention

This can be verified with '-smp' option on QEMU target.
qemu-system-x86_64
  -machine q35 -m 256 -nographic -serial mon:stdio
  -pflash Outputs/qemu/SlimBootloader.bin
  -smp 255

Signed-off-by: Aiden Park <aiden.park@intel.com>
2020-04-29 09:17:03 -07:00
Subash Lakkimsetti 7601ce7af3 Adjust hash algorithm used for KEYH based on key size
PublicKey hashes stored in HashStore use hash alg type of
PcdCompSignHash defined with Build config. In container we
support cases where hash type could differ from Sbl default
signing hash.

Adjust the hash algorithm in external KeyHashStore manifest
based on key size. Use SHA256 for size 2K and SHA384 for 3K.

Signed-off-by: Subash Lakkimsetti <subash.lakkimsetti@intel.com>
2020-04-27 09:20:03 -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
Subash Lakkimsetti 83eab7e046 Add Converged BootGuard Library to Soc common
Currently BootGuard library is maintained for
every supported silicon. Most of Slimboot supported
platforms support CBnT standard. Adding to SOC common
for platforms to consume.

Signed-off-by: Subash Lakkimsetti <subash.lakkimsetti@intel.com>
2020-04-21 19:27:21 -07:00
Subash Lakkimsetti 4a489d4f87 [APL] Rename BootGuardLib header
APL follows BootGuard 2.0 and other supported platforms
follows CBnT standad.

Signed-off-by: Subash Lakkimsetti <subash.lakkimsetti@intel.com>
2020-04-21 19:27:21 -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 c2c44813bb [APL] Fix PDR region stitching
Current APL StitchIfwi.py does not enable PDR region due to incorrect
XML option. This patch fixed this and also adjusted the default PDR
region to be 4KB to save space.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2020-04-20 09:41:50 -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
Maurice Ma d7f43dfe3a Fix ConfigEditor mouse scroll issue with Python3
Scrolling mouse in ConfigEditor with Python3 will trigger some
error message. During the scroll unit calculation, it is required
to convert float into int type. This patch fixed it.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2020-04-20 09:40:49 -07:00
Maurice Ma eb37c1c715 Add macro parameter check for GenCfgData.py
This patch added parameter error check for macro passed into the
template.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2020-04-20 09:40:28 -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
raghavag f728f9eecb
Simplified stitchifwi.py for CoffeLake (#676)
This patch simplified ingredient folder structure
required for stitchifwi. Also created a config file
with all the configuration in one file and this file
will now be input to stitchifwi

Signed-off-by: Raghava Gudla <raghava.gudla@intel.com>
2020-04-16 23:31:13 -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 52b24dede0
Add build hooks for board (#674)
This patch added build hooks for boards so that each board can do
specific actions in different build phases. This patch also added
an example for QEMU to use build hook to generate new binaries into
the flash layout.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2020-04-15 14:01:00 -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
stalamudupula 3c26520a50
Fix the BarType reported in PciResource Dump (#672)
Correct the index reported while dumping the
PCI resource information.

Signed-off-by: Sai Talamudupula <sai.kiran.talamudupula@intel.com>

Co-authored-by: Sai Talamudupula <sai.kiran.talamudupula@intel.com>
2020-04-14 10:22:48 -07:00
Subash Lakkimsetti 98066ce797
Remove Verified Boot Hash Mask (#663)
PcdVerifiedBootHashMask is no longer used while
verification except for stage1B. Remove Hash mask and
added PcdVerifiedBootStage1B for stage1B verification.

Signed-off-by: Subash Lakkimsetti <subash.lakkimsetti@intel.com>
2020-04-14 09:06:18 -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