Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/pci Sync with OpenBSD if_iwm.c rev.1.18.
details: https://anonhg.NetBSD.org/src/rev/419d25ecaaf0
branches: trunk
changeset: 336115:419d25ecaaf0
user: nonaka <nonaka%NetBSD.org@localhost>
date: Fri Feb 13 17:14:06 2015 +0000
description:
Sync with OpenBSD if_iwm.c rev.1.18.
diffstat:
sys/dev/pci/if_iwm.c | 448 +++++++++++++++++++++++------------------------
sys/dev/pci/if_iwmvar.h | 3 +-
2 files changed, 220 insertions(+), 231 deletions(-)
diffs (truncated from 1056 to 300 lines):
diff -r e1204dbc93dd -r 419d25ecaaf0 sys/dev/pci/if_iwm.c
--- a/sys/dev/pci/if_iwm.c Fri Feb 13 17:13:20 2015 +0000
+++ b/sys/dev/pci/if_iwm.c Fri Feb 13 17:14:06 2015 +0000
@@ -1,5 +1,5 @@
-/* $NetBSD: if_iwm.c,v 1.1 2015/02/07 13:20:00 pooka Exp $ */
-/* OpenBSD: if_iwm.c,v 1.3 2015/02/07 07:10:44 phessler Exp */
+/* $NetBSD: if_iwm.c,v 1.2 2015/02/13 17:14:06 nonaka Exp $ */
+/* OpenBSD: if_iwm.c,v 1.18 2015/02/11 01:12:42 brad Exp */
/*
* Copyright (c) 2014 genua mbh <info%genua.de@localhost>
@@ -105,7 +105,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_iwm.c,v 1.1 2015/02/07 13:20:00 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_iwm.c,v 1.2 2015/02/13 17:14:06 nonaka Exp $");
#include <sys/param.h>
#include <sys/conf.h>
@@ -173,6 +173,7 @@
};
#define IWM_NUM_2GHZ_CHANNELS 14
+/* It looks like 11a TX is broken, unfortunately. */
#define IWM_NO_5GHZ 1
const struct iwm_rate {
@@ -198,18 +199,6 @@
#define IWM_RIDX_IS_CCK(_i_) ((_i_) < IWM_RIDX_OFDM)
#define IWM_RIDX_IS_OFDM(_i_) ((_i_) >= IWM_RIDX_OFDM)
-/*
- * Supported rates for 802.11a/b/g modes (in 500Kbps unit).
- */
-const struct ieee80211_rateset iwm_rateset_11a =
- { 8, { 12, 18, 24, 36, 48, 72, 96, 108 } };
-
-const struct ieee80211_rateset iwm_rateset_11b =
- { 4, { 2, 4, 11, 22 } };
-
-const struct ieee80211_rateset iwm_rateset_11g =
- { 12, { 2, 4, 11, 22, 12, 18, 24, 36, 48, 72, 96, 108 } };
-
struct iwm_newstate_state {
struct work ns_wk;
struct ieee80211com *ns_ic;
@@ -409,7 +398,9 @@
void iwm_watchdog(struct ifnet *);
int iwm_ioctl(struct ifnet *, u_long, void *);
const char *iwm_desc_lookup(uint32_t);
+#ifdef IWM_DEBUG
void iwm_nic_error(struct iwm_softc *);
+#endif
void iwm_notif_intr(struct iwm_softc *);
int iwm_intr(void *);
int iwm_preinit(struct iwm_softc *);
@@ -579,8 +570,8 @@
uint32_t ucode_type = le32toh(def_calib->ucode_type);
if (ucode_type >= IWM_UCODE_TYPE_MAX) {
- printf("%s: Wrong ucode_type %u for default "
- "calibration.\n", DEVNAME(sc), ucode_type);
+ DPRINTF(("%s: Wrong ucode_type %u for default "
+ "calibration.\n", DEVNAME(sc), ucode_type));
return EINVAL;
}
@@ -600,7 +591,8 @@
struct iwm_ucode_tlv tlv;
enum iwm_ucode_tlv_type tlv_type;
uint8_t *data;
- int error, status, len;
+ int error, status;
+ size_t len;
if (fw->fw_status == IWM_FW_STATUS_NONE) {
fw->fw_status = IWM_FW_STATUS_INPROGRESS;
@@ -612,10 +604,6 @@
if (status == IWM_FW_STATUS_DONE)
return 0;
- else if (status < 0)
- return -status;
-
- KASSERT(status == IWM_FW_STATUS_INPROGRESS);
/*
* Load firmware into driver memory.
@@ -623,8 +611,8 @@
*/
error = iwm_firmload(sc);
if (error != 0) {
- printf("%s: could not read firmware %s\n",
- DEVNAME(sc), sc->sc_fwname);
+ printf("%s: could not read firmware %s (error %d)\n",
+ DEVNAME(sc), sc->sc_fwname, error);
goto out;
}
@@ -646,7 +634,7 @@
len = fw->fw_rawsize - sizeof(*uhdr);
while (len >= sizeof(tlv)) {
- uint32_t tlv_len;
+ size_t tlv_len;
void *tlv_data;
memcpy(&tlv, data, sizeof(tlv));
@@ -658,7 +646,8 @@
tlv_data = data;
if (len < tlv_len) {
- printf("%s: firmware image invalid length\n", DEVNAME(sc));
+ printf("%s: firmware too short: %zu bytes\n",
+ DEVNAME(sc), len);
error = EINVAL;
goto parse_out;
}
@@ -673,8 +662,8 @@
= le32toh(*(uint32_t *)tlv_data);
/* limit it to something sensible */
if (sc->sc_capa_max_probe_len > (1<<16)) {
- printf("%s: IWM_UCODE_TLV_PROBE_MAX_LEN "
- "ridiculous\n", DEVNAME(sc));
+ DPRINTF(("%s: IWM_UCODE_TLV_PROBE_MAX_LEN "
+ "ridiculous\n", DEVNAME(sc)));
error = EINVAL;
goto parse_out;
}
@@ -715,8 +704,8 @@
goto parse_out;
}
if (le32toh(*(uint32_t*)tlv_data) != 1) {
- printf("%s: driver supports "
- "only TLV_NUM_OF_CPU == 1", DEVNAME(sc));
+ DPRINTF(("%s: driver supports "
+ "only TLV_NUM_OF_CPU == 1", DEVNAME(sc)));
error = EINVAL;
goto parse_out;
}
@@ -758,8 +747,8 @@
break;
default:
- printf("%s: unknown firmware section %d, abort\n",
- DEVNAME(sc), tlv_type);
+ DPRINTF(("%s: unknown firmware section %d, abort\n",
+ DEVNAME(sc), tlv_type));
error = EINVAL;
goto parse_out;
}
@@ -782,12 +771,10 @@
}
out:
- if (error) {
- KASSERT(error > 0);
- fw->fw_status = -error;
- } else {
+ if (error)
+ fw->fw_status = IWM_FW_STATUS_NONE;
+ else
fw->fw_status = IWM_FW_STATUS_DONE;
- }
wakeup(&sc->sc_fw);
if (error) {
@@ -841,7 +828,7 @@
int
iwm_write_mem(struct iwm_softc *sc, uint32_t addr, const void *buf, int dwords)
{
- int offs, ret = 0;
+ int offs;
const uint32_t *vals = buf;
if (iwm_nic_lock(sc)) {
@@ -853,11 +840,10 @@
}
iwm_nic_unlock(sc);
} else {
- /* let's just say that it's good to notice this failure */
- printf("%s: WARNING: write_mem failed\n", DEVNAME(sc));
- ret = EBUSY;
- }
- return ret;
+ DPRINTF(("%s: write_mem failed\n", DEVNAME(sc)));
+ return EBUSY;
+ }
+ return 0;
}
int
@@ -1104,7 +1090,6 @@
}
if ((error = iwm_rx_addbuf(sc, IWM_RBUF_SIZE, i)) != 0) {
- printf("%s: could not add mbuf to ring", DEVNAME(sc));
goto fail;
}
}
@@ -1127,10 +1112,6 @@
break;
DELAY(10);
}
- if (ntries == 1000) {
- printf("%s: unable to detect idle rx chan after "
- "reset\n", DEVNAME(sc));
- }
iwm_nic_unlock(sc);
}
ring->cur = 0;
@@ -1468,7 +1449,8 @@
if (!iwm_poll_bit(sc, IWM_CSR_GP_CNTRL,
IWM_CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY,
IWM_CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, 25000)) {
- printf("%s: Failed to init the card\n", DEVNAME(sc));
+ printf("%s: timeout waiting for clock stabilization\n",
+ DEVNAME(sc));
goto out;
}
@@ -1527,7 +1509,7 @@
if (!iwm_poll_bit(sc, IWM_CSR_RESET,
IWM_CSR_RESET_REG_FLAG_MASTER_DISABLED,
IWM_CSR_RESET_REG_FLAG_MASTER_DISABLED, 100))
- printf("%s: Master Disable Timed Out, 100 usec\n", DEVNAME(sc));
+ printf("%s: timeout waiting for master\n", DEVNAME(sc));
DPRINTF(("iwm apm stop\n"));
}
@@ -1587,10 +1569,6 @@
break;
DELAY(20);
}
- if (ntries == 200) {
- printf("%s: unable to detect idle tx "
- "chan after reset\n", DEVNAME(sc));
- }
}
iwm_nic_unlock(sc);
}
@@ -1807,8 +1785,8 @@
iwm_enable_txq(struct iwm_softc *sc, int qid, int fifo)
{
if (!iwm_nic_lock(sc)) {
- printf("%s: cannot enable txq %d\n", DEVNAME(sc), qid);
- return;
+ DPRINTF(("%s: cannot enable txq %d\n", DEVNAME(sc), qid));
+ return; /* XXX return EBUSY */
}
/* unactivate before configuration */
@@ -1856,7 +1834,7 @@
return EBUSY;
if (sc->sched_base != iwm_read_prph(sc, IWM_SCD_SRAM_BASE_ADDR)) {
- printf("%s: sched addr mismatch", DEVNAME(sc));
+ DPRINTF(("%s: sched addr mismatch", DEVNAME(sc)));
error = EINVAL;
goto out;
}
@@ -2150,8 +2128,8 @@
/* Send the requested PHY DB section */
err = iwm_send_phy_db_cmd(sc, type, entry->size, entry->data);
if (err) {
- printf("%s: Can't SEND phy_db section %d (%d), err %d",
- DEVNAME(sc), type, i, err);
+ DPRINTF(("%s: Can't SEND phy_db section %d (%d), "
+ "err %d\n", DEVNAME(sc), type, i, err));
return err;
}
@@ -2173,29 +2151,30 @@
/* Send PHY DB CFG section */
err = iwm_phy_db_get_section_data(sc, IWM_PHY_DB_CFG, &data, &size, 0);
if (err) {
- printf("%s: Cannot get Phy DB cfg section\n", DEVNAME(sc));
+ DPRINTF(("%s: Cannot get Phy DB cfg section, %d\n",
+ DEVNAME(sc), err));
return err;
}
err = iwm_send_phy_db_cmd(sc, IWM_PHY_DB_CFG, size, data);
if (err) {
- printf("%s: Cannot send HCMD of Phy DB cfg section\n",
- DEVNAME(sc));
+ DPRINTF(("%s: Cannot send HCMD of Phy DB cfg section, %d\n",
+ DEVNAME(sc), err));
return err;
}
err = iwm_phy_db_get_section_data(sc, IWM_PHY_DB_CALIB_NCH,
&data, &size, 0);
if (err) {
- printf("%s: Cannot get Phy DB non specific channel section\n",
- DEVNAME(sc));
+ DPRINTF(("%s: Cannot get Phy DB non specific channel section, "
+ "%d\n", DEVNAME(sc), err));
return err;
Home |
Main Index |
Thread Index |
Old Index