Documentation: Fix sphinx configuration
[coreboot.git] / src / include / cbfs.h
bloba35597d5b188c5319c2f1bb1250e286bb180fce9
1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #ifndef _CBFS_H_
4 #define _CBFS_H_
6 #include <commonlib/cbfs.h>
7 #include <program_loading.h>
8 #include <stddef.h>
9 #include <stdint.h>
11 /***********************************************
12 * Perform CBFS operations on the boot device. *
13 ***********************************************/
15 /* Return mapping of option ROM found in boot device. NULL on error. */
16 void *cbfs_boot_map_optionrom(uint16_t vendor, uint16_t device);
17 /* Return mapping of option ROM with revision number. Returns NULL on error. */
18 void *cbfs_boot_map_optionrom_revision(uint16_t vendor, uint16_t device, uint8_t rev);
19 /* Locate file by name and optional type. Return 0 on success. < 0 on error. */
20 int cbfs_boot_locate(struct cbfsf *fh, const char *name, uint32_t *type);
21 /* Map file into memory leaking the mapping. Only should be used when
22 * leaking mappings are a no-op. Returns NULL on error, else returns
23 * the mapping and sets the size of the file. */
24 void *cbfs_boot_map_with_leak(const char *name, uint32_t type, size_t *size);
25 /* Locate file in a specific region of fmap. Return 0 on success. < 0 on error*/
26 int cbfs_locate_file_in_region(struct cbfsf *fh, const char *region_name,
27 const char *name, uint32_t *type);
28 /* Load an arbitrary type file from CBFS into a buffer. Returns amount of
29 * loaded bytes on success or 0 on error. File will get decompressed as
30 * necessary. Same decompression requirements as
31 * cbfs_load_and_decompress(). */
32 size_t cbfs_boot_load_file(const char *name, void *buf, size_t buf_size,
33 uint32_t type);
34 /* Load |in_size| bytes from |rdev| at |offset| to the |buffer_size| bytes
35 * large |buffer|, decompressing it according to |compression| in the process.
36 * Returns the decompressed file size, or 0 on error.
37 * LZMA files will be mapped for decompression. LZ4 files will be decompressed
38 * in-place with the buffer size requirements outlined in compression.h. */
39 size_t cbfs_load_and_decompress(const struct region_device *rdev, size_t offset,
40 size_t in_size, void *buffer, size_t buffer_size, uint32_t compression);
42 /* Load stage into memory filling in prog. Return 0 on success. < 0 on error. */
43 int cbfs_prog_stage_load(struct prog *prog);
45 /* Returns the region device of the currently active CBFS.
46 Return < 0 on error, 0 on success. */
47 int cbfs_boot_region_device(struct region_device *rdev);
49 #endif