hbm.c 16 KB

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