tp3780i.c
上传用户:lgb322
上传日期:2013-02-24
资源大小:30529k
文件大小:18k
源码类别:

嵌入式Linux

开发平台:

Unix_Linux

  1. /*
  2. *
  3. * tp3780i.c -- board driver for 3780i on ThinkPads
  4. *
  5. *
  6. * Written By: Mike Sullivan IBM Corporation
  7. *
  8. * Copyright (C) 1999 IBM Corporation
  9. *
  10. * This program is free software; you can redistribute it and/or modify
  11. * it under the terms of the GNU General Public License as published by
  12. * the Free Software Foundation; either version 2 of the License, or
  13. * (at your option) any later version.
  14. *
  15. * This program is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  18. * GNU General Public License for more details.
  19. *
  20. * NO WARRANTY
  21. * THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR
  22. * CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT
  23. * LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
  24. * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is
  25. * solely responsible for determining the appropriateness of using and
  26. * distributing the Program and assumes all risks associated with its
  27. * exercise of rights under this Agreement, including but not limited to
  28. * the risks and costs of program errors, damage to or loss of data,
  29. * programs or equipment, and unavailability or interruption of operations.
  30. *
  31. * DISCLAIMER OF LIABILITY
  32. * NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY
  33. * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  34. * DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND
  35. * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
  36. * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
  37. * USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
  38. * HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES
  39. *
  40. * You should have received a copy of the GNU General Public License
  41. * along with this program; if not, write to the Free Software
  42. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  43. *
  44. *
  45. * 10/23/2000 - Alpha Release
  46. * First release to the public
  47. */
  48. #include <linux/version.h>
  49. #include <linux/kernel.h>
  50. #include <linux/ptrace.h>
  51. #include <linux/ioport.h>
  52. #include <asm/io.h>
  53. #include "smapi.h"
  54. #include "mwavedd.h"
  55. #include "tp3780i.h"
  56. #include "3780i.h"
  57. #include "mwavepub.h"
  58. extern MWAVE_DEVICE_DATA mwave_s_mdd;
  59. static unsigned short s_ausThinkpadIrqToField[16] =
  60. { 0xFFFF, 0xFFFF, 0xFFFF, 0x0001, 0x0002, 0x0003, 0xFFFF, 0x0004,
  61. 0xFFFF, 0xFFFF, 0x0005, 0x0006, 0xFFFF, 0xFFFF, 0xFFFF, 0x0007 };
  62. static unsigned short s_ausThinkpadDmaToField[8] =
  63. { 0x0001, 0x0002, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0x0003, 0x0004 };
  64. static unsigned short s_numIrqs = 16, s_numDmas = 8;
  65. static void EnableSRAM(THINKPAD_BD_DATA * pBDData)
  66. {
  67. DSP_3780I_CONFIG_SETTINGS *pSettings = &pBDData->rDspSettings;
  68. unsigned short usDspBaseIO = pSettings->usDspBaseIO;
  69. DSP_GPIO_OUTPUT_DATA_15_8 rGpioOutputData;
  70. DSP_GPIO_DRIVER_ENABLE_15_8 rGpioDriverEnable;
  71. DSP_GPIO_MODE_15_8 rGpioMode;
  72. PRINTK_1(TRACE_TP3780I, "tp3780i::EnableSRAM, entryn");
  73. MKWORD(rGpioMode) = ReadMsaCfg(DSP_GpioModeControl_15_8);
  74. rGpioMode.GpioMode10 = 0;
  75. WriteMsaCfg(DSP_GpioModeControl_15_8, MKWORD(rGpioMode));
  76. MKWORD(rGpioDriverEnable) = 0;
  77. rGpioDriverEnable.Enable10 = TRUE;
  78. rGpioDriverEnable.Mask10 = TRUE;
  79. WriteMsaCfg(DSP_GpioDriverEnable_15_8, MKWORD(rGpioDriverEnable));
  80. MKWORD(rGpioOutputData) = 0;
  81. rGpioOutputData.Latch10 = 0;
  82. rGpioOutputData.Mask10 = TRUE;
  83. WriteMsaCfg(DSP_GpioOutputData_15_8, MKWORD(rGpioOutputData));
  84. PRINTK_1(TRACE_TP3780I, "tp3780i::EnableSRAM exitn");
  85. }
  86. static void UartInterrupt(int irq, void *dev_id, struct pt_regs *regs)
  87. {
  88. PRINTK_3(TRACE_TP3780I,
  89. "tp3780i::UartInterrupt entry irq %x dev_id %xn", irq, (int) dev_id);
  90. }
  91. static void DspInterrupt(int irq, void *dev_id, struct pt_regs *regs)
  92. {
  93. pMWAVE_DEVICE_DATA pDrvData = &mwave_s_mdd;
  94. DSP_3780I_CONFIG_SETTINGS *pSettings = &pDrvData->rBDData.rDspSettings;
  95. unsigned short usDspBaseIO = pSettings->usDspBaseIO;
  96. unsigned short usIPCSource = 0, usIsolationMask, usPCNum;
  97. PRINTK_3(TRACE_TP3780I,
  98. "tp3780i::DspInterrupt entry irq %x dev_id %xn", irq, (int) dev_id);
  99. if (dsp3780I_GetIPCSource(usDspBaseIO, &usIPCSource) == 0) {
  100. PRINTK_2(TRACE_TP3780I,
  101. "tp3780i::DspInterrupt, return from dsp3780i_GetIPCSource, usIPCSource %xn",
  102. usIPCSource);
  103. usIsolationMask = 1;
  104. for (usPCNum = 1; usPCNum <= 16; usPCNum++) {
  105. if (usIPCSource & usIsolationMask) {
  106. usIPCSource &= ~usIsolationMask;
  107. PRINTK_3(TRACE_TP3780I,
  108. "tp3780i::DspInterrupt usPCNum %x usIPCSource %xn",
  109. usPCNum, usIPCSource);
  110. if (pDrvData->IPCs[usPCNum - 1].usIntCount == 0) {
  111. pDrvData->IPCs[usPCNum - 1].usIntCount = 1;
  112. }
  113. PRINTK_2(TRACE_TP3780I,
  114. "tp3780i::DspInterrupt usIntCount %xn",
  115. pDrvData->IPCs[usPCNum - 1].usIntCount);
  116. if (pDrvData->IPCs[usPCNum - 1].bIsEnabled == TRUE) {
  117. PRINTK_2(TRACE_TP3780I,
  118. "tp3780i::DspInterrupt, waking up usPCNum %xn",
  119. usPCNum - 1);
  120. wake_up_interruptible(&pDrvData->IPCs[usPCNum - 1].ipc_wait_queue);
  121. } else {
  122. PRINTK_2(TRACE_TP3780I,
  123. "tp3780i::DspInterrupt, no one waiting for IPC %xn",
  124. usPCNum - 1);
  125. }
  126. }
  127. if (usIPCSource == 0)
  128. break;
  129. /* try next IPC */
  130. usIsolationMask = usIsolationMask << 1;
  131. }
  132. } else {
  133. PRINTK_1(TRACE_TP3780I,
  134. "tp3780i::DspInterrupt, return false from dsp3780i_GetIPCSourcen");
  135. }
  136. PRINTK_1(TRACE_TP3780I, "tp3780i::DspInterrupt exitn");
  137. }
  138. int tp3780I_InitializeBoardData(THINKPAD_BD_DATA * pBDData)
  139. {
  140. int retval = 0;
  141. DSP_3780I_CONFIG_SETTINGS *pSettings = &pBDData->rDspSettings;
  142. PRINTK_2(TRACE_TP3780I, "tp3780i::tp3780I_InitializeBoardData entry pBDData %pn", pBDData);
  143. pBDData->bDSPEnabled = FALSE;
  144. pSettings->bInterruptClaimed = FALSE;
  145. retval = smapi_init();
  146. if (retval) {
  147. PRINTK_ERROR(KERN_ERR_MWAVE "tp3780i::tp3780I_InitializeBoardData: Error: SMAPI is not available on this machinen");
  148. } else {
  149. if (mwave_3780i_irq || mwave_3780i_io || mwave_uart_irq || mwave_uart_io) {
  150. retval = smapi_set_DSP_cfg();
  151. }
  152. }
  153. PRINTK_2(TRACE_TP3780I, "tp3780i::tp3780I_InitializeBoardData exit retval %xn", retval);
  154. return retval;
  155. }
  156. int tp3780I_Cleanup(THINKPAD_BD_DATA * pBDData)
  157. {
  158. int retval = 0;
  159. PRINTK_2(TRACE_TP3780I,
  160. "tp3780i::tp3780I_Cleanup entry and exit pBDData %pn", pBDData);
  161. return retval;
  162. }
  163. int tp3780I_CalcResources(THINKPAD_BD_DATA * pBDData)
  164. {
  165. SMAPI_DSP_SETTINGS rSmapiInfo;
  166. DSP_3780I_CONFIG_SETTINGS *pSettings = &pBDData->rDspSettings;
  167. PRINTK_2(TRACE_TP3780I,
  168. "tp3780i::tp3780I_CalcResources entry pBDData %pn", pBDData);
  169. if (smapi_query_DSP_cfg(&rSmapiInfo)) {
  170. PRINTK_ERROR(KERN_ERR_MWAVE "tp3780i::tp3780I_CalcResources: Error: Could not query DSP config. Aborting.n");
  171. return -EIO;
  172. }
  173. /* Sanity check */
  174. if (
  175. ( rSmapiInfo.usDspIRQ == 0 )
  176. || ( rSmapiInfo.usDspBaseIO ==  0 )
  177. || ( rSmapiInfo.usUartIRQ ==  0 )
  178. || ( rSmapiInfo.usUartBaseIO ==  0 )
  179. ) {
  180. PRINTK_ERROR(KERN_ERR_MWAVE "tp3780i::tp3780I_CalcResources: Error: Illegal resource setting. Aborting.n");
  181. return -EIO;
  182. }
  183. pSettings->bDSPEnabled = (rSmapiInfo.bDSPEnabled && rSmapiInfo.bDSPPresent);
  184. pSettings->bModemEnabled = rSmapiInfo.bModemEnabled;
  185. pSettings->usDspIrq = rSmapiInfo.usDspIRQ;
  186. pSettings->usDspDma = rSmapiInfo.usDspDMA;
  187. pSettings->usDspBaseIO = rSmapiInfo.usDspBaseIO;
  188. pSettings->usUartIrq = rSmapiInfo.usUartIRQ;
  189. pSettings->usUartBaseIO = rSmapiInfo.usUartBaseIO;
  190. pSettings->uDStoreSize = TP_ABILITIES_DATA_SIZE;
  191. pSettings->uIStoreSize = TP_ABILITIES_INST_SIZE;
  192. pSettings->uIps = TP_ABILITIES_INTS_PER_SEC;
  193. if (pSettings->bDSPEnabled && pSettings->bModemEnabled && pSettings->usDspIrq == pSettings->usUartIrq) {
  194. pBDData->bShareDspIrq = pBDData->bShareUartIrq = 1;
  195. } else {
  196. pBDData->bShareDspIrq = pBDData->bShareUartIrq = 0;
  197. }
  198. PRINTK_1(TRACE_TP3780I, "tp3780i::tp3780I_CalcResources exitn");
  199. return 0;
  200. }
  201. int tp3780I_ClaimResources(THINKPAD_BD_DATA * pBDData)
  202. {
  203. int retval = 0;
  204. DSP_3780I_CONFIG_SETTINGS *pSettings = &pBDData->rDspSettings;
  205. #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
  206. struct resource *pres;
  207. #endif
  208. PRINTK_2(TRACE_TP3780I,
  209. "tp3780i::tp3780I_ClaimResources entry pBDData %pn", pBDData);
  210. #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
  211. pres = request_region(pSettings->usDspBaseIO, 16, "mwave_3780i");
  212. if ( pres == NULL ) retval = -EIO;
  213. #else
  214. retval = check_region(pSettings->usDspBaseIO, 16);
  215. if (!retval) request_region(pSettings->usDspBaseIO, 16, "mwave_3780i");
  216. #endif
  217. if (retval) {
  218. PRINTK_ERROR(KERN_ERR_MWAVE "tp3780i::tp3780I_ClaimResources: Error: Could not claim I/O region starting at %xn", pSettings->usDspBaseIO);
  219. retval = -EIO;
  220. }
  221. PRINTK_2(TRACE_TP3780I, "tp3780i::tp3780I_ClaimResources exit retval %xn", retval);
  222. return retval;
  223. }
  224. int tp3780I_ReleaseResources(THINKPAD_BD_DATA * pBDData)
  225. {
  226. int retval = 0;
  227. DSP_3780I_CONFIG_SETTINGS *pSettings = &pBDData->rDspSettings;
  228. PRINTK_2(TRACE_TP3780I,
  229. "tp3780i::tp3780I_ReleaseResources entry pBDData %pn", pBDData);
  230. release_region(pSettings->usDspBaseIO & (~3), 16);
  231. if (pSettings->bInterruptClaimed) {
  232. free_irq(pSettings->usDspIrq, 0);
  233. pSettings->bInterruptClaimed = FALSE;
  234. }
  235. PRINTK_2(TRACE_TP3780I,
  236. "tp3780i::tp3780I_ReleaseResources exit retval %xn", retval);
  237. return retval;
  238. }
  239. int tp3780I_EnableDSP(THINKPAD_BD_DATA * pBDData)
  240. {
  241. DSP_3780I_CONFIG_SETTINGS *pSettings = &pBDData->rDspSettings;
  242. BOOLEAN bDSPPoweredUp = FALSE, bDSPEnabled = FALSE, bInterruptAllocated = FALSE;
  243. PRINTK_2(TRACE_TP3780I, "tp3780i::tp3780I_EnableDSP entry pBDData %pn", pBDData);
  244. if (pBDData->bDSPEnabled) {
  245. PRINTK_ERROR(KERN_ERR_MWAVE "tp3780i::tp3780I_EnableDSP: Error: DSP already enabled!n");
  246. goto exit_cleanup;
  247. }
  248. if (!pSettings->bDSPEnabled) {
  249. PRINTK_ERROR(KERN_ERR_MWAVE "tp3780::tp3780I_EnableDSP: Error: pSettings->bDSPEnabled not setn");
  250. goto exit_cleanup;
  251. }
  252. if (
  253. (pSettings->usDspIrq >= s_numIrqs)
  254. || (pSettings->usDspDma >= s_numDmas)
  255. || (s_ausThinkpadIrqToField[pSettings->usDspIrq] == 0xFFFF)
  256. || (s_ausThinkpadDmaToField[pSettings->usDspDma] == 0xFFFF)
  257. ) {
  258. PRINTK_ERROR(KERN_ERR_MWAVE "tp3780i::tp3780I_EnableDSP: Error: invalid irq %xn", pSettings->usDspIrq);
  259. goto exit_cleanup;
  260. }
  261. if (
  262. ((pSettings->usDspBaseIO & 0xF00F) != 0)
  263. || (pSettings->usDspBaseIO & 0x0FF0) == 0
  264. ) {
  265. PRINTK_ERROR(KERN_ERR_MWAVE "tp3780i::tp3780I_EnableDSP: Error: Invalid DSP base I/O address %xn", pSettings->usDspBaseIO);
  266. goto exit_cleanup;
  267. }
  268. if (pSettings->bModemEnabled) {
  269. if (
  270. pSettings->usUartIrq >= s_numIrqs
  271. || s_ausThinkpadIrqToField[pSettings->usUartIrq] == 0xFFFF
  272. ) {
  273. PRINTK_ERROR(KERN_ERR_MWAVE "tp3780i::tp3780I_EnableDSP: Error: Invalid UART IRQ %xn", pSettings->usUartIrq);
  274. goto exit_cleanup;
  275. }
  276. switch (pSettings->usUartBaseIO) {
  277. case 0x03F8:
  278. case 0x02F8:
  279. case 0x03E8:
  280. case 0x02E8:
  281. break;
  282. default:
  283. PRINTK_ERROR("tp3780i::tp3780I_EnableDSP: Error: Invalid UART base I/O address %xn", pSettings->usUartBaseIO);
  284. goto exit_cleanup;
  285. }
  286. }
  287. pSettings->bDspIrqActiveLow = pSettings->bDspIrqPulse = TRUE;
  288. pSettings->bUartIrqActiveLow = pSettings->bUartIrqPulse = TRUE;
  289. if (pBDData->bShareDspIrq) {
  290. pSettings->bDspIrqActiveLow = FALSE;
  291. }
  292. if (pBDData->bShareUartIrq) {
  293. pSettings->bUartIrqActiveLow = FALSE;
  294. }
  295. pSettings->usNumTransfers = TP_CFG_NumTransfers;
  296. pSettings->usReRequest = TP_CFG_RerequestTimer;
  297. pSettings->bEnableMEMCS16 = TP_CFG_MEMCS16;
  298. pSettings->usIsaMemCmdWidth = TP_CFG_IsaMemCmdWidth;
  299. pSettings->bGateIOCHRDY = TP_CFG_GateIOCHRDY;
  300. pSettings->bEnablePwrMgmt = TP_CFG_EnablePwrMgmt;
  301. pSettings->usHBusTimerLoadValue = TP_CFG_HBusTimerValue;
  302. pSettings->bDisableLBusTimeout = TP_CFG_DisableLBusTimeout;
  303. pSettings->usN_Divisor = TP_CFG_N_Divisor;
  304. pSettings->usM_Multiplier = TP_CFG_M_Multiplier;
  305. pSettings->bPllBypass = TP_CFG_PllBypass;
  306. pSettings->usChipletEnable = TP_CFG_ChipletEnable;
  307. if (request_irq(pSettings->usUartIrq, &UartInterrupt, 0, "mwave_uart", 0)) {
  308. PRINTK_ERROR(KERN_ERR_MWAVE "tp3780i::tp3780I_EnableDSP: Error: Could not get UART IRQ %xn", pSettings->usUartIrq);
  309. goto exit_cleanup;
  310. } else { /* no conflict just release */
  311. free_irq(pSettings->usUartIrq, 0);
  312. }
  313. if (request_irq(pSettings->usDspIrq, &DspInterrupt, 0, "mwave_3780i", 0)) {
  314. PRINTK_ERROR("tp3780i::tp3780I_EnableDSP: Error: Could not get 3780i IRQ %xn", pSettings->usDspIrq);
  315. goto exit_cleanup;
  316. } else {
  317. PRINTK_3(TRACE_TP3780I,
  318. "tp3780i::tp3780I_EnableDSP, got interrupt %x bShareDspIrq %xn",
  319. pSettings->usDspIrq, pBDData->bShareDspIrq);
  320. bInterruptAllocated = TRUE;
  321. pSettings->bInterruptClaimed = TRUE;
  322. }
  323. smapi_set_DSP_power_state(FALSE);
  324. if (smapi_set_DSP_power_state(TRUE)) {
  325. PRINTK_ERROR(KERN_ERR_MWAVE "tp3780i::tp3780I_EnableDSP: Error: smapi_set_DSP_power_state(TRUE) failedn");
  326. goto exit_cleanup;
  327. } else {
  328. bDSPPoweredUp = TRUE;
  329. }
  330. if (dsp3780I_EnableDSP(pSettings, s_ausThinkpadIrqToField, s_ausThinkpadDmaToField)) {
  331. PRINTK_ERROR("tp3780i::tp3780I_EnableDSP: Error: dsp7880I_EnableDSP() failedn");
  332. goto exit_cleanup;
  333. } else {
  334. bDSPEnabled = TRUE;
  335. }
  336. EnableSRAM(pBDData);
  337. pBDData->bDSPEnabled = TRUE;
  338. PRINTK_1(TRACE_TP3780I, "tp3780i::tp3780I_EnableDSP exitn");
  339. return 0;
  340. exit_cleanup:
  341. PRINTK_ERROR("tp3780i::tp3780I_EnableDSP: Cleaning upn");
  342. if (bDSPEnabled)
  343. dsp3780I_DisableDSP(pSettings);
  344. if (bDSPPoweredUp)
  345. smapi_set_DSP_power_state(FALSE);
  346. if (bInterruptAllocated) {
  347. free_irq(pSettings->usDspIrq, 0);
  348. pSettings->bInterruptClaimed = FALSE;
  349. }
  350. return -EIO;
  351. }
  352. int tp3780I_DisableDSP(THINKPAD_BD_DATA * pBDData)
  353. {
  354. int retval = 0;
  355. DSP_3780I_CONFIG_SETTINGS *pSettings = &pBDData->rDspSettings;
  356. PRINTK_2(TRACE_TP3780I, "tp3780i::tp3780I_DisableDSP entry pBDData %pn", pBDData);
  357. if (pBDData->bDSPEnabled) {
  358. dsp3780I_DisableDSP(&pBDData->rDspSettings);
  359. if (pSettings->bInterruptClaimed) {
  360. free_irq(pSettings->usDspIrq, 0);
  361. pSettings->bInterruptClaimed = FALSE;
  362. }
  363. smapi_set_DSP_power_state(FALSE);
  364. pBDData->bDSPEnabled = FALSE;
  365. }
  366. PRINTK_2(TRACE_TP3780I, "tp3780i::tp3780I_DisableDSP exit retval %xn", retval);
  367. return retval;
  368. }
  369. int tp3780I_ResetDSP(THINKPAD_BD_DATA * pBDData)
  370. {
  371. int retval = 0;
  372. DSP_3780I_CONFIG_SETTINGS *pSettings = &pBDData->rDspSettings;
  373. PRINTK_2(TRACE_TP3780I, "tp3780i::tp3780I_ResetDSP entry pBDData %pn",
  374. pBDData);
  375. if (dsp3780I_Reset(pSettings) == 0) {
  376. EnableSRAM(pBDData);
  377. } else {
  378. retval = -EIO;
  379. }
  380. PRINTK_2(TRACE_TP3780I, "tp3780i::tp3780I_ResetDSP exit retval %xn", retval);
  381. return retval;
  382. }
  383. int tp3780I_StartDSP(THINKPAD_BD_DATA * pBDData)
  384. {
  385. int retval = 0;
  386. DSP_3780I_CONFIG_SETTINGS *pSettings = &pBDData->rDspSettings;
  387. PRINTK_2(TRACE_TP3780I, "tp3780i::tp3780I_StartDSP entry pBDData %pn", pBDData);
  388. if (dsp3780I_Run(pSettings) == 0) {
  389. // @BUG @TBD EnableSRAM(pBDData);
  390. } else {
  391. retval = -EIO;
  392. }
  393. PRINTK_2(TRACE_TP3780I, "tp3780i::tp3780I_StartDSP exit retval %xn", retval);
  394. return retval;
  395. }
  396. int tp3780I_QueryAbilities(THINKPAD_BD_DATA * pBDData, MW_ABILITIES * pAbilities)
  397. {
  398. int retval = 0;
  399. PRINTK_2(TRACE_TP3780I,
  400. "tp3780i::tp3780I_QueryAbilities entry pBDData %pn", pBDData);
  401. /* fill out standard constant fields */
  402. pAbilities->instr_per_sec = pBDData->rDspSettings.uIps;
  403. pAbilities->data_size = pBDData->rDspSettings.uDStoreSize;
  404. pAbilities->inst_size = pBDData->rDspSettings.uIStoreSize;
  405. pAbilities->bus_dma_bw = pBDData->rDspSettings.uDmaBandwidth;
  406. /* fill out dynamically determined fields */
  407. pAbilities->component_list[0] = 0x00010000 | MW_ADC_MASK;
  408. pAbilities->component_list[1] = 0x00010000 | MW_ACI_MASK;
  409. pAbilities->component_list[2] = 0x00010000 | MW_AIC1_MASK;
  410. pAbilities->component_list[3] = 0x00010000 | MW_AIC2_MASK;
  411. pAbilities->component_list[4] = 0x00010000 | MW_CDDAC_MASK;
  412. pAbilities->component_list[5] = 0x00010000 | MW_MIDI_MASK;
  413. pAbilities->component_list[6] = 0x00010000 | MW_UART_MASK;
  414. pAbilities->component_count = 7;
  415. /* Fill out Mwave OS and BIOS task names */
  416. memcpy(pAbilities->mwave_os_name, TP_ABILITIES_MWAVEOS_NAME,
  417. sizeof(TP_ABILITIES_MWAVEOS_NAME));
  418. memcpy(pAbilities->bios_task_name, TP_ABILITIES_BIOSTASK_NAME,
  419. sizeof(TP_ABILITIES_BIOSTASK_NAME));
  420. PRINTK_1(TRACE_TP3780I,
  421. "tp3780i::tp3780I_QueryAbilities exit retval=SUCCESSFULn");
  422. return retval;
  423. }
  424. int tp3780I_ReadWriteDspDStore(THINKPAD_BD_DATA * pBDData, unsigned int uOpcode,
  425.                                void *pvBuffer, unsigned int uCount,
  426.                                unsigned long ulDSPAddr)
  427. {
  428. int retval = 0;
  429. DSP_3780I_CONFIG_SETTINGS *pSettings = &pBDData->rDspSettings;
  430. unsigned short usDspBaseIO = pSettings->usDspBaseIO;
  431. BOOLEAN bRC = 0;
  432. PRINTK_6(TRACE_TP3780I,
  433. "tp3780i::tp3780I_ReadWriteDspDStore entry pBDData %p, uOpcode %x, pvBuffer %p, uCount %x, ulDSPAddr %lxn",
  434. pBDData, uOpcode, pvBuffer, uCount, ulDSPAddr);
  435. if (pBDData->bDSPEnabled) {
  436. switch (uOpcode) {
  437. case IOCTL_MW_READ_DATA:
  438. bRC = dsp3780I_ReadDStore(usDspBaseIO, pvBuffer, uCount, ulDSPAddr);
  439. break;
  440. case IOCTL_MW_READCLEAR_DATA:
  441. bRC = dsp3780I_ReadAndClearDStore(usDspBaseIO, pvBuffer, uCount, ulDSPAddr);
  442. break;
  443. case IOCTL_MW_WRITE_DATA:
  444. bRC = dsp3780I_WriteDStore(usDspBaseIO, pvBuffer, uCount, ulDSPAddr);
  445. break;
  446. }
  447. }
  448. retval = (bRC) ? -EIO : 0;
  449. PRINTK_2(TRACE_TP3780I, "tp3780i::tp3780I_ReadWriteDspDStore exit retval %xn", retval);
  450. return retval;
  451. }
  452. int tp3780I_ReadWriteDspIStore(THINKPAD_BD_DATA * pBDData, unsigned int uOpcode,
  453.                                void *pvBuffer, unsigned int uCount,
  454.                                unsigned long ulDSPAddr)
  455. {
  456. int retval = 0;
  457. DSP_3780I_CONFIG_SETTINGS *pSettings = &pBDData->rDspSettings;
  458. unsigned short usDspBaseIO = pSettings->usDspBaseIO;
  459. BOOLEAN bRC = 0;
  460. PRINTK_6(TRACE_TP3780I,
  461. "tp3780i::tp3780I_ReadWriteDspIStore entry pBDData %p, uOpcode %x, pvBuffer %p, uCount %x, ulDSPAddr %lxn",
  462. pBDData, uOpcode, pvBuffer, uCount, ulDSPAddr);
  463. if (pBDData->bDSPEnabled) {
  464. switch (uOpcode) {
  465. case IOCTL_MW_READ_INST:
  466. bRC = dsp3780I_ReadIStore(usDspBaseIO, pvBuffer, uCount, ulDSPAddr);
  467. break;
  468. case IOCTL_MW_WRITE_INST:
  469. bRC = dsp3780I_WriteIStore(usDspBaseIO, pvBuffer, uCount, ulDSPAddr);
  470. break;
  471. }
  472. }
  473. retval = (bRC) ? -EIO : 0;
  474. PRINTK_2(TRACE_TP3780I,
  475. "tp3780i::tp3780I_ReadWriteDspIStore exit retval %xn", retval);
  476. return retval;
  477. }