Big style cleanup. While there remove references to FreeBSD versions

older than 6.0.

Submitted by:	Paul B Mahol <onemda at gmail.com>
This commit is contained in:
rpaulo 2009-11-02 11:07:42 +00:00
parent 0d8a28aed3
commit 898a75fb36
9 changed files with 426 additions and 806 deletions

View File

@ -184,7 +184,7 @@ ndis_modevent(module_t mod, int cmd, void *arg)
break;
}
return(error);
return (error);
}
DEV_MODULE(ndisapi, ndis_modevent, NULL);
MODULE_VERSION(ndisapi, 1);
@ -193,7 +193,6 @@ static void
ndis_sendrsrcavail_func(adapter)
ndis_handle adapter;
{
return;
}
static void
@ -211,8 +210,7 @@ ndis_status_func(adapter, status, sbuf, slen)
sc = device_get_softc(block->nmb_physdeviceobj->do_devext);
ifp = sc->ifp;
if (ifp->if_flags & IFF_DEBUG)
device_printf (sc->ndis_dev, "status: %x\n", status);
return;
device_printf(sc->ndis_dev, "status: %x\n", status);
}
static void
@ -227,8 +225,7 @@ ndis_statusdone_func(adapter)
sc = device_get_softc(block->nmb_physdeviceobj->do_devext);
ifp = sc->ifp;
if (ifp->if_flags & IFF_DEBUG)
device_printf (sc->ndis_dev, "status complete\n");
return;
device_printf(sc->ndis_dev, "status complete\n");
}
static void
@ -241,7 +238,6 @@ ndis_setdone_func(adapter, status)
block->nmb_setstat = status;
KeSetEvent(&block->nmb_setevent, IO_NO_INCREMENT, FALSE);
return;
}
static void
@ -254,7 +250,6 @@ ndis_getdone_func(adapter, status)
block->nmb_getstat = status;
KeSetEvent(&block->nmb_getevent, IO_NO_INCREMENT, FALSE);
return;
}
static void
@ -270,10 +265,8 @@ ndis_resetdone_func(ndis_handle adapter, ndis_status status,
ifp = sc->ifp;
if (ifp->if_flags & IFF_DEBUG)
device_printf (sc->ndis_dev, "reset done...\n");
device_printf(sc->ndis_dev, "reset done...\n");
KeSetEvent(&block->nmb_resetevent, IO_NO_INCREMENT, FALSE);
return;
}
int
@ -287,7 +280,7 @@ ndis_create_sysctls(arg)
struct sysctl_ctx_entry *e;
if (arg == NULL)
return(EINVAL);
return (EINVAL);
sc = arg;
vals = sc->ndis_regvals;
@ -367,7 +360,7 @@ ndis_create_sysctls(arg)
"Interrupt Number", buf, CTLFLAG_RD);
}
return(0);
return (0);
}
int
@ -388,7 +381,7 @@ ndis_add_sysctl(arg, key, desc, val, flag)
if (cfg == NULL) {
printf("failed for %s\n", key);
return(ENOMEM);
return (ENOMEM);
}
cfg->ndis_cfg.nc_cfgkey = strdup(key, M_DEVBUF);
@ -415,7 +408,7 @@ ndis_add_sysctl(arg, key, desc, val, flag)
cfg->ndis_cfg.nc_cfgdesc);
#endif
return(0);
return (0);
}
/*
@ -451,7 +444,7 @@ ndis_flush_sysctls(arg)
free(cfg, M_DEVBUF);
}
return(0);
return (0);
}
static void
@ -488,8 +481,6 @@ ndis_return(dobj, arg)
KeAcquireSpinLock(&block->nmb_returnlock, &irql);
}
KeReleaseSpinLock(&block->nmb_returnlock, irql);
return;
}
void
@ -522,8 +513,6 @@ ndis_return_packet(buf, arg)
IoQueueWorkItem(block->nmb_returnitem,
(io_workitem_func)kernndis_functbl[7].ipt_wrap,
WORKQUEUE_CRITICAL, block);
return;
}
void
@ -540,8 +529,6 @@ ndis_free_bufs(b0)
IoFreeMdl(b0);
b0 = next;
}
return;
}
void
@ -553,7 +540,6 @@ ndis_free_packet(p)
ndis_free_bufs(p->np_private.npp_head);
NdisFreePacket(p);
return;
}
int
@ -567,26 +553,18 @@ ndis_convert_res(arg)
device_t dev;
struct resource_list *brl;
struct resource_list_entry *brle;
#if __FreeBSD_version < 600022
struct resource_list brl_rev;
struct resource_list_entry *n;
#endif
int error = 0;
sc = arg;
block = sc->ndis_block;
dev = sc->ndis_dev;
#if __FreeBSD_version < 600022
SLIST_INIT(&brl_rev);
#endif
rl = malloc(sizeof(ndis_resource_list) +
(sizeof(cm_partial_resource_desc) * (sc->ndis_rescnt - 1)),
M_DEVBUF, M_NOWAIT|M_ZERO);
if (rl == NULL)
return(ENOMEM);
return (ENOMEM);
rl->cprl_version = 5;
rl->cprl_version = 1;
@ -597,37 +575,7 @@ ndis_convert_res(arg)
if (brl != NULL) {
#if __FreeBSD_version < 600022
/*
* We have a small problem. Some PCI devices have
* multiple I/O ranges. Windows orders them starting
* from lowest numbered BAR to highest. We discover
* them in that order too, but insert them into a singly
* linked list head first, which means when time comes
* to traverse the list, we enumerate them in reverse
* order. This screws up some drivers which expect the
* BARs to be in ascending order so that they can choose
* the "first" one as their register space. Unfortunately,
* in order to fix this, we have to create our own
* temporary list with the entries in reverse order.
*/
SLIST_FOREACH(brle, brl, link) {
n = malloc(sizeof(struct resource_list_entry),
M_TEMP, M_NOWAIT);
if (n == NULL) {
error = ENOMEM;
goto bad;
}
bcopy((char *)brle, (char *)n,
sizeof(struct resource_list_entry));
SLIST_INSERT_HEAD(&brl_rev, n, link);
}
SLIST_FOREACH(brle, &brl_rev, link) {
#else
STAILQ_FOREACH(brle, brl, link) {
#endif
switch (brle->type) {
case SYS_RES_IOPORT:
prd->cprd_type = CmResourceTypePort;
@ -671,17 +619,7 @@ ndis_convert_res(arg)
block->nmb_rlist = rl;
#if __FreeBSD_version < 600022
bad:
while (!SLIST_EMPTY(&brl_rev)) {
n = SLIST_FIRST(&brl_rev);
SLIST_REMOVE_HEAD(&brl_rev, link);
free (n, M_TEMP);
}
#endif
return(error);
return (error);
}
/*
@ -711,7 +649,7 @@ ndis_ptom(m0, p)
int diff;
if (p == NULL || m0 == NULL)
return(EINVAL);
return (EINVAL);
priv = &p->np_private;
buf = priv->npp_head;
@ -729,7 +667,7 @@ ndis_ptom(m0, p)
if (m == NULL) {
m_freem(*m0);
*m0 = NULL;
return(ENOBUFS);
return (ENOBUFS);
}
m->m_len = MmGetMdlByteCount(buf);
m->m_data = MmGetMdlVirtualAddress(buf);
@ -765,7 +703,7 @@ ndis_ptom(m0, p)
}
(*m0)->m_pkthdr.len = totlen;
return(0);
return (0);
}
/*
@ -793,7 +731,7 @@ ndis_mtop(m0, p)
ndis_packet_private *priv;
if (p == NULL || *p == NULL || m0 == NULL)
return(EINVAL);
return (EINVAL);
priv = &(*p)->np_private;
priv->npp_totlen = m0->m_pkthdr.len;
@ -805,7 +743,7 @@ ndis_mtop(m0, p)
if (buf == NULL) {
ndis_free_packet(*p);
*p = NULL;
return(ENOMEM);
return (ENOMEM);
}
MmBuildMdlForNonPagedPool(buf);
@ -818,7 +756,7 @@ ndis_mtop(m0, p)
priv->npp_tail = buf;
return(0);
return (0);
}
int
@ -831,25 +769,25 @@ ndis_get_supported_oids(arg, oids, oidcnt)
ndis_oid *o;
if (arg == NULL || oids == NULL || oidcnt == NULL)
return(EINVAL);
return (EINVAL);
len = 0;
ndis_get_info(arg, OID_GEN_SUPPORTED_LIST, NULL, &len);
o = malloc(len, M_DEVBUF, M_NOWAIT);
if (o == NULL)
return(ENOMEM);
return (ENOMEM);
rval = ndis_get_info(arg, OID_GEN_SUPPORTED_LIST, o, &len);
if (rval) {
free(o, M_DEVBUF);
return(rval);
return (rval);
}
*oids = o;
*oidcnt = len / 4;
return(0);
return (0);
}
int
@ -893,7 +831,7 @@ ndis_set_info(arg, oid, buf, buflen)
sc->ndis_block->nmb_devicectx == NULL) {
sc->ndis_block->nmb_pendingreq = NULL;
KeReleaseSpinLock(&sc->ndis_block->nmb_lock, irql);
return(ENXIO);
return (ENXIO);
}
rval = MSCALL6(setfunc, adapter, oid, buf, *buflen,
@ -917,19 +855,19 @@ ndis_set_info(arg, oid, buf, buflen)
*buflen = bytesneeded;
if (rval == NDIS_STATUS_INVALID_LENGTH)
return(ENOSPC);
return (ENOSPC);
if (rval == NDIS_STATUS_INVALID_OID)
return(EINVAL);
return (EINVAL);
if (rval == NDIS_STATUS_NOT_SUPPORTED ||
rval == NDIS_STATUS_NOT_ACCEPTED)
return(ENOTSUP);
return (ENOTSUP);
if (rval != NDIS_STATUS_SUCCESS)
return(ENODEV);
return (ENODEV);
return(0);
return (0);
}
typedef void (*ndis_senddone_func)(ndis_handle, ndis_packet *, ndis_status);
@ -951,7 +889,7 @@ ndis_send_packets(arg, packets, cnt)
sc = arg;
adapter = sc->ndis_block->nmb_miniportadapterctx;
if (adapter == NULL)
return(ENXIO);
return (ENXIO);
sendfunc = sc->ndis_chars->nmc_sendmulti_func;
senddonefunc = sc->ndis_block->nmb_senddone_func;
@ -976,7 +914,7 @@ ndis_send_packets(arg, packets, cnt)
if (NDIS_SERIALIZED(sc->ndis_block))
KeReleaseSpinLock(&sc->ndis_block->nmb_lock, irql);
return(0);
return (0);
}
int
@ -994,7 +932,7 @@ ndis_send_packet(arg, packet)
sc = arg;
adapter = sc->ndis_block->nmb_miniportadapterctx;
if (adapter == NULL)
return(ENXIO);
return (ENXIO);
sendfunc = sc->ndis_chars->nmc_sendsingle_func;
senddonefunc = sc->ndis_block->nmb_senddone_func;
@ -1006,7 +944,7 @@ ndis_send_packet(arg, packet)
if (status == NDIS_STATUS_PENDING) {
if (NDIS_SERIALIZED(sc->ndis_block))
KeReleaseSpinLock(&sc->ndis_block->nmb_lock, irql);
return(0);
return (0);
}
MSCALL3(senddonefunc, sc->ndis_block, packet, status);
@ -1014,7 +952,7 @@ ndis_send_packet(arg, packet)
if (NDIS_SERIALIZED(sc->ndis_block))
KeReleaseSpinLock(&sc->ndis_block->nmb_lock, irql);
return(0);
return (0);
}
int
@ -1030,18 +968,18 @@ ndis_init_dma(arg)
M_DEVBUF, M_NOWAIT|M_ZERO);
if (sc->ndis_tmaps == NULL)
return(ENOMEM);
return (ENOMEM);
for (i = 0; i < sc->ndis_maxpkts; i++) {
error = bus_dmamap_create(sc->ndis_ttag, 0,
&sc->ndis_tmaps[i]);
if (error) {
free(sc->ndis_tmaps, M_DEVBUF);
return(ENODEV);
return (ENODEV);
}
}
return(0);
return (0);
}
int
@ -1070,7 +1008,7 @@ ndis_destroy_dma(arg)
bus_dma_tag_destroy(sc->ndis_ttag);
return(0);
return (0);
}
int
@ -1093,7 +1031,7 @@ ndis_reset_nic(arg)
if (adapter == NULL || resetfunc == NULL ||
sc->ndis_block->nmb_devicectx == NULL) {
NDIS_UNLOCK(sc);
return(EIO);
return (EIO);
}
NDIS_UNLOCK(sc);
@ -1112,7 +1050,7 @@ ndis_reset_nic(arg)
KeWaitForSingleObject(&sc->ndis_block->nmb_resetevent,
0, 0, FALSE, NULL);
return(0);
return (0);
}
int
@ -1149,7 +1087,7 @@ ndis_halt_nic(arg)
adapter = sc->ndis_block->nmb_miniportadapterctx;
if (adapter == NULL) {
NDIS_UNLOCK(sc);
return(EIO);
return (EIO);
}
sc->ndis_block->nmb_devicectx = NULL;
@ -1169,7 +1107,7 @@ ndis_halt_nic(arg)
sc->ndis_block->nmb_miniportadapterctx = NULL;
NDIS_UNLOCK(sc);
return(0);
return (0);
}
int
@ -1186,7 +1124,7 @@ ndis_shutdown_nic(arg)
shutdownfunc = sc->ndis_chars->nmc_shutdown_handler;
NDIS_UNLOCK(sc);
if (adapter == NULL || shutdownfunc == NULL)
return(EIO);
return (EIO);
if (sc->ndis_chars->nmc_rsvd0 == NULL)
MSCALL1(shutdownfunc, adapter);
@ -1195,7 +1133,7 @@ ndis_shutdown_nic(arg)
TAILQ_REMOVE(&ndis_devhead, sc->ndis_block, link);
return(0);
return (0);
}
int
@ -1215,7 +1153,7 @@ ndis_pnpevent_nic(arg, type)
pnpeventfunc = sc->ndis_chars->nmc_pnpevent_handler;
NDIS_UNLOCK(sc);
if (adapter == NULL || pnpeventfunc == NULL)
return(EIO);
return (EIO);
if (sc->ndis_chars->nmc_rsvd0 == NULL)
MSCALL4(pnpeventfunc, adapter, type, NULL, 0);
@ -1237,7 +1175,7 @@ ndis_init_nic(arg)
uint32_t chosenmedium, i;
if (arg == NULL)
return(EINVAL);
return (EINVAL);
sc = arg;
NDIS_LOCK(sc);
@ -1262,7 +1200,7 @@ ndis_init_nic(arg)
NDIS_LOCK(sc);
sc->ndis_block->nmb_miniportadapterctx = NULL;
NDIS_UNLOCK(sc);
return(ENXIO);
return (status);
}
/*
@ -1281,7 +1219,7 @@ ndis_init_nic(arg)
sc->ndis_block->nmb_devicectx = sc;
NDIS_UNLOCK(sc);
return(0);
return (0);
}
static void
@ -1305,8 +1243,6 @@ ndis_intrsetup(dpc, dobj, ip, sc)
if (KeInsertQueueDpc(&intr->ni_dpc, NULL, NULL) == TRUE)
intr->ni_dpccnt++;
KeReleaseSpinLockFromDpcLevel(&intr->ni_dpccountlock);
return;
}
int
@ -1343,7 +1279,7 @@ ndis_get_info(arg, oid, buf, buflen)
sc->ndis_block->nmb_devicectx == NULL) {
sc->ndis_block->nmb_pendingreq = NULL;
KeReleaseSpinLock(&sc->ndis_block->nmb_lock, irql);
return(ENXIO);
return (ENXIO);
}
rval = MSCALL6(queryfunc, adapter, oid, buf, *buflen,
@ -1370,19 +1306,19 @@ ndis_get_info(arg, oid, buf, buflen)
if (rval == NDIS_STATUS_INVALID_LENGTH ||
rval == NDIS_STATUS_BUFFER_TOO_SHORT)
return(ENOSPC);
return (ENOSPC);
if (rval == NDIS_STATUS_INVALID_OID)
return(EINVAL);
return (EINVAL);
if (rval == NDIS_STATUS_NOT_SUPPORTED ||
rval == NDIS_STATUS_NOT_ACCEPTED)
return(ENOTSUP);
return (ENOTSUP);
if (rval != NDIS_STATUS_SUCCESS)
return(ENODEV);
return (ENODEV);
return(0);
return (0);
}
uint32_t
@ -1403,14 +1339,14 @@ NdisAddDevice(drv, pdo)
INTR_TYPE_NET | INTR_MPSAFE,
NULL, ntoskrnl_intr, NULL, &sc->ndis_intrhand);
if (error)
return(NDIS_STATUS_FAILURE);
return (NDIS_STATUS_FAILURE);
}
status = IoCreateDevice(drv, sizeof(ndis_miniport_block), NULL,
FILE_DEVICE_UNKNOWN, 0, FALSE, &fdo);
if (status != STATUS_SUCCESS)
return(status);
return (status);
block = fdo->do_devext;
@ -1446,7 +1382,7 @@ NdisAddDevice(drv, pdo)
if (status != NDIS_STATUS_SUCCESS) {
IoDetachDevice(block->nmb_nextdeviceobj);
IoDeleteDevice(fdo);
return(status);
return (status);
}
InitializeListHead((&block->nmb_packetlist));
}
@ -1498,5 +1434,5 @@ ndis_unload_driver(arg)
IoDetachDevice(sc->ndis_block->nmb_nextdeviceobj);
IoDeleteDevice(fdo);
return(0);
return (0);
}

View File

@ -123,7 +123,7 @@ windrv_libinit(void)
panic("failed to allocate thread info blocks");
smp_rendezvous(NULL, x86_newldt, NULL, NULL);
#endif
return(0);
return (0);
}
int
@ -148,7 +148,7 @@ windrv_libfini(void)
smp_rendezvous(NULL, x86_oldldt, NULL, NULL);
ExFreePool(my_tids);
#endif
return(0);
return (0);
}
/*
@ -172,7 +172,7 @@ windrv_lookup(img, name)
if (name != NULL) {
RtlInitAnsiString(&as, name);
if (RtlAnsiStringToUnicodeString(&us, &as, TRUE))
return(NULL);
return (NULL);
}
mtx_lock(&drvdb_mtx);
@ -183,7 +183,7 @@ windrv_lookup(img, name)
mtx_unlock(&drvdb_mtx);
if (name != NULL)
ExFreePool(us.us_buf);
return(d->windrv_object);
return (d->windrv_object);
}
}
mtx_unlock(&drvdb_mtx);
@ -191,7 +191,7 @@ windrv_lookup(img, name)
if (name != NULL)
RtlFreeUnicodeString(&us);
return(NULL);
return (NULL);
}
struct drvdb_ent *
@ -209,12 +209,12 @@ windrv_match(matchfunc, ctx)
match = matchfunc(d->windrv_bustype, d->windrv_devlist, ctx);
if (match == TRUE) {
mtx_unlock(&drvdb_mtx);
return(d);
return (d);
}
}
mtx_unlock(&drvdb_mtx);
return(NULL);
return (NULL);
}
/*
@ -283,7 +283,7 @@ windrv_unload(mod, img, len)
return (ENOENT);
if (drv == NULL)
return(ENOENT);
return (ENOENT);
/*
* Destroy any custom extensions that may have been added.
@ -306,7 +306,7 @@ windrv_unload(mod, img, len)
/* Free our DB handle */
free(r, M_DEVBUF);
return(0);
return (0);
}
#define WINDRV_LOADED htonl(0x42534F44)
@ -345,28 +345,28 @@ windrv_load(mod, img, len, bustype, devlist, regvals)
/* Perform text relocation */
if (pe_relocate(img))
return(ENOEXEC);
return (ENOEXEC);
/* Dynamically link the NDIS.SYS routines -- required. */
if (pe_patch_imports(img, "NDIS", ndis_functbl))
return(ENOEXEC);
return (ENOEXEC);
/* Dynamically link the HAL.dll routines -- optional. */
if (pe_get_import_descriptor(img, &imp_desc, "HAL") == 0) {
if (pe_patch_imports(img, "HAL", hal_functbl))
return(ENOEXEC);
return (ENOEXEC);
}
/* Dynamically link ntoskrnl.exe -- optional. */
if (pe_get_import_descriptor(img, &imp_desc, "ntoskrnl") == 0) {
if (pe_patch_imports(img, "ntoskrnl", ntoskrnl_functbl))
return(ENOEXEC);
return (ENOEXEC);
}
/* Dynamically link USBD.SYS -- optional */
if (pe_get_import_descriptor(img, &imp_desc, "USBD") == 0) {
if (pe_patch_imports(img, "USBD", usbd_functbl))
return(ENOEXEC);
return (ENOEXEC);
}
*ptr = WINDRV_LOADED;
@ -398,7 +398,7 @@ windrv_load(mod, img, len, bustype, devlist, regvals)
if (drv->dro_driverext == NULL) {
free(new, M_DEVBUF);
free(drv, M_DEVBUF);
return(ENOMEM);
return (ENOMEM);
}
InitializeListHead((&drv->dro_driverext->dre_usrext));
@ -410,7 +410,7 @@ windrv_load(mod, img, len, bustype, devlist, regvals)
if (RtlAnsiStringToUnicodeString(&drv->dro_drivername, &as, TRUE)) {
free(new, M_DEVBUF);
free(drv, M_DEVBUF);
return(ENOMEM);
return (ENOMEM);
}
new->windrv_object = drv;
@ -426,7 +426,7 @@ windrv_load(mod, img, len, bustype, devlist, regvals)
RtlFreeUnicodeString(&drv->dro_drivername);
free(drv, M_DEVBUF);
free(new, M_DEVBUF);
return(ENODEV);
return (ENODEV);
}
mtx_lock(&drvdb_mtx);
@ -463,7 +463,7 @@ windrv_create_pdo(drv, bsddev)
dev->do_devext = bsddev;
return(STATUS_SUCCESS);
return (STATUS_SUCCESS);
}
void
@ -482,8 +482,6 @@ windrv_destroy_pdo(drv, bsddev)
mtx_lock(&drvdb_mtx);
IoDeleteDevice(pdo);
mtx_unlock(&drvdb_mtx);
return;
}
/*
@ -503,13 +501,13 @@ windrv_find_pdo(drv, bsddev)
while (pdo != NULL) {
if (pdo->do_devext == bsddev) {
mtx_unlock(&drvdb_mtx);
return(pdo);
return (pdo);
}
pdo = pdo->do_nextdev;
}
mtx_unlock(&drvdb_mtx);
return(NULL);
return (NULL);
}
/*
@ -533,7 +531,7 @@ windrv_bus_attach(drv, name)
if (RtlAnsiStringToUnicodeString(&drv->dro_drivername, &as, TRUE))
{
free(new, M_DEVBUF);
return(ENOMEM);
return (ENOMEM);
}
/*
@ -550,7 +548,7 @@ windrv_bus_attach(drv, name)
STAILQ_INSERT_HEAD(&drvdb_head, new, link);
mtx_unlock(&drvdb_mtx);
return(0);
return (0);
}
#ifdef __amd64__
@ -578,7 +576,7 @@ windrv_wrap(func, wrap, argcnt, ftype)
p = malloc((wrapend - wrapstart), M_DEVBUF, M_NOWAIT);
if (p == NULL)
return(ENOMEM);
return (ENOMEM);
/* Copy over the code. */
@ -591,7 +589,7 @@ windrv_wrap(func, wrap, argcnt, ftype)
*wrap = p;
return(0);
return (0);
}
#endif /* __amd64__ */
@ -695,8 +693,6 @@ ctxsw_utow(void)
x86_critical_exit();
/* Now entering Windows land, population: you. */
return;
}
/*
@ -722,7 +718,6 @@ ctxsw_wtou(void)
if (t->tid_cpu != curthread->td_oncpu)
panic("ctxsw GOT MOVED TO OTHER CPU!");
#endif
return;
}
static int windrv_wrap_stdcall(funcptr, funcptr *, int);
@ -754,7 +749,7 @@ windrv_wrap_fastcall(func, wrap, argcnt)
p = malloc((wrapend - wrapstart), M_DEVBUF, M_NOWAIT);
if (p == NULL)
return(ENOMEM);
return (ENOMEM);
/* Copy over the code. */
@ -774,7 +769,7 @@ windrv_wrap_fastcall(func, wrap, argcnt)
*wrap = p;
return(0);
return (0);
}
extern void x86_stdcall_wrap(void);
@ -802,7 +797,7 @@ windrv_wrap_stdcall(func, wrap, argcnt)
p = malloc((wrapend - wrapstart), M_DEVBUF, M_NOWAIT);
if (p == NULL)
return(ENOMEM);
return (ENOMEM);
/* Copy over the code. */
@ -818,7 +813,7 @@ windrv_wrap_stdcall(func, wrap, argcnt)
*wrap = p;
return(0);
return (0);
}
extern void x86_regparm_wrap(void);
@ -842,7 +837,7 @@ windrv_wrap_regparm(func, wrap)
p = malloc((wrapend - wrapstart), M_DEVBUF, M_NOWAIT);
if (p == NULL)
return(ENOMEM);
return (ENOMEM);
/* Copy over the code. */
@ -855,7 +850,7 @@ windrv_wrap_regparm(func, wrap)
*wrap = p;
return(0);
return (0);
}
int
@ -867,18 +862,18 @@ windrv_wrap(func, wrap, argcnt, ftype)
{
switch(ftype) {
case WINDRV_WRAP_FASTCALL:
return(windrv_wrap_fastcall(func, wrap, argcnt));
return (windrv_wrap_fastcall(func, wrap, argcnt));
case WINDRV_WRAP_STDCALL:
return(windrv_wrap_stdcall(func, wrap, argcnt));
return (windrv_wrap_stdcall(func, wrap, argcnt));
case WINDRV_WRAP_REGPARM:
return(windrv_wrap_regparm(func, wrap));
return (windrv_wrap_regparm(func, wrap));
case WINDRV_WRAP_CDECL:
return(windrv_wrap_stdcall(func, wrap, 0));
return (windrv_wrap_stdcall(func, wrap, 0));
default:
break;
}
return(EINVAL);
return (EINVAL);
}
static void
@ -909,8 +904,6 @@ x86_oldldt(dummy)
x86_setldt(&gtable, ltable);
mtx_unlock_spin(&dt_lock);
return;
}
static void
@ -959,8 +952,6 @@ x86_newldt(dummy)
mtx_unlock_spin(&dt_lock);
/* Whew. */
return;
}
#endif /* __i386__ */
@ -971,5 +962,5 @@ windrv_unwrap(func)
{
free(func, M_DEVBUF);
return(0);
return (0);
}

View File

@ -102,8 +102,7 @@ hal_libinit()
patch++;
}
return(0);
return (0);
}
int
@ -121,7 +120,7 @@ hal_libfini()
patch++;
}
return(0);
return (0);
}
static void
@ -129,7 +128,6 @@ KeStallExecutionProcessor(usecs)
uint32_t usecs;
{
DELAY(usecs);
return;
}
static void
@ -138,21 +136,18 @@ WRITE_PORT_ULONG(port, val)
uint32_t val;
{
bus_space_write_4(NDIS_BUS_SPACE_IO, 0x0, (bus_size_t)port, val);
return;
}
static void
WRITE_PORT_USHORT(uint16_t *port, uint16_t val)
{
bus_space_write_2(NDIS_BUS_SPACE_IO, 0x0, (bus_size_t)port, val);
return;
}
static void
WRITE_PORT_UCHAR(uint8_t *port, uint8_t val)
{
bus_space_write_1(NDIS_BUS_SPACE_IO, 0x0, (bus_size_t)port, val);
return;
}
static void
@ -163,7 +158,6 @@ WRITE_PORT_BUFFER_ULONG(port, val, cnt)
{
bus_space_write_multi_4(NDIS_BUS_SPACE_IO, 0x0,
(bus_size_t)port, val, cnt);
return;
}
static void
@ -174,7 +168,6 @@ WRITE_PORT_BUFFER_USHORT(port, val, cnt)
{
bus_space_write_multi_2(NDIS_BUS_SPACE_IO, 0x0,
(bus_size_t)port, val, cnt);
return;
}
static void
@ -185,28 +178,27 @@ WRITE_PORT_BUFFER_UCHAR(port, val, cnt)
{
bus_space_write_multi_1(NDIS_BUS_SPACE_IO, 0x0,
(bus_size_t)port, val, cnt);
return;
}
static uint16_t
READ_PORT_USHORT(port)
uint16_t *port;
{
return(bus_space_read_2(NDIS_BUS_SPACE_IO, 0x0, (bus_size_t)port));
return (bus_space_read_2(NDIS_BUS_SPACE_IO, 0x0, (bus_size_t)port));
}
static uint32_t
READ_PORT_ULONG(port)
uint32_t *port;
{
return(bus_space_read_4(NDIS_BUS_SPACE_IO, 0x0, (bus_size_t)port));
return (bus_space_read_4(NDIS_BUS_SPACE_IO, 0x0, (bus_size_t)port));
}
static uint8_t
READ_PORT_UCHAR(port)
uint8_t *port;
{
return(bus_space_read_1(NDIS_BUS_SPACE_IO, 0x0, (bus_size_t)port));
return (bus_space_read_1(NDIS_BUS_SPACE_IO, 0x0, (bus_size_t)port));
}
static void
@ -217,7 +209,6 @@ READ_PORT_BUFFER_ULONG(port, val, cnt)
{
bus_space_read_multi_4(NDIS_BUS_SPACE_IO, 0x0,
(bus_size_t)port, val, cnt);
return;
}
static void
@ -228,7 +219,6 @@ READ_PORT_BUFFER_USHORT(port, val, cnt)
{
bus_space_read_multi_2(NDIS_BUS_SPACE_IO, 0x0,
(bus_size_t)port, val, cnt);
return;
}
static void
@ -239,7 +229,6 @@ READ_PORT_BUFFER_UCHAR(port, val, cnt)
{
bus_space_read_multi_1(NDIS_BUS_SPACE_IO, 0x0,
(bus_size_t)port, val, cnt);
return;
}
/*
@ -370,7 +359,7 @@ KfAcquireSpinLock(lock)
KeRaiseIrql(DISPATCH_LEVEL, &oldirql);
KeAcquireSpinLockAtDpcLevel(lock);
return(oldirql);
return (oldirql);
}
void
@ -378,16 +367,14 @@ KfReleaseSpinLock(kspin_lock *lock, uint8_t newirql)
{
KeReleaseSpinLockFromDpcLevel(lock);
KeLowerIrql(newirql);
return;
}
uint8_t
KeGetCurrentIrql()
{
if (mtx_owned(&disp_lock[curthread->td_oncpu]))
return(DISPATCH_LEVEL);
return(PASSIVE_LEVEL);
return (DISPATCH_LEVEL);
return (PASSIVE_LEVEL);
}
static uint64_t
@ -397,7 +384,7 @@ KeQueryPerformanceCounter(freq)
if (freq != NULL)
*freq = hz;
return((uint64_t)ticks);
return ((uint64_t)ticks);
}
uint8_t
@ -417,7 +404,7 @@ KfRaiseIrql(uint8_t irql)
}
/*printf("RAISE IRQL: %d %d\n", irql, oldirql);*/
return(oldirql);
return (oldirql);
}
void
@ -431,8 +418,6 @@ KfLowerIrql(uint8_t oldirql)
mtx_unlock(&disp_lock[curthread->td_oncpu]);
sched_unpin();
return;
}
static uint8_t
@ -441,20 +426,18 @@ KeRaiseIrqlToDpcLevel(void)
uint8_t irql;
KeRaiseIrql(DISPATCH_LEVEL, &irql);
return(irql);
return (irql);
}
static void
_KeLowerIrql(uint8_t oldirql)
{
KeLowerIrql(oldirql);
return;
}
static void dummy()
{
printf ("hal dummy called...\n");
return;
printf("hal dummy called...\n");
}
image_patch_table hal_functbl[] = {

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -89,7 +89,7 @@ pe_get_dos_header(imgbase, hdr)
bcopy ((char *)imgbase, (char *)hdr, sizeof(image_dos_header));
return(0);
return (0);
}
/*
@ -111,10 +111,10 @@ pe_is_nt_image(imgbase)
dos_hdr = (image_dos_header *)imgbase;
signature = *(uint32_t *)(imgbase + dos_hdr->idh_lfanew);
if (signature == IMAGE_NT_SIGNATURE)
return(0);
return (0);
}
return(ENOEXEC);
return (ENOEXEC);
}
/*
@ -132,7 +132,7 @@ pe_get_optional_header(imgbase, hdr)
image_nt_header *nt_hdr;
if (imgbase == 0 || hdr == NULL)
return(EINVAL);
return (EINVAL);
if (pe_is_nt_image(imgbase))
return (EINVAL);
@ -143,7 +143,7 @@ pe_get_optional_header(imgbase, hdr)
bcopy ((char *)&nt_hdr->inh_optionalhdr, (char *)hdr,
nt_hdr->inh_filehdr.ifh_optionalhdrlen);
return(0);
return (0);
}
/*
@ -160,7 +160,7 @@ pe_get_file_header(imgbase, hdr)
image_nt_header *nt_hdr;
if (imgbase == 0 || hdr == NULL)
return(EINVAL);
return (EINVAL);
if (pe_is_nt_image(imgbase))
return (EINVAL);
@ -179,7 +179,7 @@ pe_get_file_header(imgbase, hdr)
bcopy ((char *)&nt_hdr->inh_filehdr, (char *)hdr,
sizeof(image_file_header));
return(0);
return (0);
}
/*
@ -197,7 +197,7 @@ pe_get_section_header(imgbase, hdr)
image_section_header *sect_hdr;
if (imgbase == 0 || hdr == NULL)
return(EINVAL);
return (EINVAL);
if (pe_is_nt_image(imgbase))
return (EINVAL);
@ -208,7 +208,7 @@ pe_get_section_header(imgbase, hdr)
bcopy ((char *)sect_hdr, (char *)hdr, sizeof(image_section_header));
return(0);
return (0);
}
/*
@ -222,7 +222,7 @@ pe_numsections(imgbase)
image_file_header file_hdr;
if (pe_get_file_header(imgbase, &file_hdr))
return(0);
return (0);
return (file_hdr.ifh_numsections);
}
@ -239,7 +239,7 @@ pe_imagebase(imgbase)
image_optional_header optional_hdr;
if (pe_get_optional_header(imgbase, &optional_hdr))
return(0);
return (0);
return (optional_hdr.ioh_imagebase);
}
@ -258,14 +258,14 @@ pe_directory_offset(imgbase, diridx)
vm_offset_t dir;
if (pe_get_optional_header(imgbase, &opt_hdr))
return(0);
return (0);
if (diridx >= opt_hdr.ioh_rva_size_cnt)
return(0);
return (0);
dir = opt_hdr.ioh_datadir[diridx].idd_vaddr;
return(pe_translate_addr(imgbase, dir));
return (pe_translate_addr(imgbase, dir));
}
vm_offset_t
@ -280,7 +280,7 @@ pe_translate_addr(imgbase, rva)
int i = 0, sections, fixedlen;
if (pe_get_optional_header(imgbase, &opt_hdr))
return(0);
return (0);
sections = pe_numsections(imgbase);
@ -310,9 +310,9 @@ pe_translate_addr(imgbase, rva)
}
if (i > sections)
return(0);
return (0);
return((vm_offset_t)(imgbase + rva - sect_hdr->ish_vaddr +
return ((vm_offset_t)(imgbase + rva - sect_hdr->ish_vaddr +
sect_hdr->ish_rawdataaddr));
}
@ -335,7 +335,7 @@ pe_get_section(imgbase, hdr, name)
int i, sections;
if (imgbase == 0 || hdr == NULL)
return(EINVAL);
return (EINVAL);
if (pe_is_nt_image(imgbase))
return (EINVAL);
@ -350,7 +350,7 @@ pe_get_section(imgbase, hdr, name)
if (!strcmp ((char *)&sect_hdr->ish_name, name)) {
bcopy((char *)sect_hdr, (char *)hdr,
sizeof(image_section_header));
return(0);
return (0);
} else
sect_hdr++;
}
@ -420,7 +420,7 @@ pe_relocate(imgbase)
break;
default:
printf ("[%d]reloc type: %d\n",i,
printf("[%d]reloc type: %d\n",i,
IMR_RELTYPE(rel));
break;
}
@ -429,7 +429,7 @@ pe_relocate(imgbase)
relhdr->ibr_blocksize);
} while (relhdr->ibr_blocksize);
return(0);
return (0);
}
/*
@ -452,7 +452,7 @@ pe_get_import_descriptor(imgbase, desc, module)
char *modname;
if (imgbase == 0 || module == NULL || desc == NULL)
return(EINVAL);
return (EINVAL);
offset = pe_directory_offset(imgbase, IMAGE_DIRECTORY_ENTRY_IMPORT);
if (offset == 0)
@ -466,7 +466,7 @@ pe_get_import_descriptor(imgbase, desc, module)
if (!strncasecmp(module, modname, strlen(module))) {
bcopy((char *)imp_desc, (char *)desc,
sizeof(image_import_descriptor));
return(0);
return (0);
}
imp_desc++;
}
@ -486,7 +486,7 @@ pe_get_messagetable(imgbase, md)
int i;
if (imgbase == 0)
return(EINVAL);
return (EINVAL);
offset = pe_directory_offset(imgbase, IMAGE_DIRECTORY_ENTRY_RESOURCE);
if (offset == 0)
@ -514,10 +514,10 @@ pe_get_messagetable(imgbase, md)
dent2->irde_dataoff);
*md = (message_resource_data *)pe_translate_addr(imgbase,
rent->irde_offset);
return(0);
return (0);
}
return(ENOENT);
return (ENOENT);
}
int
@ -536,7 +536,7 @@ pe_get_message(imgbase, id, str, len, flags)
pe_get_messagetable(imgbase, &md);
if (md == NULL)
return(ENOENT);
return (ENOENT);
mb = (message_resource_block *)((uintptr_t)md +
sizeof(message_resource_data));
@ -551,12 +551,12 @@ pe_get_message(imgbase, id, str, len, flags)
*str = me->mre_text;
*len = me->mre_len;
*flags = me->mre_flags;
return(0);
return (0);
}
mb++;
}
return(ENOENT);
return (ENOENT);
}
/*
@ -573,16 +573,16 @@ pe_functbl_match(functbl, name)
image_patch_table *p;
if (functbl == NULL || name == NULL)
return(0);
return (0);
p = functbl;
while (p->ipt_name != NULL) {
if (!strcmp(p->ipt_name, name))
return((vm_offset_t)p->ipt_wrap);
return ((vm_offset_t)p->ipt_wrap);
p++;
}
printf ("no match for %s\n", name);
printf("no match for %s\n", name);
/*
* Return the wrapper pointer for this routine.
@ -591,7 +591,7 @@ pe_functbl_match(functbl, name)
* that does calling convention translation and
* then invokes the underlying routine.
*/
return((vm_offset_t)p->ipt_wrap);
return ((vm_offset_t)p->ipt_wrap);
}
/*
@ -615,10 +615,10 @@ pe_patch_imports(imgbase, module, functbl)
vm_offset_t func;
if (imgbase == 0 || module == NULL || functbl == NULL)
return(EINVAL);
return (EINVAL);
if (pe_get_import_descriptor(imgbase, &imp_desc, module))
return(ENOEXEC);
return (ENOEXEC);
nptr = (vm_offset_t *)pe_translate_addr(imgbase,
imp_desc.iid_import_name_table_addr);
@ -632,11 +632,11 @@ pe_patch_imports(imgbase, module, functbl)
*fptr = func;
#ifdef notdef
if (*fptr == 0)
return(ENOENT);
return (ENOENT);
#endif
nptr++;
fptr++;
}
return(0);
return (0);
}

View File

@ -206,7 +206,7 @@ usbd_libinit(void)
usbd_driver.dro_dispatch[IRP_MJ_PNP] =
(driver_dispatch)usbd_pnp_wrap;
return(0);
return (0);
}
int
@ -230,7 +230,7 @@ usbd_libfini(void)
free(usbd_driver.dro_drivername.us_buf, M_DEVBUF);
return(0);
return (0);
}
static int32_t
@ -589,7 +589,7 @@ usbd_func_selconf(ip)
intf->uii_len);
}
return USBD_STATUS_SUCCESS;
return (USBD_STATUS_SUCCESS);
}
static usb_error_t
@ -1348,10 +1348,10 @@ USBD_CreateConfigurationRequest(conf, len)
-1, -1, -1, -1, -1);
urb = USBD_CreateConfigurationRequestEx(conf, list);
if (urb == NULL)
return NULL;
return (NULL);
*len = urb->uu_selconf.usc_hdr.uuh_len;
return urb;
return (urb);
}
static union usbd_urb *
@ -1375,7 +1375,7 @@ USBD_CreateConfigurationRequestEx(conf, list)
selconf = ExAllocatePoolWithTag(NonPagedPool, size, 0);
if (selconf == NULL)
return NULL;
return (NULL);
selconf->usc_hdr.uuh_func = URB_FUNCTION_SELECT_CONFIGURATION;
selconf->usc_hdr.uuh_len = size;
selconf->usc_handle = conf;
@ -1421,8 +1421,6 @@ USBD_GetUSBDIVersion(ui)
ui->uvi_usbdi_vers = USBDI_VERSION;
ui->uvi_supported_vers = USB_VER_2_0;
return;
}
static usb_interface_descriptor_t *
@ -1473,7 +1471,6 @@ static void
dummy(void)
{
printf("USBD dummy called\n");
return;
}
image_patch_table usbd_functbl[] = {

View File

@ -51,7 +51,6 @@ __FBSDID("$FreeBSD$");
#include <sys/sysctl.h>
#include <sys/kthread.h>
#include <net/if.h>
#include <net/if_arp.h>
#include <net/ethernet.h>
@ -137,7 +136,6 @@ static void ndis_linksts (ndis_handle, ndis_status, void *, uint32_t);
static void ndis_linksts_done (ndis_handle);
/* We need to wrap these functions for amd64. */
static funcptr ndis_txeof_wrap;
static funcptr ndis_rxeof_wrap;
static funcptr ndis_rxeof_eth_wrap;
@ -210,7 +208,6 @@ static int ndisdrv_loaded = 0;
* image, and create a Windows driver object which will be
* saved in our driver database.
*/
int
ndisdrv_modevent(mod, cmd, arg)
module_t mod;
@ -299,7 +296,7 @@ ndis_setmulti(sc)
error = ndis_set_info(sc, OID_GEN_CURRENT_PACKET_FILTER,
&sc->ndis_filter, &len);
if (error)
device_printf (sc->ndis_dev,
device_printf(sc->ndis_dev,
"set allmulti failed: %d\n", error);
return;
}
@ -339,7 +336,7 @@ ndis_setmulti(sc)
len = len * ETHER_ADDR_LEN;
error = ndis_set_info(sc, OID_802_3_MULTICAST_LIST, mclist, &len);
if (error) {
device_printf (sc->ndis_dev, "set mclist failed: %d\n", error);
device_printf(sc->ndis_dev, "set mclist failed: %d\n", error);
sc->ndis_filter |= NDIS_PACKET_TYPE_ALL_MULTICAST;
sc->ndis_filter &= ~NDIS_PACKET_TYPE_MULTICAST;
}
@ -351,9 +348,7 @@ ndis_setmulti(sc)
error = ndis_set_info(sc, OID_GEN_CURRENT_PACKET_FILTER,
&sc->ndis_filter, &len);
if (error)
device_printf (sc->ndis_dev, "set multi failed: %d\n", error);
return;
device_printf(sc->ndis_dev, "set multi failed: %d\n", error);
}
static int
@ -369,16 +364,16 @@ ndis_set_offload(sc)
ifp = sc->ifp;
if (!NDIS_INITIALIZED(sc))
return(EINVAL);
return (EINVAL);
/* See if there's anything to set. */
error = ndis_probe_offload(sc);
if (error)
return(error);
return (error);
if (sc->ndis_hwassist == 0 && ifp->if_capabilities == 0)
return(0);
return (0);
len = sizeof(ndis_task_offload_hdr) + sizeof(ndis_task_offload) +
sizeof(ndis_task_tcpip_csum);
@ -386,7 +381,7 @@ ndis_set_offload(sc)
ntoh = malloc(len, M_TEMP, M_NOWAIT|M_ZERO);
if (ntoh == NULL)
return(ENOMEM);
return (ENOMEM);
ntoh->ntoh_vers = NDIS_TASK_OFFLOAD_VERSION;
ntoh->ntoh_len = sizeof(ndis_task_offload_hdr);
@ -415,7 +410,7 @@ ndis_set_offload(sc)
error = ndis_set_info(sc, OID_TCP_TASK_OFFLOAD, ntoh, &len);
free(ntoh, M_TEMP);
return(error);
return (error);
}
static int
@ -434,12 +429,12 @@ ndis_probe_offload(sc)
error = ndis_get_info(sc, OID_TCP_TASK_OFFLOAD, &dummy, &len);
if (error != ENOSPC)
return(error);
return (error);
ntoh = malloc(len, M_TEMP, M_NOWAIT|M_ZERO);
if (ntoh == NULL)
return(ENOMEM);
return (ENOMEM);
ntoh->ntoh_vers = NDIS_TASK_OFFLOAD_VERSION;
ntoh->ntoh_len = sizeof(ndis_task_offload_hdr);
@ -451,12 +446,12 @@ ndis_probe_offload(sc)
if (error) {
free(ntoh, M_TEMP);
return(error);
return (error);
}
if (ntoh->ntoh_vers != NDIS_TASK_OFFLOAD_VERSION) {
free(ntoh, M_TEMP);
return(EINVAL);
return (EINVAL);
}
nto = (ndis_task_offload *)((char *)ntoh +
@ -481,7 +476,7 @@ ndis_probe_offload(sc)
if (nttc == NULL) {
free(ntoh, M_TEMP);
return(ENOENT);
return (ENOENT);
}
sc->ndis_v4tx = nttc->nttc_v4tx;
@ -505,7 +500,7 @@ ndis_probe_offload(sc)
ifp->if_capabilities |= IFCAP_RXCSUM;
free(ntoh, M_TEMP);
return(0);
return (0);
}
static int
@ -632,7 +627,7 @@ ndis_attach(dev)
/* Call driver's init routine. */
if (ndis_init_nic(sc)) {
device_printf (dev, "init handler failed\n");
device_printf(dev, "init handler failed\n");
error = ENXIO;
goto fail;
}
@ -650,7 +645,7 @@ ndis_attach(dev)
len = sizeof(sc->ndis_maxpkts);
if (ndis_get_info(sc, OID_GEN_MAXIMUM_SEND_PACKETS,
&sc->ndis_maxpkts, &len)) {
device_printf (dev, "failed to get max TX packets\n");
device_printf(dev, "failed to get max TX packets\n");
error = ENXIO;
goto fail;
}
@ -659,7 +654,6 @@ ndis_attach(dev)
* If this is a deserialized miniport, we don't have
* to honor the OID_GEN_MAXIMUM_SEND_PACKETS result.
*/
if (!NDIS_SERIALIZED(sc->ndis_block))
sc->ndis_maxpkts = NDIS_TXPKTS;
@ -698,12 +692,11 @@ ndis_attach(dev)
* supported by this driver. If it is, then this an 802.11
* wireless driver, and we should set up media for wireless.
*/
for (i = 0; i < sc->ndis_oidcnt; i++) {
for (i = 0; i < sc->ndis_oidcnt; i++)
if (sc->ndis_oids[i] == OID_802_11_CONFIGURATION) {
sc->ndis_80211++;
break;
}
}
if (sc->ndis_80211)
ifp = if_alloc(IFT_IEEE80211);
@ -783,7 +776,7 @@ ndis_attach(dev)
r = ndis_get_info(sc, OID_802_11_SUPPORTED_RATES,
(void *)rates, &len);
if (r)
device_printf (dev, "get rates failed: 0x%x\n", r);
device_printf(dev, "get rates failed: 0x%x\n", r);
/*
* Since the supported rates only up to 8 can be supported,
* if this is not 802.11b we're just going to be faking it
@ -975,7 +968,7 @@ ndis_attach(dev)
ndis_halt_nic(sc);
DPRINTF(("halting done.\n"));
return(error);
return (error);
}
static struct ieee80211vap *
@ -1116,7 +1109,7 @@ ndis_detach(dev)
if (sc->ndis_iftype == PCIBus)
bus_dma_tag_destroy(sc->ndis_parent_tag);
return(0);
return (0);
}
int
@ -1134,7 +1127,7 @@ ndis_suspend(dev)
ndis_stop(sc);
#endif
return(0);
return (0);
}
int
@ -1150,7 +1143,7 @@ ndis_resume(dev)
if (NDIS_INITIALIZED(sc))
ndis_init(sc);
return(0);
return (0);
}
/*
@ -1160,7 +1153,6 @@ ndis_resume(dev)
* serialized miniports, or IRQL <= DISPATCH_LEVEL for deserialized
* miniports.
*/
static void
ndis_rxeof_eth(adapter, ctx, addr, hdr, hdrlen, lookahead, lookaheadlen, pktlen)
ndis_handle adapter;
@ -1230,8 +1222,6 @@ ndis_rxeof_eth(adapter, ctx, addr, hdr, hdrlen, lookahead, lookaheadlen, pktlen)
if (!NDIS_SERIALIZED(block))
KeReleaseSpinLock(&block->nmb_lock, irql);
return;
}
/*
@ -1239,7 +1229,6 @@ ndis_rxeof_eth(adapter, ctx, addr, hdr, hdrlen, lookahead, lookaheadlen, pktlen)
* for serialized miniports, or IRQL <= DISPATCH_LEVEL for deserialized
* miniports.
*/
static void
ndis_rxeof_done(adapter)
ndis_handle adapter;
@ -1254,8 +1243,6 @@ ndis_rxeof_done(adapter)
sc = device_get_softc(block->nmb_physdeviceobj->do_devext);
KeInsertQueueDpc(&sc->ndis_rxdpc, NULL, NULL);
return;
}
/*
@ -1330,8 +1317,6 @@ ndis_rxeof_xfr(dpc, adapter, sysarg1, sysarg2)
}
KeReleaseSpinLockFromDpcLevel(&block->nmb_lock);
return;
}
/*
@ -1370,8 +1355,6 @@ ndis_rxeof_xfr_done(adapter, packet, status, len)
IoQueueWorkItem(sc->ndis_inputitem,
(io_workitem_func)ndis_inputtask_wrap,
WORKQUEUE_CRITICAL, ifp);
return;
}
/*
* A frame has been uploaded: pass the resulting mbuf chain up to
@ -1416,7 +1399,6 @@ ndis_rxeof(adapter, packets, pktcnt)
* before we're completely ready to handle them. If we detect this,
* we need to return them to the miniport and ignore them.
*/
if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) {
for (i = 0; i < pktcnt; i++) {
p = packets[i];
@ -1433,7 +1415,7 @@ ndis_rxeof(adapter, packets, pktcnt)
/* Stash the softc here so ptom can use it. */
p->np_softc = sc;
if (ndis_ptom(&m0, p)) {
device_printf (sc->ndis_dev, "ptom failed\n");
device_printf(sc->ndis_dev, "ptom failed\n");
if (p->np_oob.npo_status == NDIS_STATUS_SUCCESS)
ndis_return_packet(p, block);
} else {
@ -1498,8 +1480,6 @@ ndis_rxeof(adapter, packets, pktcnt)
WORKQUEUE_CRITICAL, ifp);
}
}
return;
}
/*
@ -1508,7 +1488,6 @@ ndis_rxeof(adapter, packets, pktcnt)
* with any locks held (at DISPATCH_LEVEL, we'll be holding the
* 'dispatch level' per-cpu sleep lock).
*/
static void
ndis_inputtask(dobj, arg)
device_object *dobj;
@ -1541,8 +1520,6 @@ ndis_inputtask(dobj, arg)
KeAcquireSpinLock(&sc->ndis_rxlock, &irql);
}
KeReleaseSpinLock(&sc->ndis_rxlock, irql);
return;
}
/*
@ -1591,8 +1568,6 @@ ndis_txeof(adapter, packet, status)
IoQueueWorkItem(sc->ndis_startitem,
(io_workitem_func)ndis_starttask_wrap,
WORKQUEUE_CRITICAL, ifp);
return;
}
static void
@ -1633,8 +1608,6 @@ ndis_linksts(adapter, status, sbuf, slen)
sc->ndis_evt[sc->ndis_evtpidx].ne_len = slen;
NDIS_EVTINC(sc->ndis_evtpidx);
NDIS_UNLOCK(sc);
return;
}
static void
@ -1674,8 +1647,6 @@ ndis_linksts_done(adapter)
/* Notify possible listners of interface change. */
rt_ifmsg(ifp);
return;
}
static void
@ -1765,8 +1736,6 @@ ndis_ticktask(d, xsc)
}
NDIS_UNLOCK(sc);
return;
}
static void
@ -1792,8 +1761,6 @@ ndis_map_sclist(arg, segs, nseg, mapsize, error)
sclist->nsl_elements[i].nse_addr.np_quad = segs[i].ds_addr;
sclist->nsl_elements[i].nse_len = segs[i].ds_len;
}
return;
}
static int
@ -1803,7 +1770,7 @@ ndis_raw_xmit(struct ieee80211_node *ni, struct mbuf *m,
/* no support; just discard */
m_freem(m);
ieee80211_free_node(ni);
return 0;
return (0);
}
static void
@ -1831,7 +1798,6 @@ ndis_starttask(d, arg)
if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))
ndis_start(ifp);
return;
}
/*
@ -1846,7 +1812,6 @@ ndis_starttask(d, arg)
* we need to perform busdma work here. Those that use map registers
* will do the mapping themselves on a buffer by buffer basis.
*/
static void
ndis_start(ifp)
struct ifnet *ifp;
@ -1860,7 +1825,6 @@ ndis_start(ifp)
sc = ifp->if_softc;
NDIS_LOCK(sc);
if (!sc->ndis_link || ifp->if_drv_flags & IFF_DRV_OACTIVE) {
NDIS_UNLOCK(sc);
return;
@ -1933,7 +1897,6 @@ ndis_start(ifp)
* If there's a BPF listener, bounce a copy of this frame
* to him.
*/
if (!sc->ndis_80211) /* XXX handle 80211 */
BPF_MTAP(ifp, m);
@ -1944,7 +1907,6 @@ ndis_start(ifp)
* so the this batch of packets can be transmitted, then
* wait for txeof to ask us to send the rest.
*/
if (sc->ndis_txidx == 0)
break;
}
@ -1970,7 +1932,6 @@ ndis_start(ifp)
* a MiniportSend() routine (which sends just a single
* packet).
*/
if (sc->ndis_chars->nmc_sendmulti_func != NULL)
ndis_send_packets(sc, p0, pcnt);
else
@ -2029,12 +1990,11 @@ ndis_init(xsc)
&sc->ndis_filter, &len);
if (error)
device_printf (sc->ndis_dev, "set filter failed: %d\n", error);
device_printf(sc->ndis_dev, "set filter failed: %d\n", error);
/*
* Set lookahead.
*/
i = ifp->if_mtu;
len = sizeof(i);
ndis_set_info(sc, OID_GEN_CURRENT_LOOKAHEAD, &i, &len);
@ -2091,7 +2051,7 @@ ndis_ifmedia_upd(ifp)
if (NDIS_INITIALIZED(sc))
ndis_init(sc);
return(0);
return (0);
}
/*
@ -2105,7 +2065,7 @@ ndis_ifmedia_sts(ifp, ifmr)
struct ndis_softc *sc;
uint32_t media_info;
ndis_media_state linkstate;
int error, len;
int len;
ifmr->ifm_status = IFM_AVALID;
ifmr->ifm_active = IFM_ETHER;
@ -2115,17 +2075,17 @@ ndis_ifmedia_sts(ifp, ifmr)
return;
len = sizeof(linkstate);
error = ndis_get_info(sc, OID_GEN_MEDIA_CONNECT_STATUS,
ndis_get_info(sc, OID_GEN_MEDIA_CONNECT_STATUS,
(void *)&linkstate, &len);
len = sizeof(media_info);
error = ndis_get_info(sc, OID_GEN_LINK_SPEED,
ndis_get_info(sc, OID_GEN_LINK_SPEED,
(void *)&media_info, &len);
if (linkstate == nmc_connected)
ifmr->ifm_status |= IFM_ACTIVE;
switch(media_info) {
switch (media_info) {
case 100000:
ifmr->ifm_active |= IFM_10_T;
break;
@ -2139,8 +2099,6 @@ ndis_ifmedia_sts(ifp, ifmr)
device_printf(sc->ndis_dev, "unknown speed: %d\n", media_info);
break;
}
return;
}
static int
@ -2158,19 +2116,19 @@ ndis_set_cipher(sc, cipher)
if (cipher == WPA_CSE_WEP40 || WPA_CSE_WEP104) {
if (!(ic->ic_cryptocaps & IEEE80211_CRYPTO_WEP))
return(ENOTSUP);
return (ENOTSUP);
arg = NDIS_80211_WEPSTAT_ENC1ENABLED;
}
if (cipher == WPA_CSE_TKIP) {
if (!(ic->ic_cryptocaps & IEEE80211_CRYPTO_TKIP))
return(ENOTSUP);
return (ENOTSUP);
arg = NDIS_80211_WEPSTAT_ENC2ENABLED;
}
if (cipher == WPA_CSE_CCMP) {
if (!(ic->ic_cryptocaps & IEEE80211_CRYPTO_AES_CCM))
return(ENOTSUP);
return (ENOTSUP);
arg = NDIS_80211_WEPSTAT_ENC3ENABLED;
}
@ -2179,7 +2137,7 @@ ndis_set_cipher(sc, cipher)
rval = ndis_set_info(sc, OID_802_11_ENCRYPTION_STATUS, &arg, &len);
if (rval)
return(rval);
return (rval);
/* Check that the cipher was set correctly. */
@ -2187,9 +2145,9 @@ ndis_set_cipher(sc, cipher)
rval = ndis_get_info(sc, OID_802_11_ENCRYPTION_STATUS, &arg, &len);
if (rval != 0 || arg != save)
return(ENODEV);
return (ENODEV);
return(0);
return (0);
}
/*
@ -2200,7 +2158,6 @@ ndis_set_cipher(sc, cipher)
* of the WPA authentication modes isn't enabled, the driver
* might not permit the TKIP or AES ciphers to be selected.
*/
static int
ndis_set_wpa(sc, ie, ielen)
struct ndis_softc *sc;
@ -2226,7 +2183,7 @@ ndis_set_wpa(sc, ie, ielen)
/* Check for the right kind of IE. */
if (w->wpa_id != IEEE80211_ELEMID_VENDOR) {
DPRINTF(("Incorrect IE type %d\n", w->wpa_id));
return(EINVAL);
return (EINVAL);
}
/* Skip over the ucast cipher OIDs. */
@ -2254,7 +2211,7 @@ ndis_set_wpa(sc, ie, ielen)
DPRINTF(("Setting WPA auth mode to %d\n", arg));
i = sizeof(arg);
if (ndis_set_info(sc, OID_802_11_AUTHENTICATION_MODE, &arg, &i))
return(ENOTSUP);
return (ENOTSUP);
i = sizeof(arg);
ndis_get_info(sc, OID_802_11_AUTHENTICATION_MODE, &arg, &i);
@ -2264,7 +2221,7 @@ ndis_set_wpa(sc, ie, ielen)
n = (struct ndis_ie *)&w->wpa_mcipher[0];
if (ndis_set_cipher(sc, n->ni_val))
return(ENOTSUP);
return (ENOTSUP);
/* Now start looking around for the unicast ciphers. */
pos = (char *)&w->wpa_uciphers[0];
@ -2272,11 +2229,11 @@ ndis_set_wpa(sc, ie, ielen)
for (i = 0; i < w->wpa_uciphercnt; i++) {
if (ndis_set_cipher(sc, n->ni_val))
return(ENOTSUP);
return (ENOTSUP);
n++;
}
return(0);
return (0);
}
static void
@ -2301,7 +2258,6 @@ ndis_setstate_80211(sc)
}
/* Disassociate and turn off radio. */
len = sizeof(arg);
arg = 1;
ndis_set_info(sc, OID_802_11_DISASSOCIATE, &arg, &len);
@ -2320,7 +2276,6 @@ ndis_setstate_80211(sc)
device_printf (sc->ndis_dev, "set infra failed: %d\n", rval);
/* Set power management */
len = sizeof(arg);
if (vap->iv_flags & IEEE80211_F_PMGTON)
arg = NDIS_80211_POWERMODE_FAST_PSP;
@ -2340,7 +2295,6 @@ ndis_setstate_80211(sc)
* Default encryption mode to off, authentication
* to open and privacy to 'accept everything.'
*/
len = sizeof(arg);
arg = NDIS_80211_WEPSTAT_DISABLED;
ndis_set_info(sc, OID_802_11_ENCRYPTION_STATUS, &arg, &len);
@ -2350,7 +2304,7 @@ ndis_setstate_80211(sc)
ndis_set_info(sc, OID_802_11_AUTHENTICATION_MODE, &arg, &len);
/*
* Note that OID_80211_PRIVACY_FILTER is optional:
* Note that OID_802_11_PRIVACY_FILTER is optional:
* not all drivers implement it.
*/
len = sizeof(arg);
@ -2407,7 +2361,6 @@ ndis_setstate_80211(sc)
if (rval)
device_printf(sc->ndis_dev,
"setting BSSID failed: %d\n", rval);
}
static void
@ -2465,7 +2418,7 @@ ndis_auth_and_assoc(sc, vap)
if (vap->iv_flags & IEEE80211_F_PRIVACY &&
!(vap->iv_flags & IEEE80211_F_WPA)) {
int keys_set = 0;
int keys_set = 0;
if (ni->ni_authmode == IEEE80211_AUTH_SHARED) {
len = sizeof(arg);
@ -2484,9 +2437,9 @@ ndis_auth_and_assoc(sc, vap)
/*
* 5, 13 and 16 are the only valid
* only valid key lengths. Anything
* in between will be zero padded out to
* the next highest boundary.
* key lengths. Anything in between
* will be zero padded out to the
* next highest boundary.
*/
if (vap->iv_nw_keys[i].wk_keylen < 5)
wep.nw_keylen = 5;
@ -2569,7 +2522,7 @@ ndis_auth_and_assoc(sc, vap)
rval = ndis_set_info(sc, OID_802_11_NETWORK_TYPE_IN_USE,
&arg, &len);
if (rval)
device_printf (sc->ndis_dev,
device_printf(sc->ndis_dev,
"set nettype failed: %d\n", rval);
}
#endif
@ -2672,13 +2625,13 @@ ndis_get_assoc(sc, assoc)
int i, len, error;
if (!sc->ndis_link)
return(ENOENT);
return (ENOENT);
len = sizeof(bssid);
error = ndis_get_info(sc, OID_802_11_BSSID, &bssid, &len);
if (error) {
device_printf(sc->ndis_dev, "failed to get bssid\n");
return(ENOENT);
return (ENOENT);
}
vap = TAILQ_FIRST(&ic->ic_vaps);
@ -2694,19 +2647,19 @@ ndis_get_assoc(sc, assoc)
*assoc = malloc(bs->nwbx_len, M_TEMP, M_NOWAIT);
if (*assoc == NULL) {
free(bl, M_TEMP);
return(ENOMEM);
return (ENOMEM);
}
bcopy((char *)bs, (char *)*assoc, bs->nwbx_len);
free(bl, M_TEMP);
if (ic->ic_opmode == IEEE80211_M_STA)
ni->ni_associd = 1 | 0xc000; /* fake associd */
return(0);
return (0);
}
bs = (ndis_wlan_bssid_ex *)((char *)bs + bs->nwbx_len);
}
free(bl, M_TEMP);
return(ENOENT);
return (ENOENT);
}
static void
@ -2746,7 +2699,7 @@ ndis_getstate_80211(sc)
len = sizeof(arg);
rval = ndis_get_info(sc, OID_GEN_LINK_SPEED, &arg, &len);
if (rval)
device_printf (sc->ndis_dev, "get link speed failed: %d\n",
device_printf(sc->ndis_dev, "get link speed failed: %d\n",
rval);
ni->ni_txrate = arg / 5000;
@ -2787,18 +2740,16 @@ ndis_getstate_80211(sc)
free(bs, M_TEMP);
/*
* Determine current authentication mode. Note: authmode
* reporting isn't supported prior to FreeBSD 6.x.
* Determine current authentication mode.
*/
len = sizeof(arg);
rval = ndis_get_info(sc, OID_802_11_AUTHENTICATION_MODE, &arg, &len);
if (rval)
device_printf (sc->ndis_dev,
device_printf(sc->ndis_dev,
"get authmode status failed: %d\n", rval);
else {
vap->iv_flags &= ~IEEE80211_F_WPA;
switch(arg) {
switch (arg) {
case NDIS_80211_AUTHMODE_OPEN:
ni->ni_authmode = IEEE80211_AUTH_OPEN;
break;
@ -2829,14 +2780,13 @@ ndis_getstate_80211(sc)
rval = ndis_get_info(sc, OID_802_11_WEP_STATUS, &arg, &len);
if (rval)
device_printf (sc->ndis_dev,
device_printf(sc->ndis_dev,
"get wep status failed: %d\n", rval);
if (arg == NDIS_80211_WEPSTAT_ENABLED)
vap->iv_flags |= IEEE80211_F_PRIVACY|IEEE80211_F_DROPUNENC;
else
vap->iv_flags &= ~(IEEE80211_F_PRIVACY|IEEE80211_F_DROPUNENC);
return;
}
static int
@ -2851,7 +2801,7 @@ ndis_ioctl(ifp, command, data)
/*NDIS_LOCK(sc);*/
switch(command) {
switch (command) {
case SIOCSIFFLAGS:
if (ifp->if_flags & IFF_UP) {
if (ifp->if_drv_flags & IFF_DRV_RUNNING &&
@ -2922,7 +2872,7 @@ ndis_ioctl_80211(ifp, command, data)
void *oidbuf;
int error = 0;
switch(command) {
switch (command) {
case SIOCSIFFLAGS:
/*NDIS_LOCK(sc);*/
if (ifp->if_flags & IFF_UP) {
@ -3045,7 +2995,7 @@ ndis_ioctl_80211(ifp, command, data)
error = EINVAL;
break;
}
return(error);
return (error);
}
int
@ -3071,9 +3021,9 @@ ndis_del_key(vap, key)
error = ndis_set_info(sc, OID_802_11_REMOVE_KEY, &rkey, &len);
if (error)
return(0);
return (0);
return(1);
return (1);
}
/*
@ -3081,7 +3031,6 @@ ndis_del_key(vap, key)
* only use it for WPA TKIP or AES keys. These need to be
* set after initial authentication with the AP.
*/
static int
ndis_add_key(vap, key, mac)
struct ieee80211vap *vap;
@ -3159,7 +3108,7 @@ ndis_add_key(vap, key, mac)
/* We need to return 1 for success, 0 for failure. */
if (error)
return(0);
return (0);
return (1);
}
@ -3173,7 +3122,6 @@ ndis_resettask(d, arg)
sc = arg;
ndis_reset_nic(sc);
return;
}
/*
@ -3214,8 +3162,6 @@ ndis_stop(sc)
sc->ndis_evtcidx = 0;
sc->ndis_evtpidx = 0;
NDIS_UNLOCK(sc);
return;
}
/*
@ -3230,8 +3176,6 @@ ndis_shutdown(dev)
sc = device_get_softc(dev);
ndis_stop(sc);
return;
}
static int
@ -3426,8 +3370,7 @@ ndis_scan_start(struct ieee80211com *ic)
DPRINTF(("%s: set ESSID failed\n", __func__));
len = 0;
error = ndis_set_info(sc, OID_802_11_BSSID_LIST_SCAN,
NULL, &len);
error = ndis_set_info(sc, OID_802_11_BSSID_LIST_SCAN, NULL, &len);
if (error) {
DPRINTF(("%s: scan command failed\n", __func__));
ieee80211_cancel_scan(vap);
@ -3460,4 +3403,3 @@ ndis_scan_end(struct ieee80211com *ic)
{
/* ignore */
}

View File

@ -194,9 +194,9 @@ ndisusb_attach(device_t self)
}
if (ndis_attach(self) != 0)
return ENXIO;
return (ENXIO);
return 0;
return (0);
}
static int