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 49 #include <linux/interrupt.h> 50 #include <linux/kernel.h> 51 #include <linux/ptrace.h> 52 #include <linux/ioport.h> 53 #include <asm/io.h> 54 #include "smapi.h" 55 #include "mwavedd.h" 56 #include "tp3780i.h" 57 #include "3780i.h" 58 #include "mwavepub.h" 59 60 static unsigned short s_ausThinkpadIrqToField[16] = 61 { 0xFFFF, 0xFFFF, 0xFFFF, 0x0001, 0x0002, 0x0003, 0xFFFF, 0x0004, 62 0xFFFF, 0xFFFF, 0x0005, 0x0006, 0xFFFF, 0xFFFF, 0xFFFF, 0x0007 }; 63 static unsigned short s_ausThinkpadDmaToField[8] = 64 { 0x0001, 0x0002, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0x0003, 0x0004 }; 65 static unsigned short s_numIrqs = 16, s_numDmas = 8; 66 67 68 static void EnableSRAM(THINKPAD_BD_DATA * pBDData) 69 { 70 DSP_3780I_CONFIG_SETTINGS *pSettings = &pBDData->rDspSettings; 71 unsigned short usDspBaseIO = pSettings->usDspBaseIO; 72 DSP_GPIO_OUTPUT_DATA_15_8 rGpioOutputData; 73 DSP_GPIO_DRIVER_ENABLE_15_8 rGpioDriverEnable; 74 DSP_GPIO_MODE_15_8 rGpioMode; 75 76 PRINTK_1(TRACE_TP3780I, "tp3780i::EnableSRAM, entry\n"); 77 78 MKWORD(rGpioMode) = ReadMsaCfg(DSP_GpioModeControl_15_8); 79 rGpioMode.GpioMode10 = 0; 80 WriteMsaCfg(DSP_GpioModeControl_15_8, MKWORD(rGpioMode)); 81 82 MKWORD(rGpioDriverEnable) = 0; 83 rGpioDriverEnable.Enable10 = TRUE; 84 rGpioDriverEnable.Mask10 = TRUE; 85 WriteMsaCfg(DSP_GpioDriverEnable_15_8, MKWORD(rGpioDriverEnable)); 86 87 MKWORD(rGpioOutputData) = 0; 88 rGpioOutputData.Latch10 = 0; 89 rGpioOutputData.Mask10 = TRUE; 90 WriteMsaCfg(DSP_GpioOutputData_15_8, MKWORD(rGpioOutputData)); 91 92 PRINTK_1(TRACE_TP3780I, "tp3780i::EnableSRAM exit\n"); 93 } 94 95 96 static irqreturn_t UartInterrupt(int irq, void *dev_id) 97 { 98 PRINTK_3(TRACE_TP3780I, 99 "tp3780i::UartInterrupt entry irq %x dev_id %p\n", irq, dev_id); 100 return IRQ_HANDLED; 101 } 102 103 static irqreturn_t DspInterrupt(int irq, void *dev_id) 104 { 105 pMWAVE_DEVICE_DATA pDrvData = &mwave_s_mdd; 106 DSP_3780I_CONFIG_SETTINGS *pSettings = &pDrvData->rBDData.rDspSettings; 107 unsigned short usDspBaseIO = pSettings->usDspBaseIO; 108 unsigned short usIPCSource = 0, usIsolationMask, usPCNum; 109 110 PRINTK_3(TRACE_TP3780I, 111 "tp3780i::DspInterrupt entry irq %x dev_id %p\n", irq, dev_id); 112 113 if (dsp3780I_GetIPCSource(usDspBaseIO, &usIPCSource) == 0) { 114 PRINTK_2(TRACE_TP3780I, 115 "tp3780i::DspInterrupt, return from dsp3780i_GetIPCSource, usIPCSource %x\n", 116 usIPCSource); 117 usIsolationMask = 1; 118 for (usPCNum = 1; usPCNum <= 16; usPCNum++) { 119 if (usIPCSource & usIsolationMask) { 120 usIPCSource &= ~usIsolationMask; 121 PRINTK_3(TRACE_TP3780I, 122 "tp3780i::DspInterrupt usPCNum %x usIPCSource %x\n", 123 usPCNum, usIPCSource); 124 if (pDrvData->IPCs[usPCNum - 1].usIntCount == 0) { 125 pDrvData->IPCs[usPCNum - 1].usIntCount = 1; 126 } 127 PRINTK_2(TRACE_TP3780I, 128 "tp3780i::DspInterrupt usIntCount %x\n", 129 pDrvData->IPCs[usPCNum - 1].usIntCount); 130 if (pDrvData->IPCs[usPCNum - 1].bIsEnabled == TRUE) { 131 PRINTK_2(TRACE_TP3780I, 132 "tp3780i::DspInterrupt, waking up usPCNum %x\n", 133 usPCNum - 1); 134 wake_up_interruptible(&pDrvData->IPCs[usPCNum - 1].ipc_wait_queue); 135 } else { 136 PRINTK_2(TRACE_TP3780I, 137 "tp3780i::DspInterrupt, no one waiting for IPC %x\n", 138 usPCNum - 1); 139 } 140 } 141 if (usIPCSource == 0) 142 break; 143 /* try next IPC */ 144 usIsolationMask = usIsolationMask << 1; 145 } 146 } else { 147 PRINTK_1(TRACE_TP3780I, 148 "tp3780i::DspInterrupt, return false from dsp3780i_GetIPCSource\n"); 149 } 150 PRINTK_1(TRACE_TP3780I, "tp3780i::DspInterrupt exit\n"); 151 return IRQ_HANDLED; 152 } 153 154 155 int tp3780I_InitializeBoardData(THINKPAD_BD_DATA * pBDData) 156 { 157 int retval = 0; 158 DSP_3780I_CONFIG_SETTINGS *pSettings = &pBDData->rDspSettings; 159 160 161 PRINTK_2(TRACE_TP3780I, "tp3780i::tp3780I_InitializeBoardData entry pBDData %p\n", pBDData); 162 163 pBDData->bDSPEnabled = FALSE; 164 pSettings->bInterruptClaimed = FALSE; 165 166 retval = smapi_init(); 167 if (retval) { 168 PRINTK_ERROR(KERN_ERR_MWAVE "tp3780i::tp3780I_InitializeBoardData: Error: SMAPI is not available on this machine\n"); 169 } else { 170 if (mwave_3780i_irq || mwave_3780i_io || mwave_uart_irq || mwave_uart_io) { 171 retval = smapi_set_DSP_cfg(); 172 } 173 } 174 175 PRINTK_2(TRACE_TP3780I, "tp3780i::tp3780I_InitializeBoardData exit retval %x\n", retval); 176 177 return retval; 178 } 179 180 int tp3780I_Cleanup(THINKPAD_BD_DATA * pBDData) 181 { 182 int retval = 0; 183 184 PRINTK_2(TRACE_TP3780I, 185 "tp3780i::tp3780I_Cleanup entry and exit pBDData %p\n", pBDData); 186 187 return retval; 188 } 189 190 int tp3780I_CalcResources(THINKPAD_BD_DATA * pBDData) 191 { 192 SMAPI_DSP_SETTINGS rSmapiInfo; 193 DSP_3780I_CONFIG_SETTINGS *pSettings = &pBDData->rDspSettings; 194 195 PRINTK_2(TRACE_TP3780I, 196 "tp3780i::tp3780I_CalcResources entry pBDData %p\n", pBDData); 197 198 if (smapi_query_DSP_cfg(&rSmapiInfo)) { 199 PRINTK_ERROR(KERN_ERR_MWAVE "tp3780i::tp3780I_CalcResources: Error: Could not query DSP config. Aborting.\n"); 200 return -EIO; 201 } 202 203 /* Sanity check */ 204 if ( 205 ( rSmapiInfo.usDspIRQ == 0 ) 206 || ( rSmapiInfo.usDspBaseIO == 0 ) 207 || ( rSmapiInfo.usUartIRQ == 0 ) 208 || ( rSmapiInfo.usUartBaseIO == 0 ) 209 ) { 210 PRINTK_ERROR(KERN_ERR_MWAVE "tp3780i::tp3780I_CalcResources: Error: Illegal resource setting. Aborting.\n"); 211 return -EIO; 212 } 213 214 pSettings->bDSPEnabled = (rSmapiInfo.bDSPEnabled && rSmapiInfo.bDSPPresent); 215 pSettings->bModemEnabled = rSmapiInfo.bModemEnabled; 216 pSettings->usDspIrq = rSmapiInfo.usDspIRQ; 217 pSettings->usDspDma = rSmapiInfo.usDspDMA; 218 pSettings->usDspBaseIO = rSmapiInfo.usDspBaseIO; 219 pSettings->usUartIrq = rSmapiInfo.usUartIRQ; 220 pSettings->usUartBaseIO = rSmapiInfo.usUartBaseIO; 221 222 pSettings->uDStoreSize = TP_ABILITIES_DATA_SIZE; 223 pSettings->uIStoreSize = TP_ABILITIES_INST_SIZE; 224 pSettings->uIps = TP_ABILITIES_INTS_PER_SEC; 225 226 if (pSettings->bDSPEnabled && pSettings->bModemEnabled && pSettings->usDspIrq == pSettings->usUartIrq) { 227 pBDData->bShareDspIrq = pBDData->bShareUartIrq = 1; 228 } else { 229 pBDData->bShareDspIrq = pBDData->bShareUartIrq = 0; 230 } 231 232 PRINTK_1(TRACE_TP3780I, "tp3780i::tp3780I_CalcResources exit\n"); 233 234 return 0; 235 } 236 237 238 int tp3780I_ClaimResources(THINKPAD_BD_DATA * pBDData) 239 { 240 int retval = 0; 241 DSP_3780I_CONFIG_SETTINGS *pSettings = &pBDData->rDspSettings; 242 struct resource *pres; 243 244 PRINTK_2(TRACE_TP3780I, 245 "tp3780i::tp3780I_ClaimResources entry pBDData %p\n", pBDData); 246 247 pres = request_region(pSettings->usDspBaseIO, 16, "mwave_3780i"); 248 if ( pres == NULL ) retval = -EIO; 249 250 if (retval) { 251 PRINTK_ERROR(KERN_ERR_MWAVE "tp3780i::tp3780I_ClaimResources: Error: Could not claim I/O region starting at %x\n", pSettings->usDspBaseIO); 252 retval = -EIO; 253 } 254 255 PRINTK_2(TRACE_TP3780I, "tp3780i::tp3780I_ClaimResources exit retval %x\n", retval); 256 257 return retval; 258 } 259 260 int tp3780I_ReleaseResources(THINKPAD_BD_DATA * pBDData) 261 { 262 int retval = 0; 263 DSP_3780I_CONFIG_SETTINGS *pSettings = &pBDData->rDspSettings; 264 265 PRINTK_2(TRACE_TP3780I, 266 "tp3780i::tp3780I_ReleaseResources entry pBDData %p\n", pBDData); 267 268 release_region(pSettings->usDspBaseIO & (~3), 16); 269 270 if (pSettings->bInterruptClaimed) { 271 free_irq(pSettings->usDspIrq, NULL); 272 pSettings->bInterruptClaimed = FALSE; 273 } 274 275 PRINTK_2(TRACE_TP3780I, 276 "tp3780i::tp3780I_ReleaseResources exit retval %x\n", retval); 277 278 return retval; 279 } 280 281 282 283 int tp3780I_EnableDSP(THINKPAD_BD_DATA * pBDData) 284 { 285 DSP_3780I_CONFIG_SETTINGS *pSettings = &pBDData->rDspSettings; 286 BOOLEAN bDSPPoweredUp = FALSE, bInterruptAllocated = FALSE; 287 288 PRINTK_2(TRACE_TP3780I, "tp3780i::tp3780I_EnableDSP entry pBDData %p\n", pBDData); 289 290 if (pBDData->bDSPEnabled) { 291 PRINTK_ERROR(KERN_ERR_MWAVE "tp3780i::tp3780I_EnableDSP: Error: DSP already enabled!\n"); 292 goto exit_cleanup; 293 } 294 295 if (!pSettings->bDSPEnabled) { 296 PRINTK_ERROR(KERN_ERR_MWAVE "tp3780::tp3780I_EnableDSP: Error: pSettings->bDSPEnabled not set\n"); 297 goto exit_cleanup; 298 } 299 300 if ( 301 (pSettings->usDspIrq >= s_numIrqs) 302 || (pSettings->usDspDma >= s_numDmas) 303 || (s_ausThinkpadIrqToField[pSettings->usDspIrq] == 0xFFFF) 304 || (s_ausThinkpadDmaToField[pSettings->usDspDma] == 0xFFFF) 305 ) { 306 PRINTK_ERROR(KERN_ERR_MWAVE "tp3780i::tp3780I_EnableDSP: Error: invalid irq %x\n", pSettings->usDspIrq); 307 goto exit_cleanup; 308 } 309 310 if ( 311 ((pSettings->usDspBaseIO & 0xF00F) != 0) 312 || (pSettings->usDspBaseIO & 0x0FF0) == 0 313 ) { 314 PRINTK_ERROR(KERN_ERR_MWAVE "tp3780i::tp3780I_EnableDSP: Error: Invalid DSP base I/O address %x\n", pSettings->usDspBaseIO); 315 goto exit_cleanup; 316 } 317 318 if (pSettings->bModemEnabled) { 319 if ( 320 pSettings->usUartIrq >= s_numIrqs 321 || s_ausThinkpadIrqToField[pSettings->usUartIrq] == 0xFFFF 322 ) { 323 PRINTK_ERROR(KERN_ERR_MWAVE "tp3780i::tp3780I_EnableDSP: Error: Invalid UART IRQ %x\n", pSettings->usUartIrq); 324 goto exit_cleanup; 325 } 326 switch (pSettings->usUartBaseIO) { 327 case 0x03F8: 328 case 0x02F8: 329 case 0x03E8: 330 case 0x02E8: 331 break; 332 333 default: 334 PRINTK_ERROR("tp3780i::tp3780I_EnableDSP: Error: Invalid UART base I/O address %x\n", pSettings->usUartBaseIO); 335 goto exit_cleanup; 336 } 337 } 338 339 pSettings->bDspIrqActiveLow = pSettings->bDspIrqPulse = TRUE; 340 pSettings->bUartIrqActiveLow = pSettings->bUartIrqPulse = TRUE; 341 342 if (pBDData->bShareDspIrq) { 343 pSettings->bDspIrqActiveLow = FALSE; 344 } 345 if (pBDData->bShareUartIrq) { 346 pSettings->bUartIrqActiveLow = FALSE; 347 } 348 349 pSettings->usNumTransfers = TP_CFG_NumTransfers; 350 pSettings->usReRequest = TP_CFG_RerequestTimer; 351 pSettings->bEnableMEMCS16 = TP_CFG_MEMCS16; 352 pSettings->usIsaMemCmdWidth = TP_CFG_IsaMemCmdWidth; 353 pSettings->bGateIOCHRDY = TP_CFG_GateIOCHRDY; 354 pSettings->bEnablePwrMgmt = TP_CFG_EnablePwrMgmt; 355 pSettings->usHBusTimerLoadValue = TP_CFG_HBusTimerValue; 356 pSettings->bDisableLBusTimeout = TP_CFG_DisableLBusTimeout; 357 pSettings->usN_Divisor = TP_CFG_N_Divisor; 358 pSettings->usM_Multiplier = TP_CFG_M_Multiplier; 359 pSettings->bPllBypass = TP_CFG_PllBypass; 360 pSettings->usChipletEnable = TP_CFG_ChipletEnable; 361 362 if (request_irq(pSettings->usUartIrq, &UartInterrupt, 0, "mwave_uart", NULL)) { 363 PRINTK_ERROR(KERN_ERR_MWAVE "tp3780i::tp3780I_EnableDSP: Error: Could not get UART IRQ %x\n", pSettings->usUartIrq); 364 goto exit_cleanup; 365 } else { /* no conflict just release */ 366 free_irq(pSettings->usUartIrq, NULL); 367 } 368 369 if (request_irq(pSettings->usDspIrq, &DspInterrupt, 0, "mwave_3780i", NULL)) { 370 PRINTK_ERROR("tp3780i::tp3780I_EnableDSP: Error: Could not get 3780i IRQ %x\n", pSettings->usDspIrq); 371 goto exit_cleanup; 372 } else { 373 PRINTK_3(TRACE_TP3780I, 374 "tp3780i::tp3780I_EnableDSP, got interrupt %x bShareDspIrq %x\n", 375 pSettings->usDspIrq, pBDData->bShareDspIrq); 376 bInterruptAllocated = TRUE; 377 pSettings->bInterruptClaimed = TRUE; 378 } 379 380 smapi_set_DSP_power_state(FALSE); 381 if (smapi_set_DSP_power_state(TRUE)) { 382 PRINTK_ERROR(KERN_ERR_MWAVE "tp3780i::tp3780I_EnableDSP: Error: smapi_set_DSP_power_state(TRUE) failed\n"); 383 goto exit_cleanup; 384 } else { 385 bDSPPoweredUp = TRUE; 386 } 387 388 if (dsp3780I_EnableDSP(pSettings, s_ausThinkpadIrqToField, s_ausThinkpadDmaToField)) { 389 PRINTK_ERROR("tp3780i::tp3780I_EnableDSP: Error: dsp7880I_EnableDSP() failed\n"); 390 goto exit_cleanup; 391 } 392 393 EnableSRAM(pBDData); 394 395 pBDData->bDSPEnabled = TRUE; 396 397 PRINTK_1(TRACE_TP3780I, "tp3780i::tp3780I_EnableDSP exit\n"); 398 399 return 0; 400 401 exit_cleanup: 402 PRINTK_ERROR("tp3780i::tp3780I_EnableDSP: Cleaning up\n"); 403 if (bDSPPoweredUp) 404 smapi_set_DSP_power_state(FALSE); 405 if (bInterruptAllocated) { 406 free_irq(pSettings->usDspIrq, NULL); 407 pSettings->bInterruptClaimed = FALSE; 408 } 409 return -EIO; 410 } 411 412 413 int tp3780I_DisableDSP(THINKPAD_BD_DATA * pBDData) 414 { 415 int retval = 0; 416 DSP_3780I_CONFIG_SETTINGS *pSettings = &pBDData->rDspSettings; 417 418 PRINTK_2(TRACE_TP3780I, "tp3780i::tp3780I_DisableDSP entry pBDData %p\n", pBDData); 419 420 if (pBDData->bDSPEnabled) { 421 dsp3780I_DisableDSP(&pBDData->rDspSettings); 422 if (pSettings->bInterruptClaimed) { 423 free_irq(pSettings->usDspIrq, NULL); 424 pSettings->bInterruptClaimed = FALSE; 425 } 426 smapi_set_DSP_power_state(FALSE); 427 pBDData->bDSPEnabled = FALSE; 428 } 429 430 PRINTK_2(TRACE_TP3780I, "tp3780i::tp3780I_DisableDSP exit retval %x\n", retval); 431 432 return retval; 433 } 434 435 436 int tp3780I_ResetDSP(THINKPAD_BD_DATA * pBDData) 437 { 438 int retval = 0; 439 DSP_3780I_CONFIG_SETTINGS *pSettings = &pBDData->rDspSettings; 440 441 PRINTK_2(TRACE_TP3780I, "tp3780i::tp3780I_ResetDSP entry pBDData %p\n", 442 pBDData); 443 444 if (dsp3780I_Reset(pSettings) == 0) { 445 EnableSRAM(pBDData); 446 } else { 447 retval = -EIO; 448 } 449 450 PRINTK_2(TRACE_TP3780I, "tp3780i::tp3780I_ResetDSP exit retval %x\n", retval); 451 452 return retval; 453 } 454 455 456 int tp3780I_StartDSP(THINKPAD_BD_DATA * pBDData) 457 { 458 int retval = 0; 459 DSP_3780I_CONFIG_SETTINGS *pSettings = &pBDData->rDspSettings; 460 461 PRINTK_2(TRACE_TP3780I, "tp3780i::tp3780I_StartDSP entry pBDData %p\n", pBDData); 462 463 if (dsp3780I_Run(pSettings) == 0) { 464 // @BUG @TBD EnableSRAM(pBDData); 465 } else { 466 retval = -EIO; 467 } 468 469 PRINTK_2(TRACE_TP3780I, "tp3780i::tp3780I_StartDSP exit retval %x\n", retval); 470 471 return retval; 472 } 473 474 475 int tp3780I_QueryAbilities(THINKPAD_BD_DATA * pBDData, MW_ABILITIES * pAbilities) 476 { 477 int retval = 0; 478 479 PRINTK_2(TRACE_TP3780I, 480 "tp3780i::tp3780I_QueryAbilities entry pBDData %p\n", pBDData); 481 482 memset(pAbilities, 0, sizeof(*pAbilities)); 483 /* fill out standard constant fields */ 484 pAbilities->instr_per_sec = pBDData->rDspSettings.uIps; 485 pAbilities->data_size = pBDData->rDspSettings.uDStoreSize; 486 pAbilities->inst_size = pBDData->rDspSettings.uIStoreSize; 487 pAbilities->bus_dma_bw = pBDData->rDspSettings.uDmaBandwidth; 488 489 /* fill out dynamically determined fields */ 490 pAbilities->component_list[0] = 0x00010000 | MW_ADC_MASK; 491 pAbilities->component_list[1] = 0x00010000 | MW_ACI_MASK; 492 pAbilities->component_list[2] = 0x00010000 | MW_AIC1_MASK; 493 pAbilities->component_list[3] = 0x00010000 | MW_AIC2_MASK; 494 pAbilities->component_list[4] = 0x00010000 | MW_CDDAC_MASK; 495 pAbilities->component_list[5] = 0x00010000 | MW_MIDI_MASK; 496 pAbilities->component_list[6] = 0x00010000 | MW_UART_MASK; 497 pAbilities->component_count = 7; 498 499 /* Fill out Mwave OS and BIOS task names */ 500 501 memcpy(pAbilities->mwave_os_name, TP_ABILITIES_MWAVEOS_NAME, 502 sizeof(TP_ABILITIES_MWAVEOS_NAME)); 503 memcpy(pAbilities->bios_task_name, TP_ABILITIES_BIOSTASK_NAME, 504 sizeof(TP_ABILITIES_BIOSTASK_NAME)); 505 506 PRINTK_1(TRACE_TP3780I, 507 "tp3780i::tp3780I_QueryAbilities exit retval=SUCCESSFUL\n"); 508 509 return retval; 510 } 511 512 int tp3780I_ReadWriteDspDStore(THINKPAD_BD_DATA * pBDData, unsigned int uOpcode, 513 void __user *pvBuffer, unsigned int uCount, 514 unsigned long ulDSPAddr) 515 { 516 int retval = 0; 517 DSP_3780I_CONFIG_SETTINGS *pSettings = &pBDData->rDspSettings; 518 unsigned short usDspBaseIO = pSettings->usDspBaseIO; 519 BOOLEAN bRC = 0; 520 521 PRINTK_6(TRACE_TP3780I, 522 "tp3780i::tp3780I_ReadWriteDspDStore entry pBDData %p, uOpcode %x, pvBuffer %p, uCount %x, ulDSPAddr %lx\n", 523 pBDData, uOpcode, pvBuffer, uCount, ulDSPAddr); 524 525 if (pBDData->bDSPEnabled) { 526 switch (uOpcode) { 527 case IOCTL_MW_READ_DATA: 528 bRC = dsp3780I_ReadDStore(usDspBaseIO, pvBuffer, uCount, ulDSPAddr); 529 break; 530 531 case IOCTL_MW_READCLEAR_DATA: 532 bRC = dsp3780I_ReadAndClearDStore(usDspBaseIO, pvBuffer, uCount, ulDSPAddr); 533 break; 534 535 case IOCTL_MW_WRITE_DATA: 536 bRC = dsp3780I_WriteDStore(usDspBaseIO, pvBuffer, uCount, ulDSPAddr); 537 break; 538 } 539 } 540 541 retval = (bRC) ? -EIO : 0; 542 PRINTK_2(TRACE_TP3780I, "tp3780i::tp3780I_ReadWriteDspDStore exit retval %x\n", retval); 543 544 return retval; 545 } 546 547 548 int tp3780I_ReadWriteDspIStore(THINKPAD_BD_DATA * pBDData, unsigned int uOpcode, 549 void __user *pvBuffer, unsigned int uCount, 550 unsigned long ulDSPAddr) 551 { 552 int retval = 0; 553 DSP_3780I_CONFIG_SETTINGS *pSettings = &pBDData->rDspSettings; 554 unsigned short usDspBaseIO = pSettings->usDspBaseIO; 555 BOOLEAN bRC = 0; 556 557 PRINTK_6(TRACE_TP3780I, 558 "tp3780i::tp3780I_ReadWriteDspIStore entry pBDData %p, uOpcode %x, pvBuffer %p, uCount %x, ulDSPAddr %lx\n", 559 pBDData, uOpcode, pvBuffer, uCount, ulDSPAddr); 560 561 if (pBDData->bDSPEnabled) { 562 switch (uOpcode) { 563 case IOCTL_MW_READ_INST: 564 bRC = dsp3780I_ReadIStore(usDspBaseIO, pvBuffer, uCount, ulDSPAddr); 565 break; 566 567 case IOCTL_MW_WRITE_INST: 568 bRC = dsp3780I_WriteIStore(usDspBaseIO, pvBuffer, uCount, ulDSPAddr); 569 break; 570 } 571 } 572 573 retval = (bRC) ? -EIO : 0; 574 575 PRINTK_2(TRACE_TP3780I, 576 "tp3780i::tp3780I_ReadWriteDspIStore exit retval %x\n", retval); 577 578 return retval; 579 } 580 581