From owner-p4-projects@FreeBSD.ORG Thu Dec 25 11:46:17 2003 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id D861516A4D0; Thu, 25 Dec 2003 11:46:16 -0800 (PST) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 95A0916A4CE for ; Thu, 25 Dec 2003 11:46:16 -0800 (PST) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1682043D2F for ; Thu, 25 Dec 2003 11:46:13 -0800 (PST) (envelope-from sam@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.10/8.12.10) with ESMTP id hBPJkD0B079975 for ; Thu, 25 Dec 2003 11:46:13 -0800 (PST) (envelope-from sam@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.10/8.12.10/Submit) id hBPJkCHp079972 for perforce@freebsd.org; Thu, 25 Dec 2003 11:46:12 -0800 (PST) (envelope-from sam@freebsd.org) Date: Thu, 25 Dec 2003 11:46:12 -0800 (PST) Message-Id: <200312251946.hBPJkCHp079972@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to sam@freebsd.org using -f From: Sam Leffler To: Perforce Change Reviews Subject: PERFORCE change 44311 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Dec 2003 19:46:17 -0000 http://perforce.freebsd.org/chv.cgi?CH=44311 Change 44311 by sam@sam_ebb on 2003/12/25 11:46:12 IFC Affected files ... .. //depot/projects/netperf+sockets/sys/compat/linux/linux_socket.c#4 integrate .. //depot/projects/netperf+sockets/sys/compat/ndis/kern_ndis.c#4 integrate .. //depot/projects/netperf+sockets/sys/compat/ndis/ndis_var.h#4 integrate .. //depot/projects/netperf+sockets/sys/compat/ndis/subr_ndis.c#4 integrate .. //depot/projects/netperf+sockets/sys/compat/ndis/subr_ntoskrnl.c#3 integrate .. //depot/projects/netperf+sockets/sys/compat/ndis/subr_pe.c#2 integrate .. //depot/projects/netperf+sockets/sys/conf/kmod.mk#3 integrate .. //depot/projects/netperf+sockets/sys/dev/ata/ata-chipset.c#4 integrate .. //depot/projects/netperf+sockets/sys/dev/hifn/hifn7751.c#2 integrate .. //depot/projects/netperf+sockets/sys/dev/if_ndis/if_ndis.c#4 integrate .. //depot/projects/netperf+sockets/sys/dev/raidframe/rf_freebsdkintf.c#2 integrate .. //depot/projects/netperf+sockets/sys/ia64/ia64/dump_machdep.c#2 integrate .. //depot/projects/netperf+sockets/sys/kern/uipc_mbuf.c#4 integrate Differences ... ==== //depot/projects/netperf+sockets/sys/compat/linux/linux_socket.c#4 (text+ko) ==== @@ -27,7 +27,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/compat/linux/linux_socket.c,v 1.44 2003/11/09 17:04:04 dwmalone Exp $"); +__FBSDID("$FreeBSD: src/sys/compat/linux/linux_socket.c,v 1.45 2003/12/25 09:59:02 bde Exp $"); /* XXX we use functions that might not exist. */ #include "opt_compat.h" @@ -405,20 +405,20 @@ linux_check_hdrincl(struct thread *td, caddr_t *sg, int s) { struct getsockopt_args /* { - int s; - int level; - int name; - caddr_t val; - int *avalsize; + int s; + int level; + int name; + void * __restrict val; + socklen_t * __restrict avalsize; } */ bsd_args; - int error; - caddr_t val, valsize; - int size_val = sizeof val; - int optval; + void * __restrict val; + socklen_t * __restrict valsize; + int error, optval, size_val; - val = stackgap_alloc(sg, sizeof(int)); - valsize = stackgap_alloc(sg, sizeof(int)); + val = stackgap_alloc(sg, sizeof(size_val)); + valsize = stackgap_alloc(sg, sizeof(socklen_t)); + size_val = sizeof(val); if ((error = copyout(&size_val, valsize, sizeof(size_val)))) return (error); @@ -426,7 +426,7 @@ bsd_args.level = IPPROTO_IP; bsd_args.name = IP_HDRINCL; bsd_args.val = val; - bsd_args.avalsize = (int *)valsize; + bsd_args.avalsize = valsize; if ((error = getsockopt(td, &bsd_args))) return (error); @@ -701,17 +701,17 @@ { struct linux_accept_args linux_args; struct accept_args /* { - int s; - caddr_t name; - int *anamelen; + int s; + struct sockaddr * __restrict name; + socklen_t * __restrict anamelen; } */ bsd_args; struct close_args /* { int fd; } */ c_args; struct fcntl_args /* { - int fd; - int cmd; - long arg; + int fd; + int cmd; + long arg; } */ f_args; int error; @@ -719,8 +719,9 @@ return (error); bsd_args.s = linux_args.s; - bsd_args.name = (void *)linux_args.addr; - bsd_args.anamelen = linux_args.namelen; + /* XXX: */ + bsd_args.name = (struct sockaddr * __restrict)linux_args.addr; + bsd_args.anamelen = linux_args.namelen; /* XXX */ error = oaccept(td, &bsd_args); if (error) return (error); @@ -757,9 +758,9 @@ { struct linux_getsockname_args linux_args; struct getsockname_args /* { - int fdes; - caddr_t asa; - int *alen; + int fdes; + struct sockaddr * __restrict asa; + socklen_t * __restrict alen; } */ bsd_args; int error; @@ -767,8 +768,9 @@ return (error); bsd_args.fdes = linux_args.s; - bsd_args.asa = (void *) linux_args.addr; - bsd_args.alen = linux_args.namelen; + /* XXX: */ + bsd_args.asa = (struct sockaddr * __restrict)linux_args.addr; + bsd_args.alen = linux_args.namelen; /* XXX */ error = ogetsockname(td, &bsd_args); if (error) return (error); @@ -942,12 +944,12 @@ { struct linux_recvfrom_args linux_args; struct recvfrom_args /* { - int s; - caddr_t buf; - size_t len; - int flags; - caddr_t from; - int *fromlenaddr; + int s; + caddr_t buf; + size_t len; + int flags; + struct sockaddr * __restrict from; + socklen_t * __restrict fromlenaddr; } */ bsd_args; int error; @@ -958,8 +960,9 @@ bsd_args.buf = linux_args.buf; bsd_args.len = linux_args.len; bsd_args.flags = linux_to_bsd_msg_flags(linux_args.flags); - bsd_args.from = (void *)linux_args.from; - bsd_args.fromlenaddr = linux_args.fromlen; + /* XXX: */ + bsd_args.from = (struct sockaddr * __restrict)linux_args.from; + bsd_args.fromlenaddr = linux_args.fromlen; /* XXX */ error = orecvfrom(td, &bsd_args); if (error) return (error); ==== //depot/projects/netperf+sockets/sys/compat/ndis/kern_ndis.c#4 (text+ko) ==== @@ -31,7 +31,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/compat/ndis/kern_ndis.c,v 1.9 2003/12/24 18:23:02 alfred Exp $"); +__FBSDID("$FreeBSD: src/sys/compat/ndis/kern_ndis.c,v 1.11 2003/12/25 06:04:39 wpaul Exp $"); #include #include @@ -328,8 +328,8 @@ } void -ndis_return_packet(packet, arg) - void *packet; +ndis_return_packet(buf, arg) + void *buf; /* not used */ void *arg; { struct ndis_softc *sc; @@ -337,25 +337,25 @@ ndis_packet *p; __stdcall ndis_return_handler returnfunc; - if (arg == NULL || packet == NULL) + if (arg == NULL) return; - p = packet; + p = arg; /* Decrement refcount. */ - p->np_private.npp_count--; + p->np_refcnt--; /* Release packet when refcount hits zero, otherwise return. */ - if (p->np_private.npp_count) + if (p->np_refcnt) return; - sc = arg; + sc = p->np_softc; returnfunc = sc->ndis_chars.nmc_return_packet_func; adapter = sc->ndis_block.nmb_miniportadapterctx; if (returnfunc == NULL) - ndis_free_packet((ndis_packet *)packet); + ndis_free_packet(p); else - returnfunc(adapter, (ndis_packet *)packet); + returnfunc(adapter, p); return; } @@ -474,7 +474,7 @@ priv = &p->np_private; buf = priv->npp_head; - priv->npp_count = 0; + p->np_refcnt = 0; for (buf = priv->npp_head; buf != NULL; buf = buf->nb_next) { if (buf == priv->npp_head) @@ -489,9 +489,8 @@ m->m_len = buf->nb_bytecount; m->m_data = MDL_VA(buf); MEXTADD(m, m->m_data, m->m_len, ndis_return_packet, - p->np_rsvd[0], 0, EXT_NDIS); - m->m_ext.ext_buf = (void *)p; /* XXX */ - priv->npp_count++; + p, 0, EXT_NDIS); + p->np_refcnt++; totlen += m->m_len; if (m->m_flags & MT_HEADER) *m0 = m; @@ -753,12 +752,15 @@ ndis_handle adapter; __stdcall ndis_halt_handler haltfunc; struct ifnet *ifp; + struct ndis_timer_entry *ne; + struct callout_handle *ch; sc = arg; ifp = &sc->arpcom.ac_if; adapter = sc->ndis_block.nmb_miniportadapterctx; if (adapter == NULL) return(EIO); + haltfunc = sc->ndis_chars.nmc_halt_func; if (haltfunc == NULL) @@ -774,6 +776,17 @@ sc->ndis_block.nmb_miniportadapterctx = NULL; + /* Clobber all the timers in case the driver left one running. */ + + while (!TAILQ_EMPTY(&sc->ndis_block.nmb_timerlist)) { + ne = TAILQ_FIRST(&sc->ndis_block.nmb_timerlist); + TAILQ_REMOVE(&sc->ndis_block.nmb_timerlist, ne, link); + ch = &ne->nte_ch; + if (ch->callout != NULL) + untimeout(ch->callout->c_func, ch->callout->c_arg, *ch); + free(ne, M_DEVBUF); + } + return(0); } @@ -821,6 +834,8 @@ block = &sc->ndis_block; initfunc = sc->ndis_chars.nmc_init_func; + TAILQ_INIT(&block->nmb_timerlist); + for (i = 0; i < NdisMediumMax; i++) mediumarray[i] = i; ==== //depot/projects/netperf+sockets/sys/compat/ndis/ndis_var.h#4 (text+ko) ==== @@ -29,7 +29,7 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: src/sys/compat/ndis/ndis_var.h,v 1.4 2003/12/23 18:31:04 wpaul Exp $ + * $FreeBSD: src/sys/compat/ndis/ndis_var.h,v 1.6 2003/12/25 06:04:39 wpaul Exp $ */ #ifndef _NDIS_VAR_H_ @@ -829,7 +829,6 @@ } np_macrsvd; } u; uint32_t *np_rsvd[2]; - uint8_t np_proto_rsvd[1]; /* * This next part is probably wrong, but we need some place @@ -838,6 +837,13 @@ ndis_packet_oob np_oob; ndis_packet_extension np_ext; ndis_sc_list np_sclist; + + /* BSD-specific stuff which should be invisible to drivers. */ + + uint32_t np_refcnt; + void *np_softc; + void *np_m0; + int np_txidx; }; typedef struct ndis_packet ndis_packet; @@ -994,6 +1000,14 @@ typedef struct ndis_reference ndis_reference; +struct ndis_timer_entry { + struct callout_handle nte_ch; + ndis_miniport_timer *nte_timer; + TAILQ_ENTRY(ndis_timer_entry) link; +}; + +TAILQ_HEAD(nte_head, ndis_timer_entry); + /* * The miniport block is basically the internal NDIS handle. We need * to define this because, unfortunately, it is not entirely opaque @@ -1116,6 +1130,7 @@ ndis_resource_list *nmb_rlist; ndis_status nmb_getstat; ndis_status nmb_setstat; + struct nte_head nmb_timerlist; }; typedef ndis_status (*ndis_init_handler)(ndis_status *, uint32_t *, ==== //depot/projects/netperf+sockets/sys/compat/ndis/subr_ndis.c#4 (text+ko) ==== @@ -31,7 +31,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/compat/ndis/subr_ndis.c,v 1.11 2003/12/23 04:08:22 wpaul Exp $"); +__FBSDID("$FreeBSD: src/sys/compat/ndis/subr_ndis.c,v 1.13 2003/12/25 00:40:02 wpaul Exp $"); /* * This file implements a translation layer between the BSD networking @@ -225,6 +225,7 @@ __stdcall static uint8_t ndis_sync_with_intr(ndis_miniport_interrupt *, void *, void *); __stdcall static void ndis_time(uint64_t *); +__stdcall static void ndis_uptime(uint32_t *); __stdcall static void ndis_init_string(ndis_unicode_string **, char *); __stdcall static void ndis_init_ansi_string(ndis_ansi_string *, char *); __stdcall static void ndis_free_string(ndis_unicode_string *); @@ -236,6 +237,11 @@ void **, uint32_t *, uint32_t *); __stdcall static void ndis_firstbuf_safe(ndis_packet *, ndis_buffer **, void **, uint32_t *, uint32_t *, uint32_t); +__stdcall static void ndis_open_file(ndis_status *, ndis_handle *, uint32_t *, + ndis_unicode_string *, ndis_physaddr); +__stdcall static void ndis_map_file(ndis_status *, void **, ndis_handle); +__stdcall static void ndis_unmap_file(ndis_handle); +__stdcall static void ndis_close_file(ndis_handle); __stdcall static void dummy(void); @@ -872,10 +878,17 @@ ndis_timer_function func; void *ctx; { - struct callout_handle *ch; + struct ndis_timer_entry *ne = NULL; + ndis_miniport_block *block; + block = (ndis_miniport_block *)handle; + + ne = malloc(sizeof(struct ndis_timer_entry), M_DEVBUF, M_NOWAIT); + callout_handle_init(&ne->nte_ch); + TAILQ_INSERT_TAIL(&block->nmb_timerlist, ne, link); + ne->nte_timer = timer; - ch = (struct callout_handle *)&timer->nmt_dpc; - callout_handle_init(ch); + timer->nmt_ktimer.nk_header.dh_sigstate = TRUE; + timer->nmt_dpc.nk_deferredctx = &ne->nte_ch; timer->nmt_timerfunc = func; timer->nmt_timerctx = ctx; @@ -896,6 +909,7 @@ timer = arg; + timer->nmt_ktimer.nk_header.dh_sigstate = FALSE; timerfunc = timer->nmt_timerfunc; timerfunc(NULL, timer->nmt_timerctx, NULL, NULL); @@ -919,8 +933,9 @@ tv.tv_sec = 0; tv.tv_usec = msecs * 1000; - ch = (struct callout_handle *)&timer->nmt_dpc; + ch = timer->nmt_dpc.nk_deferredctx; timer->nmt_dpc.nk_sysarg2 = ndis_timercall; + timer->nmt_ktimer.nk_header.dh_sigstate = TRUE; *ch = timeout((timeout_t *)timer->nmt_dpc.nk_sysarg2, (void *)timer, tvtohz(&tv)); @@ -938,6 +953,7 @@ timer = arg; + timer->nmt_ktimer.nk_header.dh_sigstate = FALSE; timerfunc = timer->nmt_timerfunc; timerfunc(NULL, timer->nmt_timerctx, NULL, NULL); @@ -945,7 +961,8 @@ tv.tv_sec = 0; tv.tv_usec = timer->nmt_ktimer.nk_period * 1000; - ch = (struct callout_handle *)&timer->nmt_dpc; + ch = timer->nmt_dpc.nk_deferredctx; + timer->nmt_ktimer.nk_header.dh_sigstate = TRUE; timer->nmt_dpc.nk_sysarg2 = ndis_tick; *ch = timeout((timeout_t *)timer->nmt_dpc.nk_sysarg2, timer, tvtohz(&tv)); @@ -965,8 +982,9 @@ tv.tv_usec = msecs * 1000; timer->nmt_ktimer.nk_period = msecs; - ch = (struct callout_handle *)&timer->nmt_dpc; + ch = timer->nmt_dpc.nk_deferredctx; timer->nmt_dpc.nk_sysarg2 = ndis_tick; + timer->nmt_ktimer.nk_header.dh_sigstate = TRUE; *ch = timeout((timeout_t *)timer->nmt_dpc.nk_sysarg2, timer, tvtohz(&tv)); @@ -980,8 +998,9 @@ { struct callout_handle *ch; - ch = (struct callout_handle *)&timer->nmt_dpc; - untimeout((timeout_t *)timer->nmt_dpc.nk_sysarg2, timer, *ch); + ch = timer->nmt_dpc.nk_deferredctx; + untimeout(ch->callout->c_func, ch->callout->c_arg, *ch); + *cancelled = timer->nmt_ktimer.nk_header.dh_sigstate; return; } @@ -2062,10 +2081,23 @@ uint64_t *tval; { struct timespec ts; + nanotime(&ts); - *tval = (ts.tv_nsec / 100) + (ts.tv_nsec * 10000000); - *tval += 11644473600; - return; + *tval = (uint64_t)ts.tv_nsec / 100 + (uint64_t)ts.tv_sec * 10000000 + + 11644473600; +} + +/* + * Return the number of milliseconds since the system booted. + */ +__stdcall static void +ndis_uptime(tval) + uint32_t *tval; +{ + struct timespec ts; + + nanouptime(&ts); + *tval = ts.tv_nsec / 1000000 + ts.tv_sec * 1000; } __stdcall static void @@ -2176,7 +2208,51 @@ ndis_firstbuf(packet, buf, firstva, firstlen, totlen); } +/* can also return NDIS_STATUS_RESOURCES/NDIS_STATUS_ERROR_READING_FILE */ +__stdcall static void +ndis_open_file(status, filehandle, filelength, filename, highestaddr) + ndis_status *status; + ndis_handle *filehandle; + uint32_t *filelength; + ndis_unicode_string *filename; + ndis_physaddr highestaddr; +{ + char *afilename = NULL; + + ndis_unicode_to_ascii(filename->nus_buf, filename->nus_len, &afilename); + printf("ndis_open_file(\"%s\", %ju)\n", afilename, + highestaddr.np_quad); + free(afilename, M_DEVBUF); + *status = NDIS_STATUS_FILE_NOT_FOUND; + return; +} + +__stdcall static void +ndis_map_file(status, mappedbuffer, filehandle) + ndis_status *status; + void **mappedbuffer; + ndis_handle filehandle; +{ + + *status = NDIS_STATUS_ALREADY_MAPPED; + return; +} + +__stdcall static void +ndis_unmap_file(filehandle) + ndis_handle filehandle; +{ + return; +} + __stdcall static void +ndis_close_file(filehandle) + ndis_handle filehandle; +{ + return; +} + +__stdcall static void dummy() { printf ("NDIS dummy called...\n"); @@ -2199,6 +2275,7 @@ { "NdisInitializeString", (FUNC)ndis_init_string }, { "NdisFreeString", (FUNC)ndis_free_string }, { "NdisGetCurrentSystemTime", (FUNC)ndis_time }, + { "NdisGetSystemUpTime", (FUNC)ndis_uptime }, { "NdisMSynchronizeWithInterrupt", (FUNC)ndis_sync_with_intr }, { "NdisMAllocateSharedMemoryAsync", (FUNC)ndis_alloc_sharedmem_async }, { "NdisInterlockedInsertHeadList", (FUNC)ndis_insert_head }, @@ -2272,6 +2349,10 @@ { "NdisUnchainBufferAtFront", (FUNC)ndis_unchain_headbuf }, { "NdisReadPcmciaAttributeMemory", (FUNC)ndis_read_pccard_amem }, { "NdisWritePcmciaAttributeMemory", (FUNC)ndis_write_pccard_amem }, + { "NdisOpenFile", (FUNC)ndis_open_file }, + { "NdisMapFile", (FUNC)ndis_map_file }, + { "NdisUnmapFile", (FUNC)ndis_unmap_file }, + { "NdisCloseFile", (FUNC)ndis_close_file }, /* * This last entry is a catch-all for any function we haven't ==== //depot/projects/netperf+sockets/sys/compat/ndis/subr_ntoskrnl.c#3 (text+ko) ==== @@ -31,7 +31,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/compat/ndis/subr_ntoskrnl.c,v 1.3 2003/12/13 07:41:12 wpaul Exp $"); +__FBSDID("$FreeBSD: src/sys/compat/ndis/subr_ntoskrnl.c,v 1.4 2003/12/25 00:40:02 wpaul Exp $"); #include #include @@ -63,6 +63,10 @@ __stdcall static uint32_t ntoskrnl_unicode_equal(ndis_unicode_string *, ndis_unicode_string *, uint32_t); +__stdcall static void ntoskrnl_unicode_copy(ndis_unicode_string *, + ndis_unicode_string *); +__stdcall static uint32_t ntoskrnl_unicode_to_ansi(ndis_ansi_string *, + ndis_unicode_string *, uint8_t); __stdcall static void *ntoskrnl_iobuildsynchfsdreq(uint32_t, void *, void *, uint32_t, uint32_t *, void *, void *); __stdcall static uint32_t ntoskrnl_iofcalldriver(void *, void *); @@ -142,8 +146,8 @@ ndis_unicode_string *str2; uint32_t casesensitive; { - char *astr1 = NULL, *astr2 = NULL; - int rval = 1; + char *astr1 = NULL, *astr2 = NULL; + int rval = 1; ndis_unicode_to_ascii(str1->nus_buf, str2->nus_len, &astr1); ndis_unicode_to_ascii(str2->nus_buf, str2->nus_len, &astr2); @@ -161,6 +165,42 @@ return(rval); } +__stdcall static void +ntoskrnl_unicode_copy(dest, src) + ndis_unicode_string *dest; + ndis_unicode_string *src; +{ + + if (dest->nus_maxlen >= src->nus_len) + dest->nus_len = src->nus_len; + else + dest->nus_len = dest->nus_maxlen; + memcpy(dest->nus_buf, src->nus_buf, dest->nus_len); + return; +} + +__stdcall static uint32_t +ntoskrnl_unicode_to_ansi(dest, src, allocate) + ndis_ansi_string *dest; + ndis_unicode_string *src; + uint8_t allocate; +{ + char *astr = NULL; + + if (allocate) { + ndis_unicode_to_ascii(src->nus_buf, src->nus_len, &astr); + dest->nas_buf = astr; + dest->nas_len = dest->nas_maxlen = strlen(astr); + } else { + dest->nas_len = src->nus_len / 2; /* XXX */ + if (dest->nas_maxlen < dest->nas_len) + dest->nas_len = dest->nas_maxlen; + ndis_unicode_to_ascii(src->nus_buf, dest->nas_len * 2, + &dest->nas_buf); + } + return (NDIS_STATUS_SUCCESS); +} + __stdcall static void * ntoskrnl_iobuildsynchfsdreq(func, dobj, buf, len, off, event, status) uint32_t func; @@ -523,6 +563,8 @@ image_patch_table ntoskrnl_functbl[] = { { "RtlEqualUnicodeString", (FUNC)ntoskrnl_unicode_equal }, + { "RtlCopyUnicodeString", (FUNC)ntoskrnl_unicode_copy }, + { "RtlUnicodeStringToAnsiString", (FUNC)ntoskrnl_unicode_to_ansi }, { "sprintf", (FUNC)sprintf }, { "DbgPrint", (FUNC)printf }, { "strncmp", (FUNC)strncmp }, ==== //depot/projects/netperf+sockets/sys/compat/ndis/subr_pe.c#2 (text+ko) ==== @@ -31,7 +31,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/compat/ndis/subr_pe.c,v 1.1 2003/12/11 22:34:37 wpaul Exp $"); +__FBSDID("$FreeBSD: src/sys/compat/ndis/subr_pe.c,v 1.2 2003/12/24 21:21:18 wpaul Exp $"); /* * This file contains routines for relocating and dynamically linking @@ -79,7 +79,7 @@ { uint16_t signature; - if (imgbase == NULL || hdr == NULL) + if (imgbase == 0 || hdr == NULL) return (EINVAL); signature = *(uint16_t *)imgbase; @@ -102,7 +102,7 @@ uint32_t signature; image_dos_header *dos_hdr; - if (imgbase == NULL) + if (imgbase == 0) return (EINVAL); signature = *(uint16_t *)imgbase; @@ -130,7 +130,7 @@ image_dos_header *dos_hdr; image_nt_header *nt_hdr; - if (imgbase == NULL || hdr == NULL) + if (imgbase == 0 || hdr == NULL) return(EINVAL); if (pe_is_nt_image(imgbase)) @@ -158,7 +158,7 @@ image_dos_header *dos_hdr; image_nt_header *nt_hdr; - if (imgbase == NULL || hdr == NULL) + if (imgbase == 0 || hdr == NULL) return(EINVAL); if (pe_is_nt_image(imgbase)) @@ -187,7 +187,7 @@ image_nt_header *nt_hdr; image_section_header *sect_hdr; - if (imgbase == NULL || hdr == NULL) + if (imgbase == 0 || hdr == NULL) return(EINVAL); if (pe_is_nt_image(imgbase)) @@ -327,7 +327,7 @@ int i, sections; - if (imgbase == NULL || hdr == NULL) + if (imgbase == 0 || hdr == NULL) return(EINVAL); if (pe_is_nt_image(imgbase)) @@ -433,7 +433,7 @@ image_import_descriptor *imp_desc; char *modname; - if (imgbase == NULL || module == NULL || desc == NULL) + if (imgbase == 0 || module == NULL || desc == NULL) return(EINVAL); offset = pe_directory_offset(imgbase, IMAGE_DIRECTORY_ENTRY_IMPORT); @@ -509,7 +509,7 @@ vm_offset_t *nptr, *fptr; vm_offset_t func; - if (imgbase == NULL || module == NULL || functbl == NULL) + if (imgbase == 0 || module == NULL || functbl == NULL) return(EINVAL); if (pe_get_import_descriptor(imgbase, &imp_desc, module)) ==== //depot/projects/netperf+sockets/sys/conf/kmod.mk#3 (text+ko) ==== @@ -1,5 +1,5 @@ # From: @(#)bsd.prog.mk 5.26 (Berkeley) 6/25/91 -# $FreeBSD: src/sys/conf/kmod.mk,v 1.150 2003/11/19 05:08:26 imp Exp $ +# $FreeBSD: src/sys/conf/kmod.mk,v 1.151 2003/12/25 14:07:52 ru Exp $ # # The include file handles installing Kernel Loadable Device # drivers (KLD's). @@ -70,7 +70,7 @@ .SUFFIXES: .out .o .c .cc .cxx .C .y .l .s .S -CFLAGS+= ${COPTS} -D_KERNEL ${CWARNFLAGS} +CFLAGS+= ${COPTS} -D_KERNEL CFLAGS+= -DKLD_MODULE # Don't use any standard or source-relative include directories. ==== //depot/projects/netperf+sockets/sys/dev/ata/ata-chipset.c#4 (text+ko) ==== @@ -27,7 +27,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/dev/ata/ata-chipset.c,v 1.52 2003/12/18 17:36:41 sos Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/ata/ata-chipset.c,v 1.53 2003/12/25 19:37:11 sos Exp $"); #include "opt_ata.h" #include @@ -1918,28 +1918,11 @@ { ATA_SIS963, 0x00, SIS133NEW, 0, ATA_UDMA6, "SiS 963" }, /* south */ { ATA_SIS962, 0x00, SIS133NEW, 0, ATA_UDMA6, "SiS 962" }, /* south */ - { ATA_SIS755, 0x00, SIS_SOUTH, 0, ATA_UDMA6, "SiS 755" }, /* ext south */ - { ATA_SIS752, 0x00, SIS_SOUTH, 0, ATA_UDMA6, "SiS 752" }, /* unknown */ - { ATA_SIS751, 0x00, SIS_SOUTH, 0, ATA_UDMA6, "SiS 751" }, /* unknown */ - { ATA_SIS750, 0x00, SIS_SOUTH, 0, ATA_UDMA6, "SiS 750" }, /* unknown */ - { ATA_SIS748, 0x00, SIS_SOUTH, 0, ATA_UDMA6, "SiS 748" }, /* unknown */ - { ATA_SIS746, 0x00, SIS_SOUTH, 0, ATA_UDMA6, "SiS 746" }, /* ext south */ { ATA_SIS745, 0x00, SIS100NEW, 0, ATA_UDMA5, "SiS 745" }, /* 1chip */ - { ATA_SIS740, 0x00, SIS_SOUTH, 0, ATA_UDMA5, "SiS 740" }, /* ext south */ { ATA_SIS735, 0x00, SIS100NEW, 0, ATA_UDMA5, "SiS 735" }, /* 1chip */ { ATA_SIS733, 0x00, SIS100NEW, 0, ATA_UDMA5, "SiS 733" }, /* 1chip */ { ATA_SIS730, 0x00, SIS100OLD, 0, ATA_UDMA5, "SiS 730" }, /* 1chip */ - { ATA_SIS661, 0x00, SIS_SOUTH, 0, ATA_UDMA6, "SiS 661" }, /* ext south */ - { ATA_SIS658, 0x00, SIS_SOUTH, 0, ATA_UDMA6, "SiS 658" }, /* ext south */ - { ATA_SIS655, 0x00, SIS_SOUTH, 0, ATA_UDMA6, "SiS 655" }, /* ext south */ - { ATA_SIS652, 0x00, SIS_SOUTH, 0, ATA_UDMA6, "SiS 652" }, /* unknown */ - { ATA_SIS651, 0x00, SIS_SOUTH, 0, ATA_UDMA6, "SiS 651" }, /* ext south */ - { ATA_SIS650, 0x00, SIS_SOUTH, 0, ATA_UDMA6, "SiS 650" }, /* ext south */ - { ATA_SIS648, 0x00, SIS_SOUTH, 0, ATA_UDMA6, "SiS 648" }, /* ext south */ - { ATA_SIS646, 0x00, SIS_SOUTH, 0, ATA_UDMA6, "SiS 645DX"},/* ext south */ - { ATA_SIS645, 0x00, SIS_SOUTH, 0, ATA_UDMA6, "SiS 645" }, /* ext south */ - { ATA_SIS640, 0x00, SIS_SOUTH, 0, ATA_UDMA4, "SiS 640" }, /* ext south */ { ATA_SIS635, 0x00, SIS100NEW, 0, ATA_UDMA5, "SiS 635" }, /* 1chip */ { ATA_SIS633, 0x00, SIS100NEW, 0, ATA_UDMA5, "SiS 633" }, /* unknown */ { ATA_SIS630, 0x30, SIS100OLD, 0, ATA_UDMA5, "SiS 630S"}, /* 1chip */ @@ -1951,29 +1934,33 @@ { ATA_SIS530, 0x00, SIS66, 0, ATA_UDMA4, "SiS 530" }, { ATA_SIS5513, 0xc2, SIS33, 0, ATA_UDMA2, "SiS 5513" }, - { ATA_SIS5513, 0x00, SIS33, 0, ATA_WDMA2, "SiS 5513" }, + { ATA_SIS5513, 0x00, SIS33, 1, ATA_WDMA2, "SiS 5513" }, { 0, 0, 0, 0, 0, 0 }}; char buffer[64]; if (!(idx = ata_find_chip(dev, ids, -pci_get_slot(dev)))) return ENXIO; - if (idx->cfg1 == SIS_SOUTH) { + if (idx->cfg2) { pci_write_config(dev, 0x57, pci_read_config(dev, 0x57, 1) & 0x7f, 1); if (pci_read_config(dev, 0x00, 4) == ATA_SIS5518) { idx->cfg1 = SIS133NEW; - sprintf(buffer, "SiS 96X %s controller",ata_mode2str(idx->max_dma)); + idx->max_dma = ATA_UDMA6; + sprintf(buffer, "SiS 962/963 %s controller", + ata_mode2str(idx->max_dma)); } else { struct ata_chip_id id[] = {{ ATA_SISSOUTH, 0x10, 0, 0, ATA_UDMA6, "SiS 961" }, { 0, 0, 0, 0, 0, 0 }}; - if (ata_find_chip(dev, id, pci_get_slot(dev))) + if (ata_find_chip(dev, id, pci_get_slot(dev))) { idx->cfg1 = SIS133OLD; + idx->max_dma = ATA_UDMA6; + } else { + idx->cfg1 = SIS100NEW; idx->max_dma = ATA_UDMA5; - idx->cfg1 = SIS100NEW; } sprintf(buffer, "SiS 961 %s controller",ata_mode2str(idx->max_dma)); } ==== //depot/projects/netperf+sockets/sys/dev/hifn/hifn7751.c#2 (text+ko) ==== @@ -41,7 +41,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/dev/hifn/hifn7751.c,v 1.23 2003/10/08 20:25:47 sam Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/hifn/hifn7751.c,v 1.24 2003/12/25 01:23:38 sam Exp $"); /* * Driver for various Hifn encryption processors. @@ -386,10 +386,10 @@ sc->sc_dma = (struct hifn_dma *)kva; bzero(sc->sc_dma, sizeof(*sc->sc_dma)); - KASSERT(sc->sc_st0 != NULL, ("hifn_attach: null bar0 tag!")); - KASSERT(sc->sc_sh0 != NULL, ("hifn_attach: null bar0 handle!")); - KASSERT(sc->sc_st1 != NULL, ("hifn_attach: null bar1 tag!")); - KASSERT(sc->sc_sh1 != NULL, ("hifn_attach: null bar1 handle!")); + KASSERT(sc->sc_st0 != 0, ("hifn_attach: null bar0 tag!")); + KASSERT(sc->sc_sh0 != 0, ("hifn_attach: null bar0 handle!")); + KASSERT(sc->sc_st1 != 0, ("hifn_attach: null bar1 tag!")); + KASSERT(sc->sc_sh1 != 0, ("hifn_attach: null bar1 handle!")); /* * Reset the board and do the ``secret handshake'' ==== //depot/projects/netperf+sockets/sys/dev/if_ndis/if_ndis.c#4 (text+ko) ==== @@ -31,7 +31,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/dev/if_ndis/if_ndis.c,v 1.9 2003/12/23 18:41:34 wpaul Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/if_ndis/if_ndis.c,v 1.13 2003/12/25 09:44:49 wpaul Exp $"); #include "opt_bdg.h" @@ -150,6 +150,7 @@ static devclass_t ndis_devclass; DRIVER_MODULE(ndis, pci, ndis_driver, ndis_devclass, 0, 0); +DRIVER_MODULE(ndis, cardbus, ndis_driver, ndis_devclass, 0, 0); /* * Program the 64-bit multicast hash filter. @@ -292,12 +293,12 @@ * Hook interrupt early, since calling the driver's * init routine may trigger an interrupt. */ + error = bus_setup_intr(dev, sc->ndis_irq, INTR_TYPE_NET, ndis_intr, sc, &sc->ndis_intrhand); if (error) { - printf("ndis%d: couldn't register interrupt\n", unit); - error = ENXIO; + printf("ndis%d: couldn't set up irq\n", unit); goto fail; } @@ -561,16 +562,13 @@ /* Override the status handler so we can detect link changes. */ sc->ndis_block.nmb_status_func = ndis_linksts; - if (error) { - printf("ndis%d: couldn't set up irq\n", unit); - ether_ifdetach(ifp); - goto fail; - } - fail: if (error) ndis_detach(dev); + /* We're done talking to the NIC for now; halt it. */ + ndis_halt_nic(sc); + return(error); } @@ -592,20 +590,19 @@ KASSERT(mtx_initialized(&sc->ndis_mtx), ("ndis mutex not initialized")); NDIS_LOCK(sc); ifp = &sc->arpcom.ac_if; + ifp->if_flags &= ~IFF_UP; if (device_is_attached(dev)) { if (sc->ndis_80211) { ifmedia_removeall(&sc->ic.ic_media); ieee80211_node_detach(ifp); } - ifp->if_flags &= ~IFF_UP; NDIS_UNLOCK(sc); ndis_stop(sc); ether_ifdetach(ifp); } else NDIS_UNLOCK(sc); - bus_generic_detach(dev); if (sc->ndis_intrhand) @@ -657,7 +654,7 @@ for (i = 0; i < pktcnt; i++) { p = packets[i]; /* Stash the softc here so ptom can use it. */ - p->np_rsvd[0] = (uint32_t *)sc; + p->np_softc = sc; if (ndis_ptom(&m0, p)) { printf ("ndis%d: ptom failed\n", sc->ndis_unit); ndis_return_packet(sc, p); @@ -692,13 +689,10 @@ sc = (struct ndis_softc *)block->nmb_ifp; ifp = block->nmb_ifp; - if (packet->np_rsvd[1] == NULL) - panic("NDIS driver corrupted reserved packet fields"); - NDIS_LOCK(sc); - m = (struct mbuf *)packet->np_rsvd[1]; - idx = (int)packet->np_rsvd[0]; + m = packet->np_m0; + idx = packet->np_txidx; ifp->if_opackets++; if (sc->ndis_sc) bus_dmamap_unload(sc->ndis_ttag, sc->ndis_tmaps[idx]); @@ -770,15 +764,11 @@ int call_isr = 0; sc = arg; - /*NDIS_LOCK(sc);*/ ifp = &sc->arpcom.ac_if; -/* - if (!(ifp->if_flags & IFF_UP)) { - NDIS_UNLOCK(sc); + if (!(ifp->if_flags & IFF_UP)) return; - } -*/ + ndis_isr(sc, &is_our_intr, &call_isr); if (is_our_intr || call_isr) @@ -787,8 +777,6 @@ if (ifp->if_snd.ifq_head != NULL) ndis_start(ifp); - /*NDIS_UNLOCK(sc);*/ - return; } @@ -906,9 +894,8 @@ * so we can free it later. */ - (sc->ndis_txarray[sc->ndis_txidx])->np_rsvd[0] = - (uint32_t *)sc->ndis_txidx; - (sc->ndis_txarray[sc->ndis_txidx])->np_rsvd[1] = (uint32_t *)m; + (sc->ndis_txarray[sc->ndis_txidx])->np_txidx = sc->ndis_txidx; + (sc->ndis_txarray[sc->ndis_txidx])->np_m0 = m; /* * Do scatter/gather processing, if driver requested it. @@ -1139,7 +1126,10 @@ len = sizeof(ssid); bzero((char *)&ssid, len); ssid.ns_ssidlen = ic->ic_des_esslen; - bcopy(ic->ic_des_essid, ssid.ns_ssid, ssid.ns_ssidlen); + if (ssid.ns_ssidlen == 0) { + ssid.ns_ssidlen = 1; + } else + bcopy(ic->ic_des_essid, ssid.ns_ssid, ssid.ns_ssidlen); >>> TRUNCATED FOR MAIL (1000 lines) <<<