svn commit: r204110 - head/lib/libc/nls
Author: gabor Date: Sat Feb 20 08:19:19 2010 New Revision: 204110 URL: http://svn.freebsd.org/changeset/base/204110 Log: - More style(9) fixups Approved by: delphij (mentor) Modified: head/lib/libc/nls/msgcat.c Modified: head/lib/libc/nls/msgcat.c == --- head/lib/libc/nls/msgcat.c Sat Feb 20 07:34:37 2010(r204109) +++ head/lib/libc/nls/msgcat.c Sat Feb 20 08:19:19 2010(r204110) @@ -60,34 +60,35 @@ __FBSDID("$FreeBSD$"); #define _DEFAULT_NLS_PATH "/usr/share/nls/%L/%N.cat:/usr/share/nls/%N/%L:/usr/local/share/nls/%L/%N.cat:/usr/local/share/nls/%N/%L" -#define RLOCK(fail){ int ret; \ - if (__isthreaded && \ - ((ret = _pthread_rwlock_rdlock(&rwlock)) != 0)) { \ - errno = ret; \ - return (fail); \ +#define RLOCK(fail){ int ret; \ + if (__isthreaded && \ + ((ret = _pthread_rwlock_rdlock(&rwlock)) != 0)) { \ + errno = ret; \ + return (fail); \ }} -#define WLOCK(fail){ int ret; \ - if (__isthreaded && \ - ((ret = _pthread_rwlock_wrlock(&rwlock)) != 0)) { \ - errno = ret; \ - return (fail); \ +#define WLOCK(fail){ int ret; \ + if (__isthreaded && \ + ((ret = _pthread_rwlock_wrlock(&rwlock)) != 0)) { \ + errno = ret; \ + return (fail); \ }} -#define UNLOCK { if (__isthreaded) \ +#define UNLOCK { if (__isthreaded) \ _pthread_rwlock_unlock(&rwlock); } #defineNLERR ((nl_catd) -1) #define NLRETERR(errc) { errno = errc; return (NLERR); } -#define SAVEFAIL(n, l, e) { WLOCK(NLERR); \ - np = malloc(sizeof(struct catentry)); \ - if (np != NULL) { \ - np->name = strdup(n); \ - np->path = NULL; \ - np->lang = (l == NULL) ? NULL : strdup(l); \ - np->caterrno = e; \ - SLIST_INSERT_HEAD(&cache, np, list); \ - } \ - UNLOCK; \ - errno = e; \ +#define SAVEFAIL(n, l, e) { WLOCK(NLERR); \ + np = malloc(sizeof(struct catentry)); \ + if (np != NULL) { \ + np->name = strdup(n); \ + np->path = NULL; \ + np->lang = (l == NULL) ? NULL : \ + strdup(l); \ + np->caterrno = e; \ + SLIST_INSERT_HEAD(&cache, np, list); \ + } \ + UNLOCK; \ + errno = e; \ } static nl_catd load_msgcat(const char *, const char *, const char *); @@ -209,7 +210,7 @@ catopen(const char *name, int type) break; case '%': ++nlspath; - /* fallthrough */ + /* FALLTHROUGH */ default: if (pathP - path >= sizeof(path) - 1) @@ -369,7 +370,8 @@ load_msgcat(const char *path, const char /* path/name will never be NULL here */ - /* One more try in cache; if it was not found by name, + /* +* One more try in cache; if it was not found by name, * it might still be found by absolute path.
Re: svn commit: r204044 - head/release/scripts
On 19/02/2010 1:45 AM, Ken Smith wrote: > Author: kensmith > Date: Thu Feb 18 15:45:43 2010 > New Revision: 204044 > URL: http://svn.freebsd.org/changeset/base/204044 > > Log: > Provide a script that can be used to create the memstick images. For now > it isn't being integrated into 'make release' because for the forseeable > future the memstick images will be identical to what's on the DVD except > for which package set is provided. If/when what's on the memstick diverges > from what's on the DVD it would make more sense to generate a "memstick" > directory in $CHROOT/R/cdrom and build the memstick image along with the > ISO images. > > Reviewed by:jhb, ru, Garrett Cooper (yanefbsd at gmail dot com) > > Added: > head/release/scripts/make-memstick.sh (contents, props changed) > > Added: head/release/scripts/make-memstick.sh > == > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/release/scripts/make-memstick.sh Thu Feb 18 15:45:43 2010 > (r204044) > @@ -0,0 +1,83 @@ > +#!/bin/sh > +# > +# This script generates a "memstick image" (image that can be copied to a > +# USB memory stick) from a directory tree. Note that the script does not > +# clean up after itself very well for error conditions on purpose so the > +# problem can be diagnosed (full filesystem most likely but ...). > +# > +# Usage: make-memstick.sh > +# > +# $FreeBSD$ > +# > + > +PATH=/bin:/usr/bin:/sbin:/usr/sbin > +export PATH > + > +BLOCKSIZE=10240 > + > +if [ $# -ne 2 ]; then > + echo "make-memstick.sh /path/to/directory /path/to/image/file" > + exit 1 > +fi > + > +tempfile="${2}.$$" > + > +if [ ! -d ${1} ]; then > + echo "${1} must be a directory" > + exit 1 > +fi > + > +if [ -e ${2} ]; then > + echo "won't overwrite ${2}" > + exit 1 > +fi > + > +rm -f ${tempfile} > +makefs ${tempfile} ${1} > +if [ $? -ne 0 ]; then > + echo "makefs failed" > + exit 1 > +fi > + > +# > +# Use $BLOCKSIZE for transfers to improve efficiency. When calculating > +# how many blocks to transfer "+ 2" is to account for truncation in the > +# division and to provide space for the label. > +# > + > +filesize=`stat -f "%z" ${tempfile}` > +blocks=$(($filesize / ${BLOCKSIZE} + 2)) > +dd if=/dev/zero of=${2} bs=${BLOCKSIZE} count=${blocks} > +if [ $? -ne 0 ]; then > + echo "creation of image file failed" > + exit 1 > +fi > + > +unit=`mdconfig -a -t vnode -f ${2}` > +if [ $? -ne 0 ]; then > + echo "mdconfig failed" > + exit 1 > +fi > + > +fdisk -BIq /dev/${unit} > +if [ $? -ne 0 ]; then > + echo "fdisk failed" > + exit 1 > +fi > + > +bsdlabel -B -w /dev/${unit} > +if [ $? -ne 0 ]; then > + echo "bsdlabel failed" > + exit 1 > +fi > + > +dd if=${tempfile} of=/dev/${unit}a bs=$BLOCKSIZE conv=sync > +if [ $? -ne 0 ]; then > + echo "copying filesystem into image file failed" > + exit 1 > +fi > + > +mdconfig -d -u ${unit} > + > +rm -f ${tempfile} > + > ___ > svn-src-head@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/svn-src-head > To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org" > I think trap should be used to clean up the tempfile in the case of the script exiting before cleaning it up. -- Andrew D. Boyd (dec...@gmail.com) ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r204111 - in head: lib/libarchive sbin/restore sys/dev/cxgb/ulp/iw_cxgb sys/fs/ext2fs sys/fs/msdosfs usr.bin/cpio usr.bin/tar usr.bin/tar/test usr.bin/xinstall usr.sbin/mtree
Author: uqs Date: Sat Feb 20 10:19:19 2010 New Revision: 204111 URL: http://svn.freebsd.org/changeset/base/204111 Log: Fix common misspelling of hierarchy Pointed out by: bf1783 at gmail Approved by: np (cxgb), kientzle (tar, etc.), philip (mentor) Modified: head/lib/libarchive/archive_write_disk.3 head/sbin/restore/restore.h head/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_qp.c head/sys/fs/ext2fs/ext2_vnops.c head/sys/fs/msdosfs/msdosfs_vnops.c head/usr.bin/cpio/bsdcpio.1 head/usr.bin/tar/test/test_option_T.c head/usr.bin/tar/test/test_option_s.c head/usr.bin/tar/tree.c head/usr.bin/xinstall/xinstall.c head/usr.sbin/mtree/mtree.5 Modified: head/lib/libarchive/archive_write_disk.3 == --- head/lib/libarchive/archive_write_disk.3Sat Feb 20 08:19:19 2010 (r204110) +++ head/lib/libarchive/archive_write_disk.3Sat Feb 20 10:19:19 2010 (r204111) @@ -339,7 +339,7 @@ In particular, the directory .Pa aa is created as well as the final object .Pa bb . -In theory, this can be exploited to create an entire directory heirarchy +In theory, this can be exploited to create an entire directory hierarchy with a single request. Of course, this does not work if the .Cm ARCHIVE_EXTRACT_NODOTDOT @@ -371,5 +371,5 @@ compact implementation when appropriate. .Pp There should be a corresponding .Nm archive_read_disk -interface that walks a directory heirarchy and returns archive +interface that walks a directory hierarchy and returns archive entry objects. Modified: head/sbin/restore/restore.h == --- head/sbin/restore/restore.h Sat Feb 20 08:19:19 2010(r204110) +++ head/sbin/restore/restore.h Sat Feb 20 10:19:19 2010(r204111) @@ -41,7 +41,7 @@ extern int bflag; /* set input block size */ extern int dflag; /* print out debugging info */ extern int Dflag; /* degraded mode - try hard to get stuff back */ -extern int hflag; /* restore heirarchies */ +extern int hflag; /* restore hierarchies */ extern int mflag; /* restore by name instead of inode number */ extern int Nflag; /* do not write the disk */ extern int uflag; /* unlink symlink targets */ Modified: head/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_qp.c == --- head/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_qp.c Sat Feb 20 08:19:19 2010 (r204110) +++ head/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_qp.c Sat Feb 20 10:19:19 2010 (r204111) @@ -675,7 +675,7 @@ static void __flush_qp(struct iwch_qp *q qhp->refcnt++; mtx_unlock(&qhp->lock); - /* locking heirarchy: cq lock first, then qp lock. */ + /* locking hierarchy: cq lock first, then qp lock. */ mtx_lock(&rchp->lock); mtx_lock(&qhp->lock); cxio_flush_hw_cq(&rchp->cq); @@ -685,7 +685,7 @@ static void __flush_qp(struct iwch_qp *q mtx_unlock(&rchp->lock); (*rchp->ibcq.comp_handler)(&rchp->ibcq, rchp->ibcq.cq_context); - /* locking heirarchy: cq lock first, then qp lock. */ + /* locking hierarchy: cq lock first, then qp lock. */ mtx_lock(&schp->lock); mtx_lock(&qhp->lock); cxio_flush_hw_cq(&schp->cq); Modified: head/sys/fs/ext2fs/ext2_vnops.c == --- head/sys/fs/ext2fs/ext2_vnops.c Sat Feb 20 08:19:19 2010 (r204110) +++ head/sys/fs/ext2fs/ext2_vnops.c Sat Feb 20 10:19:19 2010 (r204111) @@ -894,7 +894,7 @@ abortit: /* * If ".." must be changed (ie the directory gets a new * parent) then the source directory must not be in the -* directory heirarchy above the target, as this would +* directory hierarchy above the target, as this would * orphan everything below the source directory. Also * the user must have write permission in the source so * as to be able to change "..". We must repeat the call Modified: head/sys/fs/msdosfs/msdosfs_vnops.c == --- head/sys/fs/msdosfs/msdosfs_vnops.c Sat Feb 20 08:19:19 2010 (r204110) +++ head/sys/fs/msdosfs/msdosfs_vnops.c Sat Feb 20 10:19:19 2010 (r204111) @@ -1072,7 +1072,7 @@ abortit: /* * If ".." must be changed (ie the directory gets a new * parent) then the source directory must not be in the -* directory heirarchy above the target, as this would +* directory hierarchy above the target, as this would * orphan everything below the source directory. Also * the user must have write permission in the source so * as to be able to change "..". We must repeat
Re: svn commit: r204101 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
On Fri, Feb 19, 2010 at 08:18:17PM +, Pawel Jakub Dawidek wrote: > Author: pjd > Date: Fri Feb 19 20:18:16 2010 > New Revision: 204101 > URL: http://svn.freebsd.org/changeset/base/204101 > > Don't set f_bsize to recordsize. It might confuse some software (like squid). Can submitter (or maybe you, Pawel) elaborate on the subject please? Particularly, what exactly breaks squid and in what way? This was not immediately obvious from reading the diff. Thanks. ./danfe ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r204103 - in head/usr.bin: . seq
On Fri, Feb 19, 2010 at 11:54:12PM +, Xin LI wrote: > Author: delphij > Date: Fri Feb 19 23:54:12 2010 > New Revision: 204103 > URL: http://svn.freebsd.org/changeset/base/204103 > > Log: > Add seq(1), a small utility to generate sequence number. Why do we need this when we have jot(1)? ./danfe ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r204101 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
On 2010-02-20 12:56, Alexey Dokuchaev wrote: URL: http://svn.freebsd.org/changeset/base/204101 Don't set f_bsize to recordsize. It might confuse some software (like squid). Can submitter (or maybe you, Pawel) elaborate on the subject please? Particularly, what exactly breaks squid and in what way? This was not immediately obvious from reading the diff. Thanks. See here for the original post to -current: http://lists.freebsd.org/pipermail/freebsd-current/2010-February/015494.html ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r204101 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
On Sat, Feb 20, 2010 at 02:19:34PM +0100, Dimitry Andric wrote: > On 2010-02-20 12:56, Alexey Dokuchaev wrote: > >>URL: http://svn.freebsd.org/changeset/base/204101 > >> > >>Don't set f_bsize to recordsize. It might confuse some software (like > >>squid). > > > >Can submitter (or maybe you, Pawel) elaborate on the subject please? > >Particularly, what exactly breaks squid and in what way? > > See here for the original post to -current: > > http://lists.freebsd.org/pipermail/freebsd-current/2010-February/015494.html Thanks a lot, Dimitry, this quite answers my question. ./danfe ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r204118 - head/sys/amd64/include
Author: ed Date: Sat Feb 20 13:33:50 2010 New Revision: 204118 URL: http://svn.freebsd.org/changeset/base/204118 Log: Add . This header file uses __packed, without including . This means it cannot be used in the way described in sysarch(3) by only including . Modified: head/sys/amd64/include/sysarch.h Modified: head/sys/amd64/include/sysarch.h == --- head/sys/amd64/include/sysarch.hSat Feb 20 12:48:44 2010 (r204117) +++ head/sys/amd64/include/sysarch.hSat Feb 20 13:33:50 2010 (r204118) @@ -35,6 +35,8 @@ #ifndef _MACHINE_SYSARCH_H_ #define _MACHINE_SYSARCH_H_ +#include + #define I386_GET_LDT 0 #define I386_SET_LDT 1 #defineLDT_AUTO_ALLOC 0x ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r204103 - in head/usr.bin: . seq
On Sat, 20.02.2010 at 11:58:38 +, Alexey Dokuchaev wrote: > On Fri, Feb 19, 2010 at 11:54:12PM +, Xin LI wrote: > > Author: delphij > > Date: Fri Feb 19 23:54:12 2010 > > New Revision: 204103 > > URL: http://svn.freebsd.org/changeset/base/204103 > > > > Log: > > Add seq(1), a small utility to generate sequence number. > > Why do we need this when we have jot(1)? Compatibility with shell scripts, I suppose. Some ports may use seq(1) in their test or build targets, etc. There is no jot(1) on any Linux or Solaris I've seen so usage of seq(1) is fairly common. I wonder though, if we could merge functionality into jot(1) and employ a link to seq. Uli ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r204103 - in head/usr.bin: . seq
On Sat, Feb 20, 2010 at 02:35:20PM +0100, Ulrich Sp??rlein wrote: > On Sat, 20.02.2010 at 11:58:38 +, Alexey Dokuchaev wrote: > > Why do we need [seq] when we have jot(1)? > > Compatibility with shell scripts, I suppose. Some ports may use seq(1) > in their test or build targets, etc. There is no jot(1) on any Linux or > Solaris I've seen so usage of seq(1) is fairly common. True, jot(1) is BSD specific. But if we speak for ports, trivial patch can turn seq(1) expression into jot(1) one, thus getting rid of gratuitous dependency. > I wonder though, if we could merge functionality into jot(1) and employ > a link to seq. I would probably be OK with the last suggestion. :-) ./danfe ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r204120 - head/sys/amd64/include
Author: ed Date: Sat Feb 20 14:13:47 2010 New Revision: 204120 URL: http://svn.freebsd.org/changeset/base/204120 Log: Remove redundant inclusion of . In my previous commit I should have moved the inclusion to the top, instead of adding a second one. Modified: head/sys/amd64/include/sysarch.h Modified: head/sys/amd64/include/sysarch.h == --- head/sys/amd64/include/sysarch.hSat Feb 20 13:35:05 2010 (r204119) +++ head/sys/amd64/include/sysarch.hSat Feb 20 14:13:47 2010 (r204120) @@ -70,8 +70,6 @@ struct i386_ioperm_args { }; #ifndef _KERNEL -#include - __BEGIN_DECLS int amd64_get_fsbase(void **); int amd64_get_gsbase(void **); ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r204103 - in head/usr.bin: . seq
On Sat, Feb 20, 2010 at 5:35 AM, Ulrich Spörlein wrote: > On Sat, 20.02.2010 at 11:58:38 +, Alexey Dokuchaev wrote: >> On Fri, Feb 19, 2010 at 11:54:12PM +, Xin LI wrote: >> > Author: delphij >> > Date: Fri Feb 19 23:54:12 2010 >> > New Revision: 204103 >> > URL: http://svn.freebsd.org/changeset/base/204103 >> > >> > Log: >> > Add seq(1), a small utility to generate sequence number. >> >> Why do we need this when we have jot(1)? > > Compatibility with shell scripts, I suppose. Some ports may use seq(1) > in their test or build targets, etc. There is no jot(1) on any Linux or > Solaris I've seen so usage of seq(1) is fairly common. Yes exactly. > I wonder though, if we could merge functionality into jot(1) and employ > a link to seq. The primary difference between the two is the command line parsing and option handling and seq uses double number. I think we will not benefit a lot from the shared code unfortunately... Cheers, -- Xin LI http://www.delphij.net ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r204121 - head/sys/arm/include
Author: kevlo Date: Sat Feb 20 14:52:07 2010 New Revision: 204121 URL: http://svn.freebsd.org/changeset/base/204121 Log: Correct both FA526/FA626TE cpu ids since the cpu id is always masked with 0xfff0 Modified: head/sys/arm/include/armreg.h Modified: head/sys/arm/include/armreg.h == --- head/sys/arm/include/armreg.h Sat Feb 20 14:13:47 2010 (r204120) +++ head/sys/arm/include/armreg.h Sat Feb 20 14:52:07 2010 (r204121) @@ -151,8 +151,8 @@ #define CPU_ID_MV88FR131 0x56251310 /* Marvell Feroceon 88FR131 Core */ #define CPU_ID_MV88FR571_VD0x56155710 /* Marvell Feroceon 88FR571-VD Core (ID from datasheet) */ #defineCPU_ID_MV88FR571_41 0x41159260 /* Marvell Feroceon 88FR571-VD Core (actual ID from CPU reg) */ -#defineCPU_ID_FA5260x66015261 -#defineCPU_ID_FA626TE 0x66056261 +#defineCPU_ID_FA5260x66015260 +#defineCPU_ID_FA626TE 0x66056260 #define CPU_ID_SA1110 0x6901b110 #define CPU_ID_IXP1200 0x6901c120 #define CPU_ID_80200 0x69052000 ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r204122 - in head/sys/arm: arm include
Author: kevlo Date: Sat Feb 20 14:54:11 2010 New Revision: 204122 URL: http://svn.freebsd.org/changeset/base/204122 Log: Show the cpu info for fa526 Submitted by: Yohanes Nugroho Modified: head/sys/arm/arm/cpufunc.c head/sys/arm/arm/identcpu.c head/sys/arm/include/md_var.h Modified: head/sys/arm/arm/cpufunc.c == --- head/sys/arm/arm/cpufunc.c Sat Feb 20 14:52:07 2010(r204121) +++ head/sys/arm/arm/cpufunc.c Sat Feb 20 14:54:11 2010(r204122) @@ -2119,7 +2119,8 @@ fa526_setup(char *args) cpuctrl = CPU_CONTROL_MMU_ENABLE | CPU_CONTROL_32BP_ENABLE | CPU_CONTROL_32BD_ENABLE | CPU_CONTROL_SYST_ENABLE | CPU_CONTROL_IC_ENABLE | CPU_CONTROL_DC_ENABLE -| CPU_CONTROL_WBUF_ENABLE | CPU_CONTROL_LABT_ENABLE; +| CPU_CONTROL_WBUF_ENABLE | CPU_CONTROL_LABT_ENABLE + | CPU_CONTROL_BPRD_ENABLE; cpuctrlmask = CPU_CONTROL_MMU_ENABLE | CPU_CONTROL_32BP_ENABLE | CPU_CONTROL_32BD_ENABLE | CPU_CONTROL_SYST_ENABLE | CPU_CONTROL_IC_ENABLE | CPU_CONTROL_DC_ENABLE Modified: head/sys/arm/arm/identcpu.c == --- head/sys/arm/arm/identcpu.c Sat Feb 20 14:52:07 2010(r204121) +++ head/sys/arm/arm/identcpu.c Sat Feb 20 14:54:11 2010(r204122) @@ -220,6 +220,9 @@ const struct cpuidtab cpuids[] = { generic_steppings }, { CPU_ID_ARM966ESR1,CPU_CLASS_ARM9ES, "ARM966E-S", generic_steppings }, + { CPU_ID_FA526, CPU_CLASS_ARM9, "FA526", + generic_steppings }, + { CPU_ID_TI925T,CPU_CLASS_ARM9TDMI, "TI ARM925T", generic_steppings }, @@ -317,6 +320,7 @@ const struct cpu_classtab cpu_classes[] { "ARM7", "CPU_ARM7" }, /* CPU_CLASS_ARM7 */ { "ARM7TDMI", "CPU_ARM7TDMI" }, /* CPU_CLASS_ARM7TDMI */ { "ARM8", "CPU_ARM8" }, /* CPU_CLASS_ARM8 */ + { "ARM9", "CPU_ARM9" }, /* CPU_CLASS_ARM9 */ { "ARM9TDMI", "CPU_ARM9TDMI" }, /* CPU_CLASS_ARM9TDMI */ { "ARM9E-S","CPU_ARM9E" }, /* CPU_CLASS_ARM9ES */ { "ARM9EJ-S", "CPU_ARM9E" }, /* CPU_CLASS_ARM9EJS */ Modified: head/sys/arm/include/md_var.h == --- head/sys/arm/include/md_var.h Sat Feb 20 14:52:07 2010 (r204121) +++ head/sys/arm/include/md_var.h Sat Feb 20 14:54:11 2010 (r204122) @@ -57,6 +57,7 @@ enum cpu_class { CPU_CLASS_ARM7, CPU_CLASS_ARM7TDMI, CPU_CLASS_ARM8, + CPU_CLASS_ARM9, CPU_CLASS_ARM9TDMI, CPU_CLASS_ARM9ES, CPU_CLASS_ARM9EJS, ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r204123 - in head/tools/regression/kthread: . kld
Author: attilio Date: Sat Feb 20 15:20:28 2010 New Revision: 204123 URL: http://svn.freebsd.org/changeset/base/204123 Log: Add a regression test for the kthread(9) interface. Submitted by: Giovanni Trematerra Added: head/tools/regression/kthread/ head/tools/regression/kthread/kld/ head/tools/regression/kthread/kld/Makefile (contents, props changed) head/tools/regression/kthread/kld/kthrdlk.c (contents, props changed) Added: head/tools/regression/kthread/kld/Makefile == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/kthread/kld/Makefile Sat Feb 20 15:20:28 2010 (r204123) @@ -0,0 +1,10 @@ +# $FreeBSD$ + +.PATH: ${.CURDIR} + +KMOD= kthrdlk +NO_MAN= +SRCS= kthrdlk.c +WARNS?=2 + +.include Added: head/tools/regression/kthread/kld/kthrdlk.c == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/kthread/kld/kthrdlk.c Sat Feb 20 15:20:28 2010 (r204123) @@ -0,0 +1,204 @@ +/*- + * Copyright (c) 2010 Giovanni Trematerra + * 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. + */ + +/* + * PURPOSE: + * + * This kernel module helped to identify a deadlock in kthread + * interface, also pointed out a race in kthread_exit function. + * + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef TESTPAUSE_DEBUG +#define DPRINTF(x) do { \ + printf (x); \ +} while (0) +#else +#define DPRINTF(x) +#endif + +static struct mtx test_global_lock; +static int global_condvar; +static int test_thrcnt; +volatile int QUIT; + +static void +thr_suspender(void *arg) +{ + struct thread *td = (struct thread *) arg; + int error; + + for (;;) { + if (QUIT == 1) + break; + error = kthread_suspend(td, 10*hz); + if (error != 0 && QUIT == 0) { + if (error == EWOULDBLOCK) + panic("Ooops: kthread deadlock\n"); + else + panic("kthread_suspend error: %d\n", error); + break; + } + } + + mtx_lock(&test_global_lock); + test_thrcnt--; + wakeup(&global_condvar); + mtx_unlock(&test_global_lock); + + kthread_exit(); +} + +static void +thr_resumer(void *arg) +{ + struct thread *td = (struct thread *) arg; + int error; + + for (;;) { + /* must be the last thread to exit */ + if (QUIT == 1 && test_thrcnt == 1) + break; + error = kthread_resume(td); + if (error != 0) + panic("%s: error on kthread_resume. error: %d\n", + __func__, error); + } + + mtx_lock(&test_global_lock); + test_thrcnt--; + wakeup(&global_condvar); + mtx_unlock(&test_global_lock); + + kthread_exit(); +} + +static void +thr_getsuspended(void *arg) +{ + for (;;) { + if (QUIT == 1) + break; + kthread_suspend_check(); + } + + mtx_lock(&test_global_lock); + test_thrcnt--; + wakeup(&global_condvar); + mtx_unlock(&test_global_lock); + + kthread_exit(); +} + +static void +kthrdlk_init(void) +{ +
svn commit: r204126 - head/sys/powerpc/booke
Author: nwhitehorn Date: Sat Feb 20 16:13:43 2010 New Revision: 204126 URL: http://svn.freebsd.org/changeset/base/204126 Log: Merge r198724 to Book-E. casuword() non-atomically read the current value of its argument before atomically replacing it, which could occasionally return the wrong value on an SMP system. This resulted in user mutex operations hanging when using threaded applications. Modified: head/sys/powerpc/booke/copyinout.c Modified: head/sys/powerpc/booke/copyinout.c == --- head/sys/powerpc/booke/copyinout.c Sat Feb 20 16:12:37 2010 (r204125) +++ head/sys/powerpc/booke/copyinout.c Sat Feb 20 16:13:43 2010 (r204126) @@ -295,8 +295,19 @@ casuword(volatile u_long *addr, u_long o return (EFAULT); } - val = *addr; - (void) atomic_cmpset_32((volatile uint32_t *)addr, old, new); + __asm __volatile ( + "1:\tlwarx %0, 0, %2\n\t" /* load old value */ + "cmplw %3, %0\n\t" /* compare */ + "bne 2f\n\t"/* exit if not equal */ + "stwcx. %4, 0, %2\n\t" /* attempt to store */ + "bne- 1b\n\t" /* spin if failed */ + "b 3f\n\t" /* we've succeeded */ + "2:\n\t" + "stwcx. %0, 0, %2\n\t" /* clear reservation (74xx) */ + "3:\n\t" + : "=&r" (val), "=m" (*addr) + : "r" (addr), "r" (old), "r" (new), "m" (*addr) + : "cc", "memory"); td->td_pcb->pcb_onfault = NULL; ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r204127 - head/sys/powerpc/powerpc
Author: nwhitehorn Date: Sat Feb 20 16:14:19 2010 New Revision: 204127 URL: http://svn.freebsd.org/changeset/base/204127 Log: Turn on experimental support for DEEPNAP on the 970MP. Modified: head/sys/powerpc/powerpc/cpu.c Modified: head/sys/powerpc/powerpc/cpu.c == --- head/sys/powerpc/powerpc/cpu.c Sat Feb 20 16:13:43 2010 (r204126) +++ head/sys/powerpc/powerpc/cpu.c Sat Feb 20 16:14:19 2010 (r204127) @@ -446,8 +446,16 @@ cpu_970_setup(int cpuid, uint16_t vers) : "=r" (hid0_hi), "=r" (hid0_lo) : "K" (SPR_HID0)); /* Configure power-saving mode */ - hid0_hi |= (HID0_NAP | HID0_DPM); - hid0_hi &= ~(HID0_DOZE | HID0_DEEPNAP); + switch (vers) { + case IBM970MP: + hid0_hi |= (HID0_DEEPNAP | HID0_DPM); + hid0_hi &= ~(HID0_DOZE | HID0_NAP); + break; + default: + hid0_hi |= (HID0_NAP | HID0_DPM); + hid0_hi &= ~(HID0_DOZE | HID0_DEEPNAP); + break; + } powerpc_pow_enabled = 1; __asm __volatile (" \ ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r204128 - in head/sys/powerpc: aim include
Author: nwhitehorn Date: Sat Feb 20 16:23:29 2010 New Revision: 204128 URL: http://svn.freebsd.org/changeset/base/204128 Log: Reduce KVA pressure on OEA64 systems running in bridge mode by mapping UMA segments at their physical addresses instead of into KVA. This emulates the direct mapping behavior of OEA32 in an ad-hoc way. To make this work properly required sharing the entire kernel PMAP with Open Firmware, so ofw_pmap is transformed into a stub on 64-bit CPUs. Also implement some more tweaks to get more mileage out of our limited amount of KVA, principally by extending KVA into segment 16 until the beginning of the first OFW mapping. Reported by: linimon Modified: head/sys/powerpc/aim/machdep.c head/sys/powerpc/aim/mmu_oea.c head/sys/powerpc/aim/mmu_oea64.c head/sys/powerpc/aim/uma_machdep.c head/sys/powerpc/include/sr.h head/sys/powerpc/include/vmparam.h Modified: head/sys/powerpc/aim/machdep.c == --- head/sys/powerpc/aim/machdep.c Sat Feb 20 16:14:19 2010 (r204127) +++ head/sys/powerpc/aim/machdep.c Sat Feb 20 16:23:29 2010 (r204128) @@ -198,6 +198,11 @@ cpu_startup(void *dummy) ptoa(physmem) / 1048576); realmem = physmem; + if (bootverbose) + printf("available KVA = %zd (%zd MB)\n", + virtual_end - virtual_avail, + (virtual_end - virtual_avail) / 1048576); + /* * Display any holes after the first chunk of extended memory. */ Modified: head/sys/powerpc/aim/mmu_oea.c == --- head/sys/powerpc/aim/mmu_oea.c Sat Feb 20 16:14:19 2010 (r204127) +++ head/sys/powerpc/aim/mmu_oea.c Sat Feb 20 16:23:29 2010 (r204128) @@ -909,7 +909,7 @@ moea_bootstrap(mmu_t mmup, vm_offset_t k * Set the start and end of kva. */ virtual_avail = VM_MIN_KERNEL_ADDRESS; - virtual_end = VM_MAX_KERNEL_ADDRESS; + virtual_end = VM_MAX_SAFE_KERNEL_ADDRESS; /* * Allocate a kernel stack with a guard page for thread0 and map it @@ -2413,7 +2413,7 @@ moea_unmapdev(mmu_t mmu, vm_offset_t va, * If this is outside kernel virtual space, then it's a * battable entry and doesn't require unmapping */ - if ((va >= VM_MIN_KERNEL_ADDRESS) && (va <= VM_MAX_KERNEL_ADDRESS)) { + if ((va >= VM_MIN_KERNEL_ADDRESS) && (va <= virtual_end)) { base = trunc_page(va); offset = va & PAGE_MASK; size = roundup(offset + size, PAGE_SIZE); Modified: head/sys/powerpc/aim/mmu_oea64.c == --- head/sys/powerpc/aim/mmu_oea64.cSat Feb 20 16:14:19 2010 (r204127) +++ head/sys/powerpc/aim/mmu_oea64.cSat Feb 20 16:23:29 2010 (r204128) @@ -297,9 +297,6 @@ struct pvo_head moea64_pvo_unmanaged = uma_zone_t moea64_upvo_zone; /* zone for pvo entries for unmanaged pages */ uma_zone_t moea64_mpvo_zone; /* zone for pvo entries for managed pages */ -vm_offset_tpvo_allocator_start; -vm_offset_tpvo_allocator_end; - #defineBPVO_POOL_SIZE 327680 static struct pvo_entry *moea64_bpvo_pool; static int moea64_bpvo_pool_index = 0; @@ -699,6 +696,7 @@ moea64_add_ofw_mappings(mmu_t mmup, phan struct ofw_map translations[sz/sizeof(struct ofw_map)]; register_t msr; vm_offset_t off; + vm_paddr_t pa_base; int i, ofw_mappings; bzero(translations, sz); @@ -720,33 +718,18 @@ moea64_add_ofw_mappings(mmu_t mmup, phan if (translations[i].om_pa_hi) panic("OFW translations above 32-bit boundary!"); + pa_base = translations[i].om_pa_lo; + /* Now enter the pages for this mapping */ - /* -* Lock the ofw pmap. pmap_kenter(), which we use for the -* pages the kernel also needs, does its own locking. -*/ - PMAP_LOCK(&ofw_pmap); DISABLE_TRANS(msr); for (off = 0; off < translations[i].om_len; off += PAGE_SIZE) { - struct vm_page m; - - /* Map low memory mappings into the kernel pmap, too. -* These are typically mappings made by the loader, -* so we need them if we want to keep executing. */ - - if (translations[i].om_va + off < SEGMENT_LENGTH) - moea64_kenter(mmup, translations[i].om_va + off, - translations[i].om_va + off); - - m.phys_addr = translations[i].om_pa_lo + off; - moea64_enter_locked(&ofw_pmap, -
svn commit: r204129 - head/sys/boot/powerpc/ofw
Author: nwhitehorn Date: Sat Feb 20 16:28:37 2010 New Revision: 204129 URL: http://svn.freebsd.org/changeset/base/204129 Log: Enable NETIF_OPEN_CLOSE_ONCE on PowerPC OFW. This fixes netbooting on PowerPC Book-S hardware, which had been broken for a very long time. Submitted by: Andreas Tobler MFC after:1 week Modified: head/sys/boot/powerpc/ofw/Makefile Modified: head/sys/boot/powerpc/ofw/Makefile == --- head/sys/boot/powerpc/ofw/Makefile Sat Feb 20 16:23:29 2010 (r204128) +++ head/sys/boot/powerpc/ofw/Makefile Sat Feb 20 16:28:37 2010 (r204129) @@ -56,6 +56,11 @@ CFLAGS+= -DBOOT_FORTH -I${.CURDIR}/../.. LIBFICL= ${.OBJDIR}/../../ficl/libficl.a .endif +# Avoid the open-close-dance for every file access as some firmwares perform +# an auto-negotiation on every open of the network interface and thus causes +# netbooting to take horribly long. +CFLAGS+= -DNETIF_OPEN_CLOSE_ONCE + # Always add MI sources .PATH: ${.CURDIR}/../../common .include "${.CURDIR}/../../common/Makefile.inc" ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r204130 - in head/sys/mips: include rmi
Author: rrs Date: Sat Feb 20 16:30:29 2010 New Revision: 204130 URL: http://svn.freebsd.org/changeset/base/204130 Log: Some fixes to the current RMI interrupt handling, changes in this patch are: - (cleanup) remove rmi specific 'struct mips_intrhand' - this is no longer needed since 'struct intr_event' have all the required hooks - add xlr_cpu_establish_hardintr, which has args for pre/post ithread and filter hooks, so that the PCI code can add the PCI controller interrupt ack code here - make 'cpu_establish_hardintr' use the above function. - (fix) change type of eirr/eimr from register_t to uint64_t. These have to be 64bit otherwise we cannot handle interrupts from 32. - (fix) use eimr to mask eirr before checking interrupts, so that we will not handle masked interrupts. Obtained from: C. Jayachandran - c.jayachand...@gmail.com Modified: head/sys/mips/include/intr_machdep.h head/sys/mips/rmi/interrupt.h head/sys/mips/rmi/intr_machdep.c Modified: head/sys/mips/include/intr_machdep.h == --- head/sys/mips/include/intr_machdep.hSat Feb 20 16:28:37 2010 (r204129) +++ head/sys/mips/include/intr_machdep.hSat Feb 20 16:30:29 2010 (r204130) @@ -30,21 +30,7 @@ #define_MACHINE_INTR_MACHDEP_H_ #ifdef TARGET_XLR_XLS -/* - * XLR/XLS uses its own intr_machdep.c and has - * a different number of interupts. This probably - * should be placed somewhere else. - */ - -struct mips_intrhand { -struct intr_event *mih_event; -driver_intr_t *mih_disable; -volatile long *cntp; /* interrupt counter */ -}; - -extern struct mips_intrhand mips_intr_handlers[]; #define XLR_MAX_INTR 64 - #else #define NHARD_IRQS 6 #define NSOFT_IRQS 2 Modified: head/sys/mips/rmi/interrupt.h == --- head/sys/mips/rmi/interrupt.h Sat Feb 20 16:28:37 2010 (r204129) +++ head/sys/mips/rmi/interrupt.h Sat Feb 20 16:30:29 2010 (r204130) @@ -25,7 +25,7 @@ * 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. - * + *__FBSDID("$FreeBSD$") * RMI_BSD */ #ifndef _RMI_INTERRUPT_H_ #define _RMI_INTERRUPT_H_ @@ -39,4 +39,14 @@ #define IRQ_MSGRING 6 #define IRQ_TIMER7 +/* + * XLR needs custom pre and post handlers for PCI/PCI-e interrupts + * XXX: maybe follow i386 intsrc model + */ +void xlr_cpu_establish_hardintr(const char *, driver_filter_t *, +driver_intr_t *, void *, int, int, void **, void (*)(void *), +void (*)(void *), void (*)(void *), int (*)(void *, u_char)); +void xlr_mask_hard_irq(void *); +void xlr_unmask_hard_irq(void *); + #endif /* _RMI_INTERRUPT_H_ */ Modified: head/sys/mips/rmi/intr_machdep.c == --- head/sys/mips/rmi/intr_machdep.cSat Feb 20 16:28:37 2010 (r204129) +++ head/sys/mips/rmi/intr_machdep.cSat Feb 20 16:30:29 2010 (r204130) @@ -51,19 +51,19 @@ __FBSDID("$FreeBSD$"); /*#include */ static mips_intrcnt_t mips_intr_counters[XLR_MAX_INTR]; -struct mips_intrhand mips_intr_handlers[XLR_MAX_INTR]; +static struct intr_event *mips_intr_events[XLR_MAX_INTR]; static int intrcnt_index; -static void -mips_mask_hard_irq(void *source) +void +xlr_mask_hard_irq(void *source) { uintptr_t irq = (uintptr_t) source; write_c0_eimr64(read_c0_eimr64() & ~(1ULL << irq)); } -static void -mips_unmask_hard_irq(void *source) +void +xlr_unmask_hard_irq(void *source) { uintptr_t irq = (uintptr_t) source; @@ -71,10 +71,11 @@ mips_unmask_hard_irq(void *source) } void -cpu_establish_hardintr(const char *name, driver_filter_t * filt, -void (*handler) (void *), void *arg, int irq, int flags, void **cookiep) +xlr_cpu_establish_hardintr(const char *name, driver_filter_t * filt, +void (*handler) (void *), void *arg, int irq, int flags, void **cookiep, +void (*pre_ithread)(void *), void (*post_ithread)(void *), +void (*post_filter)(void *), int (*assign_cpu)(void *, u_char)) { - struct mips_intrhand *mih; /* descriptor for the IRQ */ struct intr_event *ie; /* descriptor for the IRQ */ int errcode; @@ -85,25 +86,33 @@ cpu_establish_hardintr(const char *name, * FIXME locking - not needed now, because we do this only on * startup from CPU0 */ - mih = &mips_intr_handlers[irq]; + ie = mips_intr_events[irq]; /* mih->cntp = &intrcnt[irq]; */ - ie = mih->mih_event; if (ie == NULL) { errcode = intr_event_create(&ie, (void *)(uintptr_t) irq, 0, - irq, mips_mask_hard_irq, mips_unmask_hard_irq, - NULL, N
svn commit: r204131 - head/sys/mips/rmi
Author: rrs Date: Sat Feb 20 16:32:33 2010 New Revision: 204131 URL: http://svn.freebsd.org/changeset/base/204131 Log: Cleanups for sys/mips/rmi/bus_space_rmi.c - remove pci related code from bus_space_rmi.c, we will have another file for PCI bus space functions which will do byte-swapping. - remove local SWAP implementation - added TODO stub for unimplemented functions Obtained from:C. Jayachandran - c.jayachand...@gmail.com Modified: head/sys/mips/rmi/bus_space_rmi.c Modified: head/sys/mips/rmi/bus_space_rmi.c == --- head/sys/mips/rmi/bus_space_rmi.c Sat Feb 20 16:30:29 2010 (r204130) +++ head/sys/mips/rmi/bus_space_rmi.c Sat Feb 20 16:32:33 2010 (r204131) @@ -32,6 +32,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -42,14 +43,12 @@ __FBSDID("$FreeBSD$"); #include #include -void xlr_print_int(uint32_t); static int rmi_bus_space_map(void *t, bus_addr_t addr, bus_size_t size, int flags, bus_space_handle_t * bshp); - static void rmi_bus_space_unmap(void *t, bus_space_handle_t bsh, bus_size_t size); @@ -132,6 +131,7 @@ rmi_bus_space_write_multi_1(void *t, bus_size_t offset, const u_int8_t * addr, size_t count); + static void rmi_bus_space_write_multi_2(void *t, bus_space_handle_t handle, @@ -176,7 +176,6 @@ static void rmi_bus_space_barrier(void *tag __unused, bus_space_handle_t bsh __unused, bus_size_t offset __unused, bus_size_t len __unused, int flags); - static void rmi_bus_space_copy_region_2(void *t, bus_space_handle_t bsh1, @@ -244,7 +243,8 @@ rmi_bus_space_write_multi_stream_4(void const u_int32_t * addr, size_t count); - +#define TODO() printf("XLR memory bus space function '%s' unimplemented\n", __func__) + static struct bus_space local_rmi_bus_space = { /* cookie */ (void *)0, @@ -355,27 +355,9 @@ static struct bus_space local_rmi_bus_sp /* generic bus_space tag */ bus_space_tag_t rmi_bus_space = &local_rmi_bus_space; -#defineMIPS_BUS_SPACE_IO 0 /* space is i/o space */ -#define MIPS_BUS_SPACE_MEM 1 /* space is mem space */ -#define MIPS_BUS_SPACE_PCI 10 /* avoid conflict with other spaces */ - -#define BUS_SPACE_UNRESTRICTED (~0) - -#define SWAP32(x)\ -(((x) & 0xff00) >> 24) | \ -(((x) & 0x00ff) << 24) | \ -(((x) & 0xff00) << 8) | \ -(((x) & 0x00ff) >> 8) - -#define SWAP16(x)\ -(((x) & 0xff00) >> 8) | \ -(((x) & 0x00ff) << 8) - /* * Map a region of device bus space into CPU virtual address space. */ - - static int rmi_bus_space_map(void *t __unused, bus_addr_t addr, bus_size_t size __unused, int flags __unused, @@ -417,34 +399,24 @@ static u_int8_t rmi_bus_space_read_1(void *tag, bus_space_handle_t handle, bus_size_t offset) { - if ((int)tag == MIPS_BUS_SPACE_PCI) - return (u_int8_t) (*(volatile u_int8_t *)(handle + offset)); - else - return (u_int8_t) (*(volatile u_int32_t *)(handle + offset)); + return (u_int8_t) (*(volatile u_int32_t *)(handle + offset)); } static u_int16_t rmi_bus_space_read_2(void *tag, bus_space_handle_t handle, bus_size_t offset) { - if ((int)tag == MIPS_BUS_SPACE_PCI) - return SWAP16((u_int16_t) (*(volatile u_int16_t *)(handle + offset))); - else - return *(volatile u_int16_t *)(handle + offset); + return (u_int16_t)(*(volatile u_int32_t *)(handle + offset)); } static u_int32_t rmi_bus_space_read_4(void *tag, bus_space_handle_t handle, bus_size_t offset) { - if ((int)tag == MIPS_BUS_SPACE_PCI) - return SWAP32((*(volatile u_int32_t *)(handle + offset))); - else - return (*(volatile u_int32_t *)(handle + offset)); + return (*(volatile u_int32_t *)(handle + offset)); } - /* * Read `count' 1, 2, 4, or 8 byte quantities from bus space * described by tag/handle/offset and copy into buffer provided. @@ -453,41 +425,21 @@ static void rmi_bus_space_read_multi_1(void *tag, bus_space_handle_t handle, bus_size_t offset, u_int8_t * addr, size_t count) { - - if ((int)tag != MIPS_BUS_SPACE_PCI) - return; - while (count--) { - *addr = (*(volatile u_int8_t *)(handle + offset)); - addr++; - } + TODO(); } static void rmi_bus_space_read_multi_2(void *tag, bus_space_handle_t handle, bus_size_t offset, u_int16_t * addr, size_t count) { - - if ((int)tag != MIPS_BUS_SPACE_PCI) - return; - while (count--) { - *addr = *(volatile u_int16_t *)(handle + offset); - *addr = SWAP16(*addr); - addr++; - } + TODO(); } static void rmi_bus_space_read_multi_4(void *tag, bus_spac
svn commit: r204135 - head/sys/mips/rmi
Author: rrs Date: Sat Feb 20 17:12:07 2010 New Revision: 204135 URL: http://svn.freebsd.org/changeset/base/204135 Log: Opps forgot to add this: - add bus_space_rmi_pci.c for PCI bus space Obtained from:C. Jayachandran - Added: head/sys/mips/rmi/bus_space_rmi_pci.c (contents, props changed) Added: head/sys/mips/rmi/bus_space_rmi_pci.c == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/mips/rmi/bus_space_rmi_pci.c Sat Feb 20 17:12:07 2010 (r204135) @@ -0,0 +1,760 @@ +/*- + * Copyright (c) 2009 RMI Corporation + * 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. + * + */ +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include + +static int +rmi_pci_bus_space_map(void *t, bus_addr_t addr, +bus_size_t size, int flags, +bus_space_handle_t * bshp); + +static void +rmi_pci_bus_space_unmap(void *t, bus_space_handle_t bsh, +bus_size_t size); + +static int +rmi_pci_bus_space_subregion(void *t, +bus_space_handle_t bsh, +bus_size_t offset, bus_size_t size, +bus_space_handle_t * nbshp); + +static u_int8_t +rmi_pci_bus_space_read_1(void *t, +bus_space_handle_t handle, +bus_size_t offset); + +static u_int16_t +rmi_pci_bus_space_read_2(void *t, +bus_space_handle_t handle, +bus_size_t offset); + +static u_int32_t +rmi_pci_bus_space_read_4(void *t, +bus_space_handle_t handle, +bus_size_t offset); + +static void +rmi_pci_bus_space_read_multi_1(void *t, +bus_space_handle_t handle, +bus_size_t offset, u_int8_t * addr, +size_t count); + +static void +rmi_pci_bus_space_read_multi_2(void *t, +bus_space_handle_t handle, +bus_size_t offset, u_int16_t * addr, +size_t count); + +static void +rmi_pci_bus_space_read_multi_4(void *t, +bus_space_handle_t handle, +bus_size_t offset, u_int32_t * addr, +size_t count); + +static void +rmi_pci_bus_space_read_region_1(void *t, +bus_space_handle_t bsh, +bus_size_t offset, u_int8_t * addr, +size_t count); + +static void +rmi_pci_bus_space_read_region_2(void *t, +bus_space_handle_t bsh, +bus_size_t offset, u_int16_t * addr, +size_t count); + +static void +rmi_pci_bus_space_read_region_4(void *t, +bus_space_handle_t bsh, +bus_size_t offset, u_int32_t * addr, +size_t count); + +static void +rmi_pci_bus_space_write_1(void *t, +bus_space_handle_t handle, +bus_size_t offset, u_int8_t value); + +static void +rmi_pci_bus_space_write_2(void *t, +bus_space_handle_t handle, +bus_size_t offset, u_int16_t value); + +static void +rmi_pci_bus_space_write_4(void *t, +bus_space_handle_t handle, +bus_size_t offset, u_int32_t value); + +static void +rmi_pci_bus_space_write_multi_1(void *t, +bus_space_handle_t handle, +bus_size_t offset, +const u_int8_t * addr, +size_t count); + +static void +rmi_pci_bus_space_write_multi_2(void *t, +bus_space_handle_t handle, +bus_size_t offset, +const u_int16_t * addr, +size_t count); + +static void +rmi_pci_bus_space_write_multi_4(void *t, +bus_space_handle_t handle, +bus_size_t offset, +const u_int32_t * addr, +size_t count); + +static void +rmi_pci_bus_space_write_region_2(void *t, +bus_space_handle_t bsh, +bus_size_t offset, +const u_int16_t * addr, +size_t count); + +static void +rmi_pci_bus_space_write_region_4(void *t, +bus_space_handle_t bsh, +bus_size_t offset, +const u_int32_t * addr, +size_t count); + +
svn commit: r204136 - head/sys/mips/rmi
Author: rrs Date: Sat Feb 20 17:19:16 2010 New Revision: 204136 URL: http://svn.freebsd.org/changeset/base/204136 Log: Changes for pci and pci-e support - add bus_space_rmi_pci.c for PCI bus space - files.xlr update for changes in files - pcibus.c merged into xlr_pci.c (they were small files with inter-dependencies) - xlr_pci.c - lot of changes here with few fixes, formatting cleanup Obtained from:C. Jayachandran (JC) - c.jayachand...@gmail.com Modified: head/sys/mips/rmi/bus_space_rmi_pci.c head/sys/mips/rmi/files.xlr head/sys/mips/rmi/pcibus.h head/sys/mips/rmi/xlr_pci.c Modified: head/sys/mips/rmi/bus_space_rmi_pci.c == --- head/sys/mips/rmi/bus_space_rmi_pci.c Sat Feb 20 17:12:07 2010 (r204135) +++ head/sys/mips/rmi/bus_space_rmi_pci.c Sat Feb 20 17:19:16 2010 (r204136) @@ -23,6 +23,767 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $FreeBSD$ + */ +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include + +static int +rmi_pci_bus_space_map(void *t, bus_addr_t addr, +bus_size_t size, int flags, +bus_space_handle_t * bshp); + +static void +rmi_pci_bus_space_unmap(void *t, bus_space_handle_t bsh, +bus_size_t size); + +static int +rmi_pci_bus_space_subregion(void *t, +bus_space_handle_t bsh, +bus_size_t offset, bus_size_t size, +bus_space_handle_t * nbshp); + +static u_int8_t +rmi_pci_bus_space_read_1(void *t, +bus_space_handle_t handle, +bus_size_t offset); + +static u_int16_t +rmi_pci_bus_space_read_2(void *t, +bus_space_handle_t handle, +bus_size_t offset); + +static u_int32_t +rmi_pci_bus_space_read_4(void *t, +bus_space_handle_t handle, +bus_size_t offset); + +static void +rmi_pci_bus_space_read_multi_1(void *t, +bus_space_handle_t handle, +bus_size_t offset, u_int8_t * addr, +size_t count); + +static void +rmi_pci_bus_space_read_multi_2(void *t, +bus_space_handle_t handle, +bus_size_t offset, u_int16_t * addr, +size_t count); + +static void +rmi_pci_bus_space_read_multi_4(void *t, +bus_space_handle_t handle, +bus_size_t offset, u_int32_t * addr, +size_t count); + +static void +rmi_pci_bus_space_read_region_1(void *t, +bus_space_handle_t bsh, +bus_size_t offset, u_int8_t * addr, +size_t count); + +static void +rmi_pci_bus_space_read_region_2(void *t, +bus_space_handle_t bsh, +bus_size_t offset, u_int16_t * addr, +size_t count); + +static void +rmi_pci_bus_space_read_region_4(void *t, +bus_space_handle_t bsh, +bus_size_t offset, u_int32_t * addr, +size_t count); + +static void +rmi_pci_bus_space_write_1(void *t, +bus_space_handle_t handle, +bus_size_t offset, u_int8_t value); + +static void +rmi_pci_bus_space_write_2(void *t, +bus_space_handle_t handle, +bus_size_t offset, u_int16_t value); + +static void +rmi_pci_bus_space_write_4(void *t, +bus_space_handle_t handle, +bus_size_t offset, u_int32_t value); + +static void +rmi_pci_bus_space_write_multi_1(void *t, +bus_space_handle_t handle, +bus_size_t offset, +const u_int8_t * addr, +size_t count); + +static void +rmi_pci_bus_space_write_multi_2(void *t, +bus_space_handle_t handle, +bus_size_t offset, +const u_int16_t * addr, +size_t count); + +static void +rmi_pci_bus_space_write_multi_4(void *t, +bus_space_handle_t handle, +bus_size_t offset, +const u_int32_t * addr, +size_t count); + +static void +rmi_pci_bus_space_write_region_2(void *t, +bus_space_handle_t bsh, +bus_size_t offset, +const u_int16_t * addr, +size_t count); + +static void +rmi_pci_bus_space_write_region_4(void *t, +bus_space_handle_t bsh, +bus_size_t offset, +const u_int32_t * addr, +size_t count); + + +static void +rmi_pci_bus_space_set_region_2(void *t, +bus_space_handle_t bsh, +bus_size_t offset, u_int16_t value, +size_t count); +static void +rmi_pci_bus_space_set_region_4(void *t, +bus_space_handle_t bsh, +bus_size_t offset, u_int32_t value, +size_t count); + +static void +rmi_pci_bus_space_barrier(void *tag __unused, bus_space_handle_t bsh __unused, +bus_size_t offset __unused, bus_size_t len __unused, int flags); + +static void +rmi_pci_bus_space_copy_region_2(void *t, +bus_space_handle_t bsh1, +bus_size_t off1, +bus_space_handle_t bsh2, +bus_size_t off2, size_t count); + +u_int8_t +rmi_pci_bus_space_read_stream_1(void *t, bus_space_handle_t handle, +bus_size_t offset); + +static u_int16_t +rmi_pci_bus_space_read_stream_2(void *t, bus_space_handle_t handle, +bus_size_t offset); + +static u_int32_t +rmi_pci_bus_space_read_stream_4(void *t, bus_space_handle_t handle, +
svn commit: r204137 - head/sys/mips/rmi
Author: rrs Date: Sat Feb 20 17:24:33 2010 New Revision: 204137 URL: http://svn.freebsd.org/changeset/base/204137 Log: Fix for the rge driver for boards without rge6 and rge7. - changes to avoid adding theses instances on specific chips Obtained from:C. Jayachandran - JC - c.jayachand...@gmail.com Modified: head/sys/mips/rmi/board.c head/sys/mips/rmi/iodi.c Modified: head/sys/mips/rmi/board.c == --- head/sys/mips/rmi/board.c Sat Feb 20 17:19:16 2010(r204136) +++ head/sys/mips/rmi/board.c Sat Feb 20 17:24:33 2010(r204137) @@ -27,6 +27,8 @@ * THE POSSIBILITY OF SUCH DAMAGE. * * *RMI_2**/ +#include /* RCS ID & Copyright macro defns */ +__FBSDID("$FreeBSD$"); #include #include #include @@ -93,6 +95,7 @@ struct xlr_board_info xlr_board_info; int xlr_board_info_setup() { + if (xlr_is_xls()) { xlr_board_info.is_xls = 1; xlr_board_info.nr_cpus = 8; @@ -122,6 +125,18 @@ xlr_board_info_setup() /* network block 1 */ xlr_board_info.gmac_block[1].type = XLR_GMAC; xlr_board_info.gmac_block[1].enabled = 0xf; + if (xlr_is_xls4xx()) { + xlr_reg_t *mmio = xlr_io_mmio(XLR_IO_GPIO_OFFSET); + uint32_t tmp; + + /* some ports are not enabled on 4xx, figure this out + from the GPIO fuse bank */ + tmp = xlr_read_reg(mmio, 35); + if (tmp & (1<<28)) + xlr_board_info.gmac_block[1].enabled &= ~0x8; + if (tmp & (1<<29)) + xlr_board_info.gmac_block[1].enabled &= ~0x4; + } xlr_board_info.gmac_block[1].credit_config = &xls_cc_table_gmac1; xlr_board_info.gmac_block[1].station_txbase = MSGRNG_STNID_GMAC1_TX0; xlr_board_info.gmac_block[1].station_rfr = MSGRNG_STNID_GMAC1_FR_0; Modified: head/sys/mips/rmi/iodi.c == --- head/sys/mips/rmi/iodi.cSat Feb 20 17:19:16 2010(r204136) +++ head/sys/mips/rmi/iodi.cSat Feb 20 17:24:33 2010(r204137) @@ -271,11 +271,15 @@ iodi_attach(device_t dev) tmpd = device_add_child(dev, "rge", 5); device_set_ivars(tmpd, &xlr_board_info.gmac_block[1]); - tmpd = device_add_child(dev, "rge", 6); - device_set_ivars(tmpd, &xlr_board_info.gmac_block[1]); - - tmpd = device_add_child(dev, "rge", 7); - device_set_ivars(tmpd, &xlr_board_info.gmac_block[1]); + if (xlr_board_info.gmac_block[1].enabled & 0x4) { + tmpd = device_add_child(dev, "rge", 6); + device_set_ivars(tmpd, &xlr_board_info.gmac_block[1]); + } + + if (xlr_board_info.gmac_block[1].enabled & 0x8) { + tmpd = device_add_child(dev, "rge", 7); + device_set_ivars(tmpd, &xlr_board_info.gmac_block[1]); + } } else if (xlr_board_info.gmac_block[1].type == XLR_XGMAC) { #if 0 /* XGMAC not yet */ tmpd = device_add_child(dev, "rge", 4); ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r204138 - in head: contrib/gdb/gdb gnu/usr.bin gnu/usr.bin/gdb/arch/mips gnu/usr.bin/gdb/kgdb
Author: rrs Date: Sat Feb 20 17:29:27 2010 New Revision: 204138 URL: http://svn.freebsd.org/changeset/base/204138 Log: These contain JC's patch to get gdb sort of working on mips. Its not fully done yet but its a start. Obtained from: JC - c.jayachand...@gmail.com Mgnu/usr.bin/gdb/kgdb/trgt_mips.c Mgnu/usr.bin/gdb/arch/mips/init.c Mgnu/usr.bin/gdb/arch/mips/Makefile Mgnu/usr.bin/Makefile Mcontrib/gdb/gdb/mips-tdep.h Modified: head/contrib/gdb/gdb/mips-tdep.h head/gnu/usr.bin/Makefile head/gnu/usr.bin/gdb/arch/mips/Makefile head/gnu/usr.bin/gdb/arch/mips/init.c head/gnu/usr.bin/gdb/kgdb/trgt_mips.c Modified: head/contrib/gdb/gdb/mips-tdep.h == --- head/contrib/gdb/gdb/mips-tdep.hSat Feb 20 17:24:33 2010 (r204137) +++ head/contrib/gdb/gdb/mips-tdep.hSat Feb 20 17:29:27 2010 (r204138) @@ -62,6 +62,17 @@ struct mips_regnum extern const struct mips_regnum *mips_regnum (struct gdbarch *gdbarch); enum { + MIPS_S0_REGNUM = 16, + MIPS_S1_REGNUM = 17, + MIPS_S2_REGNUM = 18, + MIPS_S3_REGNUM = 19, + MIPS_S4_REGNUM = 20, + MIPS_S5_REGNUM = 21, + MIPS_S6_REGNUM = 22, + MIPS_S7_REGNUM = 23, + MIPS_SP_REGNUM = 29, + MIPS_FP_REGNUM = 30, + MIPS_RA_REGNUM = 31, MIPS_EMBED_LO_REGNUM = 33, MIPS_EMBED_HI_REGNUM = 34, MIPS_EMBED_BADVADDR_REGNUM = 35, Modified: head/gnu/usr.bin/Makefile == --- head/gnu/usr.bin/Makefile Sat Feb 20 17:24:33 2010(r204137) +++ head/gnu/usr.bin/Makefile Sat Feb 20 17:29:27 2010(r204138) @@ -21,10 +21,6 @@ SUBDIR= ${_binutils} \ sort \ ${_texinfo} -.if ${MACHINE_ARCH} == "mips" -MK_GDB=no # not yet -.endif - .if ${MK_CXX} != "no" _gperf=gperf .if ${MK_GROFF} != "no" Modified: head/gnu/usr.bin/gdb/arch/mips/Makefile == --- head/gnu/usr.bin/gdb/arch/mips/Makefile Sat Feb 20 17:24:33 2010 (r204137) +++ head/gnu/usr.bin/gdb/arch/mips/Makefile Sat Feb 20 17:29:27 2010 (r204138) @@ -1,10 +1,10 @@ # $FreeBSD$ .if !defined(GDB_CROSS_DEBUGGER) -LIBSRCS+= mips-nat.c mips-nat.c mipsfbsd-nat.c +LIBSRCS+= mipsfbsd-nat.c .endif LIBSRCS+= solib.c solib-svr4.c -LIBSRCS+= mips-tdep.c mipsfbsd-tdep.c +LIBSRCS+= mips-tdep.c mipsfbsd-tdep.c fbsd-proc.c nm.h: echo '#include "mips/nm-fbsd.h"' > ${.TARGET} Modified: head/gnu/usr.bin/gdb/arch/mips/init.c == --- head/gnu/usr.bin/gdb/arch/mips/init.c Sat Feb 20 17:24:33 2010 (r204137) +++ head/gnu/usr.bin/gdb/arch/mips/init.c Sat Feb 20 17:29:27 2010 (r204138) @@ -123,15 +123,19 @@ initialize_all_files (void) _initialize_ser_pipe (); _initialize_ser_tcp (); #ifndef CROSS_DEBUGGER +#if 0 _initialize_mipsfbsd_nat (); _initialize_mips_nat (); +#endif _initialize_kernel_u_addr (); _initialize_infptrace (); _initialize_inftarg (); _initialize_solib (); _initialize_svr4_solib (); +#if 0 _initialize_svr4_lm (); #endif +#endif _initialize_remote (); _initialize_dcache (); _initialize_sr_support (); Modified: head/gnu/usr.bin/gdb/kgdb/trgt_mips.c == --- head/gnu/usr.bin/gdb/kgdb/trgt_mips.c Sat Feb 20 17:24:33 2010 (r204137) +++ head/gnu/usr.bin/gdb/kgdb/trgt_mips.c Sat Feb 20 17:29:27 2010 (r204138) @@ -61,18 +61,17 @@ kgdb_trgt_fetch_registers(int regno __un warnx("kvm_read: %s", kvm_geterr(kvm)); memset(&pcb, 0, sizeof(pcb)); } - supply_register(MIPS_S0_REGNUM, (char *)&pcb.pcb_context.val[0]); - supply_register(MIPS_S1_REGNUM, (char *)&pcb.pcb_context.val[1]); - supply_register(MIPS_S2_REGNUM, (char *)&pcb.pcb_context.val[2]); - supply_register(MIPS_S3_REGNUM, (char *)&pcb.pcb_context.val[3]); - supply_register(MIPS_S4_REGNUM, (char *)&pcb.pcb_context.val[4]); - supply_register(MIPS_S5_REGNUM, (char *)&pcb.pcb_context.val[5]); - supply_register(MIPS_S6_REGNUM, (char *)&pcb.pcb_context.val[6]); - supply_register(MIPS_S7_REGNUM, (char *)&pcb.pcb_context.val[7]); - supply_register(MIPS_SP_REGNUM, (char *)&pcb.pcb_context.val[8]); - supply_register(MIPS_SP_REGNUM, (char *)&pcb.pcb_context.val[8]); - supply_register(MIPS_FP_REGNUM, (char *)&pcb.pcb_context.val[9]); - supply_register(MIPS_RA_REGNUM, (char *)&pcb.pcb_context.val[10]); + supply_register(MIPS_S0_REGNUM, (char *)&pcb.pcb_context[0]); + supply_register(MIPS_S1_REGNUM, (char *)&pcb.pcb_context[1]); + supply_register(MIPS_S2_REGNUM, (char *)&pcb.pcb_context[2]); + supply_register(MIPS_S3_REGNUM, (char *)&pcb.pcb_context
Re: svn commit: r204126 - head/sys/powerpc/booke
On 2010-02-20, at 17:13, Nathan Whitehorn wrote: > Author: nwhitehorn > Date: Sat Feb 20 16:13:43 2010 > New Revision: 204126 > URL: http://svn.freebsd.org/changeset/base/204126 > > Log: > Merge r198724 to Book-E. casuword() non-atomically read the current value > of its argument before atomically replacing it, which could occasionally > return the wrong value on an SMP system. This resulted in user mutex > operations hanging when using threaded applications. Have you got a particular test case when this was breaking, so I can test? > Modified: > head/sys/powerpc/booke/copyinout.c > > Modified: head/sys/powerpc/booke/copyinout.c > == > --- head/sys/powerpc/booke/copyinout.cSat Feb 20 16:12:37 2010 > (r204125) > +++ head/sys/powerpc/booke/copyinout.cSat Feb 20 16:13:43 2010 > (r204126) > @@ -295,8 +295,19 @@ casuword(volatile u_long *addr, u_long o > return (EFAULT); > } > > - val = *addr; > - (void) atomic_cmpset_32((volatile uint32_t *)addr, old, new); > + __asm __volatile ( > + "1:\tlwarx %0, 0, %2\n\t" /* load old value */ > + "cmplw %3, %0\n\t" /* compare */ > + "bne 2f\n\t"/* exit if not equal */ > + "stwcx. %4, 0, %2\n\t" /* attempt to store */ > + "bne- 1b\n\t" /* spin if failed */ > + "b 3f\n\t" /* we've succeeded */ > + "2:\n\t" > + "stwcx. %0, 0, %2\n\t" /* clear reservation (74xx) */ The 74xx comment reference is somewhat confusing as the clear reservation operation is pretty uniform accross 32-bit PowerPC I guess, and not 74xx specific. Rafal ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r204126 - head/sys/powerpc/booke
Rafal Jaworowski wrote: On 2010-02-20, at 17:13, Nathan Whitehorn wrote: Author: nwhitehorn Date: Sat Feb 20 16:13:43 2010 New Revision: 204126 URL: http://svn.freebsd.org/changeset/base/204126 Log: Merge r198724 to Book-E. casuword() non-atomically read the current value of its argument before atomically replacing it, which could occasionally return the wrong value on an SMP system. This resulted in user mutex operations hanging when using threaded applications. Have you got a particular test case when this was breaking, so I can test? This typically shows up with heavy lock contention on umtx operations. I discovered this because running csup died for me 100% of the time on my Xserve, by hanging forever in some umtx code. This change explicitly preserves the semantics of casuword -- it is just the code for atomic_cmpset_32 copied from atomic.h, but returning the value loading with lwarx, instead of replacing it with a success code. This closes a race between val = *addr and atomic_cmpset. With the old code, another CPU could change the value at addr between val = *addr and atomic_cmpset, causing casuword to return the wrong value. Modified: head/sys/powerpc/booke/copyinout.c Modified: head/sys/powerpc/booke/copyinout.c == --- head/sys/powerpc/booke/copyinout.c Sat Feb 20 16:12:37 2010 (r204125) +++ head/sys/powerpc/booke/copyinout.c Sat Feb 20 16:13:43 2010 (r204126) @@ -295,8 +295,19 @@ casuword(volatile u_long *addr, u_long o return (EFAULT); } - val = *addr; - (void) atomic_cmpset_32((volatile uint32_t *)addr, old, new); + __asm __volatile ( + "1:\tlwarx %0, 0, %2\n\t" /* load old value */ + "cmplw %3, %0\n\t"/* compare */ + "bne 2f\n\t" /* exit if not equal */ + "stwcx. %4, 0, %2\n\t"/* attempt to store */ + "bne- 1b\n\t" /* spin if failed */ + "b 3f\n\t"/* we've succeeded */ + "2:\n\t" + "stwcx. %0, 0, %2\n\t"/* clear reservation (74xx) */ The 74xx comment reference is somewhat confusing as the clear reservation operation is pretty uniform accross 32-bit PowerPC I guess, and not 74xx specific. That's true. It should also be updated in atomic.h. -Nathan ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r204139 - head/sys/sys
Author: alc Date: Sat Feb 20 19:30:04 2010 New Revision: 204139 URL: http://svn.freebsd.org/changeset/base/204139 Log: Eliminate an unused declaration. Modified: head/sys/sys/systm.h Modified: head/sys/sys/systm.h == --- head/sys/sys/systm.hSat Feb 20 17:29:27 2010(r204138) +++ head/sys/sys/systm.hSat Feb 20 19:30:04 2010(r204139) @@ -52,8 +52,6 @@ extern char version[];/* system versio extern char copyright[]; /* system copyright */ extern int kstack_pages; /* number of kernel stack pages */ -extern int nswap; /* size of swap space */ - extern u_long pagesizes[]; /* supported page sizes */ extern long physmem; /* physical memory */ extern long realmem; /* 'real' memory */ ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r204140 - head/sys/netinet
Author: bz Date: Sat Feb 20 19:59:52 2010 New Revision: 204140 URL: http://svn.freebsd.org/changeset/base/204140 Log: Split up ip_drain() into an outer lock and iterator part and a "locked" version that will only handle a single network stack instance. The latter is called directly from ip_destroy(). Hook up an ip_destroy() function to release resources from the legacy IP network layer upon virtual network stack teardown. Sponsored by: ISPsystem Reviewed by: rwatson MFC After:5 days Modified: head/sys/netinet/in_proto.c head/sys/netinet/ip_input.c head/sys/netinet/ip_var.h Modified: head/sys/netinet/in_proto.c == --- head/sys/netinet/in_proto.c Sat Feb 20 19:30:04 2010(r204139) +++ head/sys/netinet/in_proto.c Sat Feb 20 19:59:52 2010(r204140) @@ -114,6 +114,9 @@ struct protosw inetsw[] = { .pr_domain =&inetdomain, .pr_protocol = IPPROTO_IP, .pr_init = ip_init, +#ifdef VIMAGE + .pr_destroy = ip_destroy, +#endif .pr_slowtimo = ip_slowtimo, .pr_drain = ip_drain, .pr_usrreqs = &nousrreqs Modified: head/sys/netinet/ip_input.c == --- head/sys/netinet/ip_input.c Sat Feb 20 19:30:04 2010(r204139) +++ head/sys/netinet/ip_input.c Sat Feb 20 19:59:52 2010(r204140) @@ -199,6 +199,7 @@ static struct mtx ipqlock; static voidmaxnipq_update(void); static voidipq_zone_change(void *); +static voidip_drain_locked(void); SYSCTL_VNET_INT(_net_inet_ip, OID_AUTO, fragpackets, CTLFLAG_RD, &VNET_NAME(nipq), 0, @@ -368,6 +369,22 @@ ip_init(void) netisr_register(&ip_nh); } +#ifdef VIMAGE +void +ip_destroy(void) +{ + + /* Cleanup in_ifaddr hash table; should be empty. */ + hashdestroy(V_in_ifaddrhashtbl, M_IFADDR, V_in_ifaddrhmask); + + IPQ_LOCK(); + ip_drain_locked(); + IPQ_UNLOCK(); + + uma_zdestroy(V_ipq_zone); +} +#endif + void ip_fini(void *xtp) { @@ -1237,23 +1254,32 @@ ip_slowtimo(void) /* * Drain off all datagram fragments. */ +static void +ip_drain_locked(void) +{ + int i; + + IPQ_LOCK_ASSERT(); + + for (i = 0; i < IPREASS_NHASH; i++) { + while(!TAILQ_EMPTY(&V_ipq[i])) { + IPSTAT_ADD(ips_fragdropped, + TAILQ_FIRST(&V_ipq[i])->ipq_nfrags); + ip_freef(&V_ipq[i], TAILQ_FIRST(&V_ipq[i])); + } + } +} + void ip_drain(void) { VNET_ITERATOR_DECL(vnet_iter); - int i; VNET_LIST_RLOCK_NOSLEEP(); IPQ_LOCK(); VNET_FOREACH(vnet_iter) { CURVNET_SET(vnet_iter); - for (i = 0; i < IPREASS_NHASH; i++) { - while(!TAILQ_EMPTY(&V_ipq[i])) { - IPSTAT_ADD(ips_fragdropped, - TAILQ_FIRST(&V_ipq[i])->ipq_nfrags); - ip_freef(&V_ipq[i], TAILQ_FIRST(&V_ipq[i])); - } - } + ip_drain_locked(); CURVNET_RESTORE(); } IPQ_UNLOCK(); Modified: head/sys/netinet/ip_var.h == --- head/sys/netinet/ip_var.h Sat Feb 20 19:30:04 2010(r204139) +++ head/sys/netinet/ip_var.h Sat Feb 20 19:59:52 2010(r204140) @@ -212,6 +212,9 @@ int ip_fragment(struct ip *ip, struct mb u_long if_hwassist_flags, int sw_csum); void ip_forward(struct mbuf *m, int srcrt); void ip_init(void); +#ifdef VIMAGE +void ip_destroy(void); +#endif extern int (*ip_mforward)(struct ip *, struct ifnet *, struct mbuf *, struct ip_moptions *); ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r204141 - head/sys/netinet
Author: tuexen Date: Sat Feb 20 20:30:40 2010 New Revision: 204141 URL: http://svn.freebsd.org/changeset/base/204141 Log: Fix handling of SHUTDOWN-ACK chunk in COOKIE_WAIT and COOKIE_ECHOED. MFC after: 1 week Modified: head/sys/netinet/sctp_input.c head/sys/netinet/sctp_output.c head/sys/netinet/sctp_output.h Modified: head/sys/netinet/sctp_input.c == --- head/sys/netinet/sctp_input.c Sat Feb 20 19:59:52 2010 (r204140) +++ head/sys/netinet/sctp_input.c Sat Feb 20 20:30:40 2010 (r204141) @@ -918,7 +918,8 @@ sctp_handle_shutdown(struct sctp_shutdow static void sctp_handle_shutdown_ack(struct sctp_shutdown_ack_chunk *cp, -struct sctp_tcb *stcb, struct sctp_nets *net) +struct sctp_tcb *stcb, +struct sctp_nets *net) { struct sctp_association *asoc; @@ -934,6 +935,13 @@ sctp_handle_shutdown_ack(struct sctp_shu asoc = &stcb->asoc; /* process according to association state */ + if ((SCTP_GET_STATE(asoc) == SCTP_STATE_COOKIE_WAIT) || + (SCTP_GET_STATE(asoc) == SCTP_STATE_COOKIE_ECHOED)) { + /* unexpected SHUTDOWN-ACK... do OOTB handling... */ + sctp_send_shutdown_complete(stcb, net, 1); + SCTP_TCB_UNLOCK(stcb); + return; + } if ((SCTP_GET_STATE(asoc) != SCTP_STATE_SHUTDOWN_SENT) && (SCTP_GET_STATE(asoc) != SCTP_STATE_SHUTDOWN_ACK_SENT)) { /* unexpected SHUTDOWN-ACK... so ignore... */ @@ -975,7 +983,7 @@ sctp_handle_shutdown_ack(struct sctp_shu /* stop the timer */ sctp_timer_stop(SCTP_TIMER_TYPE_SHUTDOWN, stcb->sctp_ep, stcb, net, SCTP_FROM_SCTP_INPUT + SCTP_LOC_9); /* send SHUTDOWN-COMPLETE */ - sctp_send_shutdown_complete(stcb, net); + sctp_send_shutdown_complete(stcb, net, 0); /* notify upper layer protocol */ if (stcb->sctp_socket) { sctp_ulp_notify(SCTP_NOTIFY_ASSOC_DOWN, stcb, 0, NULL, SCTP_SO_NOT_LOCKED); Modified: head/sys/netinet/sctp_output.c == --- head/sys/netinet/sctp_output.c Sat Feb 20 19:59:52 2010 (r204140) +++ head/sys/netinet/sctp_output.c Sat Feb 20 20:30:40 2010 (r204141) @@ -10622,27 +10622,37 @@ sctp_send_abort_tcb(struct sctp_tcb *stc void sctp_send_shutdown_complete(struct sctp_tcb *stcb, -struct sctp_nets *net) +struct sctp_nets *net, +int reflect_vtag) { /* formulate and SEND a SHUTDOWN-COMPLETE */ struct mbuf *m_shutdown_comp; struct sctp_shutdown_complete_chunk *shutdown_complete; + uint32_t vtag; + uint8_t flags; m_shutdown_comp = sctp_get_mbuf_for_msg(sizeof(struct sctp_chunkhdr), 0, M_DONTWAIT, 1, MT_HEADER); if (m_shutdown_comp == NULL) { /* no mbuf's */ return; } + if (reflect_vtag) { + flags = SCTP_HAD_NO_TCB; + vtag = stcb->asoc.my_vtag; + } else { + flags = 0; + vtag = stcb->asoc.peer_vtag; + } shutdown_complete = mtod(m_shutdown_comp, struct sctp_shutdown_complete_chunk *); shutdown_complete->ch.chunk_type = SCTP_SHUTDOWN_COMPLETE; - shutdown_complete->ch.chunk_flags = 0; + shutdown_complete->ch.chunk_flags = flags; shutdown_complete->ch.chunk_length = htons(sizeof(struct sctp_shutdown_complete_chunk)); SCTP_BUF_LEN(m_shutdown_comp) = sizeof(struct sctp_shutdown_complete_chunk); (void)sctp_lowlevel_chunk_output(stcb->sctp_ep, stcb, net, (struct sockaddr *)&net->ro._l_addr, m_shutdown_comp, 0, NULL, 0, 1, 0, NULL, 0, stcb->sctp_ep->sctp_lport, stcb->rport, - htonl(stcb->asoc.peer_vtag), + htonl(vtag), net->port, SCTP_SO_NOT_LOCKED, NULL); SCTP_STAT_INCR_COUNTER64(sctps_outcontrolchunks); return; Modified: head/sys/netinet/sctp_output.h == --- head/sys/netinet/sctp_output.h Sat Feb 20 19:59:52 2010 (r204140) +++ head/sys/netinet/sctp_output.h Sat Feb 20 20:30:40 2010 (r204141) @@ -111,7 +111,7 @@ void sctp_send_shutdown(struct sctp_tcb void sctp_send_shutdown_ack(struct sctp_tcb *, struct sctp_nets *); -void sctp_send_shutdown_complete(struct sctp_tcb *, struct sctp_nets *); +void sctp_send_shutdown_complete(struct sctp_tcb *, struct sctp_nets *, int); void sctp_send_shutdown_complete2(struct mbuf *, int, struct sctphdr *, ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r204142 - head/sys/net
Author: bz Date: Sat Feb 20 21:43:36 2010 New Revision: 204142 URL: http://svn.freebsd.org/changeset/base/204142 Log: Enhance a panic string to contain more useful debugging information. Sponsored by: ISPsystem Reviewed by: rwatson MFC after:5 days Modified: head/sys/net/if.c Modified: head/sys/net/if.c == --- head/sys/net/if.c Sat Feb 20 20:30:40 2010(r204141) +++ head/sys/net/if.c Sat Feb 20 21:43:36 2010(r204142) @@ -809,7 +809,8 @@ if_detach_internal(struct ifnet *ifp, in IFNET_WUNLOCK(); if (!found) { if (vmove) - panic("interface not in it's own ifnet list"); + panic("%s: ifp=%p not on the ifnet tailq %p", + __func__, ifp, &V_ifnet); else return; /* XXX this should panic as well? */ } ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r204143 - head/sys/netinet
Author: bz Date: Sat Feb 20 21:45:04 2010 New Revision: 204143 URL: http://svn.freebsd.org/changeset/base/204143 Log: Upon virtual network stack teardown properly release the TCP syncache resources. Sponsored by: ISPsystem Reviewed by: rwatson MFC After:5 days Modified: head/sys/netinet/tcp_syncache.c Modified: head/sys/netinet/tcp_syncache.c == --- head/sys/netinet/tcp_syncache.c Sat Feb 20 21:43:36 2010 (r204142) +++ head/sys/netinet/tcp_syncache.c Sat Feb 20 21:45:04 2010 (r204143) @@ -278,11 +278,33 @@ syncache_init(void) void syncache_destroy(void) { + struct syncache_head *sch; + struct syncache *sc, *nsc; + int i; + + /* Cleanup hash buckets: stop timers, free entries, destroy locks. */ + for (i = 0; i < V_tcp_syncache.hashsize; i++) { + + sch = &V_tcp_syncache.hashbase[i]; + callout_drain(&sch->sch_timer); + + SCH_LOCK(sch); + TAILQ_FOREACH_SAFE(sc, &sch->sch_bucket, sc_hash, nsc) + syncache_drop(sc, sch); + SCH_UNLOCK(sch); + KASSERT(TAILQ_EMPTY(&sch->sch_bucket), + ("%s: sch->sch_bucket not empty", __func__)); + KASSERT(sch->sch_length == 0, ("%s: sch->sch_length %d not 0", + __func__, sch->sch_length)); + mtx_destroy(&sch->sch_mtx); + } - /* XXX walk the cache, free remaining objects, stop timers */ + KASSERT(V_tcp_syncache.cache_count == 0, ("%s: cache_count %d not 0", + __func__, V_tcp_syncache.cache_count)); + /* Free the allocated global resources. */ uma_zdestroy(V_tcp_syncache.zone); - FREE(V_tcp_syncache.hashbase, M_SYNCACHE); + free(V_tcp_syncache.hashbase, M_SYNCACHE); } #endif ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r204144 - head/sys/dev/mii
Author: marius Date: Sat Feb 20 22:01:24 2010 New Revision: 204144 URL: http://svn.freebsd.org/changeset/base/204144 Log: Add support for BCM54K2 found in combination with Apple K2 GMAC. Submitted by: Andreas Tobler Obtained from: OpenBSD MFC after: 1 week Modified: head/sys/dev/mii/brgphy.c head/sys/dev/mii/miidevs Modified: head/sys/dev/mii/brgphy.c == --- head/sys/dev/mii/brgphy.c Sat Feb 20 21:45:04 2010(r204143) +++ head/sys/dev/mii/brgphy.c Sat Feb 20 22:01:24 2010(r204144) @@ -104,6 +104,7 @@ static void brgphy_reset(struct mii_soft static voidbrgphy_enable_loopback(struct mii_softc *); static voidbcm5401_load_dspcode(struct mii_softc *); static voidbcm5411_load_dspcode(struct mii_softc *); +static voidbcm54k2_load_dspcode(struct mii_softc *); static voidbrgphy_fixup_5704_a0_bug(struct mii_softc *); static voidbrgphy_fixup_adc_bug(struct mii_softc *); static voidbrgphy_fixup_adjust_trim(struct mii_softc *); @@ -117,6 +118,7 @@ static const struct mii_phydesc brgphys[ MII_PHY_DESC(xxBROADCOM, BCM5400), MII_PHY_DESC(xxBROADCOM, BCM5401), MII_PHY_DESC(xxBROADCOM, BCM5411), + MII_PHY_DESC(xxBROADCOM, BCM54K2), MII_PHY_DESC(xxBROADCOM, BCM5701), MII_PHY_DESC(xxBROADCOM, BCM5703), MII_PHY_DESC(xxBROADCOM, BCM5704), @@ -415,6 +417,9 @@ brgphy_service(struct mii_softc *sc, str case MII_MODEL_xxBROADCOM_BCM5411: bcm5411_load_dspcode(sc); break; + case MII_MODEL_xxBROADCOM_BCM54K2: + bcm54k2_load_dspcode(sc); + break; } break; case MII_OUI_xxBROADCOM_ALT1: @@ -730,6 +735,24 @@ bcm5411_load_dspcode(struct mii_softc *s PHY_WRITE(sc, dspcode[i].reg, dspcode[i].val); } +void +bcm54k2_load_dspcode(struct mii_softc *sc) +{ + static const struct { + int reg; + uint16_tval; + } dspcode[] = { + { 4,0x01e1 }, + { 9,0x0300 }, + { 0,0 }, + }; + int i; + + for (i = 0; dspcode[i].reg != 0; i++) + PHY_WRITE(sc, dspcode[i].reg, dspcode[i].val); + +} + static void brgphy_fixup_5704_a0_bug(struct mii_softc *sc) { @@ -932,6 +955,9 @@ brgphy_reset(struct mii_softc *sc) case MII_MODEL_xxBROADCOM_BCM5411: bcm5411_load_dspcode(sc); break; + case MII_MODEL_xxBROADCOM_BCM54K2: + bcm54k2_load_dspcode(sc); + break; } break; case MII_OUI_xxBROADCOM_ALT1: Modified: head/sys/dev/mii/miidevs == --- head/sys/dev/mii/miidevsSat Feb 20 21:45:04 2010(r204143) +++ head/sys/dev/mii/miidevsSat Feb 20 22:01:24 2010(r204144) @@ -145,6 +145,7 @@ model xxBROADCOM BCM57030x0016 BCM5703 model xxBROADCOM BCM5704 0x0019 BCM5704 10/100/1000baseTX PHY model xxBROADCOM BCM5705 0x001a BCM5705 10/100/1000baseTX PHY model xxBROADCOM BCM5750 0x0018 BCM5750 10/100/1000baseTX PHY +model xxBROADCOM BCM54K2 0x002e BCM54K2 10/100/1000baseTX PHY model xxBROADCOM BCM5714 0x0034 BCM5714 10/100/1000baseTX PHY model xxBROADCOM BCM5780 0x0035 BCM5780 10/100/1000baseTX PHY model xxBROADCOM BCM5708C 0x0036 BCM5708C 10/100/1000baseTX PHY ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r204145 - head/sys/net
Author: bz Date: Sat Feb 20 22:09:48 2010 New Revision: 204145 URL: http://svn.freebsd.org/changeset/base/204145 Log: Start to implement ifnet DDB support: - 'show ifnets' prints a list of ifnet *s per virtual network stack, - 'show ifnet ' prints fields matching the given ifp. We do not yet print the complete set of fields and might want to factor this out to an extra if_debug.c file in case this grows a lot[1]. We may also want to grow 'show ifnet ' support[1]. Sponsored by: ISPsystem Suggested by: rwatson [1] Reviewed by: rwatson MFC after:5 days Modified: head/sys/net/if.c Modified: head/sys/net/if.c == --- head/sys/net/if.c Sat Feb 20 22:01:24 2010(r204144) +++ head/sys/net/if.c Sat Feb 20 22:09:48 2010(r204145) @@ -34,6 +34,7 @@ #include "opt_inet6.h" #include "opt_inet.h" #include "opt_carp.h" +#include "opt_ddb.h" #include #include @@ -62,6 +63,10 @@ #include #include +#ifdef DDB +#include +#endif + #include #include #include @@ -3331,3 +3336,79 @@ if_deregister_com_alloc(u_char type) if_com_alloc[type] = NULL; if_com_free[type] = NULL; } + +#ifdef DDB +static void +if_show_ifnet(struct ifnet *ifp) +{ + + if (ifp == NULL) + return; + db_printf("%s:\n", ifp->if_xname); +#defineIF_DB_PRINTF(f, e) db_printf(" %s = " f "\n", #e, ifp->e); + IF_DB_PRINTF("%s", if_dname); + IF_DB_PRINTF("%d", if_dunit); + IF_DB_PRINTF("%s", if_description); + IF_DB_PRINTF("%u", if_index); + IF_DB_PRINTF("%u", if_refcount); + IF_DB_PRINTF("%d", if_index_reserved); + IF_DB_PRINTF("%p", if_softc); + IF_DB_PRINTF("%p", if_l2com); + IF_DB_PRINTF("%p", if_vnet); + IF_DB_PRINTF("%p", if_home_vnet); + IF_DB_PRINTF("%p", if_addr); + IF_DB_PRINTF("%p", if_llsoftc); + IF_DB_PRINTF("%p", if_label); + IF_DB_PRINTF("%u", if_pcount); + IF_DB_PRINTF("0x%08x", if_flags); + IF_DB_PRINTF("0x%08x", if_drv_flags); + IF_DB_PRINTF("0x%08x", if_capabilities); + IF_DB_PRINTF("0x%08x", if_capenable); + IF_DB_PRINTF("%p", if_snd.ifq_head); + IF_DB_PRINTF("%p", if_snd.ifq_tail); + IF_DB_PRINTF("%d", if_snd.ifq_len); + IF_DB_PRINTF("%d", if_snd.ifq_maxlen); + IF_DB_PRINTF("%d", if_snd.ifq_drops); + IF_DB_PRINTF("%p", if_snd.ifq_drv_head); + IF_DB_PRINTF("%p", if_snd.ifq_drv_tail); + IF_DB_PRINTF("%d", if_snd.ifq_drv_len); + IF_DB_PRINTF("%d", if_snd.ifq_drv_maxlen); + IF_DB_PRINTF("%d", if_snd.altq_type); + IF_DB_PRINTF("%x", if_snd.altq_flags); +#undef IF_DB_PRINTF +} + +DB_SHOW_COMMAND(ifnet, db_show_ifnet) +{ + + if (!have_addr) { + db_printf("usage: show ifnet \n"); + return; + } + + if_show_ifnet((struct ifnet *)addr); +} + +DB_SHOW_COMMAND(ifnets, db_show_ifnets) +{ + VNET_ITERATOR_DECL(vnet_iter); + struct ifnet *ifp; + u_short idx; + + VNET_FOREACH(vnet_iter) { + CURVNET_SET_QUIET(vnet_iter); +#ifdef VIMAGE + db_printf("vnet=%p\n", curvnet); +#endif + for (idx = 1; idx <= V_if_index; idx++) { + ifp = V_ifindex_table[idx].ife_ifnet; + if (ifp == NULL) + continue; + db_printf( "%20s ifp=%p\n", ifp->if_xname, ifp); + if (db_pager_quit) + break; + } + CURVNET_RESTORE(); + } +} +#endif ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r204146 - head/sys/dev/msk
Author: yongari Date: Sat Feb 20 22:24:24 2010 New Revision: 204146 URL: http://svn.freebsd.org/changeset/base/204146 Log: Correct inversed programming of ethernet hardware address on big-endian architecture. Submitted by: C. Jayachandran (initial version) Modified: head/sys/dev/msk/if_msk.c Modified: head/sys/dev/msk/if_msk.c == --- head/sys/dev/msk/if_msk.c Sat Feb 20 22:09:48 2010(r204145) +++ head/sys/dev/msk/if_msk.c Sat Feb 20 22:24:24 2010(r204146) @@ -3713,10 +3713,10 @@ msk_init_locked(struct msk_if_softc *sc_ struct msk_softc *sc; struct ifnet *ifp; struct mii_data *mii; - uint16_t eaddr[ETHER_ADDR_LEN / 2]; + uint8_t *eaddr; uint16_t gmac; uint32_t reg; - int error, i; + int error; MSK_IF_LOCK_ASSERT(sc_if); @@ -3785,14 +3785,20 @@ msk_init_locked(struct msk_if_softc *sc_ GMAC_WRITE_2(sc, sc_if->msk_port, GM_SERIAL_MODE, gmac); /* Set station address. */ -bcopy(IF_LLADDR(ifp), eaddr, ETHER_ADDR_LEN); -for (i = 0; i < ETHER_ADDR_LEN /2; i++) - GMAC_WRITE_2(sc, sc_if->msk_port, GM_SRC_ADDR_1L + i * 4, - eaddr[i]); -for (i = 0; i < ETHER_ADDR_LEN /2; i++) - GMAC_WRITE_2(sc, sc_if->msk_port, GM_SRC_ADDR_2L + i * 4, - eaddr[i]); - + eaddr = IF_LLADDR(ifp); + GMAC_WRITE_2(sc, sc_if->msk_port, GM_SRC_ADDR_1L, + eaddr[0] | (eaddr[1] << 8)); + GMAC_WRITE_2(sc, sc_if->msk_port, GM_SRC_ADDR_1M, + eaddr[2] | (eaddr[3] << 8)); + GMAC_WRITE_2(sc, sc_if->msk_port, GM_SRC_ADDR_1H, + eaddr[4] | (eaddr[5] << 8)); + GMAC_WRITE_2(sc, sc_if->msk_port, GM_SRC_ADDR_2L, + eaddr[0] | (eaddr[1] << 8)); + GMAC_WRITE_2(sc, sc_if->msk_port, GM_SRC_ADDR_2M, + eaddr[2] | (eaddr[3] << 8)); + GMAC_WRITE_2(sc, sc_if->msk_port, GM_SRC_ADDR_2H, + eaddr[4] | (eaddr[5] << 8)); + /* Disable interrupts for counter overflows. */ GMAC_WRITE_2(sc, sc_if->msk_port, GM_TX_IRQ_MSK, 0); GMAC_WRITE_2(sc, sc_if->msk_port, GM_RX_IRQ_MSK, 0); ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r204147 - head/sys/kern
Author: bz Date: Sat Feb 20 22:29:28 2010 New Revision: 204147 URL: http://svn.freebsd.org/changeset/base/204147 Log: Set curvnet earlier so that it also covers calls to sodisconnect(), which before were possibly panicing the system in ULP code in the VIMAGE case. Submitted by: Igor (igor ispsystem.com) MFC after:5 days Modified: head/sys/kern/uipc_socket.c Modified: head/sys/kern/uipc_socket.c == --- head/sys/kern/uipc_socket.c Sat Feb 20 22:24:24 2010(r204146) +++ head/sys/kern/uipc_socket.c Sat Feb 20 22:29:28 2010(r204147) @@ -773,6 +773,8 @@ soconnect(struct socket *so, struct sock if (so->so_options & SO_ACCEPTCONN) return (EOPNOTSUPP); + + CURVNET_SET(so->so_vnet); /* * If protocol is connection-based, can only connect once. * Otherwise, if connected, try to disconnect first. This allows @@ -788,10 +790,9 @@ soconnect(struct socket *so, struct sock * biting us. */ so->so_error = 0; - CURVNET_SET(so->so_vnet); error = (*so->so_proto->pr_usrreqs->pru_connect)(so, nam, td); - CURVNET_RESTORE(); } + CURVNET_RESTORE(); return (error); } ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r204149 - head/sys/net
Author: yongari Date: Sat Feb 20 22:47:20 2010 New Revision: 204149 URL: http://svn.freebsd.org/changeset/base/204149 Log: Add TSO support on VLANs. Intentionally separated IFCAP_VLAN_HWTSO from IFCAP_VLAN_HWTAGGING. I think some hardwares may be able to TSO over VLAN without VLAN hardware tagging. Driver changes and userland support will follow. Reviewed by: thompsa Modified: head/sys/net/if.h head/sys/net/if_vlan.c Modified: head/sys/net/if.h == --- head/sys/net/if.h Sat Feb 20 22:43:12 2010(r204148) +++ head/sys/net/if.h Sat Feb 20 22:47:20 2010(r204149) @@ -218,6 +218,7 @@ struct if_data { #defineIFCAP_TOE6 0x08000 /* interface can offload TCP6 */ #defineIFCAP_VLAN_HWFILTER 0x1 /* interface hw can filter vlan tag */ #defineIFCAP_POLLING_NOCOUNT 0x2 /* polling ticks cannot be fragmented */ +#defineIFCAP_VLAN_HWTSO0x4 /* can do IFCAP_TSO on VLANs */ #define IFCAP_HWCSUM (IFCAP_RXCSUM | IFCAP_TXCSUM) #defineIFCAP_TSO (IFCAP_TSO4 | IFCAP_TSO6) Modified: head/sys/net/if_vlan.c == --- head/sys/net/if_vlan.c Sat Feb 20 22:43:12 2010(r204148) +++ head/sys/net/if_vlan.c Sat Feb 20 22:47:20 2010(r204149) @@ -1322,11 +1322,26 @@ vlan_capabilities(struct ifvlan *ifv) if (p->if_capenable & IFCAP_VLAN_HWCSUM && p->if_capenable & IFCAP_VLAN_HWTAGGING) { ifp->if_capenable = p->if_capenable & IFCAP_HWCSUM; - ifp->if_hwassist = p->if_hwassist; + ifp->if_hwassist = p->if_hwassist & (CSUM_IP | CSUM_TCP | + CSUM_UDP | CSUM_SCTP | CSUM_IP_FRAGS | CSUM_FRAGMENT); } else { ifp->if_capenable = 0; ifp->if_hwassist = 0; } + /* +* If the parent interface can do TSO on VLANs then +* propagate the hardware-assisted flag. TSO on VLANs +* does not necessarily require hardware VLAN tagging. +*/ + if (p->if_capabilities & IFCAP_VLAN_HWTSO) + ifp->if_capabilities |= p->if_capabilities & IFCAP_TSO; + if (p->if_capenable & IFCAP_VLAN_HWTSO) { + ifp->if_capenable |= p->if_capenable & IFCAP_TSO; + ifp->if_hwassist |= p->if_hwassist & CSUM_TSO; + } else { + ifp->if_capenable &= ~(p->if_capenable & IFCAP_TSO); + ifp->if_hwassist &= ~(p->if_hwassist & CSUM_TSO); + } } static void ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r204150 - head/sbin/ifconfig
Author: yongari Date: Sat Feb 20 23:01:09 2010 New Revision: 204150 URL: http://svn.freebsd.org/changeset/base/204150 Log: Add TSO support on VLAN in fconfig(8). Reviewed by: thompsa Modified: head/sbin/ifconfig/ifconfig.8 head/sbin/ifconfig/ifconfig.c head/sbin/ifconfig/ifvlan.c Modified: head/sbin/ifconfig/ifconfig.8 == --- head/sbin/ifconfig/ifconfig.8 Sat Feb 20 22:47:20 2010 (r204149) +++ head/sbin/ifconfig/ifconfig.8 Sat Feb 20 23:01:09 2010 (r204150) @@ -28,7 +28,7 @@ .\" From: @(#)ifconfig.8 8.3 (Berkeley) 1/5/94 .\" $FreeBSD$ .\" -.Dd January 26, 2010 +.Dd February 20, 2010 .Dt IFCONFIG 8 .Os .Sh NAME @@ -408,20 +408,20 @@ they support in their capabilities. is a synonym for enabling all available WOL mechanisms. To disable WOL use .Fl wol . -.It Cm vlanmtu , vlanhwtag, vlanhwfilter +.It Cm vlanmtu , vlanhwtag, vlanhwfilter, vlanhwtso If the driver offers user-configurable VLAN support, enable -reception of extended frames, tag processing in hardware, or -frame filtering in hardware, +reception of extended frames, tag processing in hardware, +frame filtering in hardware, or TSO on VLAN, respectively. Note that this must be issued on a physical interface associated with .Xr vlan 4 , not on a .Xr vlan 4 interface itself. -.It Fl vlanmtu , vlanhwtag, vlanhwfilter +.It Fl vlanmtu , vlanhwtag, vlanhwfilter, vlanhwtso If the driver offers user-configurable VLAN support, disable -reception of extended frames, tag processing in hardware, or -frame filtering in hardware, +reception of extended frames, tag processing in hardware, +frame filtering in hardware, or TSO on VLAN, respectively. .It Cm vnet Ar jail Move the interface to the Modified: head/sbin/ifconfig/ifconfig.c == --- head/sbin/ifconfig/ifconfig.c Sat Feb 20 22:47:20 2010 (r204149) +++ head/sbin/ifconfig/ifconfig.c Sat Feb 20 23:01:09 2010 (r204150) @@ -881,7 +881,7 @@ unsetifdescr(const char *val, int value, #defineIFCAPBITS \ "\020\1RXCSUM\2TXCSUM\3NETCONS\4VLAN_MTU\5VLAN_HWTAGGING\6JUMBO_MTU\7POLLING" \ "\10VLAN_HWCSUM\11TSO4\12TSO6\13LRO\14WOL_UCAST\15WOL_MCAST\16WOL_MAGIC" \ -"\21VLAN_HWFILTER" +"\21VLAN_HWFILTER\23VLAN_HWTSO" /* * Print the status of the interface. If an address family was Modified: head/sbin/ifconfig/ifvlan.c == --- head/sbin/ifconfig/ifvlan.c Sat Feb 20 22:47:20 2010(r204149) +++ head/sbin/ifconfig/ifvlan.c Sat Feb 20 23:01:09 2010(r204150) @@ -181,6 +181,8 @@ static struct cmd vlan_cmds[] = { DEF_CMD("-vlanhwtag", -IFCAP_VLAN_HWTAGGING, setifcap), DEF_CMD("vlanhwfilter", IFCAP_VLAN_HWFILTER,setifcap), DEF_CMD("-vlanhwfilter", -IFCAP_VLAN_HWFILTER, setifcap), + DEF_CMD("-vlanhwtso", -IFCAP_VLAN_HWTSO, setifcap), + DEF_CMD("vlanhwtso",IFCAP_VLAN_HWTSO, setifcap), }; static struct afswtch af_vlan = { .af_name= "af_vlan", ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r204151 - head/sys/dev/bge
Author: yongari Date: Sat Feb 20 23:21:06 2010 New Revision: 204151 URL: http://svn.freebsd.org/changeset/base/204151 Log: Add TSO support on VLAN. Controller requires VLAN hardware tagging to make TSO work on VLAN. So if VLAN hardware tagging is disabled explicitly clear TSO on VLAN. While I'm here remove duplicated VLAN_CAPABILITIES call. Modified: head/sys/dev/bge/if_bge.c Modified: head/sys/dev/bge/if_bge.c == --- head/sys/dev/bge/if_bge.c Sat Feb 20 23:01:09 2010(r204150) +++ head/sys/dev/bge/if_bge.c Sat Feb 20 23:21:06 2010(r204151) @@ -2816,7 +2816,7 @@ bge_attach(device_t dev) IFCAP_VLAN_MTU; if ((sc->bge_flags & BGE_FLAG_TSO) != 0) { ifp->if_hwassist |= CSUM_TSO; - ifp->if_capabilities |= IFCAP_TSO4; + ifp->if_capabilities |= IFCAP_TSO4 | IFCAP_VLAN_HWTSO; } #ifdef IFCAP_VLAN_HWCSUM ifp->if_capabilities |= IFCAP_VLAN_HWCSUM; @@ -4526,9 +4526,6 @@ bge_ioctl(struct ifnet *ifp, u_long comm ifp->if_hwassist |= BGE_CSUM_FEATURES; else ifp->if_hwassist &= ~BGE_CSUM_FEATURES; -#ifdef VLAN_CAPABILITIES - VLAN_CAPABILITIES(ifp); -#endif } if ((mask & IFCAP_TSO4) != 0 && @@ -4546,16 +4543,21 @@ bge_ioctl(struct ifnet *ifp, u_long comm bge_init(sc); } - if (mask & IFCAP_VLAN_HWTAGGING) { + if ((mask & IFCAP_VLAN_HWTSO) != 0 && + (ifp->if_capabilities & IFCAP_VLAN_HWTSO) != 0) + ifp->if_capenable ^= IFCAP_VLAN_HWTSO; + if ((mask & IFCAP_VLAN_HWTAGGING) != 0 && + (ifp->if_capabilities & IFCAP_VLAN_HWTAGGING) != 0) { ifp->if_capenable ^= IFCAP_VLAN_HWTAGGING; + if ((ifp->if_capenable & IFCAP_VLAN_HWTAGGING) == 0) + ifp->if_capenable &= ~IFCAP_VLAN_HWTSO; BGE_LOCK(sc); bge_setvlan(sc); BGE_UNLOCK(sc); + } #ifdef VLAN_CAPABILITIES - VLAN_CAPABILITIES(ifp); + VLAN_CAPABILITIES(ifp); #endif - } - break; default: error = ether_ioctl(ifp, command, data); ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r204152 - in head/sys: boot/sparc64/loader sparc64/include sparc64/sparc64
Author: marius Date: Sat Feb 20 23:24:19 2010 New Revision: 204152 URL: http://svn.freebsd.org/changeset/base/204152 Log: Some machines can not only consist of CPUs running at different speeds but also of different types, f.e. Sun Fire V890 can be equipped with a mix of UltraSPARC IV and IV+ CPUs, requiring different MMU initialization and different workarounds for model specific errata. Therefore move the CPU implementation number from a global variable to the per-CPU data. Functions which are called before the latter is available are passed the implementation number as a parameter now. Modified: head/sys/boot/sparc64/loader/main.c head/sys/sparc64/include/cache.h head/sys/sparc64/include/cpu.h head/sys/sparc64/include/md_var.h head/sys/sparc64/include/pcpu.h head/sys/sparc64/include/pmap.h head/sys/sparc64/include/smp.h head/sys/sparc64/include/ver.h head/sys/sparc64/sparc64/cache.c head/sys/sparc64/sparc64/cheetah.c head/sys/sparc64/sparc64/identcpu.c head/sys/sparc64/sparc64/iommu.c head/sys/sparc64/sparc64/machdep.c head/sys/sparc64/sparc64/mp_locore.S head/sys/sparc64/sparc64/mp_machdep.c head/sys/sparc64/sparc64/nexus.c head/sys/sparc64/sparc64/pmap.c head/sys/sparc64/sparc64/spitfire.c head/sys/sparc64/sparc64/tick.c head/sys/sparc64/sparc64/trap.c Modified: head/sys/boot/sparc64/loader/main.c == --- head/sys/boot/sparc64/loader/main.c Sat Feb 20 23:21:06 2010 (r204151) +++ head/sys/boot/sparc64/loader/main.c Sat Feb 20 23:24:19 2010 (r204152) @@ -137,7 +137,7 @@ struct tlb_entry *dtlb_store; struct tlb_entry *itlb_store; u_int dtlb_slot; u_int itlb_slot; -int cpu_impl; +static int cpu_impl; static u_int dtlb_slot_max; static u_int itlb_slot_max; Modified: head/sys/sparc64/include/cache.h == --- head/sys/sparc64/include/cache.hSat Feb 20 23:21:06 2010 (r204151) +++ head/sys/sparc64/include/cache.hSat Feb 20 23:24:19 2010 (r204152) @@ -91,7 +91,7 @@ struct cacheinfo { struct pcpu; -typedef void cache_enable_t(void); +typedef void cache_enable_t(u_int cpu_impl); typedef void cache_flush_t(void); typedef void dcache_page_inval_t(vm_paddr_t pa); typedef void icache_page_inval_t(vm_paddr_t pa); Modified: head/sys/sparc64/include/cpu.h == --- head/sys/sparc64/include/cpu.h Sat Feb 20 23:21:06 2010 (r204151) +++ head/sys/sparc64/include/cpu.h Sat Feb 20 23:24:19 2010 (r204152) @@ -52,7 +52,7 @@ extern char btext[]; extern char etext[]; -void cheetah_init(void); +void cheetah_init(u_int cpu_impl); void cpu_halt(void); void cpu_reset(void); void fork_trampoline(void); Modified: head/sys/sparc64/include/md_var.h == --- head/sys/sparc64/include/md_var.h Sat Feb 20 23:21:06 2010 (r204151) +++ head/sys/sparc64/include/md_var.h Sat Feb 20 23:24:19 2010 (r204152) @@ -47,8 +47,8 @@ externvm_paddr_t kstack0_phys; struct pcpu; struct md_utrap; -const char *cpu_cpuid_prop(void); -uint32_t cpu_get_mid(void); +const char *cpu_cpuid_prop(u_int cpu_impl); +uint32_t cpu_get_mid(u_int cpu_impl); void cpu_identify(u_long vers, u_int clock, u_int id); void cpu_setregs(struct pcpu *pc); intis_physical_memory(vm_paddr_t addr); Modified: head/sys/sparc64/include/pcpu.h == --- head/sys/sparc64/include/pcpu.h Sat Feb 20 23:21:06 2010 (r204151) +++ head/sys/sparc64/include/pcpu.h Sat Feb 20 23:24:19 2010 (r204152) @@ -54,6 +54,7 @@ struct pmap; u_long pc_tickref; \ u_long pc_tickadj; \ u_int pc_clock; \ + u_int pc_impl;\ u_int pc_mid; \ u_int pc_node;\ u_int pc_tlb_ctx; \ Modified: head/sys/sparc64/include/pmap.h == --- head/sys/sparc64/include/pmap.h Sat Feb 20 23:21:06 2010 (r204151) +++ head/sys/sparc64/include/pmap.h Sat Feb 20 23:24:19 2010 (r204152) @@ -80,7 +80,7 @@ struct pmap { #definepmap_page_get_memattr(m)VM_MEMATTR_DEFAULT #definepmap_page_set_memattr(m, ma)(void)0 -void pmap_bootstrap(void); +void pmap_bootstrap(u_int cpu_impl); vm_paddr_t pmap_kextract(vm_offset_t va); void pmap_kenter(vm_offset_t va, v
svn commit: r204153 - head/sys/sparc64/sparc64
Author: marius Date: Sat Feb 20 23:42:24 2010 New Revision: 204153 URL: http://svn.freebsd.org/changeset/base/204153 Log: Starting with UltraSPARC IV CPUs the CPU caches are described with different OFW properties. Modified: head/sys/sparc64/sparc64/cache.c Modified: head/sys/sparc64/sparc64/cache.c == --- head/sys/sparc64/sparc64/cache.cSat Feb 20 23:24:19 2010 (r204152) +++ head/sys/sparc64/sparc64/cache.cSat Feb 20 23:42:24 2010 (r204153) @@ -43,6 +43,7 @@ */ /*- * Copyright (c) 2001 by Thomas Moestl . + * Copyright (c) 2008, 2010 Marius Strobl * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -89,32 +90,49 @@ icache_page_inval_t *icache_page_inval; #defineOF_GET(h, n, v) OF_getprop((h), (n), &(v), sizeof(v)) +static u_int cache_new_prop(u_int cpu_impl); + +static u_int +cache_new_prop(u_int cpu_impl) +{ + + switch (cpu_impl) { + case CPU_IMPL_ULTRASPARCIV: + case CPU_IMPL_ULTRASPARCIVp: + return (1); + default: + return (0); + } +} + /* - * Fill in the cache parameters using the cpu node. + * Fill in the cache parameters using the CPU node. */ void cache_init(struct pcpu *pcpu) { u_long set; + u_int use_new_prop; - if (OF_GET(pcpu->pc_node, "icache-size", - pcpu->pc_cache.ic_size) == -1 || - OF_GET(pcpu->pc_node, "icache-line-size", - pcpu->pc_cache.ic_linesize) == -1 || - OF_GET(pcpu->pc_node, "icache-associativity", - pcpu->pc_cache.ic_assoc) == -1 || - OF_GET(pcpu->pc_node, "dcache-size", - pcpu->pc_cache.dc_size) == -1 || - OF_GET(pcpu->pc_node, "dcache-line-size", - pcpu->pc_cache.dc_linesize) == -1 || - OF_GET(pcpu->pc_node, "dcache-associativity", - pcpu->pc_cache.dc_assoc) == -1 || - OF_GET(pcpu->pc_node, "ecache-size", - pcpu->pc_cache.ec_size) == -1 || - OF_GET(pcpu->pc_node, "ecache-line-size", - pcpu->pc_cache.ec_linesize) == -1 || - OF_GET(pcpu->pc_node, "ecache-associativity", - pcpu->pc_cache.ec_assoc) == -1) + use_new_prop = cache_new_prop(pcpu->pc_impl); + if (OF_GET(pcpu->pc_node, !use_new_prop ? "icache-size" : + "l1-icache-size", pcpu->pc_cache.ic_size) == -1 || + OF_GET(pcpu->pc_node, !use_new_prop ? "icache-line-size" : + "l1-icache-line-size", pcpu->pc_cache.ic_linesize) == -1 || + OF_GET(pcpu->pc_node, !use_new_prop ? "icache-associativity" : + "l1-icache-associativity", pcpu->pc_cache.ic_assoc) == -1 || + OF_GET(pcpu->pc_node, !use_new_prop ? "dcache-size" : + "l1-dcache-size", pcpu->pc_cache.dc_size) == -1 || + OF_GET(pcpu->pc_node, !use_new_prop ? "dcache-line-size" : + "l1-dcache-line-size", pcpu->pc_cache.dc_linesize) == -1 || + OF_GET(pcpu->pc_node, !use_new_prop ? "dcache-associativity" : + "l1-dcache-associativity", pcpu->pc_cache.dc_assoc) == -1 || + OF_GET(pcpu->pc_node, !use_new_prop ? "ecache-size" : + "l2-cache-size", pcpu->pc_cache.ec_size) == -1 || + OF_GET(pcpu->pc_node, !use_new_prop ? "ecache-line-size" : + "l2-cache-line-size", pcpu->pc_cache.ec_linesize) == -1 || + OF_GET(pcpu->pc_node, !use_new_prop ? "ecache-associativity" : + "l2-cache-associativity", pcpu->pc_cache.ec_assoc) == -1) panic("cache_init: could not retrieve cache parameters"); set = pcpu->pc_cache.ic_size / pcpu->pc_cache.ic_assoc; ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r204155 - head/sys/dev/re
Author: yongari Date: Sun Feb 21 00:00:55 2010 New Revision: 204155 URL: http://svn.freebsd.org/changeset/base/204155 Log: Increase PCIe maximuim read request size to 2048. Because re(4) uses Tx DMA burst size 2048, I beleive PCIe maximum read request size also should match to the value of Tx DMA burst size. With this change I can get more than 800Mbps for TCP bulk transfers. Previously I was not able to get more than 700Mbps. If I enable TSO it now shows 927Mbps. Modified: head/sys/dev/re/if_re.c Modified: head/sys/dev/re/if_re.c == --- head/sys/dev/re/if_re.c Sat Feb 20 23:48:04 2010(r204154) +++ head/sys/dev/re/if_re.c Sun Feb 21 00:00:55 2010(r204155) @@ -1162,6 +1162,9 @@ re_attach(device_t dev) msic = 0; if (pci_find_extcap(dev, PCIY_EXPRESS, ®) == 0) { sc->rl_flags |= RL_FLAG_PCIE; + /* Set PCIe maximum read request size to 2048. */ + if (pci_get_max_read_req(dev) < 2048) + pci_set_max_read_req(dev, 2048); msic = pci_msi_count(dev); if (bootverbose) device_printf(dev, "MSI count : %d\n", msic); ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r204156 - head/sys/net
Author: yongari Date: Sun Feb 21 00:07:45 2010 New Revision: 204156 URL: http://svn.freebsd.org/changeset/base/204156 Log: Add __FBSDID. Reviewed by: sam Modified: head/sys/net/if_vlan.c Modified: head/sys/net/if_vlan.c == --- head/sys/net/if_vlan.c Sun Feb 21 00:00:55 2010(r204155) +++ head/sys/net/if_vlan.c Sun Feb 21 00:07:45 2010(r204156) @@ -25,8 +25,6 @@ * 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$ */ /* @@ -41,6 +39,9 @@ * and ask it to send them. */ +#include +__FBSDID("$FreeBSD$"); + #include "opt_vlan.h" #include ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r204157 - head/sys/i386/conf
Author: kmacy Date: Sun Feb 21 01:06:07 2010 New Revision: 204157 URL: http://svn.freebsd.org/changeset/base/204157 Log: remove atkbd from default config to avoid pulling in real-mode bios emulation Modified: head/sys/i386/conf/XEN Modified: head/sys/i386/conf/XEN == --- head/sys/i386/conf/XEN Sun Feb 21 00:07:45 2010(r204156) +++ head/sys/i386/conf/XEN Sun Feb 21 01:06:07 2010(r204157) @@ -67,12 +67,12 @@ options SMP # Symmetric MultiProcesso device apic# I/O APIC -device atkbdc # AT keyboard controller -device atkbd # AT keyboard +#deviceatkbdc # AT keyboard controller +#deviceatkbd # AT keyboard device psm # PS/2 mouse device pci -device kbdmux # keyboard multiplexer +#devicekbdmux # keyboard multiplexer # Pseudo devices. device loop# Network loopback ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r204158 - head/sys/dev/xen/netfront
Author: kmacy Date: Sun Feb 21 01:11:39 2010 New Revision: 204158 URL: http://svn.freebsd.org/changeset/base/204158 Log: - make printf conditional - fix witness warnings by making configuration lock a mutex Modified: head/sys/dev/xen/netfront/netfront.c Modified: head/sys/dev/xen/netfront/netfront.c == --- head/sys/dev/xen/netfront/netfront.cSun Feb 21 01:06:07 2010 (r204157) +++ head/sys/dev/xen/netfront/netfront.cSun Feb 21 01:11:39 2010 (r204158) @@ -81,7 +81,7 @@ __FBSDID("$FreeBSD$"); #include "xenbus_if.h" -#define XN_CSUM_FEATURES (CSUM_TCP | CSUM_UDP | CSUM_TSO) +#define XN_CSUM_FEATURES (CSUM_TCP | CSUM_UDP) #define GRANT_INVALID_REF 0 @@ -233,7 +233,7 @@ struct netfront_info { struct mtx tx_lock; struct mtx rx_lock; - struct sxsc_lock; + struct mtx sc_lock; u_int handle; u_int irq; @@ -280,7 +280,7 @@ struct netfront_info { #define XN_LOCK_INIT(_sc, _name) \ mtx_init(&(_sc)->tx_lock, #_name"_tx", "network transmit lock", MTX_DEF); \ mtx_init(&(_sc)->rx_lock, #_name"_rx", "network receive lock", MTX_DEF); \ -sx_init(&(_sc)->sc_lock, #_name"_rx") +mtx_init(&(_sc)->sc_lock, #_name"_sc", "netfront softc lock", MTX_DEF) #define XN_RX_LOCK(_sc) mtx_lock(&(_sc)->rx_lock) #define XN_RX_UNLOCK(_sc) mtx_unlock(&(_sc)->rx_lock) @@ -288,15 +288,15 @@ struct netfront_info { #define XN_TX_LOCK(_sc) mtx_lock(&(_sc)->tx_lock) #define XN_TX_UNLOCK(_sc) mtx_unlock(&(_sc)->tx_lock) -#define XN_LOCK(_sc) sx_xlock(&(_sc)->sc_lock); -#define XN_UNLOCK(_sc) sx_xunlock(&(_sc)->sc_lock); +#define XN_LOCK(_sc) mtx_lock(&(_sc)->sc_lock); +#define XN_UNLOCK(_sc) mtx_unlock(&(_sc)->sc_lock); -#define XN_LOCK_ASSERT(_sc)sx_assert(&(_sc)->sc_lock, SX_LOCKED); +#define XN_LOCK_ASSERT(_sc)mtx_assert(&(_sc)->sc_lock, MA_OWNED); #define XN_RX_LOCK_ASSERT(_sc)mtx_assert(&(_sc)->rx_lock, MA_OWNED); #define XN_TX_LOCK_ASSERT(_sc)mtx_assert(&(_sc)->tx_lock, MA_OWNED); #define XN_LOCK_DESTROY(_sc) mtx_destroy(&(_sc)->rx_lock); \ mtx_destroy(&(_sc)->tx_lock); \ - sx_destroy(&(_sc)->sc_lock); + mtx_destroy(&(_sc)->sc_lock); struct netfront_rx_info { struct netif_rx_response rx; @@ -361,9 +361,13 @@ xennet_get_rx_ref(struct netfront_info * #define IPRINTK(fmt, args...) \ printf("[XEN] " fmt, ##args) +#ifdef INVARIANTS #define WPRINTK(fmt, args...) \ printf("[XEN] " fmt, ##args) -#if 0 +#else +#define WPRINTK(fmt, args...) +#endif +#ifdef DEBUG #define DPRINTK(fmt, args...) \ printf("[XEN] %s: " fmt, __func__, ##args) #else @@ -1085,7 +1089,7 @@ xn_txeof(struct netfront_info *np) ifp->if_opackets++; if (unlikely(gnttab_query_foreign_access( np->grant_tx_ref[id]) != 0)) { - printf("network_tx_buf_gc: warning " + WPRINTK("network_tx_buf_gc: warning " "-- grant still in use by backend " "domain.\n"); goto out; @@ -1260,7 +1264,7 @@ xennet_get_responses(struct netfront_inf u_long mfn; #if 0 - printf("rx->status=%hd rx->offset=%hu frags=%u\n", + DPRINTK("rx->status=%hd rx->offset=%hu frags=%u\n", rx->status, rx->offset, frags); #endif if (unlikely(rx->status < 0 || @@ -1474,7 +1478,7 @@ xn_start_locked(struct ifnet *ifp) * slot [0] free for the freelist head */ if (sc->xn_cdata.xn_tx_chain_cnt + nfrags >= NET_TX_RING_SIZE) { - printf("xn_start_locked: xn_tx_chain_cnt (%d) + nfrags %d >= NET_TX_RING_SIZE (%d); must be full!\n", + WPRINTK("xn_start_locked: xn_tx_chain_cnt (%d) + nfrags %d >= NET_TX_RING_SIZE (%d); must be full!\n", (int) sc->xn_cdata.xn_tx_chain_cnt, (int) nfrags, (int) NET_TX_RING_SIZE); IF_PREPEND(&ifp->if_snd, m_head); @@ -1490,7 +1494,7 @@ xn_start_locked(struct ifnet *ifp) * the required size. */ if (RING_FREE_REQUESTS(&sc->tx) < (nfrags + 1)) { - printf("xn_start_locked: free ring slots (%d) < (nfrags + 1) (%d); must be full!\n", + WPRINTK("xn_start_locked: free ring slots (%d) < (nfrags + 1) (%d); must be full!\n", (int) RING_FREE_REQUESTS(&sc->tx), (int) (nfrags + 1)); IF_
svn commit: r204159 - head/sys/xen/evtchn
Author: kmacy Date: Sun Feb 21 01:12:18 2010 New Revision: 204159 URL: http://svn.freebsd.org/changeset/base/204159 Log: don't hold spin lock across free Modified: head/sys/xen/evtchn/evtchn_dev.c Modified: head/sys/xen/evtchn/evtchn_dev.c == --- head/sys/xen/evtchn/evtchn_dev.cSun Feb 21 01:11:39 2010 (r204158) +++ head/sys/xen/evtchn/evtchn_dev.cSun Feb 21 01:12:18 2010 (r204159) @@ -302,11 +302,11 @@ evtchn_close(struct cdev *dev, int flag, { int i; - mtx_lock_spin(&lock); if (ring != NULL) { free(ring, M_DEVBUF); ring = NULL; } + mtx_lock_spin(&lock); for ( i = 0; i < NR_EVENT_CHANNELS; i++ ) if ( synch_test_and_clear_bit(i, &bound_ports[0]) ) mask_evtchn(i); ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r204160 - head/sys/i386/xen
Author: kmacy Date: Sun Feb 21 01:13:34 2010 New Revision: 204160 URL: http://svn.freebsd.org/changeset/base/204160 Log: - fix bootstrap for variable KVA_PAGES - remove unused CADDR1 - hold lock across page table update MFC after:3 days Modified: head/sys/i386/xen/pmap.c head/sys/i386/xen/xen_machdep.c Modified: head/sys/i386/xen/pmap.c == --- head/sys/i386/xen/pmap.cSun Feb 21 01:12:18 2010(r204159) +++ head/sys/i386/xen/pmap.cSun Feb 21 01:13:34 2010(r204160) @@ -251,9 +251,8 @@ struct sysmaps { caddr_t CADDR2; }; static struct sysmaps sysmaps_pcpu[MAXCPU]; -pt_entry_t *CMAP1 = 0; static pt_entry_t *CMAP3; -caddr_t CADDR1 = 0, ptvmmap = 0; +caddr_t ptvmmap = 0; static caddr_t CADDR3; struct msgbuf *msgbufp = 0; @@ -454,8 +453,9 @@ pmap_bootstrap(vm_paddr_t firstaddr) mtx_init(&sysmaps->lock, "SYSMAPS", NULL, MTX_DEF); SYSMAP(caddr_t, sysmaps->CMAP1, sysmaps->CADDR1, 1) SYSMAP(caddr_t, sysmaps->CMAP2, sysmaps->CADDR2, 1) + PT_SET_MA(sysmaps->CADDR1, 0); + PT_SET_MA(sysmaps->CADDR2, 0); } - SYSMAP(caddr_t, CMAP1, CADDR1, 1) SYSMAP(caddr_t, CMAP3, CADDR3, 1) PT_SET_MA(CADDR3, 0); @@ -483,7 +483,6 @@ pmap_bootstrap(vm_paddr_t firstaddr) mtx_init(&PMAP2mutex, "PMAP2", NULL, MTX_DEF); virtual_avail = va; - PT_SET_MA(CADDR1, 0); /* * Leave in place an identity mapping (virt == phys) for the low 1 MB @@ -1061,7 +1060,9 @@ pmap_pte(pmap_t pmap, vm_offset_t va) mtx_lock(&PMAP2mutex); newpf = *pde & PG_FRAME; if ((*PMAP2 & PG_FRAME) != newpf) { + vm_page_lock_queues(); PT_SET_MA(PADDR2, newpf | PG_V | PG_A | PG_M); + vm_page_unlock_queues(); CTR3(KTR_PMAP, "pmap_pte: pmap=%p va=0x%x newpte=0x%08x", pmap, va, (*PMAP2 & 0x)); } Modified: head/sys/i386/xen/xen_machdep.c == --- head/sys/i386/xen/xen_machdep.c Sun Feb 21 01:12:18 2010 (r204159) +++ head/sys/i386/xen/xen_machdep.c Sun Feb 21 01:13:34 2010 (r204160) @@ -869,23 +869,25 @@ extern unsigned long physfree; int pdir, curoffset; extern int nkpt; +extern uint32_t kernbase; + void initvalues(start_info_t *startinfo) { - int l3_pages, l2_pages, l1_pages, offset; vm_offset_t cur_space, cur_space_pt; struct physdev_set_iopl set_iopl; - vm_paddr_t KPTphys, IdlePTDma; + int l3_pages, l2_pages, l1_pages, offset; vm_paddr_t console_page_ma, xen_store_ma; - vm_offset_t KPTphysoff, tmpva; + vm_offset_t tmpva; vm_paddr_t shinfo; #ifdef PAE vm_paddr_t IdlePDPTma, IdlePDPTnewma; vm_paddr_t IdlePTDnewma[4]; pd_entry_t *IdlePDPTnew, *IdlePTDnew; + vm_paddr_t IdlePTDma[4]; #else - vm_paddr_t pdir_shadow_ma; + vm_paddr_t IdlePTDma[1]; #endif unsigned long i; int ncpus = MAXCPU; @@ -921,11 +923,9 @@ initvalues(start_info_t *startinfo) * Note that only one page directory has been allocated at this point. * Thus, if KERNBASE */ -#if 0 for (i = 0; i < l2_pages; i++) IdlePTDma[i] = xpmap_ptom(VTOP(IdlePTD + i*PAGE_SIZE)); -#endif - + l2_pages = (l2_pages == 0) ? 1 : l2_pages; #else l3_pages = 0; @@ -938,10 +938,11 @@ initvalues(start_info_t *startinfo) break; l1_pages++; } - + /* number of pages allocated after the pts + 1*/; cur_space = xen_start_info->pt_base + - ((xen_start_info->nr_pt_frames) + 3 )*PAGE_SIZE; + (l3_pages + l2_pages + l1_pages + 1)*PAGE_SIZE; + printk("initvalues(): wooh - availmem=%x,%x\n", avail_space, cur_space); printk("KERNBASE=%x,pt_base=%x, VTOPFN(base)=%x, nr_pt_frames=%x\n", @@ -949,72 +950,15 @@ initvalues(start_info_t *startinfo) xen_start_info->nr_pt_frames); xendebug_flags = 0; /* 0x; */ - /* allocate 4 pages for bootmem allocator */ - bootmem_start = bootmem_current = (char *)cur_space; - cur_space += (4 * PAGE_SIZE); - bootmem_end = (char *)cur_space; - - /* allocate page for gdt */ - gdt = (union descriptor *)cur_space; - cur_space += PAGE_SIZE*ncpus; - -/* allocate page for ldt */ - ldt = (union descriptor *)cur_space; cur_space += PAGE_SIZE; - cur_space += PAGE_SIZE; - - HYPERVISOR_shared_info = (shared_info_t *)cur_space; - cur_space += PAGE_SIZE; - - xen_store = (struct ringbuf_head *)cur_space; - cur_space += PAGE_SIZE; - - con
Re: svn commit: r204145 - head/sys/net
On Sat, Feb 20, 2010 at 10:09:48PM +, Bjoern A. Zeeb wrote: > Author: bz > Date: Sat Feb 20 22:09:48 2010 > New Revision: 204145 > URL: http://svn.freebsd.org/changeset/base/204145 > > Log: > Start to implement ifnet DDB support: > - 'show ifnets' prints a list of ifnet *s per virtual network stack, > - 'show ifnet ' prints fields matching the given ifp. The existing style for this is 'show all xxx', maybe you want to follow that. > We do not yet print the complete set of fields and might want to > factor this out to an extra if_debug.c file in case this grows > a lot[1]. We may also want to grow 'show ifnet ' support[1]. > > Sponsored by: ISPsystem > Suggested by: rwatson [1] > Reviewed by:rwatson > MFC after: 5 days > > Modified: > head/sys/net/if.c > ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r204161 - head/sys/amd64/amd64
Author: alc Date: Sun Feb 21 03:49:39 2010 New Revision: 204161 URL: http://svn.freebsd.org/changeset/base/204161 Log: Since create_pagetables() zeroes the page tables, pmap_bootstrap() needn't zero *CMAP1. Modified: head/sys/amd64/amd64/pmap.c Modified: head/sys/amd64/amd64/pmap.c == --- head/sys/amd64/amd64/pmap.c Sun Feb 21 01:13:34 2010(r204160) +++ head/sys/amd64/amd64/pmap.c Sun Feb 21 03:49:39 2010(r204161) @@ -573,8 +573,6 @@ pmap_bootstrap(vm_paddr_t *firstaddr) virtual_avail = va; - *CMAP1 = 0; - invltlb(); /* Initialize the PAT MSR. */ ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"