Deleted Added
full compact
subr_ndis.c (151606) subr_ndis.c (151691)
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 151606 2005-10-24 05:05:09Z wpaul $");
34__FBSDID("$FreeBSD: head/sys/compat/ndis/subr_ndis.c 151691 2005-10-26 06:52:57Z 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

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

1252 */
1253static void
1254NdisMInitializeTimer(timer, handle, func, ctx)
1255 ndis_miniport_timer *timer;
1256 ndis_handle handle;
1257 ndis_timer_function func;
1258 void *ctx;
1259{
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

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

1252 */
1253static void
1254NdisMInitializeTimer(timer, handle, func, ctx)
1255 ndis_miniport_timer *timer;
1256 ndis_handle handle;
1257 ndis_timer_function func;
1258 void *ctx;
1259{
1260 uint8_t irql;
1261
1262 /* Save the driver's funcptr and context */
1263
1264 timer->nmt_timerfunc = func;
1265 timer->nmt_timerctx = ctx;
1266 timer->nmt_block = handle;
1267
1268 /*
1269 * Set up the timer so it will call our intermediate DPC.
1270 * Be sure to use the wrapped entry point, since
1271 * ntoskrnl_run_dpc() expects to invoke a function with
1272 * Microsoft calling conventions.
1273 */
1274 KeInitializeTimer(&timer->nmt_ktimer);
1275 KeInitializeDpc(&timer->nmt_kdpc,
1276 ndis_findwrap((funcptr)ndis_timercall), timer);
1277 timer->nmt_ktimer.k_dpc = &timer->nmt_kdpc;
1278
1260 /* Save the driver's funcptr and context */
1261
1262 timer->nmt_timerfunc = func;
1263 timer->nmt_timerctx = ctx;
1264 timer->nmt_block = handle;
1265
1266 /*
1267 * Set up the timer so it will call our intermediate DPC.
1268 * Be sure to use the wrapped entry point, since
1269 * ntoskrnl_run_dpc() expects to invoke a function with
1270 * Microsoft calling conventions.
1271 */
1272 KeInitializeTimer(&timer->nmt_ktimer);
1273 KeInitializeDpc(&timer->nmt_kdpc,
1274 ndis_findwrap((funcptr)ndis_timercall), timer);
1275 timer->nmt_ktimer.k_dpc = &timer->nmt_kdpc;
1276
1279 KeAcquireSpinLock(&timer->nmt_block->nmb_lock, &irql);
1280
1281 timer->nmt_nexttimer = timer->nmt_block->nmb_timerlist;
1282 timer->nmt_block->nmb_timerlist = timer;
1283
1284 KeReleaseSpinLock(&timer->nmt_block->nmb_lock, irql);
1285
1286 return;
1287}
1288
1289/*
1290 * In Windows, there's both an NdisMSetTimer() and an NdisSetTimer(),
1291 * but the former is just a macro wrapper around the latter.
1292 */
1293static void

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

1745
1746static ndis_status
1747NdisMMapIoSpace(vaddr, adapter, paddr, len)
1748 void **vaddr;
1749 ndis_handle adapter;
1750 ndis_physaddr paddr;
1751 uint32_t len;
1752{
1277 return;
1278}
1279
1280/*
1281 * In Windows, there's both an NdisMSetTimer() and an NdisSetTimer(),
1282 * but the former is just a macro wrapper around the latter.
1283 */
1284static void

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

1736
1737static ndis_status
1738NdisMMapIoSpace(vaddr, adapter, paddr, len)
1739 void **vaddr;
1740 ndis_handle adapter;
1741 ndis_physaddr paddr;
1742 uint32_t len;
1743{
1753 ndis_miniport_block *block;
1754 struct ndis_softc *sc;
1755
1756 if (adapter == NULL)
1757 return(NDIS_STATUS_FAILURE);
1758
1744 if (adapter == NULL)
1745 return(NDIS_STATUS_FAILURE);
1746
1759 block = (ndis_miniport_block *)adapter;
1760 sc = device_get_softc(block->nmb_physdeviceobj->do_devext);
1747 *vaddr = MmMapIoSpace(paddr.np_quad, len, 0);
1761
1748
1762 if (sc->ndis_res_mem != NULL &&
1763 paddr.np_quad == rman_get_start(sc->ndis_res_mem))
1764 *vaddr = (void *)rman_get_virtual(sc->ndis_res_mem);
1765 else if (sc->ndis_res_altmem != NULL &&
1766 paddr.np_quad == rman_get_start(sc->ndis_res_altmem))
1767 *vaddr = (void *)rman_get_virtual(sc->ndis_res_altmem);
1768 else if (sc->ndis_res_am != NULL &&
1769 paddr.np_quad == rman_get_start(sc->ndis_res_am))
1770 *vaddr = (void *)rman_get_virtual(sc->ndis_res_am);
1771 else
1749 if (*vaddr == NULL)
1772 return(NDIS_STATUS_FAILURE);
1773
1774 return(NDIS_STATUS_SUCCESS);
1775}
1776
1777static void
1778NdisMUnmapIoSpace(adapter, vaddr, len)
1779 ndis_handle adapter;
1780 void *vaddr;
1781 uint32_t len;
1782{
1750 return(NDIS_STATUS_FAILURE);
1751
1752 return(NDIS_STATUS_SUCCESS);
1753}
1754
1755static void
1756NdisMUnmapIoSpace(adapter, vaddr, len)
1757 ndis_handle adapter;
1758 void *vaddr;
1759 uint32_t len;
1760{
1761 MmUnmapIoSpace(vaddr, len);
1783 return;
1784}
1785
1786static uint32_t
1787NdisGetCacheFillSize(void)
1788{
1789 return(128);
1790}

--- 1754 unchanged lines hidden ---
1762 return;
1763}
1764
1765static uint32_t
1766NdisGetCacheFillSize(void)
1767{
1768 return(128);
1769}

--- 1754 unchanged lines hidden ---