5 #include <linux/kernel.h>
6 #include <linux/device.h>
7 #include <linux/if_arp.h>
9 #include <linux/wireless.h>
17 #define SYMBOL_MAX_VER_LEN (14)
20 #define TX_NICBUF_SIZE_BUG 1585
43 #define BITRATE_TABLE_SIZE ARRAY_SIZE(bitrate_table)
50 static inline enum fwtype determine_firmware_type(
struct comp_id *nic_id)
52 if (nic_id->
id < 0x8000)
54 else if (nic_id->
id == 0x8000 && nic_id->
major == 0)
70 char *
fw_name,
size_t fw_name_len,
83 dev_err(dev,
"Cannot read hardware identity: error %d\n",
92 dev_info(dev,
"Hardware identity %04x:%04x:%04x:%04x\n",
96 *hw_ver = (((nic_id.
id & 0xff) << 24) |
97 ((nic_id.
variant & 0xff) << 16) |
98 ((nic_id.
major & 0xff) << 8) |
99 (nic_id.
minor & 0xff));
106 dev_err(dev,
"Cannot read station identity: error %d\n",
115 dev_info(dev,
"Station identity %04x:%04x:%04x:%04x\n",
120 dev_err(dev,
"Primary firmware is active\n");
123 dev_err(dev,
"Tertiary firmware is active\n");
129 dev_notice(dev,
"Unknown station ID, please report\n");
152 snprintf(fw_name, fw_name_len,
"Lucent/Agere %d.%02d",
157 priv->
has_ibss = (firmver >= 0x60006);
158 priv->
has_wep = (firmver >= 0x40020);
161 priv->
has_mwo = (firmver >= 0x60000);
162 priv->
has_pm = (firmver >= 0x40020);
169 priv->
has_wpa = (firmver >= 0x9002a);
184 dev_warn(dev,
"Error %d reading Symbol firmware info. "
185 "Wildly guessing capabilities...\n", err);
193 firmver = ((
tmp[1] -
'0') << 16)
194 | ((
tmp[3] -
'0') << 12)
195 | ((
tmp[4] -
'0') << 8)
196 | ((
tmp[6] -
'0') << 4)
205 priv->
has_ibss = (firmver >= 0x20000);
206 priv->
has_wep = (firmver >= 0x15012);
208 priv->
has_pm = (firmver >= 0x20000 && firmver < 0x22000) ||
209 (firmver >= 0x29000 && firmver < 0x30000) ||
229 (firmver >= 0x30000 && firmver <= 0x31000);
231 (firmver >= 0x29057 && firmver < 0x30000);
242 snprintf(fw_name, fw_name_len,
"Intersil %d.%d.%d",
245 firmver = ((
unsigned long)sta_id.
major << 16) |
248 priv->
has_ibss = (firmver >= 0x000700);
250 priv->
has_pm = (firmver >= 0x000700);
253 if (firmver >= 0x000800)
256 dev_notice(dev,
"Intersil firmware earlier than v0.8.x"
257 " - several features not supported\n");
263 dev_info(dev,
"Firmware determined as %s\n", fw_name);
265 #ifndef CONFIG_HERMES_PRISM
267 dev_err(dev,
"Support for Prism chipset is not enabled\n");
292 dev_warn(dev,
"Failed to read MAC address!\n");
296 dev_dbg(dev,
"MAC address %pM\n", dev_addr);
300 sizeof(nickbuf), &reclen, &nickbuf);
302 dev_err(dev,
"failed to read station name\n");
310 priv->
nick[len] =
'\0';
318 dev_err(dev,
"Failed to read channel list!\n");
332 dev_err(dev,
"Failed to read RTS threshold!\n");
338 err = hermes_read_wordrec(hw,
USER_BAP,
342 err = hermes_read_wordrec(hw,
USER_BAP,
346 dev_err(dev,
"Failed to read fragmentation settings!\n");
354 err = hermes_read_wordrec(hw,
USER_BAP,
358 dev_err(dev,
"Failed to read power management "
362 err = hermes_read_wordrec(hw,
USER_BAP,
366 dev_err(dev,
"Failed to read power management "
374 err = hermes_read_wordrec(hw,
USER_BAP,
378 dev_err(dev,
"Failed to read preamble setup\n");
387 dev_err(dev,
"Failed to read short retry limit\n");
394 dev_err(dev,
"Failed to read long retry limit\n");
401 dev_err(dev,
"Failed to read max retry lifetime\n");
422 dev_warn(dev,
"Firmware ALLOC bug detected "
423 "(old Symbol firmware?). Work around %s\n",
424 err ?
"failed!" :
"ok.");
435 if ((bitrate != 10) && (bitrate != 20) &&
436 (bitrate != 55) && (bitrate != 110))
440 if ((bitrate_table[i].bitrate == bitrate) &&
441 (bitrate_table[i].automatic == automatic)) {
453 *bitrate = bitrate_table[ratemode].bitrate * 100000;
454 *automatic = bitrate_table[ratemode].automatic;
485 err = hermes_write_wordrec(hw,
USER_BAP,
500 "ESSID in IBSS-Ad-Hoc mode.\n", dev->
name);
509 err = hermes_write_wordrec(hw,
USER_BAP,
562 err = hermes_write_wordrec(hw,
USER_BAP,
567 "Disabling sensitivity control\n",
585 err = hermes_write_wordrec(hw,
USER_BAP,
589 err = hermes_write_wordrec(hw,
USER_BAP,
608 err = hermes_write_wordrec(hw,
USER_BAP,
617 err = hermes_write_wordrec(hw,
USER_BAP,
625 err = hermes_write_wordrec(hw,
USER_BAP,
633 err = hermes_write_wordrec(hw,
USER_BAP,
645 err = hermes_write_wordrec(hw,
USER_BAP,
696 if ((key < 0) || (key >= 4))
700 sizeof(tsc_arr),
NULL, &tsc_arr);
702 memcpy(tsc, &tsc_arr[key][0],
sizeof(tsc_arr[0]));
715 priv->
ndev->name, ratemode);
721 err = hermes_write_wordrec(hw,
USER_BAP,
727 err = hermes_write_wordrec(hw,
USER_BAP,
745 err = hermes_read_wordrec(hw,
USER_BAP,
760 *bitrate = val * 1000000;
766 *bitrate = bitrate_table[
i].bitrate * 100000;
770 if (i >= BITRATE_TABLE_SIZE) {
771 printk(
KERN_INFO "%s: Unable to determine current bitrate (0x%04hx)\n",
772 priv->
ndev->name, val);
801 err = hermes_write_wordrec(hw,
USER_BAP,
830 memset(&keys, 0,
sizeof(keys));
848 err = hermes_write_wordrec(hw,
USER_BAP,
880 priv->
keys[i].key_len);
891 err = hermes_write_wordrec(hw,
USER_BAP,
931 err = hermes_write_wordrec(hw,
USER_BAP,
935 err = hermes_write_wordrec(hw,
USER_BAP,
943 err = hermes_write_wordrec(hw,
USER_BAP,
962 err = hermes_write_wordrec(hw,
USER_BAP,
974 err = hermes_write_wordrec(hw,
USER_BAP,
992 u8 *
tsc,
size_t tsc_len)
1015 sizeof(buf.key) +
sizeof(buf.tx_mic) +
sizeof(buf.rx_mic));
1017 if (rsc_len >
sizeof(buf.rsc))
1018 rsc_len =
sizeof(buf.rsc);
1020 if (tsc_len >
sizeof(buf.tsc))
1021 tsc_len =
sizeof(buf.tsc);
1023 memset(buf.rsc, 0,
sizeof(buf.rsc));
1024 memset(buf.tsc, 0,
sizeof(buf.tsc));
1027 memcpy(buf.rsc, rsc, rsc_len);
1030 memcpy(buf.tsc, tsc, tsc_len);
1035 for (k = 100; k > 0; k--) {
1039 if (ret || !xmitting)
1050 return ret ? ret :
err;
1058 err = hermes_write_wordrec(hw,
USER_BAP,
1063 priv->
ndev->name, err, key_idx);
1069 int mc_count,
int promisc)
1075 err = hermes_write_wordrec(hw,
USER_BAP,
1080 priv->
ndev->name, err);
1088 if (!promisc && (mc_count || priv->
mc_count)) {
1105 priv->
ndev->name, err);
1119 char *
p = (
char *)(&essidbuf.
val);
1121 unsigned long flags;
1123 if (orinoco_lock(priv, &flags) != 0)
1141 err = hw->
ops->read_ltv(hw,
USER_BAP, rid,
sizeof(essidbuf),
1149 sizeof(essidbuf),
NULL, &essidbuf);
1162 orinoco_unlock(priv, &flags);
1173 unsigned long flags;
1175 if (orinoco_lock(priv, &flags) != 0)
1191 priv->
ndev->name, channel);
1196 freq = ieee80211_dsss_chan_to_freq(channel);
1199 orinoco_unlock(priv, &flags);
1203 return err ? err :
freq;
1207 int *numrates,
s32 *rates,
int max)
1211 unsigned char *
p = (
unsigned char *)&list.
val;
1215 unsigned long flags;
1217 if (orinoco_lock(priv, &
flags) != 0)
1221 sizeof(list),
NULL, &list);
1222 orinoco_unlock(priv, &
flags);
1231 for (
i = 0;
i <
num;
i++)
1232 rates[
i] = (p[
i] & 0x7f) * 500000;
1242 unsigned long flags;
1245 if (orinoco_lock(priv, &flags) != 0)
1249 if (!netif_running(dev)) {
1265 err = hermes_write_wordrec(hw,
USER_BAP,
1293 err = hermes_write_wordrec(hw,
USER_BAP,
1300 err = hermes_write_wordrec(hw,
USER_BAP,
1306 err = hermes_inquire(hw,
1317 orinoco_unlock(priv, &flags);