Cleaned up SpiFlashLib in APL platform, and move it into
BootloaderCommonPkg, so that other platform could reuse
this SpiFlashLib
Signed-off-by: Guo Dong <guo.dong@intel.com>
Add ACPI_ENABLED() to align with MEASURED_BOOT_ENABLED().
Update MEASURED_BOOT_ENABLED() by checking PcdMeasuredBootEnabled
firstly.
Update PlatformFeaturesInit () in stage1b to fix potential inconsistent.
Update other code for changes above.
Signed-off-by: Guo Dong <guo.dong@intel.com>
Common MM_PCI_ADDRESS() provided PCI device BDF to PCIE MMIO base address.
So remove MmPciAddress() and MmPciBase () defined in platform and update
code to use MM_PCI_ADDRESS().
Add TO_PCI_LIB_ADDRESS() in common library.
Signed-off-by: Guo Dong <guo.dong@intel.com>
Currently when providing a filepath with sub-directories
the EXT2/3 library is not able to locate the file. The
code for traversing sub-directories is already present
but was not enabled. This change enables this support.
Ex: 'boot/iasimage.bin'
Signed-off-by: James Gutbub <james.gutbub@intel.com>
FileSystemLib provides generic interfaces to access file system and
its files as a abstraction of FatLib/ExtLib.
- Added CloseFileSystem
If there are opened files in a specific filesystem, those files
will be de-allocated in CloseFileSystem.
- Added OpenFile/GetFileSize/ReadFile/CloseFile
The ReadFile() does not allocate any memory for the file content.
The caller of OpenFile() MUST allocate necessary memory before
calling ReadFile().
Signed-off-by: Aiden Park <aiden.park@intel.com>
This patch will add support for updating multiple firmwares
using a single capsule image.
Following modifications are made for existing firmware update flow
1) Gather and validate capsule image
2) State Machine will be set to capsule processing state.
3) Signature of the capsule image is now stored in reserved region
During each reboot until the end of firmware update, stored signature
will be compared against the capsule image signature to make sure
capsule image is not modified until the end of firmware update.
4) Process Capsule image to gather firmware images
5) Each Firmware image information will be stored in reserved region
using FW_UPDATE_COMP_STATUS. Update pending will be marked to
update pending state indicating that this image is not processed.
6) Firmware update will use the reserved region comp structures starting
with the first image with update pending state, update the comp update
pending field to processing and applies the image. After the update, pending
field will be updated to Done and updates the status of the update in the
component structure and moves on to next image found.
7) After all the component structure in the reserved region updating pending
field are set to Done. Firmware update mode is exited.
Signed-off-by: Raghava Gudla <raghava.gudla@intel.com>
This patch will update GenCapsuleFirmware.py tool to package
multiple firmware update images into single capsule.
Example:
python GenCapsuleFirmware.py -p BIOS pld1.bin -p <GUID> pld2.bin
-p CSME Pld3.bin -p CSMD Pld4.bin -o img.bin -k TestSigningPrivateKey.pem
The following are the changes made
1) Capsule header format is changed to align with
EFI_FIRMWARE_MANAGEMENT_CAPSULE_HEADER
2) Each firmware image in the capsule will have
EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER
3) BIOS, CSME, CSME Update Driver (CSMD) and CFGData payloads
can be passed to the tool using their names as suggested in
example.
4) Unknown payloads can also be passed to the tool with associated
guid as input.
Signed-off-by: Raghava Gudla <raghava.gudla@intel.com>
The FindPartitions() allocates memory for PART_BLOCK_DEVICE instance.
This allocated memory needs to be de-allocated if no more necessary
to avoid memory leak.
TBD: Current partition info needs to be cleared before going to next
boot option.
Signed-off-by: Aiden Park <aiden.park@intel.com>
- CMD23(SET_BLOCK_COUNT) is for only MMC.
- CMD17(READ_SINGLE_BLOCK) must be used when reading a single block
with SD card
Signed-off-by: Aiden Park <aiden.park@intel.com>
On APL the last 256KB flash address space (4GB-256KB to 4GB) is
remapped to CSME SRAM read-only region. During stitching due to space
limitation, if a component gets pushed into this region, then direct
memory mapped access might not work since it will be decoded by CSME.
To access components within this region, SPI command based interfaces
has to be used instead of memory mapped interface.
This patch added warning message when this condition is detected in
the stitching process.
Signed-off-by: Maurice Ma <maurice.ma@intel.com>
Firmware update with latest code broke on APL platform.
This patch fixed#162 by:
- Corrected the HECI command response flag check
- Always read FWU state machine using SPI command instead memory map
Signed-off-by: Maurice Ma <maurice.ma@intel.com>
Set SPI flash EISS and LE for UEFI payload in EndOfStages().
Some clean up on UPDs and create a common function for security check.
Set SMM_FLAGS_4KB_COMMUNICATION flag
Signed-off-by: Guo Dong <guo.dong@intel.com>
This patch fixed some minor debug message print issue. It also added
some more debug prints to help identify potentical issue in firmware
update flow.
Signed-off-by: Maurice Ma <maurice.ma@intel.com>
Some platform might need do some platform specific init
on all the threads. So add a MP hook using a PCD.
Np impact for the platform that doesn't need this hook.
This patch also enable InSMM bit for APL.
Signed-off-by: Guo Dong <guo.dong@intel.com>
Copying the MdePkg BaseMemoryLibSse2 library into
SBL for faster CopyMem and other routines to improve
boot performance every where except for Stage1A &
Stage1B due to 'movntdq' usage limitation in earlier
stages. Remove all of the X64 files since SBL is compiled
as 32-bit. Also patch PCI enumeration code to perform
manual memory copying (using SSE2 CopyMem gives some
issue as tested on APL).
The BaseMemoryLibSse2 folder was copied from EDK2
GitHub based on the following commit ID:
9344f0921518309295da89c221d10cbead8531aa
Signed-off-by: James Gutbub <james.gutbub@intel.com>
It might be useful for the pre-OS payload/checker
to have a handle to the HOB list data for additional
support or data checking that the HOB list contains.
Signed-off-by: James Gutbub <james.gutbub@intel.com>
Current implementation of splashing a BMP image to the
display requires the allocation of a temporary buffer
to store the BMP image into a GOP Blt friendly format
that can then be used to splash the image to the display.
Instead of using a buffer for the whole image we can
allocate a smaller buffer to splash one line at a time
since splashing is already performed one line at a time.
Also fix a small print message regarding frame buffer
format.
Signed-off-by: James Gutbub <james.gutbub@intel.com>
Current GRUB config parser can only handle UNIX EOL style. For DOS
EOL style config file, an extra '\r' will be left at the line end
which might cause failure for initrd file loading due to incorrect
file name string. This patch enhanced the GRUB config file parser
to handle both UNIX and DOS EOL style.
Signed-off-by: Maurice Ma <maurice.ma@intel.com>
To ensure ConfigEditor can handle the configuration data type properly,
the default value needs to be valid. For string type configuration item,
the value should start with single quote. The APL default values for OS
image name is set to number 0 instead of '' to indicate empty string.
This patch corrected this and fixed#151.
Signed-off-by: Maurice Ma <maurice.ma@intel.com>
For the pre-OS payload/checker pass in a parameter
that contains additional information for heap space,
heap address, and additional CPU registers that may
need to be set before the pre-OS payload/checker
passes control to the OS.
Signed-off-by: James Gutbub <james.gutbub@intel.com>
An issue was reported on APL that MRC will start to do full training
after 119 boot cycles. APL MRC training data contains two parts. One
part will not change, and the other part will change for every boot.
To avoid frequently erasing flash, a rolling method was applied to
save this data into different slot for each boot. When all slots are
full, the whole block will be reclaimed. However, some boundary
condition was not handled properly which caused the NVS data cannot
be located when the slot is close to the end of the block.
This patch addressed this issue by:
- Force the max slot number to be 8 aligned so that the map is always
at byte boundary (1 bit for 1 slot in the slot map).
- When all slots are marked with 0 (all slots are full), set default
slot to be the last slot so that the last slot will be used to get
the MRC NVS data.
It fixed#146.
Signed-off-by: Maurice Ma <maurice.ma@intel.com>
This patch added the additional existence check for payload binary.
If the file does not exist, it will error out. Also if the binary
is already under build FV folder, skip the unnecessary copy.
Signed-off-by: Maurice Ma <maurice.ma@intel.com>
This patch added some additional error message print during the
boot media initializtion and file loading. It makes it easier to
identify issues in case of failure.
Signed-off-by: Maurice Ma <maurice.ma@intel.com>
For SATA boot option, the hardware partition is mapped into AHCI
port. Current implementation requires a specific AHCI port in order
to boot from that hard drive. This patch added support to boot
from the first detected AHCI port when the hardware partition is
set to 0xFF.
Signed-off-by: Maurice Ma <maurice.ma@intel.com>
The GCC build is failing due to recent check-in for OS Loader FV
building. GCC5 is throwing an error that the required fv size
of 0x37718 is exceeding the set fv size of 0x37000. Bump up the FV
size to address this issue.
Signed-off-by: James Gutbub <james.gutbub@intel.com>
Some OSes may require a pre-OS checker executable
to run before actually jumping to the OS. Add
support for this pre-OS checker loading & execution
as part of the OS Loader payload when it is compiled
as an FV and when ENABLE_PRE_OS_CHECKER option is
enabled in BoardConfig.py (per the following command):
SblBuild.py build <plat> -p OsLoader.Fv:LLDR:Lz4
The pre-OS checker entry point takes in a single
parameter which provides the CPU boot state that
should be loaded once jumping into the OS for the
pre-OS checker to launch after it finishes execution
(e.g. pre-OS checker does not return to Slim Bootloader).
Signed-off-by: James Gutbub <james.gutbub@intel.com>
When specify a payload file in the build command line, the current
searching folder is: PayloadPkg/PayloadBins, Platform/$(PlatformBoardPkg)
/Binaries. This patch added another searching folder in the Build FV
if the payload file cannot be found in the listed folders above. This
is useful when the payload image itself is generated from the build
process.
Signed-off-by: Maurice Ma <maurice.ma@intel.com>
TE image has stripped header to reduce the image size. When calculating
the preferred base for TE image, the gap should be added back in order
to match the actual TE image base. This patch fixed#133.
Signed-off-by: Maurice Ma <maurice.ma@intel.com>
Removing the HOB defined by SBL to use generic HOBs from EDK2.
Update GraphicsLib for above HOB change.
Update osloader and multibootLib for hob change.
update APL and Qemu platform for hob change.
Signed-off-by: Guo Dong <guo.dong@intel.com>
For APL, the board might need SMBUS communication to talk to some
devices, such as PMIC. This patch ported the SMBUS library from
open sourced EDK2 Minnowboard3. Basic test was done on LeafHill
CRB to read/write PMIC registers through SMBUS.
Signed-off-by: Maurice Ma <maurice.ma@intel.com>
Current QEMU build will produce many different SPI layouts due to
different build feature flags, such as source level debug support.
Since QEMU is a virtual platform, it is better to relax the size
so as to have consistent SPI layout. It will make it easier for
debug. This patch produces fixed QEMU image size (2MB).
Signed-off-by: Maurice Ma <maurice.ma@intel.com>
This patch updated some parameters in APL ACPI FADT table so as to
match the actual SOC registers. It fixed#124 .
Signed-off-by: Maurice Ma <maurice.ma@intel.com>
Slim Bootloader has its own set of approved logos. Add them to
the repo for community usage along with guidelines on logo usage.
Signed-off-by: James Gutbub <james.gutbub@intel.com>
Current SBL depends on GEN_CFG_DATA.PayloadId to determine which payload
to boot if multiple payloads exist. With this patch, when PayloadId is
set to "AUTO", QEMU will use the QEMU command line parameter
'-boot order' to determine which payload to boot.
For example, adding '-boot order=dba' in QEMU commadn line will boot to
UEFI payload. This provides a simple way to test different payloads using
the same SBL image.
Signed-off-by: Maurice Ma <maurice.ma@intel.com>
This script creates a new Apollo Lake Slim Bootloader IFWI image using
FIT tool and other ingredients. The FIT tool and some stitching
ingredients are not public available. Please contact your Intel
representative to get them.
This script can support both Linux and Windows environment.
Signed-off-by: Maurice Ma <maurice.ma@intel.com>
This patch added support to load CFGDATA directly from command line
interface. Minor clean-up work is also done to remove unused and
duplicated functions.
Signed-off-by: Maurice Ma <maurice.ma@intel.com>
This patch added support for FWST ACPI table. This table
contains generic address structure which has pointer to the
EFI System Resource Table.
ESRT table for now supports only system firmware. This table
will provide the operating system and tools knowledge of what
is the last attempt status and version of the system firmare
update.
Signed-off-by: Raghava Gudla <raghava.gudla@intel.com>
after silicon init API call. Also added code after
memory init to differentitate warm and cold reset requests.
Signed-off-by: Raghava Gudla <raghava.gudla@intel.com>
The APL StitchLoader.py script has its own limitation. For example,
if Boot Guard is enabled in the base image, the final stitched image
with this script might not boot due to security reason. It is better
to check this during stitching process so that it can error out earlier
to notify the user.
Signed-off-by: Maurice Ma <maurice.ma@intel.com>
This patch enabled DISABLE_NEW_DEPRECATED_INTERFACES build option by
default so that the deprecated APIs cannot be used in SBL source tree.
It is to enhance the coding for security.
Signed-off-by: Maurice Ma <maurice.ma@intel.com>
This patch removed unused UPT tool from BaseTools. This UPT tool
also contains sqlite3.dll binary. It is not preferred in the source
repo.
Signed-off-by: Maurice Ma <maurice.ma@intel.com>