hbm.c 17 KB

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