Aaron Durbin | 0424c95 | 2015-03-28 23:56:22 -0500 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * Copyright 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. |
Aaron Durbin | 0424c95 | 2015-03-28 23:56:22 -0500 | [diff] [blame] | 14 | */ |
| 15 | |
| 16 | #ifndef _FMAP_H_ |
| 17 | #define _FMAP_H_ |
| 18 | |
Aaron Durbin | dc9f5cd | 2015-09-08 13:34:43 -0500 | [diff] [blame] | 19 | #include <commonlib/region.h> |
| 20 | #include <commonlib/fmap_serialized.h> |
Aaron Durbin | 0424c95 | 2015-03-28 23:56:22 -0500 | [diff] [blame] | 21 | |
Patrick Georgi | 977587a | 2015-07-09 13:34:40 +0200 | [diff] [blame] | 22 | /* Locate the fmap directory. Return 0 on success, < 0 on error. */ |
| 23 | int find_fmap_directory(struct region_device *fmrd); |
| 24 | |
Aaron Durbin | 0424c95 | 2015-03-28 23:56:22 -0500 | [diff] [blame] | 25 | /* Locate the named area in the fmap and fill in a region device representing |
| 26 | * that area. The region is a sub-region of the readonly boot media. Return |
| 27 | * 0 on success, < 0 on error. */ |
| 28 | int fmap_locate_area_as_rdev(const char *name, struct region_device *area); |
| 29 | |
Aaron Durbin | bccaab8 | 2016-08-12 12:42:04 -0500 | [diff] [blame] | 30 | /* Just like fmap_locate_area_as_rdev(), however the region device is |
| 31 | * created from the RW boot device. */ |
| 32 | int fmap_locate_area_as_rdev_rw(const char *name, struct region_device *area); |
| 33 | |
Aaron Durbin | 0424c95 | 2015-03-28 23:56:22 -0500 | [diff] [blame] | 34 | /* Locate the named area in the fmap and fill in a region with the |
| 35 | * offset and size of that area within the boot media. Return 0 on success, |
| 36 | * < 0 on error. */ |
| 37 | int fmap_locate_area(const char *name, struct region *r); |
| 38 | |
Patrick Georgi | 9952690 | 2015-07-09 11:27:44 +0200 | [diff] [blame] | 39 | /* Find fmap area name by offset and size. |
| 40 | * Return 0 on success, < 0 on error. */ |
| 41 | int fmap_find_region_name(const struct region * const ar, |
| 42 | char name[FMAP_STRLEN]); |
Aaron Durbin | 0424c95 | 2015-03-28 23:56:22 -0500 | [diff] [blame] | 43 | #endif |