Commit Graph

88 Commits

Author SHA1 Message Date
Subash Lakkimsetti 3a66c9857a Remove condition for capsule payload size alignment
Capsule payload size is checked for 4K block allign
and this restriction is not required. Updates as container
or other components generated capsule size can be
any size.

Signed-off-by: Subash Lakkimsetti <subash.lakkimsetti@intel.com>
2020-08-05 11:36:34 -07:00
Subash Lakkimsetti c8bda59231 Capsule update command for SVN commit
Capsule Command support added for anti rollback
security version number. User can create command
in text file and create capsule with CMDI mode.

{ARBSVNCOMMIT}

Platform APIs would be invoked to do SVN
commit operations by useing HECI interfaces.

Signed-off-by: Subash Lakkimsetti <subash.lakkimsetti@intel.com>
2020-07-10 07:47:21 -07:00
andreyv1978 4e57ca0e92 IPC and SideBand Interfaces - Adding IPC/Sideband
- Created BaseIpcLib
- Sideband Interface picked from
    tianocore/edk2-platforms
    branch: devel-IntelAtomProcessorE3900
    commit: 181f9e6c6ccde6e3fa62278b3a8b39cfb5844a7c
- IPC Interface picked from
    tianocore/edk2-platforms
    branch: devel-IntelAtomProcessorE3900
    commit: 181f9e6c6ccde6e3fa62278b3a8b39cfb5844a7c
- Updated Stage1BBoardInitLib.C with a test function

Signed-off-by: Andrey Vinokurtsev <avinok@gmail.com>
2020-06-09 14:23:28 -07:00
Maurice Ma 8eb31ee3f6 [APL] Fix SD card boot issue on Intel CRB boards
This patch fixed OsLoader boot from SD card issue on Intel APL CRB
borads. The SD/eMMC library was updated to follow the proper sequence
for SD card. Also platform code was updated to detect SD card and
apply SD card power using proper GPIO pins.

It fixed #729.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2020-06-01 10:08:51 -07:00
Maurice Ma e0c4326b81 Fixed several Klocwork scanning issue
Fixed several Klocwork issues reported for CFL build.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2020-05-28 09:43:12 -07:00
Aiden Park 9309f21857
Suppress KW warnings (#725)
Signed-off-by: Aiden Park <aiden.park@intel.com>
2020-05-27 15:41:39 -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 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
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 1870cf66d5
Support XCODE build for Mac OS (#626)
This supports XCODE toolchain in Mac OS.
- Tested on macOS Catalina version 10.15.2
- Tested with Apple clang version 11
- Verified QEMU target

Signed-off-by: Aiden Park <aiden.park@intel.com>
2020-04-01 16:13:47 -07:00
Guo Dong f6b08d1792
Update SMM HOB support (#616)
Add SMI status register
Add SMI lock register
Add REG_TYPE_MMIO register type
Zero SMM HOB
Fill SMI lock info for CFL and APL platform

Signed-off-by: Guo Dong <guo.dong@intel.com>
2020-03-31 11:21:06 -07:00
Aiden Park 3ec0361920
Fix pointer type cast errors from Visual Studio (#617)
Visual Studio reports more pointer type cast errors with 64-bit build.
This will cover the issue on the existing targets.

Signed-off-by: Aiden Park <aiden.park@intel.com>
2020-03-27 11:03:28 -07:00
Aiden Park 29446a1c2a
Pointer type cast for both 32/64-bit operation (#615)
This patch allows both 32/64-bit addressing properly.
- Pointer type cast with UINTN
- Add missing EFIAPI for APIs

Signed-off-by: Aiden Park <aiden.park@intel.com>
2020-03-26 17:30:55 -07:00
Maurice Ma 3af6d70787 [CFL] Enable CFL DMA protection code flow
This patch added required code flow to prepare to enable DMA
protection for CFL platform. Platform code needs to build a
VTD_INFO structure, and then call SetDmaProtection to enable
and disable DMA protection at different initialization phase.
Platform needs to enable DMA protection as early as possible
after memory is ready. For CFL, VT-d PMR cannot be fully enabled
before FspSiliconInit. So it was postponed to Stage2.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2020-03-19 22:08:41 -07:00
Maurice Ma a1df5f9cc5 [APL] Enable APL DMA protection code flow
This patch added required code flow to prepare to enable DMA
protection for APL platform. Platform code needs to build a
VTD_INFO structure, and then call SetDmaProtection to enable
and disable DMA protection at different initialization phase.
Platform needs to enable DMA protection as early as possible
after memory is ready. For APL, since VT-d is only enabled
in FspSiliconInit, it was postponed to Stage2.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2020-03-19 22:08:41 -07:00
Maurice Ma 5c95bd52d8 Simply VtdPmrLib API interface
As part of the DMA memory protection, it needs API to enable/disable
DMA protection. This patch simplified the API to do that using
SetDmaProtection().

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2020-03-17 18:04:44 -07:00
Maurice Ma 5c6a33bda3 Add VTd PMR memory protection library
This patch added the VTd PMR memory protection library. It can be
used to support DMA memory protection feature later on. It also
enabled basic build on APL platform so that it can be tested as part
of the automatic build.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2020-03-16 17:05:53 -07:00
Prakash Chandra 4160d468b7 PSD Fixed memory overwrite issue.
platform security discovery driver having bug it was wrongly doing
pointer arithmetic and causing memory overwrite. this may cause
intermittent fault.

Removing ZeroMem call since its not required, ACPI table is already
ZeroMem allocated from PSD aslc code.

Signed-off-by: Prakash Chandra <prakash1.chandra@intel.com>
2020-03-08 09:04:34 -07:00
James Gutbub e5f2a61227 [CFL] SgxLib moved to CFL Silicon lib
Since SgxLib has a dependency on platform
specific FSP header files it should not be
used as a common platform library. This
patch preserves the same functionality as
before but just moves the library to be
silicon specific.

Signed-off-by: James Gutbub <james.gutbub@intel.com>
2020-03-06 11:04:22 -07:00
Aiden Park 189988e779
[WHL] Fixed USB wake from S3 and S4 (#582)
When USB devices are used to wake from S3 and S4, PME_B0_STS
GPE bit is set and is causing SMI storm which is resulting intel
board hang during wake from S3 and S4.

Clearing PME_B0_EN during wake helped fix the issue.

Signed-off-by: Raghava Gudla <raghava.gudla@intel.com>
2020-03-04 16:00:26 -08:00
raghavag 96865f114d
End firmware update incase of failure (#572)
Current code does not clear firmware update trigger incase
of failures like, capsule image not found or capsule image
authentication failed.

Code is modified to fix this issue. As part of this change,
EndFirmwareUpdate function is moved from platform code to
core firmwareupdate.c. EndFirmwareUpdate function will call
ClearFwUpdateTrigger and this will end firmware update.

Signed-off-by: Raghava Gudla <raghava.gudla@intel.com>
2020-02-20 14:23:22 -08:00
Maurice Ma f6fd3a3f06 [APL] Enable firmware update trigger through sticky register
This patch added code to:
  - Trigger FWU using sticky register in SBL Shell
  - Detect FWU mode using combination of sticky register and state
    machine
  - Clear the trigger flag at the end of FWU

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2020-02-10 17:42:50 -08:00
Guo Dong 833ecbc46b Format update by coding style
1)  Replace TAB with spaces
2)  Convert CR, LF or LFCR to CRLF
3)  Remove trailing spaces
4)  Updated below strings:
       "EFI_D_INFO"  -> "DEBUG_INFO",
       "EFI_D_WARN"  -> "DEBUG_WARN",
       "EFI_D_ERROR" -> "DEBUG_ERROR",

Signed-off-by: Guo Dong <guo.dong@intel.com>
2020-02-07 22:43:45 -07:00
Maurice Ma faa172e67e Add missing header files in INF
In order to sync up with EDK201911 stable release, it is required
to add missing header files in the INF file. Otherwise, the build
will throw warnings. This patch added the missing headers in INF
files.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2020-02-03 15:49:48 -08:00
Maurice Ma 2a3ca8bf75 Fix QEMU Flash read issue after erasing
After erasing flash on QEMU, it needs to be returned to normal
read state to allow normal read access. However, this is missing
in current SBL QEMU SpiFlashLib.  This patched added the code to
switch back to read mode. It also fixed #552.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2020-02-03 09:36:18 -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
Raghava Gudla a71bb1d25a Added comp signature along with GUID in capsule
Currently each component inside capsule is identified with GUID
but going forward support is being added to update multiple components
inside sbl and container, so larger number of GUID's are required, also
GUID need to be passed for unknown components through command line.

Instead 4 character unique signature from flash map that is passed
through command line to indentify the component is added to the
component header. This signature is used during runtime to indentify
the component from flash map and container.

Signed-off-by: Raghava Gudla <raghava.gudla@intel.com>
2020-01-13 09:02:40 -07:00
Maurice Ma 5bbf0122eb Add Visual Studio Community build support
This patch enabled Visual Studio 2017 Community 2017 build support.
The following were done:
- Added new method to detect VS2017 installation path and version
- Droped VS2005, VS2008, VS2010 and VS2012 build support. Only
  VS2013 and VS2015 are supported.
- Fixed build issue in FspApiLib due to new compiler optimizations
- Synced the build support for QEMU FSP patch

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2020-01-08 08:23:35 -08:00
Guo Dong 515ad59d9e Add SmbusLib
Add a common SmbusLib support for Intel PCH
Define PLT_MEDIUM_MISC_TYPE in device table for
devices that are not for OS boot.

Signed-off-by: Guo Dong <guo.dong@intel.com>
2019-12-13 16:30:32 -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
Aiden Park 6295c4ec8f Build stuck on unicode locale Windows
This issue happens under two conditions
  1. Unicode language environment in Windows
  2. A python calls 'BaseTools/toolsetup.bat'
     (In EDKII, edksetup.bat directly in Windows command shell)

- 'BuildLoader.py' calls 'BaseTools/toolsetup.bat' in a subprocess
- 'BaseTools/toolsetup.bat' calls 'nmake cleanall'
- 'cleanall' target runs 'python NmakeSubdirs.py' directly
- 'NmakeSubdirs.py' creates multi-threads
-  The threads create another subprocesses

But, one of multi-threads is on deadlock when python handles stdout and
stderr in a subprocess pipe only if the output includes unicode chars.
Therefore, only stderr will be handled in the pipe same as a single
thread call.

Signed-off-by: Aiden Park <aiden.park@intel.com>
2019-12-11 13:35:31 -08:00
Subash Lakkimsetti 53f088f9d5 Hash Store: Restructuring Hash Store definition
HASH_STORE_TABLE is updated and HASH_STORE_DATA is added
to provide info with variable length sizes. Usage bits would
notify for multiple component/key using the same hash.
These data structure would optimize the hash store size
in storage.

PcdHashStoreSize would define the size of Hash store
to allocate in bios bootup.

Signed-off-by: Subash Lakkimsetti <subashx.lakkimsetti@intel.com>
2019-12-06 15:48:53 -07: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
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
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
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
Aiden Park ae9068e80c
Fix no SBL serial output after restart Windows (#459)
SerialPortLib sets UART Scratch Register to a known value at the first
initialization to avoid unnecessary re-initialization afterward. But,
one of Windows driver(SIO) re-configures UART Registers while the Scratch
Register is preserved. As a result, SBL skips serial port initialization
after restarting from Windows.
Therefore, force to initialize Serial Port at Stage1A all the time simply.

Signed-off-by: Aiden Park <aiden.park@intel.com>
2019-11-18 19:14:44 -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
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
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
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
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
Maurice Ma 3cdd48750d Use SerialPortLib in BootloaderCommonPkg
This patch switched to use SerialPortLib in BootloaderCommonPkg for
QEMU and CFL platforms.  For APL platform, it can also use this common
library. However, it has an optimized SerialPortLib with FIFO enabled.
So for APL, it still uses its SOC specific library.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2019-10-07 20:39:28 -07:00
Maurice Ma 6d72d2426a Use GetTimeStampFrequency API to get CPU TSC frequency
This patch used the common API GetTimeStampFrequency() to get CPU
TSC frequency instead of the original GetCpuTscFreqency(). As part
of it, all SOC specific instances for GetCpuTscFreqency() were
removed.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2019-10-07 16:08:33 -07:00
Aiden Park f8842039ef WHL: Use CommonSocPkg SpiFlashLib and CoffeelakePkg PchPciLib
The WHL(and CFL-R) has its own SpiFlashLib, but it's almost identical
to common SpiFlashLib except of silicon specific part.
Therefore, CoffeelakePkg will have its own PchSpiLib and re-use common
SpiFlashLib.
- Remove CoffeelakePkg SpiFlashLib and related files
- Use commmon SpiFlashLib
- Use CoffeelakePkg SpiFlashLib

Signed-off-by: Aiden Park <aiden.park@intel.com>
2019-10-04 19:37:24 -07:00
Aiden Park 49c9ccdb35 QEMU: Re-use SpiFlashLib.h file from Silicon/CommonSocPkg
QEMU has its own SpiFlashLib and SpiFlashLib.h file.
But, the header file is identical to the one in Silicon/CommonSocPkg.
Therefore, remove QEMU's one and re-use the common header file from
Silicon/CommonSocPkg.

Signed-off-by: Aiden Park <aiden.park@intel.com>
2019-10-04 19:37:24 -07:00
Aiden Park 6ab0e90252 APL: Use CommonSocPkg SpiFlashLib
Use common SpiFlashLib and PchSpiLib of Silicon/CommonSocPkg.
- No more use of SpiFlashLib from BootloaderCommonPkg

Signed-off-by: Aiden Park <aiden.park@intel.com>
2019-10-04 19:37:24 -07:00