Commit Graph

190 Commits

Author SHA1 Message Date
Aiden Park c51137b7bf
Update AcpiPatchPssTable() parameter (#543)
There are many parameter passing to AcpiPatchPssTable().
A single PSS_PARAMS structure pointer will be passed to simplify.

Signed-off-by: Aiden Park <aiden.park@intel.com>
2020-01-28 11:54:48 -08:00
Aiden Park 70ce0f3252 Add a common api to patch PSS table
This will allow update PSS table in a common way.
For a platform specific power calculation,
a function pointer can be provided.

Signed-off-by: Aiden Park <aiden.park@intel.com>
2020-01-28 09:44:35 -07:00
S M Narayanan c0160fcd81 Cosmetic: Update of the typo in comments (#538)
- Update of comment in Fwst.aslc for coffeelake as per review comment.
- Update of comment in Boardconfig.py for qemu.
- Removal of vtf0.bsf in BootloaderCorePkg.

Signed-off-by: SM <s.m.narayanan@intel.com>
2020-01-20 21:23:58 -08:00
Maurice Ma 9a08163be2 Enhance GenContainer tool
This patch added following enhancement to GenContainer script:
  - Fixed python3 errors in some specific condition
  - Added more error handling to notifce the user on failure
  - Removed -od option and use directory of -o option instead

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2020-01-14 13:54:14 -07:00
Subash Lakkimsetti 94e203113d GenContainer: Converge hash param and auth type usage
In GenContainer tool auth definitions for RSA cases were
updated to include hash alg used. In current implementation
auth type is generated from hash type and private key while
container created. This patch removes hash type param
and auth type is used for hash alg generation.

Platform code to be updated as per updated auth definitions

Signed-off-by: Subash Lakkimsetti <subash.lakkimsetti@intel.com>
2020-01-10 16:23:53 -07:00
Subash Lakkimsetti 4aa3ae3ad2 Remove PDR CfgData support
Configuration data blob is supported only from Bios region.
Removing CfgData in PDR as its no longer getting used.

Updated to copy signed data structure length for max supported.
Max supported is for RSA3072 size.

Signed-off-by: Subash Lakkimsetti <subash.lakkimsetti@intel.com>
2019-12-18 21:28:45 -07:00
Raghava Gudla 25af3e1e6c [CFL] Trigger firmware update from OS
This patch does the following

1) Enable triggering firmware update from OS
2) When firmware update mode is given control, state machine
   is set to capsule processing and firmware update platform
   specific trigger is cleared. State machine will be used
   hereafter to track firmware update
3) Created CheckStateMachine method in BoardSupportLib.c to
   check state machine to see if firmware update is in progress
   and set boot mode to firmware update.
4) Removed CMOS way of triggering firmware update and wrote code
   to use Over-Clocking WDT Scratchpad (OC_WDT_SCRATCH) bits for
   triggering firmware update
5) Update shell fwupdate command to use OC_WDT_SCRATCH bits.
6) Removed extra reset during sbl firmware update
7) Removed reset after updating configuration data update

Signed-off-by: Raghava Gudla <raghava.gudla@intel.com>
2019-12-13 15:14:06 -08:00
Subash Lakkimsetti 71c64f40bd IPP Crypto and Secure boot lib to support multiple hashes
Hash and RSA signing parameters were hardcoded in
Crypto wrappers and secure boot libraries. This patch
address support for multiple hash and key sizes.

Signed-off-by: Subash Lakkimsetti <subashx.lakkimsetti@intel.com>
2019-12-12 08:13:04 -07:00
Maurice Ma d2109f20db [APL] Add KEYH component in StitchIfwi script
This patch added KEYH component into the IFWI stitching process.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2019-12-11 14:09:05 -08:00
Maurice Ma df15627dd7 Enable updatable hash store component KEYH
Current SBL hash store has many limitations:
- Only support fixed hash size
- Only support 1:1 public key and usage mapping
- Only support build time key enrollment

This patch addressed this issue by introducing:
- Add a updatable KEYH component to hold extra key hash
- Allow append new hash entries from KEYH
- Use variable length entry for hash
- Introduce "Usage" bit mask for a key usage

This will allow using a single key to sign multiple components, or
using multiple keys to sign a single component. The built-in hash
store will only contain hash for STAGE1B, STAGE2, PAYLOAD,
PAYLOAD_FWU and MASTER public key hash. Master key hash will be used
to verify the KEYH component loaded at runtime in Stage1B. Once KEYH
is loaded, it will be appended into global hash store. The combined
hash store will be used to verify other components on the boot flow.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2019-12-10 19:19:04 -08:00
Aiden Park 72262b4722
Misc Klocwork scanning fixes (#484)
This patch fixes klocwork scanning reports in qemu, apl and cfl builds.

Signed-off-by: Aiden Park <aiden.park@intel.com>
2019-12-04 15:17:04 -08:00
Maurice Ma ef9040f00e Adjust GPIO based PayloadId selection policy
This patch updated the PayloadId detection logic on APL platform
to make it easy to understand.

The current policy is as below:
- If PayloadId CFGDATA is not AUTO, use whatever provided in CFGDATA.
- If PayloadId CFGDATA is AUTO, and GPIO based PayloadId detection
  is enabled, uses GPIO level to determine the actual PayloadId to
  use. (HIGH:OsLoader LOW:UEFI)
- If PayloadId CFGDATA is AUTO, and GPIO based PayloadId detection
  is disabled, uses default PlatfomrId 0 (OsLoader).

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2019-12-04 13:26:33 -08:00
Maurice Ma b693d9776e [QEMU] Fix QEMU boot issue with new IPP library change
The previoius IPP library updates used UpdateSHA256V8 as default for
SHA256. It works on real platform. However, QEMU's default CPU config
does not support SSE3 instructions and will generate exception. This
patch added the UpdateSHA256Compact as default SHA256 function if no
advanced optimization flags are set. The same is applied for SHA512
functions too.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2019-12-04 11:20:11 -08: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
Maurice Ma 40ad2f9fb6 [APL] Provide WMI service for FWU trigger
This patch added WMI service in ACPI to provide a unified mechnism
for user to trigger a firmware update flow. New ASL methods are
defined. \DWMI.WQ00 is for read and \DWMI.WS00 is for write.

To use it from Linux (Ubuntu):
  - Install acpi-call module
    sudo apt install acpi-call-dkms
  - Load module
    sudo modprobe acpi_call
  - Read trigger register value
    echo '\DWMI.WQ00 0' | sudo tee /proc/acpi/call
    sudo cat /proc/acpi/call
  - Write trigger register value
    echo '\DWMI.WS00 0 0x12' | sudo tee /proc/acpi/call

To use it in Windows:
  - Open a command line window with admin right.
  - Run VB script to read / write the trigger register
    set Service = GetObject("winmgmts:root/wmi")
    set EnumSet = Service.InstancesOf ("AcpiFirmwareCommunication")
    for each Instance in EnumSet
      Wscript.Echo "Current  Val: " & Hex(instance.Command)
      instance.Command = 1
      instance.Put_()
      Wscript.Echo "Set New Val: " & Hex(instance.Command)
    next 'instance

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2019-11-26 12:58:29 -08:00
Maurice Ma abee91f2f8 Delay IA untrust bit set for BSP
SBL currently set IA Untrust bit in MpInit(). It is too early for
BSP. By doing so, it blocked some register access in FSP notification
APIs. This patch moved the IA Untrust bit set for BSP to the end of
boot flow while keeping it at same location for APs.

It also fixed #466.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2019-11-25 09:15:51 -08:00
Maurice Ma ec8dca50bb Move clear HOB to the very end of the boot flow
Current SBL calls ClearFspHob() too early. Since HOB is required
during the whole FSP life cycle. It is better to clear it at the
end after the last call. Otherwise, some previous API call will
potentically encounter issues.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2019-11-25 09:15:51 -08:00
Maurice Ma d7bdca432e PCIE device wake up enhancement
This is a follow-up to the previous WOL commit. The previous
implementation is more LeafHill specific. This patch further
added configuration data to control how wake up signal is mapped
into each PCIE root port. And the ASL code has been adjusted to
utilize that info so that the code can be more generic for all
other platforms.

The current default configuration for PCIE wake signal is aligned
with LeafHill CRB board. For other borads, to enable it properly,
it is required to override the wake signal configuration using DLT.

Test has been done on LeafHill to do WOL with yocto image. It worked
as expected.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2019-11-25 09:15:15 -08:00
Maurice Ma 6be72e56dd Add CFGDATA export command support in CfgDataTool
This patch added export sub-command support in CfgDataTool.py. It
is useful for users to export external CFGDATA from an exising
BIOS or IFWI binary file.
EX:
  python BootloaderCorePkg\Tools\CfgDataTool.py export
         -i Outputs\cfl\SlimBootloader.bin -o Temp

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2019-11-25 09:14:35 -08:00
Ursula Maplehurst c38f103cc3 [APL] Enable Wake-on-LAN for Leaf Hill CRB (#394)
Test: WoL works on Leaf Hill CRB

Signed-off-by: Ursula Maplehurst <ursula@kangatronix.co.uk>
2019-11-22 11:43:54 -08: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
Maurice Ma ace9d98eb8 Adjust GPIO CFGDATA structure header
This patch added additional information in the GPIO CFGDATA header
structure so that the full GPIO info can be extracted out later on
by tool. This additional information including GPIO SKIP bit position,
GPIO ID position and length.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2019-11-21 11:46:59 -08:00
Maurice Ma 3b457679ec Remove platform specific GetBuiltInConfigData()
Current SBL has platform specific GetBuiltInConfigData() implementation
because the internal CFGDATA blob is embedded into Stage1B data section.
Instead, it can be put into Stage1B FV FFS file, and then use a PCD to
get the base. In this way, it can be handled directly in core code and
remove platform specific implementation.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2019-11-20 14:43:50 -08:00
Aiden Park cd46ffb6a4
Fix MRC re-training at warm reset (#457)
MRC re-init happens in next boot when an warm reset is issued in MRC
fast boot path. DRAM Initialization Scratchpad Bit is one of warm reset
detection logics, but the bit is not updated at fast boot path.

Signed-off-by: Aiden Park <aiden.park@intel.com>
2019-11-18 16:57:52 -08:00
Aiden Park a340937fbb
Fix invalid addendum update in OsBootOption (#452)
OsBootOption config data provides addendum field to support multiple boot
option config data into a single boot option.
This patch updates a single boot option properly with multiple addendums.

Signed-off-by: Aiden Park <aiden.park@intel.com>
2019-11-13 09:49:37 -08:00
Maurice Ma 1870fb4fdf Remove HAVE_FLASH_MAP config option and PCD
SBL depends on flash map to locate all component info. It is
mandatory to keep flash map. HAVE_FLASH_MAP config option should
be removed. This patch removed this config option and the related
PcdFlashMapEnabled PCD.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2019-11-12 02:37:57 +08:00
Subash Lakkimsetti eba6c56241 Update TPM Physical Presence asl for SMM Dispatch usage in payload
UEFIPayload uses SMM dispatch for Physical Presence (Tcg2SMM) SMI.
Updated SMI port usage in asl to trigger SMI registered for
Physical Presence operation

Signed-off-by: Subash Lakkimsetti <subashx.lakkimsetti@intel.com>
2019-11-09 12:37:12 +08:00
stalamudupula a2c75b2faa Add GenGpioData.py tool (#432)
GenGpioData.py is a utility that converts
GPIO pin data from one format to other.

The formats currently supported are [h, csv, txt, dsc, dlt].
[h, csv, txt] formats are external to SBL and [dsc, dlt] formats
are known to SBL. So, this tool provides a way to convert one
of the [h, csv, txt] to [dsc, dlt] and vice-versa.

Example usage:

    python GenGpioData.py -if GpioInput.csv -of dsc

    python GenGpioData.py -if GpioInput.dsc -of txt

Signed-off-by: Sai Talamudupula <sai.kiran.talamudupula@intel.com>
2019-11-07 12:21:51 -08:00
Sai Talamudupula eef73934bf [WHL] Handle Gpio Int Config warning
ConfigEditor.py tool reports a warning regarding the
incorrect Interrupt Configuration for pins on Upx boards.

Certain board's default PAD CFG values may have none of
NMI/SMI/SCI/IOAPIC set and also RXEVCFG set to Disable,
so add a corresponding option in the drop-down for IntConfig.

Signed-off-by: Sai Talamudupula <sai.kiran.talamudupula@intel.com>
2019-11-07 05:57:16 +08:00
Aiden Park 913b4b4e9d
[WHL] Allow relative path in StitchIfwi.py (#415)
Currently, only absolute path is allowed in '-w' stitch_dir and '-s'
stitch_zip file. In addition, if stitch_dir is not absolute path, the
stitch tool looks for 'SBL_SOURCE' which does not exist in OS environment.

This patch allows the StitchIfwi.py tool to use relative path as well.

Signed-off-by: Aiden Park <aiden.park@intel.com>
2019-10-25 09:49:44 -07:00
lsubash d7b6378e75 [CFL] TPM selection type support to StitchIfwi (#410)
Added a option in CFL StitchIfwi script to pass the TPM type to
be selected for Intel FIT tool stitching.

[TEST] = Run StitchIfwi.py with -tpm=dtpm for WHL
         and verify use of dTPM.

Signed-off-by: Subash Lakkimsetti <subashx.lakkimsetti@intel.com>
2019-10-24 09:59:32 -07:00
Sachin Agrawal 94a477902b [APL] Oemkm and Bpm are not a MUST (#393) (#408)
BootPolicyManifest are required when a IFWI is
stitched with Intel BootGuard enabled. FlashMap maintains a pointer to
it so that SBL code can reach to them during execution.

This patch removes the check for its presence from IFWI images.

Test : Stitches Ok. Boots Ok.

Signed-off-by: Sachin Agrawal <sachin.agrawal@intel.com>
2019-10-22 09:36:48 -07:00
Aiden Park 33e18bc1bc
Silicon init with eMMC HS400 mode config (#407)
This patch is a follow-up patch of #380. If a platform disables HS400 mode,
silicon init code will configure eMMC in HS200. Other modes not in scope.

This will also fix #406.

Signed-off-by: Aiden Park <aiden.park@intel.com>
2019-10-21 09:30:51 -07:00
Aiden Park 2b753e922b [APL] Add config option for XDCI mode
This patch allows a board to configure XDCI mode.
By default, keep XDCI mode as PCI mode which is default value in FSP.
The mode can be controlled by Config Data.
- Silicon Setting > Device Enable/Disable > Control 2 > Enable XDCI

If XDCI mode needs to be overrided, put new value in .dlt(delta) file.
- DEV_EN_CFG_DATA.DevEnControl2.XdciEnable | 0x0 (Disabled)
- DEV_EN_CFG_DATA.DevEnControl2.XdciEnable | 0x2 (ACPI mode)

It will fix #397 with the override value in a delta file.

Signed-off-by: Aiden Park <aiden.park@intel.com>
2019-10-18 17:19:42 +08:00
Aiden Park b7df78d41f
[APL] Expose IPC1 device to OS (#402)
This patch adds IPC1 device to DSDT and exposes it to OS.
The behavior can be controlled by Config Data.
- Silicon Setting > Device Enable/Disable > Control 1 > IPC1 Enable/Disable

It also fixed #390.

Signed-off-by: Aiden Park <aiden.park@intel.com>
2019-10-17 15:58:24 -07:00
Raghava Gudla e9bba34867 [CFL] Change default payload sel based on GPIO
This patch changes the default behavior of gpio pin for payload
selection, currently user configured GPIO pin being high boots
to uefi payload, modified code will boot to OS loader when GPIO pin
is high.

Signed-off-by: Raghava Gudla <raghava.gudla@intel.com>
2019-10-14 16:50:48 -07:00
Raghava Gudla 12473c872e [WHL] Fix power button overrride smi storm issue
power button 4 second press will cause power button override
bit to set in PM1 status register, this bit is not cleared on
reset and is causing SMI storm during booting to OS.

Power button override bit if set is cleared now in stage1b and
this fixed the SMI storm issue.

Signed-off-by: Raghava Gudla <raghava.gudla@intel.com>
2019-10-14 16:47:01 -07:00
raghavag a7460bcb91 [WHL] Fix firmware update failure (#374)
Current code set payload id depending on the gpio settings
and user selection from configuration data. When UEFI payload is
selected using GPIO or config data, payload id is being set to
UEFI irrespective of boot mode, which cause notification function
to get called, this locks the spi which inturn fails firmware update

Modified code to set payload id only in non-firmware update boot mode.

Signed-off-by: Raghava Gudla <raghava.gudla@intel.com>
2019-10-14 13:20:38 -07:00
Raghava Gudla 7b222b6c5f Added CSME update driver
This patch added csme wrapper driver for csme update library.
following functionality is added in this patch

1. Boardconfig PCD option ENABLE_CSME_UPDATE is added to
   enable/disable csme update support
2. Boardconfig PCD option BUILD_CSME_UPDATE_DRIVER is added
   to enable/disable building csme update driver
3. If BUILD_CSME_UPDATE_DRIVER is 1, user need to create
   library that inludes csme update library
   this newly created library will get linked to csme update
   wrapper driver providing csme update driver
4. By default ENABLE_CSME_UPDATE is set to 0
5. Revision control for input and output data structure to
   update driver is not implemented and will be avaiable
   in further patches.

Signed-off-by: Raghava Gudla <raghava.gudla@intel.com>
2019-10-14 13:16:38 -07:00
Maurice Ma c0b7918240 [UPX] Use BomID to select memory SPD data
This patch added code to select correct SPD data according to the
UPX BomID detected.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2019-10-14 10:08:49 -07:00
Maurice Ma 0302a5e457 [UPX] Add additional SPD data for 4GB memory configuration
This patch added 4GB SPD data for UPX board. It also renamed the
original 8GB SPD data file.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2019-10-14 10:08:49 -07:00
Maurice Ma eee6f98fc5 [UPX] Add UPX board BomID detection through GPIOs
UPX board has different memory configurations indicated by GPIO pins.
This patch added GPIO detections for these pins and set it as BomID.
It can be used to decide which SPD data to use later on.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2019-10-14 10:08:49 -07:00
raghavag ecc370113d [CFL] Adjust power UPD settings (#360)
This patch adjusted power related UPD settings to BIOS
UPD values are configurable through configuration data
After these changes, CPU maximum operating frequency
increased from 3.7GHZ to 4.2GHZ on WHL.

Signed-off-by: Raghava Gudla <raghava.gudla@intel.com>
2019-10-11 23:19:09 -07:00
Aiden Park 450d429225
[WHL] Increase EPAYLOAD_SIZE (#372)
This is to fit the size of the latest Debug UEFI Payload.
Increase the size from 0x00180000 to 0x00190000.

Signed-off-by: Aiden Park <aiden.park@intel.com>
2019-10-10 09:46:42 -07:00
Maurice Ma 0efbd578f2 [APL] Fix IFWI stitiching issue for SPI QUAD mode
StitchIfwi.py supports '-q' parameter to enable SPI QUAD mode.
However, it does not work as expected. When the script tries to
modify the XML file, it used 'yes' and 'no' as option values.
But it is case sensitive, and should use 'Yes' and 'No' instead.
This patch fixed this issue.

Test was done on LeafHill board and it enabled SPI QUAD mode
in IFWI after the fix. It fixed #370.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2019-10-10 09:41:40 -07:00
Aiden Park 40e8902c62
Clean-up duplicated header files for SPI registers (#368)
This patch allows APL and WHL(CFL) to use common header file for SPI
register access.
APL and CFL are using common SpiFlashLib and PchSpiLib, but Platform
code still refering to its own SPI registers header file.
- Remove duplicated header file
- Add common one to Silicon/CommonSocPkg
- Use SPI registers from common one in each Platform code

Signed-off-by: Aiden Park <aiden.park@intel.com>
2019-10-09 16:16:27 -07:00
Aiden Park 6626a18b07
[WHL] Use common PchSpiLib (#365)
This patch allows WHL/CFL to use common PchSpiLib for code re-use
instead of its own PchSpiLib.

Signed-off-by: Aiden Park <aiden.park@intel.com>
2019-10-09 13:26:06 -07:00
Himanshu Sahdev aka CunningLearner 13bdd956e8 CoffeelakeBoardPkg/Library/ShellExtensionLib/CmdFwUpdate.c: Fix minor typo
Signed-off-by: Himanshu Sahdev aka CunningLearner <sahdev.himan@gmail.com>
2019-10-08 17:13:11 -07:00