Lines Matching refs:dev

97 static inline int mei_hbm_write_message(struct mei_device *dev,  in mei_hbm_write_message()  argument
101 return mei_write_message(dev, hdr, sizeof(*hdr), data, hdr->length); in mei_hbm_write_message()
109 void mei_hbm_idle(struct mei_device *dev) in mei_hbm_idle() argument
111 dev->init_clients_timer = 0; in mei_hbm_idle()
112 dev->hbm_state = MEI_HBM_IDLE; in mei_hbm_idle()
120 void mei_hbm_reset(struct mei_device *dev) in mei_hbm_reset() argument
122 mei_me_cl_rm_all(dev); in mei_hbm_reset()
124 mei_hbm_idle(dev); in mei_hbm_reset()
172 static inline int mei_hbm_cl_write(struct mei_device *dev, struct mei_cl *cl, in mei_hbm_cl_write() argument
180 return mei_hbm_write_message(dev, &mei_hdr, buf); in mei_hbm_cl_write()
208 struct mei_cl *mei_hbm_cl_find_by_cmd(struct mei_device *dev, void *buf) in mei_hbm_cl_find_by_cmd() argument
213 list_for_each_entry(cl, &dev->file_list, link) in mei_hbm_cl_find_by_cmd()
227 int mei_hbm_start_wait(struct mei_device *dev) in mei_hbm_start_wait() argument
231 if (dev->hbm_state > MEI_HBM_STARTING) in mei_hbm_start_wait()
234 mutex_unlock(&dev->device_lock); in mei_hbm_start_wait()
235 ret = wait_event_timeout(dev->wait_hbm_start, in mei_hbm_start_wait()
236 dev->hbm_state != MEI_HBM_STARTING, in mei_hbm_start_wait()
237 dev->timeouts.hbm); in mei_hbm_start_wait()
238 mutex_lock(&dev->device_lock); in mei_hbm_start_wait()
240 if (ret == 0 && (dev->hbm_state <= MEI_HBM_STARTING)) { in mei_hbm_start_wait()
241 dev->hbm_state = MEI_HBM_IDLE; in mei_hbm_start_wait()
242 dev_err(dev->dev, "waiting for mei start failed\n"); in mei_hbm_start_wait()
255 int mei_hbm_start_req(struct mei_device *dev) in mei_hbm_start_req() argument
261 mei_hbm_reset(dev); in mei_hbm_start_req()
271 dev->hbm_state = MEI_HBM_IDLE; in mei_hbm_start_req()
272 ret = mei_hbm_write_message(dev, &mei_hdr, &req); in mei_hbm_start_req()
274 dev_err(dev->dev, "version message write failed: ret = %d\n", in mei_hbm_start_req()
279 dev->hbm_state = MEI_HBM_STARTING; in mei_hbm_start_req()
280 dev->init_clients_timer = dev->timeouts.client_init; in mei_hbm_start_req()
281 mei_schedule_stall_timer(dev); in mei_hbm_start_req()
291 static int mei_hbm_dma_setup_req(struct mei_device *dev) in mei_hbm_dma_setup_req() argument
305 paddr = dev->dr_dscr[i].daddr; in mei_hbm_dma_setup_req()
308 req.dma_dscr[i].size = dev->dr_dscr[i].size; in mei_hbm_dma_setup_req()
311 mei_dma_ring_reset(dev); in mei_hbm_dma_setup_req()
313 ret = mei_hbm_write_message(dev, &mei_hdr, &req); in mei_hbm_dma_setup_req()
315 dev_err(dev->dev, "dma setup request write failed: ret = %d.\n", in mei_hbm_dma_setup_req()
320 dev->hbm_state = MEI_HBM_DR_SETUP; in mei_hbm_dma_setup_req()
321 dev->init_clients_timer = dev->timeouts.client_init; in mei_hbm_dma_setup_req()
322 mei_schedule_stall_timer(dev); in mei_hbm_dma_setup_req()
333 static int mei_hbm_capabilities_req(struct mei_device *dev) in mei_hbm_capabilities_req() argument
343 if (dev->hbm_f_vt_supported) in mei_hbm_capabilities_req()
346 if (dev->hbm_f_cd_supported) in mei_hbm_capabilities_req()
349 if (dev->hbm_f_gsc_supported) in mei_hbm_capabilities_req()
352 ret = mei_hbm_write_message(dev, &mei_hdr, &req); in mei_hbm_capabilities_req()
354 dev_err(dev->dev, in mei_hbm_capabilities_req()
359 dev->hbm_state = MEI_HBM_CAP_SETUP; in mei_hbm_capabilities_req()
360 dev->init_clients_timer = dev->timeouts.client_init; in mei_hbm_capabilities_req()
361 mei_schedule_stall_timer(dev); in mei_hbm_capabilities_req()
372 static int mei_hbm_enum_clients_req(struct mei_device *dev) in mei_hbm_enum_clients_req() argument
383 req.flags |= dev->hbm_f_dc_supported ? MEI_HBM_ENUM_F_ALLOW_ADD : 0; in mei_hbm_enum_clients_req()
384 req.flags |= dev->hbm_f_ie_supported ? in mei_hbm_enum_clients_req()
387 ret = mei_hbm_write_message(dev, &mei_hdr, &req); in mei_hbm_enum_clients_req()
389 dev_err(dev->dev, "enumeration request write failed: ret = %d.\n", in mei_hbm_enum_clients_req()
393 dev->hbm_state = MEI_HBM_ENUM_CLIENTS; in mei_hbm_enum_clients_req()
394 dev->init_clients_timer = dev->timeouts.client_init; in mei_hbm_enum_clients_req()
395 mei_schedule_stall_timer(dev); in mei_hbm_enum_clients_req()
408 static int mei_hbm_me_cl_add(struct mei_device *dev, in mei_hbm_me_cl_add() argument
414 mei_me_cl_rm_by_uuid(dev, uuid); in mei_hbm_me_cl_add()
426 mei_me_cl_add(dev, me_cl); in mei_hbm_me_cl_add()
440 static int mei_hbm_add_cl_resp(struct mei_device *dev, u8 addr, u8 status) in mei_hbm_add_cl_resp() argument
446 dev_dbg(dev->dev, "adding client response\n"); in mei_hbm_add_cl_resp()
455 ret = mei_hbm_write_message(dev, &mei_hdr, &resp); in mei_hbm_add_cl_resp()
457 dev_err(dev->dev, "add client response write failed: ret = %d\n", in mei_hbm_add_cl_resp()
470 static int mei_hbm_fw_add_cl_req(struct mei_device *dev, in mei_hbm_fw_add_cl_req() argument
479 ret = mei_hbm_me_cl_add(dev, (struct hbm_props_response *)req); in mei_hbm_fw_add_cl_req()
483 if (dev->dev_state == MEI_DEV_ENABLED) in mei_hbm_fw_add_cl_req()
484 schedule_work(&dev->bus_rescan_work); in mei_hbm_fw_add_cl_req()
486 return mei_hbm_add_cl_resp(dev, req->me_addr, status); in mei_hbm_fw_add_cl_req()
498 int mei_hbm_cl_notify_req(struct mei_device *dev, in mei_hbm_cl_notify_req() argument
511 ret = mei_hbm_write_message(dev, &mei_hdr, &req); in mei_hbm_cl_notify_req()
513 dev_err(dev->dev, "notify request failed: ret = %d\n", ret); in mei_hbm_cl_notify_req()
542 static void mei_hbm_cl_notify_start_res(struct mei_device *dev, in mei_hbm_cl_notify_start_res() argument
549 cl_dbg(dev, cl, "hbm: notify start response status=%d\n", rs->status); in mei_hbm_cl_notify_start_res()
568 static void mei_hbm_cl_notify_stop_res(struct mei_device *dev, in mei_hbm_cl_notify_stop_res() argument
575 cl_dbg(dev, cl, "hbm: notify stop response status=%d\n", rs->status); in mei_hbm_cl_notify_stop_res()
593 static void mei_hbm_cl_notify(struct mei_device *dev, in mei_hbm_cl_notify() argument
598 cl = mei_hbm_cl_find_by_cmd(dev, cmd); in mei_hbm_cl_notify()
611 int mei_hbm_cl_dma_map_req(struct mei_device *dev, struct mei_cl *cl) in mei_hbm_cl_dma_map_req() argument
627 ret = mei_hbm_write_message(dev, &mei_hdr, &req); in mei_hbm_cl_dma_map_req()
629 dev_err(dev->dev, "dma map request failed: ret = %d\n", ret); in mei_hbm_cl_dma_map_req()
642 int mei_hbm_cl_dma_unmap_req(struct mei_device *dev, struct mei_cl *cl) in mei_hbm_cl_dma_unmap_req() argument
655 ret = mei_hbm_write_message(dev, &mei_hdr, &req); in mei_hbm_cl_dma_unmap_req()
657 dev_err(dev->dev, "dma unmap request failed: ret = %d\n", ret); in mei_hbm_cl_dma_unmap_req()
662 static void mei_hbm_cl_dma_map_res(struct mei_device *dev, in mei_hbm_cl_dma_map_res() argument
669 list_for_each_entry_safe(cb, next, &dev->ctrl_rd_list, list) { in mei_hbm_cl_dma_map_res()
682 dev_err(dev->dev, "cl dma map failed %d\n", res->status); in mei_hbm_cl_dma_map_res()
685 dev_dbg(dev->dev, "cl dma map succeeded\n"); in mei_hbm_cl_dma_map_res()
692 static void mei_hbm_cl_dma_unmap_res(struct mei_device *dev, in mei_hbm_cl_dma_unmap_res() argument
699 list_for_each_entry_safe(cb, next, &dev->ctrl_rd_list, list) { in mei_hbm_cl_dma_unmap_res()
712 dev_err(dev->dev, "cl dma unmap failed %d\n", res->status); in mei_hbm_cl_dma_unmap_res()
715 dev_dbg(dev->dev, "cl dma unmap succeeded\n"); in mei_hbm_cl_dma_unmap_res()
730 static int mei_hbm_prop_req(struct mei_device *dev, unsigned long start_idx) in mei_hbm_prop_req() argument
737 addr = find_next_bit(dev->me_clients_map, MEI_CLIENTS_MAX, start_idx); in mei_hbm_prop_req()
741 dev->hbm_state = MEI_HBM_STARTED; in mei_hbm_prop_req()
742 mei_host_client_init(dev); in mei_hbm_prop_req()
753 ret = mei_hbm_write_message(dev, &mei_hdr, &req); in mei_hbm_prop_req()
755 dev_err(dev->dev, "properties request write failed: ret = %d\n", in mei_hbm_prop_req()
760 dev->init_clients_timer = dev->timeouts.client_init; in mei_hbm_prop_req()
761 mei_schedule_stall_timer(dev); in mei_hbm_prop_req()
775 int mei_hbm_pg(struct mei_device *dev, u8 pg_cmd) in mei_hbm_pg() argument
781 if (!dev->hbm_f_pg_supported) in mei_hbm_pg()
789 ret = mei_hbm_write_message(dev, &mei_hdr, &req); in mei_hbm_pg()
791 dev_err(dev->dev, "power gate command write failed.\n"); in mei_hbm_pg()
803 static int mei_hbm_stop_req(struct mei_device *dev) in mei_hbm_stop_req() argument
814 return mei_hbm_write_message(dev, &mei_hdr, &req); in mei_hbm_stop_req()
825 int mei_hbm_cl_flow_control_req(struct mei_device *dev, struct mei_cl *cl) in mei_hbm_cl_flow_control_req() argument
829 cl_dbg(dev, cl, "sending flow control\n"); in mei_hbm_cl_flow_control_req()
830 return mei_hbm_cl_write(dev, cl, MEI_FLOW_CONTROL_CMD, in mei_hbm_cl_flow_control_req()
842 static int mei_hbm_add_single_tx_flow_ctrl_creds(struct mei_device *dev, in mei_hbm_add_single_tx_flow_ctrl_creds() argument
848 me_cl = mei_me_cl_by_id(dev, fctrl->me_addr); in mei_hbm_add_single_tx_flow_ctrl_creds()
850 dev_err(dev->dev, "no such me client %d\n", fctrl->me_addr); in mei_hbm_add_single_tx_flow_ctrl_creds()
860 dev_dbg(dev->dev, "recv flow ctrl msg ME %d (single) creds = %d.\n", in mei_hbm_add_single_tx_flow_ctrl_creds()
875 static void mei_hbm_cl_tx_flow_ctrl_creds_res(struct mei_device *dev, in mei_hbm_cl_tx_flow_ctrl_creds_res() argument
882 mei_hbm_add_single_tx_flow_ctrl_creds(dev, fctrl); in mei_hbm_cl_tx_flow_ctrl_creds_res()
886 cl = mei_hbm_cl_find_by_cmd(dev, fctrl); in mei_hbm_cl_tx_flow_ctrl_creds_res()
889 cl_dbg(dev, cl, "flow control creds = %d.\n", in mei_hbm_cl_tx_flow_ctrl_creds_res()
903 int mei_hbm_cl_disconnect_req(struct mei_device *dev, struct mei_cl *cl) in mei_hbm_cl_disconnect_req() argument
907 return mei_hbm_cl_write(dev, cl, CLIENT_DISCONNECT_REQ_CMD, in mei_hbm_cl_disconnect_req()
919 int mei_hbm_cl_disconnect_rsp(struct mei_device *dev, struct mei_cl *cl) in mei_hbm_cl_disconnect_rsp() argument
923 return mei_hbm_cl_write(dev, cl, CLIENT_DISCONNECT_RES_CMD, in mei_hbm_cl_disconnect_rsp()
935 static void mei_hbm_cl_disconnect_res(struct mei_device *dev, struct mei_cl *cl, in mei_hbm_cl_disconnect_res() argument
941 cl_dbg(dev, cl, "hbm: disconnect response status=%d\n", rs->status); in mei_hbm_cl_disconnect_res()
956 int mei_hbm_cl_connect_req(struct mei_device *dev, struct mei_cl *cl) in mei_hbm_cl_connect_req() argument
960 return mei_hbm_cl_write(dev, cl, CLIENT_CONNECT_REQ_CMD, in mei_hbm_cl_connect_req()
972 static void mei_hbm_cl_connect_res(struct mei_device *dev, struct mei_cl *cl, in mei_hbm_cl_connect_res() argument
978 cl_dbg(dev, cl, "hbm: connect response status=%s\n", in mei_hbm_cl_connect_res()
986 mei_me_cl_del(dev, cl->me_cl); in mei_hbm_cl_connect_res()
987 if (dev->dev_state == MEI_DEV_ENABLED) in mei_hbm_cl_connect_res()
988 schedule_work(&dev->bus_rescan_work); in mei_hbm_cl_connect_res()
1002 static void mei_hbm_cl_res(struct mei_device *dev, in mei_hbm_cl_res() argument
1010 list_for_each_entry_safe(cb, next, &dev->ctrl_rd_list, list) { in mei_hbm_cl_res()
1028 mei_hbm_cl_connect_res(dev, cl, rs); in mei_hbm_cl_res()
1031 mei_hbm_cl_disconnect_res(dev, cl, rs); in mei_hbm_cl_res()
1034 mei_hbm_cl_notify_start_res(dev, cl, rs); in mei_hbm_cl_res()
1037 mei_hbm_cl_notify_stop_res(dev, cl, rs); in mei_hbm_cl_res()
1057 static int mei_hbm_fw_disconnect_req(struct mei_device *dev, in mei_hbm_fw_disconnect_req() argument
1063 cl = mei_hbm_cl_find_by_cmd(dev, disconnect_req); in mei_hbm_fw_disconnect_req()
1065 cl_warn(dev, cl, "fw disconnect request received\n"); in mei_hbm_fw_disconnect_req()
1084 static int mei_hbm_pg_enter_res(struct mei_device *dev) in mei_hbm_pg_enter_res() argument
1086 if (mei_pg_state(dev) != MEI_PG_OFF || in mei_hbm_pg_enter_res()
1087 dev->pg_event != MEI_PG_EVENT_WAIT) { in mei_hbm_pg_enter_res()
1088 dev_err(dev->dev, "hbm: pg entry response: state mismatch [%s, %d]\n", in mei_hbm_pg_enter_res()
1089 mei_pg_state_str(mei_pg_state(dev)), dev->pg_event); in mei_hbm_pg_enter_res()
1093 dev->pg_event = MEI_PG_EVENT_RECEIVED; in mei_hbm_pg_enter_res()
1094 wake_up(&dev->wait_pg); in mei_hbm_pg_enter_res()
1104 void mei_hbm_pg_resume(struct mei_device *dev) in mei_hbm_pg_resume() argument
1106 pm_request_resume(dev->dev); in mei_hbm_pg_resume()
1117 static int mei_hbm_pg_exit_res(struct mei_device *dev) in mei_hbm_pg_exit_res() argument
1119 if (mei_pg_state(dev) != MEI_PG_ON || in mei_hbm_pg_exit_res()
1120 (dev->pg_event != MEI_PG_EVENT_WAIT && in mei_hbm_pg_exit_res()
1121 dev->pg_event != MEI_PG_EVENT_IDLE)) { in mei_hbm_pg_exit_res()
1122 dev_err(dev->dev, "hbm: pg exit response: state mismatch [%s, %d]\n", in mei_hbm_pg_exit_res()
1123 mei_pg_state_str(mei_pg_state(dev)), dev->pg_event); in mei_hbm_pg_exit_res()
1127 switch (dev->pg_event) { in mei_hbm_pg_exit_res()
1129 dev->pg_event = MEI_PG_EVENT_RECEIVED; in mei_hbm_pg_exit_res()
1130 wake_up(&dev->wait_pg); in mei_hbm_pg_exit_res()
1138 dev->pg_event = MEI_PG_EVENT_RECEIVED; in mei_hbm_pg_exit_res()
1139 mei_hbm_pg_resume(dev); in mei_hbm_pg_exit_res()
1143 dev->pg_event); in mei_hbm_pg_exit_res()
1156 static void mei_hbm_config_features(struct mei_device *dev) in mei_hbm_config_features() argument
1159 dev->hbm_f_pg_supported = 0; in mei_hbm_config_features()
1160 if (dev->version.major_version > HBM_MAJOR_VERSION_PGI) in mei_hbm_config_features()
1161 dev->hbm_f_pg_supported = 1; in mei_hbm_config_features()
1163 if (dev->version.major_version == HBM_MAJOR_VERSION_PGI && in mei_hbm_config_features()
1164 dev->version.minor_version >= HBM_MINOR_VERSION_PGI) in mei_hbm_config_features()
1165 dev->hbm_f_pg_supported = 1; in mei_hbm_config_features()
1167 dev->hbm_f_dc_supported = 0; in mei_hbm_config_features()
1168 if (dev->version.major_version >= HBM_MAJOR_VERSION_DC) in mei_hbm_config_features()
1169 dev->hbm_f_dc_supported = 1; in mei_hbm_config_features()
1171 dev->hbm_f_ie_supported = 0; in mei_hbm_config_features()
1172 if (dev->version.major_version >= HBM_MAJOR_VERSION_IE) in mei_hbm_config_features()
1173 dev->hbm_f_ie_supported = 1; in mei_hbm_config_features()
1176 dev->hbm_f_dot_supported = 0; in mei_hbm_config_features()
1177 if (dev->version.major_version >= HBM_MAJOR_VERSION_DOT) in mei_hbm_config_features()
1178 dev->hbm_f_dot_supported = 1; in mei_hbm_config_features()
1181 dev->hbm_f_ev_supported = 0; in mei_hbm_config_features()
1182 if (dev->version.major_version >= HBM_MAJOR_VERSION_EV) in mei_hbm_config_features()
1183 dev->hbm_f_ev_supported = 1; in mei_hbm_config_features()
1186 dev->hbm_f_fa_supported = 0; in mei_hbm_config_features()
1187 if (dev->version.major_version >= HBM_MAJOR_VERSION_FA) in mei_hbm_config_features()
1188 dev->hbm_f_fa_supported = 1; in mei_hbm_config_features()
1191 dev->hbm_f_os_supported = 0; in mei_hbm_config_features()
1192 if (dev->version.major_version >= HBM_MAJOR_VERSION_OS) in mei_hbm_config_features()
1193 dev->hbm_f_os_supported = 1; in mei_hbm_config_features()
1196 dev->hbm_f_dr_supported = 0; in mei_hbm_config_features()
1197 if (dev->version.major_version > HBM_MAJOR_VERSION_DR || in mei_hbm_config_features()
1198 (dev->version.major_version == HBM_MAJOR_VERSION_DR && in mei_hbm_config_features()
1199 dev->version.minor_version >= HBM_MINOR_VERSION_DR)) in mei_hbm_config_features()
1200 dev->hbm_f_dr_supported = 1; in mei_hbm_config_features()
1203 dev->hbm_f_vt_supported = 0; in mei_hbm_config_features()
1204 if (dev->version.major_version > HBM_MAJOR_VERSION_VT || in mei_hbm_config_features()
1205 (dev->version.major_version == HBM_MAJOR_VERSION_VT && in mei_hbm_config_features()
1206 dev->version.minor_version >= HBM_MINOR_VERSION_VT)) in mei_hbm_config_features()
1207 dev->hbm_f_vt_supported = 1; in mei_hbm_config_features()
1210 if (dev->version.major_version > HBM_MAJOR_VERSION_GSC || in mei_hbm_config_features()
1211 (dev->version.major_version == HBM_MAJOR_VERSION_GSC && in mei_hbm_config_features()
1212 dev->version.minor_version >= HBM_MINOR_VERSION_GSC)) in mei_hbm_config_features()
1213 dev->hbm_f_gsc_supported = 1; in mei_hbm_config_features()
1216 dev->hbm_f_cap_supported = 0; in mei_hbm_config_features()
1217 if (dev->version.major_version > HBM_MAJOR_VERSION_CAP || in mei_hbm_config_features()
1218 (dev->version.major_version == HBM_MAJOR_VERSION_CAP && in mei_hbm_config_features()
1219 dev->version.minor_version >= HBM_MINOR_VERSION_CAP)) in mei_hbm_config_features()
1220 dev->hbm_f_cap_supported = 1; in mei_hbm_config_features()
1223 dev->hbm_f_cd_supported = 0; in mei_hbm_config_features()
1224 if (dev->version.major_version > HBM_MAJOR_VERSION_CD || in mei_hbm_config_features()
1225 (dev->version.major_version == HBM_MAJOR_VERSION_CD && in mei_hbm_config_features()
1226 dev->version.minor_version >= HBM_MINOR_VERSION_CD)) in mei_hbm_config_features()
1227 dev->hbm_f_cd_supported = 1; in mei_hbm_config_features()
1237 bool mei_hbm_version_is_supported(struct mei_device *dev) in mei_hbm_version_is_supported() argument
1239 return (dev->version.major_version < HBM_MAJOR_VERSION) || in mei_hbm_version_is_supported()
1240 (dev->version.major_version == HBM_MAJOR_VERSION && in mei_hbm_version_is_supported()
1241 dev->version.minor_version <= HBM_MINOR_VERSION); in mei_hbm_version_is_supported()
1253 int mei_hbm_dispatch(struct mei_device *dev, struct mei_msg_hdr *hdr) in mei_hbm_dispatch() argument
1270 BUG_ON(hdr->length >= sizeof(dev->rd_msg_buf)); in mei_hbm_dispatch()
1271 mei_read_slots(dev, dev->rd_msg_buf, hdr->length); in mei_hbm_dispatch()
1272 mei_msg = (struct mei_bus_message *)dev->rd_msg_buf; in mei_hbm_dispatch()
1278 if (dev->hbm_state == MEI_HBM_IDLE) { in mei_hbm_dispatch()
1279 dev_dbg(dev->dev, "hbm: state is idle ignore spurious messages\n"); in mei_hbm_dispatch()
1285 dev_dbg(dev->dev, "hbm: start: response message received.\n"); in mei_hbm_dispatch()
1287 dev->init_clients_timer = 0; in mei_hbm_dispatch()
1291 dev_dbg(dev->dev, "HBM VERSION: DRIVER=%02d:%02d DEVICE=%02d:%02d\n", in mei_hbm_dispatch()
1297 dev->version.major_version = HBM_MAJOR_VERSION; in mei_hbm_dispatch()
1298 dev->version.minor_version = HBM_MINOR_VERSION; in mei_hbm_dispatch()
1300 dev->version.major_version = in mei_hbm_dispatch()
1302 dev->version.minor_version = in mei_hbm_dispatch()
1306 if (!mei_hbm_version_is_supported(dev)) { in mei_hbm_dispatch()
1307 dev_warn(dev->dev, "hbm: start: version mismatch - stopping the driver.\n"); in mei_hbm_dispatch()
1309 dev->hbm_state = MEI_HBM_STOPPED; in mei_hbm_dispatch()
1310 if (mei_hbm_stop_req(dev)) { in mei_hbm_dispatch()
1311 dev_err(dev->dev, "hbm: start: failed to send stop request\n"); in mei_hbm_dispatch()
1317 mei_hbm_config_features(dev); in mei_hbm_dispatch()
1319 if (dev->dev_state != MEI_DEV_INIT_CLIENTS || in mei_hbm_dispatch()
1320 dev->hbm_state != MEI_HBM_STARTING) { in mei_hbm_dispatch()
1321 if (dev->dev_state == MEI_DEV_POWER_DOWN || in mei_hbm_dispatch()
1322 dev->dev_state == MEI_DEV_POWERING_DOWN) { in mei_hbm_dispatch()
1323 dev_dbg(dev->dev, "hbm: start: on shutdown, ignoring\n"); in mei_hbm_dispatch()
1326 dev_err(dev->dev, "hbm: start: state mismatch, [%d, %d]\n", in mei_hbm_dispatch()
1327 dev->dev_state, dev->hbm_state); in mei_hbm_dispatch()
1331 if (dev->hbm_f_cap_supported) { in mei_hbm_dispatch()
1332 if (mei_hbm_capabilities_req(dev)) in mei_hbm_dispatch()
1334 wake_up(&dev->wait_hbm_start); in mei_hbm_dispatch()
1338 if (dev->hbm_f_dr_supported) { in mei_hbm_dispatch()
1339 if (mei_dmam_ring_alloc(dev)) in mei_hbm_dispatch()
1340 dev_info(dev->dev, "running w/o dma ring\n"); in mei_hbm_dispatch()
1341 if (mei_dma_ring_is_allocated(dev)) { in mei_hbm_dispatch()
1342 if (mei_hbm_dma_setup_req(dev)) in mei_hbm_dispatch()
1345 wake_up(&dev->wait_hbm_start); in mei_hbm_dispatch()
1350 dev->hbm_f_dr_supported = 0; in mei_hbm_dispatch()
1351 mei_dmam_ring_free(dev); in mei_hbm_dispatch()
1353 if (mei_hbm_enum_clients_req(dev)) in mei_hbm_dispatch()
1356 wake_up(&dev->wait_hbm_start); in mei_hbm_dispatch()
1360 dev_dbg(dev->dev, "hbm: capabilities response: message received.\n"); in mei_hbm_dispatch()
1362 dev->init_clients_timer = 0; in mei_hbm_dispatch()
1364 if (dev->dev_state != MEI_DEV_INIT_CLIENTS || in mei_hbm_dispatch()
1365 dev->hbm_state != MEI_HBM_CAP_SETUP) { in mei_hbm_dispatch()
1366 if (dev->dev_state == MEI_DEV_POWER_DOWN || in mei_hbm_dispatch()
1367 dev->dev_state == MEI_DEV_POWERING_DOWN) { in mei_hbm_dispatch()
1368 dev_dbg(dev->dev, "hbm: capabilities response: on shutdown, ignoring\n"); in mei_hbm_dispatch()
1371 dev_err(dev->dev, "hbm: capabilities response: state mismatch, [%d, %d]\n", in mei_hbm_dispatch()
1372 dev->dev_state, dev->hbm_state); in mei_hbm_dispatch()
1378 dev->hbm_f_vt_supported = 0; in mei_hbm_dispatch()
1380 dev->hbm_f_cd_supported = 0; in mei_hbm_dispatch()
1383 dev->hbm_f_gsc_supported = 0; in mei_hbm_dispatch()
1385 if (dev->hbm_f_dr_supported) { in mei_hbm_dispatch()
1386 if (mei_dmam_ring_alloc(dev)) in mei_hbm_dispatch()
1387 dev_info(dev->dev, "running w/o dma ring\n"); in mei_hbm_dispatch()
1388 if (mei_dma_ring_is_allocated(dev)) { in mei_hbm_dispatch()
1389 if (mei_hbm_dma_setup_req(dev)) in mei_hbm_dispatch()
1395 dev->hbm_f_dr_supported = 0; in mei_hbm_dispatch()
1396 mei_dmam_ring_free(dev); in mei_hbm_dispatch()
1398 if (mei_hbm_enum_clients_req(dev)) in mei_hbm_dispatch()
1403 dev_dbg(dev->dev, "hbm: dma setup response: message received.\n"); in mei_hbm_dispatch()
1405 dev->init_clients_timer = 0; in mei_hbm_dispatch()
1407 if (dev->dev_state != MEI_DEV_INIT_CLIENTS || in mei_hbm_dispatch()
1408 dev->hbm_state != MEI_HBM_DR_SETUP) { in mei_hbm_dispatch()
1409 if (dev->dev_state == MEI_DEV_POWER_DOWN || in mei_hbm_dispatch()
1410 dev->dev_state == MEI_DEV_POWERING_DOWN) { in mei_hbm_dispatch()
1411 dev_dbg(dev->dev, "hbm: dma setup response: on shutdown, ignoring\n"); in mei_hbm_dispatch()
1414 dev_err(dev->dev, "hbm: dma setup response: state mismatch, [%d, %d]\n", in mei_hbm_dispatch()
1415 dev->dev_state, dev->hbm_state); in mei_hbm_dispatch()
1425 dev_dbg(dev->dev, "hbm: dma setup not allowed\n"); in mei_hbm_dispatch()
1427 dev_info(dev->dev, "hbm: dma setup response: failure = %d %s\n", in mei_hbm_dispatch()
1431 dev->hbm_f_dr_supported = 0; in mei_hbm_dispatch()
1432 mei_dmam_ring_free(dev); in mei_hbm_dispatch()
1435 if (mei_hbm_enum_clients_req(dev)) in mei_hbm_dispatch()
1440 dev_dbg(dev->dev, "hbm: client connect response: message received.\n"); in mei_hbm_dispatch()
1441 mei_hbm_cl_res(dev, cl_cmd, MEI_FOP_CONNECT); in mei_hbm_dispatch()
1445 dev_dbg(dev->dev, "hbm: client disconnect response: message received.\n"); in mei_hbm_dispatch()
1446 mei_hbm_cl_res(dev, cl_cmd, MEI_FOP_DISCONNECT); in mei_hbm_dispatch()
1450 dev_dbg(dev->dev, "hbm: client flow control response: message received.\n"); in mei_hbm_dispatch()
1453 mei_hbm_cl_tx_flow_ctrl_creds_res(dev, fctrl); in mei_hbm_dispatch()
1457 dev_dbg(dev->dev, "hbm: power gate isolation entry response received\n"); in mei_hbm_dispatch()
1458 ret = mei_hbm_pg_enter_res(dev); in mei_hbm_dispatch()
1464 dev_dbg(dev->dev, "hbm: power gate isolation exit request received\n"); in mei_hbm_dispatch()
1465 ret = mei_hbm_pg_exit_res(dev); in mei_hbm_dispatch()
1471 dev_dbg(dev->dev, "hbm: properties response: message received.\n"); in mei_hbm_dispatch()
1473 dev->init_clients_timer = 0; in mei_hbm_dispatch()
1475 if (dev->dev_state != MEI_DEV_INIT_CLIENTS || in mei_hbm_dispatch()
1476 dev->hbm_state != MEI_HBM_CLIENT_PROPERTIES) { in mei_hbm_dispatch()
1477 if (dev->dev_state == MEI_DEV_POWER_DOWN || in mei_hbm_dispatch()
1478 dev->dev_state == MEI_DEV_POWERING_DOWN) { in mei_hbm_dispatch()
1479 dev_dbg(dev->dev, "hbm: properties response: on shutdown, ignoring\n"); in mei_hbm_dispatch()
1482 dev_err(dev->dev, "hbm: properties response: state mismatch, [%d, %d]\n", in mei_hbm_dispatch()
1483 dev->dev_state, dev->hbm_state); in mei_hbm_dispatch()
1490 dev_dbg(dev->dev, "hbm: properties response: %d CLIENT_NOT_FOUND\n", in mei_hbm_dispatch()
1493 dev_err(dev->dev, "hbm: properties response: wrong status = %d %s\n", in mei_hbm_dispatch()
1498 mei_hbm_me_cl_add(dev, props_res); in mei_hbm_dispatch()
1502 if (mei_hbm_prop_req(dev, props_res->me_addr + 1)) in mei_hbm_dispatch()
1508 dev_dbg(dev->dev, "hbm: enumeration response: message received\n"); in mei_hbm_dispatch()
1510 dev->init_clients_timer = 0; in mei_hbm_dispatch()
1513 BUILD_BUG_ON(sizeof(dev->me_clients_map) in mei_hbm_dispatch()
1515 memcpy(dev->me_clients_map, enum_res->valid_addresses, in mei_hbm_dispatch()
1518 if (dev->dev_state != MEI_DEV_INIT_CLIENTS || in mei_hbm_dispatch()
1519 dev->hbm_state != MEI_HBM_ENUM_CLIENTS) { in mei_hbm_dispatch()
1520 if (dev->dev_state == MEI_DEV_POWER_DOWN || in mei_hbm_dispatch()
1521 dev->dev_state == MEI_DEV_POWERING_DOWN) { in mei_hbm_dispatch()
1522 dev_dbg(dev->dev, "hbm: enumeration response: on shutdown, ignoring\n"); in mei_hbm_dispatch()
1525 dev_err(dev->dev, "hbm: enumeration response: state mismatch, [%d, %d]\n", in mei_hbm_dispatch()
1526 dev->dev_state, dev->hbm_state); in mei_hbm_dispatch()
1530 dev->hbm_state = MEI_HBM_CLIENT_PROPERTIES; in mei_hbm_dispatch()
1533 if (mei_hbm_prop_req(dev, 0)) in mei_hbm_dispatch()
1539 dev_dbg(dev->dev, "hbm: stop response: message received\n"); in mei_hbm_dispatch()
1541 dev->init_clients_timer = 0; in mei_hbm_dispatch()
1543 if (dev->hbm_state != MEI_HBM_STOPPED) { in mei_hbm_dispatch()
1544 dev_err(dev->dev, "hbm: stop response: state mismatch, [%d, %d]\n", in mei_hbm_dispatch()
1545 dev->dev_state, dev->hbm_state); in mei_hbm_dispatch()
1549 mei_set_devstate(dev, MEI_DEV_POWER_DOWN); in mei_hbm_dispatch()
1550 dev_info(dev->dev, "hbm: stop response: resetting.\n"); in mei_hbm_dispatch()
1555 dev_dbg(dev->dev, "hbm: disconnect request: message received\n"); in mei_hbm_dispatch()
1558 mei_hbm_fw_disconnect_req(dev, disconnect_req); in mei_hbm_dispatch()
1562 dev_dbg(dev->dev, "hbm: stop request: message received\n"); in mei_hbm_dispatch()
1563 dev->hbm_state = MEI_HBM_STOPPED; in mei_hbm_dispatch()
1564 if (mei_hbm_stop_req(dev)) { in mei_hbm_dispatch()
1565 dev_err(dev->dev, "hbm: stop request: failed to send stop request\n"); in mei_hbm_dispatch()
1571 dev_dbg(dev->dev, "hbm: add client request received\n"); in mei_hbm_dispatch()
1576 if (dev->hbm_state <= MEI_HBM_ENUM_CLIENTS || in mei_hbm_dispatch()
1577 dev->hbm_state >= MEI_HBM_STOPPED) { in mei_hbm_dispatch()
1578 dev_err(dev->dev, "hbm: add client: state mismatch, [%d, %d]\n", in mei_hbm_dispatch()
1579 dev->dev_state, dev->hbm_state); in mei_hbm_dispatch()
1583 ret = mei_hbm_fw_add_cl_req(dev, add_cl_req); in mei_hbm_dispatch()
1585 dev_err(dev->dev, "hbm: add client: failed to send response %d\n", in mei_hbm_dispatch()
1589 dev_dbg(dev->dev, "hbm: add client request processed\n"); in mei_hbm_dispatch()
1593 dev_dbg(dev->dev, "hbm: notify response received\n"); in mei_hbm_dispatch()
1594 mei_hbm_cl_res(dev, cl_cmd, notify_res_to_fop(cl_cmd)); in mei_hbm_dispatch()
1598 dev_dbg(dev->dev, "hbm: notification\n"); in mei_hbm_dispatch()
1599 mei_hbm_cl_notify(dev, cl_cmd); in mei_hbm_dispatch()
1603 dev_dbg(dev->dev, "hbm: client dma map response: message received.\n"); in mei_hbm_dispatch()
1605 mei_hbm_cl_dma_map_res(dev, client_dma_res); in mei_hbm_dispatch()
1609 dev_dbg(dev->dev, "hbm: client dma unmap response: message received.\n"); in mei_hbm_dispatch()
1611 mei_hbm_cl_dma_unmap_res(dev, client_dma_res); in mei_hbm_dispatch()