blob: 088cd1e3bac00c42b6add3fbabe8d04c9f6b902c [file] [log] [blame]
Daisuke Nojiri742fc8d2014-10-10 10:51:06 -07001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2014 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.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
Patrick Georgib890a122015-03-26 15:17:45 +010017 * Foundation, Inc.
Daisuke Nojiri742fc8d2014-10-10 10:51:06 -070018 */
19#ifndef VBOOT_COMMON_H
20#define VBOOT_COMMON_H
21
22#include <stdint.h>
Aaron Durbindc9f5cd2015-09-08 13:34:43 -050023#include <commonlib/region.h>
Daisuke Nojiri742fc8d2014-10-10 10:51:06 -070024
25/* The FW areas consist of multiple components. At the beginning of
26 * each area is the number of total compoments as well as the size and
27 * offset for each component. One needs to caculate the total size of the
28 * signed firmware region based off of the embedded metadata. */
29struct vboot_component_entry {
30 uint32_t offset;
31 uint32_t size;
32} __attribute__((packed));
33
34struct vboot_components {
35 uint32_t num_components;
36 struct vboot_component_entry entries[0];
37} __attribute__((packed));
38
Aaron Durbin4e50cdd2015-05-15 23:25:46 -050039/* The following functions return 0 on success, < 0 on error. */
40int vboot_named_region_device(const char *name, struct region_device *rdev);
41int vboot_region_device(const struct region *reg, struct region_device *rdev);
Daisuke Nojiri742fc8d2014-10-10 10:51:06 -070042
43#endif /* VBOOT_COMMON_H */