subr_ndis.c (151207) | subr_ndis.c (151451) |
---|---|
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 151207 2005-10-10 16:46:39Z wpaul $"); | 34__FBSDID("$FreeBSD: head/sys/compat/ndis/subr_ndis.c 151451 2005-10-18 19:52:15Z 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 --- 64 unchanged lines hidden (view full) --- 107#include <vm/vm.h> 108#include <vm/vm_param.h> 109#include <vm/pmap.h> 110#include <vm/uma.h> 111#include <vm/vm_kern.h> 112#include <vm/vm_map.h> 113 114static char ndis_filepath[MAXPATHLEN]; | 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 --- 64 unchanged lines hidden (view full) --- 107#include <vm/vm.h> 108#include <vm/vm_param.h> 109#include <vm/pmap.h> 110#include <vm/uma.h> 111#include <vm/vm_kern.h> 112#include <vm/vm_map.h> 113 114static char ndis_filepath[MAXPATHLEN]; |
115extern struct nd_head ndis_devhead; | |
116 117SYSCTL_STRING(_hw, OID_AUTO, ndis_filepath, CTLFLAG_RW, ndis_filepath, 118 MAXPATHLEN, "Path used by NdisOpenFile() to search for files"); 119 120static void NdisInitializeWrapper(ndis_handle *, 121 driver_object *, void *, void *); 122static ndis_status NdisMRegisterMiniport(ndis_handle, 123 ndis_miniport_characteristics *, int); --- 109 unchanged lines hidden (view full) --- 233static void NdisMRegisterAdapterShutdownHandler(ndis_handle, void *, 234 ndis_shutdown_handler); 235static void NdisMDeregisterAdapterShutdownHandler(ndis_handle); 236static uint32_t NDIS_BUFFER_TO_SPAN_PAGES(ndis_buffer *); 237static void NdisGetBufferPhysicalArraySize(ndis_buffer *, 238 uint32_t *); 239static void NdisQueryBufferOffset(ndis_buffer *, 240 uint32_t *, uint32_t *); | 115 116SYSCTL_STRING(_hw, OID_AUTO, ndis_filepath, CTLFLAG_RW, ndis_filepath, 117 MAXPATHLEN, "Path used by NdisOpenFile() to search for files"); 118 119static void NdisInitializeWrapper(ndis_handle *, 120 driver_object *, void *, void *); 121static ndis_status NdisMRegisterMiniport(ndis_handle, 122 ndis_miniport_characteristics *, int); --- 109 unchanged lines hidden (view full) --- 232static void NdisMRegisterAdapterShutdownHandler(ndis_handle, void *, 233 ndis_shutdown_handler); 234static void NdisMDeregisterAdapterShutdownHandler(ndis_handle); 235static uint32_t NDIS_BUFFER_TO_SPAN_PAGES(ndis_buffer *); 236static void NdisGetBufferPhysicalArraySize(ndis_buffer *, 237 uint32_t *); 238static void NdisQueryBufferOffset(ndis_buffer *, 239 uint32_t *, uint32_t *); |
241static void NdisMSleep(uint32_t); | |
242static uint32_t NdisReadPcmciaAttributeMemory(ndis_handle, 243 uint32_t, void *, uint32_t); 244static uint32_t NdisWritePcmciaAttributeMemory(ndis_handle, 245 uint32_t, void *, uint32_t); 246static list_entry *NdisInterlockedInsertHeadList(list_entry *, 247 list_entry *, ndis_spin_lock *); 248static list_entry *NdisInterlockedRemoveHeadList(list_entry *, 249 ndis_spin_lock *); --- 166 unchanged lines hidden (view full) --- 416 * object using IoAllocateDriverObjectExtension(). 417 * The extra extension info is automagically deleted when 418 * the driver is unloaded (see windrv_unload()). 419 */ 420 421 if (IoAllocateDriverObjectExtension(drv, (void *)1, 422 sizeof(ndis_miniport_characteristics), (void **)&ch) != 423 STATUS_SUCCESS) { | 240static uint32_t NdisReadPcmciaAttributeMemory(ndis_handle, 241 uint32_t, void *, uint32_t); 242static uint32_t NdisWritePcmciaAttributeMemory(ndis_handle, 243 uint32_t, void *, uint32_t); 244static list_entry *NdisInterlockedInsertHeadList(list_entry *, 245 list_entry *, ndis_spin_lock *); 246static list_entry *NdisInterlockedRemoveHeadList(list_entry *, 247 ndis_spin_lock *); --- 166 unchanged lines hidden (view full) --- 414 * object using IoAllocateDriverObjectExtension(). 415 * The extra extension info is automagically deleted when 416 * the driver is unloaded (see windrv_unload()). 417 */ 418 419 if (IoAllocateDriverObjectExtension(drv, (void *)1, 420 sizeof(ndis_miniport_characteristics), (void **)&ch) != 421 STATUS_SUCCESS) { |
424 printf("register error\n"); | |
425 return(NDIS_STATUS_RESOURCES); 426 } 427 428 bzero((char *)ch, sizeof(ndis_miniport_characteristics)); 429 430 bcopy((char *)characteristics, (char *)ch, len); 431 432 if (ch->nmc_version_major < 5 || ch->nmc_version_minor < 1) { --- 1408 unchanged lines hidden (view full) --- 1841 1842void 1843NdisAllocatePacketPool(status, pool, descnum, protrsvdlen) 1844 ndis_status *status; 1845 ndis_handle *pool; 1846 uint32_t descnum; 1847 uint32_t protrsvdlen; 1848{ | 422 return(NDIS_STATUS_RESOURCES); 423 } 424 425 bzero((char *)ch, sizeof(ndis_miniport_characteristics)); 426 427 bcopy((char *)characteristics, (char *)ch, len); 428 429 if (ch->nmc_version_major < 5 || ch->nmc_version_minor < 1) { --- 1408 unchanged lines hidden (view full) --- 1838 1839void 1840NdisAllocatePacketPool(status, pool, descnum, protrsvdlen) 1841 ndis_status *status; 1842 ndis_handle *pool; 1843 uint32_t descnum; 1844 uint32_t protrsvdlen; 1845{ |
1849 ndis_packet *cur; | 1846 ndis_packet_pool *p; 1847 ndis_packet *packets; |
1850 int i; 1851 | 1848 int i; 1849 |
1852 *pool = malloc((sizeof(ndis_packet) + protrsvdlen) * 1853 ((descnum + NDIS_POOL_EXTRA) + 1), 1854 M_DEVBUF, M_NOWAIT|M_ZERO); 1855 1856 if (*pool == NULL) { | 1850 p = ExAllocatePoolWithTag(NonPagedPool, sizeof(ndis_packet_pool), 0); 1851 if (p == NULL) { |
1857 *status = NDIS_STATUS_RESOURCES; 1858 return; 1859 } 1860 | 1852 *status = NDIS_STATUS_RESOURCES; 1853 return; 1854 } 1855 |
1861 cur = (ndis_packet *)*pool; 1862 KeInitializeSpinLock(&cur->np_lock); 1863 cur->np_private.npp_flags = 0x1; /* mark the head of the list */ 1864 cur->np_private.npp_totlen = 0; /* init deletetion flag */ 1865 for (i = 0; i < (descnum + NDIS_POOL_EXTRA); i++) { 1866 cur->np_private.npp_head = (ndis_handle)(cur + 1); 1867 cur++; | 1856 p->np_cnt = descnum + NDIS_POOL_EXTRA; 1857 p->np_protrsvd = protrsvdlen; 1858 p->np_len = sizeof(ndis_packet) + protrsvdlen; 1859 1860 packets = ExAllocatePoolWithTag(NonPagedPool, p->np_cnt * 1861 p->np_len, 0); 1862 1863 1864 if (packets == NULL) { 1865 ExFreePool(p); 1866 *status = NDIS_STATUS_RESOURCES; 1867 return; |
1868 } 1869 | 1868 } 1869 |
1870 p->np_pktmem = packets; 1871 1872 for (i = 0; i < p->np_cnt; i++) 1873 InterlockedPushEntrySList(&p->np_head, 1874 (struct slist_entry *)&packets[i]); 1875 1876#ifdef NDIS_DEBUG_PACKETS 1877 p->np_dead = 0; 1878 KeInitializeSpinLock(&p->np_lock); 1879 KeInitializeEvent(&p->np_event, EVENT_TYPE_NOTIFY, TRUE); 1880#endif 1881 1882 *pool = p; |
|
1870 *status = NDIS_STATUS_SUCCESS; 1871 return; 1872} 1873 1874void 1875NdisAllocatePacketPoolEx(status, pool, descnum, oflowdescnum, protrsvdlen) 1876 ndis_status *status; 1877 ndis_handle *pool; --- 4 unchanged lines hidden (view full) --- 1882 return(NdisAllocatePacketPool(status, pool, 1883 descnum + oflowdescnum, protrsvdlen)); 1884} 1885 1886uint32_t 1887NdisPacketPoolUsage(pool) 1888 ndis_handle pool; 1889{ | 1883 *status = NDIS_STATUS_SUCCESS; 1884 return; 1885} 1886 1887void 1888NdisAllocatePacketPoolEx(status, pool, descnum, oflowdescnum, protrsvdlen) 1889 ndis_status *status; 1890 ndis_handle *pool; --- 4 unchanged lines hidden (view full) --- 1895 return(NdisAllocatePacketPool(status, pool, 1896 descnum + oflowdescnum, protrsvdlen)); 1897} 1898 1899uint32_t 1900NdisPacketPoolUsage(pool) 1901 ndis_handle pool; 1902{ |
1890 ndis_packet *head; 1891 uint8_t irql; 1892 uint32_t cnt; | 1903 ndis_packet_pool *p; |
1893 | 1904 |
1894 head = (ndis_packet *)pool; 1895 KeAcquireSpinLock(&head->np_lock, &irql); 1896 cnt = head->np_private.npp_count; 1897 KeReleaseSpinLock(&head->np_lock, irql); 1898 1899 return(cnt); | 1905 p = (ndis_packet_pool *)pool; 1906 return(p->np_cnt - ExQueryDepthSList(&p->np_head)); |
1900} 1901 1902void 1903NdisFreePacketPool(pool) 1904 ndis_handle pool; 1905{ | 1907} 1908 1909void 1910NdisFreePacketPool(pool) 1911 ndis_handle pool; 1912{ |
1906 ndis_packet *head; | 1913 ndis_packet_pool *p; 1914 int usage; 1915#ifdef NDIS_DEBUG_PACKETS |
1907 uint8_t irql; | 1916 uint8_t irql; |
1917#endif |
|
1908 | 1918 |
1909 head = pool; | 1919 p = (ndis_packet_pool *)pool; |
1910 | 1920 |
1911 /* Mark this pool as 'going away.' */ | 1921#ifdef NDIS_DEBUG_PACKETS 1922 KeAcquireSpinLock(&p->np_lock, &irql); 1923#endif |
1912 | 1924 |
1913 KeAcquireSpinLock(&head->np_lock, &irql); 1914 head->np_private.npp_totlen = 1; | 1925 usage = NdisPacketPoolUsage(pool); |
1915 | 1926 |
1916 /* If there are no buffers loaned out, destroy the pool. */ | 1927#ifdef NDIS_DEBUG_PACKETS 1928 if (usage) { 1929 p->np_dead = 1; 1930 KeResetEvent(&p->np_event); 1931 KeReleaseSpinLock(&p->np_lock, irql); 1932 KeWaitForSingleObject(&p->np_event, 0, 0, FALSE, NULL); 1933 } else 1934 KeReleaseSpinLock(&p->np_lock, irql); 1935#endif |
1917 | 1936 |
1918 if (head->np_private.npp_count == 0) { 1919 KeReleaseSpinLock(&head->np_lock, irql); 1920 free(pool, M_DEVBUF); 1921 } else { 1922 printf("NDIS: buggy driver deleting active packet pool!\n"); 1923 KeReleaseSpinLock(&head->np_lock, irql); 1924 } | 1937 ExFreePool(p->np_pktmem); 1938 ExFreePool(p); |
1925 1926 return; 1927} 1928 1929void 1930NdisAllocatePacket(status, packet, pool) 1931 ndis_status *status; 1932 ndis_packet **packet; 1933 ndis_handle pool; 1934{ | 1939 1940 return; 1941} 1942 1943void 1944NdisAllocatePacket(status, packet, pool) 1945 ndis_status *status; 1946 ndis_packet **packet; 1947 ndis_handle pool; 1948{ |
1935 ndis_packet *head, *pkt; | 1949 ndis_packet_pool *p; 1950 ndis_packet *pkt; 1951#ifdef NDIS_DEBUG_PACKETS |
1936 uint8_t irql; | 1952 uint8_t irql; |
1953#endif |
|
1937 | 1954 |
1938 head = (ndis_packet *)pool; 1939 KeAcquireSpinLock(&head->np_lock, &irql); | 1955 p = (ndis_packet_pool *)pool; |
1940 | 1956 |
1941 if (head->np_private.npp_flags != 0x1) { 1942 *status = NDIS_STATUS_FAILURE; 1943 KeReleaseSpinLock(&head->np_lock, irql); | 1957#ifdef NDIS_DEBUG_PACKETS 1958 KeAcquireSpinLock(&p->np_lock, &irql); 1959 if (p->np_dead) { 1960 KeReleaseSpinLock(&p->np_lock, irql); 1961 printf("NDIS: tried to allocate packet from dead pool %p\n", 1962 pool); 1963 *status = NDIS_STATUS_RESOURCES; |
1944 return; 1945 } | 1964 return; 1965 } |
1966#endif |
|
1946 | 1967 |
1947 /* 1948 * If this pool is marked as 'going away' don't allocate any 1949 * more packets out of it. 1950 */ | 1968 pkt = (ndis_packet *)InterlockedPopEntrySList(&p->np_head); |
1951 | 1969 |
1952 if (head->np_private.npp_totlen) { 1953 *status = NDIS_STATUS_FAILURE; 1954 KeReleaseSpinLock(&head->np_lock, irql); 1955 return; 1956 } | 1970#ifdef NDIS_DEBUG_PACKETS 1971 KeReleaseSpinLock(&p->np_lock, irql); 1972#endif |
1957 | 1973 |
1958 pkt = (ndis_packet *)head->np_private.npp_head; 1959 | |
1960 if (pkt == NULL) { 1961 *status = NDIS_STATUS_RESOURCES; | 1974 if (pkt == NULL) { 1975 *status = NDIS_STATUS_RESOURCES; |
1962 KeReleaseSpinLock(&head->np_lock, irql); | |
1963 return; 1964 } 1965 | 1976 return; 1977 } 1978 |
1966 head->np_private.npp_head = pkt->np_private.npp_head; | |
1967 | 1979 |
1968 pkt->np_private.npp_head = pkt->np_private.npp_tail = NULL; | 1980 bzero((char *)pkt, sizeof(ndis_packet)); 1981 |
1969 /* Save pointer to the pool. */ | 1982 /* Save pointer to the pool. */ |
1970 pkt->np_private.npp_pool = head; | 1983 pkt->np_private.npp_pool = pool; |
1971 1972 /* Set the oob offset pointer. Lots of things expect this. */ 1973 pkt->np_private.npp_packetooboffset = offsetof(ndis_packet, np_oob); 1974 1975 /* 1976 * We must initialize the packet flags correctly in order 1977 * for the NDIS_SET_PACKET_MEDIA_SPECIFIC_INFO() and 1978 * NDIS_GET_PACKET_MEDIA_SPECIFIC_INFO() macros to work 1979 * correctly. 1980 */ 1981 pkt->np_private.npp_ndispktflags = NDIS_PACKET_ALLOCATED_BY_NDIS; 1982 pkt->np_private.npp_validcounts = FALSE; 1983 1984 *packet = pkt; 1985 | 1984 1985 /* Set the oob offset pointer. Lots of things expect this. */ 1986 pkt->np_private.npp_packetooboffset = offsetof(ndis_packet, np_oob); 1987 1988 /* 1989 * We must initialize the packet flags correctly in order 1990 * for the NDIS_SET_PACKET_MEDIA_SPECIFIC_INFO() and 1991 * NDIS_GET_PACKET_MEDIA_SPECIFIC_INFO() macros to work 1992 * correctly. 1993 */ 1994 pkt->np_private.npp_ndispktflags = NDIS_PACKET_ALLOCATED_BY_NDIS; 1995 pkt->np_private.npp_validcounts = FALSE; 1996 1997 *packet = pkt; 1998 |
1986 head->np_private.npp_count++; | |
1987 *status = NDIS_STATUS_SUCCESS; 1988 | 1999 *status = NDIS_STATUS_SUCCESS; 2000 |
1989 KeReleaseSpinLock(&head->np_lock, irql); 1990 | |
1991 return; 1992} 1993 1994void 1995NdisFreePacket(packet) 1996 ndis_packet *packet; 1997{ | 2001 return; 2002} 2003 2004void 2005NdisFreePacket(packet) 2006 ndis_packet *packet; 2007{ |
1998 ndis_packet *head; | 2008 ndis_packet_pool *p; 2009#ifdef NDIS_DEBUG_PACKETS |
1999 uint8_t irql; | 2010 uint8_t irql; |
2011#endif |
|
2000 | 2012 |
2001 if (packet == NULL || packet->np_private.npp_pool == NULL) 2002 return; | 2013 p = (ndis_packet_pool *)packet->np_private.npp_pool; |
2003 | 2014 |
2004 head = packet->np_private.npp_pool; 2005 KeAcquireSpinLock(&head->np_lock, &irql); | 2015#ifdef NDIS_DEBUG_PACKETS 2016 KeAcquireSpinLock(&p->np_lock, &irql); 2017#endif |
2006 | 2018 |
2007 if (head->np_private.npp_flags != 0x1) { 2008 KeReleaseSpinLock(&head->np_lock, irql); 2009 return; | 2019 InterlockedPushEntrySList(&p->np_head, (slist_entry *)packet); 2020 2021#ifdef NDIS_DEBUG_PACKETS 2022 if (p->np_dead) { 2023 if (ExQueryDepthSList(&p->np_head) == p->np_cnt) 2024 KeSetEvent(&p->np_event, IO_NO_INCREMENT, FALSE); |
2010 } | 2025 } |
2026 KeReleaseSpinLock(&p->np_lock, irql); 2027#endif |
|
2011 | 2028 |
2012 packet->np_private.npp_head = head->np_private.npp_head; 2013 head->np_private.npp_head = (ndis_buffer *)packet; 2014 head->np_private.npp_count--; 2015 2016 /* 2017 * If the pool has been marked for deletion and there are 2018 * no more packets outstanding, nuke the pool. 2019 */ 2020 2021 if (head->np_private.npp_totlen && head->np_private.npp_count == 0) { 2022 KeReleaseSpinLock(&head->np_lock, irql); 2023 free(head, M_DEVBUF); 2024 } else 2025 KeReleaseSpinLock(&head->np_lock, irql); 2026 | |
2027 return; 2028} 2029 2030static void 2031NdisUnchainBufferAtFront(packet, buf) 2032 ndis_packet *packet; 2033 ndis_buffer **buf; 2034{ --- 215 unchanged lines hidden (view full) --- 2250 KeInitializeEvent(&event->ne_event, EVENT_TYPE_NOTIFY, FALSE); 2251 return; 2252} 2253 2254static void 2255NdisSetEvent(event) 2256 ndis_event *event; 2257{ | 2029 return; 2030} 2031 2032static void 2033NdisUnchainBufferAtFront(packet, buf) 2034 ndis_packet *packet; 2035 ndis_buffer **buf; 2036{ --- 215 unchanged lines hidden (view full) --- 2252 KeInitializeEvent(&event->ne_event, EVENT_TYPE_NOTIFY, FALSE); 2253 return; 2254} 2255 2256static void 2257NdisSetEvent(event) 2258 ndis_event *event; 2259{ |
2258 KeSetEvent(&event->ne_event, 0, 0); | 2260 KeSetEvent(&event->ne_event, IO_NO_INCREMENT, FALSE); |
2259 return; 2260} 2261 2262static void 2263NdisResetEvent(event) 2264 ndis_event *event; 2265{ 2266 KeResetEvent(&event->ne_event); --- 4 unchanged lines hidden (view full) --- 2271NdisWaitEvent(event, msecs) 2272 ndis_event *event; 2273 uint32_t msecs; 2274{ 2275 int64_t duetime; 2276 uint32_t rval; 2277 2278 duetime = ((int64_t)msecs * -10000); | 2261 return; 2262} 2263 2264static void 2265NdisResetEvent(event) 2266 ndis_event *event; 2267{ 2268 KeResetEvent(&event->ne_event); --- 4 unchanged lines hidden (view full) --- 2273NdisWaitEvent(event, msecs) 2274 ndis_event *event; 2275 uint32_t msecs; 2276{ 2277 int64_t duetime; 2278 uint32_t rval; 2279 2280 duetime = ((int64_t)msecs * -10000); |
2279 rval = KeWaitForSingleObject((nt_dispatch_header *)event, | 2281 rval = KeWaitForSingleObject(event, |
2280 0, 0, TRUE, msecs ? & duetime : NULL); 2281 2282 if (rval == STATUS_TIMEOUT) 2283 return(FALSE); 2284 2285 return(TRUE); 2286} 2287 --- 186 unchanged lines hidden (view full) --- 2474 KeReleaseSpinLock(intr->ni_introbj->ki_lock, irql); 2475/* 2476 KeFlushQueuedDpcs(); 2477*/ 2478 /* Disconnect our ISR */ 2479 2480 IoDisconnectInterrupt(intr->ni_introbj); 2481 | 2282 0, 0, TRUE, msecs ? & duetime : NULL); 2283 2284 if (rval == STATUS_TIMEOUT) 2285 return(FALSE); 2286 2287 return(TRUE); 2288} 2289 --- 186 unchanged lines hidden (view full) --- 2476 KeReleaseSpinLock(intr->ni_introbj->ki_lock, irql); 2477/* 2478 KeFlushQueuedDpcs(); 2479*/ 2480 /* Disconnect our ISR */ 2481 2482 IoDisconnectInterrupt(intr->ni_introbj); 2483 |
2482 KeWaitForSingleObject((nt_dispatch_header *)&intr->ni_dpcevt, 2483 0, 0, FALSE, NULL); | 2484 KeWaitForSingleObject(&intr->ni_dpcevt, 0, 0, FALSE, NULL); |
2484 KeResetEvent(&intr->ni_dpcevt); 2485 2486 return; 2487} 2488 2489static void 2490NdisMRegisterAdapterShutdownHandler(adapter, shutdownctx, shutdownfunc) 2491 ndis_handle adapter; --- 72 unchanged lines hidden (view full) --- 2564 return; 2565 2566 *off = MmGetMdlByteOffset(buf); 2567 *len = MmGetMdlByteCount(buf); 2568 2569 return; 2570} 2571 | 2485 KeResetEvent(&intr->ni_dpcevt); 2486 2487 return; 2488} 2489 2490static void 2491NdisMRegisterAdapterShutdownHandler(adapter, shutdownctx, shutdownfunc) 2492 ndis_handle adapter; --- 72 unchanged lines hidden (view full) --- 2565 return; 2566 2567 *off = MmGetMdlByteOffset(buf); 2568 *len = MmGetMdlByteCount(buf); 2569 2570 return; 2571} 2572 |
2572static void | 2573void |
2573NdisMSleep(usecs) 2574 uint32_t usecs; 2575{ 2576 ktimer timer; 2577 2578 /* 2579 * During system bootstrap, (i.e. cold == 1), we aren't 2580 * allowed to sleep, so we have to do a hard DELAY() 2581 * instead. 2582 */ 2583 2584 if (cold) 2585 DELAY(usecs); 2586 else { 2587 KeInitializeTimer(&timer); 2588 KeSetTimer(&timer, ((int64_t)usecs * -10), NULL); | 2574NdisMSleep(usecs) 2575 uint32_t usecs; 2576{ 2577 ktimer timer; 2578 2579 /* 2580 * During system bootstrap, (i.e. cold == 1), we aren't 2581 * allowed to sleep, so we have to do a hard DELAY() 2582 * instead. 2583 */ 2584 2585 if (cold) 2586 DELAY(usecs); 2587 else { 2588 KeInitializeTimer(&timer); 2589 KeSetTimer(&timer, ((int64_t)usecs * -10), NULL); |
2589 KeWaitForSingleObject((nt_dispatch_header *)&timer, 2590 0, 0, FALSE, NULL); | 2590 KeWaitForSingleObject(&timer, 0, 0, FALSE, NULL); |
2591 } | 2591 } |
2592 |
|
2592 return; 2593} 2594 2595static uint32_t 2596NdisReadPcmciaAttributeMemory(handle, offset, buf, len) 2597 ndis_handle handle; 2598 uint32_t offset; 2599 void *buf; --- 944 unchanged lines hidden --- | 2593 return; 2594} 2595 2596static uint32_t 2597NdisReadPcmciaAttributeMemory(handle, offset, buf, len) 2598 ndis_handle handle; 2599 uint32_t offset; 2600 void *buf; --- 944 unchanged lines hidden --- |