Commit Graph

323 Commits

Author SHA1 Message Date
Maurice Ma 9f31593b58 Add Universal Payload library support
Universal Payload uses ELF format. As a result, the ELF loading
library has been enhanced to handle more complicated cases. The
Universal Payload library added an abstract layer on top of
ELF lib to make it easer to use by SBL. OsLoader and Stage2 were
modified to work with the new library interfaces.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2021-10-04 11:59:55 -07:00
Maurice Ma 5507df44e5 Enhance 64bit to 32bit thunk code
In some cases the paging will be enabled after returning from the
thunked function. To ensure the paging table can be reloaded before
switching back to x64 mode, the paging needs to be in disabled
state. This patch ensures the CR0 bit31 paging bit is cleared.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2021-09-30 14:50:27 -07:00
Ong Kok Tong 9aa615c01f [Common] Sync boot option print function
Synced the PrintBootOptions fucntions to print
Pre-OS and extra images.
Fixed bug -> if pre-os or extra images are not enabled
in boot flag and it still output in PrintBootOptions
function

Signed-off-by: Ong Kok Tong <kok.tong.ong@intel.com>
2021-09-28 09:21:23 -07:00
Maurice Ma 14166f2b37 Enforce FFS alignment in FvLib
When FV extended header exists, the first FFS pointer returned by
GetFirstFfsFileInFv() might not be 8-byte aligned. This patch
adjusted the pointer accordingly to ensure it is aligned per UEFI
spec.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2021-09-17 13:50:53 -07:00
James Gutbub 2bfdb8faac
Resolve KW issue in boot command (#1280)
Boot command may attempt to use an index which
exceeds the max image type. Check if the value
is larger than the max allowed value and return
if there is an error.

Signed-off-by: James Gutbub <james.gutbub@intel.com>
2021-08-31 14:12:08 -07:00
Ong Kok Tong f2b6d0e602 [COMMON] Fix Pre-OS and extra image bug in OSL shell
There is a bug when user use boot->idx command in OSL
shell to modify boot option which contained Pre-OS and extra images
(eg. POSC or RTCM etc.)

Current CmdBoot didnt cover for extra images in idx command.
This patch cover for extra images.

Signed-off-by: Ong Kok Tong <kok.tong.ong@intel.com>
2021-08-30 11:01:49 -07:00
Sai T 06acbc85a2 Fix UefiVarialbeLib KW issues
This patch addresses KW issues reported from UefiVarialbeLib.

Signed-off-by: Sai T <sai.kiran.talamudupula@intel.com>
2021-08-06 12:35:05 -07:00
stalamudupula d627d92c94
Fix UefiVarialbeLib KW issues (#1230)
This patch addresses KW issues reported from UefiVarialbeLib.

Signed-off-by: Sai T <stalamudupula@gmail.com>
2021-07-23 11:34:06 -07:00
stalamudupula ec20bf39e7
Fix security violation for IA32 build in VS2019 toolchain (#1225)
IA32 build from VS2019 toolchain has security violation
because Digest value from SHA512_384 is not matching the
value calculated and stored in hashstore during build.

Aligning the stack to 32-byte boundary during SHA_Update
fixes this error.

Signed-off-by: Talamudupula <stalamudupula@gmail.com>
2021-07-15 09:21:10 -07:00
Vincent Chen de2761170e
add missing UsbBlockIoLib in UsbInitLib.inf (#1216)
Resolve link error when using UsbInitLib
UsbInitLib invokes UsbDeInitBot() which is defined in UsbBlockIoLib

Signed-off-by: Vincent Chen <vincent.chen@intel.com>
2021-07-06 09:18:58 -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 163458e32d Add GPIO bit bang debug port library
This patch adds DebugPortLib as a platform extention lib to add new
debug port support. It also adds a generic GpioDebugPortLib to allow
GPIO bit bang to emulate UART TX pin.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2021-07-01 11:22:16 -07:00
CSHur c7b8d5a848 Fix Linux build issue when adding UefiVariableLib
When adding UefiVariableLib, there is a build issue in Linux.
Fix the build issue.

Signed-off-by: CSHur <cs.hur@intel.com>
2021-06-29 18:23:14 -07:00
CSHur 1db0acf9ba Fix UefiVariableLib code
When adding UefiVariableLib code, there is build issue.
Fix the build issue.

Signed-off-by: CSHur <cs.hur@intel.com>
2021-06-25 06:38:23 -07:00
Aiden Park 236a800284 Support ELF32/64 format payloads regardless of operation mode
This allows to load and execute ELF32 or ELF64 format payloads
regardless of Ia32 or X64 SBL operation modes.

Signed-off-by: Aiden Park <aiden.park@intel.com>
2021-05-24 09:04:14 -07:00
Stanley Chang 3a02cd0f45 Add EXT FS check in initialization
This patch runs basic check during EXT FS initialization
by opening root directory to ensure superblock been
validated.

Signed-off-by: Stanley Chang <stanley.chang@intel.com>
2021-05-21 20:11:53 -07:00
Stanley Chang 19123314d5 Fix return code of SearchDirectory
This patch changes the return code of SearchDirectory
to EFI_NOT_FOUND when a file to search cannot be found

Signed-off-by: Stanley Chang <stanley.chang@intel.com>
2021-05-19 07:12:16 -07:00
Maurice Ma 4e770bfb22 Fix eMMC controller driver issue
When the bus master decoding was disabled by default in PCI bus, the
device driver should try to enable it on its own. However, eMMC
driver does not have the enabling code. It caused the eMMC access
failure.

It fixed #1153.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2021-05-15 09:13:50 -07:00
James Gutbub 738f946aac Allow Ext23Lib symbolic links to have longer paths
In the Ext23Lib support for symbolic links was recently enabled
but there was a limitation imposed to use the CFG data boot
option filepath limit of 16 bytes which does not need to be also
be imposed on symbolic link paths. This will allow symbolic link
paths to be up to 260 characters long.

Signed-off-by: James Gutbub <james.gutbub@intel.com>
2021-04-29 19:33:09 -07:00
stanley d05938d579
Fix NVMe failure because of bus master not enabled (#1124)
With recent code change of disabling all PCI bus master
by default, NVMe may not work in some platform (e.g., Qemu).
This patch set/clear bus master during NVMe init/deinit.

Signed-off-by: Stanley Chang <stanley.chang@intel.com>
2021-04-19 08:48:34 -07:00
James Gutbub 10b1685dc5 Add support for symbolic links to Ext23Lib
Some of the boot option file paths used when
booting with OS Loader payload are failing
because the Ext23Lib does not support symbolic
soft links (e.g. ln -s <file> <link>). This
patch adds support for loading the soft link
succesfully.

Signed-off-by: James Gutbub <james.gutbub@intel.com>
2021-04-15 08:32:34 -07:00
Maurice Ma ae3ffa3ee8 Print Payload ID in human readable format
This patch printed Playload ID in human readable string format
instead of HEX string.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2021-04-05 17:04:20 -07:00
Maurice Ma c423d5a06d Fix thunk build issue for some environment
On some build environment, NASM will fail to compile Thrun32To64.nasm.
It is because of "BITS 64" usage in WIN32. This patch removed the BITS
64 usage and used opcode prefix instead to resolve this issue.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2021-04-05 09:41:25 -07:00
Maurice Ma 13733b12bf Add thunk support from 32bit to 64bit
This patch added thunk support from 32bit to 64bit. It allows SBL
to call 64bit API entry from 32 bit compatible mode. It is useful
when the payload mode is different from SBL mode.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2021-04-04 10:59:46 -07:00
Maurice Ma 454efdda2e Add CLANG toolchain build support
This patch will enable CLANG toolchain build on Linux and Windows.
Currently CLANG toolchain build still needs Visual Studio to provide
nmake utility in Windows.
To build with CLANG, please add build option "-t clang". It assume
CLANG is installed at default path. It has been tested with SBL
QEMU x86 build.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2021-04-02 09:07:57 -07:00
Subash Lakkimsetti c05a04a5ce Fix comments in for DoHashVerify and DoRsaVerify apis
Updated param and error code descriptions

Signed-off-by: Subash Lakkimsetti <subash.lakkimsetti@intel.com>
2021-03-30 21:40:29 -07:00
Maurice Ma 4253a9dcdb Fix Shell MTRR print issue
Current MTRR lib assumes the MTRR number is always 10. Instead,
this patch follows the IA manual to get the actual MTRR number
through MTRR capability register.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2021-03-23 10:36:12 -07:00
Praveen Hp 7b903e83ca [APL] Fix Build error when SOURCE_DEBUG is enabled
This patch fixes the multiple build issues which are observed
when ENABLE_SOURCE_DEBUG config is set to 1.

Signed-off-by: Praveen Hp <praveen.hodagatta.pranesh@intel.com>
2021-02-26 07:17:48 -08:00
Maurice Ma 3a5aab690c Fix MP waking up issue on some platforms
It was reported that some platform had MP waking up issue after
switching to using X2APIC library. By comparing the library, found
X2APIC removed 2nd IPI sending in the flow. This 2nd IPI is
required per IA specification. The patch added it back.

Tests have been done and confirmed it fixed the issues seen on
thos platforms.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2021-02-23 15:22:25 -08:00
Maurice Ma 04b162e75e Add CPU X2APIC support
This patch added X2APIC support. It is to enable the case when
APIC ID is greater than 255. This patch only handle core wakeup
portion. Platform still needs to handle ACPI related changes for
X2APIC.

X2APIC lib is backward compatible with XAPIC lib. So there is no
need to use XAPIC lib anymore.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2021-02-12 17:20:57 -08:00
Aiden Park 2e9d97de20 Fix a bug in PAE 2MB paging
This will fix invalid PDP/PDE generation with PAE 2MB Pages,
and high bit calculation at PayloadEntry additionally.

Signed-off-by: Aiden Park <aiden.park@intel.com>
2021-01-23 07:42:19 -08:00
Maurice Ma 5d573cf55e Fix paging issue when PCI PMEM64 resource exists
In 32 bit SBL, when PCI PMEM64 exists, the OsLoader will hang
during boot in CreateIdentityMappingPageTables().  The function
is inteneded to be used in X64 mode only, and cannot handle
32bit well. So OsLoader should not call it for 32 bit build.

This patch also zeroed the allcated memory to ensure the unused
entries are all 0.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2021-01-21 14:08:53 -08:00
Maurice Ma ee92586656 Fix 32bit payload calling convention
Current Execute32BitCode() passes in 64bit arguments into stack.
It should use 32bit arguments instead according to 32bit calling
convention. This patch fixed this issue.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2021-01-20 13:58:12 -08:00
Guo Dong 78cce60ce8 Enhance PreOS support
SBL support to load PreOS and normal OS in a single boot option.
This patch tries to standardize the PreOS support.
The PreOS could be TrustyOS, PreOsChecker or others.
As long as PreOS flag is set in boot option, SBL will load and
boot PreOS before normal OS. If the preOS has specific requirement,
it could be addressed using PreOS image type.

Signed-off-by: Guo Dong <guo.dong@intel.com>
2021-01-15 21:29:43 -07:00
Maurice Ma a85f327ad8 Enhance BGRT BMP support for logo display
BGRT can be used by bootloader to pass logo to OS. But BGRT can
only support 24bit or 32bit BMP format. If the bootloader uses
other bit format or indexed color format, the image has to be
converted before passing it to BGRT. This patch added support
to convert other BMP image format into 32bit format required by
BGRT.

This has been tested with Windows on Leafhill board. The SBL
logo was dispalyed properly while booting Windows.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2021-01-14 09:52:36 -08:00
Sachin Agrawal e3cedba233 Handle TPMStartup error during S3 resume
As per TCG spec, if a Tpm2Startup(TPM_SU_STATE) fails during
S3 resume, a host reset should be done.

When BootGuard is enabled, ACM will notify of this failure via Bit46 in
BootGuardBootStatus register.


Signed-off-by: Sachin Agrawal <sachin.agrawal@intel.com>
2021-01-11 12:43:11 -08:00
Talamudupula 29ecb88d14 Fix ModuleGuid print in FPDT record
This patch prints the correct ModuleGuid in FPDT.

Signed-off-by: Talamudupula <sai.kiran.talamudupula@intel.com>
2020-12-17 06:10:53 -08:00
Perni e41578e663 TGL KW issue 19321
Added check for swpart to avoid accessing out of array elements

Signed-off-by: Perni <ramesh.chandra.perni@intel.com>
2020-12-15 23:01:41 -07:00
James Gutbub c7a1ca0da3 Add EXT4 to print in 'boot' command
Since the EXT library we have in OS Loader
supports 2, 3, and 4 it will help to reduce
confusion for users who have noticed that
only 2 and 3 are currently printed.

Signed-off-by: James Gutbub <james.gutbub@intel.com>
2020-12-07 22:39:41 -08:00
Maurice Ma 6117ebaa7c Enable ACPI BGRT table support
This patch enabled ACPI BGRT support. It is used to pass splash
display information from bootloader to payload and OS.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2020-12-02 12:40:18 -08:00
Maurice Ma c6feaaf3e3
Add ACPI RSDP to Linux BOOT_PARAMS (#905)
For UEFI Linux boot, a new parameter was added into BOOT_PARAMS.
This patch added this parameter support so that ACPI base can
be passed directly to kernel.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2020-11-22 21:08:19 -08:00
Maurice Ma 1002d880a2 Enable mixed payload mode calling
Since SBL could be built into either x86 or x64 mode, and the payload
can also be x86 or x64 mode. When mixed modes are used, it is required
to switch to proper mode first before calling into payload entrypoint.
This patch added this check to switch to required mode before calling
into payload entry point.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2020-10-12 13:01:07 -07:00
Maurice Ma 9a4407018d [QEMU] Fix NOOPT build failure
This patch fixed NOOPT build failure for QEMU.
It fixed #871.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2020-10-12 13:00:44 -07:00
Sai Talamudupula be30a11910 Enhance eMMC driver
Improve the HS200 switch code to set bus mode
correctly on some eMMC cards.

Signed-off-by: Sai Talamudupula <sai.kiran.talamudupula@intel.com>
2020-10-08 17:04:38 -07:00
Maurice Ma dd8fe22046 Add MultiBoot support for X64 build
During X64 enabling, there was a pending task to enable 32bit
MultiBoot support. It is not implemented.  This patch added the
support to allow X64 SBL to boot a 32bit MB image through thunking.
As part of this patch, the ThunkLib is separated from the FspApiLib
so that it can be shared by other component.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2020-10-07 14:20:50 -07:00
Guo Dong d9feb94de3 Add SetDeviceAddr() for device table update
Currently SBL library has GetDeviceAddr() to get the device
address based on device type and instance. This patch adds
SetDeviceAddr() to update a given device type and address so
that platform could update the device table dynamically.

Signed-off-by: Guo Dong <guo.dong@intel.com>
2020-09-18 17:39:27 -07:00
Subash Lakkimsetti 6a1c024a6a Naming convention update for secureboot and IppLibs
Added EFIAPI to missing APIs

Signed-off-by: Subash Lakkimsetti <subash.lakkimsetti@intel.com>
2020-09-08 08:07:30 -07:00
Maurice Ma 340b870842 Fix GCC x64 Crypto boot issue
This patch fixed GCC x64 Crypto boot issue. The issue was related
to the calling convention. "EFIAPI" was missing for several ASM
provided functions.
It also fixed #834.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2020-09-04 15:34:33 -07:00
Maurice Ma d6a4598869 Add SBL Setup tool and feature PCD
This patch added SBL python setup script. It can run on either host
or target MicroPython environment. A new PCD PcdEnableSetup is added
to control if Setup feature should be supported by core.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2020-09-02 15:42:36 -07:00
Aiden Park 02e43b4760 PayloadPkg: Build paging table to cover high MMIO region
A device in boot options can have a BAR greater than 4GB depending on PCI
64Mem/PMem resource policy.
This will allow Payload to build a paging table to cover high MMIO area.

Signed-off-by: Aiden Park <aiden.park@intel.com>
2020-09-01 17:58:58 -07:00
Maurice Ma 99332b68dc Fix new Klocwork scanning issues
This patch fixed some new reported klocwork scanning issues.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2020-08-25 09:57:23 -07:00
Sindhura Grandhi aeef6df940 Generate zero size dummy data in the Component Entry
This patch generate a component binary of zero size if not
already present.

Signed-off-by: Sindhura Grandhi <sindhura.grandhi@intel.com>
2020-08-24 14:41:35 -07:00
James Gutbub dadd8bdcd2 Fixed improper use of sizeof with pointer
This will resolve some issues reported by
the Klocwork scan.

Signed-off-by: James Gutbub <james.gutbub@intel.com>
2020-08-24 10:22:38 -07:00
James Gutbub 7371a65cae Add BootFlags selection to 'boot' command
The boot command currently does not allow you
to enter the BootFlags value which is needed
for some boot images.

Also fix a small issue in the FsType selection
code block.

Signed-off-by: James Gutbub <james.gutbub@intel.com>
2020-08-18 15:21:04 -07:00
Maurice Ma 0000d110a2 Add interface to draw framebuffer from text buffer
This patch added new DrawFrameBuffer interface. It will draw the
framebuffer from a VGA like text buffer. Payload can use this
to sync its own text buffer onto framebuffer screen. It aslo added
extend ASCII char support so that some table char can be displayed.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2020-08-12 18:45:10 -07:00
Maurice Ma 8aeed6fd9a Add functions to build CFGDATA from database
This patch added new function to build a full set of the CFGDATA set
from the memory for current platform. It is useful for exporting
current platform CFGDATA for further processing.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2020-08-12 12:33:45 -07:00
Maurice Ma 162b849e11 Add HelloWorld payload example
This patch added an example on how to build a HelloWorld payload
from separate DSC file.

To build a standalone HelloWorld payload, use the following command:
  BuildLoader.py build_dsc -p PayloadPkg\PayloadPkg.dsc

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2020-08-12 12:33:20 -07:00
Maurice Ma 6eac355a33 Fix Linux Framebuffer
Linux framebuffer screen_info has been extended to support 64bit
address. This patch added extra fields and set the upper 32 bit
for the framebuffer base.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2020-08-10 10:38:41 -07:00
Maurice Ma 67e6599714
[QEMU] Add general setting CFG page (#803)
This patch added the missing general configuration settings for
QEMU platform.  It also addressed a build issue due to non-ascii
chars in the IPP file.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2020-08-10 09:56:25 -07:00
Subash Lakkimsetti 205b93df40 IPP crypto library sync
This patch aligns IPP crypto repo sources and headers,
- Update license headers as per IPP crypto
- Naming convention updates
- Partial clean up.

ASM updates will be addressed in next patches.

Signed-off-by: Subash Lakkimsetti <subash.lakkimsetti@intel.com>
2020-08-06 18:55:52 -07:00
Maurice Ma 091ba856c6 Move GetHashToExtend to SecureBootLib
This patch moved GetHashToExtend function from BootloaderCommonLib
to SecureBootLib. It is a better place to contain this interface.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2020-08-06 12:08:30 -07:00
Subash Lakkimsetti 76eec9a127 Configdata firmware update svn check
Add support for security version check for
config data blob update. SVN is checked
for redundant region which would be updated.

Fixed python errors in CfgDataTool and
GenCapsuleFirmware.

Signed-off-by: Subash Lakkimsetti <subash.lakkimsetti@intel.com>
2020-08-05 13:49:45 -07:00
Sai Talamudupula ac66d62da1 Fix AHCI init failure when NumPort=0
When a SATA controller has no Ports Implemented
behind it, AHCI mode init returns error even before
allocating buffers for RFis, CommandTable, CommandList.
So, AHCI de-init expects them to be NULL, else any
garbage value for these fields forces the code to do
a FreePool on non-allocated memory.

Signed-off-by: Sai Talamudupula <sai.kiran.talamudupula@intel.com>
2020-08-05 06:39:09 -07:00
Subash Lakkimsetti 57c11052cd Check LocateComponentEntry outputs before its consumed
LocateComponentEntry is modified to locate only container
entry. Additional checks are required at consumer end
for Container entry and CompEntry.

Signed-off-by: Subash Lakkimsetti <subash.lakkimsetti@intel.com>
2020-07-08 20:08:30 -07:00
Maurice Ma 48ca17769b Fix MultiBoot image loading issue
The current MulitBoot loading code in SBL did not follow the specification.
The spec stated "The offset in the OS image file at which to start loading
is defined by the offset at which the header was found, minus
(header_addr - load_addr)". However, the current code always copies from
offset 0 of the image file. It caused exception when loading some valid
multiboot image.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2020-07-08 07:53:48 -07:00
Subash Lakkimsetti 99e4ba268c Initialize variables for container svn
Fix klocwork issues.

Signed-off-by: Subash Lakkimsetti <subash.lakkimsetti@intel.com>
2020-07-06 10:32:06 -07:00
Subash Lakkimsetti ad839a3507 Container capsule update svn check
Add support for security version check for
container and its components with ones available
in flash for capsule updates.

Signed-off-by: Subash Lakkimsetti <subash.lakkimsetti@intel.com>
2020-07-01 20:02:41 -07:00
Mutha 1da8b17c55 OS loader Optimization for Raw Partition Boot.
In FindPartitions() identifying memory device
using MediaGetInterfaceType().

Signed-off-by: Mutha <naga.naveen.mutha@intel.com>
2020-06-22 14:54:36 -07:00
Aiden Park f1d04b0dcd Print file size in unsigned format in 'fs ls'
File size shows negative number, so unsigned print format is used.

Signed-off-by: Aiden Park <aiden.park@intel.com>
2020-06-17 15:13:18 -07:00
Aiden Park 0feb2ecd62 Support media instance in 'fs' shell command
The 'fs' shell command initializes media device with media type info,
but it's not able to initialize another controller of same media type.
Therefore, 'fs init' accepts device instance number.
ex) SATA(0), SATA device instance 1, hwpart 2, swpart 3
    fs init 0:1 2 3

Signed-off-by: Aiden Park <aiden.park@intel.com>
2020-06-17 15:13:18 -07:00
Maurice Ma 0311566858 Use container format for key hash store
This patch converted key hash store in SBL image into container
format. In this way unified data structure can be used to
simplify code.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2020-06-16 11:20:12 -07:00
Aiden Park 2045b00eef Remove wbinvd() in warm reset
The unnecessary wbinvd() is removed from the common ResetSystemLib,
and it moves to a platform specific reset routine.

Signed-off-by: Aiden Park <aiden.park@intel.com>
2020-06-11 10:17:15 -07:00
Mutha f254d2762d Booting linux from BIOS and PDR region.
SPI driver is updated to support read linux from
BIOS and PDR region, When boot device SPI is
selected.

Signed-off-by: Mutha <naga.naveen.mutha@intel.com>
2020-06-08 11:52:40 -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
Guo Dong 7edce89fb1
Support X64 UEFI payload (#728)
IA32 UEFI payload uses PE format and X64 UEFI payload uses
PE+ format. So update LitePeCofflib to support both PE and
PE+.

Signed-off-by: Guo Dong <guo.dong@intel.com>
2020-05-29 10:15:12 -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 2f076387a0 Check SATA controller at Ahci Init
This will fix an unexpected exception when AhciHcPciBase is invalid
or the PCI config space is not enabled.

Signed-off-by: Aiden Park <aiden.park@intel.com>
2020-05-22 12:20:57 -07:00
Maurice Ma fc6aa78708 Add OEM container verification support
Current SBL supports container header verification. If the container
signature is BOOT, it will use HASH_USAGE_PUBKEY_OS. Otherwise, it
will use HASH_USAGE_PUBKEY_CONTAINER_DEF. This patch added OEM signed
container support. If a container signature between OEM0 to OEM7 is
found, it will be verified use HASH_USAGE_PUBKEY_OEM(x) where x is 0
to 7. To add an OEM public key hash, it can be done by updating
pub_key_list in GetKeyHashList() in file BoardConfig.py.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2020-05-22 12:19:50 -07:00
Subash Lakkimsetti 47a15937a1 String function Support library
Add string functionality in Osloader to a
common library

Signed-off-by: Subash Lakkimsetti <subash.lakkimsetti@intel.com>
2020-05-13 08:34:20 -07:00
Maurice Ma 248f4985e8 Fix build warning for missing header files
This patch added missing C header files in INF file. It fixed the
build warning message.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2020-05-12 14:32:40 -07:00
Sai Talamudupula 12a613a831 Fix Klockwork issue flagged in PagingMap lib
Klocwork reports a potential dereferencing of a NULL
pointer. This patch addresses the issue.

Signed-off-by: Sai Talamudupula <sai.kiran.talamudupula@intel.com>
2020-05-11 17:04:34 -07:00
Vegnish Rao 1deb84fcfa
Fix Klockwork issue flagged in BootloaderCommonPkg (#705)
Fix for: Klockwork flags multiple variables being used uninitialized

Signed-off-by: Vegnish Rao <vegnish.rao.paramesura.rao@intel.com>
2020-05-08 09:06:22 -07:00
Subash Lakkimsetti 5804d9a18a Measure firmware debugger launch
Platform debug mode is extended to PCR[7]
as part of secure boot policy. Updated bit setting
to LoaderPlatformInfo for payloads to consume.
Debug mode is checked in payload.

ArchitecturalMsr.h ported fom EDK2 repo.

Signed-off-by: Subash Lakkimsetti <subash.lakkimsetti@intel.com>
2020-05-05 15:07:15 -07:00
Himanshu Sahdev aka CunningLearner 74aa53e77a TpmLib: Add appropriate comparison checks
Signed-off-by: Himanshu Sahdev aka CunningLearner <sahdev.himan@gmail.com>
2020-05-05 15:04:20 -07:00
Himanshu Sahdev aka CunningLearner f11d4be58e TpmLib/Tpm2Capability.c: Fix typos
Signed-off-by: Himanshu Sahdev aka CunningLearner <sahdev.himan@gmail.com>
2020-05-05 15:04:20 -07:00
Aiden Park e99762353a
Introduce CONSOLE_PRINT macro (#701)
This will allow necessary messages to be printed to consoles.

These macros will redirect debug message to consoles.
  CONSOLE_PRINT
  CONSOLE_PRINT_UNICODE

These conditional macros will redirect debug message to consoles or
DEBUG(). The PrintLevel is valid only when redirected to DEBUG().
  CONSOLE_PRINT_CONDITION
  CONSOLE_PRINT_UNICODE_CONDITION

Signed-off-by: Aiden Park <aiden.park@intel.com>
2020-05-04 14:53:08 -07:00
Guo Dong 82eb72c9a7
Add MtrrLib with a MTRR display function (#693)
To help debug boot performance, add a MTRR print function.
This function could be invoked multiple times with different
string to know where this MTRR data is printed.

Signed-off-by: Guo Dong <guo.dong@intel.com>
2020-04-30 22:08:05 -07:00
stalamudupula ee26b02df5
Support paging for Above4Gb addresses (#692)
This patch enhances MapMemoryRegion subroutine to
add PDP entries for mapping addresses > 4GiB.
Only 1:1 mapping is provided for Above4Gb addresses.
And linear addresses are mapped to 1GiB pages.

Signed-off-by: Sai Talamudupula <sai.kiran.talamudupula@intel.com>
2020-04-30 22:05:54 -07:00
Aiden Park 57bea9118d
Enhance debug log buffer as ring buffer (#699)
This will allow debug log buffer to record logs in ring buffer
if the buffer is full.

Signed-off-by: Aiden Park <aiden.park@intel.com>
2020-04-30 11:56:39 -07:00
Aiden Park b884702aca
Fix ELF image loading failure (#700)
This will fix invalid offset calculation of ELF program header.

Signed-off-by: Aiden Park <aiden.park@intel.com>
2020-04-29 23:07:11 -07:00
Aiden Park 5d37a25284 [X64] Fix XHCI init failure
This issue is seen on a WHL board on X64 build when high 32-bit
BAR does not exist. In that case, MmioRead64 returns (UINT64)(-1).
To avoid this, read high 32-bit BAR only if BAR type is 64-bit
address space.

Signed-off-by: Aiden Park <aiden.park@intel.com>
2020-04-29 21:52:11 -07:00
Maurice Ma 86566d4196 Move container initialization earlier
Current container library cannot be used before memory is initialized
because the structure will only be initialized after memory. This
patch moved the initialization into Stage1A so that the library can be
used much earlier. The containers registered before memory will be
migrated into memory automatically post memory initialization. In this
way it avoids duplicated header authentication.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2020-04-24 08:06:05 -07:00
Aiden Park 70af774d71
Support 64-bit ELF loading (#687)
This will load and execute 64-bit ELF image.
- Load image from ELF program header
- 32-bit ELF on IA32 only. 64-bit ELF on X64 only
- TBD: Relocate ELF

Signed-off-by: Aiden Park <aiden.park@intel.com>
2020-04-20 16:58:49 -07:00
Maurice Ma cd40ed449c Add keypad arrow key support
This patch added support for arrow keys on PS2 numeric keypad.
The original code only supports the dedicated arrow keys.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2020-04-20 09:43:22 -07:00
Maurice Ma 16fe767e67 Add media DeInit for Shell FS command
In Shell FS after media initialization,  the de-initialization
should be called to free all allocated memory.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2020-04-20 09:41:32 -07:00
Aiden Park 0b31b6b2a6
Add 'acpi_rsdp' Linux kernel parameter in cmdline (#679)
Recent Linux kernel accepts acpi_rsdp=0x.. in kernel command line.
This will make Linux kernel look for ACPI RSDP address in the kernel
commad line first prior to in DMI or F-segment.

Signed-off-by: Aiden Park <aiden.park@intel.com>
2020-04-17 16:14:47 -07:00
Guo Dong 4430620e4b
Add FSP boot performance data (#678)
FSP could produce a FSP boot performance HOB.
So add the capability to print FSP performance data.
Also add a PcdBootPerformanceMask to enable/disable
boot performance data print.

Signed-off-by: Guo Dong <guo.dong@intel.com>
2020-04-16 23:31:35 -07:00
Maurice Ma b05a73f24b Upgrade LZ4 to 1.7.4
This patch upgraded the LZ4 from 1.4.0 to 1.7.4. The size will
increase around 300 bytes. Performance is still very similar.
But when trying to use more recent LZ4 version 1.9, noticed
significant performance degration. So keep to 1.7.4 for now.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2020-04-15 17:54:26 -07:00
stalamudupula 6cfe319efc
Support 64-bit XHCI MMIO address (#675)
If Platform code assigns 64-bit BAR address to XHCI,
get the full 64-bit address to access MMIO space.
Behavior is undefined if building IA32 and assigning
64-bit XHCI resources.

Signed-off-by: Sai Talamudupula <sai.kiran.talamudupula@intel.com>
2020-04-15 14:02:29 -07:00
Maurice Ma c94fccb54a
Fix XHCI library memory de-allocation issue (#668)
* Fix XHCI library memory de-allocation issue

This patch added code to XHCI de-initialization funciton to free
all used memory.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>

* Enhance USB De-initialization flow

This patch enhanced the USB De-initializaiton flow by trying to
call de-init functions in the full USB driver stack including XHCI,
UsbBus, UsbBot, etc.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2020-04-14 11:08:00 -07:00