summaryrefslogtreecommitdiffstats
path: root/sys/compat
diff options
context:
space:
mode:
authorwpaul <wpaul@FreeBSD.org>2004-04-05 08:26:52 +0000
committerwpaul <wpaul@FreeBSD.org>2004-04-05 08:26:52 +0000
commite8bf917ce6a49bca55330ad113bf07980c182f8d (patch)
tree057a33cfd484ecc40f229d22b45423b1a969419f /sys/compat
parent8ff01ad78588c2228109302e270b64639208cdee (diff)
downloadFreeBSD-src-e8bf917ce6a49bca55330ad113bf07980c182f8d.zip
FreeBSD-src-e8bf917ce6a49bca55330ad113bf07980c182f8d.tar.gz
- The MiniportReset() function can return NDIS_STATUS_PENDING, in which
case we should wait for the resetdone handler to be called before returning. - When providing resources via ndis_query_resources(), uses the computed rsclen when using bcopy() to copy out the resource data rather than the caller-supplied buffer length. - Avoid using ndis_reset_nic() in if_ndis.c unless we really need to reset the NIC because of a problem. - Allow interrupts to be fielded during ndis_attach(), at least as far as allowing ndis_isr() and ndis_intrhand() to run. - Use ndis_80211_rates_ex when probing for supported rates. Technically, this isn't supposed to work since, although Microsoft added the extended rate structure with the NDIS 5.1 update, the spec still says that the OID_802_11_SUPPORTED_RATES OID uses ndis_80211_rates. In spite of this, it appears some drivers use it anyway. - When adding in our guessed rates, check to see if they already exist so that we avoid any duplicates. - Add a printf() to ndis_open_file() that alerts the user when a driver attempts to open a file under /compat/ndis. With these changes, I can get the driver for the SMC 2802W 54g PCI card to load and run. This board uses a Prism54G chip. Note that in order for this driver to work, you must place the supplied smc2802w.arm firmware image under /compat/ndis. (The firmware is not resident on the device.) Note that this should also allow the 3Com 3CRWE154G72 card to work as well; as far as I can tell, these cards also use a Prism54G chip.
Diffstat (limited to 'sys/compat')
-rw-r--r--sys/compat/ndis/kern_ndis.c34
-rw-r--r--sys/compat/ndis/ndis_var.h2
-rw-r--r--sys/compat/ndis/subr_ndis.c3
3 files changed, 21 insertions, 18 deletions
diff --git a/sys/compat/ndis/kern_ndis.c b/sys/compat/ndis/kern_ndis.c
index eb62ed8..34b7b96 100644
--- a/sys/compat/ndis/kern_ndis.c
+++ b/sys/compat/ndis/kern_ndis.c
@@ -316,7 +316,6 @@ ndis_stop_thread(t)
int t;
{
struct ndis_req *r;
- struct timeval tv;
struct ndisqhead *q;
struct proc *p;
@@ -343,9 +342,7 @@ ndis_stop_thread(t)
/* wait for thread exit */
- tv.tv_sec = 60;
- tv.tv_usec = 0;
- tsleep(r, PPAUSE|PCATCH, "ndisthrexit", tvtohz(&tv));
+ tsleep(r, PPAUSE|PCATCH, "ndisthrexit", hz * 60);
/* Now empty the job list. */
@@ -565,6 +562,7 @@ ndis_resetdone_func(adapter, status, addressingreset)
if (block->nmb_ifp->if_flags & IFF_DEBUG)
device_printf (block->nmb_dev, "reset done...\n");
+ wakeup(block->nmb_ifp);
return;
}
@@ -1035,7 +1033,6 @@ ndis_set_info(arg, oid, buf, buflen)
ndis_handle adapter;
__stdcall ndis_setinfo_handler setfunc;
uint32_t byteswritten = 0, bytesneeded = 0;
- struct timeval tv;
int error;
sc = arg;
@@ -1051,10 +1048,10 @@ ndis_set_info(arg, oid, buf, buflen)
&byteswritten, &bytesneeded);
if (rval == NDIS_STATUS_PENDING) {
- tv.tv_sec = 60;
- tv.tv_usec = 0;
- error = tsleep(&sc->ndis_block.nmb_wkupdpctimer,
- PPAUSE|PCATCH, "ndisset", tvtohz(&tv));
+ PROC_LOCK(curthread->td_proc);
+ error = msleep(&sc->ndis_block.nmb_wkupdpctimer,
+ &curthread->td_proc->p_mtx, PPAUSE|PDROP,
+ "ndisset", 5 * hz);
rval = sc->ndis_block.nmb_setstat;
}
@@ -1211,6 +1208,7 @@ ndis_reset_nic(arg)
__stdcall ndis_reset_handler resetfunc;
uint8_t addressing_reset;
struct ifnet *ifp;
+ int rval;
sc = arg;
ifp = &sc->arpcom.ac_if;
@@ -1221,7 +1219,12 @@ ndis_reset_nic(arg)
if (adapter == NULL || resetfunc == NULL)
return(EIO);
- resetfunc(&addressing_reset, adapter);
+ rval = resetfunc(&addressing_reset, adapter);
+ if (rval == NDIS_STATUS_PENDING) {
+ PROC_LOCK(curthread->td_proc);
+ msleep(sc, &curthread->td_proc->p_mtx,
+ PPAUSE|PDROP, "ndisrst", 0);
+ }
return(0);
}
@@ -1438,7 +1441,6 @@ ndis_get_info(arg, oid, buf, buflen)
ndis_handle adapter;
__stdcall ndis_queryinfo_handler queryfunc;
uint32_t byteswritten = 0, bytesneeded = 0;
- struct timeval tv;
int error;
sc = arg;
@@ -1456,10 +1458,10 @@ ndis_get_info(arg, oid, buf, buflen)
/* Wait for requests that block. */
if (rval == NDIS_STATUS_PENDING) {
- tv.tv_sec = 60;
- tv.tv_usec = 0;
- error = tsleep(&sc->ndis_block.nmb_wkupdpctimer,
- PPAUSE|PCATCH, "ndisget", tvtohz(&tv));
+ PROC_LOCK(curthread->td_proc);
+ error = msleep(&sc->ndis_block.nmb_wkupdpctimer,
+ &curthread->td_proc->p_mtx, PPAUSE|PDROP,
+ "ndisget", 5 * hz);
rval = sc->ndis_block.nmb_getstat;
}
@@ -1503,7 +1505,7 @@ ndis_unload_driver(arg)
return(0);
}
-#define NDIS_LOADED 0x42534F44
+#define NDIS_LOADED htonl(0x42534F44)
int
ndis_load_driver(img, arg)
diff --git a/sys/compat/ndis/ndis_var.h b/sys/compat/ndis/ndis_var.h
index 3c3de04..cd4d82b 100644
--- a/sys/compat/ndis/ndis_var.h
+++ b/sys/compat/ndis/ndis_var.h
@@ -1459,7 +1459,7 @@ typedef ndis_status (*ndis_sendmulti_handler)(ndis_handle,
ndis_packet **, uint32_t);
typedef void (*ndis_isr_handler)(uint8_t *, uint8_t *, ndis_handle);
typedef void (*ndis_interrupt_handler)(ndis_handle);
-typedef void (*ndis_reset_handler)(uint8_t *, ndis_handle);
+typedef int (*ndis_reset_handler)(uint8_t *, ndis_handle);
typedef void (*ndis_halt_handler)(ndis_handle);
typedef void (*ndis_return_handler)(ndis_handle, ndis_packet *);
typedef void (*ndis_enable_interrupts_handler)(ndis_handle);
diff --git a/sys/compat/ndis/subr_ndis.c b/sys/compat/ndis/subr_ndis.c
index ba6f285..38bc6b8 100644
--- a/sys/compat/ndis/subr_ndis.c
+++ b/sys/compat/ndis/subr_ndis.c
@@ -1037,7 +1037,7 @@ ndis_query_resources(status, adapter, list, buflen)
return;
}
- bcopy((char *)block->nmb_rlist, (char *)list, *buflen);
+ bcopy((char *)block->nmb_rlist, (char *)list, rsclen);
*status = NDIS_STATUS_SUCCESS;
return;
}
@@ -2483,6 +2483,7 @@ ndis_open_file(status, filehandle, filelength, filename, highestaddr)
mtx_unlock(&Giant);
*status = NDIS_STATUS_FILE_NOT_FOUND;
free(fh, M_TEMP);
+ printf("NDIS: open file %s failed: %d\n", path, error);
return;
}
OpenPOWER on IntegriCloud