Deleted Added
full compact
subr_ndis.c (144888) subr_ndis.c (145485)
1/*-
2 * Copyright (c) 2003
3 * Bill Paul <wpaul@windriver.com>. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 17 unchanged lines hidden (view full) ---

26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
30 * THE POSSIBILITY OF SUCH DAMAGE.
31 */
32
33#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2003
3 * Bill Paul <wpaul@windriver.com>. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 17 unchanged lines hidden (view full) ---

26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
30 * THE POSSIBILITY OF SUCH DAMAGE.
31 */
32
33#include <sys/cdefs.h>
34__FBSDID("$FreeBSD: head/sys/compat/ndis/subr_ndis.c 144888 2005-04-11 02:02:35Z wpaul $");
34__FBSDID("$FreeBSD: head/sys/compat/ndis/subr_ndis.c 145485 2005-04-24 20:21:22Z wpaul $");
35
36/*
37 * This file implements a translation layer between the BSD networking
38 * infrasturcture and Windows(R) NDIS network driver modules. A Windows
39 * NDIS driver calls into several functions in the NDIS.SYS Windows
40 * kernel module and exports a table of functions designed to be called
41 * by the NDIS subsystem. Using the PE loader, we can patch our own
42 * versions of the NDIS routines into a given Windows driver module and

--- 51 unchanged lines hidden (view full) ---

94
95#include <net80211/ieee80211_var.h>
96#include <net80211/ieee80211_ioctl.h>
97
98#include <dev/pci/pcireg.h>
99#include <dev/pci/pcivar.h>
100
101#include <compat/ndis/pe_var.h>
35
36/*
37 * This file implements a translation layer between the BSD networking
38 * infrasturcture and Windows(R) NDIS network driver modules. A Windows
39 * NDIS driver calls into several functions in the NDIS.SYS Windows
40 * kernel module and exports a table of functions designed to be called
41 * by the NDIS subsystem. Using the PE loader, we can patch our own
42 * versions of the NDIS routines into a given Windows driver module and

--- 51 unchanged lines hidden (view full) ---

94
95#include <net80211/ieee80211_var.h>
96#include <net80211/ieee80211_ioctl.h>
97
98#include <dev/pci/pcireg.h>
99#include <dev/pci/pcivar.h>
100
101#include <compat/ndis/pe_var.h>
102#include <compat/ndis/cfg_var.h>
102#include <compat/ndis/resource_var.h>
103#include <compat/ndis/ntoskrnl_var.h>
104#include <compat/ndis/hal_var.h>
105#include <compat/ndis/ndis_var.h>
103#include <compat/ndis/resource_var.h>
104#include <compat/ndis/ntoskrnl_var.h>
105#include <compat/ndis/hal_var.h>
106#include <compat/ndis/ndis_var.h>
106#include <compat/ndis/cfg_var.h>
107#include <dev/if_ndis/if_ndisvar.h>
108
109static char ndis_filepath[MAXPATHLEN];
110extern struct nd_head ndis_devhead;
111
112SYSCTL_STRING(_hw, OID_AUTO, ndis_filepath, CTLFLAG_RW, ndis_filepath,
113 MAXPATHLEN, "Path used by NdisOpenFile() to search for files");
114

--- 894 unchanged lines hidden (view full) ---

1009 char *str = NULL, *ustr = NULL;
1010 uint16_t flags;
1011 char msgbuf[ERRMSGLEN];
1012 device_t dev;
1013 driver_object *drv;
1014
1015 block = (ndis_miniport_block *)adapter;
1016 dev = block->nmb_physdeviceobj->do_devext;
107#include <dev/if_ndis/if_ndisvar.h>
108
109static char ndis_filepath[MAXPATHLEN];
110extern struct nd_head ndis_devhead;
111
112SYSCTL_STRING(_hw, OID_AUTO, ndis_filepath, CTLFLAG_RW, ndis_filepath,
113 MAXPATHLEN, "Path used by NdisOpenFile() to search for files");
114

--- 894 unchanged lines hidden (view full) ---

1009 char *str = NULL, *ustr = NULL;
1010 uint16_t flags;
1011 char msgbuf[ERRMSGLEN];
1012 device_t dev;
1013 driver_object *drv;
1014
1015 block = (ndis_miniport_block *)adapter;
1016 dev = block->nmb_physdeviceobj->do_devext;
1017 drv = block->nmb_physdeviceobj->do_drvobj;
1017 drv = block->nmb_deviceobj->do_drvobj;
1018
1019 error = pe_get_message((vm_offset_t)drv->dro_driverstart,
1020 code, &str, &i, &flags);
1021 if (error == 0 && flags & MESSAGE_RESOURCE_UNICODE) {
1022 ustr = msgbuf;
1023 ndis_unicode_to_ascii((uint16_t *)str,
1024 ((i / 2)) > (ERRMSGLEN - 1) ? ERRMSGLEN : i, &ustr);
1025 str = ustr;

--- 231 unchanged lines hidden (view full) ---

1257 */
1258
1259static void
1260NdisMCancelTimer(timer, cancelled)
1261 ndis_timer *timer;
1262 uint8_t *cancelled;
1263{
1264 *cancelled = KeCancelTimer(&timer->nt_ktimer);
1018
1019 error = pe_get_message((vm_offset_t)drv->dro_driverstart,
1020 code, &str, &i, &flags);
1021 if (error == 0 && flags & MESSAGE_RESOURCE_UNICODE) {
1022 ustr = msgbuf;
1023 ndis_unicode_to_ascii((uint16_t *)str,
1024 ((i / 2)) > (ERRMSGLEN - 1) ? ERRMSGLEN : i, &ustr);
1025 str = ustr;

--- 231 unchanged lines hidden (view full) ---

1257 */
1258
1259static void
1260NdisMCancelTimer(timer, cancelled)
1261 ndis_timer *timer;
1262 uint8_t *cancelled;
1263{
1264 *cancelled = KeCancelTimer(&timer->nt_ktimer);
1265
1266 return;
1267}
1268
1269static void
1270NdisMQueryAdapterResources(status, adapter, list, buflen)
1271 ndis_status *status;
1272 ndis_handle adapter;
1273 ndis_resource_list *list;

--- 1067 unchanged lines hidden (view full) ---

2341}
2342
2343static void
2344NdisMSleep(usecs)
2345 uint32_t usecs;
2346{
2347 struct timeval tv;
2348
1265 return;
1266}
1267
1268static void
1269NdisMQueryAdapterResources(status, adapter, list, buflen)
1270 ndis_status *status;
1271 ndis_handle adapter;
1272 ndis_resource_list *list;

--- 1067 unchanged lines hidden (view full) ---

2340}
2341
2342static void
2343NdisMSleep(usecs)
2344 uint32_t usecs;
2345{
2346 struct timeval tv;
2347
2349 tv.tv_sec = 0;
2350 tv.tv_usec = usecs;
2348 /*
2349 * During system bootstrap, (i.e. cold == 1), we aren't
2350 * allowed to msleep(), so calling ndis_thsuspend() here
2351 * will return 0, and we won't actually have delayed. This
2352 * is a problem because some drivers expect NdisMSleep()
2353 * to always wait, and might fail if the expected delay
2354 * period does not in fact elapse. As a workaround, if the
2355 * attempt to sleep delay fails, we do a hard DELAY() instead.
2356 */
2351
2357
2352 ndis_thsuspend(curthread->td_proc, NULL, tvtohz(&tv));
2358 if (ndis_thsuspend(curthread->td_proc, NULL, tvtohz(&tv)) == 0)
2359 DELAY(usecs);
2353
2354 return;
2355}
2356
2357static uint32_t
2358NdisReadPcmciaAttributeMemory(handle, offset, buf, len)
2359 ndis_handle handle;
2360 uint32_t offset;

--- 957 unchanged lines hidden ---
2360
2361 return;
2362}
2363
2364static uint32_t
2365NdisReadPcmciaAttributeMemory(handle, offset, buf, len)
2366 ndis_handle handle;
2367 uint32_t offset;

--- 957 unchanged lines hidden ---