Deleted Added
full compact
subr_ndis.c (215779) subr_ndis.c (216242)
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 215779 2010-11-23 21:49:32Z bschmidt $");
34__FBSDID("$FreeBSD: head/sys/compat/ndis/subr_ndis.c 216242 2010-12-06 20:54:53Z bschmidt $");
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

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

192static ndis_status NdisMAllocateSharedMemoryAsync(ndis_handle,
193 uint32_t, uint8_t, void *);
194static void NdisMFreeSharedMemory(ndis_handle, uint32_t,
195 uint8_t, void *, ndis_physaddr);
196static ndis_status NdisMMapIoSpace(void **, ndis_handle,
197 ndis_physaddr, uint32_t);
198static void NdisMUnmapIoSpace(ndis_handle, void *, uint32_t);
199static uint32_t NdisGetCacheFillSize(void);
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

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

192static ndis_status NdisMAllocateSharedMemoryAsync(ndis_handle,
193 uint32_t, uint8_t, void *);
194static void NdisMFreeSharedMemory(ndis_handle, uint32_t,
195 uint8_t, void *, ndis_physaddr);
196static ndis_status NdisMMapIoSpace(void **, ndis_handle,
197 ndis_physaddr, uint32_t);
198static void NdisMUnmapIoSpace(ndis_handle, void *, uint32_t);
199static uint32_t NdisGetCacheFillSize(void);
200static void *NdisGetRoutineAddress(unicode_string *);
200static uint32_t NdisMGetDmaAlignment(ndis_handle);
201static ndis_status NdisMInitializeScatterGatherDma(ndis_handle,
202 uint8_t, uint32_t);
203static void NdisUnchainBufferAtFront(ndis_packet *, ndis_buffer **);
204static void NdisUnchainBufferAtBack(ndis_packet *, ndis_buffer **);
205static void NdisAllocateBufferPool(ndis_status *,
206 ndis_handle *, uint32_t);
207static void NdisFreeBufferPool(ndis_handle);

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

1637}
1638
1639static uint32_t
1640NdisGetCacheFillSize(void)
1641{
1642 return (128);
1643}
1644
201static uint32_t NdisMGetDmaAlignment(ndis_handle);
202static ndis_status NdisMInitializeScatterGatherDma(ndis_handle,
203 uint8_t, uint32_t);
204static void NdisUnchainBufferAtFront(ndis_packet *, ndis_buffer **);
205static void NdisUnchainBufferAtBack(ndis_packet *, ndis_buffer **);
206static void NdisAllocateBufferPool(ndis_status *,
207 ndis_handle *, uint32_t);
208static void NdisFreeBufferPool(ndis_handle);

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

1638}
1639
1640static uint32_t
1641NdisGetCacheFillSize(void)
1642{
1643 return (128);
1644}
1645
1646static void *
1647NdisGetRoutineAddress(ustr)
1648 unicode_string *ustr;
1649{
1650 ansi_string astr;
1651
1652 if (RtlUnicodeStringToAnsiString(&astr, ustr, TRUE))
1653 return (NULL);
1654 return (ndis_get_routine_address(ndis_functbl, astr.as_buf));
1655}
1656
1645static uint32_t
1646NdisMGetDmaAlignment(handle)
1647 ndis_handle handle;
1648{
1649 return (16);
1650}
1651
1652/*

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

3241 IMPORT_SFUNC(NdisAnsiStringToUnicodeString, 2),
3242 IMPORT_SFUNC(NdisTerminateWrapper, 2),
3243 IMPORT_SFUNC(NdisOpenConfigurationKeyByName, 4),
3244 IMPORT_SFUNC(NdisOpenConfigurationKeyByIndex, 5),
3245 IMPORT_SFUNC(NdisMRemoveMiniport, 1),
3246 IMPORT_SFUNC(NdisInitializeString, 2),
3247 IMPORT_SFUNC(NdisFreeString, 1),
3248 IMPORT_SFUNC(NdisGetCurrentSystemTime, 1),
1657static uint32_t
1658NdisMGetDmaAlignment(handle)
1659 ndis_handle handle;
1660{
1661 return (16);
1662}
1663
1664/*

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

3253 IMPORT_SFUNC(NdisAnsiStringToUnicodeString, 2),
3254 IMPORT_SFUNC(NdisTerminateWrapper, 2),
3255 IMPORT_SFUNC(NdisOpenConfigurationKeyByName, 4),
3256 IMPORT_SFUNC(NdisOpenConfigurationKeyByIndex, 5),
3257 IMPORT_SFUNC(NdisMRemoveMiniport, 1),
3258 IMPORT_SFUNC(NdisInitializeString, 2),
3259 IMPORT_SFUNC(NdisFreeString, 1),
3260 IMPORT_SFUNC(NdisGetCurrentSystemTime, 1),
3261 IMPORT_SFUNC(NdisGetRoutineAddress, 1),
3249 IMPORT_SFUNC(NdisGetSystemUpTime, 1),
3250 IMPORT_SFUNC(NdisGetVersion, 0),
3251 IMPORT_SFUNC(NdisMSynchronizeWithInterrupt, 3),
3252 IMPORT_SFUNC(NdisMAllocateSharedMemoryAsync, 4),
3253 IMPORT_SFUNC(NdisInterlockedInsertHeadList, 3),
3254 IMPORT_SFUNC(NdisInterlockedInsertTailList, 3),
3255 IMPORT_SFUNC(NdisInterlockedRemoveHeadList, 2),
3256 IMPORT_SFUNC(NdisInitializeWrapper, 4),

--- 108 unchanged lines hidden ---
3262 IMPORT_SFUNC(NdisGetSystemUpTime, 1),
3263 IMPORT_SFUNC(NdisGetVersion, 0),
3264 IMPORT_SFUNC(NdisMSynchronizeWithInterrupt, 3),
3265 IMPORT_SFUNC(NdisMAllocateSharedMemoryAsync, 4),
3266 IMPORT_SFUNC(NdisInterlockedInsertHeadList, 3),
3267 IMPORT_SFUNC(NdisInterlockedInsertTailList, 3),
3268 IMPORT_SFUNC(NdisInterlockedRemoveHeadList, 2),
3269 IMPORT_SFUNC(NdisInitializeWrapper, 4),

--- 108 unchanged lines hidden ---