Commit Graph

189 Commits

Author SHA1 Message Date
Maurice Ma c2e634c5c9 Add support for PCI expansion rom resource allocation
Current SBL PCI enumeration does not allocate resource for PCI ROM
bar because SBL does not deal with option ROM at all. However, the
Linux kernel might expect the ROM bar resource to be allocated.
This patch introduces a static build configuration to allow support
PCI resource allocation for PCI ROM bar.

To enable this feature, please add following into the project
BoardConfig.py file:
  self._PCI_ENUM_FLAG_ALLOC_ROM_BAR = 1

By default, it will be disabled to keep the same behavior as before.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2022-02-28 13:08:54 -08:00
Maurice Ma dfc007336e Add configuration data length check in CfgDataTool
This patch added configuration array data size check to ensure it
is DWORD aligned. It will prevent some unexpected errors later on
while merging the configuration data.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2022-02-14 09:50:16 -08:00
Randy Lin f590717e93 Fix condition fields may disappear in Config Editor tool
When enable TGL IBECC, the IbeccProtectedRegionMask should be visible
too in the Config Editor but its not happening this way.

Signed-off-by: Randy Lin <randy.lin@intel.com>
2022-02-08 20:01:52 -08:00
Mike Crowe 43001d0625 BuildUtility: Support GCC5_BIN prefix
The EDK II build tools support applying a prefix for GCC from an
environment variable (e.g. GCC5_BIN). For this to work correctly with
Slimbootloader it's also necessary to use the prefix for the version
check too.

Signed-off-by: Mike Crowe <mac@mcrowe.com>
2022-01-18 08:37:11 -08:00
Mike Crowe e21d8ea944 PrepareBuildComponentBin: Avoid network access if commit available
It may be necessary to build Slimbootloader in situations where Internet
access is not available, or where it is important to ensure that there
is also a local copy of the build dependencies.

It's possible for the correct repositories to be cloned into the right
places outside the Slimbootloader build system. However,
PrepareBuildComponentBin previously insisted on attempting to
fetch from the remote repository every time.

If the .git directory exists, let's first try to check out the required
commit and only if that fails attempt to fetch.

This means that it's possible to stop the Slimbootloader build system
accessing the Internet by arranging for the correct repositories to be
cloned in the right places beforehand and setting the https_proxy
environment variables to unresolvable names to avoid accidental use.

Signed-off-by: Mike Crowe <mac@mcrowe.com>
2022-01-18 08:36:41 -08:00
James Gutbub 4b82461065 Update IASL to version 20190509
For Azure and toolchain check we
can update to using IASL version
20190509 since some of the newer
SBL platforms require a newer
IASL version.

Signed-off-by: James Gutbub <james.gutbub@intel.com>
2022-01-05 12:01:15 -08:00
Yongxin Liu c3c9ebb1e2 add private key check for PKCS8 format
Since openssl 3.0.0, in commit 10203a34725e ("Support writing RSA
keys using the traditional format again"), the default format of
private key has been changed to PKCS#8.

Signed-off-by: Yongxin Liu <yongxin.liu@windriver.com>
2021-12-20 18:47:02 -08:00
Guo Dong d0fac9b442 Enhance the tool
When BOARD_PKG_NAME_OVERRIDE is configured, the tool will firstly
search from BOARD_PKG_NAME_OVERRIDE, then search BOARD_PKG_NAME
for dlt and vbt files. It also uses BOARD_PKG_NAME_OVERRIDE for the
VerInfo file.

Signed-off-by: Guo Dong <guo.dong@intel.com>
2021-12-13 16:13:04 -07:00
Maurice Ma 749c32b71c [BootloaderCorePkg] Fix build after syncing up to EDK2 stable tag
EDK2 stable tag 202111 changed some field name in SMBIOS structure.
This patch matched the changes to fix the build issue for SBL. It
also added new library class in DSC.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2021-12-13 14:08:25 -08:00
Maurice Ma c0e68ede88 Fix cfgdata_dir argument issue in CfgDataStitch
This patch fixed the issue that "cfgdata_dir" argument is not
used properly by the CfgDataStitch script. The "cfgdata_dir"
will contain the CfgDataDef.yaml file and optional DLT files
if provided. Otherwise, the DLT files will be extracted from
the IFWI binary and stored in "cfgdata_dir".

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2021-12-02 09:21:10 -08: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 a4be3518b2 Add new Constant type for CFGDATA
There are CFGDATA item that needs to be generated into DLT file,
but not to be displayed in ConfigEditor. The current "Reserved"
type prevents the item from being displayed in ConfigEditor,
but also prevents it from being generated in a DLT file. The new
"Constant" type is introduced here to resolve this issue. Item
with "Constant" type will not be displayed in ConfigEditor, but
will be generated in the DLT file.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2021-11-04 10:49:30 -07:00
Maurice Ma 717d2466fb Generate all files in output directory for CfgDataStitch
This patch moved all generated files into the Output direcotry so
that it is easier to find.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2021-11-04 10:49:14 -07:00
Maurice Ma 0d4ea1c451 Fix some issues in SblSetup on MicroPython
This patch fixed several minor issues to make SblSetup script work
properly on the latest SBL and MicroPython. It added string encode
and decode function to address the python unicode issue. Some help
message were added as well.
Tested with both host and target execution mode, and it worked as
expected.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2021-11-01 09:15:46 -07:00
Maurice Ma 285274385a Remove OPENSSL_PATH assignment in CfgDataStitch.py
This patch removed OPENSSL_PATH env variable overriding. It
has been handled by the SBL common script.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2021-10-29 07:49:07 -07:00
Maurice Ma d031072e9c Enable search bar in ConfigEditor
This patch added a search bar in ConfigEditor so that it
is easier to locate a configuration item.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2021-10-21 10:14:15 -07:00
Maurice Ma c03faf59c3 Enhance PCI enumeration policy for resource downgrade
On TGL platform, when enable SR_IOV for PCI enumeration, system
hung due to insufficient PCI resource. GFX VF needs lots of MMIO
resource and it cannot be satisfied by SBL in 32 bit mode.

To address this issue, this patch extends the bus 0 downgrade
policy to further allow downgrading PCI bus 0 devices except for
GFX. Now the DowngradeBus0 policy has following values:
  0: Do not downgrade PCI devices on bus 0
  1: Downgrade all PCI devices on bus 0
  2: Downgrade all PCI devices on bus 0 but GFX
  3: Reserved
By default, it has the same behavior as before. If platform needs
to download bus 0 devices but GFX, the new value 2 can be used.

This has been tested on TGL, and it worked as expected.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2021-10-18 09:14:52 -07:00
Maurice Ma 1f3de3399e Enable BIOS region update in single shot
Sometimes it is helpful if SBL can support firmware update from
SBL FW to UEFI FW, or update from incompatible SBL flash layout.
This will need SBL to write full BIOS region without using
redundant partition. To support this, a special capsule image
flag is added to indicate this special update. Please note, this
update might be very risky. This is only for development purpose.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2021-10-11 15:29:37 -07:00
Maurice Ma 248512571f Enhance IfwiUtility script to handle BIOS region gap
The current SBL IfwiUtility script assumes the SBL image size
occupies the full BIOS region. However, in some case, gap may
exist at the beginning of the BIOS region. SBL image will not
always start at BIOS region offset 0.  This patch added special
handling to support this case.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2021-10-11 15:22:52 -07:00
Aiden Park bea07fdc60 [Tool] Allow each platforms to override min tool versions
This allows each platforms to override its own minimum tool versions.

Current SBL default minimum tool versions:
    'python'    : '3.6.0'
    'nasm'      : '2.12.02'
    'iasl'      : '20160422'
    'openssl'   : '1.1.0g'
    'git'       : '2.20.0'
    'vs'        : '2015'
    'gcc'       : '7.3'
    'clang'     : '9.0.0'

If a board needs to use VS2008 and nasm2.14,
In BoardConfig.py,
    def GetPlatformToolchainVersions(self):
        version_dict = {
            'nasm'      : '2.14',
            'vs'        : '2008',
        }
        return version_dict

Signed-off-by: Aiden Park <aiden.park@intel.com>
2021-10-08 20:05:10 -07:00
Maurice Ma 2d775da9b4 Add support to show a configure item under multiple pages
Current CFGDATA item can only be displayed under one single page
defined in YAML. In some special case it might need to duplicate
the same item under a differnt page. This patch added this feature
by introducing a new "altpage" attribute for a CFG item. When a
item needs to be displayed on a 2nd page, 'altpage' can be added
to indicate the 2nd page id.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2021-09-27 11:38:34 -07:00
Maurice Ma 5ae51f68fd Fix build issue for UCODE repo clone
Ucode repo can be mapped to several different repos in SBL.
Current SBL uses the exactly same folder name for all UCODE
repo. It causes build issues when the UCODE repo switches
from one repo to another. To avoid this issue, this patch
allows to automatically use different folder name for UCODE
repo clone so that each UCODE repo has its own folder.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2021-09-13 15:40:20 -07:00
Guo Dong 64dca520ef [TGL] Make TCC setting consistent
Add a separate cfgdata dlt file to enable TCC config data.
The TCC dlt file will be appended to board dlt file when
ENABLE_TCC is set in BoardConfig.py.

Removed RTCM subregion and update boot option for RTCM support
TCC is disabled by default.

Signed-off-by: Guo Dong <guo.dong@intel.com>
2021-06-10 13:30:58 -07:00
Guo Dong aa034dd72c Enhance gen_config_file in BuildUtility script
It will first check the dlt file from source code, it the
dlt file could not be found, then check the build folder.
This enhancement supports the generated dlt file from
build folder.

Signed-off-by: Guo Dong <guo.dong@intel.com>
2021-06-10 13:30:58 -07:00
Maurice Ma 97124b133f Patch FSP-T UPD microcode base
When redundant partition is enabled, the FSP-T microcode base UPD
always points to the microcode region in 1st partition. Instead,
it should points to the microcode rgion in its own partition. This
patch fixed this issue.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2021-05-28 15:07:15 -07:00
Maurice Ma 126a2c5f03 Enhance ConfigEditor to handle error condition
This patch enhanced ConfigEditor to handle the case that the app
will crash when "Value" is not provided in YAML. It also fixed
an hide/show issue for Table type widget.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2021-05-14 11:15:19 -07:00
Aiden Park a1298c8f3b [Build] Make 'git' version checking optional
The build system is using 'git', it doesn't require the latest git.
This will show 'git' recommend version if not met,
and will address issue#1136.

Signed-off-by: Aiden Park <aiden.park@intel.com>
2021-04-27 09:12:56 -07:00
Aiden Park bc5584d176 [Build] Verify toolchain versions
This will check the minimum required toolchain versions
before starting build process.
If any of these toolchains does not meet the required version,
the build process will stop immediately.

Here are the initial minimum toolchain versions.
- python : 3.6.0
- nasm   : 2.12.02
- iasl   : 20160422
- openssl: 1.1.0g
- git    : 2.20.0
- vs     : 2015
- gcc    : 7.3
- clang  : 9.0.0

Signed-off-by: Aiden Park <aiden.park@intel.com>
2021-04-26 09:07:04 -07:00
Maurice Ma 625947617c
[EHL] Fix CFGDATA issues on EHL (#1123)
EHL CFGDATA has missing options for Combo type configuration. And
it will cause ConfigEditor exception. This patch added the missing
options. And it also fixed typos.

It fixed issue #1122.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2021-04-19 08:47:14 -07:00
Maurice Ma fda951e10a Add image ARCH type into SBL version info
SBL can support IA32 and X64 build. But this info is not indicated
in the SBL version info. This patch added one bit to indicate the
SBL is IA32 or X64.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2021-04-11 20:32:21 -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
Maurice Ma 040ab276b8 Add Visual Studio toolchain version select option
Current SBL always uses the latest VS toolchain detected to build
SBL. However, sometimes a different verion might be preferred.
This patch added a build option "-t" to specify the perferred VS
toolchain version. It is useful when mulitple VS toolchain versions
are installed.

For example, add '-t vs2015' to use VS2015 as the toolchain for
SBL build.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2021-03-25 17:14:15 -07:00
Maurice Ma 4eeb962977 Add FSP swapping script
This patch added FSP swapping script to support replace a FSP
binary inside SBL IFWI or BIOS image.

To use it, use
  python BootloaderCorePkg\Tools\FspSwap.py ifwi.bin fsp.bin
The default output directory is "Out".

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2021-02-25 16:32:05 -08:00
Maurice Ma 6b9463e791
Update QEMU FSP build to latest EDK2 (#1007)
This patch changed QEMU FSP to use INF file to provide commit id.
It also synced up to the latest EDK2 stable tag edk2-stable202011.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2021-02-08 09:13:37 -08:00
Aiden Park 680cab980b [PCI] Add an option to allocate PCI PMEM resource first
This introduces an additional PCI Enumeration option.
- self._PCI_ENUM_FLAG_ALLOC_PMEM_FIRST

By deafult, the option will allocate PCI resource by ascending order
(MEM32->PMEM32->MEM64->PMEM64). If it's set to 1, by reversed order.

Signed-off-by: Aiden Park <aiden.park@intel.com>
2021-02-03 17:14:51 -08:00
Subash Lakkimsetti 1f0b99cf3b Update get_openssl_path to return absoulte path
Tools as MEU used for signing and generating key manifests
expects to pass abosulte openssl paths. Updating
get_openssl_path to return paths for linux cases.

Signed-off-by: Subash Lakkimsetti <subash.lakkimsetti@intel.com>
2021-01-15 13:24:07 -07:00
Guo Dong c408c94737 use different workspace to prepare binaries
Different projects might use different repo to get binaries.
or different project might be built at same time. so change
to use different workspace for different project to avoid
potential conflict.

Signed-off-by: Guo Dong <guo.dong@intel.com>
2021-01-14 10:47:02 -08:00
Maurice Ma 86a24b8171 Fix GenContainer python scripts
After GenContainer script was created, there ware more changes
introduced for signing and compression. However, GenContainer
was not updated to match those new changes. This patch addressed
this issue.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2021-01-12 15:06:58 -07:00
Guo Dong 5873b52d6b Add '.exe' extension if missing for windows build
run_process is used several places. Sometime
the extension name is not given for windows build.
In this case, if same file without file extension
exist (e.g. fit and fit.exe), then fit will be used
for windows build. It is not expected, so this patch
will add the missing .exe extension for this case.

Signed-off-by: Guo Dong <guo.dong@intel.com>
2021-01-07 08:55:17 -07:00
Maurice Ma a2725951ad Removed deprecated python imp module usage
Python 3.4 and above have deprecated imp module in favor of
importlib.  This patch removed imp module usage from SBL, and
used importlib instead.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2021-01-06 11:16:59 -08:00
James Gutbub 6a1ad8f5e3 Make Python lz4 module optional
To avoid any dependency on non-standard python modules
it is preferred to make the binary Lz4 compression the
default flow and try the python module as a backup. Also
recommend to use a known working version of the lz4
python module, 3.1.1.

Signed-off-by: James Gutbub <james.gutbub@intel.com>
2021-01-04 15:05:50 -08:00
James Gutbub ab49d6c9a0 Use Python lz4 module for LZ4
To make SBL scripts/tools more OS-agnostic the
lz4 (de)compression module can be used instead of
relying on the BaseTools LZ4 package/executable.

Need to update the azure pipeline to install
the python lz4 module before running the builds.

TEST=Confirmed that the python lz4.block.compress
     routine is compatible with Lz4DecompressLib
     during SBL runtime to decompress LZ4 binaries.

Signed-off-by: James Gutbub <james.gutbub@intel.com>
2020-12-22 13:19:52 -08:00
Subash Lakkimsetti 72ab5b437a Openssl 1.1.1i tool support
Openssl 1.1.1 is an installable and it creates
openssl.exe in a bin folder.
default slimboot path: c:\Openssl\bin\openssl.exe

Added support to populate OPENSSL_PATH
from bin dir incase its available.

Signed-off-by: Subash Lakkimsetti <subash.lakkimsetti@intel.com>
2020-12-16 13:27:51 -08:00
Chin Keong Ang d6d21f507e Config Editor: Update default yaml file search dir
User experience improvement:
If there is no yaml found in current directory
then default to start browsing at platform directory

Signed-off-by: Chin Keong Ang <chin.keong.ang@intel.com>
2020-12-01 20:55:00 -08:00
Aiden Park 2d7c2b920f Add PCI resource downgrade option for all Bus-0 devices
In 64-bit operation, some PCI devices have high mmio BARs,
but 32-bit FSP can only access 32-bit memory space.
This introduces and additional PCI resource downgrade option
to downgrade all PCI devices under Bus-0.
- self._PCI_ENUM_DOWNGRADE_BUS0 = 1
  Force to have 32-bit BAR for all Bus-0 devices

Signed-off-by: Aiden Park <aiden.park@intel.com>
2020-11-02 10:57:15 -08:00
Maurice Ma b6d2c307af Fix duplicated PlatformId in DLT file
Using ConfigEditor to save back DLT changes, it will produce two
PlatformId lines in DLT file. This patch removed the extra line.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2020-10-19 23:35:51 -07:00
Maurice Ma 5eb9ae3d46 Fix save full delta file issue in ConfigEditor
Current ConfigEditor produces the same result for
"Save full cfg data" vs "save cfg changes".  This patch provided
a fix for it.  It fixed #882.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2020-10-16 13:20:33 -07:00
Maurice Ma eb43c7e8f4 Fix default value change issue in ConfigEditor
In ConfigEditor, while scrolling page using mouse middle wheel,
the Combo configuration items will change its default value. It
is because Combo control will bind MouseWheel event by default.
To address it, added code to unbind it explicitly.

It fixed #878.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2020-10-14 15:07:53 -07:00
Aiden Park 26a24f5ab2 [CFL] Fix the ucode checkout issue
This will fix the ucode repo checkout issue on 'cfl' target.

FYI, here are simple steps to reproduce.
1) Build 'apl' target first
2) Build 'cfl' target -> fails to checkout ucode repo

Signed-off-by: Aiden Park <aiden.park@intel.com>
2020-10-08 13:07:46 -07:00
Maurice Ma 5f5cbaebaa Represent data in required format in ConfigEditor
Current ConfigEditor relies on the original input data format in YAML
to determine how to represent data in GUI. For example, if the data
value is HEX in YAML, then the data will be displayed in HEX format.
This patch switched to use the specified format type to reformat the
value string so that the display is always consistent with the required
format type.

It fixed #844.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2020-09-15 07:33:14 -07:00