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.
101 return mei_write_message(dev, hdr, sizeof(*hdr), data, hdr->length); in mei_hbm_write_message()
105 * mei_hbm_idle - set hbm to idle state
111 dev->init_clients_timer = 0; in mei_hbm_idle()
112 dev->hbm_state = MEI_HBM_IDLE; in mei_hbm_idle()
116 * mei_hbm_reset - reset hbm counters and book keeping data structures
128 * mei_hbm_hdr - construct hbm header
137 mei_hdr->length = length; in mei_hbm_hdr()
138 mei_hdr->msg_complete = 1; in mei_hbm_hdr()
142 * mei_hbm_cl_hdr - construct client hbm header
156 cmd->hbm_cmd = hbm_cmd; in mei_hbm_cl_hdr()
157 cmd->host_addr = mei_cl_host_addr(cl); in mei_hbm_cl_hdr()
158 cmd->me_addr = mei_cl_me_id(cl); in mei_hbm_cl_hdr()
162 * mei_hbm_cl_write - write simple hbm client message
184 * mei_hbm_cl_addr_equal - check if the client's and
195 return mei_cl_host_addr(cl) == cmd->host_addr && in mei_hbm_cl_addr_equal()
196 mei_cl_me_id(cl) == cmd->me_addr; in mei_hbm_cl_addr_equal()
200 * mei_hbm_cl_find_by_cmd - find recipient client
213 list_for_each_entry(cl, &dev->file_list, link) in mei_hbm_cl_find_by_cmd()
221 * mei_hbm_start_wait - wait for start response message.
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()
243 return -ETIME; in mei_hbm_start_wait()
249 * mei_hbm_start_req - sends start request message.
271 dev->hbm_state = MEI_HBM_IDLE; 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()
286 * mei_hbm_dma_setup_req() - setup DMA request
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()
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()
327 * mei_hbm_capabilities_req - request capabilities
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()
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()
366 * mei_hbm_enum_clients_req - sends enumeration client request message.
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()
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()
400 * mei_hbm_me_cl_add - add new me client to the list
405 * Return: 0 on success and -ENOMEM on allocation failure
412 const uuid_le *uuid = &res->client_properties.protocol_name; in mei_hbm_me_cl_add()
418 return -ENOMEM; in mei_hbm_me_cl_add()
422 me_cl->props = res->client_properties; in mei_hbm_me_cl_add()
423 me_cl->client_id = res->me_addr; in mei_hbm_me_cl_add()
424 me_cl->tx_flow_ctrl_creds = 0; in mei_hbm_me_cl_add()
432 * mei_hbm_add_cl_resp - send response to fw on client add request
446 dev_dbg(dev->dev, "adding client response\n"); 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()
463 * mei_hbm_fw_add_cl_req - request from the fw to add a client
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()
490 * mei_hbm_cl_notify_req - send notification request
496 * Return: 0 on success and -EIO on write failure
513 dev_err(dev->dev, "notify request failed: ret = %d\n", ret); in mei_hbm_cl_notify_req()
519 * notify_res_to_fop - convert notification response to the proper
531 return mei_cl_notify_req2fop(rs->start); in notify_res_to_fop()
535 * mei_hbm_cl_notify_start_res - update the client state according
549 cl_dbg(dev, cl, "hbm: notify start response status=%d\n", rs->status); in mei_hbm_cl_notify_start_res()
551 if (rs->status == MEI_HBMS_SUCCESS || in mei_hbm_cl_notify_start_res()
552 rs->status == MEI_HBMS_ALREADY_STARTED) { in mei_hbm_cl_notify_start_res()
553 cl->notify_en = true; in mei_hbm_cl_notify_start_res()
554 cl->status = 0; in mei_hbm_cl_notify_start_res()
556 cl->status = -EINVAL; in mei_hbm_cl_notify_start_res()
561 * mei_hbm_cl_notify_stop_res - update the client state according
575 cl_dbg(dev, cl, "hbm: notify stop response status=%d\n", rs->status); in mei_hbm_cl_notify_stop_res()
577 if (rs->status == MEI_HBMS_SUCCESS || in mei_hbm_cl_notify_stop_res()
578 rs->status == MEI_HBMS_NOT_STARTED) { in mei_hbm_cl_notify_stop_res()
579 cl->notify_en = false; in mei_hbm_cl_notify_stop_res()
580 cl->status = 0; in mei_hbm_cl_notify_stop_res()
583 cl->status = -EINVAL; in mei_hbm_cl_notify_stop_res()
588 * mei_hbm_cl_notify - signal notification event
604 * mei_hbm_cl_dma_map_req - send client dma map request
609 * Return: 0 on success and -EIO on write failure
622 req.client_buffer_id = cl->dma.buffer_id; in mei_hbm_cl_dma_map_req()
623 req.address_lsb = lower_32_bits(cl->dma.daddr); in mei_hbm_cl_dma_map_req()
624 req.address_msb = upper_32_bits(cl->dma.daddr); in mei_hbm_cl_dma_map_req()
625 req.size = cl->dma.size; 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()
635 * mei_hbm_cl_dma_unmap_req - send client dma unmap request
640 * Return: 0 on success and -EIO on write failure
653 req.client_buffer_id = cl->dma.buffer_id; 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()
669 list_for_each_entry_safe(cb, next, &dev->ctrl_rd_list, list) { in mei_hbm_cl_dma_map_res()
670 if (cb->fop_type != MEI_FOP_DMA_MAP) in mei_hbm_cl_dma_map_res()
672 if (!cb->cl->dma.buffer_id || cb->cl->dma_mapped) in mei_hbm_cl_dma_map_res()
675 cl = cb->cl; in mei_hbm_cl_dma_map_res()
681 if (res->status) { 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()
683 cl->status = -EFAULT; in mei_hbm_cl_dma_map_res()
685 dev_dbg(dev->dev, "cl dma map succeeded\n"); in mei_hbm_cl_dma_map_res()
686 cl->dma_mapped = 1; in mei_hbm_cl_dma_map_res()
687 cl->status = 0; in mei_hbm_cl_dma_map_res()
689 wake_up(&cl->wait); in mei_hbm_cl_dma_map_res()
699 list_for_each_entry_safe(cb, next, &dev->ctrl_rd_list, list) { in mei_hbm_cl_dma_unmap_res()
700 if (cb->fop_type != MEI_FOP_DMA_UNMAP) in mei_hbm_cl_dma_unmap_res()
702 if (!cb->cl->dma.buffer_id || !cb->cl->dma_mapped) in mei_hbm_cl_dma_unmap_res()
705 cl = cb->cl; in mei_hbm_cl_dma_unmap_res()
711 if (res->status) { 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()
713 cl->status = -EFAULT; in mei_hbm_cl_dma_unmap_res()
715 dev_dbg(dev->dev, "cl dma unmap succeeded\n"); in mei_hbm_cl_dma_unmap_res()
716 cl->dma_mapped = 0; in mei_hbm_cl_dma_unmap_res()
717 cl->status = 0; in mei_hbm_cl_dma_unmap_res()
719 wake_up(&cl->wait); in mei_hbm_cl_dma_unmap_res()
723 * mei_hbm_prop_req - request property for a single client
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()
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()
767 * mei_hbm_pg - sends pg command
772 * Return: -EIO on write failure
773 * -EOPNOTSUPP if the operation is not supported by the protocol
781 if (!dev->hbm_f_pg_supported) in mei_hbm_pg()
782 return -EOPNOTSUPP; in mei_hbm_pg()
791 dev_err(dev->dev, "power gate command write failed.\n"); in mei_hbm_pg()
797 * mei_hbm_stop_req - send stop request message
801 * Return: -EIO on write failure
818 * mei_hbm_cl_flow_control_req - sends flow control request.
823 * Return: -EIO on write failure
835 * mei_hbm_add_single_tx_flow_ctrl_creds - adds single buffer credentials.
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()
851 return -ENOENT; in mei_hbm_add_single_tx_flow_ctrl_creds()
854 if (WARN_ON(me_cl->props.single_recv_buf == 0)) { in mei_hbm_add_single_tx_flow_ctrl_creds()
855 rets = -EINVAL; in mei_hbm_add_single_tx_flow_ctrl_creds()
859 me_cl->tx_flow_ctrl_creds++; 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()
861 fctrl->me_addr, me_cl->tx_flow_ctrl_creds); in mei_hbm_add_single_tx_flow_ctrl_creds()
870 * mei_hbm_cl_tx_flow_ctrl_creds_res - flow control response from me
880 if (!fctrl->host_addr) { in mei_hbm_cl_tx_flow_ctrl_creds_res()
888 cl->tx_flow_ctrl_creds++; in mei_hbm_cl_tx_flow_ctrl_creds_res()
890 cl->tx_flow_ctrl_creds); in mei_hbm_cl_tx_flow_ctrl_creds_res()
896 * mei_hbm_cl_disconnect_req - sends disconnect message to fw.
901 * Return: -EIO on write failure
912 * mei_hbm_cl_disconnect_rsp - sends disconnect response to the FW
917 * Return: -EIO on write failure
928 * mei_hbm_cl_disconnect_res - update the client state according
941 cl_dbg(dev, cl, "hbm: disconnect response status=%d\n", rs->status); in mei_hbm_cl_disconnect_res()
943 if (rs->status == MEI_CL_DISCONN_SUCCESS) in mei_hbm_cl_disconnect_res()
944 cl->state = MEI_FILE_DISCONNECT_REPLY; in mei_hbm_cl_disconnect_res()
945 cl->status = 0; in mei_hbm_cl_disconnect_res()
949 * mei_hbm_cl_connect_req - send connection request to specific me client
954 * Return: -EIO on write failure
965 * mei_hbm_cl_connect_res - update the client state according
979 mei_cl_conn_status_str(rs->status)); in mei_hbm_cl_connect_res()
981 if (rs->status == MEI_CL_CONN_SUCCESS) in mei_hbm_cl_connect_res()
982 cl->state = MEI_FILE_CONNECTED; in mei_hbm_cl_connect_res()
984 cl->state = MEI_FILE_DISCONNECT_REPLY; in mei_hbm_cl_connect_res()
985 if (rs->status == MEI_CL_CONN_NOT_FOUND) { 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()
991 cl->status = mei_cl_conn_status_to_errno(rs->status); in mei_hbm_cl_connect_res()
995 * mei_hbm_cl_res - process hbm response received on behalf
1010 list_for_each_entry_safe(cb, next, &dev->ctrl_rd_list, list) { in mei_hbm_cl_res()
1012 cl = cb->cl; in mei_hbm_cl_res()
1014 if (cb->fop_type != fop_type) in mei_hbm_cl_res()
1018 list_del_init(&cb->list); in mei_hbm_cl_res()
1043 cl->timer_count = 0; in mei_hbm_cl_res()
1044 wake_up(&cl->wait); in mei_hbm_cl_res()
1049 * mei_hbm_fw_disconnect_req - disconnect request initiated by ME firmware
1055 * Return: -ENOMEM on allocation failure
1066 cl->state = MEI_FILE_DISCONNECTING; in mei_hbm_fw_disconnect_req()
1067 cl->timer_count = 0; in mei_hbm_fw_disconnect_req()
1072 return -ENOMEM; in mei_hbm_fw_disconnect_req()
1078 * mei_hbm_pg_enter_res - PG enter response received
1082 * Return: 0 on success, -EPROTO on state mismatch
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()
1090 return -EPROTO; 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()
1100 * mei_hbm_pg_resume - process with PG resume
1106 pm_request_resume(dev->dev); in mei_hbm_pg_resume()
1111 * mei_hbm_pg_exit_res - PG exit response received
1115 * Return: 0 on success, -EPROTO on state mismatch
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()
1124 return -EPROTO; 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()
1143 dev->pg_event); in mei_hbm_pg_exit_res()
1144 return -EPROTO; in mei_hbm_pg_exit_res()
1151 * mei_hbm_config_features - check what hbm features and commands
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()
1231 * mei_hbm_version_is_supported - checks whether the driver can
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()
1245 * mei_hbm_dispatch - bottom half read routine after ISR to
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()
1283 switch (mei_msg->hbm_cmd) { 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()
1293 version_res->me_max_version.major_version, in mei_hbm_dispatch()
1294 version_res->me_max_version.minor_version); in mei_hbm_dispatch()
1296 if (version_res->host_version_supported) { 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()
1301 version_res->me_max_version.major_version; in mei_hbm_dispatch()
1302 dev->version.minor_version = in mei_hbm_dispatch()
1303 version_res->me_max_version.minor_version; 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()
1311 dev_err(dev->dev, "hbm: start: failed to send stop request\n"); in mei_hbm_dispatch()
1312 return -EIO; 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()
1328 return -EPROTO; in mei_hbm_dispatch()
1331 if (dev->hbm_f_cap_supported) { in mei_hbm_dispatch()
1333 return -EIO; 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()
1340 dev_info(dev->dev, "running w/o dma ring\n"); in mei_hbm_dispatch()
1343 return -EIO; 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()
1354 return -EIO; 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()
1373 return -EPROTO; in mei_hbm_dispatch()
1377 if (!(capability_res->capability_granted[0] & HBM_CAP_VT)) in mei_hbm_dispatch()
1378 dev->hbm_f_vt_supported = 0; in mei_hbm_dispatch()
1379 if (!(capability_res->capability_granted[0] & HBM_CAP_CD)) in mei_hbm_dispatch()
1380 dev->hbm_f_cd_supported = 0; in mei_hbm_dispatch()
1382 if (!(capability_res->capability_granted[0] & HBM_CAP_GSC)) 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()
1387 dev_info(dev->dev, "running w/o dma ring\n"); in mei_hbm_dispatch()
1390 return -EIO; in mei_hbm_dispatch()
1395 dev->hbm_f_dr_supported = 0; in mei_hbm_dispatch()
1399 return -EIO; 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()
1416 return -EPROTO; in mei_hbm_dispatch()
1421 if (dma_setup_res->status) { in mei_hbm_dispatch()
1422 u8 status = dma_setup_res->status; 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()
1436 return -EIO; in mei_hbm_dispatch()
1440 dev_dbg(dev->dev, "hbm: client connect response: message received.\n"); in mei_hbm_dispatch()
1445 dev_dbg(dev->dev, "hbm: client disconnect response: message received.\n"); in mei_hbm_dispatch()
1450 dev_dbg(dev->dev, "hbm: client flow control response: message received.\n"); in mei_hbm_dispatch()
1457 dev_dbg(dev->dev, "hbm: power gate isolation entry response received\n"); in mei_hbm_dispatch()
1464 dev_dbg(dev->dev, "hbm: power gate isolation exit request received\n"); 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()
1484 return -EPROTO; in mei_hbm_dispatch()
1489 if (props_res->status == MEI_HBMS_CLIENT_NOT_FOUND) { in mei_hbm_dispatch()
1490 dev_dbg(dev->dev, "hbm: properties response: %d CLIENT_NOT_FOUND\n", in mei_hbm_dispatch()
1491 props_res->me_addr); in mei_hbm_dispatch()
1492 } else if (props_res->status) { in mei_hbm_dispatch()
1493 dev_err(dev->dev, "hbm: properties response: wrong status = %d %s\n", in mei_hbm_dispatch()
1494 props_res->status, in mei_hbm_dispatch()
1495 mei_hbm_status_str(props_res->status)); in mei_hbm_dispatch()
1496 return -EPROTO; in mei_hbm_dispatch()
1502 if (mei_hbm_prop_req(dev, props_res->me_addr + 1)) in mei_hbm_dispatch()
1503 return -EIO; 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()
1514 < sizeof(enum_res->valid_addresses)); in mei_hbm_dispatch()
1515 memcpy(dev->me_clients_map, enum_res->valid_addresses, in mei_hbm_dispatch()
1516 sizeof(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()
1527 return -EPROTO; in mei_hbm_dispatch()
1530 dev->hbm_state = MEI_HBM_CLIENT_PROPERTIES; in mei_hbm_dispatch()
1534 return -EIO; 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()
1546 return -EPROTO; in mei_hbm_dispatch()
1550 dev_info(dev->dev, "hbm: stop response: resetting.\n"); in mei_hbm_dispatch()
1552 return -EPROTO; in mei_hbm_dispatch()
1555 dev_dbg(dev->dev, "hbm: disconnect request: message received\n"); 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()
1565 dev_err(dev->dev, "hbm: stop request: failed to send stop request\n"); in mei_hbm_dispatch()
1566 return -EIO; 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()
1580 return -EPROTO; in mei_hbm_dispatch()
1585 dev_err(dev->dev, "hbm: add client: failed to send response %d\n", in mei_hbm_dispatch()
1587 return -EIO; 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()
1598 dev_dbg(dev->dev, "hbm: notification\n"); in mei_hbm_dispatch()
1603 dev_dbg(dev->dev, "hbm: client dma map response: message received.\n"); in mei_hbm_dispatch()
1609 dev_dbg(dev->dev, "hbm: client dma unmap response: message received.\n"); in mei_hbm_dispatch()
1615 WARN(1, "hbm: wrong command %d\n", mei_msg->hbm_cmd); in mei_hbm_dispatch()
1616 return -EPROTO; in mei_hbm_dispatch()