Commit Graph

1261 Commits

Author SHA1 Message Date
Maurice Ma 9c206b58bd Fix misleading error message in OsLoader
This patch fixed the misleading partitioin detection error message.
It should be file system detection error message instead.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2021-10-18 08:16:04 -07:00
Maurice Ma f453d57835 Clean up NVMe debug message
This patch cleaned up the NVMe library DEBUG message. Lots of the
DEBUG_INFO level were changed to DEBUG_VERBOSE to reduce normal
output.

It also removed the hardcoded device index 0 for NvmeReadBlocks,
NvmeWriteBlocks and NvmeGetMediaInfo APIs.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2021-10-18 08:15:30 -07:00
Maurice Ma 638679f87e Fix NVMe library media info
Current NVMe library reports hardcoded block size 512 and block num
512. It is incorrect. This patch fixed it.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2021-10-18 08:15:30 -07:00
Sai T 4d17d55a21 Move PchPcrLib to CommonSocPkg
Make PchPcrLib common. Remove redundant headers
not used by some platforms and link the new common
lib with the platforms currently using it.

Signed-off-by: Sai T <sai.kiran.talamudupula@intel.com>
2021-10-18 08:02:42 -07:00
Maurice Ma 52b0edb409 Enhance FWU flow to prevent infinite loop
This patch enhanced the FWU code flow:

- Moved the capsule signature save to later flow because current
  code saved it too early and later on the state block will be
  erased.

- Enhanced error handling. If there is error during FWU, both the
  state machine and the trigger need to be cleared. Otherwise, it
  will be in infinite loop.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2021-10-18 06:58:24 -07:00
Ong Kok Tong 3157d851ac [EHL] Enabled AC Split Lock
Removal of disabling AcSplitLock FSP UPD.
The FSP UPD is commented out due to the Yocto hang
issue previously which no longer occured.

Signed-off-by: Ong Kok Tong <kok.tong.ong@intel.com>
2021-10-18 06:47:03 -07:00
Maurice Ma 145d71041a [TGL] Skip CPU replacement check to allow MRC fast boot
This patch will skip ME CPU replacement check on SBL to always
allow MRC fast boot flow.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2021-10-15 22:20:54 -07:00
Maurice Ma 05592150d8 [TGL] Fix MRC full training issue on warm reset flow
On TGL warm reset flow, current MRC will always do full MRC training.
It is because of wrong PMC rigster was used in platform code to set
and clear the MRC scratch pad bit.

This fixed #1346.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2021-10-14 15:19:56 -07:00
Maurice Ma a149d0ebca [UPX i11] Enable Ubuntu boot support
Ubuntu 20.04.3 can support TGL platform. However, current SBL won't
be able to boot without changes. It is caused by following issues:
 - GRUB CFG support is not enabled by default
 - Payload heap is too small to load the full INITRD image
 - USB boot option is set to boot from partition 1 and EXT2 filesystem.

This patch addressed above issues. It has been tested on UPX i11.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2021-10-14 14:41:09 -07:00
Maurice Ma 2954034a06 Improve XHCI library timeout polling mechanism
Current XHCI library does a big loop to poll the status of a
USB command execution. In each loop it will delay 1us until
it completes or reachs the timeout. When the loop is very big,
the accumulated 1us delay together will be shifted far beyond
the original timeout requested. This is because of the inaccuracy
of the 1us delay provided by ACPI timer library. This patch
addressed this issue by checking the actual executed time rather
than looping with delay.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2021-10-14 11:05:29 -07:00
Maurice Ma b9b01e8640 [UPX i11] Address USB boot long delay issue
This patch fixed the USB enumeration long delay issue seen on
UPX i11 board. It disabled the malfunction USB port 8.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2021-10-14 11:04:05 -07:00
Maurice Ma 9aa774f635 Issue cache flush before FWU reset in Shell
Since the commit below was reverted
24f5aa59b5. The cache flush
need to be moved into the place where data consistency
across warm reset is required. The patch added the WBINVD
to flush the cache before "fwupdate" command issues warm
reset.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2021-10-13 14:58:35 -07:00
Maurice Ma 50e5c23594 Revert "Add cache flush on warm reset for SBL shell"
This reverts commit 24f5aa59b5.

There are cases that warm reset is requested before memory is
initialized. Doing WBINVD in this case can cause system hang.
A better approach is to let the caller to decide when to do
cache flush for a warm reset.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2021-10-13 14:58:35 -07:00
Maurice Ma 1f3de3399e Enable BIOS region update in single shot
Sometimes it is helpful if SBL can support firmware update from
SBL FW to UEFI FW, or update from incompatible SBL flash layout.
This will need SBL to write full BIOS region without using
redundant partition. To support this, a special capsule image
flag is added to indicate this special update. Please note, this
update might be very risky. This is only for development purpose.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2021-10-11 15:29:37 -07:00
Maurice Ma 24f5aa59b5 Add cache flush on warm reset for SBL shell
In some cases, the memory needs to keep consistent across a warm
reset. When warm reset is triggered, it might still have modified
cacheline that has not been flushed to memory yet. The patch added
WBINVD to flush cache before the warm reset.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2021-10-11 15:24:07 -07:00
Maurice Ma eea78479da [QEMU] Add UEFI universal payload test case
This patch added UEFI universal payload boot test on QEMU.
It fixed #1332.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2021-10-11 15:23:42 -07:00
Maurice Ma 1caacefeb5 [UPX] Disable malfunctioned USB2 port
On UPX, one USB2 port does not respond properly during PCI enumeration.
It needs to be disabled.  The current SBL code disabled the wrong port.
It should be port 10 (USB2 index 9).

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2021-10-11 15:23:09 -07:00
Maurice Ma 248512571f Enhance IfwiUtility script to handle BIOS region gap
The current SBL IfwiUtility script assumes the SBL image size
occupies the full BIOS region. However, in some case, gap may
exist at the beginning of the BIOS region. SBL image will not
always start at BIOS region offset 0.  This patch added special
handling to support this case.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2021-10-11 15:22:52 -07:00
Jim A. Pelner 8d4b0dc19d [TGLH] Fix Yocto Boot Issue with TCC Enabled
In the TGL implementation of UpdateFspConfig() in Stage1BBoardInitLib.c,
there are two missing UPD updates that have been validated for TGLH. This
manifested itself when enabling the TCC feature by setting ENABLE_TCC in
BoardConfig.py by reporting a bad VT-d descriptor and hanging.

This patch incorporates these two UPD settings for the TGLH boards.

Signed-off-by: Jim A. Pelner <jim.pelner@intel.com>
2021-10-11 15:06:14 -07:00
Maurice Ma 0b5581895f [UPX] Disable trace hub debug interface by default
During UP Extreme board enabling, trace hub interface was enabled
to help debug. But it should be disabled by default. This patch
fixed it.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2021-10-09 07:14:30 -07:00
Aiden Park bea07fdc60 [Tool] Allow each platforms to override min tool versions
This allows each platforms to override its own minimum tool versions.

Current SBL default minimum tool versions:
    'python'    : '3.6.0'
    'nasm'      : '2.12.02'
    'iasl'      : '20160422'
    'openssl'   : '1.1.0g'
    'git'       : '2.20.0'
    'vs'        : '2015'
    'gcc'       : '7.3'
    'clang'     : '9.0.0'

If a board needs to use VS2008 and nasm2.14,
In BoardConfig.py,
    def GetPlatformToolchainVersions(self):
        version_dict = {
            'nasm'      : '2.14',
            'vs'        : '2008',
        }
        return version_dict

Signed-off-by: Aiden Park <aiden.park@intel.com>
2021-10-08 20:05:10 -07:00
Maurice Ma 4189ae986b [TGL] Fix UpdateFspConfig() early return issue
On TGL  UpdateFspConfig() funciton in Stage2BoardInitLib.c has code
path to return early, it will skip all remaining UPD initialization.
The code should always continue the flow to finish the whole
function. This patch fixed this issue.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2021-10-07 11:28:37 -07:00
Maurice Ma 079b7bf095 Fix HelloWorld payload build issue
This patch fixed SBL HelloWorld payload build failure.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2021-10-06 16:52:26 -07:00
Sai T 9ceb26745a Enhance FWU logic for CSME update
CSMD (CSME update driver) is a part of FwuImage.bin capsule,
and it updates the CSME binary on SPI Flash. ApplyFwImage call
cant be invoked for CSMD component.

Signed-off-by: Sai T <stalamudupula@gmail.com>
2021-10-06 05:45:01 -07:00
James Gutbub 95482aa01a Resolve KW possible NULL refs in ElfLib
KW scan reported a couple errors regarding
Sec*Shdr value, need to check if they are
NULL before using these values.

Signed-off-by: James Gutbub <james.gutbub@intel.com>
2021-10-05 13:32:41 -07:00
Randy Lin 5f7dc196ab [TGL] Disable Intel HD Audio (Azalia)
1. HD Audio and TSN share pins. These are mutually exclusive features.
 2. RVP board should be reworked to support legacy HD Audio mode.

Signed-off-by: Randy Lin <randy.lin@intel.com>
2021-10-05 11:29:04 -07:00
James Gutbub 26bb66cedf [CFL] Increase PAYLOAD size
Seems some recent patches may have added additional
size to OS Loader and now the internal pre-commit build
test in Jenkins is failing due to not enough space
for PAYLOAD. Other platforms are also using 29000h
so might be best to increase the CFL value as well.

Signed-off-by: James Gutbub <james.gutbub@intel.com>
2021-10-04 22:37:32 -07:00
Maurice Ma 8c85533285 Add accurate TSC frequency calculation support
Current SBL code uses MSR(0xce) to calculate the CPU TSC frequency.
However, it is not very accurate. A better way is to use CPUID to
calculate the TSC frequency. This patch added new API to get accurate
TSC frequency.  It also added APIs to allow conversion between time
and TSC ticks.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2021-10-04 13:16:51 -07:00
Maurice Ma 4d45a48ac0 Add gitignore file in Silicon and Platform folder
Current SBL build will show lots of FSP files as untracked files.
This patch re-orgnized the rules for .gitignore file so that it
has better control at different folder level. With these new rules
no untracked files will be shown for the FSP and VBT files.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2021-10-04 12:20:26 -07:00
Maurice Ma 8d0b3467b5 [QEMU] Fix AUTO boot option index
On SBL, it can support boot option selection through QEMU command line
"-boot order" parameter. However, it does not work anymore. It was
because of the MAX_BOOT_OPTION_CFGDATA_ENTRY adjustment in other commit.
This patch decoupled internal boot option index with the CFGDATA boot
option index so that it does not have impacts on each other. With this
change, QEMU boot option can be altered through command line again.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2021-10-04 12:00:05 -07:00
Maurice Ma edadef9b5d [EHL][CMLv] Fix Universal Payload build issue
The newly added code caused build issue for EHL and CMLv x64 due to
insuffiant flash space. This patch adjusted the flash layout to fix
the build failure.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2021-10-04 11:59:55 -07:00
Maurice Ma 02c407aac5 Enable UEFI Universal Payload boot
This patch enabled ELF UEFI Universal Payload boot for SBL. It was
tested with EDK2 commit 22873f58c40c496d59a0553bee1c720192ac35c9.

To build UEFI Universal Payload, please run script from EDK2 repo:
  edksetup.bat
  python UefiPayloadPkg\UniversalPayloadBuild.py -b DEBUG -t VS2019
The generated payload binary will be located at:
  Build\UefiPayloadPkgX64\UniversalPayload.elf

This patch was tested on QEMU, and it worked as expected.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2021-10-04 11:59:55 -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
Stanley Chang 53496b3423 [CML] Fix RTC S3 wake hang
This patch clears RTC alarm when RTC is the S3 wake-up source.
Without clearing it, SMI# will be triggered once SMI_EN is set
by RestoreS3RegInfo, but no handler to clear it which results
in hang.

In addition to clearing RTC SMI#, this patch also clears other
SMI# as UEFI BIOS does.

Test method: rtcwake -m -s 15

Signed-off-by: Stanley Chang <stanley.chang@intel.com>
2021-10-04 06:18:23 -07:00
Maurice Ma 8ae486f254 Add universal PCI root bridge info HOB
Latest EDK2 code added support to consume universal PCI root
bridge info HOB. In order to pair with the latest UEFI payload
on EDK2, SBL needs produce the required root bridge info HOB.
This patch added this support.

It was tested on QEMU with latest UEFI payload.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2021-09-30 18:19:13 -07:00
Maurice Ma f7feb3dc52 Move Stage2 HOB related code into a separate file
Current Stage2Support.c contains lots of HOB related code. Since
more universal payload related HOBs will be added, it makes more
sense to split the HOB related code into a separate file. It is
easier to maintain.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2021-09-30 18:19:13 -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
Maurice Ma 5507df44e5 Enhance 64bit to 32bit thunk code
In some cases the paging will be enabled after returning from the
thunked function. To ensure the paging table can be reloaded before
switching back to x64 mode, the paging needs to be in disabled
state. This patch ensures the CR0 bit31 paging bit is cleared.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2021-09-30 14:50:27 -07:00
Vincent Chen 93ac9991c6 [TGL] Update FSP and platform version since MR3 is released
- UP3 IoT FSP MR3
- change the FSP headers from FspBin folder to Include folder
- update TGL platform version to 1.3

Signed-off-by: Vincent Chen <vincent.chen@intel.com>
2021-09-30 12:00:49 -07:00
Maurice Ma 2d3261bdc3 Add platform device type enum definitions
SBL defined SetDeviceAddr/GetDeviceAddr to abstract platform
device info. However, currently only boot media devices are
defined. It has cases that other platform device info is needed,
such as GFX device. This patch extended the concept to define
some other platform devices as an extenstion to
OS_BOOT_MEDIUM_TYPE. The enum values should not overlap with
the ones defined in OS_BOOT_MEDIUM_TYPE.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2021-09-30 10:59:20 -07:00
Ong Kok Tong 62db9dc92c [EHL] Disable New GPIO scheme by default
Disable the new GPIO scheme by default in dlt file
Only enable this option for kernel version 4.18.0-315
Alternatively with kernel module parameter
'module_blacklist=pinctrl_elkhartlake' will works
without enabling this GPIO scheme.

Signed-off-by: Ong Kok Tong <kok.tong.ong@intel.com>
2021-09-30 10:58:59 -07:00
Ong Kok Tong 9aa615c01f [Common] Sync boot option print function
Synced the PrintBootOptions fucntions to print
Pre-OS and extra images.
Fixed bug -> if pre-os or extra images are not enabled
in boot flag and it still output in PrintBootOptions
function

Signed-off-by: Ong Kok Tong <kok.tong.ong@intel.com>
2021-09-28 09:21:23 -07:00
James Gutbub a6a0c317dd Resolve fs cmd KW issue
Currently the PLT_DEVICE_TABLE is limited
to only using OS_BOOT_MEDIUM_TYPE devices
but ideally should be capable of mapping
any system device into the table. For the
time being we will remove the OsBootDeviceGraphics
since it created some KW issue in the fs command.

Signed-off-by: James Gutbub <james.gutbub@intel.com>
2021-09-27 17:08:32 -07:00
Maurice Ma 2d775da9b4 Add support to show a configure item under multiple pages
Current CFGDATA item can only be displayed under one single page
defined in YAML. In some special case it might need to duplicate
the same item under a differnt page. This patch added this feature
by introducing a new "altpage" attribute for a CFG item. When a
item needs to be displayed on a 2nd page, 'altpage' can be added
to indicate the 2nd page id.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2021-09-27 11:38:34 -07:00
Maurice Ma 22447f0618 Adjust PCI resource check condition
Current PciBus lib expects the root bridge resource base should not be
greater than limit. It is true for normal case. However, to mark the
source is unavailable, the base could be less than the limit in some
case. PCI bus lib should only validate the resource that does have a
request.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2021-09-27 08:58:05 -07:00
Maurice Ma 3cedff43c5 [QEMU] Enable VS2019 build for QEMU FSP
This patch enabled vs2019 toolchain build for QEMU FSP.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2021-09-27 08:28:18 -07:00
Maurice Ma 7f461c59e0 Enable native GFX initialization support
On QEMU or Smimics, it might need to do native GFX initialization
if the GFX is not initialized by FSP. This patch added the native
GFX support for BOCHS graphics controller.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2021-09-23 09:15:13 -07:00
Maurice Ma 4d83ea1126 Add BOCHS graphics init support
On Simics or QEMU, BOCHS graphics is used. This patch provides
library to initialize BOCHS graphics. It is useful when GFX
initiailzation is not provided by FSP. In this case, the native
code can be used to initialize graphics.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2021-09-23 09:15:13 -07:00
Ong Kok Tong b628b95e90 [EHL] Update the EHL BoardPkg version to 1.2
Update EHL BoardPkg version to 1.2 to allign with current
software package version:

ERINFO_PROJ_MAJOR_VER: 1 PV Quality release
VERINFO_PROJ_MINOR_VER: 0: PV  1: MR1  2: MR2 etc.

PROJ_MAJOR_VER -> 1 (Maintenance Release candidate)
PROJ_MINOR_VER -> 2 (1st revision of MR2 release)

Signed-off-by: Ong Kok Tong <kok.tong.ong@intel.com>
2021-09-22 21:19:13 -07:00
Praveen Hp 1e93e7bec2 [CML] Fix chipsec SMM issues in S3 path
This patch upstreams previous CML patch for RC3 hotfix:
  [CMLV] Fix chipsec SMM issues in S3 path:
    Trigger SMI in S3 path to let UEFI payload restore registers.

Signed-off-by: Stanley Chang <stanley.chang@intel.com>
2021-09-22 21:01:20 -07:00