44 static int bcm_char_release(
struct inode *inode,
struct file *filp)
72 ptmp->
next = tmp->next;
104 int wait_ret_val = 0;
105 unsigned long ret = 0;
112 "Exiting as i've been asked to exit!!!\n");
118 "Device Removed... Killing the Apps...\n");
137 PktLen = Packet->
len;
139 min_t(
size_t, PktLen, size));
141 dev_kfree_skb(Packet);
143 "Returning from copy to user failure\n");
147 "Read %zd Bytes From Adapter packet = %p by process %d!\n",
149 dev_kfree_skb(Packet);
163 IOCTL_BUFFER IoBuffer;
206 RDM_BUFFER sRdmBuffer = {0};
215 if (IoBuffer.InputLength >
sizeof(sRdmBuffer))
218 if (
copy_from_user(&sRdmBuffer, IoBuffer.InputBuffer, IoBuffer.InputLength))
222 IoBuffer.OutputLength == 0) {
226 Bufflen = IoBuffer.OutputLength;
227 temp_value = 4 - (Bufflen % 4);
228 Bufflen += temp_value % 4;
234 bytes =
rdmalt(Adapter, (
UINT)sRdmBuffer.Register,
235 (
PUINT)temp_buff, Bufflen);
238 if (
copy_to_user(IoBuffer.OutputBuffer, temp_buff, bytes)) {
251 WRM_BUFFER sWrmBuffer = {0};
258 if (IoBuffer.InputLength >
sizeof(sWrmBuffer))
262 if (
copy_from_user(&sWrmBuffer, IoBuffer.InputBuffer, IoBuffer.InputLength))
276 Status =
wrmalt(Adapter, (
UINT)sWrmBuffer.Register,
290 RDM_BUFFER sRdmBuffer = {0};
305 if (IoBuffer.InputLength >
sizeof(sRdmBuffer))
308 if (
copy_from_user(&sRdmBuffer, IoBuffer.InputBuffer, IoBuffer.InputLength))
312 IoBuffer.OutputLength == 0) {
320 if ((((
ULONG)sRdmBuffer.Register & 0x0F000000) != 0x0F000000) ||
321 ((
ULONG)sRdmBuffer.Register & 0x3)) {
324 (
int)sRdmBuffer.Register);
335 if (
copy_to_user(IoBuffer.OutputBuffer, temp_buff, bytes)) {
348 WRM_BUFFER sWrmBuffer = {0};
362 if (IoBuffer.InputLength >
sizeof(sWrmBuffer))
366 if (
copy_from_user(&sWrmBuffer, IoBuffer.InputBuffer, IoBuffer.InputLength))
369 if ((((
ULONG)sWrmBuffer.Register & 0x0F000000) != 0x0F000000) ||
370 ((
ULONG)sWrmBuffer.Register & 0x3)) {
389 (
PUINT)sWrmBuffer.Data, sWrmBuffer.Length);
400 UCHAR ucResetValue[4];
403 UINT uiOperation = 0;
405 GPIO_INFO gpio_info = {0};
417 if (IoBuffer.InputLength >
sizeof(gpio_info))
420 if (
copy_from_user(&gpio_info, IoBuffer.InputBuffer, IoBuffer.InputLength))
423 uiBit = gpio_info.uiGpioNumber;
424 uiOperation = gpio_info.uiGpioValue;
460 "GPIO_MODE_REGISTER read failed");
467 *(
UINT *)ucResetValue |= (1<<uiBit);
481 USER_THREAD_REQ threadReq = {0};
496 if (IoBuffer.InputLength >
sizeof(threadReq))
499 if (
copy_from_user(&threadReq, IoBuffer.InputBuffer, IoBuffer.InputLength))
521 GPIO_INFO gpio_info = {0};
531 if (IoBuffer.InputLength >
sizeof(gpio_info))
534 if (
copy_from_user(&gpio_info, IoBuffer.InputBuffer, IoBuffer.InputLength))
537 uiBit = gpio_info.uiGpioNumber;
554 UCHAR ucResetValue[4];
555 GPIO_MULTI_INFO gpio_multi_info[
MAX_IDX];
558 memset(pgpio_multi_info, 0,
MAX_IDX *
sizeof(GPIO_MULTI_INFO));
568 if (IoBuffer.InputLength >
sizeof(gpio_multi_info))
571 if (
copy_from_user(&gpio_multi_info, IoBuffer.InputBuffer, IoBuffer.InputLength))
576 "Sorry, Requested GPIO<0x%X> is not correspond to NVM LED bit map<0x%X>!!!",
583 if ((pgpio_multi_info[
WIMAX_IDX].uiGPIOMask) &
586 *(
UINT *)ucResetValue = pgpio_multi_info[
WIMAX_IDX].uiGPIOMask &
587 pgpio_multi_info[
WIMAX_IDX].uiGPIOCommand &
590 if (*(
UINT *) ucResetValue)
600 *(
UINT *)ucResetValue = (pgpio_multi_info[
WIMAX_IDX].uiGPIOMask &
601 pgpio_multi_info[
WIMAX_IDX].uiGPIOCommand &
604 if (*(
UINT *) ucResetValue)
613 if (pgpio_multi_info[
WIMAX_IDX].uiGPIOMask) {
624 pgpio_multi_info[
WIMAX_IDX].uiGPIOValue = (*(
UINT *)ucResetValue &
628 Status =
copy_to_user(IoBuffer.OutputBuffer, &gpio_multi_info, IoBuffer.OutputLength);
631 "Failed while copying Content to IOBufer for user space err:%d", Status);
638 UCHAR ucResetValue[4];
639 GPIO_MULTI_MODE gpio_multi_mode[
MAX_IDX];
650 if (IoBuffer.InputLength >
sizeof(gpio_multi_mode))
653 if (
copy_from_user(&gpio_multi_mode, IoBuffer.InputBuffer, IoBuffer.InputLength))
669 "Sorry, Requested GPIO<0x%X> is not correspond to NVM LED bit map<0x%X>!!!",
675 if (pgpio_multi_mode[
WIMAX_IDX].uiGPIOMask) {
687 pgpio_multi_mode[
WIMAX_IDX].uiGPIOMode = *(
UINT *)ucResetValue;
692 "WRM to GPIO_MODE_REGISTER Done");
695 "WRM to GPIO_MODE_REGISTER Failed");
701 pgpio_multi_mode[
WIMAX_IDX].uiGPIOMode = *(
UINT *)ucResetValue;
704 Status =
copy_to_user(IoBuffer.OutputBuffer, &gpio_multi_mode, IoBuffer.OutputLength);
707 "Failed while copying Content to IOBufer for user space err:%d", Status);
732 IoBuffer.InputLength);
733 if (IS_ERR(pvBuffer))
734 return PTR_ERR(pvBuffer);
745 "Preparing Idle Mode is still True - Hence Rejecting control message\n");
760 "IOCTL_BCM_CHIP_RESET not allowed as EEPROM Read/Write is in progress\n");
765 "Starting the firmware download PID =0x%x!!!!\n",
current->pid);
775 netif_stop_queue(Adapter->
dev);
778 pr_err(
PFX "%s: reset_card_proc Failed!\n", Adapter->
dev->name);
795 "Invalid way to download buffer. Use Start and then call this!!!\n");
808 "Length for FW DLD is : %lx\n", IoBuffer.InputLength);
821 if (
copy_from_user(psFwInfo, IoBuffer.InputBuffer, IoBuffer.InputLength)) {
871 "FW download blocked as EEPROM Read/Write is in progress\n");
959 for (uiLoopIndex = 0; uiLoopIndex <
NO_OF_QUEUES; uiLoopIndex++) {
961 (
unsigned long __user *)arg)) {
1023 if (IoBuffer.OutputLength !=
sizeof(link_state)) {
1028 memset(&link_state, 0,
sizeof(link_state));
1033 if (
copy_to_user(IoBuffer.OutputBuffer, &link_state,
min_t(
size_t,
sizeof(link_state), IoBuffer.OutputLength))) {
1065 "Mismatch req: %lx needed is =0x%zx!!!",
1070 if (
copy_from_user(&ulSFId, IoBuffer.InputBuffer,
sizeof(ulSFId)))
1087 "Length Check failed %lu %zd\n",
1138 if (IoBuffer.InputLength <
sizeof(
ULONG) * 2)
1142 IoBuffer.InputLength);
1143 if (IS_ERR(pvBuffer))
1144 return PTR_ERR(pvBuffer);
1148 if (((
ULONG)pBulkBuffer->
Register & 0x0F000000) != 0x0F000000 ||
1195 UINT uiSectorSize = 0 ;
1231 USER_BCM_DBG_STATE sUserDebugState;
1237 if (
copy_from_user(&sUserDebugState, IoBuffer.InputBuffer,
sizeof(USER_BCM_DBG_STATE)))
1241 sUserDebugState.OnOff, sUserDebugState.Type);
1243 sUserDebugState.Subtype = 1 << sUserDebugState.Subtype;
1253 if (sUserDebugState.OnOff)
1267 ULONG ulDSDMagicNumInUsrBuff = 0;
1308 if (IS_ERR(pReadData))
1309 return PTR_ERR(pReadData);
1412 UINT ReadOffset = 0;
1443 ReadOffset = sFlash2xRead.
offset ;
1444 OutPutBuff = IoBuffer.OutputBuffer;
1447 if (pReadBuff ==
NULL) {
1478 Status =
copy_to_user(OutPutBuff, pReadBuff, ReadBytes);
1485 NOB = NOB - ReadBytes;
1487 ReadOffset = ReadOffset + ReadBytes;
1488 OutPutBuff = OutPutBuff + ReadBytes ;
1503 UINT WriteOffset = 0;
1504 UINT WriteBytes = 0;
1537 WriteOffset = sFlash2xWrite.
offset;
1547 if (pWriteBuff ==
NULL)
1555 if (NOB < WriteBytes)
1589 NOB = NOB - WriteBytes;
1591 WriteOffset = WriteOffset + WriteBytes;
1592 InputAddr = InputAddr + WriteBytes;
1617 if (psFlash2xBitMap ==
NULL) {
1631 kfree(psFlash2xBitMap);
1638 kfree(psFlash2xBitMap);
1642 kfree(psFlash2xBitMap);
1661 Status =
copy_from_user(&eFlash2xSectionVal, IoBuffer.InputBuffer,
sizeof(
INT));
1753 Status =
BcmCopyISO(Adapter, sCopySectStrut);
1816 Status =
copy_from_user(&eFlash2xSectionVal, IoBuffer.InputBuffer,
sizeof(
INT));
1823 if ((eFlash2xSectionVal !=
DSD0) &&
1824 (eFlash2xSectionVal !=
DSD1) &&
1825 (eFlash2xSectionVal !=
DSD2)) {
1849 UINT ReadBytes = 0 ;
1876 OutPutBuff = stNVMRead.
pBuffer;
1879 if (pReadBuff ==
NULL) {
1913 Status =
copy_to_user(OutPutBuff, pReadBuff, ReadBytes);
1920 NOB = NOB - ReadBytes;
1922 ReadOffset = ReadOffset + ReadBytes;
1923 OutPutBuff = OutPutBuff + ReadBytes;
1933 ULONG RxCntrlMsgBitMask = 0;
1942 if (IoBuffer.InputLength !=
sizeof(
unsigned long)) {
1947 Status =
copy_from_user(&RxCntrlMsgBitMask, IoBuffer.InputBuffer, IoBuffer.InputLength);
1971 if (IoBuffer.OutputLength <
sizeof(DevInfo))
1974 if (
copy_to_user(IoBuffer.OutputBuffer, &DevInfo,
sizeof(DevInfo)))
2012 .open = bcm_char_open,
2013 .release = bcm_char_release,
2014 .read = bcm_char_read,
2015 .unlocked_ioctl = bcm_char_ioctl,
2022 if (Adapter->
major > 0)
2023 return Adapter->
major;
2026 if (Adapter->
major < 0) {
2028 return Adapter->
major;
2046 if (Adapter->
major > 0) {