summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sys/compat/ndis/ndis_var.h2
-rw-r--r--sys/compat/ndis/subr_ndis.c16
-rw-r--r--sys/dev/if_ndis/if_ndis.c23
-rw-r--r--sys/dev/if_ndis/if_ndisvar.h3
4 files changed, 30 insertions, 14 deletions
diff --git a/sys/compat/ndis/ndis_var.h b/sys/compat/ndis/ndis_var.h
index f2c3566..2c015a9 100644
--- a/sys/compat/ndis/ndis_var.h
+++ b/sys/compat/ndis/ndis_var.h
@@ -975,6 +975,8 @@ struct ndis_sc_element {
typedef struct ndis_sc_element ndis_sc_element;
#define NDIS_MAXSEG 32
+#define NDIS_BUS_SPACE_SHARED_MAXADDR 0x3E7FFFFF
+
struct ndis_sc_list {
uint32_t nsl_frags;
uint32_t *nsl_rsvd;
diff --git a/sys/compat/ndis/subr_ndis.c b/sys/compat/ndis/subr_ndis.c
index 30def31..243c9dc 100644
--- a/sys/compat/ndis/subr_ndis.c
+++ b/sys/compat/ndis/subr_ndis.c
@@ -1297,8 +1297,22 @@ ndis_alloc_sharedmem(adapter, len, cached, vaddr, paddr)
if (sh == NULL)
return;
+ /*
+ * When performing shared memory allocations, create a tag
+ * with a lowaddr limit that restricts physical memory mappings
+ * so that they all fall within the first 1GB of memory.
+ * At least one device/driver combination (Linksys Instant
+ * Wireless PCI Card V2.7, Broadcom 802.11b) seems to have
+ * problems with performing DMA operations with physical
+ * that lie above the 1GB mark. I don't know if this is a
+ * hardware limitation or if the addresses are being truncated
+ * within the driver, but this seems to be the only way to
+ * make these cards work reliably in systems with more than
+ * 1GB of physical memory.
+ */
+
error = bus_dma_tag_create(sc->ndis_parent_tag, 64,
- 0, BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL,
+ 0, NDIS_BUS_SPACE_SHARED_MAXADDR, BUS_SPACE_MAXADDR, NULL,
NULL, len, 1, len, BUS_DMA_ALLOCNOW, NULL, NULL,
&sh->ndis_stag);
diff --git a/sys/dev/if_ndis/if_ndis.c b/sys/dev/if_ndis/if_ndis.c
index d68d765..60b6096 100644
--- a/sys/dev/if_ndis/if_ndis.c
+++ b/sys/dev/if_ndis/if_ndis.c
@@ -139,7 +139,7 @@ ndis_setmulti(sc)
ifp = &sc->arpcom.ac_if;
- if (!(ifp->if_flags & IFF_UP))
+ if (!NDIS_INITIALIZED(sc))
return;
if (ifp->if_flags & IFF_ALLMULTI || ifp->if_flags & IFF_PROMISC) {
@@ -214,7 +214,7 @@ ndis_set_offload(sc)
ifp = &sc->arpcom.ac_if;
- if (!(ifp->if_flags & IFF_UP))
+ if (!NDIS_INITIALIZED(sc))
return(EINVAL);
/* See if there's anything to set. */
@@ -766,7 +766,7 @@ ndis_suspend(dev)
ifp = &sc->arpcom.ac_if;
#ifdef notdef
- if (ifp->if_flags & IFF_UP)
+ if (NDIS_INITIALIZED(sc))
ndis_stop(sc);
#endif
@@ -783,7 +783,7 @@ ndis_resume(dev)
sc = device_get_softc(dev);
ifp = &sc->arpcom.ac_if;
- if (ifp->if_flags & IFF_UP)
+ if (NDIS_INITIALIZED(sc))
ndis_init(sc);
return(0);
@@ -957,7 +957,7 @@ ndis_linksts_done(adapter)
ifp = block->nmb_ifp;
sc = ifp->if_softc;
- if (!(ifp->if_flags & IFF_UP))
+ if (!NDIS_INITIALIZED(sc))
return;
switch (block->nmb_getstat) {
@@ -1364,7 +1364,7 @@ ndis_ifmedia_upd(ifp)
sc = ifp->if_softc;
- if (ifp->if_flags & IFF_UP)
+ if (NDIS_INITIALIZED(sc))
ndis_init(sc);
return(0);
@@ -1385,12 +1385,11 @@ ndis_ifmedia_sts(ifp, ifmr)
ifmr->ifm_status = IFM_AVALID;
ifmr->ifm_active = IFM_ETHER;
+ sc = ifp->if_softc;
- if (!(ifp->if_flags & IFF_UP))
+ if (!NDIS_INITIALIZED(sc))
return;
- sc = ifp->if_softc;
-
len = sizeof(linkstate);
error = ndis_get_info(sc, OID_GEN_MEDIA_CONNECT_STATUS,
(void *)&linkstate, &len);
@@ -1435,7 +1434,7 @@ ndis_setstate_80211(sc)
ic = &sc->ic;
ifp = &sc->ic.ic_ac.ac_if;
- if (!(ifp->if_flags & IFF_UP))
+ if (!NDIS_INITIALIZED(sc))
return;
/* Set network infrastructure mode. */
@@ -1734,7 +1733,7 @@ ndis_getstate_80211(sc)
ic = &sc->ic;
ifp = &sc->ic.ic_ac.ac_if;
- if (!(ifp->if_flags & IFF_UP))
+ if (!NDIS_INITIALIZED(sc))
return;
if (sc->ndis_link)
@@ -1926,7 +1925,7 @@ ndis_ioctl(ifp, command, data)
break;
case SIOCGIFGENERIC:
case SIOCSIFGENERIC:
- if (sc->ndis_80211 && ifp->if_flags & IFF_UP) {
+ if (sc->ndis_80211 && NDIS_INITIALIZED(sc)) {
if (command == SIOCGIFGENERIC)
error = ndis_wi_ioctl_get(ifp, command, data);
else
diff --git a/sys/dev/if_ndis/if_ndisvar.h b/sys/dev/if_ndis/if_ndisvar.h
index 88a6361..4560e34 100644
--- a/sys/dev/if_ndis/if_ndisvar.h
+++ b/sys/dev/if_ndis/if_ndisvar.h
@@ -62,6 +62,8 @@ struct ndis_cfglist {
TAILQ_HEAD(nch, ndis_cfglist);
+#define NDIS_INITIALIZED(sc) (sc->ndis_block.nmb_miniportadapterctx != NULL)
+
#define NDIS_INC(x) \
(x)->ndis_txidx = ((x)->ndis_txidx + 1) % (x)->ndis_maxpkts
@@ -131,4 +133,3 @@ struct ndis_softc {
#define NDIS_LOCK(_sc) mtx_lock(&(_sc)->ndis_mtx)
#define NDIS_UNLOCK(_sc) mtx_unlock(&(_sc)->ndis_mtx)
-
OpenPOWER on IntegriCloud