Skip to content

Commit

Permalink
Staging: add w35und wifi driver
Browse files Browse the repository at this point in the history
This is driver for w35und usb wifi -- also in kohjinsha
subnotebook. It should work well enough to associate and ping, but it
obviously needs to be rewritten two more times...

OTOH worst horrors (like embedded wifi stack) should have been fixed
already...

Signed-off-by: Pavel Machek <pavel@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Pavel Machek authored and Greg Kroah-Hartman committed Oct 10, 2008
1 parent 4d7b5c7 commit 66101de
Show file tree
Hide file tree
Showing 53 changed files with 14,522 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/staging/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,6 @@ source "drivers/staging/go7007/Kconfig"

source "drivers/staging/usbip/Kconfig"

source "drivers/staging/winbond/Kconfig"

endif # STAGING
1 change: 1 addition & 0 deletions drivers/staging/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ obj-$(CONFIG_SXG) += sxg/
obj-$(CONFIG_ME4000) += me4000/
obj-$(CONFIG_VIDEO_GO7007) += go7007/
obj-$(CONFIG_USB_IP_COMMON) += usbip/
obj-$(CONFIG_W35UND) += winbond/
7 changes: 7 additions & 0 deletions drivers/staging/winbond/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
config W35UND
tristate "Winbond driver"
depends on MAC80211 && WLAN_80211 && EXPERIMENTAL && !4KSTACKS
default n
---help---
This is highly experimental driver for winbond wifi card on some Kohjinsha notebooks
Check http://code.google.com/p/winbondport/ for new version
18 changes: 18 additions & 0 deletions drivers/staging/winbond/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
DRIVER_DIR=./linux

w35und-objs := $(DRIVER_DIR)/wbusb.o $(DRIVER_DIR)/wb35reg.o $(DRIVER_DIR)/wb35rx.o $(DRIVER_DIR)/wb35tx.o \
mds.o \
mlmetxrx.o \
mto.o \
phy_calibration.o \
reg.o \
rxisr.o \
sme_api.o \
wbhal.o \
wblinux.o \


obj-$(CONFIG_W35UND) += w35und.o



10 changes: 10 additions & 0 deletions drivers/staging/winbond/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
TODO:
- sparse cleanups
- checkpatch cleanups
- kerneldoc cleanups
- remove typedefs
- remove unused ioctls
- use cfg80211 for regulatory stuff

Please send patches to Greg Kroah-Hartman <greg@kroah.com> and
Pavel Machek <pavel@suse.cz>
23 changes: 23 additions & 0 deletions drivers/staging/winbond/adapter.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//
// ADAPTER.H -
// Windows NDIS global variable 'Adapter' typedef
//
#define MAX_ANSI_STRING 40
typedef struct WB32_ADAPTER
{
u32 AdapterIndex; // 20060703.4 Add for using pAdapterContext global Adapter point

WB_LOCALDESCRIPT sLocalPara; // Myself connected parameters
PWB_BSSDESCRIPTION asBSSDescriptElement;

MLME_FRAME sMlmeFrame; // connect to peerSTA parameters

MTO_PARAMETERS sMtoPara; // MTO_struct ...
hw_data_t sHwData; //For HAL
MDS Mds;

WBLINUX WbLinux;
struct iw_statistics iw_stats;

u8 LinkName[MAX_ANSI_STRING];
} WB32_ADAPTER, ADAPTER, *PWB32_ADAPTER, *PADAPTER;
59 changes: 59 additions & 0 deletions drivers/staging/winbond/bss_f.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
//
// BSS descriptor DataBase management global function
//

void vBSSdescriptionInit(PWB32_ADAPTER Adapter);
void vBSSfoundList(PWB32_ADAPTER Adapter);
u8 boChanFilter(PWB32_ADAPTER Adapter, u8 ChanNo);
u16 wBSSallocateEntry(PWB32_ADAPTER Adapter);
u16 wBSSGetEntry(PWB32_ADAPTER Adapter);
void vSimpleHouseKeeping(PWB32_ADAPTER Adapter);
u16 wBSShouseKeeping(PWB32_ADAPTER Adapter);
void ClearBSSdescpt(PWB32_ADAPTER Adapter, u16 i);
u16 wBSSfindBssID(PWB32_ADAPTER Adapter, u8 *pbBssid);
u16 wBSSfindDedicateCandidate(PWB32_ADAPTER Adapter, struct SSID_Element *psSsid, u8 *pbBssid);
u16 wBSSfindMACaddr(PWB32_ADAPTER Adapter, u8 *pbMacAddr);
u16 wBSSsearchMACaddr(PWB32_ADAPTER Adapter, u8 *pbMacAddr, u8 band);
u16 wBSSaddScanData(PWB32_ADAPTER, u16, psRXDATA);
u16 wBSSUpdateScanData(PWB32_ADAPTER Adapter, u16 wBssIdx, psRXDATA psRcvData);
u16 wBSScreateIBSSdata(PWB32_ADAPTER Adapter, PWB_BSSDESCRIPTION psDesData);
void DesiredRate2BSSdescriptor(PWB32_ADAPTER Adapter, PWB_BSSDESCRIPTION psDesData,
u8 *pBasicRateSet, u8 BasicRateCount,
u8 *pOperationRateSet, u8 OperationRateCount);
void DesiredRate2InfoElement(PWB32_ADAPTER Adapter, u8 *addr, u16 *iFildOffset,
u8 *pBasicRateSet, u8 BasicRateCount,
u8 *pOperationRateSet, u8 OperationRateCount);
void BSSAddIBSSdata(PWB32_ADAPTER Adapter, PWB_BSSDESCRIPTION psDesData);
unsigned char boCmpMacAddr( PUCHAR, PUCHAR );
unsigned char boCmpSSID(struct SSID_Element *psSSID1, struct SSID_Element *psSSID2);
u16 wBSSfindSSID(PWB32_ADAPTER Adapter, struct SSID_Element *psSsid);
u16 wRoamingQuery(PWB32_ADAPTER Adapter);
void vRateToBitmap(PWB32_ADAPTER Adapter, u16 index);
u8 bRateToBitmapIndex(PWB32_ADAPTER Adapter, u8 bRate);
u8 bBitmapToRate(u8 i);
unsigned char boIsERPsta(PWB32_ADAPTER Adapter, u16 i);
unsigned char boCheckConnect(PWB32_ADAPTER Adapter);
unsigned char boCheckSignal(PWB32_ADAPTER Adapter);
void AddIBSSIe(PWB32_ADAPTER Adapter,PWB_BSSDESCRIPTION psDesData );//added by ws for WPA_None06/01/04
void BssScanUpToDate(PWB32_ADAPTER Adapter);
void BssUpToDate(PWB32_ADAPTER Adapter);
void RateSort(u8 *RateArray, u8 num, u8 mode);
void RateReSortForSRate(PWB32_ADAPTER Adapter, u8 *RateArray, u8 num);
void Assemble_IE(PWB32_ADAPTER Adapter, u16 wBssIdx);
void SetMaxTxRate(PWB32_ADAPTER Adapter);

void CreateWpaIE(PWB32_ADAPTER Adapter, u16* iFildOffset, PUCHAR msg, struct Management_Frame* msgHeader,
struct Association_Request_Frame_Body* msgBody, u16 iMSindex); //added by WS 05/14/05

#ifdef _WPA2_
void CreateRsnIE(PWB32_ADAPTER Adapter, u16* iFildOffset, PUCHAR msg, struct Management_Frame* msgHeader,
struct Association_Request_Frame_Body* msgBody, u16 iMSindex);//added by WS 05/14/05

u16 SearchPmkid(PWB32_ADAPTER Adapter, struct Management_Frame* msgHeader,
struct PMKID_Information_Element * AssoReq_PMKID );
#endif





156 changes: 156 additions & 0 deletions drivers/staging/winbond/bssdscpt.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// bssdscpt.c
// BSS descriptor data base
// history :
//
// Description:
// BSS descriptor data base will store the information of the stations at the
// surrounding environment. The first entry( psBSS(0) ) will not be used and the
// second one( psBSS(1) ) will be used for the broadcast address.
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

//#define MAX_ACC_RSSI_COUNT 10
#define MAX_ACC_RSSI_COUNT 6

///////////////////////////////////////////////////////////////////////////
//
// BSS Description set Element , to store scan received Beacon information
//
// Our's differs slightly from the specs. The specify a PHY_Parameter_Set.
// Since we're only doing a DS design right now, we just have a DS structure.
//////////////////////////////////////////////////////////////////////////////
typedef struct BSSDescriptionElement
{
u32 SlotValid;
u32 PowerSaveMode;
RXLAYER1 RxLayer1;

u8 abPeerAddress[ MAC_ADDR_LENGTH + 2 ]; // peer MAC Address associated with this session. 6-OCTET value
u32 dwBgScanStamp; // BgScan Sequence Counter stamp, record psROAM->dwScanCounter.

u16 Beacon_Period;
u16 wATIM_Window;

u8 abBssID[ MAC_ADDR_LENGTH + 2 ]; // 6B

u8 bBssType;
u8 DTIM_Period; // 1 octet usually from TIM element, if present
u8 boInTimerHandler;
u8 boERP; // analysis ERP or (extended) supported rate element

u8 Timestamp[8];
u8 BasicRate[32];
u8 OperationalRate[32];
u32 dwBasicRateBitmap; //bit map, retrieve from SupportedRateSet
u32 dwOperationalRateBitmap; //bit map, retrieve from SupportedRateSet and
// ExtendedSupportedRateSet
// For RSSI calculating
u32 HalRssi[MAX_ACC_RSSI_COUNT]; // Encode. It must use MACRO of HAL to get the LNA and AGC data
u32 HalRssiIndex;

////From beacon/probe response
struct SSID_Element SSID; // 34B
u8 reserved_1[ 2 ];

struct Capability_Information_Element CapabilityInformation; // 2B
u8 reserved_2[ 2 ];

struct CF_Parameter_Set_Element CF_Parameter_Set; // 8B
struct IBSS_Parameter_Set_Element IBSS_Parameter_Set; // 4B
struct TIM_Element TIM_Element_Set; // 256B

struct DS_Parameter_Set_Element DS_Parameter_Set; // 3B
u8 reserved_3;

struct ERP_Information_Element ERP_Information_Set; // 3B
u8 reserved_4;

struct Supported_Rates_Element SupportedRateSet; // 10B
u8 reserved_5[2];

struct Extended_Supported_Rates_Element ExtendedSupportedRateSet; // 257B
u8 reserved_6[3];

u8 band;
u8 reserved_7[3];

// for MLME module
u16 wState; // the current state of the system
u16 wIndex; // THIS BSS element entry index

void* psAdapter; // pointer to THIS Adapter
OS_TIMER nTimer; // MLME timer

// Authentication
u16 wAuthAlgo; // peer MAC MLME use Auth algorithm, default OPEN_AUTH
u16 wAuthSeqNum; // current local MAC sendout AuthReq sequence number

u8 auth_challengeText[128];

////For XP:
u32 ies_len; // information element length
u8 ies[256]; // information element

////For WPA
u8 RsnIe_Type[2]; //added by ws for distinguish WPA and WPA2 05/14/04
u8 RsnIe_len;
u8 Rsn_Num;

// to record the rsn cipher suites,addded by ws 09/05/04
SUITE_SELECTOR group_cipher; // 4B
SUITE_SELECTOR pairwise_key_cipher_suites[WLAN_MAX_PAIRWISE_CIPHER_SUITE_COUNT];
SUITE_SELECTOR auth_key_mgt_suites[WLAN_MAX_AUTH_KEY_MGT_SUITE_LIST_COUNT];

u16 pairwise_key_cipher_suite_count;
u16 auth_key_mgt_suite_count;

u8 pairwise_key_cipher_suite_selected;
u8 auth_key_mgt_suite_selected;
u8 reserved_8[2];

struct RSN_Capability_Element rsn_capabilities; // 2B
u8 reserved_9[2];

//to record the rsn cipher suites for WPA2
#ifdef _WPA2_
u32 pre_auth; //added by WS for distinguish for 05/04/04
SUITE_SELECTOR wpa2_group_cipher; // 4B
SUITE_SELECTOR wpa2_pairwise_key_cipher_suites[WLAN_MAX_PAIRWISE_CIPHER_SUITE_COUNT];
SUITE_SELECTOR wpa2_auth_key_mgt_suites[WLAN_MAX_AUTH_KEY_MGT_SUITE_LIST_COUNT];

u16 wpa2_pairwise_key_cipher_suite_count;
u16 wpa2_auth_key_mgt_suite_count;

u8 wpa2_pairwise_key_cipher_suite_selected;
u8 wpa2_auth_key_mgt_suite_selected;
u8 reserved_10[2];

struct RSN_Capability_Element wpa2_rsn_capabilities; // 2B
u8 reserved_11[2];
#endif //endif _WPA2_

//For Replay protection
// u8 PairwiseTSC[6];
// u8 GroupTSC[6];

////For up-to-date
u32 ScanTimeStamp; //for the decision whether the station/AP(may exist at
//different channels) has left. It must be detected by
//scanning. Local device may connected or disconnected.
u32 BssTimeStamp; //Only for the decision whether the station/AP(exist in
//the same channel, and no scanning) if local device has
//connected successfully.

// 20061108 Add for storing WPS_IE. [E id][Length][OUI][Data]
u8 WPS_IE_Data[MAX_IE_APPEND_SIZE];
u16 WPS_IE_length;
u16 WPS_IE_length_tmp; // For verify there is an WPS_IE in Beacon or probe response

} WB_BSSDESCRIPTION, *PWB_BSSDESCRIPTION;

#define wBSSConnectedSTA(Adapter) \
((u16)(Adapter)->sLocalPara.wConnectedSTAindex)

#define psBSS(i) (&(Adapter->asBSSDescriptElement[(i)]))


33 changes: 33 additions & 0 deletions drivers/staging/winbond/ds_tkip.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// Rotation functions on 32 bit values
#define ROL32( A, n ) \
( ((A) << (n)) | ( ((A)>>(32-(n))) & ( (1UL << (n)) - 1 ) ) )

#define ROR32( A, n ) ROL32( (A), 32-(n) )


typedef struct tkip
{
u32 K0, K1; // Key
union
{
struct // Current state
{
u32 L;
u32 R;
};
u8 LR[8];
};
union
{
u32 M; // Message accumulator (single word)
u8 Mb[4];
};
s32 bytes_in_M; // # bytes in M
} tkip_t;

//void _append_data( PUCHAR pData, u16 size, tkip_t *p );
void Mds_MicGet( void* Adapter, void* pRxLayer1, PUCHAR pKey, PUCHAR pMic );
void Mds_MicFill( void* Adapter, void* pDes, PUCHAR XmitBufAddress );



Loading

0 comments on commit 66101de

Please sign in to comment.