Commit graph

5,288 commits

Author SHA1 Message Date
Yu-Ping Wu
e24b7c72cc util/ifdtool: Fix invalid pointer dereference
When calculating the GPR0 protection range, currently the offsets of
"CSE data partition offset" and FPT are not checked. Invalid pointer
dereference may lead to segmentation fault.

Ensure the offset is within the image size before accessing the pointer.

Change-Id: Ic9557d8fc8ae9e4c12114ee170bfc90d5e149df9
Signed-off-by: Yu-Ping Wu <yupingso@chromium.org>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/85016
Reviewed-by: Subrata Banik <subratabanik@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Alexander Goncharov <chat@joursoir.net>
2024-11-13 23:31:55 +00:00
Felix Singer
7980b6ed47 util/scripts/update_submodule: Extend commit ids to 12 chars
Checkpatch suggests to use 12 chars of the commit id. So adjust the
submodule update script in order to be consistent.

Change-Id: I0e356066b6598f586054f940684c26b6e5db2169
Signed-off-by: Felix Singer <felixsinger@posteo.net>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/85112
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Matt DeVillier <matt.devillier@gmail.com>
2024-11-13 16:23:55 +00:00
Nicholas Chin
05a13e7ed9 sconfig: Move (WEAK_)DEV_PTR from device.h to static.h
Similar to commit 8651731537 ("sconfig: Move config_of_soc from
device.h to static.h"), move these macros to static.h to separate
dependencies on device.h and static.h. These macros resolve to device
alises that are declared in the generated static_devices.h header, so
move them to static.h which includes static_devices.h.

Since static.h remains included in device.h, any source that uses these
macros should still compile correctly. Subsequent commits will add
static.h to files that need them, after which static.h can be dropped
from device.h.

Change-Id: I1c76ad749769591da9c102b11eb618e93b68bd7c
Signed-off-by: Nicholas Chin <nic.c3.14@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/84676
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Felix Singer <service+coreboot-gerrit@felixsinger.de>
2024-11-10 10:35:44 +00:00
Matt DeVillier
cfe1e921dd util/crosfirmware: Add support for parsing from manifest.json
Some ChromeOS recovery images, such as for GRUNT, support multiple
boards / multiple bios/ec images, but do not break them out in a
'models' subdirectory like modern recovery images do. Instead,
they use a manifest.json to map the board name to the correct
bios/ec images. Add support for parsing out the info from here.

TEST=run `util/chromeos/crosfirmware.sh kasumi` and verify
that the correct shellball firmware is extracted from the recovery
image.

Change-Id: I64153ba16cb8328d65a0f088d05f04a969f6810f
Signed-off-by: Matt DeVillier <matt.devillier@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/85024
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Felix Singer <service+coreboot-gerrit@felixsinger.de>
2024-11-08 19:22:37 +00:00
Arthur Heymans
e15b584961 util/cbfstool: Deal with how lld organizes loadable segments
LLD deals with loadable segments in a different manner than BFD. The
MemSiz of the .text loadable section is padded till the virtaddr of the
.car.data section. Since .text is not loaded in ENV_CAR this does not
matter.

Change-Id: I1a0541c8ea3dfbebfba83d505d84b6db12000723
Signed-off-by: Arthur Heymans <arthur@aheymans.xyz>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/84043
Reviewed-by: Elyes Haouas <ehaouas@noos.fr>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2024-11-06 04:54:22 +00:00
Nicholas Chin
d95d9f8ce8 Documentation: Remove ditaa support
Ditaa is a utility to convert ascii block diagrams into bitmap graphics.
The latest sphinx-contrib-ditaa extension has not been updated since
2022 [1] and does not declare whether it is safe for parallel reading,
causing sphinx to issue a warning as we use the `-j auto` flag to
parallelize the build. It doesn't seem like anyone ever used it in the
docs aside from a now abandoned patch [2], so just remove it.

[1] https://pypi.org/project/sphinxcontrib-ditaa/
[2] https://review.coreboot.org/c/coreboot/+/37643

Change-Id: I460ce24aab203cbb416888787fc6e2c613d306b3
Signed-off-by: Nicholas Chin <nic.c3.14@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/84887
Reviewed-by: Felix Singer <service+coreboot-gerrit@felixsinger.de>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2024-10-27 23:51:03 +00:00
Nicholas Chin
b6f3ee3f8f util/util_readme: Use HTML comments in generated output
Util_readme adds comments to the top of the generated Doc/util.md file
to indicate that it is generated and should not be edited directly.
These comments are not intended to show up in the rendered HTML output.
Since Markdown does not have a native way of adding comments, the
`[comment text]: #` syntax is often used to mark the line as a comment.
This takes advantage of the fact that references (often used throughout
the docs to list long URLs at the end of the document and reference them
in inline links) aren't rendered. However, MyST parser detects these as
a duplicate reference and issues a warning, since both lines use "//" as
the comment text.

Address this by using HTML comments, since Markdown also allows raw HTML
to be used. This seems like a cleaner option compared to repurposing
references and appears to have better compatibility with various
Markdown readers, which may be useful if someone wants to read the
documentation outside of doc.coreboot.org.

While we are here, regenerate Documentation/util.md and util/README.md

Change-Id: Ibd4f61009c01c7b64594d88c5d86e472f0ccaa6c
Signed-off-by: Nicholas Chin <nic.c3.14@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/84885
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Felix Singer <service+coreboot-gerrit@felixsinger.de>
2024-10-27 23:50:57 +00:00
Felix Singer
c21bed6de9 util/docker/doc.coreboot.org: Reformat Dockerfile
Use tabs instead of spaces and use one line per argument for better
readability.

Change-Id: Ic1893c3cd75f825cfddf29b53d3c5ddf8efcccc2
Signed-off-by: Felix Singer <felixsinger@posteo.net>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/84854
Reviewed-by: Nicholas Chin <nic.c3.14@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2024-10-26 06:38:06 +00:00
Jeremy Compostella
892257ec21 cbfstool: Fix segmentation fault for data segment relocation
`cbfstool add-stage' crashes with a segmentation fault when generating
the program binary out of a romstage ELF containing relocation within
the data segment.

This commit makes `parse_elf_to_xip_stage()' look for the segment to
which the current relocation applies and compute the appropriate
location within the program binary.

This issue can be reproduced by defining a global variable with a
pointer to constant data. This variable is defined within the .data
section and contains a pointer to a constant which resides in the
.text section. As a result, a relocation entry is generated in the ELF
file.

    struct my_struct {
            const char *name;
    };

    struct my_struct my_global = { .name = "EXAMPLE" };

    void fun(void)
    {
           printk(BIOS_DEBUG, "my_global.name=%s\n", my_global.name);
    }

TEST=global data structure with a pointer to a constant does not make
     cbfstool crash

Change-Id: I480b4b047546c8aa4e12dfb688e0299f80283235
Signed-off-by: Jeremy Compostella <jeremy.compostella@intel.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/84864
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Julius Werner <jwerner@chromium.org>
Reviewed-by: Shuo Liu <shuo.liu@intel.com>
Reviewed-by: Wonkyu Kim <wonkyu.kim@intel.com>
2024-10-25 23:01:45 +00:00
Gang Chen
1c088e6d62 util/cbfstool: Add Intel platform boot policy support
Intel platform boot policy setting blob is linked into FIT table
as an FIT4 entry. It is required for server executing CBnT and/or
PFR without a PCH.

Please refer to chapter 4.6 of the document in below link:
https://www.intel.com/content/dam/www/public/us/en/documents/
guides/fit-bios-specification.pdf

Tool usage:
./util/cbfstool/ifittool -f <binary> -a -n <cbfs name> -t 4 \
-r COREBOOT -s <max table size>

Change-Id: I0f9fc61341430b1a35a44d50b108dcfaf31cd11c
Signed-off-by: Gang Chen <gang.c.chen@intel.com>
Signed-off-by: Li, Jincheng <jincheng.li@intel.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/84305
Reviewed-by: Lean Sheng Tan <sheng.tan@9elements.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2024-10-23 10:29:59 +00:00
Daniel Maslowski
ed73b3f2f7 util/amdtools: update K8 BKDG URL
The document was moved. The current URL gives a 404.

Change-Id: If6ca74a8bf47382100da048667976958961b9320
Signed-off-by: Daniel Maslowski <info@orangecms.org>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/84764
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Felix Singer <service+coreboot-gerrit@felixsinger.de>
Reviewed-by: Nicholas Chin <nic.c3.14@gmail.com>
2024-10-16 15:31:02 +00:00
Tyler Wang
55a5041fbf mb/google/rex: Add SPDX license headers to template Makefile
According to CB:68982, add SPDX license headers to rex template
Makefile. Without this patch, build bot may report build failed.

BUG=none
TEST=Run create_coreboot_variant.sh and check Makefile

Change-Id: I7d100a2303be063590f1389a7eed8f9a52071241
Signed-off-by: Tyler Wang <tyler.wang@quanta.corp-partner.google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/84712
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Eric Lai <ericllai@google.com>
Reviewed-by: Subrata Banik <subratabanik@google.com>
2024-10-14 15:30:05 +00:00
Maximilian Brune
85541960df util/ifdtool/ifdtool.c: Add validation exception
When validating the FMAP against the IFD, the BIOS region is a somewhat
specical case, since the FMAP BIOS region usually does not match the IFD
BIOS region. Instead the FMAP region usually resides somewhere inside
the IFD BIOS region and the where depends on CONFIG_CBFS_SIZE.

Signed-off-by: Maximilian Brune <maximilian.brune@9elements.com>
Change-Id: I920a0ee246cfd2b4ae0870256357d4f285e1730d
Reviewed-on: https://review.coreboot.org/c/coreboot/+/79368
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: David Hendricks <david.hendricks@gmail.com>
2024-10-14 15:27:44 +00:00
Martin Roth
aa13aeadc0 util/marvell/doimage_mv: Update CFLAGS to CFLAGS_doimage
Because we import the doimage_mv/Makefile.mk directly into the main
coreboot makefile, this was setting a global CFLAGS variable. That's not
a huge issue since coreboot doesn't use the global CFLAGS variable, but
it should be updated anyway.

Signed-off-by: Martin Roth <gaumless@gmail.com>
Change-Id: Iebe281ca891745c1f993df274ef75b1440059c85
Reviewed-on: https://review.coreboot.org/c/coreboot/+/83857
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: David Hendricks <david.hendricks@gmail.com>
2024-10-14 15:26:38 +00:00
Nicholas Sudsgaard
33b2fb93bb util/hda-decoder: Add feature to print configuration defaults as verbs
This feature simply goes through pin configurations stored in a file and
converts them into their corresponding verbs. This can be useful when
trying to find verb data stored inside a binary (e.g. when reverse
engineering).

Input:
	0x16 0x04211040
	0x17 0x91170110
	0x18 0x40f001f0

Output:
	address: 0, node ID: 0x16, configuration default: 0x04211040
	  0x01671c40
	  0x01671d10
	  0x01671e21
	  0x01671f04
	address: 0, node ID: 0x17, configuration default: 0x91170110
	  0x01771c10
	  0x01771d01
	  0x01771e17
	  0x01771f91
	address: 0, node ID: 0x18, configuration default: 0x40f001f0
	  0x01871cf0
	  0x01871d01
	  0x01871ef0
	  0x01871f40

Change-Id: I1fb74ff4b2b654987fd25ee32d0f94e5f2f783e3
Signed-off-by: Nicholas Sudsgaard <devel+coreboot@nsudsgaard.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/84669
Reviewed-by: Paul Menzel <paulepanter@mailbox.org>
Reviewed-by: Sean Rhodes <sean@starlabs.systems>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2024-10-07 21:10:03 +00:00
Alexander Couzens
744e93e8b0 inteltool: improve support for Elkhart Lake
Add support for SPI/flash, LPC/eSPI, MCH and
add pci vendor/product description.

References:
* CPU: Linux kernel
* GPU: Linux kernel
* GPU: https://dgpu-docs.intel.com/devices/hardware-table.html
* Intel Atom x6000E Series, and Intel Pentium and Celeron N and J Series
  Processors for IoT Applications, February 2023, 636722

Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
Change-Id: Ida852f3c991cdd036d9c282f9cabceb23c765e25
Reviewed-on: https://review.coreboot.org/c/coreboot/+/75214
Reviewed-by: coreboot org <coreboot.org@gmail.com>
Reviewed-by: Felix Held <felix-coreboot@felixheld.de>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2024-10-02 12:38:05 +00:00
Arthur Heymans
4e92938fd1 util/cbfstool: Make sure to only compare PT_LOAD segments
When parsing XIP stages only compare PT_LOAD phdrs. Currently coreboot
stages only use PT_LOAD phdrs.

Change-Id: I305b25032a3c4a9fdefc76cad77fafdb862a604c
Signed-off-by: Arthur Heymans <arthur@aheymans.xyz>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/84140
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Julius Werner <jwerner@chromium.org>
2024-10-02 12:05:49 +00:00
Arthur Heymans
00783211c0 arch/arm64: Use -mno-implicit-float with clang
This fixes building inline assembly that uses SIMD registers. This is
for instance the case in the vboot library.

Change-Id: I24fa9d9f81430ea3ecd40de4304a10c6e235fece
Signed-off-by: Arthur Heymans <arthur@aheymans.xyz>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/81658
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Julius Werner <jwerner@chromium.org>
2024-10-02 09:19:15 +00:00
Subrata Banik
caefaaa093 util/lint: Use bigint for hexadecimal values in handle_range
The `handle_range` function in `kconfig_lint` was failing to correctly
handle large hexadecimal values (64-bit value) due to limitations with
Perl's handling of standard integers.

This commit modifies the function to use the `bigint` pragma, enabling
it to handle arbitrarily large integers. This prevents issues with
64-bit hexadecimal values and ensures accurate comparisons for range
validation.

Change-Id: I402bb9bec9ba5bfb79b4185f35228c41d4a7b674
Signed-off-by: Subrata Banik <subratabanik@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/84575
Reviewed-by: Karthik Ramasubramanian <kramasub@google.com>
Reviewed-by: Christian Walter <christian.walter@9elements.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2024-10-01 21:35:20 +00:00
Alexander Couzens
544fb8c296 inteltool: elkhartlake: keep the same names as coreboot code uses
coreboot doesn't have a leading zero in gpio < 10.
E.g. G00 -> G0

Change-Id: I4558cec444ae2a081fbc0f49464354df222be6c9
Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/84190
Reviewed-by: coreboot org <coreboot.org@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Nicholas Sudsgaard <devel+coreboot@nsudsgaard.com>
2024-09-30 11:11:21 +00:00
Michał Żygowski
dd5676e6e5 util/superiotool/ite: Add extra dumps for IT8613E EC
IT8613E EC space is divided into 3 banks selectable by EC index 0x06
bits 6:5. Bank0 mostly contains the ITE EC registers known by
coreboot's ITE EC driver. Bank1 contains SB_TSI and PECI temperature
reading registers. Bank2, however, contains additional registers used
to select the temperature source reported in TMPIN reading registers,
PECI bridge registers as well as FAN2-5 controls and extra vectors.

Dump the additional banks using extra-selectors.

Based on non-public IT8613E Preliminary Specification V0.3.

TEST=Perform the IT8613E dump on Hardkernel ODROID H4+.

Change-Id: Ic8fdc56d1b0fbe811e13bc6b800512af654c1cb6
Signed-off-by: Michał Żygowski <michal.zygowski@3mdeb.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/80318
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Felix Singer <service+coreboot-gerrit@felixsinger.de>
Reviewed-by: Maxim <max.senia.poliak@gmail.com>
Reviewed-by: Alicja Michalska <ahplka19@gmail.com>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-by: Marvin Drees <marvin.drees@9elements.com>
2024-09-30 10:53:50 +00:00
Nicholas Chin
8651731537 sconfig: Move config_of_soc from device.h to static.h
Many sources include device.h and thus static.h, but many only need the
function declarations and type definitions, not the compiled devicetree
from sconfig. This causes many unnecessary recompiles whenever the
devicetree is updated due to the dependency. Address this by moving the
config_of_soc macro directly into the generated static.h header, as it
seems to be the only line in device.h that actually requires static.h.
For now, static.h remains included in device.h so that the build is not
affected. Subsequent commits will include static.h directly into sources
that actually need it, after which it can be dropped from device.h.

Some statistics for C objects:

Dell Latitude E6400 (GM45/ICH9):
669 total objects
181 depend on static.h
2 require static.h

Dell Latitude E6430 (Ivy Bridge/Panther Point):
693 total objects
199 depend on static.h
3 require static.h

Lenovo ThinkCentre M700 / M900 Tiny (Kaby Lake):
794 total objects
298 depend on static.h
23 objects require static.h

MSI PRO Z690-A (WIFI) DDR4 (Alder Lake):
959 total objects
319 depend on static.h
25 require static.h

The number of objects was determined by grepping the build log for
calls to CC, the number of objects that depend on static.h was
determined by grepping for calls to CC after touching static.h, and the
number of objects that actually require the static.h related lines from
device.h was determined by grepping for objects that failed to build
after removing the static.h lines from device.h and running make with
the --keep-going flag.

Change-Id: I7c40135bf2815093b81e47201c38b7d0a6ac8fa8
Signed-off-by: Nicholas Chin <nic.c3.14@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/84431
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Nico Huber <nico.h@gmx.de>
2024-09-28 20:44:40 +00:00
Nicholas Chin
2a2c78aeea util/autoport: Make printing of SPDX headers generic
Previously, Add_gpl() was only used with C and ASL source code files,
and was hard coded to use the C /* */ style comment, preventing it from
being used with files with other comment styles. Convert this into a
generic function for adding arbitrary SPDX license identifiers for
arbitrary filetypes. This replaces the hard coded GPL-2.0-or-later
string used in gma-mainboard.ads with a call to the new function.

This is also used to add SPDX headers to Kconfig and Makefile sources;
as previous commits added them to all such files in the tree.

Tested against logs from a Latitude E6430 (Ivy Bridge) and Precision
M6800 (Haswell) to check that license headers that were already being
generated did not change.

Change-Id: I24a1ccd0afb7045e878bf6eaae7a23f828a9240d
Signed-off-by: Nicholas Chin <nic.c3.14@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/83184
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Nico Huber <nico.h@gmx.de>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
2024-09-13 14:18:48 +00:00
Zheng Bao
c421ed6f81 amdfwtool: Add PSP backup directory for A/B recovery
Change-Id: Ia5a745c86595554c83cd13a35c312c17987b716b
Signed-off-by: Zheng Bao <fishbaozi@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/75682
Reviewed-by: Felix Held <felix-coreboot@felixheld.de>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2024-09-13 14:17:06 +00:00
Zheng Bao
b46bd95ccd amdfwtool: Set the fields when the header is created
The fields spi_block_size and base_addr of regular PSP header, lookup
and reserved of combo header, are constants. So we
move the setting statements to the creation functions.
Only update the count, size and fletcher in later function
file_dir_header.

TEST=Binary identical test on all AMD SOC platforms

Change-Id: I55c400e45536a57841b01d7c90d3fef9afa53e78
Signed-off-by: Zheng Bao <fishbaozi@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/84130
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Felix Held <felix-coreboot@felixheld.de>
2024-09-12 17:04:05 +00:00
Zheng Bao
13a4e4402b amdfwtool: Add a unified function to add combo entries
TEST=Binary identical test on all AMD SOC platform with use_combo

Change-Id: I41c5c6fb5acf92604dd06becf1eda680a1fab545
Signed-off-by: Zheng Bao <fishbaozi@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/84131
Reviewed-by: Felix Held <felix-coreboot@felixheld.de>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2024-09-12 12:59:11 +00:00
Zheng Bao
138dc601f7 amdfwtool: Add combo new layout for new family
The new layout definition has a new way to support combo.
It packs multiple ISH entries into PSP L1 directory.

TEST=Identical test on all AMD platform

Change-Id: If573cdeaeb56e95d2fed235c9337fab82d622757
Signed-off-by: Zheng Bao <fishbaozi@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/84233
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Felix Held <felix-coreboot@felixheld.de>
2024-09-12 12:57:35 +00:00
Maximilian Brune
394c5a0dd1 util/lint/lint-final-newlines: Supply dirs in row
This just orders the EXCLUDED_DIRS directories in a row based manner,
since there are quite a few them now and it is arguably easier to read
and to add new directories if they are written in a row based fashion.

Signed-off-by: Maximilian Brune <maximilian.brune@9elements.com>
Change-Id: I802aece355bba4900e71824d802c4b2438726e84
Reviewed-on: https://review.coreboot.org/c/coreboot/+/83872
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Martin L Roth <gaumless@gmail.com>
2024-09-11 13:39:24 +00:00
Hsuan Ting Chen
8fe5a1f199 util/ifdtool: Exit with failure on unrecognized flags
ifdtool will exit with success while encountering an unrecognized flag.
For example, -g is a newly introduced flag, when we want to call it with
an older version of ifdtool, we will get the return value 0 and cause
confusion.

This patch change the exit status for unrecognized flags and doesn't
change the exit status for -h and -?.

BUG=b:362983041
BRANCH=none
TEST=futility update --servo --image /var/tmp/image.bin --quirks
     unlock_csme on the servo host with old ifdtool

Signed-off-by: Hsuan Ting Chen <roccochen@google.com>
Change-Id: I046ad7ec790cda41a98a1de5cd730d32f65a9067
Reviewed-on: https://review.coreboot.org/c/coreboot/+/84260
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Subrata Banik <subratabanik@google.com>
2024-09-10 10:54:25 +00:00
Yu-Ping Wu
1b72ba7b36 util/cbfstool: Print max empty entry size in error message
Currently, cbfstool prints the following error message when the added
file doesn't fit in the region:

 E: Could not add [file, 1024 bytes (1 KB)@0x0]; too big?

It requires manual inspection to know the space left in the region. To
make that easier, also print the maximum empty CBFS entry size in the
error message:

 E: Could not add file [header 76 + content 1024 bytes (1 KB)] @0x0;
 Largest empty slot: 512 bytes

Change-Id: I00bcc83abe8b0a33dcd7b75521e6cfccd8953661
Signed-off-by: Yu-Ping Wu <yupingso@chromium.org>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/84204
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Yidi Lin <yidilin@google.com>
2024-09-09 14:15:14 +00:00
Zheng Bao
9ee17ffceb amdfwtool: Set L2 table size as 0x400
The Max size of L2 table is 0x400. If we set it to other value, the
the A/B recovery image can not boot on Cezanne/Majolica platform.

The affected boards are Birman, Chausie, Skyrim, Mayan. Other boards
are binary identical. Tested on Skyrim and image can boot.

Change-Id: I2c0af6579dbe2a3a61e1fe9c79d69491fd45a5bb
Signed-off-by: Zheng Bao <fishbaozi@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/84194
Reviewed-by: Felix Held <felix-coreboot@felixheld.de>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2024-09-07 15:39:29 +00:00
Alexander Couzens
37c85f0cf5 util/inteltool: Fix format for PCI vendor/device IDs
PCI vendor/device IDs are 16 bit.

Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
Change-Id: I87804a63f04b7461d348a245531542776575eb7a
Reviewed-on: https://review.coreboot.org/c/coreboot/+/84186
Reviewed-by: Matt DeVillier <matt.devillier@amd.corp-partner.google.com>
Reviewed-by: Felix Singer <service+coreboot-gerrit@felixsinger.de>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
2024-09-03 21:18:43 +00:00
Maxim Polyakov
7f68483e28 util/hda-decoder: Protect 'fields' slice if empty string
This avoids panic if the file contains an empty string or an incorrect
configuration:

goroutine 1 [running]:
main.decodeFile({0x7ffd63da92a0?, 0xc000014070?}, 0x8?)
	/path/to/coreboot/util/hda-decoder/main.go:72 +0x2ef
main.main()
	/path/to/coreboot/util/hda-decoder/main.go:158 +0x2a5

Change-Id: I9ae8544e52d82e8d8a82a88a85a2de7d2f295ec1
Signed-off-by: Maxim Polyakov <max.senia.poliak@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/84101
Reviewed-by: Felix Singer <service+coreboot-gerrit@felixsinger.de>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
2024-08-29 12:32:01 +00:00
Martin Roth
ced2a017f2 util/scripts: Add script to capture commands from build
This allows better debugging of the build by writing all the commands
run by the build into a file by replacing the standard shell.

Run with:
make SHELL="${PWD}/util/scripts/capture_commands.sh"

This will allow us to verify that the commands being run are posix
compliant.

Signed-off-by: Martin Roth <gaumless@gmail.com>
Change-Id: I67efc5096747c2e746642639f88273132e070e49
Reviewed-on: https://review.coreboot.org/c/coreboot/+/83442
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Felix Singer <service+coreboot-gerrit@felixsinger.de>
Reviewed-by: Matt DeVillier <matt.devillier@gmail.com>
2024-08-28 17:14:28 +00:00
Arthur Heymans
0abdb8b8a9 util/crossgcc: Patch clang to enable linking x86 bare metal targets
This allows clang to link x86 bare metal targets.

TESTED: Qemu i440fx and q35 boot to payload with both 32 and 64bit code
compiled with clang and LTO enabled with updated linker script.

Change-Id: I943215c8714e392e52ea35667f2bf21e517c4255
Signed-off-by: Arthur Heymans <arthur@aheymans.xyz>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/84032
Reviewed-by: Nico Huber <nico.h@gmx.de>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Felix Singer <service+coreboot-gerrit@felixsinger.de>
2024-08-28 07:02:39 +00:00
Keith Hui
b4f47e8067 nb/intel/haswell: Move SPD addresses to devicetree
Introduce a sandybridge-style devicetree setting for SPD addresses,
and use it instead of runtime code in mb_get_spd_map() for all
haswell boards without CONFIG(HAVE_SPD_IN_CBFS) - effectively all
boards except google/slippy.

Patch also covers recently added Z97 boards using Broadwell MRC.

Also update util/autoport to match.

abuild passes for all affected boards.
autoport builds, but otherwise untested.

Change-Id: I574aec9cb6a47c8aaf275ae06c7e1fb695534b34
Signed-off-by: Keith Hui <buurin@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/79025
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2024-08-26 11:08:14 +00:00
Elyes Haouas
afd86eb309 crossgcc: Upgrade LLVM from 18.1.6 to 18.1.8
Change-Id: Id74ba772f105a5c36308b8e1dd803ae50840002b
Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/83005
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-by: Felix Singer <service+coreboot-gerrit@felixsinger.de>
2024-08-23 21:51:24 +00:00
Elyes Haouas
7db101b3db crossgcc: Upgrade CMake from 3.29.3 to 3.30.2
Change-Id: I0bb1a2a84d81ec03c4468955926f3f0c94276203
Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/83007
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Felix Singer <service+coreboot-gerrit@felixsinger.de>
2024-08-23 21:43:09 +00:00
Elyes Haouas
f35f18d858 crossgcc: Upgrade GCC from 14.1.0 to 14.2.0
Change-Id: I6ffff766fb1fa91ad376c3e7e9aebe17c3288725
Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/83839
Reviewed-by: Felix Singer <service+coreboot-gerrit@felixsinger.de>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2024-08-23 21:39:59 +00:00
Elyes Haouas
69618cd527 crossgcc: Upgrade binutils from 2.42 to 2.43.1
Change-Id: I1c9d1b2e336894ac48ce87e4d3390e9f9557d4f7
Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/83816
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Felix Singer <service+coreboot-gerrit@felixsinger.de>
2024-08-23 21:37:42 +00:00
Nico Huber
41feb32559 region: Turn region_end() into an inclusive region_last()
The current region_end() implementation is susceptible to overflow
if the region is at the end of the addressable space. A common case
with the memory-mapped flash of x86 directly below the 32-bit limit.

Note: This patch also changes console output to inclusive limits.
IMO, to the better.

Change-Id: Ic4bd6eced638745b7e845504da74542e4220554a
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/79946
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Julius Werner <jwerner@chromium.org>
2024-08-23 01:08:16 +00:00
Karthikeyan Ramasubramanian
6bdc3becfd util/sconfig: Probe device when fw_config is unprovisioned
When fw_config is unprovisioned (eg. in the factory), devices that do
not have any probe list are enabled by default and those that have probe
list are disabled. On mainboards that support multiple types of boot
critical devices (eg. storage) through probing fw_config, all of
them are disabled when fw_config is unprovisioned. Hence the devices do
not boot to OS. Add sconfig fw_config rule `probe unprovisioned` to
enable such devices when fw_config is unprovisioned.

BUG=None
TEST=Build Brox firmware and boot to OS when fw_config is unprovisioned.

Change-Id: I178f821e077912776d654971924d67203a7c43df
Signed-off-by: Karthikeyan Ramasubramanian <kramasub@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/83983
Reviewed-by: Jon Murphy <jpmurphy@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Eric Lai <ericllai@google.com>
Reviewed-by: Ren Kuo <ren.kuo@quanta.corp-partner.google.com>
2024-08-22 13:53:18 +00:00
Nicholas Chin
d47decf563 util/find_usbdebug: Add 8/9 Series PCH rate matching hub IDs
The USB IDs of the EHCI rate matching hubs found in these chipsets were
missing, preventing the utility from detecting connected USB devices.

Change-Id: I52858e2c75e8a3e1424a13bcddc2f5ec1216164b
Signed-off-by: Nicholas Chin <nic.c3.14@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/83458
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Felix Singer <service+coreboot-gerrit@felixsinger.de>
2024-08-20 19:07:22 +00:00
Maximilian Brune
888166e6ea util/cbfstool/cbfs-payload-linux: Add error handling
This adds some error handling to the code that adds the input segments
(e.g. kernel, cmdline, initrd...) to the output file.

Currently the compress function can fail and coreboot will still
build "successfully" leaving whoever build coreboot puzzled.

Change-Id: Ie36ad469c73cb3ff9360acc9bbe66c245e8b4a1e
Signed-off-by: Maximilian Brune <maximilian.brune@9elements.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/83617
Reviewed-by: Elyes Haouas <ehaouas@noos.fr>
Reviewed-by: Nico Huber <nico.h@gmx.de>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2024-08-20 01:41:59 +00:00
Maximilian Brune
2355aa7d3b util/cbfstool/cbfs-payload-linux: Do not compress bzImage
Compressing the already compressed bzImage does not yield any
fruit. If you are lucky it actually makes the image a little bit
smaller. If you are unlucky the image actually gets bigger and since the
compressing function is not checked for any errors, coreboot just builds
successfully even though the payload is broken through compression.

Before this patch you could possibly get this error during compilation:
```
E: LZMA: LzmaEnc_Encode failed 9.
```
and your linux payload would end up something like this in CBFS:
```
FMAP REGION: COREBOOT
Name                           Offset     Type           Size   Comp
....
fallback/payload               0x1c9c0    simple elf        511 none
....
```

That doesn't stop coreboot from finishing the build though, since we
currently don't check for errors from the compression. That is an issue
for another patch though.

Tested:
Build and run QEMU-Q35 with Linux bzImage as payload.

Change-Id: I022982667515ce721d98af534414d9e336b5f35a
Signed-off-by: Maximilian Brune <maximilian.brune@9elements.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/83615
Reviewed-by: coreboot org <coreboot.org@gmail.com>
Reviewed-by: Nico Huber <nico.h@gmx.de>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2024-08-19 14:10:21 +00:00
Felix Singer
a8b1260c7f util/liveiso/nixos/graphical: Preconfigure some Gnome settings
These settings are not a must, but nice to have. The most noteworthy
setting is `sleep-inactive-ac-type`, which is set to `nothing` so that
the target doesn't go into suspend when AC is used as power supply and
it's unused for a while.

Change-Id: I9a6e3eb88427f94f504a6b991a98b1b51e11bc19
Signed-off-by: Felix Singer <felixsinger@posteo.net>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/83853
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Matt DeVillier <matt.devillier@gmail.com>
Reviewed-by: Jan Philipp Groß <jeangrande@mailbox.org>
2024-08-14 15:33:38 +00:00
Felix Singer
4ea4d82cec util/liveiso/nixos/graphical: Replace PulseAudio with PipeWire
PipeWire is the successor of PulseAudio. So use that instead.

Change-Id: Ib557925e481ab72a31a64c4bf353a261dff4296d
Signed-off-by: Felix Singer <felixsinger@posteo.net>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/83851
Reviewed-by: Elyes Haouas <ehaouas@noos.fr>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Jan Philipp Groß <jeangrande@mailbox.org>
2024-08-14 02:50:17 +00:00
Nico Huber
af0d4bce65 region: Introduce region_create() functions
We introduce two new functions to create region objects. They allow us
to check for integer overflows (region_create_untrusted()) or assert
their absence (region_create()).

This fixes potential overflows in region_overlap() checks in SMI
handlers, where we would wrongfully report MMIO as *not* overlapping
SMRAM.

Also, two cases of strtol() in parse_region() (cbfstool),  where the
results were implicitly converted to `size_t`, are replaced with the
unsigned strtoul().

FIT payload support is left out, as it doesn't use the region API
(only the struct).

Change-Id: I4ae3e6274c981c9ab4fb1263c2a72fa68ef1c32b
Ticket: https://ticket.coreboot.org/issues/522
Found-by: Vadim Zaliva <lord@digamma.ai>
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/79905
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Felix Held <felix-coreboot@felixheld.de>
2024-08-11 17:07:32 +00:00
Harrie Paijmans
fda9741ff9 coreboot-sdk/Dockerfile: Add 'gettext' and 'xfonts-unifont'
Required for building grub2.

BUG=N/A
TEST=Build successfully for 'QEMU x86 i440fx/piix4' with GRUB2 payload.

Change-Id: I97860f33dd3fde2f6db2f005d65b53cd669403e9
Signed-off-by: Harrie Paijmans <hpaijmans@eltan.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/83676
Reviewed-by: Frans Hendriks <fhendriks@eltan.com>
Reviewed-by: Martin L Roth <gaumless@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2024-08-09 21:08:09 +00:00
Subrata Banik
d0d41f28d3 util/spd_tools: Add Intel Panther Lake (PTL) platform
This patch add support for PTL platform to the `spd_tools`.
This would be useful to create dynamic SPD for fatcat variants.

BUG=b:347669091
TEST=Able to generate SPD for LP5 DRAM part.

Change-Id: I55c3f49439fb1ad961c6866f03594431e54279b9
Signed-off-by: Subrata Banik <subratabanik@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/83822
Reviewed-by: Eric Lai <ericllai@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Ravishankar Sarawadi <ravishankar.sarawadi@intel.com>
2024-08-09 09:24:18 +00:00