UPSTREAM: lib/fmap: provide RW region device support

Explicitly provide a RW view of an FMAP region. This is required
for platforms which have separate implementations of a RO boot
device and a RW boot device.

BUG=chrome-os-partner:56151
BRANCH=None
TEST=None

Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: https://review.coreboot.org/16203
Reviewed-by: Furquan Shaikh <furquan@google.com>

Change-Id: Ibafa3dc534f53a3d90487f3190c0f8a2e82858c2
Reviewed-on: https://chromium-review.googlesource.com/373365
Commit-Ready: Furquan Shaikh <furquan@chromium.org>
Tested-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
This commit is contained in:
Aaron Durbin 2016-08-12 12:42:04 -05:00 committed by chrome-bot
commit 2aef9aa13d
2 changed files with 14 additions and 0 deletions

View file

@ -27,6 +27,10 @@ int find_fmap_directory(struct region_device *fmrd);
* 0 on success, < 0 on error. */
int fmap_locate_area_as_rdev(const char *name, struct region_device *area);
/* Just like fmap_locate_area_as_rdev(), however the region device is
* created from the RW boot device. */
int fmap_locate_area_as_rdev_rw(const char *name, struct region_device *area);
/* Locate the named area in the fmap and fill in a region with the
* offset and size of that area within the boot media. Return 0 on success,
* < 0 on error. */

View file

@ -80,6 +80,16 @@ int fmap_locate_area_as_rdev(const char *name, struct region_device *area)
return boot_device_ro_subregion(&ar, area);
}
int fmap_locate_area_as_rdev_rw(const char *name, struct region_device *area)
{
struct region ar;
if (fmap_locate_area(name, &ar))
return -1;
return boot_device_rw_subregion(&ar, area);
}
int fmap_locate_area(const char *name, struct region *ar)
{
struct region_device fmrd;