summaryrefslogtreecommitdiffstats
path: root/sys/compat/ndis/kern_ndis.c
diff options
context:
space:
mode:
authorwpaul <wpaul@FreeBSD.org>2004-02-07 06:44:13 +0000
committerwpaul <wpaul@FreeBSD.org>2004-02-07 06:44:13 +0000
commitfe7c8eefc3547f53401867e00dfc83a66bb130b7 (patch)
tree41bad94309044d1fa9579a2ebc2a9789d0cc8029 /sys/compat/ndis/kern_ndis.c
parent7720bf145ae3e83333c2c7a38300817781c0de19 (diff)
downloadFreeBSD-src-fe7c8eefc3547f53401867e00dfc83a66bb130b7.zip
FreeBSD-src-fe7c8eefc3547f53401867e00dfc83a66bb130b7.tar.gz
Add a whole bunch of new stuff to make the driver for the AMD Am1771/Am1772
802.11b chipset work. This chip is present on the SMC2602W version 3 NIC, which is what was used for testing. This driver creates kernel threads (12 of them!) for various purposes, and required the following routines: PsCreateSystemThread() PsTerminateSystemThread() KeInitializeEvent() KeSetEvent() KeResetEvent() KeInitializeMutex() KeReleaseMutex() KeWaitForSingleObject() KeWaitForMultipleObjects() IoGetDeviceProperty() and several more. Also, this driver abuses the fact that NDIS events and timers are actually Windows events and timers, and uses NDIS events with KeWaitForSingleObject(). The NDIS event routines have been rewritten to interface with the ntoskrnl module. Many routines with incorrect prototypes have been cleaned up. Also, this driver puts jobs on the NDIS taskqueue (via NdisScheduleWorkItem()) which block on events, and this interferes with the operation of NdisMAllocateSharedMemoryAsync(), which was also being put on the NDIS taskqueue. To avoid the deadlock, NdisMAllocateSharedMemoryAsync() is now performed in the NDIS SWI thread instead. There's still room for some cleanups here, and I really should implement KeInitializeTimer() and friends.
Diffstat (limited to 'sys/compat/ndis/kern_ndis.c')
-rw-r--r--sys/compat/ndis/kern_ndis.c39
1 files changed, 17 insertions, 22 deletions
diff --git a/sys/compat/ndis/kern_ndis.c b/sys/compat/ndis/kern_ndis.c
index 98b9c91..9ce8132 100644
--- a/sys/compat/ndis/kern_ndis.c
+++ b/sys/compat/ndis/kern_ndis.c
@@ -71,9 +71,9 @@ __FBSDID("$FreeBSD$");
#include <compat/ndis/pe_var.h>
#include <compat/ndis/resource_var.h>
+#include <compat/ndis/ntoskrnl_var.h>
#include <compat/ndis/ndis_var.h>
#include <compat/ndis/hal_var.h>
-#include <compat/ndis/ntoskrnl_var.h>
#include <compat/ndis/cfg_var.h>
#include <dev/if_ndis/if_ndisvar.h>
@@ -1444,7 +1444,6 @@ ndis_load_driver(img, arg)
image_optional_header opt_hdr;
image_import_descriptor imp_desc;
ndis_unicode_string dummystr;
- ndis_driver_object drv;
ndis_miniport_block *block;
ndis_status status;
int idx;
@@ -1487,23 +1486,10 @@ ndis_load_driver(img, arg)
pe_get_optional_header(img, &opt_hdr);
entry = (driver_entry)pe_translate_addr(img, opt_hdr.ioh_entryaddr);
- /*
- * Now call the DriverEntry() routine. This will cause
- * a callout to the NdisInitializeWrapper() and
- * NdisMRegisterMiniport() routines.
- */
- dummystr.nus_len = strlen(NDIS_DUMMY_PATH);
- dummystr.nus_maxlen = strlen(NDIS_DUMMY_PATH);
+ dummystr.nus_len = strlen(NDIS_DUMMY_PATH) * 2;
+ dummystr.nus_maxlen = strlen(NDIS_DUMMY_PATH) * 2;
dummystr.nus_buf = NULL;
ndis_ascii_to_unicode(NDIS_DUMMY_PATH, &dummystr.nus_buf);
- drv.ndo_ifname = "ndis0";
-
- status = entry(&drv, &dummystr);
-
- free (dummystr.nus_buf, M_DEVBUF);
-
- if (status != NDIS_STATUS_SUCCESS)
- return(ENODEV);
/*
* Now that we have the miniport driver characteristics,
@@ -1513,12 +1499,8 @@ ndis_load_driver(img, arg)
*/
block = &sc->ndis_block;
- bcopy((char *)&drv.ndo_chars, (char *)&sc->ndis_chars,
- sizeof(ndis_miniport_characteristics));
- /*block->nmb_signature = 0xcafebabe;*/
-
- ptr = (uint32_t *)block;
+ ptr = (uint32_t *)block;
for (idx = 0; idx < sizeof(ndis_miniport_block) / 4; idx++) {
*ptr = idx | 0xdead0000;
ptr++;
@@ -1535,6 +1517,19 @@ ndis_load_driver(img, arg)
block->nmb_ifp = &sc->arpcom.ac_if;
block->nmb_dev = sc->ndis_dev;
block->nmb_img = img;
+ block->nmb_devobj.do_rsvd = block;
+
+ /*
+ * Now call the DriverEntry() routine. This will cause
+ * a callout to the NdisInitializeWrapper() and
+ * NdisMRegisterMiniport() routines.
+ */
+ status = entry(&block->nmb_devobj, &dummystr);
+
+ free (dummystr.nus_buf, M_DEVBUF);
+
+ if (status != NDIS_STATUS_SUCCESS)
+ return(ENODEV);
ndis_enlarge_thrqueue(8);
OpenPOWER on IntegriCloud