diff options
Diffstat (limited to 'host/lib/include/flashrom.h')
-rw-r--r-- | host/lib/include/flashrom.h | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/host/lib/include/flashrom.h b/host/lib/include/flashrom.h index 560fbb0e..0d934424 100644 --- a/host/lib/include/flashrom.h +++ b/host/lib/include/flashrom.h @@ -12,39 +12,39 @@ #define FLASHROM_PROGRAMMER_INTERNAL_AP "host" #define FLASHROM_PROGRAMMER_INTERNAL_EC "ec" +/* Utilities for firmware images and (FMAP) sections */ +struct firmware_image { + /** + * programmer The name of the programmer to use. Use either + * FLASHROM_PROGRAMMER_INTERNAL_AP or, + * FLASHROM_PROGRAMMER_INTERNAL_EC + * for the AP and EC respectively. + */ + const char *programmer; + uint32_t size; /* buffer size. */ + uint8_t *data; /* data allocated buffer to read/write with. */ +}; + /** * Read using flashrom into an allocated buffer. * - * @param programmer The name of the programmer to use. There are - * named constants FLASHROM_PROGRAMMER_INTERNAL_AP - * and FLASHROM_PROGRAMMER_INTERNAL_EC available - * for the AP and EC respectively, or a custom - * programmer string can be provided. + * @param image The parameter that contains the programmer, buffer and + * size to use in the read operation. * @param region The name of the fmap region to read, or NULL to * read the entire flash chip. - * @param data_out Output parameter of allocated buffer to read into. - * The caller should free the buffer. - * @param size_out Output parameter of buffer size. * * @return VB2_SUCCESS on success, or a relevant error. */ -vb2_error_t flashrom_read(const char *programmer, const char *region, - uint8_t **data_out, uint32_t *size_out); +vb2_error_t flashrom_read(struct firmware_image *image, const char *region); /** * Write using flashrom from a buffer. * - * @param programmer The name of the programmer to use. There are - * named constants FLASHROM_PROGRAMMER_INTERNAL_AP - * and FLASHROM_PROGRAMMER_INTERNAL_EC available - * for the AP and EC respectively, or a custom - * programmer string can be provided. + * @param image The parameter that contains the programmer, buffer and + * size to use in the write operation. * @param region The name of the fmap region to write, or NULL to * write the entire flash chip. - * @param data The buffer to write. - * @param size The size of the buffer to write. * * @return VB2_SUCCESS on success, or a relevant error. */ -vb2_error_t flashrom_write(const char *programmer, const char *region, - uint8_t *data, uint32_t size); +vb2_error_t flashrom_write(struct firmware_image *image, const char *region); |