CVS commit: src/sys/arch/arm
Module Name:src Committed By: macallan Date: Mon Feb 28 10:03:50 UTC 2011 Modified Files: src/sys/arch/arm/arm32: pmap.c src/sys/arch/arm/include/arm32: pmap.h Log Message: implement arm32_pmap_flags() to allow mappings with write buffering enabled, mostly for video memory Tested on shark To generate a diff of this commit: cvs rdiff -u -r1.219 -r1.220 src/sys/arch/arm/arm32/pmap.c cvs rdiff -u -r1.97 -r1.98 src/sys/arch/arm/include/arm32/pmap.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/arm/arm32/pmap.c diff -u src/sys/arch/arm/arm32/pmap.c:1.219 src/sys/arch/arm/arm32/pmap.c:1.220 --- src/sys/arch/arm/arm32/pmap.c:1.219 Fri Nov 12 07:59:25 2010 +++ src/sys/arch/arm/arm32/pmap.c Mon Feb 28 10:03:49 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.219 2010/11/12 07:59:25 uebayasi Exp $ */ +/* $NetBSD: pmap.c,v 1.220 2011/02/28 10:03:49 macallan Exp $ */ /* * Copyright 2003 Wasabi Systems, Inc. @@ -211,7 +211,7 @@ #include machine/param.h #include arm/arm32/katelib.h -__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.219 2010/11/12 07:59:25 uebayasi Exp $); +__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.220 2011/02/28 10:03:49 macallan Exp $); #ifdef PMAP_DEBUG @@ -2745,6 +2745,16 @@ return (pm); } +u_int +arm32_mmap_flags(paddr_t pa) +{ + /* + * the upper 8 bits in pmap_enter()'s flags are reserved for MD stuff + * and we're using the upper bits in page numbers to pass flags around + * so we might as well use the same bits + */ + return (u_int)pa PMAP_MD_MASK; +} /* * int pmap_enter(pmap_t pm, vaddr_t va, paddr_t pa, vm_prot_t prot, * u_int flags) @@ -2953,9 +2963,12 @@ /* * Make sure the vector table is mapped cacheable */ - if (pm != pmap_kernel() va == vector_page) + if ((pm != pmap_kernel() va == vector_page) || + (flags ARM32_MMAP_CACHEABLE)) { npte |= pte_l2_s_cache_mode; - + } else if (flags ARM32_MMAP_WRITECOMBINE) { + npte |= pte_l2_s_wc_mode; + } if (opg) { /* * Looks like there's an existing 'managed' mapping @@ -5917,14 +5930,17 @@ */ pt_entry_t pte_l1_s_cache_mode; +pt_entry_t pte_l1_s_wc_mode; pt_entry_t pte_l1_s_cache_mode_pt; pt_entry_t pte_l1_s_cache_mask; pt_entry_t pte_l2_l_cache_mode; +pt_entry_t pte_l2_l_wc_mode; pt_entry_t pte_l2_l_cache_mode_pt; pt_entry_t pte_l2_l_cache_mask; pt_entry_t pte_l2_s_cache_mode; +pt_entry_t pte_l2_s_wc_mode; pt_entry_t pte_l2_s_cache_mode_pt; pt_entry_t pte_l2_s_cache_mask; @@ -5956,12 +5972,15 @@ { pte_l1_s_cache_mode = L1_S_B|L1_S_C; + pte_l1_s_wc_mode = L1_S_B; pte_l1_s_cache_mask = L1_S_CACHE_MASK_generic; pte_l2_l_cache_mode = L2_B|L2_C; + pte_l2_l_wc_mode = L2_B; pte_l2_l_cache_mask = L2_L_CACHE_MASK_generic; pte_l2_s_cache_mode = L2_B|L2_C; + pte_l2_s_wc_mode = L2_B; pte_l2_s_cache_mask = L2_S_CACHE_MASK_generic; /* @@ -6040,6 +6059,10 @@ pte_l2_l_cache_mode = L2_C; pte_l2_s_cache_mode = L2_C; + pte_l1_s_wc_mode = L1_S_B; + pte_l2_l_wc_mode = L2_B; + pte_l2_s_wc_mode = L2_B; + pte_l1_s_cache_mode_pt = L1_S_C; pte_l2_l_cache_mode_pt = L2_C; pte_l2_s_cache_mode_pt = L2_C; @@ -6062,6 +6085,10 @@ pte_l2_l_cache_mode = L2_B | L2_C; pte_l2_s_cache_mode = L2_B | L2_C; + pte_l1_s_cache_mode = L1_S_B; + pte_l2_l_cache_mode = L2_B; + pte_l2_s_cache_mode = L2_B; + pte_l1_s_cache_mode_pt = L1_S_C; pte_l2_l_cache_mode_pt = L2_C; pte_l2_s_cache_mode_pt = L2_C; @@ -6084,6 +6111,10 @@ pte_l2_l_cache_mode = L2_C; pte_l2_s_cache_mode = L2_C; + pte_l1_s_wc_mode = L1_S_B; + pte_l2_l_wc_mode = L2_B; + pte_l2_s_wc_mode = L2_B; + pte_l1_s_cache_mode_pt = L1_S_C; pte_l2_l_cache_mode_pt = L2_C; pte_l2_s_cache_mode_pt = L2_C; @@ -6123,12 +6154,15 @@ int write_through = 0; pte_l1_s_cache_mode = L1_S_B|L1_S_C; + pte_l1_s_wc_mode = L1_S_B; pte_l1_s_cache_mask = L1_S_CACHE_MASK_xscale; pte_l2_l_cache_mode = L2_B|L2_C; + pte_l2_l_wc_mode = L2_B; pte_l2_l_cache_mask = L2_L_CACHE_MASK_xscale; pte_l2_s_cache_mode = L2_B|L2_C; + pte_l2_s_wc_mode = L2_B; pte_l2_s_cache_mask = L2_S_CACHE_MASK_xscale; pte_l1_s_cache_mode_pt = L1_S_C; Index: src/sys/arch/arm/include/arm32/pmap.h diff -u src/sys/arch/arm/include/arm32/pmap.h:1.97 src/sys/arch/arm/include/arm32/pmap.h:1.98 --- src/sys/arch/arm/include/arm32/pmap.h:1.97 Sun Nov 14 13:33:21 2010 +++ src/sys/arch/arm/include/arm32/pmap.h Mon Feb 28 10:03:49 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.h,v 1.97 2010/11/14 13:33:21 uebayasi Exp $ */ +/* $NetBSD: pmap.h,v 1.98 2011/02/28 10:03:49 macallan Exp $ */ /* * Copyright (c) 2002, 2003 Wasabi Systems, Inc. @@ -278,6 +278,10 @@ #define pmap_copy(dp, sp, da, l, sa) /* nothing */ #define pmap_phys_address(ppn) (arm_ptob((ppn))) +u_int arm32_mmap_flags(paddr_t); +#define ARM32_MMAP_WRITECOMBINE 0x4000 +#define ARM32_MMAP_CACHEABLE 0x2000 +#define pmap_mmap_flags(ppn)
CVS commit: src/sys/arch/shark/ofw
Module Name:src Committed By: macallan Date: Mon Feb 28 10:05:04 UTC 2011 Modified Files: src/sys/arch/shark/ofw: igsfb_ofbus.c Log Message: use ARM32_MMAP_WRITECOMBINE when mmap()ing video memory for improved X11 speed To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/sys/arch/shark/ofw/igsfb_ofbus.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/shark/ofw/igsfb_ofbus.c diff -u src/sys/arch/shark/ofw/igsfb_ofbus.c:1.10 src/sys/arch/shark/ofw/igsfb_ofbus.c:1.11 --- src/sys/arch/shark/ofw/igsfb_ofbus.c:1.10 Wed Nov 11 17:05:11 2009 +++ src/sys/arch/shark/ofw/igsfb_ofbus.c Mon Feb 28 10:05:04 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: igsfb_ofbus.c,v 1.10 2009/11/11 17:05:11 macallan Exp $ */ +/* $NetBSD: igsfb_ofbus.c,v 1.11 2011/02/28 10:05:04 macallan Exp $ */ /* * Copyright (c) 2006 Michael Lorenz @@ -31,7 +31,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: igsfb_ofbus.c,v 1.10 2009/11/11 17:05:11 macallan Exp $); +__KERNEL_RCSID(0, $NetBSD: igsfb_ofbus.c,v 1.11 2011/02/28 10:05:04 macallan Exp $); #include sys/param.h #include sys/systm.h @@ -39,10 +39,12 @@ #include sys/device.h #include sys/malloc.h #include sys/buf.h +#include uvm/uvm.h #include machine/bus.h #include machine/intr.h #include machine/ofw.h +#include machine/pmap.h #include dev/isa/isavar.h @@ -255,6 +257,10 @@ * registers on CyberPro at its physical address */ if ((offset = igsfb_mem_paddr) + (offset (igsfb_mem_paddr + 0x0080))) { + return (arm_btop(offset) | ARM32_MMAP_WRITECOMBINE); + } + if ((offset = (igsfb_mem_paddr + 0x0080)) (offset (igsfb_mem_paddr + 0x0100))) return arm_btop(offset);
CVS commit: src/sys/arch/sparc64/dev
Module Name:src Committed By: nakayama Date: Mon Feb 28 14:29:29 UTC 2011 Modified Files: src/sys/arch/sparc64/dev: lom.c Log Message: lom_refresh(): Update only the sensor status specified by the edata as noted in sysmon_envsys(9). lom_sysctl_alarm(): Update alarm status before reading via sysctl to make it usable at a boot time. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/arch/sparc64/dev/lom.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/sparc64/dev/lom.c diff -u src/sys/arch/sparc64/dev/lom.c:1.6 src/sys/arch/sparc64/dev/lom.c:1.7 --- src/sys/arch/sparc64/dev/lom.c:1.6 Mon Mar 22 18:38:43 2010 +++ src/sys/arch/sparc64/dev/lom.c Mon Feb 28 14:29:29 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: lom.c,v 1.6 2010/03/22 18:38:43 nakayama Exp $ */ +/* $NetBSD: lom.c,v 1.7 2011/02/28 14:29:29 nakayama Exp $ */ /* $OpenBSD: lom.c,v 1.21 2010/02/28 20:44:39 kettenis Exp $ */ /* * Copyright (c) 2009 Mark Kettenis @@ -17,7 +17,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: lom.c,v 1.6 2010/03/22 18:38:43 nakayama Exp $); +__KERNEL_RCSID(0, $NetBSD: lom.c,v 1.7 2011/02/28 14:29:29 nakayama Exp $); #include sys/param.h #include sys/device.h @@ -217,6 +217,10 @@ static int lom_init_desc(struct lom_softc *); static void lom_refresh(struct sysmon_envsys *, envsys_data_t *); +static void lom_refresh_alarm(struct lom_softc *, envsys_data_t *, uint32_t); +static void lom_refresh_fan(struct lom_softc *, envsys_data_t *, uint32_t); +static void lom_refresh_psu(struct lom_softc *, envsys_data_t *, uint32_t); +static void lom_refresh_temp(struct lom_softc *, envsys_data_t *, uint32_t); static void lom1_write_hostname(struct lom_softc *); static void lom2_write_hostname(struct lom_softc *); @@ -947,88 +951,136 @@ lom_refresh(struct sysmon_envsys *sme, envsys_data_t *edata) { struct lom_softc *sc = sme-sme_cookie; + uint32_t i; + + /* Sensor number */ + i = edata-sensor; + + /* Sensor type */ + switch (edata-units) { + case ENVSYS_INDICATOR: + if (i sc-sc_num_alarm) + lom_refresh_alarm(sc, edata, i); + else + lom_refresh_psu(sc, edata, + i - sc-sc_num_alarm - sc-sc_num_fan); + break; + case ENVSYS_SFANRPM: + lom_refresh_fan(sc, edata, i - sc-sc_num_alarm); + break; + case ENVSYS_STEMP: + lom_refresh_temp(sc, edata, + i - sc-sc_num_alarm - sc-sc_num_fan - sc-sc_num_psu); + break; + default: + edata-state = ENVSYS_SINVALID; + break; + } + + /* + * If our hostname is set and differs from what's stored in + * the LOM, write the new hostname back to the LOM. Note that + * we include the terminating NUL when writing the hostname + * back to the LOM, otherwise the LOM will print any trailing + * garbage. + */ + if (i == 0 hostnamelen 0 + strncmp(sc-sc_hostname, hostname, sizeof(hostname)) != 0) { + if (sc-sc_type LOM_LOMLITE2) + lom1_write_hostname(sc); + else + lom2_write_hostname(sc); + strlcpy(sc-sc_hostname, hostname, sizeof(hostname)); + } +} + +static void +lom_refresh_alarm(struct lom_softc *sc, envsys_data_t *edata, uint32_t i) +{ uint8_t val; - int i; + + /* Fault LED or Alarms */ + KASSERT(i sc-sc_num_alarm); if (lom_read(sc, LOM_IDX_ALARM, val)) { - for (i = 0; i sc-sc_num_alarm; i++) - sc-sc_alarm[i].state = ENVSYS_SINVALID; + edata-state = ENVSYS_SINVALID; } else { - /* Fault LED */ - if ((val LOM_ALARM_FAULT) == LOM_ALARM_FAULT) - sc-sc_alarm[0].value_cur = 0; - else - sc-sc_alarm[0].value_cur = 1; - sc-sc_alarm[0].state = ENVSYS_SVALID; - - /* Alarms */ - for (i = 1; i sc-sc_num_alarm; i++) { + if (i == 0) { + /* Fault LED */ + if ((val LOM_ALARM_FAULT) == LOM_ALARM_FAULT) +edata-value_cur = 0; + else +edata-value_cur = 1; + } else { + /* Alarms */ if ((val (LOM_ALARM_1 (i - 1))) == 0) -sc-sc_alarm[i].value_cur = 0; +edata-value_cur = 0; else -sc-sc_alarm[i].value_cur = 1; - sc-sc_alarm[i].state = ENVSYS_SVALID; +edata-value_cur = 1; } + edata-state = ENVSYS_SVALID; } +} - for (i = 0; i sc-sc_num_fan; i++) { - if (lom_read(sc, LOM_IDX_FAN1 + i, val)) { - sc-sc_fan[i].state = ENVSYS_SINVALID; - continue; - } +static void +lom_refresh_fan(struct lom_softc *sc, envsys_data_t *edata, uint32_t i) +{ + uint8_t val; + + /* Fan speed */ + KASSERT(i sc-sc_num_fan); - sc-sc_fan[i].value_cur = (60 * sc-sc_fan_cal[i] * val) / 100; + if (lom_read(sc, LOM_IDX_FAN1 + i, val)) { + edata-state = ENVSYS_SINVALID; + } else { + edata-value_cur = (60 * sc-sc_fan_cal[i] * val) / 100; if (val sc-sc_fan_low[i]) - sc-sc_fan[i].state = ENVSYS_SCRITICAL; + edata-state = ENVSYS_SCRITICAL; else - sc-sc_fan[i].state = ENVSYS_SVALID; + edata-state = ENVSYS_SVALID; } +} - for (i = 0; i sc-sc_num_psu; i++) { - if (lom_read(sc, LOM_IDX_PSU1 + i, val) || - !ISSET(val, LOM_PSU_PRESENT)) { - sc-sc_psu[i].state
CVS commit: src/sys/dev/pad
Module Name:src Committed By: riz Date: Mon Feb 28 16:56:39 UTC 2011 Modified Files: src/sys/dev/pad: padvol.c Log Message: Use le16enc()/be16enc() to encode LE/BE values back into the audio stream. This fixes the tests/dev/audio test on my macppc box. While I'm here, use le16dec()/be16dec() directly instead of rewriting them. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/dev/pad/padvol.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/pad/padvol.c diff -u src/sys/dev/pad/padvol.c:1.4 src/sys/dev/pad/padvol.c:1.5 --- src/sys/dev/pad/padvol.c:1.4 Mon Sep 7 18:23:06 2009 +++ src/sys/dev/pad/padvol.c Mon Feb 28 16:56:39 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: padvol.c,v 1.4 2009/09/07 18:23:06 jmcneill Exp $ */ +/* $NetBSD: padvol.c,v 1.5 2011/02/28 16:56:39 riz Exp $ */ /*- * Copyright (c) 2007 Jared D. McNeill jmcne...@invisible.ca @@ -27,7 +27,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: padvol.c,v 1.4 2009/09/07 18:23:06 jmcneill Exp $); +__KERNEL_RCSID(0, $NetBSD: padvol.c,v 1.5 2011/02/28 16:56:39 riz Exp $); #include sys/types.h #include sys/param.h @@ -35,6 +35,7 @@ #include sys/condvar.h #include sys/kmem.h #include sys/device.h +#include sys/endian.h #include dev/audiovar.h #include dev/auconv.h @@ -88,9 +89,9 @@ m = (dst-end - dst-start) ~1; m = min(m, max_used); FILTER_LOOP_PROLOGUE(this-src, 2, dst, 2, m) { - j = (s[1] 8 | s[0]); + j = le16dec(s); wp = (int16_t *)d; - *wp = ((j * sc-sc_swvol) / 255); + le16enc(wp, (j * sc-sc_swvol) / 255); } FILTER_LOOP_EPILOGUE(this-src, dst); return 0; @@ -114,9 +115,9 @@ m = (dst-end - dst-start) ~1; m = min(m, max_used); FILTER_LOOP_PROLOGUE(this-src, 2, dst, 2, m) { - j = (s[0] 8 | s[1]); + j = be16dec(s); wp = (int16_t *)d; - *wp = ((j * sc-sc_swvol) / 255); + be16enc(wp, (j * sc-sc_swvol) / 255); } FILTER_LOOP_EPILOGUE(this-src, dst); return 0;
CVS commit: src/sys/dev
Module Name:src Committed By: mjacob Date: Mon Feb 28 17:17:55 UTC 2011 Modified Files: src/sys/dev/ic: isp.c isp_library.c isp_netbsd.h ispvar.h src/sys/dev/pci: isp_pci.c Log Message: Update isp driver to be in sync with other platforms. Mostly very minor changes with effectively zero impact on NetBSD. To generate a diff of this commit: cvs rdiff -u -r1.121 -r1.122 src/sys/dev/ic/isp.c cvs rdiff -u -r1.6 -r1.7 src/sys/dev/ic/isp_library.c cvs rdiff -u -r1.72 -r1.73 src/sys/dev/ic/isp_netbsd.h cvs rdiff -u -r1.71 -r1.72 src/sys/dev/ic/ispvar.h cvs rdiff -u -r1.113 -r1.114 src/sys/dev/pci/isp_pci.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ic/isp.c diff -u src/sys/dev/ic/isp.c:1.121 src/sys/dev/ic/isp.c:1.122 --- src/sys/dev/ic/isp.c:1.121 Fri Mar 26 20:52:00 2010 +++ src/sys/dev/ic/isp.c Mon Feb 28 17:17:55 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: isp.c,v 1.121 2010/03/26 20:52:00 mjacob Exp $ */ +/* $NetBSD: isp.c,v 1.122 2011/02/28 17:17:55 mjacob Exp $ */ /* * Machine and OS Independent (well, as best as possible) * code for the Qlogic ISP SCSI adapters. @@ -43,7 +43,7 @@ */ #ifdef __NetBSD__ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: isp.c,v 1.121 2010/03/26 20:52:00 mjacob Exp $); +__KERNEL_RCSID(0, $NetBSD: isp.c,v 1.122 2011/02/28 17:17:55 mjacob Exp $); #include dev/ic/isp_netbsd.h #endif #ifdef __FreeBSD__ @@ -778,7 +778,7 @@ ISP_IOXPUT_32(isp, ptr[wi++], cp[i]); wl--; } -MEMORYBARRIER(isp, SYNC_REQUEST, 0, ISP_QUEUE_SIZE(RQUEST_QUEUE_LEN(isp))); +MEMORYBARRIER(isp, SYNC_REQUEST, 0, ISP_QUEUE_SIZE(RQUEST_QUEUE_LEN(isp)), -1); ISP_MEMZERO(mbs, sizeof (mbs)); if (la 0x1 nw 0x1) { mbs.param[0] = MBOX_LOAD_RISC_RAM_2100; @@ -847,7 +847,7 @@ ISP_IOXPUT_16(isp, ptr[wi++], cp[i]); wl--; } -MEMORYBARRIER(isp, SYNC_REQUEST, 0, ISP_QUEUE_SIZE(RQUEST_QUEUE_LEN(isp))); +MEMORYBARRIER(isp, SYNC_REQUEST, 0, ISP_QUEUE_SIZE(RQUEST_QUEUE_LEN(isp)), -1); ISP_MEMZERO(mbs, sizeof (mbs)); if (la 0x1) { mbs.param[0] = MBOX_LOAD_RISC_RAM_2100; @@ -1717,7 +1717,7 @@ isp_prt(isp, ISP_LOGDEBUG0, INIT F/W from %p (%08x%08x), fcp-isp_scratch, (uint32_t) ((uint64_t)fcp-isp_scdma 32), (uint32_t) fcp-isp_scdma); - MEMORYBARRIER(isp, SYNC_SFORDEV, 0, sizeof (*icbp)); + MEMORYBARRIER(isp, SYNC_SFORDEV, 0, sizeof (*icbp), 0); isp_mboxcmd(isp, mbs); FC_SCRATCH_RELEASE(isp, 0); if (mbs.param[0] != MBOX_COMMAND_COMPLETE) { @@ -2009,7 +2009,7 @@ mbs.param[6] = DMA_WD3(fcp-isp_scdma); mbs.param[7] = DMA_WD2(fcp-isp_scdma); isp_prt(isp, ISP_LOGDEBUG0, INIT F/W from %04x%04x%04x%04x, DMA_WD3(fcp-isp_scdma), DMA_WD2(fcp-isp_scdma), DMA_WD1(fcp-isp_scdma), DMA_WD0(fcp-isp_scdma)); - MEMORYBARRIER(isp, SYNC_SFORDEV, 0, sizeof (*icbp)); + MEMORYBARRIER(isp, SYNC_SFORDEV, 0, sizeof (*icbp), 0); isp_mboxcmd(isp, mbs); FC_SCRATCH_RELEASE(isp, 0); @@ -2126,13 +2126,13 @@ mbs.param[3] = DMA_WD0(fcp-isp_scdma); mbs.param[6] = DMA_WD3(fcp-isp_scdma); mbs.param[7] = DMA_WD2(fcp-isp_scdma); - MEMORYBARRIER(isp, SYNC_SFORDEV, 0, QENTRY_LEN); + MEMORYBARRIER(isp, SYNC_SFORDEV, 0, QENTRY_LEN, chan); isp_mboxcmd(isp, mbs); if (mbs.param[0] != MBOX_COMMAND_COMPLETE) { rval = mbs.param[0]; goto out; } - MEMORYBARRIER(isp, SYNC_SFORCPU, QENTRY_LEN, QENTRY_LEN); + MEMORYBARRIER(isp, SYNC_SFORCPU, QENTRY_LEN, QENTRY_LEN, chan); scp += QENTRY_LEN; isp_get_plogx(isp, (isp_plogx_t *) scp, plp); if (isp-isp_dblev ISP_LOGDEBUG1) { @@ -2325,7 +2325,7 @@ return (-1); } } - MEMORYBARRIER(isp, SYNC_SFORDEV, 0, sizeof (un)); + MEMORYBARRIER(isp, SYNC_SFORDEV, 0, sizeof (un), chan); isp_mboxcmd(isp, mbs); if (mbs.param[0] != MBOX_COMMAND_COMPLETE) { if (dolock) { @@ -3216,7 +3216,7 @@ rq-snscb_fc4_type = FC4_SCSI; isp_put_gid_ft_request(isp, rq, fcp-isp_scratch); - MEMORYBARRIER(isp, SYNC_SFORDEV, 0, SNS_GID_FT_REQ_SIZE); + MEMORYBARRIER(isp, SYNC_SFORDEV, 0, SNS_GID_FT_REQ_SIZE, chan); MBSINIT(mbs, MBOX_SEND_SNS, MBLOGALL, 1000); mbs.param[0] = MBOX_SEND_SNS; @@ -3311,12 +3311,12 @@ mbs.param[3] = DMA_WD0(fcp-isp_scdma + CTXOFF); mbs.param[6] = DMA_WD3(fcp-isp_scdma + CTXOFF); mbs.param[7] = DMA_WD2(fcp-isp_scdma + CTXOFF); - MEMORYBARRIER(isp, SYNC_SFORDEV, XTXOFF, 2 * QENTRY_LEN); + MEMORYBARRIER(isp, SYNC_SFORDEV, XTXOFF, 2 * QENTRY_LEN, chan); isp_mboxcmd(isp, mbs); if (mbs.param[0] != MBOX_COMMAND_COMPLETE) { return (-1); } - MEMORYBARRIER(isp, SYNC_SFORCPU, ZTXOFF, QENTRY_LEN); + MEMORYBARRIER(isp, SYNC_SFORCPU, ZTXOFF, QENTRY_LEN, chan); pt = un.plocal; isp_get_ct_pt(isp, (isp_ct_pt_t *) scp[ZTXOFF], pt); if (isp-isp_dblev ISP_LOGDEBUG1) { @@ -3329,7 +3329,7 @@ chan, pt-ctp_status); return (-1); } - MEMORYBARRIER(isp, SYNC_SFORCPU, IGPOFF, GIDLEN + 16); + MEMORYBARRIER(isp, SYNC_SFORCPU,
CVS commit: src/sys/dev/microcode/isp
Module Name:src Committed By: mjacob Date: Mon Feb 28 17:19:44 UTC 2011 Modified Files: src/sys/dev/microcode/isp: asm_2322.h asm_2400.h asm_2500.h Log Message: Update firmware sets for the (rare) 2322, 2400 and 2500. In particular the latter two sets have boatloads of bug fixes. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/dev/microcode/isp/asm_2322.h cvs rdiff -u -r1.5 -r1.6 src/sys/dev/microcode/isp/asm_2400.h cvs rdiff -u -r1.1 -r1.2 src/sys/dev/microcode/isp/asm_2500.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. diffs are larger than 1MB and have been omitted
CVS commit: src/sys/dev/dkwedge
Module Name:src Committed By: christos Date: Mon Feb 28 18:28:20 UTC 2011 Modified Files: src/sys/dev/dkwedge: dk.c Log Message: Make error checking consistent, possibly fixes PR/44652. To generate a diff of this commit: cvs rdiff -u -r1.58 -r1.59 src/sys/dev/dkwedge/dk.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/dkwedge/dk.c diff -u src/sys/dev/dkwedge/dk.c:1.58 src/sys/dev/dkwedge/dk.c:1.59 --- src/sys/dev/dkwedge/dk.c:1.58 Thu Dec 23 09:22:03 2010 +++ src/sys/dev/dkwedge/dk.c Mon Feb 28 13:28:20 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: dk.c,v 1.58 2010/12/23 14:22:03 mlelstv Exp $ */ +/* $NetBSD: dk.c,v 1.59 2011/02/28 18:28:20 christos Exp $ */ /*- * Copyright (c) 2004, 2005, 2006, 2007 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: dk.c,v 1.58 2010/12/23 14:22:03 mlelstv Exp $); +__KERNEL_RCSID(0, $NetBSD: dk.c,v 1.59 2011/02/28 18:28:20 christos Exp $); #ifdef _KERNEL_OPT #include opt_dkwedge.h @@ -993,7 +993,6 @@ if (sc == NULL) return (ENODEV); - if (sc-sc_state != DKW_STATE_RUNNING) return (ENXIO); @@ -1073,6 +1072,11 @@ struct dkwedge_softc *sc = dkwedge_lookup(dev); int error = 0; + if (sc == NULL) + return (ENODEV); + if (sc-sc_state != DKW_STATE_RUNNING) + return (ENXIO); + KASSERT(sc-sc_dk.dk_openmask != 0); mutex_enter(sc-sc_dk.dk_openlock); @@ -1107,6 +,10 @@ uint64_t p_size, p_offset; int s; + if (sc == NULL) { + bp-b_error = ENODEV; + goto done; + } if (sc-sc_state != DKW_STATE_RUNNING) { bp-b_error = ENXIO; goto done; @@ -1281,6 +1289,8 @@ { struct dkwedge_softc *sc = dkwedge_lookup(dev); + if (sc == NULL) + return (ENODEV); if (sc-sc_state != DKW_STATE_RUNNING) return (ENXIO); @@ -1297,6 +1307,8 @@ { struct dkwedge_softc *sc = dkwedge_lookup(dev); + if (sc == NULL) + return (ENODEV); if (sc-sc_state != DKW_STATE_RUNNING) return (ENXIO); @@ -1314,6 +1326,8 @@ struct dkwedge_softc *sc = dkwedge_lookup(dev); int error = 0; + if (sc == NULL) + return (ENODEV); if (sc-sc_state != DKW_STATE_RUNNING) return (ENXIO); @@ -1373,7 +1387,6 @@ if (sc == NULL) return (-1); - if (sc-sc_state != DKW_STATE_RUNNING) return (-1); @@ -1409,8 +1422,7 @@ int rv = 0; if (sc == NULL) - return (ENXIO); - + return (ENODEV); if (sc-sc_state != DKW_STATE_RUNNING) return (ENXIO);
CVS commit: src/lib/librumphijack
Module Name:src Committed By: pooka Date: Mon Feb 28 19:57:37 UTC 2011 Modified Files: src/lib/librumphijack: hijack.c Log Message: A simple dup2-enforced affine transformation isn't enough when dealing with dup2() from a rump kernel fd to a host kernel fd. Consider: s1 = socket(); s2 = socket(); dup2(s2, 0); Instead, maintain a real mapping table (and get on my knees and pray i don't have to touch this hair-splitting code ever again). Apparently bourne shell scripts from a rump kernel fs work now (sh script.sh; ./script.sh doesn't work for obvious IT'S THE WRONG FS NAMESPACE reasons). No test regressions either, so I'm a happy camper. To generate a diff of this commit: cvs rdiff -u -r1.70 -r1.71 src/lib/librumphijack/hijack.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/librumphijack/hijack.c diff -u src/lib/librumphijack/hijack.c:1.70 src/lib/librumphijack/hijack.c:1.71 --- src/lib/librumphijack/hijack.c:1.70 Sun Feb 27 11:32:12 2011 +++ src/lib/librumphijack/hijack.c Mon Feb 28 19:57:36 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: hijack.c,v 1.70 2011/02/27 11:32:12 pooka Exp $ */ +/* $NetBSD: hijack.c,v 1.71 2011/02/28 19:57:36 pooka Exp $ */ /*- * Copyright (c) 2011 Antti Kantee. All Rights Reserved. @@ -26,7 +26,7 @@ */ #include sys/cdefs.h -__RCSID($NetBSD: hijack.c,v 1.70 2011/02/27 11:32:12 pooka Exp $); +__RCSID($NetBSD: hijack.c,v 1.71 2011/02/28 19:57:36 pooka Exp $); #define __ssp_weak_name(fun) _hijack_ ## fun @@ -232,23 +232,89 @@ } syscalls[DUALCALL__NUM]; #define GETSYSCALL(which, name) syscalls[DUALCALL_##name].bs_##which -pid_t (*host_fork)(void); -int (*host_daemon)(int, int); -int (*host_execve)(const char *, char *const[], char *const[]); -void * (*host_mmap)(void *, size_t, int, int, int, off_t); - -/* ok, we need *two* bits per dup2'd fd to track fd+HIJACKOFF aliases */ -static uint32_t dup2mask; -#define ISDUP2D(fd) (((fd) 16) (1(fd) dup2mask)) -#define SETDUP2(fd) \ -do { if ((fd) 16) dup2mask |= (1(fd)); } while (/*CONSTCOND*/0) -#define CLRDUP2(fd) \ -do { if ((fd) 16) dup2mask = ~(1(fd)); } while (/*CONSTCOND*/0) -#define ISDUP2ALIAS(fd) (((fd) 16) (1((fd)+16) dup2mask)) -#define SETDUP2ALIAS(fd) \ -do { if ((fd) 16) dup2mask |= (1((fd)+16)); } while (/*CONSTCOND*/0) -#define CLRDUP2ALIAS(fd) \ -do { if ((fd) 16) dup2mask = ~(1((fd)+16)); } while (/*CONSTCOND*/0) +static pid_t (*host_fork)(void); +static int (*host_daemon)(int, int); +static int (*host_execve)(const char *, char *const[], char *const[]); +static void * (*host_mmap)(void *, size_t, int, int, int, off_t); + +static bool fd_isrump(int); +static bool path_isrump(const char *); + +/* + * Maintain a mapping table for the usual dup2 suspects. + */ +/* note: you cannot change this without editing the env-passing code */ +#define DUP2HIGH 2 +static uint32_t dup2vec[DUP2HIGH+1]; +#define DUP2BIT (131) +#define DUP2ALIAS (130) +#define DUP2FDMASK ((130)-1) + +static bool +isdup2d(int fd) +{ + + return fd = DUP2HIGH fd = 0 dup2vec[fd] DUP2BIT; +} + +static int +mapdup2(int hostfd) +{ + + _DIAGASSERT(isdup2d(hostfd)); + return dup2vec[hostfd] DUP2FDMASK; +} + +static int +unmapdup2(int rumpfd) +{ + int i; + + for (i = 0; i = DUP2HIGH; i++) { + if (dup2vec[i] DUP2BIT (dup2vec[i] DUP2FDMASK) == rumpfd) + return i; + } + return -1; +} + +static void +setdup2(int hostfd, int rumpfd) +{ + + if (hostfd DUP2HIGH) { + _DIAGASSERT(0); + return; + } + + dup2vec[hostfd] = DUP2BIT | DUP2ALIAS | rumpfd; +} + +static void +clrdup2(int hostfd) +{ + + if (hostfd DUP2HIGH) { + _DIAGASSERT(0); + return; + } + + dup2vec[hostfd] = 0; +} + +static bool +killdup2alias(int rumpfd) +{ + int hostfd; + + if ((hostfd = unmapdup2(rumpfd)) == -1) + return false; + + if (dup2vec[hostfd] DUP2ALIAS) { + dup2vec[hostfd] = ~DUP2ALIAS; + return true; + } + return false; +} //#define DEBUGJACK #ifdef DEBUGJACK @@ -258,7 +324,7 @@ { va_list ap; - if (ISDUP2D(STDERR_FILENO)) + if (isdup2d(STDERR_FILENO)) return; va_start(ap, fmt); @@ -266,6 +332,28 @@ va_end(ap); } +static const char * +whichfd(int fd) +{ + + if (fd == -1) + return -1; + else if (fd_isrump(fd)) + return rump; + else + return host; +} + +static const char * +whichpath(const char *path) +{ + + if (path_isrump(path)) + return rump; + else + return host; +} + #else #define DPRINTF(x) #endif @@ -275,7 +363,7 @@ { \ type (*fun) proto; \ \ - DPRINTF((%s - %d\n, __STRING(name), fd)); \ + DPRINTF((%s - %d (%s)\n, __STRING(name), fd, whichfd(fd))); \ if (fd_isrump(fd)) { \ fun = syscalls[rcname].bs_rump;\ fd = fd_host2rump(fd); \ @@ -291,7 +379,8 @@ { \ type (*fun) proto; \ \ - DPRINTF((%s - %s\n, __STRING(name), path)); \ + DPRINTF((%s - %s (%s)\n, __STRING(name), path, \ + whichpath(path))); \
CVS commit: src/lib/librumphijack
Module Name:src Committed By: pooka Date: Mon Feb 28 20:39:07 UTC 2011 Modified Files: src/lib/librumphijack: hijack.c Log Message: make compiler sign-happy To generate a diff of this commit: cvs rdiff -u -r1.71 -r1.72 src/lib/librumphijack/hijack.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/librumphijack/hijack.c diff -u src/lib/librumphijack/hijack.c:1.71 src/lib/librumphijack/hijack.c:1.72 --- src/lib/librumphijack/hijack.c:1.71 Mon Feb 28 19:57:36 2011 +++ src/lib/librumphijack/hijack.c Mon Feb 28 20:39:07 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: hijack.c,v 1.71 2011/02/28 19:57:36 pooka Exp $ */ +/* $NetBSD: hijack.c,v 1.72 2011/02/28 20:39:07 pooka Exp $ */ /*- * Copyright (c) 2011 Antti Kantee. All Rights Reserved. @@ -26,7 +26,7 @@ */ #include sys/cdefs.h -__RCSID($NetBSD: hijack.c,v 1.71 2011/02/28 19:57:36 pooka Exp $); +__RCSID($NetBSD: hijack.c,v 1.72 2011/02/28 20:39:07 pooka Exp $); #define __ssp_weak_name(fun) _hijack_ ## fun @@ -271,7 +271,8 @@ int i; for (i = 0; i = DUP2HIGH; i++) { - if (dup2vec[i] DUP2BIT (dup2vec[i] DUP2FDMASK) == rumpfd) + if (dup2vec[i] DUP2BIT + (dup2vec[i] DUP2FDMASK) == (unsigned)rumpfd) return i; } return -1; @@ -1002,8 +1003,12 @@ */ for (i = 0, maxdup2 = 0; i = DUP2HIGH; i++) { - if (dup2vec[i] DUP2BIT) -maxdup2 = MAX(dup2vec[i] DUP2FDMASK, maxdup2); + if (dup2vec[i] DUP2BIT) { +int val; + +val = dup2vec[i] DUP2FDMASK; +maxdup2 = MAX(val, maxdup2); + } } if (fd = HIJACK_FDOFF)
CVS commit: src/tests/fs/common
Module Name:src Committed By: pooka Date: Mon Feb 28 21:03:15 UTC 2011 Modified Files: src/tests/fs/common: fstest_nfs.c Log Message: bump nfdsargv[]�size belatedly (and add a few extra for needs of future bugs) To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/tests/fs/common/fstest_nfs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/fs/common/fstest_nfs.c diff -u src/tests/fs/common/fstest_nfs.c:1.6 src/tests/fs/common/fstest_nfs.c:1.7 --- src/tests/fs/common/fstest_nfs.c:1.6 Thu Feb 10 16:35:01 2011 +++ src/tests/fs/common/fstest_nfs.c Mon Feb 28 21:03:15 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: fstest_nfs.c,v 1.6 2011/02/10 16:35:01 njoly Exp $ */ +/* $NetBSD: fstest_nfs.c,v 1.7 2011/02/28 21:03:15 pooka Exp $ */ /* * Copyright (c) 2010 The NetBSD Foundation, Inc. @@ -75,7 +75,7 @@ const char *image, off_t size, void *fspriv) { const char *srcdir; - char *nfsdargv[7]; + char *nfsdargv[16]; char nfsdpath[MAXPATHLEN]; char imagepath[MAXPATHLEN]; char ethername[MAXPATHLEN], ethername_ro[MAXPATHLEN];
CVS commit: src/tests/fs/common
Module Name:src Committed By: pooka Date: Mon Feb 28 21:08:13 UTC 2011 Modified Files: src/tests/fs/common: fstest_nfs.c Log Message: g/c unused variable To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/tests/fs/common/fstest_nfs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/fs/common/fstest_nfs.c diff -u src/tests/fs/common/fstest_nfs.c:1.7 src/tests/fs/common/fstest_nfs.c:1.8 --- src/tests/fs/common/fstest_nfs.c:1.7 Mon Feb 28 21:03:15 2011 +++ src/tests/fs/common/fstest_nfs.c Mon Feb 28 21:08:13 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: fstest_nfs.c,v 1.7 2011/02/28 21:03:15 pooka Exp $ */ +/* $NetBSD: fstest_nfs.c,v 1.8 2011/02/28 21:08:13 pooka Exp $ */ /* * Copyright (c) 2010 The NetBSD Foundation, Inc. @@ -66,9 +66,6 @@ atf_tc_fail(child died); } -struct nfstestargs *theargs; - - /* fork rump nfsd, configure interface */ static int donewfs(const atf_tc_t *tc, void **argp,
CVS commit: src/tests/fs/common
Module Name:src Committed By: pooka Date: Mon Feb 28 21:08:46 UTC 2011 Modified Files: src/tests/fs/common: fstest_nfs.c Log Message: g/c use of unused variable too To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/tests/fs/common/fstest_nfs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/fs/common/fstest_nfs.c diff -u src/tests/fs/common/fstest_nfs.c:1.8 src/tests/fs/common/fstest_nfs.c:1.9 --- src/tests/fs/common/fstest_nfs.c:1.8 Mon Feb 28 21:08:13 2011 +++ src/tests/fs/common/fstest_nfs.c Mon Feb 28 21:08:46 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: fstest_nfs.c,v 1.8 2011/02/28 21:08:13 pooka Exp $ */ +/* $NetBSD: fstest_nfs.c,v 1.9 2011/02/28 21:08:46 pooka Exp $ */ /* * Copyright (c) 2010 The NetBSD Foundation, Inc. @@ -153,7 +153,6 @@ strcpy(args-ta_ethername, ethername); *argp = args; - theargs = args; return 0; }
CVS commit: src/sys/arch/hppa/hppa
Module Name:src Committed By: skrll Date: Mon Feb 28 21:20:50 UTC 2011 Modified Files: src/sys/arch/hppa/hppa: trap.S Log Message: Remove old/incorrect comment. To generate a diff of this commit: cvs rdiff -u -r1.58 -r1.59 src/sys/arch/hppa/hppa/trap.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/hppa/hppa/trap.S diff -u src/sys/arch/hppa/hppa/trap.S:1.58 src/sys/arch/hppa/hppa/trap.S:1.59 --- src/sys/arch/hppa/hppa/trap.S:1.58 Sat Feb 26 07:54:48 2011 +++ src/sys/arch/hppa/hppa/trap.S Mon Feb 28 21:20:50 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: trap.S,v 1.58 2011/02/26 07:54:48 skrll Exp $ */ +/* $NetBSD: trap.S,v 1.59 2011/02/28 21:20:50 skrll Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -1914,7 +1914,6 @@ * - tr7: old r1 */ - /* do not overwrite %tr4(%cr28) it contains the contents of r24 */ mtctl %t3, %tr2 GET_CURCPU(%t3)
CVS commit: src/tests
Module Name:src Committed By: pooka Date: Mon Feb 28 21:21:14 UTC 2011 Modified Files: src/tests/fs/nfs/nfsservice: rumpnfsd.c src/tests/net/config: netconfig.c Log Message: make netcfg produce sensible results in a non-atf env To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/tests/fs/nfs/nfsservice/rumpnfsd.c cvs rdiff -u -r1.6 -r1.7 src/tests/net/config/netconfig.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/fs/nfs/nfsservice/rumpnfsd.c diff -u src/tests/fs/nfs/nfsservice/rumpnfsd.c:1.6 src/tests/fs/nfs/nfsservice/rumpnfsd.c:1.7 --- src/tests/fs/nfs/nfsservice/rumpnfsd.c:1.6 Fri Dec 31 18:11:27 2010 +++ src/tests/fs/nfs/nfsservice/rumpnfsd.c Mon Feb 28 21:21:14 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: rumpnfsd.c,v 1.6 2010/12/31 18:11:27 pooka Exp $ */ +/* $NetBSD: rumpnfsd.c,v 1.7 2011/02/28 21:21:14 pooka Exp $ */ /*- * Copyright (c) 2010 The NetBSD Foundation, Inc. @@ -64,6 +64,9 @@ pthread_t t; int rv; + /* for netcfg */ + noatf = 1; + /* use defaults? */ if (argc == 1) { ethername = etherbus; Index: src/tests/net/config/netconfig.c diff -u src/tests/net/config/netconfig.c:1.6 src/tests/net/config/netconfig.c:1.7 --- src/tests/net/config/netconfig.c:1.6 Tue Aug 17 12:04:34 2010 +++ src/tests/net/config/netconfig.c Mon Feb 28 21:21:14 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: netconfig.c,v 1.6 2010/08/17 12:04:34 pooka Exp $ */ +/* $NetBSD: netconfig.c,v 1.7 2011/02/28 21:21:14 pooka Exp $ */ /*- * Copyright (c) 2010 The NetBSD Foundation, Inc. @@ -29,7 +29,7 @@ #include sys/cdefs.h #ifndef lint -__RCSID($NetBSD: netconfig.c,v 1.6 2010/08/17 12:04:34 pooka Exp $); +__RCSID($NetBSD: netconfig.c,v 1.7 2011/02/28 21:21:14 pooka Exp $); #endif /* not lint */ #include sys/types.h @@ -46,6 +46,7 @@ #include netinet/ip_icmp.h #include atf-c.h +#include err.h #include errno.h #include string.h @@ -54,13 +55,18 @@ #include ../../h_macros.h +int noatf; + static void __unused netcfg_rump_makeshmif(const char *busname, char *ifname) { int rv, ifnum; if ((rv = rump_pub_shmif_create(busname, ifnum)) != 0) { - atf_tc_fail(makeshmif: rump_pub_shmif_create %d, rv); + if (noatf) + err(1, makeshmif: rump_pub_shmif_create %d, rv); + else + atf_tc_fail(makeshmif: rump_pub_shmif_create %d, rv); } sprintf(ifname, shmif%d, ifnum); } @@ -71,7 +77,10 @@ int rv; if ((rv = rump_pub_virtif_create(ifnum)) != 0) { - atf_tc_fail(makeshmif: rump_pub_virtif_create %d, rv); + if (noatf) + err(1, makeshmif: rump_pub_virtif_create %d, rv); + else + atf_tc_fail(makeshmif: rump_pub_virtif_create %d, rv); } sprintf(ifname, virt%d, ifnum); } @@ -86,7 +95,10 @@ s = -1; if ((s = rump_sys_socket(PF_INET, SOCK_DGRAM, 0)) 0) { - atf_tc_fail_errno(if config socket); + if (noatf) + err(1, if config socket); + else + atf_tc_fail_errno(if config socket); } inaddr = inet_addr(addr); @@ -113,8 +125,11 @@ sin-sin_addr.s_addr = inaddr | ~inmask; rv = rump_sys_ioctl(s, SIOCAIFADDR, ia); - if (rv) { - atf_tc_fail_errno(SIOCAIFADDR); + if (rv == -1) { + if (noatf) + err(1, SIOCAIFADDR); + else + atf_tc_fail_errno(SIOCAIFADDR); } rump_sys_close(s); } @@ -134,7 +149,10 @@ s = rump_sys_socket(PF_ROUTE, SOCK_RAW, 0); if (s == -1) { - atf_tc_fail_errno(routing socket); + if (noatf) + err(1, routing socket); + else + atf_tc_fail_errno(routing socket); } memset(m_rtmsg, 0, sizeof(m_rtmsg)); @@ -173,7 +191,10 @@ rv = rump_sys_write(s, m_rtmsg, len); if (rv != (int)len) { - atf_tc_fail_errno(write routing message); + if (noatf) + err(1, write routing message); + else + atf_tc_fail_errno(write routing message); } rump_sys_close(s); }
CVS commit: src/sys/arch/hppa/hppa
Module Name:src Committed By: skrll Date: Mon Feb 28 21:22:35 UTC 2011 Modified Files: src/sys/arch/hppa/hppa: trap.S Log Message: Don't use %tr3 (aka cr27) in emu trap. cr27 is now used for lwp private info. To generate a diff of this commit: cvs rdiff -u -r1.59 -r1.60 src/sys/arch/hppa/hppa/trap.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/hppa/hppa/trap.S diff -u src/sys/arch/hppa/hppa/trap.S:1.59 src/sys/arch/hppa/hppa/trap.S:1.60 --- src/sys/arch/hppa/hppa/trap.S:1.59 Mon Feb 28 21:20:50 2011 +++ src/sys/arch/hppa/hppa/trap.S Mon Feb 28 21:22:35 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: trap.S,v 1.59 2011/02/28 21:20:50 skrll Exp $ */ +/* $NetBSD: trap.S,v 1.60 2011/02/28 21:22:35 skrll Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -955,7 +955,7 @@ * to use. hppa_fpu_swap deliberately uses only these registers and %r1 * and %arg0. */ - mtctl %arg1, %tr3 + mtctl %arg1, %tr4 mtctl %rp, %tr5 /* Call hppa_fpu_swap. */ @@ -968,7 +968,7 @@ /* Restore registers and rfi. */ mfctl %tr5, %rp - mfctl %tr3, %arg1 + mfctl %tr4, %arg1 mfctl %tr2, %arg0 mfctl %tr7, %r1 rfi
CVS commit: src/sys/arch/hppa/include
Module Name:src Committed By: skrll Date: Mon Feb 28 21:23:33 UTC 2011 Modified Files: src/sys/arch/hppa/include: types.h Log Message: __HAVE___LWP_GETPRIVATE_FAST works now. To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.19 src/sys/arch/hppa/include/types.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/hppa/include/types.h diff -u src/sys/arch/hppa/include/types.h:1.18 src/sys/arch/hppa/include/types.h:1.19 --- src/sys/arch/hppa/include/types.h:1.18 Thu Feb 24 04:28:45 2011 +++ src/sys/arch/hppa/include/types.h Mon Feb 28 21:23:33 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: types.h,v 1.18 2011/02/24 04:28:45 joerg Exp $ */ +/* $NetBSD: types.h,v 1.19 2011/02/28 21:23:33 skrll Exp $ */ /* $OpenBSD: types.h,v 1.6 2001/08/11 01:58:34 art Exp $ */ @@ -94,8 +94,6 @@ extern const char __CONCAT(name,_ras_start[]), __CONCAT(name,_ras_end[]) #define __HAVE_CPU_LWP_SETPRIVATE -#if 0 #define __HAVE___LWP_GETPRIVATE_FAST -#endif #endif /* _HPPA_TYPES_H_ */
CVS commit: src/sys/arch/hppa/hppa
Module Name:src Committed By: skrll Date: Mon Feb 28 21:24:25 UTC 2011 Modified Files: src/sys/arch/hppa/hppa: db_trace.c Log Message: Add the trapframe pointer to the syscall information. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sys/arch/hppa/hppa/db_trace.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/hppa/hppa/db_trace.c diff -u src/sys/arch/hppa/hppa/db_trace.c:1.9 src/sys/arch/hppa/hppa/db_trace.c:1.10 --- src/sys/arch/hppa/hppa/db_trace.c:1.9 Thu Jul 1 02:38:27 2010 +++ src/sys/arch/hppa/hppa/db_trace.c Mon Feb 28 21:24:25 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: db_trace.c,v 1.9 2010/07/01 02:38:27 rmind Exp $ */ +/* $NetBSD: db_trace.c,v 1.10 2011/02/28 21:24:25 skrll Exp $ */ /* $OpenBSD: db_interface.c,v 1.16 2001/03/22 23:31:45 mickey Exp $ */ @@ -29,7 +29,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: db_trace.c,v 1.9 2010/07/01 02:38:27 rmind Exp $); +__KERNEL_RCSID(0, $NetBSD: db_trace.c,v 1.10 2011/02/28 21:24:25 skrll Exp $); #include sys/param.h #include sys/systm.h @@ -153,9 +153,9 @@ tf = (struct trapframe *)((char *)scargs - sizeof(*tf)); if (tf-tf_flags TFF_SYS) -pr(-- syscall #%d(%x, %x, %x, %x, ...)\n, +pr(-- syscall #%d(%x, %x, %x, %x, ...) (%p)\n, tf-tf_t1, scargs[1], scargs[2], -scargs[3], scargs[4]); +scargs[3], scargs[4], tf); else pr(-- trap #%d (%p) %s\n, tf-tf_flags 0x3f, tf, (tf-tf_flags T_USER)? from user :
CVS commit: src
Module Name:src Committed By: haad Date: Mon Feb 28 23:23:08 UTC 2011 Modified Files: src/gnu/usr.bin/groff/tmac: mdoc.local src/lib/libdm: dm.3 Log Message: Fix problems in libdm manual page pointed by njoly@ thanks for help. To generate a diff of this commit: cvs rdiff -u -r1.62 -r1.63 src/gnu/usr.bin/groff/tmac/mdoc.local cvs rdiff -u -r1.3 -r1.4 src/lib/libdm/dm.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/gnu/usr.bin/groff/tmac/mdoc.local diff -u src/gnu/usr.bin/groff/tmac/mdoc.local:1.62 src/gnu/usr.bin/groff/tmac/mdoc.local:1.63 --- src/gnu/usr.bin/groff/tmac/mdoc.local:1.62 Fri Feb 11 23:47:49 2011 +++ src/gnu/usr.bin/groff/tmac/mdoc.local Mon Feb 28 23:23:08 2011 @@ -1,4 +1,4 @@ -.\ $NetBSD: mdoc.local,v 1.62 2011/02/11 23:47:49 christos Exp $ +.\ $NetBSD: mdoc.local,v 1.63 2011/02/28 23:23:08 haad Exp $ .\ .\ Copyright (c) 2003, 2004 The NetBSD Foundation, Inc. .\ All rights reserved. @@ -84,6 +84,7 @@ .\ Local libraries not in groff .ds doc-str-Lb-libarchive Reading and Writing Streaming Archives Library (libarchive, \-larchive) .ds doc-str-Lb-libbluetooth Bluetooth Library (libbluetooth, \-lbluetooth) +.ds doc-str-Lb-libdm Device-mapper Library (libdm, \-ldm) .ds doc-str-Lb-libfetch File Transfer Library for URLs (libfetch, \-lfetch) .ds doc-str-Lb-libiscsi iSCSI protocol library (libiscsi, \-liscsi) .ds doc-str-Lb-libisns Internet Storage Name Service Library (libisns, \-lisns) Index: src/lib/libdm/dm.3 diff -u src/lib/libdm/dm.3:1.3 src/lib/libdm/dm.3:1.4 --- src/lib/libdm/dm.3:1.3 Mon Feb 28 09:10:28 2011 +++ src/lib/libdm/dm.3 Mon Feb 28 23:23:08 2011 @@ -1,4 +1,4 @@ -.\ $NetBSD: dm.3,v 1.3 2011/02/28 09:10:28 njoly Exp $ +.\ $NetBSD: dm.3,v 1.4 2011/02/28 23:23:08 haad Exp $ .\ .\ Copyright (c) 2004,2009 The NetBSD Foundation, Inc. .\ All rights reserved. @@ -30,7 +30,7 @@ .Dt DM 3 .Os .Sh NAME -.Nm libdm +.Nm dm .Nd device-mapper access manipulation library .Sh LIBRARY .Lb libdm @@ -107,9 +107,9 @@ .Ft char * .Fn libdm_table_get_target libdm_table_t libdm_table .Ft int -.Fn libdm_table_set_params const char *params libdm_table_t libdm_table +.Fn libdm_table_set_params const char *params libdm_table_t libdm_table .Ft char * -.Fn libdm_table_get_params libdm_table_t libdm_table +.Fn libdm_table_get_params libdm_table_t libdm_table .Ft int32_t .Fn libdm_table_get_status libdm_table_t libdm_table .Ft void @@ -218,12 +218,10 @@ Set/fetch device status flags from the task dictionary. .Pp .Fn libdm_task_get_open_num -Fetch number of opened devices from the kernel and return them as -.Rt count . +Fetch number of opened devices from the kernel and return them as count . .Pp .Fn libdm_task_get_target_num -Fetch number of opened devices from the kernel and return them as -.Rt count . +Fetch number of opened devices from the kernel and return them as count . .Pp .Fn libdm_task_get_cmd_version Get the version of the dm driver in the kernel as array
CVS commit: src/share/man/man4
Module Name:src Committed By: jruoho Date: Tue Mar 1 04:45:52 UTC 2011 Modified Files: src/share/man/man4: acpicpu.4 Log Message: Update compatibility notes. To generate a diff of this commit: cvs rdiff -u -r1.25 -r1.26 src/share/man/man4/acpicpu.4 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/share/man/man4/acpicpu.4 diff -u src/share/man/man4/acpicpu.4:1.25 src/share/man/man4/acpicpu.4:1.26 --- src/share/man/man4/acpicpu.4:1.25 Fri Feb 25 18:48:26 2011 +++ src/share/man/man4/acpicpu.4 Tue Mar 1 04:45:52 2011 @@ -1,4 +1,4 @@ -.\ $NetBSD: acpicpu.4,v 1.25 2011/02/25 18:48:26 njoly Exp $ +.\ $NetBSD: acpicpu.4,v 1.26 2011/03/01 04:45:52 jruoho Exp $ .\ .\ Copyright (c) 2010 Jukka Ruohonen jruoho...@iki.fi .\ All rights reserved. @@ -24,7 +24,7 @@ .\ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\ POSSIBILITY OF SUCH DAMAGE. .\ -.Dd February 25, 2011 +.Dd March 1, 2011 .Dt ACPICPU 4 .Os .Sh NAME @@ -288,37 +288,22 @@ (with the .Fl e flag). -Note that valid per-CPU data is available only for C-states. .Sh COMPATIBILITY The .Nm -driver conflicts with -.Xr est 4 -and -.Xr powernow 4 -in addition to the +driver conflicts with the .Dv INTEL_ONDEMAND_CLOCKMOD kernel configuration option. -These must be disabled if +This must be disabled if .Nm is used. -Furthermore, in the unlikely case where both -.Nm -and -.Xr ichlpcib 4 -or -.Xr piixpcib 4 -provide support for P-states, -the PCI-based interfaces should not be accessed due possible race conditions. -.Pp -All relatively new x86 systems should prefer +Note that all relatively new x86 systems should prefer .Nm . The P-state support provided by .Xr est 4 and .Xr powernow 4 -are known to be either problematic or -entirely dysfunctional with new x86 processors. +is known to be problematic on new x86 processors. .Sh SEE ALSO .Xr acpi 4 , .Xr acpitz 4 ,
CVS commit: src/sys/arch/x86/acpi
Module Name:src Committed By: jruoho Date: Tue Mar 1 05:02:16 UTC 2011 Modified Files: src/sys/arch/x86/acpi: acpi_cpu_md.c Log Message: Remove the cross-call from the APERF/MPERF -function. To generate a diff of this commit: cvs rdiff -u -r1.49 -r1.50 src/sys/arch/x86/acpi/acpi_cpu_md.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/x86/acpi/acpi_cpu_md.c diff -u src/sys/arch/x86/acpi/acpi_cpu_md.c:1.49 src/sys/arch/x86/acpi/acpi_cpu_md.c:1.50 --- src/sys/arch/x86/acpi/acpi_cpu_md.c:1.49 Tue Mar 1 04:35:48 2011 +++ src/sys/arch/x86/acpi/acpi_cpu_md.c Tue Mar 1 05:02:16 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: acpi_cpu_md.c,v 1.49 2011/03/01 04:35:48 jruoho Exp $ */ +/* $NetBSD: acpi_cpu_md.c,v 1.50 2011/03/01 05:02:16 jruoho Exp $ */ /*- * Copyright (c) 2010, 2011 Jukka Ruohonen jruoho...@iki.fi @@ -27,7 +27,7 @@ * SUCH DAMAGE. */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: acpi_cpu_md.c,v 1.49 2011/03/01 04:35:48 jruoho Exp $); +__KERNEL_RCSID(0, $NetBSD: acpi_cpu_md.c,v 1.50 2011/03/01 05:02:16 jruoho Exp $); #include sys/param.h #include sys/bus.h @@ -101,7 +101,6 @@ static int acpicpu_md_quirk_piix4(struct pci_attach_args *); static void acpicpu_md_pstate_percent_reset(struct acpicpu_softc *); -static void acpicpu_md_pstate_percent_status(void *, void *); static int acpicpu_md_pstate_fidvid_get(struct acpicpu_softc *, uint32_t *); static int acpicpu_md_pstate_fidvid_set(struct acpicpu_pstate *); @@ -621,23 +620,11 @@ return 0; } -/* - * Returns the percentage of the actual frequency in - * terms of the maximum frequency of the calling CPU - * since the last call. A value zero implies an error. - */ uint8_t acpicpu_md_pstate_percent(struct acpicpu_softc *sc) { - struct cpu_info *ci = sc-sc_ci; uint64_t aperf, mperf; - uint64_t xc, rv = 0; - - if (__predict_false((sc-sc_flags ACPICPU_FLAG_P) == 0)) - return 0; - - if (__predict_false((sc-sc_flags ACPICPU_FLAG_P_HW) == 0)) - return 0; + uint64_t rv = 0; /* * Read the IA32_APERF and IA32_MPERF counters. The first @@ -647,6 +634,10 @@ * read without delay, and that only the ratio between * IA32_APERF and IA32_MPERF is architecturally defined. * + * The function thus returns the percentage of the actual + * frequency in terms of the maximum frequency of the calling + * CPU since the last call. A value zero implies an error. + * * For further details, refer to: * * Intel Corporation: Intel 64 and IA-32 Architectures @@ -657,13 +648,19 @@ * Guide (BKDG) for AMD Family 10h Processors. Section * 2.4.5, Revision 3.48, April 2010. */ - x86_disable_intr(); + if (__predict_false((sc-sc_flags ACPICPU_FLAG_P) == 0)) + return 0; + + if (__predict_false((sc-sc_flags ACPICPU_FLAG_P_HW) == 0)) + return 0; aperf = sc-sc_pstate_aperf; mperf = sc-sc_pstate_mperf; - xc = xc_unicast(0, acpicpu_md_pstate_percent_status, sc, NULL, ci); - xc_wait(xc); + x86_disable_intr(); + + sc-sc_pstate_aperf = rdmsr(MSR_APERF); + sc-sc_pstate_mperf = rdmsr(MSR_MPERF); x86_enable_intr(); @@ -677,15 +674,6 @@ } static void -acpicpu_md_pstate_percent_status(void *arg1, void *arg2) -{ - struct acpicpu_softc *sc = arg1; - - sc-sc_pstate_aperf = rdmsr(MSR_APERF); - sc-sc_pstate_mperf = rdmsr(MSR_MPERF); -} - -static void acpicpu_md_pstate_percent_reset(struct acpicpu_softc *sc) { struct msr_rw_info msr;
CVS commit: src/sys/dev/acpi
Module Name:src Committed By: jruoho Date: Tue Mar 1 05:32:03 UTC 2011 Modified Files: src/sys/dev/acpi: acpi_cpu.c acpi_cpu_cstate.c acpi_cpu_pstate.c acpi_cpu_tstate.c Log Message: Simplify by moving the debug printfs to one place. No functional change. To generate a diff of this commit: cvs rdiff -u -r1.31 -r1.32 src/sys/dev/acpi/acpi_cpu.c cvs rdiff -u -r1.46 -r1.47 src/sys/dev/acpi/acpi_cpu_cstate.c cvs rdiff -u -r1.42 -r1.43 src/sys/dev/acpi/acpi_cpu_pstate.c cvs rdiff -u -r1.24 -r1.25 src/sys/dev/acpi/acpi_cpu_tstate.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/acpi/acpi_cpu.c diff -u src/sys/dev/acpi/acpi_cpu.c:1.31 src/sys/dev/acpi/acpi_cpu.c:1.32 --- src/sys/dev/acpi/acpi_cpu.c:1.31 Sun Feb 27 18:32:53 2011 +++ src/sys/dev/acpi/acpi_cpu.c Tue Mar 1 05:32:03 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: acpi_cpu.c,v 1.31 2011/02/27 18:32:53 jruoho Exp $ */ +/* $NetBSD: acpi_cpu.c,v 1.32 2011/03/01 05:32:03 jruoho Exp $ */ /*- * Copyright (c) 2010, 2011 Jukka Ruohonen jruoho...@iki.fi @@ -27,7 +27,7 @@ * SUCH DAMAGE. */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: acpi_cpu.c,v 1.31 2011/02/27 18:32:53 jruoho Exp $); +__KERNEL_RCSID(0, $NetBSD: acpi_cpu.c,v 1.32 2011/03/01 05:32:03 jruoho Exp $); #include sys/param.h #include sys/cpu.h @@ -54,6 +54,7 @@ static int acpicpu_once_detach(void); static void acpicpu_start(device_t); static void acpicpu_debug_print(device_t); +static const char *acpicpu_debug_print_method(uint8_t); static const char *acpicpu_debug_print_dep(uint32_t); static void acpicpu_sysctl(device_t); @@ -680,7 +681,61 @@ { struct acpicpu_softc *sc = device_private(self); struct cpu_info *ci = sc-sc_ci; + struct acpicpu_cstate *cs; + struct acpicpu_pstate *ps; + struct acpicpu_tstate *ts; + static bool once = false; struct acpicpu_dep *dep; + uint32_t i, method; + + if (once != true) { + + for (i = 0; i __arraycount(sc-sc_cstate); i++) { + + cs = sc-sc_cstate[i]; + + if (cs-cs_method == 0) +continue; + + aprint_verbose_dev(sc-sc_dev, C%d: %3s, + lat %3u us, pow %5u mW, %s\n, i, + acpicpu_debug_print_method(cs-cs_method), + cs-cs_latency, cs-cs_power, + (cs-cs_flags != 0) ? bus master check : ); + } + + method = sc-sc_pstate_control.reg_spaceid; + + for (i = 0; i sc-sc_pstate_count; i++) { + + ps = sc-sc_pstate[i]; + + if (ps-ps_freq == 0) +continue; + + aprint_verbose_dev(sc-sc_dev, P%d: %3s, + lat %3u us, pow %5u mW, %4u MHz\n, i, + acpicpu_debug_print_method(method), + ps-ps_latency, ps-ps_power, ps-ps_freq); + } + + method = sc-sc_tstate_control.reg_spaceid; + + for (i = 0; i sc-sc_tstate_count; i++) { + + ts = sc-sc_tstate[i]; + + if (ts-ts_percent == 0) +continue; + + aprint_verbose_dev(sc-sc_dev, T%u: %3s, + lat %3u us, pow %5u mW, %3u %%\n, i, + acpicpu_debug_print_method(method), + ts-ts_latency, ts-ts_power, ts-ts_percent); + } + + once = true; + } aprint_debug_dev(sc-sc_dev, id %u, lapic id %u, cap 0x%04x, flags 0x%08x\n, ci-ci_acpiid, @@ -715,6 +770,27 @@ } static const char * +acpicpu_debug_print_method(uint8_t val) +{ + + switch (val) { + + case ACPICPU_C_STATE_HALT: + return HLT; + + case ACPICPU_C_STATE_FFH: + case ACPI_ADR_SPACE_FIXED_HARDWARE: + return FFH; + + case ACPICPU_C_STATE_SYSIO: /* ACPI_ADR_SPACE_SYSTEM_IO */ + return I/O; + + default: + return ???; + } +} + +static const char * acpicpu_debug_print_dep(uint32_t val) { Index: src/sys/dev/acpi/acpi_cpu_cstate.c diff -u src/sys/dev/acpi/acpi_cpu_cstate.c:1.46 src/sys/dev/acpi/acpi_cpu_cstate.c:1.47 --- src/sys/dev/acpi/acpi_cpu_cstate.c:1.46 Fri Feb 25 19:55:06 2011 +++ src/sys/dev/acpi/acpi_cpu_cstate.c Tue Mar 1 05:32:03 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: acpi_cpu_cstate.c,v 1.46 2011/02/25 19:55:06 jruoho Exp $ */ +/* $NetBSD: acpi_cpu_cstate.c,v 1.47 2011/03/01 05:32:03 jruoho Exp $ */ /*- * Copyright (c) 2010, 2011 Jukka Ruohonen jruoho...@iki.fi @@ -27,7 +27,7 @@ * SUCH DAMAGE. */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: acpi_cpu_cstate.c,v 1.46 2011/02/25 19:55:06 jruoho Exp $); +__KERNEL_RCSID(0, $NetBSD: acpi_cpu_cstate.c,v 1.47 2011/03/01 05:32:03 jruoho Exp $); #include sys/param.h #include sys/cpu.h @@ -48,7 +48,6 @@ #define _COMPONENT ACPI_BUS_COMPONENT ACPI_MODULE_NAME (acpi_cpu_cstate) -static void acpicpu_cstate_attach_print(struct acpicpu_softc *); static void acpicpu_cstate_attach_evcnt(struct acpicpu_softc *); static void acpicpu_cstate_detach_evcnt(struct acpicpu_softc *); static ACPI_STATUS acpicpu_cstate_cst(struct acpicpu_softc *); @@ -112,51 +111,6 @@ acpicpu_cstate_quirks(sc); acpicpu_cstate_attach_evcnt(sc); - acpicpu_cstate_attach_print(sc); -} - -void -acpicpu_cstate_attach_print(struct acpicpu_softc *sc) -{ - struct acpicpu_cstate
CVS commit: src/sys/dev/acpi
Module Name:src Committed By: jruoho Date: Tue Mar 1 05:37:02 UTC 2011 Modified Files: src/sys/dev/acpi: acpi_cpu_cstate.c Log Message: Use __arraycount(3). To generate a diff of this commit: cvs rdiff -u -r1.47 -r1.48 src/sys/dev/acpi/acpi_cpu_cstate.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/acpi/acpi_cpu_cstate.c diff -u src/sys/dev/acpi/acpi_cpu_cstate.c:1.47 src/sys/dev/acpi/acpi_cpu_cstate.c:1.48 --- src/sys/dev/acpi/acpi_cpu_cstate.c:1.47 Tue Mar 1 05:32:03 2011 +++ src/sys/dev/acpi/acpi_cpu_cstate.c Tue Mar 1 05:37:02 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: acpi_cpu_cstate.c,v 1.47 2011/03/01 05:32:03 jruoho Exp $ */ +/* $NetBSD: acpi_cpu_cstate.c,v 1.48 2011/03/01 05:37:02 jruoho Exp $ */ /*- * Copyright (c) 2010, 2011 Jukka Ruohonen jruoho...@iki.fi @@ -27,7 +27,7 @@ * SUCH DAMAGE. */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: acpi_cpu_cstate.c,v 1.47 2011/03/01 05:32:03 jruoho Exp $); +__KERNEL_RCSID(0, $NetBSD: acpi_cpu_cstate.c,v 1.48 2011/03/01 05:37:02 jruoho Exp $); #include sys/param.h #include sys/cpu.h @@ -118,9 +118,9 @@ { struct acpicpu_cstate *cs; const char *str; - int i; + uint8_t i; - for (i = 0; i ACPI_C_STATE_COUNT; i++) { + for (i = 0; i __arraycount(sc-sc_cstate); i++) { cs = sc-sc_cstate[i]; @@ -165,9 +165,9 @@ acpicpu_cstate_detach_evcnt(struct acpicpu_softc *sc) { struct acpicpu_cstate *cs; - int i; + uint8_t i; - for (i = 0; i ACPI_C_STATE_COUNT; i++) { + for (i = 0; i __arraycount(sc-sc_cstate); i++) { cs = sc-sc_cstate[i]; @@ -477,9 +477,9 @@ static void acpicpu_cstate_memset(struct acpicpu_softc *sc) { - int i = 0; + uint8_t i = 0; - while (i ACPI_C_STATE_COUNT) { + while (i __arraycount(sc-sc_cstate)) { sc-sc_cstate[i].cs_addr = 0; sc-sc_cstate[i].cs_power = 0;
CVS commit: src/sys/dev/acpi
Module Name:src Committed By: jruoho Date: Tue Mar 1 05:57:05 UTC 2011 Modified Files: src/sys/dev/acpi: acpi_cpu.c acpi_cpu_cstate.c acpi_cpu_pstate.c acpi_cpu_tstate.c Log Message: Move also the evcnt(9) event counters to one place. No functional change. To generate a diff of this commit: cvs rdiff -u -r1.32 -r1.33 src/sys/dev/acpi/acpi_cpu.c cvs rdiff -u -r1.48 -r1.49 src/sys/dev/acpi/acpi_cpu_cstate.c cvs rdiff -u -r1.43 -r1.44 src/sys/dev/acpi/acpi_cpu_pstate.c cvs rdiff -u -r1.25 -r1.26 src/sys/dev/acpi/acpi_cpu_tstate.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/acpi/acpi_cpu.c diff -u src/sys/dev/acpi/acpi_cpu.c:1.32 src/sys/dev/acpi/acpi_cpu.c:1.33 --- src/sys/dev/acpi/acpi_cpu.c:1.32 Tue Mar 1 05:32:03 2011 +++ src/sys/dev/acpi/acpi_cpu.c Tue Mar 1 05:57:04 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: acpi_cpu.c,v 1.32 2011/03/01 05:32:03 jruoho Exp $ */ +/* $NetBSD: acpi_cpu.c,v 1.33 2011/03/01 05:57:04 jruoho Exp $ */ /*- * Copyright (c) 2010, 2011 Jukka Ruohonen jruoho...@iki.fi @@ -27,10 +27,11 @@ * SUCH DAMAGE. */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: acpi_cpu.c,v 1.32 2011/03/01 05:32:03 jruoho Exp $); +__KERNEL_RCSID(0, $NetBSD: acpi_cpu.c,v 1.33 2011/03/01 05:57:04 jruoho Exp $); #include sys/param.h #include sys/cpu.h +#include sys/evcnt.h #include sys/kernel.h #include sys/kmem.h #include sys/module.h @@ -53,9 +54,6 @@ static int acpicpu_once_attach(void); static int acpicpu_once_detach(void); static void acpicpu_start(device_t); -static void acpicpu_debug_print(device_t); -static const char *acpicpu_debug_print_method(uint8_t); -static const char *acpicpu_debug_print_dep(uint32_t); static void acpicpu_sysctl(device_t); static ACPI_STATUS acpicpu_object(ACPI_HANDLE, struct acpicpu_object *); @@ -68,6 +66,11 @@ static void acpicpu_notify(ACPI_HANDLE, uint32_t, void *); static bool acpicpu_suspend(device_t, const pmf_qual_t *); static bool acpicpu_resume(device_t, const pmf_qual_t *); +static void acpicpu_evcnt_attach(device_t); +static void acpicpu_evcnt_detach(device_t); +static void acpicpu_debug_print(device_t); +static const char *acpicpu_debug_print_method(uint8_t); +static const char *acpicpu_debug_print_dep(uint32_t); static uint32_t acpicpu_count = 0; struct acpicpu_softc **acpicpu_sc = NULL; @@ -166,6 +169,7 @@ acpicpu_tstate_attach(self); acpicpu_debug_print(self); + acpicpu_evcnt_attach(self); (void)config_interrupts(self, acpicpu_start); (void)acpi_register_notify(sc-sc_node, acpicpu_notify); @@ -200,6 +204,8 @@ return rv; mutex_destroy(sc-sc_mtx); + acpicpu_evcnt_detach(self); + sc-sc_node-ad_device = NULL; acpicpu_count--; @@ -677,6 +683,101 @@ } static void +acpicpu_evcnt_attach(device_t self) +{ + struct acpicpu_softc *sc = device_private(self); + struct acpicpu_cstate *cs; + struct acpicpu_pstate *ps; + struct acpicpu_tstate *ts; + const char *str; + uint32_t i; + + for (i = 0; i __arraycount(sc-sc_cstate); i++) { + + cs = sc-sc_cstate[i]; + + if (cs-cs_method == 0) + continue; + + str = HALT; + + if (cs-cs_method == ACPICPU_C_STATE_FFH) + str = MWAIT; + + if (cs-cs_method == ACPICPU_C_STATE_SYSIO) + str = I/O; + + (void)snprintf(cs-cs_name, sizeof(cs-cs_name), + C%d (%s), i, str); + + evcnt_attach_dynamic(cs-cs_evcnt, EVCNT_TYPE_MISC, + NULL, device_xname(sc-sc_dev), cs-cs_name); + } + + for (i = 0; i sc-sc_pstate_count; i++) { + + ps = sc-sc_pstate[i]; + + if (ps-ps_freq == 0) + continue; + + (void)snprintf(ps-ps_name, sizeof(ps-ps_name), + P%u (%u MHz), i, ps-ps_freq); + + evcnt_attach_dynamic(ps-ps_evcnt, EVCNT_TYPE_MISC, + NULL, device_xname(sc-sc_dev), ps-ps_name); + } + + for (i = 0; i sc-sc_tstate_count; i++) { + + ts = sc-sc_tstate[i]; + + if (ts-ts_percent == 0) + continue; + + (void)snprintf(ts-ts_name, sizeof(ts-ts_name), + T%u (%u %%), i, ts-ts_percent); + + evcnt_attach_dynamic(ts-ts_evcnt, EVCNT_TYPE_MISC, + NULL, device_xname(sc-sc_dev), ts-ts_name); + } +} + +static void +acpicpu_evcnt_detach(device_t self) +{ + struct acpicpu_softc *sc = device_private(self); + struct acpicpu_cstate *cs; + struct acpicpu_pstate *ps; + struct acpicpu_tstate *ts; + uint32_t i; + + for (i = 0; i __arraycount(sc-sc_cstate); i++) { + + cs = sc-sc_cstate[i]; + + if (cs-cs_method != 0) + evcnt_detach(cs-cs_evcnt); + } + + for (i = 0; i sc-sc_pstate_count; i++) { + + ps = sc-sc_pstate[i]; + + if (ps-ps_freq != 0) + evcnt_detach(ps-ps_evcnt); + } + + for (i = 0; i sc-sc_tstate_count; i++) { + + ts = sc-sc_tstate[i]; + + if (ts-ts_percent != 0) + evcnt_detach(ts-ts_evcnt); + } +} + +static void acpicpu_debug_print(device_t self) { struct acpicpu_softc *sc = device_private(self); Index: src/sys/dev/acpi/acpi_cpu_cstate.c diff -u