coreboot/src/include
Raul E Rangel 4cfb862fb2 lib/cbfs: Add cbfs_preload()
This API will hide all the complexity of preloading a CBFS file. It
makes it so the callers simply specify the file to preload and CBFS
takes care of the rest. It will start a new thread to read the file into
the cbfs_cache. When the file is actually required (i.e., cbfs_load,
etc) it will wait for the preload thread to complete (if it hasn't
already) and perform verification/decompression using the preloaded
buffer. This design allows decompression/verification to happen in the
main BSP thread so that timestamps are correctly reflected.

BUG=b:179699789
TEST=Test with whole CL chain, verify VGA bios was preloaded and boot
time was reduced by 12ms.

Logs:
Preloading VGA ROM
CBFS DEBUG: _cbfs_preload(name='pci1002,1638.rom', force_ro=false)
CBFS: Found 'pci1002,1638.rom' @0x20ac40 size 0xd800 in mcache @0xcb7dd0f0
spi_dma_readat_dma: start: dest: 0x021c0000, source: 0x51cc80, size: 55296
took 0 us to acquire mutex
start_spi_dma_transaction: dest: 0x021c0000, source: 0x51cc80, remaining: 55296
...
spi_dma_readat_dma: end: dest: 0x021c0000, source: 0x51cc80, remaining: 0
...
CBFS DEBUG: _cbfs_alloc(name='pci1002,1638.rom', alloc=0x00000000(0x00000000), force_ro=false, type=-1)
CBFS: Found 'pci1002,1638.rom' @0x20ac40 size 0xd800 in mcache @0xcb7dd0f0
waiting for thread
took 0 us
CBFS DEBUG: get_preload_rdev(name='pci1002,1638.rom', force_ro=false) preload successful
In CBFS, ROM address for PCI: 03:00.0 = 0x021c0000
PCI expansion ROM, signature 0xaa55, INIT size 0xd800, data ptr 0x01b0
PCI ROM image, vendor ID 1002, device ID 1638,
PCI ROM image, Class Code 030000, Code Type 00
Copying VGA ROM Image from 0x021c0000 to 0xc0000, 0xd800 bytes

$ cbmem
  ...
  40:device configuration                              5,399,404 (8,575)
  65:Option ROM initialization                         5,403,474 (4,070)
  66:Option ROM copy done                              5,403,488 (14)
  ...

Signed-off-by: Raul E Rangel <rrangel@chromium.org>
Change-Id: I879fc1316f97417a4b82483d353abdbd02b98a31
Reviewed-on: https://review.coreboot.org/c/coreboot/+/56491
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
2021-11-04 17:10:31 +00:00
..
acpi acpigen,soc/amd,cpu/intel: rework static DWORD for CPPC table 2021-10-21 20:03:14 +00:00
boot
console console: Remove asmlinkage from console_init 2021-09-17 23:52:02 +00:00
cpu cpu/amd/mtrr: Remove topmem global variables 2021-11-03 18:36:15 +00:00
device SMBIOS/SCONFIG: Allow devtree-defined Type 41 entries 2021-11-04 10:25:09 +00:00
efi
mipi mipi: Make panel init callback work directly on DSI transaction types 2021-09-11 01:42:47 +00:00
pc80
smp
superio
sys
adainit.h
asan.h include/asan.h: Add missing includes 2020-08-21 13:36:10 +00:00
assert.h arch/x86: Use ENV_X86_64 instead of _x86_64_ 2021-07-06 06:09:13 +00:00
b64_decode.h treewide: replace GPLv2 long form headers with SPDX header 2020-05-06 22:20:57 +00:00
base3.h treewide: Remove "this file is part of" lines 2020-05-11 17:11:40 +00:00
boardid.h treewide: Remove "this file is part of" lines 2020-05-11 17:11:40 +00:00
boot_device.h
bootblock_common.h
bootmem.h
bootmode.h Revert "vboot_logic: Set VB2_CONTEXT_EC_TRUSTED in verstage_main" 2021-10-15 13:00:32 +00:00
bootsplash.h drivers/intel/fsp1_1,fsp2_0: Refactor logo display 2021-02-09 07:52:31 +00:00
bootstate.h lib/hardwaremain: Drop boot_state_current_{block,unblock}() 2021-07-18 15:16:26 +00:00
cbfs.h lib/cbfs: Add cbfs_preload() 2021-11-04 17:10:31 +00:00
cbfs_glue.h
cbfs_private.h
cbmem.h cbmem: Introduce "early" init hooks for console 2021-05-27 23:30:42 +00:00
cper.h include/bcd: move bcd code to commonlib/bsd/include 2021-08-23 14:08:47 +00:00
crc_byte.h
ctype.h add ctype.h header 2019-06-24 21:15:14 +00:00
delay.h cpu/x86/lapic: Refactor timer_fsb() 2019-09-19 09:28:55 +00:00
device_tree.h
dimm_info_util.h lib: Add new argument as ddr_type to smbios_bus_width_to_spd_width() 2021-11-02 08:13:25 +00:00
dp_aux.h google/trogdor: Add backlight support for Parade ps8640 2021-11-02 08:17:21 +00:00
edid.h include/edid.h: Remove repeated word 2021-01-18 07:37:04 +00:00
elog.h elog: move MAX_EVENT_SIZE to commonlib/bsd/include 2021-09-10 22:53:19 +00:00
endian.h treewide: replace GPLv2 long form headers with SPDX header 2020-05-06 22:20:57 +00:00
espi.h
fallback.h drivers/pc80/rtc: Clean up some headers 2020-01-07 18:40:02 +00:00
fit.h
fmap.h src/include: Add missing includes 2020-07-26 21:37:35 +00:00
framebuffer_info.h drivers: Replace set_vbe_mode_info_valid 2020-12-17 06:21:56 +00:00
fw_config.h fw_config: Add helper function fw_config_probe_dev 2021-05-24 16:55:27 +00:00
gpio.h
halt.h
imd.h include/imd: Improve API documentation 2020-08-26 07:32:37 +00:00
imd_private.h src: Add missing <cbmem.h> 2021-02-09 15:26:51 +00:00
input-event-codes.h src/include: Drop unneeded empty lines 2020-09-14 07:09:41 +00:00
inttypes.h
ip_checksum.h src/include: Wrap lines at 80 columns 2017-03-13 17:23:37 +01:00
kconfig.h
lib.h lib/hexdump: remove hexdump32 and use hexdump instead 2021-05-27 15:41:15 +00:00
limits.h include/limits.h: Add file (read: borrow from Linux) 2021-06-10 06:57:54 +00:00
list.h lib/list: Add list_append 2021-11-03 08:29:16 +00:00
main_decl.h
memlayout.h memlayout: Store region sizes as separate symbols 2021-02-19 08:39:26 +00:00
memory_info.h include/memory_info.h: Increase DIMM_INFO_TOTAL number from 8 to 16 2021-10-21 20:10:03 +00:00
memrange.h include/memrange.h: Remove repeated word 2021-01-18 07:36:18 +00:00
metadata_hash.h
mrc_cache.h mrc_cache: Change mrc_cache_load_current to return size of entry 2020-10-09 05:38:04 +00:00
nhlt.h
option.h option: Turn CMOS option backend into choice 2021-05-28 11:37:16 +00:00
post.h
program_loading.h lib/prog_loaders: Add payload_preload 2021-07-19 02:42:43 +00:00
ramdetect.h src/include/ramdetect.h: Add missing includes 2020-07-25 01:25:57 +00:00
random.h
reg_script.h
region_file.h
reset.h
rmodule.h treewide: Remove "this file is part of" lines 2020-05-11 17:11:40 +00:00
romstage_handoff.h treewide: Remove "this file is part of" lines 2020-05-11 17:11:40 +00:00
rtc.h lib/rtc: Add sanity check for time and date 2021-05-30 20:24:13 +00:00
rules.h
sar.h wifi: Update deny list entry size to uint16_t 2021-09-09 15:01:35 +00:00
sdram_mode.h
smbios.h soc/intel/common: Add DDR5 and LPDDR5 into the SMBIOS table 2021-10-30 18:45:09 +00:00
smmstore.h drivers/smmstore: Implement SMMSTORE version 2 2020-10-22 12:29:47 +00:00
spd.h lib: Add new argument as ddr_type to smbios_bus_width_to_spd_width() 2021-11-02 08:13:25 +00:00
spd_bin.h spd_bin: Replace get_spd_cbfs_rdev() with spd_cbfs_map() 2021-03-17 08:10:35 +00:00
spd_cache.h
spi-generic.h
spi_bitbang.h
spi_flash.h drivers: spi_flash: Add Fast Read Dual I/O support 2021-07-15 14:05:34 +00:00
spi_sdcard.h
stage_cache.h
stdarg.h
stdbool.h
stddef.h stddef.h: Use compiler macros for built-in integer types 2021-06-10 05:36:30 +00:00
stdint.h treewide: Remove "this file is part of" lines 2020-05-11 17:11:40 +00:00
stdio.h
stdlib.h
string.h
swab.h
symbols.h lib/prog_loaders: Add payload_preload 2021-07-19 02:42:43 +00:00
thread.h arch/x86,cpu/x86,lib/thread: Remove usage of cpu_info from lib/thread 2021-10-18 12:36:30 +00:00
timer.h treewide: Remove "this file is part of" lines 2020-05-11 17:11:40 +00:00
timestamp.h
types.h
uuid.h include/uuid.h: Add missing include 2020-05-28 16:20:40 +00:00
vbe.h src: Use 'include <boot/coreboot_tables.h>' when appropriate 2019-10-27 17:48:30 +00:00
version.h ACPI: Correct asl_compiler_revision value 2019-02-21 19:07:31 +00:00
watchdog.h coreboot: Replace all IS_ENABLED(CONFIG_XXX) with CONFIG(XXX) 2019-03-08 08:33:24 +00:00
wrdd.h treewide: Remove "this file is part of" lines 2020-05-11 17:11:40 +00:00