hbm.c 31 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261
  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/export.h>
  17. #include <linux/sched.h>
  18. #include <linux/wait.h>
  19. #include <linux/pm_runtime.h>
  20. #include <linux/slab.h>
  21. #include <linux/mei.h>
  22. #include "mei_dev.h"
  23. #include "hbm.h"
  24. #include "client.h"
  25. static const char *mei_hbm_status_str(enum mei_hbm_status status)
  26. {
  27. #define MEI_HBM_STATUS(status) case MEI_HBMS_##status: return #status
  28. switch (status) {
  29. MEI_HBM_STATUS(SUCCESS);
  30. MEI_HBM_STATUS(CLIENT_NOT_FOUND);
  31. MEI_HBM_STATUS(ALREADY_EXISTS);
  32. MEI_HBM_STATUS(REJECTED);
  33. MEI_HBM_STATUS(INVALID_PARAMETER);
  34. MEI_HBM_STATUS(NOT_ALLOWED);
  35. MEI_HBM_STATUS(ALREADY_STARTED);
  36. MEI_HBM_STATUS(NOT_STARTED);
  37. default: return "unknown";
  38. }
  39. #undef MEI_HBM_STATUS
  40. };
  41. static const char *mei_cl_conn_status_str(enum mei_cl_connect_status status)
  42. {
  43. #define MEI_CL_CS(status) case MEI_CL_CONN_##status: return #status
  44. switch (status) {
  45. MEI_CL_CS(SUCCESS);
  46. MEI_CL_CS(NOT_FOUND);
  47. MEI_CL_CS(ALREADY_STARTED);
  48. MEI_CL_CS(OUT_OF_RESOURCES);
  49. MEI_CL_CS(MESSAGE_SMALL);
  50. MEI_CL_CS(NOT_ALLOWED);
  51. default: return "unknown";
  52. }
  53. #undef MEI_CL_CCS
  54. }
  55. const char *mei_hbm_state_str(enum mei_hbm_state state)
  56. {
  57. #define MEI_HBM_STATE(state) case MEI_HBM_##state: return #state
  58. switch (state) {
  59. MEI_HBM_STATE(IDLE);
  60. MEI_HBM_STATE(STARTING);
  61. MEI_HBM_STATE(STARTED);
  62. MEI_HBM_STATE(ENUM_CLIENTS);
  63. MEI_HBM_STATE(CLIENT_PROPERTIES);
  64. MEI_HBM_STATE(STOPPED);
  65. default:
  66. return "unknown";
  67. }
  68. #undef MEI_HBM_STATE
  69. }
  70. /**
  71. * mei_cl_conn_status_to_errno - convert client connect response
  72. * status to error code
  73. *
  74. * @status: client connect response status
  75. *
  76. * Return: corresponding error code
  77. */
  78. static int mei_cl_conn_status_to_errno(enum mei_cl_connect_status status)
  79. {
  80. switch (status) {
  81. case MEI_CL_CONN_SUCCESS: return 0;
  82. case MEI_CL_CONN_NOT_FOUND: return -ENOTTY;
  83. case MEI_CL_CONN_ALREADY_STARTED: return -EBUSY;
  84. case MEI_CL_CONN_OUT_OF_RESOURCES: return -EBUSY;
  85. case MEI_CL_CONN_MESSAGE_SMALL: return -EINVAL;
  86. case MEI_CL_CONN_NOT_ALLOWED: return -EBUSY;
  87. default: return -EINVAL;
  88. }
  89. }
  90. /**
  91. * mei_hbm_idle - set hbm to idle state
  92. *
  93. * @dev: the device structure
  94. */
  95. void mei_hbm_idle(struct mei_device *dev)
  96. {
  97. dev->init_clients_timer = 0;
  98. dev->hbm_state = MEI_HBM_IDLE;
  99. }
  100. /**
  101. * mei_hbm_reset - reset hbm counters and book keeping data structurs
  102. *
  103. * @dev: the device structure
  104. */
  105. void mei_hbm_reset(struct mei_device *dev)
  106. {
  107. dev->me_client_index = 0;
  108. mei_me_cl_rm_all(dev);
  109. mei_hbm_idle(dev);
  110. }
  111. /**
  112. * mei_hbm_hdr - construct hbm header
  113. *
  114. * @hdr: hbm header
  115. * @length: payload length
  116. */
  117. static inline void mei_hbm_hdr(struct mei_msg_hdr *hdr, size_t length)
  118. {
  119. hdr->host_addr = 0;
  120. hdr->me_addr = 0;
  121. hdr->length = length;
  122. hdr->msg_complete = 1;
  123. hdr->reserved = 0;
  124. }
  125. /**
  126. * mei_hbm_cl_hdr - construct client hbm header
  127. *
  128. * @cl: client
  129. * @hbm_cmd: host bus message command
  130. * @buf: buffer for cl header
  131. * @len: buffer length
  132. */
  133. static inline
  134. void mei_hbm_cl_hdr(struct mei_cl *cl, u8 hbm_cmd, void *buf, size_t len)
  135. {
  136. struct mei_hbm_cl_cmd *cmd = buf;
  137. memset(cmd, 0, len);
  138. cmd->hbm_cmd = hbm_cmd;
  139. cmd->host_addr = mei_cl_host_addr(cl);
  140. cmd->me_addr = mei_cl_me_id(cl);
  141. }
  142. /**
  143. * mei_hbm_cl_write - write simple hbm client message
  144. *
  145. * @dev: the device structure
  146. * @cl: client
  147. * @hbm_cmd: host bus message command
  148. * @len: buffer length
  149. *
  150. * Return: 0 on success, <0 on failure.
  151. */
  152. static inline
  153. int mei_hbm_cl_write(struct mei_device *dev,
  154. struct mei_cl *cl, u8 hbm_cmd, size_t len)
  155. {
  156. struct mei_msg_hdr *mei_hdr = &dev->wr_msg.hdr;
  157. mei_hbm_hdr(mei_hdr, len);
  158. mei_hbm_cl_hdr(cl, hbm_cmd, dev->wr_msg.data, len);
  159. return mei_write_message(dev, mei_hdr, dev->wr_msg.data);
  160. }
  161. /**
  162. * mei_hbm_cl_addr_equal - check if the client's and
  163. * the message address match
  164. *
  165. * @cl: client
  166. * @cmd: hbm client message
  167. *
  168. * Return: true if addresses are the same
  169. */
  170. static inline
  171. bool mei_hbm_cl_addr_equal(struct mei_cl *cl, struct mei_hbm_cl_cmd *cmd)
  172. {
  173. return mei_cl_host_addr(cl) == cmd->host_addr &&
  174. mei_cl_me_id(cl) == cmd->me_addr;
  175. }
  176. /**
  177. * mei_hbm_cl_find_by_cmd - find recipient client
  178. *
  179. * @dev: the device structure
  180. * @buf: a buffer with hbm cl command
  181. *
  182. * Return: the recipient client or NULL if not found
  183. */
  184. static inline
  185. struct mei_cl *mei_hbm_cl_find_by_cmd(struct mei_device *dev, void *buf)
  186. {
  187. struct mei_hbm_cl_cmd *cmd = (struct mei_hbm_cl_cmd *)buf;
  188. struct mei_cl *cl;
  189. list_for_each_entry(cl, &dev->file_list, link)
  190. if (mei_hbm_cl_addr_equal(cl, cmd))
  191. return cl;
  192. return NULL;
  193. }
  194. /**
  195. * mei_hbm_start_wait - wait for start response message.
  196. *
  197. * @dev: the device structure
  198. *
  199. * Return: 0 on success and < 0 on failure
  200. */
  201. int mei_hbm_start_wait(struct mei_device *dev)
  202. {
  203. int ret;
  204. if (dev->hbm_state > MEI_HBM_STARTING)
  205. return 0;
  206. mutex_unlock(&dev->device_lock);
  207. ret = wait_event_timeout(dev->wait_hbm_start,
  208. dev->hbm_state != MEI_HBM_STARTING,
  209. mei_secs_to_jiffies(MEI_HBM_TIMEOUT));
  210. mutex_lock(&dev->device_lock);
  211. if (ret == 0 && (dev->hbm_state <= MEI_HBM_STARTING)) {
  212. dev->hbm_state = MEI_HBM_IDLE;
  213. dev_err(dev->dev, "waiting for mei start failed\n");
  214. return -ETIME;
  215. }
  216. return 0;
  217. }
  218. /**
  219. * mei_hbm_start_req - sends start request message.
  220. *
  221. * @dev: the device structure
  222. *
  223. * Return: 0 on success and < 0 on failure
  224. */
  225. int mei_hbm_start_req(struct mei_device *dev)
  226. {
  227. struct mei_msg_hdr *mei_hdr = &dev->wr_msg.hdr;
  228. struct hbm_host_version_request *start_req;
  229. const size_t len = sizeof(struct hbm_host_version_request);
  230. int ret;
  231. mei_hbm_reset(dev);
  232. mei_hbm_hdr(mei_hdr, len);
  233. /* host start message */
  234. start_req = (struct hbm_host_version_request *)dev->wr_msg.data;
  235. memset(start_req, 0, len);
  236. start_req->hbm_cmd = HOST_START_REQ_CMD;
  237. start_req->host_version.major_version = HBM_MAJOR_VERSION;
  238. start_req->host_version.minor_version = HBM_MINOR_VERSION;
  239. dev->hbm_state = MEI_HBM_IDLE;
  240. ret = mei_write_message(dev, mei_hdr, dev->wr_msg.data);
  241. if (ret) {
  242. dev_err(dev->dev, "version message write failed: ret = %d\n",
  243. ret);
  244. return ret;
  245. }
  246. dev->hbm_state = MEI_HBM_STARTING;
  247. dev->init_clients_timer = MEI_CLIENTS_INIT_TIMEOUT;
  248. return 0;
  249. }
  250. /**
  251. * mei_hbm_enum_clients_req - sends enumeration client request message.
  252. *
  253. * @dev: the device structure
  254. *
  255. * Return: 0 on success and < 0 on failure
  256. */
  257. static int mei_hbm_enum_clients_req(struct mei_device *dev)
  258. {
  259. struct mei_msg_hdr *mei_hdr = &dev->wr_msg.hdr;
  260. struct hbm_host_enum_request *enum_req;
  261. const size_t len = sizeof(struct hbm_host_enum_request);
  262. int ret;
  263. /* enumerate clients */
  264. mei_hbm_hdr(mei_hdr, len);
  265. enum_req = (struct hbm_host_enum_request *)dev->wr_msg.data;
  266. memset(enum_req, 0, len);
  267. enum_req->hbm_cmd = HOST_ENUM_REQ_CMD;
  268. enum_req->flags |= dev->hbm_f_dc_supported ?
  269. MEI_HBM_ENUM_F_ALLOW_ADD : 0;
  270. enum_req->flags |= dev->hbm_f_ie_supported ?
  271. MEI_HBM_ENUM_F_IMMEDIATE_ENUM : 0;
  272. ret = mei_write_message(dev, mei_hdr, dev->wr_msg.data);
  273. if (ret) {
  274. dev_err(dev->dev, "enumeration request write failed: ret = %d.\n",
  275. ret);
  276. return ret;
  277. }
  278. dev->hbm_state = MEI_HBM_ENUM_CLIENTS;
  279. dev->init_clients_timer = MEI_CLIENTS_INIT_TIMEOUT;
  280. return 0;
  281. }
  282. /**
  283. * mei_hbm_me_cl_add - add new me client to the list
  284. *
  285. * @dev: the device structure
  286. * @res: hbm property response
  287. *
  288. * Return: 0 on success and -ENOMEM on allocation failure
  289. */
  290. static int mei_hbm_me_cl_add(struct mei_device *dev,
  291. struct hbm_props_response *res)
  292. {
  293. struct mei_me_client *me_cl;
  294. const uuid_le *uuid = &res->client_properties.protocol_name;
  295. mei_me_cl_rm_by_uuid(dev, uuid);
  296. me_cl = kzalloc(sizeof(struct mei_me_client), GFP_KERNEL);
  297. if (!me_cl)
  298. return -ENOMEM;
  299. mei_me_cl_init(me_cl);
  300. me_cl->props = res->client_properties;
  301. me_cl->client_id = res->me_addr;
  302. me_cl->mei_flow_ctrl_creds = 0;
  303. mei_me_cl_add(dev, me_cl);
  304. return 0;
  305. }
  306. /**
  307. * mei_hbm_add_cl_resp - send response to fw on client add request
  308. *
  309. * @dev: the device structure
  310. * @addr: me address
  311. * @status: response status
  312. *
  313. * Return: 0 on success and < 0 on failure
  314. */
  315. static int mei_hbm_add_cl_resp(struct mei_device *dev, u8 addr, u8 status)
  316. {
  317. struct mei_msg_hdr *mei_hdr = &dev->wr_msg.hdr;
  318. struct hbm_add_client_response *resp;
  319. const size_t len = sizeof(struct hbm_add_client_response);
  320. int ret;
  321. dev_dbg(dev->dev, "adding client response\n");
  322. resp = (struct hbm_add_client_response *)dev->wr_msg.data;
  323. mei_hbm_hdr(mei_hdr, len);
  324. memset(resp, 0, sizeof(struct hbm_add_client_response));
  325. resp->hbm_cmd = MEI_HBM_ADD_CLIENT_RES_CMD;
  326. resp->me_addr = addr;
  327. resp->status = status;
  328. ret = mei_write_message(dev, mei_hdr, dev->wr_msg.data);
  329. if (ret)
  330. dev_err(dev->dev, "add client response write failed: ret = %d\n",
  331. ret);
  332. return ret;
  333. }
  334. /**
  335. * mei_hbm_fw_add_cl_req - request from the fw to add a client
  336. *
  337. * @dev: the device structure
  338. * @req: add client request
  339. *
  340. * Return: 0 on success and < 0 on failure
  341. */
  342. static int mei_hbm_fw_add_cl_req(struct mei_device *dev,
  343. struct hbm_add_client_request *req)
  344. {
  345. int ret;
  346. u8 status = MEI_HBMS_SUCCESS;
  347. BUILD_BUG_ON(sizeof(struct hbm_add_client_request) !=
  348. sizeof(struct hbm_props_response));
  349. ret = mei_hbm_me_cl_add(dev, (struct hbm_props_response *)req);
  350. if (ret)
  351. status = !MEI_HBMS_SUCCESS;
  352. if (dev->dev_state == MEI_DEV_ENABLED)
  353. schedule_work(&dev->bus_rescan_work);
  354. return mei_hbm_add_cl_resp(dev, req->me_addr, status);
  355. }
  356. /**
  357. * mei_hbm_cl_notify_req - send notification request
  358. *
  359. * @dev: the device structure
  360. * @cl: a client to disconnect from
  361. * @start: true for start false for stop
  362. *
  363. * Return: 0 on success and -EIO on write failure
  364. */
  365. int mei_hbm_cl_notify_req(struct mei_device *dev,
  366. struct mei_cl *cl, u8 start)
  367. {
  368. struct mei_msg_hdr *mei_hdr = &dev->wr_msg.hdr;
  369. struct hbm_notification_request *req;
  370. const size_t len = sizeof(struct hbm_notification_request);
  371. int ret;
  372. mei_hbm_hdr(mei_hdr, len);
  373. mei_hbm_cl_hdr(cl, MEI_HBM_NOTIFY_REQ_CMD, dev->wr_msg.data, len);
  374. req = (struct hbm_notification_request *)dev->wr_msg.data;
  375. req->start = start;
  376. ret = mei_write_message(dev, mei_hdr, dev->wr_msg.data);
  377. if (ret)
  378. dev_err(dev->dev, "notify request failed: ret = %d\n", ret);
  379. return ret;
  380. }
  381. /**
  382. * notify_res_to_fop - convert notification response to the proper
  383. * notification FOP
  384. *
  385. * @cmd: client notification start response command
  386. *
  387. * Return: MEI_FOP_NOTIFY_START or MEI_FOP_NOTIFY_STOP;
  388. */
  389. static inline enum mei_cb_file_ops notify_res_to_fop(struct mei_hbm_cl_cmd *cmd)
  390. {
  391. struct hbm_notification_response *rs =
  392. (struct hbm_notification_response *)cmd;
  393. return mei_cl_notify_req2fop(rs->start);
  394. }
  395. /**
  396. * mei_hbm_cl_notify_start_res - update the client state according
  397. * notify start response
  398. *
  399. * @dev: the device structure
  400. * @cl: mei host client
  401. * @cmd: client notification start response command
  402. */
  403. static void mei_hbm_cl_notify_start_res(struct mei_device *dev,
  404. struct mei_cl *cl,
  405. struct mei_hbm_cl_cmd *cmd)
  406. {
  407. struct hbm_notification_response *rs =
  408. (struct hbm_notification_response *)cmd;
  409. cl_dbg(dev, cl, "hbm: notify start response status=%d\n", rs->status);
  410. if (rs->status == MEI_HBMS_SUCCESS ||
  411. rs->status == MEI_HBMS_ALREADY_STARTED) {
  412. cl->notify_en = true;
  413. cl->status = 0;
  414. } else {
  415. cl->status = -EINVAL;
  416. }
  417. }
  418. /**
  419. * mei_hbm_cl_notify_stop_res - update the client state according
  420. * notify stop response
  421. *
  422. * @dev: the device structure
  423. * @cl: mei host client
  424. * @cmd: client notification stop response command
  425. */
  426. static void mei_hbm_cl_notify_stop_res(struct mei_device *dev,
  427. struct mei_cl *cl,
  428. struct mei_hbm_cl_cmd *cmd)
  429. {
  430. struct hbm_notification_response *rs =
  431. (struct hbm_notification_response *)cmd;
  432. cl_dbg(dev, cl, "hbm: notify stop response status=%d\n", rs->status);
  433. if (rs->status == MEI_HBMS_SUCCESS ||
  434. rs->status == MEI_HBMS_NOT_STARTED) {
  435. cl->notify_en = false;
  436. cl->status = 0;
  437. } else {
  438. /* TODO: spec is not clear yet about other possible issues */
  439. cl->status = -EINVAL;
  440. }
  441. }
  442. /**
  443. * mei_hbm_cl_notify - signal notification event
  444. *
  445. * @dev: the device structure
  446. * @cmd: notification client message
  447. */
  448. static void mei_hbm_cl_notify(struct mei_device *dev,
  449. struct mei_hbm_cl_cmd *cmd)
  450. {
  451. struct mei_cl *cl;
  452. cl = mei_hbm_cl_find_by_cmd(dev, cmd);
  453. if (cl)
  454. mei_cl_notify(cl);
  455. }
  456. /**
  457. * mei_hbm_prop_req - request property for a single client
  458. *
  459. * @dev: the device structure
  460. *
  461. * Return: 0 on success and < 0 on failure
  462. */
  463. static int mei_hbm_prop_req(struct mei_device *dev)
  464. {
  465. struct mei_msg_hdr *mei_hdr = &dev->wr_msg.hdr;
  466. struct hbm_props_request *prop_req;
  467. const size_t len = sizeof(struct hbm_props_request);
  468. unsigned long next_client_index;
  469. int ret;
  470. next_client_index = find_next_bit(dev->me_clients_map, MEI_CLIENTS_MAX,
  471. dev->me_client_index);
  472. /* We got all client properties */
  473. if (next_client_index == MEI_CLIENTS_MAX) {
  474. dev->hbm_state = MEI_HBM_STARTED;
  475. mei_host_client_init(dev);
  476. return 0;
  477. }
  478. mei_hbm_hdr(mei_hdr, len);
  479. prop_req = (struct hbm_props_request *)dev->wr_msg.data;
  480. memset(prop_req, 0, sizeof(struct hbm_props_request));
  481. prop_req->hbm_cmd = HOST_CLIENT_PROPERTIES_REQ_CMD;
  482. prop_req->me_addr = next_client_index;
  483. ret = mei_write_message(dev, mei_hdr, dev->wr_msg.data);
  484. if (ret) {
  485. dev_err(dev->dev, "properties request write failed: ret = %d\n",
  486. ret);
  487. return ret;
  488. }
  489. dev->init_clients_timer = MEI_CLIENTS_INIT_TIMEOUT;
  490. dev->me_client_index = next_client_index;
  491. return 0;
  492. }
  493. /**
  494. * mei_hbm_pg - sends pg command
  495. *
  496. * @dev: the device structure
  497. * @pg_cmd: the pg command code
  498. *
  499. * Return: -EIO on write failure
  500. * -EOPNOTSUPP if the operation is not supported by the protocol
  501. */
  502. int mei_hbm_pg(struct mei_device *dev, u8 pg_cmd)
  503. {
  504. struct mei_msg_hdr *mei_hdr = &dev->wr_msg.hdr;
  505. struct hbm_power_gate *req;
  506. const size_t len = sizeof(struct hbm_power_gate);
  507. int ret;
  508. if (!dev->hbm_f_pg_supported)
  509. return -EOPNOTSUPP;
  510. mei_hbm_hdr(mei_hdr, len);
  511. req = (struct hbm_power_gate *)dev->wr_msg.data;
  512. memset(req, 0, len);
  513. req->hbm_cmd = pg_cmd;
  514. ret = mei_write_message(dev, mei_hdr, dev->wr_msg.data);
  515. if (ret)
  516. dev_err(dev->dev, "power gate command write failed.\n");
  517. return ret;
  518. }
  519. EXPORT_SYMBOL_GPL(mei_hbm_pg);
  520. /**
  521. * mei_hbm_stop_req - send stop request message
  522. *
  523. * @dev: mei device
  524. *
  525. * Return: -EIO on write failure
  526. */
  527. static int mei_hbm_stop_req(struct mei_device *dev)
  528. {
  529. struct mei_msg_hdr *mei_hdr = &dev->wr_msg.hdr;
  530. struct hbm_host_stop_request *req =
  531. (struct hbm_host_stop_request *)dev->wr_msg.data;
  532. const size_t len = sizeof(struct hbm_host_stop_request);
  533. mei_hbm_hdr(mei_hdr, len);
  534. memset(req, 0, len);
  535. req->hbm_cmd = HOST_STOP_REQ_CMD;
  536. req->reason = DRIVER_STOP_REQUEST;
  537. return mei_write_message(dev, mei_hdr, dev->wr_msg.data);
  538. }
  539. /**
  540. * mei_hbm_cl_flow_control_req - sends flow control request.
  541. *
  542. * @dev: the device structure
  543. * @cl: client info
  544. *
  545. * Return: -EIO on write failure
  546. */
  547. int mei_hbm_cl_flow_control_req(struct mei_device *dev, struct mei_cl *cl)
  548. {
  549. const size_t len = sizeof(struct hbm_flow_control);
  550. cl_dbg(dev, cl, "sending flow control\n");
  551. return mei_hbm_cl_write(dev, cl, MEI_FLOW_CONTROL_CMD, len);
  552. }
  553. /**
  554. * mei_hbm_add_single_flow_creds - adds single buffer credentials.
  555. *
  556. * @dev: the device structure
  557. * @flow: flow control.
  558. *
  559. * Return: 0 on success, < 0 otherwise
  560. */
  561. static int mei_hbm_add_single_flow_creds(struct mei_device *dev,
  562. struct hbm_flow_control *flow)
  563. {
  564. struct mei_me_client *me_cl;
  565. int rets;
  566. me_cl = mei_me_cl_by_id(dev, flow->me_addr);
  567. if (!me_cl) {
  568. dev_err(dev->dev, "no such me client %d\n",
  569. flow->me_addr);
  570. return -ENOENT;
  571. }
  572. if (WARN_ON(me_cl->props.single_recv_buf == 0)) {
  573. rets = -EINVAL;
  574. goto out;
  575. }
  576. me_cl->mei_flow_ctrl_creds++;
  577. dev_dbg(dev->dev, "recv flow ctrl msg ME %d (single) creds = %d.\n",
  578. flow->me_addr, me_cl->mei_flow_ctrl_creds);
  579. rets = 0;
  580. out:
  581. mei_me_cl_put(me_cl);
  582. return rets;
  583. }
  584. /**
  585. * mei_hbm_cl_flow_control_res - flow control response from me
  586. *
  587. * @dev: the device structure
  588. * @flow_control: flow control response bus message
  589. */
  590. static void mei_hbm_cl_flow_control_res(struct mei_device *dev,
  591. struct hbm_flow_control *flow_control)
  592. {
  593. struct mei_cl *cl;
  594. if (!flow_control->host_addr) {
  595. /* single receive buffer */
  596. mei_hbm_add_single_flow_creds(dev, flow_control);
  597. return;
  598. }
  599. cl = mei_hbm_cl_find_by_cmd(dev, flow_control);
  600. if (cl) {
  601. cl->mei_flow_ctrl_creds++;
  602. cl_dbg(dev, cl, "flow control creds = %d.\n",
  603. cl->mei_flow_ctrl_creds);
  604. }
  605. }
  606. /**
  607. * mei_hbm_cl_disconnect_req - sends disconnect message to fw.
  608. *
  609. * @dev: the device structure
  610. * @cl: a client to disconnect from
  611. *
  612. * Return: -EIO on write failure
  613. */
  614. int mei_hbm_cl_disconnect_req(struct mei_device *dev, struct mei_cl *cl)
  615. {
  616. const size_t len = sizeof(struct hbm_client_connect_request);
  617. return mei_hbm_cl_write(dev, cl, CLIENT_DISCONNECT_REQ_CMD, len);
  618. }
  619. /**
  620. * mei_hbm_cl_disconnect_rsp - sends disconnect respose to the FW
  621. *
  622. * @dev: the device structure
  623. * @cl: a client to disconnect from
  624. *
  625. * Return: -EIO on write failure
  626. */
  627. int mei_hbm_cl_disconnect_rsp(struct mei_device *dev, struct mei_cl *cl)
  628. {
  629. const size_t len = sizeof(struct hbm_client_connect_response);
  630. return mei_hbm_cl_write(dev, cl, CLIENT_DISCONNECT_RES_CMD, len);
  631. }
  632. /**
  633. * mei_hbm_cl_disconnect_res - update the client state according
  634. * disconnect response
  635. *
  636. * @dev: the device structure
  637. * @cl: mei host client
  638. * @cmd: disconnect client response host bus message
  639. */
  640. static void mei_hbm_cl_disconnect_res(struct mei_device *dev, struct mei_cl *cl,
  641. struct mei_hbm_cl_cmd *cmd)
  642. {
  643. struct hbm_client_connect_response *rs =
  644. (struct hbm_client_connect_response *)cmd;
  645. cl_dbg(dev, cl, "hbm: disconnect response status=%d\n", rs->status);
  646. if (rs->status == MEI_CL_DISCONN_SUCCESS)
  647. cl->state = MEI_FILE_DISCONNECT_REPLY;
  648. cl->status = 0;
  649. }
  650. /**
  651. * mei_hbm_cl_connect_req - send connection request to specific me client
  652. *
  653. * @dev: the device structure
  654. * @cl: a client to connect to
  655. *
  656. * Return: -EIO on write failure
  657. */
  658. int mei_hbm_cl_connect_req(struct mei_device *dev, struct mei_cl *cl)
  659. {
  660. const size_t len = sizeof(struct hbm_client_connect_request);
  661. return mei_hbm_cl_write(dev, cl, CLIENT_CONNECT_REQ_CMD, len);
  662. }
  663. /**
  664. * mei_hbm_cl_connect_res - update the client state according
  665. * connection response
  666. *
  667. * @dev: the device structure
  668. * @cl: mei host client
  669. * @cmd: connect client response host bus message
  670. */
  671. static void mei_hbm_cl_connect_res(struct mei_device *dev, struct mei_cl *cl,
  672. struct mei_hbm_cl_cmd *cmd)
  673. {
  674. struct hbm_client_connect_response *rs =
  675. (struct hbm_client_connect_response *)cmd;
  676. cl_dbg(dev, cl, "hbm: connect response status=%s\n",
  677. mei_cl_conn_status_str(rs->status));
  678. if (rs->status == MEI_CL_CONN_SUCCESS)
  679. cl->state = MEI_FILE_CONNECTED;
  680. else {
  681. cl->state = MEI_FILE_DISCONNECT_REPLY;
  682. if (rs->status == MEI_CL_CONN_NOT_FOUND) {
  683. mei_me_cl_del(dev, cl->me_cl);
  684. if (dev->dev_state == MEI_DEV_ENABLED)
  685. schedule_work(&dev->bus_rescan_work);
  686. }
  687. }
  688. cl->status = mei_cl_conn_status_to_errno(rs->status);
  689. }
  690. /**
  691. * mei_hbm_cl_res - process hbm response received on behalf
  692. * an client
  693. *
  694. * @dev: the device structure
  695. * @rs: hbm client message
  696. * @fop_type: file operation type
  697. */
  698. static void mei_hbm_cl_res(struct mei_device *dev,
  699. struct mei_hbm_cl_cmd *rs,
  700. enum mei_cb_file_ops fop_type)
  701. {
  702. struct mei_cl *cl;
  703. struct mei_cl_cb *cb, *next;
  704. cl = NULL;
  705. list_for_each_entry_safe(cb, next, &dev->ctrl_rd_list.list, list) {
  706. cl = cb->cl;
  707. if (cb->fop_type != fop_type)
  708. continue;
  709. if (mei_hbm_cl_addr_equal(cl, rs)) {
  710. list_del_init(&cb->list);
  711. break;
  712. }
  713. }
  714. if (!cl)
  715. return;
  716. switch (fop_type) {
  717. case MEI_FOP_CONNECT:
  718. mei_hbm_cl_connect_res(dev, cl, rs);
  719. break;
  720. case MEI_FOP_DISCONNECT:
  721. mei_hbm_cl_disconnect_res(dev, cl, rs);
  722. break;
  723. case MEI_FOP_NOTIFY_START:
  724. mei_hbm_cl_notify_start_res(dev, cl, rs);
  725. break;
  726. case MEI_FOP_NOTIFY_STOP:
  727. mei_hbm_cl_notify_stop_res(dev, cl, rs);
  728. break;
  729. default:
  730. return;
  731. }
  732. cl->timer_count = 0;
  733. wake_up(&cl->wait);
  734. }
  735. /**
  736. * mei_hbm_fw_disconnect_req - disconnect request initiated by ME firmware
  737. * host sends disconnect response
  738. *
  739. * @dev: the device structure.
  740. * @disconnect_req: disconnect request bus message from the me
  741. *
  742. * Return: -ENOMEM on allocation failure
  743. */
  744. static int mei_hbm_fw_disconnect_req(struct mei_device *dev,
  745. struct hbm_client_connect_request *disconnect_req)
  746. {
  747. struct mei_cl *cl;
  748. struct mei_cl_cb *cb;
  749. cl = mei_hbm_cl_find_by_cmd(dev, disconnect_req);
  750. if (cl) {
  751. cl_warn(dev, cl, "fw disconnect request received\n");
  752. cl->state = MEI_FILE_DISCONNECTING;
  753. cl->timer_count = 0;
  754. cb = mei_io_cb_init(cl, MEI_FOP_DISCONNECT_RSP, NULL);
  755. if (!cb)
  756. return -ENOMEM;
  757. cl_dbg(dev, cl, "add disconnect response as first\n");
  758. list_add(&cb->list, &dev->ctrl_wr_list.list);
  759. }
  760. return 0;
  761. }
  762. /**
  763. * mei_hbm_pg_enter_res - PG enter response received
  764. *
  765. * @dev: the device structure.
  766. *
  767. * Return: 0 on success, -EPROTO on state mismatch
  768. */
  769. static int mei_hbm_pg_enter_res(struct mei_device *dev)
  770. {
  771. if (mei_pg_state(dev) != MEI_PG_OFF ||
  772. dev->pg_event != MEI_PG_EVENT_WAIT) {
  773. dev_err(dev->dev, "hbm: pg entry response: state mismatch [%s, %d]\n",
  774. mei_pg_state_str(mei_pg_state(dev)), dev->pg_event);
  775. return -EPROTO;
  776. }
  777. dev->pg_event = MEI_PG_EVENT_RECEIVED;
  778. wake_up(&dev->wait_pg);
  779. return 0;
  780. }
  781. /**
  782. * mei_hbm_pg_resume - process with PG resume
  783. *
  784. * @dev: the device structure.
  785. */
  786. void mei_hbm_pg_resume(struct mei_device *dev)
  787. {
  788. pm_request_resume(dev->dev);
  789. }
  790. EXPORT_SYMBOL_GPL(mei_hbm_pg_resume);
  791. /**
  792. * mei_hbm_pg_exit_res - PG exit response received
  793. *
  794. * @dev: the device structure.
  795. *
  796. * Return: 0 on success, -EPROTO on state mismatch
  797. */
  798. static int mei_hbm_pg_exit_res(struct mei_device *dev)
  799. {
  800. if (mei_pg_state(dev) != MEI_PG_ON ||
  801. (dev->pg_event != MEI_PG_EVENT_WAIT &&
  802. dev->pg_event != MEI_PG_EVENT_IDLE)) {
  803. dev_err(dev->dev, "hbm: pg exit response: state mismatch [%s, %d]\n",
  804. mei_pg_state_str(mei_pg_state(dev)), dev->pg_event);
  805. return -EPROTO;
  806. }
  807. switch (dev->pg_event) {
  808. case MEI_PG_EVENT_WAIT:
  809. dev->pg_event = MEI_PG_EVENT_RECEIVED;
  810. wake_up(&dev->wait_pg);
  811. break;
  812. case MEI_PG_EVENT_IDLE:
  813. /*
  814. * If the driver is not waiting on this then
  815. * this is HW initiated exit from PG.
  816. * Start runtime pm resume sequence to exit from PG.
  817. */
  818. dev->pg_event = MEI_PG_EVENT_RECEIVED;
  819. mei_hbm_pg_resume(dev);
  820. break;
  821. default:
  822. WARN(1, "hbm: pg exit response: unexpected pg event = %d\n",
  823. dev->pg_event);
  824. return -EPROTO;
  825. }
  826. return 0;
  827. }
  828. /**
  829. * mei_hbm_config_features - check what hbm features and commands
  830. * are supported by the fw
  831. *
  832. * @dev: the device structure
  833. */
  834. static void mei_hbm_config_features(struct mei_device *dev)
  835. {
  836. /* Power Gating Isolation Support */
  837. dev->hbm_f_pg_supported = 0;
  838. if (dev->version.major_version > HBM_MAJOR_VERSION_PGI)
  839. dev->hbm_f_pg_supported = 1;
  840. if (dev->version.major_version == HBM_MAJOR_VERSION_PGI &&
  841. dev->version.minor_version >= HBM_MINOR_VERSION_PGI)
  842. dev->hbm_f_pg_supported = 1;
  843. if (dev->version.major_version >= HBM_MAJOR_VERSION_DC)
  844. dev->hbm_f_dc_supported = 1;
  845. if (dev->version.major_version >= HBM_MAJOR_VERSION_IE)
  846. dev->hbm_f_ie_supported = 1;
  847. /* disconnect on connect timeout instead of link reset */
  848. if (dev->version.major_version >= HBM_MAJOR_VERSION_DOT)
  849. dev->hbm_f_dot_supported = 1;
  850. /* Notification Event Support */
  851. if (dev->version.major_version >= HBM_MAJOR_VERSION_EV)
  852. dev->hbm_f_ev_supported = 1;
  853. /* Fixed Address Client Support */
  854. if (dev->version.major_version >= HBM_MAJOR_VERSION_FA)
  855. dev->hbm_f_fa_supported = 1;
  856. }
  857. /**
  858. * mei_hbm_version_is_supported - checks whether the driver can
  859. * support the hbm version of the device
  860. *
  861. * @dev: the device structure
  862. * Return: true if driver can support hbm version of the device
  863. */
  864. bool mei_hbm_version_is_supported(struct mei_device *dev)
  865. {
  866. return (dev->version.major_version < HBM_MAJOR_VERSION) ||
  867. (dev->version.major_version == HBM_MAJOR_VERSION &&
  868. dev->version.minor_version <= HBM_MINOR_VERSION);
  869. }
  870. /**
  871. * mei_hbm_dispatch - bottom half read routine after ISR to
  872. * handle the read bus message cmd processing.
  873. *
  874. * @dev: the device structure
  875. * @hdr: header of bus message
  876. *
  877. * Return: 0 on success and < 0 on failure
  878. */
  879. int mei_hbm_dispatch(struct mei_device *dev, struct mei_msg_hdr *hdr)
  880. {
  881. struct mei_bus_message *mei_msg;
  882. struct hbm_host_version_response *version_res;
  883. struct hbm_props_response *props_res;
  884. struct hbm_host_enum_response *enum_res;
  885. struct hbm_add_client_request *add_cl_req;
  886. int ret;
  887. struct mei_hbm_cl_cmd *cl_cmd;
  888. struct hbm_client_connect_request *disconnect_req;
  889. struct hbm_flow_control *flow_control;
  890. /* read the message to our buffer */
  891. BUG_ON(hdr->length >= sizeof(dev->rd_msg_buf));
  892. mei_read_slots(dev, dev->rd_msg_buf, hdr->length);
  893. mei_msg = (struct mei_bus_message *)dev->rd_msg_buf;
  894. cl_cmd = (struct mei_hbm_cl_cmd *)mei_msg;
  895. /* ignore spurious message and prevent reset nesting
  896. * hbm is put to idle during system reset
  897. */
  898. if (dev->hbm_state == MEI_HBM_IDLE) {
  899. dev_dbg(dev->dev, "hbm: state is idle ignore spurious messages\n");
  900. return 0;
  901. }
  902. switch (mei_msg->hbm_cmd) {
  903. case HOST_START_RES_CMD:
  904. dev_dbg(dev->dev, "hbm: start: response message received.\n");
  905. dev->init_clients_timer = 0;
  906. version_res = (struct hbm_host_version_response *)mei_msg;
  907. dev_dbg(dev->dev, "HBM VERSION: DRIVER=%02d:%02d DEVICE=%02d:%02d\n",
  908. HBM_MAJOR_VERSION, HBM_MINOR_VERSION,
  909. version_res->me_max_version.major_version,
  910. version_res->me_max_version.minor_version);
  911. if (version_res->host_version_supported) {
  912. dev->version.major_version = HBM_MAJOR_VERSION;
  913. dev->version.minor_version = HBM_MINOR_VERSION;
  914. } else {
  915. dev->version.major_version =
  916. version_res->me_max_version.major_version;
  917. dev->version.minor_version =
  918. version_res->me_max_version.minor_version;
  919. }
  920. if (!mei_hbm_version_is_supported(dev)) {
  921. dev_warn(dev->dev, "hbm: start: version mismatch - stopping the driver.\n");
  922. dev->hbm_state = MEI_HBM_STOPPED;
  923. if (mei_hbm_stop_req(dev)) {
  924. dev_err(dev->dev, "hbm: start: failed to send stop request\n");
  925. return -EIO;
  926. }
  927. break;
  928. }
  929. mei_hbm_config_features(dev);
  930. if (dev->dev_state != MEI_DEV_INIT_CLIENTS ||
  931. dev->hbm_state != MEI_HBM_STARTING) {
  932. dev_err(dev->dev, "hbm: start: state mismatch, [%d, %d]\n",
  933. dev->dev_state, dev->hbm_state);
  934. return -EPROTO;
  935. }
  936. if (mei_hbm_enum_clients_req(dev)) {
  937. dev_err(dev->dev, "hbm: start: failed to send enumeration request\n");
  938. return -EIO;
  939. }
  940. wake_up(&dev->wait_hbm_start);
  941. break;
  942. case CLIENT_CONNECT_RES_CMD:
  943. dev_dbg(dev->dev, "hbm: client connect response: message received.\n");
  944. mei_hbm_cl_res(dev, cl_cmd, MEI_FOP_CONNECT);
  945. break;
  946. case CLIENT_DISCONNECT_RES_CMD:
  947. dev_dbg(dev->dev, "hbm: client disconnect response: message received.\n");
  948. mei_hbm_cl_res(dev, cl_cmd, MEI_FOP_DISCONNECT);
  949. break;
  950. case MEI_FLOW_CONTROL_CMD:
  951. dev_dbg(dev->dev, "hbm: client flow control response: message received.\n");
  952. flow_control = (struct hbm_flow_control *) mei_msg;
  953. mei_hbm_cl_flow_control_res(dev, flow_control);
  954. break;
  955. case MEI_PG_ISOLATION_ENTRY_RES_CMD:
  956. dev_dbg(dev->dev, "hbm: power gate isolation entry response received\n");
  957. ret = mei_hbm_pg_enter_res(dev);
  958. if (ret)
  959. return ret;
  960. break;
  961. case MEI_PG_ISOLATION_EXIT_REQ_CMD:
  962. dev_dbg(dev->dev, "hbm: power gate isolation exit request received\n");
  963. ret = mei_hbm_pg_exit_res(dev);
  964. if (ret)
  965. return ret;
  966. break;
  967. case HOST_CLIENT_PROPERTIES_RES_CMD:
  968. dev_dbg(dev->dev, "hbm: properties response: message received.\n");
  969. dev->init_clients_timer = 0;
  970. if (dev->dev_state != MEI_DEV_INIT_CLIENTS ||
  971. dev->hbm_state != MEI_HBM_CLIENT_PROPERTIES) {
  972. dev_err(dev->dev, "hbm: properties response: state mismatch, [%d, %d]\n",
  973. dev->dev_state, dev->hbm_state);
  974. return -EPROTO;
  975. }
  976. props_res = (struct hbm_props_response *)mei_msg;
  977. if (props_res->status) {
  978. dev_err(dev->dev, "hbm: properties response: wrong status = %d %s\n",
  979. props_res->status,
  980. mei_hbm_status_str(props_res->status));
  981. return -EPROTO;
  982. }
  983. mei_hbm_me_cl_add(dev, props_res);
  984. dev->me_client_index++;
  985. /* request property for the next client */
  986. if (mei_hbm_prop_req(dev))
  987. return -EIO;
  988. break;
  989. case HOST_ENUM_RES_CMD:
  990. dev_dbg(dev->dev, "hbm: enumeration response: message received\n");
  991. dev->init_clients_timer = 0;
  992. enum_res = (struct hbm_host_enum_response *) mei_msg;
  993. BUILD_BUG_ON(sizeof(dev->me_clients_map)
  994. < sizeof(enum_res->valid_addresses));
  995. memcpy(dev->me_clients_map, enum_res->valid_addresses,
  996. sizeof(enum_res->valid_addresses));
  997. if (dev->dev_state != MEI_DEV_INIT_CLIENTS ||
  998. dev->hbm_state != MEI_HBM_ENUM_CLIENTS) {
  999. dev_err(dev->dev, "hbm: enumeration response: state mismatch, [%d, %d]\n",
  1000. dev->dev_state, dev->hbm_state);
  1001. return -EPROTO;
  1002. }
  1003. dev->hbm_state = MEI_HBM_CLIENT_PROPERTIES;
  1004. /* first property request */
  1005. if (mei_hbm_prop_req(dev))
  1006. return -EIO;
  1007. break;
  1008. case HOST_STOP_RES_CMD:
  1009. dev_dbg(dev->dev, "hbm: stop response: message received\n");
  1010. dev->init_clients_timer = 0;
  1011. if (dev->hbm_state != MEI_HBM_STOPPED) {
  1012. dev_err(dev->dev, "hbm: stop response: state mismatch, [%d, %d]\n",
  1013. dev->dev_state, dev->hbm_state);
  1014. return -EPROTO;
  1015. }
  1016. dev->dev_state = MEI_DEV_POWER_DOWN;
  1017. dev_info(dev->dev, "hbm: stop response: resetting.\n");
  1018. /* force the reset */
  1019. return -EPROTO;
  1020. break;
  1021. case CLIENT_DISCONNECT_REQ_CMD:
  1022. dev_dbg(dev->dev, "hbm: disconnect request: message received\n");
  1023. disconnect_req = (struct hbm_client_connect_request *)mei_msg;
  1024. mei_hbm_fw_disconnect_req(dev, disconnect_req);
  1025. break;
  1026. case ME_STOP_REQ_CMD:
  1027. dev_dbg(dev->dev, "hbm: stop request: message received\n");
  1028. dev->hbm_state = MEI_HBM_STOPPED;
  1029. if (mei_hbm_stop_req(dev)) {
  1030. dev_err(dev->dev, "hbm: stop request: failed to send stop request\n");
  1031. return -EIO;
  1032. }
  1033. break;
  1034. case MEI_HBM_ADD_CLIENT_REQ_CMD:
  1035. dev_dbg(dev->dev, "hbm: add client request received\n");
  1036. /*
  1037. * after the host receives the enum_resp
  1038. * message clients may be added or removed
  1039. */
  1040. if (dev->hbm_state <= MEI_HBM_ENUM_CLIENTS ||
  1041. dev->hbm_state >= MEI_HBM_STOPPED) {
  1042. dev_err(dev->dev, "hbm: add client: state mismatch, [%d, %d]\n",
  1043. dev->dev_state, dev->hbm_state);
  1044. return -EPROTO;
  1045. }
  1046. add_cl_req = (struct hbm_add_client_request *)mei_msg;
  1047. ret = mei_hbm_fw_add_cl_req(dev, add_cl_req);
  1048. if (ret) {
  1049. dev_err(dev->dev, "hbm: add client: failed to send response %d\n",
  1050. ret);
  1051. return -EIO;
  1052. }
  1053. dev_dbg(dev->dev, "hbm: add client request processed\n");
  1054. break;
  1055. case MEI_HBM_NOTIFY_RES_CMD:
  1056. dev_dbg(dev->dev, "hbm: notify response received\n");
  1057. mei_hbm_cl_res(dev, cl_cmd, notify_res_to_fop(cl_cmd));
  1058. break;
  1059. case MEI_HBM_NOTIFICATION_CMD:
  1060. dev_dbg(dev->dev, "hbm: notification\n");
  1061. mei_hbm_cl_notify(dev, cl_cmd);
  1062. break;
  1063. default:
  1064. BUG();
  1065. break;
  1066. }
  1067. return 0;
  1068. }