summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--futility/updater_utils.c2
-rw-r--r--host/lib/flashrom_drv.c6
-rw-r--r--host/lib/include/flashrom.h9
3 files changed, 12 insertions, 5 deletions
diff --git a/futility/updater_utils.c b/futility/updater_utils.c
index cb7ac604..904b6b4e 100644
--- a/futility/updater_utils.c
+++ b/futility/updater_utils.c
@@ -682,7 +682,7 @@ static int read_flash(struct flashrom_params *params,
if (get_config_quirk(QUIRK_EXTERNAL_FLASHROM, cfg))
return external_flashrom(FLASH_READ, params, &cfg->tempfiles);
- return flashrom_read_image(params->image, params->verbose);
+ return flashrom_read_image(params->image, NULL, params->verbose);
}
static int write_flash(struct flashrom_params *params,
diff --git a/host/lib/flashrom_drv.c b/host/lib/flashrom_drv.c
index 880a0fc9..6f0057aa 100644
--- a/host/lib/flashrom_drv.c
+++ b/host/lib/flashrom_drv.c
@@ -119,9 +119,11 @@ err_init:
return r;
}
-int flashrom_read_image(struct firmware_image *image, int verbosity)
+int flashrom_read_image(struct firmware_image *image, const char *region,
+ int verbosity)
{
- return flashrom_read_image_impl(image, NULL, NULL, NULL, verbosity);
+ unsigned int start, len;
+ return flashrom_read_image_impl(image, region, &start, &len, verbosity);
}
int flashrom_read_region(struct firmware_image *image, const char *region,
diff --git a/host/lib/include/flashrom.h b/host/lib/include/flashrom.h
index 81d6ba98..e7eda28a 100644
--- a/host/lib/include/flashrom.h
+++ b/host/lib/include/flashrom.h
@@ -30,7 +30,11 @@ struct firmware_image {
};
/**
- * Read using flashrom into an allocated buffer.
+ * Read using flashrom into an allocated buffer. flashrom_read subprocesses the
+ * flashrom binary and returns a buffer truncated to the region.
+ * flashrom_read_image will read the return a full sized buffer with only the
+ * region filled with data. flashrom_read_region will return the buffer
+ * truncated to the region.
*
* @param image The parameter that contains the programmer, buffer and
* size to use in the read operation.
@@ -40,7 +44,8 @@ struct firmware_image {
* @return VB2_SUCCESS on success, or a relevant error.
*/
vb2_error_t flashrom_read(struct firmware_image *image, const char *region);
-int flashrom_read_image(struct firmware_image *image, int verbosity);
+int flashrom_read_image(struct firmware_image *image, const char *region,
+ int verbosity);
int flashrom_read_region(struct firmware_image *image, const char *region,
int verbosity);