summaryrefslogtreecommitdiff
path: root/util/cbfstool/elogtool.c
diff options
context:
space:
mode:
authorMartin Roth <martin@coreboot.org>2022-02-25 17:28:04 -0700
committerNico Huber <nico.h@gmx.de>2022-02-26 01:24:17 +0000
commite3e965b13d4806b47aca23a256823efe4319ef5f (patch)
tree70c91a1a4170161bb3cc70556f058e3e192eee74 /util/cbfstool/elogtool.c
parentb4156412dbeee1c9fc3354a9c75a54e84a735dbc (diff)
downloadcoreboot-4.16_branch.tar.gz
Revert "util/cbfstool: Port elogtool to libflashrom"4.164.16_branch
This reverts commit d74b8d9c990780ba64515b36aaff79d719d71ead. This change breaks the 'make all' build of the cbfstool tools from the util/cbfstool directory unless libflashrom-dev is installed, complaining that flashrom is not installed. Even with libflashrom-dev installed, it breaks building elogtool with the public version of libflashrom-dev. Signed-off-by: Martin Roth <martin@coreboot.org> Change-Id: I572daa0c0f3998e20a8ed76df21228fdbb384baf Reviewed-on: https://review.coreboot.org/c/coreboot/+/62404 Reviewed-by: Nico Huber <nico.h@gmx.de> Reviewed-by: ron minnich <rminnich@gmail.com> Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org> Reviewed-by: Felix Singer <felixsinger@posteo.net> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'util/cbfstool/elogtool.c')
-rw-r--r--util/cbfstool/elogtool.c25
1 files changed, 9 insertions, 16 deletions
diff --git a/util/cbfstool/elogtool.c b/util/cbfstool/elogtool.c
index 44823dd89a..253e2ee95a 100644
--- a/util/cbfstool/elogtool.c
+++ b/util/cbfstool/elogtool.c
@@ -11,9 +11,9 @@
#include <common.h>
#include <commonlib/bsd/elog.h>
+#include <flashrom.h>
#include "eventlog.h"
-#include "uflashrom.h"
/* Only refers to the data max size. The "-1" is the checksum byte */
#define ELOG_MAX_EVENT_DATA_SIZE (ELOG_MAX_EVENT_SIZE - sizeof(struct event_header) - 1)
@@ -78,18 +78,16 @@ static void usage(char *invoked_as)
*/
static int elog_read(struct buffer *buffer, const char *filename)
{
- struct firmware_programmer image = {
- .programmer = FLASHROM_PROGRAMMER_INTERNAL_AP,
- .data = NULL,
- .size = 0,
- };
-
if (filename == NULL) {
- if (flashrom_read(&image, ELOG_RW_REGION_NAME) != 0) {
+ uint8_t *buf;
+ uint32_t buf_size;
+
+ if (flashrom_read(FLASHROM_PROGRAMMER_INTERNAL_AP, ELOG_RW_REGION_NAME,
+ &buf, &buf_size) != VB2_SUCCESS) {
fprintf(stderr, "Could not read RW_ELOG region using flashrom\n");
return ELOGTOOL_EXIT_READ_ERROR;
}
- buffer_init(buffer, NULL, image.data, image.size);
+ buffer_init(buffer, NULL, buf, buf_size);
} else if (buffer_from_file(buffer, filename) != 0) {
fprintf(stderr, "Could not read input file: %s\n", filename);
return ELOGTOOL_EXIT_READ_ERROR;
@@ -110,14 +108,9 @@ static int elog_read(struct buffer *buffer, const char *filename)
*/
static int elog_write(struct buffer *buf, const char *filename)
{
- struct firmware_programmer image = {
- .programmer = FLASHROM_PROGRAMMER_INTERNAL_AP,
- .data = buffer_get(buf),
- .size = buffer_size(buf),
- };
-
if (filename == NULL) {
- if (flashrom_write(&image, ELOG_RW_REGION_NAME) != 0) {
+ if (flashrom_write(FLASHROM_PROGRAMMER_INTERNAL_AP, ELOG_RW_REGION_NAME,
+ buffer_get(buf), buffer_size(buf)) != VB2_SUCCESS) {
fprintf(stderr,
"Failed to write to RW_ELOG region using flashrom\n");
return ELOGTOOL_EXIT_WRITE_ERROR;