summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRandall Spangler <rspangler@chromium.org>2012-07-17 12:59:11 -0700
committerGerrit <chrome-bot@google.com>2012-07-18 13:11:07 -0700
commit60e784481866ac0629a79327d92503635b662c1e (patch)
tree9f97ec872f362a73c82832ed224c85edf191a902
parentf211884888a181641aa4e4cea66dae4815dea111 (diff)
downloadchrome-ec-60e784481866ac0629a79327d92503635b662c1e.tar.gz
Remove old flash WP commands
These don't accurately reflect how flash write protect was/is implemented. BUG=chrome-os-partner:11150 TEST=build link, snow Change-Id: I126253a2ce05e5d3a51471c32211e6cacbfd85d4 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/27716 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
-rw-r--r--common/flash_commands.c94
-rw-r--r--include/ec_commands.h53
2 files changed, 2 insertions, 145 deletions
diff --git a/common/flash_commands.c b/common/flash_commands.c
index 590e090b0e..c52f308325 100644
--- a/common/flash_commands.c
+++ b/common/flash_commands.c
@@ -254,97 +254,3 @@ static int flash_command_erase(struct host_cmd_handler_args *args)
DECLARE_HOST_COMMAND(EC_CMD_FLASH_ERASE,
flash_command_erase,
EC_VER_MASK(0));
-
-static int flash_command_wp_enable(struct host_cmd_handler_args *args)
-{
- const struct ec_params_flash_wp_enable *p =
- (const struct ec_params_flash_wp_enable *)args->params;
-
- /*
- * TODO: this is wrong; needs to translate return code to EC_RES_*.
- * But since this command is going away imminently, no rush.
- */
- return flash_lock_protect(p->enable_wp ? 1 : 0);
-}
-DECLARE_HOST_COMMAND(EC_CMD_FLASH_WP_ENABLE,
- flash_command_wp_enable,
- EC_VER_MASK(0));
-
-static int flash_command_wp_get_state(struct host_cmd_handler_args *args)
-{
- struct ec_response_flash_wp_enable *r =
- (struct ec_response_flash_wp_enable *)args->response;
-
- if (flash_get_protect_lock() & FLASH_PROTECT_LOCK_SET)
- r->enable_wp = 1;
- else
- r->enable_wp = 0;
-
- args->response_size = sizeof(*r);
- return EC_RES_SUCCESS;
-}
-DECLARE_HOST_COMMAND(EC_CMD_FLASH_WP_GET_STATE,
- flash_command_wp_get_state,
- EC_VER_MASK(0));
-
-static int flash_command_wp_set_range(struct host_cmd_handler_args *args)
-{
- const struct ec_params_flash_wp_range *p =
- (const struct ec_params_flash_wp_range *)args->params;
-
- /*
- * TODO: this is wrong; needs to translate return code to EC_RES_*.
- * But since this command is going away imminently, no rush.
- */
- if (p->size)
- return flash_set_protect(p->offset, p->size, 1);
- else
- return flash_set_protect(0, flash_get_size(), 0);
-}
-DECLARE_HOST_COMMAND(EC_CMD_FLASH_WP_SET_RANGE,
- flash_command_wp_set_range,
- EC_VER_MASK(0));
-
-static int flash_command_wp_get_range(struct host_cmd_handler_args *args)
-{
- struct ec_response_flash_wp_range *r =
- (struct ec_response_flash_wp_range *)args->response;
- int pbsize = flash_get_protect_block_size();
- int banks = flash_get_size() / pbsize;
- const uint8_t *blocks;
- int i;
- int min = -1, max = banks - 1; /* the enclosed range for protected. */
-
- blocks = flash_get_protect_array();
- for (i = 0; i < banks; i++) {
- if (min == -1) {
- /* Looking for the first protected bank. */
- if (blocks[i] & (FLASH_PROTECT_PERSISTENT |
- FLASH_PROTECT_UNTIL_REBOOT)) {
- min = i;
- }
- } else if (i < max) {
- /* Looking for the unprotected bank. */
- if (!(blocks[i] & (FLASH_PROTECT_PERSISTENT |
- FLASH_PROTECT_UNTIL_REBOOT))) {
- max = i - 1;
- }
- }
- }
-
- /* TODO(crosbug.com/p/9492): return multiple region of ranges(). */
- if (min == -1) {
- /* None of bank is protected. */
- r->offset = 0;
- r->size = 0;
- } else {
- r->offset = min * pbsize;
- r->size = (max - min + 1) * pbsize;
- }
-
- args->response_size = sizeof(*r);
- return EC_RES_SUCCESS;
-}
-DECLARE_HOST_COMMAND(EC_CMD_FLASH_WP_GET_RANGE,
- flash_command_wp_get_range,
- EC_VER_MASK(0));
diff --git a/include/ec_commands.h b/include/ec_commands.h
index 18f309beba..b63035aaff 100644
--- a/include/ec_commands.h
+++ b/include/ec_commands.h
@@ -426,59 +426,10 @@ struct ec_params_flash_erase {
uint32_t size; /* Size to erase in bytes */
} __packed;
-/* Get flashmap offset */
-#define EC_CMD_FLASH_GET_FLASHMAP 0x14
-
-struct ec_response_flash_flashmap {
- uint32_t offset; /* Flashmap offset */
-} __packed;
-
-/* Enable/disable flash write protect */
-#define EC_CMD_FLASH_WP_ENABLE 0x15
-
-struct ec_params_flash_wp_enable {
- uint32_t enable_wp;
-} __packed;
-
-/* Get flash write protection commit state */
-#define EC_CMD_FLASH_WP_GET_STATE 0x16
-
-struct ec_response_flash_wp_enable {
- uint32_t enable_wp;
-} __packed;
-
-/* Set/get flash write protection range */
-#define EC_CMD_FLASH_WP_SET_RANGE 0x17
-
-struct ec_params_flash_wp_range {
- /* Byte offset aligned to info.protect_block_size */
- uint32_t offset;
- /* Size should be multiply of info.protect_block_size */
- uint32_t size;
-} __packed;
-
-#define EC_CMD_FLASH_WP_GET_RANGE 0x18
-
-struct ec_response_flash_wp_range {
- uint32_t offset;
- uint32_t size;
-} __packed;
-
-/* Read flash write protection GPIO pin */
-#define EC_CMD_FLASH_WP_GET_GPIO 0x19
-
/*
- * TODO: why does this pass in a pin number? EC *KNOWS* what the pin is.
- * Of course, the EC doesn't implement this message yet, so this is somewhat
- * theoretical.
+ * Note: commands 0x14 - 0x19 version 0 were old commands to get/set flash
+ * write protect. These commands may be reused with version > 0.
*/
-struct ec_params_flash_wp_gpio {
- uint32_t pin_no;
-} __packed;
-
-struct ec_response_flash_wp_gpio {
- uint32_t value;
-} __packed;
/*****************************************************************************/
/* PWM commands */