Commit 80e7c5dd authored by Mika Westerberg's avatar Mika Westerberg

thunderbolt: Handle ERR_LOCK notification

If the USB4 router downstream port is locked, sending configuration
packet to a router below it causes ERR_LOCK to be sent. Instead of warn
splat about unknown error we log the error (just warning level) and
return -EACCESS instead. The idea is that we may want to do something
when such error code is received, like perform unlock.
Signed-off-by: default avatarMika Westerberg <mika.westerberg@linux.intel.com>
parent 8eabfca5
...@@ -282,6 +282,10 @@ static void tb_cfg_print_error(struct tb_ctl *ctl, ...@@ -282,6 +282,10 @@ static void tb_cfg_print_error(struct tb_ctl *ctl,
tb_ctl_WARN(ctl, "CFG_ERROR(%llx:%x): Route contains a loop\n", tb_ctl_WARN(ctl, "CFG_ERROR(%llx:%x): Route contains a loop\n",
res->response_route, res->response_port); res->response_route, res->response_port);
return; return;
case TB_CFG_ERROR_LOCK:
tb_ctl_warn(ctl, "%llx:%x: downstream port is locked\n",
res->response_route, res->response_port);
return;
default: default:
/* 5,6,7,9 and 11 are also valid error codes */ /* 5,6,7,9 and 11 are also valid error codes */
tb_ctl_WARN(ctl, "CFG_ERROR(%llx:%x): Unknown error\n", tb_ctl_WARN(ctl, "CFG_ERROR(%llx:%x): Unknown error\n",
...@@ -950,6 +954,9 @@ static int tb_cfg_get_error(struct tb_ctl *ctl, enum tb_cfg_space space, ...@@ -950,6 +954,9 @@ static int tb_cfg_get_error(struct tb_ctl *ctl, enum tb_cfg_space space,
return -ENODEV; return -ENODEV;
tb_cfg_print_error(ctl, res); tb_cfg_print_error(ctl, res);
if (res->tb_error == TB_CFG_ERROR_LOCK)
return -EACCES;
return -EIO; return -EIO;
} }
......
...@@ -28,6 +28,7 @@ enum tb_cfg_error { ...@@ -28,6 +28,7 @@ enum tb_cfg_error {
TB_CFG_ERROR_LOOP = 8, TB_CFG_ERROR_LOOP = 8,
TB_CFG_ERROR_HEC_ERROR_DETECTED = 12, TB_CFG_ERROR_HEC_ERROR_DETECTED = 12,
TB_CFG_ERROR_FLOW_CONTROL_ERROR = 13, TB_CFG_ERROR_FLOW_CONTROL_ERROR = 13,
TB_CFG_ERROR_LOCK = 15,
}; };
/* common header */ /* common header */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment