Update copyright years
Initialize pointers to NULL
Check pointers for NULL before de-reference
Standardize debug logs
Signed-off-by: Sean McGinn <sean.mcginn@intel.com>
* [ADL] Update TPM event logging to match BIOS
If measured boot disabled via BtG profile but enabled via SBL
config flag, skip logging startup locality TPM event
If measured boot enabled via BtG profile or SBL config flag, log
CRTM version TPM event
Set startup locality based off startup locality on ACM policy status
Log detail and authority PCR events based off SCTRM status on ACM
policy status
Signed-off-by: Sean McGinn <sean.mcginn@intel.com>
* Initialize startup locality and remove measured boot check
Initialize startup locality variable used in setting up event
log
Remove measured boot check as it is not seen in BIOS and it
occurs at higher level
Signed-off-by: Sean McGinn <sean.mcginn@intel.com>
---------
Signed-off-by: Sean McGinn <sean.mcginn@intel.com>
This Patch add the support to set UFS clock frequency.
- Added the function to read or write specified attribute of a UFS device
- Shifted function which switch the link power mode and gear after ref_clock setting
because if an unsuported clock frequency being set, it won't be able to overwrite
the corrupted UFS attributes.
Signed-off-by: Aakash Panwar <aakash.panwar@intel.com>
Whenever EV_EFI_VARIABLE_DRIVER_CONFIG is specified as TPM event type,
the data that accompanies it is expected to be an UEFI variable in the
appropriate format
This change fixes an erroneously typed TPM event so that the tpm2_eventlog
command works in Linux
Signed-off-by: Sean McGinn <sean.mcginn@intel.com>
On platforms where only serial console input is enabled, enabling
source debug will lead to an infinite loop in ConsoleRead(). Newer
compilers detect this and generate a build error.
Signed-off-by: Bejean Mosher <bejean.mosher@intel.com>
In BIOS, all stage measurements are of type
EV_EFI_PLATFORM_FIRMWARE_BLOB. This change aligns SBL
with BIOS.
Signed-off-by: Sean McGinn <sean.mcginn@intel.com>
Currently, loading an ELF image will relocate the image (to its
preferred load address) only if there is at least one ELF segment
that is not completely contained in the file loaded (i.e. the memory
segment size is larger than the size inside the file. This behavior
is generally triggered by the segment that contains the .bss section).
Consequently, images that contain initialized data only (e.g. QNX IFS
files) don't get relocated, and will usually crash when jumping to the
image entry point.
This change checks whether the ELF image is already loaded at the
preferred address, and forces image relocation if not.
Signed-off-by: Bruno Achauer <bruno.achauer@intel.com>
instance 0 was hardcoded, so not able to read the devices from other
instances. Now read the instances number from the device table and
enumerate all USB instances one by one.
Signed-off-by: Biswas Arghya <arghya.biswas@intel.com>
0x03 is ACPI Reclaim Memory
0x04 is ACPI NVS Memory
As defined in BootloaderCommonPkg/Include/Guid/MemoryMapInfoGuid.h
and ACPI Specification Chapter 15.
Signed-off-by: Atharva Lele <atharva.lele@intel.com>
When running "perf" command from OsLoader shell, it would
print the performance data but it is difficult to know what
they are mean. The patch adds the description to performance
data.
Signed-off-by: Guo Dong <guo.dong@intel.com>
Signed-off-by: Guo Dong <guo.dong@intel.com>
This patch fixes 2 issues related to symbolic links:
1. when "fs ls" a directory, symbolic links are not shown.
It is because Ext2fsLs() only shows regular files and directories.
2. when "fs ls <symbolic_link>" the output is incorrect.
It is because File->FileNamePtr points to a local variable,
"NameBuf" in Ext2fsOpen(), if the file is a symbolic link
This patch replaces File->FileNamePtr with FileNameBuf.
It slightly increases Ext2fsLs/Ext2fsOpen/SearchDirectory time,
because of the use of strcpy and strcat.
Test method:
1. create a regular file, "a", in directory "x"
2. create a symbolic link file, "b", pointing to "a".
3. under the shell of OSLoader,
"fs ls x"
- expected result: a, b (symbolic link)
"fs ls x/a"
- expected result: a and its file size is shown
"fs ls x/b"
- expected result: b -> a, and the file size of a is shown
Verify: TGL-UP3 RVP
Signed-off-by: Stanley Chang <stanley.chang@intel.com>
This patch fixes an issue that SBL fails to load a file in Ext4 partition,
when
1. the ext4 partition uses Extent
2. the inode's first extent block is an internal node
3. the node has only one entry (i.e., eh_entries = 1)
Under the above conditions, the data block may point to the child of
first ei_block when accessing the data within the range of child node.
Test method:
1. Install Ubuntu 20.04.5 LTS/(min install) in an eMMC disk
Note: this issue is only reproducible when loading a file
satisfying all conditions mentioned above (i.e., eh_entries = 1).
So far, the /boot/initrd.img after installing Ubuntu in an eMMC
(where part table: 500MB(FAT), 20GB (EXT4), 4GB (Swap)) satisfies
the conditions. However, for some reasons, when using USB SATA disk,
it will not generate a /boot/initr.rd meeting the conditions.
2. Boot to OSLoader
3. "fs init 2:0 0 1" the eMMC disk (assume the HW:SW-part is 0 1)
4. "fs load boot/initrd.img"
Expected result:
1. With this patch: successfully load the file.
2. Without this patch: ASSERT [OsLoader] ..
Verified: EHL CRB
Signed-off-by: Stanley Chang <stanley.chang@intel.com>
In the Ubuntu ISO image, it has 0xF8 partition entries.
The partition library could not work as expected since
it expects the partition entries are no more than 128.
Potentially it could have more partition entries, so just
remove the check.
Signed-off-by: Guo Dong <guo.dong@intel.com>
Signed-off-by: Guo Dong <guo.dong@intel.com>
This patch fixes an invalid memory access issue caused by
the fs->Ext2FsGDSize is smaller than the size of EXT2GD.
The EXT2GD is a 64-byte structure, but fs->Ext2FsGDSize is not always 32.
Before this patch, Ext2fsOpen() allocates a smaller memory than expected:
i.e., Ext2FsGrpDes = AllocatePool (Ext2FsGDSize * Ext2FsNumCylinder);
When ReadGDBlock() loads data (E2FS_CGLOAD) into fs->Ext2FsGrpDes,
it possibly accesses mem out of the allocated Ext2FsGrpDes space.
This patch loads each element into fs->Ext2FsGrpDes.
This patch also
1. prints informative messages when OS Loader fails to load Linux files.
2. increase EHL's PLD_HEAP_SIZE (since the size of initrd in Ubuntu LiveCD
is over 130MB)
Test method:
1. create a huge EXT FS (says, at least 36GB)
2. In the fs, place the following file/dir:
a: non-empty file
b: dir
b/c: non-empty file
3. boot with SBL OS Loader and enter Shell.
4. execute "fs init <...skip...>" to init the fs
5. execute "fs ls"
6. execute "fs ls b/c"
7. execute "fs load a"
8. execute "fs load b/c"
Verify:
1. 10MB/10GB/100GB/200GB EXT2/EXT3/EXT4 FS
2. EHL CRB
Signed-off-by: Stanley Chang <stanley.chang@intel.com>
Currently SBL would return when preferred graphics mode is set
in the multiboot image. This patch would continue boot and print
the preferred graphics mode information.
Signed-off-by: Guo Dong <guo.dong@intel.com>
Adds build-time PCD that hides corruptcomp
tool by default
Renames corruptcomponent to corruptcomp
Enhances error checking/logs
Signed-off-by: Sean McGinn <sean.mcginn@intel.com>
Create a tool that corrupts SBL components so that
the SBL resiliency feature can more easily be tested
and demonstrated
Signed-off-by: Sean McGinn <sean.mcginn@intel.com>
While iterating over a USB descriptor in GetExpectedDescriptor(),
the "Len" variable always uses the 1st byte in the buffer,
This is only true for the 1st iteration, thereafter the variable should
advance as the descriptor advances.
Signed-off-by: Leon Theunissen <leon.theunissen@etion.co.za>
Universal paayload hobs are updated for secure boot
and measured boot. Event logs Hobs are created to consume
by TCG2Dxe in uefi payload.
Signed-off-by: Subash Lakkimsetti <subash.lakkimsetti@intel.com>
Signed-off-by: Subash Lakkimsetti <subash.lakkimsetti@intel.com>
Argument DataLen of function InternalGetVariable() inside Reclaim()
function is not initialized. This uninitialized value is assigned
to another variable and compared, resulting in EFI_BUFFER_TOO_SMALL
error when Data is NULL. Hence added Data NULL conditional check with
DataLen to overcome EFI_BUFFER_TOO_SMALL error when Data is NULL.
Signed-off-by: M Karuppasamy <karuppasamy.m@intel.com>
Signed-off-by: Sachin Kamat <sachin.kamat@intel.com>
Signed-off-by: M Karuppasamy <karuppasamy.m@intel.com>
Signed-off-by: Sachin Kamat <sachin.kamat@intel.com>
New shell command 'usbdev' added to enumerate USB bus and list down
all the USB devices that are found on the bus.
Signed-off-by: Biswas Arghya <arghya.biswas@intel.com>
Signed-off-by: Sachin Kamat <sachin.kamat@intel.com>
This Patch adds the support for UFS(Universal Flash Storage)
as a boot media.
- Added support to Enable all Lun's for UFS
- Added support to change power modes in UFS
- Enable Bus master for proper PCI addressing
Signed-off-by: Aakash Panwar <aakash.panwar@intel.com>
Signed-off-by: Sachin Kamat <sachin.kamat@intel.com>
Signed-off-by: Chirag Vijay Kolhe <chirag.vijay.kolhe@intel.com>
Signed-off-by: Aakash Panwar <aakash.panwar@intel.com>
This patch added support to get csme boot time performance
data and display it in perf command and also before booting
to linux.
Introduced a board config option BOOT_PERFORMANCE_MASK to control
PcdBootPerformanceMask, BIT 2 now enables printing CSME boot
performance data.
Signed-off-by: Raghava Gudla <raghava.gudla@intel.com>
A USB disk behind a hub may take longer time to respond command.
Prior to the patch, a magic 2000 ms is set. This patch introduces
a python control (USB_CMD_TIMEOUT) for customizing the timeout if
need. The patch also extends the default timeout to 4196 ms.
This patch does not impact booting time when a platform boots with
a good-conditioning usb disk, because the timeout only takes effect
when a disk does not respond to a USB inquiry for a long time.
Verified: Ehl RVP
Signed-off-by: Stanley Chang <stanley.chang@intel.com>
This patch adds "fs load" command to SBL shell so that it can be
used to load a file from boot media into memory. It also supports
loading file at specified memory address.
Signed-off-by: Maurice Ma <maurice.ma@intel.com>
If there is DEBUG output during PCI enumeration, it could cause SBL
hang due to invalid PCI bar resource. In this case, SBL will force
to return 0 for any serial port register read. And it might cause
dead loop because of LSR_TXRDY bit polling in SerialPortWrite().
To avoid this potential dead loop, it is required to set LSR_TXRDY
bit for LSR_OFFSET register read if the PCI resource is invalid.
Signed-off-by: Maurice Ma <maurice.ma@intel.com>
According to PCI spec, it is required to check the multi-function
support in PCI configuration header type before scanning next PCI
function. Current SBL does not follow this, and it caused duplicated
PCI devices listed in Shell command "lspci". This patch fixed
this issue.
Signed-off-by: Maurice Ma <maurice.ma@intel.com>
This patch extended the LZ4 library to support both compression and
decompression. It is useful for SBL to support runtime compression
in order to reduce data size. It is in sync with the LZ4 1.7.4 used
in the BaseTools.
Signed-off-by: Maurice Ma <maurice.ma@intel.com>
There is unresolved external symbol build issue with
BUILD_CSME_UPDATE_DRIVER enabled in BoardConfig.
By adding the BootloaderCommonLib in BootloaderDebugLib
inf file will address this issue.
Signed-off-by: Ong Kok Tong <kok.tong.ong@intel.com>
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>
SBL might change MTRR to enable framebuffer cache. Current code
only handles BSP MTRR programming, and it is necessary to sync
up the MTRR programming for all APs as well. This patch added
a function to sync up MTRRs for all APs.
Please note, this MTRR sync up is a simplified version for SBL
case since SBL will only add new MTRRs for GFX framebuffer.
To do a full generic MTRRs sync up, it is required to flush cache,
reload TLB, etc. And it will come with some performance impacts.
Signed-off-by: Maurice Ma <maurice.ma@intel.com>
For EXT2 filesystem revision 0, there are some fixed fields in the
super block structure according to the documentation. The code should
always use those fixed values for safe regardless of the value inside
the image.
Signed-off-by: Maurice Ma <maurice.ma@intel.com>
This patch adjusted the following debug message for USB libraries:
- For SBL, since mutli-TT is not utilized, it should not be
classified as error message. It is changed to be DEBUG_INFO now.
- Added DeInit debug print for USB so that it tells the USB
resources are de-allocated.
Signed-off-by: Maurice Ma <maurice.ma@intel.com>
When multiple USB mass storage devices are connected to the
target, it is not clear to the end user which one is selected
for boot. This patch added code to print the USB mass storage
device manufacturer and product name string. In this way, it
is easier for the end user to identify specific USB device.
It can also be used to determine the HwPart field for USB boot
option. HwPart for USB boot option is mapped to the USB mass
storage device index detected on the platform. BTW, to allow
boot from multiple USB mass storage devices, the optoin
ENABLE_MULTI_USB_BOOT_DEV needs to be enabled. So this patch
enabled ENABLE_MULTI_USB_BOOT_DEV by default.
Signed-off-by: Maurice Ma <maurice.ma@intel.com>
Current SBL will always append "acpi_rsdp=" as part of the command
line for Linux boot. However, since acpi_rsdp_addr was added in
boot parameter for Linux boot protocol 2.14 and later, it is only
required to do this for old boot protocol. This patch implemented
this.
Signed-off-by: Maurice Ma <maurice.ma@intel.com>