summaryrefslogtreecommitdiff
path: root/include/ec_commands.h
diff options
context:
space:
mode:
authorRong Chang <rongchang@google.com>2017-02-20 16:15:09 +0800
committerchrome-bot <chrome-bot@chromium.org>2017-06-02 16:59:36 -0700
commit9ca4586129844b86ca4b346860ab658754228d2b (patch)
treee8bd729cb6cca3f76b9aca3a9a0b0f1d204d6ef4 /include/ec_commands.h
parentd0ee126b4cdc368c36ae6660d66fed1524476e59 (diff)
downloadchrome-ec-9ca4586129844b86ca4b346860ab658754228d2b.tar.gz
common: Add support for flash with regions of different size
Add support to handle devices with flash regions of different sizes. BRANCH=none TEST=compile BUG=b:38018926 Change-Id: I8f842abaa50de724df60dd7e19f9e97cb9660367 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/264031 Reviewed-by: Alexandru M Stan <amstan@chromium.org>
Diffstat (limited to 'include/ec_commands.h')
-rw-r--r--include/ec_commands.h49
1 files changed, 46 insertions, 3 deletions
diff --git a/include/ec_commands.h b/include/ec_commands.h
index 40fbf0403b..998d5a1624 100644
--- a/include/ec_commands.h
+++ b/include/ec_commands.h
@@ -1097,6 +1097,7 @@ struct __ec_align4 ec_response_get_features {
/* Get flash info */
#define EC_CMD_FLASH_INFO 0x0010
+#define EC_VER_FLASH_INFO 2
/* Version 0 returns these fields */
struct __ec_align4 ec_response_flash_info {
@@ -1130,6 +1131,12 @@ struct __ec_align4 ec_response_flash_info {
* gcc anonymous structs don't seem to get along with the __packed directive;
* if they did we'd define the version 0 structure as a sub-structure of this
* one.
+ *
+ * Version 2 supports flash banks of different sizes:
+ * The caller specified the number of banks it has preallocated
+ * (num_banks_desc)
+ * The EC returns the number of banks describing the flash memory.
+ * It adds banks descriptions up to num_banks_desc.
*/
struct __ec_align4 ec_response_flash_info_1 {
/* Version 0 fields; see above for description */
@@ -1151,6 +1158,42 @@ struct __ec_align4 ec_response_flash_info_1 {
uint32_t flags;
};
+struct __ec_align4 ec_params_flash_info_2 {
+ /* Number of banks to describe */
+ uint16_t num_banks_desc;
+ /* Reserved; set 0; ignore on read */
+ uint8_t reserved[2];
+};
+
+struct ec_flash_bank {
+ /* Number of sector is in this bank. */
+ uint16_t count;
+ /* Size in power of 2 of each sector (8 --> 256 bytes) */
+ uint8_t size_exp;
+ /* Minimal write size for the sectors in this bank */
+ uint8_t write_size_exp;
+ /* Erase size for the sectors in this bank */
+ uint8_t erase_size_exp;
+ /* Size for write protection, usually identical to erase size. */
+ uint8_t protect_size_exp;
+ /* Reserved; set 0; ignore on read */
+ uint8_t reserved[2];
+};
+
+struct __ec_align4 ec_response_flash_info_2 {
+ /* Total flash in the EC. */
+ uint32_t flash_size;
+ /* Flags; see EC_FLASH_INFO_* */
+ uint32_t flags;
+ /* Maximum size to use to send data to write to the EC. */
+ uint32_t write_ideal_size;
+ /* Number of banks present in the EC. */
+ uint16_t num_banks_total;
+ /* Number of banks described in banks array. */
+ uint16_t num_banks_desc;
+ struct ec_flash_bank banks[0];
+};
+
/*
* Read flash
*
@@ -1986,7 +2029,7 @@ struct __ec_todo_packed ec_response_motion_sensor_data {
union {
int16_t data[3];
struct __ec_todo_packed {
- uint16_t rsvd;
+ uint16_t reserved;
uint32_t timestamp;
};
struct __ec_todo_unpacked {
@@ -2186,7 +2229,7 @@ struct __ec_todo_packed ec_params_motion_sense {
uint8_t spoof_enable;
/* Ignored, used for alignment. */
- uint8_t rsvd;
+ uint8_t reserved;
/* Individual component values to spoof. */
int16_t components[3];
@@ -2847,7 +2890,7 @@ union __ec_align_offset1 ec_response_get_next_data {
struct __ec_todo_unpacked {
/* For aligning the fifo_info */
- uint8_t rsvd[3];
+ uint8_t reserved[3];
struct ec_response_motion_sense_fifo_info info;
} sensor_fifo;