From owner-p4-projects@FreeBSD.ORG Fri Dec 19 17:02:14 2003 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 5A36316A4D0; Fri, 19 Dec 2003 17:02:14 -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 2B5CE16A4CE for ; Fri, 19 Dec 2003 17:02:14 -0800 (PST) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5903443D49 for ; Fri, 19 Dec 2003 17:01:59 -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 hBK11x0B073579 for ; Fri, 19 Dec 2003 17:01:59 -0800 (PST) (envelope-from sam@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.10/8.12.10/Submit) id hBK11vSP073556 for perforce@freebsd.org; Fri, 19 Dec 2003 17:01:57 -0800 (PST) (envelope-from sam@freebsd.org) Date: Fri, 19 Dec 2003 17:01:57 -0800 (PST) Message-Id: <200312200101.hBK11vSP073556@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 44106 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: Sat, 20 Dec 2003 01:02:14 -0000 http://perforce.freebsd.org/chv.cgi?CH=44106 Change 44106 by sam@sam_ebb on 2003/12/19 17:01:31 IFC @ 44105 Affected files ... .. //depot/projects/netperf+sockets/sys/contrib/dev/acpica/hwsleep.c#3 edit .. //depot/projects/netperf/sys/compat/ndis/cfg_var.h#2 integrate .. //depot/projects/netperf/sys/compat/ndis/kern_ndis.c#2 integrate .. //depot/projects/netperf/sys/compat/ndis/ndis_var.h#2 integrate .. //depot/projects/netperf/sys/compat/ndis/subr_ndis.c#3 integrate .. //depot/projects/netperf/sys/conf/files#30 integrate .. //depot/projects/netperf/sys/dev/acpica/acpi.c#15 integrate .. //depot/projects/netperf/sys/dev/acpica/acpi_cpu.c#10 integrate .. //depot/projects/netperf/sys/dev/acpica/acpi_pci_link.c#6 integrate .. //depot/projects/netperf/sys/dev/acpica/acpi_pcib.c#6 integrate .. //depot/projects/netperf/sys/dev/aic7xxx/ahc_eisa.c#3 integrate .. //depot/projects/netperf/sys/dev/aic7xxx/ahc_pci.c#7 integrate .. //depot/projects/netperf/sys/dev/aic7xxx/ahd_pci.c#7 integrate .. //depot/projects/netperf/sys/dev/aic7xxx/aic7770.c#3 integrate .. //depot/projects/netperf/sys/dev/aic7xxx/aic79xx.c#3 integrate .. //depot/projects/netperf/sys/dev/aic7xxx/aic79xx.h#3 integrate .. //depot/projects/netperf/sys/dev/aic7xxx/aic79xx.seq#2 integrate .. //depot/projects/netperf/sys/dev/aic7xxx/aic79xx_inline.h#2 integrate .. //depot/projects/netperf/sys/dev/aic7xxx/aic79xx_osm.c#3 integrate .. //depot/projects/netperf/sys/dev/aic7xxx/aic79xx_osm.h#3 integrate .. //depot/projects/netperf/sys/dev/aic7xxx/aic79xx_pci.c#4 integrate .. //depot/projects/netperf/sys/dev/aic7xxx/aic7xxx.c#3 integrate .. //depot/projects/netperf/sys/dev/aic7xxx/aic7xxx.h#2 integrate .. //depot/projects/netperf/sys/dev/aic7xxx/aic7xxx.reg#2 integrate .. //depot/projects/netperf/sys/dev/aic7xxx/aic7xxx.seq#2 integrate .. //depot/projects/netperf/sys/dev/aic7xxx/aic7xxx_93cx6.c#3 integrate .. //depot/projects/netperf/sys/dev/aic7xxx/aic7xxx_inline.h#2 integrate .. //depot/projects/netperf/sys/dev/aic7xxx/aic7xxx_osm.c#3 integrate .. //depot/projects/netperf/sys/dev/aic7xxx/aic7xxx_osm.h#3 integrate .. //depot/projects/netperf/sys/dev/aic7xxx/aic7xxx_pci.c#5 integrate .. //depot/projects/netperf/sys/dev/aic7xxx/aic_osm_lib.c#1 branch .. //depot/projects/netperf/sys/dev/aic7xxx/aic_osm_lib.h#1 branch .. //depot/projects/netperf/sys/dev/aic7xxx/aicasm/aicasm.c#2 integrate .. //depot/projects/netperf/sys/dev/aic7xxx/aicasm/aicasm_macro_scan.l#2 integrate .. //depot/projects/netperf/sys/dev/aic7xxx/aicasm/aicasm_scan.l#2 integrate .. //depot/projects/netperf/sys/dev/ata/ata-chipset.c#14 integrate .. //depot/projects/netperf/sys/dev/ata/ata-pci.h#8 integrate .. //depot/projects/netperf/sys/dev/ata/ata-queue.c#8 integrate .. //depot/projects/netperf/sys/dev/en/midway.c#4 integrate .. //depot/projects/netperf/sys/dev/if_ndis/if_ndis.c#2 integrate .. //depot/projects/netperf/sys/dev/if_ndis/if_ndisvar.h#2 integrate .. //depot/projects/netperf/sys/dev/ofw/ofw_disk.c#5 integrate .. //depot/projects/netperf/sys/dev/stg/tmc18c30.c#3 integrate .. //depot/projects/netperf/sys/dev/usb/ehci_pci.c#6 integrate .. //depot/projects/netperf/sys/dev/usb/if_aue.c#9 integrate .. //depot/projects/netperf/sys/dev/usb/ohci_pci.c#7 integrate .. //depot/projects/netperf/sys/dev/usb/umass.c#6 integrate .. //depot/projects/netperf/sys/dev/usb/usbdevs#8 integrate .. //depot/projects/netperf/sys/dev/usb/usbdevs.h#8 integrate .. //depot/projects/netperf/sys/dev/usb/usbdevs_data.h#8 integrate .. //depot/projects/netperf/sys/dev/usb/uscanner.c#6 integrate .. //depot/projects/netperf/sys/dev/vinum/vinum.c#3 integrate .. //depot/projects/netperf/sys/dev/vinum/vinumconfig.c#4 integrate .. //depot/projects/netperf/sys/dev/vinum/vinumrevive.c#4 integrate .. //depot/projects/netperf/sys/fs/ntfs/ntfs_subr.c#4 integrate .. //depot/projects/netperf/sys/i386/i386/pmap.c#24 integrate .. //depot/projects/netperf/sys/i386/include/cpu.h#3 integrate .. //depot/projects/netperf/sys/ia64/ia32/ia32_signal.c#2 integrate .. //depot/projects/netperf/sys/ia64/ia64/machdep.c#22 integrate .. //depot/projects/netperf/sys/kern/sched_ule.c#21 integrate .. //depot/projects/netperf/sys/kern/subr_taskqueue.c#6 integrate .. //depot/projects/netperf/sys/kern/sysv_sem.c#7 integrate .. //depot/projects/netperf/sys/kern/uipc_mbuf.c#3 integrate .. //depot/projects/netperf/sys/kern/vfs_subr.c#13 integrate .. //depot/projects/netperf/sys/modules/crypto/Makefile#2 integrate .. //depot/projects/netperf/sys/netgraph/atm/uni/ng_uni.c#2 integrate .. //depot/projects/netperf/sys/netgraph/ng_bridge.c#3 integrate .. //depot/projects/netperf/sys/netgraph/ng_eiface.c#4 integrate .. //depot/projects/netperf/sys/netgraph/ng_eiface.h#3 integrate .. //depot/projects/netperf/sys/netgraph/ng_etf.c#3 integrate .. //depot/projects/netperf/sys/netgraph/ng_ether.c#5 integrate .. //depot/projects/netperf/sys/netgraph/ng_ether.h#2 integrate .. //depot/projects/netperf/sys/netgraph/ng_ksocket.c#3 integrate .. //depot/projects/netperf/sys/netgraph/ng_parse.c#2 integrate .. //depot/projects/netperf/sys/netgraph/ng_parse.h#3 integrate .. //depot/projects/netperf/sys/netgraph/ng_pppoe.c#2 integrate .. //depot/projects/netperf/sys/netinet/ip_fw2.c#22 integrate .. //depot/projects/netperf/sys/netinet/tcp_subr.c#14 integrate .. //depot/projects/netperf/sys/netinet6/ip6_output.c#28 integrate .. //depot/projects/netperf/sys/netipsec/ipsec_mbuf.c#4 integrate .. //depot/projects/netperf/sys/nfsserver/nfs_srvsubs.c#2 integrate .. //depot/projects/netperf/sys/opencrypto/crmbuf.c#2 delete .. //depot/projects/netperf/sys/opencrypto/cryptodev.h#2 integrate .. //depot/projects/netperf/sys/opencrypto/cryptosoft.c#2 integrate .. //depot/projects/netperf/sys/powerpc/powerpc/pmap.c#7 integrate .. //depot/projects/netperf/sys/security/mac/mac_net.c#7 integrate .. //depot/projects/netperf/sys/security/mac_biba/mac_biba.c#8 integrate .. //depot/projects/netperf/sys/security/mac_lomac/mac_lomac.c#9 integrate .. //depot/projects/netperf/sys/security/mac_mls/mac_mls.c#7 integrate .. //depot/projects/netperf/sys/security/mac_stub/mac_stub.c#4 integrate .. //depot/projects/netperf/sys/security/mac_test/mac_test.c#8 integrate .. //depot/projects/netperf/sys/sys/_null.h#2 integrate .. //depot/projects/netperf/sys/sys/mac.h#9 integrate .. //depot/projects/netperf/sys/sys/mac_policy.h#5 integrate .. //depot/projects/netperf/sys/sys/mbuf.h#10 integrate .. //depot/projects/netperf/sys/sys/param.h#13 integrate Differences ... ==== //depot/projects/netperf+sockets/sys/contrib/dev/acpica/hwsleep.c#3 (text+ko) ==== @@ -293,6 +293,7 @@ { UINT32 PM1AControl; UINT32 PM1BControl; + UINT32 PM1Control; ACPI_BIT_REGISTER_INFO *SleepTypeRegInfo; ACPI_BIT_REGISTER_INFO *SleepEnableRegInfo; UINT32 InValue; @@ -387,6 +388,8 @@ ACPI_FLUSH_CPU_CACHE (); + Retry = 1000; +re_write: Status = AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1A_CONTROL, PM1AControl); if (ACPI_FAILURE (Status)) { @@ -399,6 +402,19 @@ return_ACPI_STATUS (Status); } + Status = AcpiHwRegisterRead (ACPI_MTX_LOCK, ACPI_REGISTER_PM1_CONTROL, &PM1Control); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + if (PM1Control != (PM1AControl | PM1BControl)) + { + if (Retry-- != 0) + goto re_write; + printf("%s: PM1Control %x PM1AControl %x PM1BControl %x\n", + __func__, PM1Control, PM1AControl, PM1BControl); + } + if (SleepState > ACPI_STATE_S3) { /* ==== //depot/projects/netperf/sys/compat/ndis/cfg_var.h#2 (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/cfg_var.h,v 1.1 2003/12/11 22:34:37 wpaul Exp $ + * $FreeBSD: src/sys/compat/ndis/cfg_var.h,v 1.2 2003/12/18 03:51:21 wpaul Exp $ */ #ifndef _CFG_VAR_H_ @@ -39,6 +39,7 @@ char *nc_cfgkey; char *nc_cfgdesc; char nc_val[256]; + int nc_idx; }; typedef struct ndis_cfg ndis_cfg; ==== //depot/projects/netperf/sys/compat/ndis/kern_ndis.c#2 (text+ko) ==== @@ -31,7 +31,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/compat/ndis/kern_ndis.c,v 1.3 2003/12/12 08:54:48 wpaul Exp $"); +__FBSDID("$FreeBSD: src/sys/compat/ndis/kern_ndis.c,v 1.6 2003/12/18 03:51:21 wpaul Exp $"); #include #include @@ -76,6 +76,7 @@ void *, uint32_t); __stdcall static void ndis_statusdone_func(ndis_handle); __stdcall static void ndis_setdone_func(ndis_handle, ndis_status); +__stdcall static void ndis_getdone_func(ndis_handle, ndis_status); __stdcall static void ndis_resetdone_func(ndis_handle, ndis_status, uint8_t); /* @@ -122,6 +123,15 @@ } __stdcall static void +ndis_getdone_func(adapter, status) + ndis_handle adapter; + ndis_status status; +{ + printf ("Query done... %x\n", status); + return; +} + +__stdcall static void ndis_resetdone_func(adapter, status, addressingreset) ndis_handle adapter; ndis_status status; @@ -204,6 +214,10 @@ while(1) { if (vals->nc_cfgkey == NULL) break; + if (vals->nc_idx != sc->ndis_devidx) { + vals++; + continue; + } SYSCTL_ADD_STRING(&sc->ndis_ctx, SYSCTL_CHILDREN(sc->ndis_tree), OID_AUTO, vals->nc_cfgkey, @@ -309,11 +323,21 @@ { struct ndis_softc *sc; ndis_handle adapter; + ndis_packet *p; __stdcall ndis_return_handler returnfunc; if (arg == NULL || packet == NULL) return; + p = packet; + + /* Decrement refcount. */ + p->np_private.npp_count--; + + /* Release packet when refcount hits zero, otherwise return. */ + if (p->np_private.npp_count) + return; + sc = arg; returnfunc = sc->ndis_chars.nmc_return_packet_func; adapter = sc->ndis_block.nmb_miniportadapterctx; @@ -439,6 +463,7 @@ priv = &p->np_private; buf = priv->npp_head; + priv->npp_count = 0; for (buf = priv->npp_head; buf != NULL; buf = buf->nb_next) { if (buf == priv->npp_head) @@ -450,25 +475,15 @@ *m0 = NULL; return(ENOBUFS); } - - /* - * Note: there's some hackery going on here. We want - * to mate the mbufs to the buffers in the NDIS packet, - * but we don't mark the mbufs with the M_EXT flag to - * indicate external storage. This is because we don't - * want anything special done to free the buffers. - * Depending on the circumstances, the caller may want - * the entire packet to be released, buffers and all, - * by calling ndis_return_packet(), or ndis_free_packet(). - * We leave it up to the caller to do the MEXTADD() to - * set up the free mechanism in the first mbuf of the - * chain. - */ if (buf->nb_bytecount > buf->nb_size) m->m_len = buf->nb_size; else m->m_len = buf->nb_bytecount; m->m_data = buf->nb_mappedsystemva; + 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++; totlen += m->m_len; if (m->m_flags & MT_HEADER) *m0 = m; @@ -524,7 +539,6 @@ for (m = m0; m != NULL; m = m->m_next) { if (m->m_len == NULL) continue; - buf = malloc(sizeof(ndis_buffer), M_DEVBUF, M_NOWAIT|M_ZERO); if (buf == NULL) { ndis_free_packet(*p); @@ -651,20 +665,11 @@ if (sc->ndis_tmaps == NULL) return(ENOMEM); - sc->ndis_mbufs = malloc(sizeof(struct mbuf) * sc->ndis_maxpkts, - M_DEVBUF, M_NOWAIT|M_ZERO); - - if (sc->ndis_mbufs == NULL) { - free(sc->ndis_tmaps, M_DEVBUF); - 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); - free(sc->ndis_mbufs, M_DEVBUF); return(ENODEV); } } @@ -677,18 +682,24 @@ void *arg; { struct ndis_softc *sc; + struct mbuf *m; + ndis_packet *p = NULL; int i; sc = arg; for (i = 0; i < sc->ndis_maxpkts; i++) { - if (sc->ndis_mbufs[i] != NULL) - m_freem(sc->ndis_mbufs[i]); + if (sc->ndis_txarray[i] != NULL) { + p = sc->ndis_txarray[i]; + m = (struct mbuf *)p->np_rsvd[1]; + if (m != NULL) + m_freem(m); + ndis_free_packet(sc->ndis_txarray[i]); + } bus_dmamap_destroy(sc->ndis_ttag, sc->ndis_tmaps[i]); } free(sc->ndis_tmaps, M_DEVBUF); - free(sc->ndis_mbufs, M_DEVBUF); bus_dma_tag_destroy(sc->ndis_ttag); @@ -1041,6 +1052,7 @@ block->nmb_signature = (void *)0xcafebabe; block->nmb_setdone_func = ndis_setdone_func; + block->nmb_querydone_func = ndis_getdone_func; block->nmb_status_func = ndis_status_func; block->nmb_statusdone_func = ndis_statusdone_func; block->nmb_resetdone_func = ndis_resetdone_func; ==== //depot/projects/netperf/sys/compat/ndis/ndis_var.h#2 (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.1 2003/12/11 22:34:37 wpaul Exp $ + * $FreeBSD: src/sys/compat/ndis/ndis_var.h,v 1.2 2003/12/14 21:31:32 wpaul Exp $ */ #ifndef _NDIS_VAR_H_ @@ -814,14 +814,16 @@ struct ndis_packet { ndis_packet_private np_private; union { + /* For connectionless miniports. */ struct { uint8_t np_miniport_rsvd[2 * sizeof(void *)]; uint8_t np_wrapper_rsvd[2 * sizeof(void *)]; - } np_rsvd; + } np_clrsvd; + /* For de-serialized miniports */ struct { uint8_t np_miniport_rsvdex[3 * sizeof(void *)]; uint8_t np_wrapper_rsvdex[sizeof(void *)]; - } np_rsvdrx; + } np_dsrsvd; struct { uint8_t np_mac_rsvd[4 * sizeof(void *)]; } np_macrsvd; @@ -840,6 +842,9 @@ typedef struct ndis_packet ndis_packet; +/* mbuf ext type for NDIS */ +#define EXT_NDIS 0x999 + struct ndis_filterdbs { union { void *nf_ethdb; ==== //depot/projects/netperf/sys/compat/ndis/subr_ndis.c#3 (text+ko) ==== @@ -31,7 +31,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/compat/ndis/subr_ndis.c,v 1.5 2003/12/13 09:07:35 wpaul Exp $"); +__FBSDID("$FreeBSD: src/sys/compat/ndis/subr_ndis.c,v 1.7 2003/12/16 18:56:33 wpaul Exp $"); /* * This file implements a translation layer between the BSD networking @@ -106,10 +106,18 @@ __stdcall static ndis_status ndis_setattr_ex(ndis_handle, ndis_handle, uint32_t, uint32_t, ndis_interface_type); __stdcall static void ndis_open_cfg(ndis_status *, ndis_handle *, ndis_handle); +__stdcall static void ndis_open_cfgbyidx(ndis_status *, ndis_handle, + uint32_t, ndis_unicode_string *, ndis_handle *); +__stdcall static void ndis_open_cfgbyname(ndis_status *, ndis_handle, + ndis_unicode_string *, ndis_handle *); static ndis_status ndis_encode_parm(ndis_miniport_block *, struct sysctl_oid *, ndis_parm_type, ndis_config_parm **); +static ndis_status ndis_decode_parm(ndis_miniport_block *, + ndis_config_parm *, char *); __stdcall static void ndis_read_cfg(ndis_status *, ndis_config_parm **, ndis_handle, ndis_unicode_string *, ndis_parm_type); +__stdcall static void ndis_write_cfg(ndis_status *, ndis_handle, + ndis_unicode_string *, ndis_config_parm *); __stdcall static void ndis_close_cfg(ndis_handle); __stdcall static void ndis_create_lock(ndis_spin_lock *); __stdcall static void ndis_destroy_lock(ndis_spin_lock *); @@ -184,6 +192,8 @@ __stdcall static uint8_t ndis_wait_event(ndis_event *, uint32_t); __stdcall static ndis_status ndis_unicode2ansi(ndis_ansi_string *, ndis_unicode_string *); +__stdcall static ndis_status ndis_ansi2unicode(ndis_unicode_string *, + ndis_ansi_string *); __stdcall static ndis_status ndis_assign_pcirsrc(ndis_handle, uint32_t, ndis_resource_list **); __stdcall static ndis_status ndis_register_intr(ndis_miniport_interrupt *, @@ -194,6 +204,7 @@ ndis_shutdown_handler); __stdcall static void ndis_deregister_shutdown(ndis_handle); __stdcall static uint32_t ndis_numpages(ndis_buffer *); +__stdcall static void ndis_buf_physpages(ndis_buffer *, uint32_t *); __stdcall static void ndis_query_bufoffset(ndis_buffer *, uint32_t *, uint32_t *); __stdcall static void ndis_sleep(uint32_t); @@ -211,8 +222,12 @@ void *, void *); __stdcall static void ndis_time(uint64_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 *); __stdcall static ndis_status ndis_remove_miniport(ndis_handle *); +__stdcall static void ndis_termwrap(ndis_handle, void *); +__stdcall static void ndis_get_devprop(ndis_handle, void *, void *, + void *, cm_resource_list *, cm_resource_list *); __stdcall static void dummy(void); @@ -312,6 +327,14 @@ return; } +__stdcall static void +ndis_termwrap(handle, syspec) + ndis_handle handle; + void *syspec; +{ + return; +} + __stdcall static ndis_status ndis_register_miniport(handle, characteristics, len) ndis_handle handle; @@ -404,6 +427,30 @@ return; } +__stdcall static void +ndis_open_cfgbyname(status, cfg, subkey, subhandle) + ndis_status *status; + ndis_handle cfg; + ndis_unicode_string *subkey; + ndis_handle *subhandle; +{ + *subhandle = cfg; + *status = NDIS_STATUS_SUCCESS; + return; +} + +__stdcall static void +ndis_open_cfgbyidx(status, cfg, idx, subkey, subhandle) + ndis_status *status; + ndis_handle cfg; + uint32_t idx; + ndis_unicode_string *subkey; + ndis_handle *subhandle; +{ + *status = NDIS_STATUS_FAILURE; + return; +} + static ndis_status ndis_encode_parm(block, oid, type, parm) ndis_miniport_block *block; @@ -508,6 +555,82 @@ return; } +static ndis_status +ndis_decode_parm(block, parm, val) + ndis_miniport_block *block; + ndis_config_parm *parm; + char *val; +{ + uint16_t *unicode; + ndis_unicode_string *ustr; + + unicode = (uint16_t *)&block->nmb_dummybuf; + + switch(parm->ncp_type) { + case ndis_parm_string: + ustr = &parm->ncp_parmdata.ncp_stringdata; + ndis_unicode_to_ascii(ustr->nus_buf, ustr->nus_len, &val); + break; + case ndis_parm_int: + sprintf(val, "%ul", parm->ncp_parmdata.ncp_intdata); + break; + case ndis_parm_hexint: + sprintf(val, "%xu", parm->ncp_parmdata.ncp_intdata); + break; + default: + return(NDIS_STATUS_FAILURE); + break; + } + return(NDIS_STATUS_SUCCESS); +} + +__stdcall static void +ndis_write_cfg(status, cfg, key, parm) + ndis_status *status; + ndis_handle cfg; + ndis_unicode_string *key; + ndis_config_parm *parm; +{ + char *keystr = NULL; + ndis_miniport_block *block; + struct ndis_softc *sc; + struct sysctl_oid *oidp; + struct sysctl_ctx_entry *e; + char val[256]; + + block = (ndis_miniport_block *)cfg; + sc = (struct ndis_softc *)block->nmb_ifp; + + ndis_unicode_to_ascii(key->nus_buf, key->nus_len, &keystr); + + /* Decode the parameter into a string. */ + *status = ndis_decode_parm(block, parm, val); + if (*status != NDIS_STATUS_SUCCESS) { + free(keystr, M_DEVBUF); + return; + } + + /* See if the key already exists. */ + + TAILQ_FOREACH(e, &sc->ndis_ctx, link) { + oidp = e->entry; + if (strcmp(oidp->oid_name, keystr) == 0) { + /* Found it, set the value. */ + strcpy((char *)oidp->oid_arg1, val); + free(keystr, M_DEVBUF); + return; + } + } + + /* Not found, add a new key with the specified value. */ + ndis_add_sysctl(sc, keystr, "(dynamically set key)", + val, CTLFLAG_RW); + + free(keystr, M_DEVBUF); + *status = NDIS_STATUS_SUCCESS; + return; +} + __stdcall static void ndis_close_cfg(cfg) ndis_handle cfg; @@ -1589,12 +1712,37 @@ __stdcall static ndis_status ndis_unicode2ansi(dstr, sstr) - ndis_ansi_string *dstr; - ndis_unicode_string *sstr; + ndis_ansi_string *dstr; + ndis_unicode_string *sstr; +{ + if (dstr == NULL || sstr == NULL) + return(NDIS_STATUS_FAILURE); + if (ndis_unicode_to_ascii(sstr->nus_buf, + sstr->nus_len, &dstr->nas_buf)) + return(NDIS_STATUS_FAILURE); + dstr->nas_len = dstr->nas_maxlen = strlen(dstr->nas_buf); + return (NDIS_STATUS_SUCCESS); +} + +__stdcall static ndis_status +ndis_ansi2unicode(dstr, sstr) + ndis_unicode_string *dstr; + ndis_ansi_string *sstr; { - ndis_unicode_to_ascii(sstr->nus_buf, sstr->nus_len, &dstr->nas_buf); - dstr->nas_len = strlen(dstr->nas_buf); - printf ("unicode 2 ansi...\n"); + char *str; + if (dstr == NULL || sstr == NULL) + return(NDIS_STATUS_FAILURE); + str = malloc(sstr->nas_len + 1, M_DEVBUF, M_NOWAIT); + if (str == NULL) + return(NDIS_STATUS_FAILURE); + strncpy(str, sstr->nas_buf, sstr->nas_len); + *(str + sstr->nas_len) = '\0'; + if (ndis_ascii_to_unicode(str, &dstr->nus_buf)) { + free(str, M_DEVBUF); + return(NDIS_STATUS_FAILURE); + } + dstr->nus_len = dstr->nus_maxlen = sstr->nas_len * 2; + free(str, M_DEVBUF); return (NDIS_STATUS_SUCCESS); } @@ -1691,6 +1839,15 @@ } __stdcall static void +ndis_buf_physpages(buf, pages) + ndis_buffer *buf; + uint32_t *pages; +{ + *pages = ndis_numpages(buf); + return; +} + +__stdcall static void ndis_query_bufoffset(buf, off, len) ndis_buffer *buf; uint32_t *off; @@ -1901,6 +2058,39 @@ } __stdcall static void +ndis_init_ansi_string(dst, src) + ndis_ansi_string *dst; + char *src; +{ + ndis_ansi_string *a; + + a = dst; + if (a == NULL) + return; + if (src == NULL) { + a->nas_len = a->nas_maxlen = 0; + a->nas_buf = NULL; + } else { + a->nas_buf = src; + a->nas_len = a->nas_maxlen = strlen(src); + } + + return; +} + +__stdcall static void ndis_get_devprop(adapter, phydevobj, + funcdevobj, nextdevobj, resources, transresources) + ndis_handle adapter; + void *phydevobj; + void *funcdevobj; + void *nextdevobj; + cm_resource_list *resources; + cm_resource_list *transresources; +{ + return; +} + +__stdcall static void dummy() { printf ("NDIS dummy called...\n"); @@ -1908,6 +2098,14 @@ } image_patch_table ndis_functbl[] = { + { "NdisGetBufferPhysicalArraySize", (FUNC)ndis_buf_physpages }, + { "NdisMGetDeviceProperty", (FUNC)ndis_get_devprop }, + { "NdisInitAnsiString", (FUNC)ndis_init_ansi_string }, + { "NdisWriteConfiguration", (FUNC)ndis_write_cfg }, + { "NdisAnsiStringToUnicodeString", (FUNC)ndis_ansi2unicode }, + { "NdisTerminateWrapper", (FUNC)ndis_termwrap }, + { "NdisOpenConfigurationKeyByName", (FUNC)ndis_open_cfgbyname }, + { "NdisOpenConfigurationKeyByIndex", (FUNC)ndis_open_cfgbyidx }, { "NdisMRemoveMiniport", (FUNC)ndis_remove_miniport }, { "NdisInitializeString", (FUNC)ndis_init_string }, { "NdisFreeString", (FUNC)ndis_free_string }, ==== //depot/projects/netperf/sys/conf/files#30 (text+ko) ==== @@ -1,4 +1,4 @@ -# $FreeBSD: src/sys/conf/files,v 1.858 2003/12/07 04:41:11 imp Exp $ +# $FreeBSD: src/sys/conf/files,v 1.859 2003/12/15 21:49:41 bms Exp $ # # The long compile-with and dependency lines are required because of # limitations in config: backslash-newline doesn't work in strings, and @@ -1570,7 +1570,6 @@ # crypto support opencrypto/cast.c optional crypto opencrypto/criov.c optional crypto -opencrypto/crmbuf.c optional crypto opencrypto/crypto.c optional crypto opencrypto/cryptodev.c optional cryptodev opencrypto/cryptosoft.c optional crypto ==== //depot/projects/netperf/sys/dev/acpica/acpi.c#15 (text+ko) ==== @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/dev/acpica/acpi.c,v 1.109 2003/12/09 06:29:57 njl Exp $ + * $FreeBSD: src/sys/dev/acpica/acpi.c,v 1.110 2003/12/18 03:25:22 njl Exp $ */ #include "opt_acpi.h" @@ -105,8 +105,8 @@ u_long count, u_int flags); static int acpi_release_resource(device_t bus, device_t child, int type, int rid, struct resource *r); -static u_int32_t acpi_isa_get_logicalid(device_t dev); -static u_int32_t acpi_isa_get_compatid(device_t dev); +static uint32_t acpi_isa_get_logicalid(device_t dev); +static int acpi_isa_get_compatid(device_t dev, uint32_t *cids, int count); static int acpi_isa_pnp_probe(device_t bus, device_t child, struct isa_pnp_id *ids); static void acpi_probe_children(device_t bus); @@ -800,12 +800,12 @@ | (PNP_HEXTONUM(s[6]) << 24) \ | (PNP_HEXTONUM(s[5]) << 28)) -static u_int32_t +static uint32_t acpi_isa_get_logicalid(device_t dev) { + ACPI_DEVICE_INFO *devinfo; + ACPI_BUFFER buf; ACPI_HANDLE h; - ACPI_DEVICE_INFO devinfo; - ACPI_BUFFER buf = {sizeof(devinfo), &devinfo}; ACPI_STATUS error; u_int32_t pnpid; ACPI_LOCK_DECL; @@ -817,50 +817,71 @@ /* Fetch and validate the HID. */ if ((h = acpi_get_handle(dev)) == NULL) - goto out; + return (0); + buf.Pointer = NULL; + buf.Length = ACPI_ALLOCATE_BUFFER; error = AcpiGetObjectInfo(h, &buf); if (ACPI_FAILURE(error)) - goto out; - if ((devinfo.Valid & ACPI_VALID_HID) == 0) - goto out; + return (0); + devinfo = (ACPI_DEVICE_INFO *)buf.Pointer; - pnpid = PNP_EISAID(devinfo.HardwareId.Value); + if ((devinfo->Valid & ACPI_VALID_HID) != 0) + pnpid = PNP_EISAID(devinfo->HardwareId.Value); -out: + AcpiOsFree(buf.Pointer); ACPI_UNLOCK; return_VALUE (pnpid); } -static u_int32_t -acpi_isa_get_compatid(device_t dev) +static int +acpi_isa_get_compatid(device_t dev, uint32_t *cids, int count) { + ACPI_DEVICE_INFO *devinfo; + ACPI_BUFFER buf; ACPI_HANDLE h; ACPI_STATUS error; - u_int32_t pnpid; + uint32_t *pnpid; + int valid, i; ACPI_LOCK_DECL; ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__); - pnpid = 0; + pnpid = cids; + valid = 0; ACPI_LOCK; - /* Fetch and validate the HID */ + /* Fetch and validate the CID */ if ((h = acpi_get_handle(dev)) == NULL) + return (0); + buf.Pointer = NULL; + buf.Length = ACPI_ALLOCATE_BUFFER; + error = AcpiGetObjectInfo(h, &buf); + if (ACPI_FAILURE(error)) + return (0); + devinfo = (ACPI_DEVICE_INFO *)buf.Pointer; + if ((devinfo->Valid & ACPI_VALID_CID) == 0) goto out; - if (ACPI_FAILURE(error = acpi_EvaluateInteger(h, "_CID", &pnpid))) - goto out; + + if (devinfo->CompatibilityId.Count < count) + count = devinfo->CompatibilityId.Count; + for (i = 0; i < count; i++) { + if (strncmp(devinfo->CompatibilityId.Id[i].Value, "PNP", 3) != 0) + continue; + *pnpid++ = PNP_EISAID(devinfo->CompatibilityId.Id[i].Value); + valid++; + } out: + AcpiOsFree(buf.Pointer); ACPI_UNLOCK; - return_VALUE (pnpid); + return_VALUE (valid); } - static int acpi_isa_pnp_probe(device_t bus, device_t child, struct isa_pnp_id *ids) { - int result; - u_int32_t lid, cid; + int result, cid_count, i; + uint32_t lid, cids[8]; ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__); @@ -873,17 +894,23 @@ /* Scan the supplied IDs for a match */ lid = acpi_isa_get_logicalid(child); - cid = acpi_isa_get_compatid(child); + cid_count = acpi_isa_get_compatid(child, cids, 8); while (ids && ids->ip_id) { - if (lid == ids->ip_id || cid == ids->ip_id) { + if (lid == ids->ip_id) { result = 0; goto out; } + for (i = 0; i < cid_count; i++) { + if (cids[i] == ids->ip_id) { + result = 0; + goto out; + } + } ids++; } out: - return_VALUE(result); + return_VALUE (result); } /* @@ -1092,28 +1119,34 @@ BOOLEAN acpi_DeviceIsPresent(device_t dev) { + ACPI_DEVICE_INFO *devinfo; ACPI_HANDLE h; - ACPI_DEVICE_INFO devinfo; - ACPI_BUFFER buf = {sizeof(devinfo), &devinfo}; + ACPI_BUFFER buf; ACPI_STATUS error; + int ret; ACPI_ASSERTLOCK; + ret = FALSE; if ((h = acpi_get_handle(dev)) == NULL) return (FALSE); + buf.Pointer = NULL; + buf.Length = ACPI_ALLOCATE_BUFFER; error = AcpiGetObjectInfo(h, &buf); if (ACPI_FAILURE(error)) return (FALSE); + devinfo = (ACPI_DEVICE_INFO *)buf.Pointer; /* If no _STA method, must be present */ - if ((devinfo.Valid & ACPI_VALID_STA) == 0) - return (TRUE); + if ((devinfo->Valid & ACPI_VALID_STA) == 0) + ret = TRUE; /* Return true for 'present' and 'functioning' */ - if ((devinfo.CurrentStatus & 0x9) == 0x9) - return (TRUE); + if ((devinfo->CurrentStatus & 0x9) == 0x9) + ret = TRUE; - return (FALSE); + AcpiOsFree(buf.Pointer); + return (ret); } /* @@ -1122,28 +1155,34 @@ BOOLEAN acpi_BatteryIsPresent(device_t dev) { + ACPI_DEVICE_INFO *devinfo; ACPI_HANDLE h; - ACPI_DEVICE_INFO devinfo; - ACPI_BUFFER buf = {sizeof(devinfo), &devinfo}; + ACPI_BUFFER buf; ACPI_STATUS error; + int ret; ACPI_ASSERTLOCK; + ret = FALSE; if ((h = acpi_get_handle(dev)) == NULL) return (FALSE); + buf.Pointer = NULL; + buf.Length = ACPI_ALLOCATE_BUFFER; error = AcpiGetObjectInfo(h, &buf); if (ACPI_FAILURE(error)) return (FALSE); + devinfo = (ACPI_DEVICE_INFO *)buf.Pointer; /* If no _STA method, must be present */ - if ((devinfo.Valid & ACPI_VALID_STA) == 0) - return (TRUE); + if ((devinfo->Valid & ACPI_VALID_STA) == 0) + ret = TRUE; /* Return true for 'present' and 'functioning' */ - if ((devinfo.CurrentStatus & 0x19) == 0x19) - return (TRUE); + if ((devinfo->CurrentStatus & 0x19) == 0x19) + ret = TRUE; - return (FALSE); + AcpiOsFree(buf.Pointer); + return (ret); } /* @@ -1152,31 +1191,40 @@ BOOLEAN acpi_MatchHid(device_t dev, char *hid) { + ACPI_DEVICE_INFO *devinfo; ACPI_HANDLE h; - ACPI_DEVICE_INFO devinfo; - ACPI_BUFFER buf = {sizeof(devinfo), &devinfo}; + ACPI_BUFFER buf; ACPI_STATUS error; - int cid; + int ret, i; ACPI_ASSERTLOCK; + ret = FALSE; if (hid == NULL) return (FALSE); if ((h = acpi_get_handle(dev)) == NULL) return (FALSE); + buf.Pointer = NULL; + buf.Length = ACPI_ALLOCATE_BUFFER; error = AcpiGetObjectInfo(h, &buf); if (ACPI_FAILURE(error)) return (FALSE); - if ((devinfo.Valid & ACPI_VALID_HID) != 0 && - strcmp(hid, devinfo.HardwareId.Value) == 0) - return (TRUE); + devinfo = (ACPI_DEVICE_INFO *)buf.Pointer; - if (ACPI_FAILURE(error = acpi_EvaluateInteger(h, "_CID", &cid))) - return (FALSE); - if (cid == PNP_EISAID(hid)) - return (TRUE); + if ((devinfo->Valid & ACPI_VALID_HID) != 0) { + if (strcmp(hid, devinfo->HardwareId.Value) == 0) + ret = TRUE; + } else if ((devinfo->Valid & ACPI_VALID_CID) != 0) { + for (i = 0; i < devinfo->CompatibilityId.Count; i++) { + if (strcmp(hid, devinfo->CompatibilityId.Id[i].Value) == 0) { + ret = TRUE; + break; + } + } + } - return (FALSE); + AcpiOsFree(buf.Pointer); + return (ret); } /* ==== //depot/projects/netperf/sys/dev/acpica/acpi_cpu.c#10 (text+ko) ==== @@ -26,7 +26,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/dev/acpica/acpi_cpu.c,v 1.26 2003/12/12 19:42:16 njl Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/acpica/acpi_cpu.c,v 1.27 2003/12/18 04:38:45 njl Exp $"); #include "opt_acpi.h" >>> TRUNCATED FOR MAIL (1000 lines) <<<