Commit Graph

37 Commits

Author SHA1 Message Date
Sean McGinn
f9d614c09f Move MB/ACPI macros to BootloaderCommonLib
Move macros to BootloaderCommonLib as they
are now consumed by both SBL stages and payload

Signed-off-by: Sean McGinn <sean.mcginn@intel.com>
2023-05-04 13:25:07 -07:00
Mike Crowe
990e3e81e6 Use LF line endings in the repository
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>
2021-11-10 12:46:42 -08:00
Maurice Ma
f67122518c SBL clean up to split core private data out
This patch moved SBL core private data strctures and definitions
into a private header file so that other packages cannot refer
to the private structures.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2021-11-04 10:49:49 -07:00
Maurice Ma
a815fd2e72 Add GetSocSku/SetSocSku API
This patch added API to Get/SetSocSku. In current code, SBL always
read the PCI register to determine the SKU. It is not efficient.
Since it is used a lot, it is better to have software API to get
this info through a software only method.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2021-11-02 10:55:04 -07:00
Maurice Ma
4936832cde [TGL] Add SOC specific memory info
This patch updated the memory info for TGL platform using the SOC
specific memory map registers.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2021-10-26 14:32:20 -07:00
Maurice Ma
78cdcd8732 Provide API inferfaces to get/set platform memory info
In order to report memory size info in SMBIOS table, it is required
to know the full system memory. However, all info can only be passed
through FSP HOB, and it cannot easily identify the top of low/high
memory. The patch added core API GetMemoryInfo/SetMemoryInfo so that
platform can provide required memory info for core. By default, it
uses FSP hobs to guess these info. But platform can update it with
more accurate info during PostMemoryInit phase.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2021-10-26 14:32:20 -07:00
Aiden Park
18d16d44ff Profile Max Used Heap size at runtime
This records the maximum usage of heap at runtime. The Stage1/2 heap
sometimes reaches OUT OF RESOURCE even if it looks there is enough
usable space in the heap. This is because AllocateTemporaryMemory()
sometime exceeds the heap boundary. ex) IppCryptoLib
This would help identify proper heap size required in each stages.

Signed-off-by: Aiden Park <aiden.park@intel.com>
2021-10-25 09:48:22 -07:00
Aiden Park
81f7712846 [CorePkg] Add additional APIs to access LoaderGlobalData
This adds additional APIs to make Platform code use APIs to access
LoaderGlobalData instead of accessing variables directly.
- GetS3DataPtr()
- SetFeatureCfg()
- ClearFspHob()
- GetVerInfoPtr()

Signed-off-by: Aiden Park <aiden.park@intel.com>
2021-08-06 12:34:36 -07:00
Aiden Park
49a3a54e6c [CorePkg] Add GetTempRamInfo() API (#1245)
Some platforms need TempRam Base & Size information to calculate
FspmArchUpd StackBase & Size at runtime.
The TempRam Base & Size info will be only valid until TempRamExit.

Signed-off-by: Aiden Park <aiden.park@intel.com>
2021-08-04 09:56:31 -07:00
Singh Nitin G
7011ce1bf0 Fix HeciGetFwCapsSkuMsg api to update MBP
Made changes to ensure the ME BIOS data information
is correctly reported.

Signed-off-by: Divneil Rai Wadhawan <divneil.r.wadhawan@intel.com>
2020-11-24 15:40:54 -08: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
864fa6d26e Fix Stage1B/Payload loading failure on gcc built X64 target (#642)
This will fix stage transition failures for X64 targets built with gcc
which is caused by mis-matched EFIAPI calling convention.
- Add EFIAPI to STAGE_ENTRY interface for Stage1A -> Stage1B
- Add EFIAPI to PAYLOAD_ENTRY interface for Stage2->OsLoader Payload
- Remove unused KERNEL_ENTRY interface

Signed-off-by: Aiden Park <aiden.park@intel.com>
2020-04-06 21:58:40 -07:00
Maurice Ma
762eee35b7 Common code change for QEMU x64 boot
This patch added additional changes for QEMU x64 boot.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2020-04-02 09:00:14 -07:00
Maurice Ma
1083cce99e Rebased to the latest master
Resolved the conflicts and fixed the build issue.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2020-04-02 07:50:30 -07:00
Maurice Ma
72cb08ee7d Enable QEMU Stage1A boot in X64 mode (#621)
* [QEMU] Enable Stage1A boot in X64 mode

This patch added necessary changes to enable QEMU boot through
Stage1A in SBL X64 build.

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

* [QEMU] Enable QEMU Linux boot in X64 mode

This patch enabled SBL X64 boot for Linux. At this moment, since
FSP is still in 32 bit mode, it is required to thunk back into
32 bit mode to call FSP APIs.
It fixed #622.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2020-04-02 07:30:43 -07:00
Maurice Ma
d3c42e575d Fix GCC build issue in x64 (#620)
Due to missing normal function implementations in some x64 code, GCC
optimized many code off from the final image which caused synbol
patching issue later on. This patch fixed this.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2020-04-02 07:28:57 -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
6e5dd24e0e Optimize GDT loading in stage core code (#611)
This patch opitmized GDT loading in different stages. The old code
put GDT in code segment so it needs to be relocated every time when
code relocation/remapping occurs. By putting GDT into heap, it avoids
the GDT reloading. It only needs to be done twice, PreMem and PostMem.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2020-03-26 09:19:26 -07:00
Maurice Ma
0e1098d7b2 Add DMA protection in core code
This patch added DMA memory type into memory allocation pool for payloads.
This DMA memory buffer with PcdDmaBufferSize is located at address
aligned at PcdDmaBufferAlignment after Payload reserved memory. Memory
type EfiRuntimeServicesData is used to indicate DMA memory type.

Stage1B calculates the DMA memory location using fixed PCDs so that
platform can set up DMA protection as early as possible after memory is
ready. In Stage1B or Stage2 platform code should use platform VTd
information to setup PMR to protect all low memory except for the DMA
buffer range. DMA memory will be added into memory pool at the entry
point of the payload. Before transfering to OS, the DMA memory protection
can be disabled, and the DMA memory pool can be reclaimed for OS usage.

Currently only boot media device will utilize the DMA buffer range for
block access operations. So it should only be required by payloads. GFX,
when enabled, will also use DMA. It will be targeted to the system stolen
memory which is not protected by PMR.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2020-03-17 18:04:44 -07:00
Subash Lakkimsetti
d2acdab100 TPMLib and Measured boot updates (#539)
- Added GetHashToExtend to bootloader common API to
  retrive digest to extend
- Hash calculations for stage component and config date updated
  to use bootloader common API
- Added functionality to extend KeyHashManifest digest

Signed-off-by: Subash Lakkimsetti <subash.lakkimsetti@intel.com>
2020-01-22 13:53:44 -08:00
Subash Lakkimsetti
f9e542a72c Update firmware component stage hash extend
LoadComponentCallback is extended to perfom TPM extend
for firmware component stages. Component callback would be
invoked after authentication.

TpmExtendStageHash would extend hash based on hash validity.
TpmExtendConfigData is added to handle the Config data blob extend.

Signed-off-by: Subash Lakkimsetti <subash.lakkimsetti@intel.com>
2020-01-13 08:30:45 -08:00
Aiden Park
ccc0560670 [Stage1] Add Stage1 stack base setup offset
This patch allows to setup Stage1 stack/data in any CAR range.
By default, the stack base offset is 0 from CarBase.

Signed-off-by: Aiden Park <aiden.park@intel.com>
2020-01-10 16:20:31 -07:00
Maurice Ma
53255d7c6d Clean up BootloaderCorePkg stage code
This patch did some of the following clean up:

- Rename *_HOB to *_PARAM for Stage1A/Stage1B/Stage2.
  This is to avoid confusion between real HOB and the parameter
  data block passed through stages.

- Rename BistVal to CpuBist.
  This is to make it more clear.

- Add BUF_INFO definition.
  BUF_INFO will be used as a general structure.

- Remove CarBase/Top in Stage1B HOB
  They are not used at all.

- Clean memory allocation in Stage1A
  Restructured the buffer allocations for Stage1A global
  data so that it is easier to read and maintain.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2019-12-17 12:59:08 -08:00
Subash Lakkimsetti
71c64f40bd IPP Crypto and Secure boot lib to support multiple hashes
Hash and RSA signing parameters were hardcoded in
Crypto wrappers and secure boot libraries. This patch
address support for multiple hash and key sizes.

Signed-off-by: Subash Lakkimsetti <subashx.lakkimsetti@intel.com>
2019-12-12 08:13:04 -07: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