summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--common/rollback.c17
-rw-r--r--common/rollback_private.h33
2 files changed, 35 insertions, 15 deletions
diff --git a/common/rollback.c b/common/rollback.c
index 95fa86f9fd..b448f0514f 100644
--- a/common/rollback.c
+++ b/common/rollback.c
@@ -17,6 +17,7 @@
#include "mpu.h"
#endif
#include "rollback.h"
+#include "rollback_private.h"
#include "sha256.h"
#include "system.h"
#include "task.h"
@@ -29,20 +30,6 @@
/* Number of rollback regions */
#define ROLLBACK_REGIONS 2
-/*
- * Note: Do not change this structure without also updating
- * common/firmware_image.S .image.ROLLBACK section.
- */
-struct rollback_data {
- int32_t id; /* Incrementing number to indicate which region to use. */
- int32_t rollback_min_version;
-#ifdef CONFIG_ROLLBACK_SECRET_SIZE
- uint8_t secret[CONFIG_ROLLBACK_SECRET_SIZE];
-#endif
- /* cookie must always be last, as it validates the rest of the data. */
- uint32_t cookie;
-};
-
static int get_rollback_offset(int region)
{
#ifdef CONFIG_FLASH_MULTIPLE_REGION
@@ -103,7 +90,7 @@ static void clear_rollback(struct rollback_data *data)
#endif
}
-static int read_rollback(int region, struct rollback_data *data)
+int read_rollback(int region, struct rollback_data *data)
{
int offset;
int ret = EC_SUCCESS;
diff --git a/common/rollback_private.h b/common/rollback_private.h
new file mode 100644
index 0000000000..c757882f4f
--- /dev/null
+++ b/common/rollback_private.h
@@ -0,0 +1,33 @@
+/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/** Internal header file for rollback.
+ *
+ * EC code should not normally include this. These are exposed so they can be
+ * used by unit test code.
+ */
+
+#ifndef __CROS_EC_ROLLBACK_PRIVATE_H
+#define __CROS_EC_ROLLBACK_PRIVATE_H
+
+#include "config.h"
+
+/*
+ * Note: Do not change this structure without also updating
+ * common/firmware_image.S .image.ROLLBACK section.
+ */
+struct rollback_data {
+ int32_t id; /* Incrementing number to indicate which region to use. */
+ int32_t rollback_min_version;
+#ifdef CONFIG_ROLLBACK_SECRET_SIZE
+ uint8_t secret[CONFIG_ROLLBACK_SECRET_SIZE];
+#endif
+ /* cookie must always be last, as it validates the rest of the data. */
+ uint32_t cookie;
+};
+
+int read_rollback(int region, struct rollback_data *data);
+
+#endif /* __CROS_EC_ROLLBACK_PRIVATE_H */