Commit 76e3e7c4 authored by Karl Relton's avatar Karl Relton Committed by Greg Kroah-Hartman

Staging: wlan-ng: Move firmware loading into driver

Move prism2 firmware loading from userspace into driver, using linux
request_firmware(). Firmware is now loaded (if available) on device
probing, before it is registered as a netdevice and advertised to userspace.
Signed-off-by: default avatarKarl Relton <karllinuxtest.relton@ntlworld.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 24b8a9df
...@@ -64,6 +64,7 @@ ...@@ -64,6 +64,7 @@
#define HFA384x_PORTID_MAX ((u16)7) #define HFA384x_PORTID_MAX ((u16)7)
#define HFA384x_NUMPORTS_MAX ((u16)(HFA384x_PORTID_MAX+1)) #define HFA384x_NUMPORTS_MAX ((u16)(HFA384x_PORTID_MAX+1))
#define HFA384x_PDR_LEN_MAX ((u16)512) /* in bytes, from EK */ #define HFA384x_PDR_LEN_MAX ((u16)512) /* in bytes, from EK */
#define HFA384x_PDA_RECS_MAX ((u16)200) /* a guess */
#define HFA384x_PDA_LEN_MAX ((u16)1024) /* in bytes, from EK */ #define HFA384x_PDA_LEN_MAX ((u16)1024) /* in bytes, from EK */
#define HFA384x_SCANRESULT_MAX ((u16)31) #define HFA384x_SCANRESULT_MAX ((u16)31)
#define HFA384x_HSCANRESULT_MAX ((u16)31) #define HFA384x_HSCANRESULT_MAX ((u16)31)
...@@ -882,6 +883,249 @@ typedef union hfa384x_usbin { ...@@ -882,6 +883,249 @@ typedef union hfa384x_usbin {
u8 boguspad[3000]; u8 boguspad[3000];
} __attribute__ ((packed)) hfa384x_usbin_t; } __attribute__ ((packed)) hfa384x_usbin_t;
/*--------------------------------------------------------------------
PD record structures.
--------------------------------------------------------------------*/
typedef struct hfa384x_pdr_pcb_partnum
{
u8 num[8];
} __attribute__ ((packed)) hfa384x_pdr_pcb_partnum_t;
typedef struct hfa384x_pdr_pcb_tracenum
{
u8 num[8];
} __attribute__ ((packed)) hfa384x_pdr_pcb_tracenum_t;
typedef struct hfa384x_pdr_nic_serial
{
u8 num[12];
} __attribute__ ((packed)) hfa384x_pdr_nic_serial_t;
typedef struct hfa384x_pdr_mkk_measurements
{
double carrier_freq;
double occupied_band;
double power_density;
double tx_spur_f1;
double tx_spur_f2;
double tx_spur_f3;
double tx_spur_f4;
double tx_spur_l1;
double tx_spur_l2;
double tx_spur_l3;
double tx_spur_l4;
double rx_spur_f1;
double rx_spur_f2;
double rx_spur_l1;
double rx_spur_l2;
} __attribute__ ((packed)) hfa384x_pdr_mkk_measurements_t;
typedef struct hfa384x_pdr_nic_ramsize
{
u8 size[12]; /* units of KB */
} __attribute__ ((packed)) hfa384x_pdr_nic_ramsize_t;
typedef struct hfa384x_pdr_mfisuprange
{
u16 id;
u16 variant;
u16 bottom;
u16 top;
} __attribute__ ((packed)) hfa384x_pdr_mfisuprange_t;
typedef struct hfa384x_pdr_cfisuprange
{
u16 id;
u16 variant;
u16 bottom;
u16 top;
} __attribute__ ((packed)) hfa384x_pdr_cfisuprange_t;
typedef struct hfa384x_pdr_nicid
{
u16 id;
u16 variant;
u16 major;
u16 minor;
} __attribute__ ((packed)) hfa384x_pdr_nicid_t;
typedef struct hfa384x_pdr_refdac_measurements
{
u16 value[0];
} __attribute__ ((packed)) hfa384x_pdr_refdac_measurements_t;
typedef struct hfa384x_pdr_vgdac_measurements
{
u16 value[0];
} __attribute__ ((packed)) hfa384x_pdr_vgdac_measurements_t;
typedef struct hfa384x_pdr_level_comp_measurements
{
u16 value[0];
} __attribute__ ((packed)) hfa384x_pdr_level_compc_measurements_t;
typedef struct hfa384x_pdr_mac_address
{
u8 addr[6];
} __attribute__ ((packed)) hfa384x_pdr_mac_address_t;
typedef struct hfa384x_pdr_mkk_callname
{
u8 callname[8];
} __attribute__ ((packed)) hfa384x_pdr_mkk_callname_t;
typedef struct hfa384x_pdr_regdomain
{
u16 numdomains;
u16 domain[5];
} __attribute__ ((packed)) hfa384x_pdr_regdomain_t;
typedef struct hfa384x_pdr_allowed_channel
{
u16 ch_bitmap;
} __attribute__ ((packed)) hfa384x_pdr_allowed_channel_t;
typedef struct hfa384x_pdr_default_channel
{
u16 channel;
} __attribute__ ((packed)) hfa384x_pdr_default_channel_t;
typedef struct hfa384x_pdr_privacy_option
{
u16 available;
} __attribute__ ((packed)) hfa384x_pdr_privacy_option_t;
typedef struct hfa384x_pdr_temptype
{
u16 type;
} __attribute__ ((packed)) hfa384x_pdr_temptype_t;
typedef struct hfa384x_pdr_refdac_setup
{
u16 ch_value[14];
} __attribute__ ((packed)) hfa384x_pdr_refdac_setup_t;
typedef struct hfa384x_pdr_vgdac_setup
{
u16 ch_value[14];
} __attribute__ ((packed)) hfa384x_pdr_vgdac_setup_t;
typedef struct hfa384x_pdr_level_comp_setup
{
u16 ch_value[14];
} __attribute__ ((packed)) hfa384x_pdr_level_comp_setup_t;
typedef struct hfa384x_pdr_trimdac_setup
{
u16 trimidac;
u16 trimqdac;
} __attribute__ ((packed)) hfa384x_pdr_trimdac_setup_t;
typedef struct hfa384x_pdr_ifr_setting
{
u16 value[3];
} __attribute__ ((packed)) hfa384x_pdr_ifr_setting_t;
typedef struct hfa384x_pdr_rfr_setting
{
u16 value[3];
} __attribute__ ((packed)) hfa384x_pdr_rfr_setting_t;
typedef struct hfa384x_pdr_hfa3861_baseline
{
u16 value[50];
} __attribute__ ((packed)) hfa384x_pdr_hfa3861_baseline_t;
typedef struct hfa384x_pdr_hfa3861_shadow
{
u32 value[32];
} __attribute__ ((packed)) hfa384x_pdr_hfa3861_shadow_t;
typedef struct hfa384x_pdr_hfa3861_ifrf
{
u32 value[20];
} __attribute__ ((packed)) hfa384x_pdr_hfa3861_ifrf_t;
typedef struct hfa384x_pdr_hfa3861_chcalsp
{
u16 value[14];
} __attribute__ ((packed)) hfa384x_pdr_hfa3861_chcalsp_t;
typedef struct hfa384x_pdr_hfa3861_chcali
{
u16 value[17];
} __attribute__ ((packed)) hfa384x_pdr_hfa3861_chcali_t;
typedef struct hfa384x_pdr_hfa3861_nic_config
{
u16 config_bitmap;
} __attribute__ ((packed)) hfa384x_pdr_nic_config_t;
typedef struct hfa384x_pdr_hfo_delay
{
u8 hfo_delay;
} __attribute__ ((packed)) hfa384x_hfo_delay_t;
typedef struct hfa384x_pdr_hfa3861_manf_testsp
{
u16 value[30];
} __attribute__ ((packed)) hfa384x_pdr_hfa3861_manf_testsp_t;
typedef struct hfa384x_pdr_hfa3861_manf_testi
{
u16 value[30];
} __attribute__ ((packed)) hfa384x_pdr_hfa3861_manf_testi_t;
typedef struct hfa384x_end_of_pda
{
u16 crc;
} __attribute__ ((packed)) hfa384x_pdr_end_of_pda_t;
typedef struct hfa384x_pdrec
{
u16 len; /* in words */
u16 code;
union pdr {
hfa384x_pdr_pcb_partnum_t pcb_partnum;
hfa384x_pdr_pcb_tracenum_t pcb_tracenum;
hfa384x_pdr_nic_serial_t nic_serial;
hfa384x_pdr_mkk_measurements_t mkk_measurements;
hfa384x_pdr_nic_ramsize_t nic_ramsize;
hfa384x_pdr_mfisuprange_t mfisuprange;
hfa384x_pdr_cfisuprange_t cfisuprange;
hfa384x_pdr_nicid_t nicid;
hfa384x_pdr_refdac_measurements_t refdac_measurements;
hfa384x_pdr_vgdac_measurements_t vgdac_measurements;
hfa384x_pdr_level_compc_measurements_t level_compc_measurements;
hfa384x_pdr_mac_address_t mac_address;
hfa384x_pdr_mkk_callname_t mkk_callname;
hfa384x_pdr_regdomain_t regdomain;
hfa384x_pdr_allowed_channel_t allowed_channel;
hfa384x_pdr_default_channel_t default_channel;
hfa384x_pdr_privacy_option_t privacy_option;
hfa384x_pdr_temptype_t temptype;
hfa384x_pdr_refdac_setup_t refdac_setup;
hfa384x_pdr_vgdac_setup_t vgdac_setup;
hfa384x_pdr_level_comp_setup_t level_comp_setup;
hfa384x_pdr_trimdac_setup_t trimdac_setup;
hfa384x_pdr_ifr_setting_t ifr_setting;
hfa384x_pdr_rfr_setting_t rfr_setting;
hfa384x_pdr_hfa3861_baseline_t hfa3861_baseline;
hfa384x_pdr_hfa3861_shadow_t hfa3861_shadow;
hfa384x_pdr_hfa3861_ifrf_t hfa3861_ifrf;
hfa384x_pdr_hfa3861_chcalsp_t hfa3861_chcalsp;
hfa384x_pdr_hfa3861_chcali_t hfa3861_chcali;
hfa384x_pdr_nic_config_t nic_config;
hfa384x_hfo_delay_t hfo_delay;
hfa384x_pdr_hfa3861_manf_testsp_t hfa3861_manf_testsp;
hfa384x_pdr_hfa3861_manf_testi_t hfa3861_manf_testi;
hfa384x_pdr_end_of_pda_t end_of_pda;
} data;
} __attribute__ ((packed)) hfa384x_pdrec_t;
#ifdef __KERNEL__ #ifdef __KERNEL__
/*-------------------------------------------------------------------- /*--------------------------------------------------------------------
--- MAC state structure, argument to all functions -- --- MAC state structure, argument to all functions --
......
...@@ -50,6 +50,14 @@ ...@@ -50,6 +50,14 @@
#define DIDmsg_dot11req_mibget \ #define DIDmsg_dot11req_mibget \
(P80211DID_MKSECTION(1) | \ (P80211DID_MKSECTION(1) | \
P80211DID_MKGROUP(1)) P80211DID_MKGROUP(1))
#define DIDmsg_dot11req_mibget_mibattribute \
(P80211DID_MKSECTION(1) | \
P80211DID_MKGROUP(1) | \
P80211DID_MKITEM(1) | 0x00000000)
#define DIDmsg_dot11req_mibget_resultcode \
(P80211DID_MKSECTION(1) | \
P80211DID_MKGROUP(1) | \
P80211DID_MKITEM(2) | 0x00000000)
#define DIDmsg_dot11req_mibset \ #define DIDmsg_dot11req_mibset \
(P80211DID_MKSECTION(1) | \ (P80211DID_MKSECTION(1) | \
P80211DID_MKGROUP(2)) P80211DID_MKGROUP(2))
...@@ -94,12 +102,48 @@ ...@@ -94,12 +102,48 @@
#define DIDmsg_p2req_readpda \ #define DIDmsg_p2req_readpda \
(P80211DID_MKSECTION(5) | \ (P80211DID_MKSECTION(5) | \
P80211DID_MKGROUP(2)) P80211DID_MKGROUP(2))
#define DIDmsg_p2req_readpda_pda \
(P80211DID_MKSECTION(5) | \
P80211DID_MKGROUP(2) | \
P80211DID_MKITEM(1) | 0x00000000)
#define DIDmsg_p2req_readpda_resultcode \
(P80211DID_MKSECTION(5) | \
P80211DID_MKGROUP(2) | \
P80211DID_MKITEM(2) | 0x00000000)
#define DIDmsg_p2req_ramdl_state \ #define DIDmsg_p2req_ramdl_state \
(P80211DID_MKSECTION(5) | \ (P80211DID_MKSECTION(5) | \
P80211DID_MKGROUP(11)) P80211DID_MKGROUP(11))
#define DIDmsg_p2req_ramdl_state_enable \
(P80211DID_MKSECTION(5) | \
P80211DID_MKGROUP(11) | \
P80211DID_MKITEM(1) | 0x00000000)
#define DIDmsg_p2req_ramdl_state_exeaddr \
(P80211DID_MKSECTION(5) | \
P80211DID_MKGROUP(11) | \
P80211DID_MKITEM(2) | 0x00000000)
#define DIDmsg_p2req_ramdl_state_resultcode \
(P80211DID_MKSECTION(5) | \
P80211DID_MKGROUP(11) | \
P80211DID_MKITEM(3) | 0x00000000)
#define DIDmsg_p2req_ramdl_write \ #define DIDmsg_p2req_ramdl_write \
(P80211DID_MKSECTION(5) | \ (P80211DID_MKSECTION(5) | \
P80211DID_MKGROUP(12)) P80211DID_MKGROUP(12))
#define DIDmsg_p2req_ramdl_write_addr \
(P80211DID_MKSECTION(5) | \
P80211DID_MKGROUP(12) | \
P80211DID_MKITEM(1) | 0x00000000)
#define DIDmsg_p2req_ramdl_write_len \
(P80211DID_MKSECTION(5) | \
P80211DID_MKGROUP(12) | \
P80211DID_MKITEM(2) | 0x00000000)
#define DIDmsg_p2req_ramdl_write_data \
(P80211DID_MKSECTION(5) | \
P80211DID_MKGROUP(12) | \
P80211DID_MKITEM(3) | 0x00000000)
#define DIDmsg_p2req_ramdl_write_resultcode \
(P80211DID_MKSECTION(5) | \
P80211DID_MKGROUP(12) | \
P80211DID_MKITEM(4) | 0x00000000)
#define DIDmsg_p2req_flashdl_state \ #define DIDmsg_p2req_flashdl_state \
(P80211DID_MKSECTION(5) | \ (P80211DID_MKSECTION(5) | \
P80211DID_MKGROUP(13)) P80211DID_MKGROUP(13))
...@@ -203,6 +247,10 @@ ...@@ -203,6 +247,10 @@
(P80211DID_MKSECTION(5) | \ (P80211DID_MKSECTION(5) | \
P80211DID_MKGROUP(2) | \ P80211DID_MKGROUP(2) | \
P80211DID_MKITEM(1) | 0x18000000) P80211DID_MKITEM(1) | 0x18000000)
#define DIDmib_p2_p2NIC_p2PRISupRange \
(P80211DID_MKSECTION(5) | \
P80211DID_MKGROUP(5) | \
P80211DID_MKITEM(6) | 0x10000000)
#define DIDmib_p2_p2MAC \ #define DIDmib_p2_p2MAC \
(P80211DID_MKSECTION(5) | \ (P80211DID_MKSECTION(5) | \
P80211DID_MKGROUP(6)) P80211DID_MKGROUP(6))
......
...@@ -566,8 +566,6 @@ static int p80211knetdev_do_ioctl(netdevice_t *dev, struct ifreq *ifr, int cmd) ...@@ -566,8 +566,6 @@ static int p80211knetdev_do_ioctl(netdevice_t *dev, struct ifreq *ifr, int cmd)
pr_debug("rx'd ioctl, cmd=%d, len=%d\n", cmd, req->len); pr_debug("rx'd ioctl, cmd=%d, len=%d\n", cmd, req->len);
mutex_lock(&wlandev->ioctl_lock);
#ifdef SIOCETHTOOL #ifdef SIOCETHTOOL
if (cmd == SIOCETHTOOL) { if (cmd == SIOCETHTOOL) {
result = result =
...@@ -608,8 +606,6 @@ static int p80211knetdev_do_ioctl(netdevice_t *dev, struct ifreq *ifr, int cmd) ...@@ -608,8 +606,6 @@ static int p80211knetdev_do_ioctl(netdevice_t *dev, struct ifreq *ifr, int cmd)
result = -ENOMEM; result = -ENOMEM;
} }
bail: bail:
mutex_unlock(&wlandev->ioctl_lock);
return result; /* If allocate,copyfrom or copyto fails, return errno */ return result; /* If allocate,copyfrom or copyto fails, return errno */
} }
...@@ -771,11 +767,6 @@ int wlan_setup(wlandevice_t *wlandev) ...@@ -771,11 +767,6 @@ int wlan_setup(wlandevice_t *wlandev)
dev->ml_priv = wlandev; dev->ml_priv = wlandev;
dev->netdev_ops = &p80211_netdev_ops; dev->netdev_ops = &p80211_netdev_ops;
mutex_init(&wlandev->ioctl_lock);
/* block ioctls until fully initialised. Don't forget to call
allow_ioctls at some point!*/
mutex_lock(&wlandev->ioctl_lock);
#if (WIRELESS_EXT < 21) #if (WIRELESS_EXT < 21)
dev->get_wireless_stats = p80211wext_get_wireless_stats; dev->get_wireless_stats = p80211wext_get_wireless_stats;
#endif #endif
...@@ -1116,8 +1107,3 @@ static void p80211knetdev_tx_timeout(netdevice_t *netdev) ...@@ -1116,8 +1107,3 @@ static void p80211knetdev_tx_timeout(netdevice_t *netdev)
netif_wake_queue(wlandev->netdev); netif_wake_queue(wlandev->netdev);
} }
} }
void p80211_allow_ioctls(wlandevice_t *wlandev)
{
mutex_unlock(&wlandev->ioctl_lock);
}
...@@ -227,8 +227,6 @@ typedef struct wlandevice { ...@@ -227,8 +227,6 @@ typedef struct wlandevice {
u8 spy_number; u8 spy_number;
char spy_address[IW_MAX_SPY][ETH_ALEN]; char spy_address[IW_MAX_SPY][ETH_ALEN];
struct iw_quality spy_stat[IW_MAX_SPY]; struct iw_quality spy_stat[IW_MAX_SPY];
struct mutex ioctl_lock;
} wlandevice_t; } wlandevice_t;
/* WEP stuff */ /* WEP stuff */
...@@ -244,5 +242,4 @@ int register_wlandev(wlandevice_t *wlandev); ...@@ -244,5 +242,4 @@ int register_wlandev(wlandevice_t *wlandev);
int unregister_wlandev(wlandevice_t *wlandev); int unregister_wlandev(wlandevice_t *wlandev);
void p80211netdev_rx(wlandevice_t *wlandev, struct sk_buff *skb); void p80211netdev_rx(wlandevice_t *wlandev, struct sk_buff *skb);
void p80211netdev_hwremoved(wlandevice_t *wlandev); void p80211netdev_hwremoved(wlandevice_t *wlandev);
void p80211_allow_ioctls(wlandevice_t *wlandev);
#endif #endif
This diff is collapsed.
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
#include "prism2mgmt.c" #include "prism2mgmt.c"
#include "prism2mib.c" #include "prism2mib.c"
#include "prism2sta.c" #include "prism2sta.c"
#include "prism2fw.c"
#define PRISM_USB_DEVICE(vid, pid, name) \ #define PRISM_USB_DEVICE(vid, pid, name) \
USB_DEVICE(vid, pid), \ USB_DEVICE(vid, pid), \
...@@ -153,15 +154,16 @@ static int prism2sta_probe_usb(struct usb_interface *interface, ...@@ -153,15 +154,16 @@ static int prism2sta_probe_usb(struct usb_interface *interface,
wlandev->msdstate = WLAN_MSD_HWPRESENT; wlandev->msdstate = WLAN_MSD_HWPRESENT;
/* Try and load firmware, then enable card before we register */
prism2_fwtry(dev, wlandev);
prism2sta_ifstate(wlandev, P80211ENUM_ifstate_enable);
if (register_wlandev(wlandev) != 0) { if (register_wlandev(wlandev) != 0) {
printk(KERN_ERR "%s: register_wlandev() failed.\n", dev_info); printk(KERN_ERR "%s: register_wlandev() failed.\n", dev_info);
result = -EIO; result = -EIO;
goto failed; goto failed;
} }
/* enable the card */
prism2sta_ifstate(wlandev, P80211ENUM_ifstate_enable);
goto done; goto done;
failed: failed:
...@@ -170,7 +172,6 @@ static int prism2sta_probe_usb(struct usb_interface *interface, ...@@ -170,7 +172,6 @@ static int prism2sta_probe_usb(struct usb_interface *interface,
wlandev = NULL; wlandev = NULL;
done: done:
p80211_allow_ioctls(wlandev);
usb_set_intfdata(interface, wlandev); usb_set_intfdata(interface, wlandev);
return result; return result;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment