/* APIs visible to the driver */ void BMIInit(void) { bmiDone = false; pendingEventsFuncCheck = false; /* * On some platforms, it's not possible to DMA to a static variable * in a device driver (e.g. Linux loadable driver module). * So we need to A_MALLOC space for "command credits" and for commands. * * Note: implicitly relies on A_MALLOC to provide a buffer that is * suitable for DMA (or PIO). This buffer will be passed down the * bus stack. */ if (!pBMICmdCredits) { pBMICmdCredits = (u32 *)A_MALLOC_NOWAIT(4); A_ASSERT(pBMICmdCredits); } if (!pBMICmdBuf) { pBMICmdBuf = (u8 *)A_MALLOC_NOWAIT(MAX_BMI_CMDBUF_SZ); A_ASSERT(pBMICmdBuf); } A_REGISTER_MODULE_DEBUG_INFO(bmi); }
/* Update the buffer alone, not the entire node. * This involves, * 1) Freeing the buffer alone. * 2) Allocating a new buffer * 3) Update the node timestamp with the current time. */ A_STATUS wlan_node_buf_update(struct ieee80211_node_table *nt, bss_t *ni, A_UINT32 len) { IEEE80211_NODE_LOCK(nt); /* Free the ni_buf alone. */ if (ni->ni_buf != NULL) { A_FREE(ni->ni_buf); ni->ni_buf = NULL; } /* Allocate ni_buf for the new length. */ if (len) { ni->ni_buf = A_MALLOC_NOWAIT(len); if (ni->ni_buf == NULL) { IEEE80211_NODE_UNLOCK(nt); return A_ERROR; } else { A_MEMZERO(ni->ni_buf, len); } } /* Update the Node's timestamp. */ wlan_node_update_timestamp(nt, ni); IEEE80211_NODE_UNLOCK(nt); return A_OK; }
bss_t * wlan_node_alloc(struct ieee80211_node_table *nt, int wh_size) { bss_t *ni; ni = A_MALLOC_NOWAIT(sizeof(bss_t)); count_node++; if (ni != NULL) { A_MEMZERO(ni, sizeof(bss_t)); if (wh_size) { ni->ni_buf = A_MALLOC_NOWAIT(wh_size); if (ni->ni_buf == NULL) { printk("Out of memory in ar6003 Driver with scan count at %d\n", count_node); A_FREE_NOWAIT(ni); ni = NULL; return ni; } else { A_MEMZERO(ni->ni_buf, wh_size); } } } else { printk("Out of memory in ar6003 Driver with scan count at %d\n", count_node); return ni; } /* Make sure our lists are clean */ ni->ni_list_next = NULL; ni->ni_list_prev = NULL; ni->ni_hash_next = NULL; ni->ni_hash_prev = NULL; // // ni_scangen never initialized before and during suspend/resume of winmobile, // that some junk has been stored in this, due to this scan list didn't properly updated // ni->ni_scangen = 0; #ifdef OS_ROAM_MANAGEMENT ni->ni_si_gen = 0; #endif return ni; }
bss_t * wlan_node_alloc(struct ieee80211_node_table *nt, int wh_size) { bss_t *ni; ni = A_MALLOC_NOWAIT(sizeof(bss_t)); if (ni != NULL) { if (wh_size) { ni->ni_buf = A_MALLOC_NOWAIT(wh_size); if (ni->ni_buf == NULL) { A_FREE(ni); ni = NULL; return ni; } } } else { return ni; } /* Make sure our lists are clean */ ni->ni_list_next = NULL; ni->ni_list_prev = NULL; ni->ni_hash_next = NULL; ni->ni_hash_prev = NULL; /* */ /* ni_scangen never initialized before and during suspend/resume of winmobile, */ /* that some junk has been stored in this, due to this scan list didn't properly updated */ /* */ ni->ni_scangen = 0; #ifdef OS_ROAM_MANAGEMENT ni->ni_si_gen = 0; #endif return ni; }