Lines Matching +full:- +full:eproto
1 // SPDX-License-Identifier: GPL-2.0
3 * Copyright (c) 2003-2022, Intel Corporation. All rights reserved.
68 * mei_cl_conn_status_to_errno - convert client connect response
79 case MEI_CL_CONN_NOT_FOUND: return -ENOTTY; in mei_cl_conn_status_to_errno()
80 case MEI_CL_CONN_ALREADY_STARTED: return -EBUSY; in mei_cl_conn_status_to_errno()
81 case MEI_CL_CONN_OUT_OF_RESOURCES: return -EBUSY; in mei_cl_conn_status_to_errno()
82 case MEI_CL_CONN_MESSAGE_SMALL: return -EINVAL; in mei_cl_conn_status_to_errno()
83 case MEI_CL_CONN_NOT_ALLOWED: return -EBUSY; in mei_cl_conn_status_to_errno()
84 default: return -EINVAL; in mei_cl_conn_status_to_errno()
89 * mei_hbm_write_message - wrapper for sending hbm messages.
99 return mei_write_message(dev, hdr, sizeof(*hdr), data, hdr->length); in mei_hbm_write_message()
103 * mei_hbm_idle - set hbm to idle state
109 dev->init_clients_timer = 0; in mei_hbm_idle()
110 dev->hbm_state = MEI_HBM_IDLE; in mei_hbm_idle()
114 * mei_hbm_reset - reset hbm counters and book keeping data structurs
126 * mei_hbm_hdr - construct hbm header
135 mei_hdr->length = length; in mei_hbm_hdr()
136 mei_hdr->msg_complete = 1; in mei_hbm_hdr()
140 * mei_hbm_cl_hdr - construct client hbm header
154 cmd->hbm_cmd = hbm_cmd; in mei_hbm_cl_hdr()
155 cmd->host_addr = mei_cl_host_addr(cl); in mei_hbm_cl_hdr()
156 cmd->me_addr = mei_cl_me_id(cl); in mei_hbm_cl_hdr()
160 * mei_hbm_cl_write - write simple hbm client message
182 * mei_hbm_cl_addr_equal - check if the client's and
193 return mei_cl_host_addr(cl) == cmd->host_addr && in mei_hbm_cl_addr_equal()
194 mei_cl_me_id(cl) == cmd->me_addr; in mei_hbm_cl_addr_equal()
198 * mei_hbm_cl_find_by_cmd - find recipient client
211 list_for_each_entry(cl, &dev->file_list, link) in mei_hbm_cl_find_by_cmd()
219 * mei_hbm_start_wait - wait for start response message.
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()
235 dev->timeouts.hbm); 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()
241 return -ETIME; in mei_hbm_start_wait()
247 * mei_hbm_start_req - sends start request message.
269 dev->hbm_state = MEI_HBM_IDLE; 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 = dev->timeouts.client_init; in mei_hbm_start_req()
284 * mei_hbm_dma_setup_req() - setup DMA request
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()
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 = dev->timeouts.client_init; in mei_hbm_dma_setup_req()
325 * mei_hbm_capabilities_req - request capabilities
341 if (dev->hbm_f_vt_supported) in mei_hbm_capabilities_req()
343 if (dev->hbm_f_cd_supported) 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 = dev->timeouts.client_init; in mei_hbm_capabilities_req()
360 * mei_hbm_enum_clients_req - sends enumeration client request message.
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()
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 = dev->timeouts.client_init; in mei_hbm_enum_clients_req()
394 * mei_hbm_me_cl_add - add new me client to the list
399 * Return: 0 on success and -ENOMEM on allocation failure
406 const uuid_le *uuid = &res->client_properties.protocol_name; in mei_hbm_me_cl_add()
412 return -ENOMEM; in mei_hbm_me_cl_add()
416 me_cl->props = res->client_properties; in mei_hbm_me_cl_add()
417 me_cl->client_id = res->me_addr; in mei_hbm_me_cl_add()
418 me_cl->tx_flow_ctrl_creds = 0; in mei_hbm_me_cl_add()
426 * mei_hbm_add_cl_resp - send response to fw on client add request
440 dev_dbg(dev->dev, "adding client response\n"); 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()
457 * mei_hbm_fw_add_cl_req - request from the fw to add a client
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()
484 * mei_hbm_cl_notify_req - send notification request
490 * Return: 0 on success and -EIO on write failure
507 dev_err(dev->dev, "notify request failed: ret = %d\n", ret); in mei_hbm_cl_notify_req()
513 * notify_res_to_fop - convert notification response to the proper
525 return mei_cl_notify_req2fop(rs->start); in notify_res_to_fop()
529 * mei_hbm_cl_notify_start_res - update the client state according
543 cl_dbg(dev, cl, "hbm: notify start response status=%d\n", rs->status); in mei_hbm_cl_notify_start_res()
545 if (rs->status == MEI_HBMS_SUCCESS || in mei_hbm_cl_notify_start_res()
546 rs->status == MEI_HBMS_ALREADY_STARTED) { in mei_hbm_cl_notify_start_res()
547 cl->notify_en = true; in mei_hbm_cl_notify_start_res()
548 cl->status = 0; in mei_hbm_cl_notify_start_res()
550 cl->status = -EINVAL; in mei_hbm_cl_notify_start_res()
555 * mei_hbm_cl_notify_stop_res - update the client state according
569 cl_dbg(dev, cl, "hbm: notify stop response status=%d\n", rs->status); in mei_hbm_cl_notify_stop_res()
571 if (rs->status == MEI_HBMS_SUCCESS || in mei_hbm_cl_notify_stop_res()
572 rs->status == MEI_HBMS_NOT_STARTED) { in mei_hbm_cl_notify_stop_res()
573 cl->notify_en = false; in mei_hbm_cl_notify_stop_res()
574 cl->status = 0; in mei_hbm_cl_notify_stop_res()
577 cl->status = -EINVAL; in mei_hbm_cl_notify_stop_res()
582 * mei_hbm_cl_notify - signal notification event
598 * mei_hbm_cl_dma_map_req - send client dma map request
603 * Return: 0 on success and -EIO on write failure
616 req.client_buffer_id = cl->dma.buffer_id; in mei_hbm_cl_dma_map_req()
617 req.address_lsb = lower_32_bits(cl->dma.daddr); in mei_hbm_cl_dma_map_req()
618 req.address_msb = upper_32_bits(cl->dma.daddr); in mei_hbm_cl_dma_map_req()
619 req.size = cl->dma.size; 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()
629 * mei_hbm_cl_dma_unmap_req - send client dma unmap request
634 * Return: 0 on success and -EIO on write failure
647 req.client_buffer_id = cl->dma.buffer_id; 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()
663 list_for_each_entry_safe(cb, next, &dev->ctrl_rd_list, list) { in mei_hbm_cl_dma_map_res()
664 if (cb->fop_type != MEI_FOP_DMA_MAP) in mei_hbm_cl_dma_map_res()
666 if (!cb->cl->dma.buffer_id || cb->cl->dma_mapped) in mei_hbm_cl_dma_map_res()
669 cl = cb->cl; in mei_hbm_cl_dma_map_res()
675 if (res->status) { in mei_hbm_cl_dma_map_res()
676 dev_err(dev->dev, "cl dma map failed %d\n", res->status); in mei_hbm_cl_dma_map_res()
677 cl->status = -EFAULT; in mei_hbm_cl_dma_map_res()
679 dev_dbg(dev->dev, "cl dma map succeeded\n"); in mei_hbm_cl_dma_map_res()
680 cl->dma_mapped = 1; in mei_hbm_cl_dma_map_res()
681 cl->status = 0; in mei_hbm_cl_dma_map_res()
683 wake_up(&cl->wait); in mei_hbm_cl_dma_map_res()
693 list_for_each_entry_safe(cb, next, &dev->ctrl_rd_list, list) { in mei_hbm_cl_dma_unmap_res()
694 if (cb->fop_type != MEI_FOP_DMA_UNMAP) in mei_hbm_cl_dma_unmap_res()
696 if (!cb->cl->dma.buffer_id || !cb->cl->dma_mapped) in mei_hbm_cl_dma_unmap_res()
699 cl = cb->cl; in mei_hbm_cl_dma_unmap_res()
705 if (res->status) { in mei_hbm_cl_dma_unmap_res()
706 dev_err(dev->dev, "cl dma unmap failed %d\n", res->status); in mei_hbm_cl_dma_unmap_res()
707 cl->status = -EFAULT; in mei_hbm_cl_dma_unmap_res()
709 dev_dbg(dev->dev, "cl dma unmap succeeded\n"); in mei_hbm_cl_dma_unmap_res()
710 cl->dma_mapped = 0; in mei_hbm_cl_dma_unmap_res()
711 cl->status = 0; in mei_hbm_cl_dma_unmap_res()
713 wake_up(&cl->wait); in mei_hbm_cl_dma_unmap_res()
717 * mei_hbm_prop_req - request property for a single client
731 addr = find_next_bit(dev->me_clients_map, MEI_CLIENTS_MAX, start_idx); in mei_hbm_prop_req()
735 dev->hbm_state = MEI_HBM_STARTED; in mei_hbm_prop_req()
749 dev_err(dev->dev, "properties request write failed: ret = %d\n", in mei_hbm_prop_req()
754 dev->init_clients_timer = dev->timeouts.client_init; in mei_hbm_prop_req()
761 * mei_hbm_pg - sends pg command
766 * Return: -EIO on write failure
767 * -EOPNOTSUPP if the operation is not supported by the protocol
775 if (!dev->hbm_f_pg_supported) in mei_hbm_pg()
776 return -EOPNOTSUPP; in mei_hbm_pg()
785 dev_err(dev->dev, "power gate command write failed.\n"); in mei_hbm_pg()
791 * mei_hbm_stop_req - send stop request message
795 * Return: -EIO on write failure
812 * mei_hbm_cl_flow_control_req - sends flow control request.
817 * Return: -EIO on write failure
829 * mei_hbm_add_single_tx_flow_ctrl_creds - adds single buffer credentials.
842 me_cl = mei_me_cl_by_id(dev, fctrl->me_addr); in mei_hbm_add_single_tx_flow_ctrl_creds()
844 dev_err(dev->dev, "no such me client %d\n", fctrl->me_addr); in mei_hbm_add_single_tx_flow_ctrl_creds()
845 return -ENOENT; in mei_hbm_add_single_tx_flow_ctrl_creds()
848 if (WARN_ON(me_cl->props.single_recv_buf == 0)) { in mei_hbm_add_single_tx_flow_ctrl_creds()
849 rets = -EINVAL; in mei_hbm_add_single_tx_flow_ctrl_creds()
853 me_cl->tx_flow_ctrl_creds++; in mei_hbm_add_single_tx_flow_ctrl_creds()
854 dev_dbg(dev->dev, "recv flow ctrl msg ME %d (single) creds = %d.\n", in mei_hbm_add_single_tx_flow_ctrl_creds()
855 fctrl->me_addr, me_cl->tx_flow_ctrl_creds); in mei_hbm_add_single_tx_flow_ctrl_creds()
864 * mei_hbm_cl_tx_flow_ctrl_creds_res - flow control response from me
874 if (!fctrl->host_addr) { in mei_hbm_cl_tx_flow_ctrl_creds_res()
882 cl->tx_flow_ctrl_creds++; in mei_hbm_cl_tx_flow_ctrl_creds_res()
884 cl->tx_flow_ctrl_creds); in mei_hbm_cl_tx_flow_ctrl_creds_res()
890 * mei_hbm_cl_disconnect_req - sends disconnect message to fw.
895 * Return: -EIO on write failure
906 * mei_hbm_cl_disconnect_rsp - sends disconnect respose to the FW
911 * Return: -EIO on write failure
922 * mei_hbm_cl_disconnect_res - update the client state according
935 cl_dbg(dev, cl, "hbm: disconnect response status=%d\n", rs->status); in mei_hbm_cl_disconnect_res()
937 if (rs->status == MEI_CL_DISCONN_SUCCESS) in mei_hbm_cl_disconnect_res()
938 cl->state = MEI_FILE_DISCONNECT_REPLY; in mei_hbm_cl_disconnect_res()
939 cl->status = 0; in mei_hbm_cl_disconnect_res()
943 * mei_hbm_cl_connect_req - send connection request to specific me client
948 * Return: -EIO on write failure
959 * mei_hbm_cl_connect_res - update the client state according
973 mei_cl_conn_status_str(rs->status)); in mei_hbm_cl_connect_res()
975 if (rs->status == MEI_CL_CONN_SUCCESS) in mei_hbm_cl_connect_res()
976 cl->state = MEI_FILE_CONNECTED; in mei_hbm_cl_connect_res()
978 cl->state = MEI_FILE_DISCONNECT_REPLY; in mei_hbm_cl_connect_res()
979 if (rs->status == MEI_CL_CONN_NOT_FOUND) { in mei_hbm_cl_connect_res()
980 mei_me_cl_del(dev, cl->me_cl); in mei_hbm_cl_connect_res()
981 if (dev->dev_state == MEI_DEV_ENABLED) in mei_hbm_cl_connect_res()
982 schedule_work(&dev->bus_rescan_work); in mei_hbm_cl_connect_res()
985 cl->status = mei_cl_conn_status_to_errno(rs->status); in mei_hbm_cl_connect_res()
989 * mei_hbm_cl_res - process hbm response received on behalf
1004 list_for_each_entry_safe(cb, next, &dev->ctrl_rd_list, list) { in mei_hbm_cl_res()
1006 cl = cb->cl; in mei_hbm_cl_res()
1008 if (cb->fop_type != fop_type) in mei_hbm_cl_res()
1012 list_del_init(&cb->list); in mei_hbm_cl_res()
1037 cl->timer_count = 0; in mei_hbm_cl_res()
1038 wake_up(&cl->wait); in mei_hbm_cl_res()
1043 * mei_hbm_fw_disconnect_req - disconnect request initiated by ME firmware
1049 * Return: -ENOMEM on allocation failure
1060 cl->state = MEI_FILE_DISCONNECTING; in mei_hbm_fw_disconnect_req()
1061 cl->timer_count = 0; in mei_hbm_fw_disconnect_req()
1066 return -ENOMEM; in mei_hbm_fw_disconnect_req()
1072 * mei_hbm_pg_enter_res - PG enter response received
1076 * Return: 0 on success, -EPROTO on state mismatch
1081 dev->pg_event != MEI_PG_EVENT_WAIT) { in mei_hbm_pg_enter_res()
1082 dev_err(dev->dev, "hbm: pg entry response: state mismatch [%s, %d]\n", in mei_hbm_pg_enter_res()
1083 mei_pg_state_str(mei_pg_state(dev)), dev->pg_event); in mei_hbm_pg_enter_res()
1084 return -EPROTO; in mei_hbm_pg_enter_res()
1087 dev->pg_event = MEI_PG_EVENT_RECEIVED; in mei_hbm_pg_enter_res()
1088 wake_up(&dev->wait_pg); in mei_hbm_pg_enter_res()
1094 * mei_hbm_pg_resume - process with PG resume
1100 pm_request_resume(dev->dev); in mei_hbm_pg_resume()
1105 * mei_hbm_pg_exit_res - PG exit response received
1109 * Return: 0 on success, -EPROTO on state mismatch
1114 (dev->pg_event != MEI_PG_EVENT_WAIT && in mei_hbm_pg_exit_res()
1115 dev->pg_event != MEI_PG_EVENT_IDLE)) { in mei_hbm_pg_exit_res()
1116 dev_err(dev->dev, "hbm: pg exit response: state mismatch [%s, %d]\n", in mei_hbm_pg_exit_res()
1117 mei_pg_state_str(mei_pg_state(dev)), dev->pg_event); in mei_hbm_pg_exit_res()
1118 return -EPROTO; in mei_hbm_pg_exit_res()
1121 switch (dev->pg_event) { in mei_hbm_pg_exit_res()
1123 dev->pg_event = MEI_PG_EVENT_RECEIVED; in mei_hbm_pg_exit_res()
1124 wake_up(&dev->wait_pg); in mei_hbm_pg_exit_res()
1132 dev->pg_event = MEI_PG_EVENT_RECEIVED; in mei_hbm_pg_exit_res()
1137 dev->pg_event); in mei_hbm_pg_exit_res()
1138 return -EPROTO; in mei_hbm_pg_exit_res()
1145 * mei_hbm_config_features - check what hbm features and commands
1153 dev->hbm_f_pg_supported = 0; in mei_hbm_config_features()
1154 if (dev->version.major_version > HBM_MAJOR_VERSION_PGI) in mei_hbm_config_features()
1155 dev->hbm_f_pg_supported = 1; in mei_hbm_config_features()
1157 if (dev->version.major_version == HBM_MAJOR_VERSION_PGI && in mei_hbm_config_features()
1158 dev->version.minor_version >= HBM_MINOR_VERSION_PGI) in mei_hbm_config_features()
1159 dev->hbm_f_pg_supported = 1; in mei_hbm_config_features()
1161 dev->hbm_f_dc_supported = 0; in mei_hbm_config_features()
1162 if (dev->version.major_version >= HBM_MAJOR_VERSION_DC) in mei_hbm_config_features()
1163 dev->hbm_f_dc_supported = 1; in mei_hbm_config_features()
1165 dev->hbm_f_ie_supported = 0; in mei_hbm_config_features()
1166 if (dev->version.major_version >= HBM_MAJOR_VERSION_IE) in mei_hbm_config_features()
1167 dev->hbm_f_ie_supported = 1; in mei_hbm_config_features()
1170 dev->hbm_f_dot_supported = 0; in mei_hbm_config_features()
1171 if (dev->version.major_version >= HBM_MAJOR_VERSION_DOT) in mei_hbm_config_features()
1172 dev->hbm_f_dot_supported = 1; in mei_hbm_config_features()
1175 dev->hbm_f_ev_supported = 0; in mei_hbm_config_features()
1176 if (dev->version.major_version >= HBM_MAJOR_VERSION_EV) in mei_hbm_config_features()
1177 dev->hbm_f_ev_supported = 1; in mei_hbm_config_features()
1180 dev->hbm_f_fa_supported = 0; in mei_hbm_config_features()
1181 if (dev->version.major_version >= HBM_MAJOR_VERSION_FA) in mei_hbm_config_features()
1182 dev->hbm_f_fa_supported = 1; in mei_hbm_config_features()
1185 dev->hbm_f_os_supported = 0; in mei_hbm_config_features()
1186 if (dev->version.major_version >= HBM_MAJOR_VERSION_OS) in mei_hbm_config_features()
1187 dev->hbm_f_os_supported = 1; in mei_hbm_config_features()
1190 dev->hbm_f_dr_supported = 0; in mei_hbm_config_features()
1191 if (dev->version.major_version > HBM_MAJOR_VERSION_DR || in mei_hbm_config_features()
1192 (dev->version.major_version == HBM_MAJOR_VERSION_DR && in mei_hbm_config_features()
1193 dev->version.minor_version >= HBM_MINOR_VERSION_DR)) in mei_hbm_config_features()
1194 dev->hbm_f_dr_supported = 1; in mei_hbm_config_features()
1197 dev->hbm_f_vt_supported = 0; in mei_hbm_config_features()
1198 if (dev->version.major_version > HBM_MAJOR_VERSION_VT || in mei_hbm_config_features()
1199 (dev->version.major_version == HBM_MAJOR_VERSION_VT && in mei_hbm_config_features()
1200 dev->version.minor_version >= HBM_MINOR_VERSION_VT)) in mei_hbm_config_features()
1201 dev->hbm_f_vt_supported = 1; in mei_hbm_config_features()
1204 dev->hbm_f_cap_supported = 0; in mei_hbm_config_features()
1205 if (dev->version.major_version > HBM_MAJOR_VERSION_CAP || in mei_hbm_config_features()
1206 (dev->version.major_version == HBM_MAJOR_VERSION_CAP && in mei_hbm_config_features()
1207 dev->version.minor_version >= HBM_MINOR_VERSION_CAP)) in mei_hbm_config_features()
1208 dev->hbm_f_cap_supported = 1; in mei_hbm_config_features()
1211 dev->hbm_f_cd_supported = 0; in mei_hbm_config_features()
1212 if (dev->version.major_version > HBM_MAJOR_VERSION_CD || in mei_hbm_config_features()
1213 (dev->version.major_version == HBM_MAJOR_VERSION_CD && in mei_hbm_config_features()
1214 dev->version.minor_version >= HBM_MINOR_VERSION_CD)) in mei_hbm_config_features()
1215 dev->hbm_f_cd_supported = 1; in mei_hbm_config_features()
1219 * mei_hbm_version_is_supported - checks whether the driver can
1227 return (dev->version.major_version < HBM_MAJOR_VERSION) || in mei_hbm_version_is_supported()
1228 (dev->version.major_version == HBM_MAJOR_VERSION && in mei_hbm_version_is_supported()
1229 dev->version.minor_version <= HBM_MINOR_VERSION); in mei_hbm_version_is_supported()
1233 * mei_hbm_dispatch - bottom half read routine after ISR to
1258 BUG_ON(hdr->length >= sizeof(dev->rd_msg_buf)); in mei_hbm_dispatch()
1259 mei_read_slots(dev, dev->rd_msg_buf, hdr->length); in mei_hbm_dispatch()
1260 mei_msg = (struct mei_bus_message *)dev->rd_msg_buf; in mei_hbm_dispatch()
1266 if (dev->hbm_state == MEI_HBM_IDLE) { in mei_hbm_dispatch()
1267 dev_dbg(dev->dev, "hbm: state is idle ignore spurious messages\n"); in mei_hbm_dispatch()
1271 switch (mei_msg->hbm_cmd) { in mei_hbm_dispatch()
1273 dev_dbg(dev->dev, "hbm: start: response message received.\n"); in mei_hbm_dispatch()
1275 dev->init_clients_timer = 0; in mei_hbm_dispatch()
1279 dev_dbg(dev->dev, "HBM VERSION: DRIVER=%02d:%02d DEVICE=%02d:%02d\n", in mei_hbm_dispatch()
1281 version_res->me_max_version.major_version, in mei_hbm_dispatch()
1282 version_res->me_max_version.minor_version); in mei_hbm_dispatch()
1284 if (version_res->host_version_supported) { in mei_hbm_dispatch()
1285 dev->version.major_version = HBM_MAJOR_VERSION; in mei_hbm_dispatch()
1286 dev->version.minor_version = HBM_MINOR_VERSION; in mei_hbm_dispatch()
1288 dev->version.major_version = in mei_hbm_dispatch()
1289 version_res->me_max_version.major_version; in mei_hbm_dispatch()
1290 dev->version.minor_version = in mei_hbm_dispatch()
1291 version_res->me_max_version.minor_version; in mei_hbm_dispatch()
1295 dev_warn(dev->dev, "hbm: start: version mismatch - stopping the driver.\n"); in mei_hbm_dispatch()
1297 dev->hbm_state = MEI_HBM_STOPPED; in mei_hbm_dispatch()
1299 dev_err(dev->dev, "hbm: start: failed to send stop request\n"); in mei_hbm_dispatch()
1300 return -EIO; in mei_hbm_dispatch()
1307 if (dev->dev_state != MEI_DEV_INIT_CLIENTS || in mei_hbm_dispatch()
1308 dev->hbm_state != MEI_HBM_STARTING) { in mei_hbm_dispatch()
1309 if (dev->dev_state == MEI_DEV_POWER_DOWN || in mei_hbm_dispatch()
1310 dev->dev_state == MEI_DEV_POWERING_DOWN) { in mei_hbm_dispatch()
1311 dev_dbg(dev->dev, "hbm: start: on shutdown, ignoring\n"); in mei_hbm_dispatch()
1314 dev_err(dev->dev, "hbm: start: state mismatch, [%d, %d]\n", in mei_hbm_dispatch()
1315 dev->dev_state, dev->hbm_state); in mei_hbm_dispatch()
1316 return -EPROTO; in mei_hbm_dispatch()
1319 if (dev->hbm_f_cap_supported) { in mei_hbm_dispatch()
1321 return -EIO; in mei_hbm_dispatch()
1322 wake_up(&dev->wait_hbm_start); in mei_hbm_dispatch()
1326 if (dev->hbm_f_dr_supported) { in mei_hbm_dispatch()
1328 dev_info(dev->dev, "running w/o dma ring\n"); in mei_hbm_dispatch()
1331 return -EIO; in mei_hbm_dispatch()
1333 wake_up(&dev->wait_hbm_start); in mei_hbm_dispatch()
1338 dev->hbm_f_dr_supported = 0; in mei_hbm_dispatch()
1342 return -EIO; in mei_hbm_dispatch()
1344 wake_up(&dev->wait_hbm_start); in mei_hbm_dispatch()
1348 dev_dbg(dev->dev, "hbm: capabilities response: message received.\n"); in mei_hbm_dispatch()
1350 dev->init_clients_timer = 0; in mei_hbm_dispatch()
1352 if (dev->dev_state != MEI_DEV_INIT_CLIENTS || in mei_hbm_dispatch()
1353 dev->hbm_state != MEI_HBM_CAP_SETUP) { in mei_hbm_dispatch()
1354 if (dev->dev_state == MEI_DEV_POWER_DOWN || in mei_hbm_dispatch()
1355 dev->dev_state == MEI_DEV_POWERING_DOWN) { in mei_hbm_dispatch()
1356 dev_dbg(dev->dev, "hbm: capabilities response: on shutdown, ignoring\n"); in mei_hbm_dispatch()
1359 dev_err(dev->dev, "hbm: capabilities response: state mismatch, [%d, %d]\n", in mei_hbm_dispatch()
1360 dev->dev_state, dev->hbm_state); in mei_hbm_dispatch()
1361 return -EPROTO; in mei_hbm_dispatch()
1365 if (!(capability_res->capability_granted[0] & HBM_CAP_VT)) in mei_hbm_dispatch()
1366 dev->hbm_f_vt_supported = 0; in mei_hbm_dispatch()
1367 if (!(capability_res->capability_granted[0] & HBM_CAP_CD)) in mei_hbm_dispatch()
1368 dev->hbm_f_cd_supported = 0; in mei_hbm_dispatch()
1370 if (dev->hbm_f_dr_supported) { in mei_hbm_dispatch()
1372 dev_info(dev->dev, "running w/o dma ring\n"); in mei_hbm_dispatch()
1375 return -EIO; in mei_hbm_dispatch()
1380 dev->hbm_f_dr_supported = 0; in mei_hbm_dispatch()
1384 return -EIO; in mei_hbm_dispatch()
1388 dev_dbg(dev->dev, "hbm: dma setup response: message received.\n"); in mei_hbm_dispatch()
1390 dev->init_clients_timer = 0; in mei_hbm_dispatch()
1392 if (dev->dev_state != MEI_DEV_INIT_CLIENTS || in mei_hbm_dispatch()
1393 dev->hbm_state != MEI_HBM_DR_SETUP) { in mei_hbm_dispatch()
1394 if (dev->dev_state == MEI_DEV_POWER_DOWN || in mei_hbm_dispatch()
1395 dev->dev_state == MEI_DEV_POWERING_DOWN) { in mei_hbm_dispatch()
1396 dev_dbg(dev->dev, "hbm: dma setup response: on shutdown, ignoring\n"); in mei_hbm_dispatch()
1399 dev_err(dev->dev, "hbm: dma setup response: state mismatch, [%d, %d]\n", in mei_hbm_dispatch()
1400 dev->dev_state, dev->hbm_state); in mei_hbm_dispatch()
1401 return -EPROTO; in mei_hbm_dispatch()
1406 if (dma_setup_res->status) { in mei_hbm_dispatch()
1407 u8 status = dma_setup_res->status; in mei_hbm_dispatch()
1410 dev_dbg(dev->dev, "hbm: dma setup not allowed\n"); in mei_hbm_dispatch()
1412 dev_info(dev->dev, "hbm: dma setup response: failure = %d %s\n", in mei_hbm_dispatch()
1416 dev->hbm_f_dr_supported = 0; in mei_hbm_dispatch()
1421 return -EIO; in mei_hbm_dispatch()
1425 dev_dbg(dev->dev, "hbm: client connect response: message received.\n"); in mei_hbm_dispatch()
1430 dev_dbg(dev->dev, "hbm: client disconnect response: message received.\n"); in mei_hbm_dispatch()
1435 dev_dbg(dev->dev, "hbm: client flow control response: message received.\n"); in mei_hbm_dispatch()
1442 dev_dbg(dev->dev, "hbm: power gate isolation entry response received\n"); in mei_hbm_dispatch()
1449 dev_dbg(dev->dev, "hbm: power gate isolation exit request received\n"); in mei_hbm_dispatch()
1456 dev_dbg(dev->dev, "hbm: properties response: message received.\n"); in mei_hbm_dispatch()
1458 dev->init_clients_timer = 0; in mei_hbm_dispatch()
1460 if (dev->dev_state != MEI_DEV_INIT_CLIENTS || in mei_hbm_dispatch()
1461 dev->hbm_state != MEI_HBM_CLIENT_PROPERTIES) { in mei_hbm_dispatch()
1462 if (dev->dev_state == MEI_DEV_POWER_DOWN || in mei_hbm_dispatch()
1463 dev->dev_state == MEI_DEV_POWERING_DOWN) { in mei_hbm_dispatch()
1464 dev_dbg(dev->dev, "hbm: properties response: on shutdown, ignoring\n"); in mei_hbm_dispatch()
1467 dev_err(dev->dev, "hbm: properties response: state mismatch, [%d, %d]\n", in mei_hbm_dispatch()
1468 dev->dev_state, dev->hbm_state); in mei_hbm_dispatch()
1469 return -EPROTO; in mei_hbm_dispatch()
1474 if (props_res->status == MEI_HBMS_CLIENT_NOT_FOUND) { in mei_hbm_dispatch()
1475 dev_dbg(dev->dev, "hbm: properties response: %d CLIENT_NOT_FOUND\n", in mei_hbm_dispatch()
1476 props_res->me_addr); in mei_hbm_dispatch()
1477 } else if (props_res->status) { in mei_hbm_dispatch()
1478 dev_err(dev->dev, "hbm: properties response: wrong status = %d %s\n", in mei_hbm_dispatch()
1479 props_res->status, in mei_hbm_dispatch()
1480 mei_hbm_status_str(props_res->status)); in mei_hbm_dispatch()
1481 return -EPROTO; in mei_hbm_dispatch()
1487 if (mei_hbm_prop_req(dev, props_res->me_addr + 1)) in mei_hbm_dispatch()
1488 return -EIO; in mei_hbm_dispatch()
1493 dev_dbg(dev->dev, "hbm: enumeration response: message received\n"); in mei_hbm_dispatch()
1495 dev->init_clients_timer = 0; in mei_hbm_dispatch()
1498 BUILD_BUG_ON(sizeof(dev->me_clients_map) in mei_hbm_dispatch()
1499 < sizeof(enum_res->valid_addresses)); in mei_hbm_dispatch()
1500 memcpy(dev->me_clients_map, enum_res->valid_addresses, in mei_hbm_dispatch()
1501 sizeof(enum_res->valid_addresses)); in mei_hbm_dispatch()
1503 if (dev->dev_state != MEI_DEV_INIT_CLIENTS || in mei_hbm_dispatch()
1504 dev->hbm_state != MEI_HBM_ENUM_CLIENTS) { in mei_hbm_dispatch()
1505 if (dev->dev_state == MEI_DEV_POWER_DOWN || in mei_hbm_dispatch()
1506 dev->dev_state == MEI_DEV_POWERING_DOWN) { in mei_hbm_dispatch()
1507 dev_dbg(dev->dev, "hbm: enumeration response: on shutdown, ignoring\n"); in mei_hbm_dispatch()
1510 dev_err(dev->dev, "hbm: enumeration response: state mismatch, [%d, %d]\n", in mei_hbm_dispatch()
1511 dev->dev_state, dev->hbm_state); in mei_hbm_dispatch()
1512 return -EPROTO; in mei_hbm_dispatch()
1515 dev->hbm_state = MEI_HBM_CLIENT_PROPERTIES; in mei_hbm_dispatch()
1519 return -EIO; in mei_hbm_dispatch()
1524 dev_dbg(dev->dev, "hbm: stop response: message received\n"); in mei_hbm_dispatch()
1526 dev->init_clients_timer = 0; in mei_hbm_dispatch()
1528 if (dev->hbm_state != MEI_HBM_STOPPED) { in mei_hbm_dispatch()
1529 dev_err(dev->dev, "hbm: stop response: state mismatch, [%d, %d]\n", in mei_hbm_dispatch()
1530 dev->dev_state, dev->hbm_state); in mei_hbm_dispatch()
1531 return -EPROTO; in mei_hbm_dispatch()
1535 dev_info(dev->dev, "hbm: stop response: resetting.\n"); in mei_hbm_dispatch()
1537 return -EPROTO; in mei_hbm_dispatch()
1540 dev_dbg(dev->dev, "hbm: disconnect request: message received\n"); in mei_hbm_dispatch()
1547 dev_dbg(dev->dev, "hbm: stop request: message received\n"); in mei_hbm_dispatch()
1548 dev->hbm_state = MEI_HBM_STOPPED; in mei_hbm_dispatch()
1550 dev_err(dev->dev, "hbm: stop request: failed to send stop request\n"); in mei_hbm_dispatch()
1551 return -EIO; in mei_hbm_dispatch()
1556 dev_dbg(dev->dev, "hbm: add client request received\n"); in mei_hbm_dispatch()
1561 if (dev->hbm_state <= MEI_HBM_ENUM_CLIENTS || in mei_hbm_dispatch()
1562 dev->hbm_state >= MEI_HBM_STOPPED) { in mei_hbm_dispatch()
1563 dev_err(dev->dev, "hbm: add client: state mismatch, [%d, %d]\n", in mei_hbm_dispatch()
1564 dev->dev_state, dev->hbm_state); in mei_hbm_dispatch()
1565 return -EPROTO; in mei_hbm_dispatch()
1570 dev_err(dev->dev, "hbm: add client: failed to send response %d\n", in mei_hbm_dispatch()
1572 return -EIO; in mei_hbm_dispatch()
1574 dev_dbg(dev->dev, "hbm: add client request processed\n"); in mei_hbm_dispatch()
1578 dev_dbg(dev->dev, "hbm: notify response received\n"); in mei_hbm_dispatch()
1583 dev_dbg(dev->dev, "hbm: notification\n"); in mei_hbm_dispatch()
1588 dev_dbg(dev->dev, "hbm: client dma map response: message received.\n"); in mei_hbm_dispatch()
1594 dev_dbg(dev->dev, "hbm: client dma unmap response: message received.\n"); in mei_hbm_dispatch()
1600 WARN(1, "hbm: wrong command %d\n", mei_msg->hbm_cmd); in mei_hbm_dispatch()
1601 return -EPROTO; in mei_hbm_dispatch()