Patrick Georgi | ea063cb | 2020-05-08 19:28:13 +0200 | [diff] [blame] | 1 | /* fmap_sections.h, track which sections of the image will contain CBFSes */ |
Patrick Georgi | 7333a11 | 2020-05-08 20:48:04 +0200 | [diff] [blame] | 2 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Sol Boucher | 023e829 | 2015-03-18 10:13:48 -0700 | [diff] [blame] | 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 | |
| 14 | #define SECTION_ANNOTATION_CBFS "CBFS" |
| 15 | |
| 16 | typedef const struct descriptor_node *cbfs_section_iterator_t; |
| 17 | |
| 18 | /** @return Iterator pointing to first CBFS section, or NULL if none exist */ |
| 19 | cbfs_section_iterator_t cbfs_sections_iterator(void); |
| 20 | |
| 21 | /** |
| 22 | * Advance iterator to point to the next CBFS section. |
| 23 | * If it was already pointing to the last such section, it will be set to NULL. |
| 24 | * |
| 25 | * @param it (Non-NULL) pointer to (possibly NULL) iterator to be updated |
| 26 | * @return Whether it was successfully advanced (wasn't already NULL) |
| 27 | */ |
| 28 | bool cbfs_sections_iterator_advance(cbfs_section_iterator_t *it); |
| 29 | |
| 30 | /** |
| 31 | * @param it Iterator, which must currently be non-NULL |
| 32 | * @return Section to which it points |
| 33 | */ |
| 34 | const struct flashmap_descriptor *cbfs_sections_iterator_deref( |
| 35 | cbfs_section_iterator_t it); |
| 36 | |
| 37 | /** @return Whether a section named SECTION_NAME_PRIMARY_CBFS is in the list. */ |
| 38 | bool cbfs_sections_primary_cbfs_accounted_for(void); |
| 39 | |
| 40 | /** Reclaim the space used to store knowledge of which sections are CBFSes. */ |
| 41 | void cbfs_sections_cleanup(void); |
| 42 | |
| 43 | #endif |