Commit Graph

367 Commits

Author SHA1 Message Date
Maurice Ma d18a96e856 Replace ASSERT macro in DebugLib for klocwork scanning
This patch replace the standard ASSERT macro with klocwork specific
implementation as indicated on:
  https://docs.roguewave.com/en/klocwork/current/tuningccanalysis
This can provide hints to klocwork scanning on the ASSERT() statement
so as to avoid false positives.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2019-10-30 03:32:54 +08:00
Maurice Ma 9117f44534 Add PCI configuration space dump with PCI command
"MM" SBL Shell command can be used to dump PCI configuration space
registers. On the other side, "PCI" command can be used to list all
PCI devices. This patch enhanced "PCI" command to support PCI
configuration space dump by redirecting it to "MM" command internally.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2019-10-30 02:37:19 +08:00
James Gutbub 63ba5a4912 Update mm command and remove io command
The 'mm' (formely 'mem') command is being
updated to handle PCI device formatted
addresses and also to support IO device
interfacing. Removing the 'io' command too
since it has been intergrated into the 'mm'
command.

Signed-off-by: James Gutbub <james.gutbub@intel.com>
2019-10-28 12:25:40 -07: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
stalamudupula fc1d53d387 Set default Container type to CLASSIC (#413)
Container parse logic cannot handle NORMAL (default) case
currently. So, if -t option is not used while generating a
Container, unsupported image type is reported during runtime.

Change the default type to CLASSIC, and end-user can use
-t option to switch to MULTIBOOT if needed.

Signed-off-by: Sai Talamudupula <sai.kiran.talamudupula@intel.com>
2019-10-24 13:20:56 -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
Maurice Ma 72774a9841 Clean up OsLoader main boot flow (#412)
Current OsLoader used many "goto" to enforce the flow, and it also
used RestartOsLoader() to allow OsLoader re-entry. This patch cleaned
these and produce a linear boot flow for PayloadMain().

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2019-10-24 09:44:03 -07:00
James Gutbub 4d7a8b58cf Remove global variable in boot cmd
The 'boot' command is making use of a global
variable declared in the OS Loader but it might
not always be available if the Shell lib is
used with other code. This patch removes the
dependency on the global variable.

Also fixes a small issue with not providing a
value at the prompt; instead prompt the user
with a error message when no valid value has
been provided.

Signed-off-by: James Gutbub <james.gutbub@intel.com>
2019-10-24 09:19:21 -07:00
Aiden Park 28c0039763
[OsLoader] OsLoader lifecycle change (#396)
This patch allows OsLoader to handle all Boot Options without restarting.

Currently, OsLoader restarts to handle next Boot Option from the beginning.
This behavior does not preserve allocated memories from Payload heap,
so it makes hardware/software states hard to be maintained.

Signed-off-by: Aiden Park <aiden.park@intel.com>
2019-10-23 09:37:57 -07:00
Maurice Ma d74c294506 Add USB arrow key support
Since SBL shell added support for command line history. It is required
to support it from USB keyboard console as well. This patch added USB
keyboard arrow key handling to convert arrow key scan code into ANSI
escape sequence so that Shell can recognize the arrow key from keyboard.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2019-10-23 05:44:48 +08: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
Ursula Maplehurst 4cc3d4df57 [APL] Update FSP to MR6 (#392) (#404)
There is an issue with Vbt.bin in MR5; MR6 has this fixed.

Test: compiles OK, boots Linux OK.

Signed-off-by: Ursula Maplehurst <ursula@kangatronix.co.uk>
2019-10-17 15:58:50 -07: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
Maurice Ma 03b466e8db Add Shell command line history support (#401)
This patch added command line history upport in SBL Shell. It makes
it easy to run a previous command using Up/Down arrow key.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2019-10-17 11:12:55 -07:00
Aiden Park 7759f83a63 Fix build failure in PreOsChecker on Windows
Fix type cast error from pointer to function pointer

Signed-off-by: Aiden Park <aiden.park@intel.com>
2019-10-16 18:28:43 -07: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
James Gutbub 3f3d48ba24 Remove boot option reset from boot cmd
The 'boot' command is resetting the current
boot option to be option zero any time the
command is invoked which conflicts with the
'c' command which allows a user to select the
next boot option that should be tried. Remove
the resetting to resolve the issue when doing
'c' sub-command in the 'boot' command.

Signed-off-by: James Gutbub <james.gutbub@intel.com>
2019-10-16 15:08:25 -07:00
Maurice Ma 9a10781d0f Limit debug output devices in stages
DEBUG_OUTPUT_DEVICE_MASK can be used to control debug output devices.
When frame buffer is enabled as debug output devices, it will only
work after GFX init. However, the code will still be linked into Stage
1A/1B/2 binary and increase the size. GFX debug device should only be
enabled in payloads. This patch used separated PCD values for stages and
payloads to optimize the binary size.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2019-10-16 09:45:49 -07:00
Maurice Ma 66c133b987 Allow restarting OsLoader after trying out all boot options (#387)
After trying out all boot options, if it still fails to boot,
current SBL code will do CpuHalt(). A better approach is to boot
into Shell and reset the current boot option to 0. In this way,
it allows user to try boot option again after modifying boot
option parameters. However, for release build, it does not change
the original behavior. System will still halt in this condition.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2019-10-16 09:28:20 -07:00
James Gutbub 74d9af1e68 Add change current boot option to boot cmd
The 'boot' command has been updated to add
an option to update the current boot option
to be booted next, e.g. mCurrentBoot. To
change the current boot option just need to
run 'boot' and then select 'c' and the
index to change the current boot option to.

Signed-off-by: James Gutbub <james.gutbub@intel.com>
2019-10-15 19:42:16 -07:00
Maurice Ma 76e03f7d32 Add Shell CLS command to clear screen
This patch added "CLS" command support to SBL Shell. It can be used
to clear the console screen.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2019-10-15 15:50:06 -07:00
Maurice Ma f6f42702bc Implement clear screen for GFX console
Current GFX console provides no function to clear the screen. This
patch added this support using the standard ANSI escape sequence
in print string.
2019-10-15 15:50:06 -07:00
James Gutbub 7ebc3279c5 Provide default values to boot command
The OS Loader 'boot' shell command does
not allow a user to skip data entry for
a given input field which can be tedious.
To make it easier allow users to press
enter to re-use the current value for
the boot option being modified to skip
to the options that they actually want
to update.

Also remove the '-a' option, no one will
typically re-enter all of the boot options.

Signed-off-by: James Gutbub <james.gutbub@intel.com>
2019-10-15 15:35:06 -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
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 b0d5ef094c Add device deinit support
This patch added basic deinit support in the media DevInit() interface.
It uses a special DevDeinit phase to inform the media driver to do
device de-initialization. This de-initialization flow will be called
before OsLoader restarting and OS booting.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2019-10-14 10:10:11 -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
Maurice Ma 161271723b Adjust USB KB polling rate
When USB keybaord input console is enabled, current code will keep
sending interrupt transfers to poll the USB keyboard state. However,
according to USB spec, it needs to be polled at certain interval
returned by the device. If the polling rate is too high, sometime,
host will fail to schedule the SPLIT transfer. This patch adjusted
the polling rate to the required interval.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2019-10-14 10:06:07 -07:00
Aiden Park b5c9976bf1 PatchCheck: Skip TAB check in .py files
This patch will skip TAB check in all python files for now.
THis change will be reverted after cleanup all TABs.

Signed-off-by: Aiden Park <aiden.park@intel.com>
2019-10-12 21:02:32 -07:00
Maurice Ma d23d7e07f8 Fix AHCI memory de-allocation issue
This patch fixed the pointer check before de-allocating memory
previously allocated for AHCI controller.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2019-10-12 19:57:40 -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
Maurice Ma b54d653430 Add support for loading container image from raw partition
Current SBL code assumes the image to load on raw partition follows
IAS format. Since container format is added recently, the code should
support both. This patch added support for container format as well.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2019-10-10 13:38:19 -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 2cd3739bde Minor fixes for ConfigEditor tool
ConfigEditor can load binary into Table widget. It has a boundary
check issue which results in the last byte left out. This patch
fixed this and also added code to roll back invalid inputs to its
last known good value for Table widget cell.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2019-10-10 09:42:03 -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
Maurice Ma a4a1b76c3b Fix ConfigEditor with Python3 issue
Current ConfigEditor does not run well with PY3. The generated DLT
file has invalid strings. It was caused by the incompability between
PY2 and PY3. This patch rewrote some code with compatibility for both
PY2 and PY3.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2019-10-09 15:52:52 -07:00
Maurice Ma c49be1603e Use Treeview widget to display table in ConfigEditor
Current ConfigEditor uses multiple Entry widgets to build a Table
widget since Tkinter does not support Table widget. However, when
the table is big, the loading performance is very slow because of
large mount of Entry widgets. This patch switched to use Treeview
widget to build a table widget, and it is much more faster than the
original implementation.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2019-10-09 15:52:37 -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
Maurice Ma e375cf8d07 Add mouse scroll event handler for ConfigEditor
This patch added mouse wheel scroll event handler so that mouse can
be used to scroll the configuration items on the page.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2019-10-09 12:04:19 -07:00
James Gutbub 2a28a0d3df Clean up EXT library
The EXT library has some unused code that
we can remove to help reduce the size and
to clean things up some more. Also add a
routine for dumping the group descriptor
table which can be helpful for debugging
issues.

Signed-off-by: James Gutbub <james.gutbub@intel.com>
2019-10-09 11:56:09 -07:00
Maurice Ma 0adfc94027 Display multiline help string in ConfigEditor
Current SBL display long help string in single line in ConfigEditor.
If the line is too long, only part of the line is visible on screen.
By change widget from Label to Message, it allows multiple lines
help string display.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2019-10-09 09:54:51 -07:00
James Gutbub 5ca06f0d92 Support 64bit EXT FS & non-512 block sizes
EXT2/3 library has some limiatation to support
hardware block sizes larger than 512 (e.g. 4KB)
and also does not currently support the flag
INCOMPAT_64BIT which indicates larger group
descriptor sizes. This patch adds flexibility
to support 512 and 4KB block sizes as well as
64bit EXT file systems.

Signed-off-by: James Gutbub <james.gutbub@intel.com>
2019-10-08 17:23:59 -07:00