Lines Matching full:dev

91  * @dev: mei device
95 static inline int mei_hbm_write_message(struct mei_device *dev, in mei_hbm_write_message() argument
99 return mei_write_message(dev, hdr, sizeof(*hdr), data, hdr->length); in mei_hbm_write_message()
105 * @dev: the device structure
107 void mei_hbm_idle(struct mei_device *dev) in mei_hbm_idle() argument
109 dev->init_clients_timer = 0; in mei_hbm_idle()
110 dev->hbm_state = MEI_HBM_IDLE; in mei_hbm_idle()
116 * @dev: the device structure
118 void mei_hbm_reset(struct mei_device *dev) in mei_hbm_reset() argument
120 mei_me_cl_rm_all(dev); in mei_hbm_reset()
122 mei_hbm_idle(dev); in mei_hbm_reset()
162 * @dev: the device structure
170 static inline int mei_hbm_cl_write(struct mei_device *dev, struct mei_cl *cl, in mei_hbm_cl_write() argument
178 return mei_hbm_write_message(dev, &mei_hdr, buf); in mei_hbm_cl_write()
200 * @dev: the device structure
206 struct mei_cl *mei_hbm_cl_find_by_cmd(struct mei_device *dev, void *buf) in mei_hbm_cl_find_by_cmd() argument
211 list_for_each_entry(cl, &dev->file_list, link) in mei_hbm_cl_find_by_cmd()
221 * @dev: the device structure
225 int mei_hbm_start_wait(struct mei_device *dev) in mei_hbm_start_wait() argument
229 if (dev->hbm_state > MEI_HBM_STARTING) in mei_hbm_start_wait()
232 mutex_unlock(&dev->device_lock); in mei_hbm_start_wait()
233 ret = wait_event_timeout(dev->wait_hbm_start, in mei_hbm_start_wait()
234 dev->hbm_state != MEI_HBM_STARTING, in mei_hbm_start_wait()
236 mutex_lock(&dev->device_lock); in mei_hbm_start_wait()
238 if (ret == 0 && (dev->hbm_state <= MEI_HBM_STARTING)) { in mei_hbm_start_wait()
239 dev->hbm_state = MEI_HBM_IDLE; in mei_hbm_start_wait()
240 dev_err(dev->dev, "waiting for mei start failed\n"); in mei_hbm_start_wait()
249 * @dev: the device structure
253 int mei_hbm_start_req(struct mei_device *dev) in mei_hbm_start_req() argument
259 mei_hbm_reset(dev); in mei_hbm_start_req()
269 dev->hbm_state = MEI_HBM_IDLE; in mei_hbm_start_req()
270 ret = mei_hbm_write_message(dev, &mei_hdr, &req); in mei_hbm_start_req()
272 dev_err(dev->dev, "version message write failed: ret = %d\n", in mei_hbm_start_req()
277 dev->hbm_state = MEI_HBM_STARTING; in mei_hbm_start_req()
278 dev->init_clients_timer = MEI_CLIENTS_INIT_TIMEOUT; in mei_hbm_start_req()
279 mei_schedule_stall_timer(dev); in mei_hbm_start_req()
285 * @dev: the device structure
289 static int mei_hbm_dma_setup_req(struct mei_device *dev) in mei_hbm_dma_setup_req() argument
303 paddr = dev->dr_dscr[i].daddr; in mei_hbm_dma_setup_req()
306 req.dma_dscr[i].size = dev->dr_dscr[i].size; in mei_hbm_dma_setup_req()
309 mei_dma_ring_reset(dev); in mei_hbm_dma_setup_req()
311 ret = mei_hbm_write_message(dev, &mei_hdr, &req); in mei_hbm_dma_setup_req()
313 dev_err(dev->dev, "dma setup request write failed: ret = %d.\n", in mei_hbm_dma_setup_req()
318 dev->hbm_state = MEI_HBM_DR_SETUP; in mei_hbm_dma_setup_req()
319 dev->init_clients_timer = MEI_CLIENTS_INIT_TIMEOUT; in mei_hbm_dma_setup_req()
320 mei_schedule_stall_timer(dev); in mei_hbm_dma_setup_req()
327 * @dev: the device structure
331 static int mei_hbm_capabilities_req(struct mei_device *dev) in mei_hbm_capabilities_req() argument
341 if (dev->hbm_f_vt_supported) in mei_hbm_capabilities_req()
343 if (dev->hbm_f_cd_supported) in mei_hbm_capabilities_req()
346 ret = mei_hbm_write_message(dev, &mei_hdr, &req); in mei_hbm_capabilities_req()
348 dev_err(dev->dev, in mei_hbm_capabilities_req()
353 dev->hbm_state = MEI_HBM_CAP_SETUP; in mei_hbm_capabilities_req()
354 dev->init_clients_timer = MEI_CLIENTS_INIT_TIMEOUT; in mei_hbm_capabilities_req()
355 mei_schedule_stall_timer(dev); in mei_hbm_capabilities_req()
362 * @dev: the device structure
366 static int mei_hbm_enum_clients_req(struct mei_device *dev) in mei_hbm_enum_clients_req() argument
377 req.flags |= dev->hbm_f_dc_supported ? MEI_HBM_ENUM_F_ALLOW_ADD : 0; in mei_hbm_enum_clients_req()
378 req.flags |= dev->hbm_f_ie_supported ? in mei_hbm_enum_clients_req()
381 ret = mei_hbm_write_message(dev, &mei_hdr, &req); in mei_hbm_enum_clients_req()
383 dev_err(dev->dev, "enumeration request write failed: ret = %d.\n", in mei_hbm_enum_clients_req()
387 dev->hbm_state = MEI_HBM_ENUM_CLIENTS; in mei_hbm_enum_clients_req()
388 dev->init_clients_timer = MEI_CLIENTS_INIT_TIMEOUT; in mei_hbm_enum_clients_req()
389 mei_schedule_stall_timer(dev); in mei_hbm_enum_clients_req()
396 * @dev: the device structure
402 static int mei_hbm_me_cl_add(struct mei_device *dev, in mei_hbm_me_cl_add() argument
408 mei_me_cl_rm_by_uuid(dev, uuid); in mei_hbm_me_cl_add()
420 mei_me_cl_add(dev, me_cl); in mei_hbm_me_cl_add()
428 * @dev: the device structure
434 static int mei_hbm_add_cl_resp(struct mei_device *dev, u8 addr, u8 status) in mei_hbm_add_cl_resp() argument
440 dev_dbg(dev->dev, "adding client response\n"); in mei_hbm_add_cl_resp()
449 ret = mei_hbm_write_message(dev, &mei_hdr, &resp); in mei_hbm_add_cl_resp()
451 dev_err(dev->dev, "add client response write failed: ret = %d\n", in mei_hbm_add_cl_resp()
459 * @dev: the device structure
464 static int mei_hbm_fw_add_cl_req(struct mei_device *dev, in mei_hbm_fw_add_cl_req() argument
473 ret = mei_hbm_me_cl_add(dev, (struct hbm_props_response *)req); in mei_hbm_fw_add_cl_req()
477 if (dev->dev_state == MEI_DEV_ENABLED) in mei_hbm_fw_add_cl_req()
478 schedule_work(&dev->bus_rescan_work); in mei_hbm_fw_add_cl_req()
480 return mei_hbm_add_cl_resp(dev, req->me_addr, status); in mei_hbm_fw_add_cl_req()
486 * @dev: the device structure
492 int mei_hbm_cl_notify_req(struct mei_device *dev, in mei_hbm_cl_notify_req() argument
505 ret = mei_hbm_write_message(dev, &mei_hdr, &req); in mei_hbm_cl_notify_req()
507 dev_err(dev->dev, "notify request failed: ret = %d\n", ret); in mei_hbm_cl_notify_req()
532 * @dev: the device structure
536 static void mei_hbm_cl_notify_start_res(struct mei_device *dev, in mei_hbm_cl_notify_start_res() argument
543 cl_dbg(dev, cl, "hbm: notify start response status=%d\n", rs->status); in mei_hbm_cl_notify_start_res()
558 * @dev: the device structure
562 static void mei_hbm_cl_notify_stop_res(struct mei_device *dev, in mei_hbm_cl_notify_stop_res() argument
569 cl_dbg(dev, cl, "hbm: notify stop response status=%d\n", rs->status); in mei_hbm_cl_notify_stop_res()
584 * @dev: the device structure
587 static void mei_hbm_cl_notify(struct mei_device *dev, in mei_hbm_cl_notify() argument
592 cl = mei_hbm_cl_find_by_cmd(dev, cmd); in mei_hbm_cl_notify()
600 * @dev: the device structure
605 int mei_hbm_cl_dma_map_req(struct mei_device *dev, struct mei_cl *cl) in mei_hbm_cl_dma_map_req() argument
621 ret = mei_hbm_write_message(dev, &mei_hdr, &req); in mei_hbm_cl_dma_map_req()
623 dev_err(dev->dev, "dma map request failed: ret = %d\n", ret); in mei_hbm_cl_dma_map_req()
631 * @dev: the device structure
636 int mei_hbm_cl_dma_unmap_req(struct mei_device *dev, struct mei_cl *cl) in mei_hbm_cl_dma_unmap_req() argument
649 ret = mei_hbm_write_message(dev, &mei_hdr, &req); in mei_hbm_cl_dma_unmap_req()
651 dev_err(dev->dev, "dma unmap request failed: ret = %d\n", ret); in mei_hbm_cl_dma_unmap_req()
656 static void mei_hbm_cl_dma_map_res(struct mei_device *dev, in mei_hbm_cl_dma_map_res() argument
663 list_for_each_entry_safe(cb, next, &dev->ctrl_rd_list, list) { in mei_hbm_cl_dma_map_res()
675 dev_dbg(dev->dev, "cl dma map result = %d\n", res->status); in mei_hbm_cl_dma_map_res()
682 static void mei_hbm_cl_dma_unmap_res(struct mei_device *dev, in mei_hbm_cl_dma_unmap_res() argument
689 list_for_each_entry_safe(cb, next, &dev->ctrl_rd_list, list) { in mei_hbm_cl_dma_unmap_res()
701 dev_dbg(dev->dev, "cl dma unmap result = %d\n", res->status); in mei_hbm_cl_dma_unmap_res()
711 * @dev: the device structure
716 static int mei_hbm_prop_req(struct mei_device *dev, unsigned long start_idx) in mei_hbm_prop_req() argument
723 addr = find_next_bit(dev->me_clients_map, MEI_CLIENTS_MAX, start_idx); in mei_hbm_prop_req()
727 dev->hbm_state = MEI_HBM_STARTED; in mei_hbm_prop_req()
728 mei_host_client_init(dev); in mei_hbm_prop_req()
739 ret = mei_hbm_write_message(dev, &mei_hdr, &req); in mei_hbm_prop_req()
741 dev_err(dev->dev, "properties request write failed: ret = %d\n", in mei_hbm_prop_req()
746 dev->init_clients_timer = MEI_CLIENTS_INIT_TIMEOUT; in mei_hbm_prop_req()
747 mei_schedule_stall_timer(dev); in mei_hbm_prop_req()
755 * @dev: the device structure
761 int mei_hbm_pg(struct mei_device *dev, u8 pg_cmd) in mei_hbm_pg() argument
767 if (!dev->hbm_f_pg_supported) in mei_hbm_pg()
775 ret = mei_hbm_write_message(dev, &mei_hdr, &req); in mei_hbm_pg()
777 dev_err(dev->dev, "power gate command write failed.\n"); in mei_hbm_pg()
785 * @dev: mei device
789 static int mei_hbm_stop_req(struct mei_device *dev) in mei_hbm_stop_req() argument
800 return mei_hbm_write_message(dev, &mei_hdr, &req); in mei_hbm_stop_req()
806 * @dev: the device structure
811 int mei_hbm_cl_flow_control_req(struct mei_device *dev, struct mei_cl *cl) in mei_hbm_cl_flow_control_req() argument
815 cl_dbg(dev, cl, "sending flow control\n"); in mei_hbm_cl_flow_control_req()
816 return mei_hbm_cl_write(dev, cl, MEI_FLOW_CONTROL_CMD, in mei_hbm_cl_flow_control_req()
823 * @dev: the device structure
828 static int mei_hbm_add_single_tx_flow_ctrl_creds(struct mei_device *dev, in mei_hbm_add_single_tx_flow_ctrl_creds() argument
834 me_cl = mei_me_cl_by_id(dev, fctrl->me_addr); in mei_hbm_add_single_tx_flow_ctrl_creds()
836 dev_err(dev->dev, "no such me client %d\n", fctrl->me_addr); in mei_hbm_add_single_tx_flow_ctrl_creds()
846 dev_dbg(dev->dev, "recv flow ctrl msg ME %d (single) creds = %d.\n", in mei_hbm_add_single_tx_flow_ctrl_creds()
858 * @dev: the device structure
861 static void mei_hbm_cl_tx_flow_ctrl_creds_res(struct mei_device *dev, in mei_hbm_cl_tx_flow_ctrl_creds_res() argument
868 mei_hbm_add_single_tx_flow_ctrl_creds(dev, fctrl); in mei_hbm_cl_tx_flow_ctrl_creds_res()
872 cl = mei_hbm_cl_find_by_cmd(dev, fctrl); in mei_hbm_cl_tx_flow_ctrl_creds_res()
875 cl_dbg(dev, cl, "flow control creds = %d.\n", in mei_hbm_cl_tx_flow_ctrl_creds_res()
884 * @dev: the device structure
889 int mei_hbm_cl_disconnect_req(struct mei_device *dev, struct mei_cl *cl) in mei_hbm_cl_disconnect_req() argument
893 return mei_hbm_cl_write(dev, cl, CLIENT_DISCONNECT_REQ_CMD, in mei_hbm_cl_disconnect_req()
900 * @dev: the device structure
905 int mei_hbm_cl_disconnect_rsp(struct mei_device *dev, struct mei_cl *cl) in mei_hbm_cl_disconnect_rsp() argument
909 return mei_hbm_cl_write(dev, cl, CLIENT_DISCONNECT_RES_CMD, in mei_hbm_cl_disconnect_rsp()
917 * @dev: the device structure
921 static void mei_hbm_cl_disconnect_res(struct mei_device *dev, struct mei_cl *cl, in mei_hbm_cl_disconnect_res() argument
927 cl_dbg(dev, cl, "hbm: disconnect response status=%d\n", rs->status); in mei_hbm_cl_disconnect_res()
937 * @dev: the device structure
942 int mei_hbm_cl_connect_req(struct mei_device *dev, struct mei_cl *cl) in mei_hbm_cl_connect_req() argument
946 return mei_hbm_cl_write(dev, cl, CLIENT_CONNECT_REQ_CMD, in mei_hbm_cl_connect_req()
954 * @dev: the device structure
958 static void mei_hbm_cl_connect_res(struct mei_device *dev, struct mei_cl *cl, in mei_hbm_cl_connect_res() argument
964 cl_dbg(dev, cl, "hbm: connect response status=%s\n", in mei_hbm_cl_connect_res()
972 mei_me_cl_del(dev, cl->me_cl); in mei_hbm_cl_connect_res()
973 if (dev->dev_state == MEI_DEV_ENABLED) in mei_hbm_cl_connect_res()
974 schedule_work(&dev->bus_rescan_work); in mei_hbm_cl_connect_res()
984 * @dev: the device structure
988 static void mei_hbm_cl_res(struct mei_device *dev, in mei_hbm_cl_res() argument
996 list_for_each_entry_safe(cb, next, &dev->ctrl_rd_list, list) { in mei_hbm_cl_res()
1014 mei_hbm_cl_connect_res(dev, cl, rs); in mei_hbm_cl_res()
1017 mei_hbm_cl_disconnect_res(dev, cl, rs); in mei_hbm_cl_res()
1020 mei_hbm_cl_notify_start_res(dev, cl, rs); in mei_hbm_cl_res()
1023 mei_hbm_cl_notify_stop_res(dev, cl, rs); in mei_hbm_cl_res()
1038 * @dev: the device structure.
1043 static int mei_hbm_fw_disconnect_req(struct mei_device *dev, in mei_hbm_fw_disconnect_req() argument
1049 cl = mei_hbm_cl_find_by_cmd(dev, disconnect_req); in mei_hbm_fw_disconnect_req()
1051 cl_warn(dev, cl, "fw disconnect request received\n"); in mei_hbm_fw_disconnect_req()
1066 * @dev: the device structure.
1070 static int mei_hbm_pg_enter_res(struct mei_device *dev) in mei_hbm_pg_enter_res() argument
1072 if (mei_pg_state(dev) != MEI_PG_OFF || in mei_hbm_pg_enter_res()
1073 dev->pg_event != MEI_PG_EVENT_WAIT) { in mei_hbm_pg_enter_res()
1074 dev_err(dev->dev, "hbm: pg entry response: state mismatch [%s, %d]\n", in mei_hbm_pg_enter_res()
1075 mei_pg_state_str(mei_pg_state(dev)), dev->pg_event); in mei_hbm_pg_enter_res()
1079 dev->pg_event = MEI_PG_EVENT_RECEIVED; in mei_hbm_pg_enter_res()
1080 wake_up(&dev->wait_pg); in mei_hbm_pg_enter_res()
1088 * @dev: the device structure.
1090 void mei_hbm_pg_resume(struct mei_device *dev) in mei_hbm_pg_resume() argument
1092 pm_request_resume(dev->dev); in mei_hbm_pg_resume()
1099 * @dev: the device structure.
1103 static int mei_hbm_pg_exit_res(struct mei_device *dev) in mei_hbm_pg_exit_res() argument
1105 if (mei_pg_state(dev) != MEI_PG_ON || in mei_hbm_pg_exit_res()
1106 (dev->pg_event != MEI_PG_EVENT_WAIT && in mei_hbm_pg_exit_res()
1107 dev->pg_event != MEI_PG_EVENT_IDLE)) { in mei_hbm_pg_exit_res()
1108 dev_err(dev->dev, "hbm: pg exit response: state mismatch [%s, %d]\n", in mei_hbm_pg_exit_res()
1109 mei_pg_state_str(mei_pg_state(dev)), dev->pg_event); in mei_hbm_pg_exit_res()
1113 switch (dev->pg_event) { in mei_hbm_pg_exit_res()
1115 dev->pg_event = MEI_PG_EVENT_RECEIVED; in mei_hbm_pg_exit_res()
1116 wake_up(&dev->wait_pg); in mei_hbm_pg_exit_res()
1124 dev->pg_event = MEI_PG_EVENT_RECEIVED; in mei_hbm_pg_exit_res()
1125 mei_hbm_pg_resume(dev); in mei_hbm_pg_exit_res()
1129 dev->pg_event); in mei_hbm_pg_exit_res()
1140 * @dev: the device structure
1142 static void mei_hbm_config_features(struct mei_device *dev) in mei_hbm_config_features() argument
1145 dev->hbm_f_pg_supported = 0; in mei_hbm_config_features()
1146 if (dev->version.major_version > HBM_MAJOR_VERSION_PGI) in mei_hbm_config_features()
1147 dev->hbm_f_pg_supported = 1; in mei_hbm_config_features()
1149 if (dev->version.major_version == HBM_MAJOR_VERSION_PGI && in mei_hbm_config_features()
1150 dev->version.minor_version >= HBM_MINOR_VERSION_PGI) in mei_hbm_config_features()
1151 dev->hbm_f_pg_supported = 1; in mei_hbm_config_features()
1153 dev->hbm_f_dc_supported = 0; in mei_hbm_config_features()
1154 if (dev->version.major_version >= HBM_MAJOR_VERSION_DC) in mei_hbm_config_features()
1155 dev->hbm_f_dc_supported = 1; in mei_hbm_config_features()
1157 dev->hbm_f_ie_supported = 0; in mei_hbm_config_features()
1158 if (dev->version.major_version >= HBM_MAJOR_VERSION_IE) in mei_hbm_config_features()
1159 dev->hbm_f_ie_supported = 1; in mei_hbm_config_features()
1162 dev->hbm_f_dot_supported = 0; in mei_hbm_config_features()
1163 if (dev->version.major_version >= HBM_MAJOR_VERSION_DOT) in mei_hbm_config_features()
1164 dev->hbm_f_dot_supported = 1; in mei_hbm_config_features()
1167 dev->hbm_f_ev_supported = 0; in mei_hbm_config_features()
1168 if (dev->version.major_version >= HBM_MAJOR_VERSION_EV) in mei_hbm_config_features()
1169 dev->hbm_f_ev_supported = 1; in mei_hbm_config_features()
1172 dev->hbm_f_fa_supported = 0; in mei_hbm_config_features()
1173 if (dev->version.major_version >= HBM_MAJOR_VERSION_FA) in mei_hbm_config_features()
1174 dev->hbm_f_fa_supported = 1; in mei_hbm_config_features()
1177 dev->hbm_f_os_supported = 0; in mei_hbm_config_features()
1178 if (dev->version.major_version >= HBM_MAJOR_VERSION_OS) in mei_hbm_config_features()
1179 dev->hbm_f_os_supported = 1; in mei_hbm_config_features()
1182 dev->hbm_f_dr_supported = 0; in mei_hbm_config_features()
1183 if (dev->version.major_version > HBM_MAJOR_VERSION_DR || in mei_hbm_config_features()
1184 (dev->version.major_version == HBM_MAJOR_VERSION_DR && in mei_hbm_config_features()
1185 dev->version.minor_version >= HBM_MINOR_VERSION_DR)) in mei_hbm_config_features()
1186 dev->hbm_f_dr_supported = 1; in mei_hbm_config_features()
1189 dev->hbm_f_vt_supported = 0; in mei_hbm_config_features()
1190 if (dev->version.major_version > HBM_MAJOR_VERSION_VT || in mei_hbm_config_features()
1191 (dev->version.major_version == HBM_MAJOR_VERSION_VT && in mei_hbm_config_features()
1192 dev->version.minor_version >= HBM_MINOR_VERSION_VT)) in mei_hbm_config_features()
1193 dev->hbm_f_vt_supported = 1; in mei_hbm_config_features()
1196 dev->hbm_f_cap_supported = 0; in mei_hbm_config_features()
1197 if (dev->version.major_version > HBM_MAJOR_VERSION_CAP || in mei_hbm_config_features()
1198 (dev->version.major_version == HBM_MAJOR_VERSION_CAP && in mei_hbm_config_features()
1199 dev->version.minor_version >= HBM_MINOR_VERSION_CAP)) in mei_hbm_config_features()
1200 dev->hbm_f_cap_supported = 1; in mei_hbm_config_features()
1203 dev->hbm_f_cd_supported = 0; in mei_hbm_config_features()
1204 if (dev->version.major_version > HBM_MAJOR_VERSION_CD || in mei_hbm_config_features()
1205 (dev->version.major_version == HBM_MAJOR_VERSION_CD && in mei_hbm_config_features()
1206 dev->version.minor_version >= HBM_MINOR_VERSION_CD)) in mei_hbm_config_features()
1207 dev->hbm_f_cd_supported = 1; in mei_hbm_config_features()
1214 * @dev: the device structure
1217 bool mei_hbm_version_is_supported(struct mei_device *dev) in mei_hbm_version_is_supported() argument
1219 return (dev->version.major_version < HBM_MAJOR_VERSION) || in mei_hbm_version_is_supported()
1220 (dev->version.major_version == HBM_MAJOR_VERSION && in mei_hbm_version_is_supported()
1221 dev->version.minor_version <= HBM_MINOR_VERSION); in mei_hbm_version_is_supported()
1228 * @dev: the device structure
1233 int mei_hbm_dispatch(struct mei_device *dev, struct mei_msg_hdr *hdr) in mei_hbm_dispatch() argument
1250 BUG_ON(hdr->length >= sizeof(dev->rd_msg_buf)); in mei_hbm_dispatch()
1251 mei_read_slots(dev, dev->rd_msg_buf, hdr->length); in mei_hbm_dispatch()
1252 mei_msg = (struct mei_bus_message *)dev->rd_msg_buf; in mei_hbm_dispatch()
1258 if (dev->hbm_state == MEI_HBM_IDLE) { in mei_hbm_dispatch()
1259 dev_dbg(dev->dev, "hbm: state is idle ignore spurious messages\n"); in mei_hbm_dispatch()
1265 dev_dbg(dev->dev, "hbm: start: response message received.\n"); in mei_hbm_dispatch()
1267 dev->init_clients_timer = 0; in mei_hbm_dispatch()
1271 dev_dbg(dev->dev, "HBM VERSION: DRIVER=%02d:%02d DEVICE=%02d:%02d\n", in mei_hbm_dispatch()
1277 dev->version.major_version = HBM_MAJOR_VERSION; in mei_hbm_dispatch()
1278 dev->version.minor_version = HBM_MINOR_VERSION; in mei_hbm_dispatch()
1280 dev->version.major_version = in mei_hbm_dispatch()
1282 dev->version.minor_version = in mei_hbm_dispatch()
1286 if (!mei_hbm_version_is_supported(dev)) { in mei_hbm_dispatch()
1287 dev_warn(dev->dev, "hbm: start: version mismatch - stopping the driver.\n"); in mei_hbm_dispatch()
1289 dev->hbm_state = MEI_HBM_STOPPED; in mei_hbm_dispatch()
1290 if (mei_hbm_stop_req(dev)) { in mei_hbm_dispatch()
1291 dev_err(dev->dev, "hbm: start: failed to send stop request\n"); in mei_hbm_dispatch()
1297 mei_hbm_config_features(dev); in mei_hbm_dispatch()
1299 if (dev->dev_state != MEI_DEV_INIT_CLIENTS || in mei_hbm_dispatch()
1300 dev->hbm_state != MEI_HBM_STARTING) { in mei_hbm_dispatch()
1301 if (dev->dev_state == MEI_DEV_POWER_DOWN || in mei_hbm_dispatch()
1302 dev->dev_state == MEI_DEV_POWERING_DOWN) { in mei_hbm_dispatch()
1303 dev_dbg(dev->dev, "hbm: start: on shutdown, ignoring\n"); in mei_hbm_dispatch()
1306 dev_err(dev->dev, "hbm: start: state mismatch, [%d, %d]\n", in mei_hbm_dispatch()
1307 dev->dev_state, dev->hbm_state); in mei_hbm_dispatch()
1311 if (dev->hbm_f_cap_supported) { in mei_hbm_dispatch()
1312 if (mei_hbm_capabilities_req(dev)) in mei_hbm_dispatch()
1314 wake_up(&dev->wait_hbm_start); in mei_hbm_dispatch()
1318 if (dev->hbm_f_dr_supported) { in mei_hbm_dispatch()
1319 if (mei_dmam_ring_alloc(dev)) in mei_hbm_dispatch()
1320 dev_info(dev->dev, "running w/o dma ring\n"); in mei_hbm_dispatch()
1321 if (mei_dma_ring_is_allocated(dev)) { in mei_hbm_dispatch()
1322 if (mei_hbm_dma_setup_req(dev)) in mei_hbm_dispatch()
1325 wake_up(&dev->wait_hbm_start); in mei_hbm_dispatch()
1330 dev->hbm_f_dr_supported = 0; in mei_hbm_dispatch()
1331 mei_dmam_ring_free(dev); in mei_hbm_dispatch()
1333 if (mei_hbm_enum_clients_req(dev)) in mei_hbm_dispatch()
1336 wake_up(&dev->wait_hbm_start); in mei_hbm_dispatch()
1340 dev_dbg(dev->dev, "hbm: capabilities response: message received.\n"); in mei_hbm_dispatch()
1342 dev->init_clients_timer = 0; in mei_hbm_dispatch()
1344 if (dev->dev_state != MEI_DEV_INIT_CLIENTS || in mei_hbm_dispatch()
1345 dev->hbm_state != MEI_HBM_CAP_SETUP) { in mei_hbm_dispatch()
1346 if (dev->dev_state == MEI_DEV_POWER_DOWN) { in mei_hbm_dispatch()
1347 dev_dbg(dev->dev, "hbm: capabilities response: on shutdown, ignoring\n"); in mei_hbm_dispatch()
1350 dev_err(dev->dev, "hbm: capabilities response: state mismatch, [%d, %d]\n", in mei_hbm_dispatch()
1351 dev->dev_state, dev->hbm_state); in mei_hbm_dispatch()
1357 dev->hbm_f_vt_supported = 0; in mei_hbm_dispatch()
1359 dev->hbm_f_cd_supported = 0; in mei_hbm_dispatch()
1361 if (dev->hbm_f_dr_supported) { in mei_hbm_dispatch()
1362 if (mei_dmam_ring_alloc(dev)) in mei_hbm_dispatch()
1363 dev_info(dev->dev, "running w/o dma ring\n"); in mei_hbm_dispatch()
1364 if (mei_dma_ring_is_allocated(dev)) { in mei_hbm_dispatch()
1365 if (mei_hbm_dma_setup_req(dev)) in mei_hbm_dispatch()
1371 dev->hbm_f_dr_supported = 0; in mei_hbm_dispatch()
1372 mei_dmam_ring_free(dev); in mei_hbm_dispatch()
1374 if (mei_hbm_enum_clients_req(dev)) in mei_hbm_dispatch()
1379 dev_dbg(dev->dev, "hbm: dma setup response: message received.\n"); in mei_hbm_dispatch()
1381 dev->init_clients_timer = 0; in mei_hbm_dispatch()
1383 if (dev->dev_state != MEI_DEV_INIT_CLIENTS || in mei_hbm_dispatch()
1384 dev->hbm_state != MEI_HBM_DR_SETUP) { in mei_hbm_dispatch()
1385 if (dev->dev_state == MEI_DEV_POWER_DOWN || in mei_hbm_dispatch()
1386 dev->dev_state == MEI_DEV_POWERING_DOWN) { in mei_hbm_dispatch()
1387 dev_dbg(dev->dev, "hbm: dma setup response: on shutdown, ignoring\n"); in mei_hbm_dispatch()
1390 dev_err(dev->dev, "hbm: dma setup response: state mismatch, [%d, %d]\n", in mei_hbm_dispatch()
1391 dev->dev_state, dev->hbm_state); in mei_hbm_dispatch()
1401 dev_dbg(dev->dev, "hbm: dma setup not allowed\n"); in mei_hbm_dispatch()
1403 dev_info(dev->dev, "hbm: dma setup response: failure = %d %s\n", in mei_hbm_dispatch()
1407 dev->hbm_f_dr_supported = 0; in mei_hbm_dispatch()
1408 mei_dmam_ring_free(dev); in mei_hbm_dispatch()
1411 if (mei_hbm_enum_clients_req(dev)) in mei_hbm_dispatch()
1416 dev_dbg(dev->dev, "hbm: client connect response: message received.\n"); in mei_hbm_dispatch()
1417 mei_hbm_cl_res(dev, cl_cmd, MEI_FOP_CONNECT); in mei_hbm_dispatch()
1421 dev_dbg(dev->dev, "hbm: client disconnect response: message received.\n"); in mei_hbm_dispatch()
1422 mei_hbm_cl_res(dev, cl_cmd, MEI_FOP_DISCONNECT); in mei_hbm_dispatch()
1426 dev_dbg(dev->dev, "hbm: client flow control response: message received.\n"); in mei_hbm_dispatch()
1429 mei_hbm_cl_tx_flow_ctrl_creds_res(dev, fctrl); in mei_hbm_dispatch()
1433 dev_dbg(dev->dev, "hbm: power gate isolation entry response received\n"); in mei_hbm_dispatch()
1434 ret = mei_hbm_pg_enter_res(dev); in mei_hbm_dispatch()
1440 dev_dbg(dev->dev, "hbm: power gate isolation exit request received\n"); in mei_hbm_dispatch()
1441 ret = mei_hbm_pg_exit_res(dev); in mei_hbm_dispatch()
1447 dev_dbg(dev->dev, "hbm: properties response: message received.\n"); in mei_hbm_dispatch()
1449 dev->init_clients_timer = 0; in mei_hbm_dispatch()
1451 if (dev->dev_state != MEI_DEV_INIT_CLIENTS || in mei_hbm_dispatch()
1452 dev->hbm_state != MEI_HBM_CLIENT_PROPERTIES) { in mei_hbm_dispatch()
1453 if (dev->dev_state == MEI_DEV_POWER_DOWN || in mei_hbm_dispatch()
1454 dev->dev_state == MEI_DEV_POWERING_DOWN) { in mei_hbm_dispatch()
1455 dev_dbg(dev->dev, "hbm: properties response: on shutdown, ignoring\n"); in mei_hbm_dispatch()
1458 dev_err(dev->dev, "hbm: properties response: state mismatch, [%d, %d]\n", in mei_hbm_dispatch()
1459 dev->dev_state, dev->hbm_state); in mei_hbm_dispatch()
1466 dev_dbg(dev->dev, "hbm: properties response: %d CLIENT_NOT_FOUND\n", in mei_hbm_dispatch()
1469 dev_err(dev->dev, "hbm: properties response: wrong status = %d %s\n", in mei_hbm_dispatch()
1474 mei_hbm_me_cl_add(dev, props_res); in mei_hbm_dispatch()
1478 if (mei_hbm_prop_req(dev, props_res->me_addr + 1)) in mei_hbm_dispatch()
1484 dev_dbg(dev->dev, "hbm: enumeration response: message received\n"); in mei_hbm_dispatch()
1486 dev->init_clients_timer = 0; in mei_hbm_dispatch()
1489 BUILD_BUG_ON(sizeof(dev->me_clients_map) in mei_hbm_dispatch()
1491 memcpy(dev->me_clients_map, enum_res->valid_addresses, in mei_hbm_dispatch()
1494 if (dev->dev_state != MEI_DEV_INIT_CLIENTS || in mei_hbm_dispatch()
1495 dev->hbm_state != MEI_HBM_ENUM_CLIENTS) { in mei_hbm_dispatch()
1496 if (dev->dev_state == MEI_DEV_POWER_DOWN || in mei_hbm_dispatch()
1497 dev->dev_state == MEI_DEV_POWERING_DOWN) { in mei_hbm_dispatch()
1498 dev_dbg(dev->dev, "hbm: enumeration response: on shutdown, ignoring\n"); in mei_hbm_dispatch()
1501 dev_err(dev->dev, "hbm: enumeration response: state mismatch, [%d, %d]\n", in mei_hbm_dispatch()
1502 dev->dev_state, dev->hbm_state); in mei_hbm_dispatch()
1506 dev->hbm_state = MEI_HBM_CLIENT_PROPERTIES; in mei_hbm_dispatch()
1509 if (mei_hbm_prop_req(dev, 0)) in mei_hbm_dispatch()
1515 dev_dbg(dev->dev, "hbm: stop response: message received\n"); in mei_hbm_dispatch()
1517 dev->init_clients_timer = 0; in mei_hbm_dispatch()
1519 if (dev->hbm_state != MEI_HBM_STOPPED) { in mei_hbm_dispatch()
1520 dev_err(dev->dev, "hbm: stop response: state mismatch, [%d, %d]\n", in mei_hbm_dispatch()
1521 dev->dev_state, dev->hbm_state); in mei_hbm_dispatch()
1525 mei_set_devstate(dev, MEI_DEV_POWER_DOWN); in mei_hbm_dispatch()
1526 dev_info(dev->dev, "hbm: stop response: resetting.\n"); in mei_hbm_dispatch()
1531 dev_dbg(dev->dev, "hbm: disconnect request: message received\n"); in mei_hbm_dispatch()
1534 mei_hbm_fw_disconnect_req(dev, disconnect_req); in mei_hbm_dispatch()
1538 dev_dbg(dev->dev, "hbm: stop request: message received\n"); in mei_hbm_dispatch()
1539 dev->hbm_state = MEI_HBM_STOPPED; in mei_hbm_dispatch()
1540 if (mei_hbm_stop_req(dev)) { in mei_hbm_dispatch()
1541 dev_err(dev->dev, "hbm: stop request: failed to send stop request\n"); in mei_hbm_dispatch()
1547 dev_dbg(dev->dev, "hbm: add client request received\n"); in mei_hbm_dispatch()
1552 if (dev->hbm_state <= MEI_HBM_ENUM_CLIENTS || in mei_hbm_dispatch()
1553 dev->hbm_state >= MEI_HBM_STOPPED) { in mei_hbm_dispatch()
1554 dev_err(dev->dev, "hbm: add client: state mismatch, [%d, %d]\n", in mei_hbm_dispatch()
1555 dev->dev_state, dev->hbm_state); in mei_hbm_dispatch()
1559 ret = mei_hbm_fw_add_cl_req(dev, add_cl_req); in mei_hbm_dispatch()
1561 dev_err(dev->dev, "hbm: add client: failed to send response %d\n", in mei_hbm_dispatch()
1565 dev_dbg(dev->dev, "hbm: add client request processed\n"); in mei_hbm_dispatch()
1569 dev_dbg(dev->dev, "hbm: notify response received\n"); in mei_hbm_dispatch()
1570 mei_hbm_cl_res(dev, cl_cmd, notify_res_to_fop(cl_cmd)); in mei_hbm_dispatch()
1574 dev_dbg(dev->dev, "hbm: notification\n"); in mei_hbm_dispatch()
1575 mei_hbm_cl_notify(dev, cl_cmd); in mei_hbm_dispatch()
1579 dev_dbg(dev->dev, "hbm: client dma map response: message received.\n"); in mei_hbm_dispatch()
1581 mei_hbm_cl_dma_map_res(dev, client_dma_res); in mei_hbm_dispatch()
1585 dev_dbg(dev->dev, "hbm: client dma unmap response: message received.\n"); in mei_hbm_dispatch()
1587 mei_hbm_cl_dma_unmap_res(dev, client_dma_res); in mei_hbm_dispatch()