Re: svn commit: r250379 - in head/usr.sbin/bsnmpd/modules: . snmp_hast

2013-05-09 Thread Mikolaj Golub
On Wed, May 08, 2013 at 04:44:54PM -0700, Peter Wemm wrote:
> On Wed, May 8, 2013 at 4:25 PM, Peter Wemm  wrote:
> > On Wed, May 8, 2013 at 1:03 PM, Mikolaj Golub  wrote:
> >> Author: trociny
> >> Date: Wed May  8 20:03:37 2013
> >> New Revision: 250379
> >> URL: http://svnweb.freebsd.org/changeset/base/250379
> >>
> >> Log:
> >>   HAST module for bsnmpd(1).
> >>
> >>   Reviewed by:  harti, pjd
> >>   MFC after:2 weeks
> >
> > This breaks world on just about everything other than i386, and it is
> > technically broken there too but doesn't actually cause a build
> > failure.
> >
> > You cannot link a .so file against a non-pic library, libl.a in this case.
> >
> > ===> usr.sbin/bsnmpd/modules/snmp_hast (all)^M
> > /usr/obj/usr/src/tmp/usr/bin/ld: 
> > /usr/obj/usr/src/tmp/usr/lib/libl.a(libyywrap.o
> > ): relocation R_X86_64_32 against `a local symbol' can not be used when 
> > making a
> >  shared object; recompile with -fPIC^M
> > /usr/obj/usr/src/tmp/usr/lib/libl.a: could not read symbols: Bad value^M
> > *** [snmp_hast.so.6] Error code 1^M
> 
> 
> Hmm. It seems clang optimizes something away that gcc doesn't.  When
> building with clang the problem doesn't show up.

Sorry for breaking build. I am always running tinderbox before commits
like this, which did not help this time. Now I will run it twice, with
both clang and gcc.

Thank you for r250394. I will investigate how to fix this. Any
suggestions are highly appreciated.

-- 
Mikolaj Golub
___
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: r250379 - in head/usr.sbin/bsnmpd/modules: . snmp_hast

2013-05-09 Thread Konstantin Belousov
On Thu, May 09, 2013 at 10:14:14AM +0300, Mikolaj Golub wrote:
> On Wed, May 08, 2013 at 04:44:54PM -0700, Peter Wemm wrote:
> > On Wed, May 8, 2013 at 4:25 PM, Peter Wemm  wrote:
> > > On Wed, May 8, 2013 at 1:03 PM, Mikolaj Golub  wrote:
> > >> Author: trociny
> > >> Date: Wed May  8 20:03:37 2013
> > >> New Revision: 250379
> > >> URL: http://svnweb.freebsd.org/changeset/base/250379
> > >>
> > >> Log:
> > >>   HAST module for bsnmpd(1).
> > >>
> > >>   Reviewed by:  harti, pjd
> > >>   MFC after:2 weeks
> > >
> > > This breaks world on just about everything other than i386, and it is
> > > technically broken there too but doesn't actually cause a build
> > > failure.
> > >
> > > You cannot link a .so file against a non-pic library, libl.a in this case.
> > >
> > > ===> usr.sbin/bsnmpd/modules/snmp_hast (all)^M
> > > /usr/obj/usr/src/tmp/usr/bin/ld: 
> > > /usr/obj/usr/src/tmp/usr/lib/libl.a(libyywrap.o
> > > ): relocation R_X86_64_32 against `a local symbol' can not be used when 
> > > making a
> > >  shared object; recompile with -fPIC^M
> > > /usr/obj/usr/src/tmp/usr/lib/libl.a: could not read symbols: Bad value^M
> > > *** [snmp_hast.so.6] Error code 1^M
> > 
> > 
> > Hmm. It seems clang optimizes something away that gcc doesn't.  When
> > building with clang the problem doesn't show up.
> 
> Sorry for breaking build. I am always running tinderbox before commits
> like this, which did not help this time. Now I will run it twice, with
> both clang and gcc.
> 
> Thank you for r250394. I will investigate how to fix this. Any
> suggestions are highly appreciated.

Why do you need libl.a ? If only for yywrap(), then re-implementing
it for the module seems to be trivial.


pgpqFQ_cQLBLK.pgp
Description: PGP signature


Re: svn commit: r250379 - in head/usr.sbin/bsnmpd/modules: . snmp_hast

2013-05-09 Thread Mikolaj Golub
On Thu, May 09, 2013 at 11:22:43AM +0300, Konstantin Belousov wrote:
> On Thu, May 09, 2013 at 10:14:14AM +0300, Mikolaj Golub wrote:
> > On Wed, May 08, 2013 at 04:44:54PM -0700, Peter Wemm wrote:
> > > On Wed, May 8, 2013 at 4:25 PM, Peter Wemm  wrote:
> > > > On Wed, May 8, 2013 at 1:03 PM, Mikolaj Golub  
> > > > wrote:
> > > >> Author: trociny
> > > >> Date: Wed May  8 20:03:37 2013
> > > >> New Revision: 250379
> > > >> URL: http://svnweb.freebsd.org/changeset/base/250379
> > > >>
> > > >> Log:
> > > >>   HAST module for bsnmpd(1).
> > > >>
> > > >>   Reviewed by:  harti, pjd
> > > >>   MFC after:2 weeks
> > > >
> > > > This breaks world on just about everything other than i386, and it is
> > > > technically broken there too but doesn't actually cause a build
> > > > failure.
> > > >
> > > > You cannot link a .so file against a non-pic library, libl.a in this 
> > > > case.
> > > >
> > > > ===> usr.sbin/bsnmpd/modules/snmp_hast (all)^M
> > > > /usr/obj/usr/src/tmp/usr/bin/ld: 
> > > > /usr/obj/usr/src/tmp/usr/lib/libl.a(libyywrap.o
> > > > ): relocation R_X86_64_32 against `a local symbol' can not be used when 
> > > > making a
> > > >  shared object; recompile with -fPIC^M
> > > > /usr/obj/usr/src/tmp/usr/lib/libl.a: could not read symbols: Bad value^M
> > > > *** [snmp_hast.so.6] Error code 1^M
> > > 
> > > 
> > > Hmm. It seems clang optimizes something away that gcc doesn't.  When
> > > building with clang the problem doesn't show up.
> > 
> > Sorry for breaking build. I am always running tinderbox before commits
> > like this, which did not help this time. Now I will run it twice, with
> > both clang and gcc.
> > 
> > Thank you for r250394. I will investigate how to fix this. Any
> > suggestions are highly appreciated.
> 
> Why do you need libl.a ? If only for yywrap(), then re-implementing
> it for the module seems to be trivial.

Yes, it is like so. Thanks! I am now considering two possible
solutions:

1) As it is suggested above, add trivial yywrap() and link without -ll.

2) Add '%option noyywrap' to hastd/token.l, and link hastd, hastctl
and snmp_hast without -ll (it looks like yywrap is needed only when
parsing more than one file).

See the patches below. It looks both solutions work for me and I
personally prefer the second one.

-- 
Mikolaj Golub
Index: usr.sbin/bsnmpd/modules/snmp_hast/yywrap.c
===
--- usr.sbin/bsnmpd/modules/snmp_hast/yywrap.c	(revision 0)
+++ usr.sbin/bsnmpd/modules/snmp_hast/yywrap.c	(working copy)
@@ -0,0 +1,8 @@
+int yywrap(void);
+
+int
+yywrap(void)
+{
+
+	return (1);
+}

Index: usr.sbin/bsnmpd/modules/snmp_hast/Makefile
===
--- usr.sbin/bsnmpd/modules/snmp_hast/Makefile	(revision 250379)
+++ usr.sbin/bsnmpd/modules/snmp_hast/Makefile	(working copy)
@@ -12,7 +12,7 @@ SRCS+=	nv.c
 SRCS+=	parse.y pjdlog.c
 SRCS+=	proto.c proto_common.c proto_uds.c
 SRCS+=	token.l
-SRCS+=	y.tab.h
+SRCS+=	y.tab.h yywrap.c
 MAN=	snmp_hast.8
 
 NO_WFORMAT=
@@ -30,7 +30,7 @@ CFLAGS+=-DYY_NO_INPUT
 CFLAGS+= -DSNMPTREE_TYPES
 
 DPADD=	${LIBL} ${LIBUTIL}
-LDADD=	-ll -lutil
+LDADD=	-lutil
 
 XSYM=	begemotHast
 DEFS=	${MOD}_tree.def
Index: sbin/hastd/Makefile
===
--- sbin/hastd/Makefile	(revision 250377)
+++ sbin/hastd/Makefile	(working copy)
@@ -31,7 +31,7 @@ CFLAGS+=-DINET6
 .endif
 
 DPADD=	${LIBGEOM} ${LIBBSDXML} ${LIBSBUF} ${LIBL} ${LIBPTHREAD} ${LIBUTIL}
-LDADD=	-lgeom -lbsdxml -lsbuf -ll -lpthread -lutil
+LDADD=	-lgeom -lbsdxml -lsbuf -lpthread -lutil
 .if ${MK_OPENSSL} != "no"
 DPADD+=	${LIBCRYPTO}
 LDADD+=	-lcrypto
Index: sbin/hastd/token.l
===
--- sbin/hastd/token.l	(revision 250377)
+++ sbin/hastd/token.l	(working copy)
@@ -46,6 +46,7 @@ int lineno;
 
 %option noinput
 %option nounput
+%option noyywrap
 
 %%
 control			{ DP; return CONTROL; }
Index: sbin/hastctl/Makefile
===
--- sbin/hastctl/Makefile	(revision 250377)
+++ sbin/hastctl/Makefile	(working copy)
@@ -32,8 +32,8 @@ CFLAGS+=-DINET6
 CFLAGS+=-DYY_NO_UNPUT
 CFLAGS+=-DYY_NO_INPUT
 
-DPADD=	${LIBL} ${LIBUTIL}
-LDADD=	-ll -lutil
+DPADD=	${LIBUTIL}
+LDADD=	-lutil
 .if ${MK_OPENSSL} != "no"
 DPADD+=	${LIBCRYPTO}
 LDADD+=	-lcrypto
Index: usr.sbin/bsnmpd/modules/snmp_hast/Makefile
===
--- usr.sbin/bsnmpd/modules/snmp_hast/Makefile	(revision 250379)
+++ usr.sbin/bsnmpd/modules/snmp_hast/Makefile	(working copy)
@@ -29,8 +29,8 @@ CFLAGS+=-DYY_NO_UNPUT
 CFLAGS+=-DYY_NO_INPUT
 CFLAGS+= -DSNMPTREE_TYPES
 
-DPADD=	${LIBL} ${LIBUTIL}
-LDADD=	-ll -lutil
+DPADD=	${LIBUTIL}
+LDADD=	-lutil
 
 XSYM=	begemotHast
 DEFS=	${MOD}_tree.def
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn

svn commit: r250405 - head/usr.sbin/bsnmpd/modules/snmp_hast

2013-05-09 Thread Mikolaj Golub
Author: trociny
Date: Thu May  9 11:10:46 2013
New Revision: 250405
URL: http://svnweb.freebsd.org/changeset/base/250405

Log:
  Move snmp_hast manual to section 3, where all other manual pages for
  bsnmp modules are located.
  
  Section 3 (Library Functions) looks wrong for this manual page, which
  contains only module description, that is why initially it was located
  to section 8 (System Manager's Manual).  On the other hand manual
  pages for all other bsnmpd modules are already located in the section
  3, and having all pages in one section looks more consistent.  Also,
  currently, similarly to manuals for other modules, snmp_hast manual
  contains LIBRARY section, which is not good style for section 8.
  
  Requested by: joel
  X-MFC with:   r250379

Added:
  head/usr.sbin/bsnmpd/modules/snmp_hast/snmp_hast.3
 - copied, changed from r250379, 
head/usr.sbin/bsnmpd/modules/snmp_hast/snmp_hast.8
Deleted:
  head/usr.sbin/bsnmpd/modules/snmp_hast/snmp_hast.8
Modified:
  head/usr.sbin/bsnmpd/modules/snmp_hast/Makefile

Modified: head/usr.sbin/bsnmpd/modules/snmp_hast/Makefile
==
--- head/usr.sbin/bsnmpd/modules/snmp_hast/Makefile Thu May  9 08:30:28 
2013(r250404)
+++ head/usr.sbin/bsnmpd/modules/snmp_hast/Makefile Thu May  9 11:10:46 
2013(r250405)
@@ -13,7 +13,7 @@ SRCS+=parse.y pjdlog.c
 SRCS+= proto.c proto_common.c proto_uds.c
 SRCS+= token.l
 SRCS+= y.tab.h
-MAN=   snmp_hast.8
+MAN=   snmp_hast.3
 
 NO_WFORMAT=
 NO_WCAST_ALIGN=

Copied and modified: head/usr.sbin/bsnmpd/modules/snmp_hast/snmp_hast.3 (from 
r250379, head/usr.sbin/bsnmpd/modules/snmp_hast/snmp_hast.8)
==
--- head/usr.sbin/bsnmpd/modules/snmp_hast/snmp_hast.8  Wed May  8 20:03:37 
2013(r250379, copy source)
+++ head/usr.sbin/bsnmpd/modules/snmp_hast/snmp_hast.3  Thu May  9 11:10:46 
2013(r250405)
@@ -25,8 +25,8 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd May 1, 2013
-.Dt SNMP_HAST 8
+.Dd May 9, 2013
+.Dt SNMP_HAST 3
 .Os
 .Sh NAME
 .Nm snmp_hast
___
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: r250406 - head/lib/libc/gen

2013-05-09 Thread Jilles Tjoelker
Author: jilles
Date: Thu May  9 11:43:45 2013
New Revision: 250406
URL: http://svnweb.freebsd.org/changeset/base/250406

Log:
  wordexp(): Simplify code by deferring work to sh.

Modified:
  head/lib/libc/gen/wordexp.c

Modified: head/lib/libc/gen/wordexp.c
==
--- head/lib/libc/gen/wordexp.c Thu May  9 11:10:46 2013(r250405)
+++ head/lib/libc/gen/wordexp.c Thu May  9 11:43:45 2013(r250406)
@@ -139,25 +139,15 @@ we_askshell(const char *words, wordexp_t
 * We are the child; just get /bin/sh to run the wordexp
 * builtin on `words'.
 */
-   int devnull;
-   char *cmd;
-
(void)_sigprocmask(SIG_SETMASK, &oldsigblock, NULL);
_close(pdes[0]);
if (_dup2(pdes[1], STDOUT_FILENO) < 0)
_exit(1);
_close(pdes[1]);
-   if (asprintf(&cmd, "wordexp %s\n", words) < 0)
-   _exit(1);
-   if ((flags & WRDE_SHOWERR) == 0) {
-   if ((devnull = _open(_PATH_DEVNULL, O_RDWR, 0666)) < 0)
-   _exit(1);
-   if (_dup2(devnull, STDERR_FILENO) < 0)
-   _exit(1);
-   _close(devnull);
-   }
execl(_PATH_BSHELL, "sh", flags & WRDE_UNDEF ? "-u" : "+u",
-   "-c", cmd, (char *)NULL);
+   "-c", "eval \"$1\";eval \"wordexp $2\"", "",
+   flags & WRDE_SHOWERR ? "" : "exec 2>/dev/null", words,
+   (char *)NULL);
_exit(1);
}
 
___
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: r250379 - in head/usr.sbin/bsnmpd/modules: . snmp_hast

2013-05-09 Thread Konstantin Belousov
On Thu, May 09, 2013 at 01:05:35PM +0300, Mikolaj Golub wrote:
> Yes, it is like so. Thanks! I am now considering two possible
> solutions:
> 
> 1) As it is suggested above, add trivial yywrap() and link without -ll.
> 
> 2) Add '%option noyywrap' to hastd/token.l, and link hastd, hastctl
> and snmp_hast without -ll (it looks like yywrap is needed only when
> parsing more than one file).
> 
> See the patches below. It looks both solutions work for me and I
> personally prefer the second one.
I do not have any opinion, use what you prefer.


pgp1MNxJlB8Wa.pgp
Description: PGP signature


svn commit: r250407 - in head/usr.sbin/makefs: . compat

2013-05-09 Thread Brooks Davis
Author: brooks
Date: Thu May  9 14:43:36 2013
New Revision: 250407
URL: http://svnweb.freebsd.org/changeset/base/250407

Log:
  Remove duplicated copies of various NetBSD compatibility shims used by
  makefs and use libnetbsd, contrib/mtree, and contrib/mknod instead.
  
  Sponsored by: DARPA, AFRLo
  MFC after:1 month

Deleted:
  head/usr.sbin/makefs/compat/
  head/usr.sbin/makefs/getid.c
Modified:
  head/usr.sbin/makefs/Makefile
  head/usr.sbin/makefs/makefs.h
  head/usr.sbin/makefs/walk.c

Modified: head/usr.sbin/makefs/Makefile
==
--- head/usr.sbin/makefs/Makefile   Thu May  9 11:43:45 2013
(r250406)
+++ head/usr.sbin/makefs/Makefile   Thu May  9 14:43:36 2013
(r250407)
@@ -5,7 +5,6 @@ PROG=   makefs
 CFLAGS+=-I${.CURDIR}
 
 SRCS=  cd9660.c ffs.c \
-   getid.c \
makefs.c \
mtree.c \
walk.c
@@ -15,19 +14,28 @@ WARNS?= 2
 
 .include "${.CURDIR}/cd9660/Makefile.inc"
 .include "${.CURDIR}/ffs/Makefile.inc"
-.include "${.CURDIR}/compat/Makefile.inc"
 
 CFLAGS+=-DHAVE_STRUCT_STAT_ST_FLAGS=1
 CFLAGS+=-DHAVE_STRUCT_STAT_ST_GEN=1
 
-.PATH: ${.CURDIR}/../mtree
-CFLAGS+=-I${.CURDIR}/../mtree
-SRCS+= misc.c spec.c
+.PATH: ${.CURDIR}/../../contrib/mtree
+CFLAGS+=-I${.CURDIR}/../../contrib/mtree
+SRCS+= getid.c misc.c spec.c
+
+.PATH: ${.CURDIR}/../../contrib/mknod
+CFLAGS+=-I${.CURDIR}/../../contrib/mknod
+SRCS+= pack_dev.c
 
 .PATH: ${.CURDIR}/../../sys/ufs/ffs
 SRCS+= ffs_tables.c
 
-DPADD=  ${LIBSBUF}
-LDADD=  -lsbuf
+CFLAGS+=   -I${.CURDIR}/../../lib/libnetbsd
+LIBNETBSDDIR=  ${.OBJDIR}/../../lib/libnetbsd
+LIBNETBSD= ${LIBNETBSDDIR}/libnetbsd.a
+DPADD+=${LIBNETBSD}
+LDADD+=${LIBNETBSD}
+
+DPADD+=  ${LIBSBUF} ${LIBUTIL}
+LDADD+=  -lsbuf -lutil
 
 .include 

Modified: head/usr.sbin/makefs/makefs.h
==
--- head/usr.sbin/makefs/makefs.h   Thu May  9 11:43:45 2013
(r250406)
+++ head/usr.sbin/makefs/makefs.h   Thu May  9 14:43:36 2013
(r250407)
@@ -282,22 +282,4 @@ void   ffs_fragacct_swap(struct fs *, in
 
 fsinode *link_check(fsinode *);
 
-/*
- * Declarations for compat routines.
- */
-long long strsuftoll(const char *, const char *, long long, long long);
-long long strsuftollx(const char *, const char *,
-   long long, long long, char *, size_t);
-
-struct passwd;
-int uid_from_user(const char *, uid_t *);
-int pwcache_userdb(int (*)(int), void (*)(void),
-   struct passwd * (*)(const char *), struct passwd * (*)(uid_t));
-struct group;
-int gid_from_group(const char *, gid_t *);
-int pwcache_groupdb(int (*)(int), void (*)(void),
-   struct group * (*)(const char *), struct group * (*)(gid_t));
-
-int setup_getid(const char *dir);
-
 #endif /* _MAKEFS_H */

Modified: head/usr.sbin/makefs/walk.c
==
--- head/usr.sbin/makefs/walk.c Thu May  9 11:43:45 2013(r250406)
+++ head/usr.sbin/makefs/walk.c Thu May  9 14:43:36 2013(r250407)
@@ -304,7 +304,7 @@ apply_specfile(const char *specfile, con
if ((fp = fopen(specfile, "r")) == NULL)
err(1, "Can't open `%s'", specfile);
TIMER_START(start);
-   root = mtree_readspec(fp);
+   root = spec(fp);
TIMER_RESULTS(start, "spec");
if (fclose(fp) == EOF)
err(1, "Can't close `%s'", specfile);
@@ -320,33 +320,6 @@ apply_specfile(const char *specfile, con
 
 }
 
-static u_int
-nodetoino(u_int type)
-{
-
-   switch (type) {
-   case F_BLOCK:
-   return S_IFBLK;
-   case F_CHAR:
-   return S_IFCHR;
-   case F_DIR:
-   return S_IFDIR;
-   case F_FIFO:
-   return S_IFIFO;
-   case F_FILE:
-   return S_IFREG;
-   case F_LINK:
-   return S_IFLNK;
-   case F_SOCK:
-   return S_IFSOCK;
-   default:
-   printf("unknown type %d", type);
-   abort();
-   }
-   /* NOTREACHED */
-}
-
-
 static void
 apply_specdir(const char *dir, NODE *specnode, fsnode *dirnode, int speconly)
 {
___
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: r250408 - head/sys/dev/ath

2013-05-09 Thread Adrian Chadd
Author: adrian
Date: Thu May  9 15:57:55 2013
New Revision: 250408
URL: http://svnweb.freebsd.org/changeset/base/250408

Log:
  Update the holding buffer locking for EDMA.

Modified:
  head/sys/dev/ath/if_ath_tx_edma.c

Modified: head/sys/dev/ath/if_ath_tx_edma.c
==
--- head/sys/dev/ath/if_ath_tx_edma.c   Thu May  9 14:43:36 2013
(r250407)
+++ head/sys/dev/ath/if_ath_tx_edma.c   Thu May  9 15:57:55 2013
(r250408)
@@ -409,7 +409,7 @@ ath_edma_xmit_handoff_mcast(struct ath_s
wh = mtod(bf_last->bf_m, struct ieee80211_frame *);
wh->i_fc[1] |= IEEE80211_FC1_MORE_DATA;
 
-   /* sync descriptor to memory */
+   /* re-sync buffer to memory */
bus_dmamap_sync(sc->sc_dmat, bf_last->bf_dmamap,
   BUS_DMASYNC_PREWRITE);
 
@@ -734,9 +734,9 @@ ath_edma_tx_processq(struct ath_softc *s
 * buffer any longer.
 */
if (bf->bf_flags & ATH_BUF_FIFOEND) {
-   ATH_TXBUF_LOCK(sc);
+   ATH_TXQ_LOCK(txq);
ath_txq_freeholdingbuf(sc, txq);
-   ATH_TXBUF_UNLOCK(sc);
+   ATH_TXQ_UNLOCK(txq);
}
 
/*
___
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: r250409 - head/sys/kern

2013-05-09 Thread Konstantin Belousov
Author: kib
Date: Thu May  9 16:05:51 2013
New Revision: 250409
URL: http://svnweb.freebsd.org/changeset/base/250409

Log:
  Item 1 in r248830 causes earlier exits from the sendfile(2), before
  all requested data was sent.  The reason is that xfsize <= 0 condition
  must not be tested at all if space == loopbytes.  Otherwise, the done
  is set to 1, and sendfile(2) is aborted too early.
  
  Instead of moving the condition to exiting the inner loop after the
  xfersize check, directly check for the completed transfer before the
  testing of the available space in the socket buffer, and revert item 1
  of r248830.  It is arguably another bug to sleep waiting for socket
  buffer space (or return EAGAIN for non-blocking socket) if all bytes
  are already transferred.
  
  Reported by:  pho
  Discussed with:   scottl, gibbs
  Tested by:scottl (stable/9 backport), pho

Modified:
  head/sys/kern/uipc_syscalls.c

Modified: head/sys/kern/uipc_syscalls.c
==
--- head/sys/kern/uipc_syscalls.c   Thu May  9 15:57:55 2013
(r250408)
+++ head/sys/kern/uipc_syscalls.c   Thu May  9 16:05:51 2013
(r250409)
@@ -1956,6 +1956,17 @@ kern_sendfile(struct thread *td, struct 
goto out;
vn_lock(vp, LK_SHARED | LK_RETRY);
if (vp->v_type == VREG) {
+   bsize = vp->v_mount->mnt_stat.f_iosize;
+   if (uap->nbytes == 0) {
+   error = VOP_GETATTR(vp, &va, td->td_ucred);
+   if (error != 0) {
+   VOP_UNLOCK(vp, 0);
+   obj = NULL;
+   goto out;
+   }
+   rem = va.va_size;
+   } else
+   rem = uap->nbytes;
obj = vp->v_object;
if (obj != NULL) {
/*
@@ -1973,7 +1984,8 @@ kern_sendfile(struct thread *td, struct 
obj = NULL;
}
}
-   }
+   } else
+   bsize = 0;  /* silence gcc */
VOP_UNLOCK(vp, 0);
if (obj == NULL) {
error = EINVAL;
@@ -2065,11 +2077,20 @@ kern_sendfile(struct thread *td, struct 
 * The outer loop checks the state and available space of the socket
 * and takes care of the overall progress.
 */
-   for (off = uap->offset, rem = uap->nbytes; ; ) {
-   struct mbuf *mtail = NULL;
-   int loopbytes = 0;
-   int space = 0;
-   int done = 0;
+   for (off = uap->offset; ; ) {
+   struct mbuf *mtail;
+   int loopbytes;
+   int space;
+   int done;
+
+   if ((uap->nbytes != 0 && uap->nbytes == fsbytes) ||
+   (uap->nbytes == 0 && va.va_size == fsbytes))
+   break;
+
+   mtail = NULL;
+   loopbytes = 0;
+   space = 0;
+   done = 0;
 
/*
 * Check the socket state for ongoing connection,
@@ -2141,17 +2162,16 @@ retry_space:
if (error != 0)
goto done;
error = VOP_GETATTR(vp, &va, td->td_ucred);
-   if (error != 0) {
+   if (error != 0 || off >= va.va_size) {
VOP_UNLOCK(vp, 0);
goto done;
}
-   bsize = vp->v_mount->mnt_stat.f_iosize;
 
/*
 * Loop and construct maximum sized mbuf chain to be bulk
 * dumped into socket buffer.
 */
-   while (1) {
+   while (space > loopbytes) {
vm_pindex_t pindex;
vm_offset_t pgoff;
struct mbuf *m0;
@@ -2175,15 +2195,6 @@ retry_space:
}
 
/*
-* We've already overfilled the socket.
-* Let the outer loop figure out how to handle it.
-*/
-   if (space <= loopbytes) {
-   done = 0;
-   break;
-   }
-
-   /*
 * Attempt to look up the page.  Allocate
 * if not found or wait and loop if busy.
 */
___
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: r250410 - head/usr.sbin/bsdconfig/share/packages

2013-05-09 Thread Devin Teske
Author: dteske
Date: Thu May  9 16:09:39 2013
New Revision: 250410
URL: http://svnweb.freebsd.org/changeset/base/250410

Log:
  Fix a bug that would cause the category menu to display the wrong value
  for number of packages available in the "All" category. Problem caused by
  re-using a variable that was still needed; fixed by variable name change.

Modified:
  head/usr.sbin/bsdconfig/share/packages/index.subr

Modified: head/usr.sbin/bsdconfig/share/packages/index.subr
==
--- head/usr.sbin/bsdconfig/share/packages/index.subr   Thu May  9 16:05:51 
2013(r250409)
+++ head/usr.sbin/bsdconfig/share/packages/index.subr   Thu May  9 16:09:39 
2013(r250410)
@@ -146,11 +146,11 @@ f_index_read()
BEGIN {
valid_chars = ENVIRON["VALID_VARNAME_CHARS"]
default_desc = ENVIRON["msg_no_description_provided"]
-   npkgs = 0
+   tpkgs = 0
prefix = ""
}
{
-   npkgs++
+   tpkgs++
varpkg = $1
gsub("[^" valid_chars "]", "_", varpkg)
print "_categories_" varpkg "=\"" $7 "\""
@@ -160,7 +160,7 @@ f_index_read()
print "_rundeps_" varpkg "=\"" $9 "\""
}
END {
-   print "_npkgs=" npkgs # For convenience, total package count
+   print "_npkgs=" tpkgs # For convenience, total package count
 
n = asorti(categories, categories_sorted)
 
@@ -175,7 +175,7 @@ f_index_read()
 
# Create menu list and generate list of categories at same time
print "CATEGORY_MENU_LIST=\""
-   print_category(ENVIRON["msg_all"], npkgs,
+   print_category(ENVIRON["msg_all"], tpkgs,
   ENVIRON["msg_all_desc"])
category_list = ""
for (i = 1; i <= n; 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: r250411 - in head/sys: conf kern sys

2013-05-09 Thread Marcel Moolenaar
Author: marcel
Date: Thu May  9 16:28:18 2013
New Revision: 250411
URL: http://svnweb.freebsd.org/changeset/base/250411

Log:
  Add option WITNESS_NO_VNODE to suppress printing LORs between VNODE
  locks. To support this, VNODE locks are created with the LK_IS_VNODE
  flag. This flag is propagated down using the LO_IS_VNODE flag.
  
  Note that WITNESS still records the LOR. Only the printing and the
  optional entering into the kernel debugger is bypassed with the
  WITNESS_NO_VNODE option.

Modified:
  head/sys/conf/options
  head/sys/kern/kern_lock.c
  head/sys/kern/subr_witness.c
  head/sys/kern/vfs_subr.c
  head/sys/sys/lock.h
  head/sys/sys/lockmgr.h

Modified: head/sys/conf/options
==
--- head/sys/conf/options   Thu May  9 16:09:39 2013(r250410)
+++ head/sys/conf/options   Thu May  9 16:28:18 2013(r250411)
@@ -672,6 +672,7 @@ KTR_ENTRIES opt_global.h
 KTR_VERBOSEopt_ktr.h
 WITNESSopt_global.h
 WITNESS_KDBopt_witness.h
+WITNESS_NO_VNODE   opt_witness.h
 WITNESS_SKIPSPIN   opt_witness.h
 
 # options for ACPI support

Modified: head/sys/kern/kern_lock.c
==
--- head/sys/kern/kern_lock.c   Thu May  9 16:09:39 2013(r250410)
+++ head/sys/kern/kern_lock.c   Thu May  9 16:28:18 2013(r250411)
@@ -393,6 +393,8 @@ lockinit(struct lock *lk, int pri, const
iflags |= LO_WITNESS;
if (flags & LK_QUIET)
iflags |= LO_QUIET;
+   if (flags & LK_IS_VNODE)
+   iflags |= LO_IS_VNODE;
iflags |= flags & (LK_ADAPTIVE | LK_NOSHARE);
 
lk->lk_lock = LK_UNLOCKED;

Modified: head/sys/kern/subr_witness.c
==
--- head/sys/kern/subr_witness.cThu May  9 16:09:39 2013
(r250410)
+++ head/sys/kern/subr_witness.cThu May  9 16:28:18 2013
(r250411)
@@ -1289,7 +1289,19 @@ witness_checkorder(struct lock_object *l
w->w_reversed = w1->w_reversed = 1;
witness_increment_graph_generation();
mtx_unlock_spin(&w_mtx);
-   
+
+#ifdef WITNESS_NO_VNODE
+   /*
+* There are known LORs between VNODE locks. They are
+* not an indication of a bug. VNODE locks are flagged
+* as such (LO_IS_VNODE) and we don't yell if the LOR
+* is between 2 VNODE locks.
+*/
+   if ((lock->lo_flags & LO_IS_VNODE) != 0 &&
+   (lock1->li_lock->lo_flags & LO_IS_VNODE) != 0)
+   return;
+#endif
+
/*
 * Ok, yell about it.
 */

Modified: head/sys/kern/vfs_subr.c
==
--- head/sys/kern/vfs_subr.cThu May  9 16:09:39 2013(r250410)
+++ head/sys/kern/vfs_subr.cThu May  9 16:28:18 2013(r250411)
@@ -1037,7 +1037,7 @@ alloc:
 * By default, don't allow shared locks unless filesystems
 * opt-in.
 */
-   lockinit(vp->v_vnlock, PVFS, tag, VLKTIMEOUT, LK_NOSHARE);
+   lockinit(vp->v_vnlock, PVFS, tag, VLKTIMEOUT, LK_NOSHARE | LK_IS_VNODE);
/*
 * Initialize bufobj.
 */

Modified: head/sys/sys/lock.h
==
--- head/sys/sys/lock.h Thu May  9 16:09:39 2013(r250410)
+++ head/sys/sys/lock.h Thu May  9 16:28:18 2013(r250411)
@@ -79,6 +79,7 @@ struct lock_class {
 #defineLO_SLEEPABLE0x0010  /* Lock may be held while 
sleeping. */
 #defineLO_UPGRADABLE   0x0020  /* Lock may be 
upgraded/downgraded. */
 #defineLO_DUPOK0x0040  /* Don't check for duplicate 
acquires */
+#defineLO_IS_VNODE 0x0080  /* Tell WITNESS about a VNODE 
lock */
 #defineLO_CLASSMASK0x0f00  /* Class index bitmask. */
 #define LO_NOPROFILE0x1000  /* Don't profile this lock */
 

Modified: head/sys/sys/lockmgr.h
==
--- head/sys/sys/lockmgr.h  Thu May  9 16:09:39 2013(r250410)
+++ head/sys/sys/lockmgr.h  Thu May  9 16:28:18 2013(r250411)
@@ -146,6 +146,7 @@ _lockmgr_args_rw(struct lock *lk, u_int 
 #defineLK_NOWITNESS0x10
 #defineLK_QUIET0x20
 #defineLK_ADAPTIVE 0x40
+#defineLK_IS_VNODE 0x80/* Tell WITNESS about a VNODE 
lock */
 
 /*
  * Additional attributes to be used in lockmgr().
_

svn commit: r250412 - head/lib/libc/gen

2013-05-09 Thread Jilles Tjoelker
Author: jilles
Date: Thu May  9 16:42:01 2013
New Revision: 250412
URL: http://svnweb.freebsd.org/changeset/base/250412

Log:
  posix_spawn_file_actions_addopen(3): Correct error for bad file descriptor.
  
  As per POSIX.1-2008, posix_spawn_file_actions_add* return [EBADF] if a file
  descriptor is negative, not [EINVAL]. The bug was only in the manual page;
  the code is correct.
  
  MFC after:1 week

Modified:
  head/lib/libc/gen/posix_spawn_file_actions_addopen.3

Modified: head/lib/libc/gen/posix_spawn_file_actions_addopen.3
==
--- head/lib/libc/gen/posix_spawn_file_actions_addopen.3Thu May  9 
16:28:18 2013(r250411)
+++ head/lib/libc/gen/posix_spawn_file_actions_addopen.3Thu May  9 
16:42:01 2013(r250412)
@@ -34,7 +34,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd March 24, 2008
+.Dd May 9, 2013
 .Dt POSIX_SPAWN_FILE_ACTIONS_ADDOPEN 3
 .Os
 .Sh NAME
@@ -145,7 +145,7 @@ otherwise, an error number is returned t
 These
 functions fail if:
 .Bl -tag -width Er
-.It Bq Er EINVAL
+.It Bq Er EBADF
 The value specified by
 .Fa fildes
 or
___
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: r250411 - in head/sys: conf kern sys

2013-05-09 Thread Attilio Rao
On Thu, May 9, 2013 at 6:28 PM, Marcel Moolenaar  wrote:
> Author: marcel
> Date: Thu May  9 16:28:18 2013
> New Revision: 250411
> URL: http://svnweb.freebsd.org/changeset/base/250411
>
> Log:
>   Add option WITNESS_NO_VNODE to suppress printing LORs between VNODE
>   locks. To support this, VNODE locks are created with the LK_IS_VNODE
>   flag. This flag is propagated down using the LO_IS_VNODE flag.
>
>   Note that WITNESS still records the LOR. Only the printing and the
>   optional entering into the kernel debugger is bypassed with the
>   WITNESS_NO_VNODE option.

This is the wrong way to deal with such problem and I avoided to do
something like that on purpose.

The way to fix this is to implement LK_NOWITNESS on a per-lock basis
into lockmgr, propagate the same concept to the vn_lock() (which
should be basically done automatically) and finally identify the
false-positive case and commit for them explicitely LK_NOWITNESS on a
per-call basis, explaining in detail why the single case reported is a
false-positive.

Please revert this patch asap.

Attilio


--
Peace can only be achieved by understanding - A. Einstein
___
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: r250413 - head/sys/dev/e1000

2013-05-09 Thread Luigi Rizzo
Author: luigi
Date: Thu May  9 16:57:02 2013
New Revision: 250413
URL: http://svnweb.freebsd.org/changeset/base/250413

Log:
  simplify the code to initialize the RDT while in netmap mode.

Modified:
  head/sys/dev/e1000/if_em.c
  head/sys/dev/e1000/if_lem.c

Modified: head/sys/dev/e1000/if_em.c
==
--- head/sys/dev/e1000/if_em.c  Thu May  9 16:42:01 2013(r250412)
+++ head/sys/dev/e1000/if_em.c  Thu May  9 16:57:02 2013(r250413)
@@ -4333,6 +4333,8 @@ em_initialize_receive_unit(struct adapte
 
for (int i = 0; i < adapter->num_queues; i++, rxr++) {
/* Setup the Base and Length of the Rx Descriptor Ring */
+   u32 rdt = adapter->num_rx_desc - 1; /* default */
+
bus_addr = rxr->rxdma.dma_paddr;
E1000_WRITE_REG(hw, E1000_RDLEN(i),
adapter->num_rx_desc * sizeof(struct e1000_rx_desc));
@@ -4344,18 +4346,11 @@ em_initialize_receive_unit(struct adapte
/*
 * an init() while a netmap client is active must
 * preserve the rx buffers passed to userspace.
-* In this driver it means we adjust RDT to
-* something different from na->num_rx_desc - 1.
 */
-   if (ifp->if_capenable & IFCAP_NETMAP) {
-   struct netmap_adapter *na = NA(adapter->ifp);
-   struct netmap_kring *kring = &na->rx_rings[i];
-   int t = na->num_rx_desc - 1 - kring->nr_hwavail;
-
-   E1000_WRITE_REG(hw, E1000_RDT(i), t);
-   } else
+   if (ifp->if_capenable & IFCAP_NETMAP)
+   rdt -= NA(adapter->ifp)->rx_rings[i].nr_hwavail;
 #endif /* DEV_NETMAP */
-   E1000_WRITE_REG(hw, E1000_RDT(i), adapter->num_rx_desc - 1);
+   E1000_WRITE_REG(hw, E1000_RDT(i), rdt);
}
 
/* Set PTHRESH for improved jumbo performance */

Modified: head/sys/dev/e1000/if_lem.c
==
--- head/sys/dev/e1000/if_lem.c Thu May  9 16:42:01 2013(r250412)
+++ head/sys/dev/e1000/if_lem.c Thu May  9 16:57:02 2013(r250413)
@@ -3361,19 +3361,13 @@ lem_initialize_receive_unit(struct adapt
 * Tail Descriptor Pointers
 */
E1000_WRITE_REG(&adapter->hw, E1000_RDH(0), 0);
+   rctl = adapter->num_rx_desc - 1; /* default RDT value */
 #ifdef DEV_NETMAP
/* preserve buffers already made available to clients */
-   if (ifp->if_capenable & IFCAP_NETMAP) {
-   struct netmap_adapter *na = NA(adapter->ifp);
-   struct netmap_kring *kring = &na->rx_rings[0];
-   int t = na->num_rx_desc - 1 - kring->nr_hwavail;
-
-   if (t >= na->num_rx_desc)
-   t -= na->num_rx_desc;
-   E1000_WRITE_REG(&adapter->hw, E1000_RDT(0), t);
-   } else
+   if (ifp->if_capenable & IFCAP_NETMAP)
+   rctl -= NA(adapter->ifp)->rx_rings[0].nr_hwavail;
 #endif /* DEV_NETMAP */
-   E1000_WRITE_REG(&adapter->hw, E1000_RDT(0), adapter->num_rx_desc - 1);
+   E1000_WRITE_REG(&adapter->hw, E1000_RDT(0), rctl);
 
return;
 }
___
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: r250414 - head/sys/dev/e1000

2013-05-09 Thread Luigi Rizzo
Author: luigi
Date: Thu May  9 17:07:30 2013
New Revision: 250414
URL: http://svnweb.freebsd.org/changeset/base/250414

Log:
  if_lem.c:  make sure that lem_rxeof() can drain the entire rx queue
irrespective of the setting of lem_rx_process_limit, while
giving a chance to the taskqueue scheduler to act after
each chunk.
This makes lem_rxeof similar to the one in if_em.c and if_igb.c .
  
  if_lem.c and if_em.c: add a sysctl to manually configure the
'itr' moderation register.
  
  Approved by:  Jack Vogel

Modified:
  head/sys/dev/e1000/if_em.c
  head/sys/dev/e1000/if_em.h
  head/sys/dev/e1000/if_lem.c
  head/sys/dev/e1000/if_lem.h

Modified: head/sys/dev/e1000/if_em.c
==
--- head/sys/dev/e1000/if_em.c  Thu May  9 16:57:02 2013(r250413)
+++ head/sys/dev/e1000/if_em.c  Thu May  9 17:07:30 2013(r250414)
@@ -335,6 +335,9 @@ MODULE_DEPEND(em, ether, 1, 1, 1);
 #define EM_USECS_TO_TICKS(usecs)   ((1000 * (usecs) + 512) / 1024)
 #define M_TSO_LEN  66
 
+#define MAX_INTS_PER_SEC   8000
+#define DEFAULT_ITR(10/(MAX_INTS_PER_SEC * 256))
+
 /* Allow common code without TSO */
 #ifndef CSUM_TSO
 #define CSUM_TSO   0
@@ -570,6 +573,11 @@ em_attach(device_t dev)
&adapter->tx_abs_int_delay,
E1000_REGISTER(hw, E1000_TADV),
em_tx_abs_int_delay_dflt);
+   em_add_int_delay_sysctl(adapter, "itr",
+   "interrupt delay limit in usecs/4",
+   &adapter->tx_itr,
+   E1000_REGISTER(hw, E1000_ITR),
+   DEFAULT_ITR);
 
/* Sysctl for limiting the amount of work done in the taskqueue */
em_set_sysctl_value(adapter, "rx_processing_limit",
@@ -4271,8 +4279,6 @@ em_free_receive_buffers(struct rx_ring *
  *  Enable receive unit.
  *
  **/
-#define MAX_INTS_PER_SEC   8000
-#define DEFAULT_ITR 10/(MAX_INTS_PER_SEC * 256)
 
 static void
 em_initialize_receive_unit(struct adapter *adapter)
@@ -5618,6 +5624,8 @@ em_sysctl_int_delay(SYSCTL_HANDLER_ARGS)
return (EINVAL);
info->value = usecs;
ticks = EM_USECS_TO_TICKS(usecs);
+   if (info->offset == E1000_ITR)  /* units are 256ns here */
+   ticks *= 4;
 
adapter = info->adapter;


Modified: head/sys/dev/e1000/if_em.h
==
--- head/sys/dev/e1000/if_em.h  Thu May  9 16:57:02 2013(r250413)
+++ head/sys/dev/e1000/if_em.h  Thu May  9 17:07:30 2013(r250414)
@@ -429,6 +429,7 @@ struct adapter {
struct em_int_delay_info tx_abs_int_delay;
struct em_int_delay_info rx_int_delay;
struct em_int_delay_info rx_abs_int_delay;
+   struct em_int_delay_info tx_itr;
 
/* Misc stats maintained by the driver */
unsigned long   dropped_pkts;

Modified: head/sys/dev/e1000/if_lem.c
==
--- head/sys/dev/e1000/if_lem.c Thu May  9 16:57:02 2013(r250413)
+++ head/sys/dev/e1000/if_lem.c Thu May  9 17:07:30 2013(r250414)
@@ -281,6 +281,9 @@ MODULE_DEPEND(lem, ether, 1, 1, 1);
 #define EM_TICKS_TO_USECS(ticks)   ((1024 * (ticks) + 500) / 1000)
 #define EM_USECS_TO_TICKS(usecs)   ((1000 * (usecs) + 512) / 1024)
 
+#define MAX_INTS_PER_SEC   8000
+#define DEFAULT_ITR(10/(MAX_INTS_PER_SEC * 256))
+
 static int lem_tx_int_delay_dflt = EM_TICKS_TO_USECS(EM_TIDV);
 static int lem_rx_int_delay_dflt = EM_TICKS_TO_USECS(EM_RDTR);
 static int lem_tx_abs_int_delay_dflt = EM_TICKS_TO_USECS(EM_TADV);
@@ -442,6 +445,11 @@ lem_attach(device_t dev)
&adapter->tx_abs_int_delay,
E1000_REGISTER(&adapter->hw, E1000_TADV),
lem_tx_abs_int_delay_dflt);
+   lem_add_int_delay_sysctl(adapter, "itr",
+   "interrupt delay limit in usecs/4",
+   &adapter->tx_itr,
+   E1000_REGISTER(&adapter->hw, E1000_ITR),
+   DEFAULT_ITR);
}
 
/* Sysctls for limiting the amount of work done in the taskqueue */
@@ -1337,12 +1345,16 @@ lem_handle_rxtx(void *context, int pendi
 
 
if (ifp->if_drv_flags & IFF_DRV_RUNNING) {
-   lem_rxeof(adapter, adapter->rx_process_limit, NULL);
+   bool more = lem_rxeof(adapter, adapter->rx_process_limit, NULL);
EM_TX_LOCK(adapter);
lem_txeof(adapter);
if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))
lem_start_locked(ifp);
EM_TX_UNLOCK(adapter);
+   if (more) {
+   taskqueue_enqueue(adapter->tq, &adapter->rxtx_task);
+   return;
+   }
}
 
   

svn commit: r250415 - head/sys/amd64/amd64

2013-05-09 Thread Konstantin Belousov
Author: kib
Date: Thu May  9 17:25:29 2013
New Revision: 250415
URL: http://svnweb.freebsd.org/changeset/base/250415

Log:
  Correct the type for the literal used on the left side of the shift up
  to 63 bit positions.
  
  Do not fill the save area and do not set the saved bit in the xstate
  bit vector for the state which is not marked as enabled in xsave_mask.
  
  Reported and tested by:   Jim Ohlstein 
  MFC after:3 days

Modified:
  head/sys/amd64/amd64/fpu.c

Modified: head/sys/amd64/amd64/fpu.c
==
--- head/sys/amd64/amd64/fpu.c  Thu May  9 17:07:30 2013(r250414)
+++ head/sys/amd64/amd64/fpu.c  Thu May  9 17:25:29 2013(r250415)
@@ -687,8 +687,8 @@ fpugetregs(struct thread *td)
offsetof(struct xstate_hdr, xstate_bv));
max_ext_n = flsl(xsave_mask);
for (i = 0; i < max_ext_n; i++) {
-   bit = 1 << i;
-   if ((*xstate_bv & bit) != 0)
+   bit = 1ULL << i;
+   if ((xsave_mask & bit) == 0 || (*xstate_bv & bit) != 0)
continue;
bcopy((char *)fpu_initialstate +
xsave_area_desc[i].offset,
___
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: r250418 - head/sys/dev/pci

2013-05-09 Thread John Baldwin
Author: jhb
Date: Thu May  9 19:24:50 2013
New Revision: 250418
URL: http://svnweb.freebsd.org/changeset/base/250418

Log:
  Revision 233677 broke certain machines.  Specifically, if the firmware/BIOS
  assigned conflicting ranges to BARs then leaving the BARs alone could
  result in one device stealing mmio accesses intended to go to a second
  device.  Prior to 233677 the PCI bus driver attempted to handle this case
  by clearing the BAR to 0 depending on BARs based at 0 not decoding (which
  is not guaranteed to be true).  Now when a conflicting BAR is detected the
  following steps are taken:
  
   1) If hw.pci.realloc_bars (a new tunable) is enabled (default is enabled),
  then ignore the current BAR setting from the firmware and attempt to
  allocate a fresh resource range for the BAR.
  
   2) If 1) failed (or was disabled), disable decoding for the relevant
  BAR type (e.g. disable mem decoding for a memory BAR) and emit a
  warning if booting verbose.
  
  Tested by:Alex Keda 
  MFC after:1 week

Modified:
  head/sys/dev/pci/pci.c

Modified: head/sys/dev/pci/pci.c
==
--- head/sys/dev/pci/pci.c  Thu May  9 18:43:01 2013(r250417)
+++ head/sys/dev/pci/pci.c  Thu May  9 19:24:50 2013(r250418)
@@ -280,6 +280,12 @@ SYSCTL_INT(_hw_pci, OID_AUTO, enable_io_
 enable these bits correctly.  We'd like to do this all the time, but there\n\
 are some peripherals that this causes problems with.");
 
+static int pci_do_realloc_bars = 1;
+TUNABLE_INT("hw.pci.realloc_bars", &pci_do_realloc_bars);
+SYSCTL_INT(_hw_pci, OID_AUTO, realloc_bars, CTLFLAG_RW,
+&pci_do_realloc_bars, 0,
+"Attempt to allocate a new range for any BARs whose original 
firmware-assigned ranges fail to allocate during the initial device scan.");
+
 static int pci_do_power_nodriver = 0;
 TUNABLE_INT("hw.pci.do_power_nodriver", &pci_do_power_nodriver);
 SYSCTL_INT(_hw_pci, OID_AUTO, do_power_nodriver, CTLFLAG_RW,
@@ -2816,13 +2822,34 @@ pci_add_map(device_t bus, device_t dev, 
 */
res = resource_list_reserve(rl, bus, dev, type, ®, start, end, count,
prefetch ? RF_PREFETCHABLE : 0);
+   if (pci_do_realloc_bars && res == NULL && (start != 0 || end != ~0ul)) {
+   /*
+* If the allocation fails, try to allocate a resource for
+* this BAR using any available range.  The firmware felt
+* it was important enough to assign a resource, so don't
+* disable decoding if we can help it.
+*/
+   resource_list_delete(rl, type, reg);
+   resource_list_add(rl, type, reg, 0, ~0ul, count);
+   res = resource_list_reserve(rl, bus, dev, type, ®, 0, ~0ul,
+   count, prefetch ? RF_PREFETCHABLE : 0);
+   }
if (res == NULL) {
/*
 * If the allocation fails, delete the resource list entry
-* to force pci_alloc_resource() to allocate resources
-* from the parent.
+* and disable decoding for this device.
+*
+* If the driver requests this resource in the future,
+* pci_reserve_map() will try to allocate a fresh
+* resource range.
 */
resource_list_delete(rl, type, reg);
+   pci_disable_io(dev, type);
+   if (bootverbose)
+   device_printf(bus,
+   "pci%d:%d:%d:%d bar %#x failed to allocate\n",
+   pci_get_domain(dev), pci_get_bus(dev),
+   pci_get_slot(dev), pci_get_function(dev), reg);
} else {
start = rman_get_start(res);
pci_write_bar(dev, pm, start);
___
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: r250407 - in head/usr.sbin/makefs: . compat

2013-05-09 Thread Garrett Cooper
On Thu, May 9, 2013 at 7:43 AM, Brooks Davis  wrote:
> Author: brooks
> Date: Thu May  9 14:43:36 2013
> New Revision: 250407
> URL: http://svnweb.freebsd.org/changeset/base/250407
>
> Log:
>   Remove duplicated copies of various NetBSD compatibility shims used by
>   makefs and use libnetbsd, contrib/mtree, and contrib/mknod instead.
>
>   Sponsored by: DARPA, AFRLo
>   MFC after:1 month
>
> Deleted:
>   head/usr.sbin/makefs/compat/
>   head/usr.sbin/makefs/getid.c
> Modified:
>   head/usr.sbin/makefs/Makefile
>   head/usr.sbin/makefs/makefs.h
>   head/usr.sbin/makefs/walk.c

I like the idea of libnetbsd, but there really isn't a clean way
to designate whether or not something needs to use the compat shims
without extensively hacking imported sources. Some of the concerns are
over:
1. __arraycount (NetBSD) vs nitems (FreeBSD/OpenBSD).
2. __DECONST (FreeBSD) vs __UNCONST (NetBSD).
Also, nitems live in sys/param.h instead of sys/cdefs.h which
causes issues when porting over code from NetBSD.
Could we improve this to match NetBSD a bit more in the base
system without having to extensively involve libnetbsd? Also, could we
make a make snippet for interfacing with libnetbsd to avoid code
duplication?
Thanks,
-Garrett
___
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: r250419 - head/sys/mips/conf

2013-05-09 Thread Adrian Chadd
Author: adrian
Date: Thu May  9 19:37:00 2013
New Revision: 250419
URL: http://svnweb.freebsd.org/changeset/base/250419

Log:
  Add some missing arge MDIO hints.
  
  Submitted by: Luiz Otavio O Souza 

Modified:
  head/sys/mips/conf/ROUTERSTATION.hints

Modified: head/sys/mips/conf/ROUTERSTATION.hints
==
--- head/sys/mips/conf/ROUTERSTATION.hints  Thu May  9 19:24:50 2013
(r250418)
+++ head/sys/mips/conf/ROUTERSTATION.hints  Thu May  9 19:37:00 2013
(r250419)
@@ -2,6 +2,12 @@
 # $FreeBSD$
 #
 
+# arge0 mdio bus
+hint.argemdio.0.at="nexus0"
+hint.argemdio.0.maddr=0x1900
+hint.argemdio.0.msize=0x1000
+hint.argemdio.0.order=0
+
 # Uncomment this hint for RS (not PRO)
 # PHY20 = 1 << 20
 hint.arge.0.phymask=0x10
___
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"


Fwd: svn commit: r250385 - head/sys/mips/conf

2013-05-09 Thread Petko Bordjukov
FYI

-- Forwarded message --
From: Luiz Otavio O Souza 
Date: Thu, May 9, 2013 at 10:24 PM
Subject: Re: svn commit: r250385 - head/sys/mips/conf
To: Petko Bordjukov 


Petko,

Thanks!

Well, there isn't too much to do or test with this driver, but you can see
and set the media options for each port with etherswitchcfg(8).

Soon i'll try to write the driver for the switch on routerstation, i'm now
working on the RSPRO switch driver.

Regards,
Luiz

On May 9, 2013, at 3:47 PM, Petko Bordjukov wrote:

> Hello Luiz,
>
> Thank you, this patch fixed it. I will play around with it and report if
something goes
> wrong (testing is the least I cloud do). It looks OK though.
>
>
> On Thu, May 9, 2013 at 7:49 PM, Luiz Otavio O Souza 
wrote:
> Hello Petko and Adrian,
>
> Sorry for the delay...
>
> I guess i forgot to add the arge mdio hints, this is why it fail on
device_get_parent() while attaching the miiproxy.
>
> Please verify if the attached patch fix your issue.
>
> And thanks for testing it.
>
> Luiz
>
>
>
>
>
>
> On May 9, 2013, at 1:06 PM, Adrian Chadd wrote:
>
> > Can you do a 'show regs' ?
> >
> >
> >
> >
> > Adrian
> >
> >
> > On 9 May 2013 01:08, Petko Bordjukov  wrote:
> >> I guess I forgot to CC you :)
> >>
> >> -- Forwarded message --
> >> From: Petko Bordjukov 
> >> Date: Thu, May 9, 2013 at 4:09 AM
> >> Subject: svn commit: r250385 - head/sys/mips/conf
> >> To: svn-src-head@freebsd.org
> >>
> >>
> >> Hello,
> >>
> >> This commit leads to a TLB miss at device_get_parent on boot on the RS.
> >>
> >> RedBoot> load -p 6969 kernel/kernel
> >> Using default protocol (TFTP)
> >> Entry point: 0x80050100, address range: 0x8005-0x8056ae38
> >> RedBoot> exec
> >> Now booting linux kernel:
> >> Base address 0x8005 Entry 0x80050100
> >> Cmdline : console=ttyS0,115200 init=/init
> >> CPU platform: Atheros AR7161 rev 2
> >> CPU Frequency=680 MHz
> >> CPU DDR Frequency=170 MHz
> >> CPU AHB Frequency=85 MHz
> >> platform frequency: 68000
> >> CPU reference clock: 40 MHz
> >> arguments:
> >>  a0 = 0002
> >>  a1 = 80050028
> >>  a2 = 8005
> >>  a3 = 001b
> >> Cmd line:  console=ttyS0,115200 init=/init
> >> Environment:
> >>  memsize = 0x0400
> >>  modetty0 = 0,n,8,1,hw
> >>  ethaddr = ommitted
> >>  board = Ubiquiti AR71xx-based board
> >> Cache info:
> >>  picache_stride= 4096
> >>  picache_loopcount = 16
> >>  pdcache_stride= 4096
> >>  pdcache_loopcount = 8
> >> cpu0: MIPS Technologies processor v116.147
> >>  MMU: Standard TLB, 16 entries
> >>  L1 i-cache: 4 ways of 512 sets, 32 bytes per line
> >>  L1 d-cache: 4 ways of 256 sets, 32 bytes per line
> >>  Config1=0x9ee3519e
> >>  Config3=0x20
> >> KDB: debugger backends: ddb
> >> KDB: current backend: ddb
> >> Copyright (c) 1992-2013 The FreeBSD Project.
> >> Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993,
1994
> >>The Regents of the University of California. All rights reserved.
> >> FreeBSD is a registered trademark of The FreeBSD Foundation.
> >> FreeBSD 10.0-CURRENT #1 r250385: Thu May  9 04:04:12 EEST 2013
> >>root@virtbsd10:/usr/obj/mips.mips/usr/src/sys/ROUTERSTATION mips
> >> gcc version 4.2.1 20070831 patched [FreeBSD]
> >> WARNING: WITNESS option enabled, expect reduced performance.
> >> MEMGUARD DEBUGGING ALLOCATOR INITIALIZED:
> >>MEMGUARD map base: 0xc040
> >>MEMGUARD map limit: 0xc6a67000
> >>MEMGUARD map size: 104860 KBytes
> >> real memory  = 67108864 (65536K bytes)
> >> avail memory = 56496128 (53MB)
> >> random device not loaded; using insecure entropy
> >> nexus0: 
> >> clock0:  on nexus0
> >> Timecounter "MIPS32" frequency 34000 Hz quality 800
> >> Event timer "MIPS32" frequency 34000 Hz quality 800
> >> apb0 at irq 4 on nexus0
> >> uart0: <16550 or compatible> on apb0
> >> uart0: console (115200,n,8,1)
> >> gpio0:  on apb0
> >> gpio0: [GIANT-LOCKED]
> >> gpio0: gpio pinmask=0x0
> >> gpioc0:  on gpio0
> >> gpiobus0:  on gpio0
> >> gpioled0:  at pin(s) 2 on gpiobus0
> >> ehci0:  at mem
0x1b00-0x1bff
> >> irq 1 on nexus0
> >> usbus0: set host controller mode
> >> usbus0: EHCI version 1.0
> >> usbus0: set host controller mode
> >> usbus0 on ehci0
> >> pcib0 at irq 0 on nexus0
> >> pcib0: ar71xx_pci_attach: missing hint 'baseslot', default to
> >> AR71XX_PCI_BASE_SLOT
> >> pci0:  on pcib0
> >> ath0:  irq 1 at device 18.0 on pci0
> >> ath0: AR2413 mac 7.8 RF2413 phy 4.5
> >> ath0: 2GHz radio: 0x; 5GHz radio: 0x0056
> >> ath1:  irq 2 at device 19.0 on pci0
> >> ath1: [HT] enabling HT modes
> >> ath1: [HT] 1 stream STBC receive enabled
> >> ath1: [HT] 1 stream STBC transmit enabled
> >> ath1: [HT] 2 RX streams; 2 TX streams
> >> ath1: AR9220 mac 128.2 RF5133 phy 13.0
> >> ath1: 2GHz radio: 0x; 5GHz radio: 0x00c0
> >> arge0:  at mem
> >> 0x1900-0x19000fff irq 2 on nexus0
> >> miiproxy0:  on arge0
> >> arge0: can't attach proxy
> >> arge0: finishing attachment, phymask 10, proxy null
> >> arge0: unable to attach PH

svn commit: r250420 - head/sys/mips/mips

2013-05-09 Thread Bjoern A. Zeeb
Author: bz
Date: Thu May  9 20:13:43 2013
New Revision: 250420
URL: http://svnweb.freebsd.org/changeset/base/250420

Log:
  MFp4 CH=227440:
  
Convert the structures to C99 style initialisation, which makes it
a lot easier to check that all of them are set and to generate a
derived template from them.
  
  Sponsored by: DARPA, AFRL
  MFC after:2 weeks

Modified:
  head/sys/mips/mips/bus_space_fdt.c
  head/sys/mips/mips/bus_space_generic.c

Modified: head/sys/mips/mips/bus_space_fdt.c
==
--- head/sys/mips/mips/bus_space_fdt.c  Thu May  9 19:37:00 2013
(r250419)
+++ head/sys/mips/mips/bus_space_fdt.c  Thu May  9 20:13:43 2013
(r250420)
@@ -94,109 +94,109 @@ static intfdt_bs_map(void *, bus_addr_t
 
 static struct bus_space fdt_space = {
/* cookie */
-   (void *) 0,
+   .bs_cookie =(void *) 0,
 
/* mapping/unmapping */
-   fdt_bs_map,
-   generic_bs_unmap,
-   generic_bs_subregion,
+   .bs_map =   fdt_bs_map,
+   .bs_unmap = generic_bs_unmap,
+   .bs_subregion = generic_bs_subregion,
 
/* allocation/deallocation */
-   generic_bs_alloc,
-   generic_bs_free,
+   .bs_alloc = generic_bs_alloc,
+   .bs_free =  generic_bs_free,
 
/* barrier */
-   generic_bs_barrier,
+   .bs_barrier =   generic_bs_barrier,
 
/* read (single) */
-   generic_bs_r_1,
-   generic_bs_r_2,
-   generic_bs_r_4,
-   generic_bs_r_8,
+   .bs_r_1 =   generic_bs_r_1,
+   .bs_r_2 =   generic_bs_r_2,
+   .bs_r_4 =   generic_bs_r_4,
+   .bs_r_8 =   generic_bs_r_8,
 
/* read multiple */
-   generic_bs_rm_1,
-   generic_bs_rm_2,
-   generic_bs_rm_4,
-   generic_bs_rm_8,
+   .bs_rm_1 =  generic_bs_rm_1,
+   .bs_rm_2 =  generic_bs_rm_2,
+   .bs_rm_4 =  generic_bs_rm_4,
+   .bs_rm_8 =  generic_bs_rm_8,
 
/* read region */
-   generic_bs_rr_1,
-   generic_bs_rr_2,
-   generic_bs_rr_4,
-   generic_bs_rr_8,
+   .bs_rr_1 =  generic_bs_rr_1,
+   .bs_rr_2 =  generic_bs_rr_2,
+   .bs_rr_4 =  generic_bs_rr_4,
+   .bs_rr_8 =  generic_bs_rr_8,
 
/* write (single) */
-   generic_bs_w_1,
-   generic_bs_w_2,
-   generic_bs_w_4,
-   generic_bs_w_8,
+   .bs_w_1 =   generic_bs_w_1,
+   .bs_w_2 =   generic_bs_w_2,
+   .bs_w_4 =   generic_bs_w_4,
+   .bs_w_8 =   generic_bs_w_8,
 
/* write multiple */
-   generic_bs_wm_1,
-   generic_bs_wm_2,
-   generic_bs_wm_4,
-   generic_bs_wm_8,
+   .bs_wm_1 =  generic_bs_wm_1,
+   .bs_wm_2 =  generic_bs_wm_2,
+   .bs_wm_4 =  generic_bs_wm_4,
+   .bs_wm_8 =  generic_bs_wm_8,
 
/* write region */
-   generic_bs_wr_1,
-   generic_bs_wr_2,
-   generic_bs_wr_4,
-   generic_bs_wr_8,
+   .bs_wr_1 =  generic_bs_wr_1,
+   .bs_wr_2 =  generic_bs_wr_2,
+   .bs_wr_4 =  generic_bs_wr_4,
+   .bs_wr_8 =  generic_bs_wr_8,
 
/* set multiple */
-   generic_bs_sm_1,
-   generic_bs_sm_2,
-   generic_bs_sm_4,
-   generic_bs_sm_8,
+   .bs_sm_1 =  generic_bs_sm_1,
+   .bs_sm_2 =  generic_bs_sm_2,
+   .bs_sm_4 =  generic_bs_sm_4,
+   .bs_sm_8 =  generic_bs_sm_8,
 
/* set region */
-   generic_bs_sr_1,
-   generic_bs_sr_2,
-   generic_bs_sr_4,
-   generic_bs_sr_8,
+   .bs_sr_1 =  generic_bs_sr_1,
+   .bs_sr_2 =  generic_bs_sr_2,
+   .bs_sr_4 =  generic_bs_sr_4,
+   .bs_sr_8 =  generic_bs_sr_8,
 
/* copy */
-   generic_bs_c_1,
-   generic_bs_c_2,
-   generic_bs_c_4,
-   generic_bs_c_8,
+   .bs_c_1 =   generic_bs_c_1,
+   .bs_c_2 =   generic_bs_c_2,
+   .bs_c_4 =   generic_bs_c_4,
+   .bs_c_8 =   generic_bs_c_8,
 
/* read (single) stream */
-   generic_bs_r_1,
-   generic_bs_r_2,
-   generic_bs_r_4,
-   generic_bs_r_8,
+   .bs_r_1_s = generic_bs_r_1,
+   .bs_r_2_s = generic_bs_r_2,
+   .bs_r_4_s = generic_bs_r_4,
+   .bs_r_8_s = generic_bs_r_8,
 
/* read multiple stream */
-   generic_bs_rm_1,
-   generic_bs_rm_2,
-   generic_bs_rm_4,
-   generic_bs_rm_8,
+   .bs_rm_1_s =generic_bs_rm_1,
+   .bs_rm_2_s =generic_bs_rm_2,
+   .bs_rm_4_s =generic_bs_rm_4,
+   .bs_rm_8_s =generic_bs_rm_8,
 
/* read region stream */
-   generic_bs_rr_1,
-   generic_bs_rr_2,
-   generic_bs_rr_4,
-   generic_bs_rr_8,
+   .bs_rr_1_s =generic_bs_rr_1,
+   .bs_rr_2_s =generic_bs_rr_2,
+   .bs_rr_4_s =generic_bs_rr_4,
+   .bs_rr_8_s =generic_bs_rr_8,
 
/* write (single) stream */
-   generic_bs

Re: svn commit: r250411 - in head/sys: conf kern sys

2013-05-09 Thread Marcel Moolenaar

On May 9, 2013, at 9:46 AM, Attilio Rao  wrote:

> On Thu, May 9, 2013 at 6:28 PM, Marcel Moolenaar  wrote:
>> Author: marcel
>> Date: Thu May  9 16:28:18 2013
>> New Revision: 250411
>> URL: http://svnweb.freebsd.org/changeset/base/250411
>> 
>> Log:
>>  Add option WITNESS_NO_VNODE to suppress printing LORs between VNODE
>>  locks. To support this, VNODE locks are created with the LK_IS_VNODE
>>  flag. This flag is propagated down using the LO_IS_VNODE flag.
>> 
>>  Note that WITNESS still records the LOR. Only the printing and the
>>  optional entering into the kernel debugger is bypassed with the
>>  WITNESS_NO_VNODE option.
> 
> This is the wrong way to deal with such problem and I avoided to do
> something like that on purpose.

I disagree. We have known LOR messages between VNODE locks that
pollute the console and so far we haven't fixed the root cause
in some form or shape. Silencing this known case is good to
maximize the attention LORs need to be given while still have
witness involved to catch locking problems with vnodes that are
of a different nature.

> 
> The way to fix this is to implement LK_NOWITNESS on a per-lock basis
> into lockmgr, propagate the same concept to the vn_lock() (which
> should be basically done automatically) and finally identify the
> false-positive case and commit for them explicitely LK_NOWITNESS on a
> per-call basis, explaining in detail why the single case reported is a
> false-positive.

This is worse. You want witness involved.

> Please revert this patch asap.

This change does not inhibit people from fixing the problem at the
root cause, and in the mean time maximize witness' effectiveness.
Calling for a backout is unwarranted and unnecessarily aggressive.

-- 
Marcel Moolenaar
mar...@xcllnt.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: r250421 - head/lib/libc/gen

2013-05-09 Thread Jilles Tjoelker
Author: jilles
Date: Thu May  9 21:29:13 2013
New Revision: 250421
URL: http://svnweb.freebsd.org/changeset/base/250421

Log:
  posix_spawn_file_actions_adddup2(3): Document difference with dup2().
  
  The ability to clear a file descriptor's close-on-exec flag via
  posix_spawn_file_actions_adddup2() is in fact proposed in Austin Group issue
  #411.
  
  MFC after:1 week

Modified:
  head/lib/libc/gen/posix_spawn_file_actions_addopen.3

Modified: head/lib/libc/gen/posix_spawn_file_actions_addopen.3
==
--- head/lib/libc/gen/posix_spawn_file_actions_addopen.3Thu May  9 
20:13:43 2013(r250420)
+++ head/lib/libc/gen/posix_spawn_file_actions_addopen.3Thu May  9 
21:29:13 2013(r250421)
@@ -123,7 +123,19 @@ to be duplicated as
 dup2(fildes, newfildes)
 .Ed
 .Pp
-had been called) when a new process is spawned using this file actions object.
+had been called) when a new process is spawned using this file actions object,
+except that the
+.Dv FD_CLOEXEC
+flag for
+.Fa newfildes
+is cleared even if
+.Fa fildes
+is equal to
+.Fa newfildes .
+The difference from
+.Fn dup2
+is useful for passing a particular file descriptor
+to a particular child process.
 .Pp
 The
 .Fn posix_spawn_file_actions_addclose
@@ -169,7 +181,16 @@ The
 and
 .Fn posix_spawn_file_actions_addclose
 functions conform to
-.St -p1003.1-2001 .
+.St -p1003.1-2001 ,
+with the exception of the behavior of
+.Fn posix_spawn_file_actions_adddup2
+if
+.Fa fildes
+is equal to
+.Fa newfildes
+(clearing
+.Dv FD_CLOEXEC ) .
+A future update of the Standard is expected to require this behavior,
 .Sh HISTORY
 The
 .Fn posix_spawn_file_actions_addopen ,
___
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: r250422 - head/bin/sh

2013-05-09 Thread Eitan Adler
Author: eadler
Date: Thu May  9 21:29:16 2013
New Revision: 250422
URL: http://svnweb.freebsd.org/changeset/base/250422

Log:
  Fix two typos
  
  Reviewed by:  jilles

Modified:
  head/bin/sh/var.c

Modified: head/bin/sh/var.c
==
--- head/bin/sh/var.c   Thu May  9 21:29:13 2013(r250421)
+++ head/bin/sh/var.c   Thu May  9 21:29:16 2013(r250422)
@@ -877,7 +877,7 @@ unsetvar(const char *s)
 
 
 /*
- * Returns true if the two strings specify the same varable.  The first
+ * Returns true if the two strings specify the same variable.  The first
  * variable name is terminated by '='; the second may be terminated by
  * either '=' or '\0'.
  */
@@ -898,7 +898,7 @@ varequal(const char *p, const char *q)
  * Search for a variable.
  * 'name' may be terminated by '=' or a NUL.
  * vppp is set to the pointer to vp, or the list head if vp isn't found
- * lenp is set to the number of charactets in 'name'
+ * lenp is set to the number of characters in 'name'
  */
 
 static struct var *
___
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: r250423 - in head/sys/amd64: amd64 ia32 include linux32

2013-05-09 Thread Dmitry Chagin
Author: dchagin
Date: Thu May  9 21:42:43 2013
New Revision: 250423
URL: http://svnweb.freebsd.org/changeset/base/250423

Log:
  Retire write-only PCB_GS32BIT pcb flag on amd64.

Modified:
  head/sys/amd64/amd64/genassym.c
  head/sys/amd64/amd64/machdep.c
  head/sys/amd64/ia32/ia32_signal.c
  head/sys/amd64/include/pcb.h
  head/sys/amd64/linux32/linux32_machdep.c
  head/sys/amd64/linux32/linux32_sysvec.c

Modified: head/sys/amd64/amd64/genassym.c
==
--- head/sys/amd64/amd64/genassym.c Thu May  9 21:29:16 2013
(r250422)
+++ head/sys/amd64/amd64/genassym.c Thu May  9 21:42:43 2013
(r250423)
@@ -167,7 +167,6 @@ ASSYM(PCB_FPUSUSPEND, offsetof(struct pc
 ASSYM(PCB_SIZE, sizeof(struct pcb));
 ASSYM(PCB_FULL_IRET, PCB_FULL_IRET);
 ASSYM(PCB_DBREGS, PCB_DBREGS);
-ASSYM(PCB_GS32BIT, PCB_GS32BIT);
 ASSYM(PCB_32BIT, PCB_32BIT);
 
 ASSYM(COMMON_TSS_RSP0, offsetof(struct amd64tss, tss_rsp0));

Modified: head/sys/amd64/amd64/machdep.c
==
--- head/sys/amd64/amd64/machdep.c  Thu May  9 21:29:16 2013
(r250422)
+++ head/sys/amd64/amd64/machdep.c  Thu May  9 21:42:43 2013
(r250423)
@@ -964,7 +964,7 @@ exec_setregs(struct thread *td, struct i

pcb->pcb_fsbase = 0;
pcb->pcb_gsbase = 0;
-   clear_pcb_flags(pcb, PCB_32BIT | PCB_GS32BIT);
+   clear_pcb_flags(pcb, PCB_32BIT);
pcb->pcb_initial_fpucw = __INITIAL_FPUCW__;
set_pcb_flags(pcb, PCB_FULL_IRET);
 

Modified: head/sys/amd64/ia32/ia32_signal.c
==
--- head/sys/amd64/ia32/ia32_signal.c   Thu May  9 21:29:16 2013
(r250422)
+++ head/sys/amd64/ia32/ia32_signal.c   Thu May  9 21:42:43 2013
(r250423)
@@ -1001,6 +1001,5 @@ ia32_setregs(struct thread *td, struct i
 
/* Return via doreti so that we can change to a different %cs */
set_pcb_flags(pcb, PCB_32BIT | PCB_FULL_IRET);
-   clear_pcb_flags(pcb, PCB_GS32BIT);
td->td_retval[1] = 0;
 }

Modified: head/sys/amd64/include/pcb.h
==
--- head/sys/amd64/include/pcb.hThu May  9 21:29:16 2013
(r250422)
+++ head/sys/amd64/include/pcb.hThu May  9 21:42:43 2013
(r250423)
@@ -77,7 +77,6 @@ struct pcb {
 #definePCB_KERNFPU 0x04/* kernel uses fpu */
 #definePCB_FPUINITDONE 0x08/* fpu state is initialized */
 #definePCB_USERFPUINITDONE 0x10 /* fpu user state is initialized */
-#definePCB_GS32BIT 0x20/* linux gs switch */
 #definePCB_32BIT   0x40/* process has 32 bit context (segs 
etc) */
 
uint16_tpcb_initial_fpucw;

Modified: head/sys/amd64/linux32/linux32_machdep.c
==
--- head/sys/amd64/linux32/linux32_machdep.cThu May  9 21:29:16 2013
(r250422)
+++ head/sys/amd64/linux32/linux32_machdep.cThu May  9 21:42:43 2013
(r250423)
@@ -447,7 +447,7 @@ linux_set_cloned_tls(struct thread *td, 
pcb->pcb_gsbase = (register_t)info.base_addr;
 /* XXXKIB  pcb->pcb_gs32sd = sd; */
td->td_frame->tf_gs = GSEL(GUGS32_SEL, SEL_UPL);
-   set_pcb_flags(pcb, PCB_GS32BIT | PCB_32BIT);
+   set_pcb_flags(pcb, PCB_32BIT);
}
 
return (error);
@@ -1026,7 +1026,7 @@ linux_set_thread_area(struct thread *td,
 
pcb = td->td_pcb;
pcb->pcb_gsbase = (register_t)info.base_addr;
-   set_pcb_flags(pcb, PCB_32BIT | PCB_GS32BIT);
+   set_pcb_flags(pcb, PCB_32BIT);
update_gdt_gsbase(td, info.base_addr);
 
return (0);

Modified: head/sys/amd64/linux32/linux32_sysvec.c
==
--- head/sys/amd64/linux32/linux32_sysvec.c Thu May  9 21:29:16 2013
(r250422)
+++ head/sys/amd64/linux32/linux32_sysvec.c Thu May  9 21:42:43 2013
(r250423)
@@ -868,7 +868,6 @@ exec_linux_setregs(struct thread *td, st
 
/* Do full restore on return so that we can change to a different %cs */
set_pcb_flags(pcb, PCB_32BIT | PCB_FULL_IRET);
-   clear_pcb_flags(pcb, PCB_GS32BIT);
td->td_retval[1] = 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"


Re: svn commit: r250411 - in head/sys: conf kern sys

2013-05-09 Thread Attilio Rao
On Thu, May 9, 2013 at 10:56 PM, Marcel Moolenaar  wrote:
>
> On May 9, 2013, at 9:46 AM, Attilio Rao  wrote:
>
>> On Thu, May 9, 2013 at 6:28 PM, Marcel Moolenaar  wrote:
>>> Author: marcel
>>> Date: Thu May  9 16:28:18 2013
>>> New Revision: 250411
>>> URL: http://svnweb.freebsd.org/changeset/base/250411
>>>
>>> Log:
>>>  Add option WITNESS_NO_VNODE to suppress printing LORs between VNODE
>>>  locks. To support this, VNODE locks are created with the LK_IS_VNODE
>>>  flag. This flag is propagated down using the LO_IS_VNODE flag.
>>>
>>>  Note that WITNESS still records the LOR. Only the printing and the
>>>  optional entering into the kernel debugger is bypassed with the
>>>  WITNESS_NO_VNODE option.
>>
>> This is the wrong way to deal with such problem and I avoided to do
>> something like that on purpose.
>
> I disagree. We have known LOR messages between VNODE locks that
> pollute the console and so far we haven't fixed the root cause
> in some form or shape. Silencing this known case is good to
> maximize the attention LORs need to be given while still have
> witness involved to catch locking problems with vnodes that are
> of a different nature.
>
>>
>> The way to fix this is to implement LK_NOWITNESS on a per-lock basis
>> into lockmgr, propagate the same concept to the vn_lock() (which
>> should be basically done automatically) and finally identify the
>> false-positive case and commit for them explicitely LK_NOWITNESS on a
>> per-call basis, explaining in detail why the single case reported is a
>> false-positive.
>
> This is worse. You want witness involved.
>
>> Please revert this patch asap.
>
> This change does not inhibit people from fixing the problem at the
> root cause, and in the mean time maximize witness' effectiveness.
> Calling for a backout is unwarranted and unnecessarily aggressive.

I completely disagree with the whole content of your e-mail.
Thanks for disrupting a useful tool along with other commits which
happened in the past by other people about invariants effectiveness.

Attilio


--
Peace can only be achieved by understanding - A. Einstein
___
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: r250411 - in head/sys: conf kern sys

2013-05-09 Thread Alfred Perlstein

On 5/9/13 3:13 PM, Attilio Rao wrote:

On Thu, May 9, 2013 at 10:56 PM, Marcel Moolenaar  wrote:

On May 9, 2013, at 9:46 AM, Attilio Rao  wrote:


On Thu, May 9, 2013 at 6:28 PM, Marcel Moolenaar  wrote:

Author: marcel
Date: Thu May  9 16:28:18 2013
New Revision: 250411
URL: http://svnweb.freebsd.org/changeset/base/250411

Log:
  Add option WITNESS_NO_VNODE to suppress printing LORs between VNODE
  locks. To support this, VNODE locks are created with the LK_IS_VNODE
  flag. This flag is propagated down using the LO_IS_VNODE flag.

  Note that WITNESS still records the LOR. Only the printing and the
  optional entering into the kernel debugger is bypassed with the
  WITNESS_NO_VNODE option.

This is the wrong way to deal with such problem and I avoided to do
something like that on purpose.

I disagree. We have known LOR messages between VNODE locks that
pollute the console and so far we haven't fixed the root cause
in some form or shape. Silencing this known case is good to
maximize the attention LORs need to be given while still have
witness involved to catch locking problems with vnodes that are
of a different nature.


The way to fix this is to implement LK_NOWITNESS on a per-lock basis
into lockmgr, propagate the same concept to the vn_lock() (which
should be basically done automatically) and finally identify the
false-positive case and commit for them explicitely LK_NOWITNESS on a
per-call basis, explaining in detail why the single case reported is a
false-positive.

This is worse. You want witness involved.


Please revert this patch asap.

This change does not inhibit people from fixing the problem at the
root cause, and in the mean time maximize witness' effectiveness.
Calling for a backout is unwarranted and unnecessarily aggressive.

I completely disagree with the whole content of your e-mail.
Thanks for disrupting a useful tool along with other commits which
happened in the past by other people about invariants effectiveness.



This should be taken offline.  Marcel has some needs which without such 
a change are hard to manage I encourage you to assist him and meeting 
half-way on this as it will greatly help the project.


Please discuss this offline a bit so you can see where each are coming from.

If you would like to cc me about this I can help mediate and explain 
this pragmatic approach to assertions.


Will you both be at BSDCan?  That would be even better.

-Alfred
___
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: r250426 - head/sys/contrib/octeon-sdk

2013-05-09 Thread Warner Losh
Author: imp
Date: Fri May 10 02:57:46 2013
New Revision: 250426
URL: http://svnweb.freebsd.org/changeset/base/250426

Log:
  Both my EBH5200 and GE WANIC 6354 have a RTC as well. It looks from
  the Linux tree that they always include this chip in their FDT, so
  make support for the ds1337 opt-out rather than opt-in. Now my boards
  boot with the correct time.

Modified:
  head/sys/contrib/octeon-sdk/cvmx-rtc.h

Modified: head/sys/contrib/octeon-sdk/cvmx-rtc.h
==
--- head/sys/contrib/octeon-sdk/cvmx-rtc.h  Thu May  9 22:29:33 2013
(r250425)
+++ head/sys/contrib/octeon-sdk/cvmx-rtc.h  Fri May 10 02:57:46 2013
(r250426)
@@ -87,13 +87,8 @@ static inline cvmx_rtc_options_t cvmx_rt
supported = CVMX_RTC_READ | CVMX_RTC_WRITE | CVMX_RTC_TIME_EPOCH;
break;
 
-   case CVMX_BOARD_TYPE_EBH3000:
-   case CVMX_BOARD_TYPE_CN3010_EVB_HS5:
-   supported = CVMX_RTC_READ | CVMX_RTC_WRITE | CVMX_RTC_TIME_CAL;
-   break;
-
default:
-   supported = 0;
+   supported = CVMX_RTC_READ | CVMX_RTC_WRITE | CVMX_RTC_TIME_CAL;
break;
}
 
@@ -122,14 +117,9 @@ static inline uint32_t cvmx_rtc_read(voi
 return cvmx_rtc_ds1374_read();
 break;
 
-case CVMX_BOARD_TYPE_EBH3000:
-case CVMX_BOARD_TYPE_CN3010_EVB_HS5:
+default:
return cvmx_rtc_ds1337_read();
break;
-
-default:
-return 0;
-break;
 }
 }
 
@@ -148,14 +138,9 @@ static inline uint32_t cvmx_rtc_write(ui
 return cvmx_rtc_ds1374_write(time);
 break;
 
-case CVMX_BOARD_TYPE_EBH3000:
-case CVMX_BOARD_TYPE_CN3010_EVB_HS5:
+default:
return cvmx_rtc_ds1337_write(time);
break;
-
-default:
-return 0;
-break;
 }
 }
 
___
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: r250427 - in head/sys/amd64/vmm: . io

2013-05-09 Thread Neel Natu
Author: neel
Date: Fri May 10 02:59:49 2013
New Revision: 250427
URL: http://svnweb.freebsd.org/changeset/base/250427

Log:
  Support array-type of stats in bhyve.
  
  An array-type stat in vmm.ko is defined as follows:
  VMM_STAT_ARRAY(IPIS_SENT, VM_MAXCPU, "ipis sent to vcpu");
  
  It is incremented as follows:
  vmm_stat_array_incr(vm, vcpuid, IPIS_SENT, array_index, 1);
  
  And output of 'bhyvectl --get-stats' looks like:
  ipis sent to vcpu[0] 3114
  ipis sent to vcpu[1] 0
  
  Reviewed by:  grehan
  Obtained from:NetApp

Modified:
  head/sys/amd64/vmm/io/vlapic.c
  head/sys/amd64/vmm/vmm_dev.c
  head/sys/amd64/vmm/vmm_stat.c
  head/sys/amd64/vmm/vmm_stat.h

Modified: head/sys/amd64/vmm/io/vlapic.c
==
--- head/sys/amd64/vmm/io/vlapic.c  Fri May 10 02:57:46 2013
(r250426)
+++ head/sys/amd64/vmm/io/vlapic.c  Fri May 10 02:59:49 2013
(r250427)
@@ -430,6 +430,8 @@ vlapic_fire_timer(struct vlapic *vlapic)
}
 }
 
+static VMM_STAT_ARRAY(IPIS_SENT, VM_MAXCPU, "ipis sent to vcpu");
+
 static int
 lapic_process_icr(struct vlapic *vlapic, uint64_t icrval)
 {
@@ -466,9 +468,11 @@ lapic_process_icr(struct vlapic *vlapic,
while ((i = cpusetobj_ffs(&dmask)) != 0) {
i--;
CPU_CLR(i, &dmask);
-   if (mode == APIC_DELMODE_FIXED)
+   if (mode == APIC_DELMODE_FIXED) {
lapic_set_intr(vlapic->vm, i, vec);
-   else
+   vmm_stat_array_incr(vlapic->vm, vlapic->vcpuid,
+   IPIS_SENT, i, 1);
+   } else
vm_inject_nmi(vlapic->vm, i);
}
 

Modified: head/sys/amd64/vmm/vmm_dev.c
==
--- head/sys/amd64/vmm/vmm_dev.cFri May 10 02:57:46 2013
(r250426)
+++ head/sys/amd64/vmm/vmm_dev.cFri May 10 02:59:49 2013
(r250427)
@@ -235,18 +235,13 @@ vmmdev_ioctl(struct cdev *cdev, u_long c
error = vm_run(sc->vm, vmrun);
break;
case VM_STAT_DESC: {
-   const char *desc;
statdesc = (struct vm_stat_desc *)data;
-   desc = vmm_stat_desc(statdesc->index);
-   if (desc != NULL) {
-   error = 0;
-   strlcpy(statdesc->desc, desc, sizeof(statdesc->desc));
-   } else
-   error = EINVAL;
+   error = vmm_stat_desc_copy(statdesc->index,
+   statdesc->desc, sizeof(statdesc->desc));
break;
}
case VM_STATS: {
-   CTASSERT(MAX_VM_STATS >= MAX_VMM_STAT_TYPES);
+   CTASSERT(MAX_VM_STATS >= MAX_VMM_STAT_ELEMS);
vmstats = (struct vm_stats *)data;
getmicrotime(&vmstats->tv);
error = vmm_stat_copy(sc->vm, vmstats->cpuid,

Modified: head/sys/amd64/vmm/vmm_stat.c
==
--- head/sys/amd64/vmm/vmm_stat.c   Fri May 10 02:57:46 2013
(r250426)
+++ head/sys/amd64/vmm/vmm_stat.c   Fri May 10 02:59:49 2013
(r250427)
@@ -39,8 +39,16 @@ __FBSDID("$FreeBSD$");
 #include "vmm_util.h"
 #include "vmm_stat.h"
 
-static int vstnum;
-static struct vmm_stat_type *vsttab[MAX_VMM_STAT_TYPES];
+/*
+ * 'vst_num_elems' is the total number of addressable statistic elements
+ * 'vst_num_types' is the number of unique statistic types
+ *
+ * It is always true that 'vst_num_elems' is greater than or equal to
+ * 'vst_num_types'. This is because a stat type may represent more than
+ * one element (for e.g. VMM_STAT_ARRAY).
+ */
+static int vst_num_elems, vst_num_types;
+static struct vmm_stat_type *vsttab[MAX_VMM_STAT_ELEMS];
 
 static MALLOC_DEFINE(M_VMM_STAT, "vmm stat", "vmm stat");
 
@@ -59,13 +67,15 @@ vmm_stat_init(void *arg)
if (vst->scope == VMM_STAT_SCOPE_AMD && !vmm_is_amd())
return;
 
-   if (vstnum >= MAX_VMM_STAT_TYPES) {
+   if (vst_num_elems + vst->nelems >= MAX_VMM_STAT_ELEMS) {
printf("Cannot accomodate vmm stat type \"%s\"!\n", vst->desc);
return;
}
 
-   vst->index = vstnum;
-   vsttab[vstnum++] = vst;
+   vst->index = vst_num_elems;
+   vst_num_elems += vst->nelems;
+
+   vsttab[vst_num_types++] = vst;
 }
 
 int
@@ -78,9 +88,9 @@ vmm_stat_copy(struct vm *vm, int vcpu, i
return (EINVAL);

stats = vcpu_stats(vm, vcpu);
-   for (i = 0; i < vstnum; i++)
+   for (i = 0; i < vst_num_elems; i++)
buf[i] = stats[i];
-   *num_stats = vstnum;
+   *num_stats = vst_num_elems;
return (0);
 }
 
@

svn commit: r250428 - head/sys/contrib/octeon-sdk

2013-05-09 Thread Warner Losh
Author: imp
Date: Fri May 10 03:04:45 2013
New Revision: 250428
URL: http://svnweb.freebsd.org/changeset/base/250428

Log:
  Add support from GE Intelligent Platform Cavium Octeon boards. Add
  options OCTEON_VENDOR_GEFES to enable support for these boards, to
  match changes that GE publishes to the Octeon Simple Executive. Since
  board types overlap with other boards, it is unlikely that we will
  properly boot on other Octeon boards with OCTEON_VENDOR_GEFES enabled.
  Tested extensively on the WANIC 6354, but I retained support for all
  the other models. Some features need changes in the base kernel, and
  those are in progress.

Modified:
  head/sys/contrib/octeon-sdk/cvmx-app-init.h
  head/sys/contrib/octeon-sdk/cvmx-helper-board.c
  head/sys/contrib/octeon-sdk/cvmx-helper-sgmii.c
  head/sys/contrib/octeon-sdk/cvmx-mgmt-port.c
  head/sys/contrib/octeon-sdk/cvmx-pcie.c

Modified: head/sys/contrib/octeon-sdk/cvmx-app-init.h
==
--- head/sys/contrib/octeon-sdk/cvmx-app-init.h Fri May 10 02:59:49 2013
(r250427)
+++ head/sys/contrib/octeon-sdk/cvmx-app-init.h Fri May 10 03:04:45 2013
(r250428)
@@ -120,6 +120,9 @@ struct cvmx_bootinfo {
 uint32_t dfa_ref_clock_hz;  /**< DFA reference clock in hz (if 
applicable)*/
 uint32_t config_flags;  /**< flags indicating various configuration 
options.  These flags supercede
 ** the 'flags' variable and should be used instead 
if available */
+#if defined(OCTEON_VENDOR_GEFES)
+uint32_t dfm_size; /**< DFA Size */
+#endif
 #endif
 #if (CVMX_BOOTINFO_MIN_VER >= 3)
 uint64_t fdt_addr;  /**< Address of the OF Flattened Device Tree structure 
describing the board. */
@@ -216,10 +219,17 @@ enum cvmx_board_types_enum {
 CVMX_BOARD_TYPE_HIKARI = 10,
 CVMX_BOARD_TYPE_CN3010_EVB_HS5 = 11,
 CVMX_BOARD_TYPE_CN3005_EVB_HS5 = 12,
+#if defined(OCTEON_VENDOR_GEFES)
+CVMX_BOARD_TYPE_TNPA3804   = 13,
+CVMX_BOARD_TYPE_AT5810 = 14,
+CVMX_BOARD_TYPE_WNPA3850   = 15,
+CVMX_BOARD_TYPE_W3860  = 16,
+#else
 CVMX_BOARD_TYPE_KBP= 13,
 CVMX_BOARD_TYPE_CN3020_EVB_HS5 = 14,  /* Deprecated, 
CVMX_BOARD_TYPE_CN3010_EVB_HS5 supports the CN3020 */
 CVMX_BOARD_TYPE_EBT5800= 15,
 CVMX_BOARD_TYPE_NICPRO2= 16,
+#endif
 CVMX_BOARD_TYPE_EBH5600= 17,
 CVMX_BOARD_TYPE_EBH5601= 18,
 CVMX_BOARD_TYPE_EBH5200= 19,
@@ -305,6 +315,16 @@ enum cvmx_board_types_enum {
 #if defined(OCTEON_VENDOR_RADISYS)
 CVMX_BOARD_TYPE_CUST_RADISYS_RSYS4GBE=20002,
 #endif
+#if defined(OCTEON_VENDOR_GEFES)
+CVMX_BOARD_TYPE_CUST_TNPA5804   = 20005,
+CVMX_BOARD_TYPE_CUST_W5434  = 20006,
+CVMX_BOARD_TYPE_CUST_W5650  = 20007,
+CVMX_BOARD_TYPE_CUST_W5800  = 20008,
+CVMX_BOARD_TYPE_CUST_W5651X = 20009,
+CVMX_BOARD_TYPE_CUST_TNPA5651X  = 20010,
+CVMX_BOARD_TYPE_CUST_TNPA56X4   = 20011,
+CVMX_BOARD_TYPE_CUST_W63XX  = 20013,
+#endif
 CVMX_BOARD_TYPE_CUST_PRIVATE_MAX = 3,
 
 
@@ -352,10 +372,17 @@ static inline const char *cvmx_board_typ
 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_HIKARI)
 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CN3010_EVB_HS5)
 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CN3005_EVB_HS5)
+#if defined(OCTEON_VENDOR_GEFES)
+ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_TNPA3804)
+ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_AT5810)
+ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_WNPA3850)
+ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_W3860)
+#else
 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_KBP)
 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CN3020_EVB_HS5)
 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_EBT5800)
 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_NICPRO2)
+#endif
 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_EBH5600)
 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_EBH5601)
 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_EBH5200)
@@ -420,7 +447,6 @@ static inline const char *cvmx_board_typ
 #else
ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_L2_ZINWELL)
 #endif
-
 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_DEFINED_MAX)
 
 /* Customer private range */
@@ -435,6 +461,16 @@ static inline const char *cvmx_board_typ
 #if defined(OCTEON_VENDOR_RADISYS)
ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_RADISYS_RSYS4GBE)
 #endif
+#if defined(OCTEON_VENDOR_GEFES)
+   ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_TNPA5804)
+   ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_W5434)
+   ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_W5650)
+   ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_W5800)
+   ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_W5651X)
+   ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_TNPA5651X)
+   ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_TNPA56X4)
+   ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_W63XX)
+#endif
 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_PRIVATE_MAX)
 
 

svn commit: r250429 - head/sys/mips/conf

2013-05-09 Thread Warner Losh
Author: imp
Date: Fri May 10 03:05:44 2013
New Revision: 250429
URL: http://svnweb.freebsd.org/changeset/base/250429

Log:
  Add commented out OCTEON_VENDOR_GEFES

Modified:
  head/sys/mips/conf/OCTEON1

Modified: head/sys/mips/conf/OCTEON1
==
--- head/sys/mips/conf/OCTEON1  Fri May 10 03:04:45 2013(r250428)
+++ head/sys/mips/conf/OCTEON1  Fri May 10 03:05:44 2013(r250429)
@@ -40,6 +40,7 @@ makeoptions   DEBUG=-g#Build kernel with
 #options   OCTEON_VENDOR_LANNER# Support for Lanner boards.
 #options   OCTEON_VENDOR_RADISYS   # Support for Radisys boards.
 #options   OCTEON_VENDOR_UBIQUITI  # Support for Ubiquiti boards.
+#options   OCTEON_VENDOR_GEFES # Support for GE LANIC boards
 #options   OCTEON_BOARD_CAPK_0100ND# Support for CAPK-0100nd.
 
 # Compile for a specified Octeon model.  If not specified, support for
___
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: r250220 - head/sys/kern

2013-05-09 Thread Bruce Evans

On Mon, 6 May 2013, John Baldwin wrote:


On Saturday, May 04, 2013 4:47:43 am Bruce Evans wrote:

Log:
 Fix FIONREAD on regular files.  The computed result was being ignored and
 it was being passed down to VOP_IOCTL() where it promptly resulted in
 ENOTTY due to a missing else for the past 8 years.  While here, use a
 shared vnode lock while fetching the current file's size.


In another thread I complained to kib about using the bad style of not
returning as soon as possible, but instead sometimes returning and sometimes
falling through a complicated if-else ladder to get to the return at the
end.


What about this:


My mail is barely working while I'm away.  This is the only reply that
I received recently.


static int
vn_ioctl(fp, com, data, active_cred, td)
struct file *fp;
u_long com;
void *data;
struct ucred *active_cred;
struct thread *td;
{
struct vnode *vp = fp->f_vnode;
struct vattr vattr;

switch (vp->v_type) {
case VREG:
case VDIR:
switch (com) {
case FIONREAD:
vn_lock(vp, LK_SHARED | LK_RETRY);
error = VOP_GETATTR(vp, &vattr, active_cred);
VOP_UNLOCK(vp, 0);
if (!error)
*(int *)data = vattr.va_size - fp->f_offset;
return (error);
case FIONBIO:
case FIOASYNC:
return (0); /* XXX */
default:
return (VOP_IOCTL(vp, com, data, fp->f_flag,
active_cred, td));
}
default:
return (ENOTTY);
}
}


Yes, that is the simplification for the logic that I want.

This function has many other style bugs, starting witht the unsorting of
vp relative to vattr and the initialization of vp in its declaration.
I don't count the old-style function definition as a style bug :).

Also, the case statment is unsorted (which used to be needed for the
logic of falling through), and !error is used for the non-boolean
'error'.  !error is near the overflow bug in *(int *) for large files.
INT_MAX should probably be returned when the correct value is
unrepresentable.  This can't be worse than overflowing to a garbage
(possibly small or negative value).  Testing 'error' is not even needed,
since *(int *)data is indeterminate after an error.


(The 'XXX' comment could perhaps be expanded to something along the lines of
'Allow fcntl() to toggle FNONBLOCK and FASYNC.')


Is that what it is about?  IIRC, upper layers do some partial handling
and then call lower layers to possibly do some more handling.  But here
and in some other places there is nothing more to be done.  No comment
is needed, but maybe the XXX's were reminders to clean up the layering.
FreeBSD has cleaned up the layering a bit, by using differnt fops for
different file types.

Bruce
___
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: r250426 - head/sys/contrib/octeon-sdk

2013-05-09 Thread Juli Mallett
On Thu, May 9, 2013 at 7:57 PM, Warner Losh  wrote:
> Log:
>   Both my EBH5200 and GE WANIC 6354 have a RTC as well. It looks from
>   the Linux tree that they always include this chip in their FDT, so
>   make support for the ds1337 opt-out rather than opt-in. Now my boards
>   boot with the correct time.

What boards did you test on without RTCs to verify that it doesn't
cause hangs?  The fact that there are two boards not enumerated which
did have an RTC doesn't say anything about the boards that truly
don't.  Likewise, Linux's FDT is not authoritative for all boards.
I'd feel better knowing this at least won't have a negative effect on
boards without an RTC.
___
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: r250430 - head/sbin/dmesg

2013-05-09 Thread Eitan Adler
Author: eadler
Date: Fri May 10 03:42:48 2013
New Revision: 250430
URL: http://svnweb.freebsd.org/changeset/base/250430

Log:
  Add support for 'dmesg -c' which clears the dmesg buffer after it has
  been printed.  This provides compatibility with other *nix systems
  (including Linux).
  
  While here use stdbool booleans for 'all'.
  
  PR:   bin/178295
  Submitted by: Levent Serinol 
  Reviewed by:  will

Modified:
  head/sbin/dmesg/dmesg.8
  head/sbin/dmesg/dmesg.c

Modified: head/sbin/dmesg/dmesg.8
==
--- head/sbin/dmesg/dmesg.8 Fri May 10 03:05:44 2013(r250429)
+++ head/sbin/dmesg/dmesg.8 Fri May 10 03:42:48 2013(r250430)
@@ -36,7 +36,7 @@
 .Nd "display the system message buffer"
 .Sh SYNOPSIS
 .Nm
-.Op Fl a
+.Op Fl ac
 .Op Fl M Ar core Op Fl N Ar system
 .Sh DESCRIPTION
 The
@@ -59,6 +59,8 @@ Show all data in the message buffer.
 This includes any syslog records and
 .Pa /dev/console
 output.
+.It Fl c
+Clear the kernel buffer after printing.
 .It Fl M
 Extract values associated with the name list from the specified core.
 .It Fl N

Modified: head/sbin/dmesg/dmesg.c
==
--- head/sbin/dmesg/dmesg.c Fri May 10 03:05:44 2013(r250429)
+++ head/sbin/dmesg/dmesg.c Fri May 10 03:42:48 2013(r250430)
@@ -54,6 +54,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -79,15 +80,20 @@ main(int argc, char *argv[])
kvm_t *kd;
size_t buflen, bufpos;
long pri;
-   int all, ch;
+   int ch, clear;
+   bool all;
 
-   all = 0;
+   all = false;
+   clear = false;
(void) setlocale(LC_CTYPE, "");
memf = nlistf = NULL;
-   while ((ch = getopt(argc, argv, "aM:N:")) != -1)
+   while ((ch = getopt(argc, argv, "acM:N:")) != -1)
switch(ch) {
case 'a':
-   all++;
+   all = true;
+   break;
+   case 'c':
+   clear = true;
break;
case 'M':
memf = optarg;
@@ -190,12 +196,16 @@ main(int argc, char *argv[])
(void)strvisx(visbp, p, nextp - p, 0);
(void)printf("%s", visbp);
}
+   if (clear)
+   if (sysctlbyname("kern.msgbuf_clear", NULL, NULL, &clear, 
sizeof(int)))
+   err(1, "sysctl kern.msgbuf_clear");
+
exit(0);
 }
 
 void
 usage(void)
 {
-   (void)fprintf(stderr, "usage: dmesg [-a] [-M core [-N system]]\n");
+   fprintf(stderr, "usage: dmesg [-ac] [-M core [-N system]]\n");
exit(1);
 }
___
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: r250431 - head/usr.bin/xargs

2013-05-09 Thread Eitan Adler
Author: eadler
Date: Fri May 10 03:49:05 2013
New Revision: 250431
URL: http://svnweb.freebsd.org/changeset/base/250431

Log:
  Style(9) changes fo xargs.c

Modified:
  head/usr.bin/xargs/xargs.c

Modified: head/usr.bin/xargs/xargs.c
==
--- head/usr.bin/xargs/xargs.c  Fri May 10 03:42:48 2013(r250430)
+++ head/usr.bin/xargs/xargs.c  Fri May 10 03:49:05 2013(r250431)
@@ -670,12 +670,14 @@ pids_init(void)
 static int
 pids_empty(void)
 {
+
return (curprocs == 0);
 }
 
 static int
 pids_full(void)
 {
+
return (curprocs >= maxprocs);
 }
 
@@ -709,7 +711,6 @@ findfreeslot(void)
 
if ((slot = findslot(NOPID)) < 0)
errx(1, "internal error: no free pid slot");
-
return (slot);
 }
 
@@ -721,13 +722,13 @@ findslot(pid_t pid)
for (slot = 0; slot < maxprocs; slot++)
if (childpids[slot] == pid)
return (slot);
-
return (-1);
 }
 
 static void
 clearslot(int slot)
 {
+
childpids[slot] = NOPID;
 }
 
@@ -762,6 +763,7 @@ prompt(void)
 static void
 usage(void)
 {
+
fprintf(stderr,
 "usage: xargs [-0opt] [-E eofstr] [-I replstr [-R replacements] [-S 
replsize]]\n"
 " [-J replstr] [-L number] [-n number [-x]] [-P maxprocs]\n"
___
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: r250426 - head/sys/contrib/octeon-sdk

2013-05-09 Thread Warner Losh

On May 9, 2013, at 9:26 PM, Juli Mallett wrote:

> On Thu, May 9, 2013 at 7:57 PM, Warner Losh  wrote:
>> Log:
>>  Both my EBH5200 and GE WANIC 6354 have a RTC as well. It looks from
>>  the Linux tree that they always include this chip in their FDT, so
>>  make support for the ds1337 opt-out rather than opt-in. Now my boards
>>  boot with the correct time.
> 
> What boards did you test on without RTCs to verify that it doesn't
> cause hangs?  The fact that there are two boards not enumerated which
> did have an RTC doesn't say anything about the boards that truly
> don't.  Likewise, Linux's FDT is not authoritative for all boards.
> I'd feel better knowing this at least won't have a negative effect on
> boards without an RTC.

I don't have any boards without an RTC, but I can try wiring the RTC to a bugs 
address to see what happens. If that's an acceptable level of testing, I'll do 
that. If not, I'll enumerate.

Warner


___
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: r250432 - head/usr.bin/split

2013-05-09 Thread Eitan Adler
Author: eadler
Date: Fri May 10 04:23:03 2013
New Revision: 250432
URL: http://svnweb.freebsd.org/changeset/base/250432

Log:
  Implement 'split -d' which allows a numeric suffix instead of an
  alphabetic one.
  
  PR:   bin/116209
  Submitted by: Marcin Gryszkalis  (adapted from)
  Reviewed by:  will
  MFC after:1 week

Modified:
  head/usr.bin/split/split.1
  head/usr.bin/split/split.c

Modified: head/usr.bin/split/split.1
==
--- head/usr.bin/split/split.1  Fri May 10 03:49:05 2013(r250431)
+++ head/usr.bin/split/split.1  Fri May 10 04:23:03 2013(r250432)
@@ -36,10 +36,12 @@
 .Nd split a file into pieces
 .Sh SYNOPSIS
 .Nm
+.Fl d
 .Op Fl l Ar line_count
 .Op Fl a Ar suffix_length
 .Op Ar file Op Ar prefix
 .Nm
+.Fl d
 .Fl b Ar byte_count Ns
 .Oo
 .Sm off
@@ -49,10 +51,12 @@
 .Op Fl a Ar suffix_length
 .Op Ar file Op Ar prefix
 .Nm
+.Fl d
 .Fl n Ar chunk_count
 .Op Fl a Ar suffix_length
 .Op Ar file Op Ar prefix
 .Nm
+.Fl d
 .Fl p Ar pattern
 .Op Fl a Ar suffix_length
 .Op Ar file Op Ar prefix
@@ -108,6 +112,8 @@ or
 is appended to the number, the file is split into
 .Ar byte_count
 gigabyte pieces.
+.It Fl d
+Use a numeric suffix instead of a alphabetic suffix.
 .It Fl l Ar line_count
 Create split files
 .Ar line_count

Modified: head/usr.bin/split/split.c
==
--- head/usr.bin/split/split.c  Fri May 10 03:49:05 2013(r250431)
+++ head/usr.bin/split/split.c  Fri May 10 04:23:03 2013(r250432)
@@ -51,6 +51,7 @@ static const char sccsid[] = "@(#)split.
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -70,6 +71,7 @@ static charbfr[MAXBSIZE]; /* I/O buff
 static char fname[MAXPATHLEN]; /* File name prefix. */
 static regex_t  rgx;
 static int  pflag;
+static bool dflag;
 static long sufflen = 2;   /* File name suffix length. */
 
 static void newfile(void);
@@ -88,7 +90,8 @@ main(int argc, char **argv)
 
setlocale(LC_ALL, "");
 
-   while ((ch = getopt(argc, argv, "0123456789a:b:l:n:p:")) != -1)
+   dflag = false;
+   while ((ch = getopt(argc, argv, "0123456789a:b:dl:n:p:")) != -1)
switch (ch) {
case '0': case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9':
@@ -131,6 +134,9 @@ main(int argc, char **argv)
errx(EX_USAGE, "%s: offset too large", optarg);
bytecnt = (off_t)(bytecnti * scale);
break;
+   case 'd':   /* Decimal suffix */
+   dflag = true;
+   break;
case 'l':   /* Line count. */
if (numlines != 0)
usage();
@@ -348,6 +354,8 @@ newfile(void)
long i, maxfiles, tfnum;
static long fnum;
static char *fpnt;
+   char beg, end;
+   int pattlen;
 
if (ofd == -1) {
if (fname[0] == '\0') {
@@ -359,9 +367,19 @@ newfile(void)
ofd = fileno(stdout);
}
 
-   /* maxfiles = 26^sufflen, but don't use libm. */
+   if (dflag) {
+   beg = '0';
+   end = '9';
+   }
+   else {
+   beg = 'a';
+   end = 'z';
+   }
+   pattlen = end - beg + 1;
+
+   /* maxfiles = pattlen^sufflen, but don't use libm. */
for (maxfiles = 1, i = 0; i < sufflen; i++)
-   if ((maxfiles *= 26) <= 0)
+   if ((maxfiles *= pattlen) <= 0)
errx(EX_USAGE, "suffix is too long (max %ld)", i);
 
if (fnum == maxfiles)
@@ -371,8 +389,8 @@ newfile(void)
tfnum = fnum;
i = sufflen - 1;
do {
-   fpnt[i] = tfnum % 26 + 'a';
-   tfnum /= 26;
+   fpnt[i] = tfnum % pattlen + beg;
+   tfnum /= pattlen;
} while (i-- > 0);
fpnt[sufflen] = '\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: r250433 - head/sys/contrib/octeon-sdk

2013-05-09 Thread Warner Losh
Author: imp
Date: Fri May 10 04:30:14 2013
New Revision: 250433
URL: http://svnweb.freebsd.org/changeset/base/250433

Log:
  Remove the commented out code I just committed. If we need it, I'll
  bring it back uncommented our, or rewrite it.

Modified:
  head/sys/contrib/octeon-sdk/cvmx-pcie.c

Modified: head/sys/contrib/octeon-sdk/cvmx-pcie.c
==
--- head/sys/contrib/octeon-sdk/cvmx-pcie.c Fri May 10 04:23:03 2013
(r250432)
+++ head/sys/contrib/octeon-sdk/cvmx-pcie.c Fri May 10 04:30:14 2013
(r250433)
@@ -518,41 +518,6 @@ retry:
 return -1;
 }
 
-#if defined(CONFIG_GEFES_SUPPORT) /* Commented out for now */
-/* check if we should initialize this port */
-if ((cvmx_sysinfo_get()->board_type == CVMX_BOARD_TYPE_TNPA56X4) ||
-(cvmx_sysinfo_get()->board_type == CVMX_BOARD_TYPE_TNPA5651X)) 
{
-unsigned char fpga_ekeylanes0 = 0;
-unsigned char fpga_ekeylanes1 = 0;
-
-cvmx_get_mmc_ekeying(&fpga_ekeylanes0, &fpga_ekeylanes1);
-/* For pcie_port 0 - QLM0 (& optionally QLM1)
-   x4 PCIe AMC ports 4-7 via QLM0
-   x8 PCIe AMC ports 4-7 via QLM0 and AMC ports 8-11 via QLM1
-   root complex or end point configuration
-   must be root complex via "if (npei_ctl_status.s.host_mode) {"
-*/
-
-if ((pcie_port == 0) && (fpga_ekeylanes1 == 0)) {
-return -1;
-}
-
-/* For pcie_port 1 - QLM2 in RC only connected to 82571 ethernet */
-/* always enabled, don't check ekeying lanes */
-}
-else /* all other GEFES boards(maybe just WANIC?)*/
-{
-cvmx_npei_ctl_status_t npei_ctl_status;
-
-npei_ctl_status.u64 = cvmx_read_csr(CVMX_PEXP_NPEI_CTL_STATUS);
-if ( (pcie_port == 1) && (!npei_ctl_status.s.host_mode) )
-{
-cvmx_dprintf("PCIe: Port 1 not used (RC only), skipping.\\n");
-return -1;
-}
-}
-#endif /* CONFIG_GEFES_SUPPORT */
-
 /* PCIe switch arbitration mode. '0' == fixed priority NPEI, PCIe0, then 
PCIe1. '1' == round robin. */
 npei_ctl_status.s.arb = 1;
 /* Allow up to 0x20 config retries */
@@ -1023,27 +988,6 @@ static int __cvmx_pcie_rc_initialize_gen
 return -1;
 }
 
-#ifdef CONFIG_GEFES_SUPPORT /* commented out for now */
-/* check if we should initialize this port */
-if ((cvmx_sysinfo_get()->board_type == CVMX_BOARD_TYPE_TNPA56X4) ||
-(cvmx_sysinfo_get()->board_type == CVMX_BOARD_TYPE_TNPA5651X)) {
-unsigned char fpga_ekeylanes0;
-unsigned char fpga_ekeylanes1;
-
-cvmx_get_mmc_ekeying(&fpga_ekeylanes0, &fpga_ekeylanes1);
-/* For pcie_port 0 - QLM0 (& optionally QLM1)
-   x4 PCIe AMC ports 4-7 via QLM0
-   x8 PCIe AMC ports 4-7 via QLM0 and AMC ports 8-11 via QLM1
-   root complex or end point configuration
-   must be endpoint via "if (npei_ctl_status.s.host_mode) {"
-*/
-if (( pcie_port == 0) && (fpga_ekeylanes1 == 0)) {
-return -1;
-}
-/* can't get here for pcie_port 1 as is always only root complex 
configured */
-}
-#endif /* CONFIG_GEFES_SUPPORT */
-
 /* CN63XX Pass 1.0 errata G-14395 requires the QLM De-emphasis be 
programmed */
 if (OCTEON_IS_MODEL(OCTEON_CN63XX_PASS1_0))
 {
@@ -1398,43 +1342,6 @@ uint32_t cvmx_pcie_config_read32(int pci
 {
 uint64_t address;
 
-#ifdef CONFIG_GEFES_SUPPORT /* Commented out for now */
-   
-int result;
-
-   /* if U-boot initializes the PCIe ports, then to Linux
-  it looks as if the ports are up, when in fact, the
-  port 0 link could be down because there is no endpoint
-  configured card present.  If that is the case, U-boot
-  would not have configured the access to the PCIe config
-  space for that port and Linux would crash when it tries
-  to access that memory space.  This code checks to see
-  if root complex mode is configured, and if it is, if
-  the link is up for the port before trying to access
-  the config space.
-   */
-
-   /* root complex ? */
-   result = cvmx_pcie_dogetinfo(pcie_port, 2);
-   if (result == 1) {
-   //cvmx_dprintf("cvmx_pcie_config_read32: pcie_port %d in root 
complex mode\n", pcie_port);
-   } else {
-   //cvmx_dprintf("cvmx_pcie_config_read32: pcie_port %d in end 
point mode\n", pcie_port);
-   }
-   
-   if (result == 1) {
-   /* link up? */
-   result = cvmx_pcie_dogetinfo(pcie_port, 0);
-
-   if (result == 1) {
-   //cvmx_dprintf("cvmx_pcie_config_read32: pcie_port %d 
link UP\n", pcie_port);
-   } else {
-   cvmx_dprintf("cvmx_pcie_config_read32: pcie_port %d 
link DOWN\n", pcie_port);
-

svn commit: r250434 - head/sys/contrib/octeon-sdk

2013-05-09 Thread Warner Losh
Author: imp
Date: Fri May 10 04:49:40 2013
New Revision: 250434
URL: http://svnweb.freebsd.org/changeset/base/250434

Log:
  As requested, move this back to opt-in and list my boards.

Modified:
  head/sys/contrib/octeon-sdk/cvmx-rtc.h

Modified: head/sys/contrib/octeon-sdk/cvmx-rtc.h
==
--- head/sys/contrib/octeon-sdk/cvmx-rtc.h  Fri May 10 04:30:14 2013
(r250433)
+++ head/sys/contrib/octeon-sdk/cvmx-rtc.h  Fri May 10 04:49:40 2013
(r250434)
@@ -87,9 +87,18 @@ static inline cvmx_rtc_options_t cvmx_rt
supported = CVMX_RTC_READ | CVMX_RTC_WRITE | CVMX_RTC_TIME_EPOCH;
break;
 
-   default:
+   case CVMX_BOARD_TYPE_EBH3000:
+   case CVMX_BOARD_TYPE_CN3010_EVB_HS5:
+   case CVMX_BOARD_TYPE_EBH5200:
+#if defined(OCTEON_VENDOR_GEFES)
+   case CVMX_BOARD_TYPE_CUST_W63XX:
+#endif
supported = CVMX_RTC_READ | CVMX_RTC_WRITE | CVMX_RTC_TIME_CAL;
break;
+
+   default:
+   supported = 0;
+   break;
}
 
 #ifdef CVMX_RTC_DEBUG
@@ -117,9 +126,18 @@ static inline uint32_t cvmx_rtc_read(voi
 return cvmx_rtc_ds1374_read();
 break;
 
-default:
+case CVMX_BOARD_TYPE_EBH3000:
+case CVMX_BOARD_TYPE_CN3010_EVB_HS5:
+case CVMX_BOARD_TYPE_EBH5200:
+#if defined(OCTEON_VENDOR_GEFES)
+case CVMX_BOARD_TYPE_CUST_W63XX:
+#endif
return cvmx_rtc_ds1337_read();
break;
+
+default:
+return 0;
+break;
 }
 }
 
@@ -138,9 +156,18 @@ static inline uint32_t cvmx_rtc_write(ui
 return cvmx_rtc_ds1374_write(time);
 break;
 
-default:
+case CVMX_BOARD_TYPE_EBH3000:
+case CVMX_BOARD_TYPE_CN3010_EVB_HS5:
+case CVMX_BOARD_TYPE_EBH5200:
+#if defined(OCTEON_VENDOR_GEFES)
+case CVMX_BOARD_TYPE_CUST_W63XX:
+#endif
return cvmx_rtc_ds1337_write(time);
break;
+
+default:
+return 0;
+break;
 }
 }
 
___
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: r250435 - head/sys/boot/fdt/dts

2013-05-09 Thread Tim Kientzle
Author: kientzle
Date: Fri May 10 05:34:08 2013
New Revision: 250435
URL: http://svnweb.freebsd.org/changeset/base/250435

Log:
  Move 'compatible' line out of the common am335x.dtsi and into
  the beaglebone-specific .dts file.
  
  Add a new .dts for the BeagleBone Black with more memory,
  slightly different pinmux initialization, and with mmchs1
  configured (though the latter doesn't quite work yet).

Added:
  head/sys/boot/fdt/dts/beaglebone-black.dts
 - copied, changed from r250434, head/sys/boot/fdt/dts/beaglebone.dts
Modified:
  head/sys/boot/fdt/dts/am335x.dtsi
  head/sys/boot/fdt/dts/beaglebone.dts

Modified: head/sys/boot/fdt/dts/am335x.dtsi
==
--- head/sys/boot/fdt/dts/am335x.dtsi   Fri May 10 04:49:40 2013
(r250434)
+++ head/sys/boot/fdt/dts/am335x.dtsi   Fri May 10 05:34:08 2013
(r250435)
@@ -27,7 +27,6 @@
  */
 
 / {
-   compatible = "ti,am335x";
#address-cells = <1>;
#size-cells = <1>;
 
@@ -107,7 +106,7 @@
interrupt-parent = <&AINTC>;
};
 
-   mmchs0@4809C000 {
+   mmchs0@4806 {
compatible = "ti,mmchs";
reg =<0x4806 0x1000 >;
interrupts = <64>;
@@ -115,6 +114,15 @@
mmchs-device-id = <0>;
};
 
+   mmchs1@481D8000 {
+   compatible = "ti,mmchs";
+   reg =<0x481D8000 0x1000 >;
+   interrupts = <28>;
+   interrupt-parent = <&AINTC>;
+   mmchs-device-id = <1>;
+   status = "disabled";
+   };
+
enet0: ethernet@4A10 {
#address-cells = <1>;
#size-cells = <1>;

Copied and modified: head/sys/boot/fdt/dts/beaglebone-black.dts (from r250434, 
head/sys/boot/fdt/dts/beaglebone.dts)
==
--- head/sys/boot/fdt/dts/beaglebone.dtsFri May 10 04:49:40 2013
(r250434, copy source)
+++ head/sys/boot/fdt/dts/beaglebone-black.dts  Fri May 10 05:34:08 2013
(r250435)
@@ -31,7 +31,9 @@
 /include/ "am335x.dtsi"
 
 / {
-   model = "beaglebone";
+   model = "beaglebone-black";
+   compatible = "beaglebone-black", "beaglebone", "ti,am335x";
+
 
aliases {
soc = &SOC;
@@ -40,7 +42,7 @@
 
memory {
device_type = "memory";
-   reg = < 0x8000 0x1000 >;/* 256MB RAM */
+   reg = < 0x8000 0x2000 >;/* 512MB RAM */
};
 
am335x {
@@ -73,18 +75,21 @@
"MMC0_DAT1", "mmc0_dat1", "input_pullup",
"MMC0_DAT2", "mmc0_dat2", "input_pullup",
"MMC0_DAT3", "mmc0_dat3", "input_pullup",
+   /* MMC1 */
+   "GPMC_CSn1", "mmc1_clk", "input_pulldown",
+   "GPMC_CSn2", "mmc1_cmd", "input_pulldown",
+   "GPMC_AD0", "mmc1_dat0", "input_pulldown",
+   "GPMC_AD1", "mmc1_dat1", "input_pulldown",
+   "GPMC_AD2", "mmc1_dat2", "input_pulldown",
+   "GPMC_AD3", "mmc1_dat3", "input_pulldown",
+   "GPMC_AD4", "mmc1_dat4", "input_pulldown",
+   "GPMC_AD5", "mmc1_dat5", "input_pulldown",
+   "GPMC_AD6", "mmc1_dat6", "input_pulldown",
+   "GPMC_AD7", "mmc1_dat7", "input_pulldown",
/* GPIO */
"ECAP0_IN_PWM0_OUT", "gpio0_7", 
"input_pulldown",
"GPMC_AD10", "gpio0_26", "input_pulldown",
"GPMC_AD11", "gpio0_27", "input_pulldown",
-   "GPMC_AD0", "gpio1_0", "input_pulldown",
-   "GPMC_AD1", "gpio1_1", "input_pulldown",
-   "GPMC_AD2", "gpio1_2", "input_pulldown",
-   "GPMC_AD3", "gpio1_3", "input_pulldown",
-   "GPMC_AD4", "gpio1_4", "input_pulldown",
-   "GPMC_AD5", "gpio1_5", "input_pulldown",
-   "GPMC_AD6", "gpio1_6", "input_pulldown",
-   "GPMC_AD7", "gpio1_7", "input_pulldown",
"GPMC_AD12", "gpio1_12", "input_pulldown",
"GPMC_AD13", "gpio1_13", "input_pulldown",
"GPMC_AD14", "gpio1_14", "input_pulldown",
@@ -97,8 +102,6 @@
"GPMC_A8", "gpio1_24", "output", /* User LED 4 

Re: svn commit: r250435 - head/sys/boot/fdt/dts

2013-05-09 Thread Oleksandr Tymoshenko

On 2013-05-09, at 10:34 PM, Tim Kientzle  wrote:

> Author: kientzle
> Date: Fri May 10 05:34:08 2013
> New Revision: 250435
> URL: http://svnweb.freebsd.org/changeset/base/250435
> 
> Log:
>  Move 'compatible' line out of the common am335x.dtsi and into
>  the beaglebone-specific .dts file.
> 
>  Add a new .dts for the BeagleBone Black with more memory,
>  slightly different pinmux initialization, and with mmchs1
>  configured (though the latter doesn't quite work yet).

Thanks for sorting this out, Tim. 
___
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: r250436 - head/sys/contrib/octeon-sdk

2013-05-09 Thread Warner Losh
Author: imp
Date: Fri May 10 06:28:01 2013
New Revision: 250436
URL: http://svnweb.freebsd.org/changeset/base/250436

Log:
  Make the read/write routines default to the newer DS1337 part, but keep
  the supported bits board specific.

Modified:
  head/sys/contrib/octeon-sdk/cvmx-rtc.h

Modified: head/sys/contrib/octeon-sdk/cvmx-rtc.h
==
--- head/sys/contrib/octeon-sdk/cvmx-rtc.h  Fri May 10 05:34:08 2013
(r250435)
+++ head/sys/contrib/octeon-sdk/cvmx-rtc.h  Fri May 10 06:28:01 2013
(r250436)
@@ -126,18 +126,9 @@ static inline uint32_t cvmx_rtc_read(voi
 return cvmx_rtc_ds1374_read();
 break;
 
-case CVMX_BOARD_TYPE_EBH3000:
-case CVMX_BOARD_TYPE_CN3010_EVB_HS5:
-case CVMX_BOARD_TYPE_EBH5200:
-#if defined(OCTEON_VENDOR_GEFES)
-case CVMX_BOARD_TYPE_CUST_W63XX:
-#endif
+default:
return cvmx_rtc_ds1337_read();
break;
-
-default:
-return 0;
-break;
 }
 }
 
@@ -156,18 +147,9 @@ static inline uint32_t cvmx_rtc_write(ui
 return cvmx_rtc_ds1374_write(time);
 break;
 
-case CVMX_BOARD_TYPE_EBH3000:
-case CVMX_BOARD_TYPE_CN3010_EVB_HS5:
-case CVMX_BOARD_TYPE_EBH5200:
-#if defined(OCTEON_VENDOR_GEFES)
-case CVMX_BOARD_TYPE_CUST_W63XX:
-#endif
+default:
return cvmx_rtc_ds1337_write(time);
break;
-
-default:
-return 0;
-break;
 }
 }
 
___
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"