mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-12-28 02:35:28 +00:00
Add RW offset query interface (EC_CMD_FLASH_RW_OFFSET).
BUG=chrome-os-partner:11149 TEST=build only. Originally-Signed-off-by: Louis Yung-Chieh Lo <yjlou@chromium.org> Change-Id: I35ad1e0a49c95a2d6cffbe49b2013a1b8050aabc Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/28166
This commit is contained in:
committed by
Gerrit
parent
7884868846
commit
3ab8ed4124
@@ -332,3 +332,34 @@ static int flash_command_protect(struct host_cmd_handler_args *args)
|
||||
DECLARE_HOST_COMMAND(EC_CMD_FLASH_PROTECT,
|
||||
flash_command_protect,
|
||||
EC_VER_MASK(1));
|
||||
|
||||
static int flash_command_region_info(struct host_cmd_handler_args *args)
|
||||
{
|
||||
struct ec_params_flash_region_info *p =
|
||||
(struct ec_params_flash_region_info *)args->params;
|
||||
struct ec_response_flash_region_info *r =
|
||||
(struct ec_response_flash_region_info *)args->response;
|
||||
|
||||
switch (p->region) {
|
||||
case EC_FLASH_REGION_RO:
|
||||
r->offset = CONFIG_SECTION_RO_OFF;
|
||||
r->size = CONFIG_SECTION_RO_SIZE;
|
||||
break;
|
||||
case EC_FLASH_REGION_RW:
|
||||
r->offset = CONFIG_SECTION_RW_OFF;
|
||||
r->size = CONFIG_SECTION_RW_SIZE;
|
||||
break;
|
||||
case EC_FLASH_REGION_WP_RO:
|
||||
r->offset = CONFIG_SECTION_RO_OFF;
|
||||
r->size = CONFIG_SECTION_RO_SIZE;
|
||||
break;
|
||||
default:
|
||||
return EC_RES_INVALID_PARAM;
|
||||
}
|
||||
|
||||
args->response_size = sizeof(*r);
|
||||
return EC_RES_SUCCESS;
|
||||
}
|
||||
DECLARE_HOST_COMMAND(EC_CMD_FLASH_REGION_INFO,
|
||||
flash_command_region_info,
|
||||
EC_VER_MASK(EC_VER_FLASH_REGION_INFO));
|
||||
|
||||
@@ -501,6 +501,32 @@ struct ec_response_flash_protect {
|
||||
* write protect. These commands may be reused with version > 0.
|
||||
*/
|
||||
|
||||
/* Get the region offset/size */
|
||||
#define EC_CMD_FLASH_REGION_INFO 0x16
|
||||
#define EC_VER_FLASH_REGION_INFO 1
|
||||
|
||||
enum ec_flash_region {
|
||||
/* Region which holds read-only EC image */
|
||||
EC_FLASH_REGION_RO,
|
||||
/* Region which holds rewritable EC image */
|
||||
EC_FLASH_REGION_RW,
|
||||
/*
|
||||
* Region which should be write-protected in the factory (a superset of
|
||||
* EC_FLASH_REGION_RO)
|
||||
*/
|
||||
EC_FLASH_REGION_WP_RO,
|
||||
};
|
||||
|
||||
struct ec_params_flash_region_info {
|
||||
uint32_t region; /* enum ec_flash_region */
|
||||
} __packed;
|
||||
|
||||
struct ec_response_flash_region_info {
|
||||
uint32_t offset;
|
||||
uint32_t size;
|
||||
} __packed;
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* PWM commands */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user