Daisuke Nojiri | 742fc8d | 2014-10-10 10:51:06 -0700 | [diff] [blame] | 1 | /* |
| 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 Georgi | b890a12 | 2015-03-26 15:17:45 +0100 | [diff] [blame] | 17 | * Foundation, Inc. |
Daisuke Nojiri | 742fc8d | 2014-10-10 10:51:06 -0700 | [diff] [blame] | 18 | */ |
| 19 | #ifndef VBOOT_COMMON_H |
| 20 | #define VBOOT_COMMON_H |
| 21 | |
| 22 | #include <stdint.h> |
Aaron Durbin | dc9f5cd | 2015-09-08 13:34:43 -0500 | [diff] [blame] | 23 | #include <commonlib/region.h> |
Daisuke Nojiri | 742fc8d | 2014-10-10 10:51:06 -0700 | [diff] [blame] | 24 | |
| 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. */ |
| 29 | struct vboot_component_entry { |
| 30 | uint32_t offset; |
| 31 | uint32_t size; |
| 32 | } __attribute__((packed)); |
| 33 | |
| 34 | struct vboot_components { |
| 35 | uint32_t num_components; |
| 36 | struct vboot_component_entry entries[0]; |
| 37 | } __attribute__((packed)); |
| 38 | |
Aaron Durbin | 4e50cdd | 2015-05-15 23:25:46 -0500 | [diff] [blame] | 39 | /* The following functions return 0 on success, < 0 on error. */ |
| 40 | int vboot_named_region_device(const char *name, struct region_device *rdev); |
| 41 | int vboot_region_device(const struct region *reg, struct region_device *rdev); |
Daisuke Nojiri | 742fc8d | 2014-10-10 10:51:06 -0700 | [diff] [blame] | 42 | |
| 43 | #endif /* VBOOT_COMMON_H */ |