coreboot/src/lib
Julius Werner 57d4bc63f0 cbfs: Add helper functions to look up size and type of a file
This patch adds cbfs_get_size() and cbfs_get_type() helper functions
(and _ro_ variations) to look up the size or type of a CBFS file without
loading it. Generally, use of these should be discouraged because that
tends to mean that the file needs to be looked up more than once, and
cbfs_alloc() or cbfs_type_load() are usually the more efficient
alternative... but sometimes they're unavoidable, so we might as well
offer them.

Also remove the <cbfs_private.h> header which had already become sort of
unnecessary with previous changes. cbfs_boot_lookup() is now exported in
<cbfs.h> for use in inlines, but should not be used directly by other
files (and is prefixed with an underscore to highlight that).

Signed-off-by: Julius Werner <jwerner@chromium.org>
Change-Id: I8092d8f6e04bdfb4df6c626dc7d42b402fe0a8ba
Reviewed-on: https://review.coreboot.org/c/coreboot/+/59312
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Werner Zeh <werner.zeh@siemens.com>
Reviewed-by: Jakub Czapiga <jacz@semihalf.com>
Reviewed-by: Lean Sheng Tan <lean.sheng.tan@intel.com>
2021-11-17 12:46:25 +00:00
..
gnat lib/gnat/i-c.ads: Add uintptr_t type 2020-11-16 12:13:31 +00:00
asan.c lib/asan.c: Update SPDX license 2021-02-01 08:53:22 +00:00
b64_decode.c treewide: replace GPLv2 long form headers with SPDX header 2020-05-06 22:20:57 +00:00
bmp_logo.c drivers/intel/fsp1_1,fsp2_0: Refactor logo display 2021-02-09 07:52:31 +00:00
boot_device.c treewide: Remove "this file is part of" lines 2020-05-11 17:11:40 +00:00
bootblock.c security/tpm: Add option to init TPM in bootblock 2021-05-06 08:26:41 +00:00
bootmem.c lib/bootmem.c: Improve bootmem_allocate_buffer algorithm 2020-07-30 17:13:28 +00:00
bootmode.c treewide: Remove "this file is part of" lines 2020-05-11 17:11:40 +00:00
bootsplash.c cbfs: Simplify load/map API names, remove type arguments 2020-12-02 22:13:17 +00:00
cb.ads Hook up Kconfig Ada spec file 2019-02-06 16:20:35 +00:00
cbfs.c cbfs: Add helper functions to look up size and type of a file 2021-11-17 12:46:25 +00:00
cbmem_common.c src: Remove unused 'include <bootstate.h>' 2020-06-02 07:40:35 +00:00
cbmem_console.c cbmem: Introduce "early" init hooks for console 2021-05-27 23:30:42 +00:00
cbmem_stage_cache.c treewide: Remove "this file is part of" lines 2020-05-11 17:11:40 +00:00
compute_ip_checksum.c
coreboot_table.c coreboot tables: Add type-c port info to coreboot table 2021-10-04 17:12:48 +00:00
crc_byte.c treewide: Remove "this file is part of" lines 2020-05-11 17:11:40 +00:00
decompressor.c decompressor: Add CBFS_VERIFICATION support 2021-04-06 07:49:15 +00:00
delay.c
device_tree.c src/acpi to src/lib: Fix spelling errors 2021-10-05 18:06:39 +00:00
dimm_info_util.c arch/x86: Refactor the SMBIOS type 17 write function 2021-11-11 09:10:10 +00:00
dp_aux.c google/trogdor: Add backlight support for Parade ps8640 2021-11-02 08:17:21 +00:00
edid.c src/acpi to src/lib: Fix spelling errors 2021-10-05 18:06:39 +00:00
edid_fill_fb.c lib/edid_fill_fb: Relax bits_per_pixel constraint 2021-01-24 11:18:23 +00:00
espi_debug.c lib/espi_debug: Add espi_show_slave_peripheral_channel_configuration 2021-04-23 21:20:26 +00:00
ext_stage_cache.c src/lib: Remove unused function parameters in imd.c 2020-08-04 07:13:59 +00:00
fallback_boot.c coreboot: Replace all IS_ENABLED(CONFIG_XXX) with CONFIG(XXX) 2019-03-08 08:33:24 +00:00
fit.c fit: Swap compat matching priorities for board-revX and board-skuY 2020-05-29 20:47:54 +00:00
fit_payload.c cbfs: Remove prog_locate() for payloads (SELF and FIT) 2021-03-17 00:13:53 +00:00
fmap.c src/lib/fmap.c: use le*toh() functions where needed 2021-10-27 14:55:51 +00:00
fw_config.c src/lib: Add FW_CONFIG_SOURCE_VPD 2021-11-08 14:48:05 +00:00
gcc.c treewide: Remove "this file is part of" lines 2020-05-11 17:11:40 +00:00
gcov-glue.c lib/gcov: Remove assert(0) 2020-08-03 10:36:00 +00:00
gcov-io.c
gcov-io.h
gcov-iov.h
gpio.c gpio: Pull down HiZ pins after reading tristate GPIO strapping 2020-08-06 23:54:41 +00:00
halt.c treewide: Remove "this file is part of" lines 2020-05-11 17:11:40 +00:00
hardwaremain.c lib/hardwaremain: Run timers more frequently 2021-11-15 16:15:32 +00:00
hexdump.c lib/hexdump: remove hexdump32 and use hexdump instead 2021-05-27 15:41:15 +00:00
hexstrtobin.c treewide: Convert more license headers to SPDX style 2020-05-11 19:37:19 +00:00
hw-time-timer.adb treewide: Remove "this file is part of" lines 2020-05-11 17:11:40 +00:00
imd.c lib/imd: move struct definitions to a new header file 2020-10-19 06:55:03 +00:00
imd_cbmem.c lib/imd_cbmem.c: Add a helper function to indicate that cbmem is ready 2020-08-17 06:22:58 +00:00
jpeg.c src/lib/jpeg.c: Drop dead code 2020-07-09 23:50:51 +00:00
jpeg.h treewide: Remove "this file is part of" lines 2020-05-11 17:11:40 +00:00
Kconfig lib/prog_loaders, soc/amd/: Make payload_preload use cbfs_preload 2021-11-16 18:20:31 +00:00
Kconfig.cbfs_verification decompressor: Add CBFS_VERIFICATION support 2021-04-06 07:49:15 +00:00
libgcc.c treewide: Replace CONFIG(ARCH_xx) tests 2020-06-17 21:13:09 +00:00
libgcov.c lib/libgcov.c: Do not redefine alloca 2020-07-29 09:27:33 +00:00
list.c lib/list: Add list_append 2021-11-03 08:29:16 +00:00
lzma.c Remove MAYBE_STATIC_BSS and ENV_STAGE_HAS_BSS_SECTION 2020-05-26 15:04:08 +00:00
lzmadecode.c src/{include,arch,cpu,lib}: Add missing 'include <types.h>' 2019-05-29 20:27:18 +00:00
lzmadecode.h
Makefile.inc lib: Add list.c to all stages 2021-11-04 10:35:48 +00:00
malloc.c lib: Add obvious definition for calloc 2021-04-06 06:50:38 +00:00
memchr.c
memcmp.c
memcpy.c
memmove.c
memrange.c treewide: Remove "this file is part of" lines 2020-05-11 17:11:40 +00:00
memset.c
metadata_hash.c src: Drop "This file is part of the coreboot project" lines 2021-05-10 15:07:33 +00:00
nhlt.c src/acpi to src/lib: Fix spelling errors 2021-10-05 18:06:39 +00:00
primitive_memtest.c treewide: Remove "this file is part of" lines 2020-05-11 17:11:40 +00:00
prog_loaders.c src/lib/prog_loaders: Add preload_ramstage 2021-11-16 21:45:36 +00:00
prog_ops.c treewide: Remove "this file is part of" lines 2020-05-11 17:11:40 +00:00
program.ld cbmem: Introduce "early" init hooks for console 2021-05-27 23:30:42 +00:00
ramdetect.c treewide: Remove "this file is part of" lines 2020-05-11 17:11:40 +00:00
ramtest.c src: Remove useless comments in "includes" lines 2021-02-04 10:18:49 +00:00
reg_script.c lib/reg_script: Add cast to fix compilation on x86_64 2020-12-01 16:00:57 +00:00
region_file.c src/acpi to src/lib: Fix spelling errors 2021-10-05 18:06:39 +00:00
reset.c treewide: Remove "this file is part of" lines 2020-05-11 17:11:40 +00:00
rmodule.c cbfs: Make mdata argument to cbfs_allocator_t const 2021-04-05 22:59:02 +00:00
rmodule.ld src: Fix typo 2018-08-10 21:25:53 +00:00
romstage_handoff.c ACPI S3: Replace stashed acpi_slp_typ value 2021-01-23 20:19:47 +00:00
rtc.c lib/rtc: Add sanity check for time and date 2021-05-30 20:24:13 +00:00
selfboot.c selfboot: Add support for selfload in romstage 2021-07-02 00:47:23 +00:00
spd_bin.c spd_bin: Replace get_spd_cbfs_rdev() with spd_cbfs_map() 2021-03-17 08:10:35 +00:00
spd_cache.c Remove new additions of "this file is part of" lines 2020-05-18 07:12:03 +00:00
stack.c symbols.h: Add macro to define memlayout region symbols 2019-02-22 06:44:02 +00:00
string.c lib/string: Add standard strstr() function 2020-08-03 05:12:23 +00:00
thread.c lib/thread: Start stopwatch after printk 2021-11-10 21:17:28 +00:00
timer.c treewide: Remove "this file is part of" lines 2020-05-11 17:11:40 +00:00
timer_queue.c src: Remove unused 'include <stddef.h> 2020-08-18 12:15:44 +00:00
timestamp.c symbols: Change implementation details of DECLARE_OPTIONAL_REGION() 2020-08-27 22:11:17 +00:00
ubsan.c lib/ubsan.c: Remove GCC 5.x workaround 2020-10-05 16:18:24 +00:00
uuid.c treewide: Remove "this file is part of" lines 2020-05-11 17:11:40 +00:00
version.c ACPI: Correct asl_compiler_revision value 2019-02-21 19:07:31 +00:00
wrdd.c treewide: Remove "this file is part of" lines 2020-05-11 17:11:40 +00:00