version 1.1, 2006/03/30 22:56:50 |
version 1.2, 2006/03/30 23:06:56 |
|
|
*/ |
*/ |
|
|
#include <sys/cdefs.h> |
#include <sys/cdefs.h> |
|
#ifdef __FreeBSD__ |
__FBSDID("$FreeBSD: src/sys/compat/ndis/subr_ndis.c,v 1.67.2.7 2005/03/31 21:50:11 wpaul Exp $"); |
__FBSDID("$FreeBSD: src/sys/compat/ndis/subr_ndis.c,v 1.67.2.7 2005/03/31 21:50:11 wpaul Exp $"); |
|
#endif |
|
#ifdef __NetBSD__ |
|
__KERNEL_RCSID(0, "$NetBSD$"); |
|
#endif |
|
|
/* |
/* |
* This file implements a translation layer between the BSD networking |
* This file implements a translation layer between the BSD networking |
Line 48 __FBSDID("$FreeBSD: src/sys/compat/ndis/ |
|
Line 53 __FBSDID("$FreeBSD: src/sys/compat/ndis/ |
|
* expects. |
* expects. |
*/ |
*/ |
|
|
|
#ifdef __FreeBSD__ |
#include <sys/ctype.h> |
#include <sys/ctype.h> |
|
#endif |
#include <sys/param.h> |
#include <sys/param.h> |
#include <sys/types.h> |
#include <sys/types.h> |
#include <sys/errno.h> |
#include <sys/errno.h> |
Line 57 __FBSDID("$FreeBSD: src/sys/compat/ndis/ |
|
Line 63 __FBSDID("$FreeBSD: src/sys/compat/ndis/ |
|
#include <sys/callout.h> |
#include <sys/callout.h> |
#include <sys/kernel.h> |
#include <sys/kernel.h> |
#include <sys/systm.h> |
#include <sys/systm.h> |
|
#ifdef __NetBSD__ |
|
#include <sys/lkm.h> |
|
#endif |
#include <sys/malloc.h> |
#include <sys/malloc.h> |
#include <sys/lock.h> |
#include <sys/lock.h> |
|
#ifdef __FreeBSD__ |
#include <sys/mutex.h> |
#include <sys/mutex.h> |
|
#endif |
#include <sys/socket.h> |
#include <sys/socket.h> |
#include <sys/sysctl.h> |
#include <sys/sysctl.h> |
|
#ifdef __FreeBSD__ |
#include <sys/timespec.h> |
#include <sys/timespec.h> |
#include <sys/smp.h> |
#include <sys/smp.h> |
|
#endif |
#include <sys/queue.h> |
#include <sys/queue.h> |
#include <sys/proc.h> |
#include <sys/proc.h> |
#include <sys/filedesc.h> |
#include <sys/filedesc.h> |
Line 71 __FBSDID("$FreeBSD: src/sys/compat/ndis/ |
|
Line 84 __FBSDID("$FreeBSD: src/sys/compat/ndis/ |
|
#include <sys/fcntl.h> |
#include <sys/fcntl.h> |
#include <sys/vnode.h> |
#include <sys/vnode.h> |
#include <sys/kthread.h> |
#include <sys/kthread.h> |
|
#ifdef __FreeBSD__ |
#include <sys/linker.h> |
#include <sys/linker.h> |
#include <sys/mount.h> |
|
#include <sys/sysproto.h> |
#include <sys/sysproto.h> |
|
#endif |
|
#include <sys/mount.h> |
|
|
#include <net/if.h> |
#include <net/if.h> |
#include <net/if_arp.h> |
#include <net/if_arp.h> |
|
#ifdef __FreeBSD__ |
#include <net/ethernet.h> |
#include <net/ethernet.h> |
|
#else |
|
#include <net/if_ether.h> |
|
#endif |
#include <net/if_dl.h> |
#include <net/if_dl.h> |
#include <net/if_media.h> |
#include <net/if_media.h> |
|
|
#include <machine/atomic.h> |
#include <machine/atomic.h> |
|
#ifdef __FreeBSD__ |
#include <machine/bus_memio.h> |
#include <machine/bus_memio.h> |
#include <machine/bus_pio.h> |
#include <machine/bus_pio.h> |
#include <machine/bus.h> |
|
#include <machine/resource.h> |
#include <machine/resource.h> |
|
|
#include <sys/bus.h> |
#include <sys/bus.h> |
#include <sys/rman.h> |
#include <sys/rman.h> |
|
#endif |
|
#include <machine/bus.h> |
|
|
#include <machine/stdarg.h> |
#include <machine/stdarg.h> |
|
|
Line 109 __FBSDID("$FreeBSD: src/sys/compat/ndis/ |
|
Line 129 __FBSDID("$FreeBSD: src/sys/compat/ndis/ |
|
static char ndis_filepath[MAXPATHLEN]; |
static char ndis_filepath[MAXPATHLEN]; |
extern struct nd_head ndis_devhead; |
extern struct nd_head ndis_devhead; |
|
|
|
#ifdef __FreeBSD__ |
SYSCTL_STRING(_hw, OID_AUTO, ndis_filepath, CTLFLAG_RW, ndis_filepath, |
SYSCTL_STRING(_hw, OID_AUTO, ndis_filepath, CTLFLAG_RW, ndis_filepath, |
MAXPATHLEN, "Path used by NdisOpenFile() to search for files"); |
MAXPATHLEN, "Path used by NdisOpenFile() to search for files"); |
|
#endif |
|
|
__stdcall static void NdisInitializeWrapper(ndis_handle *, |
__stdcall static void NdisInitializeWrapper(ndis_handle *, |
driver_object *, void *, void *); |
driver_object *, void *, void *); |
Line 129 __stdcall static void NdisOpenConfigurat |
|
Line 151 __stdcall static void NdisOpenConfigurat |
|
ndis_handle, uint32_t, ndis_unicode_string *, ndis_handle *); |
ndis_handle, uint32_t, ndis_unicode_string *, ndis_handle *); |
__stdcall static void NdisOpenConfigurationKeyByName(ndis_status *, |
__stdcall static void NdisOpenConfigurationKeyByName(ndis_status *, |
ndis_handle, ndis_unicode_string *, ndis_handle *); |
ndis_handle, ndis_unicode_string *, ndis_handle *); |
|
#ifdef __FreeBSD__ |
static ndis_status ndis_encode_parm(ndis_miniport_block *, |
static ndis_status ndis_encode_parm(ndis_miniport_block *, |
struct sysctl_oid *, ndis_parm_type, ndis_config_parm **); |
struct sysctl_oid *, ndis_parm_type, ndis_config_parm **); |
|
#endif |
static ndis_status ndis_decode_parm(ndis_miniport_block *, |
static ndis_status ndis_decode_parm(ndis_miniport_block *, |
ndis_config_parm *, char *); |
ndis_config_parm *, char *); |
__stdcall static void NdisReadConfiguration(ndis_status *, ndis_config_parm **, |
__stdcall static void NdisReadConfiguration(ndis_status *, ndis_config_parm **, |
Line 260 __stdcall static void NdisGetFirstBuffer |
|
Line 284 __stdcall static void NdisGetFirstBuffer |
|
ndis_buffer **, void **, uint32_t *, uint32_t *); |
ndis_buffer **, void **, uint32_t *, uint32_t *); |
__stdcall static void NdisGetFirstBufferFromPacketSafe(ndis_packet *, |
__stdcall static void NdisGetFirstBufferFromPacketSafe(ndis_packet *, |
ndis_buffer **, void **, uint32_t *, uint32_t *, uint32_t); |
ndis_buffer **, void **, uint32_t *, uint32_t *, uint32_t); |
|
#ifdef __FreeBSD__ |
static int ndis_find_sym(linker_file_t, char *, char *, caddr_t *); |
static int ndis_find_sym(linker_file_t, char *, char *, caddr_t *); |
__stdcall static void NdisOpenFile(ndis_status *, ndis_handle *, uint32_t *, |
__stdcall static void NdisOpenFile(ndis_status *, ndis_handle *, uint32_t *, |
ndis_unicode_string *, ndis_physaddr); |
ndis_unicode_string *, ndis_physaddr); |
__stdcall static void NdisMapFile(ndis_status *, void **, ndis_handle); |
__stdcall static void NdisMapFile(ndis_status *, void **, ndis_handle); |
__stdcall static void NdisUnmapFile(ndis_handle); |
__stdcall static void NdisUnmapFile(ndis_handle); |
__stdcall static void NdisCloseFile(ndis_handle); |
__stdcall static void NdisCloseFile(ndis_handle); |
|
#endif |
__stdcall static uint8_t NdisSystemProcessorCount(void); |
__stdcall static uint8_t NdisSystemProcessorCount(void); |
__stdcall static void NdisMIndicateStatusComplete(ndis_handle); |
__stdcall static void NdisMIndicateStatusComplete(ndis_handle); |
__stdcall static void NdisMIndicateStatus(ndis_handle, ndis_status, |
__stdcall static void NdisMIndicateStatus(ndis_handle, ndis_status, |
Line 588 NdisOpenConfigurationKeyByIndex(status, |
|
Line 614 NdisOpenConfigurationKeyByIndex(status, |
|
return; |
return; |
} |
} |
|
|
|
#ifdef __FreeBSD__ |
static ndis_status |
static ndis_status |
ndis_encode_parm(block, oid, type, parm) |
ndis_encode_parm(block, oid, type, parm) |
ndis_miniport_block *block; |
ndis_miniport_block *block; |
Line 634 ndis_encode_parm(block, oid, type, parm) |
|
Line 661 ndis_encode_parm(block, oid, type, parm) |
|
|
|
return(NDIS_STATUS_SUCCESS); |
return(NDIS_STATUS_SUCCESS); |
} |
} |
|
#endif /* __FreeBSD__ */ |
|
|
int |
int |
ndis_strcasecmp(s1, s2) |
ndis_strcasecmp(s1, s2) |
Line 690 NdisReadConfiguration(status, parm, cfg, |
|
Line 718 NdisReadConfiguration(status, parm, cfg, |
|
ndis_unicode_string *key; |
ndis_unicode_string *key; |
ndis_parm_type type; |
ndis_parm_type type; |
{ |
{ |
|
#ifdef __FreeBSD__ |
char *keystr = NULL; |
char *keystr = NULL; |
uint16_t *unicode; |
uint16_t *unicode; |
ndis_miniport_block *block; |
ndis_miniport_block *block; |
Line 714 NdisReadConfiguration(status, parm, cfg, |
|
Line 743 NdisReadConfiguration(status, parm, cfg, |
|
* See if registry key is already in a list of known keys |
* See if registry key is already in a list of known keys |
* included with the driver. |
* included with the driver. |
*/ |
*/ |
|
|
#if __FreeBSD_version < 502113 |
#if __FreeBSD_version < 502113 |
TAILQ_FOREACH(e, &sc->ndis_ctx, link) { |
TAILQ_FOREACH(e, &sc->ndis_ctx, link) { |
#else |
#else |
Line 754 NdisReadConfiguration(status, parm, cfg, |
|
Line 784 NdisReadConfiguration(status, parm, cfg, |
|
free(keystr, M_DEVBUF); |
free(keystr, M_DEVBUF); |
*status = NDIS_STATUS_FAILURE; |
*status = NDIS_STATUS_FAILURE; |
return; |
return; |
|
#else /* __FreeBSD__ */ |
|
*status = NDIS_STATUS_FAILURE; |
|
return; |
|
#endif |
} |
} |
|
|
static ndis_status |
static ndis_status |
Line 792 NdisWriteConfiguration(status, cfg, key, |
|
Line 826 NdisWriteConfiguration(status, cfg, key, |
|
ndis_unicode_string *key; |
ndis_unicode_string *key; |
ndis_config_parm *parm; |
ndis_config_parm *parm; |
{ |
{ |
|
#ifdef __FreeBSD__ |
char *keystr = NULL; |
char *keystr = NULL; |
ndis_miniport_block *block; |
ndis_miniport_block *block; |
struct ndis_softc *sc; |
struct ndis_softc *sc; |
Line 800 NdisWriteConfiguration(status, cfg, key, |
|
Line 835 NdisWriteConfiguration(status, cfg, key, |
|
char val[256]; |
char val[256]; |
|
|
block = (ndis_miniport_block *)cfg; |
block = (ndis_miniport_block *)cfg; |
|
|
sc = device_get_softc(block->nmb_physdeviceobj->do_devext); |
sc = device_get_softc(block->nmb_physdeviceobj->do_devext); |
|
|
ndis_unicode_to_ascii(key->us_buf, key->us_len, &keystr); |
ndis_unicode_to_ascii(key->us_buf, key->us_len, &keystr); |
Line 814 NdisWriteConfiguration(status, cfg, key, |
|
Line 850 NdisWriteConfiguration(status, cfg, key, |
|
|
|
/* See if the key already exists. */ |
/* See if the key already exists. */ |
|
|
#if __FreeBSD_version < 502113 |
#if __FreeBSD_version < 502113 || !defined(__FreeBSD__) |
TAILQ_FOREACH(e, &sc->ndis_ctx, link) { |
TAILQ_FOREACH(e, &sc->ndis_ctx, link) { |
#else |
#else |
TAILQ_FOREACH(e, device_get_sysctl_ctx(sc->ndis_dev), link) { |
TAILQ_FOREACH(e, device_get_sysctl_ctx(sc->ndis_dev), link) { |
Line 835 NdisWriteConfiguration(status, cfg, key, |
|
Line 871 NdisWriteConfiguration(status, cfg, key, |
|
free(keystr, M_DEVBUF); |
free(keystr, M_DEVBUF); |
*status = NDIS_STATUS_SUCCESS; |
*status = NDIS_STATUS_SUCCESS; |
return; |
return; |
|
#else /* __FreeBSD__ */ |
|
*status = NDIS_STATUS_SUCCESS; |
|
return; |
|
#endif |
} |
} |
|
|
__stdcall static void |
__stdcall static void |
Line 940 NdisReadPciSlotInformation(adapter, slot |
|
Line 980 NdisReadPciSlotInformation(adapter, slot |
|
if (block == NULL) |
if (block == NULL) |
return(0); |
return(0); |
|
|
dev = block->nmb_physdeviceobj->do_devext; |
dev = (device_t)block->nmb_physdeviceobj->do_devext; |
|
|
/* |
/* |
* I have a test system consisting of a Sun w2100z |
* I have a test system consisting of a Sun w2100z |
Line 1088 NdisMStartBufferPhysicalMapping(adapter, |
|
Line 1128 NdisMStartBufferPhysicalMapping(adapter, |
|
map = sc->ndis_mmaps[mapreg]; |
map = sc->ndis_mmaps[mapreg]; |
nma.nma_fraglist = addrarray; |
nma.nma_fraglist = addrarray; |
|
|
|
#ifdef __FreeBSD__ |
error = bus_dmamap_load(sc->ndis_mtag, map, |
error = bus_dmamap_load(sc->ndis_mtag, map, |
MmGetMdlVirtualAddress(buf), MmGetMdlByteCount(buf), ndis_map_cb, |
MmGetMdlVirtualAddress(buf), MmGetMdlByteCount(buf), ndis_map_cb, |
(void *)&nma, BUS_DMA_NOWAIT); |
(void *)&nma, BUS_DMA_NOWAIT); |
|
#else |
|
error = bus_dmamap_load(sc->ndis_mtag, map, |
|
MmGetMdlVirtualAddress(buf), MmGetMdlByteCount(buf), |
|
NULL /* kernel space */, BUS_DMA_NOWAIT); |
|
/* callback function called "by hand" */ |
|
ndis_map_cb((void *)&nma, map->dm_segs, map->dm_nsegs, error); |
|
#endif |
if (error) |
if (error) |
return; |
return; |
|
|
|
#ifdef __FreeBSD__ |
bus_dmamap_sync(sc->ndis_mtag, map, |
bus_dmamap_sync(sc->ndis_mtag, map, |
writedev ? BUS_DMASYNC_PREWRITE : BUS_DMASYNC_PREREAD); |
writedev ? BUS_DMASYNC_PREWRITE : BUS_DMASYNC_PREREAD); |
|
#else |
|
bus_dmamap_sync(sc->ndis_mtag, map, 0, map->dm_mapsize, |
|
writedev ? BUS_DMASYNC_PREWRITE : BUS_DMASYNC_PREREAD); |
|
#endif |
*arraysize = nma.nma_cnt; |
*arraysize = nma.nma_cnt; |
|
|
return; |
return; |
Line 1124 NdisMCompleteBufferPhysicalMapping(adapt |
|
Line 1175 NdisMCompleteBufferPhysicalMapping(adapt |
|
|
|
map = sc->ndis_mmaps[mapreg]; |
map = sc->ndis_mmaps[mapreg]; |
|
|
|
#ifdef __FreeBSD__ |
bus_dmamap_sync(sc->ndis_mtag, map, |
bus_dmamap_sync(sc->ndis_mtag, map, |
BUS_DMASYNC_POSTREAD|BUS_DMASYNC_POSTWRITE); |
BUS_DMASYNC_POSTREAD|BUS_DMASYNC_POSTWRITE); |
|
#else |
|
bus_dmamap_sync(sc->ndis_mtag, map, 0, map->dm_mapsize, |
|
BUS_DMASYNC_POSTREAD|BUS_DMASYNC_POSTWRITE); |
|
#endif |
bus_dmamap_unload(sc->ndis_mtag, map); |
bus_dmamap_unload(sc->ndis_mtag, map); |
|
|
return; |
return; |
Line 1345 NdisReadNetworkAddress(status, addr, add |
|
Line 1400 NdisReadNetworkAddress(status, addr, add |
|
block = (ndis_miniport_block *)adapter; |
block = (ndis_miniport_block *)adapter; |
sc = device_get_softc(block->nmb_physdeviceobj->do_devext); |
sc = device_get_softc(block->nmb_physdeviceobj->do_devext); |
|
|
|
#ifdef __FreeBSD__ |
if (bcmp(sc->arpcom.ac_enaddr, empty, ETHER_ADDR_LEN) == 0) |
if (bcmp(sc->arpcom.ac_enaddr, empty, ETHER_ADDR_LEN) == 0) |
|
#else |
|
if (bcmp(LLADDR(sc->arpcom.ec_if.if_sadl), |
|
empty, ETHER_ADDR_LEN) == 0) |
|
#endif |
|
|
*status = NDIS_STATUS_FAILURE; |
*status = NDIS_STATUS_FAILURE; |
else { |
else { |
|
#ifdef __FreeBSD__ |
*addr = sc->arpcom.ac_enaddr; |
*addr = sc->arpcom.ac_enaddr; |
|
#else |
|
*addr = LLADDR(sc->arpcom.ec_if.if_sadl); |
|
#endif |
*addrlen = ETHER_ADDR_LEN; |
*addrlen = ETHER_ADDR_LEN; |
*status = NDIS_STATUS_SUCCESS; |
*status = NDIS_STATUS_SUCCESS; |
} |
} |
Line 1386 NdisMAllocateMapRegisters(adapter, dmach |
|
Line 1451 NdisMAllocateMapRegisters(adapter, dmach |
|
if (sc->ndis_mmaps == NULL) |
if (sc->ndis_mmaps == NULL) |
return(NDIS_STATUS_RESOURCES); |
return(NDIS_STATUS_RESOURCES); |
|
|
|
#ifdef __FreeBSD__ |
error = bus_dma_tag_create(sc->ndis_parent_tag, ETHER_ALIGN, 0, |
error = bus_dma_tag_create(sc->ndis_parent_tag, ETHER_ALIGN, 0, |
BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, |
BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, |
NULL, maxmap * nseg, nseg, maxmap, BUS_DMA_ALLOCNOW, |
NULL, maxmap * nseg, nseg, maxmap, BUS_DMA_ALLOCNOW, |
Line 1395 NdisMAllocateMapRegisters(adapter, dmach |
|
Line 1461 NdisMAllocateMapRegisters(adapter, dmach |
|
free(sc->ndis_mmaps, M_DEVBUF); |
free(sc->ndis_mmaps, M_DEVBUF); |
return(NDIS_STATUS_RESOURCES); |
return(NDIS_STATUS_RESOURCES); |
} |
} |
|
#else |
|
sc->ndis_mtag = sc->ndis_parent_tag; |
|
#endif |
for (i = 0; i < physmapneeded; i++) |
for (i = 0; i < physmapneeded; i++) |
|
#ifdef __FreeBSD__ |
bus_dmamap_create(sc->ndis_mtag, 0, &sc->ndis_mmaps[i]); |
bus_dmamap_create(sc->ndis_mtag, 0, &sc->ndis_mmaps[i]); |
|
#else |
|
bus_dmamap_create(sc->ndis_mtag, maxmap * nseg, |
|
nseg, maxmap, BUS_DMA_NOWAIT, |
|
0, &sc->ndis_mmaps[i]); |
|
#endif |
|
|
sc->ndis_mmapcnt = physmapneeded; |
sc->ndis_mmapcnt = physmapneeded; |
|
|
Line 1459 NdisMAllocateSharedMemory(adapter, len, |
|
Line 1533 NdisMAllocateSharedMemory(adapter, len, |
|
struct ndis_softc *sc; |
struct ndis_softc *sc; |
struct ndis_shmem *sh; |
struct ndis_shmem *sh; |
int error; |
int error; |
|
#ifndef __FreeBSD__ |
|
bus_dma_segment_t segs; |
|
int nsegs; |
|
#endif |
|
|
if (adapter == NULL) |
if (adapter == NULL) |
return; |
return; |
Line 1484 NdisMAllocateSharedMemory(adapter, len, |
|
Line 1562 NdisMAllocateSharedMemory(adapter, len, |
|
* than 1GB of physical memory. |
* than 1GB of physical memory. |
*/ |
*/ |
|
|
|
#ifdef __FreeBSD__ |
error = bus_dma_tag_create(sc->ndis_parent_tag, 64, |
error = bus_dma_tag_create(sc->ndis_parent_tag, 64, |
0, NDIS_BUS_SPACE_SHARED_MAXADDR, BUS_SPACE_MAXADDR, NULL, |
0, NDIS_BUS_SPACE_SHARED_MAXADDR, BUS_SPACE_MAXADDR, NULL, |
NULL, len, 1, len, BUS_DMA_ALLOCNOW, NULL, NULL, |
NULL, len, 1, len, BUS_DMA_ALLOCNOW, NULL, NULL, |
Line 1512 NdisMAllocateSharedMemory(adapter, len, |
|
Line 1591 NdisMAllocateSharedMemory(adapter, len, |
|
free(sh, M_DEVBUF); |
free(sh, M_DEVBUF); |
return; |
return; |
} |
} |
|
#else |
|
sh->ndis_stag = sc->ndis_parent_tag; |
|
|
|
error = bus_dmamem_alloc(sh->ndis_stag, len, 64, 0, |
|
&segs, 1, &nsegs, BUS_DMA_NOWAIT); |
|
if (error) { |
|
printf("bus_dmamem_alloc failed(1)\n"); |
|
return; |
|
} |
|
|
|
error = bus_dmamem_map(sh->ndis_stag, &segs, nsegs, |
|
len, (caddr_t *)&vaddr, BUS_DMA_NOWAIT); |
|
|
|
if (error) { |
|
printf("bus_dmamem_alloc failed(2)\n"); |
|
/* XXX free */ |
|
return; |
|
} |
|
|
|
error = bus_dmamap_create(sh->ndis_stag, len, nsegs, |
|
BUS_SPACE_MAXSIZE_32BIT, 0, |
|
BUS_DMA_ALLOCNOW, &sh->ndis_smap); |
|
|
|
if (error) { |
|
printf("bus_dmamem_alloc failed(3)\n"); |
|
/* XXX free, unmap */ |
|
return; |
|
} |
|
|
|
error = bus_dmamap_load(sh->ndis_stag, sh->ndis_smap, vaddr, |
|
len, NULL, BUS_DMA_NOWAIT); |
|
ndis_mapshared_cb((void *)paddr, |
|
sh->ndis_smap->dm_segs, |
|
sh->ndis_smap->dm_nsegs, error); |
|
|
|
if (error) { |
|
printf("bus_dmamem_alloc failed(3)\n"); |
|
/* XXX free, unmap, destroy */ |
|
return; |
|
} |
|
#endif |
|
|
sh->ndis_saddr = *vaddr; |
sh->ndis_saddr = *vaddr; |
sh->ndis_next = sc->ndis_shlist; |
sh->ndis_next = sc->ndis_shlist; |
Line 1621 NdisMFreeSharedMemory(adapter, len, cach |
|
Line 1741 NdisMFreeSharedMemory(adapter, len, cach |
|
} |
} |
|
|
bus_dmamap_unload(sh->ndis_stag, sh->ndis_smap); |
bus_dmamap_unload(sh->ndis_stag, sh->ndis_smap); |
|
#ifdef __FreeBSD__ |
bus_dmamem_free(sh->ndis_stag, vaddr, sh->ndis_smap); |
bus_dmamem_free(sh->ndis_stag, vaddr, sh->ndis_smap); |
|
#else |
|
bus_dmamem_unmap(sh->ndis_stag, vaddr, sh->ndis_smap->dm_mapsize); |
|
bus_dmamem_free(sh->ndis_stag, |
|
sh->ndis_smap->dm_segs, sh->ndis_smap->dm_nsegs ); |
|
#endif |
bus_dma_tag_destroy(sh->ndis_stag); |
bus_dma_tag_destroy(sh->ndis_stag); |
|
|
if (sh == sc->ndis_shlist) |
if (sh == sc->ndis_shlist) |
Line 2349 NdisMSleep(usecs) |
|
Line 2475 NdisMSleep(usecs) |
|
tv.tv_sec = 0; |
tv.tv_sec = 0; |
tv.tv_usec = usecs; |
tv.tv_usec = usecs; |
|
|
|
#ifdef __FreeBSD__ |
ndis_thsuspend(curthread->td_proc, NULL, tvtohz(&tv)); |
ndis_thsuspend(curthread->td_proc, NULL, tvtohz(&tv)); |
|
#else |
|
ndis_thsuspend(curproc, NULL, tvtohz(&tv)); |
|
#endif |
|
|
return; |
return; |
} |
} |
Line 2503 NdisGetCurrentSystemTime(tval) |
|
Line 2633 NdisGetCurrentSystemTime(tval) |
|
|
|
nanotime(&ts); |
nanotime(&ts); |
*tval = (uint64_t)ts.tv_nsec / 100 + (uint64_t)ts.tv_sec * 10000000 + |
*tval = (uint64_t)ts.tv_nsec / 100 + (uint64_t)ts.tv_sec * 10000000 + |
11644473600; |
(uint64_t)11644473600ULL; |
|
|
return; |
return; |
} |
} |
Line 2660 NdisGetFirstBufferFromPacketSafe(packet, |
|
Line 2790 NdisGetFirstBufferFromPacketSafe(packet, |
|
NdisGetFirstBufferFromPacket(packet, buf, firstva, firstlen, totlen); |
NdisGetFirstBufferFromPacket(packet, buf, firstva, firstlen, totlen); |
} |
} |
|
|
|
#ifdef __FreeBSD__ |
static int |
static int |
ndis_find_sym(lf, filename, suffix, sym) |
ndis_find_sym(lf, filename, suffix, sym) |
linker_file_t lf; |
linker_file_t lf; |
Line 2946 NdisCloseFile(filehandle) |
|
Line 3077 NdisCloseFile(filehandle) |
|
|
|
return; |
return; |
} |
} |
|
#endif /* __FreeBSD__ */ |
__stdcall static uint8_t |
__stdcall static uint8_t |
NdisSystemProcessorCount() |
NdisSystemProcessorCount() |
{ |
{ |
|
#ifdef __FreeBSD__ |
return(mp_ncpus); |
return(mp_ncpus); |
|
#else |
|
return(nprocs); |
|
#endif |
} |
} |
|
|
typedef void (*ndis_statusdone_handler)(ndis_handle); |
typedef void (*ndis_statusdone_handler)(ndis_handle); |
Line 3280 image_patch_table ndis_functbl[] = { |
|
Line 3415 image_patch_table ndis_functbl[] = { |
|
IMPORT_FUNC(NdisUnchainBufferAtFront), |
IMPORT_FUNC(NdisUnchainBufferAtFront), |
IMPORT_FUNC(NdisReadPcmciaAttributeMemory), |
IMPORT_FUNC(NdisReadPcmciaAttributeMemory), |
IMPORT_FUNC(NdisWritePcmciaAttributeMemory), |
IMPORT_FUNC(NdisWritePcmciaAttributeMemory), |
|
#ifdef __FreeBSD__ |
IMPORT_FUNC(NdisOpenFile), |
IMPORT_FUNC(NdisOpenFile), |
IMPORT_FUNC(NdisMapFile), |
IMPORT_FUNC(NdisMapFile), |
IMPORT_FUNC(NdisUnmapFile), |
IMPORT_FUNC(NdisUnmapFile), |
IMPORT_FUNC(NdisCloseFile), |
IMPORT_FUNC(NdisCloseFile), |
|
#endif |
IMPORT_FUNC(NdisMRegisterDevice), |
IMPORT_FUNC(NdisMRegisterDevice), |
IMPORT_FUNC(NdisMDeregisterDevice), |
IMPORT_FUNC(NdisMDeregisterDevice), |
IMPORT_FUNC(NdisMQueryAdapterInstanceName), |
IMPORT_FUNC(NdisMQueryAdapterInstanceName), |