Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 1 | #include "headers.h" |
| 2 | |
Stephen Hemminger | 9dd47ee | 2010-11-01 12:24:00 -0400 | [diff] [blame] | 3 | static int BcmFileDownload(PMINI_ADAPTER Adapter, const char *path, |
| 4 | unsigned int loc); |
| 5 | static VOID doPowerAutoCorrection(PMINI_ADAPTER psAdapter); |
| 6 | static void HandleShutDownModeRequest(PMINI_ADAPTER Adapter,PUCHAR pucBuffer); |
| 7 | static int bcm_parse_target_params(PMINI_ADAPTER Adapter); |
| 8 | static void beceem_protocol_reset (PMINI_ADAPTER Adapter); |
| 9 | |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 10 | static VOID default_wimax_protocol_initialize(PMINI_ADAPTER Adapter) |
| 11 | { |
| 12 | |
| 13 | UINT uiLoopIndex; |
| 14 | |
| 15 | for(uiLoopIndex=0; uiLoopIndex < NO_OF_QUEUES-1; uiLoopIndex++) |
| 16 | { |
| 17 | Adapter->PackInfo[uiLoopIndex].uiThreshold=TX_PACKET_THRESHOLD; |
| 18 | Adapter->PackInfo[uiLoopIndex].uiMaxAllowedRate=MAX_ALLOWED_RATE; |
| 19 | Adapter->PackInfo[uiLoopIndex].uiMaxBucketSize=20*1024*1024; |
| 20 | } |
| 21 | |
| 22 | Adapter->BEBucketSize=BE_BUCKET_SIZE; |
| 23 | Adapter->rtPSBucketSize=rtPS_BUCKET_SIZE; |
| 24 | Adapter->LinkStatus=SYNC_UP_REQUEST; |
| 25 | Adapter->TransferMode=IP_PACKET_ONLY_MODE; |
| 26 | Adapter->usBestEffortQueueIndex=-1; |
| 27 | return; |
| 28 | } |
| 29 | |
| 30 | |
| 31 | INT |
| 32 | InitAdapter(PMINI_ADAPTER psAdapter) |
| 33 | { |
| 34 | int i = 0; |
| 35 | INT Status = STATUS_SUCCESS ; |
Arnd Bergmann | 9f1c75a | 2010-09-30 10:24:11 +0200 | [diff] [blame] | 36 | BCM_DEBUG_PRINT(psAdapter,DBG_TYPE_INITEXIT, MP_INIT, DBG_LVL_ALL, "Initialising Adapter = %p", psAdapter); |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 37 | |
| 38 | if(psAdapter == NULL) |
| 39 | { |
| 40 | BCM_DEBUG_PRINT(psAdapter,DBG_TYPE_INITEXIT, MP_INIT, DBG_LVL_ALL, "Adapter is NULL"); |
| 41 | return -EINVAL; |
| 42 | } |
| 43 | |
| 44 | sema_init(&psAdapter->NVMRdmWrmLock,1); |
| 45 | // psAdapter->ulFlashCalStart = FLASH_AUTO_INIT_BASE_ADDR; |
| 46 | |
| 47 | sema_init(&psAdapter->rdmwrmsync, 1); |
| 48 | spin_lock_init(&psAdapter->control_queue_lock); |
| 49 | spin_lock_init(&psAdapter->txtransmitlock); |
| 50 | sema_init(&psAdapter->RxAppControlQueuelock, 1); |
| 51 | // sema_init(&psAdapter->data_packet_queue_lock, 1); |
| 52 | sema_init(&psAdapter->fw_download_sema, 1); |
| 53 | sema_init(&psAdapter->LowPowerModeSync,1); |
| 54 | |
| 55 | // spin_lock_init(&psAdapter->sleeper_lock); |
| 56 | |
| 57 | for(i=0;i<NO_OF_QUEUES; i++) |
| 58 | spin_lock_init(&psAdapter->PackInfo[i].SFQueueLock); |
| 59 | i=0; |
| 60 | |
| 61 | init_waitqueue_head(&psAdapter->process_rx_cntrlpkt); |
| 62 | init_waitqueue_head(&psAdapter->tx_packet_wait_queue); |
| 63 | init_waitqueue_head(&psAdapter->process_read_wait_queue); |
| 64 | init_waitqueue_head(&psAdapter->ioctl_fw_dnld_wait_queue); |
| 65 | init_waitqueue_head(&psAdapter->lowpower_mode_wait_queue); |
| 66 | psAdapter->waiting_to_fw_download_done = TRUE; |
| 67 | //init_waitqueue_head(&psAdapter->device_wake_queue); |
| 68 | psAdapter->fw_download_done=FALSE; |
| 69 | |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 70 | |
| 71 | default_wimax_protocol_initialize(psAdapter); |
| 72 | for (i=0;i<MAX_CNTRL_PKTS;i++) |
| 73 | { |
Jesper Juhl | 3701bef | 2010-11-10 21:31:38 +0100 | [diff] [blame] | 74 | psAdapter->txctlpacket[i] = kmalloc(MAX_CNTL_PKT_SIZE, GFP_KERNEL); |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 75 | if(!psAdapter->txctlpacket[i]) |
| 76 | { |
| 77 | BCM_DEBUG_PRINT(psAdapter,DBG_TYPE_INITEXIT, MP_INIT, DBG_LVL_ALL, "No More Cntl pkts got, max got is %d", i); |
| 78 | return -ENOMEM; |
| 79 | } |
| 80 | } |
| 81 | if(AllocAdapterDsxBuffer(psAdapter)) |
| 82 | { |
| 83 | BCM_DEBUG_PRINT(psAdapter,DBG_TYPE_INITEXIT, MP_INIT, DBG_LVL_ALL, "Failed to allocate DSX buffers"); |
| 84 | return -EINVAL; |
| 85 | } |
| 86 | |
| 87 | //Initialize PHS interface |
| 88 | if(phs_init(&psAdapter->stBCMPhsContext,psAdapter)!=0) |
| 89 | { |
| 90 | BCM_DEBUG_PRINT(psAdapter,DBG_TYPE_INITEXIT, MP_INIT, DBG_LVL_ALL,"%s:%s:%d:Error PHS Init Failed=====>\n", __FILE__, __FUNCTION__, __LINE__); |
| 91 | return -ENOMEM; |
| 92 | } |
| 93 | |
| 94 | Status = BcmAllocFlashCSStructure(psAdapter); |
| 95 | if(Status) |
| 96 | { |
| 97 | BCM_DEBUG_PRINT(psAdapter,DBG_TYPE_INITEXIT, MP_INIT, DBG_LVL_ALL,"Memory Allocation for Flash structure failed"); |
| 98 | return Status ; |
| 99 | } |
| 100 | |
| 101 | Status = vendorextnInit(psAdapter); |
| 102 | |
| 103 | if(STATUS_SUCCESS != Status) |
| 104 | { |
| 105 | BCM_DEBUG_PRINT(psAdapter,DBG_TYPE_INITEXIT, MP_INIT, DBG_LVL_ALL,"Vendor Init Failed"); |
| 106 | return Status ; |
| 107 | } |
| 108 | |
| 109 | BCM_DEBUG_PRINT(psAdapter,DBG_TYPE_INITEXIT, MP_INIT, DBG_LVL_ALL, "Adapter initialised"); |
| 110 | |
| 111 | |
| 112 | return STATUS_SUCCESS; |
| 113 | } |
| 114 | |
| 115 | VOID AdapterFree(PMINI_ADAPTER Adapter) |
| 116 | { |
Stephen Hemminger | e614e28 | 2010-11-01 09:52:14 -0400 | [diff] [blame] | 117 | int count; |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 118 | |
| 119 | beceem_protocol_reset(Adapter); |
| 120 | |
| 121 | vendorextnExit(Adapter); |
| 122 | |
| 123 | if(Adapter->control_packet_handler && !IS_ERR(Adapter->control_packet_handler)) |
| 124 | kthread_stop (Adapter->control_packet_handler); |
Stephen Hemminger | e614e28 | 2010-11-01 09:52:14 -0400 | [diff] [blame] | 125 | |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 126 | if(Adapter->transmit_packet_thread && !IS_ERR(Adapter->transmit_packet_thread)) |
Stephen Hemminger | e614e28 | 2010-11-01 09:52:14 -0400 | [diff] [blame] | 127 | kthread_stop (Adapter->transmit_packet_thread); |
| 128 | |
| 129 | wake_up(&Adapter->process_read_wait_queue); |
| 130 | |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 131 | if(Adapter->LEDInfo.led_thread_running & (BCM_LED_THREAD_RUNNING_ACTIVELY | BCM_LED_THREAD_RUNNING_INACTIVELY)) |
| 132 | kthread_stop (Adapter->LEDInfo.led_cntrl_threadid); |
Stephen Hemminger | e614e28 | 2010-11-01 09:52:14 -0400 | [diff] [blame] | 133 | |
Stephen Hemminger | 4ea4f7a | 2010-11-01 14:06:24 -0400 | [diff] [blame] | 134 | unregister_networkdev(Adapter); |
Stephen Hemminger | e614e28 | 2010-11-01 09:52:14 -0400 | [diff] [blame] | 135 | |
| 136 | /* FIXME: use proper wait_event and refcounting */ |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 137 | while(atomic_read(&Adapter->ApplicationRunning)) |
| 138 | { |
| 139 | BCM_DEBUG_PRINT(Adapter,DBG_TYPE_INITEXIT, MP_INIT, DBG_LVL_ALL, "Waiting for Application to close.. %d\n",atomic_read(&Adapter->ApplicationRunning)); |
| 140 | msleep(100); |
| 141 | } |
| 142 | unregister_control_device_interface(Adapter); |
Stephen Hemminger | e614e28 | 2010-11-01 09:52:14 -0400 | [diff] [blame] | 143 | |
| 144 | kfree(Adapter->pstargetparams); |
| 145 | |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 146 | for (count =0;count < MAX_CNTRL_PKTS;count++) |
Stephen Hemminger | e614e28 | 2010-11-01 09:52:14 -0400 | [diff] [blame] | 147 | kfree(Adapter->txctlpacket[count]); |
| 148 | |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 149 | FreeAdapterDsxBuffer(Adapter); |
Stephen Hemminger | 92bc605 | 2010-10-29 08:22:10 -0700 | [diff] [blame] | 150 | |
Stephen Hemminger | e614e28 | 2010-11-01 09:52:14 -0400 | [diff] [blame] | 151 | kfree(Adapter->pvInterfaceAdapter); |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 152 | |
| 153 | //Free the PHS Interface |
| 154 | PhsCleanup(&Adapter->stBCMPhsContext); |
| 155 | |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 156 | BcmDeAllocFlashCSStructure(Adapter); |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 157 | |
Stephen Hemminger | e614e28 | 2010-11-01 09:52:14 -0400 | [diff] [blame] | 158 | free_netdev(Adapter->dev); |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 159 | } |
| 160 | |
Stephen Hemminger | 2d08748 | 2010-11-01 12:14:01 -0400 | [diff] [blame] | 161 | static int create_worker_threads(PMINI_ADAPTER psAdapter) |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 162 | { |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 163 | // Rx Control Packets Processing |
| 164 | psAdapter->control_packet_handler = kthread_run((int (*)(void *)) |
Stephen Hemminger | 2d08748 | 2010-11-01 12:14:01 -0400 | [diff] [blame] | 165 | control_packet_handler, psAdapter, "%s-rx", DRV_NAME); |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 166 | if(IS_ERR(psAdapter->control_packet_handler)) |
| 167 | { |
Stephen Hemminger | 2d08748 | 2010-11-01 12:14:01 -0400 | [diff] [blame] | 168 | pr_notice(DRV_NAME ": could not create control thread\n"); |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 169 | return PTR_ERR(psAdapter->control_packet_handler); |
| 170 | } |
Stephen Hemminger | 2d08748 | 2010-11-01 12:14:01 -0400 | [diff] [blame] | 171 | |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 172 | // Tx Thread |
| 173 | psAdapter->transmit_packet_thread = kthread_run((int (*)(void *)) |
Stephen Hemminger | 2d08748 | 2010-11-01 12:14:01 -0400 | [diff] [blame] | 174 | tx_pkt_handler, psAdapter, "%s-tx", DRV_NAME); |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 175 | if(IS_ERR (psAdapter->transmit_packet_thread)) |
| 176 | { |
Stephen Hemminger | 2d08748 | 2010-11-01 12:14:01 -0400 | [diff] [blame] | 177 | pr_notice(DRV_NAME ": could not creat transmit thread\n"); |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 178 | kthread_stop(psAdapter->control_packet_handler); |
| 179 | return PTR_ERR(psAdapter->transmit_packet_thread); |
| 180 | } |
| 181 | return 0; |
| 182 | } |
| 183 | |
Stephen Hemminger | 9dd47ee | 2010-11-01 12:24:00 -0400 | [diff] [blame] | 184 | static struct file *open_firmware_file(PMINI_ADAPTER Adapter, const char *path) |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 185 | { |
| 186 | struct file *flp=NULL; |
| 187 | mm_segment_t oldfs; |
| 188 | oldfs=get_fs(); |
| 189 | set_fs(get_ds()); |
| 190 | flp=filp_open(path, O_RDONLY, S_IRWXU); |
| 191 | set_fs(oldfs); |
| 192 | if(IS_ERR(flp)) |
| 193 | { |
Stephen Hemminger | 2d08748 | 2010-11-01 12:14:01 -0400 | [diff] [blame] | 194 | pr_err(DRV_NAME "Unable To Open File %s, err %ld", |
| 195 | path, PTR_ERR(flp)); |
| 196 | flp = NULL; |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 197 | } |
Stephen Hemminger | 2d08748 | 2010-11-01 12:14:01 -0400 | [diff] [blame] | 198 | |
| 199 | if(Adapter->device_removed) |
| 200 | flp = NULL; |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 201 | |
| 202 | return flp; |
| 203 | } |
| 204 | |
| 205 | |
Stephen Hemminger | 9dd47ee | 2010-11-01 12:24:00 -0400 | [diff] [blame] | 206 | static int BcmFileDownload(PMINI_ADAPTER Adapter,/**< Logical Adapter */ |
| 207 | const char *path, /**< path to image file */ |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 208 | unsigned int loc /**< Download Address on the chip*/ |
| 209 | ) |
| 210 | { |
| 211 | int errorno=0; |
| 212 | struct file *flp=NULL; |
| 213 | mm_segment_t oldfs; |
| 214 | struct timeval tv={0}; |
| 215 | |
| 216 | flp=open_firmware_file(Adapter, path); |
| 217 | if(!flp) |
| 218 | { |
| 219 | errorno = -ENOENT; |
| 220 | BCM_DEBUG_PRINT(Adapter,DBG_TYPE_INITEXIT, MP_INIT, DBG_LVL_ALL, "Unable to Open %s\n", path); |
| 221 | goto exit_download; |
| 222 | } |
| 223 | BCM_DEBUG_PRINT(Adapter,DBG_TYPE_INITEXIT, MP_INIT, DBG_LVL_ALL, "Opened file is = %s and length =0x%lx to be downloaded at =0x%x", path,(unsigned long)flp->f_dentry->d_inode->i_size, loc); |
| 224 | do_gettimeofday(&tv); |
| 225 | |
| 226 | BCM_DEBUG_PRINT(Adapter,DBG_TYPE_INITEXIT, MP_INIT, DBG_LVL_ALL, "download start %lx", ((tv.tv_sec * 1000) + |
| 227 | (tv.tv_usec/1000))); |
| 228 | if(Adapter->bcm_file_download(Adapter->pvInterfaceAdapter, flp, loc)) |
| 229 | { |
| 230 | BCM_DEBUG_PRINT(Adapter,DBG_TYPE_INITEXIT, MP_INIT, DBG_LVL_ALL, "Failed to download the firmware with error\ |
| 231 | %x!!!", -EIO); |
| 232 | errorno=-EIO; |
| 233 | goto exit_download; |
| 234 | } |
| 235 | oldfs=get_fs();set_fs(get_ds()); |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 236 | vfs_llseek(flp, 0, 0); |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 237 | set_fs(oldfs); |
| 238 | if(Adapter->bcm_file_readback_from_chip(Adapter->pvInterfaceAdapter, |
| 239 | flp, loc)) |
| 240 | { |
| 241 | BCM_DEBUG_PRINT(Adapter,DBG_TYPE_INITEXIT, MP_INIT, DBG_LVL_ALL, "Failed to read back firmware!"); |
| 242 | errorno=-EIO; |
| 243 | goto exit_download; |
| 244 | } |
| 245 | |
| 246 | exit_download: |
| 247 | oldfs=get_fs();set_fs(get_ds()); |
| 248 | if(flp && !(IS_ERR(flp))) |
| 249 | filp_close(flp, current->files); |
| 250 | set_fs(oldfs); |
Stephen Hemminger | 2d08748 | 2010-11-01 12:14:01 -0400 | [diff] [blame] | 251 | |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 252 | return errorno; |
| 253 | } |
| 254 | |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 255 | /** |
| 256 | @ingroup ctrl_pkt_functions |
| 257 | This function copies the contents of given buffer |
| 258 | to the control packet and queues it for transmission. |
| 259 | @note Do not acquire the spinock, as it it already acquired. |
| 260 | @return SUCCESS/FAILURE. |
| 261 | */ |
| 262 | INT CopyBufferToControlPacket(PMINI_ADAPTER Adapter,/**<Logical Adapter*/ |
| 263 | PVOID ioBuffer/**<Control Packet Buffer*/ |
| 264 | ) |
| 265 | { |
| 266 | PLEADER pLeader=NULL; |
| 267 | INT Status=0; |
| 268 | unsigned char *ctrl_buff=NULL; |
| 269 | UINT pktlen=0; |
| 270 | PLINK_REQUEST pLinkReq = NULL; |
| 271 | PUCHAR pucAddIndication = NULL; |
| 272 | |
| 273 | BCM_DEBUG_PRINT( Adapter,DBG_TYPE_TX, TX_CONTROL, DBG_LVL_ALL, "======>"); |
| 274 | if(!ioBuffer) |
| 275 | { |
| 276 | BCM_DEBUG_PRINT( Adapter,DBG_TYPE_TX, TX_CONTROL,DBG_LVL_ALL, "Got Null Buffer\n"); |
| 277 | return -EINVAL; |
| 278 | } |
| 279 | |
| 280 | pLinkReq = (PLINK_REQUEST)ioBuffer; |
| 281 | pLeader=(PLEADER)ioBuffer; //ioBuffer Contains sw_Status and Payload |
| 282 | |
| 283 | if(Adapter->bShutStatus == TRUE && |
| 284 | pLinkReq->szData[0] == LINK_DOWN_REQ_PAYLOAD && |
| 285 | pLinkReq->szData[1] == LINK_SYNC_UP_SUBTYPE) |
| 286 | { |
| 287 | //Got sync down in SHUTDOWN..we could not process this. |
| 288 | BCM_DEBUG_PRINT(Adapter,DBG_TYPE_TX, TX_CONTROL,DBG_LVL_ALL, "SYNC DOWN Request in Shut Down Mode..\n"); |
| 289 | return STATUS_FAILURE; |
| 290 | } |
| 291 | |
| 292 | if((pLeader->Status == LINK_UP_CONTROL_REQ) && |
| 293 | ((pLinkReq->szData[0] == LINK_UP_REQ_PAYLOAD && |
| 294 | (pLinkReq->szData[1] == LINK_SYNC_UP_SUBTYPE)) ||//Sync Up Command |
| 295 | pLinkReq->szData[0] == NETWORK_ENTRY_REQ_PAYLOAD)) //Net Entry Command |
| 296 | { |
| 297 | if(Adapter->LinkStatus > PHY_SYNC_ACHIVED) |
| 298 | { |
| 299 | BCM_DEBUG_PRINT(Adapter,DBG_TYPE_TX, TX_CONTROL,DBG_LVL_ALL,"LinkStatus is Greater than PHY_SYN_ACHIEVED"); |
| 300 | return STATUS_FAILURE; |
| 301 | } |
| 302 | if(TRUE == Adapter->bShutStatus) |
| 303 | { |
| 304 | BCM_DEBUG_PRINT(Adapter,DBG_TYPE_TX, TX_CONTROL,DBG_LVL_ALL, "SYNC UP IN SHUTDOWN..Device WakeUp\n"); |
| 305 | if(Adapter->bTriedToWakeUpFromlowPowerMode == FALSE) |
| 306 | { |
| 307 | BCM_DEBUG_PRINT(Adapter,DBG_TYPE_TX, TX_CONTROL,DBG_LVL_ALL, "Waking up for the First Time..\n"); |
| 308 | Adapter->usIdleModePattern = ABORT_SHUTDOWN_MODE; // change it to 1 for current support. |
| 309 | Adapter->bWakeUpDevice = TRUE; |
| 310 | wake_up(&Adapter->process_rx_cntrlpkt); |
| 311 | |
| 312 | Status = wait_event_interruptible_timeout(Adapter->lowpower_mode_wait_queue, |
| 313 | !Adapter->bShutStatus, (5 * HZ)); |
| 314 | |
| 315 | if(Status == -ERESTARTSYS) |
| 316 | return Status; |
| 317 | |
| 318 | if(Adapter->bShutStatus) |
| 319 | { |
| 320 | BCM_DEBUG_PRINT(Adapter,DBG_TYPE_TX, TX_CONTROL,DBG_LVL_ALL, "Shutdown Mode Wake up Failed - No Wake Up Received\n"); |
| 321 | return STATUS_FAILURE; |
| 322 | } |
| 323 | } |
| 324 | else |
| 325 | { |
| 326 | BCM_DEBUG_PRINT(Adapter,DBG_TYPE_TX, TX_CONTROL,DBG_LVL_ALL, "Wakeup has been tried already...\n"); |
| 327 | } |
| 328 | } |
| 329 | |
| 330 | } |
| 331 | if(TRUE == Adapter->IdleMode) |
| 332 | { |
| 333 | //BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0,"Device is in Idle mode ... hence \n"); |
| 334 | if(pLeader->Status == LINK_UP_CONTROL_REQ || pLeader->Status == 0x80 || |
| 335 | pLeader->Status == CM_CONTROL_NEWDSX_MULTICLASSIFIER_REQ ) |
| 336 | |
| 337 | { |
| 338 | if((pLeader->Status == LINK_UP_CONTROL_REQ) && (pLinkReq->szData[0]==LINK_DOWN_REQ_PAYLOAD)) |
| 339 | { |
| 340 | if((pLinkReq->szData[1] == LINK_SYNC_DOWN_SUBTYPE)) |
| 341 | { |
| 342 | BCM_DEBUG_PRINT(Adapter,DBG_TYPE_TX, TX_CONTROL,DBG_LVL_ALL, "Link Down Sent in Idle Mode\n"); |
| 343 | Adapter->usIdleModePattern = ABORT_IDLE_SYNCDOWN;//LINK DOWN sent in Idle Mode |
| 344 | } |
| 345 | else |
| 346 | { |
| 347 | BCM_DEBUG_PRINT(Adapter,DBG_TYPE_TX, TX_CONTROL,DBG_LVL_ALL,"ABORT_IDLE_MODE pattern is being written\n"); |
| 348 | Adapter->usIdleModePattern = ABORT_IDLE_REG; |
| 349 | } |
| 350 | } |
| 351 | else |
| 352 | { |
| 353 | BCM_DEBUG_PRINT(Adapter,DBG_TYPE_TX, TX_CONTROL,DBG_LVL_ALL,"ABORT_IDLE_MODE pattern is being written\n"); |
| 354 | Adapter->usIdleModePattern = ABORT_IDLE_MODE; |
| 355 | } |
| 356 | |
| 357 | /*Setting bIdleMode_tx_from_host to TRUE to indicate LED control thread to represent |
| 358 | the wake up from idlemode is from host*/ |
| 359 | //Adapter->LEDInfo.bIdleMode_tx_from_host = TRUE; |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 360 | Adapter->bWakeUpDevice = TRUE; |
| 361 | wake_up(&Adapter->process_rx_cntrlpkt); |
| 362 | |
| 363 | |
| 364 | |
| 365 | if(LINK_DOWN_REQ_PAYLOAD == pLinkReq->szData[0]) |
| 366 | { |
| 367 | // We should not send DREG message down while in idlemode. |
| 368 | return STATUS_SUCCESS; |
| 369 | } |
| 370 | |
| 371 | Status = wait_event_interruptible_timeout(Adapter->lowpower_mode_wait_queue, |
| 372 | !Adapter->IdleMode, (5 * HZ)); |
| 373 | |
| 374 | if(Status == -ERESTARTSYS) |
| 375 | return Status; |
| 376 | |
| 377 | if(Adapter->IdleMode) |
| 378 | { |
| 379 | BCM_DEBUG_PRINT(Adapter,DBG_TYPE_TX, TX_CONTROL,DBG_LVL_ALL, "Idle Mode Wake up Failed - No Wake Up Received\n"); |
| 380 | return STATUS_FAILURE; |
| 381 | } |
| 382 | } |
| 383 | else |
| 384 | return STATUS_SUCCESS; |
| 385 | } |
| 386 | //The Driver has to send control messages with a particular VCID |
| 387 | pLeader->Vcid = VCID_CONTROL_PACKET;//VCID for control packet. |
| 388 | |
| 389 | /* Allocate skb for Control Packet */ |
| 390 | pktlen = pLeader->PLength; |
| 391 | ctrl_buff = (char *)Adapter->txctlpacket[atomic_read(&Adapter->index_wr_txcntrlpkt)%MAX_CNTRL_PKTS]; |
| 392 | |
| 393 | BCM_DEBUG_PRINT(Adapter,DBG_TYPE_TX, TX_CONTROL,DBG_LVL_ALL, "Control packet to be taken =%d and address is =%pincoming address is =%p and packet len=%x", |
| 394 | atomic_read(&Adapter->index_wr_txcntrlpkt), ctrl_buff, ioBuffer, pktlen); |
| 395 | if(ctrl_buff) |
| 396 | { |
| 397 | if(pLeader) |
| 398 | { |
| 399 | if((pLeader->Status == 0x80) || |
| 400 | (pLeader->Status == CM_CONTROL_NEWDSX_MULTICLASSIFIER_REQ)) |
| 401 | { |
| 402 | /* |
| 403 | //Restructure the DSX message to handle Multiple classifier Support |
| 404 | // Write the Service Flow param Structures directly to the target |
| 405 | //and embed the pointers in the DSX messages sent to target. |
| 406 | */ |
| 407 | //Lets store the current length of the control packet we are transmitting |
| 408 | pucAddIndication = (PUCHAR)ioBuffer + LEADER_SIZE; |
| 409 | pktlen = pLeader->PLength; |
| 410 | Status = StoreCmControlResponseMessage(Adapter,pucAddIndication, &pktlen); |
| 411 | if(Status != 1) |
| 412 | { |
| 413 | ClearTargetDSXBuffer(Adapter,((stLocalSFAddIndicationAlt *)pucAddIndication)->u16TID, FALSE); |
| 414 | BCM_DEBUG_PRINT(Adapter,DBG_TYPE_TX, TX_CONTROL, DBG_LVL_ALL, " Error Restoring The DSX Control Packet. Dsx Buffers on Target may not be Setup Properly "); |
| 415 | return STATUS_FAILURE; |
| 416 | } |
| 417 | /* |
| 418 | //update the leader to use the new length |
| 419 | //The length of the control packet is length of message being sent + Leader length |
| 420 | */ |
| 421 | pLeader->PLength = pktlen; |
| 422 | } |
| 423 | } |
| 424 | memset(ctrl_buff, 0, pktlen+LEADER_SIZE); |
| 425 | BCM_DEBUG_PRINT(Adapter,DBG_TYPE_TX, TX_CONTROL, DBG_LVL_ALL, "Copying the Control Packet Buffer with length=%d\n", pLeader->PLength); |
| 426 | *(PLEADER)ctrl_buff=*pLeader; |
| 427 | memcpy(ctrl_buff + LEADER_SIZE, ((PUCHAR)ioBuffer + LEADER_SIZE), pLeader->PLength); |
| 428 | BCM_DEBUG_PRINT(Adapter,DBG_TYPE_TX, TX_CONTROL, DBG_LVL_ALL, "Enqueuing the Control Packet"); |
| 429 | |
| 430 | /*Update the statistics counters */ |
| 431 | spin_lock_bh(&Adapter->PackInfo[HiPriority].SFQueueLock); |
| 432 | Adapter->PackInfo[HiPriority].uiCurrentBytesOnHost+=pLeader->PLength; |
| 433 | Adapter->PackInfo[HiPriority].uiCurrentPacketsOnHost++; |
| 434 | atomic_inc(&Adapter->TotalPacketCount); |
| 435 | spin_unlock_bh(&Adapter->PackInfo[HiPriority].SFQueueLock); |
| 436 | |
| 437 | Adapter->PackInfo[HiPriority].bValid = TRUE; |
| 438 | |
| 439 | BCM_DEBUG_PRINT(Adapter,DBG_TYPE_TX, TX_CONTROL, DBG_LVL_ALL, "CurrBytesOnHost: %x bValid: %x", |
| 440 | Adapter->PackInfo[HiPriority].uiCurrentBytesOnHost, |
| 441 | Adapter->PackInfo[HiPriority].bValid); |
| 442 | Status=STATUS_SUCCESS; |
| 443 | /*Queue the packet for transmission */ |
| 444 | atomic_inc(&Adapter->index_wr_txcntrlpkt); |
| 445 | BCM_DEBUG_PRINT( Adapter,DBG_TYPE_TX, TX_CONTROL,DBG_LVL_ALL, "Calling transmit_packets"); |
| 446 | atomic_set(&Adapter->TxPktAvail, 1); |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 447 | wake_up(&Adapter->tx_packet_wait_queue); |
| 448 | } |
| 449 | else |
| 450 | { |
| 451 | Status=-ENOMEM; |
| 452 | BCM_DEBUG_PRINT( Adapter,DBG_TYPE_TX, TX_CONTROL, DBG_LVL_ALL, "mem allocation Failed"); |
| 453 | } |
| 454 | BCM_DEBUG_PRINT( Adapter,DBG_TYPE_TX, TX_CONTROL, DBG_LVL_ALL, "<===="); |
| 455 | return Status; |
| 456 | } |
| 457 | |
Arnd Bergmann | 44a17eff | 2010-09-30 10:24:12 +0200 | [diff] [blame] | 458 | #if 0 |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 459 | /***************************************************************** |
| 460 | * Function - SendStatisticsPointerRequest() |
| 461 | * |
| 462 | * Description - This function builds and forwards the Statistics |
| 463 | * Pointer Request control Packet. |
| 464 | * |
| 465 | * Parameters - Adapter : Pointer to Adapter structure. |
| 466 | * - pstStatisticsPtrRequest : Pointer to link request. |
| 467 | * |
| 468 | * Returns - None. |
| 469 | *****************************************************************/ |
Arnd Bergmann | 44a17eff | 2010-09-30 10:24:12 +0200 | [diff] [blame] | 470 | static VOID SendStatisticsPointerRequest(PMINI_ADAPTER Adapter, |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 471 | PLINK_REQUEST pstStatisticsPtrRequest) |
| 472 | { |
| 473 | BCM_DEBUG_PRINT(Adapter,DBG_TYPE_RX, RX_DPC, DBG_LVL_ALL, "======>"); |
| 474 | pstStatisticsPtrRequest->Leader.Status = STATS_POINTER_REQ_STATUS; |
| 475 | pstStatisticsPtrRequest->Leader.PLength = sizeof(ULONG);//minimum 4 bytes |
| 476 | pstStatisticsPtrRequest->szData[0] = STATISTICS_POINTER_REQ; |
| 477 | |
| 478 | CopyBufferToControlPacket(Adapter,pstStatisticsPtrRequest); |
| 479 | BCM_DEBUG_PRINT(Adapter,DBG_TYPE_RX, RX_DPC, DBG_LVL_ALL, "<====="); |
| 480 | return; |
| 481 | } |
Arnd Bergmann | 44a17eff | 2010-09-30 10:24:12 +0200 | [diff] [blame] | 482 | #endif |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 483 | |
| 484 | |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 485 | /****************************************************************** |
| 486 | * Function - LinkMessage() |
| 487 | * |
| 488 | * Description - This function builds the Sync-up and Link-up request |
| 489 | * packet messages depending on the device Link status. |
| 490 | * |
| 491 | * Parameters - Adapter: Pointer to the Adapter structure. |
| 492 | * |
| 493 | * Returns - None. |
| 494 | *******************************************************************/ |
Stephen Hemminger | 20f4865 | 2010-10-31 23:52:36 -0400 | [diff] [blame] | 495 | VOID LinkMessage(PMINI_ADAPTER Adapter) |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 496 | { |
| 497 | PLINK_REQUEST pstLinkRequest=NULL; |
| 498 | BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, LINK_UP_MSG, DBG_LVL_ALL, "=====>"); |
| 499 | if(Adapter->LinkStatus == SYNC_UP_REQUEST && Adapter->AutoSyncup) |
| 500 | { |
Alexander Beregalov | f4a0e6b | 2011-03-09 03:53:34 +0300 | [diff] [blame] | 501 | pstLinkRequest = kzalloc(sizeof(LINK_REQUEST), GFP_ATOMIC); |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 502 | if(!pstLinkRequest) |
| 503 | { |
| 504 | BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, LINK_UP_MSG, DBG_LVL_ALL, "Can not allocate memory for Link request!"); |
| 505 | return; |
| 506 | } |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 507 | //sync up request... |
| 508 | Adapter->LinkStatus = WAIT_FOR_SYNC;// current link status |
| 509 | BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, LINK_UP_MSG, DBG_LVL_ALL, "Requesting For SyncUp..."); |
| 510 | pstLinkRequest->szData[0]=LINK_UP_REQ_PAYLOAD; |
| 511 | pstLinkRequest->szData[1]=LINK_SYNC_UP_SUBTYPE; |
| 512 | pstLinkRequest->Leader.Status=LINK_UP_CONTROL_REQ; |
| 513 | pstLinkRequest->Leader.PLength=sizeof(ULONG); |
| 514 | Adapter->bSyncUpRequestSent = TRUE; |
| 515 | } |
| 516 | else if(Adapter->LinkStatus == PHY_SYNC_ACHIVED && Adapter->AutoLinkUp) |
| 517 | { |
Alexander Beregalov | f4a0e6b | 2011-03-09 03:53:34 +0300 | [diff] [blame] | 518 | pstLinkRequest = kzalloc(sizeof(LINK_REQUEST), GFP_ATOMIC); |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 519 | if(!pstLinkRequest) |
| 520 | { |
| 521 | BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, LINK_UP_MSG, DBG_LVL_ALL, "Can not allocate memory for Link request!"); |
| 522 | return; |
| 523 | } |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 524 | //LINK_UP_REQUEST |
| 525 | BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, LINK_UP_MSG, DBG_LVL_ALL, "Requesting For LinkUp..."); |
| 526 | pstLinkRequest->szData[0]=LINK_UP_REQ_PAYLOAD; |
| 527 | pstLinkRequest->szData[1]=LINK_NET_ENTRY; |
| 528 | pstLinkRequest->Leader.Status=LINK_UP_CONTROL_REQ; |
| 529 | pstLinkRequest->Leader.PLength=sizeof(ULONG); |
| 530 | } |
| 531 | if(pstLinkRequest) |
| 532 | { |
| 533 | BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, LINK_UP_MSG, DBG_LVL_ALL, "Calling CopyBufferToControlPacket"); |
| 534 | CopyBufferToControlPacket(Adapter, pstLinkRequest); |
Stephen Hemminger | 082e889 | 2010-11-01 09:35:21 -0400 | [diff] [blame] | 535 | kfree(pstLinkRequest); |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 536 | } |
| 537 | BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, LINK_UP_MSG, DBG_LVL_ALL, "LinkMessage <====="); |
| 538 | return; |
| 539 | } |
| 540 | |
| 541 | |
| 542 | /********************************************************************** |
| 543 | * Function - StatisticsResponse() |
| 544 | * |
| 545 | * Description - This function handles the Statistics response packet. |
| 546 | * |
| 547 | * Parameters - Adapter : Pointer to the Adapter structure. |
| 548 | * - pvBuffer: Starting address of Statistic response data. |
| 549 | * |
| 550 | * Returns - None. |
| 551 | ************************************************************************/ |
| 552 | VOID StatisticsResponse(PMINI_ADAPTER Adapter,PVOID pvBuffer) |
| 553 | { |
| 554 | BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "%s====>",__FUNCTION__); |
Stephen Hemminger | e39e3be | 2010-11-01 11:14:29 -0400 | [diff] [blame] | 555 | Adapter->StatisticsPointer = ntohl(*(__be32 *)pvBuffer); |
| 556 | BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "Stats at %x", (UINT)Adapter->StatisticsPointer); |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 557 | BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "%s <====",__FUNCTION__); |
| 558 | return; |
| 559 | } |
| 560 | |
| 561 | |
| 562 | /********************************************************************** |
| 563 | * Function - LinkControlResponseMessage() |
| 564 | * |
| 565 | * Description - This function handles the Link response packets. |
| 566 | * |
| 567 | * Parameters - Adapter : Pointer to the Adapter structure. |
| 568 | * - pucBuffer: Starting address of Link response data. |
| 569 | * |
| 570 | * Returns - None. |
| 571 | ***********************************************************************/ |
| 572 | VOID LinkControlResponseMessage(PMINI_ADAPTER Adapter,PUCHAR pucBuffer) |
| 573 | { |
| 574 | BCM_DEBUG_PRINT(Adapter,DBG_TYPE_RX, RX_DPC, DBG_LVL_ALL, "=====>"); |
| 575 | |
| 576 | if(*pucBuffer==LINK_UP_ACK) |
| 577 | { |
| 578 | switch(*(pucBuffer+1)) |
| 579 | { |
| 580 | case PHY_SYNC_ACHIVED: //SYNCed UP |
| 581 | BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "PHY_SYNC_ACHIVED"); |
| 582 | |
| 583 | if(Adapter->LinkStatus == LINKUP_DONE) |
| 584 | { |
| 585 | beceem_protocol_reset(Adapter); |
| 586 | } |
| 587 | |
| 588 | Adapter->usBestEffortQueueIndex=INVALID_QUEUE_INDEX ; |
| 589 | Adapter->LinkStatus=PHY_SYNC_ACHIVED; |
| 590 | |
| 591 | if(Adapter->LEDInfo.led_thread_running & BCM_LED_THREAD_RUNNING_ACTIVELY) |
| 592 | { |
| 593 | Adapter->DriverState = NO_NETWORK_ENTRY; |
| 594 | wake_up(&Adapter->LEDInfo.notify_led_event); |
| 595 | } |
| 596 | |
| 597 | LinkMessage(Adapter); |
| 598 | break; |
| 599 | |
| 600 | case LINKUP_DONE: |
| 601 | BCM_DEBUG_PRINT(Adapter,DBG_TYPE_RX, RX_DPC, DBG_LVL_ALL, "LINKUP_DONE"); |
| 602 | Adapter->LinkStatus=LINKUP_DONE; |
| 603 | Adapter->bPHSEnabled = *(pucBuffer+3); |
| 604 | Adapter->bETHCSEnabled = *(pucBuffer+4) & ETH_CS_MASK; |
Lucas De Marchi | 25985ed | 2011-03-30 22:57:33 -0300 | [diff] [blame] | 605 | BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "PHS Support Status Received In LinkUp Ack : %x \n",Adapter->bPHSEnabled); |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 606 | if((FALSE == Adapter->bShutStatus)&& |
| 607 | (FALSE == Adapter->IdleMode)) |
| 608 | { |
| 609 | if(Adapter->LEDInfo.led_thread_running & BCM_LED_THREAD_RUNNING_ACTIVELY) |
| 610 | { |
| 611 | Adapter->DriverState = NORMAL_OPERATION; |
| 612 | wake_up(&Adapter->LEDInfo.notify_led_event); |
| 613 | } |
| 614 | } |
| 615 | LinkMessage(Adapter); |
| 616 | break; |
| 617 | case WAIT_FOR_SYNC: |
| 618 | |
| 619 | /* |
| 620 | * Driver to ignore the DREG_RECEIVED |
| 621 | * WiMAX Application should handle this Message |
| 622 | */ |
| 623 | //Adapter->liTimeSinceLastNetEntry = 0; |
| 624 | Adapter->LinkUpStatus = 0; |
| 625 | Adapter->LinkStatus = 0; |
| 626 | Adapter->usBestEffortQueueIndex=INVALID_QUEUE_INDEX ; |
| 627 | Adapter->bTriedToWakeUpFromlowPowerMode = FALSE; |
| 628 | Adapter->IdleMode = FALSE; |
| 629 | beceem_protocol_reset(Adapter); |
| 630 | |
| 631 | break; |
| 632 | case LINK_SHUTDOWN_REQ_FROM_FIRMWARE: |
| 633 | case COMPLETE_WAKE_UP_NOTIFICATION_FRM_FW: |
| 634 | { |
| 635 | HandleShutDownModeRequest(Adapter, pucBuffer); |
| 636 | } |
| 637 | break; |
| 638 | default: |
| 639 | BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "default case:LinkResponse %x",*(pucBuffer+1)); |
| 640 | break; |
| 641 | } |
| 642 | } |
| 643 | else if(SET_MAC_ADDRESS_RESPONSE==*pucBuffer) |
| 644 | { |
| 645 | PUCHAR puMacAddr = (pucBuffer + 1); |
| 646 | Adapter->LinkStatus=SYNC_UP_REQUEST; |
| 647 | BCM_DEBUG_PRINT(Adapter,DBG_TYPE_RX, RX_DPC, DBG_LVL_ALL, "MAC address response, sending SYNC_UP"); |
| 648 | LinkMessage(Adapter); |
| 649 | memcpy(Adapter->dev->dev_addr, puMacAddr, MAC_ADDRESS_SIZE); |
| 650 | } |
| 651 | BCM_DEBUG_PRINT(Adapter,DBG_TYPE_RX, RX_DPC, DBG_LVL_ALL, "%s <=====",__FUNCTION__); |
| 652 | return; |
| 653 | } |
| 654 | |
| 655 | void SendIdleModeResponse(PMINI_ADAPTER Adapter) |
| 656 | { |
| 657 | INT status = 0, NVMAccess = 0,lowPwrAbortMsg = 0; |
| 658 | struct timeval tv; |
| 659 | CONTROL_MESSAGE stIdleResponse = {{0}}; |
| 660 | memset(&tv, 0, sizeof(tv)); |
| 661 | stIdleResponse.Leader.Status = IDLE_MESSAGE; |
| 662 | stIdleResponse.Leader.PLength = IDLE_MODE_PAYLOAD_LENGTH; |
| 663 | stIdleResponse.szData[0] = GO_TO_IDLE_MODE_PAYLOAD; |
| 664 | BCM_DEBUG_PRINT(Adapter,DBG_TYPE_RX, RX_DPC, DBG_LVL_ALL," ============>"); |
| 665 | |
| 666 | /********************************* |
| 667 | **down_trylock - |
| 668 | ** if [ semaphore is available ] |
| 669 | ** acquire semaphone and return value 0 ; |
| 670 | ** else |
| 671 | ** return non-zero value ; |
| 672 | ** |
| 673 | ***********************************/ |
| 674 | |
| 675 | NVMAccess = down_trylock(&Adapter->NVMRdmWrmLock); |
| 676 | |
| 677 | lowPwrAbortMsg= down_trylock(&Adapter->LowPowerModeSync); |
| 678 | |
| 679 | |
| 680 | if((NVMAccess || lowPwrAbortMsg || atomic_read(&Adapter->TotalPacketCount)) && |
| 681 | (Adapter->ulPowerSaveMode != DEVICE_POWERSAVE_MODE_AS_PROTOCOL_IDLE_MODE) ) |
| 682 | { |
| 683 | if(!NVMAccess) |
| 684 | up(&Adapter->NVMRdmWrmLock); |
| 685 | |
| 686 | if(!lowPwrAbortMsg) |
| 687 | up(&Adapter->LowPowerModeSync); |
| 688 | |
| 689 | stIdleResponse.szData[1] = TARGET_CAN_NOT_GO_TO_IDLE_MODE;//NACK- device access is going on. |
| 690 | BCM_DEBUG_PRINT(Adapter,DBG_TYPE_RX, RX_DPC, DBG_LVL_ALL, "HOST IS NACKING Idle mode To F/W!!!!!!!!"); |
| 691 | Adapter->bPreparingForLowPowerMode = FALSE; |
| 692 | } |
| 693 | else |
| 694 | { |
| 695 | stIdleResponse.szData[1] = TARGET_CAN_GO_TO_IDLE_MODE; //2;//Idle ACK |
| 696 | Adapter->StatisticsPointer = 0; |
| 697 | |
| 698 | /* Wait for the LED to TURN OFF before sending ACK response */ |
| 699 | if(Adapter->LEDInfo.led_thread_running & BCM_LED_THREAD_RUNNING_ACTIVELY) |
| 700 | { |
| 701 | INT iRetVal = 0; |
| 702 | |
| 703 | /* Wake the LED Thread with IDLEMODE_ENTER State */ |
| 704 | Adapter->DriverState = LOWPOWER_MODE_ENTER; |
Joe Perches | 859171c | 2010-11-14 19:04:48 -0800 | [diff] [blame] | 705 | BCM_DEBUG_PRINT(Adapter,DBG_TYPE_RX, RX_DPC, DBG_LVL_ALL,"LED Thread is Running..Hence Setting LED Event as IDLEMODE_ENTER jiffies:%ld",jiffies); |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 706 | wake_up(&Adapter->LEDInfo.notify_led_event); |
| 707 | |
| 708 | /* Wait for 1 SEC for LED to OFF */ |
| 709 | iRetVal = wait_event_timeout(Adapter->LEDInfo.idleModeSyncEvent, \ |
| 710 | Adapter->LEDInfo.bIdle_led_off, msecs_to_jiffies(1000)); |
| 711 | |
| 712 | |
| 713 | /* If Timed Out to Sync IDLE MODE Enter, do IDLE mode Exit and Send NACK to device */ |
| 714 | if(iRetVal <= 0) |
| 715 | { |
| 716 | stIdleResponse.szData[1] = TARGET_CAN_NOT_GO_TO_IDLE_MODE;//NACK- device access is going on. |
| 717 | Adapter->DriverState = NORMAL_OPERATION; |
| 718 | wake_up(&Adapter->LEDInfo.notify_led_event); |
| 719 | BCM_DEBUG_PRINT(Adapter,DBG_TYPE_RX, RX_DPC, DBG_LVL_ALL, "NACKING Idle mode as time out happen from LED side!!!!!!!!"); |
| 720 | } |
| 721 | } |
| 722 | if(stIdleResponse.szData[1] == TARGET_CAN_GO_TO_IDLE_MODE) |
| 723 | { |
| 724 | BCM_DEBUG_PRINT(Adapter,DBG_TYPE_RX, RX_DPC, DBG_LVL_ALL,"ACKING IDLE MODE !!!!!!!!!"); |
| 725 | down(&Adapter->rdmwrmsync); |
| 726 | Adapter->bPreparingForLowPowerMode = TRUE; |
| 727 | up(&Adapter->rdmwrmsync); |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 728 | //Killing all URBS. |
| 729 | if(Adapter->bDoSuspend == TRUE) |
| 730 | Bcm_kill_all_URBs((PS_INTERFACE_ADAPTER)(Adapter->pvInterfaceAdapter)); |
| 731 | |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 732 | } |
| 733 | else |
| 734 | { |
| 735 | Adapter->bPreparingForLowPowerMode = FALSE; |
| 736 | } |
| 737 | |
| 738 | if(!NVMAccess) |
| 739 | up(&Adapter->NVMRdmWrmLock); |
| 740 | |
| 741 | if(!lowPwrAbortMsg) |
| 742 | up(&Adapter->LowPowerModeSync); |
| 743 | |
| 744 | } |
| 745 | status = CopyBufferToControlPacket(Adapter,&stIdleResponse); |
| 746 | if((status != STATUS_SUCCESS)) |
| 747 | { |
| 748 | BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0,"fail to send the Idle mode Request \n"); |
| 749 | Adapter->bPreparingForLowPowerMode = FALSE; |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 750 | StartInterruptUrb((PS_INTERFACE_ADAPTER)(Adapter->pvInterfaceAdapter)); |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 751 | } |
| 752 | do_gettimeofday(&tv); |
| 753 | BCM_DEBUG_PRINT(Adapter,DBG_TYPE_RX, RX_DPC, DBG_LVL_ALL, "IdleMode Msg submitter to Q :%ld ms", tv.tv_sec *1000 + tv.tv_usec /1000); |
| 754 | |
| 755 | } |
| 756 | |
| 757 | /****************************************************************** |
| 758 | * Function - DumpPackInfo() |
| 759 | * |
| 760 | * Description - This function dumps the all Queue(PackInfo[]) details. |
| 761 | * |
| 762 | * Parameters - Adapter: Pointer to the Adapter structure. |
| 763 | * |
| 764 | * Returns - None. |
| 765 | *******************************************************************/ |
| 766 | VOID DumpPackInfo(PMINI_ADAPTER Adapter) |
| 767 | { |
| 768 | |
| 769 | UINT uiLoopIndex = 0; |
| 770 | UINT uiIndex = 0; |
| 771 | UINT uiClsfrIndex = 0; |
| 772 | S_CLASSIFIER_RULE *pstClassifierEntry = NULL; |
| 773 | |
| 774 | for(uiLoopIndex=0;uiLoopIndex<NO_OF_QUEUES;uiLoopIndex++) |
| 775 | { |
| 776 | BCM_DEBUG_PRINT (Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL,"*********** Showing Details Of Queue %d***** ******",uiLoopIndex); |
| 777 | if(FALSE == Adapter->PackInfo[uiLoopIndex].bValid) |
| 778 | { |
| 779 | BCM_DEBUG_PRINT (Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL,"bValid is FALSE for %X index\n",uiLoopIndex); |
| 780 | continue; |
| 781 | } |
| 782 | |
| 783 | BCM_DEBUG_PRINT (Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL," Dumping SF Rule Entry For SFID %lX \n",Adapter->PackInfo[uiLoopIndex].ulSFID); |
| 784 | BCM_DEBUG_PRINT (Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL," ucDirection %X \n",Adapter->PackInfo[uiLoopIndex].ucDirection); |
| 785 | if(Adapter->PackInfo[uiLoopIndex].ucIpVersion == IPV6) |
| 786 | { |
| 787 | BCM_DEBUG_PRINT (Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL,"Ipv6 Service Flow \n"); |
| 788 | } |
| 789 | else |
| 790 | { |
| 791 | BCM_DEBUG_PRINT (Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL,"Ipv4 Service Flow \n"); |
| 792 | } |
| 793 | BCM_DEBUG_PRINT (Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL," SF Traffic Priority %X \n",Adapter->PackInfo[uiLoopIndex].u8TrafficPriority); |
| 794 | |
| 795 | for(uiClsfrIndex=0;uiClsfrIndex<MAX_CLASSIFIERS;uiClsfrIndex++) |
| 796 | { |
| 797 | pstClassifierEntry = &Adapter->astClassifierTable[uiClsfrIndex]; |
| 798 | if(!pstClassifierEntry->bUsed) |
| 799 | continue; |
| 800 | |
| 801 | if(pstClassifierEntry->ulSFID != Adapter->PackInfo[uiLoopIndex].ulSFID) |
| 802 | continue; |
| 803 | |
| 804 | BCM_DEBUG_PRINT (Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL,"\tDumping Classifier Rule Entry For Index: %X Classifier Rule ID : %X\n",uiClsfrIndex,pstClassifierEntry->uiClassifierRuleIndex); |
| 805 | BCM_DEBUG_PRINT (Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL,"\tDumping Classifier Rule Entry For Index: %X usVCID_Value : %X\n",uiClsfrIndex,pstClassifierEntry->usVCID_Value); |
| 806 | BCM_DEBUG_PRINT (Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL,"\tDumping Classifier Rule Entry For Index: %X bProtocolValid : %X\n",uiClsfrIndex,pstClassifierEntry->bProtocolValid); |
| 807 | BCM_DEBUG_PRINT (Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL,"\tDumping Classifier Rule Entry For Index: %X bTOSValid : %X\n",uiClsfrIndex,pstClassifierEntry->bTOSValid); |
| 808 | BCM_DEBUG_PRINT (Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL,"\tDumping Classifier Rule Entry For Index: %X bDestIpValid : %X\n",uiClsfrIndex,pstClassifierEntry->bDestIpValid); |
| 809 | BCM_DEBUG_PRINT (Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL,"\tDumping Classifier Rule Entry For Index: %X bSrcIpValid : %X\n",uiClsfrIndex,pstClassifierEntry->bSrcIpValid); |
| 810 | |
| 811 | |
| 812 | for(uiIndex=0;uiIndex<MAX_PORT_RANGE;uiIndex++) |
| 813 | { |
| 814 | BCM_DEBUG_PRINT (Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL,"\tusSrcPortRangeLo:%X\n",pstClassifierEntry->usSrcPortRangeLo[uiIndex]); |
| 815 | BCM_DEBUG_PRINT (Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL,"\tusSrcPortRangeHi:%X\n",pstClassifierEntry->usSrcPortRangeHi[uiIndex]); |
| 816 | BCM_DEBUG_PRINT (Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL,"\tusDestPortRangeLo:%X\n",pstClassifierEntry->usDestPortRangeLo[uiIndex]); |
| 817 | BCM_DEBUG_PRINT (Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL,"\tusDestPortRangeHi:%X\n",pstClassifierEntry->usDestPortRangeHi[uiIndex]); |
| 818 | } |
| 819 | |
| 820 | BCM_DEBUG_PRINT (Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL," \tucIPSourceAddressLength : 0x%x\n",pstClassifierEntry->ucIPSourceAddressLength); |
| 821 | BCM_DEBUG_PRINT (Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL,"\tucIPDestinationAddressLength : 0x%x\n",pstClassifierEntry->ucIPDestinationAddressLength); |
| 822 | for(uiIndex=0;uiIndex<pstClassifierEntry->ucIPSourceAddressLength;uiIndex++) |
| 823 | { |
| 824 | if(Adapter->PackInfo[uiLoopIndex].ucIpVersion == IPV6) |
| 825 | { |
| 826 | BCM_DEBUG_PRINT (Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL,"\tIpv6 ulSrcIpAddr :\n"); |
| 827 | DumpIpv6Address(pstClassifierEntry->stSrcIpAddress.ulIpv6Addr); |
| 828 | BCM_DEBUG_PRINT (Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL,"\tIpv6 ulSrcIpMask :\n"); |
| 829 | DumpIpv6Address(pstClassifierEntry->stSrcIpAddress.ulIpv6Mask); |
| 830 | } |
| 831 | else |
| 832 | { |
| 833 | BCM_DEBUG_PRINT (Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL,"\tulSrcIpAddr:%lX\n",pstClassifierEntry->stSrcIpAddress.ulIpv4Addr[uiIndex]); |
| 834 | BCM_DEBUG_PRINT (Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL,"\tulSrcIpMask:%lX\n",pstClassifierEntry->stSrcIpAddress.ulIpv4Mask[uiIndex]); |
| 835 | } |
| 836 | } |
| 837 | for(uiIndex=0;uiIndex<pstClassifierEntry->ucIPDestinationAddressLength;uiIndex++) |
| 838 | { |
| 839 | if(Adapter->PackInfo[uiLoopIndex].ucIpVersion == IPV6) |
| 840 | { |
| 841 | BCM_DEBUG_PRINT (Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL,"\tIpv6 ulDestIpAddr :\n"); |
| 842 | DumpIpv6Address(pstClassifierEntry->stDestIpAddress.ulIpv6Addr); |
| 843 | BCM_DEBUG_PRINT (Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL,"\tIpv6 ulDestIpMask :\n"); |
| 844 | DumpIpv6Address(pstClassifierEntry->stDestIpAddress.ulIpv6Mask); |
| 845 | |
| 846 | } |
| 847 | else |
| 848 | { |
| 849 | BCM_DEBUG_PRINT (Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL,"\tulDestIpAddr:%lX\n",pstClassifierEntry->stDestIpAddress.ulIpv4Addr[uiIndex]); |
| 850 | BCM_DEBUG_PRINT (Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL,"\tulDestIpMask:%lX\n",pstClassifierEntry->stDestIpAddress.ulIpv4Mask[uiIndex]); |
| 851 | } |
| 852 | } |
| 853 | BCM_DEBUG_PRINT (Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL,"\tucProtocol:0x%X\n",pstClassifierEntry->ucProtocol[0]); |
| 854 | BCM_DEBUG_PRINT (Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL,"\tu8ClassifierRulePriority:%X\n",pstClassifierEntry->u8ClassifierRulePriority); |
| 855 | |
| 856 | |
| 857 | } |
| 858 | BCM_DEBUG_PRINT (Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL,"ulSFID:%lX\n",Adapter->PackInfo[uiLoopIndex].ulSFID); |
| 859 | BCM_DEBUG_PRINT (Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL,"usVCID_Value:%X\n",Adapter->PackInfo[uiLoopIndex].usVCID_Value); |
| 860 | BCM_DEBUG_PRINT (Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL,"PhsEnabled: 0x%X\n",Adapter->PackInfo[uiLoopIndex].bHeaderSuppressionEnabled); |
| 861 | BCM_DEBUG_PRINT (Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL,"uiThreshold:%X\n",Adapter->PackInfo[uiLoopIndex].uiThreshold); |
| 862 | |
| 863 | |
| 864 | BCM_DEBUG_PRINT (Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL,"bValid:%X\n",Adapter->PackInfo[uiLoopIndex].bValid); |
| 865 | BCM_DEBUG_PRINT (Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL,"bActive:%X\n",Adapter->PackInfo[uiLoopIndex].bActive); |
| 866 | BCM_DEBUG_PRINT (Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL,"ActivateReqSent: %x", Adapter->PackInfo[uiLoopIndex].bActivateRequestSent); |
| 867 | BCM_DEBUG_PRINT (Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL,"u8QueueType:%X\n",Adapter->PackInfo[uiLoopIndex].u8QueueType); |
| 868 | BCM_DEBUG_PRINT (Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL,"uiMaxBucketSize:%X\n",Adapter->PackInfo[uiLoopIndex].uiMaxBucketSize); |
| 869 | BCM_DEBUG_PRINT (Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL,"uiPerSFTxResourceCount:%X\n",atomic_read(&Adapter->PackInfo[uiLoopIndex].uiPerSFTxResourceCount)); |
| 870 | //DumpDebug(DUMP_INFO,(" bCSSupport:%X\n",Adapter->PackInfo[uiLoopIndex].bCSSupport)); |
| 871 | BCM_DEBUG_PRINT (Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL,"CurrQueueDepthOnTarget: %x\n", Adapter->PackInfo[uiLoopIndex].uiCurrentQueueDepthOnTarget); |
| 872 | BCM_DEBUG_PRINT (Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL,"uiCurrentBytesOnHost:%X\n",Adapter->PackInfo[uiLoopIndex].uiCurrentBytesOnHost); |
| 873 | BCM_DEBUG_PRINT (Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL,"uiCurrentPacketsOnHost:%X\n",Adapter->PackInfo[uiLoopIndex].uiCurrentPacketsOnHost); |
| 874 | BCM_DEBUG_PRINT (Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL,"uiDroppedCountBytes:%X\n",Adapter->PackInfo[uiLoopIndex].uiDroppedCountBytes); |
| 875 | BCM_DEBUG_PRINT (Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL,"uiDroppedCountPackets:%X\n",Adapter->PackInfo[uiLoopIndex].uiDroppedCountPackets); |
| 876 | BCM_DEBUG_PRINT (Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL,"uiSentBytes:%X\n",Adapter->PackInfo[uiLoopIndex].uiSentBytes); |
| 877 | BCM_DEBUG_PRINT (Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL,"uiSentPackets:%X\n",Adapter->PackInfo[uiLoopIndex].uiSentPackets); |
| 878 | BCM_DEBUG_PRINT (Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL,"uiCurrentDrainRate:%X\n",Adapter->PackInfo[uiLoopIndex].uiCurrentDrainRate); |
| 879 | BCM_DEBUG_PRINT (Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL,"uiThisPeriodSentBytes:%X\n",Adapter->PackInfo[uiLoopIndex].uiThisPeriodSentBytes); |
| 880 | BCM_DEBUG_PRINT (Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL,"liDrainCalculated:%llX\n",Adapter->PackInfo[uiLoopIndex].liDrainCalculated); |
| 881 | BCM_DEBUG_PRINT (Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL,"uiCurrentTokenCount:%X\n",Adapter->PackInfo[uiLoopIndex].uiCurrentTokenCount); |
| 882 | BCM_DEBUG_PRINT (Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL,"liLastUpdateTokenAt:%llX\n",Adapter->PackInfo[uiLoopIndex].liLastUpdateTokenAt); |
| 883 | BCM_DEBUG_PRINT (Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL,"uiMaxAllowedRate:%X\n",Adapter->PackInfo[uiLoopIndex].uiMaxAllowedRate); |
| 884 | BCM_DEBUG_PRINT (Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL,"uiPendedLast:%X\n",Adapter->PackInfo[uiLoopIndex].uiPendedLast); |
| 885 | BCM_DEBUG_PRINT (Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL,"NumOfPacketsSent:%X\n",Adapter->PackInfo[uiLoopIndex].NumOfPacketsSent); |
| 886 | BCM_DEBUG_PRINT (Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "Direction: %x\n", Adapter->PackInfo[uiLoopIndex].ucDirection); |
| 887 | BCM_DEBUG_PRINT (Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "CID: %x\n", Adapter->PackInfo[uiLoopIndex].usCID); |
| 888 | BCM_DEBUG_PRINT (Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "ProtocolValid: %x\n", Adapter->PackInfo[uiLoopIndex].bProtocolValid); |
| 889 | BCM_DEBUG_PRINT (Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "TOSValid: %x\n", Adapter->PackInfo[uiLoopIndex].bTOSValid); |
| 890 | BCM_DEBUG_PRINT (Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "DestIpValid: %x\n", Adapter->PackInfo[uiLoopIndex].bDestIpValid); |
| 891 | BCM_DEBUG_PRINT (Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "SrcIpValid: %x\n", Adapter->PackInfo[uiLoopIndex].bSrcIpValid); |
| 892 | BCM_DEBUG_PRINT (Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "ActiveSet: %x\n", Adapter->PackInfo[uiLoopIndex].bActiveSet); |
| 893 | BCM_DEBUG_PRINT (Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "AdmittedSet: %x\n", Adapter->PackInfo[uiLoopIndex].bAdmittedSet); |
| 894 | BCM_DEBUG_PRINT (Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "AuthzSet: %x\n", Adapter->PackInfo[uiLoopIndex].bAuthorizedSet); |
| 895 | BCM_DEBUG_PRINT (Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "ClassifyPrority: %x\n", Adapter->PackInfo[uiLoopIndex].bClassifierPriority); |
| 896 | BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "uiMaxLatency: %x\n",Adapter->PackInfo[uiLoopIndex].uiMaxLatency); |
| 897 | BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "ServiceClassName: %x %x %x %x\n",Adapter->PackInfo[uiLoopIndex].ucServiceClassName[0],Adapter->PackInfo[uiLoopIndex].ucServiceClassName[1],Adapter->PackInfo[uiLoopIndex].ucServiceClassName[2],Adapter->PackInfo[uiLoopIndex].ucServiceClassName[3]); |
| 898 | // BCM_DEBUG_PRINT (Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "bHeaderSuppressionEnabled :%X\n", Adapter->PackInfo[uiLoopIndex].bHeaderSuppressionEnabled); |
| 899 | // BCM_DEBUG_PRINT (Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "uiTotalTxBytes:%X\n", Adapter->PackInfo[uiLoopIndex].uiTotalTxBytes); |
| 900 | // BCM_DEBUG_PRINT (Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "uiTotalRxBytes:%X\n", Adapter->PackInfo[uiLoopIndex].uiTotalRxBytes); |
| 901 | // DumpDebug(DUMP_INFO,(" uiRanOutOfResCount:%X\n",Adapter->PackInfo[uiLoopIndex].uiRanOutOfResCount)); |
| 902 | } |
| 903 | |
| 904 | for(uiLoopIndex = 0 ; uiLoopIndex < MIBS_MAX_HIST_ENTRIES ; uiLoopIndex++) |
| 905 | BCM_DEBUG_PRINT (Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL,"Adapter->aRxPktSizeHist[%x] = %x\n",uiLoopIndex,Adapter->aRxPktSizeHist[uiLoopIndex]); |
| 906 | |
| 907 | for(uiLoopIndex = 0 ; uiLoopIndex < MIBS_MAX_HIST_ENTRIES ; uiLoopIndex++) |
| 908 | BCM_DEBUG_PRINT (Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL,"Adapter->aTxPktSizeHist[%x] = %x\n",uiLoopIndex,Adapter->aTxPktSizeHist[uiLoopIndex]); |
| 909 | |
| 910 | |
| 911 | |
| 912 | return; |
| 913 | |
| 914 | |
| 915 | } |
| 916 | |
Stephen Hemminger | 20f4865 | 2010-10-31 23:52:36 -0400 | [diff] [blame] | 917 | int reset_card_proc(PMINI_ADAPTER ps_adapter) |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 918 | { |
| 919 | int retval = STATUS_SUCCESS; |
| 920 | |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 921 | PMINI_ADAPTER Adapter = GET_BCM_ADAPTER(gblpnetdev); |
| 922 | PS_INTERFACE_ADAPTER psIntfAdapter = NULL; |
| 923 | unsigned int value = 0, uiResetValue = 0; |
| 924 | |
| 925 | psIntfAdapter = ((PS_INTERFACE_ADAPTER)(ps_adapter->pvInterfaceAdapter)) ; |
| 926 | |
| 927 | ps_adapter->bDDRInitDone = FALSE; |
| 928 | |
| 929 | if(ps_adapter->chip_id >= T3LPB) |
| 930 | { |
| 931 | //SYS_CFG register is write protected hence for modifying this reg value, it should be read twice before |
| 932 | rdmalt(ps_adapter,SYS_CFG, &value, sizeof(value)); |
| 933 | rdmalt(ps_adapter,SYS_CFG, &value, sizeof(value)); |
| 934 | |
| 935 | //making bit[6...5] same as was before f/w download. this setting force the h/w to |
| 936 | //re-populated the SP RAM area with the string descriptor . |
| 937 | value = value | (ps_adapter->syscfgBefFwDld & 0x00000060) ; |
| 938 | wrmalt(ps_adapter, SYS_CFG, &value, sizeof(value)); |
| 939 | } |
| 940 | |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 941 | //killing all submitted URBs. |
| 942 | psIntfAdapter->psAdapter->StopAllXaction = TRUE ; |
| 943 | Bcm_kill_all_URBs(psIntfAdapter); |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 944 | /* Reset the UMA-B Device */ |
| 945 | if(ps_adapter->chip_id >= T3LPB) |
| 946 | { |
| 947 | BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "Reseting UMA-B \n"); |
| 948 | retval = usb_reset_device(psIntfAdapter->udev); |
| 949 | |
| 950 | psIntfAdapter->psAdapter->StopAllXaction = FALSE ; |
| 951 | |
| 952 | if(retval != STATUS_SUCCESS) |
| 953 | { |
| 954 | BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "Reset failed with ret value :%d", retval); |
| 955 | goto err_exit; |
| 956 | } |
| 957 | if (ps_adapter->chip_id == BCS220_2 || |
| 958 | ps_adapter->chip_id == BCS220_2BC || |
| 959 | ps_adapter->chip_id == BCS250_BC || |
| 960 | ps_adapter->chip_id == BCS220_3) |
| 961 | { |
| 962 | retval = rdmalt(ps_adapter,HPM_CONFIG_LDO145, &value, sizeof(value)); |
| 963 | if( retval < 0) |
| 964 | { |
| 965 | BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0,"read failed with status :%d",retval); |
| 966 | goto err_exit; |
| 967 | } |
| 968 | //setting 0th bit |
| 969 | value |= (1<<0); |
| 970 | retval = wrmalt(ps_adapter, HPM_CONFIG_LDO145, &value, sizeof(value)); |
| 971 | if( retval < 0) |
| 972 | { |
| 973 | BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0,"write failed with status :%d",retval); |
| 974 | goto err_exit; |
| 975 | } |
| 976 | } |
| 977 | |
| 978 | } |
| 979 | else |
| 980 | { |
| 981 | retval = rdmalt(ps_adapter,0x0f007018, &value, sizeof(value)); |
| 982 | if( retval < 0) { |
| 983 | BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0,"read failed with status :%d",retval); |
| 984 | goto err_exit; |
| 985 | } |
| 986 | value&=(~(1<<16)); |
| 987 | retval= wrmalt(ps_adapter, 0x0f007018, &value, sizeof(value)) ; |
| 988 | if( retval < 0) { |
| 989 | BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0,"write failed with status :%d",retval); |
| 990 | goto err_exit; |
| 991 | } |
| 992 | |
| 993 | // Toggling the GPIO 8, 9 |
| 994 | value = 0; |
| 995 | retval = wrmalt(ps_adapter, GPIO_OUTPUT_REGISTER, &value, sizeof(value)); |
| 996 | if(retval < 0) { |
| 997 | BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0,"write failed with status :%d",retval); |
| 998 | goto err_exit; |
| 999 | } |
| 1000 | value = 0x300; |
| 1001 | retval = wrmalt(ps_adapter, GPIO_MODE_REGISTER, &value, sizeof(value)) ; |
| 1002 | if(retval < 0) { |
| 1003 | BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0,"write failed with status :%d",retval); |
| 1004 | goto err_exit; |
| 1005 | } |
| 1006 | mdelay(50); |
| 1007 | } |
| 1008 | |
| 1009 | //ps_adapter->downloadDDR = false; |
| 1010 | |
| 1011 | if(ps_adapter->bFlashBoot) |
| 1012 | { |
| 1013 | //In flash boot mode MIPS state register has reverse polarity. |
| 1014 | // So just or with setting bit 30. |
| 1015 | //Make the MIPS in Reset state. |
| 1016 | rdmalt(ps_adapter, CLOCK_RESET_CNTRL_REG_1, &uiResetValue, sizeof(uiResetValue)); |
| 1017 | |
| 1018 | uiResetValue |=(1<<30); |
| 1019 | wrmalt(ps_adapter, CLOCK_RESET_CNTRL_REG_1, &uiResetValue, sizeof(uiResetValue)); |
| 1020 | } |
| 1021 | |
| 1022 | if(ps_adapter->chip_id >= T3LPB) |
| 1023 | { |
| 1024 | uiResetValue = 0; |
| 1025 | // |
| 1026 | // WA for SYSConfig Issue. |
| 1027 | // Read SYSCFG Twice to make it writable. |
| 1028 | // |
| 1029 | rdmalt(ps_adapter, SYS_CFG, &uiResetValue, sizeof(uiResetValue)); |
| 1030 | if(uiResetValue & (1<<4)) |
| 1031 | { |
| 1032 | uiResetValue = 0; |
| 1033 | rdmalt(ps_adapter, SYS_CFG, &uiResetValue, sizeof(uiResetValue));//2nd read to make it writable. |
| 1034 | uiResetValue &= (~(1<<4)); |
| 1035 | wrmalt(ps_adapter,SYS_CFG, &uiResetValue, sizeof(uiResetValue)); |
| 1036 | } |
| 1037 | |
| 1038 | } |
| 1039 | uiResetValue = 0; |
| 1040 | wrmalt(ps_adapter, 0x0f01186c, &uiResetValue, sizeof(uiResetValue)); |
| 1041 | |
| 1042 | err_exit : |
| 1043 | psIntfAdapter->psAdapter->StopAllXaction = FALSE ; |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 1044 | return retval; |
| 1045 | } |
| 1046 | |
Stephen Hemminger | 20f4865 | 2010-10-31 23:52:36 -0400 | [diff] [blame] | 1047 | int run_card_proc(PMINI_ADAPTER ps_adapter ) |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 1048 | { |
| 1049 | unsigned int value=0; |
| 1050 | { |
| 1051 | |
| 1052 | if(rdmalt(ps_adapter, CLOCK_RESET_CNTRL_REG_1, &value, sizeof(value)) < 0) { |
| 1053 | BCM_DEBUG_PRINT(ps_adapter,DBG_TYPE_INITEXIT, MP_INIT, DBG_LVL_ALL,"%s:%d\n", __FUNCTION__, __LINE__); |
| 1054 | return STATUS_FAILURE; |
| 1055 | } |
| 1056 | |
| 1057 | if(ps_adapter->bFlashBoot) |
| 1058 | { |
| 1059 | |
| 1060 | value&=(~(1<<30)); |
| 1061 | } |
| 1062 | else |
| 1063 | { |
| 1064 | value |=(1<<30); |
| 1065 | } |
| 1066 | |
| 1067 | if(wrmalt(ps_adapter, CLOCK_RESET_CNTRL_REG_1, &value, sizeof(value)) < 0) { |
| 1068 | BCM_DEBUG_PRINT(ps_adapter,DBG_TYPE_INITEXIT, MP_INIT, DBG_LVL_ALL,"%s:%d\n", __FUNCTION__, __LINE__); |
| 1069 | return STATUS_FAILURE; |
| 1070 | } |
| 1071 | } |
| 1072 | return STATUS_SUCCESS; |
| 1073 | } |
| 1074 | |
| 1075 | int InitCardAndDownloadFirmware(PMINI_ADAPTER ps_adapter) |
| 1076 | { |
| 1077 | |
Dan Carpenter | 2e31613 | 2010-11-13 11:24:22 +0300 | [diff] [blame] | 1078 | int status; |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 1079 | UINT value = 0; |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 1080 | /* |
| 1081 | * Create the threads first and then download the |
| 1082 | * Firm/DDR Settings.. |
| 1083 | */ |
| 1084 | |
Stephen Hemminger | 2d08748 | 2010-11-01 12:14:01 -0400 | [diff] [blame] | 1085 | status = create_worker_threads(ps_adapter); |
| 1086 | if (status<0) |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 1087 | return status; |
Stephen Hemminger | 2d08748 | 2010-11-01 12:14:01 -0400 | [diff] [blame] | 1088 | |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 1089 | /* |
| 1090 | * For Downloading the Firm, parse the cfg file first. |
| 1091 | */ |
| 1092 | status = bcm_parse_target_params (ps_adapter); |
| 1093 | if(status){ |
| 1094 | return status; |
| 1095 | } |
| 1096 | |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 1097 | if(ps_adapter->chip_id >= T3LPB) |
| 1098 | { |
| 1099 | rdmalt(ps_adapter, SYS_CFG, &value, sizeof (value)); |
| 1100 | ps_adapter->syscfgBefFwDld = value ; |
| 1101 | if((value & 0x60)== 0) |
| 1102 | { |
| 1103 | ps_adapter->bFlashBoot = TRUE; |
| 1104 | } |
| 1105 | } |
| 1106 | |
| 1107 | reset_card_proc(ps_adapter); |
| 1108 | |
| 1109 | //Initializing the NVM. |
| 1110 | BcmInitNVM(ps_adapter); |
| 1111 | status = ddr_init(ps_adapter); |
| 1112 | if(status) |
| 1113 | { |
Stephen Hemminger | 2d08748 | 2010-11-01 12:14:01 -0400 | [diff] [blame] | 1114 | pr_err(DRV_NAME "ddr_init Failed\n"); |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 1115 | return status; |
| 1116 | } |
| 1117 | |
| 1118 | /* Download cfg file */ |
| 1119 | status = buffDnldVerify(ps_adapter, |
| 1120 | (PUCHAR)ps_adapter->pstargetparams, |
| 1121 | sizeof(STARGETPARAMS), |
| 1122 | CONFIG_BEGIN_ADDR); |
| 1123 | if(status) |
| 1124 | { |
| 1125 | BCM_DEBUG_PRINT(ps_adapter,DBG_TYPE_INITEXIT, MP_INIT, DBG_LVL_ALL, "Error downloading CFG file"); |
| 1126 | goto OUT; |
| 1127 | } |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 1128 | |
| 1129 | if(register_networkdev(ps_adapter)) |
| 1130 | { |
| 1131 | BCM_DEBUG_PRINT(ps_adapter,DBG_TYPE_INITEXIT, MP_INIT, DBG_LVL_ALL, "Register Netdevice failed. Cleanup needs to be performed."); |
| 1132 | return -EIO; |
| 1133 | } |
| 1134 | |
| 1135 | if(FALSE == ps_adapter->AutoFirmDld) |
| 1136 | { |
| 1137 | BCM_DEBUG_PRINT(ps_adapter,DBG_TYPE_INITEXIT, MP_INIT, DBG_LVL_ALL, "AutoFirmDld Disabled in CFG File..\n"); |
| 1138 | //If Auto f/w download is disable, register the control interface, |
| 1139 | //register the control interface after the mailbox. |
| 1140 | if(register_control_device_interface(ps_adapter) < 0) |
| 1141 | { |
| 1142 | BCM_DEBUG_PRINT(ps_adapter,DBG_TYPE_INITEXIT, MP_INIT, DBG_LVL_ALL, "Register Control Device failed. Cleanup needs to be performed."); |
| 1143 | return -EIO; |
| 1144 | } |
| 1145 | |
| 1146 | return STATUS_SUCCESS; |
| 1147 | } |
| 1148 | |
| 1149 | /* |
| 1150 | * Do the LED Settings here. It will be used by the Firmware Download |
| 1151 | * Thread. |
| 1152 | */ |
| 1153 | |
| 1154 | /* |
| 1155 | * 1. If the LED Settings fails, do not stop and do the Firmware download. |
Lucas De Marchi | 25985ed | 2011-03-30 22:57:33 -0300 | [diff] [blame] | 1156 | * 2. This init would happened only if the cfg file is present, else |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 1157 | * call from the ioctl context. |
| 1158 | */ |
| 1159 | |
| 1160 | status = InitLedSettings (ps_adapter); |
| 1161 | |
| 1162 | if(status) |
| 1163 | { |
| 1164 | BCM_DEBUG_PRINT(ps_adapter,DBG_TYPE_PRINTK, 0, 0,"INIT LED FAILED\n"); |
| 1165 | return status; |
| 1166 | } |
| 1167 | if(ps_adapter->LEDInfo.led_thread_running & BCM_LED_THREAD_RUNNING_ACTIVELY) |
| 1168 | { |
| 1169 | ps_adapter->DriverState = DRIVER_INIT; |
| 1170 | wake_up(&ps_adapter->LEDInfo.notify_led_event); |
| 1171 | } |
| 1172 | |
| 1173 | if(ps_adapter->LEDInfo.led_thread_running & BCM_LED_THREAD_RUNNING_ACTIVELY) |
| 1174 | { |
| 1175 | ps_adapter->DriverState = FW_DOWNLOAD; |
| 1176 | wake_up(&ps_adapter->LEDInfo.notify_led_event); |
| 1177 | } |
| 1178 | |
| 1179 | value = 0; |
| 1180 | wrmalt(ps_adapter, EEPROM_CAL_DATA_INTERNAL_LOC - 4, &value, sizeof(value)); |
| 1181 | wrmalt(ps_adapter, EEPROM_CAL_DATA_INTERNAL_LOC - 8, &value, sizeof(value)); |
| 1182 | |
| 1183 | if(ps_adapter->eNVMType == NVM_FLASH) |
| 1184 | { |
| 1185 | status = PropagateCalParamsFromFlashToMemory(ps_adapter); |
| 1186 | if(status) |
| 1187 | { |
Lucas De Marchi | 25985ed | 2011-03-30 22:57:33 -0300 | [diff] [blame] | 1188 | BCM_DEBUG_PRINT(ps_adapter,DBG_TYPE_INITEXIT, MP_INIT, DBG_LVL_ALL," Propagation of Cal param failed .." ); |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 1189 | goto OUT; |
| 1190 | } |
| 1191 | } |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 1192 | |
| 1193 | /* Download Firmare */ |
| 1194 | if ((status = BcmFileDownload( ps_adapter, BIN_FILE, FIRMWARE_BEGIN_ADDR))) |
| 1195 | { |
| 1196 | BCM_DEBUG_PRINT(ps_adapter,DBG_TYPE_INITEXIT, MP_INIT, DBG_LVL_ALL, "No Firmware File is present... \n"); |
| 1197 | goto OUT; |
| 1198 | } |
| 1199 | |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 1200 | status = run_card_proc(ps_adapter); |
| 1201 | if(status) |
| 1202 | { |
| 1203 | BCM_DEBUG_PRINT (ps_adapter,DBG_TYPE_INITEXIT, MP_INIT, DBG_LVL_ALL, "run_card_proc Failed\n"); |
| 1204 | goto OUT; |
| 1205 | } |
| 1206 | |
| 1207 | |
| 1208 | ps_adapter->fw_download_done = TRUE; |
| 1209 | mdelay(10); |
| 1210 | |
| 1211 | OUT: |
| 1212 | if(ps_adapter->LEDInfo.led_thread_running & BCM_LED_THREAD_RUNNING_ACTIVELY) |
| 1213 | { |
| 1214 | ps_adapter->DriverState = FW_DOWNLOAD_DONE; |
| 1215 | wake_up(&ps_adapter->LEDInfo.notify_led_event); |
| 1216 | } |
| 1217 | |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 1218 | return status; |
| 1219 | } |
| 1220 | |
| 1221 | |
Stephen Hemminger | 9dd47ee | 2010-11-01 12:24:00 -0400 | [diff] [blame] | 1222 | static int bcm_parse_target_params(PMINI_ADAPTER Adapter) |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 1223 | { |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 1224 | struct file *flp=NULL; |
| 1225 | mm_segment_t oldfs={0}; |
Jesper Juhl | 3701bef | 2010-11-10 21:31:38 +0100 | [diff] [blame] | 1226 | char *buff; |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 1227 | int len = 0; |
| 1228 | loff_t pos = 0; |
| 1229 | |
Jesper Juhl | 3701bef | 2010-11-10 21:31:38 +0100 | [diff] [blame] | 1230 | buff=kmalloc(BUFFER_1K, GFP_KERNEL); |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 1231 | if(!buff) |
| 1232 | { |
| 1233 | return -ENOMEM; |
| 1234 | } |
| 1235 | if((Adapter->pstargetparams = |
| 1236 | kmalloc(sizeof(STARGETPARAMS), GFP_KERNEL)) == NULL) |
| 1237 | { |
Stephen Hemminger | 082e889 | 2010-11-01 09:35:21 -0400 | [diff] [blame] | 1238 | kfree(buff); |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 1239 | return -ENOMEM; |
| 1240 | } |
| 1241 | flp=open_firmware_file(Adapter, CFG_FILE); |
| 1242 | if(!flp) { |
| 1243 | BCM_DEBUG_PRINT(Adapter,DBG_TYPE_INITEXIT, MP_INIT, DBG_LVL_ALL, "NOT ABLE TO OPEN THE %s FILE \n", CFG_FILE); |
Stephen Hemminger | 082e889 | 2010-11-01 09:35:21 -0400 | [diff] [blame] | 1244 | kfree(buff); |
| 1245 | kfree(Adapter->pstargetparams); |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 1246 | Adapter->pstargetparams = NULL; |
| 1247 | return -ENOENT; |
| 1248 | } |
| 1249 | oldfs=get_fs(); set_fs(get_ds()); |
Arnd Bergmann | 44a17eff | 2010-09-30 10:24:12 +0200 | [diff] [blame] | 1250 | len=vfs_read(flp, (void __user __force *)buff, BUFFER_1K, &pos); |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 1251 | set_fs(oldfs); |
| 1252 | |
| 1253 | if(len != sizeof(STARGETPARAMS)) |
| 1254 | { |
| 1255 | BCM_DEBUG_PRINT(Adapter,DBG_TYPE_INITEXIT, MP_INIT, DBG_LVL_ALL,"Mismatch in Target Param Structure!\n"); |
Stephen Hemminger | 082e889 | 2010-11-01 09:35:21 -0400 | [diff] [blame] | 1256 | kfree(buff); |
| 1257 | kfree(Adapter->pstargetparams); |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 1258 | Adapter->pstargetparams = NULL; |
| 1259 | filp_close(flp, current->files); |
| 1260 | return -ENOENT; |
| 1261 | } |
| 1262 | filp_close(flp, current->files); |
| 1263 | |
| 1264 | /* Check for autolink in config params */ |
| 1265 | /* |
| 1266 | * Values in Adapter->pstargetparams are in network byte order |
| 1267 | */ |
| 1268 | memcpy(Adapter->pstargetparams, buff, sizeof(STARGETPARAMS)); |
Stephen Hemminger | 082e889 | 2010-11-01 09:35:21 -0400 | [diff] [blame] | 1269 | kfree (buff); |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 1270 | beceem_parse_target_struct(Adapter); |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 1271 | return STATUS_SUCCESS; |
| 1272 | } |
| 1273 | |
| 1274 | void beceem_parse_target_struct(PMINI_ADAPTER Adapter) |
| 1275 | { |
Joe Perches | 859171c | 2010-11-14 19:04:48 -0800 | [diff] [blame] | 1276 | UINT uiHostDrvrCfg6 =0, uiEEPROMFlag = 0; |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 1277 | |
| 1278 | if(ntohl(Adapter->pstargetparams->m_u32PhyParameter2) & AUTO_SYNC_DISABLE) |
| 1279 | { |
Stephen Hemminger | 2d08748 | 2010-11-01 12:14:01 -0400 | [diff] [blame] | 1280 | pr_info(DRV_NAME ": AutoSyncup is Disabled\n"); |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 1281 | Adapter->AutoSyncup = FALSE; |
| 1282 | } |
| 1283 | else |
| 1284 | { |
Stephen Hemminger | 2d08748 | 2010-11-01 12:14:01 -0400 | [diff] [blame] | 1285 | pr_info(DRV_NAME ": AutoSyncup is Enabled\n"); |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 1286 | Adapter->AutoSyncup = TRUE; |
| 1287 | } |
Stephen Hemminger | 2d08748 | 2010-11-01 12:14:01 -0400 | [diff] [blame] | 1288 | |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 1289 | if(ntohl(Adapter->pstargetparams->HostDrvrConfig6) & AUTO_LINKUP_ENABLE) |
| 1290 | { |
Stephen Hemminger | 2d08748 | 2010-11-01 12:14:01 -0400 | [diff] [blame] | 1291 | pr_info(DRV_NAME ": Enabling autolink up"); |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 1292 | Adapter->AutoLinkUp = TRUE; |
| 1293 | } |
| 1294 | else |
| 1295 | { |
Stephen Hemminger | 2d08748 | 2010-11-01 12:14:01 -0400 | [diff] [blame] | 1296 | pr_info(DRV_NAME ": Disabling autolink up"); |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 1297 | Adapter->AutoLinkUp = FALSE; |
| 1298 | } |
| 1299 | // Setting the DDR Setting.. |
| 1300 | Adapter->DDRSetting = |
| 1301 | (ntohl(Adapter->pstargetparams->HostDrvrConfig6) >>8)&0x0F; |
| 1302 | Adapter->ulPowerSaveMode = |
| 1303 | (ntohl(Adapter->pstargetparams->HostDrvrConfig6)>>12)&0x0F; |
| 1304 | |
Stephen Hemminger | 2d08748 | 2010-11-01 12:14:01 -0400 | [diff] [blame] | 1305 | pr_info(DRV_NAME ": DDR Setting: %x\n", Adapter->DDRSetting); |
| 1306 | pr_info(DRV_NAME ": Power Save Mode: %lx\n", Adapter->ulPowerSaveMode); |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 1307 | if(ntohl(Adapter->pstargetparams->HostDrvrConfig6) & AUTO_FIRM_DOWNLOAD) |
| 1308 | { |
Stephen Hemminger | 2d08748 | 2010-11-01 12:14:01 -0400 | [diff] [blame] | 1309 | pr_info(DRV_NAME ": Enabling Auto Firmware Download\n"); |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 1310 | Adapter->AutoFirmDld = TRUE; |
| 1311 | } |
| 1312 | else |
| 1313 | { |
Stephen Hemminger | 2d08748 | 2010-11-01 12:14:01 -0400 | [diff] [blame] | 1314 | pr_info(DRV_NAME ": Disabling Auto Firmware Download\n"); |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 1315 | Adapter->AutoFirmDld = FALSE; |
| 1316 | } |
| 1317 | uiHostDrvrCfg6 = ntohl(Adapter->pstargetparams->HostDrvrConfig6); |
| 1318 | Adapter->bMipsConfig = (uiHostDrvrCfg6>>20)&0x01; |
Stephen Hemminger | 2d08748 | 2010-11-01 12:14:01 -0400 | [diff] [blame] | 1319 | pr_info(DRV_NAME ": MIPSConfig : 0x%X\n",Adapter->bMipsConfig); |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 1320 | //used for backward compatibility. |
| 1321 | Adapter->bDPLLConfig = (uiHostDrvrCfg6>>19)&0x01; |
| 1322 | |
| 1323 | Adapter->PmuMode= (uiHostDrvrCfg6 >> 24 ) & 0x03; |
Stephen Hemminger | 2d08748 | 2010-11-01 12:14:01 -0400 | [diff] [blame] | 1324 | pr_info(DRV_NAME ": PMU MODE: %x", Adapter->PmuMode); |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 1325 | |
| 1326 | if((uiHostDrvrCfg6 >> HOST_BUS_SUSPEND_BIT ) & (0x01)) |
| 1327 | { |
| 1328 | Adapter->bDoSuspend = TRUE; |
Stephen Hemminger | 2d08748 | 2010-11-01 12:14:01 -0400 | [diff] [blame] | 1329 | pr_info(DRV_NAME ": Making DoSuspend TRUE as per configFile"); |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 1330 | } |
| 1331 | |
| 1332 | uiEEPROMFlag = ntohl(Adapter->pstargetparams->m_u32EEPROMFlag); |
Stephen Hemminger | 2d08748 | 2010-11-01 12:14:01 -0400 | [diff] [blame] | 1333 | pr_info(DRV_NAME ": uiEEPROMFlag : 0x%X\n",uiEEPROMFlag); |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 1334 | Adapter->eNVMType = (NVM_TYPE)((uiEEPROMFlag>>4)&0x3); |
| 1335 | |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 1336 | Adapter->bStatusWrite = (uiEEPROMFlag>>6)&0x1; |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 1337 | |
| 1338 | Adapter->uiSectorSizeInCFG = 1024*(0xFFFF & ntohl(Adapter->pstargetparams->HostDrvrConfig4)); |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 1339 | |
| 1340 | Adapter->bSectorSizeOverride =(bool) ((ntohl(Adapter->pstargetparams->HostDrvrConfig4))>>16)&0x1; |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 1341 | |
| 1342 | if(ntohl(Adapter->pstargetparams->m_u32PowerSavingModeOptions) &0x01) |
| 1343 | Adapter->ulPowerSaveMode = DEVICE_POWERSAVE_MODE_AS_PROTOCOL_IDLE_MODE; |
Stephen Hemminger | 2d08748 | 2010-11-01 12:14:01 -0400 | [diff] [blame] | 1344 | |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 1345 | if(Adapter->ulPowerSaveMode != DEVICE_POWERSAVE_MODE_AS_PROTOCOL_IDLE_MODE) |
| 1346 | doPowerAutoCorrection(Adapter); |
| 1347 | |
| 1348 | } |
| 1349 | |
Stephen Hemminger | 9dd47ee | 2010-11-01 12:24:00 -0400 | [diff] [blame] | 1350 | static VOID doPowerAutoCorrection(PMINI_ADAPTER psAdapter) |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 1351 | { |
Stephen Hemminger | 2d08748 | 2010-11-01 12:14:01 -0400 | [diff] [blame] | 1352 | UINT reporting_mode; |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 1353 | |
| 1354 | reporting_mode = ntohl(psAdapter->pstargetparams->m_u32PowerSavingModeOptions) &0x02 ; |
| 1355 | psAdapter->bIsAutoCorrectEnabled = !((char)(psAdapter->ulPowerSaveMode >> 3) & 0x1); |
| 1356 | |
| 1357 | if(reporting_mode == TRUE) |
| 1358 | { |
| 1359 | BCM_DEBUG_PRINT(psAdapter,DBG_TYPE_INITEXIT, MP_INIT, DBG_LVL_ALL,"can't do suspen/resume as reporting mode is enable"); |
| 1360 | psAdapter->bDoSuspend = FALSE; |
| 1361 | } |
| 1362 | |
| 1363 | if (psAdapter->bIsAutoCorrectEnabled && (psAdapter->chip_id >= T3LPB)) |
| 1364 | { |
| 1365 | //If reporting mode is enable, switch PMU to PMC |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 1366 | { |
| 1367 | psAdapter->ulPowerSaveMode = DEVICE_POWERSAVE_MODE_AS_PMU_CLOCK_GATING; |
| 1368 | psAdapter->bDoSuspend =FALSE; |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 1369 | |
| 1370 | } |
| 1371 | |
| 1372 | //clearing space bit[15..12] |
| 1373 | psAdapter->pstargetparams->HostDrvrConfig6 &= ~(htonl((0xF << 12))); |
| 1374 | //placing the power save mode option |
| 1375 | psAdapter->pstargetparams->HostDrvrConfig6 |= htonl((psAdapter->ulPowerSaveMode << 12)); |
| 1376 | |
| 1377 | } |
| 1378 | else if (psAdapter->bIsAutoCorrectEnabled == FALSE) |
| 1379 | { |
| 1380 | |
| 1381 | // remove the autocorrect disable bit set before dumping. |
| 1382 | psAdapter->ulPowerSaveMode &= ~(1 << 3); |
| 1383 | psAdapter->pstargetparams->HostDrvrConfig6 &= ~(htonl(1 << 15)); |
| 1384 | BCM_DEBUG_PRINT(psAdapter,DBG_TYPE_INITEXIT, MP_INIT, DBG_LVL_ALL,"Using Forced User Choice: %lx\n", psAdapter->ulPowerSaveMode); |
| 1385 | } |
| 1386 | } |
Arnd Bergmann | 44a17eff | 2010-09-30 10:24:12 +0200 | [diff] [blame] | 1387 | |
| 1388 | #if 0 |
| 1389 | static unsigned char *ReadMacAddrEEPROM(PMINI_ADAPTER Adapter, ulong dwAddress) |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 1390 | { |
Jesper Juhl | 3701bef | 2010-11-10 21:31:38 +0100 | [diff] [blame] | 1391 | int status = 0, i = 0; |
| 1392 | unsigned int temp = 0; |
| 1393 | unsigned char *pucmacaddr = kmalloc(MAC_ADDRESS_SIZE, GFP_KERNEL); |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 1394 | |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 1395 | if(!pucmacaddr) |
| 1396 | { |
| 1397 | BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "No Buffers to Read the EEPROM Address\n"); |
| 1398 | return NULL; |
| 1399 | } |
| 1400 | |
| 1401 | dwAddress |= 0x5b000000; |
| 1402 | status = wrmalt(Adapter, EEPROM_COMMAND_Q_REG, |
| 1403 | (PUINT)&dwAddress, sizeof(UINT)); |
| 1404 | if(status != STATUS_SUCCESS) |
| 1405 | { |
| 1406 | BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "wrm Failed..\n"); |
Stephen Hemminger | 082e889 | 2010-11-01 09:35:21 -0400 | [diff] [blame] | 1407 | kfree(pucmacaddr); |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 1408 | pucmacaddr = NULL; |
| 1409 | goto OUT; |
| 1410 | } |
| 1411 | for(i=0;i<MAC_ADDRESS_SIZE;i++) |
| 1412 | { |
| 1413 | status = rdmalt(Adapter, EEPROM_READ_DATA_Q_REG, &temp,sizeof(temp)); |
| 1414 | if(status != STATUS_SUCCESS) |
| 1415 | { |
| 1416 | BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "rdm Failed..\n"); |
Stephen Hemminger | 082e889 | 2010-11-01 09:35:21 -0400 | [diff] [blame] | 1417 | kfree(pucmacaddr); |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 1418 | pucmacaddr = NULL; |
| 1419 | goto OUT; |
| 1420 | } |
| 1421 | pucmacaddr[i] = temp & 0xff; |
| 1422 | BCM_DEBUG_PRINT(Adapter,DBG_TYPE_INITEXIT, DRV_ENTRY, DBG_LVL_ALL,"%x \n", pucmacaddr[i]); |
| 1423 | } |
| 1424 | OUT: |
| 1425 | return pucmacaddr; |
| 1426 | } |
Arnd Bergmann | 44a17eff | 2010-09-30 10:24:12 +0200 | [diff] [blame] | 1427 | #endif |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 1428 | |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 1429 | |
Arnd Bergmann | 44a17eff | 2010-09-30 10:24:12 +0200 | [diff] [blame] | 1430 | static void convertEndian(B_UINT8 rwFlag, PUINT puiBuffer, UINT uiByteCount) |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 1431 | { |
| 1432 | UINT uiIndex = 0; |
| 1433 | |
| 1434 | if(RWM_WRITE == rwFlag) { |
| 1435 | for(uiIndex =0; uiIndex < (uiByteCount/sizeof(UINT)); uiIndex++) { |
| 1436 | puiBuffer[uiIndex] = htonl(puiBuffer[uiIndex]); |
| 1437 | } |
| 1438 | } else { |
| 1439 | for(uiIndex =0; uiIndex < (uiByteCount/sizeof(UINT)); uiIndex++) { |
| 1440 | puiBuffer[uiIndex] = ntohl(puiBuffer[uiIndex]); |
| 1441 | } |
| 1442 | } |
| 1443 | } |
| 1444 | |
| 1445 | #define CACHE_ADDRESS_MASK 0x80000000 |
| 1446 | #define UNCACHE_ADDRESS_MASK 0xa0000000 |
| 1447 | |
| 1448 | int rdm(PMINI_ADAPTER Adapter, UINT uiAddress, PCHAR pucBuff, size_t sSize) |
| 1449 | { |
Greg Dietsche | c5274ab | 2011-06-13 13:11:47 -0500 | [diff] [blame] | 1450 | return Adapter->interface_rdm(Adapter->pvInterfaceAdapter, |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 1451 | uiAddress, pucBuff, sSize); |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 1452 | } |
Greg Dietsche | c5274ab | 2011-06-13 13:11:47 -0500 | [diff] [blame] | 1453 | |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 1454 | int wrm(PMINI_ADAPTER Adapter, UINT uiAddress, PCHAR pucBuff, size_t sSize) |
| 1455 | { |
| 1456 | int iRetVal; |
| 1457 | |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 1458 | iRetVal = Adapter->interface_wrm(Adapter->pvInterfaceAdapter, |
| 1459 | uiAddress, pucBuff, sSize); |
| 1460 | |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 1461 | |
| 1462 | return iRetVal; |
| 1463 | } |
| 1464 | |
| 1465 | int wrmalt (PMINI_ADAPTER Adapter, UINT uiAddress, PUINT pucBuff, size_t size) |
| 1466 | { |
| 1467 | convertEndian(RWM_WRITE, pucBuff, size); |
| 1468 | return wrm(Adapter, uiAddress, (PUCHAR)pucBuff, size); |
| 1469 | } |
| 1470 | |
| 1471 | int rdmalt (PMINI_ADAPTER Adapter, UINT uiAddress, PUINT pucBuff, size_t size) |
| 1472 | { |
| 1473 | INT uiRetVal =0; |
| 1474 | |
| 1475 | uiRetVal = rdm(Adapter,uiAddress,(PUCHAR)pucBuff,size); |
| 1476 | convertEndian(RWM_READ, (PUINT)pucBuff, size); |
| 1477 | |
| 1478 | return uiRetVal; |
| 1479 | } |
| 1480 | |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 1481 | |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 1482 | int wrmWithLock(PMINI_ADAPTER Adapter, UINT uiAddress, PCHAR pucBuff, size_t sSize) |
| 1483 | { |
| 1484 | INT status = STATUS_SUCCESS ; |
| 1485 | down(&Adapter->rdmwrmsync); |
| 1486 | |
| 1487 | if((Adapter->IdleMode == TRUE) || |
| 1488 | (Adapter->bShutStatus ==TRUE) || |
| 1489 | (Adapter->bPreparingForLowPowerMode ==TRUE)) |
| 1490 | { |
| 1491 | status = -EACCES; |
| 1492 | goto exit; |
| 1493 | } |
| 1494 | |
| 1495 | status =wrm(Adapter, uiAddress, pucBuff, sSize); |
| 1496 | |
| 1497 | exit: |
| 1498 | up(&Adapter->rdmwrmsync); |
| 1499 | return status ; |
| 1500 | } |
| 1501 | |
| 1502 | int wrmaltWithLock (PMINI_ADAPTER Adapter, UINT uiAddress, PUINT pucBuff, size_t size) |
| 1503 | { |
| 1504 | int iRetVal = STATUS_SUCCESS; |
| 1505 | |
| 1506 | down(&Adapter->rdmwrmsync); |
| 1507 | |
| 1508 | if((Adapter->IdleMode == TRUE) || |
| 1509 | (Adapter->bShutStatus ==TRUE) || |
| 1510 | (Adapter->bPreparingForLowPowerMode ==TRUE)) |
| 1511 | { |
| 1512 | iRetVal = -EACCES; |
| 1513 | goto exit; |
| 1514 | } |
| 1515 | |
| 1516 | iRetVal = wrmalt(Adapter,uiAddress,pucBuff,size); |
| 1517 | |
| 1518 | exit: |
| 1519 | up(&Adapter->rdmwrmsync); |
| 1520 | return iRetVal; |
| 1521 | } |
| 1522 | |
| 1523 | int rdmaltWithLock (PMINI_ADAPTER Adapter, UINT uiAddress, PUINT pucBuff, size_t size) |
| 1524 | { |
| 1525 | INT uiRetVal =STATUS_SUCCESS; |
| 1526 | |
| 1527 | down(&Adapter->rdmwrmsync); |
| 1528 | |
| 1529 | if((Adapter->IdleMode == TRUE) || |
| 1530 | (Adapter->bShutStatus ==TRUE) || |
| 1531 | (Adapter->bPreparingForLowPowerMode ==TRUE)) |
| 1532 | { |
| 1533 | uiRetVal = -EACCES; |
| 1534 | goto exit; |
| 1535 | } |
| 1536 | |
| 1537 | uiRetVal = rdmalt(Adapter,uiAddress, pucBuff, size); |
| 1538 | |
| 1539 | exit: |
| 1540 | up(&Adapter->rdmwrmsync); |
| 1541 | return uiRetVal; |
| 1542 | } |
| 1543 | |
| 1544 | |
Arnd Bergmann | 44a17eff | 2010-09-30 10:24:12 +0200 | [diff] [blame] | 1545 | static VOID HandleShutDownModeWakeup(PMINI_ADAPTER Adapter) |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 1546 | { |
| 1547 | int clear_abort_pattern = 0,Status = 0; |
| 1548 | BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, MP_SHUTDOWN, DBG_LVL_ALL, "====>\n"); |
| 1549 | //target has woken up From Shut Down |
| 1550 | BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, MP_SHUTDOWN, DBG_LVL_ALL, "Clearing Shut Down Software abort pattern\n"); |
| 1551 | Status = wrmalt(Adapter,SW_ABORT_IDLEMODE_LOC, (PUINT)&clear_abort_pattern, sizeof(clear_abort_pattern)); |
| 1552 | if(Status) |
| 1553 | { |
| 1554 | BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, MP_SHUTDOWN, DBG_LVL_ALL,"WRM to SW_ABORT_IDLEMODE_LOC failed with err:%d", Status); |
| 1555 | return; |
| 1556 | } |
| 1557 | if(Adapter->ulPowerSaveMode != DEVICE_POWERSAVE_MODE_AS_PROTOCOL_IDLE_MODE) |
| 1558 | { |
| 1559 | msleep(100); |
| 1560 | InterfaceHandleShutdownModeWakeup(Adapter); |
| 1561 | msleep(100); |
| 1562 | } |
| 1563 | if(Adapter->LEDInfo.led_thread_running & BCM_LED_THREAD_RUNNING_ACTIVELY) |
| 1564 | { |
| 1565 | Adapter->DriverState = NO_NETWORK_ENTRY; |
| 1566 | wake_up(&Adapter->LEDInfo.notify_led_event); |
| 1567 | } |
| 1568 | |
| 1569 | Adapter->bTriedToWakeUpFromlowPowerMode = FALSE; |
| 1570 | Adapter->bShutStatus = FALSE; |
| 1571 | wake_up(&Adapter->lowpower_mode_wait_queue); |
| 1572 | BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, MP_SHUTDOWN, DBG_LVL_ALL, "<====\n"); |
| 1573 | } |
| 1574 | |
Arnd Bergmann | 44a17eff | 2010-09-30 10:24:12 +0200 | [diff] [blame] | 1575 | static VOID SendShutModeResponse(PMINI_ADAPTER Adapter) |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 1576 | { |
| 1577 | CONTROL_MESSAGE stShutdownResponse; |
| 1578 | UINT NVMAccess = 0,lowPwrAbortMsg = 0; |
| 1579 | UINT Status = 0; |
| 1580 | |
| 1581 | memset (&stShutdownResponse, 0, sizeof(CONTROL_MESSAGE)); |
| 1582 | stShutdownResponse.Leader.Status = LINK_UP_CONTROL_REQ; |
| 1583 | stShutdownResponse.Leader.PLength = 8;//8 bytes; |
| 1584 | stShutdownResponse.szData[0] = LINK_UP_ACK; |
| 1585 | stShutdownResponse.szData[1] = LINK_SHUTDOWN_REQ_FROM_FIRMWARE; |
| 1586 | |
| 1587 | /********************************* |
| 1588 | **down_trylock - |
| 1589 | ** if [ semaphore is available ] |
| 1590 | ** acquire semaphone and return value 0 ; |
| 1591 | ** else |
| 1592 | ** return non-zero value ; |
| 1593 | ** |
| 1594 | ***********************************/ |
| 1595 | |
| 1596 | NVMAccess = down_trylock(&Adapter->NVMRdmWrmLock); |
| 1597 | |
| 1598 | lowPwrAbortMsg= down_trylock(&Adapter->LowPowerModeSync); |
| 1599 | |
| 1600 | |
| 1601 | if(NVMAccess || lowPwrAbortMsg|| atomic_read(&Adapter->TotalPacketCount)) |
| 1602 | { |
| 1603 | if(!NVMAccess) |
| 1604 | up(&Adapter->NVMRdmWrmLock); |
| 1605 | |
| 1606 | if(!lowPwrAbortMsg) |
| 1607 | up(&Adapter->LowPowerModeSync); |
| 1608 | |
| 1609 | BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, MP_SHUTDOWN, DBG_LVL_ALL, "Device Access is going on NACK the Shut Down MODE\n"); |
| 1610 | stShutdownResponse.szData[2] = SHUTDOWN_NACK_FROM_DRIVER;//NACK- device access is going on. |
| 1611 | Adapter->bPreparingForLowPowerMode = FALSE; |
| 1612 | } |
| 1613 | else |
| 1614 | { |
| 1615 | BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, MP_SHUTDOWN, DBG_LVL_ALL, "Sending SHUTDOWN MODE ACK\n"); |
| 1616 | stShutdownResponse.szData[2] = SHUTDOWN_ACK_FROM_DRIVER;//ShutDown ACK |
| 1617 | |
| 1618 | /* Wait for the LED to TURN OFF before sending ACK response */ |
| 1619 | if(Adapter->LEDInfo.led_thread_running & BCM_LED_THREAD_RUNNING_ACTIVELY) |
| 1620 | { |
| 1621 | INT iRetVal = 0; |
| 1622 | |
| 1623 | /* Wake the LED Thread with LOWPOWER_MODE_ENTER State */ |
| 1624 | Adapter->DriverState = LOWPOWER_MODE_ENTER; |
| 1625 | wake_up(&Adapter->LEDInfo.notify_led_event); |
| 1626 | |
| 1627 | /* Wait for 1 SEC for LED to OFF */ |
| 1628 | iRetVal = wait_event_timeout(Adapter->LEDInfo.idleModeSyncEvent,\ |
| 1629 | Adapter->LEDInfo.bIdle_led_off, msecs_to_jiffies(1000)); |
| 1630 | |
| 1631 | /* If Timed Out to Sync IDLE MODE Enter, do IDLE mode Exit and Send NACK to device */ |
| 1632 | if(iRetVal <= 0) |
| 1633 | { |
| 1634 | stShutdownResponse.szData[1] = SHUTDOWN_NACK_FROM_DRIVER;//NACK- device access is going on. |
| 1635 | |
| 1636 | Adapter->DriverState = NO_NETWORK_ENTRY; |
| 1637 | wake_up(&Adapter->LEDInfo.notify_led_event); |
| 1638 | } |
| 1639 | } |
| 1640 | |
| 1641 | if(stShutdownResponse.szData[2] == SHUTDOWN_ACK_FROM_DRIVER) |
| 1642 | { |
| 1643 | BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, MP_SHUTDOWN, DBG_LVL_ALL,"ACKING SHUTDOWN MODE !!!!!!!!!"); |
| 1644 | down(&Adapter->rdmwrmsync); |
| 1645 | Adapter->bPreparingForLowPowerMode = TRUE; |
| 1646 | up(&Adapter->rdmwrmsync); |
| 1647 | //Killing all URBS. |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 1648 | if(Adapter->bDoSuspend == TRUE) |
| 1649 | Bcm_kill_all_URBs((PS_INTERFACE_ADAPTER)(Adapter->pvInterfaceAdapter)); |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 1650 | } |
| 1651 | else |
| 1652 | { |
| 1653 | Adapter->bPreparingForLowPowerMode = FALSE; |
| 1654 | } |
| 1655 | |
| 1656 | if(!NVMAccess) |
| 1657 | up(&Adapter->NVMRdmWrmLock); |
| 1658 | |
| 1659 | if(!lowPwrAbortMsg) |
| 1660 | up(&Adapter->LowPowerModeSync); |
| 1661 | } |
| 1662 | Status = CopyBufferToControlPacket(Adapter,&stShutdownResponse); |
| 1663 | if((Status != STATUS_SUCCESS)) |
| 1664 | { |
| 1665 | BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, MP_SHUTDOWN, DBG_LVL_ALL,"fail to send the Idle mode Request \n"); |
| 1666 | Adapter->bPreparingForLowPowerMode = FALSE; |
| 1667 | |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 1668 | StartInterruptUrb((PS_INTERFACE_ADAPTER)(Adapter->pvInterfaceAdapter)); |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 1669 | } |
| 1670 | } |
| 1671 | |
| 1672 | |
Stephen Hemminger | 9dd47ee | 2010-11-01 12:24:00 -0400 | [diff] [blame] | 1673 | static void HandleShutDownModeRequest(PMINI_ADAPTER Adapter,PUCHAR pucBuffer) |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 1674 | { |
| 1675 | B_UINT32 uiResetValue = 0; |
| 1676 | |
| 1677 | BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, MP_SHUTDOWN, DBG_LVL_ALL, "====>\n"); |
| 1678 | |
| 1679 | if(*(pucBuffer+1) == COMPLETE_WAKE_UP_NOTIFICATION_FRM_FW) |
| 1680 | { |
| 1681 | HandleShutDownModeWakeup(Adapter); |
| 1682 | } |
| 1683 | else if(*(pucBuffer+1) == LINK_SHUTDOWN_REQ_FROM_FIRMWARE) |
| 1684 | { |
| 1685 | //Target wants to go to Shut Down Mode |
| 1686 | //InterfacePrepareForShutdown(Adapter); |
| 1687 | if(Adapter->chip_id == BCS220_2 || |
| 1688 | Adapter->chip_id == BCS220_2BC || |
| 1689 | Adapter->chip_id == BCS250_BC || |
| 1690 | Adapter->chip_id == BCS220_3) |
| 1691 | { |
| 1692 | rdmalt(Adapter,HPM_CONFIG_MSW, &uiResetValue, 4); |
| 1693 | uiResetValue |= (1<<17); |
| 1694 | wrmalt(Adapter, HPM_CONFIG_MSW, &uiResetValue, 4); |
| 1695 | } |
| 1696 | |
| 1697 | SendShutModeResponse(Adapter); |
| 1698 | BCM_DEBUG_PRINT (Adapter,DBG_TYPE_OTHERS, MP_SHUTDOWN, DBG_LVL_ALL,"ShutDownModeResponse:Notification received: Sending the response(Ack/Nack)\n"); |
| 1699 | } |
| 1700 | |
| 1701 | BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, MP_SHUTDOWN, DBG_LVL_ALL, "<====\n"); |
| 1702 | return; |
| 1703 | |
| 1704 | } |
| 1705 | |
| 1706 | VOID ResetCounters(PMINI_ADAPTER Adapter) |
| 1707 | { |
| 1708 | |
| 1709 | beceem_protocol_reset(Adapter); |
| 1710 | |
| 1711 | Adapter->CurrNumRecvDescs = 0; |
| 1712 | Adapter->PrevNumRecvDescs = 0; |
| 1713 | Adapter->LinkUpStatus = 0; |
| 1714 | Adapter->LinkStatus = 0; |
| 1715 | atomic_set(&Adapter->cntrlpktCnt,0); |
| 1716 | atomic_set (&Adapter->TotalPacketCount,0); |
| 1717 | Adapter->fw_download_done=FALSE; |
| 1718 | Adapter->LinkStatus = 0; |
| 1719 | Adapter->AutoLinkUp = FALSE; |
| 1720 | Adapter->IdleMode = FALSE; |
| 1721 | Adapter->bShutStatus = FALSE; |
| 1722 | |
| 1723 | } |
| 1724 | S_CLASSIFIER_RULE *GetFragIPClsEntry(PMINI_ADAPTER Adapter,USHORT usIpIdentification,ULONG SrcIP) |
| 1725 | { |
| 1726 | UINT uiIndex=0; |
| 1727 | for(uiIndex=0;uiIndex<MAX_FRAGMENTEDIP_CLASSIFICATION_ENTRIES;uiIndex++) |
| 1728 | { |
| 1729 | if((Adapter->astFragmentedPktClassifierTable[uiIndex].bUsed)&& |
| 1730 | (Adapter->astFragmentedPktClassifierTable[uiIndex].usIpIdentification == usIpIdentification)&& |
| 1731 | (Adapter->astFragmentedPktClassifierTable[uiIndex].ulSrcIpAddress== SrcIP)&& |
| 1732 | !Adapter->astFragmentedPktClassifierTable[uiIndex].bOutOfOrderFragment) |
| 1733 | return Adapter->astFragmentedPktClassifierTable[uiIndex].pstMatchedClassifierEntry; |
| 1734 | } |
| 1735 | return NULL; |
| 1736 | } |
| 1737 | |
| 1738 | void AddFragIPClsEntry(PMINI_ADAPTER Adapter,PS_FRAGMENTED_PACKET_INFO psFragPktInfo) |
| 1739 | { |
| 1740 | UINT uiIndex=0; |
| 1741 | for(uiIndex=0;uiIndex<MAX_FRAGMENTEDIP_CLASSIFICATION_ENTRIES;uiIndex++) |
| 1742 | { |
| 1743 | if(!Adapter->astFragmentedPktClassifierTable[uiIndex].bUsed) |
| 1744 | { |
| 1745 | memcpy(&Adapter->astFragmentedPktClassifierTable[uiIndex],psFragPktInfo,sizeof(S_FRAGMENTED_PACKET_INFO)); |
| 1746 | break; |
| 1747 | } |
| 1748 | } |
| 1749 | |
| 1750 | } |
| 1751 | |
| 1752 | void DelFragIPClsEntry(PMINI_ADAPTER Adapter,USHORT usIpIdentification,ULONG SrcIp) |
| 1753 | { |
| 1754 | UINT uiIndex=0; |
| 1755 | for(uiIndex=0;uiIndex<MAX_FRAGMENTEDIP_CLASSIFICATION_ENTRIES;uiIndex++) |
| 1756 | { |
| 1757 | if((Adapter->astFragmentedPktClassifierTable[uiIndex].bUsed)&& |
| 1758 | (Adapter->astFragmentedPktClassifierTable[uiIndex].usIpIdentification == usIpIdentification)&& |
| 1759 | (Adapter->astFragmentedPktClassifierTable[uiIndex].ulSrcIpAddress== SrcIp)) |
| 1760 | memset(&Adapter->astFragmentedPktClassifierTable[uiIndex],0,sizeof(S_FRAGMENTED_PACKET_INFO)); |
| 1761 | } |
| 1762 | } |
| 1763 | |
| 1764 | void update_per_cid_rx (PMINI_ADAPTER Adapter) |
| 1765 | { |
| 1766 | UINT qindex = 0; |
| 1767 | |
| 1768 | if((jiffies - Adapter->liDrainCalculated) < XSECONDS) |
| 1769 | return; |
| 1770 | |
| 1771 | for(qindex = 0; qindex < HiPriority; qindex++) |
| 1772 | { |
| 1773 | if(Adapter->PackInfo[qindex].ucDirection == 0) |
| 1774 | { |
| 1775 | Adapter->PackInfo[qindex].uiCurrentRxRate = |
| 1776 | (Adapter->PackInfo[qindex].uiCurrentRxRate + |
| 1777 | Adapter->PackInfo[qindex].uiThisPeriodRxBytes)/2; |
| 1778 | |
| 1779 | Adapter->PackInfo[qindex].uiThisPeriodRxBytes = 0; |
| 1780 | } |
| 1781 | else |
| 1782 | { |
| 1783 | Adapter->PackInfo[qindex].uiCurrentDrainRate = |
| 1784 | (Adapter->PackInfo[qindex].uiCurrentDrainRate + |
| 1785 | Adapter->PackInfo[qindex].uiThisPeriodSentBytes)/2; |
| 1786 | |
| 1787 | Adapter->PackInfo[qindex].uiThisPeriodSentBytes=0; |
| 1788 | } |
| 1789 | } |
| 1790 | Adapter->liDrainCalculated=jiffies; |
| 1791 | } |
| 1792 | void update_per_sf_desc_cnts( PMINI_ADAPTER Adapter) |
| 1793 | { |
| 1794 | INT iIndex = 0; |
| 1795 | u32 uibuff[MAX_TARGET_DSX_BUFFERS]; |
| 1796 | |
| 1797 | if(!atomic_read (&Adapter->uiMBupdate)) |
| 1798 | return; |
| 1799 | |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 1800 | if(rdmaltWithLock(Adapter, TARGET_SFID_TXDESC_MAP_LOC, (PUINT)uibuff, sizeof(UINT) * MAX_TARGET_DSX_BUFFERS)<0) |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 1801 | { |
| 1802 | BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "rdm failed\n"); |
| 1803 | return; |
| 1804 | } |
| 1805 | for(iIndex = 0;iIndex < HiPriority; iIndex++) |
| 1806 | { |
| 1807 | if(Adapter->PackInfo[iIndex].bValid && Adapter->PackInfo[iIndex].ucDirection) |
| 1808 | { |
| 1809 | if(Adapter->PackInfo[iIndex].usVCID_Value < MAX_TARGET_DSX_BUFFERS) |
| 1810 | { |
| 1811 | atomic_set(&Adapter->PackInfo[iIndex].uiPerSFTxResourceCount, uibuff[Adapter->PackInfo[iIndex].usVCID_Value]); |
| 1812 | } |
| 1813 | else |
| 1814 | { |
| 1815 | BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "Invalid VCID : %x \n", |
| 1816 | Adapter->PackInfo[iIndex].usVCID_Value); |
| 1817 | } |
| 1818 | } |
| 1819 | } |
| 1820 | atomic_set (&Adapter->uiMBupdate, FALSE); |
| 1821 | } |
| 1822 | |
| 1823 | void flush_queue(PMINI_ADAPTER Adapter, UINT iQIndex) |
| 1824 | { |
| 1825 | struct sk_buff* PacketToDrop=NULL; |
Stephen Hemminger | 92bc605 | 2010-10-29 08:22:10 -0700 | [diff] [blame] | 1826 | struct net_device_stats* netstats = &Adapter->dev->stats; |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 1827 | |
| 1828 | spin_lock_bh(&Adapter->PackInfo[iQIndex].SFQueueLock); |
| 1829 | |
| 1830 | while(Adapter->PackInfo[iQIndex].FirstTxQueue && |
| 1831 | atomic_read(&Adapter->TotalPacketCount)) |
| 1832 | { |
| 1833 | PacketToDrop = Adapter->PackInfo[iQIndex].FirstTxQueue; |
| 1834 | if(PacketToDrop && PacketToDrop->len) |
| 1835 | { |
| 1836 | netstats->tx_dropped++; |
| 1837 | DEQUEUEPACKET(Adapter->PackInfo[iQIndex].FirstTxQueue, \ |
| 1838 | Adapter->PackInfo[iQIndex].LastTxQueue); |
| 1839 | |
| 1840 | Adapter->PackInfo[iQIndex].uiCurrentPacketsOnHost--; |
| 1841 | Adapter->PackInfo[iQIndex].uiCurrentBytesOnHost -= PacketToDrop->len; |
| 1842 | |
| 1843 | //Adding dropped statistics |
| 1844 | Adapter->PackInfo[iQIndex].uiDroppedCountBytes += PacketToDrop->len; |
| 1845 | Adapter->PackInfo[iQIndex].uiDroppedCountPackets++; |
| 1846 | |
Stephen Hemminger | 082e889 | 2010-11-01 09:35:21 -0400 | [diff] [blame] | 1847 | dev_kfree_skb(PacketToDrop); |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 1848 | atomic_dec(&Adapter->TotalPacketCount); |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 1849 | } |
| 1850 | } |
| 1851 | spin_unlock_bh(&Adapter->PackInfo[iQIndex].SFQueueLock); |
| 1852 | |
| 1853 | } |
| 1854 | |
Stephen Hemminger | 9dd47ee | 2010-11-01 12:24:00 -0400 | [diff] [blame] | 1855 | static void beceem_protocol_reset (PMINI_ADAPTER Adapter) |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 1856 | { |
Stephen Hemminger | 4fd64dd | 2010-11-01 12:12:31 -0400 | [diff] [blame] | 1857 | int i; |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 1858 | |
Stephen Hemminger | 4fd64dd | 2010-11-01 12:12:31 -0400 | [diff] [blame] | 1859 | if (netif_msg_link(Adapter)) |
Stephen Hemminger | 9ec4475 | 2010-11-01 12:18:36 -0400 | [diff] [blame] | 1860 | pr_notice(PFX "%s: protocol reset\n", Adapter->dev->name); |
Stephen Hemminger | 4fd64dd | 2010-11-01 12:12:31 -0400 | [diff] [blame] | 1861 | |
| 1862 | netif_carrier_off(Adapter->dev); |
| 1863 | netif_stop_queue(Adapter->dev); |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 1864 | |
| 1865 | Adapter->IdleMode = FALSE; |
| 1866 | Adapter->LinkUpStatus = FALSE; |
| 1867 | ClearTargetDSXBuffer(Adapter,0, TRUE); |
| 1868 | //Delete All Classifier Rules |
| 1869 | |
| 1870 | for(i = 0;i<HiPriority;i++) |
| 1871 | { |
| 1872 | DeleteAllClassifiersForSF(Adapter,i); |
| 1873 | } |
| 1874 | |
| 1875 | flush_all_queues(Adapter); |
| 1876 | |
| 1877 | if(Adapter->TimerActive == TRUE) |
| 1878 | Adapter->TimerActive = FALSE; |
| 1879 | |
| 1880 | memset(Adapter->astFragmentedPktClassifierTable, 0, |
Stephen Hemminger | 4fd64dd | 2010-11-01 12:12:31 -0400 | [diff] [blame] | 1881 | sizeof(S_FRAGMENTED_PACKET_INFO) * MAX_FRAGMENTEDIP_CLASSIFICATION_ENTRIES); |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 1882 | |
| 1883 | for(i = 0;i<HiPriority;i++) |
| 1884 | { |
| 1885 | //resetting only the first size (S_MIBS_SERVICEFLOW_TABLE) for the SF. |
| 1886 | // It is same between MIBs and SF. |
Stephen Hemminger | 4fd64dd | 2010-11-01 12:12:31 -0400 | [diff] [blame] | 1887 | memset(&Adapter->PackInfo[i].stMibsExtServiceFlowTable, |
| 1888 | 0, sizeof(S_MIBS_EXTSERVICEFLOW_PARAMETERS)); |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 1889 | } |
| 1890 | } |
| 1891 | |
| 1892 | |
| 1893 | |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 1894 | |
| 1895 | |