From owner-svn-src-user@FreeBSD.ORG Mon May 31 23:58:37 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BBED31065673; Mon, 31 May 2010 23:58:37 +0000 (UTC) (envelope-from jmallett@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A85828FC13; Mon, 31 May 2010 23:58:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o4VNwbJk061112; Mon, 31 May 2010 23:58:37 GMT (envelope-from jmallett@svn.freebsd.org) Received: (from jmallett@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o4VNwbLS061089; Mon, 31 May 2010 23:58:37 GMT (envelope-from jmallett@svn.freebsd.org) Message-Id: <201005312358.o4VNwbLS061089@svn.freebsd.org> From: Juli Mallett Date: Mon, 31 May 2010 23:58:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r208685 - in user/jmallett/octeon: bin/sh cddl/contrib/opensolaris/lib/libzfs/common sbin/mount share/man/man5 sys/amd64/amd64 sys/boot/zfs sys/cddl/contrib/opensolaris/uts/common/fs/zf... X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 May 2010 23:58:37 -0000 Author: jmallett Date: Mon May 31 23:58:36 2010 New Revision: 208685 URL: http://svn.freebsd.org/changeset/base/208685 Log: Merge from head. Added: user/jmallett/octeon/tools/regression/bin/sh/builtins/dot1.0 - copied unchanged from r208684, head/tools/regression/bin/sh/builtins/dot1.0 user/jmallett/octeon/tools/regression/bin/sh/builtins/dot2.0 - copied unchanged from r208684, head/tools/regression/bin/sh/builtins/dot2.0 user/jmallett/octeon/tools/regression/bin/sh/builtins/exec1.0 - copied unchanged from r208684, head/tools/regression/bin/sh/builtins/exec1.0 user/jmallett/octeon/tools/regression/bin/sh/builtins/exec2.0 - copied unchanged from r208684, head/tools/regression/bin/sh/builtins/exec2.0 user/jmallett/octeon/tools/regression/bin/sh/builtins/return4.0 - copied unchanged from r208684, head/tools/regression/bin/sh/builtins/return4.0 user/jmallett/octeon/tools/regression/bin/sh/parser/heredoc4.0 - copied unchanged from r208684, head/tools/regression/bin/sh/parser/heredoc4.0 user/jmallett/octeon/tools/regression/bin/sh/parser/heredoc5.0 - copied unchanged from r208684, head/tools/regression/bin/sh/parser/heredoc5.0 user/jmallett/octeon/tools/regression/bin/sh/parser/heredoc6.0 - copied unchanged from r208684, head/tools/regression/bin/sh/parser/heredoc6.0 Modified: user/jmallett/octeon/bin/sh/eval.c user/jmallett/octeon/bin/sh/main.c user/jmallett/octeon/bin/sh/parser.c user/jmallett/octeon/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c user/jmallett/octeon/sbin/mount/mount.8 user/jmallett/octeon/share/man/man5/devfs.5 user/jmallett/octeon/sys/amd64/amd64/pmap.c user/jmallett/octeon/sys/boot/zfs/zfs.c user/jmallett/octeon/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c user/jmallett/octeon/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c user/jmallett/octeon/sys/dev/amdsbwd/amdsbwd.c user/jmallett/octeon/sys/dev/ath/ath_hal/ah_eeprom_v1.c user/jmallett/octeon/sys/dev/ath/ath_hal/ar5210/ar5210_reset.c user/jmallett/octeon/sys/dev/ath/ath_hal/ar5211/ar5211_reset.c user/jmallett/octeon/sys/dev/fdc/fdc_acpi.c user/jmallett/octeon/sys/fs/udf/udf_vnops.c user/jmallett/octeon/sys/geom/label/g_label.c user/jmallett/octeon/sys/i386/i386/pmap.c user/jmallett/octeon/sys/i386/xen/pmap.c user/jmallett/octeon/sys/ia64/ia64/pmap.c user/jmallett/octeon/sys/mips/mips/pmap.c user/jmallett/octeon/sys/pc98/pc98/machdep.c user/jmallett/octeon/sys/sun4v/sun4v/pmap.c user/jmallett/octeon/sys/vm/vm_page.h user/jmallett/octeon/usr.sbin/newsyslog/newsyslog.c user/jmallett/octeon/usr.sbin/newsyslog/newsyslog.conf.5 Directory Properties: user/jmallett/octeon/ (props changed) Modified: user/jmallett/octeon/bin/sh/eval.c ============================================================================== --- user/jmallett/octeon/bin/sh/eval.c Mon May 31 23:29:56 2010 (r208684) +++ user/jmallett/octeon/bin/sh/eval.c Mon May 31 23:58:36 2010 (r208685) @@ -1170,6 +1170,12 @@ truecmd(int argc __unused, char **argv _ int execcmd(int argc, char **argv) { + /* + * Because we have historically not supported any options, + * only treat "--" specially. + */ + if (argc > 1 && strcmp(argv[1], "--") == 0) + argc--, argv++; if (argc > 1) { struct strlist *sp; Modified: user/jmallett/octeon/bin/sh/main.c ============================================================================== --- user/jmallett/octeon/bin/sh/main.c Mon May 31 23:29:56 2010 (r208684) +++ user/jmallett/octeon/bin/sh/main.c Mon May 31 23:58:36 2010 (r208685) @@ -314,14 +314,20 @@ find_dot_file(char *basename) int dotcmd(int argc, char **argv) { - char *fullname; + char *filename, *fullname; if (argc < 2) error("missing filename"); exitstatus = 0; - fullname = find_dot_file(argv[1]); + /* + * Because we have historically not supported any options, + * only treat "--" specially. + */ + filename = argc > 2 && strcmp(argv[1], "--") == 0 ? argv[2] : argv[1]; + + fullname = find_dot_file(filename); setinputfile(fullname, 1); commandname = fullname; cmdloop(0); Modified: user/jmallett/octeon/bin/sh/parser.c ============================================================================== --- user/jmallett/octeon/bin/sh/parser.c Mon May 31 23:29:56 2010 (r208684) +++ user/jmallett/octeon/bin/sh/parser.c Mon May 31 23:58:36 2010 (r208685) @@ -203,6 +203,7 @@ parsecmd(int interact) * which could happen if we add command substitution on PS1/PS2. */ parser_temp_free_all(); + heredoclist = NULL; tokpushback = 0; doprompt = interact; @@ -973,6 +974,8 @@ parsebackq(char *out, struct nodelist ** const int bq_startlinno = plinno; char *volatile ostr = NULL; struct parsefile *const savetopfile = getcurrentfile(); + struct heredoc *const saveheredoclist = heredoclist; + struct heredoc *here; str = NULL; if (setjmp(jmploc.loc)) { @@ -981,6 +984,7 @@ parsebackq(char *out, struct nodelist ** ckfree(str); if (ostr) ckfree(ostr); + heredoclist = saveheredoclist; handler = savehandler; if (exception == EXERROR) { startlinno = bq_startlinno; @@ -995,6 +999,7 @@ parsebackq(char *out, struct nodelist ** memcpy(str, stackblock(), savelen); } handler = &jmploc; + heredoclist = NULL; INTON; if (oldstyle) { /* We must read until the closing backquote, giving special @@ -1091,21 +1096,26 @@ done: while (stackblocksize() <= savelen) growstackblock(); STARTSTACKSTR(out); + INTOFF; if (str) { memcpy(out, str, savelen); STADJUST(savelen, out); - INTOFF; ckfree(str); str = NULL; - INTON; } if (ostr) { - INTOFF; ckfree(ostr); ostr = NULL; - INTON; + } + here = saveheredoclist; + if (here != NULL) { + while (here->next != NULL) + here = here->next; + here->next = heredoclist; + heredoclist = saveheredoclist; } handler = savehandler; + INTON; if (quoted) USTPUTC(CTLBACKQ | CTLQUOTE, out); else Modified: user/jmallett/octeon/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c ============================================================================== --- user/jmallett/octeon/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Mon May 31 23:29:56 2010 (r208684) +++ user/jmallett/octeon/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Mon May 31 23:58:36 2010 (r208685) @@ -1791,7 +1791,6 @@ zfs_prop_set(zfs_handle_t *zhp, const ch /* We don't support those properties on FreeBSD. */ switch (prop) { case ZFS_PROP_DEVICES: - case ZFS_PROP_ZONED: case ZFS_PROP_SHAREISCSI: case ZFS_PROP_ISCSIOPTIONS: case ZFS_PROP_XATTR: Modified: user/jmallett/octeon/sbin/mount/mount.8 ============================================================================== --- user/jmallett/octeon/sbin/mount/mount.8 Mon May 31 23:29:56 2010 (r208684) +++ user/jmallett/octeon/sbin/mount/mount.8 Mon May 31 23:58:36 2010 (r208685) @@ -525,6 +525,7 @@ support for a particular file system mig .Xr nmount 2 , .Xr acl 3 , .Xr mac 4 , +.Xr devfs 5 , .Xr ext2fs 5 , .Xr fstab 5 , .Xr procfs 5 , Modified: user/jmallett/octeon/share/man/man5/devfs.5 ============================================================================== --- user/jmallett/octeon/share/man/man5/devfs.5 Mon May 31 23:29:56 2010 (r208684) +++ user/jmallett/octeon/share/man/man5/devfs.5 Mon May 31 23:58:36 2010 (r208685) @@ -38,7 +38,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 14, 1996 +.Dd May 30, 2010 .Dt DEVFS 5 .Os .Sh NAME @@ -80,9 +80,9 @@ mount point. To mount a .Nm volume located on -.Pa /dev : +.Pa /mychroot/dev : .Pp -.Dl "mount -t devfs devfs /dev" +.Dl "mount -t devfs devfs /mychroot/dev" .Sh SEE ALSO .Xr devfs 8 , .Xr mount 8 @@ -91,6 +91,10 @@ The .Nm file system first appeared in .Fx 2.0 . +It became the preferred method for accessing devices in +.Fx 5.0 +and the only method in +.Fx 6.0 . The .Nm manual page first appeared in Modified: user/jmallett/octeon/sys/amd64/amd64/pmap.c ============================================================================== --- user/jmallett/octeon/sys/amd64/amd64/pmap.c Mon May 31 23:29:56 2010 (r208684) +++ user/jmallett/octeon/sys/amd64/amd64/pmap.c Mon May 31 23:58:36 2010 (r208685) @@ -2041,7 +2041,6 @@ SYSCTL_INT(_vm_pmap, OID_AUTO, pmap_coll static void pmap_collect(pmap_t locked_pmap, struct vpgqueues *vpq) { - struct md_page *pvh; pd_entry_t *pde; pmap_t pmap; pt_entry_t *pte, tpte; @@ -2077,15 +2076,13 @@ pmap_collect(pmap_t locked_pmap, struct pmap_invalidate_page(pmap, va); pmap_free_zero_pages(free); TAILQ_REMOVE(&m->md.pv_list, pv, pv_list); - if (TAILQ_EMPTY(&m->md.pv_list)) { - pvh = pa_to_pvh(VM_PAGE_TO_PHYS(m)); - if (TAILQ_EMPTY(&pvh->pv_list)) - vm_page_flag_clear(m, PG_WRITEABLE); - } free_pv_entry(pmap, pv); if (pmap != locked_pmap) PMAP_UNLOCK(pmap); } + if (TAILQ_EMPTY(&m->md.pv_list) && + TAILQ_EMPTY(&pa_to_pvh(VM_PAGE_TO_PHYS(m))->pv_list)) + vm_page_flag_clear(m, PG_WRITEABLE); } } @@ -3128,11 +3125,11 @@ void pmap_enter(pmap_t pmap, vm_offset_t va, vm_prot_t access, vm_page_t m, vm_prot_t prot, boolean_t wired) { - vm_paddr_t pa; pd_entry_t *pde; pt_entry_t *pte; - vm_paddr_t opa; - pt_entry_t origpte, newpte; + pt_entry_t newpte, origpte; + pv_entry_t pv; + vm_paddr_t opa, pa; vm_page_t mpte, om; boolean_t invlva; @@ -3190,16 +3187,15 @@ pmap_enter(pmap_t pmap, vm_offset_t va, if (mpte) mpte->wire_count--; - /* - * We might be turning off write access to the page, - * so we go ahead and sense modify status. - */ if (origpte & PG_MANAGED) { om = m; pa |= PG_MANAGED; } goto validate; } + + pv = NULL; + /* * Mapping has changed, invalidate old range and fall through to * handle validating new mapping. @@ -3209,7 +3205,7 @@ pmap_enter(pmap_t pmap, vm_offset_t va, pmap->pm_stats.wired_count--; if (origpte & PG_MANAGED) { om = PHYS_TO_VM_PAGE(opa); - pmap_remove_entry(pmap, om, va); + pv = pmap_pvh_remove(&om->md, pmap, va); } if (mpte != NULL) { mpte->wire_count--; @@ -3226,9 +3222,13 @@ pmap_enter(pmap_t pmap, vm_offset_t va, if ((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0) { KASSERT(va < kmi.clean_sva || va >= kmi.clean_eva, ("pmap_enter: managed mapping within the clean submap")); - pmap_insert_entry(pmap, va, m); + if (pv == NULL) + pv = get_pv_entry(pmap, FALSE); + pv->pv_va = va; + TAILQ_INSERT_TAIL(&m->md.pv_list, pv, pv_list); pa |= PG_MANAGED; - } + } else if (pv != NULL) + free_pv_entry(pmap, pv); /* * Increment counters @@ -3243,7 +3243,8 @@ validate: newpte = (pt_entry_t)(pa | pmap_cache_bits(m->md.pat_mode, 0) | PG_V); if ((prot & VM_PROT_WRITE) != 0) { newpte |= PG_RW; - vm_page_flag_set(m, PG_WRITEABLE); + if ((newpte & PG_MANAGED) != 0) + vm_page_flag_set(m, PG_WRITEABLE); } if ((prot & VM_PROT_EXECUTE) == 0) newpte |= pg_nx; @@ -3278,6 +3279,10 @@ validate: if ((newpte & PG_RW) == 0) invlva = TRUE; } + if ((origpte & PG_MANAGED) != 0 && + TAILQ_EMPTY(&om->md.pv_list) && + TAILQ_EMPTY(&pa_to_pvh(opa)->pv_list)) + vm_page_flag_clear(om, PG_WRITEABLE); if (invlva) pmap_invalidate_page(pmap, va); } else Modified: user/jmallett/octeon/sys/boot/zfs/zfs.c ============================================================================== --- user/jmallett/octeon/sys/boot/zfs/zfs.c Mon May 31 23:29:56 2010 (r208684) +++ user/jmallett/octeon/sys/boot/zfs/zfs.c Mon May 31 23:58:36 2010 (r208685) @@ -265,6 +265,8 @@ zfs_readdir(struct open_file *f, struct rc = dnode_read(spa, &fp->f_dnode, fp->f_seekp, &mze, sizeof(mze)); + if (rc) + return (rc); fp->f_seekp += sizeof(mze); if (!mze.mze_name[0]) Modified: user/jmallett/octeon/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c ============================================================================== --- user/jmallett/octeon/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Mon May 31 23:29:56 2010 (r208684) +++ user/jmallett/octeon/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Mon May 31 23:58:36 2010 (r208685) @@ -1425,6 +1425,12 @@ spa_load(spa_t *spa, nvlist_t *config, s */ if (need_update) spa_async_request(spa, SPA_ASYNC_CONFIG_UPDATE); + + /* + * Check all DTLs to see if anything needs resilvering. + */ + if (vdev_resilver_needed(rvd, NULL, NULL)) + spa_async_request(spa, SPA_ASYNC_RESILVER); } error = 0; Modified: user/jmallett/octeon/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c ============================================================================== --- user/jmallett/octeon/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Mon May 31 23:29:56 2010 (r208684) +++ user/jmallett/octeon/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Mon May 31 23:58:36 2010 (r208685) @@ -183,7 +183,7 @@ vdev_geom_io(struct g_consumer *cp, int { struct bio *bp; u_char *p; - off_t off; + off_t off, maxio; int error; ASSERT((offset % cp->provider->sectorsize) == 0); @@ -193,14 +193,15 @@ vdev_geom_io(struct g_consumer *cp, int off = offset; offset += size; p = data; + maxio = MAXPHYS - (MAXPHYS % cp->provider->sectorsize); error = 0; - for (; off < offset; off += MAXPHYS, p += MAXPHYS, size -= MAXPHYS) { + for (; off < offset; off += maxio, p += maxio, size -= maxio) { bzero(bp, sizeof(*bp)); bp->bio_cmd = cmd; bp->bio_done = NULL; bp->bio_offset = off; - bp->bio_length = MIN(size, MAXPHYS); + bp->bio_length = MIN(size, maxio); bp->bio_data = p; g_io_request(bp, cp); error = biowait(bp, "vdev_geom_io"); Modified: user/jmallett/octeon/sys/dev/amdsbwd/amdsbwd.c ============================================================================== --- user/jmallett/octeon/sys/dev/amdsbwd/amdsbwd.c Mon May 31 23:29:56 2010 (r208684) +++ user/jmallett/octeon/sys/dev/amdsbwd/amdsbwd.c Mon May 31 23:58:36 2010 (r208685) @@ -230,10 +230,10 @@ amdsbwd_event(void *arg, unsigned int cm cmd &= WD_INTERVAL; if (cmd < WD_TO_1SEC) cmd = 0; - timeout = ((uint64_t)1 << (cmd - WD_TO_1MS)) / sc->ms_per_tick; - if (timeout > sc->max_ticks) - timeout = sc->max_ticks; if (cmd) { + timeout = ((uint64_t)1 << (cmd - WD_TO_1MS)) / sc->ms_per_tick; + if (timeout > sc->max_ticks) + timeout = sc->max_ticks; if (timeout != sc->timeout) { amdsbwd_tmr_set(sc, timeout); if (!sc->active) Modified: user/jmallett/octeon/sys/dev/ath/ath_hal/ah_eeprom_v1.c ============================================================================== --- user/jmallett/octeon/sys/dev/ath/ath_hal/ah_eeprom_v1.c Mon May 31 23:29:56 2010 (r208684) +++ user/jmallett/octeon/sys/dev/ath/ath_hal/ah_eeprom_v1.c Mon May 31 23:58:36 2010 (r208685) @@ -112,7 +112,7 @@ ath_hal_v1EepromAttach(struct ath_hal *a { HAL_EEPROM_v1 *ee = AH_PRIVATE(ah)->ah_eeprom; uint16_t athvals[AR_EEPROM_ATHEROS_MAX]; /* XXX off stack */ - uint16_t protect, version, eeval; + uint16_t protect, eeprom_version, eeval; uint32_t sum; int i, loc; @@ -138,18 +138,18 @@ ath_hal_v1EepromAttach(struct ath_hal *a HALDEBUG(ah, HAL_DEBUG_ATTACH, "EEPROM protect 0x%x\n", protect); /* XXX check proper access before continuing */ - if (!ath_hal_eepromRead(ah, AR_EEPROM_VERSION, &version)) { + if (!ath_hal_eepromRead(ah, AR_EEPROM_VERSION, &eeprom_version)) { HALDEBUG(ah, HAL_DEBUG_ANY, "%s: unable to read EEPROM version\n", __func__); return HAL_EEREAD; } - if (((version>>12) & 0xf) != 1) { + if (((eeprom_version>>12) & 0xf) != 1) { /* * This code only groks the version 1 EEPROM layout. */ HALDEBUG(ah, HAL_DEBUG_ANY, "%s: unsupported EEPROM version 0x%x found\n", - __func__, version); + __func__, eeprom_version); return HAL_EEVERSION; } @@ -183,7 +183,7 @@ ath_hal_v1EepromAttach(struct ath_hal *a return HAL_ENOMEM; } - ee->ee_version = version; + ee->ee_version = eeprom_version; ee->ee_protect = protect; ee->ee_antenna = athvals[2]; ee->ee_biasCurrents = athvals[3]; @@ -243,7 +243,7 @@ ath_hal_v1EepromAttach(struct ath_hal *a } AH_PRIVATE(ah)->ah_eeprom = ee; - AH_PRIVATE(ah)->ah_eeversion = version; + AH_PRIVATE(ah)->ah_eeversion = eeprom_version; AH_PRIVATE(ah)->ah_eepromDetach = v1EepromDetach; AH_PRIVATE(ah)->ah_eepromGet = v1EepromGet; AH_PRIVATE(ah)->ah_eepromSet = v1EepromSet; Modified: user/jmallett/octeon/sys/dev/ath/ath_hal/ar5210/ar5210_reset.c ============================================================================== --- user/jmallett/octeon/sys/dev/ath/ath_hal/ar5210/ar5210_reset.c Mon May 31 23:29:56 2010 (r208684) +++ user/jmallett/octeon/sys/dev/ath/ath_hal/ar5210/ar5210_reset.c Mon May 31 23:58:36 2010 (r208685) @@ -526,9 +526,10 @@ ar5210PerCalibrationN(struct ath_hal *ah /* AGC calibration (this was added to make the NF threshold check work) */ OS_REG_WRITE(ah, AR_PHY_AGCCTL, OS_REG_READ(ah, AR_PHY_AGCCTL) | AR_PHY_AGC_CAL); - if (!ath_hal_wait(ah, AR_PHY_AGCCTL, AR_PHY_AGC_CAL, 0)) + if (!ath_hal_wait(ah, AR_PHY_AGCCTL, AR_PHY_AGC_CAL, 0)) { HALDEBUG(ah, HAL_DEBUG_ANY, "%s: AGC calibration timeout\n", __func__); + } /* Rewrite our AGC values we stored off earlier (return AGC to normal operation) */ OS_REG_WRITE(ah, 0x9858, reg9858); Modified: user/jmallett/octeon/sys/dev/ath/ath_hal/ar5211/ar5211_reset.c ============================================================================== --- user/jmallett/octeon/sys/dev/ath/ath_hal/ar5211/ar5211_reset.c Mon May 31 23:29:56 2010 (r208684) +++ user/jmallett/octeon/sys/dev/ath/ath_hal/ar5211/ar5211_reset.c Mon May 31 23:58:36 2010 (r208685) @@ -46,7 +46,7 @@ typedef struct { } CHAN_INFO_2GHZ; #define CI_2GHZ_INDEX_CORRECTION 19 -const static CHAN_INFO_2GHZ chan2GHzData[] = { +static const CHAN_INFO_2GHZ chan2GHzData[] = { { 1, 0x46, 96 }, /* 2312 -19 */ { 1, 0x46, 97 }, /* 2317 -18 */ { 1, 0x46, 98 }, /* 2322 -17 */ @@ -926,9 +926,10 @@ ar5211IsNfGood(struct ath_hal *ah, struc if (!getNoiseFloorThresh(ah, chan, &nfThresh)) return AH_FALSE; - if (OS_REG_READ(ah, AR_PHY_AGC_CONTROL) & AR_PHY_AGC_CONTROL_NF) + if (OS_REG_READ(ah, AR_PHY_AGC_CONTROL) & AR_PHY_AGC_CONTROL_NF) { HALDEBUG(ah, HAL_DEBUG_ANY, "%s: NF did not complete in calibration window\n", __func__); + } nf = ar5211GetNoiseFloor(ah); if (nf > nfThresh) { HALDEBUG(ah, HAL_DEBUG_ANY, Modified: user/jmallett/octeon/sys/dev/fdc/fdc_acpi.c ============================================================================== --- user/jmallett/octeon/sys/dev/fdc/fdc_acpi.c Mon May 31 23:29:56 2010 (r208684) +++ user/jmallett/octeon/sys/dev/fdc/fdc_acpi.c Mon May 31 23:58:36 2010 (r208685) @@ -96,6 +96,7 @@ fdc_acpi_attach(device_t dev) { struct fdc_data *sc; ACPI_BUFFER buf; + ACPI_OBJECT *obj; device_t bus; int error; @@ -131,7 +132,8 @@ fdc_acpi_attach(device_t dev) } /* Add fd child devices as specified. */ - error = fdc_acpi_probe_children(bus, dev, buf.Pointer); + obj = buf.Pointer; + error = fdc_acpi_probe_children(bus, dev, obj->Buffer.Pointer); out: if (buf.Pointer) Modified: user/jmallett/octeon/sys/fs/udf/udf_vnops.c ============================================================================== --- user/jmallett/octeon/sys/fs/udf/udf_vnops.c Mon May 31 23:29:56 2010 (r208684) +++ user/jmallett/octeon/sys/fs/udf/udf_vnops.c Mon May 31 23:58:36 2010 (r208685) @@ -904,9 +904,9 @@ udf_readlink(struct vop_readlink_args *a vp = ap->a_vp; node = VTON(vp); len = le64toh(node->fentry->inf_len); + iov[0].iov_len = len; buf = malloc(iov[0].iov_len, M_DEVBUF, M_WAITOK); iov[0].iov_base = buf; - iov[0].iov_len = len; uio.uio_iov = iov; uio.uio_iovcnt = 1; uio.uio_offset = 0; Modified: user/jmallett/octeon/sys/geom/label/g_label.c ============================================================================== --- user/jmallett/octeon/sys/geom/label/g_label.c Mon May 31 23:29:56 2010 (r208684) +++ user/jmallett/octeon/sys/geom/label/g_label.c Mon May 31 23:58:36 2010 (r208685) @@ -203,10 +203,8 @@ g_label_destroy(struct g_geom *gp, boole pp->acr, pp->acw, pp->ace); return (EBUSY); } - } else { - G_LABEL_DEBUG(1, "Label %s removed.", - LIST_FIRST(&gp->provider)->name); - } + } else if (pp != NULL) + G_LABEL_DEBUG(1, "Label %s removed.", pp->name); g_slice_spoiled(LIST_FIRST(&gp->consumer)); return (0); } Modified: user/jmallett/octeon/sys/i386/i386/pmap.c ============================================================================== --- user/jmallett/octeon/sys/i386/i386/pmap.c Mon May 31 23:29:56 2010 (r208684) +++ user/jmallett/octeon/sys/i386/i386/pmap.c Mon May 31 23:58:36 2010 (r208685) @@ -2147,7 +2147,6 @@ SYSCTL_INT(_vm_pmap, OID_AUTO, pmap_coll static void pmap_collect(pmap_t locked_pmap, struct vpgqueues *vpq) { - struct md_page *pvh; pd_entry_t *pde; pmap_t pmap; pt_entry_t *pte, tpte; @@ -2184,15 +2183,13 @@ pmap_collect(pmap_t locked_pmap, struct pmap_invalidate_page(pmap, va); pmap_free_zero_pages(free); TAILQ_REMOVE(&m->md.pv_list, pv, pv_list); - if (TAILQ_EMPTY(&m->md.pv_list)) { - pvh = pa_to_pvh(VM_PAGE_TO_PHYS(m)); - if (TAILQ_EMPTY(&pvh->pv_list)) - vm_page_flag_clear(m, PG_WRITEABLE); - } free_pv_entry(pmap, pv); if (pmap != locked_pmap) PMAP_UNLOCK(pmap); } + if (TAILQ_EMPTY(&m->md.pv_list) && + TAILQ_EMPTY(&pa_to_pvh(VM_PAGE_TO_PHYS(m))->pv_list)) + vm_page_flag_clear(m, PG_WRITEABLE); } sched_unpin(); } @@ -3257,11 +3254,11 @@ void pmap_enter(pmap_t pmap, vm_offset_t va, vm_prot_t access, vm_page_t m, vm_prot_t prot, boolean_t wired) { - vm_paddr_t pa; pd_entry_t *pde; pt_entry_t *pte; - vm_paddr_t opa; - pt_entry_t origpte, newpte; + pt_entry_t newpte, origpte; + pv_entry_t pv; + vm_paddr_t opa, pa; vm_page_t mpte, om; boolean_t invlva; @@ -3326,16 +3323,15 @@ pmap_enter(pmap_t pmap, vm_offset_t va, if (mpte) mpte->wire_count--; - /* - * We might be turning off write access to the page, - * so we go ahead and sense modify status. - */ if (origpte & PG_MANAGED) { om = m; pa |= PG_MANAGED; } goto validate; } + + pv = NULL; + /* * Mapping has changed, invalidate old range and fall through to * handle validating new mapping. @@ -3345,7 +3341,7 @@ pmap_enter(pmap_t pmap, vm_offset_t va, pmap->pm_stats.wired_count--; if (origpte & PG_MANAGED) { om = PHYS_TO_VM_PAGE(opa); - pmap_remove_entry(pmap, om, va); + pv = pmap_pvh_remove(&om->md, pmap, va); } if (mpte != NULL) { mpte->wire_count--; @@ -3362,9 +3358,13 @@ pmap_enter(pmap_t pmap, vm_offset_t va, if ((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0) { KASSERT(va < kmi.clean_sva || va >= kmi.clean_eva, ("pmap_enter: managed mapping within the clean submap")); - pmap_insert_entry(pmap, va, m); + if (pv == NULL) + pv = get_pv_entry(pmap, FALSE); + pv->pv_va = va; + TAILQ_INSERT_TAIL(&m->md.pv_list, pv, pv_list); pa |= PG_MANAGED; - } + } else if (pv != NULL) + free_pv_entry(pmap, pv); /* * Increment counters @@ -3379,7 +3379,8 @@ validate: newpte = (pt_entry_t)(pa | pmap_cache_bits(m->md.pat_mode, 0) | PG_V); if ((prot & VM_PROT_WRITE) != 0) { newpte |= PG_RW; - vm_page_flag_set(m, PG_WRITEABLE); + if ((newpte & PG_MANAGED) != 0) + vm_page_flag_set(m, PG_WRITEABLE); } #ifdef PAE if ((prot & VM_PROT_EXECUTE) == 0) @@ -3420,6 +3421,10 @@ validate: if ((prot & VM_PROT_WRITE) == 0) invlva = TRUE; } + if ((origpte & PG_MANAGED) != 0 && + TAILQ_EMPTY(&om->md.pv_list) && + TAILQ_EMPTY(&pa_to_pvh(opa)->pv_list)) + vm_page_flag_clear(om, PG_WRITEABLE); if (invlva) pmap_invalidate_page(pmap, va); } else Modified: user/jmallett/octeon/sys/i386/xen/pmap.c ============================================================================== --- user/jmallett/octeon/sys/i386/xen/pmap.c Mon May 31 23:29:56 2010 (r208684) +++ user/jmallett/octeon/sys/i386/xen/pmap.c Mon May 31 23:58:36 2010 (r208685) @@ -103,8 +103,6 @@ __FBSDID("$FreeBSD$"); * and to when physical maps must be made correct. */ -#define PMAP_DIAGNOSTIC - #include "opt_cpu.h" #include "opt_pmap.h" #include "opt_msgbuf.h" @@ -168,13 +166,11 @@ __FBSDID("$FreeBSD$"); #define PMAP_SHPGPERPROC 200 #endif -#if defined(DIAGNOSTIC) -#define PMAP_DIAGNOSTIC -#endif +#define DIAGNOSTIC -#if !defined(PMAP_DIAGNOSTIC) +#if !defined(DIAGNOSTIC) #ifdef __GNUC_GNU_INLINE__ -#define PMAP_INLINE inline +#define PMAP_INLINE __attribute__((__gnu_inline__)) inline #else #define PMAP_INLINE extern inline #endif @@ -298,6 +294,9 @@ SYSCTL_ULONG(_vm_pmap_pde, OID_AUTO, map static void free_pv_entry(pmap_t pmap, pv_entry_t pv); static pv_entry_t get_pv_entry(pmap_t locked_pmap, int try); +static void pmap_pvh_free(struct md_page *pvh, pmap_t pmap, vm_offset_t va); +static pv_entry_t pmap_pvh_remove(struct md_page *pvh, pmap_t pmap, + vm_offset_t va); static vm_page_t pmap_enter_quick_locked(multicall_entry_t **mcl, int *count, pmap_t pmap, vm_offset_t va, vm_page_t m, vm_prot_t prot, vm_page_t mpte); @@ -307,7 +306,6 @@ static void pmap_remove_page(struct pmap vm_page_t *free); static void pmap_remove_entry(struct pmap *pmap, vm_page_t m, vm_offset_t va); -static void pmap_insert_entry(pmap_t pmap, vm_offset_t va, vm_page_t m); static boolean_t pmap_try_insert_pv_entry(pmap_t pmap, vm_offset_t va, vm_page_t m); @@ -2073,23 +2071,19 @@ pmap_collect(pmap_t locked_pmap, struct ("pmap_collect: wired pte %#jx", (uintmax_t)tpte)); if (tpte & PG_A) vm_page_flag_set(m, PG_REFERENCED); - if (tpte & PG_M) { - KASSERT((tpte & PG_RW), - ("pmap_collect: modified page not writable: va: %#x, pte: %#jx", - va, (uintmax_t)tpte)); + if ((tpte & (PG_M | PG_RW)) == (PG_M | PG_RW)) vm_page_dirty(m); - } free = NULL; pmap_unuse_pt(pmap, va, &free); pmap_invalidate_page(pmap, va); pmap_free_zero_pages(free); TAILQ_REMOVE(&m->md.pv_list, pv, pv_list); - if (TAILQ_EMPTY(&m->md.pv_list)) - vm_page_flag_clear(m, PG_WRITEABLE); free_pv_entry(pmap, pv); if (pmap != locked_pmap) PMAP_UNLOCK(pmap); } + if (TAILQ_EMPTY(&m->md.pv_list)) + vm_page_flag_clear(m, PG_WRITEABLE); } sched_unpin(); } @@ -2229,38 +2223,39 @@ retry: return (pv); } -static void -pmap_remove_entry(pmap_t pmap, vm_page_t m, vm_offset_t va) +static __inline pv_entry_t +pmap_pvh_remove(struct md_page *pvh, pmap_t pmap, vm_offset_t va) { pv_entry_t pv; - PMAP_LOCK_ASSERT(pmap, MA_OWNED); mtx_assert(&vm_page_queue_mtx, MA_OWNED); - TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) { - if (pmap == PV_PMAP(pv) && va == pv->pv_va) + TAILQ_FOREACH(pv, &pvh->pv_list, pv_list) { + if (pmap == PV_PMAP(pv) && va == pv->pv_va) { + TAILQ_REMOVE(&pvh->pv_list, pv, pv_list); break; + } } - KASSERT(pv != NULL, ("pmap_remove_entry: pv not found")); - TAILQ_REMOVE(&m->md.pv_list, pv, pv_list); - if (TAILQ_EMPTY(&m->md.pv_list)) - vm_page_flag_clear(m, PG_WRITEABLE); - free_pv_entry(pmap, pv); + return (pv); } -/* - * Create a pv entry for page at pa for - * (pmap, va). - */ static void -pmap_insert_entry(pmap_t pmap, vm_offset_t va, vm_page_t m) +pmap_pvh_free(struct md_page *pvh, pmap_t pmap, vm_offset_t va) { pv_entry_t pv; - PMAP_LOCK_ASSERT(pmap, MA_OWNED); + pv = pmap_pvh_remove(pvh, pmap, va); + KASSERT(pv != NULL, ("pmap_pvh_free: pv not found")); + free_pv_entry(pmap, pv); +} + +static void +pmap_remove_entry(pmap_t pmap, vm_page_t m, vm_offset_t va) +{ + mtx_assert(&vm_page_queue_mtx, MA_OWNED); - pv = get_pv_entry(pmap, FALSE); - pv->pv_va = va; - TAILQ_INSERT_TAIL(&m->md.pv_list, pv, pv_list); + pmap_pvh_free(&m->md, pmap, va); + if (TAILQ_EMPTY(&m->md.pv_list)) + vm_page_flag_clear(m, PG_WRITEABLE); } /* @@ -2320,12 +2315,8 @@ pmap_remove_pte(pmap_t pmap, pt_entry_t if (!(oldpte & PG_MANAGED)) printf("va=0x%x is unmanaged :-( pte=0x%llx\n", va, oldpte); - if (oldpte & PG_M) { - KASSERT((oldpte & PG_RW), - ("pmap_remove_pte: modified page not writable: va: %#x, pte: %#jx", - va, (uintmax_t)oldpte)); + if ((oldpte & (PG_M | PG_RW)) == (PG_M | PG_RW)) vm_page_dirty(m); - } if (oldpte & PG_A) vm_page_flag_set(m, PG_REFERENCED); pmap_remove_entry(pmap, m, va); @@ -2487,6 +2478,7 @@ pmap_remove_all(vm_page_t m) KASSERT((m->flags & PG_FICTITIOUS) == 0, ("pmap_remove_all: page %p is fictitious", m)); + free = NULL; vm_page_lock_queues(); sched_pin(); while ((pv = TAILQ_FIRST(&m->md.pv_list)) != NULL) { @@ -2505,16 +2497,10 @@ pmap_remove_all(vm_page_t m) /* * Update the vm_page_t clean and reference bits. */ - if (tpte & PG_M) { - KASSERT((tpte & PG_RW), - ("pmap_remove_all: modified page not writable: va: %#x, pte: %#jx", - pv->pv_va, (uintmax_t)tpte)); + if ((tpte & (PG_M | PG_RW)) == (PG_M | PG_RW)) vm_page_dirty(m); - } - free = NULL; pmap_unuse_pt(pmap, pv->pv_va, &free); pmap_invalidate_page(pmap, pv->pv_va); - pmap_free_zero_pages(free); TAILQ_REMOVE(&m->md.pv_list, pv, pv_list); free_pv_entry(pmap, pv); PMAP_UNLOCK(pmap); @@ -2525,6 +2511,7 @@ pmap_remove_all(vm_page_t m) PT_SET_MA(PADDR1, 0); sched_unpin(); vm_page_unlock_queues(); + pmap_free_zero_pages(free); } /* @@ -2671,19 +2658,19 @@ void pmap_enter(pmap_t pmap, vm_offset_t va, vm_prot_t access, vm_page_t m, vm_prot_t prot, boolean_t wired) { - vm_paddr_t pa; pd_entry_t *pde; pt_entry_t *pte; - vm_paddr_t opa; - pt_entry_t origpte, newpte; + pt_entry_t newpte, origpte; + pv_entry_t pv; + vm_paddr_t opa, pa; vm_page_t mpte, om; boolean_t invlva; CTR6(KTR_PMAP, "pmap_enter: pmap=%08p va=0x%08x access=0x%x ma=0x%08x prot=0x%x wired=%d", pmap, va, access, xpmap_ptom(VM_PAGE_TO_PHYS(m)), prot, wired); va = trunc_page(va); - KASSERT(va <= VM_MAX_KERNEL_ADDRESS, ("pmap_enter: toobig")); - KASSERT(va < UPT_MIN_ADDRESS || va >= UPT_MAX_ADDRESS, + KASSERT(va <= VM_MAX_KERNEL_ADDRESS, ("pmap_enter: toobig")); + KASSERT(va < UPT_MIN_ADDRESS || va >= UPT_MAX_ADDRESS, ("pmap_enter: invalid to pmap_enter page table pages (va: 0x%x)", va)); KASSERT((m->oflags & VPO_BUSY) != 0, @@ -2702,16 +2689,6 @@ pmap_enter(pmap_t pmap, vm_offset_t va, if (va < VM_MAXUSER_ADDRESS) { mpte = pmap_allocpte(pmap, va, M_WAITOK); } -#if 0 && defined(PMAP_DIAGNOSTIC) - else { - pd_entry_t *pdeaddr = pmap_pde(pmap, va); - origpte = *pdeaddr; - if ((origpte & PG_V) == 0) { - panic("pmap_enter: invalid kernel page table page, pdir=%p, pde=%p, va=%p\n", - pmap->pm_pdir[PTDPTDI], origpte, va); - } - } -#endif pde = pmap_pde(pmap, va); if ((*pde & PG_PS) != 0) @@ -2722,7 +2699,7 @@ pmap_enter(pmap_t pmap, vm_offset_t va, * Page Directory table entry not valid, we need a new PT page */ if (pte == NULL) { - panic("pmap_enter: invalid page directory pdir=%#jx, va=%#x\n", + panic("pmap_enter: invalid page directory pdir=%#jx, va=%#x", (uintmax_t)pmap->pm_pdir[va >> PDRSHIFT], va); } @@ -2760,16 +2737,15 @@ pmap_enter(pmap_t pmap, vm_offset_t va, if (mpte) mpte->wire_count--; - /* - * We might be turning off write access to the page, - * so we go ahead and sense modify status. - */ if (origpte & PG_MANAGED) { om = m; pa |= PG_MANAGED; } goto validate; } + + pv = NULL; + /* * Mapping has changed, invalidate old range and fall through to * handle validating new mapping. @@ -2779,7 +2755,7 @@ pmap_enter(pmap_t pmap, vm_offset_t va, pmap->pm_stats.wired_count--; if (origpte & PG_MANAGED) { om = PHYS_TO_VM_PAGE(opa); - pmap_remove_entry(pmap, om, va); + pv = pmap_pvh_remove(&om->md, pmap, va); } else if (va < VM_MAXUSER_ADDRESS) printf("va=0x%x is unmanaged :-( \n", va); @@ -2798,9 +2774,13 @@ pmap_enter(pmap_t pmap, vm_offset_t va, if ((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0) { KASSERT(va < kmi.clean_sva || va >= kmi.clean_eva, ("pmap_enter: managed mapping within the clean submap")); - pmap_insert_entry(pmap, va, m); + if (pv == NULL) + pv = get_pv_entry(pmap, FALSE); + pv->pv_va = va; + TAILQ_INSERT_TAIL(&m->md.pv_list, pv, pv_list); pa |= PG_MANAGED; - } + } else if (pv != NULL) + free_pv_entry(pmap, pv); /* * Increment counters @@ -2815,7 +2795,8 @@ validate: newpte = (pt_entry_t)(pa | PG_V); if ((prot & VM_PROT_WRITE) != 0) { newpte |= PG_RW; - vm_page_flag_set(m, PG_WRITEABLE); + if ((newpte & PG_MANAGED) != 0) + vm_page_flag_set(m, PG_WRITEABLE); } #ifdef PAE if ((prot & VM_PROT_EXECUTE) == 0) @@ -2849,15 +2830,15 @@ validate: invlva = TRUE; #endif } - if (origpte & PG_M) { - KASSERT((origpte & PG_RW), - ("pmap_enter: modified page not writable: va: %#x, pte: %#jx", - va, (uintmax_t)origpte)); + if ((origpte & (PG_M | PG_RW)) == (PG_M | PG_RW)) { if ((origpte & PG_MANAGED) != 0) vm_page_dirty(om); if ((prot & VM_PROT_WRITE) == 0) invlva = TRUE; } + if ((origpte & PG_MANAGED) != 0 && + TAILQ_EMPTY(&om->md.pv_list)) + vm_page_flag_clear(om, PG_WRITEABLE); if (invlva) pmap_invalidate_page(pmap, va); } else{ @@ -3270,8 +3251,8 @@ pmap_copy(pmap_t dst_pmap, pmap_t src_pm pd_entry_t srcptepaddr; unsigned ptepindex; - if (addr >= UPT_MIN_ADDRESS) - panic("pmap_copy: invalid to pmap_copy page tables"); + KASSERT(addr < UPT_MIN_ADDRESS, + ("pmap_copy: invalid to pmap_copy page tables")); pdnxt = (addr + NBPDR) & ~PDRMASK; ptepindex = addr >> PDRSHIFT; @@ -3290,8 +3271,8 @@ pmap_copy(pmap_t dst_pmap, pmap_t src_pm } srcmpte = PHYS_TO_VM_PAGE(srcptepaddr & PG_FRAME); - if (srcmpte->wire_count == 0) - panic("pmap_copy: source page table page is unused"); + KASSERT(srcmpte->wire_count > 0, + ("pmap_copy: source page table page is unused")); if (pdnxt > end_addr) pdnxt = end_addr; Modified: user/jmallett/octeon/sys/ia64/ia64/pmap.c ============================================================================== --- user/jmallett/octeon/sys/ia64/ia64/pmap.c Mon May 31 23:29:56 2010 (r208684) +++ user/jmallett/octeon/sys/ia64/ia64/pmap.c Mon May 31 23:58:36 2010 (r208685) @@ -800,8 +800,6 @@ retry: TAILQ_REMOVE(&pmap->pm_pvlist, pv, pv_plist); m->md.pv_list_count--; TAILQ_REMOVE(&m->md.pv_list, pv, pv_list); - if (TAILQ_EMPTY(&m->md.pv_list)) - vm_page_flag_clear(m, PG_WRITEABLE); if (pmap != locked_pmap) PMAP_UNLOCK(pmap); if (allocated_pv == NULL) @@ -809,6 +807,8 @@ retry: else free_pv_entry(pv); } + if (TAILQ_EMPTY(&m->md.pv_list)) + vm_page_flag_clear(m, PG_WRITEABLE); } if (allocated_pv == NULL) { if (vpq == &vm_page_queues[PQ_INACTIVE]) { @@ -1595,7 +1595,7 @@ validate: if (icache_inval) ia64_sync_icache(va, PAGE_SIZE); - if ((prot & VM_PROT_WRITE) != 0) + if ((prot & VM_PROT_WRITE) != 0 && managed) vm_page_flag_set(m, PG_WRITEABLE); vm_page_unlock_queues(); pmap_switch(oldpmap); Modified: user/jmallett/octeon/sys/mips/mips/pmap.c ============================================================================== --- user/jmallett/octeon/sys/mips/mips/pmap.c Mon May 31 23:29:56 2010 (r208684) +++ user/jmallett/octeon/sys/mips/mips/pmap.c Mon May 31 23:58:36 2010 (r208685) @@ -167,6 +167,9 @@ static int pv_entry_count = 0, pv_entry_ static PMAP_INLINE void free_pv_entry(pv_entry_t pv); static pv_entry_t get_pv_entry(pmap_t locked_pmap); +static void pmap_pvh_free(struct md_page *pvh, pmap_t pmap, vm_offset_t va); +static pv_entry_t pmap_pvh_remove(struct md_page *pvh, pmap_t pmap, + vm_offset_t va); static __inline void pmap_clear_modified_bit(vm_page_t m); static vm_page_t pmap_enter_quick_locked(pmap_t pmap, vm_offset_t va, @@ -175,9 +178,6 @@ static int pmap_remove_pte(struct pmap * static void pmap_remove_page(struct pmap *pmap, vm_offset_t va); static void pmap_remove_entry(struct pmap *pmap, vm_page_t m, vm_offset_t va); static boolean_t pmap_check_modified_bit(vm_page_t m); -static void -pmap_insert_entry(pmap_t pmap, vm_offset_t va, vm_page_t mpte, - vm_page_t m, boolean_t wired); static boolean_t pmap_try_insert_pv_entry(pmap_t pmap, vm_page_t mpte, vm_offset_t va, vm_page_t m); static __inline void @@ -1327,10 +1327,6 @@ retry: TAILQ_REMOVE(&pmap->pm_pvlist, pv, pv_plist); m->md.pv_list_count--; TAILQ_REMOVE(&m->md.pv_list, pv, pv_list); - if (TAILQ_EMPTY(&m->md.pv_list)) { - vm_page_flag_clear(m, PG_WRITEABLE); - m->md.pv_flags &= ~(PV_TABLE_REF | PV_TABLE_MOD); - } pmap_unuse_pt(pmap, va, pv->pv_ptem); if (pmap != locked_pmap) PMAP_UNLOCK(pmap); @@ -1339,6 +1335,10 @@ retry: else free_pv_entry(pv); } + if (TAILQ_EMPTY(&m->md.pv_list)) { + vm_page_flag_clear(m, PG_WRITEABLE); + m->md.pv_flags &= ~(PV_TABLE_REF | PV_TABLE_MOD); + } } if (allocated_pv == NULL) { if (vpq == &vm_page_queues[PQ_INACTIVE]) { @@ -1370,15 +1370,15 @@ retry: * the entry. In either case we free the now unused entry. */ -static void -pmap_remove_entry(struct pmap *pmap, vm_page_t m, vm_offset_t va) +static pv_entry_t +pmap_pvh_remove(struct md_page *pvh, pmap_t pmap, vm_offset_t va) { pv_entry_t pv; PMAP_LOCK_ASSERT(pmap, MA_OWNED); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-user@FreeBSD.ORG Wed Jun 2 04:13:11 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7778D1065677; Wed, 2 Jun 2010 04:13:11 +0000 (UTC) (envelope-from jmallett@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 637268FC17; Wed, 2 Jun 2010 04:13:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o524DBjS038873; Wed, 2 Jun 2010 04:13:11 GMT (envelope-from jmallett@svn.freebsd.org) Received: (from jmallett@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o524DAov038837; Wed, 2 Jun 2010 04:13:10 GMT (envelope-from jmallett@svn.freebsd.org) Message-Id: <201006020413.o524DAov038837@svn.freebsd.org> From: Juli Mallett Date: Wed, 2 Jun 2010 04:13:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r208725 - in user/jmallett/octeon: crypto/openssh share/man/man4 sys/arm/arm sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/dev/acpica sys/dev/ath/ath_hal sys/dev/ath/ath_hal/ar5416... X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Jun 2010 04:13:11 -0000 Author: jmallett Date: Wed Jun 2 04:13:10 2010 New Revision: 208725 URL: http://svn.freebsd.org/changeset/base/208725 Log: Merge from head, mainly to get pmap build fix. Modified: user/jmallett/octeon/crypto/openssh/moduli.5 user/jmallett/octeon/crypto/openssh/scp.1 user/jmallett/octeon/crypto/openssh/sftp-server.8 user/jmallett/octeon/crypto/openssh/sftp.1 user/jmallett/octeon/crypto/openssh/ssh-add.1 user/jmallett/octeon/crypto/openssh/ssh-agent.1 user/jmallett/octeon/crypto/openssh/ssh-keygen.1 user/jmallett/octeon/crypto/openssh/ssh-keyscan.1 user/jmallett/octeon/crypto/openssh/ssh-keysign.8 user/jmallett/octeon/crypto/openssh/ssh.1 user/jmallett/octeon/crypto/openssh/ssh_config.5 user/jmallett/octeon/crypto/openssh/sshd.8 user/jmallett/octeon/crypto/openssh/sshd_config.5 user/jmallett/octeon/share/man/man4/io.4 user/jmallett/octeon/sys/arm/arm/pmap.c user/jmallett/octeon/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c user/jmallett/octeon/sys/dev/acpica/acpi_ec.c user/jmallett/octeon/sys/dev/ath/ath_hal/ah.h user/jmallett/octeon/sys/dev/ath/ath_hal/ah_eeprom_v4k.c user/jmallett/octeon/sys/dev/ath/ath_hal/ah_eeprom_v4k.h user/jmallett/octeon/sys/dev/ath/ath_hal/ar5416/ar5416_interrupts.c user/jmallett/octeon/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c user/jmallett/octeon/sys/dev/ath/ath_hal/ar5416/ar5416phy.h user/jmallett/octeon/sys/dev/ath/ath_hal/ar5416/ar5416reg.h user/jmallett/octeon/sys/dev/ath/ath_hal/ar5416/ar9285_attach.c user/jmallett/octeon/sys/dev/ath/ath_hal/ar5416/ar9285_reset.c user/jmallett/octeon/sys/fs/devfs/devfs_vnops.c user/jmallett/octeon/sys/kern/subr_taskqueue.c user/jmallett/octeon/sys/mips/mips/pmap.c user/jmallett/octeon/sys/net80211/ieee80211_hwmp.c user/jmallett/octeon/sys/net80211/ieee80211_ioctl.c user/jmallett/octeon/sys/net80211/ieee80211_scan_sta.c user/jmallett/octeon/sys/powerpc/booke/pmap.c user/jmallett/octeon/sys/sun4v/sun4v/pmap.c user/jmallett/octeon/sys/sys/_task.h Directory Properties: user/jmallett/octeon/ (props changed) Modified: user/jmallett/octeon/crypto/openssh/moduli.5 ============================================================================== --- user/jmallett/octeon/crypto/openssh/moduli.5 Tue Jun 1 22:46:57 2010 (r208724) +++ user/jmallett/octeon/crypto/openssh/moduli.5 Wed Jun 2 04:13:10 2010 (r208725) @@ -13,7 +13,7 @@ .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -.Dd June 26 2008 +.Dd June 26, 2008 .Dt MODULI 5 .Os .Sh NAME Modified: user/jmallett/octeon/crypto/openssh/scp.1 ============================================================================== --- user/jmallett/octeon/crypto/openssh/scp.1 Tue Jun 1 22:46:57 2010 (r208724) +++ user/jmallett/octeon/crypto/openssh/scp.1 Wed Jun 2 04:13:10 2010 (r208725) @@ -11,7 +11,7 @@ .\" .\" $OpenBSD: scp.1,v 1.50 2010/02/08 10:50:20 markus Exp $ .\" -.Dd February 8 2010 +.Dd February 8, 2010 .Dt SCP 1 .Os .Sh NAME Modified: user/jmallett/octeon/crypto/openssh/sftp-server.8 ============================================================================== --- user/jmallett/octeon/crypto/openssh/sftp-server.8 Tue Jun 1 22:46:57 2010 (r208724) +++ user/jmallett/octeon/crypto/openssh/sftp-server.8 Wed Jun 2 04:13:10 2010 (r208725) @@ -23,7 +23,7 @@ .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.Dd January 9 2010 +.Dd January 9, 2010 .Dt SFTP-SERVER 8 .Os .Sh NAME Modified: user/jmallett/octeon/crypto/openssh/sftp.1 ============================================================================== --- user/jmallett/octeon/crypto/openssh/sftp.1 Tue Jun 1 22:46:57 2010 (r208724) +++ user/jmallett/octeon/crypto/openssh/sftp.1 Wed Jun 2 04:13:10 2010 (r208725) @@ -23,7 +23,7 @@ .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.Dd February 8 2010 +.Dd February 8, 2010 .Dt SFTP 1 .Os .Sh NAME Modified: user/jmallett/octeon/crypto/openssh/ssh-add.1 ============================================================================== --- user/jmallett/octeon/crypto/openssh/ssh-add.1 Tue Jun 1 22:46:57 2010 (r208724) +++ user/jmallett/octeon/crypto/openssh/ssh-add.1 Wed Jun 2 04:13:10 2010 (r208725) @@ -37,7 +37,7 @@ .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.Dd March 5 2010 +.Dd March 5, 2010 .Dt SSH-ADD 1 .Os .Sh NAME Modified: user/jmallett/octeon/crypto/openssh/ssh-agent.1 ============================================================================== --- user/jmallett/octeon/crypto/openssh/ssh-agent.1 Tue Jun 1 22:46:57 2010 (r208724) +++ user/jmallett/octeon/crypto/openssh/ssh-agent.1 Wed Jun 2 04:13:10 2010 (r208725) @@ -35,7 +35,7 @@ .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.Dd January 17 2010 +.Dd January 17, 2010 .Dt SSH-AGENT 1 .Os .Sh NAME Modified: user/jmallett/octeon/crypto/openssh/ssh-keygen.1 ============================================================================== --- user/jmallett/octeon/crypto/openssh/ssh-keygen.1 Tue Jun 1 22:46:57 2010 (r208724) +++ user/jmallett/octeon/crypto/openssh/ssh-keygen.1 Wed Jun 2 04:13:10 2010 (r208725) @@ -38,7 +38,7 @@ .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.Dd March 13 2010 +.Dd March 13, 2010 .Dt SSH-KEYGEN 1 .Os .Sh NAME Modified: user/jmallett/octeon/crypto/openssh/ssh-keyscan.1 ============================================================================== --- user/jmallett/octeon/crypto/openssh/ssh-keyscan.1 Tue Jun 1 22:46:57 2010 (r208724) +++ user/jmallett/octeon/crypto/openssh/ssh-keyscan.1 Wed Jun 2 04:13:10 2010 (r208725) @@ -7,7 +7,7 @@ .\" permitted provided that due credit is given to the author and the .\" OpenBSD project by leaving this copyright notice intact. .\" -.Dd January 9 2010 +.Dd January 9, 2010 .Dt SSH-KEYSCAN 1 .Os .Sh NAME Modified: user/jmallett/octeon/crypto/openssh/ssh-keysign.8 ============================================================================== --- user/jmallett/octeon/crypto/openssh/ssh-keysign.8 Tue Jun 1 22:46:57 2010 (r208724) +++ user/jmallett/octeon/crypto/openssh/ssh-keysign.8 Wed Jun 2 04:13:10 2010 (r208725) @@ -22,7 +22,7 @@ .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.Dd May 31 2007 +.Dd May 31, 2007 .Dt SSH-KEYSIGN 8 .Os .Sh NAME Modified: user/jmallett/octeon/crypto/openssh/ssh.1 ============================================================================== --- user/jmallett/octeon/crypto/openssh/ssh.1 Tue Jun 1 22:46:57 2010 (r208724) +++ user/jmallett/octeon/crypto/openssh/ssh.1 Wed Jun 2 04:13:10 2010 (r208725) @@ -36,7 +36,7 @@ .\" .\" $OpenBSD: ssh.1,v 1.303 2010/03/26 00:26:58 djm Exp $ .\" $FreeBSD$ -.Dd March 26 2010 +.Dd March 26, 2010 .Dt SSH 1 .Os .Sh NAME Modified: user/jmallett/octeon/crypto/openssh/ssh_config.5 ============================================================================== --- user/jmallett/octeon/crypto/openssh/ssh_config.5 Tue Jun 1 22:46:57 2010 (r208724) +++ user/jmallett/octeon/crypto/openssh/ssh_config.5 Wed Jun 2 04:13:10 2010 (r208725) @@ -36,7 +36,7 @@ .\" .\" $OpenBSD: ssh_config.5,v 1.130 2010/03/26 01:06:13 dtucker Exp $ .\" $FreeBSD$ -.Dd March 26 2010 +.Dd March 26, 2010 .Dt SSH_CONFIG 5 .Os .Sh NAME Modified: user/jmallett/octeon/crypto/openssh/sshd.8 ============================================================================== --- user/jmallett/octeon/crypto/openssh/sshd.8 Tue Jun 1 22:46:57 2010 (r208724) +++ user/jmallett/octeon/crypto/openssh/sshd.8 Wed Jun 2 04:13:10 2010 (r208725) @@ -36,7 +36,7 @@ .\" .\" $OpenBSD: sshd.8,v 1.255 2010/03/05 06:50:35 jmc Exp $ .\" $FreeBSD$ -.Dd March 5 2010 +.Dd March 5, 2010 .Dt SSHD 8 .Os .Sh NAME Modified: user/jmallett/octeon/crypto/openssh/sshd_config.5 ============================================================================== --- user/jmallett/octeon/crypto/openssh/sshd_config.5 Tue Jun 1 22:46:57 2010 (r208724) +++ user/jmallett/octeon/crypto/openssh/sshd_config.5 Wed Jun 2 04:13:10 2010 (r208725) @@ -36,7 +36,7 @@ .\" .\" $OpenBSD: sshd_config.5,v 1.120 2010/03/04 23:17:25 djm Exp $ .\" $FreeBSD$ -.Dd March 4 2010 +.Dd March 4, 2010 .Dt SSHD_CONFIG 5 .Os .Sh NAME Modified: user/jmallett/octeon/share/man/man4/io.4 ============================================================================== --- user/jmallett/octeon/share/man/man4/io.4 Tue Jun 1 22:46:57 2010 (r208724) +++ user/jmallett/octeon/share/man/man4/io.4 Wed Jun 2 04:13:10 2010 (r208725) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 8, 2010 +.Dd June 01, 2010 .Dt IO 4 .Os .Sh NAME @@ -35,32 +35,89 @@ .Nd I/O privilege file .Sh SYNOPSIS .Cd "device io" +.Pp +.In sys/types.h +.In sys/ioctl.h +.In dev/io/iodev.h +.In machine/iodev.h +.Pp +.Bd -literal +struct iodev_pio_req { + u_int access; + u_int port; + u_int width; + u_int val; +}; .Sh DESCRIPTION The special file .Pa /dev/io is a controlled security hole that allows a process to gain I/O privileges (which are normally reserved for kernel-internal code). -Any process that holds a file descriptor on -.Pa /dev/io -open will get its -.Em IOPL -bits in the flag register set, thus allowing it to perform direct -I/O operations. This can be useful in order to write userland programs that handle some hardware directly. -Note that even read-only access will grant the full I/O privileges. +.Pp +The usual operations on the device are to open it via the +.Xr open 2 +interface and to send I/O requests to the file descriptor using the +.Xr ioctl 2 +syscall. +.Pp +The +.Xr ioctl 2 +requests available for +.Pa /dev/io +are mostly platform dependent, but there are also some in common between +all of them. +The +.Dv IODEV_PIO +is used by all the architectures in order to request that an I/O operation +be performed. It takes a 'struct iodev_pio_req' argument +that must be previously setup. +.Pp +The +.Fa access +member specifies the type of operation requested. It may be: +.Bl -tag -width IODEV_PIO_WRITE +.It Dv IODEV_PIO_READ +The operation is an "in" type. A value will be read from the specified port +(retrieved from the +.Fa port +member) and the result will be stored in the +.Fa val +member. +.It Dv IODEV_PIO_WRITE +The operation is a "out" type. The value will be fetched from the +.Fa val +member and will be written out to the specified port (defined as the +.Fa port +member). +.El +.Pp +Finally, the +.Fa width +member specifies the size of the operand to be read/written, expressed +in bytes. .Pp In addition to any file access permissions on .Pa /dev/io , the kernel enforces that only the super-user may open this device. -.Sh FILES -.Bl -tag -width Pa -compact -.It Pa /dev/io -.El +.Sh LEGACY +The +.Pa /dev/io +interface used to be very i386 specific and worked differently. The initial +implementation, in fact, simply raised the +.Em IOPL +of the current thread when +.Xr open 2 +was called on the file. This behaviour is retained in the current +implementation as legacy support for both i386 and amd64 architectures. .Sh SEE ALSO +.Xr close 2 , .Xr i386_get_ioperm 2 , .Xr i386_set_ioperm 2 , +.Xr ioctl 2 , +.Xr open 2 , .Xr mem 4 .Sh HISTORY The Modified: user/jmallett/octeon/sys/arm/arm/pmap.c ============================================================================== --- user/jmallett/octeon/sys/arm/arm/pmap.c Tue Jun 1 22:46:57 2010 (r208724) +++ user/jmallett/octeon/sys/arm/arm/pmap.c Wed Jun 2 04:13:10 2010 (r208725) @@ -3318,15 +3318,16 @@ pmap_enter_locked(pmap_t pmap, vm_offset u_int oflags; vm_paddr_t pa; - KASSERT((m->oflags & VPO_BUSY) != 0 || (flags & M_NOWAIT) != 0, - ("pmap_enter_locked: page %p is not busy", m)); PMAP_ASSERT_LOCKED(pmap); mtx_assert(&vm_page_queue_mtx, MA_OWNED); if (va == vector_page) { pa = systempage.pv_pa; m = NULL; - } else + } else { + KASSERT((m->oflags & VPO_BUSY) != 0 || (flags & M_NOWAIT) != 0, + ("pmap_enter_locked: page %p is not busy", m)); pa = VM_PAGE_TO_PHYS(m); + } nflags = 0; if (prot & VM_PROT_WRITE) nflags |= PVF_WRITE; Modified: user/jmallett/octeon/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c ============================================================================== --- user/jmallett/octeon/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Tue Jun 1 22:46:57 2010 (r208724) +++ user/jmallett/octeon/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Wed Jun 2 04:13:10 2010 (r208725) @@ -499,6 +499,12 @@ zfsvfs_setup(zfsvfs_t *zfsvfs, boolean_t dmu_objset_set_user(zfsvfs->z_os, zfsvfs); mutex_exit(&zfsvfs->z_os->os->os_user_ptr_lock); + zfsvfs->z_log = zil_open(zfsvfs->z_os, zfs_get_data); + if (zil_disable) { + zil_destroy(zfsvfs->z_log, B_FALSE); + zfsvfs->z_log = NULL; + } + /* * If we are not mounting (ie: online recv), then we don't * have to worry about replaying the log as we blocked all @@ -512,21 +518,45 @@ zfsvfs_setup(zfsvfs_t *zfsvfs, boolean_t * allow replays to succeed. */ readonly = zfsvfs->z_vfs->vfs_flag & VFS_RDONLY; - zfsvfs->z_vfs->vfs_flag &= ~VFS_RDONLY; - - /* - * Parse and replay the intent log. - */ - zil_replay(zfsvfs->z_os, zfsvfs, &zfsvfs->z_assign, - zfs_replay_vector, zfs_unlinked_drain); + if (readonly != 0) + zfsvfs->z_vfs->vfs_flag &= ~VFS_RDONLY; + else + zfs_unlinked_drain(zfsvfs); - zfs_unlinked_drain(zfsvfs); + if (zfsvfs->z_log) { + /* + * Parse and replay the intent log. + * + * Because of ziltest, this must be done after + * zfs_unlinked_drain(). (Further note: ziltest + * doesn't use readonly mounts, where + * zfs_unlinked_drain() isn't called.) This is because + * ziltest causes spa_sync() to think it's committed, + * but actually it is not, so the intent log contains + * many txg's worth of changes. + * + * In particular, if object N is in the unlinked set in + * the last txg to actually sync, then it could be + * actually freed in a later txg and then reallocated + * in a yet later txg. This would write a "create + * object N" record to the intent log. Normally, this + * would be fine because the spa_sync() would have + * written out the fact that object N is free, before + * we could write the "create object N" intent log + * record. + * + * But when we are in ziltest mode, we advance the "open + * txg" without actually spa_sync()-ing the changes to + * disk. So we would see that object N is still + * allocated and in the unlinked set, and there is an + * intent log record saying to allocate it. + */ + zil_replay(zfsvfs->z_os, zfsvfs, &zfsvfs->z_assign, + zfs_replay_vector, zfs_unlinked_drain); + } zfsvfs->z_vfs->vfs_flag |= readonly; /* restore readonly bit */ } - if (!zil_disable) - zfsvfs->z_log = zil_open(zfsvfs->z_os, zfs_get_data); - return (0); } Modified: user/jmallett/octeon/sys/dev/acpica/acpi_ec.c ============================================================================== --- user/jmallett/octeon/sys/dev/acpica/acpi_ec.c Tue Jun 1 22:46:57 2010 (r208724) +++ user/jmallett/octeon/sys/dev/acpica/acpi_ec.c Wed Jun 2 04:13:10 2010 (r208725) @@ -223,7 +223,7 @@ static ACPI_STATUS EcSpaceSetup(ACPI_HAN void *Context, void **return_Context); static ACPI_STATUS EcSpaceHandler(UINT32 Function, ACPI_PHYSICAL_ADDRESS Address, - UINT32 width, UINT64 *Value, + UINT32 Width, UINT64 *Value, void *Context, void *RegionContext); static ACPI_STATUS EcWaitEvent(struct acpi_ec_softc *sc, EC_EVENT Event, u_int gen_count); @@ -231,7 +231,7 @@ static ACPI_STATUS EcCommand(struct acpi static ACPI_STATUS EcRead(struct acpi_ec_softc *sc, UINT8 Address, UINT8 *Data); static ACPI_STATUS EcWrite(struct acpi_ec_softc *sc, UINT8 Address, - UINT8 *Data); + UINT8 Data); static int acpi_ec_probe(device_t dev); static int acpi_ec_attach(device_t dev); static int acpi_ec_suspend(device_t dev); @@ -717,25 +717,27 @@ EcSpaceSetup(ACPI_HANDLE Region, UINT32 } static ACPI_STATUS -EcSpaceHandler(UINT32 Function, ACPI_PHYSICAL_ADDRESS Address, UINT32 width, +EcSpaceHandler(UINT32 Function, ACPI_PHYSICAL_ADDRESS Address, UINT32 Width, UINT64 *Value, void *Context, void *RegionContext) { struct acpi_ec_softc *sc = (struct acpi_ec_softc *)Context; ACPI_STATUS Status; - UINT8 EcAddr, EcData; - int i; + UINT8 *EcData; + UINT8 EcAddr; + int bytes, i; ACPI_FUNCTION_TRACE_U32((char *)(uintptr_t)__func__, (UINT32)Address); - if (width % 8 != 0 || Value == NULL || Context == NULL) + if (Width % 8 != 0 || Value == NULL || Context == NULL) return_ACPI_STATUS (AE_BAD_PARAMETER); - if (Address + (width / 8) - 1 > 0xFF) + bytes = Width / 8; + if (Address + bytes - 1 > 0xFF) return_ACPI_STATUS (AE_BAD_ADDRESS); if (Function == ACPI_READ) *Value = 0; EcAddr = Address; - Status = AE_ERROR; + EcData = (UINT8 *)Value; /* * If booting, check if we need to run the query handler. If so, we @@ -753,17 +755,14 @@ EcSpaceHandler(UINT32 Function, ACPI_PHY if (ACPI_FAILURE(Status)) return_ACPI_STATUS (Status); - /* Perform the transaction(s), based on width. */ - for (i = 0; i < width; i += 8, EcAddr++) { + /* Perform the transaction(s), based on Width. */ + for (i = 0; i < bytes; i++, EcAddr++, EcData++) { switch (Function) { case ACPI_READ: - Status = EcRead(sc, EcAddr, &EcData); - if (ACPI_SUCCESS(Status)) - *Value |= ((UINT64)EcData) << i; + Status = EcRead(sc, EcAddr, EcData); break; case ACPI_WRITE: - EcData = (UINT8)((*Value) >> i); - Status = EcWrite(sc, EcAddr, &EcData); + Status = EcWrite(sc, EcAddr, *EcData); break; default: device_printf(sc->ec_dev, "invalid EcSpaceHandler function %d\n", @@ -986,14 +985,14 @@ EcRead(struct acpi_ec_softc *sc, UINT8 A } static ACPI_STATUS -EcWrite(struct acpi_ec_softc *sc, UINT8 Address, UINT8 *Data) +EcWrite(struct acpi_ec_softc *sc, UINT8 Address, UINT8 Data) { ACPI_STATUS status; UINT8 data; u_int gen_count; ACPI_SERIAL_ASSERT(ec); - CTR2(KTR_ACPI, "ec write to %#x, data %#x", Address, *Data); + CTR2(KTR_ACPI, "ec write to %#x, data %#x", Address, Data); /* If we can't start burst mode, continue anyway. */ status = EcCommand(sc, EC_COMMAND_BURST_ENABLE); @@ -1018,7 +1017,7 @@ EcWrite(struct acpi_ec_softc *sc, UINT8 } gen_count = sc->ec_gencount; - EC_SET_DATA(sc, *Data); + EC_SET_DATA(sc, Data); status = EcWaitEvent(sc, EC_EVENT_INPUT_BUFFER_EMPTY, gen_count); if (ACPI_FAILURE(status)) { device_printf(sc->ec_dev, "EcWrite: failed waiting for sent data\n"); Modified: user/jmallett/octeon/sys/dev/ath/ath_hal/ah.h ============================================================================== --- user/jmallett/octeon/sys/dev/ath/ath_hal/ah.h Tue Jun 1 22:46:57 2010 (r208724) +++ user/jmallett/octeon/sys/dev/ath/ath_hal/ah.h Wed Jun 2 04:13:10 2010 (r208725) @@ -324,6 +324,7 @@ typedef enum { HAL_INT_RXORN = 0x00000020, HAL_INT_TX = 0x00000040, /* Non-common mapping */ HAL_INT_TXDESC = 0x00000080, + HAL_INT_TIM_TIMER= 0x00000100, HAL_INT_TXURN = 0x00000800, HAL_INT_MIB = 0x00001000, HAL_INT_RXPHY = 0x00004000, Modified: user/jmallett/octeon/sys/dev/ath/ath_hal/ah_eeprom_v4k.c ============================================================================== --- user/jmallett/octeon/sys/dev/ath/ath_hal/ah_eeprom_v4k.c Tue Jun 1 22:46:57 2010 (r208724) +++ user/jmallett/octeon/sys/dev/ath/ath_hal/ah_eeprom_v4k.c Wed Jun 2 04:13:10 2010 (r208725) @@ -38,11 +38,8 @@ v4kEepromGet(struct ath_hal *ah, int par int i; switch (param) { - case AR_EEP_NFTHRESH_5: - *(int16_t *)val = pModal[0].noiseFloorThreshCh[0]; - return HAL_OK; case AR_EEP_NFTHRESH_2: - *(int16_t *)val = pModal[1].noiseFloorThreshCh[0]; + *(int16_t *)val = pModal->noiseFloorThreshCh[0]; return HAL_OK; case AR_EEP_MACADDR: /* Get MAC Address */ sum = 0; @@ -67,14 +64,10 @@ v4kEepromGet(struct ath_hal *ah, int par return pBase->opCapFlags; case AR_EEP_RFSILENT: return pBase->rfSilent; - case AR_EEP_OB_5: - return pModal[CHAN_A_IDX].ob; - case AR_EEP_DB_5: - return pModal[CHAN_A_IDX].db; case AR_EEP_OB_2: - return pModal[CHAN_B_IDX].ob; + return pModal->ob; case AR_EEP_DB_2: - return pModal[CHAN_B_IDX].db; + return pModal->db; case AR_EEP_TXMASK: return pBase->txMask; case AR_EEP_RXMASK: @@ -84,11 +77,9 @@ v4kEepromGet(struct ath_hal *ah, int par case AR_EEP_TXGAIN_TYPE: return IS_VERS(>=, AR5416_EEP_MINOR_VER_19) ? pBase->txGainType : AR5416_EEP_TXGAIN_ORIG; -#if 0 case AR_EEP_OL_PWRCTRL: HALASSERT(val == AH_NULL); - return pBase->openLoopPwrCntl ? HAL_OK : HAL_EIO; -#endif + return HAL_EIO; case AR_EEP_AMODE: HALASSERT(val == AH_NULL); return pBase->opCapFlags & AR5416_OPFLAGS_11A ? @@ -110,15 +101,11 @@ v4kEepromGet(struct ath_hal *ah, int par case AR_EEP_AES: case AR_EEP_BURST: case AR_EEP_RFKILL: - case AR_EEP_TURBO5DISABLE: case AR_EEP_TURBO2DISABLE: HALASSERT(val == AH_NULL); return HAL_OK; case AR_EEP_ANTGAINMAX_2: - *(int8_t *) val = ee->ee_antennaGainMax[1]; - return HAL_OK; - case AR_EEP_ANTGAINMAX_5: - *(int8_t *) val = ee->ee_antennaGainMax[0]; + *(int8_t *) val = ee->ee_antennaGainMax; return HAL_OK; default: HALASSERT(0); @@ -136,10 +123,7 @@ v4kEepromSet(struct ath_hal *ah, int par switch (param) { case AR_EEP_ANTGAINMAX_2: - ee->ee_antennaGainMax[1] = (int8_t) v; - return HAL_OK; - case AR_EEP_ANTGAINMAX_5: - ee->ee_antennaGainMax[0] = (int8_t) v; + ee->ee_antennaGainMax = (int8_t) v; return HAL_OK; } return HAL_EINVAL; @@ -252,7 +236,7 @@ v4kEepromReadCTLInfo(struct ath_hal *ah, RD_EDGES_POWER *rep = ee->ee_rdEdgesPower; int i, j; - HALASSERT(AR5416_NUM_CTLS <= sizeof(ee->ee_rdEdgesPower)/NUM_EDGES); + HALASSERT(AR5416_4K_NUM_CTLS <= sizeof(ee->ee_rdEdgesPower)/NUM_EDGES); for (i = 0; ee->ee_base.ctlIndex[i] != 0 && i < AR5416_4K_NUM_CTLS; i++) { for (j = 0; j < NUM_EDGES; j ++) { Modified: user/jmallett/octeon/sys/dev/ath/ath_hal/ah_eeprom_v4k.h ============================================================================== --- user/jmallett/octeon/sys/dev/ath/ath_hal/ah_eeprom_v4k.h Tue Jun 1 22:46:57 2010 (r208724) +++ user/jmallett/octeon/sys/dev/ath/ath_hal/ah_eeprom_v4k.h Wed Jun 2 04:13:10 2010 (r208725) @@ -23,6 +23,8 @@ #include "ah_eeprom.h" #include "ah_eeprom_v14.h" +#define AR9285_RDEXT_DEFAULT 0x1F + #undef owl_eep_start_loc #ifdef __LINUX_ARM_ARCH__ /* AP71 */ #define owl_eep_start_loc 0 @@ -150,6 +152,6 @@ typedef struct { uint16_t ee_numCtls; RD_EDGES_POWER ee_rdEdgesPower[NUM_EDGES*AR5416_4K_NUM_CTLS]; /* XXX these are dynamically calculated for use by shared code */ - int8_t ee_antennaGainMax[2]; + int8_t ee_antennaGainMax; } HAL_EEPROM_v4k; #endif /* _AH_EEPROM_V4K_H_ */ Modified: user/jmallett/octeon/sys/dev/ath/ath_hal/ar5416/ar5416_interrupts.c ============================================================================== --- user/jmallett/octeon/sys/dev/ath/ath_hal/ar5416/ar5416_interrupts.c Tue Jun 1 22:46:57 2010 (r208724) +++ user/jmallett/octeon/sys/dev/ath/ath_hal/ar5416/ar5416_interrupts.c Wed Jun 2 04:13:10 2010 (r208725) @@ -120,6 +120,13 @@ ar5416GetPendingInterrupts(struct ath_ha ahp->ah_intrTxqs |= MS(isr1, AR_ISR_S1_QCU_TXEOL); } + if (AR_SREV_MERLIN(ah) || AR_SREV_KITE(ah)) { + uint32_t isr5; + isr5 = OS_REG_READ(ah, AR_ISR_S5_S); + if (isr5 & AR_ISR_S5_TIM_TIMER) + *masked |= HAL_INT_TIM_TIMER; + } + /* Interrupt Mitigation on AR5416 */ #ifdef AR5416_INT_MITIGATION if (isr & (AR_ISR_RXMINTR | AR_ISR_RXINTM)) Modified: user/jmallett/octeon/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c ============================================================================== --- user/jmallett/octeon/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c Tue Jun 1 22:46:57 2010 (r208724) +++ user/jmallett/octeon/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c Wed Jun 2 04:13:10 2010 (r208725) @@ -170,7 +170,16 @@ ar5416Reset(struct ath_hal *ah, HAL_OPMO OS_REG_WRITE(ah, AR_RSSI_THR, rssiThrReg); OS_MARK(ah, AH_MARK_RESET_LINE, __LINE__); + if (AR_SREV_MERLIN_10_OR_LATER(ah)) + OS_REG_SET_BIT(ah, AR_GPIO_INPUT_EN_VAL, AR_GPIO_JTAG_DISABLE); + if (AR_SREV_KITE(ah)) { + uint32_t val; + val = OS_REG_READ(ah, AR_PHY_HEAVY_CLIP_FACTOR_RIFS); + val &= ~AR_PHY_RIFS_INIT_DELAY; + OS_REG_WRITE(ah, AR_PHY_HEAVY_CLIP_FACTOR_RIFS, val); + } + AH5416(ah)->ah_writeIni(ah, chan); /* Setup 11n MAC/Phy mode registers */ @@ -1019,8 +1028,11 @@ ar5416SetResetPowerOn(struct ath_hal *ah /* * RTC reset and clear */ + OS_REG_WRITE(ah, AR_RC, AR_RC_AHB); OS_REG_WRITE(ah, AR_RTC_RESET, 0); OS_DELAY(20); + OS_REG_WRITE(ah, AR_RC, 0); + OS_REG_WRITE(ah, AR_RTC_RESET, 1); /* Modified: user/jmallett/octeon/sys/dev/ath/ath_hal/ar5416/ar5416phy.h ============================================================================== --- user/jmallett/octeon/sys/dev/ath/ath_hal/ar5416/ar5416phy.h Tue Jun 1 22:46:57 2010 (r208724) +++ user/jmallett/octeon/sys/dev/ath/ath_hal/ar5416/ar5416phy.h Wed Jun 2 04:13:10 2010 (r208725) @@ -111,6 +111,9 @@ #define AR_PHY_HEAVY_CLIP_ENABLE 0x99E0 +#define AR_PHY_HEAVY_CLIP_FACTOR_RIFS 0x99ec +#define AR_PHY_RIFS_INIT_DELAY 0x03ff0000 + #define AR_PHY_M_SLEEP 0x99f0 /* sleep control registers */ #define AR_PHY_REFCLKDLY 0x99f4 #define AR_PHY_REFCLKPD 0x99f8 Modified: user/jmallett/octeon/sys/dev/ath/ath_hal/ar5416/ar5416reg.h ============================================================================== --- user/jmallett/octeon/sys/dev/ath/ath_hal/ar5416/ar5416reg.h Tue Jun 1 22:46:57 2010 (r208724) +++ user/jmallett/octeon/sys/dev/ath/ath_hal/ar5416/ar5416reg.h Wed Jun 2 04:13:10 2010 (r208725) @@ -127,6 +127,7 @@ #define AR_EXTRCCNT 0x8328 /* extension channel rx clear count */ #define AR_SELFGEN_MASK 0x832c /* rx and cal chain masks */ #define AR_PCU_TXBUF_CTRL 0x8340 +#define AR_PCU_MISC_MODE2 0x8344 /* DMA & PCI Registers in PCI space (usable during sleep)*/ #define AR_RC_AHB 0x00000001 /* AHB reset */ @@ -244,6 +245,10 @@ #define AR_ISR_S2_GTT 0x00800000 /* Global transmit timeout */ #define AR_ISR_S2_TSFOOR 0x40000000 /* RX TSF out of range */ +#define AR_ISR_S5 0x0098 +#define AR_ISR_S5_S 0x00d8 +#define AR_ISR_S5_TIM_TIMER 0x00000010 + #define AR_INTR_SPURIOUS 0xffffffff #define AR_INTR_RTC_IRQ 0x00000001 /* rtc in shutdown state */ #define AR_INTR_MAC_IRQ 0x00000002 /* pending mac interrupt */ @@ -495,6 +500,8 @@ #define AR_PCU_CLEAR_VMF 0x01000000 /* clear vmf mode (fast cc)*/ #define AR_PCU_CLEAR_BA_VALID 0x04000000 /* clear ba state */ +#define AR_PCU_MISC_MODE2_HWWAR1 0x00100000 + /* GPIO Interrupt */ #define AR_INTR_GPIO 0x3FF00000 /* gpio interrupted */ #define AR_INTR_GPIO_S 20 @@ -521,6 +528,8 @@ #define AR_GPIO_INTR_POL_VAL 0x1FFF #define AR_GPIO_INTR_POL_VAL_S 0 +#define AR_GPIO_JTAG_DISABLE 0x00020000 + #define AR_2040_JOINED_RX_CLEAR 0x00000001 /* use ctl + ext rx_clear for cca */ #define AR_PCU_TXBUF_CTRL_SIZE_MASK 0x7FF Modified: user/jmallett/octeon/sys/dev/ath/ath_hal/ar5416/ar9285_attach.c ============================================================================== --- user/jmallett/octeon/sys/dev/ath/ath_hal/ar5416/ar9285_attach.c Tue Jun 1 22:46:57 2010 (r208724) +++ user/jmallett/octeon/sys/dev/ath/ath_hal/ar5416/ar9285_attach.c Wed Jun 2 04:13:10 2010 (r208725) @@ -316,6 +316,16 @@ ar9285WriteIni(struct ath_hal *ah, const regWrites = ath_hal_ini_write(ah, &AH5212(ah)->ah_ini_common, 1, regWrites); + OS_REG_SET_BIT(ah, AR_DIAG_SW, (AR_DIAG_RX_DIS | AR_DIAG_RX_ABORT)); + + if (AR_SREV_MERLIN_10_OR_LATER(ah)) { + uint32_t val; + val = OS_REG_READ(ah, AR_PCU_MISC_MODE2) & + (~AR_PCU_MISC_MODE2_HWWAR1); + OS_REG_WRITE(ah, AR_PCU_MISC_MODE2, val); + OS_REG_WRITE(ah, 0x9800 + (651 << 2), 0x11); + } + } /* Modified: user/jmallett/octeon/sys/dev/ath/ath_hal/ar5416/ar9285_reset.c ============================================================================== --- user/jmallett/octeon/sys/dev/ath/ath_hal/ar5416/ar9285_reset.c Tue Jun 1 22:46:57 2010 (r208724) +++ user/jmallett/octeon/sys/dev/ath/ath_hal/ar5416/ar9285_reset.c Wed Jun 2 04:13:10 2010 (r208725) @@ -245,107 +245,60 @@ ar9285SetBoardValues(struct ath_hal *ah, const HAL_EEPROM_v4k *ee = AH_PRIVATE(ah)->ah_eeprom; const struct ar5416eeprom_4k *eep = &ee->ee_base; const MODAL_EEP4K_HEADER *pModal; - int i, regChainOffset; - uint8_t txRxAttenLocal; /* workaround for eeprom versions <= 14.2 */ + uint8_t txRxAttenLocal = 23; HALASSERT(AH_PRIVATE(ah)->ah_eeversion >= AR_EEPROM_VER14_1); pModal = &eep->modalHeader; - /* NB: workaround for eeprom versions <= 14.2 */ - txRxAttenLocal = 23; - OS_REG_WRITE(ah, AR_PHY_SWITCH_COM, pModal->antCtrlCommon); - for (i = 0; i < AR5416_4K_MAX_CHAINS; i++) { - if (AR_SREV_MERLIN(ah)) { - if (i >= 2) break; - } - if (AR_SREV_OWL_20_OR_LATER(ah) && - (AH5416(ah)->ah_rx_chainmask == 0x5 || - AH5416(ah)->ah_tx_chainmask == 0x5) && i != 0) { - /* Regs are swapped from chain 2 to 1 for 5416 2_0 with - * only chains 0 and 2 populated - */ - regChainOffset = (i == 1) ? 0x2000 : 0x1000; - } else { - regChainOffset = i * 0x1000; - } - - OS_REG_WRITE(ah, AR_PHY_SWITCH_CHAIN_0 + regChainOffset, pModal->antCtrlChain[i]); - OS_REG_WRITE(ah, AR_PHY_TIMING_CTRL4 + regChainOffset, - (OS_REG_READ(ah, AR_PHY_TIMING_CTRL4 + regChainOffset) & + OS_REG_WRITE(ah, AR_PHY_SWITCH_CHAIN_0, pModal->antCtrlChain[0]); + OS_REG_WRITE(ah, AR_PHY_TIMING_CTRL4, + (OS_REG_READ(ah, AR_PHY_TIMING_CTRL4) & ~(AR_PHY_TIMING_CTRL4_IQCORR_Q_Q_COFF | AR_PHY_TIMING_CTRL4_IQCORR_Q_I_COFF)) | - SM(pModal->iqCalICh[i], AR_PHY_TIMING_CTRL4_IQCORR_Q_I_COFF) | - SM(pModal->iqCalQCh[i], AR_PHY_TIMING_CTRL4_IQCORR_Q_Q_COFF)); - - /* - * Large signal upgrade. - * XXX update - */ + SM(pModal->iqCalICh[0], AR_PHY_TIMING_CTRL4_IQCORR_Q_I_COFF) | + SM(pModal->iqCalQCh[0], AR_PHY_TIMING_CTRL4_IQCORR_Q_Q_COFF)); - if ((i == 0) || AR_SREV_OWL_20_OR_LATER(ah)) { - OS_REG_WRITE(ah, AR_PHY_RXGAIN + regChainOffset, - (OS_REG_READ(ah, AR_PHY_RXGAIN + regChainOffset) & ~AR_PHY_RXGAIN_TXRX_ATTEN) | - SM(IS_EEP_MINOR_V3(ah) ? pModal->txRxAttenCh[i] : txRxAttenLocal, - AR_PHY_RXGAIN_TXRX_ATTEN)); - - OS_REG_WRITE(ah, AR_PHY_GAIN_2GHZ + regChainOffset, - (OS_REG_READ(ah, AR_PHY_GAIN_2GHZ + regChainOffset) & ~AR_PHY_GAIN_2GHZ_RXTX_MARGIN) | - SM(pModal->rxTxMarginCh[i], AR_PHY_GAIN_2GHZ_RXTX_MARGIN)); - } - } - - OS_REG_RMW_FIELD(ah, AR_PHY_SETTLING, AR_PHY_SETTLING_SWITCH, pModal->switchSettling); - OS_REG_RMW_FIELD(ah, AR_PHY_DESIRED_SZ, AR_PHY_DESIRED_SZ_ADC, pModal->adcDesiredSize); - OS_REG_RMW_FIELD(ah, AR_PHY_DESIRED_SZ, AR_PHY_DESIRED_SZ_PGA, pModal->pgaDesiredSize); - OS_REG_WRITE(ah, AR_PHY_RF_CTL4, - SM(pModal->txEndToXpaOff, AR_PHY_RF_CTL4_TX_END_XPAA_OFF) - | SM(pModal->txEndToXpaOff, AR_PHY_RF_CTL4_TX_END_XPAB_OFF) - | SM(pModal->txFrameToXpaOn, AR_PHY_RF_CTL4_FRAME_XPAA_ON) - | SM(pModal->txFrameToXpaOn, AR_PHY_RF_CTL4_FRAME_XPAB_ON)); - - OS_REG_RMW_FIELD(ah, AR_PHY_RF_CTL3, AR_PHY_TX_END_TO_A2_RX_ON, pModal->txEndToRxOn); - - OS_REG_RMW_FIELD(ah, AR_PHY_CCA, AR9280_PHY_CCA_THRESH62, - pModal->thresh62); - OS_REG_RMW_FIELD(ah, AR_PHY_EXT_CCA0, AR_PHY_EXT_CCA0_THRESH62, - pModal->thresh62); - - /* Minor Version Specific application */ - if (IS_EEP_MINOR_V2(ah)) { - OS_REG_RMW_FIELD(ah, AR_PHY_RF_CTL2, AR_PHY_TX_FRAME_TO_DATA_START, pModal->txFrameToDataStart); - OS_REG_RMW_FIELD(ah, AR_PHY_RF_CTL2, AR_PHY_TX_FRAME_TO_PA_ON, pModal->txFrameToPaOn); - } - if (IS_EEP_MINOR_V3(ah)) { if (IEEE80211_IS_CHAN_HT40(chan)) { /* Overwrite switch settling with HT40 value */ - OS_REG_RMW_FIELD(ah, AR_PHY_SETTLING, AR_PHY_SETTLING_SWITCH, pModal->swSettleHt40); + OS_REG_RMW_FIELD(ah, AR_PHY_SETTLING, AR_PHY_SETTLING_SWITCH, + pModal->swSettleHt40); } - - if ((AR_SREV_OWL_20_OR_LATER(ah)) && - ( AH5416(ah)->ah_rx_chainmask == 0x5 || AH5416(ah)->ah_tx_chainmask == 0x5)){ - /* Reg Offsets are swapped for logical mapping */ - OS_REG_WRITE(ah, AR_PHY_GAIN_2GHZ + 0x1000, (OS_REG_READ(ah, AR_PHY_GAIN_2GHZ + 0x1000) & ~AR_PHY_GAIN_2GHZ_BSW_MARGIN) | - SM(pModal->bswMargin[2], AR_PHY_GAIN_2GHZ_BSW_MARGIN)); - OS_REG_WRITE(ah, AR_PHY_GAIN_2GHZ + 0x1000, (OS_REG_READ(ah, AR_PHY_GAIN_2GHZ + 0x1000) & ~AR_PHY_GAIN_2GHZ_BSW_ATTEN) | - SM(pModal->bswAtten[2], AR_PHY_GAIN_2GHZ_BSW_ATTEN)); - OS_REG_WRITE(ah, AR_PHY_GAIN_2GHZ + 0x2000, (OS_REG_READ(ah, AR_PHY_GAIN_2GHZ + 0x2000) & ~AR_PHY_GAIN_2GHZ_BSW_MARGIN) | - SM(pModal->bswMargin[1], AR_PHY_GAIN_2GHZ_BSW_MARGIN)); - OS_REG_WRITE(ah, AR_PHY_GAIN_2GHZ + 0x2000, (OS_REG_READ(ah, AR_PHY_GAIN_2GHZ + 0x2000) & ~AR_PHY_GAIN_2GHZ_BSW_ATTEN) | - SM(pModal->bswAtten[1], AR_PHY_GAIN_2GHZ_BSW_ATTEN)); - } else { - OS_REG_WRITE(ah, AR_PHY_GAIN_2GHZ + 0x1000, (OS_REG_READ(ah, AR_PHY_GAIN_2GHZ + 0x1000) & ~AR_PHY_GAIN_2GHZ_BSW_MARGIN) | - SM(pModal->bswMargin[1], AR_PHY_GAIN_2GHZ_BSW_MARGIN)); - OS_REG_WRITE(ah, AR_PHY_GAIN_2GHZ + 0x1000, (OS_REG_READ(ah, AR_PHY_GAIN_2GHZ + 0x1000) & ~AR_PHY_GAIN_2GHZ_BSW_ATTEN) | - SM(pModal->bswAtten[1], AR_PHY_GAIN_2GHZ_BSW_ATTEN)); - OS_REG_WRITE(ah, AR_PHY_GAIN_2GHZ + 0x2000, (OS_REG_READ(ah, AR_PHY_GAIN_2GHZ + 0x2000) & ~AR_PHY_GAIN_2GHZ_BSW_MARGIN) | - SM(pModal->bswMargin[2],AR_PHY_GAIN_2GHZ_BSW_MARGIN)); - OS_REG_WRITE(ah, AR_PHY_GAIN_2GHZ + 0x2000, (OS_REG_READ(ah, AR_PHY_GAIN_2GHZ + 0x2000) & ~AR_PHY_GAIN_2GHZ_BSW_ATTEN) | - SM(pModal->bswAtten[2], AR_PHY_GAIN_2GHZ_BSW_ATTEN)); - } - OS_REG_RMW_FIELD(ah, AR_PHY_GAIN_2GHZ, AR_PHY_GAIN_2GHZ_BSW_MARGIN, pModal->bswMargin[0]); - OS_REG_RMW_FIELD(ah, AR_PHY_GAIN_2GHZ, AR_PHY_GAIN_2GHZ_BSW_ATTEN, pModal->bswAtten[0]); - } + txRxAttenLocal = pModal->txRxAttenCh[0]; + + OS_REG_RMW_FIELD(ah, AR_PHY_GAIN_2GHZ, AR_PHY_GAIN_2GHZ_XATTEN1_MARGIN, + pModal->bswMargin[0]); + OS_REG_RMW_FIELD(ah, AR_PHY_GAIN_2GHZ, AR_PHY_GAIN_2GHZ_XATTEN1_DB, + pModal->bswAtten[0]); + OS_REG_RMW_FIELD(ah, AR_PHY_GAIN_2GHZ, AR_PHY_GAIN_2GHZ_XATTEN2_MARGIN, + pModal->xatten2Margin[0]); + OS_REG_RMW_FIELD(ah, AR_PHY_GAIN_2GHZ, AR_PHY_GAIN_2GHZ_XATTEN2_DB, + pModal->xatten2Db[0]); + + /* block 1 has the same values as block 0 */ + OS_REG_RMW_FIELD(ah, AR_PHY_GAIN_2GHZ + 0x1000, + AR_PHY_GAIN_2GHZ_XATTEN1_MARGIN, pModal->bswMargin[0]); + OS_REG_RMW_FIELD(ah, AR_PHY_GAIN_2GHZ + 0x1000, + AR_PHY_GAIN_2GHZ_XATTEN1_DB, pModal->bswAtten[0]); + OS_REG_RMW_FIELD(ah, AR_PHY_GAIN_2GHZ + 0x1000, + AR_PHY_GAIN_2GHZ_XATTEN2_MARGIN, pModal->xatten2Margin[0]); + OS_REG_RMW_FIELD(ah, AR_PHY_GAIN_2GHZ + 0x1000, + AR_PHY_GAIN_2GHZ_XATTEN2_DB, pModal->xatten2Db[0]); + + } + OS_REG_RMW_FIELD(ah, AR_PHY_RXGAIN, + AR9280_PHY_RXGAIN_TXRX_ATTEN, txRxAttenLocal); + OS_REG_RMW_FIELD(ah, AR_PHY_RXGAIN, + AR9280_PHY_RXGAIN_TXRX_MARGIN, pModal->rxTxMarginCh[0]); + + OS_REG_RMW_FIELD(ah, AR_PHY_RXGAIN + 0x1000, + AR9280_PHY_RXGAIN_TXRX_ATTEN, txRxAttenLocal); + OS_REG_RMW_FIELD(ah, AR_PHY_RXGAIN + 0x1000, + AR9280_PHY_RXGAIN_TXRX_MARGIN, pModal->rxTxMarginCh[0]); + + if (AR_SREV_KITE_11(ah)) + OS_REG_WRITE(ah, AR9285_AN_TOP4, (AR9285_AN_TOP4_DEFAULT | 0x14)); + return AH_TRUE; } @@ -634,7 +587,7 @@ ar9285SetPowerCalTable(struct ath_hal *a OS_REG_WRITE(ah, AR_PHY_TPCRG1, (OS_REG_READ(ah, AR_PHY_TPCRG1) & ~(AR_PHY_TPCRG1_NUM_PD_GAIN | AR_PHY_TPCRG1_PD_GAIN_1 | AR_PHY_TPCRG1_PD_GAIN_2 | AR_PHY_TPCRG1_PD_GAIN_3)) | SM(numXpdGain - 1, AR_PHY_TPCRG1_NUM_PD_GAIN) | SM(xpdGainValues[0], AR_PHY_TPCRG1_PD_GAIN_1 ) | - SM(xpdGainValues[1], AR_PHY_TPCRG1_PD_GAIN_2) | SM(xpdGainValues[2], AR_PHY_TPCRG1_PD_GAIN_3)); + SM(xpdGainValues[1], AR_PHY_TPCRG1_PD_GAIN_2) | SM(0, AR_PHY_TPCRG1_PD_GAIN_3)); for (i = 0; i < AR5416_MAX_CHAINS; i++) { Modified: user/jmallett/octeon/sys/fs/devfs/devfs_vnops.c ============================================================================== --- user/jmallett/octeon/sys/fs/devfs/devfs_vnops.c Tue Jun 1 22:46:57 2010 (r208724) +++ user/jmallett/octeon/sys/fs/devfs/devfs_vnops.c Wed Jun 2 04:13:10 2010 (r208725) @@ -459,6 +459,13 @@ devfs_close(struct vop_close_args *ap) int vp_locked, error; /* + * XXX: Don't call d_close() if we were called because of + * XXX: insmntque1() failure. + */ + if (vp->v_data == NULL) + return (0); + + /* * Hack: a tty device that is a controlling terminal * has a reference from the session structure. * We cannot easily tell that a character device is Modified: user/jmallett/octeon/sys/kern/subr_taskqueue.c ============================================================================== --- user/jmallett/octeon/sys/kern/subr_taskqueue.c Tue Jun 1 22:46:57 2010 (r208724) +++ user/jmallett/octeon/sys/kern/subr_taskqueue.c Wed Jun 2 04:13:10 2010 (r208725) @@ -51,13 +51,12 @@ struct taskqueue { const char *tq_name; taskqueue_enqueue_fn tq_enqueue; void *tq_context; + struct task *tq_running; struct mtx tq_mutex; struct thread **tq_threads; int tq_tcount; int tq_spin; int tq_flags; - int tq_tasks_running; - int tq_task_waiters; }; #define TQ_FLAGS_ACTIVE (1 << 0) @@ -234,15 +233,14 @@ taskqueue_run(struct taskqueue *queue) STAILQ_REMOVE_HEAD(&queue->tq_queue, ta_link); pending = task->ta_pending; task->ta_pending = 0; - queue->tq_tasks_running++; + queue->tq_running = task; TQ_UNLOCK(queue); task->ta_func(task->ta_context, pending); TQ_LOCK(queue); - queue->tq_tasks_running--; - if (queue->tq_task_waiters > 0) - wakeup(task); + queue->tq_running = NULL; + wakeup(task); } /* @@ -258,21 +256,15 @@ taskqueue_drain(struct taskqueue *queue, { if (queue->tq_spin) { /* XXX */ mtx_lock_spin(&queue->tq_mutex); - while (task->ta_pending != 0 || queue->tq_tasks_running > 0) { - queue->tq_task_waiters++; + while (task->ta_pending != 0 || task == queue->tq_running) msleep_spin(task, &queue->tq_mutex, "-", 0); - queue->tq_task_waiters--; - } mtx_unlock_spin(&queue->tq_mutex); } else { WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, __func__); mtx_lock(&queue->tq_mutex); - while (task->ta_pending != 0 || queue->tq_tasks_running > 0) { - queue->tq_task_waiters++; + while (task->ta_pending != 0 || task == queue->tq_running) msleep(task, &queue->tq_mutex, PWAIT, "-", 0); - queue->tq_task_waiters--; - } mtx_unlock(&queue->tq_mutex); } } Modified: user/jmallett/octeon/sys/mips/mips/pmap.c ============================================================================== --- user/jmallett/octeon/sys/mips/mips/pmap.c Tue Jun 1 22:46:57 2010 (r208724) +++ user/jmallett/octeon/sys/mips/mips/pmap.c Wed Jun 2 04:13:10 2010 (r208725) @@ -1403,7 +1403,8 @@ pmap_pvh_free(struct md_page *pvh, pmap_ pv = pmap_pvh_remove(pvh, pmap, va); KASSERT(pv != NULL, ("pmap_pvh_free: pv not found, pa %lx va %lx", - (u_long)VM_PAGE_TO_PHYS(m), (u_long)va)); + (u_long)VM_PAGE_TO_PHYS(member2struct(vm_page, md, pvh)), + (u_long)va)); free_pv_entry(pv); } Modified: user/jmallett/octeon/sys/net80211/ieee80211_hwmp.c ============================================================================== --- user/jmallett/octeon/sys/net80211/ieee80211_hwmp.c Tue Jun 1 22:46:57 2010 (r208724) +++ user/jmallett/octeon/sys/net80211/ieee80211_hwmp.c Wed Jun 2 04:13:10 2010 (r208725) @@ -707,6 +707,9 @@ hwmp_recv_preq(struct ieee80211vap *vap, rtorig = ieee80211_mesh_rt_find(vap, preq->preq_origaddr); if (rtorig == NULL) rtorig = ieee80211_mesh_rt_add(vap, preq->preq_origaddr); + if (rtorig == NULL) + /* XXX stat */ + return; hrorig = IEEE80211_MESH_ROUTE_PRIV(rtorig, struct ieee80211_hwmp_route); /* * Sequence number validation. Modified: user/jmallett/octeon/sys/net80211/ieee80211_ioctl.c ============================================================================== --- user/jmallett/octeon/sys/net80211/ieee80211_ioctl.c Tue Jun 1 22:46:57 2010 (r208724) +++ user/jmallett/octeon/sys/net80211/ieee80211_ioctl.c Wed Jun 2 04:13:10 2010 (r208725) @@ -1518,6 +1518,7 @@ setmlme_assoc_adhoc(struct ieee80211vap memcpy(vap->iv_des_ssid[0].ssid, ssid, ssid_len); vap->iv_des_nssid = 1; + memset(&sr, 0, sizeof(sr)); sr.sr_flags = IEEE80211_IOC_SCAN_ACTIVE | IEEE80211_IOC_SCAN_ONCE; sr.sr_duration = IEEE80211_IOC_SCAN_FOREVER; memcpy(sr.sr_ssid[0].ssid, ssid, ssid_len); @@ -1627,8 +1628,10 @@ ieee80211_ioctl_setchanlist(struct ieee8 if (list == NULL) return ENOMEM; error = copyin(ireq->i_data, list, ireq->i_len); - if (error) + if (error) { + free(list, M_TEMP); return error; + } nchan = 0; chanlist = list + ireq->i_len; /* NB: zero'd already */ maxchan = ireq->i_len * NBBY; @@ -1644,8 +1647,10 @@ ieee80211_ioctl_setchanlist(struct ieee8 nchan++; } } - if (nchan == 0) + if (nchan == 0) { + free(list, M_TEMP); return EINVAL; + } if (ic->ic_bsschan != IEEE80211_CHAN_ANYC && /* XXX */ isclr(chanlist, ic->ic_bsschan->ic_ieee)) ic->ic_bsschan = IEEE80211_CHAN_ANYC; Modified: user/jmallett/octeon/sys/net80211/ieee80211_scan_sta.c ============================================================================== --- user/jmallett/octeon/sys/net80211/ieee80211_scan_sta.c Tue Jun 1 22:46:57 2010 (r208724) +++ user/jmallett/octeon/sys/net80211/ieee80211_scan_sta.c Wed Jun 2 04:13:10 2010 (r208725) @@ -1013,7 +1013,7 @@ match_bss(struct ieee80211vap *vap, */ if (se->se_capinfo & (IEEE80211_CAPINFO_IBSS|IEEE80211_CAPINFO_ESS)) fail |= MATCH_CAPINFO; - else if (se->se_meshid == NULL) + else if (&se->se_meshid == NULL) fail |= MATCH_MESH_NOID; else if (ms->ms_idlen != 0 && match_id(se->se_meshid, ms->ms_id, ms->ms_idlen)) Modified: user/jmallett/octeon/sys/powerpc/booke/pmap.c ============================================================================== --- user/jmallett/octeon/sys/powerpc/booke/pmap.c Tue Jun 1 22:46:57 2010 (r208724) +++ user/jmallett/octeon/sys/powerpc/booke/pmap.c Wed Jun 2 04:13:10 2010 (r208725) @@ -1621,7 +1621,7 @@ mmu_booke_enter_locked(mmu_t mmu, pmap_t * are turning execute permissions on, icache should * be flushed. */ - if ((flags & (PTE_UX | PTE_SX)) == 0) + if ((pte->flags & (PTE_UX | PTE_SX)) == 0) sync++; } Modified: user/jmallett/octeon/sys/sun4v/sun4v/pmap.c ============================================================================== --- user/jmallett/octeon/sys/sun4v/sun4v/pmap.c Tue Jun 1 22:46:57 2010 (r208724) +++ user/jmallett/octeon/sys/sun4v/sun4v/pmap.c Wed Jun 2 04:13:10 2010 (r208725) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-user@FreeBSD.ORG Wed Jun 2 07:21:23 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BD01E106566C; Wed, 2 Jun 2010 07:21:23 +0000 (UTC) (envelope-from jmallett@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AB7928FC0C; Wed, 2 Jun 2010 07:21:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o527LNRo080373; Wed, 2 Jun 2010 07:21:23 GMT (envelope-from jmallett@svn.freebsd.org) Received: (from jmallett@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o527LNT1080372; Wed, 2 Jun 2010 07:21:23 GMT (envelope-from jmallett@svn.freebsd.org) Message-Id: <201006020721.o527LNT1080372@svn.freebsd.org> From: Juli Mallett Date: Wed, 2 Jun 2010 07:21:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r208726 - user/jmallett/octeon/sys/mips/cavium X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Jun 2010 07:21:23 -0000 Author: jmallett Date: Wed Jun 2 07:21:23 2010 New Revision: 208726 URL: http://svn.freebsd.org/changeset/base/208726 Log: Use a little-endian bus space for PCI accesses. Added: user/jmallett/octeon/sys/mips/cavium/octopci_bus_space.c user/jmallett/octeon/sys/mips/cavium/octopcivar.h Modified: user/jmallett/octeon/sys/mips/cavium/files.octeon1 user/jmallett/octeon/sys/mips/cavium/octopci.c Modified: user/jmallett/octeon/sys/mips/cavium/files.octeon1 ============================================================================== --- user/jmallett/octeon/sys/mips/cavium/files.octeon1 Wed Jun 2 04:13:10 2010 (r208725) +++ user/jmallett/octeon/sys/mips/cavium/files.octeon1 Wed Jun 2 07:21:23 2010 (r208726) @@ -27,6 +27,7 @@ mips/cavium/octe/octe.c optional octe mips/cavium/octe/octebus.c optional octe mips/cavium/octopci.c optional pci +mips/cavium/octopci_bus_space.c optional pci contrib/octeon-sdk/cvmx-cmd-queue.c optional octe contrib/octeon-sdk/cvmx-fpa.c optional octe Modified: user/jmallett/octeon/sys/mips/cavium/octopci.c ============================================================================== --- user/jmallett/octeon/sys/mips/cavium/octopci.c Wed Jun 2 04:13:10 2010 (r208725) +++ user/jmallett/octeon/sys/mips/cavium/octopci.c Wed Jun 2 07:21:23 2010 (r208726) @@ -57,6 +57,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include "pcib_if.h" @@ -193,7 +194,7 @@ octopci_alloc_resource(device_t bus, dev return (NULL); rman_set_rid(res, *rid); - rman_set_bustag(res, mips_bus_space_generic); + rman_set_bustag(res, octopci_bus_space); switch (type) { case SYS_RES_MEMORY: Added: user/jmallett/octeon/sys/mips/cavium/octopci_bus_space.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/jmallett/octeon/sys/mips/cavium/octopci_bus_space.c Wed Jun 2 07:21:23 2010 (r208726) @@ -0,0 +1,583 @@ +/* $NetBSD: bus.h,v 1.12 1997/10/01 08:25:15 fvdl Exp $ */ +/*- + * $Id: bus.h,v 1.6 2007/08/09 11:23:32 katta Exp $ + * + * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, + * NASA Ames Research Center. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the NetBSD + * Foundation, Inc. and its contributors. + * 4. Neither the name of The NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * Copyright (c) 1996 Charles M. Hannum. All rights reserved. + * Copyright (c) 1996 Christopher G. Demetriou. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Christopher G. Demetriou + * for the NetBSD Project. + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * from: src/sys/alpha/include/bus.h,v 1.5 1999/08/28 00:38:40 peter + * $FreeBSD: user/jmallett/octeon/sys/mips/mips/bus_space_octopci.c 207417 2010-04-30 03:14:47Z jmallett $ + */ +#include +__FBSDID("$FreeBSD: user/jmallett/octeon/sys/mips/mips/bus_space_octopci.c 207417 2010-04-30 03:14:47Z jmallett $"); + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include + +#include + +#include + +static struct bus_space octopci_space = { + /* cookie */ + (void *) 0, + + /* mapping/unmapping */ + octopci_bs_map, + octopci_bs_unmap, + octopci_bs_subregion, + + /* allocation/deallocation */ + NULL, + NULL, + + /* barrier */ + octopci_bs_barrier, + + /* read (single) */ + octopci_bs_r_1, + octopci_bs_r_2, + octopci_bs_r_4, + NULL, + + /* read multiple */ + octopci_bs_rm_1, + octopci_bs_rm_2, + octopci_bs_rm_4, + NULL, + + /* read region */ + octopci_bs_rr_1, + octopci_bs_rr_2, + octopci_bs_rr_4, + NULL, + + /* write (single) */ + octopci_bs_w_1, + octopci_bs_w_2, + octopci_bs_w_4, + NULL, + + /* write multiple */ + octopci_bs_wm_1, + octopci_bs_wm_2, + octopci_bs_wm_4, + NULL, + + /* write region */ + NULL, + octopci_bs_wr_2, + octopci_bs_wr_4, + NULL, + + /* set multiple */ + NULL, + NULL, + NULL, + NULL, + + /* set region */ + NULL, + octopci_bs_sr_2, + octopci_bs_sr_4, + NULL, + + /* copy */ + NULL, + octopci_bs_c_2, + NULL, + NULL, + + /* read (single) stream */ + octopci_bs_r_1, + octopci_bs_r_2, + octopci_bs_r_4, + NULL, + + /* read multiple stream */ + octopci_bs_rm_1, + octopci_bs_rm_2, + octopci_bs_rm_4, + NULL, + + /* read region stream */ + octopci_bs_rr_1, + octopci_bs_rr_2, + octopci_bs_rr_4, + NULL, + + /* write (single) stream */ + octopci_bs_w_1, + octopci_bs_w_2, + octopci_bs_w_4, + NULL, + + /* write multiple stream */ + octopci_bs_wm_1, + octopci_bs_wm_2, + octopci_bs_wm_4, + NULL, + + /* write region stream */ + NULL, + octopci_bs_wr_2, + octopci_bs_wr_4, + NULL, +}; + +#define rd8(a) cvmx_read64_uint8(a) +#define rd16(a) le16toh(cvmx_read64_uint16(a)) +#define rd32(a) le32toh(cvmx_read64_uint32(a)) +#define wr8(a, v) cvmx_write64_uint8(a, v) +#define wr16(a, v) cvmx_write64_uint16(a, htole16(v)) +#define wr32(a, v) cvmx_write64_uint32(a, htole32(v)) + +/* octopci bus_space tag */ +bus_space_tag_t octopci_bus_space = &octopci_space; + +int +octopci_bs_map(void *t __unused, bus_addr_t addr, + bus_size_t size __unused, int flags __unused, + bus_space_handle_t *bshp) +{ + + *bshp = addr; + return (0); +} + +void +octopci_bs_unmap(void *t __unused, bus_space_handle_t bh __unused, + bus_size_t size __unused) +{ + + /* Do nothing */ +} + +int +octopci_bs_subregion(void *t __unused, bus_space_handle_t handle __unused, + bus_size_t offset __unused, bus_size_t size __unused, + bus_space_handle_t *nhandle __unused) +{ + + printf("SUBREGION?!?!?!\n"); + /* Do nothing */ + return (0); +} + +uint8_t +octopci_bs_r_1(void *t, bus_space_handle_t handle, + bus_size_t offset) +{ + + return (rd8(handle + offset)); +} + +uint16_t +octopci_bs_r_2(void *t, bus_space_handle_t handle, + bus_size_t offset) +{ + + return (rd16(handle + offset)); +} + +uint32_t +octopci_bs_r_4(void *t, bus_space_handle_t handle, + bus_size_t offset) +{ + + return (rd32(handle + offset)); +} + + +void +octopci_bs_rm_1(void *t, bus_space_handle_t bsh, + bus_size_t offset, uint8_t *addr, size_t count) +{ + + while (count--) + *addr++ = rd8(bsh + offset); +} + +void +octopci_bs_rm_2(void *t, bus_space_handle_t bsh, + bus_size_t offset, uint16_t *addr, size_t count) +{ + bus_addr_t baddr = bsh + offset; + + while (count--) + *addr++ = rd16(baddr); +} + +void +octopci_bs_rm_4(void *t, bus_space_handle_t bsh, + bus_size_t offset, uint32_t *addr, size_t count) +{ + bus_addr_t baddr = bsh + offset; + + while (count--) + *addr++ = rd32(baddr); +} + + +/* + * Read `count' 1, 2, 4, or 8 byte quantities from bus space + * described by tag/handle and starting at `offset' and copy into + * buffer provided. + */ +void +octopci_bs_rr_1(void *t, bus_space_handle_t bsh, + bus_size_t offset, uint8_t *addr, size_t count) +{ + bus_addr_t baddr = bsh + offset; + + while (count--) { + *addr++ = rd8(baddr); + baddr += 1; + } +} + +void +octopci_bs_rr_2(void *t, bus_space_handle_t bsh, + bus_size_t offset, uint16_t *addr, size_t count) +{ + bus_addr_t baddr = bsh + offset; + + while (count--) { + *addr++ = rd16(baddr); + baddr += 2; + } +} + +void +octopci_bs_rr_4(void *t, bus_space_handle_t bsh, + bus_size_t offset, uint32_t *addr, size_t count) +{ + bus_addr_t baddr = bsh + offset; + + while (count--) { + *addr++ = rd32(baddr); + baddr += 4; + } +} + +/* + * Write the 1, 2, 4, or 8 byte value `value' to bus space + * described by tag/handle/offset. + */ +void +octopci_bs_w_1(void *t, bus_space_handle_t bsh, + bus_size_t offset, uint8_t value) +{ + + wr8(bsh + offset, value); +} + +void +octopci_bs_w_2(void *t, bus_space_handle_t bsh, + bus_size_t offset, uint16_t value) +{ + + wr16(bsh + offset, value); +} + +void +octopci_bs_w_4(void *t, bus_space_handle_t bsh, + bus_size_t offset, uint32_t value) +{ + + wr32(bsh + offset, value); +} + +/* + * Write `count' 1, 2, 4, or 8 byte quantities from the buffer + * provided to bus space described by tag/handle/offset. + */ +void +octopci_bs_wm_1(void *t, bus_space_handle_t bsh, + bus_size_t offset, const uint8_t *addr, size_t count) +{ + bus_addr_t baddr = bsh + offset; + + while (count--) + wr8(baddr, *addr++); +} + +void +octopci_bs_wm_2(void *t, bus_space_handle_t bsh, + bus_size_t offset, const uint16_t *addr, size_t count) +{ + bus_addr_t baddr = bsh + offset; + + while (count--) + wr16(baddr, *addr++); +} + +void +octopci_bs_wm_4(void *t, bus_space_handle_t bsh, + bus_size_t offset, const uint32_t *addr, size_t count) +{ + bus_addr_t baddr = bsh + offset; + + while (count--) + wr32(baddr, *addr++); +} + +/* + * Write `count' 1, 2, 4, or 8 byte quantities from the buffer provided + * to bus space described by tag/handle starting at `offset'. + */ +void +octopci_bs_wr_1(void *t, bus_space_handle_t bsh, + bus_size_t offset, const uint8_t *addr, size_t count) +{ + bus_addr_t baddr = bsh + offset; + + while (count--) { + wr8(baddr, *addr++); + baddr += 1; + } +} + +void +octopci_bs_wr_2(void *t, bus_space_handle_t bsh, + bus_size_t offset, const uint16_t *addr, size_t count) +{ + bus_addr_t baddr = bsh + offset; + + while (count--) { + wr16(baddr, *addr++); + baddr += 2; + } +} + +void +octopci_bs_wr_4(void *t, bus_space_handle_t bsh, + bus_size_t offset, const uint32_t *addr, size_t count) +{ + bus_addr_t baddr = bsh + offset; + + while (count--) { + wr32(baddr, *addr++); + baddr += 4; + } +} + +/* + * Write the 1, 2, 4, or 8 byte value `val' to bus space described + * by tag/handle/offset `count' times. + */ +void +octopci_bs_sm_1(void *t, bus_space_handle_t bsh, + bus_size_t offset, uint8_t value, size_t count) +{ + bus_addr_t addr = bsh + offset; + + while (count--) + wr8(addr, value); +} + +void +octopci_bs_sm_2(void *t, bus_space_handle_t bsh, + bus_size_t offset, uint16_t value, size_t count) +{ + bus_addr_t addr = bsh + offset; + + while (count--) + wr16(addr, value); +} + +void +octopci_bs_sm_4(void *t, bus_space_handle_t bsh, + bus_size_t offset, uint32_t value, size_t count) +{ + bus_addr_t addr = bsh + offset; + + while (count--) + wr32(addr, value); +} + +/* + * Write `count' 1, 2, 4, or 8 byte value `val' to bus space described + * by tag/handle starting at `offset'. + */ +void +octopci_bs_sr_1(void *t, bus_space_handle_t bsh, + bus_size_t offset, uint8_t value, size_t count) +{ + bus_addr_t addr = bsh + offset; + + for (; count != 0; count--, addr++) + wr8(addr, value); +} + +void +octopci_bs_sr_2(void *t, bus_space_handle_t bsh, + bus_size_t offset, uint16_t value, size_t count) +{ + bus_addr_t addr = bsh + offset; + + for (; count != 0; count--, addr += 2) + wr16(addr, value); +} + +void +octopci_bs_sr_4(void *t, bus_space_handle_t bsh, + bus_size_t offset, uint32_t value, size_t count) +{ + bus_addr_t addr = bsh + offset; + + for (; count != 0; count--, addr += 4) + wr32(addr, value); +} + +/* + * Copy `count' 1, 2, 4, or 8 byte values from bus space starting + * at tag/bsh1/off1 to bus space starting at tag/bsh2/off2. + */ +void +octopci_bs_c_1(void *t, bus_space_handle_t bsh1, + bus_size_t off1, bus_space_handle_t bsh2, + bus_size_t off2, size_t count) +{ + bus_addr_t addr1 = bsh1 + off1; + bus_addr_t addr2 = bsh2 + off2; + + if (addr1 >= addr2) { + /* src after dest: copy forward */ + for (; count != 0; count--, addr1++, addr2++) + wr8(addr2, rd8(addr1)); + } else { + /* dest after src: copy backwards */ + for (addr1 += (count - 1), addr2 += (count - 1); + count != 0; count--, addr1--, addr2--) + wr8(addr2, rd8(addr1)); + } +} + +void +octopci_bs_c_2(void *t, bus_space_handle_t bsh1, + bus_size_t off1, bus_space_handle_t bsh2, + bus_size_t off2, size_t count) +{ + bus_addr_t addr1 = bsh1 + off1; + bus_addr_t addr2 = bsh2 + off2; + + if (addr1 >= addr2) { + /* src after dest: copy forward */ + for (; count != 0; count--, addr1 += 2, addr2 += 2) + wr16(addr2, rd16(addr1)); + } else { + /* dest after src: copy backwards */ + for (addr1 += 2 * (count - 1), addr2 += 2 * (count - 1); + count != 0; count--, addr1 -= 2, addr2 -= 2) + wr16(addr2, rd16(addr1)); + } +} + +void +octopci_bs_c_4(void *t, bus_space_handle_t bsh1, + bus_size_t off1, bus_space_handle_t bsh2, + bus_size_t off2, size_t count) +{ + bus_addr_t addr1 = bsh1 + off1; + bus_addr_t addr2 = bsh2 + off2; + + if (addr1 >= addr2) { + /* src after dest: copy forward */ + for (; count != 0; count--, addr1 += 4, addr2 += 4) + wr32(addr2, rd32(addr1)); + } else { + /* dest after src: copy backwards */ + for (addr1 += 4 * (count - 1), addr2 += 4 * (count - 1); + count != 0; count--, addr1 -= 4, addr2 -= 4) + wr32(addr2, rd32(addr1)); + } +} + +void +octopci_bs_barrier(void *t __unused, + bus_space_handle_t bsh __unused, + bus_size_t offset __unused, bus_size_t len __unused, + int flags) +{ +#if 0 + if (flags & BUS_SPACE_BARRIER_WRITE) + mips_dcache_wbinv_all(); +#endif +} Added: user/jmallett/octeon/sys/mips/cavium/octopcivar.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/jmallett/octeon/sys/mips/cavium/octopcivar.h Wed Jun 2 07:21:23 2010 (r208726) @@ -0,0 +1,35 @@ +/*- + * Copyright (c) 2010 Juli Mallett + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ +#ifndef _MIPS_CAVIUM_OCTOPCIVAR_H +#define _MIPS_CAVIUM_OCTOPCIVAR_H + +DECLARE_BUS_SPACE_PROTOTYPES(octopci); + +extern bus_space_tag_t octopci_bus_space; + +#endif /* !_MIPS_CAVIUM_OCTOPCIVAR_H */ From owner-svn-src-user@FreeBSD.ORG Wed Jun 2 07:28:12 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A4036106564A; Wed, 2 Jun 2010 07:28:12 +0000 (UTC) (envelope-from jmallett@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 93F3C8FC1D; Wed, 2 Jun 2010 07:28:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o527SCYJ081905; Wed, 2 Jun 2010 07:28:12 GMT (envelope-from jmallett@svn.freebsd.org) Received: (from jmallett@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o527SCcC081903; Wed, 2 Jun 2010 07:28:12 GMT (envelope-from jmallett@svn.freebsd.org) Message-Id: <201006020728.o527SCcC081903@svn.freebsd.org> From: Juli Mallett Date: Wed, 2 Jun 2010 07:28:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r208727 - user/jmallett/octeon/sys/mips/cavium X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Jun 2010 07:28:12 -0000 Author: jmallett Date: Wed Jun 2 07:28:12 2010 New Revision: 208727 URL: http://svn.freebsd.org/changeset/base/208727 Log: Add a comment. Modified: user/jmallett/octeon/sys/mips/cavium/octopci.c Modified: user/jmallett/octeon/sys/mips/cavium/octopci.c ============================================================================== --- user/jmallett/octeon/sys/mips/cavium/octopci.c Wed Jun 2 07:21:23 2010 (r208726) +++ user/jmallett/octeon/sys/mips/cavium/octopci.c Wed Jun 2 07:28:12 2010 (r208727) @@ -110,6 +110,12 @@ octopci_attach(device_t dev) struct octopci_softc *sc; int error; + /* + * XXX + * We currently rely on U-Boot to set up the PCI in host state. We + * should properly initialize the PCI bus here. + */ + sc = device_get_softc(dev); sc->sc_dev = dev; sc->sc_domain = 0; From owner-svn-src-user@FreeBSD.ORG Wed Jun 2 11:08:56 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E035D106566C; Wed, 2 Jun 2010 11:08:56 +0000 (UTC) (envelope-from jmallett@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D02468FC20; Wed, 2 Jun 2010 11:08:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o52B8uFJ036014; Wed, 2 Jun 2010 11:08:56 GMT (envelope-from jmallett@svn.freebsd.org) Received: (from jmallett@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o52B8udH036012; Wed, 2 Jun 2010 11:08:56 GMT (envelope-from jmallett@svn.freebsd.org) Message-Id: <201006021108.o52B8udH036012@svn.freebsd.org> From: Juli Mallett Date: Wed, 2 Jun 2010 11:08:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r208738 - user/jmallett/octeon/sys/contrib/octeon-sdk X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Jun 2010 11:08:57 -0000 Author: jmallett Date: Wed Jun 2 11:08:56 2010 New Revision: 208738 URL: http://svn.freebsd.org/changeset/base/208738 Log: Spell typeof in the preferred way for the FreeBSD kernel. Modified: user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-asm.h Modified: user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-asm.h ============================================================================== --- user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-asm.h Wed Jun 2 11:06:03 2010 (r208737) +++ user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-asm.h Wed Jun 2 11:08:56 2010 (r208738) @@ -225,12 +225,12 @@ extern "C" { unsigned long _v; \ ASM_STMT ("rdhwr\t%0,$31\n" \ "\tsll\t%0,%0,0" : "=d"(_v)); \ - result = (typeof(result))_v; \ + result = (__typeof__(result))_v; \ } \ } else { \ unsigned long _v; \ ASM_STMT ("rdhwr\t%0,$" CVMX_TMP_STR(regstr) : "=d"(_v)); \ - result = (typeof(result))_v; \ + result = (__typeof__(result))_v; \ }}) From owner-svn-src-user@FreeBSD.ORG Wed Jun 2 11:13:50 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0F902106566B; Wed, 2 Jun 2010 11:13:50 +0000 (UTC) (envelope-from jmallett@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DA53D8FC16; Wed, 2 Jun 2010 11:13:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o52BDncY037111; Wed, 2 Jun 2010 11:13:49 GMT (envelope-from jmallett@svn.freebsd.org) Received: (from jmallett@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o52BDnOn037108; Wed, 2 Jun 2010 11:13:49 GMT (envelope-from jmallett@svn.freebsd.org) Message-Id: <201006021113.o52BDnOn037108@svn.freebsd.org> From: Juli Mallett Date: Wed, 2 Jun 2010 11:13:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r208739 - user/jmallett/octeon/sys/mips/conf X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Jun 2010 11:13:50 -0000 Author: jmallett Date: Wed Jun 2 11:13:49 2010 New Revision: 208739 URL: http://svn.freebsd.org/changeset/base/208739 Log: Add some more devices for my testing. Pulling over amd64 GENERIC and doing a new config from there at some point probably makes good sense. Modified: user/jmallett/octeon/sys/mips/conf/OCTEON1 user/jmallett/octeon/sys/mips/conf/OCTEON1-32 Modified: user/jmallett/octeon/sys/mips/conf/OCTEON1 ============================================================================== --- user/jmallett/octeon/sys/mips/conf/OCTEON1 Wed Jun 2 11:08:56 2010 (r208738) +++ user/jmallett/octeon/sys/mips/conf/OCTEON1 Wed Jun 2 11:13:49 2010 (r208739) @@ -88,6 +88,36 @@ device octe device bpf device random +# Wireless NIC cards +device wlan # 802.11 support +options IEEE80211_DEBUG # enable debug msgs +options IEEE80211_AMPDU_AGE # age frames in AMPDU reorder q's +options IEEE80211_SUPPORT_MESH # enable 802.11s draft support +device wlan_wep # 802.11 WEP support +device wlan_ccmp # 802.11 CCMP support +device wlan_tkip # 802.11 TKIP support +device wlan_amrr # AMRR transmit rate control algorithm +device ath # Atheros pci/cardbus NIC's +device ath_hal # pci/cardbus chip support +options AH_SUPPORT_AR5416 # enable AR5416 tx/rx descriptors +device ath_rate_sample # SampleRate tx rate control for ath + +# USB support +device uhci # UHCI PCI->USB interface +device ohci # OHCI PCI->USB interface +device ehci # EHCI PCI->USB interface (USB 2.0) +device usb # USB Bus (required) + +# ATA and ATAPI devices +device ata +device atadisk # ATA disk drives +device ataraid # ATA RAID drives +device atapicd # ATAPI CDROM drives +options ATA_STATIC_ID # Static device numbering + +# PCI Ethernet +device re + # # Use the following for Compact Flash file-system device cf Modified: user/jmallett/octeon/sys/mips/conf/OCTEON1-32 ============================================================================== --- user/jmallett/octeon/sys/mips/conf/OCTEON1-32 Wed Jun 2 11:08:56 2010 (r208738) +++ user/jmallett/octeon/sys/mips/conf/OCTEON1-32 Wed Jun 2 11:13:49 2010 (r208739) @@ -99,6 +99,16 @@ device ohci # OHCI PCI->USB interface device ehci # EHCI PCI->USB interface (USB 2.0) device usb # USB Bus (required) +# ATA and ATAPI devices +device ata +device atadisk # ATA disk drives +device ataraid # ATA RAID drives +device atapicd # ATAPI CDROM drives +options ATA_STATIC_ID # Static device numbering + +# PCI Ethernet +device re + # # Use the following for Compact Flash file-system device cf From owner-svn-src-user@FreeBSD.ORG Wed Jun 2 11:15:13 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 551621065673; Wed, 2 Jun 2010 11:15:13 +0000 (UTC) (envelope-from jmallett@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 451118FC19; Wed, 2 Jun 2010 11:15:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o52BFDDc037483; Wed, 2 Jun 2010 11:15:13 GMT (envelope-from jmallett@svn.freebsd.org) Received: (from jmallett@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o52BFDkC037481; Wed, 2 Jun 2010 11:15:13 GMT (envelope-from jmallett@svn.freebsd.org) Message-Id: <201006021115.o52BFDkC037481@svn.freebsd.org> From: Juli Mallett Date: Wed, 2 Jun 2010 11:15:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r208740 - user/jmallett/octeon/sys/mips/cavium X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Jun 2010 11:15:13 -0000 Author: jmallett Date: Wed Jun 2 11:15:12 2010 New Revision: 208740 URL: http://svn.freebsd.org/changeset/base/208740 Log: Note some lurking problems with io ports (namely the dependence on virtual mappings.) Modified: user/jmallett/octeon/sys/mips/cavium/octopci.c Modified: user/jmallett/octeon/sys/mips/cavium/octopci.c ============================================================================== --- user/jmallett/octeon/sys/mips/cavium/octopci.c Wed Jun 2 11:13:49 2010 (r208739) +++ user/jmallett/octeon/sys/mips/cavium/octopci.c Wed Jun 2 11:15:12 2010 (r208740) @@ -208,6 +208,15 @@ octopci_alloc_resource(device_t bus, dev break; case SYS_RES_IOPORT: rman_set_bushandle(res, CVMX_ADDR_DID(CVMX_FULL_DID(CVMX_OCT_DID_PCI, CVMX_OCT_SUBDID_PCI_IO)) + rman_get_start(res)); + /* + * XXX + * We should just disallow use of io ports on !n64 since without + * 64-bit PTEs we can't even do a 32-bit virtual address + * mapped to them. + */ +#if 0 + rman_set_virtual(res, (void *)rman_get_bushandle(res)); +#endif break; } From owner-svn-src-user@FreeBSD.ORG Wed Jun 2 11:21:36 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 011E3106564A; Wed, 2 Jun 2010 11:21:36 +0000 (UTC) (envelope-from jmallett@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E10E18FC14; Wed, 2 Jun 2010 11:21:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o52BLZCF038934; Wed, 2 Jun 2010 11:21:35 GMT (envelope-from jmallett@svn.freebsd.org) Received: (from jmallett@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o52BLZKC038911; Wed, 2 Jun 2010 11:21:35 GMT (envelope-from jmallett@svn.freebsd.org) Message-Id: <201006021121.o52BLZKC038911@svn.freebsd.org> From: Juli Mallett Date: Wed, 2 Jun 2010 11:21:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r208741 - in user/jmallett/octeon: bin/chio games/pom lib/libc/gen lib/libgssapi lib/libpmc lib/msun/man libexec/rbootd share/man/man4 share/man/man9 sys/kern sys/sys tools/regression/u... X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Jun 2010 11:21:36 -0000 Author: jmallett Date: Wed Jun 2 11:21:35 2010 New Revision: 208741 URL: http://svn.freebsd.org/changeset/base/208741 Log: Merge from head (loopback toolchain changes.) Added: user/jmallett/octeon/tools/regression/usr.bin/jot/regress.rand1.out - copied unchanged from r208740, head/tools/regression/usr.bin/jot/regress.rand1.out user/jmallett/octeon/tools/regression/usr.bin/jot/regress.rand2.out - copied unchanged from r208740, head/tools/regression/usr.bin/jot/regress.rand2.out user/jmallett/octeon/tools/regression/usr.bin/jot/regress.stutter2.out - copied unchanged from r208740, head/tools/regression/usr.bin/jot/regress.stutter2.out Modified: user/jmallett/octeon/bin/chio/chio.c user/jmallett/octeon/games/pom/pom.6 user/jmallett/octeon/lib/libc/gen/scandir.3 user/jmallett/octeon/lib/libgssapi/gss_compare_name.3 user/jmallett/octeon/lib/libpmc/pmc.ucf.3 user/jmallett/octeon/lib/msun/man/atan2.3 user/jmallett/octeon/lib/msun/man/remainder.3 user/jmallett/octeon/libexec/rbootd/rbootd.8 user/jmallett/octeon/share/man/man4/acpi.4 user/jmallett/octeon/share/man/man4/mpt.4 user/jmallett/octeon/share/man/man9/make_dev.9 user/jmallett/octeon/sys/kern/posix4_mib.c user/jmallett/octeon/sys/kern/uipc_sem.c user/jmallett/octeon/sys/sys/posix4.h user/jmallett/octeon/tools/regression/usr.bin/jot/regress.sh user/jmallett/octeon/usr.bin/join/join.1 user/jmallett/octeon/usr.bin/jot/jot.1 user/jmallett/octeon/usr.bin/jot/jot.c user/jmallett/octeon/usr.bin/newkey/newkey.8 Directory Properties: user/jmallett/octeon/ (props changed) Modified: user/jmallett/octeon/bin/chio/chio.c ============================================================================== --- user/jmallett/octeon/bin/chio/chio.c Wed Jun 2 11:15:12 2010 (r208740) +++ user/jmallett/octeon/bin/chio/chio.c Wed Jun 2 11:21:35 2010 (r208741) @@ -1072,6 +1072,7 @@ find_element(char *voltag, uint16_t *et, /* Read in the changer slots */ if (cp.cp_nslots > 0) { + (void) memset(&cesr, 0, sizeof(cesr)); cesr.cesr_element_type = CHET_ST; cesr.cesr_element_base = 0; cesr.cesr_element_count = cp.cp_nslots; Modified: user/jmallett/octeon/games/pom/pom.6 ============================================================================== --- user/jmallett/octeon/games/pom/pom.6 Wed Jun 2 11:15:12 2010 (r208740) +++ user/jmallett/octeon/games/pom/pom.6 Wed Jun 2 11:21:35 2010 (r208741) @@ -34,6 +34,7 @@ .\" .Dd May 31, 1993 .Dt POM 6 +.Os .Sh NAME .Nm pom .Nd display the phase of the moon Modified: user/jmallett/octeon/lib/libc/gen/scandir.3 ============================================================================== --- user/jmallett/octeon/lib/libc/gen/scandir.3 Wed Jun 2 11:15:12 2010 (r208740) +++ user/jmallett/octeon/lib/libc/gen/scandir.3 Wed Jun 2 11:21:35 2010 (r208741) @@ -40,7 +40,7 @@ .Sh SYNOPSIS .In dirent.h .Ft int -.Fn scandir "const char *dirname" "struct dirent ***namelist" "int \\*(lp*select\\*(rp\\*(lpconst struct dirent *\\*(rp" "int \\*(lp*compar\\*(rp\\*(lpconst struct dirent **, const struct dirent **\\*(rp" +.Fn scandir "const char *dirname" "struct dirent ***namelist" "int \*(lp*select\*(rp\*(lpconst struct dirent *\*(rp" "int \*(lp*compar\*(rp\*(lpconst struct dirent **, const struct dirent **\*(rp" .Ft int .Fn alphasort "const struct dirent **d1" "const struct dirent **d2" .Sh DESCRIPTION Modified: user/jmallett/octeon/lib/libgssapi/gss_compare_name.3 ============================================================================== --- user/jmallett/octeon/lib/libgssapi/gss_compare_name.3 Wed Jun 2 11:15:12 2010 (r208740) +++ user/jmallett/octeon/lib/libgssapi/gss_compare_name.3 Wed Jun 2 11:21:35 2010 (r208741) @@ -28,7 +28,7 @@ .\" .\" The following commands are required for all man pages. .Dd January 26, 2010 -.Dt GSS_COMPARE_NAME PRM +.Dt GSS_COMPARE_NAME 3 PRM .Os .Sh NAME .Nm gss_compare_name Modified: user/jmallett/octeon/lib/libpmc/pmc.ucf.3 ============================================================================== --- user/jmallett/octeon/lib/libpmc/pmc.ucf.3 Wed Jun 2 11:15:12 2010 (r208740) +++ user/jmallett/octeon/lib/libpmc/pmc.ucf.3 Wed Jun 2 11:21:35 2010 (r208741) @@ -111,5 +111,3 @@ The library was written by .An "Joseph Koshy" .Aq jkoshy@FreeBSD.org . - - Modified: user/jmallett/octeon/lib/msun/man/atan2.3 ============================================================================== --- user/jmallett/octeon/lib/msun/man/atan2.3 Wed Jun 2 11:15:12 2010 (r208740) +++ user/jmallett/octeon/lib/msun/man/atan2.3 Wed Jun 2 11:21:35 2010 (r208741) @@ -114,7 +114,7 @@ if .Ar x > 0, .It Ta sign( Ns Ar y Ns )*(\*(Pi - -.Fn atan "\\*(Bay/x\\*(Ba" ) Ta +.Fn atan "\*(Bay/x\*(Ba" ) Ta if .Ar x < 0, @@ -122,7 +122,7 @@ if .No 0 Ta if x = y = 0, or .It Ta -.Pf sign( Ar y Ns )*\\*(Pi/2 Ta +.Pf sign( Ar y Ns )*\*(Pi/2 Ta if .Ar x = 0 \(!= Modified: user/jmallett/octeon/lib/msun/man/remainder.3 ============================================================================== --- user/jmallett/octeon/lib/msun/man/remainder.3 Wed Jun 2 11:15:12 2010 (r208740) +++ user/jmallett/octeon/lib/msun/man/remainder.3 Wed Jun 2 11:21:35 2010 (r208741) @@ -76,10 +76,10 @@ is the integer nearest the exact value o .Fa x Ns / Ns Fa y ; .Ek moreover if -.Pf \\*(Ba Fa n +.Pf \*(Ba Fa n \- .Sm off -.Fa x No / Fa y No \\*(Ba +.Fa x No / Fa y No \*(Ba .Sm on = 1/2 @@ -89,11 +89,11 @@ is even. Consequently the remainder is computed exactly and .Sm off -.Pf \\*(Ba Fa r No \\*(Ba +.Pf \*(Ba Fa r No \*(Ba .Sm on \*(Le .Sm off -.Pf \\*(Ba Fa y No \\*(Ba/2 . +.Pf \*(Ba Fa y No \*(Ba/2 . .Sm on But attempting to take the remainder when .Fa y Modified: user/jmallett/octeon/libexec/rbootd/rbootd.8 ============================================================================== --- user/jmallett/octeon/libexec/rbootd/rbootd.8 Wed Jun 2 11:15:12 2010 (r208740) +++ user/jmallett/octeon/libexec/rbootd/rbootd.8 Wed Jun 2 11:21:35 2010 (r208741) @@ -103,14 +103,14 @@ and/or comma characters. A pound sign causes the remainder of a line to be ignored. .Pp Here is a sample configuration file: -.Bl -column 08:00:09:0:66:ad SYSHPBSD,SYSHPUX -.It # -.It "# ethernet addr boot file(s) comments -.It # -.It "08:00:09:0:66:ad SYSHPBSD # snake (4.3BSD) -.It "08:00:09:0:59:5b # vandy (anything) -.It "8::9:1:C6:75 SYSHPBSD,SYSHPUX # jaguar (either) -.El +.Bd -literal +# +# ethernet addr boot file(s) comments +# +08:00:09:0:66:ad SYSHPBSD # snake (4.3BSD) +08:00:09:0:59:5b # vandy (anything) +8::9:1:C6:75 SYSHPBSD,SYSHPUX # jaguar (either) +.Ed .Pp The .Nm Modified: user/jmallett/octeon/share/man/man4/acpi.4 ============================================================================== --- user/jmallett/octeon/share/man/man4/acpi.4 Wed Jun 2 11:15:12 2010 (r208740) +++ user/jmallett/octeon/share/man/man4/acpi.4 Wed Jun 2 11:21:35 2010 (r208741) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 9, 2010 +.Dd June 2, 2010 .Dt ACPI 4 .Os .Sh NAME @@ -599,10 +599,8 @@ The .Nm CPU idle power management drive conflicts with the local APIC (LAPIC) timer. -Disable APIC mode with -.Va hint.apic.0.disabled +Disable the local APIC timer with +.Va hint.apic.0.clock=0 or do not use the -.Li C2 -and .Li C3 -states if APIC mode is enabled. +and deeper states if the local APIC timer is enabled. Modified: user/jmallett/octeon/share/man/man4/mpt.4 ============================================================================== --- user/jmallett/octeon/share/man/man4/mpt.4 Wed Jun 2 11:15:12 2010 (r208740) +++ user/jmallett/octeon/share/man/man4/mpt.4 Wed Jun 2 11:21:35 2010 (r208741) @@ -183,4 +183,3 @@ by and .An Scott Long Aq scottl@FreeBSD.org have made more substantial improvements. -.Sh BUGS Modified: user/jmallett/octeon/share/man/man9/make_dev.9 ============================================================================== --- user/jmallett/octeon/share/man/man9/make_dev.9 Wed Jun 2 11:15:12 2010 (r208740) +++ user/jmallett/octeon/share/man/man9/make_dev.9 Wed Jun 2 11:21:35 2010 (r208741) @@ -158,14 +158,14 @@ The function is equivalent to the call .Bd -literal -offset indent make_dev_credf(0, cdevsw, unit, cr, uid, gid, perms, fmt, ...); -.Ed . +.Ed .Pp The .Fn make_dev function call is the same as .Bd -literal -offset indent make_dev_credf(0, cdevsw, unit, NULL, uid, gid, perms, fmt, ...); -.Ed . +.Ed .Pp The .Fn make_dev_alias @@ -245,7 +245,7 @@ The function is the same as .Bd -literal -offset indent destroy_dev_sched(cdev, NULL, NULL); -.Ed . +.Ed .Pp The .Fn d_close Modified: user/jmallett/octeon/sys/kern/posix4_mib.c ============================================================================== --- user/jmallett/octeon/sys/kern/posix4_mib.c Wed Jun 2 11:15:12 2010 (r208740) +++ user/jmallett/octeon/sys/kern/posix4_mib.c Wed Jun 2 11:21:35 2010 (r208741) @@ -45,6 +45,8 @@ __FBSDID("$FreeBSD$"); static int facility[CTL_P1003_1B_MAXID - 1]; static int facility_initialized[CTL_P1003_1B_MAXID - 1]; +static int p31b_sysctl_proc(SYSCTL_HANDLER_ARGS); + /* OID_AUTO isn't working with sysconf(3). I guess I'd have to * modify it to do a lookup by name from the index. * For now I've left it a top-level sysctl. @@ -55,16 +57,21 @@ static int facility_initialized[CTL_P100 SYSCTL_DECL(_p1003_1b); #define P1B_SYSCTL(num, name) \ -SYSCTL_INT(_p1003_1b, num, \ - name, CTLFLAG_RD, facility + num - 1, 0, ""); + SYSCTL_INT(_p1003_1b, num, name, CTLFLAG_RD, facility + num - 1, 0, ""); +#define P1B_SYSCTL_RW(num, name) \ + SYSCTL_PROC(_p1003_1b, num, name, CTLTYPE_INT | CTLFLAG_RW, NULL, num, \ + p31b_sysctl_proc, "I", ""); #else SYSCTL_DECL(_kern_p1003_1b); #define P1B_SYSCTL(num, name) \ -SYSCTL_INT(_kern_p1003_1b, OID_AUTO, \ - name, CTLFLAG_RD, facility + num - 1, 0, ""); + SYSCTL_INT(_kern_p1003_1b, OID_AUTO, name, CTLFLAG_RD, \ + facility + num - 1, 0, ""); +#define P1B_SYSCTL_RW(num, name) \ + SYSCTL_PROC(_p1003_1b, OID_AUTO, name, CTLTYPE_INT | CTLFLAG_RW, NULL, \ + num, p31b_sysctl_proc, "I", ""); SYSCTL_NODE(_kern, OID_AUTO, p1003_1b, CTLFLAG_RW, 0, "P1003.1B"); #endif @@ -91,13 +98,28 @@ P1B_SYSCTL(CTL_P1003_1B_DELAYTIMER_MAX, P1B_SYSCTL(CTL_P1003_1B_MQ_OPEN_MAX, mq_open_max); P1B_SYSCTL(CTL_P1003_1B_PAGESIZE, pagesize); P1B_SYSCTL(CTL_P1003_1B_RTSIG_MAX, rtsig_max); -P1B_SYSCTL(CTL_P1003_1B_SEM_NSEMS_MAX, sem_nsems_max); +P1B_SYSCTL_RW(CTL_P1003_1B_SEM_NSEMS_MAX, sem_nsems_max); P1B_SYSCTL(CTL_P1003_1B_SEM_VALUE_MAX, sem_value_max); P1B_SYSCTL(CTL_P1003_1B_SIGQUEUE_MAX, sigqueue_max); P1B_SYSCTL(CTL_P1003_1B_TIMER_MAX, timer_max); #define P31B_VALID(num) ((num) >= 1 && (num) < CTL_P1003_1B_MAXID) +static int +p31b_sysctl_proc(SYSCTL_HANDLER_ARGS) +{ + int error, num, val; + + num = arg2; + if (!P31B_VALID(num)) + return (EINVAL); + val = facility_initialized[num] ? facility[num - 1] : 0; + error = sysctl_handle_int(oidp, &val, 0, req); + if (error == 0 && req->newptr != NULL && facility_initialized[num]) + facility[num - 1] = val; + return (error); +} + /* p31b_setcfg: Set the configuration */ void @@ -110,6 +132,14 @@ p31b_setcfg(int num, int value) } } +void +p31b_unsetcfg(int num) +{ + + facility[num - 1] = 0; + facility_initialized[num -1] = 0; +} + int p31b_getcfg(int num) { Modified: user/jmallett/octeon/sys/kern/uipc_sem.c ============================================================================== --- user/jmallett/octeon/sys/kern/uipc_sem.c Wed Jun 2 11:15:12 2010 (r208740) +++ user/jmallett/octeon/sys/kern/uipc_sem.c Wed Jun 2 11:21:35 2010 (r208741) @@ -976,6 +976,8 @@ ksem_module_destroy(void) sx_destroy(&ksem_dict_lock); mtx_destroy(&ksem_count_lock); mtx_destroy(&sem_lock); + p31b_unsetcfg(CTL_P1003_1B_SEM_VALUE_MAX); + p31b_unsetcfg(CTL_P1003_1B_SEM_NSEMS_MAX); } static int Modified: user/jmallett/octeon/sys/sys/posix4.h ============================================================================== --- user/jmallett/octeon/sys/sys/posix4.h Wed Jun 2 11:15:12 2010 (r208740) +++ user/jmallett/octeon/sys/sys/posix4.h Wed Jun 2 11:21:35 2010 (r208741) @@ -64,6 +64,7 @@ int p31b_proc(struct proc *, pid_t, stru void p31b_setcfg(int, int); int p31b_getcfg(int); int p31b_iscfg(int); +void p31b_unsetcfg(int); #ifdef _KPOSIX_PRIORITY_SCHEDULING Copied: user/jmallett/octeon/tools/regression/usr.bin/jot/regress.rand1.out (from r208740, head/tools/regression/usr.bin/jot/regress.rand1.out) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/jmallett/octeon/tools/regression/usr.bin/jot/regress.rand1.out Wed Jun 2 11:21:35 2010 (r208741, copy of r208740, head/tools/regression/usr.bin/jot/regress.rand1.out) @@ -0,0 +1,10 @@ +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 Copied: user/jmallett/octeon/tools/regression/usr.bin/jot/regress.rand2.out (from r208740, head/tools/regression/usr.bin/jot/regress.rand2.out) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/jmallett/octeon/tools/regression/usr.bin/jot/regress.rand2.out Wed Jun 2 11:21:35 2010 (r208741, copy of r208740, head/tools/regression/usr.bin/jot/regress.rand2.out) @@ -0,0 +1,10 @@ +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 Modified: user/jmallett/octeon/tools/regression/usr.bin/jot/regress.sh ============================================================================== --- user/jmallett/octeon/tools/regression/usr.bin/jot/regress.sh Wed Jun 2 11:15:12 2010 (r208740) +++ user/jmallett/octeon/tools/regression/usr.bin/jot/regress.sh Wed Jun 2 11:21:35 2010 (r208741) @@ -1,6 +1,6 @@ # $FreeBSD$ -echo 1..57 +echo 1..60 REGRESSION_START($1) @@ -32,12 +32,15 @@ REGRESSION_TEST(`hddd2', `jot 30 - - -') REGRESSION_TEST(`dhhh2', `jot - 20 160 2') REGRESSION_TEST(`dhhd2', `jot - 20 160 -') REGRESSION_TEST(`ddhh2', `jot - - 160 2') +REGRESSION_TEST(`rand1', `jot -r 10000 0 9 | sort -u') +REGRESSION_TEST(`rand2', `jot -r 10000 9 0 | sort -u') REGRESSION_TEST(`n21', `jot 21 -1 1.00') REGRESSION_TEST(`ascii', `jot -c 128 0') REGRESSION_TEST(`xaa', `jot -w xa%c 26 a') REGRESSION_TEST(`yes', `jot -b yes 10') REGRESSION_TEST(`ed', `jot -w %ds/old/new/ 30 2 - 5') REGRESSION_TEST(`stutter', `jot - 9 0 -.5') +REGRESSION_TEST(`stutter2', `jot -w %d - 9.5 0 -.5') REGRESSION_TEST(`block', `jot -b x 512') REGRESSION_TEST(`tabs', `jot -s, - 10 132 4') REGRESSION_TEST(`grep', `jot -s "" -b . 80') Copied: user/jmallett/octeon/tools/regression/usr.bin/jot/regress.stutter2.out (from r208740, head/tools/regression/usr.bin/jot/regress.stutter2.out) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/jmallett/octeon/tools/regression/usr.bin/jot/regress.stutter2.out Wed Jun 2 11:21:35 2010 (r208741, copy of r208740, head/tools/regression/usr.bin/jot/regress.stutter2.out) @@ -0,0 +1,20 @@ +9 +9 +8 +8 +7 +7 +6 +6 +5 +5 +4 +4 +3 +3 +2 +2 +1 +1 +0 +0 Modified: user/jmallett/octeon/usr.bin/join/join.1 ============================================================================== --- user/jmallett/octeon/usr.bin/join/join.1 Wed Jun 2 11:15:12 2010 (r208740) +++ user/jmallett/octeon/usr.bin/join/join.1 Wed Jun 2 11:21:35 2010 (r208741) @@ -48,8 +48,6 @@ .Oc .Op Fl e Ar string .Op Fl o Ar list -.Bk -words -.Ek .Op Fl t Ar char .Op Fl 1 Ar field .Op Fl 2 Ar field Modified: user/jmallett/octeon/usr.bin/jot/jot.1 ============================================================================== --- user/jmallett/octeon/usr.bin/jot/jot.1 Wed Jun 2 11:15:12 2010 (r208740) +++ user/jmallett/octeon/usr.bin/jot/jot.1 Wed Jun 2 11:21:35 2010 (r208741) @@ -32,7 +32,7 @@ .\" @(#)jot.1 8.1 (Berkeley) 6/6/93 .\" $FreeBSD$ .\" -.Dd February 19, 2010 +.Dd June 2, 2010 .Dt JOT 1 .Os .Sh NAME @@ -167,6 +167,86 @@ The name derives in part from .Nm iota , a function in APL. +.Ss Rounding and truncation +The +.Nm +utility uses double precision floating point arithmetic internally. +Before printing a number, it is converted depending on the output +format used. +.Pp +If no output format is specified or the output format is a +floating point format +.Po +.Sq E , +.Sq G , +.Sq e , +.Sq f , +or +.Sq g +.Pc , +the value is rounded using the +.Xr printf 3 +function, taking into account the requested precision. +.Pp +If the output format is an integer format +.Po +.Sq D , +.Sq O , +.Sq U , +.Sq X , +.Sq c , +.Sq d , +.Sq i , +.Sq o , +.Sq u , +or +.Sq x +.Pc , +the value is converted to an integer value by truncation. +.Pp +As an illustration, consider the following command: +.Bd -literal -offset indent +$ jot 6 1 10 0.5 +1 +2 +2 +2 +3 +4 +.Ed +.Pp +By requesting an explicit precision of 1, the values generated before rounding +can be seen. +The .5 values are rounded down if the integer part is even, +up otherwise. +.Bd -literal -offset indent +$ jot -p 1 6 1 10 0.5 +1.0 +1.5 +2.0 +2.5 +3.0 +3.5 +.Ed +.Pp +By offsetting the values slightly, the values generated by the following +command are always rounded down: +.Bd -literal -offset indent +$ jot -p 0 6 .9999999999 10 0.5 +1 +1 +2 +2 +3 +3 +.Ed +.Pp +Another way of achieving the same result is to force truncation by +specifying an integer format: +.Bd -literal -offset indent +$ jot -w %d 6 1 10 0.5 +.Ed +.Pp .Sh EXIT STATUS .Ex -std .Sh EXAMPLES @@ -201,9 +281,9 @@ the result of .Dl jot -w %ds/old/new/ 30 2 - 5 .Pp The stuttering sequence 9, 9, 8, 8, 7, etc.\& can be -produced by suitable choice of step size, +produced by truncating the output precision and a suitable choice of step size, as in -.Dl jot - 9 0 -.5 +.Dl jot -w %d - 9.5 0 -.5 .Pp and a file containing exactly 1024 bytes is created with .Dl jot -b x 512 > block Modified: user/jmallett/octeon/usr.bin/jot/jot.c ============================================================================== --- user/jmallett/octeon/usr.bin/jot/jot.c Wed Jun 2 11:15:12 2010 (r208740) +++ user/jmallett/octeon/usr.bin/jot/jot.c Wed Jun 2 11:21:35 2010 (r208741) @@ -77,7 +77,7 @@ __FBSDID("$FreeBSD$"); #define is_default(s) (*(s) == 0 || strcmp((s), "-") == 0) static bool boring; -static int prec; +static int prec = -1; static bool longdata; static bool intdata; static bool chardata; @@ -128,7 +128,7 @@ main(int argc, char **argv) break; case 'p': prec = atoi(optarg); - if (prec <= 0) + if (prec < 0) errx(1, "bad precision value"); have_format = true; break; @@ -159,7 +159,7 @@ main(int argc, char **argv) if (!sscanf(argv[2], "%lf", &ender)) ender = argv[2][strlen(argv[2])-1]; mask |= HAVE_ENDER; - if (!prec) + if (prec < 0) n = getprec(argv[2]); } /* FALLTHROUGH */ @@ -168,7 +168,7 @@ main(int argc, char **argv) if (!sscanf(argv[1], "%lf", &begin)) begin = argv[1][strlen(argv[1])-1]; mask |= HAVE_BEGIN; - if (!prec) + if (prec < 0) prec = getprec(argv[1]); if (n > prec) /* maximum precision */ prec = n; @@ -188,6 +188,10 @@ main(int argc, char **argv) argv[4]); } getformat(); + + if (prec == -1) + prec = 0; + while (mask) /* 4 bit mask has 1's where last 4 args were given */ switch (mask) { /* fill in the 0's by default or computation */ case HAVE_STEP: @@ -284,13 +288,16 @@ main(int argc, char **argv) if (!have_format && prec == 0 && begin >= 0 && begin < divisor && ender >= 0 && ender < divisor) { - ender += 1; + if (begin <= ender) + ender += 1; + else + begin += 1; nosign = true; intdata = true; (void)strlcpy(format, chardata ? "%c" : "%u", sizeof(format)); } - x = (ender - begin) * (ender > begin ? 1 : -1); + x = ender - begin; for (i = 1; i <= reps || infinity; i++) { if (use_random) y = random() / divisor; Modified: user/jmallett/octeon/usr.bin/newkey/newkey.8 ============================================================================== --- user/jmallett/octeon/usr.bin/newkey/newkey.8 Wed Jun 2 11:15:12 2010 (r208740) +++ user/jmallett/octeon/usr.bin/newkey/newkey.8 Wed Jun 2 11:21:35 2010 (r208741) @@ -16,13 +16,13 @@ The .Nm utility is normally run by the network administrator on the Network Interface Service -(\s-1NIS\s0) +.Pq NIS master machine in order to establish public keys for users and super-users on the network. These keys are needed for using secure RPC or secure -NFS\s0. +NFS . .Pp The .Nm @@ -52,8 +52,8 @@ password of the given username. .Xr keyserv 8 .Sh NOTES The Network Information Service -(\s-1NIS\s0) +.Pq NIS was formerly known as Sun Yellow Pages -(\s-1YP\s0). +.Pq YP . The functionality of the two remains the same; only the name has changed. From owner-svn-src-user@FreeBSD.ORG Thu Jun 3 11:22:29 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6DF9D1065675; Thu, 3 Jun 2010 11:22:29 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail04.syd.optusnet.com.au (mail04.syd.optusnet.com.au [211.29.132.185]) by mx1.freebsd.org (Postfix) with ESMTP id 0846C8FC25; Thu, 3 Jun 2010 11:22:28 +0000 (UTC) Received: from c122-106-160-243.carlnfd1.nsw.optusnet.com.au (c122-106-160-243.carlnfd1.nsw.optusnet.com.au [122.106.160.243]) by mail04.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id o53BMObX023897 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 3 Jun 2010 21:22:26 +1000 Date: Thu, 3 Jun 2010 21:22:24 +1000 (EST) From: Bruce Evans X-X-Sender: bde@delplex.bde.org To: Juli Mallett In-Reply-To: <201006021108.o52B8udH036012@svn.freebsd.org> Message-ID: <20100603205323.P27876@delplex.bde.org> References: <201006021108.o52B8udH036012@svn.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: Re: svn commit: r208738 - user/jmallett/octeon/sys/contrib/octeon-sdk X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Jun 2010 11:22:29 -0000 > Log: > Spell typeof in the preferred way for the FreeBSD kernel. Thanks, but that way is __typeof... > Modified: user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-asm.h > ============================================================================== > --- user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-asm.h Wed Jun 2 11:06:03 2010 (r208737) > +++ user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-asm.h Wed Jun 2 11:08:56 2010 (r208738) > @@ -225,12 +225,12 @@ extern "C" { > unsigned long _v; \ > ASM_STMT ("rdhwr\t%0,$31\n" \ > "\tsll\t%0,%0,0" : "=d"(_v)); \ > - result = (typeof(result))_v; \ > + result = (__typeof__(result))_v; \ > } \ ... typeof is not just an unpreferred spelling, but a syntax error (if compiled by a C compiler or by gcc -pedantic), while __typeof__ is a just an unpreferred (gnuish) spelling. > } else { \ > unsigned long _v; \ > ASM_STMT ("rdhwr\t%0,$" CVMX_TMP_STR(regstr) : "=d"(_v)); \ > - result = (typeof(result))_v; \ > + result = (__typeof__(result))_v; \ > }}) More syntax errors. Careful code uses __extension__. Here the excessive underscores must be used because the gnuish spelling for __extension__ is not aliased to a good spelling. 27 lines in RELENG_9 use some form of typeof, and 10 of them actually have the preferred spelling, with the unpreferred one mainly in newer non-core code: xfs: 6 lines with typeof, but 2 of these #define typeof as __typeof if typeof is not defined, which should be always reiserfs: 2 lines with __typeof__ drm: 4 lines with __typeof nxge: 1 line with __typeof net: 1 line with __typeof i386/include: 1 line with _typeof by me; 2 lines with __typeof__ (xen) xen: 5 lines with typeof amd64/include: 1 line with _typeof by me; 2 lines with __typeof__ (xen) sys: 2 lines with __typeof Bruce