Sol Boucher | 023e829 | 2015-03-18 10:13:48 -0700 | [diff] [blame] | 1 | /* |
| 2 | * fmap_sections.h, track which sections of the image will contain CBFSes |
| 3 | * |
| 4 | * Copyright (C) 2015 Google, Inc. |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by |
| 8 | * the Free Software Foundation; version 2 of the License. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
Sol Boucher | 023e829 | 2015-03-18 10:13:48 -0700 | [diff] [blame] | 14 | */ |
| 15 | |
| 16 | #ifndef CBFS_SECTIONS_H_ |
| 17 | #define CBFS_SECTIONS_H_ |
| 18 | |
| 19 | #include "fmd.h" |
| 20 | |
| 21 | #include <stdbool.h> |
| 22 | |
| 23 | #define SECTION_NAME_FMAP "FMAP" |
| 24 | #define SECTION_NAME_PRIMARY_CBFS "COREBOOT" |
| 25 | |
| 26 | #define SECTION_ANNOTATION_CBFS "CBFS" |
| 27 | |
| 28 | typedef const struct descriptor_node *cbfs_section_iterator_t; |
| 29 | |
| 30 | /** @return Iterator pointing to first CBFS section, or NULL if none exist */ |
| 31 | cbfs_section_iterator_t cbfs_sections_iterator(void); |
| 32 | |
| 33 | /** |
| 34 | * Advance iterator to point to the next CBFS section. |
| 35 | * If it was already pointing to the last such section, it will be set to NULL. |
| 36 | * |
| 37 | * @param it (Non-NULL) pointer to (possibly NULL) iterator to be updated |
| 38 | * @return Whether it was successfully advanced (wasn't already NULL) |
| 39 | */ |
| 40 | bool cbfs_sections_iterator_advance(cbfs_section_iterator_t *it); |
| 41 | |
| 42 | /** |
| 43 | * @param it Iterator, which must currently be non-NULL |
| 44 | * @return Section to which it points |
| 45 | */ |
| 46 | const struct flashmap_descriptor *cbfs_sections_iterator_deref( |
| 47 | cbfs_section_iterator_t it); |
| 48 | |
| 49 | /** @return Whether a section named SECTION_NAME_PRIMARY_CBFS is in the list. */ |
| 50 | bool cbfs_sections_primary_cbfs_accounted_for(void); |
| 51 | |
| 52 | /** Reclaim the space used to store knowledge of which sections are CBFSes. */ |
| 53 | void cbfs_sections_cleanup(void); |
| 54 | |
| 55 | #endif |