hbm.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669
  1. /*
  2. *
  3. * Intel Management Engine Interface (Intel MEI) Linux driver
  4. * Copyright (c) 2003-2012, Intel Corporation.
  5. *
  6. * This program is free software; you can redistribute it and/or modify it
  7. * under the terms and conditions of the GNU General Public License,
  8. * version 2, as published by the Free Software Foundation.
  9. *
  10. * This program is distributed in the hope it will be useful, but WITHOUT
  11. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  12. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  13. * more details.
  14. *
  15. */
  16. #include <linux/pci.h>
  17. #include <linux/sched.h>
  18. #include <linux/wait.h>
  19. #include <linux/mei.h>
  20. #include "mei_dev.h"
  21. #include "hbm.h"
  22. #include "hw-me.h"
  23. /**
  24. * mei_hbm_me_cl_allocate - allocates storage for me clients
  25. *
  26. * @dev: the device structure
  27. *
  28. * returns none.
  29. */
  30. static void mei_hbm_me_cl_allocate(struct mei_device *dev)
  31. {
  32. struct mei_me_client *clients;
  33. int b;
  34. /* count how many ME clients we have */
  35. for_each_set_bit(b, dev->me_clients_map, MEI_CLIENTS_MAX)
  36. dev->me_clients_num++;
  37. if (dev->me_clients_num <= 0)
  38. return;
  39. kfree(dev->me_clients);
  40. dev->me_clients = NULL;
  41. dev_dbg(&dev->pdev->dev, "memory allocation for ME clients size=%zd.\n",
  42. dev->me_clients_num * sizeof(struct mei_me_client));
  43. /* allocate storage for ME clients representation */
  44. clients = kcalloc(dev->me_clients_num,
  45. sizeof(struct mei_me_client), GFP_KERNEL);
  46. if (!clients) {
  47. dev_err(&dev->pdev->dev, "memory allocation for ME clients failed.\n");
  48. dev->dev_state = MEI_DEV_RESETING;
  49. mei_reset(dev, 1);
  50. return;
  51. }
  52. dev->me_clients = clients;
  53. return;
  54. }
  55. /**
  56. * mei_hbm_cl_hdr - construct client hbm header
  57. * @cl: - client
  58. * @hbm_cmd: host bus message command
  59. * @buf: buffer for cl header
  60. * @len: buffer length
  61. */
  62. static inline
  63. void mei_hbm_cl_hdr(struct mei_cl *cl, u8 hbm_cmd, void *buf, size_t len)
  64. {
  65. struct mei_hbm_cl_cmd *cmd = buf;
  66. memset(cmd, 0, len);
  67. cmd->hbm_cmd = hbm_cmd;
  68. cmd->host_addr = cl->host_client_id;
  69. cmd->me_addr = cl->me_client_id;
  70. }
  71. /**
  72. * same_disconn_addr - tells if they have the same address
  73. *
  74. * @file: private data of the file object.
  75. * @disconn: disconnection request.
  76. *
  77. * returns true if addres are same
  78. */
  79. static inline
  80. bool mei_hbm_cl_addr_equal(struct mei_cl *cl, void *buf)
  81. {
  82. struct mei_hbm_cl_cmd *cmd = buf;
  83. return cl->host_client_id == cmd->host_addr &&
  84. cl->me_client_id == cmd->me_addr;
  85. }
  86. /**
  87. * is_treat_specially_client - checks if the message belongs
  88. * to the file private data.
  89. *
  90. * @cl: private data of the file object
  91. * @rs: connect response bus message
  92. *
  93. */
  94. static bool is_treat_specially_client(struct mei_cl *cl,
  95. struct hbm_client_connect_response *rs)
  96. {
  97. if (mei_hbm_cl_addr_equal(cl, rs)) {
  98. if (!rs->status) {
  99. cl->state = MEI_FILE_CONNECTED;
  100. cl->status = 0;
  101. } else {
  102. cl->state = MEI_FILE_DISCONNECTED;
  103. cl->status = -ENODEV;
  104. }
  105. cl->timer_count = 0;
  106. return true;
  107. }
  108. return false;
  109. }
  110. /**
  111. * mei_hbm_start_req - sends start request message.
  112. *
  113. * @dev: the device structure
  114. */
  115. void mei_hbm_start_req(struct mei_device *dev)
  116. {
  117. struct mei_msg_hdr *mei_hdr = &dev->wr_msg.hdr;
  118. struct hbm_host_version_request *start_req;
  119. const size_t len = sizeof(struct hbm_host_version_request);
  120. mei_hbm_hdr(mei_hdr, len);
  121. /* host start message */
  122. start_req = (struct hbm_host_version_request *)dev->wr_msg.data;
  123. memset(start_req, 0, len);
  124. start_req->hbm_cmd = HOST_START_REQ_CMD;
  125. start_req->host_version.major_version = HBM_MAJOR_VERSION;
  126. start_req->host_version.minor_version = HBM_MINOR_VERSION;
  127. dev->recvd_msg = false;
  128. if (mei_write_message(dev, mei_hdr, dev->wr_msg.data)) {
  129. dev_dbg(&dev->pdev->dev, "write send version message to FW fail.\n");
  130. dev->dev_state = MEI_DEV_RESETING;
  131. mei_reset(dev, 1);
  132. }
  133. dev->init_clients_state = MEI_START_MESSAGE;
  134. dev->init_clients_timer = MEI_CLIENTS_INIT_TIMEOUT;
  135. return ;
  136. }
  137. /**
  138. * mei_hbm_enum_clients_req - sends enumeration client request message.
  139. *
  140. * @dev: the device structure
  141. *
  142. * returns none.
  143. */
  144. static void mei_hbm_enum_clients_req(struct mei_device *dev)
  145. {
  146. struct mei_msg_hdr *mei_hdr = &dev->wr_msg.hdr;
  147. struct hbm_host_enum_request *enum_req;
  148. const size_t len = sizeof(struct hbm_host_enum_request);
  149. /* enumerate clients */
  150. mei_hbm_hdr(mei_hdr, len);
  151. enum_req = (struct hbm_host_enum_request *)dev->wr_msg.data;
  152. memset(enum_req, 0, len);
  153. enum_req->hbm_cmd = HOST_ENUM_REQ_CMD;
  154. if (mei_write_message(dev, mei_hdr, dev->wr_msg.data)) {
  155. dev->dev_state = MEI_DEV_RESETING;
  156. dev_dbg(&dev->pdev->dev, "write send enumeration request message to FW fail.\n");
  157. mei_reset(dev, 1);
  158. }
  159. dev->init_clients_state = MEI_ENUM_CLIENTS_MESSAGE;
  160. dev->init_clients_timer = MEI_CLIENTS_INIT_TIMEOUT;
  161. return;
  162. }
  163. /**
  164. * mei_hbm_prop_requsest - request property for a single client
  165. *
  166. * @dev: the device structure
  167. *
  168. * returns none.
  169. */
  170. static int mei_hbm_prop_req(struct mei_device *dev)
  171. {
  172. struct mei_msg_hdr *mei_hdr = &dev->wr_msg.hdr;
  173. struct hbm_props_request *prop_req;
  174. const size_t len = sizeof(struct hbm_props_request);
  175. unsigned long next_client_index;
  176. u8 client_num;
  177. client_num = dev->me_client_presentation_num;
  178. next_client_index = find_next_bit(dev->me_clients_map, MEI_CLIENTS_MAX,
  179. dev->me_client_index);
  180. /* We got all client properties */
  181. if (next_client_index == MEI_CLIENTS_MAX) {
  182. schedule_work(&dev->init_work);
  183. return 0;
  184. }
  185. dev->me_clients[client_num].client_id = next_client_index;
  186. dev->me_clients[client_num].mei_flow_ctrl_creds = 0;
  187. mei_hbm_hdr(mei_hdr, len);
  188. prop_req = (struct hbm_props_request *)dev->wr_msg.data;
  189. memset(prop_req, 0, sizeof(struct hbm_props_request));
  190. prop_req->hbm_cmd = HOST_CLIENT_PROPERTIES_REQ_CMD;
  191. prop_req->address = next_client_index;
  192. if (mei_write_message(dev, mei_hdr, dev->wr_msg.data)) {
  193. dev->dev_state = MEI_DEV_RESETING;
  194. dev_err(&dev->pdev->dev, "Properties request command failed\n");
  195. mei_reset(dev, 1);
  196. return -EIO;
  197. }
  198. dev->init_clients_timer = MEI_CLIENTS_INIT_TIMEOUT;
  199. dev->me_client_index = next_client_index;
  200. return 0;
  201. }
  202. /**
  203. * mei_hbm_stop_req_prepare - perpare stop request message
  204. *
  205. * @dev - mei device
  206. * @mei_hdr - mei message header
  207. * @data - hbm message body buffer
  208. */
  209. static void mei_hbm_stop_req_prepare(struct mei_device *dev,
  210. struct mei_msg_hdr *mei_hdr, unsigned char *data)
  211. {
  212. struct hbm_host_stop_request *req =
  213. (struct hbm_host_stop_request *)data;
  214. const size_t len = sizeof(struct hbm_host_stop_request);
  215. mei_hbm_hdr(mei_hdr, len);
  216. memset(req, 0, len);
  217. req->hbm_cmd = HOST_STOP_REQ_CMD;
  218. req->reason = DRIVER_STOP_REQUEST;
  219. }
  220. /**
  221. * mei_hbm_cl_flow_control_req - sends flow control requst.
  222. *
  223. * @dev: the device structure
  224. * @cl: client info
  225. *
  226. * This function returns -EIO on write failure
  227. */
  228. int mei_hbm_cl_flow_control_req(struct mei_device *dev, struct mei_cl *cl)
  229. {
  230. struct mei_msg_hdr *mei_hdr = &dev->wr_msg.hdr;
  231. const size_t len = sizeof(struct hbm_flow_control);
  232. mei_hbm_hdr(mei_hdr, len);
  233. mei_hbm_cl_hdr(cl, MEI_FLOW_CONTROL_CMD, dev->wr_msg.data, len);
  234. dev_dbg(&dev->pdev->dev, "sending flow control host client = %d, ME client = %d\n",
  235. cl->host_client_id, cl->me_client_id);
  236. return mei_write_message(dev, mei_hdr, dev->wr_msg.data);
  237. }
  238. /**
  239. * add_single_flow_creds - adds single buffer credentials.
  240. *
  241. * @file: private data ot the file object.
  242. * @flow: flow control.
  243. */
  244. static void mei_hbm_add_single_flow_creds(struct mei_device *dev,
  245. struct hbm_flow_control *flow)
  246. {
  247. struct mei_me_client *client;
  248. int i;
  249. for (i = 0; i < dev->me_clients_num; i++) {
  250. client = &dev->me_clients[i];
  251. if (client && flow->me_addr == client->client_id) {
  252. if (client->props.single_recv_buf) {
  253. client->mei_flow_ctrl_creds++;
  254. dev_dbg(&dev->pdev->dev, "recv flow ctrl msg ME %d (single).\n",
  255. flow->me_addr);
  256. dev_dbg(&dev->pdev->dev, "flow control credentials =%d.\n",
  257. client->mei_flow_ctrl_creds);
  258. } else {
  259. BUG(); /* error in flow control */
  260. }
  261. }
  262. }
  263. }
  264. /**
  265. * mei_hbm_cl_flow_control_res - flow control response from me
  266. *
  267. * @dev: the device structure
  268. * @flow_control: flow control response bus message
  269. */
  270. static void mei_hbm_cl_flow_control_res(struct mei_device *dev,
  271. struct hbm_flow_control *flow_control)
  272. {
  273. struct mei_cl *cl = NULL;
  274. struct mei_cl *next = NULL;
  275. if (!flow_control->host_addr) {
  276. /* single receive buffer */
  277. mei_hbm_add_single_flow_creds(dev, flow_control);
  278. return;
  279. }
  280. /* normal connection */
  281. list_for_each_entry_safe(cl, next, &dev->file_list, link) {
  282. if (mei_hbm_cl_addr_equal(cl, flow_control)) {
  283. cl->mei_flow_ctrl_creds++;
  284. dev_dbg(&dev->pdev->dev, "flow ctrl msg for host %d ME %d.\n",
  285. flow_control->host_addr, flow_control->me_addr);
  286. dev_dbg(&dev->pdev->dev, "flow control credentials = %d.\n",
  287. cl->mei_flow_ctrl_creds);
  288. break;
  289. }
  290. }
  291. }
  292. /**
  293. * mei_hbm_cl_disconnect_req - sends disconnect message to fw.
  294. *
  295. * @dev: the device structure
  296. * @cl: a client to disconnect from
  297. *
  298. * This function returns -EIO on write failure
  299. */
  300. int mei_hbm_cl_disconnect_req(struct mei_device *dev, struct mei_cl *cl)
  301. {
  302. struct mei_msg_hdr *mei_hdr = &dev->wr_msg.hdr;
  303. const size_t len = sizeof(struct hbm_client_connect_request);
  304. mei_hbm_hdr(mei_hdr, len);
  305. mei_hbm_cl_hdr(cl, CLIENT_DISCONNECT_REQ_CMD, dev->wr_msg.data, len);
  306. return mei_write_message(dev, mei_hdr, dev->wr_msg.data);
  307. }
  308. /**
  309. * mei_hbm_cl_disconnect_res - disconnect response from ME
  310. *
  311. * @dev: the device structure
  312. * @rs: disconnect response bus message
  313. */
  314. static void mei_hbm_cl_disconnect_res(struct mei_device *dev,
  315. struct hbm_client_connect_response *rs)
  316. {
  317. struct mei_cl *cl;
  318. struct mei_cl_cb *pos = NULL, *next = NULL;
  319. dev_dbg(&dev->pdev->dev,
  320. "disconnect_response:\n"
  321. "ME Client = %d\n"
  322. "Host Client = %d\n"
  323. "Status = %d\n",
  324. rs->me_addr,
  325. rs->host_addr,
  326. rs->status);
  327. list_for_each_entry_safe(pos, next, &dev->ctrl_rd_list.list, list) {
  328. cl = pos->cl;
  329. if (!cl) {
  330. list_del(&pos->list);
  331. return;
  332. }
  333. dev_dbg(&dev->pdev->dev, "list_for_each_entry_safe in ctrl_rd_list.\n");
  334. if (mei_hbm_cl_addr_equal(cl, rs)) {
  335. list_del(&pos->list);
  336. if (!rs->status)
  337. cl->state = MEI_FILE_DISCONNECTED;
  338. cl->status = 0;
  339. cl->timer_count = 0;
  340. break;
  341. }
  342. }
  343. }
  344. /**
  345. * mei_hbm_cl_connect_req - send connection request to specific me client
  346. *
  347. * @dev: the device structure
  348. * @cl: a client to connect to
  349. *
  350. * returns -EIO on write failure
  351. */
  352. int mei_hbm_cl_connect_req(struct mei_device *dev, struct mei_cl *cl)
  353. {
  354. struct mei_msg_hdr *mei_hdr = &dev->wr_msg.hdr;
  355. const size_t len = sizeof(struct hbm_client_connect_request);
  356. mei_hbm_hdr(mei_hdr, len);
  357. mei_hbm_cl_hdr(cl, CLIENT_CONNECT_REQ_CMD, dev->wr_msg.data, len);
  358. return mei_write_message(dev, mei_hdr, dev->wr_msg.data);
  359. }
  360. /**
  361. * mei_hbm_cl_connect_res - connect resposne from the ME
  362. *
  363. * @dev: the device structure
  364. * @rs: connect response bus message
  365. */
  366. static void mei_hbm_cl_connect_res(struct mei_device *dev,
  367. struct hbm_client_connect_response *rs)
  368. {
  369. struct mei_cl *cl;
  370. struct mei_cl_cb *pos = NULL, *next = NULL;
  371. dev_dbg(&dev->pdev->dev,
  372. "connect_response:\n"
  373. "ME Client = %d\n"
  374. "Host Client = %d\n"
  375. "Status = %d\n",
  376. rs->me_addr,
  377. rs->host_addr,
  378. rs->status);
  379. /* if WD or iamthif client treat specially */
  380. if (is_treat_specially_client(&dev->wd_cl, rs)) {
  381. dev_dbg(&dev->pdev->dev, "successfully connected to WD client.\n");
  382. mei_watchdog_register(dev);
  383. return;
  384. }
  385. if (is_treat_specially_client(&dev->iamthif_cl, rs)) {
  386. dev->iamthif_state = MEI_IAMTHIF_IDLE;
  387. return;
  388. }
  389. list_for_each_entry_safe(pos, next, &dev->ctrl_rd_list.list, list) {
  390. cl = pos->cl;
  391. if (!cl) {
  392. list_del(&pos->list);
  393. return;
  394. }
  395. if (pos->fop_type == MEI_FOP_IOCTL) {
  396. if (is_treat_specially_client(cl, rs)) {
  397. list_del(&pos->list);
  398. cl->status = 0;
  399. cl->timer_count = 0;
  400. break;
  401. }
  402. }
  403. }
  404. }
  405. /**
  406. * mei_client_disconnect_request - disconnect request initiated by me
  407. * host sends disoconnect response
  408. *
  409. * @dev: the device structure.
  410. * @disconnect_req: disconnect request bus message from the me
  411. */
  412. static void mei_hbm_fw_disconnect_req(struct mei_device *dev,
  413. struct hbm_client_connect_request *disconnect_req)
  414. {
  415. struct mei_cl *cl, *next;
  416. const size_t len = sizeof(struct hbm_client_connect_response);
  417. list_for_each_entry_safe(cl, next, &dev->file_list, link) {
  418. if (mei_hbm_cl_addr_equal(cl, disconnect_req)) {
  419. dev_dbg(&dev->pdev->dev, "disconnect request host client %d ME client %d.\n",
  420. disconnect_req->host_addr,
  421. disconnect_req->me_addr);
  422. cl->state = MEI_FILE_DISCONNECTED;
  423. cl->timer_count = 0;
  424. if (cl == &dev->wd_cl)
  425. dev->wd_pending = false;
  426. else if (cl == &dev->iamthif_cl)
  427. dev->iamthif_timer = 0;
  428. /* prepare disconnect response */
  429. mei_hbm_hdr(&dev->wr_ext_msg.hdr, len);
  430. mei_hbm_cl_hdr(cl, CLIENT_DISCONNECT_RES_CMD,
  431. dev->wr_ext_msg.data, len);
  432. break;
  433. }
  434. }
  435. }
  436. /**
  437. * mei_hbm_dispatch - bottom half read routine after ISR to
  438. * handle the read bus message cmd processing.
  439. *
  440. * @dev: the device structure
  441. * @mei_hdr: header of bus message
  442. */
  443. void mei_hbm_dispatch(struct mei_device *dev, struct mei_msg_hdr *hdr)
  444. {
  445. struct mei_bus_message *mei_msg;
  446. struct mei_me_client *me_client;
  447. struct hbm_host_version_response *version_res;
  448. struct hbm_client_connect_response *connect_res;
  449. struct hbm_client_connect_response *disconnect_res;
  450. struct hbm_client_connect_request *disconnect_req;
  451. struct hbm_flow_control *flow_control;
  452. struct hbm_props_response *props_res;
  453. struct hbm_host_enum_response *enum_res;
  454. /* read the message to our buffer */
  455. BUG_ON(hdr->length >= sizeof(dev->rd_msg_buf));
  456. mei_read_slots(dev, dev->rd_msg_buf, hdr->length);
  457. mei_msg = (struct mei_bus_message *)dev->rd_msg_buf;
  458. switch (mei_msg->hbm_cmd) {
  459. case HOST_START_RES_CMD:
  460. version_res = (struct hbm_host_version_response *)mei_msg;
  461. if (!version_res->host_version_supported) {
  462. dev->version = version_res->me_max_version;
  463. dev_dbg(&dev->pdev->dev, "version mismatch.\n");
  464. mei_hbm_stop_req_prepare(dev, &dev->wr_msg.hdr,
  465. dev->wr_msg.data);
  466. mei_write_message(dev, &dev->wr_msg.hdr,
  467. dev->wr_msg.data);
  468. return;
  469. }
  470. dev->version.major_version = HBM_MAJOR_VERSION;
  471. dev->version.minor_version = HBM_MINOR_VERSION;
  472. if (dev->dev_state == MEI_DEV_INIT_CLIENTS &&
  473. dev->init_clients_state == MEI_START_MESSAGE) {
  474. dev->init_clients_timer = 0;
  475. mei_hbm_enum_clients_req(dev);
  476. } else {
  477. dev->recvd_msg = false;
  478. dev_dbg(&dev->pdev->dev, "reset due to received hbm: host start\n");
  479. mei_reset(dev, 1);
  480. return;
  481. }
  482. dev->recvd_msg = true;
  483. dev_dbg(&dev->pdev->dev, "host start response message received.\n");
  484. break;
  485. case CLIENT_CONNECT_RES_CMD:
  486. connect_res = (struct hbm_client_connect_response *) mei_msg;
  487. mei_hbm_cl_connect_res(dev, connect_res);
  488. dev_dbg(&dev->pdev->dev, "client connect response message received.\n");
  489. wake_up(&dev->wait_recvd_msg);
  490. break;
  491. case CLIENT_DISCONNECT_RES_CMD:
  492. disconnect_res = (struct hbm_client_connect_response *) mei_msg;
  493. mei_hbm_cl_disconnect_res(dev, disconnect_res);
  494. dev_dbg(&dev->pdev->dev, "client disconnect response message received.\n");
  495. wake_up(&dev->wait_recvd_msg);
  496. break;
  497. case MEI_FLOW_CONTROL_CMD:
  498. flow_control = (struct hbm_flow_control *) mei_msg;
  499. mei_hbm_cl_flow_control_res(dev, flow_control);
  500. dev_dbg(&dev->pdev->dev, "client flow control response message received.\n");
  501. break;
  502. case HOST_CLIENT_PROPERTIES_RES_CMD:
  503. props_res = (struct hbm_props_response *)mei_msg;
  504. me_client = &dev->me_clients[dev->me_client_presentation_num];
  505. if (props_res->status || !dev->me_clients) {
  506. dev_dbg(&dev->pdev->dev, "reset due to received host client properties response bus message wrong status.\n");
  507. mei_reset(dev, 1);
  508. return;
  509. }
  510. if (me_client->client_id != props_res->address) {
  511. dev_err(&dev->pdev->dev,
  512. "Host client properties reply mismatch\n");
  513. mei_reset(dev, 1);
  514. return;
  515. }
  516. if (dev->dev_state != MEI_DEV_INIT_CLIENTS ||
  517. dev->init_clients_state != MEI_CLIENT_PROPERTIES_MESSAGE) {
  518. dev_err(&dev->pdev->dev,
  519. "Unexpected client properties reply\n");
  520. mei_reset(dev, 1);
  521. return;
  522. }
  523. me_client->props = props_res->client_properties;
  524. dev->me_client_index++;
  525. dev->me_client_presentation_num++;
  526. /* request property for the next client */
  527. mei_hbm_prop_req(dev);
  528. break;
  529. case HOST_ENUM_RES_CMD:
  530. enum_res = (struct hbm_host_enum_response *) mei_msg;
  531. memcpy(dev->me_clients_map, enum_res->valid_addresses, 32);
  532. if (dev->dev_state == MEI_DEV_INIT_CLIENTS &&
  533. dev->init_clients_state == MEI_ENUM_CLIENTS_MESSAGE) {
  534. dev->init_clients_timer = 0;
  535. dev->me_client_presentation_num = 0;
  536. dev->me_client_index = 0;
  537. mei_hbm_me_cl_allocate(dev);
  538. dev->init_clients_state =
  539. MEI_CLIENT_PROPERTIES_MESSAGE;
  540. /* first property reqeust */
  541. mei_hbm_prop_req(dev);
  542. } else {
  543. dev_dbg(&dev->pdev->dev, "reset due to received host enumeration clients response bus message.\n");
  544. mei_reset(dev, 1);
  545. return;
  546. }
  547. break;
  548. case HOST_STOP_RES_CMD:
  549. dev->dev_state = MEI_DEV_DISABLED;
  550. dev_dbg(&dev->pdev->dev, "resetting because of FW stop response.\n");
  551. mei_reset(dev, 1);
  552. break;
  553. case CLIENT_DISCONNECT_REQ_CMD:
  554. /* search for client */
  555. disconnect_req = (struct hbm_client_connect_request *)mei_msg;
  556. mei_hbm_fw_disconnect_req(dev, disconnect_req);
  557. break;
  558. case ME_STOP_REQ_CMD:
  559. mei_hbm_stop_req_prepare(dev, &dev->wr_ext_msg.hdr,
  560. dev->wr_ext_msg.data);
  561. break;
  562. default:
  563. BUG();
  564. break;
  565. }
  566. }