summaryrefslogtreecommitdiff
path: root/chip/g/flash.c
diff options
context:
space:
mode:
Diffstat (limited to 'chip/g/flash.c')
-rw-r--r--chip/g/flash.c56
1 files changed, 0 insertions, 56 deletions
diff --git a/chip/g/flash.c b/chip/g/flash.c
index 83870e03ec..ba0e9459ae 100644
--- a/chip/g/flash.c
+++ b/chip/g/flash.c
@@ -530,60 +530,4 @@ static enum vendor_cmd_rc vc_endorsement_seed(enum vendor_cmd_cc code,
return rv;
}
DECLARE_VENDOR_COMMAND(VENDOR_CC_ENDORSEMENT_SEED, vc_endorsement_seed);
-
-static int command_erase_flash_info(int argc, char **argv)
-{
- int i;
- int rv;
- struct info1_layout *info1;
- uint32_t *p;
-
- rv = shared_mem_acquire(sizeof(*info1), (char **)&info1);
- if (rv != EC_SUCCESS) {
- ccprintf("Failed to allocate memory for info1!\n");
- return rv;
- }
-
- /* Read the entire info1. */
- p = (uint32_t *)info1;
- for (i = 0; i < (sizeof(*info1) / sizeof(*p)); i++) {
- if (flash_physical_info_read_word(i * sizeof(*p), p + i) !=
- EC_SUCCESS) {
- ccprintf("Failed to read word %d!\n", i);
- goto exit;
- }
- }
- /*
- * This must be CR50_DEV=1 image, just erase the board information
- * space.
- */
- memset(&info1->board_space, 0xff, sizeof(info1->board_space));
-
- memset(info1->rw_info_map, 0xff, sizeof(info1->rw_info_map));
-
- mutex_lock(&flash_mtx);
-
- flash_info_write_enable();
-
- rv = do_flash_op(OP_ERASE_BLOCK, 1, 0, 512);
-
- mutex_unlock(&flash_mtx);
-
- if (rv != EC_SUCCESS) {
- ccprintf("Failed to erase info space!\n");
- goto exit;
- }
-
- rv = flash_info_physical_write(0, sizeof(*info1), (char *)info1);
- if (rv != EC_SUCCESS)
- ccprintf("Failed write back info1 contents!\n");
-
- exit:
- flash_info_write_disable();
- always_memset(info1, 0, sizeof(*info1));
- shared_mem_release(info1);
- return rv;
-}
-DECLARE_SAFE_CONSOLE_COMMAND(eraseflashinfo, command_erase_flash_info,
- "", "Erase INFO1 flash space");
#endif