Commit Graph

166 Commits

Author SHA1 Message Date
Kobe 20bc4cf163 feat: [Common] VBT header removal
Removed GopConfigLib and GopConfig header files
SBL will skip the runtime VBT update and will only consume updated VBT
SBL only pass the VBT reference to FSP without perform update
The updated VBTs for all platform boards will stored in VbtBin folder

Signed-off-by: Kobe <kok.tong.ong@intel.com>
2023-07-17 10:35:05 -07:00
randylintw 6a818eb039
fix: [Common] Dereference null return TempSmbiosStrTbl (#1951)
If the function actually returns a null value,
a null pointer dereference will occur.
In InitializeSmbiosInfo: Return value of function which returns
null is dereferenced without checking (CWE-476)

Signed-off-by: Randy <randy.lin@intel.com>
2023-07-14 12:19:01 -07:00
randylintw 9dc4a2f7ad
fix: [Common] Operands don't affect result for PlatformId (#1940)
Define of platformId is : [UINT8 : 5;]

Operands don't affect result (CONSTANT_EXPRESSION_RESULT)
result_independent_of_operands: StitchData->PlatformId < 32
is always true regardless of the values of its operands.
This occurs as the logical second operand of "&&".

Signed-off-by: Randy <randy.lin@intel.com>
2023-06-29 09:43:18 -07:00
stanley d7e5864581
feat: [CFL] add ACPI DMAR table (#1798)
This patch adds ACPI DMAR table for CFL.
Some VT-d init code are ported from EDK2.

Test method:
  1. dump acpi tables: acpidump -b
  2. check the dmar table: iasl -d dmar.dat

Verify: CFL-s RVP

Signed-off-by: Stanley Chang <stanley.chang@intel.com>

Signed-off-by: Stanley Chang <stanley.chang@intel.com>
2023-01-09 09:52:52 -05:00
Stanley Chang 7f58247911 feat: [CFL] stitch tool to support Linux build env
CFL does not have Linux-native stitch tools.
This patch uses 'wine' as a wrapper to support stitching
SBL under Linux env.

Signed-off-by: Stanley Chang <stanley.chang@intel.com>
2023-01-04 10:09:08 -07:00
Sean McGinn eeb05a8a5e Add SBL resiliency common code
This change adds SBL resiliency-related code
to common SG1A, SG1B, SG02, and FWU code

Signed-off-by: Sean McGinn <sean.mcginn@intel.com>
2022-08-17 11:40:43 -07:00
Guo Dong 7440dec946 [CFL] Increase payload size
Increase the payload size to fix the build failure.

Signed-off-by: Guo Dong <guo.dong@intel.com>
2022-08-02 07:42:55 -07:00
Stanley Chang f61bb6c116 FWU: support OEM key revocation together with BIOS/CSME update
The steps of OEM key revocation are:
  1. Replace OEM KM (signed with key2) by updating CSME
  2. Replace BIOS region (signed with key2)
  3. Reboot with new BIOS region (to make key1 inactive)
  4. Revoke key1

Before this patch, it requires 2 firmware updates and 2 capsules for
step 1~2 and step 4 respectively. The patch combines them into a single
update/capsule.

To implement the feature, the patch:
  1. Double max # of payloads to allow CSME/CSMD/BIOS/CMDI update
     in one capsule image.
  2. Prevent from failing update of a critical component.
     e.g., if step 1(CSME) fails, step 2(BIOS) should be skipped

Verified cases:

 Case 1: Capsule having CSMD/CSMD/BIOS/CMDI.
         Expectation: successful

    $ python BootloaderCorePkg/Tools/GenCapsuleFirmware.py \
      -p CSME FWUpdate.bin \
      -p CSMD CsmeUpdateDriver.efi \
      -p BIOS new_BiosRegion.bin \
      -p CMDI cmdi.txt \
      ...(skip)

 Case 2: Capsule having CSME/BIOS/CMDI but no CSMD.
         Expectation: no update

 Case 3: Inject fault flow (no partition switch after first flash),
         Capsule having CSME/CSMD/BIOS/CMDI.
         Expectation: no CMDI update

Verification: EHL CRB

Signed-off-by: Stanley Chang <stanley.chang@intel.com>
2022-07-19 15:31:23 -07:00
Vincent Chen 7400d6f0b3 fix the wrong sblopen_dir value in StitchLoader.py and StitchIfwi.py
This patch can reduce the chance of setting SBL_SOURCE when the
SBL root directory is not named as "SblOpen" or when the scripts
are run from the path other than the SBL root directory. Also note
that os.path.abspath() returns the absolute path relative to the
current working directory instead of the real path of __file__.
So in StitchIfwi.py, sblopen_dir was incorrect since the working
directory had been changed before calling stitch().

Signed-off-by: Vincent Chen <vincent.chen@intel.com>
2022-05-05 10:09:21 -07:00
Maurice Ma 93317d89fc Revert "[UPX] Disable malfunctioned USB2 port"
This reverts commit 1caacefeb5.

The USB port that does not respond to USB bus enumeration is port 8 on
the newer UPX board. The old UPX board might have different behavior.
The original commit was valid on old UPX board only, and this patch
reverted it. Confirmed the USB error message disappeared on the new
UPX board after the reverting.

Signed-off-by: Maurice Ma <mauricemx.ma@gmail.com>
2022-04-25 08:58:41 -07:00
Maurice Ma c4ac8e1939 Update loader serial port hob to support 64bit base
This patch added a new 64bit base field in the loader serial
port hob to support 64bit resource. The revision is updated
to 2. It is backward compatible with revision 1.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2022-03-03 12:45:00 -08:00
Sai T 20c30ff496 Gpio data convert improvements
Pass in a pch_series param to GpioDataConvert tool
to fetch the correct gpio group info for a platform
based on the pch series.

The tool expects the platform specific config file to
implement a function vir_to_phy_grp () that returns
a BOOL value based on:

If vir_to_phy_grp = False, SBL's config has A->0, B->1 etc. mapping.
And GpioSiLib.c or GpioInitLib.c corresponding libraries will map
this virtual group #s to real physical group #s (if not same).

If vir_to_phy_grp = True, SBL's config has A->G1, B->G2 etc.
physical mapping directly, so the GpioLib library uses this as is.

GpioDataConfig.py file was added for ADL platform.

Signed-off-by: Sai T <sai.kiran.talamudupula@intel.com>
2022-02-15 10:39:12 -07:00
Maurice Ma 7a9cc52e05 [TGL] Update MCFG table template with correct end bus number
Current TGL platform set 0 as the PCI end bus number in ACPI
MCFG table. And it caused incorrect MMCONFIG range calculation in
Linux. This patch updated the template to use 0xFF as the PCI
end bus number.

It should fix #1481, to be confirmed.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2022-02-11 09:48:40 -07:00
Mike Crowe a9d9774ca9 StitchIfwi: Indicate failure through exit status
When run as part of an automated system it's important to ensure that
any failure is reported to the calling process. Writing an error message
and then exiting indicating success leads to difficult-to-diagnose
problems.

Signed-off-by: Mike Crowe <mac@mcrowe.com>
2022-02-11 09:48:23 -07:00
Randy Lin 4a436f44ab [CFL] Fix Klocwork scanning issue
Fix Expression 'BootMode' can never reach the value

Signed-off-by: Randy Lin <randy.lin@intel.com>
2022-01-04 13:32:16 -08:00
Maurice Ma 4a9390c3f8 [CFL][CML] Fix board hook call sequence issue
On CFL and CML, the board hook PostMemoryInit was called before
FspMemoryInit API. This should be called afterwards instead.

This patch fixed this issue. It is because of missing "break"
statement. It fixed #1435.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2021-12-15 10:15:17 -07:00
Mike Crowe 990e3e81e6 Use LF line endings in the repository
Convert the line endings stored for all text files in the repository to
LF. The majority previously used DOS-style CRLF line endings. Add a
.gitattributes file to enforce this and treat certain extensions as
never being text files.

Update PatchCheck.py to insist on LF line endings rather than CRLF.
However, its other checks fail on this commit due to lots of
pre-existing complaints that it only notices because the line endings
have changed.

Silicon/QemuSocPkg/FspBin/Patches/0001-Build-QEMU-FSP-2.0-binaries.patch
needs to be treated as binary since it contains a mixture of line
endings.

This change has implications depending on the client platform you are
using the repository from:

* Windows

The usual configuration for Git on Windows means that text files will
be checked out to the work tree with DOS-style CRLF line endings. If
that's not the case then you can configure Git to do so for the entire
machine with:

 git config --global core.autocrlf true

or for just the repository with:

 git config core.autocrlf true

Line endings will be normalised to LF when they are committed to the
repository. If you commit a text file with only LF line endings then it
will be converted to CRLF line endings in your work tree.

* Linux, MacOS and other Unices

The usual configuration for Git on such platforms is to check files out
of the repository with LF line endings. This is probably the right thing
for you. In the unlikely even that you are using Git on Unix but editing
or compiling on Windows for some reason then you may need to tweak your
configuration to force the use of CRLF line endings as described above.

* General

For more information see
https://docs.github.com/en/get-started/getting-started-with-git/configuring-git-to-handle-line-endings .

Fixes: https://github.com/slimbootloader/slimbootloader/issues/1400
Signed-off-by: Mike Crowe <mac@mcrowe.com>
2021-11-10 12:46:42 -08:00
Sai T acccaea853 Add RxRaw field to Gpio config template
Current GpioLib uses 2 bits from OtherSettings to
configure RxRaw field in GPIO PAD CFG DWORD 0. But
Gpio config templates are missing the option to configure
this feature. This patch adds the option in template.

Signed-off-by: Sai T <sai.kiran.talamudupula@intel.com>
2021-11-03 16:18:42 -07:00
Maurice Ma 0e0eb047e3 Add UpdateMemoryInfo implementation for all open platforms
This patch implemented SOC specific hook to update the memory
map info through UpdateMemoryInfo() API.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2021-10-29 07:49:55 -07:00
Maurice Ma 21917377c8 Change GetSerialPortBase() API to return 64bit address
When UART bar is alloaced to 64 bit address, the current SBL API
GetSerialPortBase() only returns the lower 32 bit address, which will
cause problem for UART access. This patch fixed this issue.

Please note the patch did not change the payload HOB interface for
UART info. That needs to be updated to 64bit base address too. But this
patch does not cover that.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2021-10-21 10:09:20 -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 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 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
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
Sai T 772da78bfa Move BdatLib to CommonSocPkg
This patch adds BdatLib to CommonSocPkg so that all projects
can refer to one single instance of BdatLib. Also removed the
redundant platform-specific package folders.

Signed-off-by: Sai T <sai.kiran.talamudupula@intel.com>
2021-09-08 16:39:56 -07:00
Stanley Chang 02a10d7452 fix TSeg full during warn reset
This patch fixes TSeg region full problem after multiple
warn reset. Each time of warm reset, except S3 resume, the
TSeg region should be clear.

Signed-off-by: Stanley Chang <stanley.chang@intel.com>
2021-08-19 07:59:32 -07:00
Aiden Park 4b2e566921 Cleanup Platform/Silicon code to access LoaderGlobalData via APIs
This makes all Platform & Silicon code use APIs to access
LoaderGlobalData instead of accessing variables directly.

Signed-off-by: Aiden Park <aiden.park@intel.com>
2021-08-06 12:34:36 -07:00
Subash Lakkimsetti 237b5f3d45
[CFL] Fix reading bpmgen2 params (#1241)
Default Bpmgen params created by bpmgen tool
has unicode characters. This patch fixes reading the
file with unicode chars.

Signed-off-by: Subash Lakkimsetti <subash.lakkimsetti@intel.com>
2021-08-03 15:30:12 -07:00
Talamudupula fc8a3b33ce GpioLib header clean-up
Inconsistent and redundant header files are removed.
All projects going forward

 - Use API declared in GpioLib.h
 - Provide instance of GpioSiLib.h
 - Use common defines in GpioConfig.h

[QEMU][APL][CFL][CML][CMLV]
 - Follow above header model
 - Have own instance of GpioLib

[EHL][TGL]
 - Follow above header model
 - Use common GpioLib instance

Signed-off-by: Talamudupula <stalamudupula@gmail.com>
2021-07-01 11:24:03 -07:00
Maurice Ma d26709e289 [WHL] Add mailbox debug port example code
This patch provides exampole on how to enable mailbox debug port on
WHL. To enable it, the following needs to be set in BoardConfig.py.
  self.DEBUG_OUTPUT_DEVICE_MASK = 0x07
  self.CONSOLE_IN_DEVICE_MASK   = 0x00000005
  self.CONSOLE_OUT_DEVICE_MASK  = 0x00000005
Also adjust the PcdMailboxDebugPortMmioBase value in BoardConfig.py
as needed.

On host side, python script can be used in ISD to read/write this
register using IPC interfaces. EX:
  import ipccli
  ipc = ipccli.baseaccess()
  ipc.stateport.cnp_tpsb0.tap2iosfsb32 (...)
Please refere to MailboxDebugPort.py for example.

This was tested on UPX board with CCA debuger connected.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2021-07-01 11:22:16 -07:00
Maurice Ma d8c0177fe9 Added mailbox debug port support
This patch allows to use a mailbox register (DWORD) to support debug
port. If CCA debug is connected, it is possible to access certain
SOC register through BSSB. Then this register can be used for debug
console input/output.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2021-07-01 11:22:16 -07:00
Maurice Ma 800d4e4f0f [CFL] Add GPIO big bang debug port support
This patch added an example on how to enable GPIO  big bang debug
port on CFL platform.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2021-07-01 11:22:16 -07:00
James Gutbub 2471cdddeb [CFL] Resolve StitchIfwi.py issue
Recent addition of '-op' argument may have
unintentionally created an issue by using an
unassigned variable 'work_dir' where the
intended variable to be used may have been
'stitch_dir'. This patch resolves the issue
and able to successfully stitch an IFWI once
again.

Signed-off-by: James Gutbub <james.gutbub@intel.com>
2021-05-26 14:00:22 -07:00
stalamudupula 1320881dd9
[CFL][CML][CML-V][EHL][TGL] Use common PchSbiAccessLib (#1161)
Use the newly added PchSbiAccessLib in common package,
for all the current platfroms. Platform specific PchSbi Lib
is removed.

Signed-off-by: Talamudupula <stalamudupula@gmail.com>
2021-05-20 11:24:26 -07:00
Subash Lakkimsetti dfd4444a33 Generate signed slimboot binary to output path
Currently final IFWI gets generated output path.
Copy the signed slimboot binary to out path.
Added option for outpath.

Signed-off-by: Subash Lakkimsetti <subash.lakkimsetti@intel.com>
2021-05-20 11:13:36 -07:00
Maurice Ma c6ddf6fd38 [CFL] Add PCI 64bit resource support
This patch added required support to enable PCI 64 bit resource
allocation. By default, all downgrading is enabled so that it has
the same behavior as current code. To enable 64 bit resource,
set related downgrading flag to 0.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2021-05-13 15:41:45 -07:00
Maurice Ma 4e47d2ed74
[WHL] Clear power button status on normal boot flow (#1113)
When S3 resume fails for some reason, the power button status will
be not be cleared on next boot. It might trigger shutdown event in
payload. This patch will clear power button status bit on normal
boot flow so that system can still boot properly.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2021-04-19 08:46:27 -07:00
Talamudupula 85826d40f2 Fix buffer overflow for copy in S3SaveRestore lib
For appending Save/Restore structs in TSEG area,
bootloader should reserve space for TotalSize and
for certain structs, only header info should be
actually populated. Rest should be all Zeros.

Signed-off-by: Talamudupula <stalamudupula@gmail.com>
2021-04-14 11:16:13 -07:00
Maurice Ma 94d22382bd [APL/CFL] Enable SMM rebase for mon UEFI payload
For non UEFI payload, SBL will install dummy SMI handler for
security concern. For UEFI payload, SMM rebasing is expected
to be done itself. This patch enabled this feature for APL and
CFL platform.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2021-04-10 15:28:07 -07:00
Maurice Ma af807ee2d0 Enable SMRR programming in SMM rebasing flow
In normal UEFI payload case, the UEFI will handle SMM rebasing.
If SMM rebasing is handled by SBL, SBL will put a dummy SMI handler
at the new SMBASE to prevent SMM hang.  Beyond SMM rebasing, it
is also required to program SMRR registers. This patch added this
support for core code. It also added TSEG PCD init for CFL.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2021-04-10 15:28:07 -07:00
Maurice Ma 41ccfcca7c Clean up release build debug output
Current SBL release debug output has more than what is expected.
This patch reset some of the debug message to proper level to limit
debug message for release build.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2021-04-04 07:59:03 -07:00
Praveen Hp 640f5db739 [CFL] Set TSeg size to 16MB.
This Patch did the following

-  TsegSize config options is defined in CfgData_Memory.yaml.
-  with 64GB RAM, slow boot issue was reported on ubuntu_20.0.
   Root cuase of the issue is due out of MTTR's and unable to cover
   portion of higher memory ranges. this patch fixes this issue.

Signed-off-by: Praveen Hp <praveen.hodagatta.pranesh@intel.com>
2021-02-23 22:29:27 -08:00
Praveen Hp b982bb3df8 [CFL] Fix audio record issue
This patches fixes the audio record issue using onboard 3mm jack.

TEST= booted to windows on both CFL-S & CFL-H board and verified
      Audio playback and record is working using onboard 3mm jack.

Signed-off-by: Praveen Hp <praveen.hodagatta.pranesh@intel.com>
2021-01-27 07:57:41 -07:00
Praveen Hp 89bb7b2b5b [CFL] Add TPM2 ACPI table
similar to CML, CFL also uses both IOB2 & IOB3 ports to pass the info
and generate an SMI. where as common code ACPI implementation uses
only IOB2, hence TPM2 ACPI tables are ported from CML platforms.
This patch fixes physical presence query and TPM clear issue on windows.

TEST: boot to windows on CFL-H platform and verified TPM physical
      presence and TPM clear command is successfull.

Signed-off-by: Praveen Hp <praveen.hodagatta.pranesh@intel.com>
2021-01-27 07:56:22 -07:00
Praveen Hp b111c8f75e [CFL]Fix payload selection GPIO issue
WHL CRB board is configured to boot different payload based on GPIO pin
status, which is not working currenly.
this patch ensures to boot to Osloader payload when PayloadSelGpioData=1
otherwise boot to UEFI payload.

TEST= Boot test on WHL CRB and verified board able to switch between
OSloader & UEFI payload based on DIP switch R4H1B_4 status.

Signed-off-by: Praveen Hp <praveen.hodagatta.pranesh@intel.com>
2021-01-12 14:41:06 -08:00
Maurice Ma a2725951ad Removed deprecated python imp module usage
Python 3.4 and above have deprecated imp module in favor of
importlib.  This patch removed imp module usage from SBL, and
used importlib instead.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2021-01-06 11:16:59 -08:00
Praveen bf3f3d2e06
[CFL]: Fix onboard display issue on CFL-S & CFL-H (#922)
As per board design the DDI ports are routed as per below,

CFL-S:
DDI1-->PORTB-->LSPCON-->HDMI
DDI2-->PORTC-->DP
CFL-H:
DDI1-->PORTB-->DP1
DDI2-->PORTC-->DP2
DDI3-->PORTC-->LSPCON-->HDMI

Hence add separate VBT binaries accordingly.

-Set HPD of DDI port F to disable as default since it's not used by
 H/S/U processor line.

TEST: verified onboard display's ports booting to UEFI shell & Yocto.

Signed-off-by: Praveen Hp <praveen.hodagatta.pranesh@intel.com>
2020-12-11 17:40:09 -08:00
Maurice Ma c4de1ca3e0 [CFL] Fix DEBUG FSP build error
Current CFL SBL build with DEBUG FSP will fail due to size issue.
This patch fixed this issue by adjusting size properly when DEBUG
FSP is used.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2020-12-07 22:39:03 -08:00
Raghava Gudla 1914cab2a6 [CFL] Fix BOM ID detection for Upx platform.
This patch addressed an issue while detecting the
BOM ID for Upx platform which is causing the MRC
to fail.

Signed-off-by: Raghava Gudla <raghava.gudla@intel.com>
2020-10-29 20:48:48 -07:00
Raghava Gudla 3ec4e03a74 Expand HECI service to add more API's
This patch expanded HECI service to include send, receive and
reset interface functions. This helps in making firmwareupdatelib.c
and PSDlib common across platforms.

Signed-off-by: Raghava Gudla <raghava.gudla@intel.com>
2020-10-08 15:40:00 -07:00