xref: /aosp_15_r20/external/coreboot/util/cbfstool/cbfs_sections.h (revision b9411a12aaaa7e1e6a6fb7c5e057f44ee179a49c)
1 /* fmap_sections.h, track which sections of the image will contain CBFSes */
2 /* SPDX-License-Identifier: GPL-2.0-only */
3 
4 #ifndef CBFS_SECTIONS_H_
5 #define CBFS_SECTIONS_H_
6 
7 #include "fmd.h"
8 
9 #include <stdbool.h>
10 
11 #define SECTION_NAME_FMAP		"FMAP"
12 #define SECTION_NAME_PRIMARY_CBFS	"COREBOOT"
13 #define SECTION_NAME_BOOTBLOCK		"BOOTBLOCK"
14 
15 #define SECTION_ANNOTATION_CBFS		"CBFS"
16 
17 typedef const struct descriptor_node *cbfs_section_iterator_t;
18 
19 /** @return Iterator pointing to first CBFS section, or NULL if none exist */
20 cbfs_section_iterator_t cbfs_sections_iterator(void);
21 
22 /**
23  * Advance iterator to point to the next CBFS section.
24  * If it was already pointing to the last such section, it will be set to NULL.
25  *
26  * @param it (Non-NULL) pointer to (possibly NULL) iterator to be updated
27  * @return   Whether it was successfully advanced (wasn't already NULL)
28  */
29 bool cbfs_sections_iterator_advance(cbfs_section_iterator_t *it);
30 
31 /**
32  * @param it Iterator, which must currently be non-NULL
33  * @return   Section to which it points
34  */
35 const struct flashmap_descriptor *cbfs_sections_iterator_deref(
36 						cbfs_section_iterator_t it);
37 
38 /** @return Whether a section named SECTION_NAME_PRIMARY_CBFS is in the list. */
39 bool cbfs_sections_primary_cbfs_accounted_for(void);
40 
41 /** Reclaim the space used to store knowledge of which sections are CBFSes. */
42 void cbfs_sections_cleanup(void);
43 
44 #endif
45