summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorPratik Prajapati <pratikkumar.v.prajapati@intel.com>2016-11-30 17:29:10 -0800
committerAaron Durbin <adurbin@chromium.org>2016-12-10 03:16:55 +0100
commit2a7708a9f8e543cd03d55716f21ea3318920ac03 (patch)
tree5cb361c5c906ae737c72cff27dae01779236c5d1 /src/lib
parentb6e9021b162ebe73d67a4d75c3e304fb2727860d (diff)
downloadcoreboot-2a7708a9f8e543cd03d55716f21ea3318920ac03.tar.xz
cbfs: Add API to locate a file from specific region
This patch adds an API to find file by name from any specific region of fmap. Change-Id: Iabe785a6434937be6a57c7009882a0d68f6c8ad4 Signed-off-by: Pratik Prajapati <pratikkumar.v.prajapati@intel.com> Reviewed-on: https://review.coreboot.org/17664 Tested-by: build bot (Jenkins) Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/cbfs.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/lib/cbfs.c b/src/lib/cbfs.c
index 19737a4192..ff166d8793 100644
--- a/src/lib/cbfs.c
+++ b/src/lib/cbfs.c
@@ -24,7 +24,7 @@
#include <lib.h>
#include <symbols.h>
#include <timestamp.h>
-
+#include <fmap.h>
#include "fmap_config.h"
#define ERROR(x...) printk(BIOS_ERR, "CBFS: " x)
@@ -72,6 +72,20 @@ void *cbfs_boot_map_with_leak(const char *name, uint32_t type, size_t *size)
return rdev_mmap(&fh.data, 0, fsize);
}
+int cbfs_locate_file_in_region(struct cbfsf *fh, const char *region_name,
+ const char *name, uint32_t *type)
+{
+ struct region_device rdev;
+
+ if (fmap_locate_area_as_rdev(region_name, &rdev)) {
+ LOG("%s region not found while looking for %s\n",
+ region_name, name);
+ return -1;
+ }
+
+ return cbfs_locate(fh, &rdev, name, type);
+}
+
size_t cbfs_load_and_decompress(const struct region_device *rdev, size_t offset,
size_t in_size, void *buffer, size_t buffer_size, uint32_t compression)
{