Commit Graph

112 Commits

Author SHA1 Message Date
Aiden Park b17c6c29b1 Fix compile errors when disabling compile optimization
- 'OpenFile may be used uninitialized' in ExtLib
- 'undefined reference to memcpy' in FatLib
- 'Lasa/Laml may be used uninitialized' in TpmLib
- 'Adjust may be used uninitialized' in Stage2Support

Signed-off-by: Aiden Park <aiden.park@intel.com>
2019-09-29 22:26:22 -07:00
Aiden Park b779fd044a Enable 'NOOPT' target for debugging purpose
Compile optimization sometimes needs to be disabled for debugging.
EDKII BaseTools provide NOOPT target, so leverage it.
The default GCC '-O0' and VS '/Od' option results in huge size image,
so the optimization level is adjusted with approximately level.

Add a new build option '-no' or '--noopt' for NOOPT target
- Release build option '-r' will ignore '--noopt' option
ex) python BuildLoader.py build qemu --noopt

Signed-off-by: Aiden Park <aiden.park@intel.com>
2019-09-29 22:26:22 -07:00
Ravi Rangarajan 57061dd9ec Checksum verification function changed for better readability
Signed-off-by: Ravi Rangarajan <ravi.p.rangarajan@intel.com>
2019-09-27 16:06:18 -07:00
Ravi Rangarajan 332c769f19 KW cleanup
Signed-off-by: Ravi Rangarajan <ravi.p.rangarajan@intel.com>
2019-09-27 16:06:18 -07:00
Ravi Rangarajan 45cceeed4d Added BSP Init to initialize BSP when SMP is disabled
Signed-off-by: Ravi Rangarajan <ravi.p.rangarajan@intel.com>
2019-09-27 16:06:18 -07:00
Maurice Ma 453bd2112c Add normal region parsing support for IfwiUtility
Current IfwiUtility does not support the old non-redundant image
layout format. This patch added support for non-redundant image by
defining a new FLASH_MAP_REGION key.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2019-09-27 16:03:47 -07:00
Teo, Boon Tiong 68c1cea581 Fix GenCfgData tool which wrongly handle data bigger than one byte.
When config data define with size bigger than 1 byte in array,
GenCfgData will parse as zero value.

This patch to fix the issue.

Signed-off-by: Teo, Boon Tiong <boon.tiong.teo@intel.com>
2019-09-27 14:16:37 -07:00
Maurice Ma 6787a4d106 Remove FDF rule overriding
This patch sets the default PEIM rule to use TE image format.
In this way it does not need rule overriding anymore.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2019-09-24 11:16:46 -07:00
Aiden Park f4f16878ab
[AcpiInitLib] Fix build failure on Windows (#315)
Error: conversion from 'UINT32' to 'UINT8', possible loss of data

MADT ProcessorId and ApicId has the size of UINT8. Cast the size from UINT32 to UINT8.

Change-Id: I3f46b2015b0d21c2b3e2f9389ecb8d5364ed5a5e
Signed-off-by: Aiden Park <aiden.park@intel.com>
2019-09-09 14:58:04 -07:00
Aiden Park 4803d940b1 [MpInit] Allow a Board to configure PcdCpuMaxLogicalProcessorNumber
Make PcdCpuMaxLogicalProcessorNumber configurable on a Board
- PcdCpuMaxLogicalProcessorNumber = 16 by default
- Configurable by CPU_MAX_LOGICAL_PROCESSOR_NUMBER in BoardConfig.py

Signed-off-by: Aiden Park <aiden.park@intel.com>
2019-09-09 09:06:57 -07:00
Aiden Park dbe7aaa987 [ACPI] Append Processor Local APIC entries into MADT in runtime
Currently, the common hook UpdateMadt() was updating fixed size of
ProcessorLocalApic entries.
This allows the hook to append ProcessorLocalApic entries with the number
of detected CPUs in runtime.

Signed-off-by: Aiden Park <aiden.park@intel.com>
2019-09-09 09:06:57 -07:00
Aiden Park 63439af6db
[AcpiInitLib] Allocate ACPI tables from low to high memory (#314)
To make PlatformUpdateAcpiTable() hook its contents and length easily,
allocate a memory from low to high and appends each tables to higher direction

Signed-off-by: Aiden Park <aiden.park@intel.com>
2019-09-06 09:11:10 -07:00
Himanshu Sahdev 09245f4e54 BootloaderCore: Handle BIST failure in SecEntry (#311)
- Add BistVal in STAGE1A_ASM_HOB structure
- Use MM0 register to preserve the BIST value
- Push BistVal while setup HOB in stack
- Add check for CPU BIST failure and halt the system when failed

Signed-off-by: Himanshu Sahdev aka CunningLearner sahdev.himan@gmail.com
2019-09-06 09:10:41 -07:00
Himanshu Sahdev dbd92ac9c1 BootloaderCorePkg/Stage1A/Ia32/Vtf0/ReadMe.txt: Updating ReadMe
Signed-off-by: Himanshu Sahdev aka CunningLearner <sahdev.himan@gmail.com>
2019-09-04 16:00:10 -07:00
CunningLearner a46605d970 Optimize Stage1A early boot init (#308)
- Clear interrupts at EarlyInit16
- Restore BIST value to EAX register

Signed-off-by: Himanshu Sahdev aka CunningLearner sahdev.himan@gmail.com
2019-09-03 22:32:28 -07:00
Grandhi 5275a93191 Add ACM3 binary into BIOS region
Signed-off-by: Grandhi <sindhura.grandhi@intel.com>
2019-08-30 16:45:35 -07:00
Raghava Gudla e8d08aacdb Remove using FitHelp.py in StitchIfwi
This patch will remove FitHelp.py dependency from StitchIfwi
and reuses code from IfwiUtility to patch ACM binary.

This patch also fixed some case dependency required for python
in xml file patching. without this fix, fit does not work as
expected.

Signed-off-by: Raghava Gudla <raghava.gudla@intel.com>
2019-08-29 15:08:06 -07:00
Maurice Ma cc46751e0c Fix CfgDataTool issue on some platforms (#294)
CfgDataTool was originally developed for APL. On APL, the CFGDATA
region name is 'CFGD'.  However, on all other platform, the name
is 'CNFG'. This patch modified the script to handle both. And it
fixed #293.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2019-08-28 10:13:46 -07:00
Maurice Ma 4e13be369f [QEMU] Add repo clean command before building QEMU FSP
This patch run repo clean to remove previous generated files before
starting a new QEMU FSP build.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2019-08-23 14:10:58 -07:00
Maurice Ma b26a56480c [TOOLS] Misc enhancements for build scripts
Some misc enhancements for build scripts including:
- Adding all required exectuable check for build
- Removng hardcoded Python27 path
- Printing out used python version and path
- Using EDKII stable201905 tag to build QEMU FSP

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2019-08-23 08:32:49 -07:00
Maurice Ma 9fff1db6aa [TOOLS] Clean up stitching scripts for flash map
This patch cleaned APL and CFL stitching script.
- Shared common code for stitching functions on flash map process
- Converted coding style to snake_case for consistent naming convention

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2019-08-23 08:21:34 -07:00
Maurice Ma ea38da7599 [TOOLS] Add python3 build support
EDK II build has enabled python3 support. Since SBL has its own scripts,
it is required to port them accordingly to support python3. This patch
added python3 build support for SBL.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2019-08-22 09:18:52 -07:00
Sai Talamudupula 9af34bca9a Remove Core pkg references from Common pkg
By design, BootloaderCommonPkg should not refer to
BootloaderCorePkg. Hence removed those references in
the .inf files in Common pkg.

Moving SmbiosInitLib to Core pkg as it is a core feature.

Signed-off-by: Sai Talamudupula <sai.kiran.talamudupula@intel.com>
2019-08-22 06:26:18 -07:00
Maurice Ma d9a6a2f211 [TOOLS] Add IFWI helper script
This patch added IfwiUtility.py script to help parse the IFWI layout
and locate and replace components. It can be used to swap component
listed in the SBL flashmap, such as CFGDATA, MRCDATA, ACM, etc. It
supports different IFWI layout.
For exmaple,
APL MRC data flash layout path:
  IFWI/BIOS/NRD/MRCD
CFL MRC data flash layout path:
  IFWI/BIOS/BP0/BPDT/BpdtIbb/MRCD
To determine a compoment flash layout path, please use:
  python IfwiUtility.py view -i IfwiImage.bin

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2019-08-20 10:12:29 -07:00
Guo Dong 73553318cd Enhance build script to support build flexibility
With this change, customer could copy only board package folder
outside of SBL repo and build it without copying silicon folder.
It could help customer create their own repo and use SBL open
source repo as a submodule.

Signed-off-by: Guo Dong <guo.dong@intel.com>
2019-08-16 07:25:35 -07:00
Sai Talamudupula f0b5eaf43a Add UEFI Get Variable support
Users might want to have some parameters that can be set
from UEFI environment. UEFI NVRAM variables provide a way
to achieve this functionality. And they require these vars
to be read from bootloader.

This patch provides a library to get read access to the
UEFI variables stored in NV region. The driver was ported
from MdeModulePkg\Universal\Variable\Pei @ EDKII Open Source.

Signed-off-by: Sai Talamudupula <sai.kiran.talamudupula@intel.com>
2019-08-16 07:25:20 -07:00
Guo Dong ed53beb624 Enhance build support for binary downloading
Removing hard code in PrepareBuildComponentBin.py, so it could
support other platforms. And enhance its logic to support to
run in different places.
Moving repo and commit information to driver INF so this script
could reuse code to support different drivers.

Signed-off-by: Guo Dong <guo.dong@intel.com>
2019-08-15 18:09:51 -07:00
James Gutbub f9335e19a9 Switch to use container for pre-OS checker/payload
Since we may want to perform FW update on
pre-OS checker/payload binaries separately
from the OS Loader payload we will search
for pre-OS checker/payload in the container
entries instead of adding it into the OS
Loader FD.

Signed-off-by: James Gutbub <james.gutbub@intel.com>
2019-08-15 11:08:46 -07:00
Maurice Ma 78e7b0225e Fix FSP and Microcode download path issue
When downloading FSP and Microcode into local tree, it is required
to support board/silicon packages at different locations since the
board/silicon packages might be located outside of the SBL tree pointed
by PLT_SOURCE environment variable. Current code always assumes the
board/silicon is inside SBL tree, and it needs to be fixed. This
patch fixed #269 .

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2019-08-15 09:24:34 -07:00
Subash Lakkimsetti fa2124f91e [CFL] Add TPMType param to Loader Platform info HOB
Update TpmType to LoaderPlatform info hob based on
Type updated in Platform Info. LoaderPlatformInfo revision
is updated.

Signed-off-by: Subash Lakkimsetti <subashx.lakkimsetti@intel.com>
2019-08-14 14:44:23 -07:00
Maurice Ma 05e712bcbb [Tools] Add !include support for DLT files
To make it easier to share the most common configuration items in a
DLT file, it is better to support '!include' in DLT file. This patch
added this feature.  It also added examples in QEMU to test this.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2019-08-13 14:34:08 -07:00
Maurice Ma 42b93e3b57 Enable Linux as payload support
This patch enabled Linux as payload support on QEMU platform. To build
Linux as payload, please follow instructions mentioned in commit:
  4a5af4f8b0
In addtion, to boot Linux payload on QEMU, please append following
into QEMU command line to set Payload ID to 'LINX' dynamically.
  -boot order=abc

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2019-08-13 14:32:18 -07:00
Maurice Ma 4a5af4f8b0 Add Linux Kernel Boot Support in Stage2
OsLoader has the capability to boot a Linux kernel. However, to support
LinuxBoot type of payload, it is required to load kernel in Stage2. This
patch abstracts the standard Linux loading logic into common LinuxLib
class so that it can be linked in Stage2 or Payload such as OsLoader.
A new PcdLinuxPayloadEnabled is introduced to control if this feature
should be enabled or not.

To boot a Linux kernel from Stage2, it is required to put the command
line file and kernel image into the EPAYLOAD container during the build.
And the PayloadId CFGDATA needs to be set to 'LINX'.
For example:
  python BuildLoader.py build qemu
         -p OsLoader.efi::Lz4;vmlinuz:LINX:Dummy;cmdline.txt:CMDL:Dummy
vmlinuz and cmdkube.txt need to be copied to PayloadPkg/PayloadBins
folder. If kernel size cannot fit into EPAYLOAD, EPAYLOAD_SIZE in
BoardConfig.py needs to be adjusted accordingly.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2019-08-09 16:48:12 -07:00
Maurice Ma 944e5b8d2d Break down boot option CFGDATA
The current implementation used a huge array to represent boot options in
a single CFGDATA tag. With this approach, when a different board needs
to modify a single field, the whole array needs to be duplicated in the
CFGDATA. It is not efficient. A better approach is to break the options
into individual boot option CFGDATA tag. It will reduce the overall CFGDATA
in general. This patch implemented this mechanism. A library interface
FillBootOptionListFromCfgData() is provided to convert the CFGDATA into
the required OS_BOOT_OPTION_LIST.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2019-08-07 14:06:45 -07:00
Maurice Ma ef682b19c3 Switch to use container for EPAYLOAD
This patch enabled container use case for EPAYLOAD loading.
It also switched to use LoadComponent() API for Stage2 and
payload loading. It simplified the code flow. An example in
QEMU was added to demonstrate on how to add a container in
build and load it in Stage2 code.

To define a container layout, it is required to provide
GetContainerList() in BoardConfig.py. Then in stage or payload
code, LoadComponent() can be used to load a component from the
container.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2019-08-01 15:58:25 -07:00
James Gutbub 4623f82719 Replace HASH_INDEX_* with COMP_TYPE_*
Since HASH_INDEX_* is a 1:1 mapping with
COMP_TYPE_* we can remove HASH_INDEX_* and
replace with COMP_TYPE_*.

Also fix some misspellings.

Signed-off-by: James Gutbub <james.gutbub@intel.com>
2019-08-01 08:56:29 -07:00
Maurice Ma 93b2e96d8e Add ContainerLib to support sub-region
This patch added a ContainerLib to support load and location a
component from a specified container. It copies the component
from flash to memory, authenticate it, and then decompress it if
required. It can also be used to support load component from flash
map in SBL stage2 or payload, such as payload or e-payload.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2019-07-31 09:32:00 -07:00
Maurice Ma 651a189d53 Add GenContainer tool script
This patch added GenContainer.py script to create, extrace, replace,
sign and display a container image. If platform provides
GetContainerList() in BoardConfig.py, the build process will consume
it to create container images.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2019-07-31 09:31:36 -07:00
Maurice Ma 626a8db20e Add temporary memory management for MemoryAllocationLib
There are cases where temporary memory is required in stages. Since
MemoryAllocationLib instance for stages has no de-allocation function,
it needs special handling. This patch added temporary memory management
into standard MemoryAllocatoinLib interface.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2019-07-29 14:44:02 -07:00
Sai Talamudupula 8988a7e5f0 Fix S3 resume issue with OsLoader payload
SmmBase Info should not be expected by MpInit if the
platform/payload has not updated the Tseg region.
Check for the COMM signature before proceeding to Rebase.

Signed-off-by: Sai Talamudupula <sai.kiran.talamudupula@intel.com>
2019-07-26 16:51:56 -07:00
Sai Talamudupula 1ca691339d [CFL] Restore regsiters on S3 resume
Restore the register information saved during the
normal boot, on S3 resume path for UEFI payload only.

Signed-off-by: Sai Talamudupula <sai.kiran.talamudupula@intel.com>
2019-07-26 10:04:13 -07:00
Aiden Park bef00bf3f7 Fix invalid CfgDataDef generation in multi-level includes
This issue happens when a template file includes another files
since template dictionary has '!include' line itself instead of
its contents.

Signed-off-by: Aiden Park <aiden.park@intel.com>
2019-07-11 15:13:27 -07:00
Maurice Ma 641c721134 Allow to use platform specific logo file
This patch allows platform to use BoardConfig.py to override the
LOGO_FILE path so that customized logo file can be used instead of
the common one.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2019-06-20 19:19:16 -07:00
Maurice Ma 6b45c53c54 Filter out include DSC files in ConfigEditor open dialog
In ConfigEditor, when open DSC files, many files will show up. It
is expected to only open the CfgDataDef.dsc. This patch changed
the file match pattern to only list *Def.dsc file.  In this way,
user will not make mistake to open some include DSC file.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2019-06-19 15:39:47 -07:00
Aiden Park 0066eccdb3
Re-implement ElfLib for ELF32 format image (#193)
The previous implementation has a little confusion in license header.
To avoid further annoying, simply re-implement ElfLib.
- 32bits, little-endian, executable elf only supported
- elf32.h/elf_common.h from BaseTools/Source/C/GenFw
- LoadElfImage() interface changed

Signed-off-by: Aiden Park <aiden.park@intel.com>
2019-06-17 16:58:08 -07:00
Maurice Ma ee96ab59c1 Exclude board notifications for built-in payloads
Previous commit 4061d47f30 missed one
condition while handling the board notification calls. For built-in
payload such as OsLoader and FwUpdate, it will issue notifications
from payload through SBL platform services. So for these payloads,
board notification should not be called in SBL Stage2. This patch
fixed this.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2019-06-17 10:19:32 -07:00
Maurice Ma 4061d47f30 Add call to board notifications by default
Current SBL does not call board ReadyToBoot & EndOfFirmware phases
in Stage on normal boot flow. Current open source UEFI payload does not
do it either. It caused some security concerns. The patch enforced
these notification calls on normal boot flow in SBL for all payloads
except for those that can handle board and FSP notification on its own.

It fixed #191.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2019-06-14 16:18:41 -07:00
Guo Dong 5e10bd1e07 Update BSD license to BSD+Patent license
To align with EDK2, update file license
to use BSD+Patent license

Signed-off-by: Guo Dong <guo.dong@intel.com>
2019-06-13 10:46:49 -07:00
Maurice Ma 84db8526e7 Use FSP INF file to guide FSP binary copy from repo
This patch utilizes information from FspBin.inf to checkout specific
tag from FSP repo and copy files to SBL source tree.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2019-06-12 13:59:14 -07:00
Maurice Ma 6f8c44b375 Sync up with EDK2 stable tag edk2-stable201905
Synced up MdePkg, IntelFsp2Pkg and BaseTools to EDK2 stable tag
edk2-stable201905.

There are several changes for MdePkg and BaseTools.
MdePkg:
 - Support light print to reduce SBL size
   MdePkg\Library\BasePrintLib\PrintLibInternal.c
   MdePkg\Include\Library\DebugLib.h
 - TCG TPM2 spec changes and remove dependencies
   MdePkg\Include\IndustryStandard\UefiTcgPlatform.h
   MdePkg\Include\IndustryStandard\Tpm2Acpi.h
 - Use old NVM protocol file
   MdePkg\Include\Protocol\NvmExpressPassthru.h
 - Removed unused files

BaseTools:
 - Added LZ4 support
 - Removed unused files

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2019-06-12 08:29:06 -07:00