| OLD | NEW |
| 1 //------------------------------------------------------------------------------ | 1 //------------------------------------------------------------------------------ |
| 2 // <copyright file="ar6k_gmbox.c" company="Atheros"> | 2 // <copyright file="ar6k_gmbox.c" company="Atheros"> |
| 3 // Copyright (c) 2007-2008 Atheros Corporation. All rights reserved. | 3 // Copyright (c) 2007-2010 Atheros Corporation. All rights reserved. |
| 4 // | 4 // |
| 5 // This program is free software; you can redistribute it and/or modify | |
| 6 // it under the terms of the GNU General Public License version 2 as | |
| 7 // published by the Free Software Foundation; | |
| 8 // | 5 // |
| 9 // Software distributed under the License is distributed on an "AS | 6 // Permission to use, copy, modify, and/or distribute this software for any |
| 10 // IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or | 7 // purpose with or without fee is hereby granted, provided that the above |
| 11 // implied. See the License for the specific language governing | 8 // copyright notice and this permission notice appear in all copies. |
| 12 // rights and limitations under the License. | 9 // |
| 10 // THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
| 11 // WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
| 12 // MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
| 13 // ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
| 14 // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
| 15 // ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 16 // OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 13 // | 17 // |
| 14 // | 18 // |
| 15 //------------------------------------------------------------------------------ | 19 //------------------------------------------------------------------------------ |
| 16 //============================================================================== | 20 //============================================================================== |
| 17 // Generic MBOX API implementation | 21 // Generic MBOX API implementation |
| 18 // | 22 // |
| 19 // Author(s): ="Atheros" | 23 // Author(s): ="Atheros" |
| 20 //============================================================================== | 24 //============================================================================== |
| 21 #include "a_config.h" | 25 #include "a_config.h" |
| 22 #include "athdefs.h" | 26 #include "athdefs.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 52 /* external APIs for allocating and freeing internal I/O packets to handle A
SYNC I/O */ | 56 /* external APIs for allocating and freeing internal I/O packets to handle A
SYNC I/O */ |
| 53 extern void AR6KFreeIOPacket(AR6K_DEVICE *pDev, HTC_PACKET *pPacket); | 57 extern void AR6KFreeIOPacket(AR6K_DEVICE *pDev, HTC_PACKET *pPacket); |
| 54 extern HTC_PACKET *AR6KAllocIOPacket(AR6K_DEVICE *pDev); | 58 extern HTC_PACKET *AR6KAllocIOPacket(AR6K_DEVICE *pDev); |
| 55 | 59 |
| 56 | 60 |
| 57 /* callback when our fetch to enable/disable completes */ | 61 /* callback when our fetch to enable/disable completes */ |
| 58 static void DevGMboxIRQActionAsyncHandler(void *Context, HTC_PACKET *pPacket) | 62 static void DevGMboxIRQActionAsyncHandler(void *Context, HTC_PACKET *pPacket) |
| 59 { | 63 { |
| 60 AR6K_DEVICE *pDev = (AR6K_DEVICE *)Context; | 64 AR6K_DEVICE *pDev = (AR6K_DEVICE *)Context; |
| 61 | 65 |
| 62 AR_DEBUG_PRINTF(ATH_DEBUG_IRQ,("+DevGMboxIRQActionAsyncHandler: (dev: 0x%X)\
n", (A_UINT32)pDev)); | 66 AR_DEBUG_PRINTF(ATH_DEBUG_IRQ,("+DevGMboxIRQActionAsyncHandler: (dev: 0x%lX)
\n", (unsigned long)pDev)); |
| 63 | 67 |
| 64 if (A_FAILED(pPacket->Status)) { | 68 if (A_FAILED(pPacket->Status)) { |
| 65 AR_DEBUG_PRINTF(ATH_DEBUG_ERR, | 69 AR_DEBUG_PRINTF(ATH_DEBUG_ERR, |
| 66 ("IRQAction Operation (%d) failed! status:%d \n", pPacket->PktIn
fo.AsRx.HTCRxFlags,pPacket->Status)); | 70 ("IRQAction Operation (%d) failed! status:%d \n", pPacket->PktIn
fo.AsRx.HTCRxFlags,pPacket->Status)); |
| 67 } | 71 } |
| 68 /* free this IO packet */ | 72 /* free this IO packet */ |
| 69 AR6KFreeIOPacket(pDev,pPacket); | 73 AR6KFreeIOPacket(pDev,pPacket); |
| 70 AR_DEBUG_PRINTF(ATH_DEBUG_IRQ,("-DevGMboxIRQActionAsyncHandler \n")); | 74 AR_DEBUG_PRINTF(ATH_DEBUG_IRQ,("-DevGMboxIRQActionAsyncHandler \n")); |
| 71 } | 75 } |
| 72 | 76 |
| (...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 445 ("DevGMboxRead, Not enough space for padlen:%d recvlen:%d buffer
len:%d \n", | 449 ("DevGMboxRead, Not enough space for padlen:%d recvlen:%d buffer
len:%d \n", |
| 446 paddedLength,ReadLength,pPacket->BufferLength)); | 450 paddedLength,ReadLength,pPacket->BufferLength)); |
| 447 if (pPacket->Completion != NULL) { | 451 if (pPacket->Completion != NULL) { |
| 448 COMPLETE_HTC_PACKET(pPacket,A_EINVAL); | 452 COMPLETE_HTC_PACKET(pPacket,A_EINVAL); |
| 449 return A_OK; | 453 return A_OK; |
| 450 } | 454 } |
| 451 return A_EINVAL; | 455 return A_EINVAL; |
| 452 } | 456 } |
| 453 | 457 |
| 454 AR_DEBUG_PRINTF(ATH_DEBUG_RECV, | 458 AR_DEBUG_PRINTF(ATH_DEBUG_RECV, |
| 455 ("DevGMboxRead (0x%X : hdr:0x%X) Padded Length: %d Mbox:0x%X (mo
de:%s)\n", | 459 ("DevGMboxRead (0x%lX : hdr:0x%X) Padded Length: %d Mbox:0x%X (m
ode:%s)\n", |
| 456 (A_UINT32)pPacket, pPacket->PktInfo.AsRx.ExpectedHdr, | 460 (unsigned long)pPacket, pPacket->PktInfo.AsRx.ExpectedHdr, |
| 457 paddedLength, | 461 paddedLength, |
| 458 pDev->MailBoxInfo.GMboxAddress, | 462 pDev->MailBoxInfo.GMboxAddress, |
| 459 sync ? "SYNC" : "ASYNC")); | 463 sync ? "SYNC" : "ASYNC")); |
| 460 | 464 |
| 461 status = HIFReadWrite(pDev->HIFDevice, | 465 status = HIFReadWrite(pDev->HIFDevice, |
| 462 pDev->MailBoxInfo.GMboxAddress, | 466 pDev->MailBoxInfo.GMboxAddress, |
| 463 pPacket->pBuffer, | 467 pPacket->pBuffer, |
| 464 paddedLength, | 468 paddedLength, |
| 465 sync ? HIF_RD_SYNC_BLOCK_FIX : HIF_RD_ASYNC_BLOCK_FIX, | 469 sync ? HIF_RD_SYNC_BLOCK_FIX : HIF_RD_ASYNC_BLOCK_FIX, |
| 466 sync ? NULL : pPacket); /* pass the packet as the con
text to the HIF request */ | 470 sync ? NULL : pPacket); /* pass the packet as the con
text to the HIF request */ |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 509 | 513 |
| 510 return credits; | 514 return credits; |
| 511 } | 515 } |
| 512 | 516 |
| 513 | 517 |
| 514 /* callback when our fetch to enable/disable completes */ | 518 /* callback when our fetch to enable/disable completes */ |
| 515 static void DevGMboxReadCreditsAsyncHandler(void *Context, HTC_PACKET *pPacket) | 519 static void DevGMboxReadCreditsAsyncHandler(void *Context, HTC_PACKET *pPacket) |
| 516 { | 520 { |
| 517 AR6K_DEVICE *pDev = (AR6K_DEVICE *)Context; | 521 AR6K_DEVICE *pDev = (AR6K_DEVICE *)Context; |
| 518 | 522 |
| 519 AR_DEBUG_PRINTF(ATH_DEBUG_IRQ,("+DevGMboxReadCreditsAsyncHandler: (dev: 0x%X
)\n", (A_UINT32)pDev)); | 523 AR_DEBUG_PRINTF(ATH_DEBUG_IRQ,("+DevGMboxReadCreditsAsyncHandler: (dev: 0x%l
X)\n", (unsigned long)pDev)); |
| 520 | 524 |
| 521 if (A_FAILED(pPacket->Status)) { | 525 if (A_FAILED(pPacket->Status)) { |
| 522 AR_DEBUG_PRINTF(ATH_DEBUG_ERR, | 526 AR_DEBUG_PRINTF(ATH_DEBUG_ERR, |
| 523 ("Read Credit Operation failed! status:%d \n", pPacket->Status))
; | 527 ("Read Credit Operation failed! status:%d \n", pPacket->Status))
; |
| 524 } else { | 528 } else { |
| 525 int credits = 0; | 529 int credits = 0; |
| 526 credits = ProcessCreditCounterReadBuffer(pPacket->pBuffer, AR6K_REG_IO_B
UFFER_SIZE); | 530 credits = ProcessCreditCounterReadBuffer(pPacket->pBuffer, AR6K_REG_IO_B
UFFER_SIZE); |
| 527 pDev->GMboxInfo.pCreditsPendingCallback(pDev->GMboxInfo.pProtocolContext
, | 531 pDev->GMboxInfo.pCreditsPendingCallback(pDev->GMboxInfo.pProtocolContext
, |
| 528 credits, | 532 credits, |
| 529 pDev->GMboxInfo.CreditCountIRQEn
abled); | 533 pDev->GMboxInfo.CreditCountIRQEn
abled); |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 743 | 747 |
| 744 return status; | 748 return status; |
| 745 | 749 |
| 746 } | 750 } |
| 747 | 751 |
| 748 #endif //ATH_AR6K_ENABLE_GMBOX | 752 #endif //ATH_AR6K_ENABLE_GMBOX |
| 749 | 753 |
| 750 | 754 |
| 751 | 755 |
| 752 | 756 |
| OLD | NEW |