[coreboot-gerrit] Patch set updated for coreboot: cbfs: Add API to locate a file from specific region

Pratikkumar V Prajapati (pratikkumar.v.prajapati@intel.com) gerrit at coreboot.org
Fri Dec 9 02:45:03 CET 2016


Pratikkumar V Prajapati (pratikkumar.v.prajapati at intel.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/17664

-gerrit

commit bf75f7fc73d8e1a54e74ded7260ee8e72c55356d
Author: Pratik Prajapati <pratikkumar.v.prajapati at intel.com>
Date:   Wed Nov 30 17:29:10 2016 -0800

    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 at intel.com>
---
 src/include/cbfs.h |  3 +++
 src/lib/cbfs.c     | 16 +++++++++++++++-
 2 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/src/include/cbfs.h b/src/include/cbfs.h
index 8538b3d..1350671 100644
--- a/src/include/cbfs.h
+++ b/src/include/cbfs.h
@@ -34,6 +34,9 @@ int cbfs_boot_locate(struct cbfsf *fh, const char *name, uint32_t *type);
  * leaking mappings are a no-op. Returns NULL on error, else returns
  * the mapping and sets the size of the file. */
 void *cbfs_boot_map_with_leak(const char *name, uint32_t type, size_t *size);
+/* Locate file in a specific region of fmap. Return 0 on success. < 0 on error*/
+int cbfs_locate_file_in_region(struct cbfsf *fh, const char *region_name,
+		const char *name, uint32_t *type);
 /* Load a struct file from CBFS into a buffer. Returns amount of loaded
  * bytes on success or 0 on error. File will get decompressed as necessary.
  * Same decompression requirements as cbfs_load_and_decompress(). */
diff --git a/src/lib/cbfs.c b/src/lib/cbfs.c
index 19737a4..ff166d8 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)
 {



More information about the coreboot-gerrit mailing list