summaryrefslogtreecommitdiff
path: root/common/pstore_commands.c
diff options
context:
space:
mode:
authorJack Rosenthal <jrosenth@chromium.org>2021-11-04 12:11:58 -0600
committerCommit Bot <commit-bot@chromium.org>2021-11-05 04:22:34 +0000
commit252457d4b21f46889eebad61d4c0a65331919cec (patch)
tree01856c4d31d710b20e85a74c8d7b5836e35c3b98 /common/pstore_commands.c
parent08f5a1e6fc2c9467230444ac9b582dcf4d9f0068 (diff)
downloadchrome-ec-stabilize-14395.B-ish.tar.gz
In the interest of making long-term branch maintenance incur as little technical debt on us as possible, we should not maintain any files on the branch we are not actually using. This has the added effect of making it extremely clear when merging CLs from the main branch when changes have the possibility to affect us. The follow-on CL adds a convenience script to actually pull updates from the main branch and generate a CL for the update. BUG=b:204206272 BRANCH=ish TEST=make BOARD=arcada_ish && make BOARD=drallion_ish Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I17e4694c38219b5a0823e0a3e55a28d1348f4b18 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3262038 Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Tom Hughes <tomhughes@chromium.org>
Diffstat (limited to 'common/pstore_commands.c')
-rw-r--r--common/pstore_commands.c101
1 files changed, 0 insertions, 101 deletions
diff --git a/common/pstore_commands.c b/common/pstore_commands.c
deleted file mode 100644
index 52270cd1cf..0000000000
--- a/common/pstore_commands.c
+++ /dev/null
@@ -1,101 +0,0 @@
-/* Copyright 2012 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.
- */
-
-/* Persistent storage commands for Chrome EC */
-
-#include "common.h"
-#include "eeprom.h"
-#include "host_command.h"
-#include "util.h"
-
-enum ec_status pstore_command_get_info(struct host_cmd_handler_args *args)
-{
- struct ec_response_pstore_info *r = args->response;
-
- ASSERT(EEPROM_BLOCK_START_PSTORE + EEPROM_BLOCK_COUNT_PSTORE <=
- eeprom_get_block_count());
-
- r->pstore_size = EEPROM_BLOCK_COUNT_PSTORE * eeprom_get_block_size();
- r->access_size = sizeof(uint32_t);
- args->response_size = sizeof(*r);
- return EC_RES_SUCCESS;
-}
-DECLARE_HOST_COMMAND(EC_CMD_PSTORE_INFO,
- pstore_command_get_info,
- EC_VER_MASK(0));
-
-enum ec_status pstore_command_read(struct host_cmd_handler_args *args)
-{
- const struct ec_params_pstore_read *p = args->params;
- char *dest = args->response;
- int block_size = eeprom_get_block_size();
- int block = p->offset / block_size + EEPROM_BLOCK_START_PSTORE;
- int offset = p->offset % block_size;
- int bytes_left = p->size;
-
- if (p->size > args->response_max)
- return EC_RES_INVALID_PARAM;
-
- while (bytes_left) {
- /* Read what we can from the current block */
- int bytes_this = MIN(bytes_left, block_size - offset);
-
- if (block >=
- EEPROM_BLOCK_START_PSTORE + EEPROM_BLOCK_COUNT_PSTORE)
- return EC_RES_ERROR;
-
- if (eeprom_read(block, offset, bytes_this, dest))
- return EC_RES_ERROR;
-
- /* Continue to the next block if necessary */
- offset = 0;
- block++;
- bytes_left -= bytes_this;
- dest += bytes_this;
- }
-
- args->response_size = p->size;
- return EC_RES_SUCCESS;
-}
-DECLARE_HOST_COMMAND(EC_CMD_PSTORE_READ,
- pstore_command_read,
- EC_VER_MASK(0));
-
-enum ec_status pstore_command_write(struct host_cmd_handler_args *args)
-{
- const struct ec_params_pstore_write *p = args->params;
-
- const char *src = p->data;
- int block_size = eeprom_get_block_size();
- int block = p->offset / block_size + EEPROM_BLOCK_START_PSTORE;
- int offset = p->offset % block_size;
- int bytes_left = p->size;
-
- if (p->size > sizeof(p->data))
- return EC_RES_ERROR;
-
- while (bytes_left) {
- /* Write what we can to the current block */
- int bytes_this = MIN(bytes_left, block_size - offset);
-
- if (block >=
- EEPROM_BLOCK_START_PSTORE + EEPROM_BLOCK_COUNT_PSTORE)
- return EC_RES_ERROR;
-
- if (eeprom_write(block, offset, bytes_this, src))
- return EC_RES_ERROR;
-
- /* Continue to the next block if necessary */
- offset = 0;
- block++;
- bytes_left -= bytes_this;
- src += bytes_this;
- }
-
- return EC_RES_SUCCESS;
-}
-DECLARE_HOST_COMMAND(EC_CMD_PSTORE_WRITE,
- pstore_command_write,
- EC_VER_MASK(0));