Date: Wed, 31 Mar 2004 18:00:49 -0800 (PST) From: Warner Losh <imp@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 50095 for review Message-ID: <200404010200.i3120nNV062262@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=50095 Change 50095 by imp@imp_pacopaco on 2004/03/31 18:00:34 IFC @50093 Affected files ... .. //depot/projects/power/sys/compat/linprocfs/linprocfs.c#6 integrate .. //depot/projects/power/sys/conf/NOTES#9 integrate .. //depot/projects/power/sys/conf/options#9 integrate .. //depot/projects/power/sys/dev/acpica/acpi.c#13 integrate .. //depot/projects/power/sys/dev/acpica/acpi_pci.c#8 integrate .. //depot/projects/power/sys/dev/ath/if_ath.c#8 integrate .. //depot/projects/power/sys/dev/ath/if_athvar.h#4 integrate .. //depot/projects/power/sys/dev/md/md.c#6 integrate .. //depot/projects/power/sys/dev/wi/if_wi.c#6 integrate .. //depot/projects/power/sys/dev/wi/if_wivar.h#3 integrate .. //depot/projects/power/sys/fs/procfs/procfs_status.c#3 integrate .. //depot/projects/power/sys/geom/geom_apple.c#3 integrate .. //depot/projects/power/sys/kern/kern_exec.c#6 integrate .. //depot/projects/power/sys/kern/kern_proc.c#4 integrate .. //depot/projects/power/sys/net/if_sl.c#3 integrate .. //depot/projects/power/sys/pci/if_ste.c#8 integrate .. //depot/projects/power/sys/pci/if_stereg.h#4 integrate .. //depot/projects/power/sys/sys/proc.h#8 integrate Differences ... ==== //depot/projects/power/sys/compat/linprocfs/linprocfs.c#6 (text+ko) ==== @@ -40,7 +40,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/compat/linprocfs/linprocfs.c,v 1.82 2004/02/09 20:33:42 des Exp $"); +__FBSDID("$FreeBSD: src/sys/compat/linprocfs/linprocfs.c,v 1.83 2004/04/01 00:04:22 pjd Exp $"); #include <sys/param.h> #include <sys/queue.h> @@ -771,7 +771,7 @@ */ PROC_LOCK(p); - if (p->p_args && (ps_argsopen || !p_cansee(td, p))) { + if (p->p_args && p_cansee(td, p) == 0) { sbuf_bcpy(sb, p->p_args->ar_args, p->p_args->ar_length); PROC_UNLOCK(p); } else if (p != td->td_proc) { ==== //depot/projects/power/sys/conf/NOTES#9 (text+ko) ==== @@ -1,4 +1,4 @@ -# $FreeBSD: src/sys/conf/NOTES,v 1.1210 2004/03/31 08:22:09 scottl Exp $ +# $FreeBSD: src/sys/conf/NOTES,v 1.1211 2004/03/31 18:46:13 vkashyap Exp $ # # NOTES -- Lines that can be cut/pasted into kernel and hints configs. # @@ -1388,6 +1388,14 @@ device twe # 3ware ATA RAID # +# 3ware 9000 series PATA/SATA RAID controller driver and options. +# The driver is implemented as a SIM, and so, needs the CAM infrastructure. +# +options TWA_DEBUG # 0-10; 10 prints the most messages. +options TWA_FLASH_FIRMWARE # firmware image bundled when defined. +device twa # 3ware 9000 series PATA/SATA RAID + +# # The 'ATA' driver supports all ATA and ATAPI devices, including PC Card # devices. You only need one "device ata" for it to find all # PCI and PC Card ATA/ATAPI devices on modern machines. ==== //depot/projects/power/sys/conf/options#9 (text+ko) ==== @@ -1,4 +1,4 @@ -# $FreeBSD: src/sys/conf/options,v 1.437 2004/03/31 08:22:09 scottl Exp $ +# $FreeBSD: src/sys/conf/options,v 1.438 2004/03/31 18:46:13 vkashyap Exp $ # # On the handling of kernel options # @@ -43,9 +43,8 @@ AHD_REG_PRETTY_PRINT opt_aic79xx.h ADW_ALLOW_MEMIO opt_adw.h -# 3ware 9000 series RAID controller driver options -TWA_DEBUG opt_twa.h # 0-10; 10 prints the most messages. -TWA_FLASH_FIRMWARE opt_twa.h # firmware image bundled when defined. +TWA_DEBUG opt_twa.h +TWA_FLASH_FIRMWARE opt_twa.h # Miscellaneous options. ADAPTIVE_MUTEXES ==== //depot/projects/power/sys/dev/acpica/acpi.c#13 (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.132 2004/03/31 17:23:46 njl Exp $ + * $FreeBSD: src/sys/dev/acpica/acpi.c,v 1.133 2004/03/31 17:35:28 njl Exp $ */ #include "opt_acpi.h" @@ -165,8 +165,8 @@ DEVMETHOD(bus_get_resource, acpi_get_resource), DEVMETHOD(bus_alloc_resource, acpi_alloc_resource), DEVMETHOD(bus_release_resource, acpi_release_resource), - DEVMETHOD(bus_child_pnpinfo_str, acpi_child_pnpinfo_str_method), - DEVMETHOD(bus_child_location_str, acpi_child_location_str_method), + DEVMETHOD(bus_child_pnpinfo_str, acpi_child_pnpinfo_str_method), + DEVMETHOD(bus_child_location_str, acpi_child_location_str_method), DEVMETHOD(bus_driver_added, bus_generic_driver_added), DEVMETHOD(bus_activate_resource, bus_generic_activate_resource), DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource), @@ -699,11 +699,8 @@ return (retval); } -/* - * Location hint for devctl(8) - */ - -int +/* Location hint for devctl(8) */ +static int acpi_child_location_str_method(device_t cbdev, device_t child, char *buf, size_t buflen) { @@ -716,31 +713,28 @@ return (0); } -/* - * PnP information for devctl(8) - */ - -int +/* PnP information for devctl(8) */ +static int acpi_child_pnpinfo_str_method(device_t cbdev, device_t child, char *buf, size_t buflen) { + ACPI_BUFFER adbuf = {ACPI_ALLOCATE_BUFFER, NULL}; + ACPI_DEVICE_INFO *adinfo; struct acpi_device *dinfo = device_get_ivars(child); - ACPI_DEVICE_INFO *adinfo; - ACPI_BUFFER adbuf = {ACPI_ALLOCATE_BUFFER, NULL}; char *end; int error; error = AcpiGetObjectInfo(dinfo->ad_handle, &adbuf); adinfo = (ACPI_DEVICE_INFO *) adbuf.Pointer; - + if (error) snprintf(buf, buflen, "Unknown"); else snprintf(buf, buflen, "_HID=%s _UID=%lu", - (adinfo->Valid & ACPI_VALID_HID)? + (adinfo->Valid & ACPI_VALID_HID) ? adinfo->HardwareId.Value : "UNKNOWN", - ((adinfo->Valid & ACPI_VALID_UID)? - strtoul(adinfo->UniqueId.Value, &end, 10):0 )); + (adinfo->Valid & ACPI_VALID_UID) ? + strtoul(adinfo->UniqueId.Value, &end, 10) : 0); if (adinfo) AcpiOsFree(adinfo); ==== //depot/projects/power/sys/dev/acpica/acpi_pci.c#8 (text+ko) ==== @@ -27,7 +27,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/dev/acpica/acpi_pci.c,v 1.8 2004/03/31 17:27:19 takawata Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/acpica/acpi_pci.c,v 1.9 2004/03/31 17:35:28 njl Exp $"); #include "opt_bus.h" @@ -133,12 +133,12 @@ struct acpi_pci_devinfo *dinfo; switch (which) { - case ACPI_IVAR_HANDLE: + case ACPI_IVAR_HANDLE: dinfo = device_get_ivars(child); *result = (uintptr_t)dinfo->ap_handle; - return(0); + return (0); } - return(pci_read_ivar(dev, child, which, result)); + return (pci_read_ivar(dev, child, which, result)); } static int @@ -146,10 +146,10 @@ size_t buflen) { struct acpi_pci_devinfo *dinfo = device_get_ivars(child); - int status; + pci_child_location_str_method(cbdev, child, buf, buflen); - if(dinfo->ap_handle){ + if (dinfo->ap_handle) { strlcat(buf, " path=", buflen); strlcat(buf, acpi_name(dinfo->ap_handle), buflen); } ==== //depot/projects/power/sys/dev/ath/if_ath.c#8 (text+ko) ==== @@ -35,7 +35,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/dev/ath/if_ath.c,v 1.46 2004/03/20 19:57:46 mdodd Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/ath/if_ath.c,v 1.47 2004/04/01 00:38:45 sam Exp $"); /* * Driver for the Atheros Wireless LAN controller. @@ -339,15 +339,20 @@ &sc->sc_drvbpf); /* * Initialize constant fields. + * XXX make header lengths a multiple of 32-bits so subsequent + * headers are properly aligned; this is a kludge to keep + * certain applications happy. * * NB: the channel is setup each time we transition to the * RUN state to avoid filling it in for each frame. */ - sc->sc_tx_th.wt_ihdr.it_len = sizeof(sc->sc_tx_th); - sc->sc_tx_th.wt_ihdr.it_present = ATH_TX_RADIOTAP_PRESENT; + sc->sc_tx_th_len = roundup(sizeof(sc->sc_tx_th), sizeof(u_int32_t)); + sc->sc_tx_th.wt_ihdr.it_len = htole16(sc->sc_tx_th_len); + sc->sc_tx_th.wt_ihdr.it_present = htole32(ATH_TX_RADIOTAP_PRESENT); - sc->sc_rx_th.wr_ihdr.it_len = sizeof(sc->sc_rx_th); - sc->sc_rx_th.wr_ihdr.it_present = ATH_RX_RADIOTAP_PRESENT; + sc->sc_rx_th_len = roundup(sizeof(sc->sc_rx_th), sizeof(u_int32_t)); + sc->sc_rx_th.wr_ihdr.it_len = htole16(sc->sc_rx_th_len); + sc->sc_rx_th.wr_ihdr.it_present = htole32(ATH_RX_RADIOTAP_PRESENT); return 0; bad: @@ -1726,7 +1731,7 @@ /* XXX TSF */ bpf_mtap2(sc->sc_drvbpf, - &sc->sc_rx_th, sizeof(sc->sc_rx_th), m); + &sc->sc_rx_th, sc->sc_rx_th_len, m); } m_adj(m, -IEEE80211_CRC_LEN); @@ -2070,7 +2075,7 @@ sc->sc_tx_th.wt_antenna = antenna; bpf_mtap2(sc->sc_drvbpf, - &sc->sc_tx_th, sizeof(sc->sc_tx_th), m0); + &sc->sc_tx_th, sc->sc_tx_th_len, m0); } /* ==== //depot/projects/power/sys/dev/ath/if_athvar.h#4 (text+ko) ==== @@ -33,7 +33,7 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGES. * - * $FreeBSD: src/sys/dev/ath/if_athvar.h,v 1.10 2003/11/29 01:23:59 sam Exp $ + * $FreeBSD: src/sys/dev/ath/if_athvar.h,v 1.11 2004/04/01 00:38:45 sam Exp $ */ /* @@ -115,10 +115,12 @@ struct ath_tx_radiotap_header th; u_int8_t pad[64]; } u_tx_rt; + int sc_tx_th_len; union { struct ath_rx_radiotap_header th; u_int8_t pad[64]; } u_rx_rt; + int sc_rx_th_len; struct ath_desc *sc_desc; /* TX/RX descriptors */ bus_dma_segment_t sc_dseg; ==== //depot/projects/power/sys/dev/md/md.c#6 (text+ko) ==== @@ -6,7 +6,7 @@ * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp * ---------------------------------------------------------------------------- * - * $FreeBSD: src/sys/dev/md/md.c,v 1.118 2004/03/19 21:19:15 alc Exp $ + * $FreeBSD: src/sys/dev/md/md.c,v 1.119 2004/03/31 21:48:02 luigi Exp $ * */ @@ -110,7 +110,6 @@ static g_init_t md_drvinit; -static int mdrootready; static int mdunits; static dev_t status_dev = 0; @@ -1180,8 +1179,10 @@ sc->nsect = length / DEV_BSIZE; sc->pl_ptr = image; sc->pl_len = length; +#ifdef MD_ROOT if (sc->unit == 0) - mdrootready = 1; + rootdevnames[0] = "ufs:/dev/md0"; +#endif mdinit(sc); } @@ -1253,15 +1254,3 @@ }; DECLARE_MODULE(md, md_mod, SI_SUB_DRIVERS, SI_ORDER_MIDDLE); MODULE_VERSION(md, MD_MODVER); - - -#ifdef MD_ROOT -static void -md_takeroot(void *junk) -{ - if (mdrootready) - rootdevnames[0] = "ufs:/dev/md0"; -} - -SYSINIT(md_root, SI_SUB_MOUNT_ROOT, SI_ORDER_FIRST, md_takeroot, NULL); -#endif /* MD_ROOT */ ==== //depot/projects/power/sys/dev/wi/if_wi.c#6 (text+ko) ==== @@ -62,7 +62,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/dev/wi/if_wi.c,v 1.164 2004/03/20 19:57:47 mdodd Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/wi/if_wi.c,v 1.166 2004/04/01 00:38:45 sam Exp $"); #define WI_HERMES_AUTOINC_WAR /* Work around data write autoinc bug. */ #define WI_HERMES_STATS_WAR /* Work around stats counter bug. */ @@ -482,15 +482,20 @@ &sc->sc_drvbpf); /* * Initialize constant fields. + * XXX make header lengths a multiple of 32-bits so subsequent + * headers are properly aligned; this is a kludge to keep + * certain applications happy. * * NB: the channel is setup each time we transition to the * RUN state to avoid filling it in for each frame. */ - sc->sc_tx_th.wt_ihdr.it_len = sizeof(sc->sc_tx_th); - sc->sc_tx_th.wt_ihdr.it_present = WI_TX_RADIOTAP_PRESENT; + sc->sc_tx_th_len = roundup(sizeof(sc->sc_tx_th), sizeof(u_int32_t)); + sc->sc_tx_th.wt_ihdr.it_len = htole16(sc->sc_tx_th_len); + sc->sc_tx_th.wt_ihdr.it_present = htole32(WI_TX_RADIOTAP_PRESENT); - sc->sc_rx_th.wr_ihdr.it_len = sizeof(sc->sc_rx_th); - sc->sc_rx_th.wr_ihdr.it_present = WI_RX_RADIOTAP_PRESENT; + sc->sc_rx_th_len = roundup(sizeof(sc->sc_rx_th), sizeof(u_int32_t)); + sc->sc_rx_th.wr_ihdr.it_len = htole16(sc->sc_rx_th_len); + sc->sc_rx_th.wr_ihdr.it_present = htole32(WI_RX_RADIOTAP_PRESENT); #endif return (0); } @@ -939,18 +944,18 @@ } frmhdr.wi_tx_ctl |= htole16(WI_TXCNTL_NOCRYPT); } - m_copydata(m0, 0, sizeof(struct ieee80211_frame), - (caddr_t)&frmhdr.wi_whdr); - m_adj(m0, sizeof(struct ieee80211_frame)); - frmhdr.wi_dat_len = htole16(m0->m_pkthdr.len); #if NBPFILTER > 0 if (sc->sc_drvbpf) { sc->sc_tx_th.wt_rate = ni->ni_rates.rs_rates[ni->ni_txrate]; bpf_mtap2(sc->sc_drvbpf, - &sc->sc_tx_th, sizeof(sc->sc_tx_th), m0); + &sc->sc_tx_th, sc->sc_tx_th_len, m0); } #endif + m_copydata(m0, 0, sizeof(struct ieee80211_frame), + (caddr_t)&frmhdr.wi_whdr); + m_adj(m0, sizeof(struct ieee80211_frame)); + frmhdr.wi_dat_len = htole16(m0->m_pkthdr.len); if (IFF_DUMPPKTS(ifp)) wi_dump_pkt(&frmhdr, NULL, -1); fid = sc->sc_txd[cur].d_fid; @@ -1495,7 +1500,7 @@ if (frmhdr.wi_status & WI_STAT_PCF) sc->sc_rx_th.wr_flags |= IEEE80211_RADIOTAP_F_CFP; bpf_mtap2(sc->sc_drvbpf, - &sc->sc_rx_th, sizeof(sc->sc_rx_th), m); + &sc->sc_rx_th, sc->sc_rx_th_len, m); } #endif wh = mtod(m, struct ieee80211_frame *); ==== //depot/projects/power/sys/dev/wi/if_wivar.h#3 (text+ko) ==== @@ -31,7 +31,7 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: src/sys/dev/wi/if_wivar.h,v 1.21 2003/12/09 07:41:07 imp Exp $ + * $FreeBSD: src/sys/dev/wi/if_wivar.h,v 1.22 2004/04/01 00:38:45 sam Exp $ */ #if 0 @@ -168,10 +168,12 @@ struct wi_tx_radiotap_header th; u_int8_t pad[64]; } u_tx_rt; + int sc_tx_th_len; union { struct wi_rx_radiotap_header th; u_int8_t pad[64]; } u_rx_rt; + int sc_rx_th_len; }; #define sc_if sc_ic.ic_if #define sc_tx_th u_tx_rt.th ==== //depot/projects/power/sys/fs/procfs/procfs_status.c#3 (text+ko) ==== @@ -38,7 +38,7 @@ * * From: * $Id: procfs_status.c,v 3.1 1993/12/15 09:40:17 jsp Exp $ - * $FreeBSD: src/sys/fs/procfs/procfs_status.c,v 1.50 2003/12/07 17:40:00 des Exp $ + * $FreeBSD: src/sys/fs/procfs/procfs_status.c,v 1.51 2004/04/01 00:04:23 pjd Exp $ */ #include <sys/param.h> @@ -191,7 +191,7 @@ */ PROC_LOCK(p); - if (p->p_args && (ps_argsopen || !p_cansee(td, p))) { + if (p->p_args && p_cansee(td, p) == 0) { sbuf_bcpy(sb, p->p_args->ar_args, p->p_args->ar_length); PROC_UNLOCK(p); return (0); ==== //depot/projects/power/sys/geom/geom_apple.c#3 (text+ko) ==== @@ -31,7 +31,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/geom/geom_apple.c,v 1.13 2004/02/12 22:42:11 phk Exp $"); +__FBSDID("$FreeBSD: src/sys/geom/geom_apple.c,v 1.14 2004/04/01 01:33:37 grehan Exp $"); #include <sys/param.h> #include <sys/endian.h> @@ -116,11 +116,13 @@ mp = gsp->softc; g_slice_dumpconf(sb, indent, gp, cp, pp); if (pp != NULL) { - if (indent == NULL) - sbuf_printf(sb, " n %s ty %s", - mp->apmpart[pp->index].am_name, + if (indent == NULL) { + sbuf_printf(sb, " ty %s", mp->apmpart[pp->index].am_type); - else { + if (*mp->apmpart[pp->index].am_name) + sbuf_printf(sb, " sn %s", + mp->apmpart[pp->index].am_name); + } else { sbuf_printf(sb, "%s<name>%s</name>\n", indent, mp->apmpart[pp->index].am_name); sbuf_printf(sb, "%s<type>%s</type>\n", indent, ==== //depot/projects/power/sys/kern/kern_exec.c#6 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/kern/kern_exec.c,v 1.240 2004/03/14 02:06:27 peter Exp $"); +__FBSDID("$FreeBSD: src/sys/kern/kern_exec.c,v 1.241 2004/04/01 00:10:44 pjd Exp $"); #include "opt_ktrace.h" #include "opt_mac.h" @@ -95,9 +95,6 @@ SYSCTL_ULONG(_kern, OID_AUTO, ps_arg_cache_limit, CTLFLAG_RW, &ps_arg_cache_limit, 0, ""); -int ps_argsopen = 1; -SYSCTL_INT(_kern, OID_AUTO, ps_argsopen, CTLFLAG_RW, &ps_argsopen, 0, ""); - static int sysctl_kern_ps_strings(SYSCTL_HANDLER_ARGS) { ==== //depot/projects/power/sys/kern/kern_proc.c#4 (text+ko) ==== @@ -31,11 +31,11 @@ * SUCH DAMAGE. * * @(#)kern_proc.c 8.7 (Berkeley) 2/14/95 - * $FreeBSD: src/sys/kern/kern_proc.c,v 1.200 2004/03/17 13:19:43 pjd Exp $ + * $FreeBSD: src/sys/kern/kern_proc.c,v 1.201 2004/04/01 00:08:20 pjd Exp $ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/kern/kern_proc.c,v 1.200 2004/03/17 13:19:43 pjd Exp $"); +__FBSDID("$FreeBSD: src/sys/kern/kern_proc.c,v 1.201 2004/04/01 00:08:20 pjd Exp $"); #include "opt_ktrace.h" #include "opt_kstack_pages.h" @@ -1111,11 +1111,6 @@ return (error); } - if (!ps_argsopen) { - PROC_UNLOCK(p); - return (EPERM); - } - if (req->newptr && curproc != p) { PROC_UNLOCK(p); return (EPERM); ==== //depot/projects/power/sys/net/if_sl.c#3 (text+ko) ==== @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)if_sl.c 8.6 (Berkeley) 2/1/94 - * $FreeBSD: src/sys/net/if_sl.c,v 1.111 2003/10/31 18:32:08 brooks Exp $ + * $FreeBSD: src/sys/net/if_sl.c,v 1.112 2004/03/31 22:59:56 rwatson Exp $ */ /* @@ -224,6 +224,18 @@ static size_t st_unit_max = 0; static int +slisunitfree(int unit) +{ + struct sl_softc *nc; + + LIST_FOREACH(nc, &sl_list, sl_next) { + if (nc->sc_if.if_dunit == unit) + return (0); + } + return (1); +} + +static int slisstatic(unit) int unit; { @@ -260,7 +272,7 @@ static struct sl_softc * slcreate() { - struct sl_softc *sc, *nc; + struct sl_softc *sc; int unit; struct mbuf *m; @@ -310,10 +322,8 @@ for (unit=0; ; unit++) { if (slisstatic(unit)) continue; - LIST_FOREACH(nc, &sl_list, sl_next) { - if (nc->sc_if.if_dunit == unit) - continue; - } + if (!slisunitfree(unit)) + continue; break; } if_initname(&sc->sc_if, "sl", unit); @@ -443,7 +453,7 @@ int flag; struct thread *td; { - struct sl_softc *sc = (struct sl_softc *)tp->t_sc, *nc; + struct sl_softc *sc = (struct sl_softc *)tp->t_sc; int s, unit, wasup; s = splimp(); @@ -459,12 +469,8 @@ return (ENXIO); } if (sc->sc_if.if_dunit != unit) { - LIST_FOREACH(nc, &sl_list, sl_next) { - if (nc->sc_if.if_dunit == *(u_int *)data) { - splx(s); - return (ENXIO); - } - } + if (!slisunitfree(unit)) + return (ENXIO); wasup = sc->sc_if.if_flags & IFF_UP; bpfdetach(&sc->sc_if); ==== //depot/projects/power/sys/pci/if_ste.c#8 (text+ko) ==== @@ -31,7 +31,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/pci/if_ste.c,v 1.64 2004/03/30 19:23:38 ru Exp $"); +__FBSDID("$FreeBSD: src/sys/pci/if_ste.c,v 1.66 2004/03/31 21:10:01 ru Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -40,6 +40,7 @@ #include <sys/malloc.h> #include <sys/kernel.h> #include <sys/socket.h> +#include <sys/sysctl.h> #include <net/if.h> #include <net/if_arp.h> @@ -162,6 +163,9 @@ DRIVER_MODULE(ste, pci, ste_driver, ste_devclass, 0, 0); DRIVER_MODULE(miibus, ste, miibus_driver, miibus_devclass, 0, 0); +static int ste_rxsyncs; +SYSCTL_INT(_hw, OID_AUTO, ste_rxsyncs, CTLFLAG_RW, &ste_rxsyncs, 0, ""); + #define STE_SETBIT4(sc, reg, x) \ CSR_WRITE_4(sc, reg, CSR_READ_4(sc, reg) | (x)) @@ -622,7 +626,53 @@ return; } +#ifdef DEVICE_POLLING +static poll_handler_t ste_poll; + static void +ste_poll(struct ifnet *ifp, enum poll_cmd cmd, int count) +{ + struct ste_softc *sc = ifp->if_softc; + + STE_LOCK(sc); + if (cmd == POLL_DEREGISTER) { /* final call, enable interrupts */ + CSR_WRITE_2(sc, STE_IMR, STE_INTRS); + goto done; + } + + sc->rxcycles = count; + ste_rxeof(sc); + ste_txeof(sc); + if (ifp->if_snd.ifq_head != NULL) + ste_start(ifp); + + if (cmd == POLL_AND_CHECK_STATUS) { /* also check status register */ + u_int16_t status; + + status = CSR_READ_2(sc, STE_ISR_ACK); + + if (status & STE_ISR_TX_DONE) + ste_txeoc(sc); + + if (status & STE_ISR_STATS_OFLOW) { + untimeout(ste_stats_update, sc, sc->ste_stat_ch); + ste_stats_update(sc); + } + + if (status & STE_ISR_LINKEVENT) + mii_pollstat(device_get_softc(sc->ste_miibus)); + + if (status & STE_ISR_HOSTERR) { + ste_reset(sc); + ste_init(sc); + } + } +done: + STE_UNLOCK(sc); +} +#endif /* DEVICE_POLLING */ + +static void ste_intr(xsc) void *xsc; { @@ -634,6 +684,16 @@ STE_LOCK(sc); ifp = &sc->arpcom.ac_if; +#ifdef DEVICE_POLLING + if (ifp->if_flags & IFF_POLLING) + goto done; + if (ether_poll_register(ste_poll, ifp)) { /* ok, disable interrupts */ + CSR_WRITE_2(sc, STE_IMR, 0); + ste_poll(ifp, 0, 1); + goto done; + } +#endif /* DEVICE_POLLING */ + /* See if this is really our interrupt. */ if (!(CSR_READ_2(sc, STE_ISR) & STE_ISR_INTLATCH)) { STE_UNLOCK(sc); @@ -676,6 +736,9 @@ if (ifp->if_snd.ifq_head != NULL) ste_start(ifp); +#ifdef DEVICE_POLLING +done: +#endif /* DEVICE_POLLING */ STE_UNLOCK(sc); return; @@ -699,8 +762,28 @@ ifp = &sc->arpcom.ac_if; + if (sc->ste_cdata.ste_rx_head->ste_ptr->ste_status == 0) { + cur_rx = sc->ste_cdata.ste_rx_head; + do { + cur_rx = cur_rx->ste_next; + /* If the ring is empty, just return. */ + if (cur_rx == sc->ste_cdata.ste_rx_head) + return; + } while (cur_rx->ste_ptr->ste_status == 0); + /* We've fallen behind the chip: catch it. */ + sc->ste_cdata.ste_rx_head = cur_rx; + ++ste_rxsyncs; + }; + while((rxstat = sc->ste_cdata.ste_rx_head->ste_ptr->ste_status) & STE_RXSTAT_DMADONE) { +#ifdef DEVICE_POLLING + if (ifp->if_flags & IFF_POLLING) { + if (sc->rxcycles <= 0) + break; + sc->rxcycles--; + } +#endif /* DEVICE_POLLING */ if ((STE_RX_LIST_CNT - count) < 3) { break; } @@ -1223,7 +1306,7 @@ } /* Set RX polling interval */ - CSR_WRITE_1(sc, STE_RX_DMAPOLL_PERIOD, 1); + CSR_WRITE_1(sc, STE_RX_DMAPOLL_PERIOD, 64); /* Init TX descriptors */ ste_init_tx_list(sc); @@ -1285,8 +1368,14 @@ /* Enable stats counters. */ STE_SETBIT2(sc, STE_MACCTL1, STE_MACCTL1_STATS_ENABLE); + CSR_WRITE_2(sc, STE_ISR, 0xFFFF); +#ifdef DEVICE_POLLING + /* Disable interrupts if we are polling. */ + if (ifp->if_flags & IFF_POLLING) + CSR_WRITE_2(sc, STE_IMR, 0); + else +#endif /* DEVICE_POLLING */ /* Enable interrupts. */ - CSR_WRITE_2(sc, STE_ISR, 0xFFFF); CSR_WRITE_2(sc, STE_IMR, STE_INTRS); /* Accept VLAN length packets */ @@ -1314,6 +1403,10 @@ ifp = &sc->arpcom.ac_if; untimeout(ste_stats_update, sc, sc->ste_stat_ch); + ifp->if_flags &= ~(IFF_RUNNING|IFF_OACTIVE); +#ifdef DEVICE_POLLING + ether_poll_deregister(ifp); +#endif /* DEVICE_POLLING */ CSR_WRITE_2(sc, STE_IMR, 0); STE_SETBIT2(sc, STE_MACCTL1, STE_MACCTL1_TX_DISABLE); @@ -1345,8 +1438,6 @@ } bzero(sc->ste_ldata, sizeof(struct ste_list_data)); - - ifp->if_flags &= ~(IFF_RUNNING|IFF_OACTIVE); STE_UNLOCK(sc); return; ==== //depot/projects/power/sys/pci/if_stereg.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/pci/if_stereg.h,v 1.12 2003/11/14 19:00:32 sam Exp $ + * $FreeBSD: src/sys/pci/if_stereg.h,v 1.13 2004/03/31 20:39:20 ru Exp $ */ /* @@ -526,6 +526,9 @@ struct callout_handle ste_stat_ch; struct mtx ste_mtx; u_int8_t ste_one_phy; +#ifdef DEVICE_POLLING + int rxcycles; +#endif }; #define STE_LOCK(_sc) mtx_lock(&(_sc)->ste_mtx) ==== //depot/projects/power/sys/sys/proc.h#8 (text+ko) ==== @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)proc.h 8.15 (Berkeley) 5/19/95 - * $FreeBSD: src/sys/sys/proc.h,v 1.371 2004/03/28 04:17:36 bde Exp $ + * $FreeBSD: src/sys/sys/proc.h,v 1.372 2004/04/01 00:10:45 pjd Exp $ */ #ifndef _SYS_PROC_H_ @@ -806,7 +806,6 @@ extern int nprocs, maxproc; /* Current and max number of procs. */ extern int maxprocperuid; /* Max procs per uid. */ extern u_long ps_arg_cache_limit; -extern int ps_argsopen; extern int sched_quantum; /* Scheduling quantum in ticks. */ LIST_HEAD(proclist, proc);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200404010200.i3120nNV062262>