summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/config.h5
-rw-r--r--include/cros_version.h5
-rw-r--r--include/ec_commands.h6
-rw-r--r--include/system.h9
-rw-r--r--include/util.h3
5 files changed, 26 insertions, 2 deletions
diff --git a/include/config.h b/include/config.h
index 63dc4beb62..e555b8a78e 100644
--- a/include/config.h
+++ b/include/config.h
@@ -5208,6 +5208,11 @@
#undef CONFIG_EXTENDED_VERSION_INFO
/*
+ * Include CROS_FWID in version output.
+ */
+#define CONFIG_CROS_FWID_VERSION
+
+/*
* Define this to support Cros Board Info from EEPROM. I2C_PORT_EEPROM
* and I2C_ADDR_EEPROM_FLAGS must be defined as well.
*/
diff --git a/include/cros_version.h b/include/cros_version.h
index 0d3e777dc5..585c2c1013 100644
--- a/include/cros_version.h
+++ b/include/cros_version.h
@@ -13,6 +13,9 @@
#define CROS_EC_IMAGE_DATA_COOKIE1 0xce778899
#define CROS_EC_IMAGE_DATA_COOKIE2 0xceaabbdd
+#define CROS_EC_IMAGE_DATA_COOKIE3 0xceeeff00
+#define CROS_EC_IMAGE_DATA_COOKIE3_MASK GENMASK(31, 8)
+#define CROS_EC_IMAGE_DATA_COOKIE3_VERSION GENMASK(7, 0)
struct image_data {
uint32_t cookie1;
@@ -20,6 +23,8 @@ struct image_data {
uint32_t size;
int32_t rollback_version;
uint32_t cookie2;
+ char cros_fwid[32];
+ uint32_t cookie3;
} __packed;
extern const struct image_data current_image_data;
diff --git a/include/ec_commands.h b/include/ec_commands.h
index 9395175e73..6e9c538e5e 100644
--- a/include/ec_commands.h
+++ b/include/ec_commands.h
@@ -1152,14 +1152,16 @@ enum ec_image {
* struct ec_response_get_version - Response to the get version command.
* @version_string_ro: Null-terminated RO firmware version string.
* @version_string_rw: Null-terminated RW firmware version string.
- * @reserved: Unused bytes; was previously RW-B firmware version string.
+ * @cros_fwid_ro: Null-terminated RO CrOS FWID string.
* @current_image: One of ec_image.
+ * @cros_fwid_rw: Null-terminated RW CrOS FWID string.
*/
struct ec_response_get_version {
char version_string_ro[32];
char version_string_rw[32];
- char reserved[32];
+ char cros_fwid_ro[32]; /* Added in version 1 (Used to be reserved) */
uint32_t current_image;
+ char cros_fwid_rw[32]; /* Added in version 1 */
} __ec_align4;
/* Read test */
diff --git a/include/system.h b/include/system.h
index 325d76f702..6d46392e38 100644
--- a/include/system.h
+++ b/include/system.h
@@ -286,6 +286,15 @@ const struct image_data *system_get_image_data(enum ec_image copy);
const char *system_get_version(enum ec_image copy);
/**
+ * Get the CrOS fwid string for an image
+ *
+ * @param copy Image copy to get version from, or SYSTEM_IMAGE_UNKNOWN
+ * to get the version for the currently running image.
+ * @return The fwid string for the image copy, or an empty string if error.
+ */
+const char *system_get_cros_fwid(enum ec_image copy);
+
+/**
* Get the SKU ID for a device
*
* @return A value that identifies the SKU variant of a model. Its meaning and
diff --git a/include/util.h b/include/util.h
index 1b077d0f55..a1c1abb514 100644
--- a/include/util.h
+++ b/include/util.h
@@ -45,6 +45,9 @@ extern "C" {
#define NULL ((void *)0)
#endif
+/* Returns true if string is not null and not empty */
+#define IS_NONEMPTY_STRING(s) ((s) && (s)[0])
+
/**
* Ensure that value `v` is between `min` and `max`.
*