hw-txe.c 31 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268
  1. /*
  2. *
  3. * Intel Management Engine Interface (Intel MEI) Linux driver
  4. * Copyright (c) 2013-2014, 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/jiffies.h>
  18. #include <linux/ktime.h>
  19. #include <linux/delay.h>
  20. #include <linux/kthread.h>
  21. #include <linux/interrupt.h>
  22. #include <linux/pm_runtime.h>
  23. #include <linux/mei.h>
  24. #include "mei_dev.h"
  25. #include "hw-txe.h"
  26. #include "client.h"
  27. #include "hbm.h"
  28. #include "mei-trace.h"
  29. #define TXE_HBUF_DEPTH (PAYLOAD_SIZE / MEI_SLOT_SIZE)
  30. /**
  31. * mei_txe_reg_read - Reads 32bit data from the txe device
  32. *
  33. * @base_addr: registers base address
  34. * @offset: register offset
  35. *
  36. * Return: register value
  37. */
  38. static inline u32 mei_txe_reg_read(void __iomem *base_addr,
  39. unsigned long offset)
  40. {
  41. return ioread32(base_addr + offset);
  42. }
  43. /**
  44. * mei_txe_reg_write - Writes 32bit data to the txe device
  45. *
  46. * @base_addr: registers base address
  47. * @offset: register offset
  48. * @value: the value to write
  49. */
  50. static inline void mei_txe_reg_write(void __iomem *base_addr,
  51. unsigned long offset, u32 value)
  52. {
  53. iowrite32(value, base_addr + offset);
  54. }
  55. /**
  56. * mei_txe_sec_reg_read_silent - Reads 32bit data from the SeC BAR
  57. *
  58. * @hw: the txe hardware structure
  59. * @offset: register offset
  60. *
  61. * Doesn't check for aliveness while Reads 32bit data from the SeC BAR
  62. *
  63. * Return: register value
  64. */
  65. static inline u32 mei_txe_sec_reg_read_silent(struct mei_txe_hw *hw,
  66. unsigned long offset)
  67. {
  68. return mei_txe_reg_read(hw->mem_addr[SEC_BAR], offset);
  69. }
  70. /**
  71. * mei_txe_sec_reg_read - Reads 32bit data from the SeC BAR
  72. *
  73. * @hw: the txe hardware structure
  74. * @offset: register offset
  75. *
  76. * Reads 32bit data from the SeC BAR and shout loud if aliveness is not set
  77. *
  78. * Return: register value
  79. */
  80. static inline u32 mei_txe_sec_reg_read(struct mei_txe_hw *hw,
  81. unsigned long offset)
  82. {
  83. WARN(!hw->aliveness, "sec read: aliveness not asserted\n");
  84. return mei_txe_sec_reg_read_silent(hw, offset);
  85. }
  86. /**
  87. * mei_txe_sec_reg_write_silent - Writes 32bit data to the SeC BAR
  88. * doesn't check for aliveness
  89. *
  90. * @hw: the txe hardware structure
  91. * @offset: register offset
  92. * @value: value to write
  93. *
  94. * Doesn't check for aliveness while writes 32bit data from to the SeC BAR
  95. */
  96. static inline void mei_txe_sec_reg_write_silent(struct mei_txe_hw *hw,
  97. unsigned long offset, u32 value)
  98. {
  99. mei_txe_reg_write(hw->mem_addr[SEC_BAR], offset, value);
  100. }
  101. /**
  102. * mei_txe_sec_reg_write - Writes 32bit data to the SeC BAR
  103. *
  104. * @hw: the txe hardware structure
  105. * @offset: register offset
  106. * @value: value to write
  107. *
  108. * Writes 32bit data from the SeC BAR and shout loud if aliveness is not set
  109. */
  110. static inline void mei_txe_sec_reg_write(struct mei_txe_hw *hw,
  111. unsigned long offset, u32 value)
  112. {
  113. WARN(!hw->aliveness, "sec write: aliveness not asserted\n");
  114. mei_txe_sec_reg_write_silent(hw, offset, value);
  115. }
  116. /**
  117. * mei_txe_br_reg_read - Reads 32bit data from the Bridge BAR
  118. *
  119. * @hw: the txe hardware structure
  120. * @offset: offset from which to read the data
  121. *
  122. * Return: the byte read.
  123. */
  124. static inline u32 mei_txe_br_reg_read(struct mei_txe_hw *hw,
  125. unsigned long offset)
  126. {
  127. return mei_txe_reg_read(hw->mem_addr[BRIDGE_BAR], offset);
  128. }
  129. /**
  130. * mei_txe_br_reg_write - Writes 32bit data to the Bridge BAR
  131. *
  132. * @hw: the txe hardware structure
  133. * @offset: offset from which to write the data
  134. * @value: the byte to write
  135. */
  136. static inline void mei_txe_br_reg_write(struct mei_txe_hw *hw,
  137. unsigned long offset, u32 value)
  138. {
  139. mei_txe_reg_write(hw->mem_addr[BRIDGE_BAR], offset, value);
  140. }
  141. /**
  142. * mei_txe_aliveness_set - request for aliveness change
  143. *
  144. * @dev: the device structure
  145. * @req: requested aliveness value
  146. *
  147. * Request for aliveness change and returns true if the change is
  148. * really needed and false if aliveness is already
  149. * in the requested state
  150. *
  151. * Locking: called under "dev->device_lock" lock
  152. *
  153. * Return: true if request was send
  154. */
  155. static bool mei_txe_aliveness_set(struct mei_device *dev, u32 req)
  156. {
  157. struct mei_txe_hw *hw = to_txe_hw(dev);
  158. bool do_req = hw->aliveness != req;
  159. dev_dbg(dev->dev, "Aliveness current=%d request=%d\n",
  160. hw->aliveness, req);
  161. if (do_req) {
  162. dev->pg_event = MEI_PG_EVENT_WAIT;
  163. mei_txe_br_reg_write(hw, SICR_HOST_ALIVENESS_REQ_REG, req);
  164. }
  165. return do_req;
  166. }
  167. /**
  168. * mei_txe_aliveness_req_get - get aliveness requested register value
  169. *
  170. * @dev: the device structure
  171. *
  172. * Extract HICR_HOST_ALIVENESS_RESP_ACK bit from
  173. * from HICR_HOST_ALIVENESS_REQ register value
  174. *
  175. * Return: SICR_HOST_ALIVENESS_REQ_REQUESTED bit value
  176. */
  177. static u32 mei_txe_aliveness_req_get(struct mei_device *dev)
  178. {
  179. struct mei_txe_hw *hw = to_txe_hw(dev);
  180. u32 reg;
  181. reg = mei_txe_br_reg_read(hw, SICR_HOST_ALIVENESS_REQ_REG);
  182. return reg & SICR_HOST_ALIVENESS_REQ_REQUESTED;
  183. }
  184. /**
  185. * mei_txe_aliveness_get - get aliveness response register value
  186. *
  187. * @dev: the device structure
  188. *
  189. * Return: HICR_HOST_ALIVENESS_RESP_ACK bit from HICR_HOST_ALIVENESS_RESP
  190. * register
  191. */
  192. static u32 mei_txe_aliveness_get(struct mei_device *dev)
  193. {
  194. struct mei_txe_hw *hw = to_txe_hw(dev);
  195. u32 reg;
  196. reg = mei_txe_br_reg_read(hw, HICR_HOST_ALIVENESS_RESP_REG);
  197. return reg & HICR_HOST_ALIVENESS_RESP_ACK;
  198. }
  199. /**
  200. * mei_txe_aliveness_poll - waits for aliveness to settle
  201. *
  202. * @dev: the device structure
  203. * @expected: expected aliveness value
  204. *
  205. * Polls for HICR_HOST_ALIVENESS_RESP.ALIVENESS_RESP to be set
  206. *
  207. * Return: 0 if the expected value was received, -ETIME otherwise
  208. */
  209. static int mei_txe_aliveness_poll(struct mei_device *dev, u32 expected)
  210. {
  211. struct mei_txe_hw *hw = to_txe_hw(dev);
  212. ktime_t stop, start;
  213. start = ktime_get();
  214. stop = ktime_add(start, ms_to_ktime(SEC_ALIVENESS_WAIT_TIMEOUT));
  215. do {
  216. hw->aliveness = mei_txe_aliveness_get(dev);
  217. if (hw->aliveness == expected) {
  218. dev->pg_event = MEI_PG_EVENT_IDLE;
  219. dev_dbg(dev->dev, "aliveness settled after %lld usecs\n",
  220. ktime_to_us(ktime_sub(ktime_get(), start)));
  221. return 0;
  222. }
  223. usleep_range(20, 50);
  224. } while (ktime_before(ktime_get(), stop));
  225. dev->pg_event = MEI_PG_EVENT_IDLE;
  226. dev_err(dev->dev, "aliveness timed out\n");
  227. return -ETIME;
  228. }
  229. /**
  230. * mei_txe_aliveness_wait - waits for aliveness to settle
  231. *
  232. * @dev: the device structure
  233. * @expected: expected aliveness value
  234. *
  235. * Waits for HICR_HOST_ALIVENESS_RESP.ALIVENESS_RESP to be set
  236. *
  237. * Return: 0 on success and < 0 otherwise
  238. */
  239. static int mei_txe_aliveness_wait(struct mei_device *dev, u32 expected)
  240. {
  241. struct mei_txe_hw *hw = to_txe_hw(dev);
  242. const unsigned long timeout =
  243. msecs_to_jiffies(SEC_ALIVENESS_WAIT_TIMEOUT);
  244. long err;
  245. int ret;
  246. hw->aliveness = mei_txe_aliveness_get(dev);
  247. if (hw->aliveness == expected)
  248. return 0;
  249. mutex_unlock(&dev->device_lock);
  250. err = wait_event_timeout(hw->wait_aliveness_resp,
  251. dev->pg_event == MEI_PG_EVENT_RECEIVED, timeout);
  252. mutex_lock(&dev->device_lock);
  253. hw->aliveness = mei_txe_aliveness_get(dev);
  254. ret = hw->aliveness == expected ? 0 : -ETIME;
  255. if (ret)
  256. dev_warn(dev->dev, "aliveness timed out = %ld aliveness = %d event = %d\n",
  257. err, hw->aliveness, dev->pg_event);
  258. else
  259. dev_dbg(dev->dev, "aliveness settled after = %d msec aliveness = %d event = %d\n",
  260. jiffies_to_msecs(timeout - err),
  261. hw->aliveness, dev->pg_event);
  262. dev->pg_event = MEI_PG_EVENT_IDLE;
  263. return ret;
  264. }
  265. /**
  266. * mei_txe_aliveness_set_sync - sets an wait for aliveness to complete
  267. *
  268. * @dev: the device structure
  269. * @req: requested aliveness value
  270. *
  271. * Return: 0 on success and < 0 otherwise
  272. */
  273. int mei_txe_aliveness_set_sync(struct mei_device *dev, u32 req)
  274. {
  275. if (mei_txe_aliveness_set(dev, req))
  276. return mei_txe_aliveness_wait(dev, req);
  277. return 0;
  278. }
  279. /**
  280. * mei_txe_pg_in_transition - is device now in pg transition
  281. *
  282. * @dev: the device structure
  283. *
  284. * Return: true if in pg transition, false otherwise
  285. */
  286. static bool mei_txe_pg_in_transition(struct mei_device *dev)
  287. {
  288. return dev->pg_event == MEI_PG_EVENT_WAIT;
  289. }
  290. /**
  291. * mei_txe_pg_is_enabled - detect if PG is supported by HW
  292. *
  293. * @dev: the device structure
  294. *
  295. * Return: true is pg supported, false otherwise
  296. */
  297. static bool mei_txe_pg_is_enabled(struct mei_device *dev)
  298. {
  299. return true;
  300. }
  301. /**
  302. * mei_txe_pg_state - translate aliveness register value
  303. * to the mei power gating state
  304. *
  305. * @dev: the device structure
  306. *
  307. * Return: MEI_PG_OFF if aliveness is on and MEI_PG_ON otherwise
  308. */
  309. static inline enum mei_pg_state mei_txe_pg_state(struct mei_device *dev)
  310. {
  311. struct mei_txe_hw *hw = to_txe_hw(dev);
  312. return hw->aliveness ? MEI_PG_OFF : MEI_PG_ON;
  313. }
  314. /**
  315. * mei_txe_input_ready_interrupt_enable - sets the Input Ready Interrupt
  316. *
  317. * @dev: the device structure
  318. */
  319. static void mei_txe_input_ready_interrupt_enable(struct mei_device *dev)
  320. {
  321. struct mei_txe_hw *hw = to_txe_hw(dev);
  322. u32 hintmsk;
  323. /* Enable the SEC_IPC_HOST_INT_MASK_IN_RDY interrupt */
  324. hintmsk = mei_txe_sec_reg_read(hw, SEC_IPC_HOST_INT_MASK_REG);
  325. hintmsk |= SEC_IPC_HOST_INT_MASK_IN_RDY;
  326. mei_txe_sec_reg_write(hw, SEC_IPC_HOST_INT_MASK_REG, hintmsk);
  327. }
  328. /**
  329. * mei_txe_input_doorbell_set - sets bit 0 in
  330. * SEC_IPC_INPUT_DOORBELL.IPC_INPUT_DOORBELL.
  331. *
  332. * @hw: the txe hardware structure
  333. */
  334. static void mei_txe_input_doorbell_set(struct mei_txe_hw *hw)
  335. {
  336. /* Clear the interrupt cause */
  337. clear_bit(TXE_INTR_IN_READY_BIT, &hw->intr_cause);
  338. mei_txe_sec_reg_write(hw, SEC_IPC_INPUT_DOORBELL_REG, 1);
  339. }
  340. /**
  341. * mei_txe_output_ready_set - Sets the SICR_SEC_IPC_OUTPUT_STATUS bit to 1
  342. *
  343. * @hw: the txe hardware structure
  344. */
  345. static void mei_txe_output_ready_set(struct mei_txe_hw *hw)
  346. {
  347. mei_txe_br_reg_write(hw,
  348. SICR_SEC_IPC_OUTPUT_STATUS_REG,
  349. SEC_IPC_OUTPUT_STATUS_RDY);
  350. }
  351. /**
  352. * mei_txe_is_input_ready - check if TXE is ready for receiving data
  353. *
  354. * @dev: the device structure
  355. *
  356. * Return: true if INPUT STATUS READY bit is set
  357. */
  358. static bool mei_txe_is_input_ready(struct mei_device *dev)
  359. {
  360. struct mei_txe_hw *hw = to_txe_hw(dev);
  361. u32 status;
  362. status = mei_txe_sec_reg_read(hw, SEC_IPC_INPUT_STATUS_REG);
  363. return !!(SEC_IPC_INPUT_STATUS_RDY & status);
  364. }
  365. /**
  366. * mei_txe_intr_clear - clear all interrupts
  367. *
  368. * @dev: the device structure
  369. */
  370. static inline void mei_txe_intr_clear(struct mei_device *dev)
  371. {
  372. struct mei_txe_hw *hw = to_txe_hw(dev);
  373. mei_txe_sec_reg_write_silent(hw, SEC_IPC_HOST_INT_STATUS_REG,
  374. SEC_IPC_HOST_INT_STATUS_PENDING);
  375. mei_txe_br_reg_write(hw, HISR_REG, HISR_INT_STS_MSK);
  376. mei_txe_br_reg_write(hw, HHISR_REG, IPC_HHIER_MSK);
  377. }
  378. /**
  379. * mei_txe_intr_disable - disable all interrupts
  380. *
  381. * @dev: the device structure
  382. */
  383. static void mei_txe_intr_disable(struct mei_device *dev)
  384. {
  385. struct mei_txe_hw *hw = to_txe_hw(dev);
  386. mei_txe_br_reg_write(hw, HHIER_REG, 0);
  387. mei_txe_br_reg_write(hw, HIER_REG, 0);
  388. }
  389. /**
  390. * mei_txe_intr_enable - enable all interrupts
  391. *
  392. * @dev: the device structure
  393. */
  394. static void mei_txe_intr_enable(struct mei_device *dev)
  395. {
  396. struct mei_txe_hw *hw = to_txe_hw(dev);
  397. mei_txe_br_reg_write(hw, HHIER_REG, IPC_HHIER_MSK);
  398. mei_txe_br_reg_write(hw, HIER_REG, HIER_INT_EN_MSK);
  399. }
  400. /**
  401. * mei_txe_synchronize_irq - wait for pending IRQ handlers
  402. *
  403. * @dev: the device structure
  404. */
  405. static void mei_txe_synchronize_irq(struct mei_device *dev)
  406. {
  407. struct pci_dev *pdev = to_pci_dev(dev->dev);
  408. synchronize_irq(pdev->irq);
  409. }
  410. /**
  411. * mei_txe_pending_interrupts - check if there are pending interrupts
  412. * only Aliveness, Input ready, and output doorbell are of relevance
  413. *
  414. * @dev: the device structure
  415. *
  416. * Checks if there are pending interrupts
  417. * only Aliveness, Readiness, Input ready, and Output doorbell are relevant
  418. *
  419. * Return: true if there are pending interrupts
  420. */
  421. static bool mei_txe_pending_interrupts(struct mei_device *dev)
  422. {
  423. struct mei_txe_hw *hw = to_txe_hw(dev);
  424. bool ret = (hw->intr_cause & (TXE_INTR_READINESS |
  425. TXE_INTR_ALIVENESS |
  426. TXE_INTR_IN_READY |
  427. TXE_INTR_OUT_DB));
  428. if (ret) {
  429. dev_dbg(dev->dev,
  430. "Pending Interrupts InReady=%01d Readiness=%01d, Aliveness=%01d, OutDoor=%01d\n",
  431. !!(hw->intr_cause & TXE_INTR_IN_READY),
  432. !!(hw->intr_cause & TXE_INTR_READINESS),
  433. !!(hw->intr_cause & TXE_INTR_ALIVENESS),
  434. !!(hw->intr_cause & TXE_INTR_OUT_DB));
  435. }
  436. return ret;
  437. }
  438. /**
  439. * mei_txe_input_payload_write - write a dword to the host buffer
  440. * at offset idx
  441. *
  442. * @dev: the device structure
  443. * @idx: index in the host buffer
  444. * @value: value
  445. */
  446. static void mei_txe_input_payload_write(struct mei_device *dev,
  447. unsigned long idx, u32 value)
  448. {
  449. struct mei_txe_hw *hw = to_txe_hw(dev);
  450. mei_txe_sec_reg_write(hw, SEC_IPC_INPUT_PAYLOAD_REG +
  451. (idx * sizeof(u32)), value);
  452. }
  453. /**
  454. * mei_txe_out_data_read - read dword from the device buffer
  455. * at offset idx
  456. *
  457. * @dev: the device structure
  458. * @idx: index in the device buffer
  459. *
  460. * Return: register value at index
  461. */
  462. static u32 mei_txe_out_data_read(const struct mei_device *dev,
  463. unsigned long idx)
  464. {
  465. struct mei_txe_hw *hw = to_txe_hw(dev);
  466. return mei_txe_br_reg_read(hw,
  467. BRIDGE_IPC_OUTPUT_PAYLOAD_REG + (idx * sizeof(u32)));
  468. }
  469. /* Readiness */
  470. /**
  471. * mei_txe_readiness_set_host_rdy - set host readiness bit
  472. *
  473. * @dev: the device structure
  474. */
  475. static void mei_txe_readiness_set_host_rdy(struct mei_device *dev)
  476. {
  477. struct mei_txe_hw *hw = to_txe_hw(dev);
  478. mei_txe_br_reg_write(hw,
  479. SICR_HOST_IPC_READINESS_REQ_REG,
  480. SICR_HOST_IPC_READINESS_HOST_RDY);
  481. }
  482. /**
  483. * mei_txe_readiness_clear - clear host readiness bit
  484. *
  485. * @dev: the device structure
  486. */
  487. static void mei_txe_readiness_clear(struct mei_device *dev)
  488. {
  489. struct mei_txe_hw *hw = to_txe_hw(dev);
  490. mei_txe_br_reg_write(hw, SICR_HOST_IPC_READINESS_REQ_REG,
  491. SICR_HOST_IPC_READINESS_RDY_CLR);
  492. }
  493. /**
  494. * mei_txe_readiness_get - Reads and returns
  495. * the HICR_SEC_IPC_READINESS register value
  496. *
  497. * @dev: the device structure
  498. *
  499. * Return: the HICR_SEC_IPC_READINESS register value
  500. */
  501. static u32 mei_txe_readiness_get(struct mei_device *dev)
  502. {
  503. struct mei_txe_hw *hw = to_txe_hw(dev);
  504. return mei_txe_br_reg_read(hw, HICR_SEC_IPC_READINESS_REG);
  505. }
  506. /**
  507. * mei_txe_readiness_is_sec_rdy - check readiness
  508. * for HICR_SEC_IPC_READINESS_SEC_RDY
  509. *
  510. * @readiness: cached readiness state
  511. *
  512. * Return: true if readiness bit is set
  513. */
  514. static inline bool mei_txe_readiness_is_sec_rdy(u32 readiness)
  515. {
  516. return !!(readiness & HICR_SEC_IPC_READINESS_SEC_RDY);
  517. }
  518. /**
  519. * mei_txe_hw_is_ready - check if the hw is ready
  520. *
  521. * @dev: the device structure
  522. *
  523. * Return: true if sec is ready
  524. */
  525. static bool mei_txe_hw_is_ready(struct mei_device *dev)
  526. {
  527. u32 readiness = mei_txe_readiness_get(dev);
  528. return mei_txe_readiness_is_sec_rdy(readiness);
  529. }
  530. /**
  531. * mei_txe_host_is_ready - check if the host is ready
  532. *
  533. * @dev: the device structure
  534. *
  535. * Return: true if host is ready
  536. */
  537. static inline bool mei_txe_host_is_ready(struct mei_device *dev)
  538. {
  539. struct mei_txe_hw *hw = to_txe_hw(dev);
  540. u32 reg = mei_txe_br_reg_read(hw, HICR_SEC_IPC_READINESS_REG);
  541. return !!(reg & HICR_SEC_IPC_READINESS_HOST_RDY);
  542. }
  543. /**
  544. * mei_txe_readiness_wait - wait till readiness settles
  545. *
  546. * @dev: the device structure
  547. *
  548. * Return: 0 on success and -ETIME on timeout
  549. */
  550. static int mei_txe_readiness_wait(struct mei_device *dev)
  551. {
  552. if (mei_txe_hw_is_ready(dev))
  553. return 0;
  554. mutex_unlock(&dev->device_lock);
  555. wait_event_timeout(dev->wait_hw_ready, dev->recvd_hw_ready,
  556. msecs_to_jiffies(SEC_RESET_WAIT_TIMEOUT));
  557. mutex_lock(&dev->device_lock);
  558. if (!dev->recvd_hw_ready) {
  559. dev_err(dev->dev, "wait for readiness failed\n");
  560. return -ETIME;
  561. }
  562. dev->recvd_hw_ready = false;
  563. return 0;
  564. }
  565. static const struct mei_fw_status mei_txe_fw_sts = {
  566. .count = 2,
  567. .status[0] = PCI_CFG_TXE_FW_STS0,
  568. .status[1] = PCI_CFG_TXE_FW_STS1
  569. };
  570. /**
  571. * mei_txe_fw_status - read fw status register from pci config space
  572. *
  573. * @dev: mei device
  574. * @fw_status: fw status register values
  575. *
  576. * Return: 0 on success, error otherwise
  577. */
  578. static int mei_txe_fw_status(struct mei_device *dev,
  579. struct mei_fw_status *fw_status)
  580. {
  581. const struct mei_fw_status *fw_src = &mei_txe_fw_sts;
  582. struct pci_dev *pdev = to_pci_dev(dev->dev);
  583. int ret;
  584. int i;
  585. if (!fw_status)
  586. return -EINVAL;
  587. fw_status->count = fw_src->count;
  588. for (i = 0; i < fw_src->count && i < MEI_FW_STATUS_MAX; i++) {
  589. ret = pci_read_config_dword(pdev, fw_src->status[i],
  590. &fw_status->status[i]);
  591. trace_mei_pci_cfg_read(dev->dev, "PCI_CFG_HSF_X",
  592. fw_src->status[i],
  593. fw_status->status[i]);
  594. if (ret)
  595. return ret;
  596. }
  597. return 0;
  598. }
  599. /**
  600. * mei_txe_hw_config - configure hardware at the start of the devices
  601. *
  602. * @dev: the device structure
  603. *
  604. * Configure hardware at the start of the device should be done only
  605. * once at the device probe time
  606. */
  607. static void mei_txe_hw_config(struct mei_device *dev)
  608. {
  609. struct mei_txe_hw *hw = to_txe_hw(dev);
  610. hw->aliveness = mei_txe_aliveness_get(dev);
  611. hw->readiness = mei_txe_readiness_get(dev);
  612. dev_dbg(dev->dev, "aliveness_resp = 0x%08x, readiness = 0x%08x.\n",
  613. hw->aliveness, hw->readiness);
  614. }
  615. /**
  616. * mei_txe_write - writes a message to device.
  617. *
  618. * @dev: the device structure
  619. * @hdr: header of message
  620. * @hdr_len: header length in bytes - must multiplication of a slot (4bytes)
  621. * @data: payload
  622. * @data_len: paylead length in bytes
  623. *
  624. * Return: 0 if success, < 0 - otherwise.
  625. */
  626. static int mei_txe_write(struct mei_device *dev,
  627. const void *hdr, size_t hdr_len,
  628. const void *data, size_t data_len)
  629. {
  630. struct mei_txe_hw *hw = to_txe_hw(dev);
  631. unsigned long rem;
  632. const u32 *reg_buf;
  633. u32 slots = TXE_HBUF_DEPTH;
  634. u32 dw_cnt;
  635. unsigned long i, j;
  636. if (WARN_ON(!hdr || !data || hdr_len & 0x3))
  637. return -EINVAL;
  638. dev_dbg(dev->dev, MEI_HDR_FMT, MEI_HDR_PRM((struct mei_msg_hdr *)hdr));
  639. dw_cnt = mei_data2slots(hdr_len + data_len);
  640. if (dw_cnt > slots)
  641. return -EMSGSIZE;
  642. if (WARN(!hw->aliveness, "txe write: aliveness not asserted\n"))
  643. return -EAGAIN;
  644. /* Enable Input Ready Interrupt. */
  645. mei_txe_input_ready_interrupt_enable(dev);
  646. if (!mei_txe_is_input_ready(dev)) {
  647. char fw_sts_str[MEI_FW_STATUS_STR_SZ];
  648. mei_fw_status_str(dev, fw_sts_str, MEI_FW_STATUS_STR_SZ);
  649. dev_err(dev->dev, "Input is not ready %s\n", fw_sts_str);
  650. return -EAGAIN;
  651. }
  652. reg_buf = hdr;
  653. for (i = 0; i < hdr_len / MEI_SLOT_SIZE; i++)
  654. mei_txe_input_payload_write(dev, i, reg_buf[i]);
  655. reg_buf = data;
  656. for (j = 0; j < data_len / MEI_SLOT_SIZE; j++)
  657. mei_txe_input_payload_write(dev, i + j, reg_buf[j]);
  658. rem = data_len & 0x3;
  659. if (rem > 0) {
  660. u32 reg = 0;
  661. memcpy(&reg, (const u8 *)data + data_len - rem, rem);
  662. mei_txe_input_payload_write(dev, i + j, reg);
  663. }
  664. /* after each write the whole buffer is consumed */
  665. hw->slots = 0;
  666. /* Set Input-Doorbell */
  667. mei_txe_input_doorbell_set(hw);
  668. return 0;
  669. }
  670. /**
  671. * mei_txe_hbuf_depth - mimics the me hbuf circular buffer
  672. *
  673. * @dev: the device structure
  674. *
  675. * Return: the TXE_HBUF_DEPTH
  676. */
  677. static u32 mei_txe_hbuf_depth(const struct mei_device *dev)
  678. {
  679. return TXE_HBUF_DEPTH;
  680. }
  681. /**
  682. * mei_txe_hbuf_empty_slots - mimics the me hbuf circular buffer
  683. *
  684. * @dev: the device structure
  685. *
  686. * Return: always TXE_HBUF_DEPTH
  687. */
  688. static int mei_txe_hbuf_empty_slots(struct mei_device *dev)
  689. {
  690. struct mei_txe_hw *hw = to_txe_hw(dev);
  691. return hw->slots;
  692. }
  693. /**
  694. * mei_txe_count_full_read_slots - mimics the me device circular buffer
  695. *
  696. * @dev: the device structure
  697. *
  698. * Return: always buffer size in dwords count
  699. */
  700. static int mei_txe_count_full_read_slots(struct mei_device *dev)
  701. {
  702. /* read buffers has static size */
  703. return TXE_HBUF_DEPTH;
  704. }
  705. /**
  706. * mei_txe_read_hdr - read message header which is always in 4 first bytes
  707. *
  708. * @dev: the device structure
  709. *
  710. * Return: mei message header
  711. */
  712. static u32 mei_txe_read_hdr(const struct mei_device *dev)
  713. {
  714. return mei_txe_out_data_read(dev, 0);
  715. }
  716. /**
  717. * mei_txe_read - reads a message from the txe device.
  718. *
  719. * @dev: the device structure
  720. * @buf: message buffer will be written
  721. * @len: message size will be read
  722. *
  723. * Return: -EINVAL on error wrong argument and 0 on success
  724. */
  725. static int mei_txe_read(struct mei_device *dev,
  726. unsigned char *buf, unsigned long len)
  727. {
  728. struct mei_txe_hw *hw = to_txe_hw(dev);
  729. u32 *reg_buf, reg;
  730. u32 rem;
  731. u32 i;
  732. if (WARN_ON(!buf || !len))
  733. return -EINVAL;
  734. reg_buf = (u32 *)buf;
  735. rem = len & 0x3;
  736. dev_dbg(dev->dev, "buffer-length = %lu buf[0]0x%08X\n",
  737. len, mei_txe_out_data_read(dev, 0));
  738. for (i = 0; i < len / MEI_SLOT_SIZE; i++) {
  739. /* skip header: index starts from 1 */
  740. reg = mei_txe_out_data_read(dev, i + 1);
  741. dev_dbg(dev->dev, "buf[%d] = 0x%08X\n", i, reg);
  742. *reg_buf++ = reg;
  743. }
  744. if (rem) {
  745. reg = mei_txe_out_data_read(dev, i + 1);
  746. memcpy(reg_buf, &reg, rem);
  747. }
  748. mei_txe_output_ready_set(hw);
  749. return 0;
  750. }
  751. /**
  752. * mei_txe_hw_reset - resets host and fw.
  753. *
  754. * @dev: the device structure
  755. * @intr_enable: if interrupt should be enabled after reset.
  756. *
  757. * Return: 0 on success and < 0 in case of error
  758. */
  759. static int mei_txe_hw_reset(struct mei_device *dev, bool intr_enable)
  760. {
  761. struct mei_txe_hw *hw = to_txe_hw(dev);
  762. u32 aliveness_req;
  763. /*
  764. * read input doorbell to ensure consistency between Bridge and SeC
  765. * return value might be garbage return
  766. */
  767. (void)mei_txe_sec_reg_read_silent(hw, SEC_IPC_INPUT_DOORBELL_REG);
  768. aliveness_req = mei_txe_aliveness_req_get(dev);
  769. hw->aliveness = mei_txe_aliveness_get(dev);
  770. /* Disable interrupts in this stage we will poll */
  771. mei_txe_intr_disable(dev);
  772. /*
  773. * If Aliveness Request and Aliveness Response are not equal then
  774. * wait for them to be equal
  775. * Since we might have interrupts disabled - poll for it
  776. */
  777. if (aliveness_req != hw->aliveness)
  778. if (mei_txe_aliveness_poll(dev, aliveness_req) < 0) {
  779. dev_err(dev->dev, "wait for aliveness settle failed ... bailing out\n");
  780. return -EIO;
  781. }
  782. /*
  783. * If Aliveness Request and Aliveness Response are set then clear them
  784. */
  785. if (aliveness_req) {
  786. mei_txe_aliveness_set(dev, 0);
  787. if (mei_txe_aliveness_poll(dev, 0) < 0) {
  788. dev_err(dev->dev, "wait for aliveness failed ... bailing out\n");
  789. return -EIO;
  790. }
  791. }
  792. /*
  793. * Set readiness RDY_CLR bit
  794. */
  795. mei_txe_readiness_clear(dev);
  796. return 0;
  797. }
  798. /**
  799. * mei_txe_hw_start - start the hardware after reset
  800. *
  801. * @dev: the device structure
  802. *
  803. * Return: 0 on success an error code otherwise
  804. */
  805. static int mei_txe_hw_start(struct mei_device *dev)
  806. {
  807. struct mei_txe_hw *hw = to_txe_hw(dev);
  808. int ret;
  809. u32 hisr;
  810. /* bring back interrupts */
  811. mei_txe_intr_enable(dev);
  812. ret = mei_txe_readiness_wait(dev);
  813. if (ret < 0) {
  814. dev_err(dev->dev, "waiting for readiness failed\n");
  815. return ret;
  816. }
  817. /*
  818. * If HISR.INT2_STS interrupt status bit is set then clear it.
  819. */
  820. hisr = mei_txe_br_reg_read(hw, HISR_REG);
  821. if (hisr & HISR_INT_2_STS)
  822. mei_txe_br_reg_write(hw, HISR_REG, HISR_INT_2_STS);
  823. /* Clear the interrupt cause of OutputDoorbell */
  824. clear_bit(TXE_INTR_OUT_DB_BIT, &hw->intr_cause);
  825. ret = mei_txe_aliveness_set_sync(dev, 1);
  826. if (ret < 0) {
  827. dev_err(dev->dev, "wait for aliveness failed ... bailing out\n");
  828. return ret;
  829. }
  830. pm_runtime_set_active(dev->dev);
  831. /* enable input ready interrupts:
  832. * SEC_IPC_HOST_INT_MASK.IPC_INPUT_READY_INT_MASK
  833. */
  834. mei_txe_input_ready_interrupt_enable(dev);
  835. /* Set the SICR_SEC_IPC_OUTPUT_STATUS.IPC_OUTPUT_READY bit */
  836. mei_txe_output_ready_set(hw);
  837. /* Set bit SICR_HOST_IPC_READINESS.HOST_RDY
  838. */
  839. mei_txe_readiness_set_host_rdy(dev);
  840. return 0;
  841. }
  842. /**
  843. * mei_txe_check_and_ack_intrs - translate multi BAR interrupt into
  844. * single bit mask and acknowledge the interrupts
  845. *
  846. * @dev: the device structure
  847. * @do_ack: acknowledge interrupts
  848. *
  849. * Return: true if found interrupts to process.
  850. */
  851. static bool mei_txe_check_and_ack_intrs(struct mei_device *dev, bool do_ack)
  852. {
  853. struct mei_txe_hw *hw = to_txe_hw(dev);
  854. u32 hisr;
  855. u32 hhisr;
  856. u32 ipc_isr;
  857. u32 aliveness;
  858. bool generated;
  859. /* read interrupt registers */
  860. hhisr = mei_txe_br_reg_read(hw, HHISR_REG);
  861. generated = (hhisr & IPC_HHIER_MSK);
  862. if (!generated)
  863. goto out;
  864. hisr = mei_txe_br_reg_read(hw, HISR_REG);
  865. aliveness = mei_txe_aliveness_get(dev);
  866. if (hhisr & IPC_HHIER_SEC && aliveness) {
  867. ipc_isr = mei_txe_sec_reg_read_silent(hw,
  868. SEC_IPC_HOST_INT_STATUS_REG);
  869. } else {
  870. ipc_isr = 0;
  871. hhisr &= ~IPC_HHIER_SEC;
  872. }
  873. generated = generated ||
  874. (hisr & HISR_INT_STS_MSK) ||
  875. (ipc_isr & SEC_IPC_HOST_INT_STATUS_PENDING);
  876. if (generated && do_ack) {
  877. /* Save the interrupt causes */
  878. hw->intr_cause |= hisr & HISR_INT_STS_MSK;
  879. if (ipc_isr & SEC_IPC_HOST_INT_STATUS_IN_RDY)
  880. hw->intr_cause |= TXE_INTR_IN_READY;
  881. mei_txe_intr_disable(dev);
  882. /* Clear the interrupts in hierarchy:
  883. * IPC and Bridge, than the High Level */
  884. mei_txe_sec_reg_write_silent(hw,
  885. SEC_IPC_HOST_INT_STATUS_REG, ipc_isr);
  886. mei_txe_br_reg_write(hw, HISR_REG, hisr);
  887. mei_txe_br_reg_write(hw, HHISR_REG, hhisr);
  888. }
  889. out:
  890. return generated;
  891. }
  892. /**
  893. * mei_txe_irq_quick_handler - The ISR of the MEI device
  894. *
  895. * @irq: The irq number
  896. * @dev_id: pointer to the device structure
  897. *
  898. * Return: IRQ_WAKE_THREAD if interrupt is designed for the device
  899. * IRQ_NONE otherwise
  900. */
  901. irqreturn_t mei_txe_irq_quick_handler(int irq, void *dev_id)
  902. {
  903. struct mei_device *dev = dev_id;
  904. if (mei_txe_check_and_ack_intrs(dev, true))
  905. return IRQ_WAKE_THREAD;
  906. return IRQ_NONE;
  907. }
  908. /**
  909. * mei_txe_irq_thread_handler - txe interrupt thread
  910. *
  911. * @irq: The irq number
  912. * @dev_id: pointer to the device structure
  913. *
  914. * Return: IRQ_HANDLED
  915. */
  916. irqreturn_t mei_txe_irq_thread_handler(int irq, void *dev_id)
  917. {
  918. struct mei_device *dev = (struct mei_device *) dev_id;
  919. struct mei_txe_hw *hw = to_txe_hw(dev);
  920. struct list_head cmpl_list;
  921. s32 slots;
  922. int rets = 0;
  923. dev_dbg(dev->dev, "irq thread: Interrupt Registers HHISR|HISR|SEC=%02X|%04X|%02X\n",
  924. mei_txe_br_reg_read(hw, HHISR_REG),
  925. mei_txe_br_reg_read(hw, HISR_REG),
  926. mei_txe_sec_reg_read_silent(hw, SEC_IPC_HOST_INT_STATUS_REG));
  927. /* initialize our complete list */
  928. mutex_lock(&dev->device_lock);
  929. INIT_LIST_HEAD(&cmpl_list);
  930. if (pci_dev_msi_enabled(to_pci_dev(dev->dev)))
  931. mei_txe_check_and_ack_intrs(dev, true);
  932. /* show irq events */
  933. mei_txe_pending_interrupts(dev);
  934. hw->aliveness = mei_txe_aliveness_get(dev);
  935. hw->readiness = mei_txe_readiness_get(dev);
  936. /* Readiness:
  937. * Detection of TXE driver going through reset
  938. * or TXE driver resetting the HECI interface.
  939. */
  940. if (test_and_clear_bit(TXE_INTR_READINESS_BIT, &hw->intr_cause)) {
  941. dev_dbg(dev->dev, "Readiness Interrupt was received...\n");
  942. /* Check if SeC is going through reset */
  943. if (mei_txe_readiness_is_sec_rdy(hw->readiness)) {
  944. dev_dbg(dev->dev, "we need to start the dev.\n");
  945. dev->recvd_hw_ready = true;
  946. } else {
  947. dev->recvd_hw_ready = false;
  948. if (dev->dev_state != MEI_DEV_RESETTING) {
  949. dev_warn(dev->dev, "FW not ready: resetting.\n");
  950. schedule_work(&dev->reset_work);
  951. goto end;
  952. }
  953. }
  954. wake_up(&dev->wait_hw_ready);
  955. }
  956. /************************************************************/
  957. /* Check interrupt cause:
  958. * Aliveness: Detection of SeC acknowledge of host request that
  959. * it remain alive or host cancellation of that request.
  960. */
  961. if (test_and_clear_bit(TXE_INTR_ALIVENESS_BIT, &hw->intr_cause)) {
  962. /* Clear the interrupt cause */
  963. dev_dbg(dev->dev,
  964. "Aliveness Interrupt: Status: %d\n", hw->aliveness);
  965. dev->pg_event = MEI_PG_EVENT_RECEIVED;
  966. if (waitqueue_active(&hw->wait_aliveness_resp))
  967. wake_up(&hw->wait_aliveness_resp);
  968. }
  969. /* Output Doorbell:
  970. * Detection of SeC having sent output to host
  971. */
  972. slots = mei_count_full_read_slots(dev);
  973. if (test_and_clear_bit(TXE_INTR_OUT_DB_BIT, &hw->intr_cause)) {
  974. /* Read from TXE */
  975. rets = mei_irq_read_handler(dev, &cmpl_list, &slots);
  976. if (rets &&
  977. (dev->dev_state != MEI_DEV_RESETTING &&
  978. dev->dev_state != MEI_DEV_POWER_DOWN)) {
  979. dev_err(dev->dev,
  980. "mei_irq_read_handler ret = %d.\n", rets);
  981. schedule_work(&dev->reset_work);
  982. goto end;
  983. }
  984. }
  985. /* Input Ready: Detection if host can write to SeC */
  986. if (test_and_clear_bit(TXE_INTR_IN_READY_BIT, &hw->intr_cause)) {
  987. dev->hbuf_is_ready = true;
  988. hw->slots = TXE_HBUF_DEPTH;
  989. }
  990. if (hw->aliveness && dev->hbuf_is_ready) {
  991. /* get the real register value */
  992. dev->hbuf_is_ready = mei_hbuf_is_ready(dev);
  993. rets = mei_irq_write_handler(dev, &cmpl_list);
  994. if (rets && rets != -EMSGSIZE)
  995. dev_err(dev->dev, "mei_irq_write_handler ret = %d.\n",
  996. rets);
  997. dev->hbuf_is_ready = mei_hbuf_is_ready(dev);
  998. }
  999. mei_irq_compl_handler(dev, &cmpl_list);
  1000. end:
  1001. dev_dbg(dev->dev, "interrupt thread end ret = %d\n", rets);
  1002. mutex_unlock(&dev->device_lock);
  1003. mei_enable_interrupts(dev);
  1004. return IRQ_HANDLED;
  1005. }
  1006. static const struct mei_hw_ops mei_txe_hw_ops = {
  1007. .host_is_ready = mei_txe_host_is_ready,
  1008. .fw_status = mei_txe_fw_status,
  1009. .pg_state = mei_txe_pg_state,
  1010. .hw_is_ready = mei_txe_hw_is_ready,
  1011. .hw_reset = mei_txe_hw_reset,
  1012. .hw_config = mei_txe_hw_config,
  1013. .hw_start = mei_txe_hw_start,
  1014. .pg_in_transition = mei_txe_pg_in_transition,
  1015. .pg_is_enabled = mei_txe_pg_is_enabled,
  1016. .intr_clear = mei_txe_intr_clear,
  1017. .intr_enable = mei_txe_intr_enable,
  1018. .intr_disable = mei_txe_intr_disable,
  1019. .synchronize_irq = mei_txe_synchronize_irq,
  1020. .hbuf_free_slots = mei_txe_hbuf_empty_slots,
  1021. .hbuf_is_ready = mei_txe_is_input_ready,
  1022. .hbuf_depth = mei_txe_hbuf_depth,
  1023. .write = mei_txe_write,
  1024. .rdbuf_full_slots = mei_txe_count_full_read_slots,
  1025. .read_hdr = mei_txe_read_hdr,
  1026. .read = mei_txe_read,
  1027. };
  1028. /**
  1029. * mei_txe_dev_init - allocates and initializes txe hardware specific structure
  1030. *
  1031. * @pdev: pci device
  1032. *
  1033. * Return: struct mei_device * on success or NULL
  1034. */
  1035. struct mei_device *mei_txe_dev_init(struct pci_dev *pdev)
  1036. {
  1037. struct mei_device *dev;
  1038. struct mei_txe_hw *hw;
  1039. dev = devm_kzalloc(&pdev->dev, sizeof(struct mei_device) +
  1040. sizeof(struct mei_txe_hw), GFP_KERNEL);
  1041. if (!dev)
  1042. return NULL;
  1043. mei_device_init(dev, &pdev->dev, &mei_txe_hw_ops);
  1044. hw = to_txe_hw(dev);
  1045. init_waitqueue_head(&hw->wait_aliveness_resp);
  1046. return dev;
  1047. }
  1048. /**
  1049. * mei_txe_setup_satt2 - SATT2 configuration for DMA support.
  1050. *
  1051. * @dev: the device structure
  1052. * @addr: physical address start of the range
  1053. * @range: physical range size
  1054. *
  1055. * Return: 0 on success an error code otherwise
  1056. */
  1057. int mei_txe_setup_satt2(struct mei_device *dev, phys_addr_t addr, u32 range)
  1058. {
  1059. struct mei_txe_hw *hw = to_txe_hw(dev);
  1060. u32 lo32 = lower_32_bits(addr);
  1061. u32 hi32 = upper_32_bits(addr);
  1062. u32 ctrl;
  1063. /* SATT is limited to 36 Bits */
  1064. if (hi32 & ~0xF)
  1065. return -EINVAL;
  1066. /* SATT has to be 16Byte aligned */
  1067. if (lo32 & 0xF)
  1068. return -EINVAL;
  1069. /* SATT range has to be 4Bytes aligned */
  1070. if (range & 0x4)
  1071. return -EINVAL;
  1072. /* SATT is limited to 32 MB range*/
  1073. if (range > SATT_RANGE_MAX)
  1074. return -EINVAL;
  1075. ctrl = SATT2_CTRL_VALID_MSK;
  1076. ctrl |= hi32 << SATT2_CTRL_BR_BASE_ADDR_REG_SHIFT;
  1077. mei_txe_br_reg_write(hw, SATT2_SAP_SIZE_REG, range);
  1078. mei_txe_br_reg_write(hw, SATT2_BRG_BA_LSB_REG, lo32);
  1079. mei_txe_br_reg_write(hw, SATT2_CTRL_REG, ctrl);
  1080. dev_dbg(dev->dev, "SATT2: SAP_SIZE_OFFSET=0x%08X, BRG_BA_LSB_OFFSET=0x%08X, CTRL_OFFSET=0x%08X\n",
  1081. range, lo32, ctrl);
  1082. return 0;
  1083. }