From dc4cc17a81f4a483ffde65fa73575c0f2225b584 Mon Sep 17 00:00:00 2001 From: Mary Ruthven Date: Tue, 9 Nov 2021 15:57:58 -0600 Subject: i2c_controller: remove Protect TCPC I2C tunnels as part of EC_REBOOT_DISABLE_JUMP This removes the support added in 9e4474e561ec165cf24e8aa249c2aeeed8e7f1ef. BUG=b:200823466 TEST=make buildall -j Change-Id: I81745d55783e69a345a41c55b126f196b20d952a Signed-off-by: Mary Ruthven Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3273401 Reviewed-by: Vadim Sukhomlinov --- common/i2c_controller.c | 12 ++---------- common/system.c | 32 -------------------------------- 2 files changed, 2 insertions(+), 42 deletions(-) (limited to 'common') diff --git a/common/i2c_controller.c b/common/i2c_controller.c index 535de034c4..9c710e9f06 100644 --- a/common/i2c_controller.c +++ b/common/i2c_controller.c @@ -36,7 +36,7 @@ static struct mutex port_mutex[I2C_CONTROLLER_COUNT]; /* A bitmap of the controllers which are currently servicing a request. */ static uint32_t i2c_port_active_list; BUILD_ASSERT(I2C_CONTROLLER_COUNT < 32); -static uint8_t port_protected[I2C_PORT_COUNT]; +static uint8_t port_protected[I2C_CONTROLLER_COUNT]; /** * Non-deterministically test the lock status of the port. If another task @@ -1082,14 +1082,6 @@ DECLARE_HOST_COMMAND(EC_CMD_I2C_LOOKUP, i2c_command_lookup, EC_VER_MASK(0)); /* If the params union expands in the future, need to bump EC_VER_MASK */ BUILD_ASSERT(sizeof(struct ec_params_i2c_lookup) == 4); -void i2c_passthru_protect_port(uint32_t port) -{ - if (port < I2C_PORT_COUNT) - port_protected[port] = 1; - else - PTHRUPRINTS("Invalid I2C port %d to be protected\n", port); -} - static enum ec_status i2c_command_passthru_protect(struct host_cmd_handler_args *args) { @@ -1118,7 +1110,7 @@ i2c_command_passthru_protect(struct host_cmd_handler_args *args) resp->status = port_protected[params->port]; args->response_size = sizeof(*resp); } else if (params->subcmd == EC_CMD_I2C_PASSTHRU_PROTECT_ENABLE) { - i2c_passthru_protect_port(params->port); + port_protected[params->port] = 1; } else { return EC_RES_INVALID_COMMAND; } diff --git a/common/system.c b/common/system.c index c0d5e13fc5..e8b08b69f2 100644 --- a/common/system.c +++ b/common/system.c @@ -350,36 +350,6 @@ const uint8_t *system_get_jump_tag(uint16_t tag, int *version, int *size) return NULL; } -#if defined(CONFIG_USB_POWER_DELIVERY) && !defined(CONFIG_USB_PD_TCPM_STUB) && \ - defined(CONFIG_I2C_CONTROLLER) -extern const struct tcpc_config_t tcpc_config[]; - -static void system_protect_tcpc_i2c_ports(void) -{ - uint32_t locked = system_is_locked(); - int i; - - /* - * If WP is not enabled i.e. system is not locked leave the tunnels open - * so that factory line can do updates without a new RO BIOS. - */ - if (!locked) { - CPRINTS("System unlocked, TCPC I2C tunnels may be unprotected"); - return; - } - - for (i = 0; i < CONFIG_USB_PD_PORT_COUNT; i++) - i2c_passthru_protect_port(tcpc_config[i].i2c_host_port); -} - -#else - -static void system_protect_tcpc_i2c_ports(void) -{ -} - -#endif - void system_disable_jump(void) { disable_jump = 1; @@ -911,7 +881,6 @@ static int handle_pending_reboot(enum ec_reboot_cmd cmd) /* That shouldn't return... */ return EC_ERROR_UNKNOWN; case EC_REBOOT_DISABLE_JUMP: - system_protect_tcpc_i2c_ports(); system_disable_jump(); return EC_SUCCESS; #ifdef CONFIG_HIBERNATE @@ -1188,7 +1157,6 @@ static int command_sysjump(int argc, char **argv) return EC_ERROR_PARAM1; #endif } else if (!strcasecmp(argv[1], "disable")) { - system_protect_tcpc_i2c_ports(); system_disable_jump(); return EC_SUCCESS; } -- cgit v1.2.1