blob: 3526f8d94c3c626cd9f24fa4ba41e46e26bd0865 [file] [log] [blame]
Sol Boucher023e8292015-03-18 10:13:48 -07001/*
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 Boucher023e8292015-03-18 10:13:48 -070014 */
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
28typedef const struct descriptor_node *cbfs_section_iterator_t;
29
30/** @return Iterator pointing to first CBFS section, or NULL if none exist */
31cbfs_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 */
40bool 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 */
46const 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. */
50bool cbfs_sections_primary_cbfs_accounted_for(void);
51
52/** Reclaim the space used to store knowledge of which sections are CBFSes. */
53void cbfs_sections_cleanup(void);
54
55#endif