From owner-svn-src-head@FreeBSD.ORG Sun Mar 25 00:02:38 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 44740106566B; Sun, 25 Mar 2012 00:02:38 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2587D8FC1A; Sun, 25 Mar 2012 00:02:38 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2P02ckw054529; Sun, 25 Mar 2012 00:02:38 GMT (envelope-from mckusick@svn.freebsd.org) Received: (from mckusick@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2P02bU3054520; Sun, 25 Mar 2012 00:02:37 GMT (envelope-from mckusick@svn.freebsd.org) Message-Id: <201203250002.q2P02bU3054520@svn.freebsd.org> From: Kirk McKusick Date: Sun, 25 Mar 2012 00:02:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233438 - head/sys/ufs/ffs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Mar 2012 00:02:38 -0000 Author: mckusick Date: Sun Mar 25 00:02:37 2012 New Revision: 233438 URL: http://svn.freebsd.org/changeset/base/233438 Log: Add a third flags argument to ffs_syncvnode to avoid a possible conflict with MNT_WAIT flags that passed in its second argument. This will be MFC'ed together with r232351. Discussed with: kib Modified: head/sys/ufs/ffs/ffs_balloc.c head/sys/ufs/ffs/ffs_extern.h head/sys/ufs/ffs/ffs_inode.c head/sys/ufs/ffs/ffs_rawread.c head/sys/ufs/ffs/ffs_snapshot.c head/sys/ufs/ffs/ffs_softdep.c head/sys/ufs/ffs/ffs_vfsops.c head/sys/ufs/ffs/ffs_vnops.c Modified: head/sys/ufs/ffs/ffs_balloc.c ============================================================================== --- head/sys/ufs/ffs/ffs_balloc.c Sat Mar 24 23:10:18 2012 (r233437) +++ head/sys/ufs/ffs/ffs_balloc.c Sun Mar 25 00:02:37 2012 (r233438) @@ -450,7 +450,7 @@ fail: * * XXX Still have to journal the free below */ - (void) ffs_syncvnode(vp, MNT_WAIT); + (void) ffs_syncvnode(vp, MNT_WAIT, 0); for (deallocated = 0, blkp = allociblk, lbns_remfree = lbns; blkp < allocblk; blkp++, lbns_remfree++) { /* @@ -497,7 +497,7 @@ fail: dp->di_blocks -= btodb(deallocated); ip->i_flag |= IN_CHANGE | IN_UPDATE; } - (void) ffs_syncvnode(vp, MNT_WAIT); + (void) ffs_syncvnode(vp, MNT_WAIT, 0); /* * After the buffers are invalidated and on-disk pointers are * cleared, free the blocks. @@ -994,7 +994,7 @@ fail: * * XXX Still have to journal the free below */ - (void) ffs_syncvnode(vp, MNT_WAIT); + (void) ffs_syncvnode(vp, MNT_WAIT, 0); for (deallocated = 0, blkp = allociblk, lbns_remfree = lbns; blkp < allocblk; blkp++, lbns_remfree++) { /* @@ -1041,7 +1041,7 @@ fail: dp->di_blocks -= btodb(deallocated); ip->i_flag |= IN_CHANGE | IN_UPDATE; } - (void) ffs_syncvnode(vp, MNT_WAIT); + (void) ffs_syncvnode(vp, MNT_WAIT, 0); /* * After the buffers are invalidated and on-disk pointers are * cleared, free the blocks. Modified: head/sys/ufs/ffs/ffs_extern.h ============================================================================== --- head/sys/ufs/ffs/ffs_extern.h Sat Mar 24 23:10:18 2012 (r233437) +++ head/sys/ufs/ffs/ffs_extern.h Sun Mar 25 00:02:37 2012 (r233438) @@ -92,7 +92,7 @@ void ffs_snapshot_mount(struct mount *mp void ffs_snapshot_unmount(struct mount *mp); void process_deferred_inactive(struct mount *mp); void ffs_sync_snap(struct mount *, int); -int ffs_syncvnode(struct vnode *vp, int waitfor); +int ffs_syncvnode(struct vnode *vp, int waitfor, int flags); int ffs_truncate(struct vnode *, off_t, int, struct ucred *, struct thread *); int ffs_update(struct vnode *, int); int ffs_valloc(struct vnode *, int, struct ucred *, struct vnode **); @@ -168,12 +168,11 @@ void softdep_freework(struct workhead *) #define FLUSH_BLOCKS 3 #define FLUSH_BLOCKS_WAIT 4 /* - * Flag to ffs_syncinode() to request flushing of data only, + * Flag to ffs_syncvnode() to request flushing of data only, * but skip the ffs_update() on the inode itself. Used to avoid * deadlock when flushing snapshot inodes while holding snaplk. - * Avoid bit conflicts with MNT_WAIT values in sys/mount.h */ -#define NO_INO_UPDT 0x10 +#define NO_INO_UPDT 0x00000001 int ffs_rdonly(struct inode *); Modified: head/sys/ufs/ffs/ffs_inode.c ============================================================================== --- head/sys/ufs/ffs/ffs_inode.c Sat Mar 24 23:10:18 2012 (r233437) +++ head/sys/ufs/ffs/ffs_inode.c Sun Mar 25 00:02:37 2012 (r233438) @@ -228,7 +228,7 @@ ffs_truncate(vp, length, flags, cred, td goto extclean; needextclean = 1; } else { - if ((error = ffs_syncvnode(vp, MNT_WAIT)) != 0) + if ((error = ffs_syncvnode(vp, MNT_WAIT, 0)) != 0) return (error); #ifdef QUOTA (void) chkdq(ip, -extblocks, NOCRED, 0); @@ -321,7 +321,7 @@ ffs_truncate(vp, length, flags, cred, td * rarely, we solve the problem by syncing the file * so that it will have no data structures left. */ - if ((error = ffs_syncvnode(vp, MNT_WAIT)) != 0) + if ((error = ffs_syncvnode(vp, MNT_WAIT, 0)) != 0) return (error); } else { flags = IO_NORMAL | (needextclean ? IO_EXT: 0); @@ -366,7 +366,7 @@ ffs_truncate(vp, length, flags, cred, td */ if (DOINGSOFTDEP(vp) && lbn < NDADDR && fragroundup(fs, blkoff(fs, length)) < fs->fs_bsize && - (error = ffs_syncvnode(vp, MNT_WAIT)) != 0) + (error = ffs_syncvnode(vp, MNT_WAIT, 0)) != 0) return (error); ip->i_size = length; DIP_SET(ip, i_size, length); Modified: head/sys/ufs/ffs/ffs_rawread.c ============================================================================== --- head/sys/ufs/ffs/ffs_rawread.c Sat Mar 24 23:10:18 2012 (r233437) +++ head/sys/ufs/ffs/ffs_rawread.c Sun Mar 25 00:02:37 2012 (r233438) @@ -163,7 +163,7 @@ ffs_rawread_sync(struct vnode *vp) /* Flush dirty buffers */ if (bo->bo_dirty.bv_cnt > 0) { BO_UNLOCK(bo); - if ((error = ffs_syncvnode(vp, MNT_WAIT)) != 0) { + if ((error = ffs_syncvnode(vp, MNT_WAIT, 0)) != 0) { if (upgraded != 0) VOP_LOCK(vp, LK_DOWNGRADE); vn_finished_write(mp); Modified: head/sys/ufs/ffs/ffs_snapshot.c ============================================================================== --- head/sys/ufs/ffs/ffs_snapshot.c Sat Mar 24 23:10:18 2012 (r233437) +++ head/sys/ufs/ffs/ffs_snapshot.c Sun Mar 25 00:02:37 2012 (r233438) @@ -362,7 +362,7 @@ restart: goto out; bawrite(nbp); if (cg % 10 == 0) - ffs_syncvnode(vp, MNT_WAIT); + ffs_syncvnode(vp, MNT_WAIT, 0); } /* * Copy all the cylinder group maps. Although the @@ -385,7 +385,7 @@ restart: error = cgaccount(cg, vp, nbp, 1); bawrite(nbp); if (cg % 10 == 0) - ffs_syncvnode(vp, MNT_WAIT); + ffs_syncvnode(vp, MNT_WAIT, 0); if (error) goto out; } @@ -400,7 +400,7 @@ restart: * Since we have marked it as a snapshot it is safe to * unlock it as no process will be allowed to write to it. */ - if ((error = ffs_syncvnode(vp, MNT_WAIT)) != 0) + if ((error = ffs_syncvnode(vp, MNT_WAIT, 0)) != 0) goto out; VOP_UNLOCK(vp, 0); /* @@ -861,7 +861,7 @@ out: MNT_IUNLOCK(mp); if (error) (void) ffs_truncate(vp, (off_t)0, 0, NOCRED, td); - (void) ffs_syncvnode(vp, MNT_WAIT); + (void) ffs_syncvnode(vp, MNT_WAIT, 0); if (error) vput(vp); else @@ -1714,7 +1714,7 @@ ffs_snapremove(vp) * may find indirect pointers using the magic BLK_* values. */ if (DOINGSOFTDEP(vp)) - ffs_syncvnode(vp, MNT_WAIT); + ffs_syncvnode(vp, MNT_WAIT, 0); #ifdef QUOTA /* * Reenable disk quotas for ex-snapshot file. @@ -1908,7 +1908,7 @@ retry: bawrite(cbp); if ((vtype == VDIR || dopersistence) && ip->i_effnlink > 0) - (void) ffs_syncvnode(vp, MNT_WAIT|NO_INO_UPDT); + (void) ffs_syncvnode(vp, MNT_WAIT, NO_INO_UPDT); continue; } /* @@ -1919,7 +1919,7 @@ retry: bawrite(cbp); if ((vtype == VDIR || dopersistence) && ip->i_effnlink > 0) - (void) ffs_syncvnode(vp, MNT_WAIT|NO_INO_UPDT); + (void) ffs_syncvnode(vp, MNT_WAIT, NO_INO_UPDT); break; } savedcbp = cbp; @@ -1937,7 +1937,7 @@ retry: bawrite(savedcbp); if ((vtype == VDIR || dopersistence) && VTOI(vp)->i_effnlink > 0) - (void) ffs_syncvnode(vp, MNT_WAIT|NO_INO_UPDT); + (void) ffs_syncvnode(vp, MNT_WAIT, NO_INO_UPDT); } /* * If we have been unable to allocate a block in which to do @@ -2000,7 +2000,7 @@ ffs_snapshot_mount(mp) } else { reason = "old format snapshot"; (void)ffs_truncate(vp, (off_t)0, 0, NOCRED, td); - (void)ffs_syncvnode(vp, MNT_WAIT); + (void)ffs_syncvnode(vp, MNT_WAIT, 0); } printf("ffs_snapshot_mount: %s inode %d\n", reason, fs->fs_snapinum[snaploc]); @@ -2401,7 +2401,7 @@ ffs_copyonwrite(devvp, bp) bawrite(cbp); if ((devvp == bp->b_vp || bp->b_vp->v_type == VDIR || dopersistence) && ip->i_effnlink > 0) - (void) ffs_syncvnode(vp, MNT_WAIT|NO_INO_UPDT); + (void) ffs_syncvnode(vp, MNT_WAIT, NO_INO_UPDT); else launched_async_io = 1; continue; @@ -2414,7 +2414,7 @@ ffs_copyonwrite(devvp, bp) bawrite(cbp); if ((devvp == bp->b_vp || bp->b_vp->v_type == VDIR || dopersistence) && ip->i_effnlink > 0) - (void) ffs_syncvnode(vp, MNT_WAIT|NO_INO_UPDT); + (void) ffs_syncvnode(vp, MNT_WAIT, NO_INO_UPDT); else launched_async_io = 1; break; @@ -2434,7 +2434,7 @@ ffs_copyonwrite(devvp, bp) bawrite(savedcbp); if ((devvp == bp->b_vp || bp->b_vp->v_type == VDIR || dopersistence) && VTOI(vp)->i_effnlink > 0) - (void) ffs_syncvnode(vp, MNT_WAIT|NO_INO_UPDT); + (void) ffs_syncvnode(vp, MNT_WAIT, NO_INO_UPDT); else launched_async_io = 1; } @@ -2484,7 +2484,7 @@ ffs_sync_snap(mp, waitfor) } TAILQ_FOREACH(ip, &sn->sn_head, i_nextsnap) { vp = ITOV(ip); - ffs_syncvnode(vp, waitfor|NO_INO_UPDT); + ffs_syncvnode(vp, waitfor, NO_INO_UPDT); } lockmgr(&sn->sn_lock, LK_RELEASE, NULL); } Modified: head/sys/ufs/ffs/ffs_softdep.c ============================================================================== --- head/sys/ufs/ffs/ffs_softdep.c Sat Mar 24 23:10:18 2012 (r233437) +++ head/sys/ufs/ffs/ffs_softdep.c Sun Mar 25 00:02:37 2012 (r233438) @@ -2848,7 +2848,7 @@ softdep_prealloc(vp, waitok) * work attached to it. */ if ((curthread->td_pflags & TDP_COWINPROGRESS) == 0) - ffs_syncvnode(vp, waitok); + ffs_syncvnode(vp, waitok, 0); ACQUIRE_LOCK(&lk); process_removes(vp); process_truncates(vp); @@ -2887,8 +2887,8 @@ softdep_prelink(dvp, vp) stat_journal_low++; FREE_LOCK(&lk); if (vp) - ffs_syncvnode(vp, MNT_NOWAIT); - ffs_syncvnode(dvp, MNT_WAIT); + ffs_syncvnode(vp, MNT_NOWAIT, 0); + ffs_syncvnode(dvp, MNT_WAIT, 0); ACQUIRE_LOCK(&lk); /* Process vp before dvp as it may create .. removes. */ if (vp) { @@ -11841,8 +11841,8 @@ restart: pagedep_new_block = pagedep->pd_state & NEWBLOCK; FREE_LOCK(&lk); locked = 0; - if (pagedep_new_block && - (error = ffs_syncvnode(pvp, MNT_WAIT))) { + if (pagedep_new_block && (error = + ffs_syncvnode(pvp, MNT_WAIT, 0))) { vput(pvp); return (error); } @@ -12683,7 +12683,7 @@ retry: MNT_ILOCK(mp); continue; } - (void) ffs_syncvnode(lvp, MNT_NOWAIT); + (void) ffs_syncvnode(lvp, MNT_NOWAIT, 0); vput(lvp); MNT_ILOCK(mp); } @@ -12856,7 +12856,7 @@ clear_remove(td) softdep_error("clear_remove: vget", error); goto finish_write; } - if ((error = ffs_syncvnode(vp, MNT_NOWAIT))) + if ((error = ffs_syncvnode(vp, MNT_NOWAIT, 0))) softdep_error("clear_remove: fsync", error); bo = &vp->v_bufobj; BO_LOCK(bo); @@ -12939,10 +12939,10 @@ clear_inodedeps(td) } vfs_unbusy(mp); if (ino == lastino) { - if ((error = ffs_syncvnode(vp, MNT_WAIT))) + if ((error = ffs_syncvnode(vp, MNT_WAIT, 0))) softdep_error("clear_inodedeps: fsync1", error); } else { - if ((error = ffs_syncvnode(vp, MNT_NOWAIT))) + if ((error = ffs_syncvnode(vp, MNT_NOWAIT, 0))) softdep_error("clear_inodedeps: fsync2", error); BO_LOCK(&vp->v_bufobj); drain_output(vp); Modified: head/sys/ufs/ffs/ffs_vfsops.c ============================================================================== --- head/sys/ufs/ffs/ffs_vfsops.c Sat Mar 24 23:10:18 2012 (r233437) +++ head/sys/ufs/ffs/ffs_vfsops.c Sun Mar 25 00:02:37 2012 (r233438) @@ -1505,7 +1505,7 @@ loop: } continue; } - if ((error = ffs_syncvnode(vp, waitfor)) != 0) + if ((error = ffs_syncvnode(vp, waitfor, 0)) != 0) allerror = error; vput(vp); MNT_ILOCK(mp); Modified: head/sys/ufs/ffs/ffs_vnops.c ============================================================================== --- head/sys/ufs/ffs/ffs_vnops.c Sat Mar 24 23:10:18 2012 (r233437) +++ head/sys/ufs/ffs/ffs_vnops.c Sun Mar 25 00:02:37 2012 (r233438) @@ -184,7 +184,7 @@ ffs_fsync(struct vop_fsync_args *ap) vp = ap->a_vp; bo = &vp->v_bufobj; retry: - error = ffs_syncvnode(vp, ap->a_waitfor); + error = ffs_syncvnode(vp, ap->a_waitfor, 0); if (error) return (error); if (ap->a_waitfor == MNT_WAIT && DOINGSOFTDEP(vp)) { @@ -209,17 +209,15 @@ retry: } int -ffs_syncvnode(struct vnode *vp, int waitfor) +ffs_syncvnode(struct vnode *vp, int waitfor, int flags) { struct inode *ip; struct bufobj *bo; struct buf *bp; struct buf *nbp; ufs_lbn_t lbn; - int error, wait, passes, noupdate; + int error, wait, passes; - noupdate = waitfor & NO_INO_UPDT; - waitfor &= ~NO_INO_UPDT; ip = VTOI(vp); ip->i_flag &= ~IN_NEEDSYNC; bo = &vp->v_bufobj; @@ -302,7 +300,7 @@ next: } if (waitfor != MNT_WAIT) { BO_UNLOCK(bo); - if (noupdate) + if ((flags & NO_INO_UPDT) != 0) return (0); else return (ffs_update(vp, 0)); @@ -322,7 +320,7 @@ next: */ if (bo->bo_dirty.bv_cnt > 0) { /* Write the inode after sync passes to flush deps. */ - if (wait && DOINGSOFTDEP(vp) && noupdate == 0) { + if (wait && DOINGSOFTDEP(vp) && (flags & NO_INO_UPDT) == 0) { BO_UNLOCK(bo); ffs_update(vp, 1); BO_LOCK(bo); @@ -338,7 +336,7 @@ next: } BO_UNLOCK(bo); error = 0; - if (noupdate == 0) + if ((flags & NO_INO_UPDT) == 0) error = ffs_update(vp, 1); if (DOINGSUJ(vp)) softdep_journal_fsync(VTOI(vp)); From owner-svn-src-head@FreeBSD.ORG Sun Mar 25 02:10:31 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D70E91065670; Sun, 25 Mar 2012 02:10:31 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C1A778FC12; Sun, 25 Mar 2012 02:10:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2P2AVol058823; Sun, 25 Mar 2012 02:10:31 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2P2AVoS058814; Sun, 25 Mar 2012 02:10:31 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <201203250210.q2P2AVoS058814@svn.freebsd.org> From: Edwin Groothuis Date: Sun, 25 Mar 2012 02:10:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233445 - head/contrib/tzdata X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Mar 2012 02:10:31 -0000 Author: edwin Date: Sun Mar 25 02:10:31 2012 New Revision: 233445 URL: http://svn.freebsd.org/changeset/base/233445 Log: MFV of 233442, tzdata2012a - Updates to various locations in Antarctica. - Armenia will abolish DST this year. - Not only Samoa has moved to UTC+14, also Fakaofo did. - There will be a leap second in 30 June 2012. - Historical updates of 1918 to Canada, Winn, Regina, Edm, Vanc, Creston. - Chili stays on DST until 28 April 2012 - The Falkland islands will stay on DST this year. Modified: head/contrib/tzdata/antarctica head/contrib/tzdata/asia head/contrib/tzdata/australasia head/contrib/tzdata/europe head/contrib/tzdata/leapseconds head/contrib/tzdata/northamerica head/contrib/tzdata/southamerica head/contrib/tzdata/zone.tab Directory Properties: head/contrib/tzdata/ (props changed) Modified: head/contrib/tzdata/antarctica ============================================================================== --- head/contrib/tzdata/antarctica Sun Mar 25 02:07:47 2012 (r233444) +++ head/contrib/tzdata/antarctica Sun Mar 25 02:10:31 2012 (r233445) @@ -1,5 +1,5 @@ #
-# @(#)antarctica	8.9
+# @(#)antarctica	8.10
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -42,8 +42,19 @@ Rule	ChileAQ	1997	only	-	Mar	30	3:00u	0	
 Rule	ChileAQ	1998	only	-	Mar	Sun>=9	3:00u	0	-
 Rule	ChileAQ	1998	only	-	Sep	27	4:00u	1:00	S
 Rule	ChileAQ	1999	only	-	Apr	 4	3:00u	0	-
-Rule	ChileAQ	1999	max	-	Oct	Sun>=9	4:00u	1:00	S
-Rule	ChileAQ	2000	max	-	Mar	Sun>=9	3:00u	0	-
+Rule	ChileAQ	1999	2010	-	Oct	Sun>=9	4:00u	1:00	S
+Rule	ChileAQ	2000	2007	-	Mar	Sun>=9	3:00u	0	-
+# N.B.: the end of March 29 in Chile is March 30 in Universal time,
+# which is used below in specifying the transition.
+Rule	ChileAQ	2008	only	-	Mar	30	3:00u	0	-
+Rule	ChileAQ	2009	only	-	Mar	Sun>=9	3:00u	0	-
+Rule	ChileAQ	2010	only	-	Apr	Sun>=1	3:00u	0	-
+Rule	ChileAQ	2011	only	-	May	Sun>=2	3:00u	0	-
+Rule	ChileAQ	2011	only	-	Aug	Sun>=16	4:00u	1:00	S
+Rule	ChileAQ	2012	only	-	Apr	Sun>=23	3:00u	0	-
+Rule	ChileAQ	2012	only	-	Sep	Sun>=2	4:00u	1:00	S
+Rule	ChileAQ	2013	max	-	Mar	Sun>=9	3:00u	0	-
+Rule	ChileAQ	2013	max	-	Oct	Sun>=9	4:00u	1:00	S
 
 # These rules are stolen from the `australasia' file.
 Rule	AusAQ	1917	only	-	Jan	 1	0:01	1:00	-
@@ -142,12 +153,16 @@ Zone Antarctica/Casey	0	-	zzz	1969
 						# Western (Aus) Standard Time
 			11:00	-	CAST	2010 Mar 5 2:00
 						# Casey Time
+			8:00	-	WST	2011 Oct 28 2:00
+			11:00	-	CAST	2012 Feb 21 17:00u
 			8:00	-	WST
 Zone Antarctica/Davis	0	-	zzz	1957 Jan 13
 			7:00	-	DAVT	1964 Nov # Davis Time
 			0	-	zzz	1969 Feb
 			7:00	-	DAVT	2009 Oct 18 2:00
 			5:00	-	DAVT	2010 Mar 10 20:00u
+			7:00	-	DAVT	2011 Oct 28 2:00
+			5:00	-	DAVT	2012 Feb 21 20:00u
 			7:00	-	DAVT
 Zone Antarctica/Mawson	0	-	zzz	1954 Feb 13
 			6:00	-	MAWT	2009 Oct 18 2:00

Modified: head/contrib/tzdata/asia
==============================================================================
--- head/contrib/tzdata/asia	Sun Mar 25 02:07:47 2012	(r233444)
+++ head/contrib/tzdata/asia	Sun Mar 25 02:10:31 2012	(r233445)
@@ -1,4 +1,4 @@
-# @(#)asia	8.69
+# @(#)asia	8.70
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -77,10 +77,6 @@ Rule RussiaAsia	1993	max	-	Mar	lastSun	 
 Rule RussiaAsia	1993	1995	-	Sep	lastSun	 2:00s	0	-
 Rule RussiaAsia	1996	max	-	Oct	lastSun	 2:00s	0	-
 
-# From Arthur David Olson (2011-06-15):
-# While Russia abandoned DST in 2011, Armenia may choose to
-# follow Russia's "old" rules.
-
 # Afghanistan
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Asia/Kabul	4:36:48 -	LMT	1890
@@ -97,6 +93,21 @@ Zone	Asia/Kabul	4:36:48 -	LMT	1890
 # in 1996, though it did use DST in 1995.  IATA SSIM (1991/1998) reports that
 # Armenia switched from 3:00 to 4:00 in 1998 and observed DST after 1991,
 # but started switching at 3:00s in 1998.
+
+# From Arthur David Olson (2011-06-15):
+# While Russia abandoned DST in 2011, Armenia may choose to
+# follow Russia's "old" rules.
+
+# From Alexander Krivenyshev (2012-02-10):
+# According to News Armenia, on Feb 9, 2012,
+# http://newsarmenia.ru/society/20120209/42609695.html
+# 
+# The Armenia National Assembly adopted final reading of Amendments to the
+# Law "On procedure of calculation time on the territory of the Republic of
+# Armenia" according to which Armenia [is] abolishing Daylight Saving Time.
+# or
+# (brief)
+# http://www.worldtimezone.com/dst_news/dst_news_armenia03.html
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Asia/Yerevan	2:58:00 -	LMT	1924 May  2
 			3:00	-	YERT	1957 Mar    # Yerevan Time
@@ -104,7 +115,8 @@ Zone	Asia/Yerevan	2:58:00 -	LMT	1924 May
 			3:00	1:00	YERST	1991 Sep 23 # independence
 			3:00 RussiaAsia	AM%sT	1995 Sep 24 2:00s
 			4:00	-	AMT	1997
-			4:00 RussiaAsia	AM%sT
+			4:00 RussiaAsia	AM%sT	2012 Mar 25 2:00s
+			4:00	-	AMT
 
 # Azerbaijan
 # From Rustam Aliyev of the Azerbaijan Internet Forum (2005-10-23):

Modified: head/contrib/tzdata/australasia
==============================================================================
--- head/contrib/tzdata/australasia	Sun Mar 25 02:07:47 2012	(r233444)
+++ head/contrib/tzdata/australasia	Sun Mar 25 02:10:31 2012	(r233445)
@@ -1,5 +1,5 @@
 # 
-# @(#)australasia	8.29
+# @(#)australasia	8.30
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -616,6 +616,11 @@ Zone Pacific/Pago_Pago	 12:37:12 -	LMT	1
 # Dateline Change skip Friday 30th Dec 2011
 # Thursday 29th December 2011	23:59:59 Hours
 # Saturday 31st December 2011	00:00:00 Hours
+#
+# Clarification by Tim Parenti (2012-01-03):
+# Although Samoa has used Daylight Saving Time in the 2010-2011 and 2011-2012
+# seasons, there is not yet any indication that this trend will continue on
+# a regular basis. For now, we have explicitly listed the transitions below.
 Zone Pacific/Apia	 12:33:04 -	LMT	1879 Jul  5
 			-11:26:56 -	LMT	1911
 			-11:30	-	SAMT	1950		# Samoa Time
@@ -633,9 +638,28 @@ Zone Pacific/Guadalcanal 10:39:48 -	LMT	
 			11:00	-	SBT	# Solomon Is Time
 
 # Tokelau Is
+#
+# From Gwillim Law (2011-12-29)
+# A correspondent informed me that Tokelau, like Samoa, will be skipping
+# December 31 this year, thereby changing its time zone from UTC-10 to
+# UTC+14. When I tried to verify this statement, I found a confirming
+# article in Time magazine online
+# 
+# (http://www.time.com/time/world/article/0,8599,2103243,00.html).
+# 
+#
+# From Jonathan Leffler (2011-12-29)
+# Information from the BBC to the same effect:
+# 
+# http://www.bbc.co.uk/news/world-asia-16351377
+# 
+#
+# Patch supplied by Tim Parenti (2011-12-29)
+
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Pacific/Fakaofo	-11:24:56 -	LMT	1901
-			-10:00	-	TKT	# Tokelau Time
+			-10:00	-	TKT 2011 Dec 30	# Tokelau Time
+			14:00	-	TKT
 
 # Tonga
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S

Modified: head/contrib/tzdata/europe
==============================================================================
--- head/contrib/tzdata/europe	Sun Mar 25 02:07:47 2012	(r233444)
+++ head/contrib/tzdata/europe	Sun Mar 25 02:10:31 2012	(r233445)
@@ -1,5 +1,5 @@
 # 
-# @(#)europe	8.40
+# @(#)europe	8.41
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -211,9 +211,15 @@
 # the history of summer time legislation in the United Kingdom.
 # Since 1998 Joseph S. Myers has been updating
 # and extending this list, which can be found in
-# 
+# http://student.cusu.cam.ac.uk/~jsm28/british-time/
+# 
 # History of legal time in Britain
 # 
+# Rob Crowther (2012-01-04) reports that that URL no longer
+# exists, and the article can now be found at:
+# 
+# http://www.polyomino.org.uk/british-time/
+# 
 
 # From Joseph S. Myers (1998-01-06):
 #
@@ -1151,10 +1157,10 @@ Rule	France	1940	only	-	Feb	25	 2:00	1:0
 # write that they were used in Monaco and in many French locations.
 # Le Corre writes that the upper limit of the free zone was Arneguy, Orthez,
 # Mont-de-Marsan, Bazas, Langon, Lamotte-Montravel, Marouil, La
-# Rochefoucault, Champagne-Mouton, La Roche-Posay, La Haye-Decartes,
+# Rochefoucault, Champagne-Mouton, La Roche-Posay, La Haye-Descartes,
 # Loches, Montrichard, Vierzon, Bourges, Moulins, Digoin,
 # Paray-le-Monial, Montceau-les-Mines, Chalons-sur-Saone, Arbois,
-# Dole, Morez, St-Claude, and Collognes (Haute-Savioe).
+# Dole, Morez, St-Claude, and Collonges (Haute-Savoie).
 Rule	France	1941	only	-	May	 5	 0:00	2:00	M # Midsummer
 # Shanks & Pottenger say this transition occurred at Oct 6 1:00,
 # but go with Denis Excoffier (1997-12-12),

Modified: head/contrib/tzdata/leapseconds
==============================================================================
--- head/contrib/tzdata/leapseconds	Sun Mar 25 02:07:47 2012	(r233444)
+++ head/contrib/tzdata/leapseconds	Sun Mar 25 02:10:31 2012	(r233445)
@@ -1,5 +1,5 @@
 # 
-# @(#)leapseconds	8.11
+# @(#)leapseconds	8.13
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -48,40 +48,54 @@ Leap	1997	Jun	30	23:59:60	+	S
 Leap	1998	Dec	31	23:59:60	+	S
 Leap	2005	Dec	31	23:59:60	+	S
 Leap	2008	Dec	31	23:59:60	+	S
+Leap	2012	Jun	30	23:59:60	+	S
 
 # INTERNATIONAL EARTH ROTATION AND REFERENCE SYSTEMS SERVICE (IERS)
 #
 # SERVICE INTERNATIONAL DE LA ROTATION TERRESTRE ET DES SYSTEMES DE REFERENCE
 #
+#
 # SERVICE DE LA ROTATION TERRESTRE
 # OBSERVATOIRE DE PARIS
 # 61, Av. de l'Observatoire 75014 PARIS (France)
-# Tel.      : 33 (0) 1 40 51 22 29
+# Tel.      : 33 (0) 1 40 51 22 26
 # FAX       : 33 (0) 1 40 51 22 91
-# Internet  : services.iers@obspm.fr
+# e-mail    : (E-Mail Removed)
+# http://hpiers.obspm.fr/eop-pc
+#
+# Paris, 5 January 2012
 #
-# Paris, 2 February 2011
 #
-# Bulletin C 41
+# Bulletin C 43
 #
 # To authorities responsible
 # for the measurement and
 # distribution of time
 #
-# INFORMATION ON UTC - TAI
 #
-# NO positive leap second will be introduced at the end of June 2011.
-# The difference between Coordinated Universal Time UTC and the
-# International Atomic Time TAI is :		
+# UTC TIME STEP
+# on the 1st of July 2012
+#
 #
-# from 2009 January 1, 0h UTC, until further notice : UTC-TAI = -34 s
+# A positive leap second will be introduced at the end of June 2012.
+# The sequence of dates of the UTC second markers will be:		
+# 		
+#                          2012 June 30,     23h 59m 59s
+#                          2012 June 30,     23h 59m 60s
+#                          2012 July  1,      0h  0m  0s
+#
+# The difference between UTC and the International Atomic Time TAI is:
+#
+# from 2009 January 1, 0h UTC, to 2012 July 1  0h UTC  : UTC-TAI = - 34s
+# from 2012 July 1,    0h UTC, until further notice    : UTC-TAI = - 35s
 #
 # Leap seconds can be introduced in UTC at the end of the months of December
-# or June,  depending on the evolution of UT1-TAI. Bulletin C is mailed every
-# six months, either to announce a time step in UTC, or to confirm that there
+# or June, depending on the evolution of UT1-TAI. Bulletin C is mailed every
+# six months, either to announce a time step in UTC or to confirm that there
 # will be no time step at the next possible date.
 #
+#
 # Daniel GAMBIS
-# Head			
-# Earth Orientation Center of the IERS
+# Head		
+# Earth Orientation Center of IERS
 # Observatoire de Paris, France

Modified: head/contrib/tzdata/northamerica
==============================================================================
--- head/contrib/tzdata/northamerica	Sun Mar 25 02:07:47 2012	(r233444)
+++ head/contrib/tzdata/northamerica	Sun Mar 25 02:10:31 2012	(r233445)
@@ -1,5 +1,5 @@
 # 
-# @(#)northamerica	8.51
+# @(#)northamerica	8.52
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -1120,9 +1120,26 @@ Zone America/Menominee	-5:50:27 -	LMT	18
 # For now, assume all of DST-observing Canada will fall into line with the
 # new US DST rules,
 
+# From Chris Walton (2011-12-01)
+# In the first of Tammy Hardwick's articles
+# 
+# http://www.ilovecreston.com/?p=articles&t=spec&ar=260
+# 
+# she quotes the Friday November 1/1918 edition of the Creston Review.
+# The quote includes these two statements:
+# 'Sunday the CPR went back to the old system of time...'
+# '... The daylight saving scheme was dropped all over Canada at the same time,'
+# These statements refer to a transition from daylight time to standard time
+# that occurred nationally on Sunday October 27/1918.  This transition was
+# also documented in the Saturday October 26/1918 edition of the Toronto Star.
+
+# In light of that evidence, we alter the date from the earlier believed
+# Oct 31, to Oct 27, 1918 (and Sunday is a more likely transition day
+# than Thursday) in all Canadian rulesets.
+
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
 Rule	Canada	1918	only	-	Apr	14	2:00	1:00	D
-Rule	Canada	1918	only	-	Oct	31	2:00	0	S
+Rule	Canada	1918	only	-	Oct	27	2:00	0	S
 Rule	Canada	1942	only	-	Feb	 9	2:00	1:00	W # War
 Rule	Canada	1945	only	-	Aug	14	23:00u	1:00	P # Peace
 Rule	Canada	1945	only	-	Sep	30	2:00	0	S
@@ -1645,7 +1662,7 @@ Zone America/Atikokan	-6:06:28 -	LMT	189
 Rule	Winn	1916	only	-	Apr	23	0:00	1:00	D
 Rule	Winn	1916	only	-	Sep	17	0:00	0	S
 Rule	Winn	1918	only	-	Apr	14	2:00	1:00	D
-Rule	Winn	1918	only	-	Oct	31	2:00	0	S
+Rule	Winn	1918	only	-	Oct	27	2:00	0	S
 Rule	Winn	1937	only	-	May	16	2:00	1:00	D
 Rule	Winn	1937	only	-	Sep	26	2:00	0	S
 Rule	Winn	1942	only	-	Feb	 9	2:00	1:00	W # War
@@ -1728,7 +1745,7 @@ Zone America/Winnipeg	-6:28:36 -	LMT	188
 
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
 Rule	Regina	1918	only	-	Apr	14	2:00	1:00	D
-Rule	Regina	1918	only	-	Oct	31	2:00	0	S
+Rule	Regina	1918	only	-	Oct	27	2:00	0	S
 Rule	Regina	1930	1934	-	May	Sun>=1	0:00	1:00	D
 Rule	Regina	1930	1934	-	Oct	Sun>=1	0:00	0	S
 Rule	Regina	1937	1941	-	Apr	Sun>=8	0:00	1:00	D
@@ -1765,7 +1782,7 @@ Zone America/Swift_Current -7:11:20 -	LM
 
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
 Rule	Edm	1918	1919	-	Apr	Sun>=8	2:00	1:00	D
-Rule	Edm	1918	only	-	Oct	31	2:00	0	S
+Rule	Edm	1918	only	-	Oct	27	2:00	0	S
 Rule	Edm	1919	only	-	May	27	2:00	0	S
 Rule	Edm	1920	1923	-	Apr	lastSun	2:00	1:00	D
 Rule	Edm	1920	only	-	Oct	lastSun	2:00	0	S
@@ -1795,9 +1812,68 @@ Zone America/Edmonton	-7:33:52 -	LMT	190
 # Dawson Creek uses MST.  Much of east BC is like Edmonton.
 # Matthews and Vincent (1998) write that Creston is like Dawson Creek.
 
+# It seems though that (re: Creston) is not entirely correct:
+
+# From Chris Walton (2011-12-01):
+# There are two areas within the Canadian province of British Columbia
+# that do not currently observe daylight saving:
+# a) The Creston Valley (includes the town of Creston and surrounding area)
+# b) The eastern half of the Peace River Regional District
+# (includes the cities of Dawson Creek and Fort St. John)
+
+# Earlier this year I stumbled across a detailed article about the time
+# keeping history of Creston; it was written by Tammy Hardwick who is the
+# manager of the Creston & District Museum. The article was written in May 2009.
+# 
+# http://www.ilovecreston.com/?p=articles&t=spec&ar=260
+# 
+# According to the article, Creston has not changed its clocks since June 1918.
+# i.e. Creston has been stuck on UTC-7 for 93 years.
+# Dawson Creek, on the other hand, changed its clocks as recently as April 1972.
+
+# Unfortunately the exact date for the time change in June 1918 remains
+# unknown and will be difficult to ascertain.  I e-mailed Tammy a few months
+# ago to ask if Sunday June 2 was a reasonable guess.  She said it was just
+# as plausible as any other date (in June).  She also said that after writing the
+# article she had discovered another time change in 1916; this is the subject
+# of another article which she wrote in October 2010.
+# 
+# http://www.creston.museum.bc.ca/index.php?module=comments&uop=view_comment&cm+id=56
+# 
+
+# Here is a summary of the three clock change events in Creston's history:
+# 1. 1884 or 1885: adoption of Mountain Standard Time (GMT-7)
+# Exact date unknown
+# 2. Oct 1916: switch to Pacific Standard Time (GMT-8) 
+# Exact date in October unknown;  Sunday October 1 is a reasonable guess.
+# 3. June 1918: switch to Pacific Daylight Time (GMT-7)
+# Exact date in June unknown; Sunday June 2 is a reasonable guess.
+# note#1:
+# On Oct 27/1918 when daylight saving ended in the rest of Canada,
+# Creston did not change its clocks.
+# note#2:
+# During WWII when the Federal Government legislated a mandatory clock change,
+# Creston did not oblige.
+# note#3:
+# There is no guarantee that Creston will remain on Mountain Standard Time
+# (UTC-7) forever.
+# The subject was debated at least once this year by the town Council.
+# 
+# http://www.bclocalnews.com/kootenay_rockies/crestonvalleyadvance/news/116760809.html
+# 
+
+# During a period WWII, summer time (Daylight saying) was mandatory in Canada.
+# In Creston, that was handled by shifting the area to PST (-8:00) then applying
+# summer time to cause the offset to be -7:00, the same as it had been before
+# the change.  It can be argued that the timezone abbreviation during this
+# period should be PDT rather than MST, but that doesn't seem important enough
+# (to anyone) to further complicate the rules.
+
+# The transition dates (and times) are guesses.
+
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
 Rule	Vanc	1918	only	-	Apr	14	2:00	1:00	D
-Rule	Vanc	1918	only	-	Oct	31	2:00	0	S
+Rule	Vanc	1918	only	-	Oct	27	2:00	0	S
 Rule	Vanc	1942	only	-	Feb	 9	2:00	1:00	W # War
 Rule	Vanc	1945	only	-	Aug	14	23:00u	1:00	P # Peace
 Rule	Vanc	1945	only	-	Sep	30	2:00	0	S
@@ -1813,7 +1889,10 @@ Zone America/Dawson_Creek -8:00:56 -	LMT
 			-8:00	Canada	P%sT	1947
 			-8:00	Vanc	P%sT	1972 Aug 30 2:00
 			-7:00	-	MST
-
+Zone America/Creston	-7:46:04 -	LMT	1884
+			-7:00	-	MST	1916 Oct 1
+			-8:00	-	PST	1918 Jun 2
+			-7:00	-	MST
 
 # Northwest Territories, Nunavut, Yukon
 

Modified: head/contrib/tzdata/southamerica
==============================================================================
--- head/contrib/tzdata/southamerica	Sun Mar 25 02:07:47 2012	(r233444)
+++ head/contrib/tzdata/southamerica	Sun Mar 25 02:10:31 2012	(r233445)
@@ -1,5 +1,5 @@
 # 
-# @(#)southamerica	8.52
+# @(#)southamerica	8.53
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -1218,6 +1218,28 @@ Zone America/Rio_Branco	-4:31:12 -	LMT	1
 # August, not in October as they have since 1968. This is a pilot plan
 # which will be reevaluated in 2012.
 
+# From Mauricio Parada (2012-02-22), translated by Glenn Eychaner (2012-02-23):
+# As stated in the website of the Chilean Energy Ministry
+# http://www.minenergia.cl/ministerio/noticias/generales/gobierno-anuncia-fechas-de-cambio-de.html
+# The Chilean Government has decided to postpone the entrance into winter time
+# (to leave DST) from March 11 2012 to April 28th 2012. The decision has not
+# been yet formalized but it will within the next days.
+# Quote from the website communication:
+#
+# 6. For the year 2012, the dates of entry into winter time will be as follows:
+# a. Saturday April 28, 2012, clocks should go back 60 minutes; that is, at
+# 23:59:59, instead of passing to 0:00, the time should be adjusted to be 23:00
+# of the same day.
+# b. Saturday, September 1, 2012, clocks should go forward 60 minutes; that is,
+# at 23:59:59, instead of passing to 0:00, the time should be adjusted to be
+# 01:00 on September 2.
+#
+# Note that...this is yet another "temporary" change that will be reevaluated
+# AGAIN in 2013.
+
+# NOTE: ChileAQ rules for Antarctic bases are stored separately in the
+# 'antarctica' file.
+
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
 Rule	Chile	1927	1932	-	Sep	 1	0:00	1:00	S
 Rule	Chile	1928	1932	-	Apr	 1	0:00	0	-
@@ -1248,8 +1270,6 @@ Rule	Chile	1998	only	-	Mar	Sun>=9	3:00u	
 Rule	Chile	1998	only	-	Sep	27	4:00u	1:00	S
 Rule	Chile	1999	only	-	Apr	 4	3:00u	0	-
 Rule	Chile	1999	2010	-	Oct	Sun>=9	4:00u	1:00	S
-Rule	Chile	2011	only	-	Aug	Sun>=16	4:00u	1:00	S
-Rule	Chile	2012	max	-	Oct	Sun>=9	4:00u	1:00	S
 Rule	Chile	2000	2007	-	Mar	Sun>=9	3:00u	0	-
 # N.B.: the end of March 29 in Chile is March 30 in Universal time,
 # which is used below in specifying the transition.
@@ -1257,7 +1277,11 @@ Rule	Chile	2008	only	-	Mar	30	3:00u	0	-
 Rule	Chile	2009	only	-	Mar	Sun>=9	3:00u	0	-
 Rule	Chile	2010	only	-	Apr	Sun>=1	3:00u	0	-
 Rule	Chile	2011	only	-	May	Sun>=2	3:00u	0	-
-Rule	Chile	2012	max	-	Mar	Sun>=9	3:00u	0	-
+Rule	Chile	2011	only	-	Aug	Sun>=16	4:00u	1:00	S
+Rule	Chile	2012	only	-	Apr	Sun>=23	3:00u	0	-
+Rule	Chile	2012	only	-	Sep	Sun>=2	4:00u	1:00	S
+Rule	Chile	2013	max	-	Mar	Sun>=9	3:00u	0	-
+Rule	Chile	2013	max	-	Oct	Sun>=9	4:00u	1:00	S
 # IATA SSIM anomalies: (1992-02) says 1992-03-14;
 # (1996-09) says 1998-03-08.  Ignore these.
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
@@ -1403,6 +1427,21 @@ Zone Pacific/Galapagos	-5:58:24 -	LMT	19
 # will not revert to local mean time, but clocks will remain on Summer
 # time (UTC/GMT - 3 hours) throughout the whole of 2011.  Any long term
 # change to local time following the trial period will be notified.
+#
+# From Andrew Newman (2012-02-24)
+# A letter from Justin McPhee, Chief Executive,
+# Cable & Wireless Falkland Islands (dated 2012-02-22)
+# states...
+#   The current Atlantic/Stanley entry under South America expects the
+#   clocks to go back to standard Falklands Time (FKT) on the 15th April.
+#   The database entry states that in 2011 Stanley was staying on fixed
+#   summer time on a trial basis only.  FIG need to contact IANA and/or
+#   the maintainers of the database to inform them we're adopting
+#   the same policy this year and suggest recommendations for future years.
+#
+# For now we will assume permanent summer time for the Falklands
+# until advised differently (to apply for 2012 and beyond, after the 2011
+# experiment was apparently successful.)
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
 Rule	Falk	1937	1938	-	Sep	lastSun	0:00	1:00	S
 Rule	Falk	1938	1942	-	Mar	Sun>=19	0:00	0	-
@@ -1415,14 +1454,14 @@ Rule	Falk	1984	only	-	Sep	16	0:00	1:00	S
 Rule	Falk	1985	2000	-	Sep	Sun>=9	0:00	1:00	S
 Rule	Falk	1986	2000	-	Apr	Sun>=16	0:00	0	-
 Rule	Falk	2001	2010	-	Apr	Sun>=15	2:00	0	-
-Rule	Falk	2012	max	-	Apr	Sun>=15	2:00	0	-
-Rule	Falk	2001	max	-	Sep	Sun>=1	2:00	1:00	S
+Rule	Falk	2001	2010	-	Sep	Sun>=1	2:00	1:00	S
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone Atlantic/Stanley	-3:51:24 -	LMT	1890
 			-3:51:24 -	SMT	1912 Mar 12  # Stanley Mean Time
 			-4:00	Falk	FK%sT	1983 May     # Falkland Is Time
 			-3:00	Falk	FK%sT	1985 Sep 15
-			-4:00	Falk	FK%sT
+			-4:00	Falk	FK%sT	2010 Sep 5 02:00
+			-3:00	-	FKST
 
 # French Guiana
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]

Modified: head/contrib/tzdata/zone.tab
==============================================================================
--- head/contrib/tzdata/zone.tab	Sun Mar 25 02:07:47 2012	(r233444)
+++ head/contrib/tzdata/zone.tab	Sun Mar 25 02:10:31 2012	(r233445)
@@ -1,5 +1,5 @@
 # 
-# @(#)zone.tab	8.52
+# @(#)zone.tab	8.54
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 #
@@ -131,6 +131,7 @@ CA	+5333-11328	America/Edmonton	Mountain
 CA	+690650-1050310	America/Cambridge_Bay	Mountain Time - west Nunavut
 CA	+6227-11421	America/Yellowknife	Mountain Time - central Northwest Territories
 CA	+682059-1334300	America/Inuvik	Mountain Time - west Northwest Territories
+CA	+4906-11631	America/Creston		Mountain Standard Time - Creston, British Columbia
 CA	+5946-12014	America/Dawson_Creek	Mountain Standard Time - Dawson Creek & Fort Saint John, British Columbia
 CA	+4916-12307	America/Vancouver	Pacific Time - west British Columbia
 CA	+6043-13503	America/Whitehorse	Pacific Time - south Yukon
@@ -333,7 +334,7 @@ RS	+4450+02030	Europe/Belgrade
 RU	+5443+02030	Europe/Kaliningrad	Moscow-01 - Kaliningrad
 RU	+5545+03735	Europe/Moscow	Moscow+00 - west Russia
 RU	+4844+04425	Europe/Volgograd	Moscow+00 - Caspian Sea
-RU	+5312+05009	Europe/Samara	Moscow - Samara, Udmurtia
+RU	+5312+05009	Europe/Samara	Moscow+00 - Samara, Udmurtia
 RU	+5651+06036	Asia/Yekaterinburg	Moscow+02 - Urals
 RU	+5500+07324	Asia/Omsk	Moscow+03 - west Siberia
 RU	+5502+08255	Asia/Novosibirsk	Moscow+03 - Novosibirsk

From owner-svn-src-head@FreeBSD.ORG  Sun Mar 25 02:22:32 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id A3E68106566B;
	Sun, 25 Mar 2012 02:22:32 +0000 (UTC)
	(envelope-from gonzo@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 8DF4C8FC12;
	Sun, 25 Mar 2012 02:22:32 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2P2MWTU059540;
	Sun, 25 Mar 2012 02:22:32 GMT (envelope-from gonzo@svn.freebsd.org)
Received: (from gonzo@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2P2MWTY059536;
	Sun, 25 Mar 2012 02:22:32 GMT (envelope-from gonzo@svn.freebsd.org)
Message-Id: <201203250222.q2P2MWTY059536@svn.freebsd.org>
From: Oleksandr Tymoshenko 
Date: Sun, 25 Mar 2012 02:22:32 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233451 - head/lib/libpmc
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sun, 25 Mar 2012 02:22:32 -0000

Author: gonzo
Date: Sun Mar 25 02:22:32 2012
New Revision: 233451
URL: http://svn.freebsd.org/changeset/base/233451

Log:
  Update manual pages for MIPS-related CPUs:
  
  - Rename pmc.mips to pmc.mips24k since it covers just one CPU,
      no whole architecture
  - Add documetnations for Octeon's PMC counters
  - Remove CAVEATS section from pmc.mips24k page: PMC for MIPS supports
      sampling now.

Added:
  head/lib/libpmc/pmc.mips24k.3
     - copied, changed from r233380, head/lib/libpmc/pmc.mips.3
  head/lib/libpmc/pmc.octeon.3   (contents, props changed)
Deleted:
  head/lib/libpmc/pmc.mips.3
Modified:
  head/lib/libpmc/Makefile

Modified: head/lib/libpmc/Makefile
==============================================================================
--- head/lib/libpmc/Makefile	Sun Mar 25 02:20:18 2012	(r233450)
+++ head/lib/libpmc/Makefile	Sun Mar 25 02:22:32 2012	(r233451)
@@ -42,6 +42,9 @@ MAN+=	pmc.westmereuc.3
 MAN+=	pmc.tsc.3
 .elif ${MACHINE_CPUARCH} == "arm" && ${CPUTYPE} == "xscale"
 MAN+=	pmc.xscale.3
+.elif ${MACHINE_CPUARCH} == "mips"
+MAN+=	pmc.mips24k.3
+MAN+=	pmc.octeon.3
 .endif
 
 MLINKS+= \

Copied and modified: head/lib/libpmc/pmc.mips24k.3 (from r233380, head/lib/libpmc/pmc.mips.3)
==============================================================================
--- head/lib/libpmc/pmc.mips.3	Fri Mar 23 18:03:38 2012	(r233380, copy source)
+++ head/lib/libpmc/pmc.mips24k.3	Sun Mar 25 02:22:32 2012	(r233451)
@@ -23,13 +23,13 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd February 25, 2012
-.Dt PMC.MIPS 3
+.Dd March 24, 2012
+.Dt PMC.MIPS24K 3
 .Os
 .Sh NAME
-.Nm pmc.mips
+.Nm pmc.mips24k
 .Nd measurement events for
-.Tn MIPS
+.Tn MIPS24K
 family CPUs
 .Sh LIBRARY
 .Lb libpmc
@@ -388,6 +388,7 @@ and the underlying hardware events used.
 .Xr pmc.iaf 3 ,
 .Xr pmc.k7 3 ,
 .Xr pmc.k8 3 ,
+.Xr pmc.octeon 3 ,
 .Xr pmc.p4 3 ,
 .Xr pmc.p5 3 ,
 .Xr pmc.p6 3 ,
@@ -409,5 +410,3 @@ library was written by
 MIPS support was added by
 .An "George Neville-Neil"
 .Aq gnn@FreeBSD.org .
-.Sh CAVEATS
-The MIPS code does not yet support sampling.

Added: head/lib/libpmc/pmc.octeon.3
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/lib/libpmc/pmc.octeon.3	Sun Mar 25 02:22:32 2012	(r233451)
@@ -0,0 +1,253 @@
+.\" Copyright (c) 2010 George Neville-Neil.  All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\"    notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\"    notice, this list of conditions and the following disclaimer in the
+.\"    documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd March 24, 2012
+.Dt PMC.OCTEON 3
+.Os
+.Sh NAME
+.Nm pmc.octeon
+.Nd measurement events for
+.Tn Octeon
+family CPUs
+.Sh LIBRARY
+.Lb libpmc
+.Sh SYNOPSIS
+.In pmc.h
+.Sh DESCRIPTION
+.Pp
+There are two counters per core supported by the hardware and each is 64 bits
+wide.
+.Ss Event Specifiers (Programmable PMCs)
+MIPS programmable PMCs support the following events:
+.Bl -tag -width indent
+.It Li CLK
+.Pq Event 1
+Conditionally clocked cycles (as opposed to count/cvm_count which count even with no clocks)
+.It Li ISSUE
+.Pq Event 2
+Instructions issued but not retired
+.It Li RET
+.Pq Event 3
+Instructions retired
+.It Li NISSUE
+.Pq Event 4
+Cycles no issue
+.It Li SISSUE
+.Pq Event 5
+Cycles single issue
+.It Li DISSUE
+.Pq Event 6
+Cycles dual issue
+.It Li IFI
+.Pq Event 7
+Cycle ifetch issued (but not necessarily commit to pp_mem)
+.It Li BR
+.Pq Event 8
+Branches retired
+.It Li BRMIS
+.Pq Event 9
+Branch mispredicts
+.It Li J
+.Pq Event 10
+Jumps retired
+.It Li JMIS
+.Pq Event 11
+Jumps mispredicted
+.It Li REPLAY
+.Pq Event 12
+Mem Replays
+.It Li IUNA
+.Pq Event 13
+Cycles idle due to unaligned_replays
+.It Li TRAP
+.Pq Event 14
+trap_6a signal
+.It Li UULOAD
+.Pq Event 16
+Unexpected unaligned loads (REPUN=1)
+.It Li UUSTORE
+.Pq Event 17
+Unexpected unaligned store (REPUN=1)
+.It Li ULOAD
+.Pq Event 18
+Unaligned loads (REPUN=1 or USEUN=1)
+.It Li USTORE
+.Pq Event 19
+Unaligned store (REPUN=1 or USEUN=1)
+.It Li EC
+.Pq Event 20
+Exec clocks(must set CvmCtl[DISCE] for accurate timing)
+.It Li MC
+.Pq Event 21
+Mul clocks(must set CvmCtl[DISCE] for accurate timing)
+.It Li CC
+.Pq Event 22
+Crypto clocks(must set CvmCtl[DISCE] for accurate timing)
+.It Li CSRC
+.Pq Event 23
+Issue_csr clocks(must set CvmCtl[DISCE] for accurate timing)
+.It Li CFETCH
+.Pq Event 24
+Icache committed fetches (demand+prefetch)
+.It Li CPREF
+.Pq Event 25
+Icache committed prefetches
+.It Li ICA
+.Pq Event 26
+Icache aliases
+.It Li II
+.Pq Event 27
+Icache invalidates
+.It Li IP
+.Pq Event 28
+Icache parity error
+.It Li CIMISS
+.Pq Event 29
+Cycles idle due to imiss (must set CvmCtl[DISCE] for accurate timing)
+.It Li WBUF
+.Pq Event 32
+Number of write buffer entries created
+.It Li WDAT
+.Pq Event 33
+Number of write buffer data cycles used (may need to set CvmCtl[DISCE] for accurate counts)
+.It Li WBUFLD
+.Pq Event 34
+Number of write buffer entries forced out by loads
+.It Li WBUFFL
+.Pq Event 35
+Number of cycles that there was no available write buffer entry (may need to set CvmCtl[DISCE] and CvmMemCtl[MCLK] for accurate counts)
+.It Li WBUFTR
+.Pq Event 36
+Number of stores that found no available write buffer entries
+.It Li BADD
+.Pq Event 37
+Number of address bus cycles used (may need to set CvmCtl[DISCE] for accurate counts)
+.It Li BADDL2
+.Pq Event 38
+Number of address bus cycles not reflected (i.e. destined for L2) (may need to set CvmCtl[DISCE] for accurate counts)
+.It Li BFILL
+.Pq Event 39
+Number of fill bus cycles used (may need to set CvmCtl[DISCE] for accurate counts)
+.It Li DDIDS
+.Pq Event 40
+Number of Dstream DIDs created
+.It Li IDIDS
+.Pq Event 41
+Number of Istream DIDs created
+.It Li DIDNA
+.Pq Event 42
+Number of cycles that no DIDs were available (may need to set CvmCtl[DISCE] and CvmMemCtl[MCLK] for accurate counts)
+.It Li LDS
+.Pq Event 43
+Number of load issues
+.It Li LMLDS
+.Pq Event 44
+Number of local memory load
+.It Li IOLDS
+.Pq Event 45
+Number of I/O load issues
+.It Li DMLDS
+.Pq Event 46
+Number of loads that were not prefetches and missed in the cache
+.It Li STS
+.Pq Event 48
+Number of store issues
+.It Li LMSTS
+.Pq Event 49
+Number of local memory store issues
+.It Li IOSTS
+.Pq Event 50
+Number of I/O store issues
+.It Li IOBDMA
+.Pq Event 51
+Number of IOBDMAs
+.It Li DTLB
+.Pq Event 53
+Number of dstream TLB refill, invalid, or modified exceptions
+.It Li DTLBAD
+.Pq Event 54
+Number of dstream TLB address errors
+.It Li ITLB
+.Pq Event 55
+Number of istream TLB refill, invalid, or address error exceptions
+.It Li SYNC
+.Pq Event 56
+Number of SYNC stall cycles (may need to set CvmCtl[DISCE] for accurate counts)
+.It Li SYNCIOB
+.Pq Event 57
+Number of SYNCIOBDMA stall cycles (may need to set CvmCtl[DISCE] for accurate counts)
+.It Li SYNCW
+.Pq Event 58
+Number of SYNCWs
+.It Li ERETMIS
+.Pq Event 64
+D/eret mispredicts (CN63XX specific)
+.It Li LIKMIS
+.Pq Event 65
+Branch likely mispredicts (CN63XX specific)
+.It Li HAZTR
+.Pq Event 66
+Hazard traps due to *MTC0 to CvmCtl, Perf counter control, EntryHi, or CvmMemCtl registers (CN63XX specific)
+.El
+.Ss Event Name Aliases
+The following table shows the mapping between the PMC-independent
+aliases supported by
+.Lb libpmc
+and the underlying hardware events used.
+.Bl -column "branch-mispredicts" "cpu_clk_unhalted.core_p"
+.It Em Alias Ta Em Event Ta
+.It Li instructions Ta Li RET Ta
+.It Li branches Ta Li BR Ta
+.It Li branch-mispredicts Ta Li BRMIS Ta
+.El
+.Sh SEE ALSO
+.Xr pmc 3 ,
+.Xr pmc.atom 3 ,
+.Xr pmc.core 3 ,
+.Xr pmc.iaf 3 ,
+.Xr pmc.k7 3 ,
+.Xr pmc.k8 3 ,
+.Xr pmc.mips24k 3 ,
+.Xr pmc.p4 3 ,
+.Xr pmc.p5 3 ,
+.Xr pmc.p6 3 ,
+.Xr pmc.tsc 3 ,
+.Xr pmc_cpuinfo 3 ,
+.Xr pmclog 3 ,
+.Xr hwpmc 4
+.Sh HISTORY
+The
+.Nm pmc
+library first appeared in
+.Fx 6.0 .
+.Sh AUTHORS
+The
+.Lb libpmc
+library was written by
+.An "Joseph Koshy"
+.Aq jkoshy@FreeBSD.org .
+MIPS support was added by
+.An "George Neville-Neil"
+.Aq gnn@FreeBSD.org .

From owner-svn-src-head@FreeBSD.ORG  Sun Mar 25 03:11:58 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 159A6106566B;
	Sun, 25 Mar 2012 03:11:58 +0000 (UTC)
	(envelope-from adrian@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id EAEF78FC08;
	Sun, 25 Mar 2012 03:11:57 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2P3BvrW061384;
	Sun, 25 Mar 2012 03:11:57 GMT (envelope-from adrian@svn.freebsd.org)
Received: (from adrian@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2P3Bvfs061375;
	Sun, 25 Mar 2012 03:11:57 GMT (envelope-from adrian@svn.freebsd.org)
Message-Id: <201203250311.q2P3Bvfs061375@svn.freebsd.org>
From: Adrian Chadd 
Date: Sun, 25 Mar 2012 03:11:57 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233452 - head/sys/net80211
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sun, 25 Mar 2012 03:11:58 -0000

Author: adrian
Date: Sun Mar 25 03:11:57 2012
New Revision: 233452
URL: http://svn.freebsd.org/changeset/base/233452

Log:
  Create a new task to handle 802.11n channel width changes.
  
  Currently, a channel width change updates the 802.11n HT info data in
  net80211 but it doesn't trigger any device changes.  So the device
  driver may decide that HT40 frames can be transmitted but the last
  device channel set only had HT20 set.
  
  Now, a task is scheduled so a hardware reset or change isn't done
  during any active ongoing RX. It also means that it's serialised
  with the other task operations (eg channel change.)
  
  This isn't the final incantation of this work, see below.
  
  For now, any unmodified drivers will simply receive a channel
  change log entry.  A subsequent patch to ath(4) will introduce
  some basic channel change handling (by resetting the NIC.)
  Other NICs may need to update their rate control information.
  
  TODO:
  
  * There's still a small window at the present moment where the
    channel width has been updated but the task hasn't been fired.
    The final version of this should likely pass in a channel width
    field to the driver and let the driver atomically do whatever
    it needs to before changing the channel.
  
  PR:		kern/166286

Modified:
  head/sys/net80211/ieee80211.c
  head/sys/net80211/ieee80211_ht.c
  head/sys/net80211/ieee80211_ht.h
  head/sys/net80211/ieee80211_node.c
  head/sys/net80211/ieee80211_node.h
  head/sys/net80211/ieee80211_proto.c
  head/sys/net80211/ieee80211_sta.c
  head/sys/net80211/ieee80211_var.h

Modified: head/sys/net80211/ieee80211.c
==============================================================================
--- head/sys/net80211/ieee80211.c	Sun Mar 25 02:22:32 2012	(r233451)
+++ head/sys/net80211/ieee80211.c	Sun Mar 25 03:11:57 2012	(r233452)
@@ -256,6 +256,13 @@ null_input(struct ifnet *ifp, struct mbu
 	m_freem(m);
 }
 
+static void
+null_update_chw(struct ieee80211com *ic)
+{
+
+	if_printf(ic->ic_ifp, "%s: need callback\n", __func__);
+}
+
 /*
  * Attach/setup the common net80211 state.  Called by
  * the driver on attach to prior to creating any vap's.
@@ -287,6 +294,7 @@ ieee80211_ifattach(struct ieee80211com *
 
 	ic->ic_update_mcast = null_update_mcast;
 	ic->ic_update_promisc = null_update_promisc;
+	ic->ic_update_chw = null_update_chw;
 
 	ic->ic_hash_key = arc4random();
 	ic->ic_bintval = IEEE80211_BINTVAL_DEFAULT;

Modified: head/sys/net80211/ieee80211_ht.c
==============================================================================
--- head/sys/net80211/ieee80211_ht.c	Sun Mar 25 02:22:32 2012	(r233451)
+++ head/sys/net80211/ieee80211_ht.c	Sun Mar 25 03:11:57 2012	(r233452)
@@ -1428,12 +1428,13 @@ ieee80211_parse_htinfo(struct ieee80211_
  * required channel change is done (e.g. in sta mode when
  * parsing the contents of a beacon frame).
  */
-static void
+static int
 htinfo_update_chw(struct ieee80211_node *ni, int htflags)
 {
 	struct ieee80211com *ic = ni->ni_ic;
 	struct ieee80211_channel *c;
 	int chanflags;
+	int ret = 0;
 
 	chanflags = (ni->ni_chan->ic_flags &~ IEEE80211_CHAN_HT) | htflags;
 	if (chanflags != ni->ni_chan->ic_flags) {
@@ -1460,11 +1461,13 @@ htinfo_update_chw(struct ieee80211_node 
 			    IEEE80211_IS_CHAN_HT40(c) ? 40 : 20,
 			    c->ic_freq, c->ic_flags);
 			ni->ni_chan = c;
+			ret = 1;
 		}
 		/* NB: caller responsible for forcing any channel change */
 	}
 	/* update node's tx channel width */
 	ni->ni_chw = IEEE80211_IS_CHAN_HT40(ni->ni_chan)? 40 : 20;
+	return (ret);
 }
 
 /*
@@ -1515,13 +1518,14 @@ htcap_update_shortgi(struct ieee80211_no
  * Parse and update HT-related state extracted from
  * the HT cap and info ie's.
  */
-void
+int
 ieee80211_ht_updateparams(struct ieee80211_node *ni,
 	const uint8_t *htcapie, const uint8_t *htinfoie)
 {
 	struct ieee80211vap *vap = ni->ni_vap;
 	const struct ieee80211_ie_htinfo *htinfo;
 	int htflags;
+	int ret = 0;
 
 	ieee80211_parse_htcap(ni, htcapie);
 	if (vap->iv_htcaps & IEEE80211_HTCAP_SMPS)
@@ -1543,13 +1547,16 @@ ieee80211_ht_updateparams(struct ieee802
 		else if (ni->ni_ht2ndchan == IEEE80211_HTINFO_2NDCHAN_BELOW)
 			htflags = IEEE80211_CHAN_HT40D;
 	}
-	htinfo_update_chw(ni, htflags);
+	if (htinfo_update_chw(ni, htflags))
+		ret = 1;
 
 	if ((htinfo->hi_byte1 & IEEE80211_HTINFO_RIFSMODE_PERM) &&
 	    (vap->iv_flags_ht & IEEE80211_FHT_RIFS))
 		ni->ni_flags |= IEEE80211_NODE_RIFS;
 	else
 		ni->ni_flags &= ~IEEE80211_NODE_RIFS;
+
+	return (ret);
 }
 
 /*
@@ -1578,7 +1585,7 @@ ieee80211_ht_updatehtcap(struct ieee8021
 		else if (IEEE80211_IS_CHAN_HT40D(vap->iv_bss->ni_chan))
 			htflags = IEEE80211_CHAN_HT40D;
 	}
-	htinfo_update_chw(ni, htflags);
+	(void) htinfo_update_chw(ni, htflags);
 }
 
 /*

Modified: head/sys/net80211/ieee80211_ht.h
==============================================================================
--- head/sys/net80211/ieee80211_ht.h	Sun Mar 25 02:22:32 2012	(r233451)
+++ head/sys/net80211/ieee80211_ht.h	Sun Mar 25 03:11:57 2012	(r233452)
@@ -184,7 +184,7 @@ void	ieee80211_htprot_update(struct ieee
 void	ieee80211_ht_timeout(struct ieee80211com *);
 void	ieee80211_parse_htcap(struct ieee80211_node *, const uint8_t *);
 void	ieee80211_parse_htinfo(struct ieee80211_node *, const uint8_t *);
-void	ieee80211_ht_updateparams(struct ieee80211_node *, const uint8_t *,
+int	ieee80211_ht_updateparams(struct ieee80211_node *, const uint8_t *,
 		const uint8_t *);
 void	ieee80211_ht_updatehtcap(struct ieee80211_node *, const uint8_t *);
 int	ieee80211_ampdu_request(struct ieee80211_node *,

Modified: head/sys/net80211/ieee80211_node.c
==============================================================================
--- head/sys/net80211/ieee80211_node.c	Sun Mar 25 02:22:32 2012	(r233451)
+++ head/sys/net80211/ieee80211_node.c	Sun Mar 25 03:11:57 2012	(r233452)
@@ -685,6 +685,14 @@ ieee80211_setcurchan(struct ieee80211com
 	ieee80211_runtask(ic, &ic->ic_chan_task);
 }
 
+void
+ieee80211_update_chw(struct ieee80211com *ic)
+{
+
+	ieee80211_setupcurchan(ic, ic->ic_curchan);
+	ieee80211_runtask(ic, &ic->ic_chw_task);
+}
+
 /*
  * Join the specified IBSS/BSS network.  The node is assumed to
  * be passed in with a held reference.

Modified: head/sys/net80211/ieee80211_node.h
==============================================================================
--- head/sys/net80211/ieee80211_node.h	Sun Mar 25 02:22:32 2012	(r233451)
+++ head/sys/net80211/ieee80211_node.h	Sun Mar 25 03:11:57 2012	(r233452)
@@ -324,6 +324,7 @@ void	ieee80211_sync_curchan(struct ieee8
 void	ieee80211_setupcurchan(struct ieee80211com *,
 	    struct ieee80211_channel *);
 void	ieee80211_setcurchan(struct ieee80211com *, struct ieee80211_channel *);
+void	ieee80211_update_chw(struct ieee80211com *);
 int	ieee80211_ibss_merge(struct ieee80211_node *);
 struct ieee80211_scan_entry;
 int	ieee80211_sta_join(struct ieee80211vap *, struct ieee80211_channel *,

Modified: head/sys/net80211/ieee80211_proto.c
==============================================================================
--- head/sys/net80211/ieee80211_proto.c	Sun Mar 25 02:22:32 2012	(r233451)
+++ head/sys/net80211/ieee80211_proto.c	Sun Mar 25 03:11:57 2012	(r233452)
@@ -105,6 +105,7 @@ static void parent_updown(void *, int);
 static void update_mcast(void *, int);
 static void update_promisc(void *, int);
 static void update_channel(void *, int);
+static void update_chw(void *, int);
 static void ieee80211_newstate_cb(void *, int);
 static int ieee80211_new_state_locked(struct ieee80211vap *,
 	enum ieee80211_state, int);
@@ -144,6 +145,7 @@ ieee80211_proto_attach(struct ieee80211c
 	TASK_INIT(&ic->ic_promisc_task, 0, update_promisc, ic);
 	TASK_INIT(&ic->ic_chan_task, 0, update_channel, ic);
 	TASK_INIT(&ic->ic_bmiss_task, 0, beacon_miss, ic);
+	TASK_INIT(&ic->ic_chw_task, 0, update_chw, ic);
 
 	ic->ic_wme.wme_hipri_switch_hysteresis =
 		AGGRESSIVE_MODE_SWITCH_HYSTERESIS;
@@ -1147,6 +1149,17 @@ update_channel(void *arg, int npending)
 	ieee80211_radiotap_chan_change(ic);
 }
 
+static void
+update_chw(void *arg, int npending)
+{
+	struct ieee80211com *ic = arg;
+
+	/*
+	 * XXX should we defer the channel width _config_ update until now?
+	 */
+	ic->ic_update_chw(ic);
+}
+
 /*
  * Block until the parent is in a known state.  This is
  * used after any operations that dispatch a task (e.g.
@@ -1161,6 +1174,7 @@ ieee80211_waitfor_parent(struct ieee8021
 	ieee80211_draintask(ic, &ic->ic_promisc_task);
 	ieee80211_draintask(ic, &ic->ic_chan_task);
 	ieee80211_draintask(ic, &ic->ic_bmiss_task);
+	ieee80211_draintask(ic, &ic->ic_chw_task);
 	taskqueue_unblock(ic->ic_tq);
 }
 

Modified: head/sys/net80211/ieee80211_sta.c
==============================================================================
--- head/sys/net80211/ieee80211_sta.c	Sun Mar 25 02:22:32 2012	(r233451)
+++ head/sys/net80211/ieee80211_sta.c	Sun Mar 25 03:11:57 2012	(r233452)
@@ -1285,6 +1285,7 @@ sta_recv_mgmt(struct ieee80211_node *ni,
 	uint8_t *frm, *efrm;
 	uint8_t *rates, *xrates, *wme, *htcap, *htinfo;
 	uint8_t rate;
+	int ht_state_change = 0;
 
 	wh = mtod(m0, struct ieee80211_frame *);
 	frm = (uint8_t *)&wh[1];
@@ -1372,9 +1373,10 @@ sta_recv_mgmt(struct ieee80211_node *ni,
 #endif
 			if (scan.htcap != NULL && scan.htinfo != NULL &&
 			    (vap->iv_flags_ht & IEEE80211_FHT_HT)) {
-				ieee80211_ht_updateparams(ni,
-				    scan.htcap, scan.htinfo);
 				/* XXX state changes? */
+				if (ieee80211_ht_updateparams(ni,
+				    scan.htcap, scan.htinfo))
+					ht_state_change = 1;
 			}
 			if (scan.quiet)
 				ic->ic_set_quiet(ni, scan.quiet);
@@ -1441,6 +1443,13 @@ sta_recv_mgmt(struct ieee80211_node *ni,
 #endif
 				ieee80211_bg_scan(vap, 0);
 			}
+
+			/*
+			 * If we've had a channel width change (eg HT20<->HT40)
+			 * then schedule a delayed driver notification.
+			 */
+			if (ht_state_change)
+				ieee80211_update_chw(ic);
 			return;
 		}
 		/*

Modified: head/sys/net80211/ieee80211_var.h
==============================================================================
--- head/sys/net80211/ieee80211_var.h	Sun Mar 25 02:22:32 2012	(r233451)
+++ head/sys/net80211/ieee80211_var.h	Sun Mar 25 03:11:57 2012	(r233452)
@@ -130,6 +130,7 @@ struct ieee80211com {
 	struct task		ic_mcast_task;	/* deferred mcast update */
 	struct task		ic_chan_task;	/* deferred channel change */
 	struct task		ic_bmiss_task;	/* deferred beacon miss hndlr */
+	struct task		ic_chw_task;	/* deferred HT CHW update */
 
 	uint32_t		ic_flags;	/* state flags */
 	uint32_t		ic_flags_ext;	/* extended state flags */
@@ -322,6 +323,10 @@ struct ieee80211com {
 				    int batimeout, int baseqctl);
 	void			(*ic_ampdu_rx_stop)(struct ieee80211_node *,
 				    struct ieee80211_rx_ampdu *);
+
+	/* The channel width has changed (20<->2040) */
+	void			(*ic_update_chw)(struct ieee80211com *);
+
 	uint64_t		ic_spare[7];
 };
 

From owner-svn-src-head@FreeBSD.ORG  Sun Mar 25 03:14:31 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id DA8B8106564A;
	Sun, 25 Mar 2012 03:14:31 +0000 (UTC)
	(envelope-from adrian@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id AB6D18FC18;
	Sun, 25 Mar 2012 03:14:31 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2P3EVX8061495;
	Sun, 25 Mar 2012 03:14:31 GMT (envelope-from adrian@svn.freebsd.org)
Received: (from adrian@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2P3EVYt061493;
	Sun, 25 Mar 2012 03:14:31 GMT (envelope-from adrian@svn.freebsd.org)
Message-Id: <201203250314.q2P3EVYt061493@svn.freebsd.org>
From: Adrian Chadd 
Date: Sun, 25 Mar 2012 03:14:31 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233453 - head/sys/dev/ath
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sun, 25 Mar 2012 03:14:31 -0000

Author: adrian
Date: Sun Mar 25 03:14:31 2012
New Revision: 233453
URL: http://svn.freebsd.org/changeset/base/233453

Log:
  Add the new channel width change field to the ath(4) driver.
  
  This is not entirely correct as it simply resets the channel, flushing
  whatever is in the TX/RX queue.  This can and will break aggregation
  BAW tracking.  But the alternative (HT40 frames being sent with the hardware
  in HT20 mode) is even worse.
  
  There's still a small window between the htinfo being received (and the ni_chw
  field being updated) which could cause problems.  I'll look at fleshing this
  out in follow-up commits.
  
  PR:		kern/166286

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

Modified: head/sys/dev/ath/if_ath.c
==============================================================================
--- head/sys/dev/ath/if_ath.c	Sun Mar 25 03:11:57 2012	(r233452)
+++ head/sys/dev/ath/if_ath.c	Sun Mar 25 03:14:31 2012	(r233453)
@@ -199,6 +199,7 @@ static void	ath_chan_change(struct ath_s
 static void	ath_scan_start(struct ieee80211com *);
 static void	ath_scan_end(struct ieee80211com *);
 static void	ath_set_channel(struct ieee80211com *);
+static void	ath_update_chw(struct ieee80211com *);
 static void	ath_calibrate(void *);
 static int	ath_newstate(struct ieee80211vap *, enum ieee80211_state, int);
 static void	ath_setup_stationkey(struct ieee80211_node *);
@@ -794,6 +795,7 @@ ath_attach(u_int16_t devid, struct ath_s
 	ic->ic_scan_start = ath_scan_start;
 	ic->ic_scan_end = ath_scan_end;
 	ic->ic_set_channel = ath_set_channel;
+	ic->ic_update_chw = ath_update_chw;
 
 	/* 802.11n specific - but just override anyway */
 	sc->sc_addba_request = ic->ic_addba_request;
@@ -5717,6 +5719,31 @@ ath_scan_end(struct ieee80211com *ic)
 		 sc->sc_curaid);
 }
 
+/*
+ * For now, just do a channel change.
+ *
+ * Later, we'll go through the hard slog of suspending tx/rx, changing rate
+ * control state and resetting the hardware without dropping frames out
+ * of the queue.
+ *
+ * The unfortunate trouble here is making absolutely sure that the
+ * channel width change has propagated enough so the hardware
+ * absolutely isn't handed bogus frames for it's current operating
+ * mode. (Eg, 40MHz frames in 20MHz mode.) Since TX and RX can and
+ * does occur in parallel, we need to make certain we've blocked
+ * any further ongoing TX (and RX, that can cause raw TX)
+ * before we do this.
+ */
+static void
+ath_update_chw(struct ieee80211com *ic)
+{
+	struct ifnet *ifp = ic->ic_ifp;
+	struct ath_softc *sc = ifp->if_softc;
+
+	DPRINTF(sc, ATH_DEBUG_STATE, "%s: called\n", __func__);
+	ath_set_channel(ic);
+}
+
 static void
 ath_set_channel(struct ieee80211com *ic)
 {

From owner-svn-src-head@FreeBSD.ORG  Sun Mar 25 05:31:41 2012
Return-Path: 
Delivered-To: svn-src-head@FreeBSD.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 2441E106566B;
	Sun, 25 Mar 2012 05:31:41 +0000 (UTC)
	(envelope-from brde@optusnet.com.au)
Received: from mail06.syd.optusnet.com.au (mail06.syd.optusnet.com.au
	[211.29.132.187])
	by mx1.freebsd.org (Postfix) with ESMTP id 91BC28FC1B;
	Sun, 25 Mar 2012 05:31:39 +0000 (UTC)
Received: from c211-30-171-136.carlnfd1.nsw.optusnet.com.au
	(c211-30-171-136.carlnfd1.nsw.optusnet.com.au [211.30.171.136])
	by mail06.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id
	q2P5VT47001365
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO);
	Sun, 25 Mar 2012 16:31:30 +1100
Date: Sun, 25 Mar 2012 16:31:29 +1100 (EST)
From: Bruce Evans 
X-X-Sender: bde@besplex.bde.org
To: Dimitry Andric 
In-Reply-To: <4F6E3A7D.9020709@FreeBSD.org>
Message-ID: <20120325150057.H933@besplex.bde.org>
References: <201203241007.q2OA7MtS024789@svn.freebsd.org>
	<20120325040224.Q2467@besplex.bde.org> <4F6E3A7D.9020709@FreeBSD.org>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed
Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org,
	src-committers@FreeBSD.org, tijl@FreeBSD.org,
	Bruce Evans 
Subject: Re: svn commit: r233419 - head/sys/x86/include
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sun, 25 Mar 2012 05:31:41 -0000

On Sat, 24 Mar 2012, Dimitry Andric wrote:

> On 2012-03-24 18:48, Bruce Evans wrote:
>> On Sat, 24 Mar 2012, Dimitry Andric wrote:
>>
>>> Log:
>>>  Fix the following clang warning in sys/dev/dcons/dcons.c, caused by the
>>>  recent changes in sys/x86/include/endian.h:
>>>
>>>    sys/dev/dcons/dcons.c:190:15: error: implicit conversion from '__uint32_t' (aka 'unsigned int') to '__uint16_t' (aka 'unsigned short') changes value from 1684238190 to 28526 [-Werror,-Wconstant-conversion]
>>>
>>>  	  buf->magic = ntohl(DCONS_MAGIC);
>>>  		       ^~~~~~~~~~~~~~~~~~
>>>    sys/sys/param.h:306:18: note: expanded from:
>>>    #define ntohl(x)        __ntohl(x)
>>>  			  ^
>>>    ./x86/endian.h:128:20: note: expanded from:
>>>    #define __ntohl(x)      __bswap32(x)
>>>  			  ^
>>>    ./x86/endian.h:78:20: note: expanded from:
>>>  	      __bswap32_gen((__uint32_t)(x)) : __bswap32_var(x))
>>>  			    ^
>>>    ./x86/endian.h:68:26: note: expanded from:
>>>  	  (((__uint32_t)__bswap16(x) << 16) | __bswap16((x) >> 16))
>>>  				  ^
>>>    ./x86/endian.h:75:53: note: expanded from:
>>>  	      __bswap16_gen((__uint16_t)(x)) : __bswap16_var(x)))
>>>  					       ~~~~~~~~~~~~~ ^
>>
>> This warning was discussed before things were committed.
>
> Then why was it committed without fixing the warning first?

Because testing (by tijl) showed that there was no warning.

Testing now (by me) shows the warning for dcons.

>> gcc gives a
>> similar warning, but according to tijl, it can't happen in normal use
>> with either gcc or clang because -Wno-system-headers suppresses warnings
>> in system headers.  -Wnosystem-headers is the default in the kernel,
>> where the above problem happens, so I don't see how it happens.
>
> I don't see that option anywhere in either the world or kernel build.

It is the default for gcc.  It seems to be the default for clang too.

> Why would you not want to warn about system headers?

We do want to warn about system headers.  That's why we add
-Wsystem-headers to CFLAGS in bsd.sys.mk if WARNS >= 1 (to change the
default).  But WARNS is not supported for kernels, and is not normally
set for modules.

>> However, bsd.sys.mk forces the non-default of -Wsystem-headers in
>> userland at WARNS >= 1, so I don't see why there isn't a problem in
>> userland if userland actually uses an expression like
>> ntohl(DCONS_MAGIC).
>
> It only occurs in certain cases, and I have not been able to exactly
> determine when.  It doesn't seem to be related to -Wsystem-headers.

-Wsystem-headers operates mysteriously.  It is reported to not work for
clang, but it works for me in _not_ suppressing the warning for
(x && y || z && t), yet not for the ntohl() warning.  What a system
header is undocumented.  It seems to be related to using the standard
search path: `-I.' to reach  doesn't work, but '-I.' to reach x86
does work.  So I was able to test ./x86/endian.h as a "system header"
and put garbage in it, and got strange results:
- when ./x86/endian.h is a "system" header, clang never warns about
   the ntohl(), irrespective of -Wsystem-headers
- when ./x86/endian.h is not a "system" header, clang always warns about
   the ntohl()
- gcc never warns about the ntohl()
- when ./x86/endian.h is a "system" header, with -Wall both gcc and clang
   warns about (x && y || z && t) according to -Wsystem-headers
- when ./x86/endian.h is not a "system" header, with -Wall both gcc and
   clang always warn about (x && y || z && t)
- when ./x86/endian.h is a "system" header, with -Wimplicit-int clang
   warns about 'x(void);' according to -Wsystem-headers, but gcc never
   warns about it.
- when ./x86/endian.h is not a "system" header, with -Wall both gcc and
   clang always warn about 'x(void);'.

>>>  This is because the __bswapXX_gen() macros (for x86) call the regular
>>>  __bswapXX() macros.  Since the __bswapXX_gen() variants are only called
>>>  when their arguments are constant, there is no need to do that constancy
>>>  check recursively.  Also, it causes the above error with clang.
>>
>> Not true.  The __bswapXX_gen() are called with non-constant args from
>> __bswap64_var() in the i386 case.
>
> Sure, but there it doesn't matter at all.
>
>> As documented there, it is important

Of course it matters there.  It is the difference between gcc generating
2 32-bit bswap instructions for bswap64(var) and 25 lines of shifts and
mask instructions.

>>>  This is because the __bswapXX_gen() macros (for x86) call the regular
>>>  __bswapXX() macros.  Since the __bswapXX_gen() variants are only called
>>>  when their arguments are constant, there is no need to do that constancy
>>>  check recursively.  Also, it causes the above error with clang.
>>
>> Not true.  The __bswapXX_gen() are called with non-constant args from
>> __bswap64_var() in the i386 case.
>
> Sure, but there it doesn't matter at all.

Of course it matters.

>> As documented there, it is important
>> for optimizations that __bswap64_gen() does do the constancy check
>> recursively.  This was discussed before things were committed, and
>> again when jhb siggested breaking it similarly to this commit to avoid
>> a problem on ia64.
>
> Isn't it much easier, and less obtuse, to just jam in two bswaps for the
> i386?  I never saw the reason for making the bswap macros *more*
> complicated instead of less.  If you obfuscate them enough, no compiler
> will be able to optimize properly... :)

No, since the divison of 64 bits into 2 times 32-bits is very easy.
For constants it is much simpler than what it replaced, and the same
method is now used for variables.  Hard-coding 2 32-bit bswaps for
i386 would give a different method for i386, and if done in asm would
inhibit the compiler combining these bswaps.  Although we do have the
corresponding hard asm for bswap32() (gcc needs it but clang doesn't;
clang needs help only for bswap64()).

>>>  Fix it by calling __bswap16_gen() from __bswap32_gen(), and similarly,
>>>  __bswap32_gen() from  __bswap64_gen().
>>
>> This breaks it.  DIring development, I had a correct fix involving
>> casting down the arg.
>
> If it works correctly with clang, please post it.

This mail contains an intermediate version and discusses and fixes this
bug, but is out of date in many respects:

@ From bde@optusnet.com.au Fri Mar  2 22:52:44 2012 +1100
@ Date: Fri, 2 Mar 2012 22:52:41 +1100 (EST)
@ From: Bruce Evans 
@ X-X-Sender: bde@besplex.bde.org
@ To: Bruce Evans 
@ cc: Tijl Coosemans , Dimitry Andric , 
@     src-committers@freebsd.org, svn-src-all@freebsd.org, 
@     svn-src-head@freebsd.org
@ Subject: Re: svn commit: r232266 - in head/sys: amd64/include i386/include
@  pc98/include x86/include
@ In-Reply-To: <20120302130435.J929@besplex.bde.org>
@ Message-ID: <20120302223355.Q2543@besplex.bde.org>
@ References: <201202281939.q1SJdtYr084858@svn.freebsd.org>
@  <20120229160522.W2514@besplex.bde.org> <20120229181608.S2887@besplex.bde.org>
@  <201203012346.20648.tijl@freebsd.org> <20120302130435.J929@besplex.bde.org>
@ MIME-Version: 1.0
@ Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed
@ Status: RO
@ X-Status: 
@ X-Keywords: 
@ X-UID: 3391
@ 
@ On Fri, 2 Mar 2012, Bruce Evans wrote:
@ 
@ > On Thu, 1 Mar 2012, Tijl Coosemans wrote:
@ >
@ >> On Wednesday 29 February 2012 08:44:54 Bruce Evans wrote:
@ >>> ...
@ >>> So any macro version must use gcc features to be safe.  The following
@ >>> seems to work:
@ >>> 
@ >>> #define	__bswap16(x)	__extension__ ({ __uint16_t __x = x;
@ >>>  	(__uint16_t)(__x << 8 | __x >> 8); })
@ >>> 
@ >>> clang now produces "rolw $8,x" when x is volatile.  This seems to
@ >>> violate volatile semantics.  gcc produces load-rolw-store then.  Both
@ >>> produce "rolw $8,x" when x is not volatile.
@ >> 
@ >> I'll have a closer look at the patch tomorrow, but the Intel
@ >> documentation for the bswap instruction recommends to use xchg for
@ >> bswap16.
@ >
@ > That's what i386 used to do, using an asm (see for example the RELENG_4
@ > version), but the asm was replaced by C code and the compiler apparently
@ > knows better.  This might depend on -mtune.  I tested with the default,
@ > ...
@ 
@ Here is another version.  It has now been tested a bit at runtime.
@ I had to restore almost all of the complications, so the following
@ reduces to mostly style changes including comments about surprising
@ details.  It has 1 fix for clang (the comitted version doesn't
@ work for clang).
@ 
@ % Index: endian.h
@ % ===================================================================
@ % RCS file: /home/ncvs/src/sys/x86/include/endian.h,v
@ % retrieving revision 1.1
@ % diff -u -2 -r1.1 endian.h
@ % --- endian.h	28 Feb 2012 19:39:54 -0000	1.1
@ % +++ endian.h	2 Mar 2012 10:43:53 -0000
@ % @@ -37,8 +37,4 @@
@ %  #include 
@ % 
@ % -#ifdef __cplusplus
@ % -extern "C" {
@ % -#endif
@ % -
@ %  /*
@ %   * Define the order of 32-bit words in 64-bit words.
@ % @@ -68,25 +64,17 @@
@ %  #endif
@ % 
@ % -#if defined(__GNUCLIKE_ASM) && defined(__GNUCLIKE_BUILTIN_CONSTANT_P)
@ % -
@ % -#define	__bswap16_const(_x)	(__uint16_t)((_x) << 8 | (_x) >> 8)
@ % +#define	__bswap16_gen(x)	(__uint16_t)((x) << 8 | (x) >> 8)
@ % +#define	__bswap32_gen(x)		\
@ % +	(((__uint32_t)__bswap16(x) << 16) | __bswap16((x) >> 16))
@ % +#define	__bswap64_gen(x)		\
@ % +	(((__uint64_t)__bswap32(x) << 32) | __bswap32((x) >> 32))
@ % 
@ % -#define	__bswap16(_x)			\
@ % -	(__builtin_constant_p(_x) ?	\
@ % -	    __bswap16_const((__uint16_t)(_x)) : __bswap16_var(_x))
@ % -
@ % -#define	__bswap32_const(_x)		\
@ % -	(((__uint32_t)__bswap16(_x) << 16) | __bswap16((_x) >> 16))
@ % -
@ % -#define	__bswap32(_x)			\
@ % -	(__builtin_constant_p(_x) ?	\
@ % -	    __bswap32_const((__uint32_t)(_x)) : __bswap32_var(_x))
@ % +#if defined(__GNUCLIKE_ASM) && defined(__GNUCLIKE_BUILTIN_CONSTANT_P)
@ % 
@ % -#define	__bswap64_const(_x)		\
@ % -	(((__uint64_t)__bswap32(_x) << 32) | __bswap32((_x) >> 32))
@ % +/* The following mess is to avoid multiple evaluation of x. */
@ % 
@ % -#define	__bswap64(_x)			\
@ % -	(__builtin_constant_p(_x) ?	\
@ % -	    __bswap64_const((__uint64_t)(_x)) : __bswap64_var(_x))
@ % +#define	__bswap16(x)			\
@ % +	(__builtin_constant_p(x) ?	\
@ % +	    __bswap16_gen((__uint16_t)(x)) : __bswap16_var((__uint16_t)(x)))
@ 
@ For clang, x must be cast in the `var' clause too, since when x is
@ something like 0x12345678 (having been passed here without conversion
@ by __bswap32()), clang parses the `var' clause and warns about the
@ implicit truncation of 0x12345678 to 0x5678 in it.  This is a bug
@ in clang -- when warning about fine details, it is important not to
@ do it for non-problems.
@ 
@ % 
@ %  static __inline __uint16_t
@ % @@ -94,7 +82,19 @@
@ %  {
@ % 
@ % -	return (__bswap16_const(_x));
@ % +	return (__bswap16_gen(_x));
@ %  }
@ % 
@ % +/*
@ % + * The following messes are old optimizations for gcc.  The messes have
@ % + * been reduced significantly, but I don't know how to implement the
@ % + * preferred way of defining defaults above and overriding them cleanly
@ % + * here.  Even clang needs help for the 64-bit case, so to keep the
@ % + * ifdefs sane we use this for the 32-bit case with clang too.
@ % + */
@ % +
@ % +#define	__bswap32(x)			\
@ % +	(__builtin_constant_p(x) ?	\
@ % +	    __bswap32_gen((__uint32_t)(x)) : __bswap32_var(x))
@ % +
@ %  static __inline __uint32_t
@ %  __bswap32_var(__uint32_t _x)
@ % @@ -105,34 +105,37 @@
@ %  }
@ % 
@ % +#define	__bswap64(x)			\
@ % +	(__builtin_constant_p(x) ?	\
@ % +	    __bswap64_gen((__uint64_t)(x)) : __bswap64_var(x))
@ % +
@ %  static __inline __uint64_t
@ %  __bswap64_var(__uint64_t _x)
@ %  {
@ % -#ifdef	_LP64
@ % +
@ % +#ifdef _LP64
@ %  	__asm ("bswap %0" : "+r" (_x));
@ %  	return (_x);
@ %  #else
@ % -	return (__bswap64_const(_x));
@ % +	/*
@ % +	 * It is important for the optimizations that the following is not
@ % +	 * really generic, but expands to 2 __bswap32_var()'s.
@ % +	 */
@ % +	return (__bswap64_gen(_x));
@ %  #endif
@ %  }
@ % 
@ % -#define	__htonl(x)	__bswap32(x)
@ % -#define	__htons(x)	__bswap16(x)
@ % -#define	__ntohl(x)	__bswap32(x)
@ % -#define	__ntohs(x)	__bswap16(x)
@ % +#else /* !(__GNUCLIKE_ASM && __GNUCLIKE_BUILTIN_CONSTANT_P */
@ % 
@ % -#else /* !(__GNUCLIKE_ASM && __GNUCLIKE_BUILTIN_CONSTANT_P) */
@ % -
@ % -/*
@ % - * No optimizations are available for this compiler.  Fall back to
@ % - * non-optimized functions by defining the constant usually used to prevent
@ % - * redefinition.
@ % - */
@ % -#define	_BYTEORDER_FUNC_DEFINED
@ % +/* XXX these are broken, since they evaluate x more than once. */
@ % +#define	__bswap16(x)	(__bswap16_gen((__uint16_t)(x)))
@ % +#define	__bswap32(x)	(__bswap32_gen((__uint32_t)(x)))
@ % +#define	__bswap64(x)	(__bswap64_gen((__uint64_t)(x)))
@ % 
@ %  #endif /* __GNUCLIKE_ASM && __GNUCLIKE_BUILTIN_CONSTANT_P */
@ % 
@ % -#ifdef __cplusplus
@ % -}
@ % -#endif
@ % +#define	__htonl(x)	__bswap32(x)
@ % +#define	__htons(x)	__bswap16(x)
@ % +#define	__ntohl(x)	__bswap32(x)
@ % +#define	__ntohs(x)	__bswap16(x)
@ % 
@ %  #endif /* !_MACHINE_ENDIAN_H_ */
@ 
@ Here is a cut down version showing the clang bug:
@ 
@ % static inline int
@ % unused(short x)
@ % {
@ % 	return (x);
@ % }
@ % 
@ % int
@ % foo(void)
@ % {
@ % 	return (1 ? 0 : unused(0x12345678));
@ % }
@ 
@ % w.c:10:25: warning: implicit conversion from 'int' to 'short' changes value from 305419896 to 22136 [-Wconstant-conversion]
@ %         return (1 ? 0 : unused(0x12345678));
@ %                         ~~~~~~ ^~~~~~~~~~
@ % 1 warning generated.
@ 
@ This shows another bug: the hex constants are obfuscated in the error message
@ by printing them in decimal.
@ 
@ Bruce

The fix is the obvious one of casting args to __bswapNN_gen() to size NN,
so that 0x12345678 becomes 0x5678.

>>>  While here, add extra parentheses around the __bswap16_gen() macro
>>>  expansion, to prevent unexpected side effects.
>>
>> These parentheses were intentionally left out for clarity.
>> __bswap16_gen() is not user-serving, and all places in endian.h that
>> use it supply enough parentheses.
>
> Let's hope so, until a follow up commit breaks it again.

There are also a couple of '(x)'s that don't need parentheses.

Bruce

From owner-svn-src-head@FreeBSD.ORG  Sun Mar 25 06:01:35 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 2596B106564A;
	Sun, 25 Mar 2012 06:01:35 +0000 (UTC)
	(envelope-from nwhitehorn@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id EB3AA8FC12;
	Sun, 25 Mar 2012 06:01:34 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2P61YD3066733;
	Sun, 25 Mar 2012 06:01:34 GMT
	(envelope-from nwhitehorn@svn.freebsd.org)
Received: (from nwhitehorn@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2P61Yut066731;
	Sun, 25 Mar 2012 06:01:34 GMT
	(envelope-from nwhitehorn@svn.freebsd.org)
Message-Id: <201203250601.q2P61Yut066731@svn.freebsd.org>
From: Nathan Whitehorn 
Date: Sun, 25 Mar 2012 06:01:34 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233454 - head/sys/powerpc/aim
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sun, 25 Mar 2012 06:01:35 -0000

Author: nwhitehorn
Date: Sun Mar 25 06:01:34 2012
New Revision: 233454
URL: http://svn.freebsd.org/changeset/base/233454

Log:
  More PMAP performance improvements: on powerpc64, when TLBIE can be run
  with exceptions enabled, leave them enabled and use a regular mutex to
  guard TLB invalidations instead of a spinlock.

Modified:
  head/sys/powerpc/aim/moea64_native.c

Modified: head/sys/powerpc/aim/moea64_native.c
==============================================================================
--- head/sys/powerpc/aim/moea64_native.c	Sun Mar 25 03:14:31 2012	(r233453)
+++ head/sys/powerpc/aim/moea64_native.c	Sun Mar 25 06:01:34 2012	(r233454)
@@ -138,7 +138,7 @@ __FBSDID("$FreeBSD$");
  * Just to add to the fun, exceptions must be off as well
  * so that we can't trap in 64-bit mode. What a pain.
  */
-struct mtx	tlbie_mutex;
+static struct mtx	tlbie_mutex;
 
 static __inline void
 TLBIE(uint64_t vpn) {
@@ -151,8 +151,8 @@ TLBIE(uint64_t vpn) {
 	vpn <<= ADDR_PIDX_SHFT;
 	vpn &= ~(0xffffULL << 48);
 
-	mtx_lock_spin(&tlbie_mutex);
 #ifdef __powerpc64__
+	mtx_lock(&tlbie_mutex);
 	__asm __volatile("\
 	    ptesync; \
 	    tlbie %0; \
@@ -160,10 +160,13 @@ TLBIE(uint64_t vpn) {
 	    tlbsync; \
 	    ptesync;" 
 	:: "r"(vpn) : "memory");
+	mtx_unlock(&tlbie_mutex);
 #else
 	vpn_hi = (uint32_t)(vpn >> 32);
 	vpn_lo = (uint32_t)vpn;
 
+	/* Note: spin mutex is to disable exceptions while fiddling MSR */
+	mtx_lock_spin(&tlbie_mutex);
 	__asm __volatile("\
 	    mfmsr %0; \
 	    mr %1, %0; \
@@ -181,8 +184,8 @@ TLBIE(uint64_t vpn) {
 	    ptesync;" 
 	: "=r"(msr), "=r"(scratch) : "r"(vpn_hi), "r"(vpn_lo), "r"(32), "r"(1)
 	    : "memory");
-#endif
 	mtx_unlock_spin(&tlbie_mutex);
+#endif
 }
 
 #define DISABLE_TRANS(msr)	msr = mfmsr(); mtmsr(msr & ~PSL_DR)
@@ -413,7 +416,11 @@ moea64_bootstrap_native(mmu_t mmup, vm_o
 	/*
 	 * Initialize the TLBIE lock. TLBIE can only be executed by one CPU.
 	 */
-	mtx_init(&tlbie_mutex, "tlbie mutex", NULL, MTX_SPIN);
+#ifdef __powerpc64__
+	mtx_init(&tlbie_mutex, "tlbie", NULL, MTX_DEF);
+#else
+	mtx_init(&tlbie_mutex, "tlbie", NULL, MTX_SPIN);
+#endif
 
 	moea64_mid_bootstrap(mmup, kernelstart, kernelend);
 

From owner-svn-src-head@FreeBSD.ORG  Sun Mar 25 09:18:35 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id A392F106564A;
	Sun, 25 Mar 2012 09:18:35 +0000 (UTC)
	(envelope-from joel@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 8B3CC8FC18;
	Sun, 25 Mar 2012 09:18:35 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2P9IZU2073029;
	Sun, 25 Mar 2012 09:18:35 GMT (envelope-from joel@svn.freebsd.org)
Received: (from joel@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2P9IZKQ073014;
	Sun, 25 Mar 2012 09:18:35 GMT (envelope-from joel@svn.freebsd.org)
Message-Id: <201203250918.q2P9IZKQ073014@svn.freebsd.org>
From: Joel Dahl 
Date: Sun, 25 Mar 2012 09:18:35 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233455 - in head/usr.sbin: boot0cfg
	bsnmpd/modules/snmp_netgraph bsnmpd/tools/bsnmptools ctladm
	ifmcstat mfiutil mptutil mtest mtree nfsd ntp/doc utx ypserv
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sun, 25 Mar 2012 09:18:35 -0000

Author: joel (doc committer)
Date: Sun Mar 25 09:18:34 2012
New Revision: 233455
URL: http://svn.freebsd.org/changeset/base/233455

Log:
  Remove superfluous paragraph macro.

Modified:
  head/usr.sbin/boot0cfg/boot0cfg.8
  head/usr.sbin/bsnmpd/modules/snmp_netgraph/snmp_netgraph.3
  head/usr.sbin/bsnmpd/tools/bsnmptools/bsnmpget.1
  head/usr.sbin/ctladm/ctladm.8
  head/usr.sbin/ifmcstat/ifmcstat.8
  head/usr.sbin/mfiutil/mfiutil.8
  head/usr.sbin/mptutil/mptutil.8
  head/usr.sbin/mtest/mtest.8
  head/usr.sbin/mtree/mtree.5
  head/usr.sbin/nfsd/nfsv4.4
  head/usr.sbin/ntp/doc/ntp-keygen.8
  head/usr.sbin/ntp/doc/ntpdate.8
  head/usr.sbin/utx/utx.8
  head/usr.sbin/ypserv/ypserv.8

Modified: head/usr.sbin/boot0cfg/boot0cfg.8
==============================================================================
--- head/usr.sbin/boot0cfg/boot0cfg.8	Sun Mar 25 06:01:34 2012	(r233454)
+++ head/usr.sbin/boot0cfg/boot0cfg.8	Sun Mar 25 09:18:34 2012	(r233455)
@@ -184,7 +184,6 @@ To go back to non-interactive booting, u
 to install the default MBR:
 .Pp
 .Dl "fdisk -B ad0"
-.Pp
 .Sh SEE ALSO
 .Xr geom 4 ,
 .Xr boot 8 ,

Modified: head/usr.sbin/bsnmpd/modules/snmp_netgraph/snmp_netgraph.3
==============================================================================
--- head/usr.sbin/bsnmpd/modules/snmp_netgraph/snmp_netgraph.3	Sun Mar 25 06:01:34 2012	(r233454)
+++ head/usr.sbin/bsnmpd/modules/snmp_netgraph/snmp_netgraph.3	Sun Mar 25 09:18:34 2012	(r233455)
@@ -283,7 +283,6 @@ The function
 .Fn ng_unregister_module
 removes all control and data registrations for that module.
 .Ss FINDING NODES AND NODE CHARACTERISTICS
-.Pp
 The function
 .Fn ng_node_id
 returns the id of the node addressed by

Modified: head/usr.sbin/bsnmpd/tools/bsnmptools/bsnmpget.1
==============================================================================
--- head/usr.sbin/bsnmpd/tools/bsnmptools/bsnmpget.1	Sun Mar 25 06:01:34 2012	(r233454)
+++ head/usr.sbin/bsnmpd/tools/bsnmptools/bsnmpget.1	Sun Mar 25 09:18:34 2012	(r233455)
@@ -121,7 +121,6 @@ constructs a SMNP SetRequest packet, fil
 syntaxes and values of the objects whose values are to be set and waits for a
 response from server.
 .Sh OPTIONS
-.Pp
 The options are as follows (not all apply to all three programs):
 .Bl -tag -width ".It Fl D Ar options"
 .It Fl A Ar options

Modified: head/usr.sbin/ctladm/ctladm.8
==============================================================================
--- head/usr.sbin/ctladm/ctladm.8	Sun Mar 25 06:01:34 2012	(r233454)
+++ head/usr.sbin/ctladm/ctladm.8	Sun Mar 25 09:18:34 2012	(r233455)
@@ -227,7 +227,6 @@ Specify the target (almost always 0) and
 Many of the primary functions of the
 .Nm
 utility take the following optional arguments:
-.Pp
 .Bl -tag -width 10n
 .It Fl C Ar retries
 Specify the number of times to retry a command in the event of failure.
@@ -905,7 +904,6 @@ Display the list of mode pages supported
 Display the saved version of the Control mode page (page 10) on LUN 0.
 Disable fetching block descriptors, and use a 10 byte MODE SENSE command
 instead of the default 6 byte command.
-.Pp
 .Bd -literal
 ctladm read 0:2 -l 0 -d 1 -b 512 -f - > foo
 .Ed
@@ -966,7 +964,6 @@ ioctl port.
 .Pp
 Inject a medium error on LUN 6 for every read that covers the first 512
 blocks of the LUN.
-.Pp
 .Bd -literal -offset indent
 ctladm inject 0:6 -i custom -p tur -s 18 "f0 0 02 s12 04 02"
 .Ed

Modified: head/usr.sbin/ifmcstat/ifmcstat.8
==============================================================================
--- head/usr.sbin/ifmcstat/ifmcstat.8	Sun Mar 25 06:01:34 2012	(r233454)
+++ head/usr.sbin/ifmcstat/ifmcstat.8	Sun Mar 25 09:18:34 2012	(r233455)
@@ -123,7 +123,6 @@ support, the information displayed by
 is more limited.
 This support is recommended for debugging purposes.
 It requires super-user privilege if used to inspect a running kernel.
-.Pp
 .Sh SEE ALSO
 .Xr netstat 1 ,
 .Xr getifaddrs 3 ,

Modified: head/usr.sbin/mfiutil/mfiutil.8
==============================================================================
--- head/usr.sbin/mfiutil/mfiutil.8	Sun Mar 25 06:01:34 2012	(r233454)
+++ head/usr.sbin/mfiutil/mfiutil.8	Sun Mar 25 09:18:34 2012	(r233455)
@@ -597,7 +597,6 @@ Configure the adapter to run periodic pa
 patrol read starting in 5 minutes:
 .Pp
 .Dl Nm Cm patrol auto 604800 300
-.Pp
 .Sh SEE ALSO
 .Xr mfi 4
 .Sh HISTORY

Modified: head/usr.sbin/mptutil/mptutil.8
==============================================================================
--- head/usr.sbin/mptutil/mptutil.8	Sun Mar 25 06:01:34 2012	(r233454)
+++ head/usr.sbin/mptutil/mptutil.8	Sun Mar 25 09:18:34 2012	(r233455)
@@ -354,7 +354,6 @@ The
 utility first appeared in
 .Fx 8.0 .
 .Sh BUGS
-.Pp
 The handling of spare drives appears to be unreliable.
 The
 .Xr mpt 4

Modified: head/usr.sbin/mtest/mtest.8
==============================================================================
--- head/usr.sbin/mtest/mtest.8	Sun Mar 25 06:01:34 2012	(r233454)
+++ head/usr.sbin/mtest/mtest.8	Sun Mar 25 09:18:34 2012	(r233455)
@@ -159,7 +159,6 @@ name rather than an interface address.
 For IPv4, the program will perform
 a lookup of the primary IP address based on the interface name.
 This may fail if no primary IP address is assigned.
-.Pp
 .Sh SEE ALSO
 .Rs
 .%A D. Thaler

Modified: head/usr.sbin/mtree/mtree.5
==============================================================================
--- head/usr.sbin/mtree/mtree.5	Sun Mar 25 06:01:34 2012	(r233454)
+++ head/usr.sbin/mtree/mtree.5	Sun Mar 25 09:18:34 2012	(r233455)
@@ -223,7 +223,6 @@ symbolic link
 socket
 .El
 .El
-.Pp
 .Sh SEE ALSO
 .Xr cksum 1 ,
 .Xr find 1 ,

Modified: head/usr.sbin/nfsd/nfsv4.4
==============================================================================
--- head/usr.sbin/nfsd/nfsv4.4	Sun Mar 25 06:01:34 2012	(r233454)
+++ head/usr.sbin/nfsd/nfsv4.4	Sun Mar 25 09:18:34 2012	(r233455)
@@ -152,7 +152,6 @@ However, if you run
 with RPCSEC_GSS (sec=krb5, krb5i, krb5p), only names and KerberosV tickets
 will go on the wire.
 .Sh SERVER SETUP
-.Pp
 To set up the NFS server that supports
 .Nm ,
 you will need to either set the variables in
@@ -219,7 +218,6 @@ must be specified in the kernel's
 .Xr config 5
 file.
 .Sh CLIENT MOUNTS
-.Pp
 To do an
 .Nm
 mount, specify the ``nfsv4'' option on the

Modified: head/usr.sbin/ntp/doc/ntp-keygen.8
==============================================================================
--- head/usr.sbin/ntp/doc/ntp-keygen.8	Sun Mar 25 06:01:34 2012	(r233454)
+++ head/usr.sbin/ntp/doc/ntp-keygen.8	Sun Mar 25 09:18:34 2012	(r233455)
@@ -197,7 +197,6 @@ It is convenient to designate the owner 
 as the subject and issuer fields, respectively, of the certificate.
 The owner name is also used for the host and sign key files,
 while the trusted name is used for the identity files.
-.Pp
 .Ss Trusted Hosts and Groups
 Each cryptographic configuration involves selection of a signature scheme
 and identification scheme, called a cryptotype,

Modified: head/usr.sbin/ntp/doc/ntpdate.8
==============================================================================
--- head/usr.sbin/ntp/doc/ntpdate.8	Sun Mar 25 06:01:34 2012	(r233454)
+++ head/usr.sbin/ntp/doc/ntpdate.8	Sun Mar 25 09:18:34 2012	(r233455)
@@ -18,7 +18,6 @@
 .Op Fl t Ar timeout
 .Ar server ...
 .Sh DESCRIPTION
-.Pp
 .Em Note :
 The functionality of this program is now available
 in the

Modified: head/usr.sbin/utx/utx.8
==============================================================================
--- head/usr.sbin/utx/utx.8	Sun Mar 25 06:01:34 2012	(r233454)
+++ head/usr.sbin/utx/utx.8	Sun Mar 25 09:18:34 2012	(r233455)
@@ -89,7 +89,6 @@ by using the
 command.
 .El
 .Pp
-.Pp
 Because this utility requires write-access to the user accounting
 database, its use is limited to the super-user.
 .Sh SEE ALSO

Modified: head/usr.sbin/ypserv/ypserv.8
==============================================================================
--- head/usr.sbin/ypserv/ypserv.8	Sun Mar 25 06:01:34 2012	(r233454)
+++ head/usr.sbin/ypserv/ypserv.8	Sun Mar 25 09:18:34 2012	(r233455)
@@ -220,7 +220,6 @@ clients to perform user
 authentication through
 .Tn NIS .
 .El
-.Pp
 .Ss Security
 In general, any remote user can issue an RPC to
 .Nm
@@ -292,7 +291,6 @@ security, they, like the privileged port
 to
 .Dq IP spoofing
 attacks.
-.Pp
 .Ss NIS v1 compatibility
 This version of
 .Nm

From owner-svn-src-head@FreeBSD.ORG  Sun Mar 25 09:19:26 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id A5B261065677;
	Sun, 25 Mar 2012 09:19:26 +0000 (UTC)
	(envelope-from joel@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 873AD8FC25;
	Sun, 25 Mar 2012 09:19:26 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2P9JQjT073103;
	Sun, 25 Mar 2012 09:19:26 GMT (envelope-from joel@svn.freebsd.org)
Received: (from joel@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2P9JQDX073092;
	Sun, 25 Mar 2012 09:19:26 GMT (envelope-from joel@svn.freebsd.org)
Message-Id: <201203250919.q2P9JQDX073092@svn.freebsd.org>
From: Joel Dahl 
Date: Sun, 25 Mar 2012 09:19:26 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233456 - in head/usr.bin: calendar find indent jot
	rctl setchannel tr unifdef unzip vgrind
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sun, 25 Mar 2012 09:19:26 -0000

Author: joel (doc committer)
Date: Sun Mar 25 09:19:25 2012
New Revision: 233456
URL: http://svn.freebsd.org/changeset/base/233456

Log:
  Remove superfluous paragraph macro.

Modified:
  head/usr.bin/calendar/calendar.1
  head/usr.bin/find/find.1
  head/usr.bin/indent/indent.1
  head/usr.bin/jot/jot.1
  head/usr.bin/rctl/rctl.8
  head/usr.bin/setchannel/setchannel.1
  head/usr.bin/tr/tr.1
  head/usr.bin/unifdef/unifdef.1
  head/usr.bin/unzip/unzip.1
  head/usr.bin/vgrind/vgrindefs.5

Modified: head/usr.bin/calendar/calendar.1
==============================================================================
--- head/usr.bin/calendar/calendar.1	Sun Mar 25 09:18:34 2012	(r233455)
+++ head/usr.bin/calendar/calendar.1	Sun Mar 25 09:19:25 2012	(r233456)
@@ -113,7 +113,6 @@ days (forward, future).
 Ignore weekends when calculating the number of days.
 .El
 .Sh FILE FORMAT
-.Pp
 To handle calendars in your national code table you can specify
 .Dq LANG=
 in the calendar file as early as possible.

Modified: head/usr.bin/find/find.1
==============================================================================
--- head/usr.bin/find/find.1	Sun Mar 25 09:18:34 2012	(r233455)
+++ head/usr.bin/find/find.1	Sun Mar 25 09:19:25 2012	(r233456)
@@ -177,7 +177,6 @@ This option is equivalent to the depreca
 primary.
 .El
 .Sh PRIMARIES
-.Pp
 All primaries which take a numeric argument allow the number to be
 preceded by a plus sign
 .Pq Dq Li +

Modified: head/usr.bin/indent/indent.1
==============================================================================
--- head/usr.bin/indent/indent.1	Sun Mar 25 09:18:34 2012	(r233455)
+++ head/usr.bin/indent/indent.1	Sun Mar 25 09:19:25 2012	(r233456)
@@ -488,7 +488,6 @@ The
 utility fits as many words (separated by blanks, tabs, or newlines) on a
 line as possible.
 Blank lines break paragraphs.
-.Pp
 .Ss Comment indentation
 If a comment is on a line with code it is started in the `comment column',
 which is set by the
@@ -504,7 +503,6 @@ command line parameter.
 If the code on a line extends past the comment
 column, the comment starts further to the right, and the right margin may be
 automatically extended in extreme cases.
-.Pp
 .Ss Preprocessor lines
 In general,
 .Nm
@@ -519,7 +517,6 @@ is recognized and
 .Nm
 attempts to correctly
 compensate for the syntactic peculiarities introduced.
-.Pp
 .Ss C syntax
 The
 .Nm

Modified: head/usr.bin/jot/jot.1
==============================================================================
--- head/usr.bin/jot/jot.1	Sun Mar 25 09:18:34 2012	(r233455)
+++ head/usr.bin/jot/jot.1	Sun Mar 25 09:19:25 2012	(r233456)
@@ -242,7 +242,6 @@ specifying an integer format:
 .Bd -literal -offset indent
 $ jot -w %d 6 1 10 0.5
 .Ed
-.Pp
 .Sh EXIT STATUS
 .Ex -std
 .Sh EXAMPLES

Modified: head/usr.bin/rctl/rctl.8
==============================================================================
--- head/usr.bin/rctl/rctl.8	Sun Mar 25 09:18:34 2012	(r233455)
+++ head/usr.bin/rctl/rctl.8	Sun Mar 25 09:19:25 2012	(r233456)
@@ -119,7 +119,6 @@ or, in short, ":".
 A filter that matches all the login classes would be "loginclass:".
 A filter that matches all defined rules for maxproc resource would be
 "::maxproc".
-.Pp
 .Sh RESOURCES
 .Bl -column -offset 3n "pseudoterminals"
 .It "cputime		CPU time, in seconds"

Modified: head/usr.bin/setchannel/setchannel.1
==============================================================================
--- head/usr.bin/setchannel/setchannel.1	Sun Mar 25 09:18:34 2012	(r233455)
+++ head/usr.bin/setchannel/setchannel.1	Sun Mar 25 09:19:25 2012	(r233456)
@@ -33,7 +33,6 @@
 .Nd Hauppage PVR250/350 channel selector
 .Sh SYNOPSIS
 .Cd pvr250-setchannel [-a {on | off}] [-c | -r | -s | -t] [-g geom] [-m channel_set] [channel | freq]
-.Pp
 .Sh DESCRIPTION
 .Nm
 provides support for selecting channels on Hauppauge WinTV cards,

Modified: head/usr.bin/tr/tr.1
==============================================================================
--- head/usr.bin/tr/tr.1	Sun Mar 25 09:18:34 2012	(r233455)
+++ head/usr.bin/tr/tr.1	Sun Mar 25 09:19:25 2012	(r233456)
@@ -145,7 +145,6 @@ the octal sequence to the full 3 octal d
 .It \echaracter
 A backslash followed by certain special characters maps to special
 values.
-.Pp
 .Bl -column "\ea"
 .It "\ea	
 .It "\eb	
@@ -177,7 +176,6 @@ previous implementations.
 .It [:class:]
 Represents all characters belonging to the defined character class.
 Class names are:
-.Pp
 .Bl -column "phonogram"
 .It "alnum	
 .It "alpha	

Modified: head/usr.bin/unifdef/unifdef.1
==============================================================================
--- head/usr.bin/unifdef/unifdef.1	Sun Mar 25 09:18:34 2012	(r233455)
+++ head/usr.bin/unifdef/unifdef.1	Sun Mar 25 09:19:25 2012	(r233456)
@@ -164,7 +164,6 @@ then invokes
 .Nm
 with appropriate arguments to process the file.
 .Sh OPTIONS
-.Pp
 .Bl -tag -width indent -compact
 .It Fl D Ns Ar sym Ns = Ns Ar val
 Specify that a symbol is defined to a given value

Modified: head/usr.bin/unzip/unzip.1
==============================================================================
--- head/usr.bin/unzip/unzip.1	Sun Mar 25 09:18:34 2012	(r233455)
+++ head/usr.bin/unzip/unzip.1	Sun Mar 25 09:19:25 2012	(r233456)
@@ -38,7 +38,6 @@
 .Ar zipfile
 .Sh DESCRIPTION
 .\" ...
-.Pp
 The following options are available:
 .Bl -tag -width Fl
 .It Fl a

Modified: head/usr.bin/vgrind/vgrindefs.5
==============================================================================
--- head/usr.bin/vgrind/vgrindefs.5	Sun Mar 25 09:18:34 2012	(r233455)
+++ head/usr.bin/vgrind/vgrindefs.5	Sun Mar 25 09:19:25 2012	(r233456)
@@ -48,7 +48,6 @@ very similar to
 .Xr termcap 5 .
 .Sh FIELDS
 The following table names and describes each field.
-.Pp
 .Bl -column Namexxx Tpexxx
 .It Sy "Name	Type	Description
 .It "ab	str	regular expression for the start of an alternate comment"

From owner-svn-src-head@FreeBSD.ORG  Sun Mar 25 09:20:15 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 7AED11065672;
	Sun, 25 Mar 2012 09:20:15 +0000 (UTC)
	(envelope-from joel@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 4C54E8FC1E;
	Sun, 25 Mar 2012 09:20:15 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2P9KFOP073177;
	Sun, 25 Mar 2012 09:20:15 GMT (envelope-from joel@svn.freebsd.org)
Received: (from joel@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2P9KFMB073172;
	Sun, 25 Mar 2012 09:20:15 GMT (envelope-from joel@svn.freebsd.org)
Message-Id: <201203250920.q2P9KFMB073172@svn.freebsd.org>
From: Joel Dahl 
Date: Sun, 25 Mar 2012 09:20:15 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233457 - in head/bin: kenv pwait sh stty
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sun, 25 Mar 2012 09:20:15 -0000

Author: joel (doc committer)
Date: Sun Mar 25 09:20:14 2012
New Revision: 233457
URL: http://svn.freebsd.org/changeset/base/233457

Log:
  Remove superfluous paragraph macro.

Modified:
  head/bin/kenv/kenv.1
  head/bin/pwait/pwait.1
  head/bin/sh/sh.1
  head/bin/stty/stty.1

Modified: head/bin/kenv/kenv.1
==============================================================================
--- head/bin/kenv/kenv.1	Sun Mar 25 09:19:25 2012	(r233456)
+++ head/bin/kenv/kenv.1	Sun Mar 25 09:20:14 2012	(r233457)
@@ -84,7 +84,6 @@ everything after a '#' character, are ig
 character except '=' is acceptable as part of a name.  Quotes
 are optional and necessary only if the value contains
 whitespace.
-.Pp
 .Sh SEE ALSO
 .Xr kenv 2 ,
 .Xr config 5 ,

Modified: head/bin/pwait/pwait.1
==============================================================================
--- head/bin/pwait/pwait.1	Sun Mar 25 09:19:25 2012	(r233456)
+++ head/bin/pwait/pwait.1	Sun Mar 25 09:20:14 2012	(r233457)
@@ -54,7 +54,6 @@ The following option is available:
 Print the exit status when each process terminates.
 .El
 .Sh DIAGNOSTICS
-.Pp
 The
 .Nm
 utility returns 0 on success, and >0 if an error occurs.

Modified: head/bin/sh/sh.1
==============================================================================
--- head/bin/sh/sh.1	Sun Mar 25 09:19:25 2012	(r233456)
+++ head/bin/sh/sh.1	Sun Mar 25 09:20:14 2012	(r233457)
@@ -1027,7 +1027,6 @@ or
 .Pp
 The first form executes the commands in a subshell environment.
 A subshell environment has its own copy of:
-.Pp
 .Bl -enum
 .It
 The current working directory as set by

Modified: head/bin/stty/stty.1
==============================================================================
--- head/bin/stty/stty.1	Sun Mar 25 09:19:25 2012	(r233456)
+++ head/bin/stty/stty.1	Sun Mar 25 09:20:14 2012	(r233457)
@@ -90,7 +90,6 @@ to restore the current terminal state as
 The following arguments are available to set the terminal
 characteristics:
 .Ss Control Modes:
-.Pp
 Control mode flags affect hardware characteristics associated with the
 terminal.
 This corresponds to the c_cflag in the termios structure.
@@ -256,7 +255,6 @@ Do not (do) output CRs at column zero.
 On the terminal NL performs (does not perform) the CR function.
 .El
 .Ss Local Modes:
-.Pp
 Local mode flags (lflags) affect various and sundry characteristics of terminal
 processing.
 Historically the term "local" pertained to new job control features
@@ -513,7 +511,6 @@ The size of the terminal is printed as t
 first rows, then columns.
 .El
 .Ss Compatibility Modes:
-.Pp
 These modes remain for compatibility with the previous version of
 the
 .Nm

From owner-svn-src-head@FreeBSD.ORG  Sun Mar 25 09:21:10 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id A3A841065676;
	Sun, 25 Mar 2012 09:21:10 +0000 (UTC)
	(envelope-from joel@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 8C0958FC14;
	Sun, 25 Mar 2012 09:21:10 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2P9LA9F073250;
	Sun, 25 Mar 2012 09:21:10 GMT (envelope-from joel@svn.freebsd.org)
Received: (from joel@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2P9LAWp073240;
	Sun, 25 Mar 2012 09:21:10 GMT (envelope-from joel@svn.freebsd.org)
Message-Id: <201203250921.q2P9LAWp073240@svn.freebsd.org>
From: Joel Dahl 
Date: Sun, 25 Mar 2012 09:21:10 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233458 - in head/sbin: camcontrol geom/class/eli
	geom/class/multipath geom/class/sched gvinum ipfw kldload
	route setkey
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sun, 25 Mar 2012 09:21:10 -0000

Author: joel (doc committer)
Date: Sun Mar 25 09:21:09 2012
New Revision: 233458
URL: http://svn.freebsd.org/changeset/base/233458

Log:
  Remove superfluous paragraph macro.

Modified:
  head/sbin/camcontrol/camcontrol.8
  head/sbin/geom/class/eli/geli.8
  head/sbin/geom/class/multipath/gmultipath.8
  head/sbin/geom/class/sched/gsched.8
  head/sbin/gvinum/gvinum.8
  head/sbin/ipfw/ipfw.8
  head/sbin/kldload/kldload.8
  head/sbin/route/route.8
  head/sbin/setkey/setkey.8

Modified: head/sbin/camcontrol/camcontrol.8
==============================================================================
--- head/sbin/camcontrol/camcontrol.8	Sun Mar 25 09:20:14 2012	(r233457)
+++ head/sbin/camcontrol/camcontrol.8	Sun Mar 25 09:21:09 2012	(r233458)
@@ -1228,7 +1228,6 @@ camcontrol negotiate -n da -u 3 -R 20.00
 Negotiate a sync rate of 20MHz and an offset of 15 with da3.
 Then send a
 Test Unit Ready command to make the settings take effect.
-.Pp
 .Bd -literal -offset indent
 camcontrol smpcmd ses0 -v -r 4 "40 0 00 0" -R 1020 "s9 i1"
 .Ed

Modified: head/sbin/geom/class/eli/geli.8
==============================================================================
--- head/sbin/geom/class/eli/geli.8	Sun Mar 25 09:20:14 2012	(r233457)
+++ head/sbin/geom/class/eli/geli.8	Sun Mar 25 09:21:09 2012	(r233458)
@@ -946,7 +946,6 @@ block cipher is implemented by Yoshisato
 Highest
 .Nm GELI
 metadata version supported by the given FreeBSD version:
-.Pp
 .Bl -column -offset indent ".Sy FreeBSD" ".Sy version"
 .It Sy FreeBSD Ta Sy GELI
 .It Sy version Ta Sy version
@@ -969,6 +968,5 @@ metadata version supported by the given 
 .Pp
 .It Li 9.0 Ta 6
 .El
-.Pp
 .Sh AUTHORS
 .An Pawel Jakub Dawidek Aq pjd@FreeBSD.org

Modified: head/sbin/geom/class/multipath/gmultipath.8
==============================================================================
--- head/sbin/geom/class/multipath/gmultipath.8	Sun Mar 25 09:20:14 2012	(r233457)
+++ head/sbin/geom/class/multipath/gmultipath.8	Sun Mar 25 09:21:09 2012	(r233458)
@@ -176,7 +176,6 @@ See
 See
 .Xr geom 8 .
 .El
-.Pp
 .Sh SYSCTL VARIABLES
 The following
 .Xr sysctl 8
@@ -196,7 +195,6 @@ Open underlying providers exclusively, p
 .Sh EXIT STATUS
 Exit status is 0 on success, and 1 if the command fails.
 .Sh MULTIPATH ARCHITECTURE
-.Pp
 This is a multiple path architecture with no device knowledge or
 presumptions other than size matching built in.
 Therefore the user must exercise some care

Modified: head/sbin/geom/class/sched/gsched.8
==============================================================================
--- head/sbin/geom/class/sched/gsched.8	Sun Mar 25 09:20:14 2012	(r233457)
+++ head/sbin/geom/class/sched/gsched.8	Sun Mar 25 09:21:09 2012	(r233458)
@@ -149,7 +149,6 @@ geom sched insert -a rr ad0
 # Remove the scheduler on the device:
 geom sched destroy -v ad0.sched.
 .Ed
-.Pp
 .Sh SEE ALSO
 .Xr geom 4 ,
 .Xr geom 8

Modified: head/sbin/gvinum/gvinum.8
==============================================================================
--- head/sbin/gvinum/gvinum.8	Sun Mar 25 09:20:14 2012	(r233457)
+++ head/sbin/gvinum/gvinum.8	Sun Mar 25 09:21:09 2012	(r233458)
@@ -356,7 +356,6 @@ command.
 .Pp
 For a more advanced usage and detailed explanation of gvinum, the
 handbook is recommended.
-.Pp
 .Sh SEE ALSO
 .Xr geom 4 ,
 .Xr geom 8

Modified: head/sbin/ipfw/ipfw.8
==============================================================================
--- head/sbin/ipfw/ipfw.8	Sun Mar 25 09:20:14 2012	(r233457)
+++ head/sbin/ipfw/ipfw.8	Sun Mar 25 09:21:09 2012	(r233458)
@@ -40,14 +40,12 @@ in-kernel NAT.
 .Nm
 .Cm set show
 .Ss SYSCTL SHORTCUTS
-.Pp
 .Nm
 .Cm enable
 .Brq Cm firewall | altq | one_pass | debug | verbose | dyn_keepalive
 .Nm
 .Cm disable
 .Brq Cm firewall | altq | one_pass | debug | verbose | dyn_keepalive
-.Pp
 .Ss LOOKUP TABLES
 .Nm
 .Cm table Ar number Cm add Ar addr Ns Oo / Ns Ar masklen Oc Op Ar value
@@ -61,7 +59,6 @@ in-kernel NAT.
 .Cm table
 .Brq Ar number | all
 .Cm list
-.Pp
 .Ss DUMMYNET CONFIGURATION (TRAFFIC SHAPER AND PACKET SCHEDULER)
 .Nm
 .Brq Cm pipe | queue | sched
@@ -73,7 +70,6 @@ in-kernel NAT.
 .Brq Cm pipe | queue | sched
 .Brq Cm delete | list | show
 .Op Ar number ...
-.Pp
 .Ss IN-KERNEL NAT
 .Nm
 .Op Fl q
@@ -285,7 +281,6 @@ When listing, show last match timestamp 
 When listing, show last match timestamp as seconds from the epoch.
 This form can be more convenient for postprocessing by scripts.
 .El
-.Pp
 .Ss LIST OF RULES AND PREPROCESSING
 To ease configuration, rules can be put into a file which is
 processed using
@@ -325,7 +320,6 @@ for interpretation.
 This allows for flexible configuration files (like conditionalizing
 them on the local hostname) and the use of macros to centralize
 frequently required arguments like IP addresses.
-.Pp
 .Ss TRAFFIC SHAPER CONFIGURATION
 The
 .Nm
@@ -884,7 +878,6 @@ for readability.
 A workaround for this is to use new syntax and
 .Fl c
 switch:
-.Pp
 .Bd -literal -offset indent
 # Add a rule without actual body
 ipfw add 2999 return via any
@@ -2471,7 +2464,6 @@ If no socket is bound to the destination
 not loaded, or if the kernel was not compiled with divert socket support,
 the packets are dropped.
 .Sh NETWORK ADDRESS TRANSLATION (NAT)
-.Pp
 .Nm
 support in-kernel NAT using the kernel version of
 .Xr libalias 3 .
@@ -2869,7 +2861,6 @@ Controls whether bridged packets are pas
 .Nm .
 Default is no.
 .El
-.Pp
 .Sh EXAMPLES
 There are far too many possible uses of
 .Nm
@@ -3007,7 +2998,6 @@ Next rule diverts all incoming packets f
 to divert port 5000:
 .Pp
 .Dl ipfw divert 5000 ip from 192.168.2.0/24 to any in
-.Pp
 .Ss TRAFFIC SHAPING
 The following rules show some of the applications of
 .Nm
@@ -3224,7 +3214,6 @@ or it could be split in:
 .Dl "				         10.0.0.100"
 .Dl "ipfw nat 5 config redirect_port tcp"
 .Dl "			192.168.0.1:80,192.168.0.10:22,192.168.0.20:25 500"
-.Pp
 .Sh SEE ALSO
 .Xr cpp 1 ,
 .Xr m4 1 ,

Modified: head/sbin/kldload/kldload.8
==============================================================================
--- head/sbin/kldload/kldload.8	Sun Mar 25 09:20:14 2012	(r233457)
+++ head/sbin/kldload/kldload.8	Sun Mar 25 09:21:09 2012	(r233458)
@@ -70,7 +70,6 @@ Be more verbose.
 Silence any extraneous warnings.
 .El
 .Sh NOTES
-.Pp
 The kernel security level settings may prevent a module from being
 loaded or unloaded by giving
 .Em "Operation not permitted" .

Modified: head/sbin/route/route.8
==============================================================================
--- head/sbin/route/route.8	Sun Mar 25 09:20:14 2012	(r233457)
+++ head/sbin/route/route.8	Sun Mar 25 09:21:09 2012	(r233458)
@@ -378,7 +378,6 @@ Delete a static route from the routing t
 Remove all routes from the routing table:
 .Pp
 .Dl route flush
-.Pp
 .Sh DIAGNOSTICS
 .Bl -diag
 .It "add [host \&| network ] %s: gateway %s flags %x"

Modified: head/sbin/setkey/setkey.8
==============================================================================
--- head/sbin/setkey/setkey.8	Sun Mar 25 09:20:14 2012	(r233457)
+++ head/sbin/setkey/setkey.8	Sun Mar 25 09:21:09 2012	(r233458)
@@ -567,7 +567,6 @@ See
 .Xr ipsec_set_policy 3
 for details.
 .El
-.Pp
 .\"
 .Sh ALGORITHMS
 The following list shows the supported algorithms.

From owner-svn-src-head@FreeBSD.ORG  Sun Mar 25 09:23:11 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 1385D1065670;
	Sun, 25 Mar 2012 09:23:11 +0000 (UTC)
	(envelope-from joel@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id F34D88FC0A;
	Sun, 25 Mar 2012 09:23:10 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2P9NATH073356;
	Sun, 25 Mar 2012 09:23:10 GMT (envelope-from joel@svn.freebsd.org)
Received: (from joel@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2P9NALH073354;
	Sun, 25 Mar 2012 09:23:10 GMT (envelope-from joel@svn.freebsd.org)
Message-Id: <201203250923.q2P9NALH073354@svn.freebsd.org>
From: Joel Dahl 
Date: Sun, 25 Mar 2012 09:23:10 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233459 - head/share/termcap
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sun, 25 Mar 2012 09:23:11 -0000

Author: joel (doc committer)
Date: Sun Mar 25 09:23:10 2012
New Revision: 233459
URL: http://svn.freebsd.org/changeset/base/233459

Log:
  Remove superfluous paragraph macro.

Modified:
  head/share/termcap/termcap.5

Modified: head/share/termcap/termcap.5
==============================================================================
--- head/share/termcap/termcap.5	Sun Mar 25 09:21:09 2012	(r233458)
+++ head/share/termcap/termcap.5	Sun Mar 25 09:23:10 2012	(r233459)
@@ -1157,7 +1157,6 @@ These are primarily useful if the termin
 .Sy \&cm ,
 such as the Tektronix 4025.
 .Ss Cursor Motions
-.Pp
 If the terminal has a fast way to home the cursor
 (to the very upper left corner of the screen), this can be given as
 .Sy \&ho .

From owner-svn-src-head@FreeBSD.ORG  Sun Mar 25 10:59:34 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id E665910657C2;
	Sun, 25 Mar 2012 10:59:34 +0000 (UTC) (envelope-from slw@zxy.spb.ru)
Received: from zxy.spb.ru (zxy.spb.ru [195.70.199.98])
	by mx1.freebsd.org (Postfix) with ESMTP id 20EB58FC18;
	Sun, 25 Mar 2012 10:59:33 +0000 (UTC)
Received: from slw by zxy.spb.ru with local (Exim 4.69 (FreeBSD))
	(envelope-from )
	id 1SBlB0-000BcE-HR; Sun, 25 Mar 2012 14:59:58 +0400
Date: Sun, 25 Mar 2012 14:59:58 +0400
From: Slawa Olhovchenkov 
To: Stanislav Sedov 
Message-ID: <20120325105958.GB61230@zxy.spb.ru>
References: <201203220848.q2M8mia8015593@svn.freebsd.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <201203220848.q2M8mia8015593@svn.freebsd.org>
User-Agent: Mutt/1.5.21 (2010-09-15)
X-SA-Exim-Connect-IP: 
X-SA-Exim-Mail-From: slw@zxy.spb.ru
X-SA-Exim-Scanned: No (on zxy.spb.ru); SAEximRunCond expanded to false
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r233294 - in head: . contrib/com_err crypto/heimdal
 crypto/heimdal/admin crypto/heimdal/appl crypto/heimdal/appl/afsutil
 crypto/heimdal/appl/ftp crypto/heimdal/appl/ftp/common crypto/he...
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sun, 25 Mar 2012 10:59:35 -0000

On Thu, Mar 22, 2012 at 08:48:44AM +0000, Stanislav Sedov wrote:

>   - Heimdal's KDC now require sqlite to operate.  We use the bundled version
>     and install it as libheimsqlite.  If some other FreeBSD components will
>     require it in the future we can rename it to libbsdsqlite and use for these
>     components as well.

Can some ports (svn, for example) use this library?

From owner-svn-src-head@FreeBSD.ORG  Sun Mar 25 12:13:25 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 3D34E106564A;
	Sun, 25 Mar 2012 12:13:25 +0000 (UTC)
	(envelope-from joel@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 24F348FC08;
	Sun, 25 Mar 2012 12:13:25 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2PCDPGD081045;
	Sun, 25 Mar 2012 12:13:25 GMT (envelope-from joel@svn.freebsd.org)
Received: (from joel@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2PCDO9j081009;
	Sun, 25 Mar 2012 12:13:24 GMT (envelope-from joel@svn.freebsd.org)
Message-Id: <201203251213.q2PCDO9j081009@svn.freebsd.org>
From: Joel Dahl 
Date: Sun, 25 Mar 2012 12:13:24 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233462 - in head/lib: libc/locale libc/net
	libc/posix1e libc/sys libcrypt libelf libgpib libpmc
	libtacplus msun/man
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sun, 25 Mar 2012 12:13:25 -0000

Author: joel (doc committer)
Date: Sun Mar 25 12:13:24 2012
New Revision: 233462
URL: http://svn.freebsd.org/changeset/base/233462

Log:
  Remove superfluous paragraph macro.

Modified:
  head/lib/libc/locale/iscntrl.3
  head/lib/libc/locale/isdigit.3
  head/lib/libc/locale/isgraph.3
  head/lib/libc/locale/islower.3
  head/lib/libc/locale/isprint.3
  head/lib/libc/locale/ispunct.3
  head/lib/libc/locale/isspace.3
  head/lib/libc/locale/isupper.3
  head/lib/libc/locale/isxdigit.3
  head/lib/libc/locale/xlocale.3
  head/lib/libc/net/inet_net.3
  head/lib/libc/net/nsdispatch.3
  head/lib/libc/net/sctp_getassocid.3
  head/lib/libc/posix1e/acl_to_text.3
  head/lib/libc/sys/cpuset_getaffinity.2
  head/lib/libc/sys/pathconf.2
  head/lib/libc/sys/posix_fadvise.2
  head/lib/libc/sys/posix_fallocate.2
  head/lib/libc/sys/sctp_peeloff.2
  head/lib/libc/sys/shm_open.2
  head/lib/libcrypt/crypt.3
  head/lib/libelf/elf_getphdrnum.3
  head/lib/libelf/elf_getphnum.3
  head/lib/libelf/elf_getshdrnum.3
  head/lib/libelf/elf_getshdrstrndx.3
  head/lib/libelf/elf_getshnum.3
  head/lib/libelf/elf_getshstrndx.3
  head/lib/libgpib/gpib.3
  head/lib/libpmc/pmc.3
  head/lib/libpmc/pmc.k7.3
  head/lib/libpmc/pmc.k8.3
  head/lib/libpmc/pmc.octeon.3
  head/lib/libpmc/pmc.p4.3
  head/lib/libtacplus/libtacplus.3
  head/lib/msun/man/ieee.3

Modified: head/lib/libc/locale/iscntrl.3
==============================================================================
--- head/lib/libc/locale/iscntrl.3	Sun Mar 25 11:42:59 2012	(r233461)
+++ head/lib/libc/locale/iscntrl.3	Sun Mar 25 12:13:24 2012	(r233462)
@@ -57,7 +57,6 @@ or the value of
 .Pp
 In the ASCII character set, this includes the following characters
 (with their numeric values shown in octal):
-.Pp
 .Bl -column \&000_``0''__ \&000_``0''__ \&000_``0''__ \&000_``0''__ \&000_``0''__
 .It "\&000\ NUL \t001\ SOH \t002\ STX \t003\ ETX \t004\ EOT"
 .It "\&005\ ENQ \t006\ ACK \t007\ BEL \t010\ BS \t011\ HT"

Modified: head/lib/libc/locale/isdigit.3
==============================================================================
--- head/lib/libc/locale/isdigit.3	Sun Mar 25 11:42:59 2012	(r233461)
+++ head/lib/libc/locale/isdigit.3	Sun Mar 25 12:13:24 2012	(r233462)
@@ -55,7 +55,6 @@ The
 .Fn isdigit
 function tests for a decimal digit character.
 Regardless of locale, this includes the following characters only:
-.Pp
 .Bl -column \&``0''______ \&``0''______ \&``0''______ \&``0''______ \&``0''______
 .It "\&``0''\t``1''\t``2''\t``3''\t``4''"
 .It "\&``5''\t``6''\t``7''\t``8''\t``9''"

Modified: head/lib/libc/locale/isgraph.3
==============================================================================
--- head/lib/libc/locale/isgraph.3	Sun Mar 25 11:42:59 2012	(r233461)
+++ head/lib/libc/locale/isgraph.3	Sun Mar 25 12:13:24 2012	(r233462)
@@ -58,7 +58,6 @@ or the value of
 .Pp
 In the ASCII character set, this includes the following characters
 (with their numeric values shown in octal):
-.Pp
 .Bl -column \&000_``0''__ \&000_``0''__ \&000_``0''__ \&000_``0''__ \&000_``0''__
 .It "\&041\ ``!'' \t042\ ``""'' \t043\ ``#'' \t044\ ``$'' \t045\ ``%''"
 .It "\&046\ ``&'' \t047\ ``''' \t050\ ``('' \t051\ ``)'' \t052\ ``*''"

Modified: head/lib/libc/locale/islower.3
==============================================================================
--- head/lib/libc/locale/islower.3	Sun Mar 25 11:42:59 2012	(r233461)
+++ head/lib/libc/locale/islower.3	Sun Mar 25 12:13:24 2012	(r233462)
@@ -55,7 +55,6 @@ or the value of
 .Pp
 In the ASCII character set, this includes the following characters
 (with their numeric values shown in octal):
-.Pp
 .Bl -column \&000_``0''__ \&000_``0''__ \&000_``0''__ \&000_``0''__ \&000_``0''__
 .It "\&141\ ``a'' \t142\ ``b'' \t143\ ``c'' \t144\ ``d'' \t145\ ``e''"
 .It "\&146\ ``f'' \t147\ ``g'' \t150\ ``h'' \t151\ ``i'' \t152\ ``j''"

Modified: head/lib/libc/locale/isprint.3
==============================================================================
--- head/lib/libc/locale/isprint.3	Sun Mar 25 11:42:59 2012	(r233461)
+++ head/lib/libc/locale/isprint.3	Sun Mar 25 12:13:24 2012	(r233462)
@@ -56,7 +56,6 @@ or the value of
 .Pp
 In the ASCII character set, this includes the following characters
 (with their numeric values shown in octal):
-.Pp
 .Bl -column \&000_``0''__ \&000_``0''__ \&000_``0''__ \&000_``0''__ \&000_``0''__
 .It "\&040\ sp \t041\ ``!'' \t042\ ``""'' \t043\ ``#'' \t044\ ``$''"
 .It "\&045\ ``%'' \t046\ ``&'' \t047\ ``''' \t050\ ``('' \t051\ ``)''"

Modified: head/lib/libc/locale/ispunct.3
==============================================================================
--- head/lib/libc/locale/ispunct.3	Sun Mar 25 11:42:59 2012	(r233461)
+++ head/lib/libc/locale/ispunct.3	Sun Mar 25 12:13:24 2012	(r233462)
@@ -60,7 +60,6 @@ or the value of
 .Pp
 In the ASCII character set, this includes the following characters
 (with their numeric values shown in octal):
-.Pp
 .Bl -column \&000_``0''__ \&000_``0''__ \&000_``0''__ \&000_``0''__ \&000_``0''__
 .It "\&041\ ``!'' \t042\ ``""'' \t043\ ``#'' \t044\ ``$'' \t045\ ``%''"
 .It "\&046\ ``&'' \t047\ ``''' \t050\ ``('' \t051\ ``)'' \t052\ ``*''"

Modified: head/lib/libc/locale/isspace.3
==============================================================================
--- head/lib/libc/locale/isspace.3	Sun Mar 25 11:42:59 2012	(r233461)
+++ head/lib/libc/locale/isspace.3	Sun Mar 25 12:13:24 2012	(r233462)
@@ -49,7 +49,6 @@ The
 .Fn isspace
 function tests for white-space characters.
 For any locale, this includes the following standard characters:
-.Pp
 .Bl -column \&`\et''___ \&``\et''___ \&``\et''___ \&``\et''___ \&``\et''___ \&``\et''___
 .It "\&``\et''\t``\en''\t``\ev''\t``\ef''\t``\er''\t`` ''"
 .El

Modified: head/lib/libc/locale/isupper.3
==============================================================================
--- head/lib/libc/locale/isupper.3	Sun Mar 25 11:42:59 2012	(r233461)
+++ head/lib/libc/locale/isupper.3	Sun Mar 25 12:13:24 2012	(r233462)
@@ -55,7 +55,6 @@ or the value of
 .Pp
 In the ASCII character set, this includes the following characters
 (with their numeric values shown in octal):
-.Pp
 .Bl -column \&000_``0''__ \&000_``0''__ \&000_``0''__ \&000_``0''__ \&000_``0''__
 .It "\&101\ ``A'' \t102\ ``B'' \t103\ ``C'' \t104\ ``D'' \t105\ ``E''"
 .It "\&106\ ``F'' \t107\ ``G'' \t110\ ``H'' \t111\ ``I'' \t112\ ``J''"

Modified: head/lib/libc/locale/isxdigit.3
==============================================================================
--- head/lib/libc/locale/isxdigit.3	Sun Mar 25 11:42:59 2012	(r233461)
+++ head/lib/libc/locale/isxdigit.3	Sun Mar 25 12:13:24 2012	(r233462)
@@ -51,7 +51,6 @@ The
 .Fn isxdigit
 function tests for any hexadecimal-digit character.
 Regardless of locale, this includes the following characters only:
-.Pp
 .Bl -column \&``0''______ \&``0''______ \&``0''______ \&``0''______ \&``0''______
 .It "\&``0''\t``1''\t``2''\t``3''\t``4''"
 .It "\&``5''\t``6''\t``7''\t``8''\t``9''"

Modified: head/lib/libc/locale/xlocale.3
==============================================================================
--- head/lib/libc/locale/xlocale.3	Sun Mar 25 11:42:59 2012	(r233461)
+++ head/lib/libc/locale/xlocale.3	Sun Mar 25 12:13:24 2012	(r233462)
@@ -118,7 +118,6 @@ which defines
 For reference,
 a complete list of the locale-aware functions that are available in this form,
 along with the headers that expose them, is provided here:
-.Pp
 .Bl -tag -width " "
 .It In wctype.h
 .Xr iswalnum_l 3 ,

Modified: head/lib/libc/net/inet_net.3
==============================================================================
--- head/lib/libc/net/inet_net.3	Sun Mar 25 11:42:59 2012	(r233461)
+++ head/lib/libc/net/inet_net.3	Sun Mar 25 12:13:24 2012	(r233462)
@@ -95,7 +95,6 @@ The
 argument
 is the size of the result buffer
 .Fa dst .
-.Pp
 .Sh NETWORK NUMBERS (IP VERSION 4)
 Internet network numbers may be specified in one of the following forms:
 .Bd -literal -offset indent

Modified: head/lib/libc/net/nsdispatch.3
==============================================================================
--- head/lib/libc/net/nsdispatch.3	Sun Mar 25 11:42:59 2012	(r233461)
+++ head/lib/libc/net/nsdispatch.3	Sun Mar 25 12:13:24 2012	(r233462)
@@ -183,7 +183,6 @@ While there is support for arbitrary sou
 Refer to
 .Xr nsswitch.conf 5
 for a complete description of what each source type is.
-.Pp
 .Ss Method return values
 The
 .Vt nss_method

Modified: head/lib/libc/net/sctp_getassocid.3
==============================================================================
--- head/lib/libc/net/sctp_getassocid.3	Sun Mar 25 11:42:59 2012	(r233461)
+++ head/lib/libc/net/sctp_getassocid.3	Sun Mar 25 12:13:24 2012	(r233462)
@@ -51,7 +51,6 @@ The
 call attempts to look up the specified socket address
 .Fa addr
 and find the respective association identification. 
-.Pp
 .Sh RETURN VALUES
 The call returns the association id upon success and
 0 is returned upon failure.

Modified: head/lib/libc/posix1e/acl_to_text.3
==============================================================================
--- head/lib/libc/posix1e/acl_to_text.3	Sun Mar 25 11:42:59 2012	(r233461)
+++ head/lib/libc/posix1e/acl_to_text.3	Sun Mar 25 12:13:24 2012	(r233462)
@@ -66,7 +66,6 @@ flag is given.
 The flags specified are formed by
 .Em or Ns 'ing
 the following values
-.Pp
 .Bl -column -offset 3n "ACL_TEXT_NUMERIC_IDS"
 .It ACL_TEXT_VERBOSE		Format ACL using verbose form
 .It ACL_TEXT_NUMERIC_IDS	Do not resolve IDs into user or group names

Modified: head/lib/libc/sys/cpuset_getaffinity.2
==============================================================================
--- head/lib/libc/sys/cpuset_getaffinity.2	Sun Mar 25 11:42:59 2012	(r233461)
+++ head/lib/libc/sys/cpuset_getaffinity.2	Sun Mar 25 12:13:24 2012	(r233462)
@@ -108,7 +108,6 @@ and
 .Fa id
 to the value in
 .Fa mask .
-.Pp
 .Sh RETURN VALUES
 .Rv -std
 .Sh ERRORS

Modified: head/lib/libc/sys/pathconf.2
==============================================================================
--- head/lib/libc/sys/pathconf.2	Sun Mar 25 11:42:59 2012	(r233461)
+++ head/lib/libc/sys/pathconf.2	Sun Mar 25 12:13:24 2012	(r233462)
@@ -87,7 +87,6 @@ while
 returns information about the file the link references.
 .Pp
 The available values are as follows:
-.Pp
 .Bl -tag -width 6n
 .It Li _PC_LINK_MAX
 The maximum file link count.

Modified: head/lib/libc/sys/posix_fadvise.2
==============================================================================
--- head/lib/libc/sys/posix_fadvise.2	Sun Mar 25 11:42:59 2012	(r233461)
+++ head/lib/libc/sys/posix_fadvise.2	Sun Mar 25 12:13:24 2012	(r233462)
@@ -89,7 +89,6 @@ descriptor has the
 .Dv O_DIRECT
 flag enabled.
 .El
-.Pp
 .Sh RETURN VALUES
 .Rv -std posix_fadvise
 .Sh ERRORS

Modified: head/lib/libc/sys/posix_fallocate.2
==============================================================================
--- head/lib/libc/sys/posix_fallocate.2	Sun Mar 25 11:42:59 2012	(r233461)
+++ head/lib/libc/sys/posix_fallocate.2	Sun Mar 25 12:13:24 2012	(r233462)
@@ -79,7 +79,6 @@ may be freed by a successful call to
 that reduces the file size to a size smaller than
 .Fa offset +
 .Fa len .
-.Pp
 .Sh RETURN VALUES
 If successful,
 .Fn posix_fallocate

Modified: head/lib/libc/sys/sctp_peeloff.2
==============================================================================
--- head/lib/libc/sys/sctp_peeloff.2	Sun Mar 25 11:42:59 2012	(r233461)
+++ head/lib/libc/sys/sctp_peeloff.2	Sun Mar 25 12:13:24 2012	(r233462)
@@ -51,7 +51,6 @@ The
 system call attempts detach the association specified by
 .Fa id
 into its own separate socket.
-.Pp
 .Sh RETURN VALUES
 The call returns -1 on failure and the new socket descriptor
 upon success.

Modified: head/lib/libc/sys/shm_open.2
==============================================================================
--- head/lib/libc/sys/shm_open.2	Sun Mar 25 11:42:59 2012	(r233461)
+++ head/lib/libc/sys/shm_open.2	Sun Mar 25 12:13:24 2012	(r233462)
@@ -139,7 +139,6 @@ The
 .Fn shm_unlink
 system call removes a shared memory object named
 .Fa path .
-.Pp
 .Sh RETURN VALUES
 If successful,
 .Fn shm_open

Modified: head/lib/libcrypt/crypt.3
==============================================================================
--- head/lib/libcrypt/crypt.3	Sun Mar 25 11:42:59 2012	(r233461)
+++ head/lib/libcrypt/crypt.3	Sun Mar 25 12:13:24 2012	(r233462)
@@ -107,7 +107,6 @@ A brief test on a
 crypt to do approximately 2640 crypts
 a CPU second and MD5 to do about 62 crypts a CPU second.
 .Ss DES Extended Format:
-.Pp
 The
 .Ar key
 is divided into groups of 8 characters (the last group is null-padded)
@@ -163,7 +162,6 @@ string, 20 or 13 bytes (plus null) in le
 .Ar salt
 followed by the encoded 64-bit encryption.
 .Ss "Modular" crypt:
-.Pp
 If the salt begins with the string
 .Fa $digit$
 then the Modular Crypt Format is used.
@@ -199,9 +197,7 @@ An example salt would be:
 .Bl -tag -offset indent
 .It Cm "$4$thesalt$rest"
 .El
-.Pp
 .Ss "Traditional" crypt:
-.Pp
 The algorithm used will depend upon whether
 .Fn crypt_set_format
 has been called and whether a global default format has been specified.

Modified: head/lib/libelf/elf_getphdrnum.3
==============================================================================
--- head/lib/libelf/elf_getphdrnum.3	Sun Mar 25 11:42:59 2012	(r233461)
+++ head/lib/libelf/elf_getphdrnum.3	Sun Mar 25 12:13:24 2012	(r233462)
@@ -45,7 +45,6 @@ and stores it into the location pointed 
 .Pp
 This routine allows applications to uniformly process both normal ELF
 objects and ELF objects that use extended numbering.
-.Pp
 .Sh RETURN VALUES
 Function
 .Fn elf_getphdrnum

Modified: head/lib/libelf/elf_getphnum.3
==============================================================================
--- head/lib/libelf/elf_getphnum.3	Sun Mar 25 11:42:59 2012	(r233461)
+++ head/lib/libelf/elf_getphnum.3	Sun Mar 25 12:13:24 2012	(r233462)
@@ -50,7 +50,6 @@ and stores it into the location pointed 
 .Pp
 This routine allows applications to uniformly process both normal ELF
 objects and ELF objects that use extended numbering.
-.Pp
 .Sh RETURN VALUES
 Function
 .Fn elf_getphnum

Modified: head/lib/libelf/elf_getshdrnum.3
==============================================================================
--- head/lib/libelf/elf_getshdrnum.3	Sun Mar 25 11:42:59 2012	(r233461)
+++ head/lib/libelf/elf_getshdrnum.3	Sun Mar 25 12:13:24 2012	(r233462)
@@ -45,7 +45,6 @@ and stores it into the location pointed 
 .Pp
 This routine allows applications to uniformly process both normal ELF
 objects, and ELF objects that use extended section numbering.
-.Pp
 .Sh RETURN VALUES
 Function
 .Fn elf_getshdrnum

Modified: head/lib/libelf/elf_getshdrstrndx.3
==============================================================================
--- head/lib/libelf/elf_getshdrstrndx.3	Sun Mar 25 11:42:59 2012	(r233461)
+++ head/lib/libelf/elf_getshdrstrndx.3	Sun Mar 25 12:13:24 2012	(r233462)
@@ -46,7 +46,6 @@ and stores it into the location pointed 
 .Pp
 This function allow applications to process both normal ELF
 objects and ELF objects that use extended section numbering uniformly.
-.Pp
 .Sh RETURN VALUES
 These functions return zero if successful, or -1 in case of an error.
 .Sh ERRORS

Modified: head/lib/libelf/elf_getshnum.3
==============================================================================
--- head/lib/libelf/elf_getshnum.3	Sun Mar 25 11:42:59 2012	(r233461)
+++ head/lib/libelf/elf_getshnum.3	Sun Mar 25 12:13:24 2012	(r233462)
@@ -50,7 +50,6 @@ and stores it into the location pointed 
 .Pp
 This routine allows applications to uniformly process both normal ELF
 objects, and ELF objects that use extended section numbering.
-.Pp
 .Sh RETURN VALUES
 Function
 .Fn elf_getshnum

Modified: head/lib/libelf/elf_getshstrndx.3
==============================================================================
--- head/lib/libelf/elf_getshstrndx.3	Sun Mar 25 11:42:59 2012	(r233461)
+++ head/lib/libelf/elf_getshstrndx.3	Sun Mar 25 12:13:24 2012	(r233462)
@@ -60,7 +60,6 @@ sets the index of the section name strin
 .Pp
 These routines allow applications to process both normal ELF
 objects and ELF objects that use extended section numbering uniformly.
-.Pp
 .Sh RETURN VALUES
 These functions return a non-zero value if successful, or zero in case
 of an error.

Modified: head/lib/libgpib/gpib.3
==============================================================================
--- head/lib/libgpib/gpib.3	Sun Mar 25 11:42:59 2012	(r233461)
+++ head/lib/libgpib/gpib.3	Sun Mar 25 12:13:24 2012	(r233462)
@@ -279,7 +279,6 @@ Device trigger status
 Device clear state
 .El
 .Ss Function Description
-.Pp
 The function
 .Fn ibdev
 is used to open the GPIB device, and establish the parameters to

Modified: head/lib/libpmc/pmc.3
==============================================================================
--- head/lib/libpmc/pmc.3	Sun Mar 25 11:42:59 2012	(r233461)
+++ head/lib/libpmc/pmc.3	Sun Mar 25 12:13:24 2012	(r233462)
@@ -225,7 +225,6 @@ CPUs.
 The timestamp counter on i386 and amd64 architecture CPUs.
 .El
 .Ss PMC Capabilities
-.Pp
 Capabilities of performance monitoring hardware are denoted using
 the
 .Vt "enum pmc_caps"

Modified: head/lib/libpmc/pmc.k7.3
==============================================================================
--- head/lib/libpmc/pmc.k7.3	Sun Mar 25 11:42:59 2012	(r233461)
+++ head/lib/libpmc/pmc.k7.3	Sun Mar 25 12:13:24 2012	(r233462)
@@ -64,7 +64,6 @@ Each K7 CPU contains 4 PMCs with the fol
 .It PMC_CAP_WRITE Ta Yes
 .El
 .Ss Event Qualifiers
-.Pp
 Event specifiers for AMD K7 PMCs can have the following optional
 qualifiers:
 .Bl -tag -width indent

Modified: head/lib/libpmc/pmc.k8.3
==============================================================================
--- head/lib/libpmc/pmc.k8.3	Sun Mar 25 11:42:59 2012	(r233461)
+++ head/lib/libpmc/pmc.k8.3	Sun Mar 25 12:13:24 2012	(r233462)
@@ -67,7 +67,6 @@ Each CPU contains 4 PMCs with the follow
 .It PMC_CAP_WRITE Ta Yes
 .El
 .Ss Event Qualifiers
-.Pp
 Event specifiers for AMD K8 PMCs can have the following optional
 qualifiers:
 .Bl -tag -width indent

Modified: head/lib/libpmc/pmc.octeon.3
==============================================================================
--- head/lib/libpmc/pmc.octeon.3	Sun Mar 25 11:42:59 2012	(r233461)
+++ head/lib/libpmc/pmc.octeon.3	Sun Mar 25 12:13:24 2012	(r233462)
@@ -36,7 +36,6 @@ family CPUs
 .Sh SYNOPSIS
 .In pmc.h
 .Sh DESCRIPTION
-.Pp
 There are two counters per core supported by the hardware and each is 64 bits
 wide.
 .Ss Event Specifiers (Programmable PMCs)

Modified: head/lib/libpmc/pmc.p4.3
==============================================================================
--- head/lib/libpmc/pmc.p4.3	Sun Mar 25 11:42:59 2012	(r233461)
+++ head/lib/libpmc/pmc.p4.3	Sun Mar 25 12:13:24 2012	(r233462)
@@ -90,7 +90,6 @@ These PMCs support the following capabil
 .It PMC_CAP_WRITE Ta Yes
 .El
 .Ss Event Qualifiers
-.Pp
 Event specifiers for Intel P4 PMCs can have the following common
 qualifiers:
 .Bl -tag -width indent

Modified: head/lib/libtacplus/libtacplus.3
==============================================================================
--- head/lib/libtacplus/libtacplus.3	Sun Mar 25 11:42:59 2012	(r233461)
+++ head/lib/libtacplus/libtacplus.3	Sun Mar 25 12:13:24 2012	(r233462)
@@ -393,7 +393,6 @@ include:
 .It
 .Dv TAC_ACCT_STATUS_FOLLOW
 .El
-.Pp
 .Sh EXTRACTING INFORMATION FROM THE SERVER'S AUTHORIZATION RESPONSE
 Like an authentication response packet, an authorization
 response packet from the

Modified: head/lib/msun/man/ieee.3
==============================================================================
--- head/lib/msun/man/ieee.3	Sun Mar 25 11:42:59 2012	(r233461)
+++ head/lib/msun/man/ieee.3	Sun Mar 25 12:13:24 2012	(r233462)
@@ -271,7 +271,6 @@ integer multiple of 0.5**16494 = 6.5e\-4
 .Ed
 .Ed
 .Ss Additional Information Regarding Exceptions
-.Pp
 For each kind of floating-point exception, IEEE 754
 provides a Flag that is raised each time its exception
 is signaled, and stays raised until the program resets

From owner-svn-src-head@FreeBSD.ORG  Sun Mar 25 12:53:19 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id BA7AB1065673;
	Sun, 25 Mar 2012 12:53:19 +0000 (UTC)
	(envelope-from trasz@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id A57288FC12;
	Sun, 25 Mar 2012 12:53:19 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2PCrJIG082357;
	Sun, 25 Mar 2012 12:53:19 GMT (envelope-from trasz@svn.freebsd.org)
Received: (from trasz@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2PCrJXi082355;
	Sun, 25 Mar 2012 12:53:19 GMT (envelope-from trasz@svn.freebsd.org)
Message-Id: <201203251253.q2PCrJXi082355@svn.freebsd.org>
From: Edward Tomasz Napierala 
Date: Sun, 25 Mar 2012 12:53:19 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233463 - head/sys/sys
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sun, 25 Mar 2012 12:53:19 -0000

Author: trasz
Date: Sun Mar 25 12:53:19 2012
New Revision: 233463
URL: http://svn.freebsd.org/changeset/base/233463

Log:
  Remove unused define.
  
  Discussed with:	kib

Modified:
  head/sys/sys/vnode.h

Modified: head/sys/sys/vnode.h
==============================================================================
--- head/sys/sys/vnode.h	Sun Mar 25 12:13:24 2012	(r233462)
+++ head/sys/sys/vnode.h	Sun Mar 25 12:53:19 2012	(r233463)
@@ -380,7 +380,6 @@ extern int		vttoif_tab[];
 #define	SKIPSYSTEM	0x0001	/* vflush: skip vnodes marked VSYSTEM */
 #define	FORCECLOSE	0x0002	/* vflush: force file closure */
 #define	WRITECLOSE	0x0004	/* vflush: only close writable files */
-#define	DOCLOSE		0x0008	/* vclean: close active files */
 #define	V_SAVE		0x0001	/* vinvalbuf: sync file first */
 #define	V_ALT		0x0002	/* vinvalbuf: invalidate only alternate bufs */
 #define	V_NORMAL	0x0004	/* vinvalbuf: invalidate only regular bufs */

From owner-svn-src-head@FreeBSD.ORG  Sun Mar 25 14:20:44 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id E42B0106564A;
	Sun, 25 Mar 2012 14:20:44 +0000 (UTC)
	(envelope-from gibbs@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 7B9028FC1A;
	Sun, 25 Mar 2012 14:20:44 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2PEKi1C085306;
	Sun, 25 Mar 2012 14:20:44 GMT (envelope-from gibbs@svn.freebsd.org)
Received: (from gibbs@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2PEKi2p085304;
	Sun, 25 Mar 2012 14:20:44 GMT (envelope-from gibbs@svn.freebsd.org)
Message-Id: <201203251420.q2PEKi2p085304@svn.freebsd.org>
From: "Justin T. Gibbs" 
Date: Sun, 25 Mar 2012 14:20:44 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233465 - head/sys/dev/xen/blkfront
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sun, 25 Mar 2012 14:20:45 -0000

Author: gibbs
Date: Sun Mar 25 14:20:43 2012
New Revision: 233465
URL: http://svn.freebsd.org/changeset/base/233465

Log:
  Correct failure to attach the PV block front device on Citrix
  XenServer configurations that advertise the multi-page ring extension,
  but only allow a single page of ring space.
  
  sys/dev/xen/blkfront/blkfront.c:
  	If only one page of ring space is being used, do not publish
  	in the XenStore the number of pages in use (1), via either
  	of the supported multi-page ring extension schemes.
  
  	Single page operation is the same with or without the
  	ring-page extension being negotiated.   Relying on the
  	legacy behavior avoids an incompatible difference in how
  	the two ring-page extension schemes that are out in the
  	wild, deal with the base case of a single page.  The
  	Amazon/Red Hat drivers use the same XenStore variable as
  	if the extension was not negotiated.  The Citrix drivers
  	assume the new ring reference XenStore variables will be
  	available
  
  Reported by:	Oliver Schonefeld 
  MFC after:	3 days

Modified:
  head/sys/dev/xen/blkfront/blkfront.c

Modified: head/sys/dev/xen/blkfront/blkfront.c
==============================================================================
--- head/sys/dev/xen/blkfront/blkfront.c	Sun Mar 25 13:20:38 2012	(r233464)
+++ head/sys/dev/xen/blkfront/blkfront.c	Sun Mar 25 14:20:43 2012	(r233465)
@@ -698,21 +698,25 @@ blkfront_initialize(struct xb_softc *sc)
 		return;
 
 	/* Support both backend schemes for relaying ring page limits. */
-	error = xs_printf(XST_NIL, node_path,
-			 "num-ring-pages","%u", sc->ring_pages);
-	if (error) {
-		xenbus_dev_fatal(sc->xb_dev, error,
-				 "writing %s/num-ring-pages",
-				 node_path);
-		return;
-	}
-	error = xs_printf(XST_NIL, node_path,
-			 "ring-page-order","%u", fls(sc->ring_pages) - 1);
-	if (error) {
-		xenbus_dev_fatal(sc->xb_dev, error,
-				 "writing %s/ring-page-order",
-				 node_path);
-		return;
+	if (sc->ring_pages > 1) {
+		error = xs_printf(XST_NIL, node_path,
+				 "num-ring-pages","%u", sc->ring_pages);
+		if (error) {
+			xenbus_dev_fatal(sc->xb_dev, error,
+					 "writing %s/num-ring-pages",
+					 node_path);
+			return;
+		}
+
+		error = xs_printf(XST_NIL, node_path,
+				 "ring-page-order", "%u",
+				 fls(sc->ring_pages) - 1);
+		if (error) {
+			xenbus_dev_fatal(sc->xb_dev, error,
+					 "writing %s/ring-page-order",
+					 node_path);
+			return;
+		}
 	}
 
 	error = xs_printf(XST_NIL, node_path,

From owner-svn-src-head@FreeBSD.ORG  Sun Mar 25 16:00:57 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 464CD106564A;
	Sun, 25 Mar 2012 16:00:57 +0000 (UTC)
	(envelope-from joel@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 2F5558FC12;
	Sun, 25 Mar 2012 16:00:57 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2PG0vp6088863;
	Sun, 25 Mar 2012 16:00:57 GMT (envelope-from joel@svn.freebsd.org)
Received: (from joel@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2PG0u4R088855;
	Sun, 25 Mar 2012 16:00:56 GMT (envelope-from joel@svn.freebsd.org)
Message-Id: <201203251600.q2PG0u4R088855@svn.freebsd.org>
From: Joel Dahl 
Date: Sun, 25 Mar 2012 16:00:56 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233466 - in head: lib/libc/locale lib/libc/sys
	libexec/bootpd share/man/man3 share/man/man4
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sun, 25 Mar 2012 16:00:57 -0000

Author: joel (doc committer)
Date: Sun Mar 25 16:00:56 2012
New Revision: 233466
URL: http://svn.freebsd.org/changeset/base/233466

Log:
  Make sure sections are sorted into conventional order.

Modified:
  head/lib/libc/locale/duplocale.3
  head/lib/libc/locale/xlocale.3
  head/lib/libc/sys/cap_new.2
  head/libexec/bootpd/bootpd.8
  head/share/man/man3/pthread_cond_destroy.3
  head/share/man/man4/umcs.4
  head/share/man/man4/xnb.4

Modified: head/lib/libc/locale/duplocale.3
==============================================================================
--- head/lib/libc/locale/duplocale.3	Sun Mar 25 14:20:43 2012	(r233465)
+++ head/lib/libc/locale/duplocale.3	Sun Mar 25 16:00:56 2012	(r233466)
@@ -59,15 +59,6 @@ locale.
 .Pt
 The locale returned by this call must be freed with
 .Xr freelocale 3 .
-.Sh BUGS
-Ideally,
-.Xr uselocale 3
-should make a copy of the
-.Fa locale_t
-implicitly to ensure thread safety,
-and a copy of the global locale should be installed lazily on each thread.
-The FreeBSD implementation does not do this,
-for compatibility with Darwin.
 .Sh SEE ALSO
 .Xr freelocale 3 ,
 .Xr localeconv 3 ,
@@ -78,3 +69,12 @@ for compatibility with Darwin.
 .Sh STANDARDS
 This function, conforms to
 .St -p1003.1-2008
+.Sh BUGS
+Ideally,
+.Xr uselocale 3
+should make a copy of the
+.Fa locale_t
+implicitly to ensure thread safety,
+and a copy of the global locale should be installed lazily on each thread.
+The FreeBSD implementation does not do this,
+for compatibility with Darwin.

Modified: head/lib/libc/locale/xlocale.3
==============================================================================
--- head/lib/libc/locale/xlocale.3	Sun Mar 25 14:20:43 2012	(r233465)
+++ head/lib/libc/locale/xlocale.3	Sun Mar 25 16:00:56 2012	(r233466)
@@ -65,21 +65,6 @@ LC_GLOBAL_LOCALE refers to the global lo
 The global locale is the locale set with the
 .Xr setlocale 3
 function.
-.Sh CAVEATS
-The
-.Xr setlocale 3
-function, and others in the family, refer to the global locale.
-Other functions that depend on the locale, however,
-will take the thread-local locale if one has been set.
-This means that the idiom of setting the locale using
-.Xr setlocale 3 ,
-calling a locale-dependent function,
-and then restoring the locale will not
-have the expected behavior if the current thread has had a locale set using
-.Xr uselocale 3 .
-You should avoid this idiom and prefer to use the
-.Fa _l
-suffixed versions instead.
 .Sh SEE ALSO
 .Xr duplocale 3 ,
 .Xr freelocale 3 ,
@@ -278,3 +263,18 @@ The xlocale APIs first appeared in Darwi
 This implementation was written by David Chisnall,
 under sponsorship from the FreeBSD Foundation and first appeared in
 .Fx 9.1 .
+.Sh CAVEATS
+The
+.Xr setlocale 3
+function, and others in the family, refer to the global locale.
+Other functions that depend on the locale, however,
+will take the thread-local locale if one has been set.
+This means that the idiom of setting the locale using
+.Xr setlocale 3 ,
+calling a locale-dependent function,
+and then restoring the locale will not
+have the expected behavior if the current thread has had a locale set using
+.Xr uselocale 3 .
+You should avoid this idiom and prefer to use the
+.Fa _l
+suffixed versions instead.

Modified: head/lib/libc/sys/cap_new.2
==============================================================================
--- head/lib/libc/sys/cap_new.2	Sun Mar 25 14:20:43 2012	(r233465)
+++ head/lib/libc/sys/cap_new.2	Sun Mar 25 16:00:56 2012	(r233466)
@@ -462,14 +462,14 @@ argument is not a capability.
 Support for capabilities and capabilities mode was developed as part of the
 .Tn TrustedBSD
 Project.
+.Sh AUTHORS
+These functions and the capability facility were created by
+.An "Robert N. M. Watson" 
+at the University of Cambridge Computer Laboratory with support from a grant
+from Google, Inc.
 .Sh BUGS
 This man page should list the set of permitted system calls more specifically
 for each capability right.
 .Pp
 Capability rights sometimes have unclear indirect impacts, which should be
 documented, or at least hinted at.
-.Sh AUTHORS
-These functions and the capability facility were created by
-.An "Robert N. M. Watson" 
-at the University of Cambridge Computer Laboratory with support from a grant
-from Google, Inc.

Modified: head/libexec/bootpd/bootpd.8
==============================================================================
--- head/libexec/bootpd/bootpd.8	Sun Mar 25 14:20:43 2012	(r233465)
+++ head/libexec/bootpd/bootpd.8	Sun Mar 25 16:00:56 2012	(r233466)
@@ -263,9 +263,21 @@ Internet service numbers.
 Current directory typically used by the TFTP server and
 .Nm .
 .El
-.Sh BUGS
-Individual host entries must not exceed 1024 characters.
-.Sh CREDITS
+.Sh "SEE ALSO"
+.Xr bootptab 5 ,
+.Xr inetd 8 ,
+.Xr tftpd 8
+.Pp
+DARPA Internet Request For Comments:
+.Bl -tag -width RFC1533 -compact
+.It RFC951
+Bootstrap Protocol
+.It RFC1532
+Clarifications and Extensions for the Bootstrap Protocol
+.It RFC1533
+DHCP Options and BOOTP Vendor Extensions
+.El
+.Sh AUTHORS
 This distribution is currently maintained by
 .An Walter L. Wimer Aq walt+@cmu.edu .
 .Pp
@@ -294,17 +306,5 @@ Enhancements and bug-fixes have been con
 .An Jim McKim Aq mckim@lerc.nasa.gov
 .An Gordon W. Ross Aq gwr@mc.com
 .An Jason Zions Aq jazz@hal.com .
-.Sh "SEE ALSO"
-.Xr bootptab 5 ,
-.Xr inetd 8 ,
-.Xr tftpd 8
-.Pp
-DARPA Internet Request For Comments:
-.Bl -tag -width RFC1533 -compact
-.It RFC951
-Bootstrap Protocol
-.It RFC1532
-Clarifications and Extensions for the Bootstrap Protocol
-.It RFC1533
-DHCP Options and BOOTP Vendor Extensions
-.El
+.Sh BUGS
+Individual host entries must not exceed 1024 characters.

Modified: head/share/man/man3/pthread_cond_destroy.3
==============================================================================
--- head/share/man/man3/pthread_cond_destroy.3	Sun Mar 25 14:20:43 2012	(r233465)
+++ head/share/man/man3/pthread_cond_destroy.3	Sun Mar 25 16:00:56 2012	(r233466)
@@ -44,6 +44,9 @@ The
 .Fn pthread_cond_destroy
 function frees the resources allocated by the condition variable
 .Fa cond .
+.Sh IMPLEMENTATION NOTES
+A condition variable can be destroyed immediately after all the threads that
+are blocked on it are awakened.
 .Sh RETURN VALUES
 If successful, the
 .Fn pthread_cond_destroy
@@ -63,9 +66,6 @@ The variable
 .Fa cond
 is locked by another thread.
 .El
-.Sh IMPLEMENTATION NOTES
-A condition variable can be destroyed immediately after all the threads that
-are blocked on it are awakened.
 .Sh SEE ALSO
 .Xr pthread_cond_broadcast 3 ,
 .Xr pthread_cond_init 3 ,

Modified: head/share/man/man4/umcs.4
==============================================================================
--- head/share/man/man4/umcs.4	Sun Mar 25 14:20:43 2012	(r233465)
+++ head/share/man/man4/umcs.4	Sun Mar 25 16:00:56 2012	(r233466)
@@ -84,9 +84,6 @@ ST Lab U-400 four-port serial USB adapte
 .Xr tty 4 ,
 .Xr ucom 4 ,
 .Xr usb 4
-.Sh BUGS
-This driver doesn't support access to any fine tunes of
-chip, like RS522/RS485 mode, non-standard baudrates, etc.
 .Sh HISTORY
 The
 .Nm
@@ -99,3 +96,6 @@ The
 driver was written by
 .An Lev Serebryakov
 .Aq lev@FreeBSD.org .
+.Sh BUGS
+This driver doesn't support access to any fine tunes of
+chip, like RS522/RS485 mode, non-standard baudrates, etc.

Modified: head/share/man/man4/xnb.4
==============================================================================
--- head/share/man/man4/xnb.4	Sun Mar 25 14:20:43 2012	(r233465)
+++ head/share/man/man4/xnb.4	Sun Mar 25 16:00:56 2012	(r233466)
@@ -84,6 +84,26 @@ Runs a builtin suite of unit tests and d
 Does not affect the operation of the driver in any way.
 Note that the test suite simulates error conditions; this will result in
 error messages being printed to the system system log.
+.Sh SEE ALSO
+.Xr arp 4 ,
+.Xr netintro 4 ,
+.Xr ng_ether 4 ,
+.Xr xen 4 ,
+.Xr ifconfig 8
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Fx 10.0 .
+.Sh AUTHORS
+The
+.Nm
+driver was written by
+.An Alan Somers
+.Aq alans@spectralogic.com
+and
+.An John Suykerbuyk
+.Aq johns@spectralogic.com
 .Sh CAVEATS
 Packets sent through Xennet pass over shared memory, so the protocol includes
 no form of link-layer checksum or CRC.
@@ -110,26 +130,6 @@ is bridged to a physcal interface, then 
 disabled on the netfront.
 The Xennet protocol does not have any mechanism for the netback to request
 the netfront to do this; the operator must do it manually.
-.Sh SEE ALSO
-.Xr arp 4 ,
-.Xr netintro 4 ,
-.Xr ng_ether 4 ,
-.Xr xen 4 ,
-.Xr ifconfig 8
-.Sh HISTORY
-The
-.Nm
-device driver first appeared in
-.Fx 10.0 .
-.Sh AUTHORS
-The
-.Nm
-driver was written by
-.An Alan Somers
-.Aq alans@spectralogic.com
-and
-.An John Suykerbuyk
-.Aq johns@spectralogic.com
 .Sh BUGS
 The
 .Nm

From owner-svn-src-head@FreeBSD.ORG  Sun Mar 25 19:34:05 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id BF579106564A;
	Sun, 25 Mar 2012 19:34:05 +0000 (UTC)
	(envelope-from joel@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id AA67A8FC28;
	Sun, 25 Mar 2012 19:34:05 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2PJY5sH096308;
	Sun, 25 Mar 2012 19:34:05 GMT (envelope-from joel@svn.freebsd.org)
Received: (from joel@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2PJY55s096303;
	Sun, 25 Mar 2012 19:34:05 GMT (envelope-from joel@svn.freebsd.org)
Message-Id: <201203251934.q2PJY55s096303@svn.freebsd.org>
From: Joel Dahl 
Date: Sun, 25 Mar 2012 19:34:05 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233473 - in head: lib/libc/locale share/man/man4
	usr.bin/mkulzma usr.sbin/bsdinstall
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sun, 25 Mar 2012 19:34:05 -0000

Author: joel (doc committer)
Date: Sun Mar 25 19:34:05 2012
New Revision: 233473
URL: http://svn.freebsd.org/changeset/base/233473

Log:
  mdoc: document title should be all caps.

Modified:
  head/lib/libc/locale/newlocale.3
  head/share/man/man4/wbwd.4
  head/usr.bin/mkulzma/mkulzma.8
  head/usr.sbin/bsdinstall/bsdinstall.8

Modified: head/lib/libc/locale/newlocale.3
==============================================================================
--- head/lib/libc/locale/newlocale.3	Sun Mar 25 18:43:14 2012	(r233472)
+++ head/lib/libc/locale/newlocale.3	Sun Mar 25 19:34:05 2012	(r233473)
@@ -27,7 +27,7 @@
 .\"
 .\" $FreeBSD$
 .Dd September 17 2011
-.Dt newlocale 3
+.Dt NEWLOCALE 3
 .Os
 .Sh NAME
 .Nm newlocale

Modified: head/share/man/man4/wbwd.4
==============================================================================
--- head/share/man/man4/wbwd.4	Sun Mar 25 18:43:14 2012	(r233472)
+++ head/share/man/man4/wbwd.4	Sun Mar 25 19:34:05 2012	(r233473)
@@ -26,7 +26,7 @@
 .\" $FreeBSD$
 .\"
 .Dd March 6, 2012
-.Dt wbwd 4
+.Dt WBWD 4
 .Os
 .Sh NAME
 .Nm wbwd

Modified: head/usr.bin/mkulzma/mkulzma.8
==============================================================================
--- head/usr.bin/mkulzma/mkulzma.8	Sun Mar 25 18:43:14 2012	(r233472)
+++ head/usr.bin/mkulzma/mkulzma.8	Sun Mar 25 19:34:05 2012	(r233473)
@@ -10,7 +10,7 @@
 .\" $FreeBSD$
 .\"
 .Dd March 17, 2006
-.Dt mkulzma 8
+.Dt MKULZMA 8
 .Os
 .Sh NAME
 .Nm mkulzma

Modified: head/usr.sbin/bsdinstall/bsdinstall.8
==============================================================================
--- head/usr.sbin/bsdinstall/bsdinstall.8	Sun Mar 25 18:43:14 2012	(r233472)
+++ head/usr.sbin/bsdinstall/bsdinstall.8	Sun Mar 25 19:34:05 2012	(r233473)
@@ -26,7 +26,7 @@
 .\" $FreeBSD$
 .\"
 .Dd June 11, 2011
-.Dt bsdinstall 8
+.Dt BSDINSTALL 8
 .Os
 .Sh NAME
 .Nm bsdinstall

From owner-svn-src-head@FreeBSD.ORG  Sun Mar 25 20:25:43 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 50A7B106566C;
	Sun, 25 Mar 2012 20:25:43 +0000 (UTC)
	(envelope-from kabaev@gmail.com)
Received: from mail-qc0-f182.google.com (mail-qc0-f182.google.com
	[209.85.216.182])
	by mx1.freebsd.org (Postfix) with ESMTP id B2B008FC3B;
	Sun, 25 Mar 2012 20:25:42 +0000 (UTC)
Received: by qcsg15 with SMTP id g15so3435513qcs.13
	for ; Sun, 25 Mar 2012 13:25:36 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
	h=date:from:to:cc:subject:message-id:in-reply-to:references:x-mailer
	:mime-version:content-type;
	bh=QtRt1GQ0yyRQu9qkbVxQTA/bvZRJgzr3C6ZMLaY/bs0=;
	b=xtX5kTERO7uclmkPdSDLwJ9dyxunf9HA8GFVkzII+DQUCJWgPhhsUe0AHrb1OkLDk3
	zTLUdySzSy13VwFqo3Ms6AjaUgKKNE2QcRBI5carB5sTBQBZ95ySQuRWFQ7LufWwO5Hv
	lbCewnCUtJqapmigZM+9P/uiUjs42xm/LWzAEnHG5OYxWM132vIPH44skDDxKBtuWO8s
	OhnP+TcOLvAzMBarQRWUluztUt9Ax51rRShe2ZVimiVu8Zdk0WjTBk0+WiS7IbzrLkfR
	eZIH+HphPpkfnV/UVf50IAX6YLsAQ0tuwP1Qw8ohch611lm9MeoizLYg5GqBXtWBlFqp
	pmTg==
Received: by 10.224.101.72 with SMTP id b8mr24919354qao.31.1332707136287;
	Sun, 25 Mar 2012 13:25:36 -0700 (PDT)
Received: from kan.dyndns.org (c-24-63-226-98.hsd1.ma.comcast.net.
	[24.63.226.98])
	by mx.google.com with ESMTPS id 1sm26223314qac.3.2012.03.25.13.25.35
	(version=SSLv3 cipher=OTHER); Sun, 25 Mar 2012 13:25:35 -0700 (PDT)
Date: Sun, 25 Mar 2012 16:25:28 -0400
From: Alexander Kabaev 
To: Marius Strobl 
Message-ID: <20120325162528.7f73300c@kan.dyndns.org>
In-Reply-To: <201203212055.q2LKtMYR093218@svn.freebsd.org>
References: <201203212055.q2LKtMYR093218@svn.freebsd.org>
X-Mailer: Claws Mail 3.8.0 (GTK+ 2.24.6; amd64-portbld-freebsd10.0)
Mime-Version: 1.0
Content-Type: multipart/signed; micalg=PGP-SHA1;
	boundary="Sig_/M=KMPHEp7tOmJHtkHiLMNpO";
	protocol="application/pgp-signature"
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r233288 - in head/sys: boot/common libkern sys
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sun, 25 Mar 2012 20:25:43 -0000

--Sig_/M=KMPHEp7tOmJHtkHiLMNpO
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: quoted-printable

On Wed, 21 Mar 2012 20:55:22 +0000 (UTC)
Marius Strobl  wrote:


> Modified: head/sys/sys/libkern.h
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D
> --- head/sys/sys/libkern.h	Wed Mar 21 20:53:47 2012
> (r233287) +++ head/sys/sys/libkern.h	Wed Mar 21 20:55:21
> 2012	(r233288) @@ -121,7 +121,7 @@ size_t	 strspn(const
> char *, const char char	*strstr(const char *, const char *);
>  int	 strvalid(const char *, size_t);
> =20
> -extern uint32_t crc32_tab[];
> +extern const uint32_t const crc32_tab[];
> =20
>  static __inline uint32_t
>  crc32_raw(const void *buf, size_t size, uint32_t crc)

Hi,


g++ produces "error: duplicate 'const'" on this changed line. Leaving
the question as to why this file is ever being compiled by C++ on the
conscience of of VirtualBox authors, I would suggest partially backing
out this commit and getting easier on 'const' for C++'s sake.=20

--=20
Alexander Kabaev

--Sig_/M=KMPHEp7tOmJHtkHiLMNpO
Content-Type: application/pgp-signature; name=signature.asc
Content-Disposition: attachment; filename=signature.asc

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.18 (FreeBSD)

iD8DBQFPb389Q6z1jMm+XZYRAu9aAKCT5xRcekTe8Z3bC7wGtoeKmWhAqQCffA87
UFMXWot/IhgdQTuQCoe+DoE=
=Fj62
-----END PGP SIGNATURE-----

--Sig_/M=KMPHEp7tOmJHtkHiLMNpO--

From owner-svn-src-head@FreeBSD.ORG  Sun Mar 25 20:27:58 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 4FE7E106566B;
	Sun, 25 Mar 2012 20:27:58 +0000 (UTC)
	(envelope-from tijl@freebsd.org)
Received: from mailrelay009.isp.belgacom.be (mailrelay009.isp.belgacom.be
	[195.238.6.176])
	by mx1.freebsd.org (Postfix) with ESMTP id 9ECB48FC1A;
	Sun, 25 Mar 2012 20:27:56 +0000 (UTC)
X-Belgacom-Dynamic: yes
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-Anti-Spam-Result: AjgFAL1+b09bsVzs/2dsb2JhbABCtQ2DF4EIggkBAQQBJy8jEAsOCi45HgYBiBcJt3eKYoZGBIgkiViUEYJpgVI
Received: from 236.92-177-91.adsl-dyn.isp.belgacom.be (HELO
	kalimero.tijl.coosemans.org) ([91.177.92.236])
	by relay.skynet.be with ESMTP; 25 Mar 2012 22:26:45 +0200
Received: from kalimero.tijl.coosemans.org (kalimero.tijl.coosemans.org
	[127.0.0.1])
	by kalimero.tijl.coosemans.org (8.14.5/8.14.5) with ESMTP id
	q2PKQhXa004352; Sun, 25 Mar 2012 22:26:44 +0200 (CEST)
	(envelope-from tijl@freebsd.org)
From: Tijl Coosemans 
To: Bruce Evans , Dimitry Andric 
Date: Sun, 25 Mar 2012 22:26:36 +0200
User-Agent: KMail/1.13.7 (FreeBSD/10.0-CURRENT; KDE/4.7.3; i386; ; )
References: <201203241007.q2OA7MtS024789@svn.freebsd.org>
	<4F6E3A7D.9020709@FreeBSD.org>
	<20120325150057.H933@besplex.bde.org>
In-Reply-To: <20120325150057.H933@besplex.bde.org>
MIME-Version: 1.0
Content-Type: multipart/signed; boundary="nextPart2186372.ztlCrlZhdp";
	protocol="application/pgp-signature"; micalg=pgp-sha256
Content-Transfer-Encoding: 7bit
Message-Id: <201203252226.41883.tijl@freebsd.org>
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org, John Baldwin 
Subject: Re: svn commit: r233419 - head/sys/x86/include
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sun, 25 Mar 2012 20:27:58 -0000

--nextPart2186372.ztlCrlZhdp
Content-Type: Text/Plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

On Sunday 25 March 2012 07:31:29 Bruce Evans wrote:
> On Sat, 24 Mar 2012, Dimitry Andric wrote:
>> On 2012-03-24 18:48, Bruce Evans wrote:
>>> On Sat, 24 Mar 2012, Dimitry Andric wrote:
>>>> Log:
>>>>  Fix the following clang warning in sys/dev/dcons/dcons.c, caused by t=
he
>>>>  recent changes in sys/x86/include/endian.h:
>>>>
>>>>    sys/dev/dcons/dcons.c:190:15: error: implicit conversion from '__ui=
nt32_t' (aka 'unsigned int') to '__uint16_t' (aka 'unsigned short') changes=
 value from 1684238190 to 28526 [-Werror,-Wconstant-conversion]
>>>>
>>>>  	  buf->magic =3D ntohl(DCONS_MAGIC);
>>>>  		       ^~~~~~~~~~~~~~~~~~
>>>>    sys/sys/param.h:306:18: note: expanded from:
>>>>    #define ntohl(x)        __ntohl(x)
>>>>  			  ^
>>>>    ./x86/endian.h:128:20: note: expanded from:
>>>>    #define __ntohl(x)      __bswap32(x)
>>>>  			  ^
>>>>    ./x86/endian.h:78:20: note: expanded from:
>>>>  	      __bswap32_gen((__uint32_t)(x)) : __bswap32_var(x))
>>>>  			    ^
>>>>    ./x86/endian.h:68:26: note: expanded from:
>>>>  	  (((__uint32_t)__bswap16(x) << 16) | __bswap16((x) >> 16))
>>>>  				  ^
>>>>    ./x86/endian.h:75:53: note: expanded from:
>>>>  	      __bswap16_gen((__uint16_t)(x)) : __bswap16_var(x)))
>>>>  					       ~~~~~~~~~~~~~ ^
>>>
>>> This warning was discussed before things were committed.
>>
>> Then why was it committed without fixing the warning first?
>=20
> Because testing (by tijl) showed that there was no warning.

To clarify, I didn't do a full clang build, just some test programs.

>>> As documented there, it is important
>>> for optimizations that __bswap64_gen() does do the constancy check
>>> recursively.  This was discussed before things were committed, and
>>> again when jhb siggested breaking it similarly to this commit to avoid
>>> a problem on ia64.
>>
>> Isn't it much easier, and less obtuse, to just jam in two bswaps for the
>> i386?  I never saw the reason for making the bswap macros *more*
>> complicated instead of less.  If you obfuscate them enough, no compiler
>> will be able to optimize properly... :)
>=20
> No, since the divison of 64 bits into 2 times 32-bits is very easy.
> For constants it is much simpler than what it replaced, and the same
> method is now used for variables.  Hard-coding 2 32-bit bswaps for
> i386 would give a different method for i386, and if done in asm would
> inhibit the compiler combining these bswaps.  Although we do have the
> corresponding hard asm for bswap32() (gcc needs it but clang doesn't;
> clang needs help only for bswap64()).

Are you sure about clang not needing the asm? I cannot get it to turn
the generic macro into a bswap instruction. GCC 4.7 does seem to be
able to do that at -O2 and higher (if I add extra casts).

>>>>  Fix it by calling __bswap16_gen() from __bswap32_gen(), and similarly,
>>>>  __bswap32_gen() from  __bswap64_gen().
>>>
>>> This breaks it.  DIring development, I had a correct fix involving
>>> casting down the arg.
>>
>> If it works correctly with clang, please post it.

I've been experimenting a bit with various compilers over the weekend.
The following is an incomplete/untested patch, but feel free to comment
on it. It moves the __bswapNN definitions to sys/_endian.h. Only asm
versions would stay in machine/endian.h. The patch also adds support
for __builtin_bswap32/64 to cdefs.h. Only x86/endian.h has been
converted here and not all places that include machine/endian.h have
been checked yet.


diff --git a/include/arpa/inet.h b/include/arpa/inet.h
index 9713e7f..2a296ca 100644
=2D-- a/include/arpa/inet.h
+++ b/include/arpa/inet.h
@@ -61,10 +61,9 @@
 /* External definitions for functions in inet(3). */
=20
 #include 
+#include 
 #include 
=20
=2D/* Required for byteorder(3) functions. */
=2D#include 
=20
 #define	INET_ADDRSTRLEN		16
 #define	INET6_ADDRSTRLEN	46
diff --git a/sys/sys/cdefs.h b/sys/sys/cdefs.h
index 076842d..0ddab2d 100644
=2D-- a/sys/sys/cdefs.h
+++ b/sys/sys/cdefs.h
@@ -44,6 +44,16 @@
 #define	__END_DECLS
 #endif
=20
+#ifndef	__has_feature
+#define	__has_feature(x) 0
+#endif
+#ifndef	__has_include
+#define	__has_include(x) 0
+#endif
+#ifndef	__has_builtin
+#define	__has_builtin(x) 0
+#endif
+
 /*
  * This code has been put in place to help reduce the addition of
  * compiler specific defines in FreeBSD code.  It helps to aid in
@@ -293,6 +303,14 @@
 #define __nonnull(x)
 #endif
=20
+#if __has_builtin(__builtin_bswap32) || __GNUC_PREREQ__(4, 3)
+#define	__bswap32(x)	__builtin_bswap32(x)
+#define	__bswap64(x)	__builtin_bswap64(x)
+#else
+#undef __bswap32
+#undef __bswap64
+#endif
+
 /* XXX: should use `#if __STDC_VERSION__ < 199901'. */
 #if !__GNUC_PREREQ__(2, 7) && !defined(__INTEL_COMPILER)
 #define	__func__	NULL
@@ -647,16 +665,6 @@
 #endif
 #endif
=20
=2D#ifndef	__has_feature
=2D#define	__has_feature(x) 0
=2D#endif
=2D#ifndef	__has_include
=2D#define	__has_include(x) 0
=2D#endif
=2D#ifndef	__has_builtin
=2D#define	__has_builtin(x) 0
=2D#endif
=2D
 #if defined(__mips) || defined(__powerpc64__)
 #define __NO_TLS 1
 #endif
diff --git a/sys/sys/endian.h b/sys/sys/endian.h
index d50110c..6c2aa54 100644
=2D-- a/sys/sys/endian.h
+++ b/sys/sys/endian.h
@@ -30,8 +30,8 @@
 #define _SYS_ENDIAN_H_
=20
 #include 
+#include 
 #include 
=2D#include 
=20
 #ifndef _UINT8_T_DECLARED
 typedef	__uint8_t	uint8_t;
diff --git a/sys/sys/_endian.h b/sys/sys/_endian.h
new file mode 100644
index 0000000..43973d2
=2D-- /dev/null
+++ b/sys/sys/_endian.h
@@ -0,0 +1,101 @@
+/*-
+ * Copyright (c) 1987, 1991 Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURP=
OSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENT=
IAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STR=
ICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY W=
AY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)endian.h	7.8 (Berkeley) 4/3/91
+ * $FreeBSD$
+ */
+
+#ifndef _SYS__ENDIAN_H_
+#define	_SYS__ENDIAN_H_
+
+#include 
+#include 
+
+#include 
+
+#ifdef __GNUCLIKE_BUILTIN_CONSTANT_P
+#define	__isconst(x)		__builtin_constant_p(x)
+#else
+#define	__isconst(x)		0
+#endif

isconst(x) should probably be defined in cdefs.h.

+
+#ifndef __bswap16
+#define	__bswap16_gen(x)		\
+	((__uint16_t)((__uint16_t)	\
+	((__uint16_t)(x) << 8) | (__uint16_t)(x) >> 8))

MI version of __bswap16. The first cast is the return type. The second
helps all versions of gcc that I've tested to optimise __bswap32 and
__bswap64 better (probably because the expression is promoted to int
and the cast tells the compiler to discard the upper 16 bits). The
third and fourth simply cast the macro argument. It makes the macro
more function-like. All macros are like this now.

+static __inline __uint16_t
+__bswap16(__uint16_t __x)
+{
+#ifdef __bswap16_asm
+	__bswap16_asm(__x);
+	return (__x);
+#else
+	return (__bswap16_gen(__x));
+#endif
+}

If machine/endian.h defines __bswap16_asm, use it, otherwise use the
MI version. machine/endian.h should not define __bswap16_asm if the
compiler can optimise the C expression correctly.

+#define	__bswap16(x)			\
+	((__uint16_t)(__isconst(x) ? __bswap16_gen(x) : __bswap16(x)))

Allow using __bswap16 in static initialisers.

+#endif /* ! __bswap16 */
+
+#ifndef __bswap32

If __bswap32 is defined in cdefs.h, don't do anything here.

+#define	__bswap32_gen(x)	 	\
+	((__uint32_t)((__uint32_t)	\
+	((__uint32_t)__bswap16(x) << 16) | __bswap16((__uint32_t)(x) >> 16)))

__bswap32 implemented using __bswap16. The second cast doesn't seem to
be necessary here. I kept it just to be sure and to keep the definition
similar to __bswap16_gen.

+static __inline __uint32_t
+__bswap32(__uint32_t __x)
+{
+#ifdef __bswap32_asm
+	__bswap32_asm(__x);
+	return (__x);
+#else
+	return (__bswap32_gen(__x));
+#endif
+}

Same as __bswap16.

+#define	__bswap32(x)			\
+	((__uint32_t)(__isconst(x) ? __bswap32_gen(x) : __bswap32(x)))

Same as __bswap16.

+#endif /* ! __bswap32 */
+
+#ifndef __bswap64
+#define	__bswap64_gen(x)		\
+	((__uint64_t)((__uint64_t)	\
+	((__uint64_t)__bswap32(x) << 32) | __bswap32((__uint64_t)(x) >> 32)))
+static __inline __uint64_t
+__bswap64(__uint64_t __x)
+{
+#ifdef __bswap64_asm
+	__bswap64_asm(__x);
+	return (__x);
+#else
+	return (__bswap64_gen(__x));
+#endif
+}
+#define	__bswap64(x)			\
+	((__uint64_t)(__isconst(x) ? __bswap64_gen(x) : __bswap64(x)))
+#endif /* ! __bswap64 */

Same as __bswap32.

+#endif /* !_SYS__ENDIAN_H_ */
diff --git a/sys/x86/include/endian.h b/sys/x86/include/endian.h
index 9059587..7827231 100644
=2D-- a/sys/x86/include/endian.h
+++ b/sys/x86/include/endian.h
@@ -63,65 +63,12 @@
 #define	BYTE_ORDER	_BYTE_ORDER
 #endif
=20
=2D#define	__bswap16_gen(x)	((__uint16_t)((x) << 8 | (x) >> 8))
=2D#define	__bswap32_gen(x)		\
=2D	(((__uint32_t)__bswap16_gen(x) << 16) | __bswap16_gen((x) >> 16))
=2D#define	__bswap64_gen(x)		\
=2D	(((__uint64_t)__bswap32_gen(x) << 32) | __bswap32_gen((x) >> 32))
=2D
=2D#ifdef __GNUCLIKE_BUILTIN_CONSTANT_P
=2D#define	__bswap16(x)				\
=2D	((__uint16_t)(__builtin_constant_p(x) ?	\
=2D	    __bswap16_gen((__uint16_t)(x)) : __bswap16_var(x)))
=2D#define	__bswap32(x)			\
=2D	(__builtin_constant_p(x) ?	\
=2D	    __bswap32_gen((__uint32_t)(x)) : __bswap32_var(x))
=2D#define	__bswap64(x)			\
=2D	(__builtin_constant_p(x) ?	\
=2D	    __bswap64_gen((__uint64_t)(x)) : __bswap64_var(x))
=2D#else
=2D/* XXX these are broken for use in static initializers. */
=2D#define	__bswap16(x)	__bswap16_var(x)
=2D#define	__bswap32(x)	__bswap32_var(x)
=2D#define	__bswap64(x)	__bswap64_var(x)
=2D#endif
=2D
=2D/* These are defined as functions to avoid multiple evaluation of x. */
=2D
=2Dstatic __inline __uint16_t
=2D__bswap16_var(__uint16_t _x)
=2D{
=2D
=2D	return (__bswap16_gen(_x));
=2D}
=2D
=2Dstatic __inline __uint32_t
=2D__bswap32_var(__uint32_t _x)
=2D{
=2D
 #ifdef __GNUCLIKE_ASM
=2D	__asm("bswap %0" : "+r" (_x));
=2D	return (_x);
=2D#else
=2D	return (__bswap32_gen(_x));
+#define	__bswap32_asm(x) __asm("bswapl	%0" : "+r" (x))
+#ifdef __amd64__
+#define	__bswap64_asm(x) __asm("bswapq	%0" : "+r" (x))
 #endif

Remove everything about __bswapNN and just keep _asm versions. Because
clang and gcc>=3D4.3 have __builtin_bswapNN these are only used by base
system gcc and older versions of gcc.

=2D}
=2D
=2Dstatic __inline __uint64_t
=2D__bswap64_var(__uint64_t _x)
=2D{
=2D
=2D#if defined(__amd64__) && defined(__GNUCLIKE_ASM)
=2D	__asm("bswap %0" : "+r" (_x));
=2D	return (_x);
=2D#else
=2D	/*
=2D	 * It is important for the optimizations that the following is not
=2D	 * really generic, but expands to 2 __bswap32_var()'s.
=2D	 */
=2D	return (__bswap64_gen(_x));
 #endif
=2D}
=20
 #define	__htonl(x)	__bswap32(x)
 #define	__htons(x)	__bswap16(x)


I tried to make the implementation as simple as I could, but obviously
it is still complicated, so suggestions to improve this are welcome.

--nextPart2186372.ztlCrlZhdp
Content-Type: application/pgp-signature; name=signature.asc 
Content-Description: This is a digitally signed message part.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.18 (FreeBSD)

iF4EABEIAAYFAk9vf4EACgkQfoCS2CCgtivp1AD7BMuEE3Sjy6yT/iimR6kSqzPH
PNsVxzmRYCkPdCNGVKMA+QHHsmjBRmsqvysSQUGy3ZTOz66StaEbVZz3NROKCqhQ
=wJYj
-----END PGP SIGNATURE-----

--nextPart2186372.ztlCrlZhdp--

From owner-svn-src-head@FreeBSD.ORG  Sun Mar 25 20:38:00 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 2A0291065687;
	Sun, 25 Mar 2012 20:38:00 +0000 (UTC)
	(envelope-from melifaro@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 12B388FC20;
	Sun, 25 Mar 2012 20:38:00 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2PKbxcL098624;
	Sun, 25 Mar 2012 20:37:59 GMT
	(envelope-from melifaro@svn.freebsd.org)
Received: (from melifaro@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2PKbxhw098617;
	Sun, 25 Mar 2012 20:37:59 GMT
	(envelope-from melifaro@svn.freebsd.org)
Message-Id: <201203252037.q2PKbxhw098617@svn.freebsd.org>
From: "Alexander V. Chernikov" 
Date: Sun, 25 Mar 2012 20:37:59 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233478 - in head: sbin/ipfw sys/netinet
	sys/netinet/ipfw
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sun, 25 Mar 2012 20:38:00 -0000

Author: melifaro
Date: Sun Mar 25 20:37:59 2012
New Revision: 233478
URL: http://svn.freebsd.org/changeset/base/233478

Log:
  - Permit number of ipfw tables to be changed in runtime.
  
  net.inet.ip.fw.tables_max is now read-write.
  
  - Bump IPFW_TABLES_MAX to 65535
  Default number of tables is still 128
  
  - Remove IPFW_TABLES_MAX from ipfw(8) code.
  
  Sponsored by Yandex LLC
  
  Approved by:    kib(mentor)
  
  MFC after:      2 weeks

Modified:
  head/sbin/ipfw/ipfw.8
  head/sbin/ipfw/ipfw2.c
  head/sys/netinet/ip_fw.h
  head/sys/netinet/ipfw/ip_fw2.c
  head/sys/netinet/ipfw/ip_fw_private.h
  head/sys/netinet/ipfw/ip_fw_table.c

Modified: head/sbin/ipfw/ipfw.8
==============================================================================
--- head/sbin/ipfw/ipfw.8	Sun Mar 25 20:09:02 2012	(r233477)
+++ head/sbin/ipfw/ipfw.8	Sun Mar 25 20:37:59 2012	(r233478)
@@ -2845,7 +2845,7 @@ node is not passed though the firewall a
 Otherwise, after an action, the packet is
 reinjected into the firewall at the next rule.
 .It Va net.inet.ip.fw.tables_max : No 128
-Maximum number of tables (read-only).
+Maximum number of tables.
 .It Va net.inet.ip.fw.verbose : No 1
 Enables verbose messages.
 .It Va net.inet.ip.fw.verbose_limit : No 0

Modified: head/sbin/ipfw/ipfw2.c
==============================================================================
--- head/sbin/ipfw/ipfw2.c	Sun Mar 25 20:09:02 2012	(r233477)
+++ head/sbin/ipfw/ipfw2.c	Sun Mar 25 20:37:59 2012	(r233478)
@@ -3932,15 +3932,9 @@ ipfw_table_handler(int ac, char *av[])
 
 	len = sizeof(tables_max);
 	if (sysctlbyname("net.inet.ip.fw.tables_max", &tables_max, &len,
-		NULL, 0) == -1) {
-#ifdef IPFW_TABLES_MAX
-		warn("Warn: Failed to get the max tables number via sysctl. "
-		     "Using the compiled in defaults. \nThe reason was");
-		tables_max = IPFW_TABLES_MAX;
-#else
-		errx(1, "Failed sysctlbyname(\"net.inet.ip.fw.tables_max\")");
-#endif
-	}
+		NULL, 0) == -1)
+		errx(1, "Can't determine maximum number of ipfw tables. "
+		    "Perhaps you forgot to load ipfw module?");
 
 	memset(&xent, 0, sizeof(xent));
 

Modified: head/sys/netinet/ip_fw.h
==============================================================================
--- head/sys/netinet/ip_fw.h	Sun Mar 25 20:09:02 2012	(r233477)
+++ head/sys/netinet/ip_fw.h	Sun Mar 25 20:37:59 2012	(r233478)
@@ -39,7 +39,8 @@
 /*
  * Default number of ipfw tables.
  */
-#define	IPFW_TABLES_MAX		128
+#define	IPFW_TABLES_MAX		65535
+#define	IPFW_TABLES_DEFAULT	128
 
 /*
  * Most commands (queue, pipe, tag, untag, limit...) can have a 16-bit

Modified: head/sys/netinet/ipfw/ip_fw2.c
==============================================================================
--- head/sys/netinet/ipfw/ip_fw2.c	Sun Mar 25 20:09:02 2012	(r233477)
+++ head/sys/netinet/ipfw/ip_fw2.c	Sun Mar 25 20:37:59 2012	(r233478)
@@ -116,8 +116,9 @@ static int default_to_accept;
 VNET_DEFINE(int, autoinc_step);
 VNET_DEFINE(int, fw_one_pass) = 1;
 
+VNET_DEFINE(unsigned int, fw_tables_max);
 /* Use 128 tables by default */
-int fw_tables_max = IPFW_TABLES_MAX;
+static unsigned int default_fw_tables = IPFW_TABLES_DEFAULT;
 
 /*
  * Each rule belongs to one of 32 different sets (0..31).
@@ -148,6 +149,7 @@ ipfw_nat_cfg_t *ipfw_nat_get_log_ptr;
 
 #ifdef SYSCTL_NODE
 uint32_t dummy_def = IPFW_DEFAULT_RULE;
+static int sysctl_ipfw_table_num(SYSCTL_HANDLER_ARGS);
 
 SYSBEGIN(f3)
 
@@ -167,14 +169,14 @@ SYSCTL_VNET_INT(_net_inet_ip_fw, OID_AUT
 SYSCTL_UINT(_net_inet_ip_fw, OID_AUTO, default_rule, CTLFLAG_RD,
     &dummy_def, 0,
     "The default/max possible rule number.");
-SYSCTL_UINT(_net_inet_ip_fw, OID_AUTO, tables_max, CTLFLAG_RD,
-    &V_fw_tables_max, 0,
-    "The maximum number of tables.");
+SYSCTL_VNET_PROC(_net_inet_ip_fw, OID_AUTO, tables_max,
+    CTLTYPE_UINT|CTLFLAG_RW, 0, 0, sysctl_ipfw_table_num, "IU",
+    "Maximum number of tables");
 SYSCTL_INT(_net_inet_ip_fw, OID_AUTO, default_to_accept, CTLFLAG_RDTUN,
     &default_to_accept, 0,
     "Make the default rule accept all packets.");
 TUNABLE_INT("net.inet.ip.fw.default_to_accept", &default_to_accept);
-TUNABLE_INT("net.inet.ip.fw.tables_max", &V_fw_tables_max);
+TUNABLE_INT("net.inet.ip.fw.tables_max", &default_fw_tables);
 SYSCTL_VNET_INT(_net_inet_ip_fw, OID_AUTO, static_count,
     CTLFLAG_RD, &VNET_NAME(layer3_chain.n_rules), 0,
     "Number of static rules");
@@ -2488,6 +2490,26 @@ pullup_failed:
 }
 
 /*
+ * Set maximum number of tables that can be used in given VNET ipfw instance.
+ */
+#ifdef SYSCTL_NODE
+static int
+sysctl_ipfw_table_num(SYSCTL_HANDLER_ARGS)
+{
+	int error;
+	unsigned int ntables;
+
+	ntables = V_fw_tables_max;
+
+	error = sysctl_handle_int(oidp, &ntables, 0, req);
+	/* Read operation or some error */
+	if ((error != 0) || (req->newptr == NULL))
+		return (error);
+
+	return (ipfw_resize_tables(&V_layer3_chain, ntables));
+}
+#endif
+/*
  * Module and VNET glue
  */
 
@@ -2543,6 +2565,10 @@ ipfw_init(void)
 		printf("limited to %d packets/entry by default\n",
 		    V_verbose_limit);
 
+	/* Check user-supplied table count for validness */
+	if (default_fw_tables > IPFW_TABLES_MAX)
+	  default_fw_tables = IPFW_TABLES_MAX;
+
 	ipfw_log_bpf(1); /* init */
 	return (error);
 }
@@ -2585,18 +2611,15 @@ vnet_ipfw_init(const void *unused)
 	LIST_INIT(&chain->nat);
 #endif
 
-	/* Check user-supplied number for validness */
-	if (V_fw_tables_max < 0)
-	  V_fw_tables_max = IPFW_TABLES_MAX;
-	if (V_fw_tables_max > 65534)
-	  V_fw_tables_max = 65534;
-
 	/* insert the default rule and create the initial map */
 	chain->n_rules = 1;
 	chain->static_len = sizeof(struct ip_fw);
 	chain->map = malloc(sizeof(struct ip_fw *), M_IPFW, M_WAITOK | M_ZERO);
 	if (chain->map)
 		rule = malloc(chain->static_len, M_IPFW, M_WAITOK | M_ZERO);
+
+	/* Set initial number of tables */
+	V_fw_tables_max = default_fw_tables;
 	error = ipfw_init_tables(chain);
 	if (error) {
 		printf("ipfw2: setting up tables failed\n");

Modified: head/sys/netinet/ipfw/ip_fw_private.h
==============================================================================
--- head/sys/netinet/ipfw/ip_fw_private.h	Sun Mar 25 20:09:02 2012	(r233477)
+++ head/sys/netinet/ipfw/ip_fw_private.h	Sun Mar 25 20:37:59 2012	(r233478)
@@ -209,8 +209,8 @@ VNET_DECLARE(u_int32_t, set_disable);
 VNET_DECLARE(int, autoinc_step);
 #define V_autoinc_step		VNET(autoinc_step)
 
-extern int fw_tables_max;
-#define V_fw_tables_max		fw_tables_max
+VNET_DECLARE(unsigned int, fw_tables_max);
+#define V_fw_tables_max		VNET(fw_tables_max)
 
 struct ip_fw_chain {
 	struct ip_fw	*rules;		/* list of rules */
@@ -292,6 +292,7 @@ int ipfw_dump_table_entry(struct radix_n
 int ipfw_dump_table(struct ip_fw_chain *ch, ipfw_table *tbl);
 int ipfw_count_xtable(struct ip_fw_chain *ch, uint32_t tbl, uint32_t *cnt);
 int ipfw_dump_xtable(struct ip_fw_chain *ch, ipfw_xtable *tbl);
+int ipfw_resize_tables(struct ip_fw_chain *ch, unsigned int ntables);
 
 /* In ip_fw_nat.c -- XXX to be moved to ip_var.h */
 

Modified: head/sys/netinet/ipfw/ip_fw_table.c
==============================================================================
--- head/sys/netinet/ipfw/ip_fw_table.c	Sun Mar 25 20:09:02 2012	(r233477)
+++ head/sys/netinet/ipfw/ip_fw_table.c	Sun Mar 25 20:37:59 2012	(r233478)
@@ -460,6 +460,68 @@ ipfw_init_tables(struct ip_fw_chain *ch)
 }
 
 int
+ipfw_resize_tables(struct ip_fw_chain *ch, unsigned int ntables)
+{
+	struct radix_node_head **tables, **xtables, *rnh;
+	struct radix_node_head **tables_old, **xtables_old;
+	uint8_t *tabletype, *tabletype_old;
+	unsigned int ntables_old, tbl;
+
+	/* Check new value for validity */
+	if (ntables > IPFW_TABLES_MAX)
+		ntables = IPFW_TABLES_MAX;
+
+	/* Allocate new pointers */
+	tables = malloc(ntables * sizeof(void *), M_IPFW, M_WAITOK | M_ZERO);
+	xtables = malloc(ntables * sizeof(void *), M_IPFW, M_WAITOK | M_ZERO);
+	tabletype = malloc(ntables * sizeof(uint8_t), M_IPFW, M_WAITOK | M_ZERO);
+
+	IPFW_WLOCK(ch);
+
+	tbl = (ntables >= V_fw_tables_max) ? V_fw_tables_max : ntables;
+
+	/* Copy old table pointers */
+	memcpy(tables, ch->tables, sizeof(void *) * tbl);
+	memcpy(xtables, ch->xtables, sizeof(void *) * tbl);
+	memcpy(tabletype, ch->tabletype, sizeof(uint8_t) * tbl);
+
+	/* Change pointers and number of tables */
+	tables_old = ch->tables;
+	xtables_old = ch->xtables;
+	tabletype_old = ch->tabletype;
+	ch->tables = tables;
+	ch->xtables = xtables;
+	ch->tabletype = tabletype;
+
+	ntables_old = V_fw_tables_max;
+	V_fw_tables_max = ntables;
+
+	IPFW_WUNLOCK(ch);
+
+	/* Check if we need to destroy radix trees */
+	if (ntables < ntables_old) {
+		for (tbl = ntables; tbl < ntables_old; tbl++) {
+			if ((rnh = tables_old[tbl]) != NULL) {
+				rnh->rnh_walktree(rnh, flush_table_entry, rnh);
+				rn_detachhead((void **)&rnh);
+			}
+
+			if ((rnh = xtables_old[tbl]) != NULL) {
+				rnh->rnh_walktree(rnh, flush_table_entry, rnh);
+				rn_detachhead((void **)&rnh);
+			}
+		}
+	}
+
+	/* Free old pointers */
+	free(tables_old, M_IPFW);
+	free(xtables_old, M_IPFW);
+	free(tabletype_old, M_IPFW);
+
+	return (0);
+}
+
+int
 ipfw_lookup_table(struct ip_fw_chain *ch, uint16_t tbl, in_addr_t addr,
     uint32_t *val)
 {

From owner-svn-src-head@FreeBSD.ORG  Sun Mar 25 21:54:36 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id C2920106564A;
	Sun, 25 Mar 2012 21:54:36 +0000 (UTC) (envelope-from rmh@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id AC0128FC19;
	Sun, 25 Mar 2012 21:54:36 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2PLsadk001070;
	Sun, 25 Mar 2012 21:54:36 GMT (envelope-from rmh@svn.freebsd.org)
Received: (from rmh@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2PLsaWr001068;
	Sun, 25 Mar 2012 21:54:36 GMT (envelope-from rmh@svn.freebsd.org)
Message-Id: <201203252154.q2PLsaWr001068@svn.freebsd.org>
From: Robert Millan 
Date: Sun, 25 Mar 2012 21:54:36 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233479 - head/sys/dev/aic7xxx/aicasm
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sun, 25 Mar 2012 21:54:36 -0000

Author: rmh
Date: Sun Mar 25 21:54:36 2012
New Revision: 233479
URL: http://svn.freebsd.org/changeset/base/233479

Log:
  Follow non-BSD case when GNU/Hurd is detected.

Modified:
  head/sys/dev/aic7xxx/aicasm/aicasm_symbol.c

Modified: head/sys/dev/aic7xxx/aicasm/aicasm_symbol.c
==============================================================================
--- head/sys/dev/aic7xxx/aicasm/aicasm_symbol.c	Sun Mar 25 20:37:59 2012	(r233478)
+++ head/sys/dev/aic7xxx/aicasm/aicasm_symbol.c	Sun Mar 25 21:54:36 2012	(r233479)
@@ -44,7 +44,7 @@
 
 #include 
 #include 
-#ifdef BSD
+#if defined(BSD) && !defined(__GNU__)
 #include 
 #else
 #include 

From owner-svn-src-head@FreeBSD.ORG  Sun Mar 25 23:50:34 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id E86561065670;
	Sun, 25 Mar 2012 23:50:34 +0000 (UTC)
	(envelope-from adrian@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id D3E098FC0C;
	Sun, 25 Mar 2012 23:50:34 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2PNoYgj004761;
	Sun, 25 Mar 2012 23:50:34 GMT (envelope-from adrian@svn.freebsd.org)
Received: (from adrian@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2PNoYRw004759;
	Sun, 25 Mar 2012 23:50:34 GMT (envelope-from adrian@svn.freebsd.org)
Message-Id: <201203252350.q2PNoYRw004759@svn.freebsd.org>
From: Adrian Chadd 
Date: Sun, 25 Mar 2012 23:50:34 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233480 - head/sys/dev/ath
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sun, 25 Mar 2012 23:50:35 -0000

Author: adrian
Date: Sun Mar 25 23:50:34 2012
New Revision: 233480
URL: http://svn.freebsd.org/changeset/base/233480

Log:
  Add some more debugging to try and nail down exactly what's going on when
  I see traffic stalls.
  
  It turns out that the bug isn't because the first and last frame in the
  BAW is in the software queue.  It is more likely that it's because
  the first frame in the BAW is still in the software queue and thus there's
  no more room to allocate and do subsequent TX.
  
  PR:		kern/166357

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

Modified: head/sys/dev/ath/if_ath_tx.c
==============================================================================
--- head/sys/dev/ath/if_ath_tx.c	Sun Mar 25 21:54:36 2012	(r233479)
+++ head/sys/dev/ath/if_ath_tx.c	Sun Mar 25 23:50:34 2012	(r233480)
@@ -2357,6 +2357,7 @@ ath_tx_xmit_aggr(struct ath_softc *sc, s
 	/* paused? queue */
 	if (tid->paused) {
 		ATH_TXQ_INSERT_TAIL(tid, bf, bf_list);
+		/* XXX don't sched - we're paused! */
 		return;
 	}
 
@@ -2647,13 +2648,19 @@ ath_tx_tid_drain(struct ath_softc *sc, s
 		if (t == 0) {
 			device_printf(sc->sc_dev,
 			    "%s: node %p: bf=%p: addbaw=%d, dobaw=%d, "
-			    "seqno_assign=%d, seqno_required=%d, seqno=%d\n",
+			    "seqno_assign=%d, seqno_required=%d, seqno=%d, retry=%d\n",
 			    __func__, ni, bf,
 			    bf->bf_state.bfs_addedbaw,
 			    bf->bf_state.bfs_dobaw,
 			    bf->bf_state.bfs_need_seqno,
 			    bf->bf_state.bfs_seqno_assigned,
-			    SEQNO(bf->bf_state.bfs_seqno));
+			    SEQNO(bf->bf_state.bfs_seqno),
+			    bf->bf_state.bfs_retries);
+			device_printf(sc->sc_dev,
+			    "%s: node %p: bf=%p: tid txq_depth=%d hwq_depth=%d\n",
+			    __func__, ni, bf,
+			    tid->axq_depth,
+			    tid->hwq_depth);
 			device_printf(sc->sc_dev,
 			    "%s: node %p: bf=%p: tid %d: txq_depth=%d, "
 			    "txq_aggr_depth=%d, sched=%d, paused=%d, "

From owner-svn-src-head@FreeBSD.ORG  Mon Mar 26 01:26:34 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 92DB7106564A;
	Mon, 26 Mar 2012 01:26:34 +0000 (UTC)
	(envelope-from gonzo@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 7E2E78FC18;
	Mon, 26 Mar 2012 01:26:34 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2Q1QYpx007894;
	Mon, 26 Mar 2012 01:26:34 GMT (envelope-from gonzo@svn.freebsd.org)
Received: (from gonzo@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2Q1QYVD007892;
	Mon, 26 Mar 2012 01:26:34 GMT (envelope-from gonzo@svn.freebsd.org)
Message-Id: <201203260126.q2Q1QYVD007892@svn.freebsd.org>
From: Oleksandr Tymoshenko 
Date: Mon, 26 Mar 2012 01:26:34 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233484 - head/sys/cddl/dev/dtrace/mips
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Mon, 26 Mar 2012 01:26:34 -0000

Author: gonzo
Date: Mon Mar 26 01:26:33 2012
New Revision: 233484
URL: http://svn.freebsd.org/changeset/base/233484

Log:
  Use macroses to load/store pointers and increase indexes instead of
      hardcoded MIPS64 instructions

Modified:
  head/sys/cddl/dev/dtrace/mips/dtrace_asm.S

Modified: head/sys/cddl/dev/dtrace/mips/dtrace_asm.S
==============================================================================
--- head/sys/cddl/dev/dtrace/mips/dtrace_asm.S	Mon Mar 26 01:16:56 2012	(r233483)
+++ head/sys/cddl/dev/dtrace/mips/dtrace_asm.S	Mon Mar 26 01:26:33 2012	(r233484)
@@ -158,7 +158,7 @@ uint32_t
 dtrace_fuword32_nocheck(void *addr)
 */
 LEAF(dtrace_fuword32_nocheck)
-	lwu	v0, 0(a0)
+	lw	v0, 0(a0)
 	j	ra
 	nop
 END(dtrace_fuword32_nocheck)
@@ -189,9 +189,9 @@ LEAF(dtrace_copy)
 	nop
 	lbu	t0, 0(a0)
 	sb	t0, 0(a1)
-	daddu	a0, a0, 1
-	daddu	a1, a1, 1
-	dsubu	a2, a2, 1
+	PTR_ADDU	a0, a0, 1
+	PTR_ADDU	a1, a1, 1
+	INT_SUBU	a2, a2, 1
 	j	1b
 	nop
 2:
@@ -209,9 +209,9 @@ LEAF(dtrace_copystr)
 1:
 	lbu	t0, 0(a0)
 	sb	t0, 0(a1)
-	daddu	a0, a0, 1
-	daddu	a1, a1, 1
-	dsubu	a2, a2, 1
+	PTR_ADDU	a0, a0, 1
+	PTR_ADDU	a1, a1, 1
+	INT_SUBU	a2, a2, 1
 	beqz	t0, 2f
 	nop
 	lhu	t1, (a3)
@@ -231,9 +231,9 @@ void dtrace_invop_init(void)
 */
 LEAF(dtrace_invop_init)
 	/* XXX: impement it properly */
-	dla	t0, dtrace_invop_jump_addr
+	PTR_LA	t0, dtrace_invop_jump_addr
 	/* dla	t1, dtrace_invop_start */
-	sd	zero, 0(t0)
+	PTR_S	zero, 0(t0)
 	j	ra
 	nop
 END(dtrace_invop_init)
@@ -242,8 +242,8 @@ END(dtrace_invop_init)
 void dtrace_invop_uninit(void)
 */
 LEAF(dtrace_invop_uninit)
-	dla	t0, dtrace_invop_jump_addr
-	sd	zero, 0(t0)
+	PTR_LA	t0, dtrace_invop_jump_addr
+	PTR_S	zero, 0(t0)
 	j	ra
 	nop
 END(dtrace_invop_uninit)

From owner-svn-src-head@FreeBSD.ORG  Mon Mar 26 02:43:46 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: by hub.freebsd.org (Postfix, from userid 1033)
	id AF0BB1065674; Mon, 26 Mar 2012 02:43:46 +0000 (UTC)
Date: Mon, 26 Mar 2012 02:43:46 +0000
From: Alexey Dokuchaev 
To: Robert Millan 
Message-ID: <20120326024346.GA49199@FreeBSD.org>
References: <201203252154.q2PLsaWr001068@svn.freebsd.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=koi8-r
Content-Disposition: inline
In-Reply-To: <201203252154.q2PLsaWr001068@svn.freebsd.org>
User-Agent: Mutt/1.4.2.1i
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r233479 - head/sys/dev/aic7xxx/aicasm
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Mon, 26 Mar 2012 02:43:46 -0000

On Sun, Mar 25, 2012 at 09:54:36PM +0000, Robert Millan wrote:
> Author: rmh
> Date: Sun Mar 25 21:54:36 2012
> New Revision: 233479
> URL: http://svn.freebsd.org/changeset/base/233479
> 
> Log:
>   Follow non-BSD case when GNU/Hurd is detected.

Oh how do I love commit messages like this one.  Feels so '90s...

./danfe

From owner-svn-src-head@FreeBSD.ORG  Mon Mar 26 05:35:35 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 6B5DE106566B;
	Mon, 26 Mar 2012 05:35:35 +0000 (UTC)
	(envelope-from Cy.Schubert@komquats.com)
Received: from idcmail-mo1so.shaw.ca (idcmail-mo1so.shaw.ca [24.71.223.10])
	by mx1.freebsd.org (Postfix) with ESMTP id 147098FC15;
	Mon, 26 Mar 2012 05:35:34 +0000 (UTC)
Received: from pd3ml3so-ssvc.prod.shaw.ca ([10.0.141.149])
	by pd2mo1so-svcs.prod.shaw.ca with ESMTP; 25 Mar 2012 23:35:34 -0600
X-Cloudmark-SP-Filtered: true
X-Cloudmark-SP-Result: v=1.1 cv=zk9oM8twhc3i0pWciPL6Xc/pqaeDF/K3qFEQp81fRTo=
	c=1 sm=1
	a=g2nFUZfGhBYA:10 a=QrugwKR0C_UA:10 a=wAGQQ9Az6v0A:10 a=BLceEmwcHowA:10
	a=ICAaq7hcmGcA:10 a=kj9zAlcOel0A:10 a=IbtKDeXwb2+SRU442/pi3A==:17
	a=6I5d2MoRAAAA:8 a=BWvPGDcYAAAA:8 a=-LNdWuVWa0cFcNFywoIA:9
	a=8J2rZIzaxqlN7Le0N90A:7 a=CjuIK1q_8ugA:10 a=V7tsTZBp22UA:10
	a=SV7veod9ZcQA:10 a=HpAAvcLHHh0Zw7uRqdWCyQ==:117
Received: from unknown (HELO spqr.komquats.com) ([96.50.7.119])
	by pd3ml3so-dmz.prod.shaw.ca with ESMTP; 25 Mar 2012 23:35:34 -0600
Received: from slippy.cwsent.com (slippy [10.1.1.91])
	by spqr.komquats.com (Postfix) with ESMTP id A785181;
	Sun, 25 Mar 2012 22:35:33 -0700 (PDT)
Received: from slippy (localhost [127.0.0.1])
	by slippy.cwsent.com (8.14.5/8.14.5) with ESMTP id q2Q5ZXE7043378;
	Sun, 25 Mar 2012 22:35:33 -0700 (PDT)
	(envelope-from Cy.Schubert@komquats.com)
Message-Id: <201203260535.q2Q5ZXE7043378@slippy.cwsent.com>
X-Mailer: exmh version 2.7.2 01/07/2005 with nmh-1.3
From: Cy Schubert 
X-os: FreeBSD
X-Sender: cy@cwsent.com
X-URL: http://www.komquats.com/
To: Marius Strobl 
In-Reply-To: Your message of "Wed, 21 Mar 2012 08:57:15 -0000."
	<201203210857.q2L8vFLB062984@svn.freebsd.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Date: Sun, 25 Mar 2012 22:35:33 -0700
Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org,
	src-committers@FreeBSD.org
Subject: Re: svn commit: r233274 - in head/sys/dev/ata: . chipsets
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: Cy Schubert 
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Mon, 26 Mar 2012 05:35:35 -0000

In message <201203210857.q2L8vFLB062984@svn.freebsd.org>, Marius Strobl 
writes:
> Author: marius
> Date: Wed Mar 21 08:57:15 2012
> New Revision: 233274
> URL: http://svn.freebsd.org/changeset/base/233274
> 
> Log:
>   Remove remnants of ATA_LOCKING uses in the ATA_CAM case and wrap it
>   along with functions, SYSCTLs and tunables that are not used with
>   ATA_CAM in #ifndef ATA_CAM, similar to the existing #ifdef'ed ATA_CAM
>   code for the other way around. This makes it easier to understand
>   which parts of ata(4) actually are used in the new world order and
>   to later on remove the !ATA_CAM bits. It also makes it obvious that
>   there is something fishy with the C-bus front-end as well as in the
>   ATP850 support, as these used ATA_LOCKING which is defunct in the
>   ATA_CAM case. When fixing the former, ATA_LOCKING probably needs to
>   be brought back in some form or other.
>   
>   Reviewed by:	mav
>   MFC after:	1 week
> 
> Modified:
>   head/sys/dev/ata/ata-all.c
>   head/sys/dev/ata/ata-cbus.c
>   head/sys/dev/ata/ata-pci.c
>   head/sys/dev/ata/ata-pci.h
>   head/sys/dev/ata/ata-queue.c
>   head/sys/dev/ata/chipsets/ata-acard.c
> 
[... diff removed for brevity ...]

Hi,

This commit broke kernels with device atapicam specified:

# ATA and ATAPI devices
device          atapicam        # emulate ATAPI devices as SCSI ditto via 
CAM
                                        # needs CAM to be present (scbus & 
pass)

Here are two examples when device atapicam is specified in the kernel 
config:

cd /usr/obj/dsk03/src/svn-current/sys/BREAK; MAKEOBJDIRPREFIX=/usr/obj  
MACHINE_ARCH=i386  MACHINE=i386  CPUTYPE= GROFF_BIN_PATH=/usr/obj/dsk03/src/
svn-current/tmp/legacy/usr/bin  GROFF_FONT_PATH=/usr/obj/dsk03/src/svn-curre
nt/tmp/legacy/usr/share/groff_font  GROFF_TMAC_PATH=/usr/obj/dsk03/src/svn-c
urrent/tmp/legacy/usr/share/tmac  _SHLIBDIRPREFIX=/usr/obj/dsk03/src/svn-cur
rent/tmp  VERSION="FreeBSD 10.0-CURRENT i386 1000009"  INSTALL="sh 
/dsk03/src/svn-current/tools/install.sh"  PATH=/usr/obj/dsk03/src/svn-curren
t/tmp/legacy/usr/sbin:/usr/obj/dsk03/src/svn-current/tmp/legacy/usr/bin:/usr
/obj/dsk03/src/svn-current/tmp/legacy/usr/games:/usr/obj/dsk03/src/svn-curre
nt/tmp/usr/sbin:/usr/obj/dsk03/src/svn-current/tmp/usr/bin:/usr/obj/dsk03/sr
c/svn-current/tmp/usr/games:/sbin:/bin:/usr/sbin:/usr/bin make 
KERNEL=kernel all -DNO_MODULES_OBJ
linking kernel.debug
atapi-cam.o: In function `atapi_action':
/dsk03/src/svn-current/sys/dev/ata/atapi-cam.c:436: undefined reference to 
`ata_controlcmd'
/dsk03/src/svn-current/sys/dev/ata/atapi-cam.c:651: undefined reference to 
`ata_queue_request'
*** [kernel.debug] Error code 1

Stop in /dsk02/obj/dsk03/src/svn-current/sys/BREAK.
*** [buildkernel] Error code 1

Stop in /dsk03/src/svn-current.
*** [buildkernel] Error code 1

Stop in /dsk03/src/svn-current.
bob# 

	... and later ...

cc -c -O -pipe  -std=c99 -g -Wall -Wredundant-decls -Wnested-externs 
-Wstrict-prototypes  -Wmissing-prototypes -Wpointer-arith -Winline 
-Wcast-qual  -Wundef -Wno-pointer-sign -fformat-extensions  
-Wmissing-include-dirs -fdiagnostics-show-option   -nostdinc  -I. 
-I/dsk03/src/svn-current/sys -I/dsk03/src/svn-current/sys/contrib/altq 
-D_KERNEL -DHAVE_KERNEL_OPTION_HEADERS -include opt_global.h -fno-common 
-finline-limit=8000 --param inline-unit-growth=100 --param 
large-function-growth=1000  -mno-align-long-strings 
-mpreferred-stack-boundary=2 -mno-mmx -mno-sse -msoft-float -ffreestanding 
-fstack-protector -Werror  vers.c
linking kernel.debug
ata-queue.o: In function `ata_controlcmd':
/dsk03/src/svn-current/sys/dev/ata/ata-queue.c:154: undefined reference to 
`ata_queue_request'
ata-queue.o: In function `ata_atapicmd':
/dsk03/src/svn-current/sys/dev/ata/ata-queue.c:177: undefined reference to 
`ata_queue_request'
atapi-cam.o: In function `atapi_action':
/dsk03/src/svn-current/sys/dev/ata/atapi-cam.c:651: undefined reference to 
`ata_queue_request'
*** [kernel.debug] Error code 1

Stop in /dsk02/obj/dsk03/src/svn-current/sys/BREAK.
*** [buildkernel] Error code 1

Stop in /dsk03/src/svn-current.
*** [buildkernel] Error code 1

Stop in /dsk03/src/svn-current.
bob# 

There are many more like this.

And, the patch to fix the issue:

Index: ata-queue.c
===================================================================
--- ata-queue.c	(revision 233460)
+++ ata-queue.c	(working copy)
@@ -43,14 +43,11 @@
 #include 
 #include 
 
-#ifndef ATA_CAM
 /* prototypes */
 static void ata_completed(void *, int);
 static void ata_sort_queue(struct ata_channel *ch, struct ata_request 
*request);
 static const char *ata_skey2str(u_int8_t);
-#endif
 
-#ifndef ATA_CAM
 void
 ata_queue_request(struct ata_request *request)
 {
@@ -126,9 +123,7 @@
 	sema_destroy(&request->done);
     }
 }
-#endif
 
-#ifndef ATA_CAM
 int
 ata_controlcmd(device_t dev, u_int8_t command, u_int16_t feature,
 	       u_int64_t lba, u_int16_t count)
@@ -158,9 +153,7 @@
     }
     return error;
 }
-#endif
 
-#ifndef ATA_CAM
 int
 ata_atapicmd(device_t dev, u_int8_t *ccb, caddr_t data,
 	     int count, int flags, int timeout)
@@ -183,9 +176,7 @@
     }
     return error;
 }
-#endif
 
-#ifndef ATA_CAM
 void
 ata_start(device_t dev)
 {
@@ -244,9 +235,7 @@
 	}
     }
 }
-#endif
 
-#ifndef ATA_CAM
 void
 ata_finish(struct ata_request *request)
 {
@@ -274,9 +263,7 @@
 	}
     }
 }
-#endif
 
-#ifndef ATA_CAM
 static void
 ata_completed(void *context, int dummy)
 {
@@ -508,7 +495,6 @@
     if (ch)
 	ata_start(ch->dev);
 }
-#endif
 
 void
 ata_timeout(struct ata_request *request)
@@ -605,7 +591,6 @@
 }
 #endif
 
-#ifndef ATA_CAM
 static u_int64_t
 ata_get_lba(struct ata_request *request)
 {
@@ -627,9 +612,7 @@
     else
 	return request->u.ata.lba;
 }
-#endif
 
-#ifndef ATA_CAM
 static void
 ata_sort_queue(struct ata_channel *ch, struct ata_request *request)
 {
@@ -682,7 +665,6 @@
 	ch->freezepoint = request;
     TAILQ_INSERT_AFTER(&ch->ata_queue, this, request, chain);
 }
-#endif
 
 const char *
 ata_cmd2str(struct ata_request *request)
@@ -798,7 +780,6 @@
     return buffer;
 }
 
-#ifndef ATA_CAM
 static const char *
 ata_skey2str(u_int8_t skey)
 {
@@ -822,4 +803,3 @@
     default: return("UNKNOWN");
     }
 }
-#endif


-- 
Cheers,
Cy Schubert 
FreeBSD UNIX:     Web:  http://www.FreeBSD.org

	The need of the many outweighs the greed of the few.




From owner-svn-src-head@FreeBSD.ORG  Mon Mar 26 06:50:12 2012
Return-Path: 
Delivered-To: svn-src-head@FreeBSD.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 43F23106566C;
	Mon, 26 Mar 2012 06:50:12 +0000 (UTC)
	(envelope-from marius@alchemy.franken.de)
Received: from alchemy.franken.de (alchemy.franken.de [194.94.249.214])
	by mx1.freebsd.org (Postfix) with ESMTP id B4EFC8FC1E;
	Mon, 26 Mar 2012 06:50:11 +0000 (UTC)
Received: from alchemy.franken.de (localhost [127.0.0.1])
	by alchemy.franken.de (8.14.4/8.14.4/ALCHEMY.FRANKEN.DE) with ESMTP id
	q2Q6o4Xn085026; Mon, 26 Mar 2012 08:50:04 +0200 (CEST)
	(envelope-from marius@alchemy.franken.de)
Received: (from marius@localhost)
	by alchemy.franken.de (8.14.4/8.14.4/Submit) id q2Q6o4Us085025;
	Mon, 26 Mar 2012 08:50:04 +0200 (CEST) (envelope-from marius)
Date: Mon, 26 Mar 2012 08:50:04 +0200
From: Marius Strobl 
To: Cy Schubert 
Message-ID: <20120326065004.GS37560@alchemy.franken.de>
References: <201203210857.q2L8vFLB062984@svn.freebsd.org>
	<201203260535.q2Q5ZXE7043378@slippy.cwsent.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <201203260535.q2Q5ZXE7043378@slippy.cwsent.com>
User-Agent: Mutt/1.4.2.3i
Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org,
	src-committers@FreeBSD.org
Subject: Re: svn commit: r233274 - in head/sys/dev/ata: . chipsets
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Mon, 26 Mar 2012 06:50:12 -0000

On Sun, Mar 25, 2012 at 10:35:33PM -0700, Cy Schubert wrote:
> In message <201203210857.q2L8vFLB062984@svn.freebsd.org>, Marius Strobl 
> writes:
> > Author: marius
> > Date: Wed Mar 21 08:57:15 2012
> > New Revision: 233274
> > URL: http://svn.freebsd.org/changeset/base/233274
> > 
> > Log:
> >   Remove remnants of ATA_LOCKING uses in the ATA_CAM case and wrap it
> >   along with functions, SYSCTLs and tunables that are not used with
> >   ATA_CAM in #ifndef ATA_CAM, similar to the existing #ifdef'ed ATA_CAM
> >   code for the other way around. This makes it easier to understand
> >   which parts of ata(4) actually are used in the new world order and
> >   to later on remove the !ATA_CAM bits. It also makes it obvious that
> >   there is something fishy with the C-bus front-end as well as in the
> >   ATP850 support, as these used ATA_LOCKING which is defunct in the
> >   ATA_CAM case. When fixing the former, ATA_LOCKING probably needs to
> >   be brought back in some form or other.
> >   
> >   Reviewed by:	mav
> >   MFC after:	1 week
> > 
> > Modified:
> >   head/sys/dev/ata/ata-all.c
> >   head/sys/dev/ata/ata-cbus.c
> >   head/sys/dev/ata/ata-pci.c
> >   head/sys/dev/ata/ata-pci.h
> >   head/sys/dev/ata/ata-queue.c
> >   head/sys/dev/ata/chipsets/ata-acard.c
> > 
> [... diff removed for brevity ...]
> 
> Hi,
> 
> This commit broke kernels with device atapicam specified:
> 
> # ATA and ATAPI devices
> device          atapicam        # emulate ATAPI devices as SCSI ditto via 
> CAM
>                                         # needs CAM to be present (scbus & 
> pass)
> 
> Here are two examples when device atapicam is specified in the kernel 
> config:
> 

<...>

Apparently, you are using both "device atapicam" and "options ATA_CAM",
which are mutually exclusive at run-time. As an intentional side-effect,
r233274 breaks such configurations. The fact that you could compile
both into the same kernel before was a bug, as ATA_CAM always took
precedence.

> 
> And, the patch to fix the issue:

No, this is backwards.


Marius


From owner-svn-src-head@FreeBSD.ORG  Mon Mar 26 07:31:49 2012
Return-Path: 
Delivered-To: svn-src-head@FreeBSD.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 1B4511065672;
	Mon, 26 Mar 2012 07:31:49 +0000 (UTC)
	(envelope-from brde@optusnet.com.au)
Received: from mail02.syd.optusnet.com.au (mail02.syd.optusnet.com.au
	[211.29.132.183])
	by mx1.freebsd.org (Postfix) with ESMTP id A7FD78FC0A;
	Mon, 26 Mar 2012 07:31:48 +0000 (UTC)
Received: from c211-30-171-136.carlnfd1.nsw.optusnet.com.au
	(c211-30-171-136.carlnfd1.nsw.optusnet.com.au [211.30.171.136])
	by mail02.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id
	q2Q7VjpQ000605
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO);
	Mon, 26 Mar 2012 18:31:46 +1100
Date: Mon, 26 Mar 2012 18:31:45 +1100 (EST)
From: Bruce Evans 
X-X-Sender: bde@besplex.bde.org
To: Alexander Kabaev 
In-Reply-To: <20120325162528.7f73300c@kan.dyndns.org>
Message-ID: <20120326173737.U827@besplex.bde.org>
References: <201203212055.q2LKtMYR093218@svn.freebsd.org>
	<20120325162528.7f73300c@kan.dyndns.org>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed
Cc: svn-src-head@FreeBSD.org, Marius Strobl ,
	src-committers@FreeBSD.org, svn-src-all@FreeBSD.org
Subject: Re: svn commit: r233288 - in head/sys: boot/common libkern sys
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Mon, 26 Mar 2012 07:31:49 -0000

On Sun, 25 Mar 2012, Alexander Kabaev wrote:

> On Wed, 21 Mar 2012 20:55:22 +0000 (UTC)
> Marius Strobl  wrote:
>
> 
>> Modified: head/sys/sys/libkern.h
>> ==============================================================================
>> --- head/sys/sys/libkern.h	Wed Mar 21 20:53:47 2012
>> (r233287) +++ head/sys/sys/libkern.h	Wed Mar 21 20:55:21
>> 2012	(r233288) @@ -121,7 +121,7 @@ size_t	 strspn(const
>> char *, const char char	*strstr(const char *, const char *);
>>  int	 strvalid(const char *, size_t);
>>
>> -extern uint32_t crc32_tab[];
>> +extern const uint32_t const crc32_tab[];
>>
>>  static __inline uint32_t
>>  crc32_raw(const void *buf, size_t size, uint32_t crc)
>
> g++ produces "error: duplicate 'const'" on this changed line. Leaving
> the question as to why this file is ever being compiled by C++ on the
> conscience of of VirtualBox authors, I would suggest partially backing
> out this commit and getting easier on 'const' for C++'s sake.

It does have a duplicate `const'.  This is not just a style bug, since
duplicate type qualifiers are a constraint error in C90, and apparently
in C++.

TenDRA says that it violates [ISO C90 6.5.3], and indeed 6.5.3 says:

     Constraints
       The same type qualifier shall not appear more than once...
       either directly [as here] or via one or more typedefs.

6.5.3 in C90 corresponds to 6.7.3 in C99, and C99 no longer says this.
This change causes many confusing variations in behaviour:

For CC=gcc-3.3.3:
- ${CC}          without -pedantic  warns about this
- ${CC} -std=c89 without -pedantic  warns about this
- ${CC} -std=c99 with    -pedantic  doesn't warn about this (correct)
For CC=gcc-3.4.6 and gcc-4.2.1:
- ${CC}          without -pedantic  doesn't warn about this (broken)
- ${CC}          with    -pedantic  warns about this
- ${CC} -std=c89 without -pedantic  doesn't warn about this (broken)
- ${CC} -std=c99 with    -pedantic  doesn't warn about this (correct)
For CC=clang:
- ${CC}          without -pedantic  doesn't warn about this (broken)
- ${CC}          with    -pedantic  doesn't warn about this (broken)
                                     (maybe it defaults to c99, but that
                                     is an even larger incompatibility)
- ${CC} -std=c89 without -pedantic  doesn't warn about this (broken)
- ${CC} -std=c99 with    -pedantic  doesn't warn about this (correct)
For C++: apparently, closest to gcc-3.3.3 and C90.

There are also complications with warnings being broken by default in
"system" headers:
- if libkern.h is a "system" header, then to detect this bug in it,
   -Wsystem-headers must be added to CFLAGS for one the non-broken cases
   non-c99 cases above.

Bruce

From owner-svn-src-head@FreeBSD.ORG  Mon Mar 26 09:34:17 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id E991E106566C;
	Mon, 26 Mar 2012 09:34:17 +0000 (UTC)
	(envelope-from melifaro@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id CA29C8FC1B;
	Mon, 26 Mar 2012 09:34:17 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2Q9YHm5025595;
	Mon, 26 Mar 2012 09:34:17 GMT
	(envelope-from melifaro@svn.freebsd.org)
Received: (from melifaro@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2Q9YHFV025590;
	Mon, 26 Mar 2012 09:34:17 GMT
	(envelope-from melifaro@svn.freebsd.org)
Message-Id: <201203260934.q2Q9YHFV025590@svn.freebsd.org>
From: "Alexander V. Chernikov" 
Date: Mon, 26 Mar 2012 09:34:17 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233505 - in head: share/man/man9 sys/kern sys/sys
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Mon, 26 Mar 2012 09:34:18 -0000

Author: melifaro
Date: Mon Mar 26 09:34:17 2012
New Revision: 233505
URL: http://svn.freebsd.org/changeset/base/233505

Log:
  - Add knlist_init_rw_reader() function to kqueue(9).
  Function acquired reader lock if needed.
  Assert check for reader or writer lock (RA_LOCKED / RA_UNLOCKED)
  - While here, add knlist_init_mtx.9 to MLINKS and fix some style(9) issues
  
  Reviewed by:    glebius
  Approved by:    ae(mentor)
  
  MFC after:      2 weeks

Modified:
  head/share/man/man9/Makefile
  head/share/man/man9/kqueue.9
  head/sys/kern/kern_event.c
  head/sys/sys/event.h

Modified: head/share/man/man9/Makefile
==============================================================================
--- head/share/man/man9/Makefile	Mon Mar 26 09:31:15 2012	(r233504)
+++ head/share/man/man9/Makefile	Mon Mar 26 09:34:17 2012	(r233505)
@@ -773,6 +773,8 @@ MLINKS+=kqueue.9 knlist_add.9 \
 	kqueue.9 knlist_destroy.9 \
 	kqueue.9 knlist_empty.9 \
 	kqueue.9 knlist_init.9 \
+	kqueue.9 knlist_init_mtx.9 \
+	kqueue.9 knlist_init_rw_reader.9 \
 	kqueue.9 knlist_remove.9 \
 	kqueue.9 knlist_remove_inevent.9 \
 	kqueue.9 knote_fdclose.9 \

Modified: head/share/man/man9/kqueue.9
==============================================================================
--- head/share/man/man9/kqueue.9	Mon Mar 26 09:31:15 2012	(r233504)
+++ head/share/man/man9/kqueue.9	Mon Mar 26 09:34:17 2012	(r233505)
@@ -24,14 +24,14 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd February 25, 2012
+.Dd March 26, 2012
 .Dt KQUEUE 9
 .Os
 .Sh NAME
 .Nm kqueue_add_filteropts , kqueue_del_filteropts ,
 .Nm kqfd_register ,
 .Nm knote_fdclose ,
-.Nm knlist_init , knlist_init_mtx ,
+.Nm knlist_init , knlist_init_mtx , knlist_init_rw_reader ,
 .Nm knlist_add , knlist_remove , knlist_remove_inevent , knlist_empty ,
 .Nm knlist_clear , knlist_delete , knlist_destroy ,
 .Nm KNOTE_LOCKED , KNOTE_UNLOCKED
@@ -57,6 +57,8 @@
 .Ft void
 .Fn knlist_init_mtx "struct knlist *knl" "struct mtx *lock"
 .Ft void
+.Fn knlist_init_rw_reader "struct knlist *knl" "struct rwlock *lock"
+.Ft void
 .Fn knlist_add "struct knlist *knl" "struct knote *kn" "int islocked"
 .Ft void
 .Fn knlist_remove "struct knlist *knl" "struct knote *kn" "int islocked"
@@ -259,8 +261,10 @@ If used, the
 .Vt knlist
 must be initialized with either
 .Fn knlist_init
+,
+.Fn knlist_init_mtx
 or
-.Fn knlist_init_mtx .
+.Fn knlist_init_rw_reader .
 The
 .Vt knlist
 structure may be embedded into the object structure.
@@ -305,6 +309,19 @@ style
 lock.
 .Pp
 The function
+.Fn knlist_init_rw_reader
+may be used to initialize a
+.Vt knlist
+when
+.Fa lock
+is a
+.Xr rwlock 9
+read lock.
+Lock is acquired via
+.Fn rw_rlock
+function.
+.Pp
+The function
 .Fn knlist_empty
 returns true when there are no
 .Vt knotes

Modified: head/sys/kern/kern_event.c
==============================================================================
--- head/sys/kern/kern_event.c	Mon Mar 26 09:31:15 2012	(r233504)
+++ head/sys/kern/kern_event.c	Mon Mar 26 09:34:17 2012	(r233505)
@@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -1869,6 +1870,7 @@ knlist_remove_inevent(struct knlist *knl
 int
 knlist_empty(struct knlist *knl)
 {
+
 	KNL_ASSERT_LOCKED(knl);
 	return SLIST_EMPTY(&knl->kl_list);
 }
@@ -1882,27 +1884,59 @@ static void knlist_mtx_unlock(void *arg)
 static void
 knlist_mtx_lock(void *arg)
 {
+
 	mtx_lock((struct mtx *)arg);
 }
 
 static void
 knlist_mtx_unlock(void *arg)
 {
+
 	mtx_unlock((struct mtx *)arg);
 }
 
 static void
 knlist_mtx_assert_locked(void *arg)
 {
+
 	mtx_assert((struct mtx *)arg, MA_OWNED);
 }
 
 static void
 knlist_mtx_assert_unlocked(void *arg)
 {
+
 	mtx_assert((struct mtx *)arg, MA_NOTOWNED);
 }
 
+static void
+knlist_rw_rlock(void *arg)
+{
+
+	rw_rlock((struct rwlock *)arg);
+}
+
+static void
+knlist_rw_runlock(void *arg)
+{
+
+	rw_runlock((struct rwlock *)arg);
+}
+
+static void
+knlist_rw_assert_locked(void *arg)
+{
+
+	rw_assert((struct rwlock *)arg, RA_LOCKED);
+}
+
+static void
+knlist_rw_assert_unlocked(void *arg)
+{
+
+	rw_assert((struct rwlock *)arg, RA_UNLOCKED);
+}
+
 void
 knlist_init(struct knlist *knl, void *lock, void (*kl_lock)(void *),
     void (*kl_unlock)(void *),
@@ -1942,6 +1976,14 @@ knlist_init_mtx(struct knlist *knl, stru
 }
 
 void
+knlist_init_rw_reader(struct knlist *knl, struct rwlock *lock)
+{
+
+	knlist_init(knl, lock, knlist_rw_rlock, knlist_rw_runlock,
+	    knlist_rw_assert_locked, knlist_rw_assert_unlocked);
+}
+
+void
 knlist_destroy(struct knlist *knl)
 {
 

Modified: head/sys/sys/event.h
==============================================================================
--- head/sys/sys/event.h	Mon Mar 26 09:31:15 2012	(r233504)
+++ head/sys/sys/event.h	Mon Mar 26 09:34:17 2012	(r233505)
@@ -234,6 +234,7 @@ struct thread;
 struct proc;
 struct knlist;
 struct mtx;
+struct rwlock;
 
 extern void	knote(struct knlist *list, long hint, int lockflags);
 extern void	knote_fork(struct knlist *list, int pid);
@@ -245,6 +246,7 @@ extern void	knlist_init(struct knlist *k
     void (*kl_lock)(void *), void (*kl_unlock)(void *),
     void (*kl_assert_locked)(void *), void (*kl_assert_unlocked)(void *));
 extern void	knlist_init_mtx(struct knlist *knl, struct mtx *lock);
+extern void	knlist_init_rw_reader(struct knlist *knl, struct rwlock *lock);
 extern void	knlist_destroy(struct knlist *knl);
 extern void	knlist_cleardel(struct knlist *knl, struct thread *td,
 	int islocked, int killkn);

From owner-svn-src-head@FreeBSD.ORG  Mon Mar 26 11:48:48 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 9D3D81065672;
	Mon, 26 Mar 2012 11:48:48 +0000 (UTC)
	(envelope-from ivoras@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 88B6C8FC17;
	Mon, 26 Mar 2012 11:48:48 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2QBmmAN031470;
	Mon, 26 Mar 2012 11:48:48 GMT (envelope-from ivoras@svn.freebsd.org)
Received: (from ivoras@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2QBmmgj031468;
	Mon, 26 Mar 2012 11:48:48 GMT (envelope-from ivoras@svn.freebsd.org)
Message-Id: <201203261148.q2QBmmgj031468@svn.freebsd.org>
From: Ivan Voras 
Date: Mon, 26 Mar 2012 11:48:48 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233506 - head/etc
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Mon, 26 Mar 2012 11:48:48 -0000

Author: ivoras
Date: Mon Mar 26 11:48:47 2012
New Revision: 233506
URL: http://svn.freebsd.org/changeset/base/233506

Log:
  Add MySQL port 3306
  
  Obtained from:	http://www.iana.org/assignments/port-numbers
  MFC after:	1 week

Modified:
  head/etc/services

Modified: head/etc/services
==============================================================================
--- head/etc/services	Mon Mar 26 09:34:17 2012	(r233505)
+++ head/etc/services	Mon Mar 26 11:48:47 2012	(r233506)
@@ -2219,6 +2219,8 @@ iscsi-target	3260/tcp   # iSCSI port
 iscsi-target	3260/udp   # iSCSI port
 ccmail		3264/tcp   #cc:mail/lotus
 ccmail		3264/udp   #cc:mail/lotus
+mysql		3306/tcp   #MySQL
+mysql		3306/udp   #MySQL
 dec-notes	3333/tcp   #DEC Notes
 dec-notes	3333/udp   #DEC Notes
 rdp		3389/tcp   #Microsoft Remote Desktop Protocol

From owner-svn-src-head@FreeBSD.ORG  Mon Mar 26 12:18:15 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 952121065677;
	Mon, 26 Mar 2012 12:18:15 +0000 (UTC)
	(envelope-from dumbbell@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 7DE9D8FC23;
	Mon, 26 Mar 2012 12:18:15 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2QCIFDi032409;
	Mon, 26 Mar 2012 12:18:15 GMT
	(envelope-from dumbbell@svn.freebsd.org)
Received: (from dumbbell@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2QCIFUf032406;
	Mon, 26 Mar 2012 12:18:15 GMT
	(envelope-from dumbbell@svn.freebsd.org)
Message-Id: <201203261218.q2QCIFUf032406@svn.freebsd.org>
From: Jean-Sebastien Pedron 
Date: Mon, 26 Mar 2012 12:18:15 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233507 - head/lib/libpam/modules/pam_exec
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Mon, 26 Mar 2012 12:18:15 -0000

Author: dumbbell
Date: Mon Mar 26 12:18:15 2012
New Revision: 233507
URL: http://svn.freebsd.org/changeset/base/233507

Log:
  Use program exit status as pam_exec return code (optional)
  
  pam_exec(8) now accepts a new option "return_prog_exit_status". When
  set, the program exit status is used as the pam_exec return code. It
  allows the program to tell why the step failed (eg. user unknown).
  However, if it exits with a code not allowed by the calling PAM service
  module function (see $PAM_SM_FUNC below), a warning is logged and
  PAM_SERVICE_ERR is returned.
  
  The following changes are related to this new feature but they apply no
  matter if the "return_prog_exit_status" option is set or not.
  
  The environment passed to the program is extended:
      o  $PAM_SM_FUNC contains the name of the PAM service module function
         (eg. pam_sm_authenticate).
      o  All valid PAM return codes' numerical values are available
         through variables named after the return code name. For instance,
         $PAM_SUCCESS, $PAM_USER_UNKNOWN or $PAM_PERM_DENIED.
  
  pam_exec return code better reflects what went on:
      o  If the program exits with !0, the return code is now
         PAM_PERM_DENIED, not PAM_SYSTEM_ERR.
      o  If the program fails because of a signal (WIFSIGNALED) or doesn't
         terminate normally (!WIFEXITED), the return code is now
         PAM_SERVICE_ERR, not PAM_SYSTEM_ERR.
      o  If a syscall in pam_exec fails, the return code remains
         PAM_SYSTEM_ERR.
  
  waitpid(2) is called in a loop. If it returns because of EINTR, do it
  again. Before, it would return PAM_SYSTEM_ERR without waiting for the
  child to exit.
  
  Several log messages now include the PAM service module function name.
  
  The man page is updated accordingly.
  
  Reviewed by:	gleb@, des@
  Sponsored by:	Yakaz (http://www.yakaz.com)
  MFC after:	2 weeks

Modified:
  head/lib/libpam/modules/pam_exec/pam_exec.8
  head/lib/libpam/modules/pam_exec/pam_exec.c

Modified: head/lib/libpam/modules/pam_exec/pam_exec.8
==============================================================================
--- head/lib/libpam/modules/pam_exec/pam_exec.8	Mon Mar 26 11:48:47 2012	(r233506)
+++ head/lib/libpam/modules/pam_exec/pam_exec.8	Mon Mar 26 12:18:15 2012	(r233507)
@@ -32,7 +32,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd February 1, 2005
+.Dd February 8, 2012
 .Dt PAM_EXEC 8
 .Os
 .Sh NAME
@@ -45,9 +45,25 @@
 .Pa pam_exec
 .Op Ar arguments
 .Sh DESCRIPTION
-The exec service module for PAM executes the program designated by its
-first argument, with its remaining arguments as command-line
-arguments.
+The exec service module for PAM executes the program designated by
+its first argument if no options are specified, with its remaining
+arguments as command-line arguments.
+If options are specified, the program and its arguments follow the last
+option or
+.Cm --
+if the program name conflicts with an option name.
+.Pp
+The following options may be passed before the program and its
+arguments:
+.Bl -tag -width ".Cm return_prog_exit_status"
+.It Cm return_prog_exit_status
+Use the program exit status as the return code of the pam_sm_* function.
+It must be a valid return value for this function.
+.It Cm --
+Stop options parsing;
+program and its arguments follow.
+.El
+.Pp
 The child's environment is set to the current PAM environment list,
 as returned by
 .Xr pam_getenvlist 3 .
@@ -56,13 +72,69 @@ variables:
 .Ev PAM_RHOST ,
 .Ev PAM_RUSER ,
 .Ev PAM_SERVICE ,
-.Ev PAM_TTY ,
+.Ev PAM_SM_FUNC ,
+.Ev PAM_TTY
 and
 .Ev PAM_USER .
+.Pp
+The
+.Ev PAM_SM_FUNC
+variable contains the name of the PAM service module function being
+called.
+It may be:
+.Bl -dash -offset indent -compact
+.It
+pam_sm_acct_mgmt
+.It
+pam_sm_authenticate
+.It
+pam_sm_chauthtok
+.It
+pam_sm_close_session
+.It
+pam_sm_open_session
+.It
+pam_sm_setcred
+.El
+.Pp
+If
+.Cm return_prog_exit_status
+is not set (default), the
+.Ev PAM_SM_FUNC
+function returns
+.Er PAM_SUCCESS
+if the program exit status is 0,
+.Er PAM_PERM_DENIED
+otherwise.
+.Pp
+If
+.Cm return_prog_exit_status
+is set, the program exit status is used.
+It should be
+.Er PAM_SUCCESS
+or one of the error codes allowed by the calling
+.Ev PAM_SM_FUNC
+function.
+The valid codes are documented in each function man page.
+If the exit status is not a valid return code,
+.Er PAM_SERVICE_ERR
+is returned.
+Each valid codes numerical value is available as an environment variable
+(eg.\&
+.Ev PAM_SUCESS ,
+.Ev PAM_USER_UNKNOWN ,
+etc).
+This is useful in shell scripts for instance.
 .Sh SEE ALSO
 .Xr pam_get_item 3 ,
 .Xr pam.conf 5 ,
-.Xr pam 8
+.Xr pam 8 ,
+.Xr pam_sm_acct_mgmt 8 ,
+.Xr pam_sm_authenticate 8 ,
+.Xr pam_sm_chauthtok 8,
+.Xr pam_sm_close_session 8 ,
+.Xr pam_sm_open_session 8 ,
+.Xr pam_sm_setcred 8 .
 .Sh AUTHORS
 The
 .Nm

Modified: head/lib/libpam/modules/pam_exec/pam_exec.c
==============================================================================
--- head/lib/libpam/modules/pam_exec/pam_exec.c	Mon Mar 26 11:48:47 2012	(r233506)
+++ head/lib/libpam/modules/pam_exec/pam_exec.c	Mon Mar 26 12:18:15 2012	(r233507)
@@ -60,32 +60,71 @@ static struct {
 	ENV_ITEM(PAM_RUSER),
 };
 
+#define	PAM_RV_COUNT 24
+
 static int
-_pam_exec(pam_handle_t *pamh __unused, int flags __unused,
-    int argc, const char *argv[])
+_pam_exec(pam_handle_t *pamh __unused,
+    const char *func, int flags __unused, int argc, const char *argv[])
 {
-	int envlen, i, nitems, pam_err, status;
-	char *env, **envlist, **tmp;
+	int envlen, i, nitems, pam_err, status, return_prog_exit_status;
+	int nitems_rv;
+	char *env, **envlist, **tmp, *envstr;
 	volatile int childerr;
 	pid_t pid;
 
-	if (argc < 1)
-		return (PAM_SERVICE_ERR);
-
 	/*
 	 * XXX For additional credit, divert child's stdin/stdout/stderr
 	 * to the conversation function.
 	 */
 
 	/*
-	 * Set up the child's environment list.  It consists of the PAM
-	 * environment, plus a few hand-picked PAM items.
+	 * Parse options:
+	 *   return_prog_exit_status:
+	 *     use the program exit status as the return code of pam_exec
+	 *   --:
+	 *     stop options parsing; what follows is the command to execute
+	 */
+	return_prog_exit_status = 0;
+	for (i = 0; i < argc; ++i) {
+		if (strcmp(argv[i], "return_prog_exit_status") == 0) {
+			openpam_log(PAM_LOG_DEBUG,
+			    "%s: Option \"return_prog_exit_status\" enabled",
+			    func);
+			return_prog_exit_status = 1;
+		} else {
+			if (strcmp(argv[i], "--") == 0) {
+				argc--;
+				argv++;
+			}
+
+			break;
+		}
+	}
+
+	argc -= i;
+	argv += i;
+
+	/* Check there's a program name left after parsing options. */
+	if (argc < 1) {
+		openpam_log(PAM_LOG_ERROR, "%s: No program specified: aborting",
+		    func);
+		return (PAM_SERVICE_ERR);
+	}
+
+	/*
+	 * Set up the child's environment list. It consists of the PAM
+	 * environment, plus a few hand-picked PAM items, the pam_sm_*
+	 * function name calling it and, if return_prog_exit_status is
+	 * set, the valid return codes numerical values.
 	 */
 	envlist = pam_getenvlist(pamh);
 	for (envlen = 0; envlist[envlen] != NULL; ++envlen)
 		/* nothing */ ;
 	nitems = sizeof(env_items) / sizeof(*env_items);
-	tmp = realloc(envlist, (envlen + nitems + 1) * sizeof(*envlist));
+	/* Count PAM return values put in the environment. */
+	nitems_rv = return_prog_exit_status ? PAM_RV_COUNT : 0;
+	tmp = realloc(envlist, (envlen + nitems + 1 + nitems_rv + 1) *
+	    sizeof(*envlist));
 	if (tmp == NULL) {
 		openpam_free_envlist(envlist);
 		return (PAM_BUF_ERR);
@@ -93,7 +132,6 @@ _pam_exec(pam_handle_t *pamh __unused, i
 	envlist = tmp;
 	for (i = 0; i < nitems; ++i) {
 		const void *item;
-		char *envstr;
 
 		pam_err = pam_get_item(pamh, env_items[i].item, &item);
 		if (pam_err != PAM_SUCCESS || item == NULL)
@@ -107,10 +145,59 @@ _pam_exec(pam_handle_t *pamh __unused, i
 		envlist[envlen] = NULL;
 	}
 
+	/* Add the pam_sm_* function name to the environment. */
+	asprintf(&envstr, "PAM_SM_FUNC=%s", func);
+	if (envstr == NULL) {
+		openpam_free_envlist(envlist);
+		return (PAM_BUF_ERR);
+	}
+	envlist[envlen++] = envstr;
+
+	/* Add the PAM return values to the environment. */
+	if (return_prog_exit_status) {
+#define	ADD_PAM_RV_TO_ENV(name)						\
+		asprintf(&envstr, #name "=%d", name);			\
+		if (envstr == NULL) {					\
+			openpam_free_envlist(envlist);			\
+			return (PAM_BUF_ERR);				\
+		}							\
+		envlist[envlen++] = envstr
+		/*
+		 * CAUTION: When adding/removing an item in the list
+		 * below, be sure to update the value of PAM_RV_COUNT.
+		 */
+		ADD_PAM_RV_TO_ENV(PAM_ABORT);
+		ADD_PAM_RV_TO_ENV(PAM_ACCT_EXPIRED);
+		ADD_PAM_RV_TO_ENV(PAM_AUTHINFO_UNAVAIL);
+		ADD_PAM_RV_TO_ENV(PAM_AUTHTOK_DISABLE_AGING);
+		ADD_PAM_RV_TO_ENV(PAM_AUTHTOK_ERR);
+		ADD_PAM_RV_TO_ENV(PAM_AUTHTOK_LOCK_BUSY);
+		ADD_PAM_RV_TO_ENV(PAM_AUTHTOK_RECOVERY_ERR);
+		ADD_PAM_RV_TO_ENV(PAM_AUTH_ERR);
+		ADD_PAM_RV_TO_ENV(PAM_BUF_ERR);
+		ADD_PAM_RV_TO_ENV(PAM_CONV_ERR);
+		ADD_PAM_RV_TO_ENV(PAM_CRED_ERR);
+		ADD_PAM_RV_TO_ENV(PAM_CRED_EXPIRED);
+		ADD_PAM_RV_TO_ENV(PAM_CRED_INSUFFICIENT);
+		ADD_PAM_RV_TO_ENV(PAM_CRED_UNAVAIL);
+		ADD_PAM_RV_TO_ENV(PAM_IGNORE);
+		ADD_PAM_RV_TO_ENV(PAM_MAXTRIES);
+		ADD_PAM_RV_TO_ENV(PAM_NEW_AUTHTOK_REQD);
+		ADD_PAM_RV_TO_ENV(PAM_PERM_DENIED);
+		ADD_PAM_RV_TO_ENV(PAM_SERVICE_ERR);
+		ADD_PAM_RV_TO_ENV(PAM_SESSION_ERR);
+		ADD_PAM_RV_TO_ENV(PAM_SUCCESS);
+		ADD_PAM_RV_TO_ENV(PAM_SYSTEM_ERR);
+		ADD_PAM_RV_TO_ENV(PAM_TRY_AGAIN);
+		ADD_PAM_RV_TO_ENV(PAM_USER_UNKNOWN);
+	}
+
+	envlist[envlen] = NULL;
+
 	/*
 	 * Fork and run the command.  By using vfork() instead of fork(),
 	 * we can distinguish between an execve() failure and a non-zero
-	 * exit code from the command.
+	 * exit status from the command.
 	 */
 	childerr = 0;
 	if ((pid = vfork()) == 0) {
@@ -120,81 +207,246 @@ _pam_exec(pam_handle_t *pamh __unused, i
 	}
 	openpam_free_envlist(envlist);
 	if (pid == -1) {
-		openpam_log(PAM_LOG_ERROR, "vfork(): %m");
+		openpam_log(PAM_LOG_ERROR, "%s: vfork(): %m", func);
 		return (PAM_SYSTEM_ERR);
 	}
-	if (waitpid(pid, &status, 0) == -1) {
-		openpam_log(PAM_LOG_ERROR, "waitpid(): %m");
+	while (waitpid(pid, &status, 0) == -1) {
+		if (errno == EINTR)
+			continue;
+		openpam_log(PAM_LOG_ERROR, "%s: waitpid(): %m", func);
 		return (PAM_SYSTEM_ERR);
 	}
 	if (childerr != 0) {
-		openpam_log(PAM_LOG_ERROR, "execve(): %m");
+		openpam_log(PAM_LOG_ERROR, "%s: execve(): %m", func);
 		return (PAM_SYSTEM_ERR);
 	}
 	if (WIFSIGNALED(status)) {
-		openpam_log(PAM_LOG_ERROR, "%s caught signal %d%s",
-		    argv[0], WTERMSIG(status),
+		openpam_log(PAM_LOG_ERROR, "%s: %s caught signal %d%s",
+		    func, argv[0], WTERMSIG(status),
 		    WCOREDUMP(status) ? " (core dumped)" : "");
-		return (PAM_SYSTEM_ERR);
+		return (PAM_SERVICE_ERR);
 	}
 	if (!WIFEXITED(status)) {
-		openpam_log(PAM_LOG_ERROR, "unknown status 0x%x", status);
-		return (PAM_SYSTEM_ERR);
+		openpam_log(PAM_LOG_ERROR, "%s: unknown status 0x%x",
+		    func, status);
+		return (PAM_SERVICE_ERR);
 	}
-	if (WEXITSTATUS(status) != 0) {
-		openpam_log(PAM_LOG_ERROR, "%s returned code %d",
-		    argv[0], WEXITSTATUS(status));
-		return (PAM_SYSTEM_ERR);
+
+	if (return_prog_exit_status) {
+		openpam_log(PAM_LOG_DEBUG,
+		    "%s: Use program exit status as return value: %d",
+		    func, WEXITSTATUS(status));
+		return (WEXITSTATUS(status));
+	} else {
+		return (WEXITSTATUS(status) == 0 ?
+		    PAM_SUCCESS : PAM_PERM_DENIED);
 	}
-	return (PAM_SUCCESS);
 }
 
 PAM_EXTERN int
 pam_sm_authenticate(pam_handle_t *pamh, int flags,
     int argc, const char *argv[])
 {
+	int ret;
+
+	ret = _pam_exec(pamh, __func__, flags, argc, argv);
 
-	return (_pam_exec(pamh, flags, argc, argv));
+	/*
+	 * We must check that the program returned a valid code for this
+	 * function.
+	 */
+	switch (ret) {
+	case PAM_SUCCESS:
+	case PAM_ABORT:
+	case PAM_AUTHINFO_UNAVAIL:
+	case PAM_AUTH_ERR:
+	case PAM_BUF_ERR:
+	case PAM_CONV_ERR:
+	case PAM_CRED_INSUFFICIENT:
+	case PAM_IGNORE:
+	case PAM_MAXTRIES:
+	case PAM_PERM_DENIED:
+	case PAM_SERVICE_ERR:
+	case PAM_SYSTEM_ERR:
+	case PAM_USER_UNKNOWN:
+		break;
+	default:
+		openpam_log(PAM_LOG_ERROR, "%s returned invalid code %d",
+		    argv[0], ret);
+		ret = PAM_SERVICE_ERR;
+	}
+
+	return (ret);
 }
 
 PAM_EXTERN int
 pam_sm_setcred(pam_handle_t *pamh, int flags,
     int argc, const char *argv[])
 {
+	int ret;
 
-	return (_pam_exec(pamh, flags, argc, argv));
+	ret = _pam_exec(pamh, __func__, flags, argc, argv);
+
+	/*
+	 * We must check that the program returned a valid code for this
+	 * function.
+	 */
+	switch (ret) {
+	case PAM_SUCCESS:
+	case PAM_ABORT:
+	case PAM_BUF_ERR:
+	case PAM_CONV_ERR:
+	case PAM_CRED_ERR:
+	case PAM_CRED_EXPIRED:
+	case PAM_CRED_UNAVAIL:
+	case PAM_IGNORE:
+	case PAM_PERM_DENIED:
+	case PAM_SERVICE_ERR:
+	case PAM_SYSTEM_ERR:
+	case PAM_USER_UNKNOWN:
+		break;
+	default:
+		openpam_log(PAM_LOG_ERROR, "%s returned invalid code %d",
+		    argv[0], ret);
+		ret = PAM_SERVICE_ERR;
+	}
+
+	return (ret);
 }
 
 PAM_EXTERN int
 pam_sm_acct_mgmt(pam_handle_t *pamh, int flags,
     int argc, const char *argv[])
 {
+	int ret;
+
+	ret = _pam_exec(pamh, __func__, flags, argc, argv);
 
-	return (_pam_exec(pamh, flags, argc, argv));
+	/*
+	 * We must check that the program returned a valid code for this
+	 * function.
+	 */
+	switch (ret) {
+	case PAM_SUCCESS:
+	case PAM_ABORT:
+	case PAM_ACCT_EXPIRED:
+	case PAM_AUTH_ERR:
+	case PAM_BUF_ERR:
+	case PAM_CONV_ERR:
+	case PAM_IGNORE:
+	case PAM_NEW_AUTHTOK_REQD:
+	case PAM_PERM_DENIED:
+	case PAM_SERVICE_ERR:
+	case PAM_SYSTEM_ERR:
+	case PAM_USER_UNKNOWN:
+		break;
+	default:
+		openpam_log(PAM_LOG_ERROR, "%s returned invalid code %d",
+		    argv[0], ret);
+		ret = PAM_SERVICE_ERR;
+	}
+
+	return (ret);
 }
 
 PAM_EXTERN int
 pam_sm_open_session(pam_handle_t *pamh, int flags,
     int argc, const char *argv[])
 {
+	int ret;
+
+	ret = _pam_exec(pamh, __func__, flags, argc, argv);
 
-	return (_pam_exec(pamh, flags, argc, argv));
+	/*
+	 * We must check that the program returned a valid code for this
+	 * function.
+	 */
+	switch (ret) {
+	case PAM_SUCCESS:
+	case PAM_ABORT:
+	case PAM_BUF_ERR:
+	case PAM_CONV_ERR:
+	case PAM_IGNORE:
+	case PAM_PERM_DENIED:
+	case PAM_SERVICE_ERR:
+	case PAM_SESSION_ERR:
+	case PAM_SYSTEM_ERR:
+		break;
+	default:
+		openpam_log(PAM_LOG_ERROR, "%s returned invalid code %d",
+		    argv[0], ret);
+		ret = PAM_SERVICE_ERR;
+	}
+
+	return (ret);
 }
 
 PAM_EXTERN int
 pam_sm_close_session(pam_handle_t *pamh, int flags,
     int argc, const char *argv[])
 {
+	int ret;
+
+	ret = _pam_exec(pamh, __func__, flags, argc, argv);
+
+	/*
+	 * We must check that the program returned a valid code for this
+	 * function.
+	 */
+	switch (ret) {
+	case PAM_SUCCESS:
+	case PAM_ABORT:
+	case PAM_BUF_ERR:
+	case PAM_CONV_ERR:
+	case PAM_IGNORE:
+	case PAM_PERM_DENIED:
+	case PAM_SERVICE_ERR:
+	case PAM_SESSION_ERR:
+	case PAM_SYSTEM_ERR:
+		break;
+	default:
+		openpam_log(PAM_LOG_ERROR, "%s returned invalid code %d",
+		    argv[0], ret);
+		ret = PAM_SERVICE_ERR;
+	}
 
-	return (_pam_exec(pamh, flags, argc, argv));
+	return (ret);
 }
 
 PAM_EXTERN int
 pam_sm_chauthtok(pam_handle_t *pamh, int flags,
     int argc, const char *argv[])
 {
+	int ret;
+
+	ret = _pam_exec(pamh, __func__, flags, argc, argv);
+
+	/*
+	 * We must check that the program returned a valid code for this
+	 * function.
+	 */
+	switch (ret) {
+	case PAM_SUCCESS:
+	case PAM_ABORT:
+	case PAM_AUTHTOK_DISABLE_AGING:
+	case PAM_AUTHTOK_ERR:
+	case PAM_AUTHTOK_LOCK_BUSY:
+	case PAM_AUTHTOK_RECOVERY_ERR:
+	case PAM_BUF_ERR:
+	case PAM_CONV_ERR:
+	case PAM_IGNORE:
+	case PAM_PERM_DENIED:
+	case PAM_SERVICE_ERR:
+	case PAM_SYSTEM_ERR:
+	case PAM_TRY_AGAIN:
+		break;
+	default:
+		openpam_log(PAM_LOG_ERROR, "%s returned invalid code %d",
+		    argv[0], ret);
+		ret = PAM_SERVICE_ERR;
+	}
 
-	return (_pam_exec(pamh, flags, argc, argv));
+	return (ret);
 }
 
 PAM_MODULE_ENTRY("pam_exec");

From owner-svn-src-head@FreeBSD.ORG  Mon Mar 26 14:56:24 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 09746106566B;
	Mon, 26 Mar 2012 14:56:24 +0000 (UTC)
	(envelope-from joel@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id E85408FC12;
	Mon, 26 Mar 2012 14:56:23 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2QEuNnJ037613;
	Mon, 26 Mar 2012 14:56:23 GMT (envelope-from joel@svn.freebsd.org)
Received: (from joel@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2QEuNQI037610;
	Mon, 26 Mar 2012 14:56:23 GMT (envelope-from joel@svn.freebsd.org)
Message-Id: <201203261456.q2QEuNQI037610@svn.freebsd.org>
From: Joel Dahl 
Date: Mon, 26 Mar 2012 14:56:23 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233509 - in head: lib/libc/iconv
	usr.sbin/bluetooth/ath3kfw
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Mon, 26 Mar 2012 14:56:24 -0000

Author: joel (doc committer)
Date: Mon Mar 26 14:56:23 2012
New Revision: 233509
URL: http://svn.freebsd.org/changeset/base/233509

Log:
  Fix date.

Modified:
  head/lib/libc/iconv/iconv.3
  head/usr.sbin/bluetooth/ath3kfw/ath3kfw.8

Modified: head/lib/libc/iconv/iconv.3
==============================================================================
--- head/lib/libc/iconv/iconv.3	Mon Mar 26 13:02:31 2012	(r233508)
+++ head/lib/libc/iconv/iconv.3	Mon Mar 26 14:56:23 2012	(r233509)
@@ -26,7 +26,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd Juny 16, 2010
+.Dd June 16, 2010
 .Dt ICONV 3
 .Os
 .Sh NAME

Modified: head/usr.sbin/bluetooth/ath3kfw/ath3kfw.8
==============================================================================
--- head/usr.sbin/bluetooth/ath3kfw/ath3kfw.8	Mon Mar 26 13:02:31 2012	(r233508)
+++ head/usr.sbin/bluetooth/ath3kfw/ath3kfw.8	Mon Mar 26 14:56:23 2012	(r233509)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd Novermber 9, 2010
+.Dd November 9, 2010
 .Dt ATH3KFW 8
 .Os
 .Sh NAME

From owner-svn-src-head@FreeBSD.ORG  Mon Mar 26 15:18:15 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 2633A1065672;
	Mon, 26 Mar 2012 15:18:15 +0000 (UTC)
	(envelope-from joel@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 0CB418FC15;
	Mon, 26 Mar 2012 15:18:15 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2QFIEWs038367;
	Mon, 26 Mar 2012 15:18:14 GMT (envelope-from joel@svn.freebsd.org)
Received: (from joel@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2QFIEGO038341;
	Mon, 26 Mar 2012 15:18:14 GMT (envelope-from joel@svn.freebsd.org)
Message-Id: <201203261518.q2QFIEGO038341@svn.freebsd.org>
From: Joel Dahl 
Date: Mon, 26 Mar 2012 15:18:14 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233510 - in head: lib/libc/gen lib/libgssapi
	lib/libutil libexec/getty sbin/init sbin/sysctl
	share/man/man4 share/man/man7 share/man/man9 usr.bin/hexdump
	usr.bin/killall usr.bin/tr usr...
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Mon, 26 Mar 2012 15:18:15 -0000

Author: joel (doc committer)
Date: Mon Mar 26 15:18:14 2012
New Revision: 233510
URL: http://svn.freebsd.org/changeset/base/233510

Log:
  mdoc: terminate quoted strings.
  
  Reviewed by:	brueffer

Modified:
  head/lib/libc/gen/psignal.3
  head/lib/libgssapi/gss_accept_sec_context.3
  head/lib/libutil/login.conf.5
  head/libexec/getty/gettytab.5
  head/sbin/init/init.8
  head/sbin/sysctl/sysctl.8
  head/share/man/man4/amdsmb.4
  head/share/man/man4/bce.4
  head/share/man/man4/cd.4
  head/share/man/man4/lmc.4
  head/share/man/man4/syscons.4
  head/share/man/man7/operator.7
  head/share/man/man9/crypto.9
  head/usr.bin/hexdump/hexdump.1
  head/usr.bin/killall/killall.1
  head/usr.bin/tr/tr.1
  head/usr.bin/units/units.1
  head/usr.bin/vgrind/vgrindefs.5
  head/usr.sbin/arp/arp.4
  head/usr.sbin/bootparamd/bootparamd/bootparamd.8
  head/usr.sbin/bsnmpd/modules/snmp_netgraph/snmp_netgraph.3
  head/usr.sbin/bsnmpd/modules/snmp_wlan/snmp_wlan.3
  head/usr.sbin/fdwrite/fdwrite.1
  head/usr.sbin/fwcontrol/fwcontrol.8
  head/usr.sbin/lpr/lpr/printcap.5

Modified: head/lib/libc/gen/psignal.3
==============================================================================
--- head/lib/libc/gen/psignal.3	Mon Mar 26 14:56:23 2012	(r233509)
+++ head/lib/libc/gen/psignal.3	Mon Mar 26 15:18:14 2012	(r233510)
@@ -79,7 +79,7 @@ immediately followed by a colon and a sp
 If the signal number is not recognized
 .Pq Xr sigaction 2 ,
 the string
-.Dq "Unknown signal
+.Dq "Unknown signal"
 is produced.
 .Pp
 The message strings can be accessed directly

Modified: head/lib/libgssapi/gss_accept_sec_context.3
==============================================================================
--- head/lib/libgssapi/gss_accept_sec_context.3	Mon Mar 26 14:56:23 2012	(r233509)
+++ head/lib/libgssapi/gss_accept_sec_context.3	Mon Mar 26 15:18:14 2012	(r233510)
@@ -39,7 +39,7 @@
 .In "gssapi/gssapi.h"
 .Ft OM_uint32
 .Fo gss_accept_sec_context
-.Fa "OM_uint32 *minor_status
+.Fa "OM_uint32 *minor_status"
 .Fa "gss_ctx_id_t *context_handle"
 .Fa "const gss_cred_id_t acceptor_cred_handle"
 .Fa "const gss_buffer_t input_token_buffer"

Modified: head/lib/libutil/login.conf.5
==============================================================================
--- head/lib/libutil/login.conf.5	Mon Mar 26 14:56:23 2012	(r233509)
+++ head/lib/libutil/login.conf.5	Mon Mar 26 15:18:14 2012	(r233510)
@@ -177,20 +177,20 @@ The usual convention to interpolate capa
 notation may be used.
 .Sh RESOURCE LIMITS
 .Bl -column pseudoterminals indent indent
-.It Sy "Name	Type	Notes	Description
-.It "coredumpsize	size		Maximum coredump size limit.
-.It "cputime	time		CPU usage limit.
-.It "datasize	size		Maximum data size limit.
-.It "filesize	size		Maximum file size limit.
-.It "maxproc	number		Maximum number of processes.
-.It "memorylocked	size		Maximum locked in core memory size limit.
-.It "memoryuse	size		Maximum of core memory use size limit.
-.It "openfiles	number		Maximum number of open files per process.
-.It "sbsize	size		Maximum permitted socketbuffer size.
-.It "vmemoryuse	size		Maximum permitted total VM usage per process.
-.It "stacksize	size		Maximum stack size limit.
-.It "pseudoterminals	number		Maximum number of pseudo-terminals.
-.It "swapuse	size		Maximum swap space size limit.
+.It Sy "Name	Type	Notes	Description"
+.It "coredumpsize	size		Maximum coredump size limit."
+.It "cputime	time		CPU usage limit."
+.It "datasize	size		Maximum data size limit."
+.It "filesize	size		Maximum file size limit."
+.It "maxproc	number		Maximum number of processes."
+.It "memorylocked	size		Maximum locked in core memory size limit."
+.It "memoryuse	size		Maximum of core memory use size limit."
+.It "openfiles	number		Maximum number of open files per process."
+.It "sbsize	size		Maximum permitted socketbuffer size."
+.It "vmemoryuse	size		Maximum permitted total VM usage per process."
+.It "stacksize	size		Maximum stack size limit."
+.It "pseudoterminals	number		Maximum number of pseudo-terminals."
+.It "swapuse	size		Maximum swap space size limit."
 .El
 .Pp
 These resource limit entries actually specify both the maximum
@@ -202,10 +202,10 @@ The maximum and current limits may be sp
 -max or -cur to the capability name.
 .Sh ENVIRONMENT
 .Bl -column ignorenologin indent xbinxxusrxbin
-.It Sy "Name	Type	Notes	Description
-.It "charset	string		Set $MM_CHARSET environment variable to the specified
+.It Sy "Name	Type	Notes	Description"
+.It charset	string		Set $MM_CHARSET environment variable to the specified
 value.
-.It "cpumask	string		List of cpus to bind the user to.
+.It "cpumask	string		List of cpus to bind the user to."
 The syntax is the same as for the
 .Fl l
 argument of
@@ -214,9 +214,9 @@ argument of
 If set to
 .Ql default
 no action is taken.
-.It "hushlogin	bool	false	Same as having a ~/.hushlogin file.
-.It "ignorenologin	bool	false	Login not prevented by nologin.
-.It "ftp-chroot	bool	false	Limit FTP access with
+.It "hushlogin	bool	false	Same as having a ~/.hushlogin file."
+.It "ignorenologin	bool	false	Login not prevented by nologin."
+.It "ftp-chroot	bool	false	Limit FTP access with"
 .Xr chroot 2
 to the
 .Ev HOME
@@ -224,7 +224,7 @@ directory of the user.
 See
 .Xr ftpd 8
 for details.
-.It "label	string			Default MAC policy; see
+.It "label	string			Default MAC policy; see"
 .Xr maclabel 7 .
 .It "lang	string		Set $LANG environment variable to the specified value.
 .It "manpath	path		Default search path for manpages.

Modified: head/libexec/getty/gettytab.5
==============================================================================
--- head/libexec/getty/gettytab.5	Mon Mar 26 14:56:23 2012	(r233509)
+++ head/libexec/getty/gettytab.5	Mon Mar 26 15:18:14 2012	(r233510)
@@ -75,7 +75,7 @@ no entry in the table obtained, nor one 
 .Va default
 table.
 .Bl -column Name Type /usr/bin/login
-.It Sy "Name	Type	Default	Description
+.It Sy "Name	Type	Default	Description"
 .It "ac	str	unused	expect-send chat script for modem answer"
 .It "al	str	unused	user to auto-login instead of prompting"
 .It "ap	bool	false	terminal uses any parity"
@@ -188,7 +188,7 @@ use raw for input, use cbreak
 .It "ub	bool	false	do unbuffered output (of prompts etc)"
 .It "we	str" Ta So Li ^W Sc Ta
 .No "word erase character"
-.It "xc	bool	false	do
+.It "xc	bool	false	do"
 .Em NOT
 echo control chars as
 .Ql ^X

Modified: head/sbin/init/init.8
==============================================================================
--- head/sbin/init/init.8	Mon Mar 26 14:56:23 2012	(r233509)
+++ head/sbin/init/init.8	Mon Mar 26 15:18:14 2012	(r233510)
@@ -283,7 +283,7 @@ will signal the original
 .Nm
 as follows:
 .Bl -column Run-level SIGTERM
-.It Sy "Run-level	Signal	Action
+.It Sy "Run-level	Signal	Action"
 .It Cm 0 Ta Dv SIGUSR2 Ta "Halt and turn the power off"
 .It Cm 1 Ta Dv SIGTERM Ta "Go to single-user mode"
 .It Cm 6 Ta Dv SIGINT Ta "Reboot the machine"

Modified: head/sbin/sysctl/sysctl.8
==============================================================================
--- head/sbin/sysctl/sysctl.8	Mon Mar 26 14:56:23 2012	(r233509)
+++ head/sbin/sysctl/sysctl.8	Mon Mar 26 15:18:14 2012	(r233510)
@@ -166,72 +166,72 @@ privilege can change the value.
 String and integer values can be set using
 .Nm .
 .Bl -column security.bsd.unprivileged_read_msgbuf integerxxx
-.It Sy "Name	Type	Changeable
-.It "kern.ostype	string	no
-.It "kern.osrelease	string	no
-.It "kern.osrevision	integer	no
-.It "kern.version	string	no
-.It "kern.maxvnodes	integer	yes
-.It "kern.maxproc	integer	no
-.It "kern.maxprocperuid	integer	yes
-.It "kern.maxfiles	integer	yes
-.It "kern.maxfilesperproc	integer	yes
-.It "kern.argmax	integer	no
-.It "kern.securelevel	integer	raise only
-.It "kern.hostname	string	yes
-.It "kern.hostid	integer	yes
-.It "kern.clockrate	struct	no
-.It "kern.posix1version	integer	no
-.It "kern.ngroups	integer	no
-.It "kern.job_control	integer	no
-.It "kern.saved_ids	integer	no
-.It "kern.boottime	struct	no
-.It "kern.domainname	string	yes
-.It "kern.filedelay	integer	yes
-.It "kern.dirdelay	integer	yes
-.It "kern.metadelay	integer	yes
-.It "kern.osreldate	string	no
-.It "kern.bootfile	string	yes
-.It "kern.corefile	string	yes
-.It "kern.logsigexit	integer	yes
-.It "security.bsd.suser_enabled	integer	yes
-.It "security.bsd.see_other_uids	integer	yes
-.It "security.bsd.unprivileged_proc_debug	integer	yes
-.It "security.bsd.unprivileged_read_msgbuf	integer	yes
-.It "vm.loadavg	struct	no
-.It "hw.machine	string	no
-.It "hw.model	string	no
-.It "hw.ncpu	integer	no
-.It "hw.byteorder	integer	no
-.It "hw.physmem	integer	no
-.It "hw.usermem	integer	no
-.It "hw.pagesize	integer	no
-.It "hw.floatingpoint	integer	no
-.It "hw.machine_arch	string	no
-.It "hw.realmem	integer	no
-.It "machdep.adjkerntz	integer	yes
-.It "machdep.disable_rtc_set	integer	yes
-.It "machdep.guessed_bootdev	string	no
-.It "user.cs_path	string	no
-.It "user.bc_base_max	integer	no
-.It "user.bc_dim_max	integer	no
-.It "user.bc_scale_max	integer	no
-.It "user.bc_string_max	integer	no
-.It "user.coll_weights_max	integer	no
-.It "user.expr_nest_max	integer	no
-.It "user.line_max	integer	no
-.It "user.re_dup_max	integer	no
-.It "user.posix2_version	integer	no
-.It "user.posix2_c_bind	integer	no
-.It "user.posix2_c_dev	integer	no
-.It "user.posix2_char_term	integer	no
-.It "user.posix2_fort_dev	integer	no
-.It "user.posix2_fort_run	integer	no
-.It "user.posix2_localedef	integer	no
-.It "user.posix2_sw_dev	integer	no
-.It "user.posix2_upe	integer	no
-.It "user.stream_max	integer	no
-.It "user.tzname_max	integer	no
+.It Sy "Name	Type	Changeable"
+.It "kern.ostype	string	no"
+.It "kern.osrelease	string	no"
+.It "kern.osrevision	integer	no"
+.It "kern.version	string	no"
+.It "kern.maxvnodes	integer	yes"
+.It "kern.maxproc	integer	no"
+.It "kern.maxprocperuid	integer	yes"
+.It "kern.maxfiles	integer	yes"
+.It "kern.maxfilesperproc	integer	yes"
+.It "kern.argmax	integer	no"
+.It "kern.securelevel	integer	raise only"
+.It "kern.hostname	string	yes"
+.It "kern.hostid	integer	yes"
+.It "kern.clockrate	struct	no"
+.It "kern.posix1version	integer	no"
+.It "kern.ngroups	integer	no"
+.It "kern.job_control	integer	no"
+.It "kern.saved_ids	integer	no"
+.It "kern.boottime	struct	no"
+.It "kern.domainname	string	yes"
+.It "kern.filedelay	integer	yes"
+.It "kern.dirdelay	integer	yes"
+.It "kern.metadelay	integer	yes"
+.It "kern.osreldate	string	no"
+.It "kern.bootfile	string	yes"
+.It "kern.corefile	string	yes"
+.It "kern.logsigexit	integer	yes"
+.It "security.bsd.suser_enabled	integer	yes"
+.It "security.bsd.see_other_uids	integer	yes"
+.It "security.bsd.unprivileged_proc_debug	integer	yes"
+.It "security.bsd.unprivileged_read_msgbuf	integer	yes"
+.It "vm.loadavg	struct	no"
+.It "hw.machine	string	no"
+.It "hw.model	string	no"
+.It "hw.ncpu	integer	no"
+.It "hw.byteorder	integer	no"
+.It "hw.physmem	integer	no"
+.It "hw.usermem	integer	no"
+.It "hw.pagesize	integer	no"
+.It "hw.floatingpoint	integer	no"
+.It "hw.machine_arch	string	no"
+.It "hw.realmem	integer	no"
+.It "machdep.adjkerntz	integer	yes"
+.It "machdep.disable_rtc_set	integer	yes"
+.It "machdep.guessed_bootdev	string	no"
+.It "user.cs_path	string	no"
+.It "user.bc_base_max	integer	no"
+.It "user.bc_dim_max	integer	no"
+.It "user.bc_scale_max	integer	no"
+.It "user.bc_string_max	integer	no"
+.It "user.coll_weights_max	integer	no"
+.It "user.expr_nest_max	integer	no"
+.It "user.line_max	integer	no"
+.It "user.re_dup_max	integer	no"
+.It "user.posix2_version	integer	no"
+.It "user.posix2_c_bind	integer	no"
+.It "user.posix2_c_dev	integer	no"
+.It "user.posix2_char_term	integer	no"
+.It "user.posix2_fort_dev	integer	no"
+.It "user.posix2_fort_run	integer	no"
+.It "user.posix2_localedef	integer	no"
+.It "user.posix2_sw_dev	integer	no"
+.It "user.posix2_upe	integer	no"
+.It "user.stream_max	integer	no"
+.It "user.tzname_max	integer	no"
 .El
 .Sh FILES
 .Bl -tag -width ".In netinet/icmp_var.h" -compact

Modified: head/share/man/man4/amdsmb.4
==============================================================================
--- head/share/man/man4/amdsmb.4	Mon Mar 26 14:56:23 2012	(r233509)
+++ head/share/man/man4/amdsmb.4	Mon Mar 26 15:18:14 2012	(r233510)
@@ -33,7 +33,7 @@
 .Sh SYNOPSIS
 .Cd "device smbus"
 .Cd "device smb"
-.Cd "device amdsmb
+.Cd "device amdsmb"
 .Sh DESCRIPTION
 The
 .Nm

Modified: head/share/man/man4/bce.4
==============================================================================
--- head/share/man/man4/bce.4	Mon Mar 26 14:56:23 2012	(r233509)
+++ head/share/man/man4/bce.4	Mon Mar 26 15:18:14 2012	(r233510)
@@ -266,7 +266,7 @@ address space.
 .It "bce%d: Could not allocate TX descriptor chain DMA tag!"
 The driver could not allocate a DMA tag for the controller's
 TX chain.
-.It "bce%d: Could not allocate TX descriptor chain DMA memory!
+.It "bce%d: Could not allocate TX descriptor chain DMA memory!"
 The driver could not allocate DMA addressable memory for the controller's
 TX chain.
 .It "bce%d: Could not map TX descriptor chain DMA memory!"

Modified: head/share/man/man4/cd.4
==============================================================================
--- head/share/man/man4/cd.4	Mon Mar 26 14:56:23 2012	(r233509)
+++ head/share/man/man4/cd.4	Mon Mar 26 15:18:14 2012	(r233510)
@@ -34,7 +34,7 @@
 .Sh SYNOPSIS
 .Cd device cd
 .Cd "options ""CHANGER_MIN_BUSY_SECONDS=3"""
-.Cd "options ""CHANGER_MAX_BUSY_SECONDS=11""
+.Cd "options ""CHANGER_MAX_BUSY_SECONDS=11"""
 .Sh DESCRIPTION
 The
 .Nm

Modified: head/share/man/man4/lmc.4
==============================================================================
--- head/share/man/man4/lmc.4	Mon Mar 26 14:56:23 2012	(r233509)
+++ head/share/man/man4/lmc.4	Mon Mar 26 15:18:14 2012	(r233510)
@@ -407,7 +407,7 @@ When testing an HSSI card with a null mo
 with
 .Xr lmcconfig 8 :
 .Pp
-.Dl "lmcconfig lmc0 -a 2
+.Dl "lmcconfig lmc0 -a 2"
 .Pp
 .Dq Fl a Li 2
 selects the PCI bus clock as the transmit clock.

Modified: head/share/man/man4/syscons.4
==============================================================================
--- head/share/man/man4/syscons.4	Mon Mar 26 14:56:23 2012	(r233509)
+++ head/share/man/man4/syscons.4	Mon Mar 26 15:18:14 2012	(r233510)
@@ -501,15 +501,15 @@ Note that you cannot put any white space
 because of the current implementation of
 .Xr config 8 .
 .Pp
-.Dl "options SC_NORM_ATTR=(FG_GREEN|BG_BLACK)
-.Dl "options SC_NORM_REV_ATTR=(FG_YELLOW|BG_GREEN)
+.Dl "options SC_NORM_ATTR=(FG_GREEN|BG_BLACK)"
+.Dl "options SC_NORM_REV_ATTR=(FG_YELLOW|BG_GREEN)"
 .Pp
 The following lines will set the default colors of the kernel message.
 The kernel message will be printed bright red on black background.
 The reversed message will be black on red background.
 .Pp
-.Dl "options SC_KERNEL_CONS_ATTR=(FG_LIGHTRED|BG_BLACK)
-.Dl "options SC_KERNEL_CONS_REV_ATTR=(FG_BLACK|BG_RED)
+.Dl "options SC_KERNEL_CONS_ATTR=(FG_LIGHTRED|BG_BLACK)"
+.Dl "options SC_KERNEL_CONS_REV_ATTR=(FG_BLACK|BG_RED)"
 .Pp
 The following example adds the font files
 .Pa cp850-8x16.fnt ,
@@ -519,7 +519,7 @@ and
 to the kernel.
 .Pp
 .Dl "options SC_DFLT_FONT"
-.Dl "makeoptions SC_DFLT_FONT=cp850
+.Dl "makeoptions SC_DFLT_FONT=cp850"
 .Dl "device sc"
 .\".Sh DIAGNOSTICS
 .Sh SEE ALSO

Modified: head/share/man/man7/operator.7
==============================================================================
--- head/share/man/man7/operator.7	Mon Mar 26 14:56:23 2012	(r233509)
+++ head/share/man/man7/operator.7	Mon Mar 26 15:18:14 2012	(r233510)
@@ -45,7 +45,7 @@
 .It "--------	-------------"
 .It "() [] -> .	left to right"
 .It "! ~ ++ -- - (type) * & sizeof new delete	right to left"
-.It "->* .*	left to right
+.It "->* .*	left to right"
 .It "* / %	left to right"
 .It "+ -	left to right"
 .It "<< >>	left to right"

Modified: head/share/man/man9/crypto.9
==============================================================================
--- head/share/man/man9/crypto.9	Mon Mar 26 14:56:23 2012	(r233509)
+++ head/share/man/man9/crypto.9	Mon Mar 26 15:18:14 2012	(r233510)
@@ -450,7 +450,7 @@ is called to perform a keying operation.
 The various fields in the
 .Vt cryptkop
 structure are:
-.Bl -tag -width ".Va krp_callback'
+.Bl -tag -width ".Va krp_callback"
 .It Va krp_op
 Operation code, such as
 .Dv CRK_MOD_EXP .

Modified: head/usr.bin/hexdump/hexdump.1
==============================================================================
--- head/usr.bin/hexdump/hexdump.1	Mon Mar 26 14:56:23 2012	(r233509)
+++ head/usr.bin/hexdump/hexdump.1	Mon Mar 26 15:18:14 2012	(r233510)
@@ -200,14 +200,14 @@ The single character escape sequences
 described in the C standard are supported:
 .Bd -ragged -offset indent -compact
 .Bl -column 
-.It "NUL	\e0
-.It "	\ea
-.It "	\eb
-.It "	\ef
-.It "	\en
-.It "	\er
-.It "	\et
-.It "	\ev
+.It "NUL	\e0"
+.It "	\ea"
+.It "	\eb"
+.It "	\ef"
+.It "	\en"
+.It "	\er"
+.It "	\et"
+.It "	\ev"
 .El
 .Ed
 .El
@@ -249,12 +249,12 @@ displayed using the following, lower-cas
 Characters greater than 0xff, hexadecimal, are displayed as hexadecimal
 strings.
 .Bl -column \&000_nu \&001_so \&002_st \&003_et \&004_eo
-.It "\&000\ NUL\t001\ SOH\t002\ STX\t003\ ETX\t004\ EOT\t005\ ENQ
-.It "\&006\ ACK\t007\ BEL\t008\ BS\t009\ HT\t00A\ LF\t00B\ VT
-.It "\&00C\ FF\t00D\ CR\t00E\ SO\t00F\ SI\t010\ DLE\t011\ DC1
-.It "\&012\ DC2\t013\ DC3\t014\ DC4\t015\ NAK\t016\ SYN\t017\ ETB
-.It "\&018\ CAN\t019\ EM\t01A\ SUB\t01B\ ESC\t01C\ FS\t01D\ GS
-.It "\&01E\ RS\t01F\ US\t07F\ DEL
+.It "\&000\ NUL\t001\ SOH\t002\ STX\t003\ ETX\t004\ EOT\t005\ ENQ"
+.It "\&006\ ACK\t007\ BEL\t008\ BS\t009\ HT\t00A\ LF\t00B\ VT"
+.It "\&00C\ FF\t00D\ CR\t00E\ SO\t00F\ SI\t010\ DLE\t011\ DC1"
+.It "\&012\ DC2\t013\ DC3\t014\ DC4\t015\ NAK\t016\ SYN\t017\ ETB"
+.It "\&018\ CAN\t019\ EM\t01A\ SUB\t01B\ ESC\t01C\ FS\t01D\ GS"
+.It "\&01E\ RS\t01F\ US\t07F\ DEL"
 .El
 .El
 .Pp

Modified: head/usr.bin/killall/killall.1
==============================================================================
--- head/usr.bin/killall/killall.1	Mon Mar 26 14:56:23 2012	(r233509)
+++ head/usr.bin/killall/killall.1	Mon Mar 26 15:18:14 2012	(r233510)
@@ -118,7 +118,7 @@ is already supported by
 So use
 .Xr kill 1
 for this job (e.g.\&
-.Dq Li "kill -TERM -1
+.Dq Li "kill -TERM -1"
 or as root
 .Dq Li "echo kill -TERM -1 | su -m " ) .
 .Sh IMPLEMENTATION NOTES

Modified: head/usr.bin/tr/tr.1
==============================================================================
--- head/usr.bin/tr/tr.1	Mon Mar 26 14:56:23 2012	(r233509)
+++ head/usr.bin/tr/tr.1	Mon Mar 26 15:18:14 2012	(r233510)
@@ -146,13 +146,13 @@ the octal sequence to the full 3 octal d
 A backslash followed by certain special characters maps to special
 values.
 .Bl -column "\ea"
-.It "\ea	
-.It "\eb	
-.It "\ef	
-.It "\en	
-.It "\er	
-.It "\et	
-.It "\ev	
+.It "\ea	"
+.It "\eb	"
+.It "\ef	"
+.It "\en	"
+.It "\er	"
+.It "\et	"
+.It "\ev	"
 .El
 .Pp
 A backslash followed by any other character maps to that character.
@@ -177,22 +177,22 @@ previous implementations.
 Represents all characters belonging to the defined character class.
 Class names are:
 .Bl -column "phonogram"
-.It "alnum	
-.It "alpha	
-.It "blank	
-.It "cntrl	
-.It "digit	
-.It "graph	
-.It "ideogram	
-.It "lower	
-.It "phonogram	
-.It "print	
-.It "punct	
-.It "rune	
-.It "space	
-.It "special	
-.It "upper	
-.It "xdigit	
+.It "alnum	"
+.It "alpha	"
+.It "blank	"
+.It "cntrl	"
+.It "digit	"
+.It "graph	"
+.It "ideogram	"
+.It "lower	"
+.It "phonogram	"
+.It "print	"
+.It "punct	"
+.It "rune	"
+.It "space	"
+.It "special	"
+.It "upper	"
+.It "xdigit	"
 .El
 .Pp
 .\" All classes may be used in

Modified: head/usr.bin/units/units.1
==============================================================================
--- head/usr.bin/units/units.1	Mon Mar 26 14:56:23 2012	(r233509)
+++ head/usr.bin/units/units.1	Mon Mar 26 15:18:14 2012	(r233510)
@@ -95,15 +95,15 @@ metric prefixes.
 Some constants of nature included are:
 .Pp
 .Bl -column -offset indent -compact "mercury"
-.It "pi	ratio of circumference to diameter
-.It "c	speed of light
-.It "e	charge on an electron
-.It "g	acceleration of gravity
-.It "force	same as g
-.It "mole	Avogadro's number
-.It "water	pressure per unit height of water
-.It "mercury	pressure per unit height of mercury
-.It "au	astronomical unit
+.It "pi	ratio of circumference to diameter"
+.It "c	speed of light"
+.It "e	charge on an electron"
+.It "g	acceleration of gravity"
+.It "force	same as g"
+.It "mole	Avogadro's number"
+.It "water	pressure per unit height of water"
+.It "mercury	pressure per unit height of mercury"
+.It "au	astronomical unit"
 .El
 .Pp
 The unit 'pound' is a unit of mass.
@@ -148,14 +148,14 @@ Here is an example of a short units file
 units.
 .Pp
 .Bl -column -offset indent -compact "minute"
-.It "m	!a!
-.It "sec	!b!
-.It "micro-	1e-6
-.It "minute	60 sec
-.It "hour	60 min
-.It "inch	0.0254 m
-.It "ft	12 inches
-.It "mile	5280 ft
+.It "m	!a!"
+.It "sec	!b!"
+.It "micro-	1e-6"
+.It "minute	60 sec"
+.It "hour	60 min"
+.It "inch	0.0254 m"
+.It "ft	12 inches"
+.It "mile	5280 ft"
 .El
 .Sh FILES
 .Bl -tag -width /usr/share/misc/units.lib -compact

Modified: head/usr.bin/vgrind/vgrindefs.5
==============================================================================
--- head/usr.bin/vgrind/vgrindefs.5	Mon Mar 26 14:56:23 2012	(r233509)
+++ head/usr.bin/vgrind/vgrindefs.5	Mon Mar 26 15:18:14 2012	(r233510)
@@ -49,7 +49,7 @@ very similar to
 .Sh FIELDS
 The following table names and describes each field.
 .Bl -column Namexxx Tpexxx
-.It Sy "Name	Type	Description
+.It Sy "Name	Type	Description"
 .It "ab	str	regular expression for the start of an alternate comment"
 .It "ae	str	regular expression for the end of an alternate comment"
 .It "pb	str	regular expression for start of a procedure"

Modified: head/usr.sbin/arp/arp.4
==============================================================================
--- head/usr.sbin/arp/arp.4	Mon Mar 26 14:56:23 2012	(r233509)
+++ head/usr.sbin/arp/arp.4	Mon Mar 26 15:18:14 2012	(r233510)
@@ -186,6 +186,6 @@ is set to 1, which is the system's defau
 .Rs
 .%A Leffler, S.J.
 .%A Karels, M.J.
-.%B "Trailer Encapsulations
+.%B "Trailer Encapsulations"
 .%T RFC893
 .Re

Modified: head/usr.sbin/bootparamd/bootparamd/bootparamd.8
==============================================================================
--- head/usr.sbin/bootparamd/bootparamd/bootparamd.8	Mon Mar 26 14:56:23 2012	(r233509)
+++ head/usr.sbin/bootparamd/bootparamd/bootparamd.8	Mon Mar 26 15:18:14 2012	(r233510)
@@ -58,7 +58,7 @@ The SunOS kernel hangs until it receives
 To accommodate this behaviour add an alias address
 that responds to an all-0 broadcast.
 So, add something like
-.Ql "ifconfig xl0 192.168.200.254 netmask 255.255.255.255 broadcast 192.168.200.0 alias
+.Ql "ifconfig xl0 192.168.200.254 netmask 255.255.255.255 broadcast 192.168.200.0 alias"
 on the relevant network interface on your
 .Nm
 server.

Modified: head/usr.sbin/bsnmpd/modules/snmp_netgraph/snmp_netgraph.3
==============================================================================
--- head/usr.sbin/bsnmpd/modules/snmp_netgraph/snmp_netgraph.3	Mon Mar 26 14:56:23 2012	(r233509)
+++ head/usr.sbin/bsnmpd/modules/snmp_netgraph/snmp_netgraph.3	Mon Mar 26 15:18:14 2012	(r233510)
@@ -65,7 +65,7 @@
 .Nm ng_node_name ,
 .Nm ng_node_type ,
 .Nm ng_peer_hook_id
-.Nd "netgraph module for snmpd.
+.Nd "netgraph module for snmpd"
 .Sh LIBRARY
 .Pq begemotSnmpdModulePath."netgraph" = "/usr/lib/snmp_netgraph.so"
 .Sh SYNOPSIS

Modified: head/usr.sbin/bsnmpd/modules/snmp_wlan/snmp_wlan.3
==============================================================================
--- head/usr.sbin/bsnmpd/modules/snmp_wlan/snmp_wlan.3	Mon Mar 26 14:56:23 2012	(r233509)
+++ head/usr.sbin/bsnmpd/modules/snmp_wlan/snmp_wlan.3	Mon Mar 26 15:18:14 2012	(r233510)
@@ -33,7 +33,7 @@
 .Os
 .Sh NAME
 .Nm snmp_wlan
-.Nd "wireless networking module for
+.Nd "wireless networking module for"
 .Xr bsnmpd 1
 .Sh LIBRARY
 .Pq begemotSnmpdModulePath."wlan" = "/usr/lib/snmp_wlan.so"

Modified: head/usr.sbin/fdwrite/fdwrite.1
==============================================================================
--- head/usr.sbin/fdwrite/fdwrite.1	Mon Mar 26 14:56:23 2012	(r233509)
+++ head/usr.sbin/fdwrite/fdwrite.1	Mon Mar 26 15:18:14 2012	(r233510)
@@ -87,7 +87,7 @@ utility
 was planned as a tool to make life easier when writing a set of floppies,
 one such use could be to write a tar-archive:
 .Pp
-.Dl "tar cf - . | gzip -9 | fdwrite -d /dev/fd0.1720 -v
+.Dl tar cf - . | gzip -9 | fdwrite -d /dev/fd0.1720 -v
 .Pp
 The main difference from using
 .Xr tar 1 Ns 's

Modified: head/usr.sbin/fwcontrol/fwcontrol.8
==============================================================================
--- head/usr.sbin/fwcontrol/fwcontrol.8	Mon Mar 26 14:56:23 2012	(r233509)
+++ head/usr.sbin/fwcontrol/fwcontrol.8	Mon Mar 26 15:18:14 2012	(r233510)
@@ -171,7 +171,7 @@ For PAL, replace
 with
 .Dq Li bs=144000 .
 .Pp
-.Dl "fwcontrol -R file.m2t
+.Dl "fwcontrol -R file.m2t"
 .Pp
 Receive an MPEG TS stream from a camera producing MPEG transport stream.
 This has been tested with SONY HDR-FX1E camera that produces HD MPEG-2
@@ -179,7 +179,7 @@ stream at 25 Mbps bandwidth.
 .Pp
 To send the stream from the camera over the network using TCP (which
 surprisingly works better with vlc), you can use
-.Dl "fwcontrol -R - | nc 192.168.10.11 9000
+.Dl "fwcontrol -R - | nc 192.168.10.11 9000"
 with
 .Nm netcat
 from ports and to receive the stream, use
@@ -190,7 +190,7 @@ To netcast via UDP, you need to use
 program from ports, since vlc is not fast enough to read UDP packets from
 buffers and thus it experiences dropouts when run directly.
 The sending side can use
-.Dl "fwcontrol -R - | nc 192.168.10.11 9000
+.Dl "fwcontrol -R - | nc 192.168.10.11 9000"
 and to receive the stream, use
 .Dl nc -l -u -p 9000 | buffer -s 10k -b 1000 -m 20m -p 5 | vlc -
 .Pp

Modified: head/usr.sbin/lpr/lpr/printcap.5
==============================================================================
--- head/usr.sbin/lpr/lpr/printcap.5	Mon Mar 26 14:56:23 2012	(r233509)
+++ head/usr.sbin/lpr/lpr/printcap.5	Mon Mar 26 15:18:14 2012	(r233510)
@@ -72,7 +72,7 @@ Refer to
 .Xr termcap 5
 for a description of the file layout.
 .Bl -column Namexxx Typexx "/var/spool/lpdxxxxx"
-.Sy "Name	Type	Default	Description
+.Sy "Name	Type	Default	Description"
 .It "af	str" Ta Dv NULL Ta No "name of accounting file"
 .It "br	num	none	if lp is a tty, set the baud rate"
 .Xr ( ioctl 2

From owner-svn-src-head@FreeBSD.ORG  Mon Mar 26 15:29:02 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id A8FEA106566C;
	Mon, 26 Mar 2012 15:29:02 +0000 (UTC)
	(envelope-from joel@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 9480F8FC16;
	Mon, 26 Mar 2012 15:29:02 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2QFT2ME038742;
	Mon, 26 Mar 2012 15:29:02 GMT (envelope-from joel@svn.freebsd.org)
Received: (from joel@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2QFT2F4038739;
	Mon, 26 Mar 2012 15:29:02 GMT (envelope-from joel@svn.freebsd.org)
Message-Id: <201203261529.q2QFT2F4038739@svn.freebsd.org>
From: Joel Dahl 
Date: Mon, 26 Mar 2012 15:29:02 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233511 - head/lib/libutil
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Mon, 26 Mar 2012 15:29:02 -0000

Author: joel (doc committer)
Date: Mon Mar 26 15:29:02 2012
New Revision: 233511
URL: http://svn.freebsd.org/changeset/base/233511

Log:
  This string should be quoted.
  
  Noticed by:	brueffer

Modified:
  head/lib/libutil/login.conf.5

Modified: head/lib/libutil/login.conf.5
==============================================================================
--- head/lib/libutil/login.conf.5	Mon Mar 26 15:18:14 2012	(r233510)
+++ head/lib/libutil/login.conf.5	Mon Mar 26 15:29:02 2012	(r233511)
@@ -203,7 +203,7 @@ The maximum and current limits may be sp
 .Sh ENVIRONMENT
 .Bl -column ignorenologin indent xbinxxusrxbin
 .It Sy "Name	Type	Notes	Description"
-.It charset	string		Set $MM_CHARSET environment variable to the specified
+.It "charset	string		Set $MM_CHARSET environment variable to the specified"
 value.
 .It "cpumask	string		List of cpus to bind the user to."
 The syntax is the same as for the

From owner-svn-src-head@FreeBSD.ORG  Mon Mar 26 15:30:29 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 65105106566C;
	Mon, 26 Mar 2012 15:30:29 +0000 (UTC)
	(envelope-from joel@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 509A78FC0C;
	Mon, 26 Mar 2012 15:30:29 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2QFUTfJ038838;
	Mon, 26 Mar 2012 15:30:29 GMT (envelope-from joel@svn.freebsd.org)
Received: (from joel@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2QFUTdq038835;
	Mon, 26 Mar 2012 15:30:29 GMT (envelope-from joel@svn.freebsd.org)
Message-Id: <201203261530.q2QFUTdq038835@svn.freebsd.org>
From: Joel Dahl 
Date: Mon, 26 Mar 2012 15:30:29 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233512 - head/lib/libc/locale
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Mon, 26 Mar 2012 15:30:29 -0000

Author: joel (doc committer)
Date: Mon Mar 26 15:30:28 2012
New Revision: 233512
URL: http://svn.freebsd.org/changeset/base/233512

Log:
  mdoc: remove empty lines.

Modified:
  head/lib/libc/locale/isalpha.3
  head/lib/libc/locale/newlocale.3

Modified: head/lib/libc/locale/isalpha.3
==============================================================================
--- head/lib/libc/locale/isalpha.3	Mon Mar 26 15:29:02 2012	(r233511)
+++ head/lib/libc/locale/isalpha.3	Mon Mar 26 15:30:28 2012	(r233512)
@@ -110,4 +110,3 @@ The
 .Fn isalpha_l
 function conforms to
 .St -p1003.1-2008 .
-

Modified: head/lib/libc/locale/newlocale.3
==============================================================================
--- head/lib/libc/locale/newlocale.3	Mon Mar 26 15:29:02 2012	(r233511)
+++ head/lib/libc/locale/newlocale.3	Mon Mar 26 15:30:28 2012	(r233512)
@@ -93,7 +93,6 @@ Set a locale for formatting dates and ti
 .Xr strftime 3
 function.
 .El
-
 This function uses the same rules for loading locale components as
 .Xr setlocale 3 .
 .Sh RETURN VALUES

From owner-svn-src-head@FreeBSD.ORG  Mon Mar 26 16:05:20 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 9D58B106564A;
	Mon, 26 Mar 2012 16:05:20 +0000 (UTC)
	(envelope-from adrian@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 881268FC1B;
	Mon, 26 Mar 2012 16:05:20 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2QG5KtL040063;
	Mon, 26 Mar 2012 16:05:20 GMT (envelope-from adrian@svn.freebsd.org)
Received: (from adrian@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2QG5KQj040060;
	Mon, 26 Mar 2012 16:05:20 GMT (envelope-from adrian@svn.freebsd.org)
Message-Id: <201203261605.q2QG5KQj040060@svn.freebsd.org>
From: Adrian Chadd 
Date: Mon, 26 Mar 2012 16:05:20 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233514 - head/sys/dev/ath
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Mon, 26 Mar 2012 16:05:20 -0000

Author: adrian
Date: Mon Mar 26 16:05:19 2012
New Revision: 233514
URL: http://svn.freebsd.org/changeset/base/233514

Log:
  Use the assigned sequence number when checking if a retried packet is
  within the BAW.
  
  This regression was introduced in ane earlier commit by me to fix the
  BAW seqno allocation-but-not-insertion-into-BAW race.  Since it was only
  ever using the to-be allocated sequence number, any frame retries
  with the first frame in the BAW still in the software queue would
  have constantly failed, as ni_txseqs[tid] would always be outside
  the BAW.
  
  TODO:
  
  * Extract out the mostly common code here in the agg and non-agg ADDBA
    case and stuff it into a single function.
  
  PR:		kern/166357

Modified:
  head/sys/dev/ath/if_ath_tx.c
  head/sys/dev/ath/if_ath_tx_ht.c

Modified: head/sys/dev/ath/if_ath_tx.c
==============================================================================
--- head/sys/dev/ath/if_ath_tx.c	Mon Mar 26 15:38:17 2012	(r233513)
+++ head/sys/dev/ath/if_ath_tx.c	Mon Mar 26 16:05:19 2012	(r233514)
@@ -2348,7 +2348,6 @@ ath_tx_xmit_aggr(struct ath_softc *sc, s
 	struct ath_tid *tid = &an->an_tid[bf->bf_state.bfs_tid];
 	struct ath_txq *txq = bf->bf_state.bfs_txq;
 	struct ieee80211_tx_ampdu *tap;
-	int seqno;
 
 	ATH_TXQ_LOCK_ASSERT(txq);
 
@@ -2384,13 +2383,31 @@ ath_tx_xmit_aggr(struct ath_softc *sc, s
 	 * the TIDs that map to it.  Ugh.
 	 */
 	if (bf->bf_state.bfs_dobaw) {
-		if (! BAW_WITHIN(tap->txa_start, tap->txa_wnd,
-		    ni->ni_txseqs[bf->bf_state.bfs_tid])) {
+		ieee80211_seq seqno;
+
+		/*
+		 * If the sequence number is allocated, use it.
+		 * Otherwise, use the sequence number we WOULD
+		 * allocate.
+		 */
+		if (bf->bf_state.bfs_seqno_assigned)
+			seqno = SEQNO(bf->bf_state.bfs_seqno);
+		else
+			seqno = ni->ni_txseqs[bf->bf_state.bfs_tid];
+
+		/*
+		 * Check whether either the currently allocated
+		 * sequence number _OR_ the to-be allocated
+		 * sequence number is inside the BAW.
+		 */
+		if (! BAW_WITHIN(tap->txa_start, tap->txa_wnd, seqno)) {
 			ATH_TXQ_INSERT_TAIL(tid, bf, bf_list);
 			ath_tx_tid_sched(sc, tid);
 			return;
 		}
 		if (! bf->bf_state.bfs_seqno_assigned) {
+			int seqno;
+
 			seqno = ath_tx_tid_seqno_assign(sc, ni, bf, bf->bf_m);
 			if (seqno < 0) {
 				device_printf(sc->sc_dev,

Modified: head/sys/dev/ath/if_ath_tx_ht.c
==============================================================================
--- head/sys/dev/ath/if_ath_tx_ht.c	Mon Mar 26 15:38:17 2012	(r233513)
+++ head/sys/dev/ath/if_ath_tx_ht.c	Mon Mar 26 16:05:19 2012	(r233514)
@@ -652,7 +652,6 @@ ath_tx_form_aggr(struct ath_softc *sc, s
 	int status = ATH_AGGR_DONE;
 	int prev_frames = 0;	/* XXX for AR5416 burst, not done here */
 	int prev_al = 0;	/* XXX also for AR5416 burst */
-	int seqno;
 
 	ATH_TXQ_LOCK_ASSERT(sc->sc_ac2q[tid->ac]);
 
@@ -747,13 +746,32 @@ ath_tx_form_aggr(struct ath_softc *sc, s
 		 * see ath_tx_xmit_aggr() for more info.
 		 */
 		if (bf->bf_state.bfs_dobaw) {
+			ieee80211_seq seqno;
+
+			/*
+			 * If the sequence number is allocated, use it.
+			 * Otherwise, use the sequence number we WOULD
+			 * allocate.
+			 */
+			if (bf->bf_state.bfs_seqno_assigned)
+				seqno = SEQNO(bf->bf_state.bfs_seqno);
+			else
+				seqno = ni->ni_txseqs[bf->bf_state.bfs_tid];
+
+			/*
+			 * Check whether either the currently allocated
+			 * sequence number _OR_ the to-be allocated
+			 * sequence number is inside the BAW.
+			 */
 			if (! BAW_WITHIN(tap->txa_start, tap->txa_wnd,
-			    ni->ni_txseqs[bf->bf_state.bfs_tid])) {
+			    seqno)) {
 				status = ATH_AGGR_BAW_CLOSED;
 				break;
 			}
+
 			/* XXX check for bfs_need_seqno? */
 			if (! bf->bf_state.bfs_seqno_assigned) {
+				int seqno;
 				seqno = ath_tx_tid_seqno_assign(sc, ni, bf, bf->bf_m);
 				if (seqno < 0) {
 					device_printf(sc->sc_dev,

From owner-svn-src-head@FreeBSD.ORG  Mon Mar 26 16:40:45 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id A7C87106564A;
	Mon, 26 Mar 2012 16:40:45 +0000 (UTC)
	(envelope-from joel@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 9260A8FC08;
	Mon, 26 Mar 2012 16:40:45 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2QGejTR041649;
	Mon, 26 Mar 2012 16:40:45 GMT (envelope-from joel@svn.freebsd.org)
Received: (from joel@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2QGej1d041646;
	Mon, 26 Mar 2012 16:40:45 GMT (envelope-from joel@svn.freebsd.org)
Message-Id: <201203261640.q2QGej1d041646@svn.freebsd.org>
From: Joel Dahl 
Date: Mon, 26 Mar 2012 16:40:45 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233515 - in head/share/man: man4 man5
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Mon, 26 Mar 2012 16:40:45 -0000

Author: joel (doc committer)
Date: Mon Mar 26 16:40:45 2012
New Revision: 233515
URL: http://svn.freebsd.org/changeset/base/233515

Log:
  mdoc: Remove tabs in non-literal context.

Modified:
  head/share/man/man4/nvram2env.4
  head/share/man/man5/style.Makefile.5

Modified: head/share/man/man4/nvram2env.4
==============================================================================
--- head/share/man/man4/nvram2env.4	Mon Mar 26 16:05:19 2012	(r233514)
+++ head/share/man/man4/nvram2env.4	Mon Mar 26 16:40:45 2012	(r233515)
@@ -31,7 +31,7 @@
 .Nm nvram2env
 .Nd "copy nvram-like data into kernel environment"
 .Sh SYNOPSIS
-.Cd "device	nvram2env"
+.Cd "device nvram2env"
 .Sh DESCRIPTION
 .Nm
 implements a simple method of reading the NVRAM-like data and information

Modified: head/share/man/man5/style.Makefile.5
==============================================================================
--- head/share/man/man5/style.Makefile.5	Mon Mar 26 16:05:19 2012	(r233514)
+++ head/share/man/man5/style.Makefile.5	Mon Mar 26 16:40:45 2012	(r233515)
@@ -143,7 +143,7 @@ is an important thing.
 The usage of
 .Va WARNS
 is spelled
-.Dq Li "WARNS?=	" ,
+.Dq Li "WARNS?= " ,
 so that it may be overridden on the command line or in
 .Xr make.conf 5 .
 .It

From owner-svn-src-head@FreeBSD.ORG  Mon Mar 26 17:05:27 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 50859106566C;
	Mon, 26 Mar 2012 17:05:27 +0000 (UTC)
	(envelope-from jilles@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 3B54D8FC08;
	Mon, 26 Mar 2012 17:05:27 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2QH5R6R042464;
	Mon, 26 Mar 2012 17:05:27 GMT (envelope-from jilles@svn.freebsd.org)
Received: (from jilles@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2QH5RPI042462;
	Mon, 26 Mar 2012 17:05:27 GMT (envelope-from jilles@svn.freebsd.org)
Message-Id: <201203261705.q2QH5RPI042462@svn.freebsd.org>
From: Jilles Tjoelker 
Date: Mon, 26 Mar 2012 17:05:27 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233516 - head/lib/libthr/thread
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Mon, 26 Mar 2012 17:05:27 -0000

Author: jilles
Date: Mon Mar 26 17:05:26 2012
New Revision: 233516
URL: http://svn.freebsd.org/changeset/base/233516

Log:
  libthr: In the atfork handlers for signals, do not skip the last signal.
  
  _SIG_MAXSIG works a bit unexpectedly: signals 1 till _SIG_MAXSIG are valid,
  both bounds inclusive.
  
  Reviewed by:	davidxu
  MFC after:	1 week

Modified:
  head/lib/libthr/thread/thr_sig.c

Modified: head/lib/libthr/thread/thr_sig.c
==============================================================================
--- head/lib/libthr/thread/thr_sig.c	Mon Mar 26 16:40:45 2012	(r233515)
+++ head/lib/libthr/thread/thr_sig.c	Mon Mar 26 17:05:26 2012	(r233516)
@@ -458,7 +458,7 @@ _thr_signal_prefork(void)
 {
 	int i;
 
-	for (i = 1; i < _SIG_MAXSIG; ++i)
+	for (i = 1; i <= _SIG_MAXSIG; ++i)
 		_thr_rwl_rdlock(&_thr_sigact[i-1].lock);
 }
 
@@ -467,7 +467,7 @@ _thr_signal_postfork(void)
 {
 	int i;
 
-	for (i = 1; i < _SIG_MAXSIG; ++i)
+	for (i = 1; i <= _SIG_MAXSIG; ++i)
 		_thr_rwl_unlock(&_thr_sigact[i-1].lock);
 }
 
@@ -476,7 +476,7 @@ _thr_signal_postfork_child(void)
 {
 	int i;
 
-	for (i = 1; i < _SIG_MAXSIG; ++i)
+	for (i = 1; i <= _SIG_MAXSIG; ++i)
 		bzero(&_thr_sigact[i-1].lock, sizeof(struct urwlock));
 }
 

From owner-svn-src-head@FreeBSD.ORG  Mon Mar 26 18:22:05 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 376701065689;
	Mon, 26 Mar 2012 18:22:05 +0000 (UTC)
	(envelope-from marius@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 18BFA8FC1C;
	Mon, 26 Mar 2012 18:22:05 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2QIM4vj044944;
	Mon, 26 Mar 2012 18:22:04 GMT (envelope-from marius@svn.freebsd.org)
Received: (from marius@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2QIM4Xk044941;
	Mon, 26 Mar 2012 18:22:04 GMT (envelope-from marius@svn.freebsd.org)
Message-Id: <201203261822.q2QIM4Xk044941@svn.freebsd.org>
From: Marius Strobl 
Date: Mon, 26 Mar 2012 18:22:04 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233517 - in head/sys: boot/common libkern sys
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Mon, 26 Mar 2012 18:22:05 -0000

Author: marius
Date: Mon Mar 26 18:22:04 2012
New Revision: 233517
URL: http://svn.freebsd.org/changeset/base/233517

Log:
  Remove second consts in r233288 in order to appease C++ compilers.
  While at it, remove some style(9) bugs in libkern.h.
  
  Submitted by:	kan

Modified:
  head/sys/boot/common/crc32.c
  head/sys/libkern/crc32.c
  head/sys/sys/libkern.h

Modified: head/sys/boot/common/crc32.c
==============================================================================
--- head/sys/boot/common/crc32.c	Mon Mar 26 17:05:26 2012	(r233516)
+++ head/sys/boot/common/crc32.c	Mon Mar 26 18:22:04 2012	(r233517)
@@ -49,7 +49,7 @@ __FBSDID("$FreeBSD$");
 
 #include "crc32.h"
 
-static const uint32_t const crc32_tab[] = {
+static const uint32_t crc32_tab[] = {
 	0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f,
 	0xe963a535, 0x9e6495a3,	0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988,
 	0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, 0x1db71064, 0x6ab020f2,

Modified: head/sys/libkern/crc32.c
==============================================================================
--- head/sys/libkern/crc32.c	Mon Mar 26 17:05:26 2012	(r233516)
+++ head/sys/libkern/crc32.c	Mon Mar 26 18:22:04 2012	(r233517)
@@ -48,7 +48,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-const uint32_t const crc32_tab[] = {
+const uint32_t crc32_tab[] = {
 	0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f,
 	0xe963a535, 0x9e6495a3,	0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988,
 	0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, 0x1db71064, 0x6ab020f2,
@@ -134,7 +134,7 @@ const uint32_t const crc32_tab[] = {
 /*                                                               */
 /*****************************************************************/
 
-static const uint32_t const crc32Table[256] = {
+static const uint32_t crc32Table[256] = {
 	0x00000000L, 0xF26B8303L, 0xE13B70F7L, 0x1350F3F4L,
 	0xC79A971FL, 0x35F1141CL, 0x26A1E7E8L, 0xD4CA64EBL,
 	0x8AD958CFL, 0x78B2DBCCL, 0x6BE22838L, 0x9989AB3BL,
@@ -240,7 +240,7 @@ singletable_crc32c(uint32_t crc, const v
  * File Name = ............................ 8x256_tables.c
  */
 
-static const uint32_t const sctp_crc_tableil8_o32[256] =
+static const uint32_t sctp_crc_tableil8_o32[256] =
 {
 	0x00000000, 0xF26B8303, 0xE13B70F7, 0x1350F3F4, 0xC79A971F, 0x35F1141C, 0x26A1E7E8, 0xD4CA64EB,
 	0x8AD958CF, 0x78B2DBCC, 0x6BE22838, 0x9989AB3B, 0x4D43CFD0, 0xBF284CD3, 0xAC78BF27, 0x5E133C24,
@@ -296,7 +296,7 @@ static const uint32_t const sctp_crc_tab
  * File Name = ............................ 8x256_tables.c
  */
 
-static const uint32_t const sctp_crc_tableil8_o40[256] =
+static const uint32_t sctp_crc_tableil8_o40[256] =
 {
 	0x00000000, 0x13A29877, 0x274530EE, 0x34E7A899, 0x4E8A61DC, 0x5D28F9AB, 0x69CF5132, 0x7A6DC945,
 	0x9D14C3B8, 0x8EB65BCF, 0xBA51F356, 0xA9F36B21, 0xD39EA264, 0xC03C3A13, 0xF4DB928A, 0xE7790AFD,
@@ -352,7 +352,7 @@ static const uint32_t const sctp_crc_tab
  * File Name = ............................ 8x256_tables.c
  */
 
-static const uint32_t const sctp_crc_tableil8_o48[256] =
+static const uint32_t sctp_crc_tableil8_o48[256] =
 {
 	0x00000000, 0xA541927E, 0x4F6F520D, 0xEA2EC073, 0x9EDEA41A, 0x3B9F3664, 0xD1B1F617, 0x74F06469,
 	0x38513EC5, 0x9D10ACBB, 0x773E6CC8, 0xD27FFEB6, 0xA68F9ADF, 0x03CE08A1, 0xE9E0C8D2, 0x4CA15AAC,
@@ -408,7 +408,7 @@ static const uint32_t const sctp_crc_tab
  * File Name = ............................ 8x256_tables.c
  */
 
-static const uint32_t const sctp_crc_tableil8_o56[256] =
+static const uint32_t sctp_crc_tableil8_o56[256] =
 {
 	0x00000000, 0xDD45AAB8, 0xBF672381, 0x62228939, 0x7B2231F3, 0xA6679B4B, 0xC4451272, 0x1900B8CA,
 	0xF64463E6, 0x2B01C95E, 0x49234067, 0x9466EADF, 0x8D665215, 0x5023F8AD, 0x32017194, 0xEF44DB2C,
@@ -464,7 +464,7 @@ static const uint32_t const sctp_crc_tab
  * File Name = ............................ 8x256_tables.c
  */
 
-static const uint32_t const sctp_crc_tableil8_o64[256] =
+static const uint32_t sctp_crc_tableil8_o64[256] =
 {
 	0x00000000, 0x38116FAC, 0x7022DF58, 0x4833B0F4, 0xE045BEB0, 0xD854D11C, 0x906761E8, 0xA8760E44,
 	0xC5670B91, 0xFD76643D, 0xB545D4C9, 0x8D54BB65, 0x2522B521, 0x1D33DA8D, 0x55006A79, 0x6D1105D5,
@@ -520,7 +520,7 @@ static const uint32_t const sctp_crc_tab
  * File Name = ............................ 8x256_tables.c
  */
 
-static const uint32_t const sctp_crc_tableil8_o72[256] =
+static const uint32_t sctp_crc_tableil8_o72[256] =
 {
 	0x00000000, 0xEF306B19, 0xDB8CA0C3, 0x34BCCBDA, 0xB2F53777, 0x5DC55C6E, 0x697997B4, 0x8649FCAD,
 	0x6006181F, 0x8F367306, 0xBB8AB8DC, 0x54BAD3C5, 0xD2F32F68, 0x3DC34471, 0x097F8FAB, 0xE64FE4B2,
@@ -576,7 +576,7 @@ static const uint32_t const sctp_crc_tab
  * File Name = ............................ 8x256_tables.c
  */
 
-static const uint32_t const sctp_crc_tableil8_o80[256] =
+static const uint32_t sctp_crc_tableil8_o80[256] =
 {
 	0x00000000, 0x68032CC8, 0xD0065990, 0xB8057558, 0xA5E0C5D1, 0xCDE3E919, 0x75E69C41, 0x1DE5B089,
 	0x4E2DFD53, 0x262ED19B, 0x9E2BA4C3, 0xF628880B, 0xEBCD3882, 0x83CE144A, 0x3BCB6112, 0x53C84DDA,
@@ -632,7 +632,7 @@ static const uint32_t const sctp_crc_tab
  * File Name = ............................ 8x256_tables.c
  */
 
-static const uint32_t const sctp_crc_tableil8_o88[256] =
+static const uint32_t sctp_crc_tableil8_o88[256] =
 {
 	0x00000000, 0x493C7D27, 0x9278FA4E, 0xDB448769, 0x211D826D, 0x6821FF4A, 0xB3657823, 0xFA590504,
 	0x423B04DA, 0x0B0779FD, 0xD043FE94, 0x997F83B3, 0x632686B7, 0x2A1AFB90, 0xF15E7CF9, 0xB86201DE,

Modified: head/sys/sys/libkern.h
==============================================================================
--- head/sys/sys/libkern.h	Mon Mar 26 17:05:26 2012	(r233516)
+++ head/sys/sys/libkern.h	Mon Mar 26 18:22:04 2012	(r233517)
@@ -121,7 +121,7 @@ size_t	 strspn(const char *, const char 
 char	*strstr(const char *, const char *);
 int	 strvalid(const char *, size_t);
 
-extern const uint32_t const crc32_tab[];
+extern const uint32_t crc32_tab[];
 
 static __inline uint32_t
 crc32_raw(const void *buf, size_t size, uint32_t crc)
@@ -143,8 +143,8 @@ crc32(const void *buf, size_t size)
 }
 
 uint32_t
-calculate_crc32c(uint32_t crc32c, const unsigned char *buffer, 
-        unsigned int length);
+calculate_crc32c(uint32_t crc32c, const unsigned char *buffer,
+    unsigned int length);
 
 
 LIBKERN_INLINE void *memset(void *, int, size_t);

From owner-svn-src-head@FreeBSD.ORG  Mon Mar 26 18:22:26 2012
Return-Path: 
Delivered-To: svn-src-head@FreeBSD.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id AA8381065687;
	Mon, 26 Mar 2012 18:22:26 +0000 (UTC)
	(envelope-from marius@alchemy.franken.de)
Received: from alchemy.franken.de (alchemy.franken.de [194.94.249.214])
	by mx1.freebsd.org (Postfix) with ESMTP id 3E77F8FC14;
	Mon, 26 Mar 2012 18:22:26 +0000 (UTC)
Received: from alchemy.franken.de (localhost [127.0.0.1])
	by alchemy.franken.de (8.14.4/8.14.4/ALCHEMY.FRANKEN.DE) with ESMTP id
	q2QIMOA2089071; Mon, 26 Mar 2012 20:22:24 +0200 (CEST)
	(envelope-from marius@alchemy.franken.de)
Received: (from marius@localhost)
	by alchemy.franken.de (8.14.4/8.14.4/Submit) id q2QIMOQw089070;
	Mon, 26 Mar 2012 20:22:24 +0200 (CEST) (envelope-from marius)
Date: Mon, 26 Mar 2012 20:22:24 +0200
From: Marius Strobl 
To: Alexander Kabaev 
Message-ID: <20120326182224.GU37560@alchemy.franken.de>
References: <201203212055.q2LKtMYR093218@svn.freebsd.org>
	<20120325162528.7f73300c@kan.dyndns.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20120325162528.7f73300c@kan.dyndns.org>
User-Agent: Mutt/1.4.2.3i
Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org,
	src-committers@FreeBSD.org
Subject: Re: svn commit: r233288 - in head/sys: boot/common libkern sys
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Mon, 26 Mar 2012 18:22:26 -0000

On Sun, Mar 25, 2012 at 04:25:28PM -0400, Alexander Kabaev wrote:
> On Wed, 21 Mar 2012 20:55:22 +0000 (UTC)
> Marius Strobl  wrote:
> 
> 
> > Modified: head/sys/sys/libkern.h
> > ==============================================================================
> > --- head/sys/sys/libkern.h	Wed Mar 21 20:53:47 2012
> > (r233287) +++ head/sys/sys/libkern.h	Wed Mar 21 20:55:21
> > 2012	(r233288) @@ -121,7 +121,7 @@ size_t	 strspn(const
> > char *, const char char	*strstr(const char *, const char *);
> >  int	 strvalid(const char *, size_t);
> >  
> > -extern uint32_t crc32_tab[];
> > +extern const uint32_t const crc32_tab[];
> >  
> >  static __inline uint32_t
> >  crc32_raw(const void *buf, size_t size, uint32_t crc)
> 
> Hi,
> 
> 
> g++ produces "error: duplicate 'const'" on this changed line. Leaving
> the question as to why this file is ever being compiled by C++ on the
> conscience of of VirtualBox authors, I would suggest partially backing
> out this commit and getting easier on 'const' for C++'s sake. 
> 

Done in r233517.

Marius


From owner-svn-src-head@FreeBSD.ORG  Mon Mar 26 19:07:00 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 2C85E106564A;
	Mon, 26 Mar 2012 19:07:00 +0000 (UTC)
	(envelope-from joel@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 17FD58FC1E;
	Mon, 26 Mar 2012 19:07:00 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2QJ6xBP046385;
	Mon, 26 Mar 2012 19:06:59 GMT (envelope-from joel@svn.freebsd.org)
Received: (from joel@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2QJ6xW7046382;
	Mon, 26 Mar 2012 19:06:59 GMT (envelope-from joel@svn.freebsd.org)
Message-Id: <201203261906.q2QJ6xW7046382@svn.freebsd.org>
From: Joel Dahl 
Date: Mon, 26 Mar 2012 19:06:59 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233518 - head/lib/libc/locale
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Mon, 26 Mar 2012 19:07:00 -0000

Author: joel (doc committer)
Date: Mon Mar 26 19:06:59 2012
New Revision: 233518
URL: http://svn.freebsd.org/changeset/base/233518

Log:
  mdoc: remove unknown macro.

Modified:
  head/lib/libc/locale/duplocale.3
  head/lib/libc/locale/newlocale.3

Modified: head/lib/libc/locale/duplocale.3
==============================================================================
--- head/lib/libc/locale/duplocale.3	Mon Mar 26 18:22:04 2012	(r233517)
+++ head/lib/libc/locale/duplocale.3	Mon Mar 26 19:06:59 2012	(r233518)
@@ -56,7 +56,6 @@ associated with the current thread by
 .Xr uselocale 3 .
 These calls are therefore only thread safe on threads with a unique per-thread
 locale.
-.Pt
 The locale returned by this call must be freed with
 .Xr freelocale 3 .
 .Sh SEE ALSO

Modified: head/lib/libc/locale/newlocale.3
==============================================================================
--- head/lib/libc/locale/newlocale.3	Mon Mar 26 18:22:04 2012	(r233517)
+++ head/lib/libc/locale/newlocale.3	Mon Mar 26 19:06:59 2012	(r233518)
@@ -48,7 +48,6 @@ name specified in the
 parameter.
 Any other components will be inherited from
 .Fa base .
-.Pt
 The
 .Fa mask
 is either

From owner-svn-src-head@FreeBSD.ORG  Mon Mar 26 19:12:10 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 28C58106566B;
	Mon, 26 Mar 2012 19:12:10 +0000 (UTC) (envelope-from rmh@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id EE2018FC08;
	Mon, 26 Mar 2012 19:12:09 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2QJC95F046595;
	Mon, 26 Mar 2012 19:12:09 GMT (envelope-from rmh@svn.freebsd.org)
Received: (from rmh@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2QJC9A0046591;
	Mon, 26 Mar 2012 19:12:09 GMT (envelope-from rmh@svn.freebsd.org)
Message-Id: <201203261912.q2QJC9A0046591@svn.freebsd.org>
From: Robert Millan 
Date: Mon, 26 Mar 2012 19:12:09 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233519 - in head: lib/librt sys/sys
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Mon, 26 Mar 2012 19:12:10 -0000

Author: rmh
Date: Mon Mar 26 19:12:09 2012
New Revision: 233519
URL: http://svn.freebsd.org/changeset/base/233519

Log:
  Register signal 33 explicitly as reserved by real-time library, and
  use it by its new name (SIGLIBRT) rather than internal definition
  in librt (SIGSERVICE).
  
  Approved by:	davidxu, arch

Modified:
  head/lib/librt/sigev_thread.c
  head/lib/librt/sigev_thread.h
  head/sys/sys/signal.h

Modified: head/lib/librt/sigev_thread.c
==============================================================================
--- head/lib/librt/sigev_thread.c	Mon Mar 26 19:06:59 2012	(r233518)
+++ head/lib/librt/sigev_thread.c	Mon Mar 26 19:12:09 2012	(r233519)
@@ -224,11 +224,11 @@ __sigev_get_sigevent(struct sigev_node *
 	sigev_id_t id)
 {
 	/*
-	 * Build a new sigevent, and tell kernel to deliver SIGSERVICE
+	 * Build a new sigevent, and tell kernel to deliver SIGLIBRT
 	 * signal to the new thread.
 	 */
 	newevp->sigev_notify = SIGEV_THREAD_ID;
-	newevp->sigev_signo  = SIGSERVICE;
+	newevp->sigev_signo  = SIGLIBRT;
 	newevp->sigev_notify_thread_id = (lwpid_t)sn->sn_tn->tn_lwpid;
 	newevp->sigev_value.sival_ptr = (void *)id;
 }
@@ -279,7 +279,7 @@ __sigev_delete_node(struct sigev_node *s
 	LIST_REMOVE(sn, sn_link);
 
 	if (--sn->sn_tn->tn_refcount == 0)
-		_pthread_kill(sn->sn_tn->tn_thread, SIGSERVICE);
+		_pthread_kill(sn->sn_tn->tn_thread, SIGLIBRT);
 	if (sn->sn_flags & SNF_WORKING)
 		sn->sn_flags |= SNF_REMOVED;
 	else
@@ -326,7 +326,7 @@ sigev_thread_create(int usedefault)
 	LIST_INSERT_HEAD(&sigev_threads, tn, tn_link);
 	__sigev_list_unlock();
 
-	sigfillset(&set);	/* SIGSERVICE is masked. */
+	sigfillset(&set);	/* SIGLIBRT is masked. */
 	sigdelset(&set, SIGBUS);
 	sigdelset(&set, SIGILL);
 	sigdelset(&set, SIGFPE);
@@ -378,7 +378,7 @@ sigev_service_loop(void *arg)
 	__sigev_list_unlock();
 
 	sigemptyset(&set);
-	sigaddset(&set, SIGSERVICE);
+	sigaddset(&set, SIGLIBRT);
 	for (;;) {
 		ret = sigwaitinfo(&set, &si);
 

Modified: head/lib/librt/sigev_thread.h
==============================================================================
--- head/lib/librt/sigev_thread.h	Mon Mar 26 19:06:59 2012	(r233518)
+++ head/lib/librt/sigev_thread.h	Mon Mar 26 19:12:09 2012	(r233519)
@@ -67,8 +67,6 @@ struct sigev_thread {
 #define	SNF_REMOVED		0x02
 #define	SNF_SYNC		0x04
 
-#define	SIGSERVICE		(SIGTHR+1)
-
 int	__sigev_check_init();
 struct sigev_node *__sigev_alloc(int, const struct sigevent *,
 	struct sigev_node *, int);

Modified: head/sys/sys/signal.h
==============================================================================
--- head/sys/sys/signal.h	Mon Mar 26 19:06:59 2012	(r233518)
+++ head/sys/sys/signal.h	Mon Mar 26 19:12:09 2012	(r233519)
@@ -111,6 +111,7 @@
 #if __BSD_VISIBLE
 #define	SIGTHR		32	/* reserved by thread library. */
 #define	SIGLWP		SIGTHR
+#define	SIGLIBRT	33	/* reserved by real-time library. */
 #endif
 
 #define	SIGRTMIN	65

From owner-svn-src-head@FreeBSD.ORG  Mon Mar 26 19:23:58 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 131281065672;
	Mon, 26 Mar 2012 19:23:58 +0000 (UTC)
	(envelope-from joel@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id E7EAF8FC0A;
	Mon, 26 Mar 2012 19:23:57 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2QJNvaF047013;
	Mon, 26 Mar 2012 19:23:57 GMT (envelope-from joel@svn.freebsd.org)
Received: (from joel@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2QJNvxH047001;
	Mon, 26 Mar 2012 19:23:57 GMT (envelope-from joel@svn.freebsd.org)
Message-Id: <201203261923.q2QJNvxH047001@svn.freebsd.org>
From: Joel Dahl 
Date: Mon, 26 Mar 2012 19:23:57 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233520 - in head: lib/libc/i386/sys lib/libelf
	lib/libutil share/man/man5 usr.bin/man usr.sbin/wlconfig
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Mon, 26 Mar 2012 19:23:58 -0000

Author: joel (doc committer)
Date: Mon Mar 26 19:23:57 2012
New Revision: 233520
URL: http://svn.freebsd.org/changeset/base/233520

Log:
  mdoc: sort prologue macros.

Modified:
  head/lib/libc/i386/sys/i386_get_ioperm.2
  head/lib/libc/i386/sys/i386_set_watch.3
  head/lib/libc/i386/sys/i386_vm86.2
  head/lib/libelf/elf_getphdrnum.3
  head/lib/libelf/elf_getshdrnum.3
  head/lib/libelf/elf_getshdrstrndx.3
  head/lib/libutil/kinfo_getallproc.3
  head/lib/libutil/kinfo_getproc.3
  head/share/man/man5/ar.5
  head/usr.bin/man/man.conf.5
  head/usr.sbin/wlconfig/wlconfig.8

Modified: head/lib/libc/i386/sys/i386_get_ioperm.2
==============================================================================
--- head/lib/libc/i386/sys/i386_get_ioperm.2	Mon Mar 26 19:12:09 2012	(r233519)
+++ head/lib/libc/i386/sys/i386_get_ioperm.2	Mon Mar 26 19:23:57 2012	(r233520)
@@ -25,8 +25,8 @@
 .\" $FreeBSD$
 .\"
 .Dd July 27, 1998
-.Os
 .Dt I386_GET_IOPERM 2
+.Os
 .Sh NAME
 .Nm i386_get_ioperm ,
 .Nm i386_set_ioperm

Modified: head/lib/libc/i386/sys/i386_set_watch.3
==============================================================================
--- head/lib/libc/i386/sys/i386_set_watch.3	Mon Mar 26 19:12:09 2012	(r233519)
+++ head/lib/libc/i386/sys/i386_set_watch.3	Mon Mar 26 19:23:57 2012	(r233520)
@@ -28,8 +28,8 @@
 .\" $FreeBSD$
 .\"
 .Dd August 24, 2000
-.Os
 .Dt I386_SET_WATCH 3
+.Os
 .Sh NAME
 .Nm i386_clr_watch ,
 .Nm i386_set_watch

Modified: head/lib/libc/i386/sys/i386_vm86.2
==============================================================================
--- head/lib/libc/i386/sys/i386_vm86.2	Mon Mar 26 19:12:09 2012	(r233519)
+++ head/lib/libc/i386/sys/i386_vm86.2	Mon Mar 26 19:23:57 2012	(r233520)
@@ -25,8 +25,8 @@
 .\" $FreeBSD$
 .\"
 .Dd July 27, 1998
-.Os
 .Dt I386_VM86 2
+.Os
 .Sh NAME
 .Nm i386_vm86
 .Nd control vm86-related functions

Modified: head/lib/libelf/elf_getphdrnum.3
==============================================================================
--- head/lib/libelf/elf_getphdrnum.3	Mon Mar 26 19:12:09 2012	(r233519)
+++ head/lib/libelf/elf_getphdrnum.3	Mon Mar 26 19:23:57 2012	(r233520)
@@ -24,8 +24,8 @@
 .\" $FreeBSD$
 .\"
 .Dd August 5, 2009
-.Os
 .Dt ELF_GETPHDRNUM 3
+.Os
 .Sh NAME
 .Nm elf_getphdrnum
 .Nd return the number of program headers in an ELF file

Modified: head/lib/libelf/elf_getshdrnum.3
==============================================================================
--- head/lib/libelf/elf_getshdrnum.3	Mon Mar 26 19:12:09 2012	(r233519)
+++ head/lib/libelf/elf_getshdrnum.3	Mon Mar 26 19:23:57 2012	(r233520)
@@ -24,8 +24,8 @@
 .\" $FreeBSD$
 .\"
 .Dd August 4, 2009
-.Os
 .Dt ELF_GETSHDRNUM 3
+.Os
 .Sh NAME
 .Nm elf_getshdrnum
 .Nd return the number of sections in an ELF file

Modified: head/lib/libelf/elf_getshdrstrndx.3
==============================================================================
--- head/lib/libelf/elf_getshdrstrndx.3	Mon Mar 26 19:12:09 2012	(r233519)
+++ head/lib/libelf/elf_getshdrstrndx.3	Mon Mar 26 19:23:57 2012	(r233520)
@@ -24,8 +24,8 @@
 .\" $FreeBSD$
 .\"
 .Dd August 5, 2009
-.Os
 .Dt ELF_GETSHDRSTRNDX 3
+.Os
 .Sh NAME
 .Nm elf_getshdrstrndx
 .Nd retrieve the index of the section name string table

Modified: head/lib/libutil/kinfo_getallproc.3
==============================================================================
--- head/lib/libutil/kinfo_getallproc.3	Mon Mar 26 19:12:09 2012	(r233519)
+++ head/lib/libutil/kinfo_getallproc.3	Mon Mar 26 19:23:57 2012	(r233520)
@@ -26,8 +26,8 @@
 .\" $FreeBSD$
 .\"
 .Dd July 9, 2009
-.Os
 .Dt KINFO_GETALLPROC 3
+.Os
 .Sh NAME
 .Nm kinfo_getallproc
 .Nd function for getting process information of all processes from kernel

Modified: head/lib/libutil/kinfo_getproc.3
==============================================================================
--- head/lib/libutil/kinfo_getproc.3	Mon Mar 26 19:12:09 2012	(r233519)
+++ head/lib/libutil/kinfo_getproc.3	Mon Mar 26 19:23:57 2012	(r233520)
@@ -26,8 +26,8 @@
 .\" $FreeBSD$
 .\"
 .Dd February 25, 2012
-.Os
 .Dt KINFO_GETPROC 3
+.Os
 .Sh NAME
 .Nm kinfo_getproc
 .Nd function for getting process information from kernel

Modified: head/share/man/man5/ar.5
==============================================================================
--- head/share/man/man5/ar.5	Mon Mar 26 19:12:09 2012	(r233519)
+++ head/share/man/man5/ar.5	Mon Mar 26 19:23:57 2012	(r233520)
@@ -24,8 +24,8 @@
 .\" $FreeBSD$
 .\"
 .Dd November 28, 2010
-.Os
 .Dt AR 5
+.Os
 .Sh NAME
 .Nm ar
 .Nd archive file format for

Modified: head/usr.bin/man/man.conf.5
==============================================================================
--- head/usr.bin/man/man.conf.5	Mon Mar 26 19:12:09 2012	(r233519)
+++ head/usr.bin/man/man.conf.5	Mon Mar 26 19:23:57 2012	(r233520)
@@ -26,8 +26,8 @@
 .\" $FreeBSD$
 .\"
 .Dd June 3, 2011
-.Os
 .Dt MAN.CONF 5
+.Os
 .Sh NAME
 .Nm man.conf
 .Nd

Modified: head/usr.sbin/wlconfig/wlconfig.8
==============================================================================
--- head/usr.sbin/wlconfig/wlconfig.8	Mon Mar 26 19:12:09 2012	(r233519)
+++ head/usr.sbin/wlconfig/wlconfig.8	Mon Mar 26 19:23:57 2012	(r233520)
@@ -1,8 +1,8 @@
 .\" $FreeBSD$
 .\"
 .Dd December 26, 1996
-.Os
 .Dt WLCONFIG 8 i386
+.Os
 .Sh NAME
 .Nm wlconfig
 .Nd read/write wavelan config parameters

From owner-svn-src-head@FreeBSD.ORG  Mon Mar 26 21:22:52 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 96294106566C;
	Mon, 26 Mar 2012 21:22:52 +0000 (UTC)
	(envelope-from gonzo@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 80DB68FC14;
	Mon, 26 Mar 2012 21:22:52 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2QLMqtT050711;
	Mon, 26 Mar 2012 21:22:52 GMT (envelope-from gonzo@svn.freebsd.org)
Received: (from gonzo@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2QLMqbl050709;
	Mon, 26 Mar 2012 21:22:52 GMT (envelope-from gonzo@svn.freebsd.org)
Message-Id: <201203262122.q2QLMqbl050709@svn.freebsd.org>
From: Oleksandr Tymoshenko 
Date: Mon, 26 Mar 2012 21:22:52 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233521 - head/sys/cddl/dev/dtrace
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Mon, 26 Mar 2012 21:22:52 -0000

Author: gonzo
Date: Mon Mar 26 21:22:51 2012
New Revision: 233521
URL: http://svn.freebsd.org/changeset/base/233521

Log:
  Properly cast 64-bit dofhp_dof to pointer.
  
  For i386 this change is no-op. For AMD64 it was tested with DTrace test
  suite: results are the same from the test run before the change and after

Modified:
  head/sys/cddl/dev/dtrace/dtrace_ioctl.c

Modified: head/sys/cddl/dev/dtrace/dtrace_ioctl.c
==============================================================================
--- head/sys/cddl/dev/dtrace/dtrace_ioctl.c	Mon Mar 26 19:23:57 2012	(r233520)
+++ head/sys/cddl/dev/dtrace/dtrace_ioctl.c	Mon Mar 26 21:22:51 2012	(r233521)
@@ -39,11 +39,7 @@ dtrace_ioctl_helper(struct cdev *dev, u_
 	case DTRACEHIOC_ADDDOF:
 		dhp = (dof_helper_t *)addr;
 		/* XXX all because dofhp_dof is 64 bit */
-#ifdef __i386
-		addr = (caddr_t)(uint32_t)dhp->dofhp_dof;
-#else
-		addr = (caddr_t)dhp->dofhp_dof;
-#endif
+		addr = (caddr_t)(vm_offset_t)dhp->dofhp_dof;
 		/* FALLTHROUGH */
 	case DTRACEHIOC_ADD:
 		dof = dtrace_dof_copyin((intptr_t)addr, &rval);

From owner-svn-src-head@FreeBSD.ORG  Mon Mar 26 21:22:54 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 98939106564A;
	Mon, 26 Mar 2012 21:22:54 +0000 (UTC)
	(envelope-from joel@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 8073F8FC0C;
	Mon, 26 Mar 2012 21:22:54 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2QLMss3050753;
	Mon, 26 Mar 2012 21:22:54 GMT (envelope-from joel@svn.freebsd.org)
Received: (from joel@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2QLMs27050742;
	Mon, 26 Mar 2012 21:22:54 GMT (envelope-from joel@svn.freebsd.org)
Message-Id: <201203262122.q2QLMs27050742@svn.freebsd.org>
From: Joel Dahl 
Date: Mon, 26 Mar 2012 21:22:54 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233522 - in head: lib/libc/iconv lib/libc/net
	sbin/setkey usr.sbin/ac usr.sbin/apmd usr.sbin/faithd
	usr.sbin/mfiutil usr.sbin/pmcstat usr.sbin/rtadvd usr.sbin/wlconfig
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Mon, 26 Mar 2012 21:22:54 -0000

Author: joel (doc committer)
Date: Mon Mar 26 21:22:53 2012
New Revision: 233522
URL: http://svn.freebsd.org/changeset/base/233522

Log:
  mdoc: correct .Bd/.Bl arguments.
  
  Reviewed by:	brueffer

Modified:
  head/lib/libc/iconv/iconvctl.3
  head/lib/libc/net/getipnodebyname.3
  head/sbin/setkey/setkey.8
  head/usr.sbin/ac/ac.8
  head/usr.sbin/apmd/apmd.8
  head/usr.sbin/faithd/faithd.8
  head/usr.sbin/mfiutil/mfiutil.8
  head/usr.sbin/pmcstat/pmcstat.8
  head/usr.sbin/rtadvd/rtadvd.conf.5
  head/usr.sbin/wlconfig/wlconfig.8

Modified: head/lib/libc/iconv/iconvctl.3
==============================================================================
--- head/lib/libc/iconv/iconvctl.3	Mon Mar 26 21:22:51 2012	(r233521)
+++ head/lib/libc/iconv/iconvctl.3	Mon Mar 26 21:22:53 2012	(r233522)
@@ -61,7 +61,7 @@ parameter specifies the operation to acc
 is an operation-specific argument.
 .Pp
 The possible operations are the following:
-.Bl -tag -width -indent
+.Bl -tag -width indent
 .It ICONV_TRIVIALP
 In this case
 .Fa argument

Modified: head/lib/libc/net/getipnodebyname.3
==============================================================================
--- head/lib/libc/net/getipnodebyname.3	Mon Mar 26 21:22:51 2012	(r233521)
+++ head/lib/libc/net/getipnodebyname.3	Mon Mar 26 21:22:53 2012	(r233522)
@@ -108,13 +108,13 @@ We note that a special flags value of
 (defined below)
 should handle most applications.
 That is, porting simple applications to use IPv6 replaces the call
-.Bd -literal -offset
-   hptr = gethostbyname(name);
+.Bd -literal -offset indent
+hptr = gethostbyname(name);
 .Ed
 .Pp
 with
-.Bd -literal -offset
-   hptr = getipnodebyname(name, AF_INET6, AI_DEFAULT, &error_num);
+.Bd -literal -offset indent
+hptr = getipnodebyname(name, AF_INET6, AI_DEFAULT, &error_num);
 .Ed
 .Pp
 Applications desiring finer control over the types of addresses
@@ -270,8 +270,8 @@ records are returned as IPv4-mapped IPv6
 The special flags value of
 .Dv AI_DEFAULT
 is defined as
-.Bd -literal -offset
-   #define  AI_DEFAULT  (AI_V4MAPPED_CFG | AI_ADDRCONFIG)
+.Bd -literal -offset indent
+#define  AI_DEFAULT  (AI_V4MAPPED_CFG | AI_ADDRCONFIG)
 .Ed
 .Pp
 We noted that the

Modified: head/sbin/setkey/setkey.8
==============================================================================
--- head/sbin/setkey/setkey.8	Mon Mar 26 21:22:51 2012	(r233521)
+++ head/sbin/setkey/setkey.8	Mon Mar 26 21:22:53 2012	(r233522)
@@ -651,48 +651,48 @@ deflate		rfc2394
 .Sh EXAMPLES
 Add an ESP SA between two IPv6 addresses using the
 des-cbc encryption algorithm.
-.Bd -literal -offset
+.Bd -literal -offset indent
 add 3ffe:501:4819::1 3ffe:501:481d::1 esp 123457
 	-E des-cbc 0x3ffe05014819ffff ;
 
 .Ed
 .\"
 Add an authentication SA between two FQDN specified hosts:
-.Bd -literal -offset
+.Bd -literal -offset indent
 add -6 myhost.example.com yourhost.example.com ah 123456
 	-A hmac-sha1 "AH SA configuration!" ;
 
 .Ed
 Use both ESP and AH between two numerically specified hosts:
-.Bd -literal -offset
+.Bd -literal -offset indent
 add 10.0.11.41 10.0.11.33 esp 0x10001
 	-E des-cbc 0x3ffe05014819ffff
 	-A hmac-md5 "authentication!!" ;
 
 .Ed
 Get the SA information associated with first example above:
-.Bd -literal -offset
+.Bd -literal -offset indent
 get 3ffe:501:4819::1 3ffe:501:481d::1 ah 123456 ;
 
 .Ed
 Flush all entries from the database:
-.Bd -literal -offset
+.Bd -literal -offset indent
 flush ;
 
 .Ed
 Dump the ESP entries from the database:
-.Bd -literal -offset
+.Bd -literal -offset indent
 dump esp ;
 
 .Ed
 Add a security policy between two networks that uses ESP in tunnel mode:
-.Bd -literal -offset
+.Bd -literal -offset indent
 spdadd 10.0.11.41/32[21] 10.0.11.33/32[any] any
 	-P out ipsec esp/tunnel/192.168.0.1-192.168.1.2/require ;
 
 .Ed
 Use TCP MD5 between two numerically specified hosts:
-.Bd -literal -offset
+.Bd -literal -offset indent
 add 10.1.10.34 10.1.10.36 tcp 0x1000 -A tcp-md5 "TCP-MD5 BGP secret" ;
 
 .Ed

Modified: head/usr.sbin/ac/ac.8
==============================================================================
--- head/usr.sbin/ac/ac.8	Mon Mar 26 21:22:51 2012	(r233521)
+++ head/usr.sbin/ac/ac.8	Mon Mar 26 21:22:53 2012	(r233522)
@@ -112,7 +112,7 @@ No login or connect time accounting is p
 does not exist.
 .Pp
 For example,
-.Bd -literal -offset
+.Bd -literal -offset indent
 ac -p -t "ttyd*" > modems
 ac -p -t "!ttyd*" > other
 .Ed

Modified: head/usr.sbin/apmd/apmd.8
==============================================================================
--- head/usr.sbin/apmd/apmd.8	Mon Mar 26 21:22:51 2012	(r233521)
+++ head/usr.sbin/apmd/apmd.8	Mon Mar 26 21:22:53 2012	(r233522)
@@ -66,7 +66,7 @@ built-in functions in the configuration 
 The
 .Nm
 utility recognizes the following runtime options:
-.Bl -tag -width -f_file
+.Bl -tag -width f_file
 .It Fl d
 Starts in debug mode.
 This causes

Modified: head/usr.sbin/faithd/faithd.8
==============================================================================
--- head/usr.sbin/faithd/faithd.8	Mon Mar 26 21:22:51 2012	(r233521)
+++ head/usr.sbin/faithd/faithd.8	Mon Mar 26 21:22:53 2012	(r233522)
@@ -281,7 +281,7 @@ Before invoking
 the
 .Xr faith 4
 interface has to be configured properly.
-.Bd -literal -offset
+.Bd -literal -offset indent
 # sysctl net.inet6.ip6.accept_rtadv=0
 # sysctl net.inet6.ip6.forwarding=1
 # sysctl net.inet6.ip6.keepfaith=1
@@ -295,7 +295,7 @@ To translate
 service, and provide no local telnet service, invoke
 .Nm
 as follows:
-.Bd -literal -offset
+.Bd -literal -offset indent
 # faithd telnet
 .Ed
 .Pp
@@ -304,12 +304,12 @@ If you would like to provide local telne
 on
 .Pa /usr/libexec/telnetd ,
 use the following command line:
-.Bd -literal -offset
+.Bd -literal -offset indent
 # faithd telnet /usr/libexec/telnetd telnetd
 .Ed
 .Pp
 If you would like to pass extra arguments to the local daemon:
-.Bd -literal -offset
+.Bd -literal -offset indent
 # faithd ftp /usr/libexec/ftpd ftpd -l
 .Ed
 .Pp
@@ -317,7 +317,7 @@ Here are some other examples.
 You may need
 .Fl p
 if the service checks the source port range.
-.Bd -literal -offset
+.Bd -literal -offset indent
 # faithd ssh
 # faithd telnet /usr/libexec/telnetd telnetd
 .Ed
@@ -325,7 +325,7 @@ if the service checks the source port ra
 Add the following lines into
 .Xr inetd.conf 5 .
 Syntax may vary depending upon your operating system.
-.Bd -literal -offset
+.Bd -literal -offset indent
 telnet  stream  tcp6/faith  nowait  root  faithd  telnetd
 ftp     stream  tcp6/faith  nowait  root  faithd  ftpd -l
 ssh     stream  tcp6/faith  nowait  root  faithd  /usr/sbin/sshd -i
@@ -349,7 +349,7 @@ will invoke service-specific daemon like
 The following illustrates a simple
 .Pa faithd.conf
 setting.
-.Bd -literal -offset
+.Bd -literal -offset indent
 # permit anyone from 3ffe:501:ffff::/48 to use the translator,
 # to connect to the following IPv4 destinations:
 # - any location except 10.0.0.0/8 and 127.0.0.0/8.

Modified: head/usr.sbin/mfiutil/mfiutil.8
==============================================================================
--- head/usr.sbin/mfiutil/mfiutil.8	Mon Mar 26 21:22:51 2012	(r233521)
+++ head/usr.sbin/mfiutil/mfiutil.8	Mon Mar 26 21:22:53 2012	(r233522)
@@ -250,7 +250,7 @@ parameter limits the output to entries a
 The default class is
 .Dq warn .
 The available classes from lowest priority to highest are:
-.Bl -tag -width -indent
+.Bl -tag -width indent
 .It Cm debug
 Debug messages.
 .It Cm progress
@@ -300,7 +300,7 @@ and
 parameters.
 Each of these parameters can either be specified as a log entry number or as
 one of the following aliases:
-.Bl -tag -width -indent
+.Bl -tag -width indent
 .It Cm newest
 The newest entry in the event log.
 .It Cm oldest

Modified: head/usr.sbin/pmcstat/pmcstat.8
==============================================================================
--- head/usr.sbin/pmcstat/pmcstat.8	Mon Mar 26 21:22:51 2012	(r233521)
+++ head/usr.sbin/pmcstat/pmcstat.8	Mon Mar 26 21:22:53 2012	(r233522)
@@ -388,7 +388,7 @@ If option
 is specified,
 .Nm
 may issue the following diagnostic messages:
-.Bl -diag -width indent
+.Bl -diag
 .It "#callchain/dubious-frames"
 The number of callchain records that had an
 .Dq impossible

Modified: head/usr.sbin/rtadvd/rtadvd.conf.5
==============================================================================
--- head/usr.sbin/rtadvd/rtadvd.conf.5	Mon Mar 26 21:22:51 2012	(r233521)
+++ head/usr.sbin/rtadvd/rtadvd.conf.5	Mon Mar 26 21:22:53 2012	(r233522)
@@ -449,7 +449,7 @@ With the following configuration,
 overrides the router lifetime parameter for the
 .Li ne0
 interface.
-.Bd -literal -offset
+.Bd -literal -offset indent
 ne0:\\
 	:rltime#0:
 .Ed
@@ -461,7 +461,7 @@ The configuration must be used with the
 .Fl s
 option to
 .Xr rtadvd 8 .
-.Bd -literal -offset
+.Bd -literal -offset indent
 ef0:\\
 	:addr="2001:db8:ffff:1000::":prefixlen#64:
 .Ed
@@ -470,7 +470,7 @@ The following example configures the
 .Li wlan0
 interface and adds two DNS servers and a DNS domain search options
 using the default option lifetime values.
-.Bd -literal -offset
+.Bd -literal -offset indent
 wlan0:\\
 	:addr="2001:db8:ffff:1000::":prefixlen#64:\\
 	:rdnss="2001:db8:ffff::10,2001:db8:ffff::2:43":\\
@@ -480,7 +480,7 @@ wlan0:\\
 The following example presents the default values in an explicit manner.
 The configuration is provided just for reference purposes;
 YOU DO NOT NEED TO HAVE IT AT ALL.
-.Bd -literal -offset
+.Bd -literal -offset indent
 default:\\
 	:chlim#64:raflags#0:rltime#1800:rtime#0:retrans#0:\\
 	:pinfoflags="la":vltime#2592000:pltime#604800:mtu#0:

Modified: head/usr.sbin/wlconfig/wlconfig.8
==============================================================================
--- head/usr.sbin/wlconfig/wlconfig.8	Mon Mar 26 21:22:51 2012	(r233521)
+++ head/usr.sbin/wlconfig/wlconfig.8	Mon Mar 26 21:22:53 2012	(r233522)
@@ -97,12 +97,12 @@ utility should then be used to reconfigu
 value.
 .Sh EXAMPLES
 Set the NWID to 0x1234:
-.Bd -literal -offset
+.Bd -literal -offset indent
 # wlconfig wl0 nwid 0x1234
 .Ed
 .Pp
 Show the current settings:
-.Bd -literal -offset
+.Bd -literal -offset indent
 # wlconfig wl0
 Board type            : ISA
 Base address options  : 0x300, 0x390, 0x3c0, 0x3e0
@@ -128,7 +128,7 @@ CRC status            : OK
 .Ed
 .Pp
 Print a scaled version of the signal strength cache:
-.Bd -literal -offset
+.Bd -literal -offset indent
 # wlconfig wl0 cache scale
 .Ed
 .Sh SEE ALSO

From owner-svn-src-head@FreeBSD.ORG  Mon Mar 26 21:26:23 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id E193B106564A;
	Mon, 26 Mar 2012 21:26:23 +0000 (UTC)
	(envelope-from gonzo@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id CD09A8FC17;
	Mon, 26 Mar 2012 21:26:23 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2QLQNTR050897;
	Mon, 26 Mar 2012 21:26:23 GMT (envelope-from gonzo@svn.freebsd.org)
Received: (from gonzo@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2QLQNaS050895;
	Mon, 26 Mar 2012 21:26:23 GMT (envelope-from gonzo@svn.freebsd.org)
Message-Id: <201203262126.q2QLQNaS050895@svn.freebsd.org>
From: Oleksandr Tymoshenko 
Date: Mon, 26 Mar 2012 21:26:23 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233523 - head/sys/sys
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Mon, 26 Mar 2012 21:26:24 -0000

Author: gonzo
Date: Mon Mar 26 21:26:23 2012
New Revision: 233523
URL: http://svn.freebsd.org/changeset/base/233523

Log:
  Add .reginfo section entry

Modified:
  head/sys/sys/elf_common.h

Modified: head/sys/sys/elf_common.h
==============================================================================
--- head/sys/sys/elf_common.h	Mon Mar 26 21:22:53 2012	(r233522)
+++ head/sys/sys/elf_common.h	Mon Mar 26 21:26:23 2012	(r233523)
@@ -296,6 +296,7 @@ typedef struct {
 #define	SHT_HIOS		0x6fffffff	/* Last of OS specific semantics */
 #define	SHT_LOPROC		0x70000000	/* reserved range for processor */
 #define	SHT_AMD64_UNWIND	0x70000001	/* unwind information */
+#define	SHT_MIPS_REGINFO	0x70000006
 #define	SHT_MIPS_OPTIONS	0x7000000d
 #define	SHT_MIPS_DWARF		0x7000001e	/* MIPS gcc uses MIPS_DWARF */
 #define	SHT_HIPROC		0x7fffffff	/* specific section header types */

From owner-svn-src-head@FreeBSD.ORG  Mon Mar 26 21:31:58 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 20E6D1065676;
	Mon, 26 Mar 2012 21:31:58 +0000 (UTC)
	(envelope-from gonzo@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 0C3ED8FC12;
	Mon, 26 Mar 2012 21:31:58 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2QLVvei051124;
	Mon, 26 Mar 2012 21:31:57 GMT (envelope-from gonzo@svn.freebsd.org)
Received: (from gonzo@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2QLVv8H051122;
	Mon, 26 Mar 2012 21:31:57 GMT (envelope-from gonzo@svn.freebsd.org)
Message-Id: <201203262131.q2QLVv8H051122@svn.freebsd.org>
From: Oleksandr Tymoshenko 
Date: Mon, 26 Mar 2012 21:31:57 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233524 - head/lib/libelf
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Mon, 26 Mar 2012 21:31:58 -0000

Author: gonzo
Date: Mon Mar 26 21:31:57 2012
New Revision: 233524
URL: http://svn.freebsd.org/changeset/base/233524

Log:
  Handle MIPS .reginfo section as ELF_T_BYTE

Modified:
  head/lib/libelf/libelf_data.c

Modified: head/lib/libelf/libelf_data.c
==============================================================================
--- head/lib/libelf/libelf_data.c	Mon Mar 26 21:26:23 2012	(r233523)
+++ head/lib/libelf/libelf_data.c	Mon Mar 26 21:31:57 2012	(r233524)
@@ -86,6 +86,8 @@ _libelf_xlate_shtype(uint32_t sht)
 #endif
 	case SHT_MIPS_DWARF:
 		/* FALLTHROUGH */
+	case SHT_MIPS_REGINFO:
+		/* FALLTHROUGH */
 	case SHT_MIPS_OPTIONS:
 		/* FALLTHROUGH */
 	case SHT_AMD64_UNWIND:	/* == SHT_IA_64_UNWIND */

From owner-svn-src-head@FreeBSD.ORG  Mon Mar 26 21:47:07 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 59C3D106566C;
	Mon, 26 Mar 2012 21:47:07 +0000 (UTC)
	(envelope-from gonzo@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 2BFE68FC0A;
	Mon, 26 Mar 2012 21:47:07 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2QLl7m5051619;
	Mon, 26 Mar 2012 21:47:07 GMT (envelope-from gonzo@svn.freebsd.org)
Received: (from gonzo@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2QLl6JE051617;
	Mon, 26 Mar 2012 21:47:06 GMT (envelope-from gonzo@svn.freebsd.org)
Message-Id: <201203262147.q2QLl6JE051617@svn.freebsd.org>
From: Oleksandr Tymoshenko 
Date: Mon, 26 Mar 2012 21:47:06 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233525 - head/sys/cddl/dev/dtrace/mips
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Mon, 26 Mar 2012 21:47:07 -0000

Author: gonzo
Date: Mon Mar 26 21:47:06 2012
New Revision: 233525
URL: http://svn.freebsd.org/changeset/base/233525

Log:
  - For o32 ABI get arguments from the stack
  - Clear CPU_DTRACE_FAULT flag in userland backtrace routine. It just
     means we hit wrong memory region and should stop.

Modified:
  head/sys/cddl/dev/dtrace/mips/dtrace_isa.c

Modified: head/sys/cddl/dev/dtrace/mips/dtrace_isa.c
==============================================================================
--- head/sys/cddl/dev/dtrace/mips/dtrace_isa.c	Mon Mar 26 21:31:57 2012	(r233524)
+++ head/sys/cddl/dev/dtrace/mips/dtrace_isa.c	Mon Mar 26 21:47:06 2012	(r233525)
@@ -487,6 +487,19 @@ dtrace_next_frame(register_t *pc, regist
 	*pc = ra;
 	*sp += stksize;
 
+#if defined(__mips_o32)
+	/*
+	 * For MIPS32 fill out arguments 5..8 from the stack
+	 */
+	for (arg = 4; arg < 8; arg++) {
+		addr = (vm_offset_t)(*sp + arg*sizeof(register_t));
+		if (args)
+			args[arg] = kdbpeekd((int *)addr);
+		if (valid_args)
+			valid_args[arg] = 1;
+	}
+#endif
+
 	return (0);
 error:
 	return (-1);
@@ -501,6 +514,9 @@ dtrace_next_uframe(register_t *pc, regis
 	int stksize;
 	InstFmt i;
 
+	volatile uint16_t *flags =
+	    (volatile uint16_t *)&cpu_core[curcpu].cpuc_dtrace_flags;
+
 	registers_on_stack = 0;
 	mask = 0;
 	function_start = 0;
@@ -510,6 +526,9 @@ dtrace_next_uframe(register_t *pc, regis
 	while (offset < MAX_FUNCTION_SIZE) {
 		opcode = dtrace_fuword32((void *)(vm_offset_t)(*pc - offset));
 
+		if (*flags & CPU_DTRACE_FAULT)
+			goto fault;
+
 		/* [d]addiu sp, sp, -X*/
 		if (((opcode & 0xffff8000) == 0x27bd8000)
 		    || ((opcode & 0xffff8000) == 0x67bd8000)) {
@@ -593,6 +612,9 @@ dtrace_next_uframe(register_t *pc, regis
 			}
 
 			offset += sizeof(int);
+
+			if (*flags & CPU_DTRACE_FAULT)
+				goto fault;
 		}
 	}
 
@@ -606,6 +628,12 @@ dtrace_next_uframe(register_t *pc, regis
 	*sp += stksize;
 
 	return (0);
+fault:
+	/*
+	 * We just got lost in backtrace, no big deal
+	 */
+	*flags &= ~CPU_DTRACE_FAULT;
+	return (-1);
 }
 
 static int

From owner-svn-src-head@FreeBSD.ORG  Tue Mar 27 01:24:18 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id E0351106566C;
	Tue, 27 Mar 2012 01:24:18 +0000 (UTC)
	(envelope-from nwhitehorn@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id C8F348FC0A;
	Tue, 27 Mar 2012 01:24:18 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2R1OIr0058443;
	Tue, 27 Mar 2012 01:24:18 GMT
	(envelope-from nwhitehorn@svn.freebsd.org)
Received: (from nwhitehorn@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2R1OIr7058441;
	Tue, 27 Mar 2012 01:24:18 GMT
	(envelope-from nwhitehorn@svn.freebsd.org)
Message-Id: <201203270124.q2R1OIr7058441@svn.freebsd.org>
From: Nathan Whitehorn 
Date: Tue, 27 Mar 2012 01:24:18 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233529 - head/sys/powerpc/aim
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 27 Mar 2012 01:24:19 -0000

Author: nwhitehorn
Date: Tue Mar 27 01:24:18 2012
New Revision: 233529
URL: http://svn.freebsd.org/changeset/base/233529

Log:
  More PMAP concurrency improvements: replace the table lock and (almost) all
  uses of the page queues mutex with a new rwlock that protects the page
  table and the PV lists. This reduces system time during a parallel
  buildworld by 35%.
  
  Reviewed by:	alc

Modified:
  head/sys/powerpc/aim/mmu_oea64.c

Modified: head/sys/powerpc/aim/mmu_oea64.c
==============================================================================
--- head/sys/powerpc/aim/mmu_oea64.c	Tue Mar 27 00:52:30 2012	(r233528)
+++ head/sys/powerpc/aim/mmu_oea64.c	Tue Mar 27 01:24:18 2012	(r233529)
@@ -126,6 +126,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -173,9 +174,20 @@ uintptr_t moea64_get_unique_vsid(void); 
 #define	VSID_TO_HASH(vsid)	(((vsid) >> 4) & 0xfffff)
 #define	VSID_HASH_MASK		0x0000007fffffffffULL
 
-#define LOCK_TABLE() mtx_lock(&moea64_table_mutex)
-#define UNLOCK_TABLE() mtx_unlock(&moea64_table_mutex);
-#define ASSERT_TABLE_LOCK() mtx_assert(&moea64_table_mutex, MA_OWNED)
+/*
+ * Locking semantics:
+ * -- Read lock: if no modifications are being made to either the PVO lists
+ *    or page table or if any modifications being made result in internal
+ *    changes (e.g. wiring, protection) such that the existence of the PVOs
+ *    is unchanged and they remain associated with the same pmap (in which
+ *    case the changes should be protected by the pmap lock)
+ * -- Write lock: required if PTEs/PVOs are being inserted or removed.
+ */
+
+#define LOCK_TABLE_RD() rw_rlock(&moea64_table_lock)
+#define UNLOCK_TABLE_RD() rw_runlock(&moea64_table_lock)
+#define LOCK_TABLE_WR() rw_wlock(&moea64_table_lock)
+#define UNLOCK_TABLE_WR() rw_wunlock(&moea64_table_lock)
 
 struct ofw_map {
 	cell_t	om_va;
@@ -198,7 +210,7 @@ extern void bs_remap_earlyboot(void);
 /*
  * Lock for the pteg and pvo tables.
  */
-struct mtx	moea64_table_mutex;
+struct rwlock	moea64_table_lock;
 struct mtx	moea64_slb_mutex;
 
 /*
@@ -400,8 +412,6 @@ moea64_pte_create(struct lpte *pt, uint6
     uint64_t pte_lo, int flags)
 {
 
-	ASSERT_TABLE_LOCK();
-
 	/*
 	 * Construct a PTE.  Default to IMB initially.  Valid bit only gets
 	 * set when the real pte is set in memory.
@@ -594,6 +604,7 @@ moea64_setup_direct_map(mmu_t mmup, vm_o
 
 	DISABLE_TRANS(msr);
 	if (hw_direct_map) {
+		LOCK_TABLE_WR();
 		PMAP_LOCK(kernel_pmap);
 		for (i = 0; i < pregions_sz; i++) {
 		  for (pa = pregions[i].mr_start; pa < pregions[i].mr_start +
@@ -618,6 +629,7 @@ moea64_setup_direct_map(mmu_t mmup, vm_o
 		  }
 		}
 		PMAP_UNLOCK(kernel_pmap);
+		UNLOCK_TABLE_WR();
 	} else {
 		size = sizeof(struct pvo_head) * moea64_pteg_count;
 		off = (vm_offset_t)(moea64_pvo_table);
@@ -776,8 +788,7 @@ moea64_mid_bootstrap(mmu_t mmup, vm_offs
 	 * Initialize the lock that synchronizes access to the pteg and pvo
 	 * tables.
 	 */
-	mtx_init(&moea64_table_mutex, "pmap table", NULL, MTX_DEF |
-	    MTX_RECURSE);
+	rw_init_flags(&moea64_table_lock, "pmap tables", RW_RECURSE);
 	mtx_init(&moea64_slb_mutex, "SLB table", NULL, MTX_DEF);
 
 	/*
@@ -956,7 +967,7 @@ moea64_late_bootstrap(mmu_t mmup, vm_off
 
 			moea64_scratchpage_pvo[i] = moea64_pvo_find_va(
 			    kernel_pmap, (vm_offset_t)moea64_scratchpage_va[i]);
-			LOCK_TABLE();
+			LOCK_TABLE_RD();
 			moea64_scratchpage_pte[i] = MOEA64_PVO_TO_PTE(
 			    mmup, moea64_scratchpage_pvo[i]);
 			moea64_scratchpage_pvo[i]->pvo_pte.lpte.pte_hi
@@ -964,7 +975,7 @@ moea64_late_bootstrap(mmu_t mmup, vm_off
 			MOEA64_PTE_CHANGE(mmup, moea64_scratchpage_pte[i],
 			    &moea64_scratchpage_pvo[i]->pvo_pte.lpte,
 			    moea64_scratchpage_pvo[i]->pvo_vpn);
-			UNLOCK_TABLE();
+			UNLOCK_TABLE_RD();
 		}
 	}
 }
@@ -1010,11 +1021,11 @@ moea64_change_wiring(mmu_t mmu, pmap_t p
 	uint64_t vsid;
 	int	i, ptegidx;
 
+	LOCK_TABLE_WR();
 	PMAP_LOCK(pm);
 	pvo = moea64_pvo_find_va(pm, va & ~ADDR_POFF);
 
 	if (pvo != NULL) {
-		LOCK_TABLE();
 		pt = MOEA64_PVO_TO_PTE(mmu, pvo);
 
 		if (wired) {
@@ -1050,8 +1061,8 @@ moea64_change_wiring(mmu_t mmu, pmap_t p
 			}
 		}
 			
-		UNLOCK_TABLE();
 	}
+	UNLOCK_TABLE_WR();
 	PMAP_UNLOCK(pm);
 }
 
@@ -1162,10 +1173,10 @@ moea64_enter(mmu_t mmu, pmap_t pmap, vm_
     vm_prot_t prot, boolean_t wired)
 {
 
-	vm_page_lock_queues();
+	LOCK_TABLE_WR();
 	PMAP_LOCK(pmap);
 	moea64_enter_locked(mmu, pmap, va, m, prot, wired);
-	vm_page_unlock_queues();
+	UNLOCK_TABLE_WR();
 	PMAP_UNLOCK(pmap);
 }
 
@@ -1174,7 +1185,7 @@ moea64_enter(mmu_t mmu, pmap_t pmap, vm_
  * target pmap with the protection requested.  If specified the page
  * will be wired down.
  *
- * The page queues and pmap must be locked.
+ * The table (write) and pmap must be locked.
  */
 
 static void
@@ -1200,8 +1211,6 @@ moea64_enter_locked(mmu_t mmu, pmap_t pm
 		pvo_flags = PVO_MANAGED;
 	}
 
-	if (pmap_bootstrapped)
-		mtx_assert(&vm_page_queue_mtx, MA_OWNED);
 	PMAP_LOCK_ASSERT(pmap, MA_OWNED);
 	KASSERT((m->oflags & (VPO_UNMANAGED | VPO_BUSY)) != 0 ||
 	    VM_OBJECT_LOCKED(m->object),
@@ -1299,14 +1308,14 @@ moea64_enter_object(mmu_t mmu, pmap_t pm
 
 	psize = atop(end - start);
 	m = m_start;
-	vm_page_lock_queues();
+	LOCK_TABLE_WR();
 	PMAP_LOCK(pm);
 	while (m != NULL && (diff = m->pindex - m_start->pindex) < psize) {
 		moea64_enter_locked(mmu, pm, start + ptoa(diff), m, prot &
 		    (VM_PROT_READ | VM_PROT_EXECUTE), FALSE);
 		m = TAILQ_NEXT(m, listq);
 	}
-	vm_page_unlock_queues();
+	UNLOCK_TABLE_WR();
 	PMAP_UNLOCK(pm);
 }
 
@@ -1315,11 +1324,11 @@ moea64_enter_quick(mmu_t mmu, pmap_t pm,
     vm_prot_t prot)
 {
 
-	vm_page_lock_queues();
+	LOCK_TABLE_WR();
 	PMAP_LOCK(pm);
 	moea64_enter_locked(mmu, pm, va, m,
 	    prot & (VM_PROT_READ | VM_PROT_EXECUTE), FALSE);
-	vm_page_unlock_queues();
+	UNLOCK_TABLE_WR();
 	PMAP_UNLOCK(pm);
 }
 
@@ -1329,6 +1338,7 @@ moea64_extract(mmu_t mmu, pmap_t pm, vm_
 	struct	pvo_entry *pvo;
 	vm_paddr_t pa;
 
+	LOCK_TABLE_RD();
 	PMAP_LOCK(pm);
 	pvo = moea64_pvo_find_va(pm, va);
 	if (pvo == NULL)
@@ -1336,6 +1346,7 @@ moea64_extract(mmu_t mmu, pmap_t pm, vm_
 	else
 		pa = (pvo->pvo_pte.lpte.pte_lo & LPTE_RPGN) |
 		    (va - PVO_VADDR(pvo));
+	UNLOCK_TABLE_RD();
 	PMAP_UNLOCK(pm);
 	return (pa);
 }
@@ -1354,6 +1365,7 @@ moea64_extract_and_hold(mmu_t mmu, pmap_
         
 	m = NULL;
 	pa = 0;
+	LOCK_TABLE_RD();
 	PMAP_LOCK(pmap);
 retry:
 	pvo = moea64_pvo_find_va(pmap, va & ~ADDR_POFF);
@@ -1367,6 +1379,7 @@ retry:
 		vm_page_hold(m);
 	}
 	PA_UNLOCK_COND(pa);
+	UNLOCK_TABLE_RD();
 	PMAP_UNLOCK(pmap);
 	return (m);
 }
@@ -1390,9 +1403,6 @@ moea64_uma_page_alloc(uma_zone_t zone, i
 	*flags = UMA_SLAB_PRIV;
 	needed_lock = !PMAP_LOCKED(kernel_pmap);
 
-	if (needed_lock)
-		PMAP_LOCK(kernel_pmap);
-
         if ((wait & (M_NOWAIT|M_USE_RESERVE)) == M_NOWAIT)
                 pflags = VM_ALLOC_INTERRUPT | VM_ALLOC_WIRED;
         else
@@ -1412,12 +1422,17 @@ moea64_uma_page_alloc(uma_zone_t zone, i
 
 	va = VM_PAGE_TO_PHYS(m);
 
+	LOCK_TABLE_WR();
+	if (needed_lock)
+		PMAP_LOCK(kernel_pmap);
+
 	moea64_pvo_enter(installed_mmu, kernel_pmap, moea64_upvo_zone,
 	    &moea64_pvo_kunmanaged, va, VM_PAGE_TO_PHYS(m), LPTE_M,
 	    PVO_WIRED | PVO_BOOTSTRAP);
 
 	if (needed_lock)
 		PMAP_UNLOCK(kernel_pmap);
+	UNLOCK_TABLE_WR();
 	
 	if ((wait & M_ZERO) && (m->flags & PG_ZERO) == 0)
                 bzero((void *)va, PAGE_SIZE);
@@ -1487,10 +1502,12 @@ moea64_is_prefaultable(mmu_t mmu, pmap_t
 	struct pvo_entry *pvo;
 	boolean_t rv;
 
+	LOCK_TABLE_RD();
 	PMAP_LOCK(pmap);
 	pvo = moea64_pvo_find_va(pmap, va & ~ADDR_POFF);
 	rv = pvo == NULL || (pvo->pvo_pte.lpte.pte_hi & LPTE_VALID) == 0;
 	PMAP_UNLOCK(pmap);
+	UNLOCK_TABLE_RD();
 	return (rv);
 }
 
@@ -1546,12 +1563,11 @@ moea64_remove_write(mmu_t mmu, vm_page_t
 	if ((m->oflags & VPO_BUSY) == 0 &&
 	    (m->aflags & PGA_WRITEABLE) == 0)
 		return;
-	vm_page_lock_queues();
 	powerpc_sync();
+	LOCK_TABLE_RD();
 	LIST_FOREACH(pvo, vm_page_to_pvoh(m), pvo_vlink) {
 		pmap = pvo->pvo_pmap;
 		PMAP_LOCK(pmap);
-		LOCK_TABLE();
 		if ((pvo->pvo_pte.lpte.pte_lo & LPTE_PP) != LPTE_BR) {
 			pt = MOEA64_PVO_TO_PTE(mmu, pvo);
 			pvo->pvo_pte.lpte.pte_lo &= ~LPTE_PP;
@@ -1566,13 +1582,12 @@ moea64_remove_write(mmu_t mmu, vm_page_t
 					isync();
 			}
 		}
-		UNLOCK_TABLE();
 		PMAP_UNLOCK(pmap);
 	}
+	UNLOCK_TABLE_RD();
 	if ((lo & LPTE_CHG) != 0) 
 		vm_page_dirty(m);
 	vm_page_aflag_clear(m, PGA_WRITEABLE);
-	vm_page_unlock_queues();
 }
 
 /*
@@ -1613,13 +1628,12 @@ moea64_page_set_memattr(mmu_t mmu, vm_pa
 		return;
 	}
 
-	vm_page_lock_queues();
 	pvo_head = vm_page_to_pvoh(m);
 	lo = moea64_calc_wimg(VM_PAGE_TO_PHYS(m), ma);
+	LOCK_TABLE_RD();
 	LIST_FOREACH(pvo, pvo_head, pvo_vlink) {
 		pmap = pvo->pvo_pmap;
 		PMAP_LOCK(pmap);
-		LOCK_TABLE();
 		pt = MOEA64_PVO_TO_PTE(mmu, pvo);
 		pvo->pvo_pte.lpte.pte_lo &= ~LPTE_WIMG;
 		pvo->pvo_pte.lpte.pte_lo |= lo;
@@ -1629,11 +1643,10 @@ moea64_page_set_memattr(mmu_t mmu, vm_pa
 			if (pvo->pvo_pmap == kernel_pmap)
 				isync();
 		}
-		UNLOCK_TABLE();
 		PMAP_UNLOCK(pmap);
 	}
+	UNLOCK_TABLE_RD();
 	m->md.mdpg_cache_attrs = ma;
-	vm_page_unlock_queues();
 }
 
 /*
@@ -1647,9 +1660,12 @@ moea64_kenter_attr(mmu_t mmu, vm_offset_
 
 	pte_lo = moea64_calc_wimg(pa, ma);
 
+	LOCK_TABLE_WR();
 	PMAP_LOCK(kernel_pmap);
 	error = moea64_pvo_enter(mmu, kernel_pmap, moea64_upvo_zone,
 	    &moea64_pvo_kunmanaged, va, pa, pte_lo, PVO_WIRED);
+	PMAP_UNLOCK(kernel_pmap);
+	UNLOCK_TABLE_WR();
 
 	if (error != 0 && error != ENOENT)
 		panic("moea64_kenter: failed to enter va %#zx pa %#zx: %d", va,
@@ -1660,7 +1676,6 @@ moea64_kenter_attr(mmu_t mmu, vm_offset_
 	 */
 	if ((pte_lo & (LPTE_I | LPTE_G)) == 0)
 		__syncicache((void *)va, PAGE_SIZE);
-	PMAP_UNLOCK(kernel_pmap);
 }
 
 void
@@ -1687,11 +1702,13 @@ moea64_kextract(mmu_t mmu, vm_offset_t v
 	if (va < VM_MIN_KERNEL_ADDRESS)
 		return (va);
 
+	LOCK_TABLE_RD();
 	PMAP_LOCK(kernel_pmap);
 	pvo = moea64_pvo_find_va(kernel_pmap, va);
 	KASSERT(pvo != NULL, ("moea64_kextract: no addr found for %#" PRIxPTR,
 	    va));
 	pa = (pvo->pvo_pte.lpte.pte_lo & LPTE_RPGN) | (va - PVO_VADDR(pvo));
+	UNLOCK_TABLE_RD();
 	PMAP_UNLOCK(kernel_pmap);
 	return (pa);
 }
@@ -1747,7 +1764,7 @@ moea64_page_exists_quick(mmu_t mmu, pmap
 	    ("moea64_page_exists_quick: page %p is not managed", m));
 	loops = 0;
 	rv = FALSE;
-	vm_page_lock_queues();
+	LOCK_TABLE_RD();
 	LIST_FOREACH(pvo, vm_page_to_pvoh(m), pvo_vlink) {
 		if (pvo->pvo_pmap == pmap) {
 			rv = TRUE;
@@ -1756,7 +1773,7 @@ moea64_page_exists_quick(mmu_t mmu, pmap
 		if (++loops >= 16)
 			break;
 	}
-	vm_page_unlock_queues();
+	UNLOCK_TABLE_RD();
 	return (rv);
 }
 
@@ -1773,11 +1790,11 @@ moea64_page_wired_mappings(mmu_t mmu, vm
 	count = 0;
 	if ((m->oflags & VPO_UNMANAGED) != 0)
 		return (count);
-	vm_page_lock_queues();
+	LOCK_TABLE_RD();
 	LIST_FOREACH(pvo, vm_page_to_pvoh(m), pvo_vlink)
 		if ((pvo->pvo_vaddr & PVO_WIRED) != 0)
 			count++;
-	vm_page_unlock_queues();
+	UNLOCK_TABLE_RD();
 	return (count);
 }
 
@@ -1891,11 +1908,12 @@ moea64_pvo_protect(mmu_t mmu,  pmap_t pm
 	uintptr_t pt;
 	uint64_t oldlo;
 
+	PMAP_LOCK_ASSERT(pm, MA_OWNED);
+
 	/*
 	 * Grab the PTE pointer before we diddle with the cached PTE
 	 * copy.
 	 */
-	LOCK_TABLE();
 	pt = MOEA64_PVO_TO_PTE(mmu, pvo);
 
 	/*
@@ -1941,7 +1959,6 @@ moea64_pvo_protect(mmu_t mmu,  pmap_t pm
 				vm_page_aflag_set(pg, PGA_REFERENCED);
 		}
 	}
-	UNLOCK_TABLE();
 }
 
 void
@@ -1961,6 +1978,7 @@ moea64_protect(mmu_t mmu, pmap_t pm, vm_
 		return;
 	}
 
+	LOCK_TABLE_RD();
 	PMAP_LOCK(pm);
 	if ((eva - sva)/PAGE_SIZE < pm->pm_stats.resident_count) {
 		for (; sva < eva; sva += PAGE_SIZE) {
@@ -1975,6 +1993,7 @@ moea64_protect(mmu_t mmu, pmap_t pm, vm_
 			moea64_pvo_protect(mmu, pm, pvo, prot);
 		}
 	}
+	UNLOCK_TABLE_RD();
 	PMAP_UNLOCK(pm);
 }
 
@@ -2049,13 +2068,13 @@ moea64_remove_pages(mmu_t mmu, pmap_t pm
 {
 	struct	pvo_entry *pvo, *tpvo;
 
-	vm_page_lock_queues();
+	LOCK_TABLE_WR();
 	PMAP_LOCK(pm);
 	LIST_FOREACH_SAFE(pvo, &pm->pmap_pvo, pvo_plink, tpvo) {
 		if (!(pvo->pvo_vaddr & PVO_WIRED))
 			moea64_pvo_remove(mmu, pvo);
 	}
-	vm_page_unlock_queues();
+	UNLOCK_TABLE_WR();
 	PMAP_UNLOCK(pm);
 }
 
@@ -2073,7 +2092,7 @@ moea64_remove(mmu_t mmu, pmap_t pm, vm_o
 	if (pm->pm_stats.resident_count == 0)
 		return;
 
-	vm_page_lock_queues();
+	LOCK_TABLE_WR();
 	PMAP_LOCK(pm);
 	if ((eva - sva)/PAGE_SIZE < pm->pm_stats.resident_count) {
 		for (; sva < eva; sva += PAGE_SIZE) {
@@ -2088,7 +2107,7 @@ moea64_remove(mmu_t mmu, pmap_t pm, vm_o
 			moea64_pvo_remove(mmu, pvo);
 		}
 	}
-	vm_page_unlock_queues();
+	UNLOCK_TABLE_WR();
 	PMAP_UNLOCK(pm);
 }
 
@@ -2103,8 +2122,8 @@ moea64_remove_all(mmu_t mmu, vm_page_t m
 	struct	pvo_entry *pvo, *next_pvo;
 	pmap_t	pmap;
 
-	vm_page_lock_queues();
 	pvo_head = vm_page_to_pvoh(m);
+	LOCK_TABLE_WR();
 	for (pvo = LIST_FIRST(pvo_head); pvo != NULL; pvo = next_pvo) {
 		next_pvo = LIST_NEXT(pvo, pvo_vlink);
 
@@ -2113,10 +2132,10 @@ moea64_remove_all(mmu_t mmu, vm_page_t m
 		moea64_pvo_remove(mmu, pvo);
 		PMAP_UNLOCK(pmap);
 	}
+	UNLOCK_TABLE_WR();
 	if ((m->aflags & PGA_WRITEABLE) && moea64_is_modified(mmu, m))
 		vm_page_dirty(m);
 	vm_page_aflag_clear(m, PGA_WRITEABLE);
-	vm_page_unlock_queues();
 }
 
 /*
@@ -2192,6 +2211,9 @@ moea64_pvo_enter(mmu_t mmu, pmap_t pm, u
 	if (!moea64_initialized)
 		bootstrap = 1;
 
+	PMAP_LOCK_ASSERT(pm, MA_OWNED);
+	rw_assert(&moea64_table_lock, RA_WLOCKED);
+
 	/*
 	 * Compute the PTE Group index.
 	 */
@@ -2203,8 +2225,6 @@ moea64_pvo_enter(mmu_t mmu, pmap_t pm, u
 	 * Remove any existing mapping for this page.  Reuse the pvo entry if
 	 * there is a mapping.
 	 */
-	LOCK_TABLE();
-
 	moea64_pvo_enter_calls++;
 
 	LIST_FOREACH(pvo, &moea64_pvo_table[ptegidx], pvo_olink) {
@@ -2220,7 +2240,6 @@ moea64_pvo_enter(mmu_t mmu, pmap_t pm, u
 						PVO_PTEGIDX_SET(pvo, i);
 					moea64_pte_overflow--;
 				}
-				UNLOCK_TABLE();
 				return (0);
 			}
 			moea64_pvo_remove(mmu, pvo);
@@ -2247,15 +2266,11 @@ moea64_pvo_enter(mmu_t mmu, pmap_t pm, u
 		 * table. The mapping we are working with is already
 		 * protected by the PMAP lock.
 		 */
-		UNLOCK_TABLE();
 		pvo = uma_zalloc(zone, M_NOWAIT);
-		LOCK_TABLE();
 	}
 
-	if (pvo == NULL) {
-		UNLOCK_TABLE();
+	if (pvo == NULL)
 		return (ENOMEM);
-	}
 
 	moea64_pvo_entries++;
 	pvo->pvo_vaddr = va;
@@ -2310,8 +2325,6 @@ moea64_pvo_enter(mmu_t mmu, pmap_t pm, u
 	if (pm == kernel_pmap)
 		isync();
 
-	UNLOCK_TABLE();
-
 #ifdef __powerpc64__
 	/*
 	 * Make sure all our bootstrap mappings are in the SLB as soon
@@ -2329,11 +2342,13 @@ moea64_pvo_remove(mmu_t mmu, struct pvo_
 {
 	uintptr_t pt;
 
+	PMAP_LOCK_ASSERT(pvo->pvo_pmap, MA_OWNED);
+	rw_assert(&moea64_table_lock, RA_WLOCKED);
+
 	/*
 	 * If there is an active pte entry, we need to deactivate it (and
 	 * save the ref & cfg bits).
 	 */
-	LOCK_TABLE();
 	pt = MOEA64_PVO_TO_PTE(mmu, pvo);
 	if (pt != -1) {
 		MOEA64_PTE_UNSET(mmu, pt, &pvo->pvo_pte.lpte, pvo->pvo_vpn);
@@ -2350,6 +2365,18 @@ moea64_pvo_remove(mmu_t mmu, struct pvo_
 		pvo->pvo_pmap->pm_stats.wired_count--;
 
 	/*
+	 * Remove this PVO from the PV and pmap lists.
+	 */
+	LIST_REMOVE(pvo, pvo_vlink);
+	LIST_REMOVE(pvo, pvo_plink);
+
+	/*
+	 * Remove this from the overflow list and return it to the pool
+	 * if we aren't going to reuse it.
+	 */
+	LIST_REMOVE(pvo, pvo_olink);
+
+	/*
 	 * Update vm about the REF/CHG bits if the page is managed.
 	 */
 	if ((pvo->pvo_vaddr & PVO_MANAGED) == PVO_MANAGED &&
@@ -2362,26 +2389,14 @@ moea64_pvo_remove(mmu_t mmu, struct pvo_
 				vm_page_dirty(pg);
 			if (pvo->pvo_pte.lpte.pte_lo & LPTE_REF)
 				vm_page_aflag_set(pg, PGA_REFERENCED);
+			if (LIST_EMPTY(vm_page_to_pvoh(pg)))
+				vm_page_aflag_clear(pg, PGA_WRITEABLE);
 		}
 	}
 
-	/*
-	 * Remove this PVO from the PV and pmap lists.
-	 */
-	LIST_REMOVE(pvo, pvo_vlink);
-	LIST_REMOVE(pvo, pvo_plink);
-
-	/*
-	 * Remove this from the overflow list and return it to the pool
-	 * if we aren't going to reuse it.
-	 */
-	LIST_REMOVE(pvo, pvo_olink);
-
 	moea64_pvo_entries--;
 	moea64_pvo_remove_calls++;
 
-	UNLOCK_TABLE();
-
 	if (!(pvo->pvo_vaddr & PVO_BOOTSTRAP))
 		uma_zfree((pvo->pvo_vaddr & PVO_MANAGED) ? moea64_mpvo_zone :
 		    moea64_upvo_zone, pvo);
@@ -2419,12 +2434,10 @@ moea64_pvo_find_va(pmap_t pm, vm_offset_
 	ptegidx = va_to_pteg(vsid, va, 0);
 	#endif
 
-	LOCK_TABLE();
 	LIST_FOREACH(pvo, &moea64_pvo_table[ptegidx], pvo_olink) {
 		if (pvo->pvo_pmap == pm && PVO_VADDR(pvo) == va)
 			break;
 	}
-	UNLOCK_TABLE();
 
 	return (pvo);
 }
@@ -2435,14 +2448,13 @@ moea64_query_bit(mmu_t mmu, vm_page_t m,
 	struct	pvo_entry *pvo;
 	uintptr_t pt;
 
-	vm_page_lock_queues();
-
+	LOCK_TABLE_RD();
 	LIST_FOREACH(pvo, vm_page_to_pvoh(m), pvo_vlink) {
 		/*
 		 * See if we saved the bit off.  If so, return success.
 		 */
 		if (pvo->pvo_pte.lpte.pte_lo & ptebit) {
-			vm_page_unlock_queues();
+			UNLOCK_TABLE_RD();
 			return (TRUE);
 		}
 	}
@@ -2460,20 +2472,20 @@ moea64_query_bit(mmu_t mmu, vm_page_t m,
 		 * REF/CHG bits from the valid PTE.  If the appropriate
 		 * ptebit is set, return success.
 		 */
-		LOCK_TABLE();
+		PMAP_LOCK(pvo->pvo_pmap);
 		pt = MOEA64_PVO_TO_PTE(mmu, pvo);
 		if (pt != -1) {
 			MOEA64_PTE_SYNCH(mmu, pt, &pvo->pvo_pte.lpte);
 			if (pvo->pvo_pte.lpte.pte_lo & ptebit) {
-				UNLOCK_TABLE();
-				vm_page_unlock_queues();
+				PMAP_UNLOCK(pvo->pvo_pmap);
+				UNLOCK_TABLE_RD();
 				return (TRUE);
 			}
 		}
-		UNLOCK_TABLE();
+		PMAP_UNLOCK(pvo->pvo_pmap);
 	}
 
-	vm_page_unlock_queues();
+	UNLOCK_TABLE_RD();
 	return (FALSE);
 }
 
@@ -2484,8 +2496,6 @@ moea64_clear_bit(mmu_t mmu, vm_page_t m,
 	struct	pvo_entry *pvo;
 	uintptr_t pt;
 
-	vm_page_lock_queues();
-
 	/*
 	 * Sync so that any pending REF/CHG bits are flushed to the PTEs (so
 	 * we can reset the right ones).  note that since the pvo entries and
@@ -2500,9 +2510,9 @@ moea64_clear_bit(mmu_t mmu, vm_page_t m,
 	 * valid pte clear the ptebit from the valid pte.
 	 */
 	count = 0;
+	LOCK_TABLE_RD();
 	LIST_FOREACH(pvo, vm_page_to_pvoh(m), pvo_vlink) {
-
-		LOCK_TABLE();
+		PMAP_LOCK(pvo->pvo_pmap);
 		pt = MOEA64_PVO_TO_PTE(mmu, pvo);
 		if (pt != -1) {
 			MOEA64_PTE_SYNCH(mmu, pt, &pvo->pvo_pte.lpte);
@@ -2513,10 +2523,10 @@ moea64_clear_bit(mmu_t mmu, vm_page_t m,
 			}
 		}
 		pvo->pvo_pte.lpte.pte_lo &= ~ptebit;
-		UNLOCK_TABLE();
+		PMAP_UNLOCK(pvo->pvo_pmap);
 	}
 
-	vm_page_unlock_queues();
+	UNLOCK_TABLE_RD();
 	return (count);
 }
 
@@ -2527,6 +2537,7 @@ moea64_dev_direct_mapped(mmu_t mmu, vm_o
 	vm_offset_t ppa;
 	int error = 0;
 
+	LOCK_TABLE_RD();
 	PMAP_LOCK(kernel_pmap);
 	for (ppa = pa & ~ADDR_POFF; ppa < pa + size; ppa += PAGE_SIZE) {
 		pvo = moea64_pvo_find_va(kernel_pmap, ppa);
@@ -2536,6 +2547,7 @@ moea64_dev_direct_mapped(mmu_t mmu, vm_o
 			break;
 		}
 	}
+	UNLOCK_TABLE_RD();
 	PMAP_UNLOCK(kernel_pmap);
 
 	return (error);
@@ -2598,6 +2610,7 @@ moea64_sync_icache(mmu_t mmu, pmap_t pm,
 	vm_paddr_t pa;
 	vm_size_t len;
 
+	LOCK_TABLE_RD();
 	PMAP_LOCK(pm);
 	while (sz > 0) {
 		lim = round_page(va);
@@ -2611,5 +2624,6 @@ moea64_sync_icache(mmu_t mmu, pmap_t pm,
 		va += len;
 		sz -= len;
 	}
+	UNLOCK_TABLE_RD();
 	PMAP_UNLOCK(pm);
 }

From owner-svn-src-head@FreeBSD.ORG  Tue Mar 27 01:26:01 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 083A4106566C;
	Tue, 27 Mar 2012 01:26:01 +0000 (UTC)
	(envelope-from nwhitehorn@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id E81B68FC17;
	Tue, 27 Mar 2012 01:26:00 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2R1Q0av058527;
	Tue, 27 Mar 2012 01:26:00 GMT
	(envelope-from nwhitehorn@svn.freebsd.org)
Received: (from nwhitehorn@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2R1Q0DW058525;
	Tue, 27 Mar 2012 01:26:00 GMT
	(envelope-from nwhitehorn@svn.freebsd.org)
Message-Id: <201203270126.q2R1Q0DW058525@svn.freebsd.org>
From: Nathan Whitehorn 
Date: Tue, 27 Mar 2012 01:26:00 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233530 - head/sys/powerpc/aim
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 27 Mar 2012 01:26:01 -0000

Author: nwhitehorn
Date: Tue Mar 27 01:26:00 2012
New Revision: 233530
URL: http://svn.freebsd.org/changeset/base/233530

Log:
  Make sure to call vm_page_dirty() before the pmap lock is released to
  prevent a race where another process could conclude the page was clean.
  
  Submitted by:	alc

Modified:
  head/sys/powerpc/aim/mmu_oea64.c

Modified: head/sys/powerpc/aim/mmu_oea64.c
==============================================================================
--- head/sys/powerpc/aim/mmu_oea64.c	Tue Mar 27 01:24:18 2012	(r233529)
+++ head/sys/powerpc/aim/mmu_oea64.c	Tue Mar 27 01:26:00 2012	(r233530)
@@ -1582,11 +1582,11 @@ moea64_remove_write(mmu_t mmu, vm_page_t
 					isync();
 			}
 		}
+		if ((lo & LPTE_CHG) != 0) 
+			vm_page_dirty(m);
 		PMAP_UNLOCK(pmap);
 	}
 	UNLOCK_TABLE_RD();
-	if ((lo & LPTE_CHG) != 0) 
-		vm_page_dirty(m);
 	vm_page_aflag_clear(m, PGA_WRITEABLE);
 }
 

From owner-svn-src-head@FreeBSD.ORG  Tue Mar 27 04:15:39 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id A79B81065672;
	Tue, 27 Mar 2012 04:15:39 +0000 (UTC)
	(envelope-from adrian@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 929978FC0A;
	Tue, 27 Mar 2012 04:15:39 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2R4FdoE068558;
	Tue, 27 Mar 2012 04:15:39 GMT (envelope-from adrian@svn.freebsd.org)
Received: (from adrian@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2R4FdL1068556;
	Tue, 27 Mar 2012 04:15:39 GMT (envelope-from adrian@svn.freebsd.org)
Message-Id: <201203270415.q2R4FdL1068556@svn.freebsd.org>
From: Adrian Chadd 
Date: Tue, 27 Mar 2012 04:15:39 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233531 - head/sys/net80211
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 27 Mar 2012 04:15:39 -0000

Author: adrian
Date: Tue Mar 27 04:15:38 2012
New Revision: 233531
URL: http://svn.freebsd.org/changeset/base/233531

Log:
  Correct the ordering of tid/crypto ic_name.
  
  Because the code lacks all the GNU extensions to printf() format stuff,
  the compiler doesn't helpfully tell us that I messed up in a previous
  commit.
  
  Pointy hat to: adrian, who likely only cares about this because he's the
    only one who bothers flipping on net80211 debugging.

Modified:
  head/sys/net80211/ieee80211_freebsd.c

Modified: head/sys/net80211/ieee80211_freebsd.c
==============================================================================
--- head/sys/net80211/ieee80211_freebsd.c	Tue Mar 27 01:26:00 2012	(r233530)
+++ head/sys/net80211/ieee80211_freebsd.c	Tue Mar 27 04:15:38 2012	(r233531)
@@ -572,7 +572,7 @@ ieee80211_notify_replay_failure(struct i
 
 	IEEE80211_NOTE_MAC(vap, IEEE80211_MSG_CRYPTO, wh->i_addr2,
 	    "%s replay detected tid %d ",
-	    tid, k->wk_cipher->ic_name, (intmax_t) rsc,
+	    k->wk_cipher->ic_name, tid, (intmax_t) rsc,
 	    (intmax_t) k->wk_keyrsc[tid],
 	    k->wk_keyix, k->wk_rxkeyix);
 

From owner-svn-src-head@FreeBSD.ORG  Tue Mar 27 07:34:28 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id E66AF106564A;
	Tue, 27 Mar 2012 07:34:27 +0000 (UTC)
	(envelope-from jchandra@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id B6C4A8FC16;
	Tue, 27 Mar 2012 07:34:27 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2R7YRst074973;
	Tue, 27 Mar 2012 07:34:27 GMT
	(envelope-from jchandra@svn.freebsd.org)
Received: (from jchandra@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2R7YRoX074971;
	Tue, 27 Mar 2012 07:34:27 GMT
	(envelope-from jchandra@svn.freebsd.org)
Message-Id: <201203270734.q2R7YRoX074971@svn.freebsd.org>
From: "Jayachandran C." 
Date: Tue, 27 Mar 2012 07:34:27 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233532 - head/sys/mips/nlm
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 27 Mar 2012 07:34:28 -0000

Author: jchandra
Date: Tue Mar 27 07:34:27 2012
New Revision: 233532
URL: http://svn.freebsd.org/changeset/base/233532

Log:
  Fixes to the XLP startup code.
  
  Changes are:
  - Correct the order of calling init functions.
  - Fix up checking excluding reset area.

Modified:
  head/sys/mips/nlm/xlp_machdep.c

Modified: head/sys/mips/nlm/xlp_machdep.c
==============================================================================
--- head/sys/mips/nlm/xlp_machdep.c	Tue Mar 27 04:15:38 2012	(r233531)
+++ head/sys/mips/nlm/xlp_machdep.c	Tue Mar 27 07:34:27 2012	(r233532)
@@ -358,14 +358,14 @@ mips_init(void)
 	mips_cpu_init();
 	cpuinfo.cache_coherent_dma = TRUE;
 	pmap_bootstrap();
+	mips_proc0_init();
+	mutex_init();
 #ifdef DDB
 	kdb_init();
 	if (boothowto & RB_KDB) {
 		kdb_enter("Boot flags requested debugger", NULL);
 	}
 #endif
-	mips_proc0_init();
-	mutex_init();
 }
 
 unsigned int
@@ -433,8 +433,12 @@ xlp_mem_init(void)
 
 		/* first bar, start a bit after end */
 		if (base == 0) {
-			base = (vm_paddr_t)MIPS_KSEG0_TO_PHYS(&_end) + 0x20000;
-			lim  = 0x0c000000;  /* TODO : hack to avoid uboot packet mem */
+			base = (vm_paddr_t)MIPS_KSEG0_TO_PHYS(&_end);
+			base = round_page(base) + 0x20000; /* round up */
+			/* TODO : hack to avoid uboot packet mem, network
+			 * interface will write here if not reset correctly
+			 * by u-boot */
+			lim  = 0x0c000000;
 		}
 		if (base >= XLP_MEM_LIM) {
 			printf("Mem [%d]: Ignore %#jx - %#jx\n", i,
@@ -456,7 +460,7 @@ xlp_mem_init(void)
 		 * Exclude reset entry memory range 0x1fc00000 - 0x20000000
 		 * from free memory
 		 */
-		if (base <= 0x1fc00000 && (base + lim) > 0x1fc00000) {
+		if (base < 0x20000000 && lim > 0x1fc00000) {
 			uint64_t base0, lim0, base1, lim1;
 
 			base0 = base;
@@ -542,6 +546,9 @@ platform_start(__register_t a0 __unused,
 	/* setup for the startup core */
 	xlp_setup_mmu();
 
+	/* Read/Guess/setup board information */
+	nlm_board_info_setup();
+
 	/* MIPS generic init */
 	mips_init();
 
@@ -549,7 +556,6 @@ platform_start(__register_t a0 __unused,
 	 * XLP specific post initialization
  	 * initialize other on chip stuff
 	 */
-	nlm_board_info_setup();
 	xlp_pic_init();
 
 	mips_timer_init_params(xlp_cpu_frequency, 0);

From owner-svn-src-head@FreeBSD.ORG  Tue Mar 27 07:39:06 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 12AC2106564A;
	Tue, 27 Mar 2012 07:39:06 +0000 (UTC)
	(envelope-from jchandra@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id F0B008FC16;
	Tue, 27 Mar 2012 07:39:05 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2R7d54l075159;
	Tue, 27 Mar 2012 07:39:05 GMT
	(envelope-from jchandra@svn.freebsd.org)
Received: (from jchandra@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2R7d5e2075154;
	Tue, 27 Mar 2012 07:39:05 GMT
	(envelope-from jchandra@svn.freebsd.org)
Message-Id: <201203270739.q2R7d5e2075154@svn.freebsd.org>
From: "Jayachandran C." 
Date: Tue, 27 Mar 2012 07:39:05 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233533 - in head/sys/mips/nlm: . hal
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 27 Mar 2012 07:39:06 -0000

Author: jchandra
Date: Tue Mar 27 07:39:05 2012
New Revision: 233533
URL: http://svn.freebsd.org/changeset/base/233533

Log:
  Support for XLP4xx and XLP 8xx B0 revision
  
  - Add 4xx processor IDs, add workaround in CPU detection code.
  - Update frequency detection code for XLP 8xx.
  - Add setting device frequency code.
  - Update processor ID checking code.

Modified:
  head/sys/mips/nlm/hal/nlm_hal.c
  head/sys/mips/nlm/hal/sys.h
  head/sys/mips/nlm/xlp.h
  head/sys/mips/nlm/xlp_machdep.c

Modified: head/sys/mips/nlm/hal/nlm_hal.c
==============================================================================
--- head/sys/mips/nlm/hal/nlm_hal.c	Tue Mar 27 07:34:27 2012	(r233532)
+++ head/sys/mips/nlm/hal/nlm_hal.c	Tue Mar 27 07:39:05 2012	(r233533)
@@ -55,33 +55,81 @@ int pic_irt_pcie_lnk2;
 int pic_irt_pcie_lnk3;
 
 uint32_t
-xlp_get_cpu_frequency(int core)
+xlp_get_cpu_frequency(int node, int core)
 {
-	uint64_t sysbase = nlm_get_sys_regbase(nlm_nodeid());
-	uint64_t num;
+	uint64_t sysbase = nlm_get_sys_regbase(node);
 	unsigned int pll_divf, pll_divr, dfs_div, ext_div;
-	unsigned int rstval, dfsval, denom;
+	unsigned int rstval, dfsval;
 
 	rstval = nlm_read_sys_reg(sysbase, SYS_POWER_ON_RESET_CFG);
 	dfsval = nlm_read_sys_reg(sysbase, SYS_CORE_DFS_DIV_VALUE);
 	pll_divf = ((rstval >> 10) & 0x7f) + 1;
 	pll_divr = ((rstval >> 8)  & 0x3) + 1;
-	ext_div  = ((rstval >> 30) & 0x3) + 1;
-	dfs_div  = ((dfsval >> (core * 4)) & 0xf) + 1;
+	if (!nlm_is_xlp8xx_ax())
+		ext_div  = ((rstval >> 30) & 0x3) + 1;
+	else
+		ext_div  = 1;
+	dfs_div  = ((dfsval >> (core << 2)) & 0xf) + 1;
 
-	num = 800000000ULL * pll_divf;
-	denom = 3 * pll_divr * ext_div * dfs_div;
-	num = num/denom;
-	return (num);
+	return ((800000000ULL * pll_divf)/(3 * pll_divr * ext_div * dfs_div));
+}
+
+static u_int
+nlm_get_device_frequency(uint64_t sysbase, int devtype)
+{
+	uint32_t pllctrl, dfsdiv, spf, spr, div_val;
+	int extra_div;
+
+	pllctrl = nlm_read_sys_reg(sysbase, SYS_PLL_CTRL);
+	if (devtype <= 7)
+		div_val = nlm_read_sys_reg(sysbase, SYS_DFS_DIV_VALUE0);
+	else {
+		devtype -= 8;
+		div_val = nlm_read_sys_reg(sysbase, SYS_DFS_DIV_VALUE1);
+	}
+	dfsdiv = ((div_val >> (devtype << 2)) & 0xf) + 1;
+	spf = (pllctrl >> 3 & 0x7f) + 1;
+	spr = (pllctrl >> 1 & 0x03) + 1;
+	extra_div = nlm_is_xlp8xx_ax() ? 1 : 2;
+
+	return ((400 * spf) / (3 * extra_div * spr * dfsdiv));
+}
+
+int
+nlm_set_device_frequency(int node, int devtype, int frequency)
+{
+	uint64_t sysbase;
+	u_int cur_freq;
+	int dec_div;
+
+	sysbase = nlm_get_sys_regbase(node);
+	cur_freq = nlm_get_device_frequency(sysbase, devtype);
+	if (cur_freq < (frequency - 5))
+		dec_div = 1;
+	else
+		dec_div = 0;
+
+	for(;;) {
+		if ((cur_freq >= (frequency - 5)) && (cur_freq <= frequency))
+			break;
+		if (dec_div)
+			nlm_write_sys_reg(sysbase, SYS_DFS_DIV_DEC_CTRL,
+			    (1 << devtype));
+		else
+			nlm_write_sys_reg(sysbase, SYS_DFS_DIV_INC_CTRL,
+			    (1 << devtype));
+		cur_freq = nlm_get_device_frequency(sysbase, devtype);
+	}
+	return (nlm_get_device_frequency(sysbase, devtype));
 }
 
 void
-nlm_pic_irt_init(void)
+nlm_pic_irt_init(int node)
 {
-	pic_irt_ehci0 = nlm_irtstart(nlm_get_usb_pcibase(nlm_nodeid(), 0));
-	pic_irt_ehci1 = nlm_irtstart(nlm_get_usb_pcibase(nlm_nodeid(), 3));
-	pic_irt_uart0 = nlm_irtstart(nlm_get_uart_pcibase(nlm_nodeid(), 0));
-	pic_irt_uart1 = nlm_irtstart(nlm_get_uart_pcibase(nlm_nodeid(), 1));
+	pic_irt_ehci0 = nlm_irtstart(nlm_get_usb_pcibase(node, 0));
+	pic_irt_ehci1 = nlm_irtstart(nlm_get_usb_pcibase(node, 3));
+	pic_irt_uart0 = nlm_irtstart(nlm_get_uart_pcibase(node, 0));
+	pic_irt_uart1 = nlm_irtstart(nlm_get_uart_pcibase(node, 1));
 
 	/* Hardcoding the PCIE IRT information as PIC doesn't 
 	   understand any value other than 78,79,80,81 for PCIE0/1/2/3 */
@@ -107,24 +155,25 @@ int
 xlp_irt_to_irq(int irt)
 {
 	if (irt == pic_irt_ehci0)
-	    return PIC_EHCI_0_IRQ;
+		return PIC_EHCI_0_IRQ;
 	else if (irt == pic_irt_ehci1)
-	    return PIC_EHCI_1_IRQ;
+		return PIC_EHCI_1_IRQ;
 	else if (irt == pic_irt_uart0)
-	    return PIC_UART_0_IRQ;
+		return PIC_UART_0_IRQ;
 	else if (irt == pic_irt_uart1)
-	    return PIC_UART_1_IRQ;
+		return PIC_UART_1_IRQ;
 	else if (irt == pic_irt_pcie_lnk0)
-	    return PIC_PCIE_0_IRQ;
+		return PIC_PCIE_0_IRQ;
 	else if (irt == pic_irt_pcie_lnk1)
-	    return PIC_PCIE_1_IRQ;
+		return PIC_PCIE_1_IRQ;
 	else if (irt == pic_irt_pcie_lnk2)
-	    return PIC_PCIE_2_IRQ;
+		return PIC_PCIE_2_IRQ;
 	else if (irt == pic_irt_pcie_lnk3)
-	    return PIC_PCIE_3_IRQ;
+		return PIC_PCIE_3_IRQ;
 	else {
-	    printf("Cannot find irq for IRT %d\n", irt);
-	    return 0;
+		if (bootverbose)
+			printf("Cannot find irq for IRT %d\n", irt);
+		return 0;
 	 }
 }
 
@@ -156,15 +205,15 @@ int
 xlp_irq_is_picintr(int irq)
 {
 	switch (irq) {
-		case PIC_MMC_IRQ : return 1;
- 		case PIC_EHCI_0_IRQ : return 1;
- 		case PIC_EHCI_1_IRQ : return 1;
-		case PIC_UART_0_IRQ : return 1;
-		case PIC_UART_1_IRQ : return 1;
-		case PIC_PCIE_0_IRQ : return 1;
-		case PIC_PCIE_1_IRQ : return 1;
-		case PIC_PCIE_2_IRQ : return 1;
-		case PIC_PCIE_3_IRQ : return 1;
-		default: return 0;
+ 		case PIC_EHCI_0_IRQ :
+ 		case PIC_EHCI_1_IRQ :
+		case PIC_UART_0_IRQ :
+		case PIC_UART_1_IRQ :
+		case PIC_PCIE_0_IRQ :
+		case PIC_PCIE_1_IRQ :
+		case PIC_PCIE_2_IRQ :
+		case PIC_PCIE_3_IRQ :
+			return (1);
+		default: return (0);
 	}
 }

Modified: head/sys/mips/nlm/hal/sys.h
==============================================================================
--- head/sys/mips/nlm/hal/sys.h	Tue Mar 27 07:34:27 2012	(r233532)
+++ head/sys/mips/nlm/hal/sys.h	Tue Mar 27 07:39:05 2012	(r233533)
@@ -30,7 +30,7 @@
  */
 
 #ifndef __NLM_HAL_SYS_H__
-#define __NLM_HAL_SYS_H__
+#define	__NLM_HAL_SYS_H__
 
 /**
 * @file_name sys.h
@@ -121,5 +121,24 @@
 #define	nlm_get_sys_pcibase(node) nlm_pcicfg_base(XLP_IO_SYS_OFFSET(node))
 #define	nlm_get_sys_regbase(node) (nlm_get_sys_pcibase(node) + XLP_IO_PCI_HDRSZ)
 
+enum {
+	/* Don't change order and it must start from zero */
+	DFS_DEVICE_NAE = 0,
+	DFS_DEVICE_SAE,
+	DFS_DEVICE_RSA,
+	DFS_DEVICE_DTRE,
+	DFS_DEVICE_CMP,
+	DFS_DEVICE_KBP,
+	DFS_DEVICE_DMC,
+	DFS_DEVICE_NAND,
+	DFS_DEVICE_MMC,
+	DFS_DEVICE_NOR,
+	DFS_DEVICE_CORE,
+	DFS_DEVICE_REGEX_SLOW,
+	DFS_DEVICE_REGEX_FAST,
+	DFS_DEVICE_SATA,
+	INVALID_DFS_DEVICE = 0xFF
+};
+
 #endif
 #endif

Modified: head/sys/mips/nlm/xlp.h
==============================================================================
--- head/sys/mips/nlm/xlp.h	Tue Mar 27 07:34:27 2012	(r233532)
+++ head/sys/mips/nlm/xlp.h	Tue Mar 27 07:39:05 2012	(r233533)
@@ -34,21 +34,25 @@
 #include 
 #include 
 
-#define PIC_UART_0_IRQ	9
-#define PIC_UART_1_IRQ	10
+#define	PIC_UART_0_IRQ	9
+#define	PIC_UART_1_IRQ	10
+
+#define	PIC_PCIE_0_IRQ	11
+#define	PIC_PCIE_1_IRQ	12
+#define	PIC_PCIE_2_IRQ	13
+#define	PIC_PCIE_3_IRQ	14
+
+#define	PIC_EHCI_0_IRQ	39 
+/* 41 used by IRQ_SMP */
+#define	PIC_EHCI_1_IRQ	42 
+#define	PIC_MMC_IRQ	43
 
-#define PIC_PCIE_0_IRQ	11
-#define PIC_PCIE_1_IRQ	12
-#define PIC_PCIE_2_IRQ	13
-#define PIC_PCIE_3_IRQ	14
-
-#define PIC_EHCI_0_IRQ	39 
-#define PIC_EHCI_1_IRQ	42 
-#define PIC_MMC_IRQ	43
 
 /* XLP 8xx/4xx A0, A1, A2 CPU COP0 PRIDs */
 #define	CHIP_PROCESSOR_ID_XLP_8XX		0x10
 #define	CHIP_PROCESSOR_ID_XLP_3XX		0x11
+#define	CHIP_PROCESSOR_ID_XLP_416		0x94
+#define	CHIP_PROCESSOR_ID_XLP_432		0x14
 
 /* Revision id's */
 #define	XLP_REVISION_A0				0x00
@@ -69,24 +73,51 @@ extern int xlp_hwtid_to_cpuid[];
 #ifdef SMP
 extern void xlp_enable_threads(int code);
 #endif
-uint32_t xlp_get_cpu_frequency(int core);
-void nlm_pic_irt_init(void);
+uint32_t xlp_get_cpu_frequency(int node, int core);
+int nlm_set_device_frequency(int node, int devtype, int frequency);
+void nlm_pic_irt_init(int node);
 int xlp_irt_to_irq(int irt);
 int xlp_irq_to_irt(int irq);
 int xlp_irq_is_picintr(int irq);
 
+static __inline int nlm_processor_id(void)
+{
+	return ((mips_rd_prid() >> 8) & 0xff);
+}
+
 static __inline int nlm_is_xlp3xx(void)
 {
-	int prid = (mips_rd_prid() >> 8) & 0xff;
 
-	return (prid == CHIP_PROCESSOR_ID_XLP_3XX);
+	return (nlm_processor_id() == CHIP_PROCESSOR_ID_XLP_3XX);
+}
+
+static __inline int nlm_is_xlp4xx(void)
+{
+	int prid = nlm_processor_id();
+
+	return (prid == CHIP_PROCESSOR_ID_XLP_432 ||
+	    prid == CHIP_PROCESSOR_ID_XLP_416);
 }
 
 static __inline int nlm_is_xlp8xx(void)
 {
-	int prid = (mips_rd_prid() >> 8) & 0xff;
+	int prid = nlm_processor_id();
 
-	return (prid == CHIP_PROCESSOR_ID_XLP_8XX);
+	return (prid == CHIP_PROCESSOR_ID_XLP_8XX ||
+	    prid == CHIP_PROCESSOR_ID_XLP_432 ||
+	    prid == CHIP_PROCESSOR_ID_XLP_416);
+}
+
+static __inline int nlm_is_xlp8xx_ax(void)
+{
+	uint32_t procid = mips_rd_prid();
+	int prid = (procid >> 8) & 0xff;
+	int rev = procid & 0xff;
+
+	return ((prid == CHIP_PROCESSOR_ID_XLP_8XX ||
+	    prid == CHIP_PROCESSOR_ID_XLP_432 ||
+	    prid == CHIP_PROCESSOR_ID_XLP_416) &&
+	    (rev < XLP_REVISION_B0));
 }
 
 #endif /* LOCORE */

Modified: head/sys/mips/nlm/xlp_machdep.c
==============================================================================
--- head/sys/mips/nlm/xlp_machdep.c	Tue Mar 27 07:34:27 2012	(r233532)
+++ head/sys/mips/nlm/xlp_machdep.c	Tue Mar 27 07:39:05 2012	(r233533)
@@ -196,9 +196,15 @@ xlp_parse_mmu_options(void)
 		goto unsupp;
 	}
 
-	/* Take out cores which do not exist on chip */
+	/* Try to find the enabled cores from SYS block */
 	sysbase = nlm_get_sys_regbase(0);
 	cpu_rst_mask = nlm_read_sys_reg(sysbase, SYS_CPU_RESET) & 0xff;
+
+	/* XLP 416 does not report this correctly, fix */
+	if (nlm_processor_id() == CHIP_PROCESSOR_ID_XLP_416)
+		cpu_rst_mask = 0xe;
+
+	/* Take out cores which do not exist on chip */
 	for (i = 1; i < XLP_MAX_CORES; i++) {
 		if ((cpu_rst_mask & (1 << i)) == 0)
 			cpu_map &= ~(0xfu << (4 * i));
@@ -515,12 +521,12 @@ platform_start(__register_t a0 __unused,
 	/* initialize console so that we have printf */
 	boothowto |= (RB_SERIAL | RB_MULTIPLE);	/* Use multiple consoles */
 
-	nlm_pic_irt_init(); /* complete before interrupts or console init */
+	nlm_pic_irt_init(0); /* complete before interrupts or console init */
 	init_static_kenv(boot1_env, sizeof(boot1_env));
 	xlp_bootargs_init(a0);
 
 	/* clockrate used by delay, so initialize it here */
-	xlp_cpu_frequency = xlp_get_cpu_frequency(0);
+	xlp_cpu_frequency = xlp_get_cpu_frequency(0, 0);
 	cpu_clock = xlp_cpu_frequency / 1000000;
 	mips_timer_early_init(xlp_cpu_frequency);
 

From owner-svn-src-head@FreeBSD.ORG  Tue Mar 27 07:47:13 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id E70A0106566C;
	Tue, 27 Mar 2012 07:47:13 +0000 (UTC)
	(envelope-from jchandra@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id C7F1A8FC16;
	Tue, 27 Mar 2012 07:47:13 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2R7lDg6075455;
	Tue, 27 Mar 2012 07:47:13 GMT
	(envelope-from jchandra@svn.freebsd.org)
Received: (from jchandra@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2R7lDKY075453;
	Tue, 27 Mar 2012 07:47:13 GMT
	(envelope-from jchandra@svn.freebsd.org)
Message-Id: <201203270747.q2R7lDKY075453@svn.freebsd.org>
From: "Jayachandran C." 
Date: Tue, 27 Mar 2012 07:47:13 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233534 - head/sys/mips/nlm
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 27 Mar 2012 07:47:14 -0000

Author: jchandra
Date: Tue Mar 27 07:47:13 2012
New Revision: 233534
URL: http://svn.freebsd.org/changeset/base/233534

Log:
  Switch to interrupt based message handling for XLP 8xx B0.
  
  Fixup some style issues in the file as well.

Modified:
  head/sys/mips/nlm/cms.c

Modified: head/sys/mips/nlm/cms.c
==============================================================================
--- head/sys/mips/nlm/cms.c	Tue Mar 27 07:39:05 2012	(r233533)
+++ head/sys/mips/nlm/cms.c	Tue Mar 27 07:47:13 2012	(r233534)
@@ -65,9 +65,8 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 
-#define MSGRNG_NSTATIONS 1024
+#define	MSGRNG_NSTATIONS	1024
 /*
  * Keep track of our message ring handler threads, each core has a
  * different message station. Ideally we will need to start a few
@@ -92,7 +91,7 @@ struct tx_stn_handler {
 static struct tx_stn_handler msgmap[MSGRNG_NSTATIONS];
 static struct mtx	msgmap_lock;
 uint32_t xlp_msg_thread_mask;
-static int xlp_msg_threads_per_core = 3;
+static int xlp_msg_threads_per_core = XLP_MAX_THREADS;
 
 static void create_msgring_thread(int hwtid);
 static int msgring_process_fast_intr(void *arg);
@@ -105,7 +104,7 @@ static int fmn_msgcount[XLP_MAX_CORES * 
 static int fmn_loops[XLP_MAX_CORES * XLP_MAX_THREADS];
 
 /* Whether polled driver implementation */
-static int polled = 1;
+static int polled = 0;
 
 /* We do only i/o device credit setup here. CPU credit setup is now
  * moved to xlp_msgring_cpu_init() so that the credits get setup 
@@ -125,7 +124,7 @@ xlp_cms_credit_setup(int credit)
 	for (i = 0; i < XLP_MAX_NODES; i++) {
 		cmspcibase = nlm_get_cms_pcibase(i);
 		if (!nlm_dev_exists(XLP_IO_CMS_OFFSET(i)))
-		    continue;
+			continue;
 		cmsbase = nlm_get_cms_regbase(i);
 		maxqid = nlm_read_reg(cmspcibase, XLP_PCI_DEVINFO_REG0);
 		for (dev = 0; dev < 8; dev++) {
@@ -136,7 +135,7 @@ xlp_cms_credit_setup(int credit)
 				pcibase = nlm_pcicfg_base(devoffset);
 				src = nlm_qidstart(pcibase);
 				if (src == 0)
-				    continue;
+					continue;
 #if 0 /* Debug */
 				printf("Setup CMS credits for queues ");
 				printf("[%d to %d] from src %d\n", 0,
@@ -163,7 +162,7 @@ xlp_msgring_cpu_init(int node, int cpu, 
 	if((cpu % 4) == 0) {
 		src = cpu << 2; /* each thread has 4 vc's */
 		for (qid = 0; qid < maxqid; qid++)
-		    nlm_cms_setup_credits(cmsbase, qid, src, credit);
+			nlm_cms_setup_credits(cmsbase, qid, src, credit);
 	}
 }
 
@@ -181,7 +180,6 @@ xlp_handle_msg_vc(u_int vcmask, int max_
 	int n_msgs = 0, vc, m, hwtid;
 	u_int msgmask;
 
-
 	hwtid = nlm_cpuid();
 	for (;;) {
 		/* check if VC empty */
@@ -211,8 +209,9 @@ xlp_handle_msg_vc(u_int vcmask, int max_
 			}
 			he = &msgmap[srcid];
 			if(he->action != NULL)
-				(he->action)(vc, size, code, srcid, &msg, he->arg);
-#if 1 /* defined DEBUG */
+				(he->action)(vc, size, code, srcid, &msg,
+				he->arg);
+#if 0
 			else
 				printf("[%s]: No Handler for msg from stn %d,"
 				    " vc=%d, size=%d, msg0=%jx, droppinge\n",
@@ -226,7 +225,7 @@ xlp_handle_msg_vc(u_int vcmask, int max_
 			break;	/* nothing done in this iter */
 		n_msgs += m;
 		if (max_msgs > 0 && n_msgs >= max_msgs)
-		    break;
+			break;
 	}
 
 	return (n_msgs);
@@ -248,7 +247,7 @@ xlp_discard_msg_vc(u_int vcmask)
 
 			/* break if there is no msg or error */
 			if (status != 0)
-			    break;
+				break;
 		}
 	}
 }
@@ -382,9 +381,6 @@ create_msgring_thread(int hwtid)
 	sched_class(td, PRI_ITHD);
 	sched_add(td, SRQ_INTR);
 	thread_unlock(td);
-	if (bootverbose)
-		printf("Msgring handler create on cpu %d (%s)\n",
-		    hwtid, td->td_name);
 }
 
 int
@@ -393,7 +389,9 @@ register_msgring_handler(int startb, int
 {
 	int	i;
 
-	printf("Register handler %d-%d %p(%p)\n", startb, endb, action, arg);
+	if (bootverbose)
+		printf("Register handler %d-%d %p(%p)\n",
+		    startb, endb, action, arg);
 	KASSERT(startb >= 0 && startb <= endb && endb < MSGRNG_NSTATIONS,
 	    ("Invalid value for bucket range %d,%d", startb, endb));
 
@@ -421,11 +419,18 @@ xlp_msgring_config(void *arg)
 	unsigned int thrmask, mask;
 	int i;
 
+	/* used polled handler for Ax silion */
+	if (nlm_is_xlp8xx_ax())
+		polled = 1;
+
+	/* Don't poll on all threads, if polled */
+	if (polled)
+		xlp_msg_threads_per_core -= 1;
+
 	mtx_init(&msgmap_lock, "msgring", NULL, MTX_SPIN);
 	if (xlp_threads_per_core < xlp_msg_threads_per_core)
 		xlp_msg_threads_per_core = xlp_threads_per_core;
 	thrmask = ((1 << xlp_msg_threads_per_core) - 1);
-	/*thrmask <<= xlp_threads_per_core - xlp_msg_threads_per_core;*/
 	mask = 0;
 	for (i = 0; i < XLP_MAX_CORES; i++) {
 		mask <<= XLP_MAX_THREADS;
@@ -436,11 +441,6 @@ xlp_msgring_config(void *arg)
 	printf("CMS Message handler thread mask %#jx\n",
 	    (uintmax_t)xlp_msg_thread_mask);
 #endif
-
-	if (nlm_is_xlp3xx())
-	    polled = 0;		/* switch to interrupt driven driver */
-
-/*	nlm_cms_default_setup(0,0,0,0); */
 	xlp_cms_credit_setup(CMS_DEFAULT_CREDIT);
 	create_msgring_thread(0);
 	cpu_establish_hardintr("msgring", msgring_process_fast_intr, NULL,

From owner-svn-src-head@FreeBSD.ORG  Tue Mar 27 07:51:43 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 5BF9D106566B;
	Tue, 27 Mar 2012 07:51:43 +0000 (UTC)
	(envelope-from jchandra@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 46DAA8FC16;
	Tue, 27 Mar 2012 07:51:43 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2R7phpA075633;
	Tue, 27 Mar 2012 07:51:43 GMT
	(envelope-from jchandra@svn.freebsd.org)
Received: (from jchandra@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2R7phZs075631;
	Tue, 27 Mar 2012 07:51:43 GMT
	(envelope-from jchandra@svn.freebsd.org)
Message-Id: <201203270751.q2R7phZs075631@svn.freebsd.org>
From: "Jayachandran C." 
Date: Tue, 27 Mar 2012 07:51:43 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233535 - head/sys/mips/nlm
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 27 Mar 2012 07:51:43 -0000

Author: jchandra
Date: Tue Mar 27 07:51:42 2012
New Revision: 233535
URL: http://svn.freebsd.org/changeset/base/233535

Log:
  Update the L1D cache flush sequence when enabling threads.
  
  Added more comments to the code.

Modified:
  head/sys/mips/nlm/mpreset.S

Modified: head/sys/mips/nlm/mpreset.S
==============================================================================
--- head/sys/mips/nlm/mpreset.S	Tue Mar 27 07:47:13 2012	(r233534)
+++ head/sys/mips/nlm/mpreset.S	Tue Mar 27 07:51:42 2012	(r233535)
@@ -55,24 +55,24 @@
 	.set	noreorder
 	li	$8, LSU_DEBUG_DATA0 /* use register number to handle */
 	li	$9, LSU_DEBUG_ADDR  /* different ABIs */
-	li	t2, 0
-	li	t3, 0x200
+	li	t2, 0		/* index */
+	li	t3, 0x1000	/* loop count, 512 sets * 8 whatever? */
 1:
 	sll	v0, t2, 5
 	MTCR(0, 8)
-	ori	v1, v0, 0x3
+	ori	v1, v0, 0x3	/* way0 | write_enable | write_active */
 	MTCR(3, 9)
 2:
 	MFCR(3, 9)
-	andi	v1, 0x1
+	andi	v1, 0x1		/* wait for write_active == 0 */
 	bnez	v1, 2b
 	nop
 	MTCR(0, 8)
-	ori	v1, v0, 0x7
+	ori	v1, v0, 0x7	/* way1 | write_enable | write_active */
 	MTCR(3, 9)
 3:
 	MFCR(3, 9)
-	andi	v1, 0x1
+	andi	v1, 0x1		/* wait for write_active == 0 */
 	bnez	v1, 3b
 	nop
 	addi	t2, 1
@@ -195,7 +195,7 @@ LEAF(xlp_enable_threads)
 	mfc0	t1, MIPS_COP_0_STATUS
 
 	move	sp, t0		/* Restore the real SP */
-	jr	ra
+	jr.hb	ra
 	nop
 END(xlp_enable_threads)
 #endif

From owner-svn-src-head@FreeBSD.ORG  Tue Mar 27 07:57:41 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id ED0471065677;
	Tue, 27 Mar 2012 07:57:41 +0000 (UTC)
	(envelope-from jchandra@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id D74108FC17;
	Tue, 27 Mar 2012 07:57:41 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2R7vf4N075861;
	Tue, 27 Mar 2012 07:57:41 GMT
	(envelope-from jchandra@svn.freebsd.org)
Received: (from jchandra@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2R7vfEG075857;
	Tue, 27 Mar 2012 07:57:41 GMT
	(envelope-from jchandra@svn.freebsd.org)
Message-Id: <201203270757.q2R7vfEG075857@svn.freebsd.org>
From: "Jayachandran C." 
Date: Tue, 27 Mar 2012 07:57:41 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233536 - in head/sys/mips/nlm: . hal
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 27 Mar 2012 07:57:42 -0000

Author: jchandra
Date: Tue Mar 27 07:57:41 2012
New Revision: 233536
URL: http://svn.freebsd.org/changeset/base/233536

Log:
  XLP PCIe code update.
  
  - XLP supports hardware swap for PCIe IO/MEM accesses. Since we
    are in big-endian mode, enable hardware swap and use the normal
    bus space.
  - move some printfs to bootverbose, and remove others.
  - fix SoC device resource allocation code
  - Do not use '|' while updating PCIE_BRIDGE_MSI_ADDRL
  - some style fixes
  
  In collaboration with: Venkatesh J. V. (venkatesh at netlogicmicro com)

Modified:
  head/sys/mips/nlm/hal/iomap.h
  head/sys/mips/nlm/hal/pcibus.h
  head/sys/mips/nlm/xlp_pci.c

Modified: head/sys/mips/nlm/hal/iomap.h
==============================================================================
--- head/sys/mips/nlm/hal/iomap.h	Tue Mar 27 07:51:42 2012	(r233535)
+++ head/sys/mips/nlm/hal/iomap.h	Tue Mar 27 07:57:41 2012	(r233536)
@@ -190,6 +190,16 @@ nlm_uenginenum(uint64_t pcibase)
 	return nlm_read_reg(pcibase, XLP_PCI_UCODEINFO_REG);
 }
 
+/*
+ * Find node on which a given Soc device is located.
+ * input is the pci device (slot) number.
+ */
+static __inline__ int
+nlm_get_device_node(int device)
+{
+	return (device / 8);
+}
+
 #endif /* !LOCORE or !__ASSEMBLY */
 
 #endif /* __NLM_HAL_IOMAP_H__ */

Modified: head/sys/mips/nlm/hal/pcibus.h
==============================================================================
--- head/sys/mips/nlm/hal/pcibus.h	Tue Mar 27 07:51:42 2012	(r233535)
+++ head/sys/mips/nlm/hal/pcibus.h	Tue Mar 27 07:57:41 2012	(r233536)
@@ -57,16 +57,26 @@
 
 #define	MSI_MIPS_DATA_INTVEC		0x000000ff
 
-#define	PCIE_BRIDGE_CMD		0x1
-#define	PCIE_BRIDGE_MSI_CAP	0x14
-#define	PCIE_BRIDGE_MSI_ADDRL	0x15
-#define	PCIE_BRIDGE_MSI_ADDRH	0x16
-#define	PCIE_BRIDGE_MSI_DATA	0x17
+/* PCIE Memory and IO regions */
+#define	PCIE_MEM_BASE			0xd0000000ULL
+#define	PCIE_MEM_LIMIT			0xdfffffffULL
+#define	PCIE_IO_BASE			0x14000000ULL
+#define	PCIE_IO_LIMIT			0x15ffffffULL
+
+#define	PCIE_BRIDGE_CMD			0x1
+#define	PCIE_BRIDGE_MSI_CAP		0x14
+#define	PCIE_BRIDGE_MSI_ADDRL		0x15
+#define	PCIE_BRIDGE_MSI_ADDRH		0x16
+#define	PCIE_BRIDGE_MSI_DATA		0x17
 
 /* XLP Global PCIE configuration space registers */
-#define	PCIE_MSI_STATUS		0x25A
-#define	PCIE_MSI_EN		0x25B
-#define	PCIE_INT_EN0		0x261
+#define	PCIE_BYTE_SWAP_MEM_BASE		0x247
+#define	PCIE_BYTE_SWAP_MEM_LIM		0x248
+#define	PCIE_BYTE_SWAP_IO_BASE		0x249
+#define	PCIE_BYTE_SWAP_IO_LIM		0x24A
+#define	PCIE_MSI_STATUS			0x25A
+#define	PCIE_MSI_EN			0x25B
+#define	PCIE_INT_EN0			0x261
 
 /* PCIE_MSI_EN */
 #define	PCIE_MSI_VECTOR_INT_EN		0xFFFFFFFF

Modified: head/sys/mips/nlm/xlp_pci.c
==============================================================================
--- head/sys/mips/nlm/xlp_pci.c	Tue Mar 27 07:51:42 2012	(r233535)
+++ head/sys/mips/nlm/xlp_pci.c	Tue Mar 27 07:57:41 2012	(r233536)
@@ -61,6 +61,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -77,7 +78,6 @@ static struct rman irq_rman, port_rman, 
 static void
 xlp_pci_init_resources(void)
 {
-
 	irq_rman.rm_start = 0;
 	irq_rman.rm_end = 255;
 	irq_rman.rm_type = RMAN_ARRAY;
@@ -91,7 +91,7 @@ xlp_pci_init_resources(void)
 	port_rman.rm_type = RMAN_ARRAY;
 	port_rman.rm_descr = "I/O ports";
 	if (rman_init(&port_rman)
-	    || rman_manage_region(&port_rman, 0x14000000UL, 0x15ffffffUL))
+	    || rman_manage_region(&port_rman, PCIE_IO_BASE, PCIE_IO_LIMIT))
 		panic("pci_init_resources port_rman");
 
 	mem_rman.rm_start = 0;
@@ -99,15 +99,19 @@ xlp_pci_init_resources(void)
 	mem_rman.rm_type = RMAN_ARRAY;
 	mem_rman.rm_descr = "I/O memory";
 	if (rman_init(&mem_rman)
-	    || rman_manage_region(&mem_rman, 0xd0000000ULL, 0xdfffffffULL))
+	    || rman_manage_region(&mem_rman, PCIE_MEM_BASE, PCIE_MEM_LIMIT))
 		panic("pci_init_resources mem_rman");
 
+	/*
+	 * This includes the GBU (nor flash) memory range and the PCIe
+	 * memory area. 
+	 */
 	emul_rman.rm_start = 0;
 	emul_rman.rm_end = ~0ul;
 	emul_rman.rm_type = RMAN_ARRAY;
 	emul_rman.rm_descr = "Emulated MEMIO";
 	if (rman_init(&emul_rman)
-	    || rman_manage_region(&emul_rman, 0x18000000ULL, 0x18ffffffULL))
+	    || rman_manage_region(&emul_rman, 0x16000000UL, 0x18ffffffUL))
 		panic("pci_init_resources emul_rman");
 }
 
@@ -220,15 +224,48 @@ xlp_pcib_write_config(device_t dev, u_in
 	return;
 }
 
+/*
+ * Enable byte swap in hardware. Program a link's PCIe SWAP regions
+ * from the link's IO and MEM address ranges.
+ */
+static void
+xlp_pci_hardware_swap_enable(int node, int link)
+{
+	uint64_t bbase, linkpcibase;
+	uint32_t bar;
+	int pcieoffset;
+
+	pcieoffset = XLP_IO_PCIE_OFFSET(node, link);
+	if (!nlm_dev_exists(pcieoffset))
+		return;
+
+	bbase = nlm_get_bridge_regbase(node);
+	linkpcibase = nlm_pcicfg_base(pcieoffset);
+	bar = nlm_read_bridge_reg(bbase, BRIDGE_PCIEMEM_BASE0 + link);
+	nlm_write_pci_reg(linkpcibase, PCIE_BYTE_SWAP_MEM_BASE, bar);
+
+	bar = nlm_read_bridge_reg(bbase, BRIDGE_PCIEMEM_LIMIT0 + link);
+	nlm_write_pci_reg(linkpcibase, PCIE_BYTE_SWAP_MEM_LIM, bar);
+
+	bar = nlm_read_bridge_reg(bbase, BRIDGE_PCIEIO_BASE0 + link);
+	nlm_write_pci_reg(linkpcibase, PCIE_BYTE_SWAP_IO_BASE, bar);
+
+	bar = nlm_read_bridge_reg(bbase, BRIDGE_PCIEIO_LIMIT0 + link);
+	nlm_write_pci_reg(linkpcibase, PCIE_BYTE_SWAP_IO_LIM, bar);
+}
+
 static int 
 xlp_pcib_attach(device_t dev)
 {
-	struct xlp_pcib_softc *sc;
-	sc = device_get_softc(dev);
+	int node, link;
+
+	/* enable hardware swap on all nodes/links */
+	for (node = 0; node < XLP_MAX_NODES; node++)
+		for (link = 0; link < 4; link++)
+			xlp_pci_hardware_swap_enable(node, link);
 
 	device_add_child(dev, "pci", 0);
 	bus_generic_attach(dev);
-
 	return (0);
 }
 
@@ -249,10 +286,6 @@ xlp_pcie_link(device_t pcib, device_t de
 	device_t parent, tmp;
 
 	/* find the lane on which the slot is connected to */
-#if 0 /* Debug */
-	printf("xlp_pcie_link : bus %s dev %s\n", device_get_nameunit(pcib),
-		device_get_nameunit(dev));
-#endif
 	tmp = dev;
 	while (1) {
 		parent = device_get_parent(tmp);
@@ -295,8 +328,6 @@ xlp_alloc_msi(device_t pcib, device_t de
 static int
 xlp_release_msi(device_t pcib, device_t dev, int count, int *irqs)
 {
-	device_printf(dev, "%s: msi release %d\n", device_get_nameunit(pcib),
-	    count);
 	return (0);
 }
 
@@ -369,7 +400,6 @@ mips_platform_pci_setup_intr(device_t de
 		return (EINVAL);
 	}
 	xlpirq = rman_get_start(irq);
-	device_printf(dev, "setup intr %d\n", xlpirq);
 
 	if (strcmp(device_get_name(dev), "pcib") != 0) {
 		device_printf(dev, "ret 0 on dev\n");
@@ -389,7 +419,7 @@ mips_platform_pci_setup_intr(device_t de
 			return (0);
 
 		node = nlm_nodeid();
-		link = (xlpirq / 32);
+		link = xlpirq / 32;
 		base = nlm_pcicfg_base(XLP_IO_PCIE_OFFSET(node,link));
 
 		/* MSI Interrupt Vector enable at bridge's configuration */
@@ -398,24 +428,23 @@ mips_platform_pci_setup_intr(device_t de
 		val = nlm_read_pci_reg(base, PCIE_INT_EN0);
 		/* MSI Interrupt enable at bridge's configuration */
 		nlm_write_pci_reg(base, PCIE_INT_EN0,
-				(val | PCIE_MSI_INT_EN));
+		    (val | PCIE_MSI_INT_EN));
 
 		/* legacy interrupt disable at bridge */
 		val = nlm_read_pci_reg(base, PCIE_BRIDGE_CMD);
 		nlm_write_pci_reg(base, PCIE_BRIDGE_CMD,
-				(val | PCIM_CMD_INTxDIS));
+		    (val | PCIM_CMD_INTxDIS));
 
 		/* MSI address update at bridge */
-		val = nlm_read_pci_reg(base, PCIE_BRIDGE_MSI_ADDRL);
 		nlm_write_pci_reg(base, PCIE_BRIDGE_MSI_ADDRL,
-				(val | MSI_MIPS_ADDR_BASE));
+		    MSI_MIPS_ADDR_BASE);
+		nlm_write_pci_reg(base, PCIE_BRIDGE_MSI_ADDRH, 0);
 
 		val = nlm_read_pci_reg(base, PCIE_BRIDGE_MSI_CAP);
 		/* MSI capability enable at bridge */
 		nlm_write_pci_reg(base, PCIE_BRIDGE_MSI_CAP, 
-				(val |
-				(PCIM_MSICTRL_MSI_ENABLE << 16) |
-				(PCIM_MSICTRL_MMC_32 << 16)));
+		    (val | (PCIM_MSICTRL_MSI_ENABLE << 16) |
+		        (PCIM_MSICTRL_MMC_32 << 16)));
 
 		xlpirq = xlp_pcie_link_irt(xlpirq / 32);
 		if (xlpirq == -1)
@@ -423,12 +452,10 @@ mips_platform_pci_setup_intr(device_t de
 		xlpirq = xlp_irt_to_irq(xlpirq);
 	}
 	/* Set all irqs to CPU 0 for now */
-	printf("set up intr %d->%d(%d)\n", xlp_irq_to_irt(xlpirq), xlpirq, (int)rman_get_start(irq));
 	nlm_pic_write_irt_direct(xlp_pic_base, xlp_irq_to_irt(xlpirq), 1, 0,
-				 PIC_LOCAL_SCHEDULING, xlpirq, 0);
+	    PIC_LOCAL_SCHEDULING, xlpirq, 0);
 	extra_ack = NULL;
-	if (xlpirq >= PIC_PCIE_0_IRQ &&
-	    xlpirq <= PIC_PCIE_3_IRQ)
+	if (xlpirq >= PIC_PCIE_0_IRQ && xlpirq <= PIC_PCIE_3_IRQ)
 		extra_ack = bridge_pcie_ack;
 	xlp_establish_intr(device_get_name(child), filt,
 	    intr, arg, xlpirq, flags, cookiep, extra_ack);
@@ -451,34 +478,37 @@ static void
 assign_soc_resource(device_t child, int type, u_long *startp, u_long *endp,
     u_long *countp, struct rman **rm, bus_space_tag_t *bst, vm_offset_t *va)
 {
-	int devid = pci_get_device(child);
-	int inst = pci_get_function(child);
-	int node = pci_get_slot(child) / 8;
-	int dev = pci_get_slot(child) % 8;
+	int devid, inst, node, unit;
+
+	devid = pci_get_device(child);
+	inst = pci_get_function(child);
+	node = pci_get_slot(child) / 8;
+	unit = device_get_unit(child);
 
 	*rm = NULL;
 	*va = 0;
 	*bst = 0;
-	if (type == SYS_RES_IRQ) {
-		printf("%s: %d %d %d : start %d, end %d\n", __func__,
-				node, dev, inst, (int)*startp, (int)*endp);
-	} else if (type == SYS_RES_MEMORY) {
+	if (type == SYS_RES_MEMORY) { 
 		switch (devid) {
 		case PCI_DEVICE_ID_NLM_UART:
 			*va = nlm_get_uart_regbase(node, inst);
-			*startp = MIPS_KSEG1_TO_PHYS(va);
+			*startp = MIPS_KSEG1_TO_PHYS(*va);
 			*countp = 0x100;
 			*rm = &emul_rman;
 			*bst = uart_bus_space_mem;
 			break;
 		}
-
-	} else
+		/* calculate end if allocated */
+		if (*rm)
+			*endp = *startp + *countp - 1;
+	} else if (type != SYS_RES_IRQ) {
+		/*
+		 * IRQ allocation is done by route_interrupt,
+		 * for any other request print warning.
+		 */
 		printf("Unknown type %d in req for [%x%x]\n",
 			type, devid, inst);
-	/* default to rmi_bus_space for SoC resources */
-	if (type == SYS_RES_MEMORY && *bst == 0)
-		*bst = rmi_bus_space;
+	}
 }
 
 static struct resource *
@@ -529,7 +559,7 @@ xlp_pci_alloc_resource(device_t bus, dev
 		if (va == 0)
 			va = (vm_offset_t)pmap_mapdev(start, count);
 		if (bst == 0)
-			bst = rmi_pci_bus_space;
+			bst = rmi_bus_space;
 
 		rman_set_bushandle(rv, va);
 		rman_set_virtual(rv, (void *)va);
@@ -590,7 +620,6 @@ mips_pci_route_interrupt(device_t bus, d
 	if ((pin < 1) || (pin > 4))
 		return (255);
 
-	device_printf(bus, "route  %s %d", device_get_nameunit(dev), pin);
 	if (pci_get_bus(dev) == 0 &&
 	    pci_get_vendor(dev) == PCI_VENDOR_NETLOGIC) {
 		/* SoC devices */

From owner-svn-src-head@FreeBSD.ORG  Tue Mar 27 09:48:19 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 22C37106566B;
	Tue, 27 Mar 2012 09:48:19 +0000 (UTC)
	(envelope-from jchandra@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 0223E8FC14;
	Tue, 27 Mar 2012 09:48:19 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2R9mI2Y079254;
	Tue, 27 Mar 2012 09:48:18 GMT
	(envelope-from jchandra@svn.freebsd.org)
Received: (from jchandra@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2R9mIuk079250;
	Tue, 27 Mar 2012 09:48:18 GMT
	(envelope-from jchandra@svn.freebsd.org)
Message-Id: <201203270948.q2R9mIuk079250@svn.freebsd.org>
From: "Jayachandran C." 
Date: Tue, 27 Mar 2012 09:48:18 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233537 - in head/sys: conf dev/iicbus
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 27 Mar 2012 09:48:19 -0000

Author: jchandra
Date: Tue Mar 27 09:48:18 2012
New Revision: 233537
URL: http://svn.freebsd.org/changeset/base/233537

Log:
  Move driver for DS1374 RTC to sys/dev/iicbus
  
  The earlier version of the driver is sys/mips/rmi/dev/iic/ds1374u.c
  Convert all references to ds1374u to ds1374, and use DEVMETHOD_END.
  Also update the license header as Netlogic is now Broadcom.

Added:
  head/sys/dev/iicbus/ds1374.c   (contents, props changed)
Modified:
  head/sys/conf/NOTES
  head/sys/conf/files

Modified: head/sys/conf/NOTES
==============================================================================
--- head/sys/conf/NOTES	Tue Mar 27 07:57:41 2012	(r233536)
+++ head/sys/conf/NOTES	Tue Mar 27 09:48:18 2012	(r233537)
@@ -2547,9 +2547,11 @@ device		iicsmb		# smb over i2c bridge
 # I2C peripheral devices
 #
 # ds133x	Dallas Semiconductor DS1337, DS1338 and DS1339 RTC
+# ds1374	Dallas Semiconductor DS1374 RTC
 # ds1672	Dallas Semiconductor DS1672 RTC
 #
 device		ds133x
+device		ds1374
 device		ds1672
 
 # Parallel-Port Bus

Modified: head/sys/conf/files
==============================================================================
--- head/sys/conf/files	Tue Mar 27 07:57:41 2012	(r233536)
+++ head/sys/conf/files	Tue Mar 27 09:48:18 2012	(r233537)
@@ -1149,6 +1149,7 @@ dev/ieee488/tnt4882.c		optional tnt4882
 dev/ieee488/upd7210.c		optional pcii | tnt4882
 dev/iicbus/ad7418.c		optional ad7418
 dev/iicbus/ds133x.c		optional ds133x
+dev/iicbus/ds1374.c		optional ds1374
 dev/iicbus/ds1672.c		optional ds1672
 dev/iicbus/icee.c		optional icee
 dev/iicbus/if_ic.c		optional ic

Added: head/sys/dev/iicbus/ds1374.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sys/dev/iicbus/ds1374.c	Tue Mar 27 09:48:18 2012	(r233537)
@@ -0,0 +1,143 @@
+/*-
+ * Copyright (c) 2003-2012 Broadcom Corporation
+ * All Rights Reserved
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY BROADCOM ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL BROADCOM OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include "iicbus_if.h"
+#include "clock_if.h"
+
+#define	DS1374_RTC_COUNTER	0	/* counter (bytes 0-3) */
+
+struct ds1374_softc {
+	uint32_t	sc_addr;
+	device_t	sc_dev;
+};
+
+static int
+ds1374_probe(device_t dev)
+{
+	device_set_desc(dev, "DS1374 RTC");
+	return (0);
+}
+
+static int
+ds1374_attach(device_t dev)
+{
+	struct ds1374_softc *sc = device_get_softc(dev);
+
+	if(sc==NULL) {
+		printf("ds1374_attach device_get_softc failed\n");
+		return (0);
+	}
+	sc->sc_dev = dev;
+	sc->sc_addr = iicbus_get_addr(dev);
+
+	clock_register(dev, 1000);
+	return (0);
+}
+
+static int 
+ds1374_settime(device_t dev, struct timespec *ts)
+{
+	/* NB: register pointer precedes actual data */
+	uint8_t data[5] = { DS1374_RTC_COUNTER };
+	struct ds1374_softc *sc = device_get_softc(dev);
+	struct iic_msg msgs[1] = {
+	     { sc->sc_addr, IIC_M_WR, 5, data },
+	};
+
+	data[1] = (ts->tv_sec >> 0) & 0xff;
+	data[2] = (ts->tv_sec >> 8) & 0xff;
+	data[3] = (ts->tv_sec >> 16) & 0xff;
+	data[4] = (ts->tv_sec >> 24) & 0xff;
+
+	return iicbus_transfer(dev, msgs, 1);
+}
+
+static int
+ds1374_gettime(device_t dev, struct timespec *ts)
+{
+	struct ds1374_softc *sc = device_get_softc(dev);
+	uint8_t addr[1] = { DS1374_RTC_COUNTER };
+	uint8_t secs[4];
+	struct iic_msg msgs[2] = {
+	     { sc->sc_addr, IIC_M_WR, 1, addr },
+	     { sc->sc_addr, IIC_M_RD, 4, secs },
+	};
+	int error;
+
+	error = iicbus_transfer(dev, msgs, 2);
+	if (error == 0) {
+		/* counter has seconds since epoch */
+		ts->tv_sec = (secs[3] << 24) | (secs[2] << 16)
+			   | (secs[1] <<  8) | (secs[0] <<  0);
+		ts->tv_nsec = 0;
+	}
+	return error;
+}
+
+static device_method_t ds1374_methods[] = {
+	DEVMETHOD(device_probe,		ds1374_probe),
+	DEVMETHOD(device_attach,	ds1374_attach),
+
+	DEVMETHOD(clock_gettime,	ds1374_gettime),
+	DEVMETHOD(clock_settime,	ds1374_settime),
+
+	DEVMETHOD_END
+};
+
+static driver_t ds1374_driver = {
+	"ds1374_rtc",
+	ds1374_methods,
+	sizeof(struct ds1374_softc),
+};
+static devclass_t ds1374_devclass;
+
+DRIVER_MODULE(ds1374, iicbus, ds1374_driver, ds1374_devclass, 0, 0);
+MODULE_VERSION(ds1374, 1);
+MODULE_DEPEND(ds1374, iicbus, 1, 1, 1);

From owner-svn-src-head@FreeBSD.ORG  Tue Mar 27 10:00:33 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id E731D1065674;
	Tue, 27 Mar 2012 10:00:33 +0000 (UTC)
	(envelope-from jchandra@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id B82BF8FC08;
	Tue, 27 Mar 2012 10:00:33 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2RA0XeU079751;
	Tue, 27 Mar 2012 10:00:33 GMT
	(envelope-from jchandra@svn.freebsd.org)
Received: (from jchandra@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2RA0XXd079750;
	Tue, 27 Mar 2012 10:00:33 GMT
	(envelope-from jchandra@svn.freebsd.org)
Message-Id: <201203271000.q2RA0XXd079750@svn.freebsd.org>
From: "Jayachandran C." 
Date: Tue, 27 Mar 2012 10:00:33 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233538 - head/sys/dev/iicbus
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 27 Mar 2012 10:00:34 -0000

Author: jchandra
Date: Tue Mar 27 10:00:33 2012
New Revision: 233538
URL: http://svn.freebsd.org/changeset/base/233538

Log:
  Fix property name, r233537 used mime-type instead of svn:mime-type

Modified:
Directory Properties:
  head/sys/dev/iicbus/ds1374.c   (props changed)

From owner-svn-src-head@FreeBSD.ORG  Tue Mar 27 10:44:32 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id DAC03106566B;
	Tue, 27 Mar 2012 10:44:32 +0000 (UTC)
	(envelope-from jchandra@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id C25808FC15;
	Tue, 27 Mar 2012 10:44:32 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2RAiWNA081239;
	Tue, 27 Mar 2012 10:44:32 GMT
	(envelope-from jchandra@svn.freebsd.org)
Received: (from jchandra@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2RAiWqu081234;
	Tue, 27 Mar 2012 10:44:32 GMT
	(envelope-from jchandra@svn.freebsd.org)
Message-Id: <201203271044.q2RAiWqu081234@svn.freebsd.org>
From: "Jayachandran C." 
Date: Tue, 27 Mar 2012 10:44:32 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233539 - in head/sys: conf dev/iicbus
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 27 Mar 2012 10:44:33 -0000

Author: jchandra
Date: Tue Mar 27 10:44:32 2012
New Revision: 233539
URL: http://svn.freebsd.org/changeset/base/233539

Log:
  Driver for OpenCores I2C controller.
  
  Add a Simple polled driver iicoc for the OpenCores I2C controller. This
  is used in Netlogic XLP processors.
  
  Submitted by:	Sreekanth M. S. (kanthms at netlogicmicro com)

Added:
  head/sys/dev/iicbus/iicoc.c   (contents, props changed)
  head/sys/dev/iicbus/iicoc.h   (contents, props changed)
Modified:
  head/sys/conf/NOTES
  head/sys/conf/files

Modified: head/sys/conf/NOTES
==============================================================================
--- head/sys/conf/NOTES	Tue Mar 27 10:00:33 2012	(r233538)
+++ head/sys/conf/NOTES	Tue Mar 27 10:44:32 2012	(r233539)
@@ -2530,6 +2530,7 @@ device		smb
 # ic	i2c network interface
 # iic	i2c standard io
 # iicsmb i2c to smb bridge. Allow i2c i/o with smb commands.
+# iicoc simple polling driver for OpenCores I2C controller
 #
 # Supported interfaces:
 # bktr	brooktree848 I2C software interface
@@ -2543,6 +2544,7 @@ device		iicbb
 device		ic
 device		iic
 device		iicsmb		# smb over i2c bridge
+device		iicoc		# OpenCores I2C controller support
 
 # I2C peripheral devices
 #

Modified: head/sys/conf/files
==============================================================================
--- head/sys/conf/files	Tue Mar 27 10:00:33 2012	(r233538)
+++ head/sys/conf/files	Tue Mar 27 10:44:32 2012	(r233539)
@@ -1161,6 +1161,7 @@ dev/iicbus/iicbus_if.m		optional iicbus
 dev/iicbus/iiconf.c		optional iicbus
 dev/iicbus/iicsmb.c		optional iicsmb				\
 	dependency	"iicbus_if.h"
+dev/iicbus/iicoc.c		optional iicoc
 dev/iir/iir.c			optional iir
 dev/iir/iir_ctrl.c		optional iir
 dev/iir/iir_pci.c		optional iir pci

Added: head/sys/dev/iicbus/iicoc.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sys/dev/iicbus/iicoc.c	Tue Mar 27 10:44:32 2012	(r233539)
@@ -0,0 +1,390 @@
+/*-
+ * Copyright (c) 2003-2012 Broadcom Corporation
+ * All Rights Reserved
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY BROADCOM ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL BROADCOM OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include "iicbus_if.h"
+
+static devclass_t iicoc_devclass;
+
+/*
+ * Device methods
+ */
+static int iicoc_probe(device_t);
+static int iicoc_attach(device_t);
+static int iicoc_detach(device_t);
+
+static int iicoc_start(device_t dev, u_char slave, int timeout);
+static int iicoc_stop(device_t dev);
+static int iicoc_read(device_t dev, char *buf,
+    int len, int *read, int last, int delay);
+static int iicoc_write(device_t dev, const char *buf, 
+    int len, int *sent, int timeout);
+static int iicoc_repeated_start(device_t dev, u_char slave, int timeout);
+
+struct iicoc_softc {
+	device_t 	dev;		/* Self */
+	u_int		reg_shift;	/* Chip specific */
+	u_int		clockfreq;
+	u_int		i2cfreq;
+	struct resource *mem_res;	/* Memory resource */
+	int		mem_rid;
+	int 		sc_started;
+	uint8_t		i2cdev_addr;
+	device_t	iicbus;
+	struct mtx	sc_mtx;
+};
+
+static void 
+iicoc_dev_write(device_t dev, int reg, int value)
+{
+	struct iicoc_softc *sc;
+
+	sc = device_get_softc(dev);
+	bus_write_1(sc->mem_res, reg<reg_shift, value);
+}
+
+static int 
+iicoc_dev_read(device_t dev, int reg)
+{
+	uint8_t val;
+	struct iicoc_softc *sc;
+
+	sc = device_get_softc(dev);
+	val = bus_read_1(sc->mem_res, reg<reg_shift);
+	return (val);
+}
+
+static int
+iicoc_wait_on_status(device_t dev, uint8_t bit)
+{
+	int tries = I2C_TIMEOUT;
+	uint8_t status;
+
+	do {
+		status = iicoc_dev_read(dev, OC_I2C_STATUS_REG);
+	} while ((status & bit) != 0 && --tries > 0);
+
+	return (tries == 0 ? -1: 0);
+}
+
+static int
+iicoc_rd_cmd(device_t dev, uint8_t cmd)
+{
+	uint8_t data;
+
+	iicoc_dev_write(dev, OC_I2C_CMD_REG, cmd);
+	if (iicoc_wait_on_status(dev, OC_STATUS_TIP) < 0) {
+		device_printf(dev, "read: Timeout waiting for TIP clear.\n");
+		return (-1);
+	}
+	data = iicoc_dev_read(dev, OC_I2C_DATA_REG); 
+	return (data);
+}
+
+static int
+iicoc_wr_cmd(device_t dev, uint8_t data, uint8_t cmd)
+{
+
+	iicoc_dev_write(dev, OC_I2C_DATA_REG, data);
+	iicoc_dev_write(dev, OC_I2C_CMD_REG, cmd);
+	if (iicoc_wait_on_status(dev, OC_STATUS_TIP) < 0) {
+		device_printf(dev, "write: Timeout waiting for TIP clear.\n");
+		return (-1);
+	}
+	return (0);
+}
+
+static int
+iicoc_wr_ack_cmd(device_t dev, uint8_t data, uint8_t cmd)
+{
+	if (iicoc_wr_cmd(dev, data, cmd) < 0) 
+		return (-1);	
+	
+	if (iicoc_dev_read(dev, OC_I2C_STATUS_REG) & OC_STATUS_NACK) {
+		device_printf(dev, "write: I2C command ACK Error.\n");
+		return (IIC_ENOACK);
+	}
+	return (0);
+}
+
+static int 
+iicoc_init(device_t dev)
+{
+	struct iicoc_softc *sc;
+	int value;
+
+	sc = device_get_softc(dev);
+	value = iicoc_dev_read(dev, OC_I2C_CTRL_REG);
+	iicoc_dev_write(dev, OC_I2C_CTRL_REG, 
+	    value & ~(OC_CONTROL_EN | OC_CONTROL_IEN));
+	value = (sc->clockfreq/(5 * sc->i2cfreq)) - 1;
+	iicoc_dev_write(dev, OC_I2C_PRESCALE_LO_REG, value & 0xff);
+	iicoc_dev_write(dev, OC_I2C_PRESCALE_HI_REG, value >> 8);
+	value = iicoc_dev_read(dev, OC_I2C_CTRL_REG);
+	iicoc_dev_write(dev, OC_I2C_CTRL_REG, value | OC_CONTROL_EN);
+
+	value = iicoc_dev_read(dev, OC_I2C_CTRL_REG);
+	/* return 0 on success, 1 on error */
+	return ((value & OC_CONTROL_EN) == 0);
+}
+
+static int
+iicoc_probe(device_t dev)
+{
+	struct iicoc_softc *sc;
+	
+	sc = device_get_softc(dev);
+	if ((pci_get_vendor(dev) == 0x184e) &&
+	    (pci_get_device(dev) == 0x1011)) {
+		sc->clockfreq = XLP_I2C_CLKFREQ;
+		sc->i2cfreq = XLP_I2C_FREQ;
+		sc->reg_shift = 2;
+		device_set_desc(dev, "Netlogic XLP I2C Controller");
+		return (BUS_PROBE_DEFAULT);
+	}
+	return (ENXIO);
+}
+
+
+/*
+ * We add all the devices which we know about.
+ * The generic attach routine will attach them if they are alive.
+ */
+static int
+iicoc_attach(device_t dev)
+{
+	int bus;
+	struct iicoc_softc *sc;
+
+	sc = device_get_softc(dev);
+	bus = device_get_unit(dev);
+
+	sc->dev = dev;
+	mtx_init(&sc->sc_mtx, "iicoc", "iicoc", MTX_DEF);
+	sc->mem_rid = 0;
+	sc->mem_res = bus_alloc_resource(dev,
+	    SYS_RES_MEMORY, &sc->mem_rid, 0ul, ~0ul, 0x100, RF_ACTIVE);
+
+	if (sc->mem_res == NULL) {
+		device_printf(dev, "Could not allocate bus resource.\n");
+		return (-1);
+	}
+	iicoc_init(dev);
+	sc->iicbus = device_add_child(dev, "iicbus", -1);
+	if (sc->iicbus == NULL) {
+		device_printf(dev, "Could not allocate iicbus instance.\n");
+		return (-1);
+	}
+	bus_generic_attach(dev);
+
+	return (0);
+}
+
+static int
+iicoc_detach(device_t dev)
+{
+	bus_generic_detach(dev);
+
+	return (0);
+}
+
+static int 
+iicoc_start(device_t dev, u_char slave, int timeout)
+{
+	int error = IIC_EBUSBSY;
+	struct iicoc_softc *sc;
+
+	sc = device_get_softc(dev);
+	mtx_lock(&sc->sc_mtx);
+	sc->i2cdev_addr = (slave >> 1);
+
+	/* Verify the bus is idle */
+	if (iicoc_wait_on_status(dev, OC_STATUS_BUSY) < 0)
+		goto i2c_stx_error;
+
+	/* Write Slave Address */
+	if (iicoc_wr_ack_cmd(dev, slave, OC_COMMAND_START)) {
+		device_printf(dev, 
+		    "I2C write slave address [0x%x] failed.\n", slave);
+		error = IIC_ENOACK;
+		goto i2c_stx_error;	
+	}
+	
+	/* Verify Arbitration is not Lost */
+	if (iicoc_dev_read(dev, OC_I2C_STATUS_REG) & OC_STATUS_AL) {
+		device_printf(dev, "I2C Bus Arbitration Lost, Aborting.\n");
+		error = IIC_EBUSERR;
+		goto i2c_stx_error;
+	}
+	error = IIC_NOERR;
+	mtx_unlock(&sc->sc_mtx);
+	return (error);
+i2c_stx_error:
+	iicoc_dev_write(dev, OC_I2C_CMD_REG, OC_COMMAND_STOP);
+	iicoc_wait_on_status(dev, OC_STATUS_BUSY);  /* wait for idle */
+	mtx_unlock(&sc->sc_mtx);
+	return (error);
+}
+
+static int 
+iicoc_stop(device_t dev)
+{
+	int error = 0;
+	struct iicoc_softc *sc;
+
+	sc = device_get_softc(dev);
+	mtx_lock(&sc->sc_mtx);
+	iicoc_dev_write(dev, OC_I2C_CMD_REG, OC_COMMAND_STOP);
+	iicoc_wait_on_status(dev, OC_STATUS_BUSY);  /* wait for idle */
+	mtx_unlock(&sc->sc_mtx);
+	return (error);
+
+}
+
+static int 
+iicoc_write(device_t dev, const char *buf, int len,
+    int *sent, int timeout /* us */ )
+{
+	uint8_t value;
+	int i;
+
+	value = buf[0];
+	/* Write Slave Offset */
+	if (iicoc_wr_ack_cmd(dev, value, OC_COMMAND_WRITE)) {
+		device_printf(dev, "I2C write slave offset failed.\n");
+		goto i2c_tx_error;	
+	}
+
+	for (i = 1; i < len; i++) {
+		/* Write data byte */
+		value = buf[i];
+		if (iicoc_wr_cmd(dev, value, OC_COMMAND_WRITE)) {
+			device_printf(dev, "I2C write data byte %d failed.\n",
+			    i);
+			goto i2c_tx_error;	
+		}
+	}
+	*sent = len;
+	return (IIC_NOERR);
+
+i2c_tx_error:
+	return (IIC_EBUSERR);
+}
+
+static int 
+iicoc_read(device_t dev, char *buf, int len, int *read, int last,
+    int delay)
+{
+	int data, i;
+	uint8_t cmd;
+
+	for (i = 0; i < len; i++) {
+		/* Read data byte */
+		cmd = (i == len - 1) ? OC_COMMAND_RDNACK : OC_COMMAND_READ;
+		data = iicoc_rd_cmd(dev, cmd);
+		if (data < 0) {
+			device_printf(dev, 
+			    "I2C read data byte %d failed.\n", i);
+			goto i2c_rx_error;
+		}
+		buf[i] = (uint8_t)data;
+	}
+	
+	*read = len;
+	return (IIC_NOERR);
+
+i2c_rx_error:	
+	return (IIC_EBUSERR);
+}
+
+static int
+iicoc_reset(device_t dev, u_char speed, u_char addr, u_char *oldadr)
+{
+	int error;
+	struct iicoc_softc *sc;
+
+	sc = device_get_softc(dev);
+	mtx_lock(&sc->sc_mtx);
+	error = iicoc_init(dev);
+	mtx_unlock(&sc->sc_mtx);
+	return (error);
+}
+
+static int
+iicoc_repeated_start(device_t dev, u_char slave, int timeout)
+{
+	return 0;
+}
+
+static device_method_t iicoc_methods[] = {
+	/* device interface */
+	DEVMETHOD(device_probe, iicoc_probe),
+	DEVMETHOD(device_attach, iicoc_attach),
+	DEVMETHOD(device_detach, iicoc_detach),
+
+	/* iicbus interface */
+	DEVMETHOD(iicbus_callback, iicbus_null_callback),
+	DEVMETHOD(iicbus_repeated_start, iicoc_repeated_start),
+	DEVMETHOD(iicbus_start, iicoc_start),
+	DEVMETHOD(iicbus_stop, iicoc_stop),
+	DEVMETHOD(iicbus_reset, iicoc_reset),	
+	DEVMETHOD(iicbus_write, iicoc_write),
+	DEVMETHOD(iicbus_read, iicoc_read),
+	DEVMETHOD(iicbus_transfer, iicbus_transfer_gen),
+
+	DEVMETHOD_END
+};
+
+static driver_t iicoc_driver = {
+	"iicoc",
+	iicoc_methods,
+	sizeof(struct iicoc_softc),
+};
+
+DRIVER_MODULE(iicoc, pci, iicoc_driver, iicoc_devclass, 0, 0);
+DRIVER_MODULE(iicbus, iicoc, iicbus_driver, iicbus_devclass, 0, 0);

Added: head/sys/dev/iicbus/iicoc.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sys/dev/iicbus/iicoc.h	Tue Mar 27 10:44:32 2012	(r233539)
@@ -0,0 +1,78 @@
+/*-
+ * Copyright (c) 2003-2012 Broadcom Corporation
+ * All Rights Reserved
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY BROADCOM ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL BROADCOM OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef __OPENCORE_I2C_H__
+#define __OPENCORE_I2C_H__
+
+/* I2C specific registers */
+#define OC_I2C_PRESCALE_LO_REG		0x00
+#define OC_I2C_PRESCALE_HI_REG		0x01
+#define OC_I2C_CTRL_REG			0x02
+#define OC_I2C_TRANSMIT_REG		0x03  /* tx and rx - same reg */
+#define OC_I2C_RECV_REG			0x03  /* tx and rx - same reg */
+#define OC_I2C_DATA_REG			0x03  /* tx and rx - same reg */
+#define OC_I2C_CMD_REG			0x04  /* cmd and status - same reg */
+#define OC_I2C_STATUS_REG		0x04  /* cmd and status - same reg */
+
+#define XLP_I2C_CLKFREQ			133333333 /* XLP 133 MHz IO clock */
+#define XLP_I2C_FREQ			100000	/* default 100kHz */
+#define I2C_TIMEOUT			500000
+
+/*
+ * These defines pertain to the OpenCores
+ * I2C Master Host Controller used in XLP
+ */
+
+#define OC_PRESCALER_LO			0
+#define OC_PRESCALER_HI			1
+
+#define OC_CONTROL			2
+#define OC_CONTROL_EN			0x80
+#define OC_CONTROL_IEN			0x40
+
+#define OC_DATA				3	/* Data TX & RX Reg */
+
+#define OC_COMMAND			4
+#define OC_COMMAND_START		0x90
+#define OC_COMMAND_STOP			0x40
+#define OC_COMMAND_READ			0x20
+#define OC_COMMAND_WRITE		0x10
+#define OC_COMMAND_RDACK		0x20
+#define OC_COMMAND_RDNACK		0x28
+#define OC_COMMAND_IACK			0x01	/* Not used */
+
+#define OC_STATUS			4	/* Same as 'command' */
+#define OC_STATUS_NACK			0x80	/* Did not get an ACK */
+#define OC_STATUS_BUSY			0x40
+#define OC_STATUS_AL			0x20	/* Arbitration Lost */
+#define OC_STATUS_TIP			0x02	/* Transfer in Progress  */
+#define OC_STATUS_IF			0x01	/* Intr. Pending Flag */
+
+#endif

From owner-svn-src-head@FreeBSD.ORG  Tue Mar 27 11:17:05 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 64709106564A;
	Tue, 27 Mar 2012 11:17:05 +0000 (UTC)
	(envelope-from jchandra@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 356948FC14;
	Tue, 27 Mar 2012 11:17:05 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2RBH57f083473;
	Tue, 27 Mar 2012 11:17:05 GMT
	(envelope-from jchandra@svn.freebsd.org)
Received: (from jchandra@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2RBH4Ur083470;
	Tue, 27 Mar 2012 11:17:04 GMT
	(envelope-from jchandra@svn.freebsd.org)
Message-Id: <201203271117.q2RBH4Ur083470@svn.freebsd.org>
From: "Jayachandran C." 
Date: Tue, 27 Mar 2012 11:17:04 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233540 - in head/sys/mips: conf nlm
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 27 Mar 2012 11:17:05 -0000

Author: jchandra
Date: Tue Mar 27 11:17:04 2012
New Revision: 233540
URL: http://svn.freebsd.org/changeset/base/233540

Log:
  I2C support for XLP, add hints for I2C devices and update PCI resource
  allocation code.

Added:
  head/sys/mips/conf/XLP.hints   (contents, props changed)
Modified:
  head/sys/mips/conf/std.XLP
  head/sys/mips/nlm/xlp_pci.c

Added: head/sys/mips/conf/XLP.hints
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sys/mips/conf/XLP.hints	Tue Mar 27 11:17:04 2012	(r233540)
@@ -0,0 +1,5 @@
+# $FreeBSD$
+
+# RTC
+hint.ds1374_rtc.0.at="iicbus1"
+hint.ds1374_rtc.0.addr=0xd0

Modified: head/sys/mips/conf/std.XLP
==============================================================================
--- head/sys/mips/conf/std.XLP	Tue Mar 27 10:44:32 2012	(r233539)
+++ head/sys/mips/conf/std.XLP	Tue Mar 27 11:17:04 2012	(r233540)
@@ -5,6 +5,8 @@ makeoptions	MODULES_OVERRIDE=""
 makeoptions	DEBUG=-g		# Build kernel with gdb(1) debug symbols
 #profile 	2
 
+hints		"XLP.hints"
+
 options 	SCHED_ULE		# ULE scheduler
 #options 	VERBOSE_SYSINIT
 #options 	SCHED_4BSD		# 4BSD scheduler
@@ -55,6 +57,11 @@ options 	ALT_BREAK_TO_DEBUGGER
 
 options 	GEOM_UZIP
 
+# Device tree
+options 	FDT
+options 	FDT_DTB_STATIC
+makeoptions	FDT_DTS_FILE=xlp-basic.dts
+
 # Pseudo
 device		loop
 device		random
@@ -83,6 +90,8 @@ device		ehci			# EHCI PCI->USB interface
 #device		uhid			# "Human Interface Devices"
 device		umass			# Requires scbus and da
 
-options 	FDT
-options 	FDT_DTB_STATIC
-makeoptions	FDT_DTS_FILE=xlp-basic.dts
+# i2c driver and devices
+device		iic
+device		iicbus
+device		iicoc
+device		ds1374			# RTC on XLP boards

Modified: head/sys/mips/nlm/xlp_pci.c
==============================================================================
--- head/sys/mips/nlm/xlp_pci.c	Tue Mar 27 10:44:32 2012	(r233539)
+++ head/sys/mips/nlm/xlp_pci.c	Tue Mar 27 11:17:04 2012	(r233540)
@@ -497,6 +497,15 @@ assign_soc_resource(device_t child, int 
 			*rm = &emul_rman;
 			*bst = uart_bus_space_mem;
 			break;
+
+		case PCI_DEVICE_ID_NLM_I2C:
+			*va = nlm_pcicfg_base(XLP_IO_I2C_OFFSET(node, unit)) +
+			    XLP_IO_PCI_HDRSZ;
+			*startp = MIPS_KSEG1_TO_PHYS(*va);
+			*countp = 0x100;
+			*rm = &emul_rman;
+			*bst = uart_bus_space_mem;
+			break;
 		}
 		/* calculate end if allocated */
 		if (*rm)

From owner-svn-src-head@FreeBSD.ORG  Tue Mar 27 11:43:47 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 7F7F5106566C;
	Tue, 27 Mar 2012 11:43:47 +0000 (UTC)
	(envelope-from jchandra@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 675898FC14;
	Tue, 27 Mar 2012 11:43:47 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2RBhlV9084314;
	Tue, 27 Mar 2012 11:43:47 GMT
	(envelope-from jchandra@svn.freebsd.org)
Received: (from jchandra@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2RBhlc2084308;
	Tue, 27 Mar 2012 11:43:47 GMT
	(envelope-from jchandra@svn.freebsd.org)
Message-Id: <201203271143.q2RBhlc2084308@svn.freebsd.org>
From: "Jayachandran C." 
Date: Tue, 27 Mar 2012 11:43:47 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233541 - in head/sys/mips: conf nlm nlm/dev
	nlm/dev/sec nlm/hal
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 27 Mar 2012 11:43:47 -0000

Author: jchandra
Date: Tue Mar 27 11:43:46 2012
New Revision: 233541
URL: http://svn.freebsd.org/changeset/base/233541

Log:
  Opencrypto driver for XLP Security and RSA/ECC blocks
  
  Support for the Security and RSA blocks on XLP SoC. Even though
  the XLP supports many more algorithms, only the ones supported
  in OCF have been added.
  
  Submitted by:	Venkatesh J. V. (venkatesh at netlogicmicro com)

Added:
  head/sys/mips/nlm/dev/
  head/sys/mips/nlm/dev/sec/
  head/sys/mips/nlm/dev/sec/nlmrsa.c   (contents, props changed)
  head/sys/mips/nlm/dev/sec/nlmrsalib.h   (contents, props changed)
  head/sys/mips/nlm/dev/sec/nlmsec.c   (contents, props changed)
  head/sys/mips/nlm/dev/sec/nlmseclib.c   (contents, props changed)
  head/sys/mips/nlm/dev/sec/nlmseclib.h   (contents, props changed)
  head/sys/mips/nlm/dev/sec/rsa_ucode.h   (contents, props changed)
  head/sys/mips/nlm/hal/nlmsaelib.h   (contents, props changed)
Modified:
  head/sys/mips/conf/std.XLP
  head/sys/mips/nlm/files.xlp
  head/sys/mips/nlm/hal/iomap.h

Modified: head/sys/mips/conf/std.XLP
==============================================================================
--- head/sys/mips/conf/std.XLP	Tue Mar 27 11:17:04 2012	(r233540)
+++ head/sys/mips/conf/std.XLP	Tue Mar 27 11:43:46 2012	(r233541)
@@ -95,3 +95,13 @@ device		iic
 device		iicbus
 device		iicoc
 device		ds1374			# RTC on XLP boards
+
+# Crypto
+device		crypto
+device		cryptodev
+device		nlmsec
+device		nlmrsa
+
+# Options that use crypto
+options 	IPSEC
+options 	GEOM_ELI

Added: head/sys/mips/nlm/dev/sec/nlmrsa.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sys/mips/nlm/dev/sec/nlmrsa.c	Tue Mar 27 11:43:46 2012	(r233541)
@@ -0,0 +1,556 @@
+/*-
+ * Copyright (c) 2003-2012 Broadcom Corporation
+ * All Rights Reserved
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY BROADCOM ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL BROADCOM OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#include 
+
+#include "cryptodev_if.h"
+
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#ifdef NLM_RSA_DEBUG
+int print_krp_params(struct cryptkop *krp);
+#endif
+
+static	int xlp_rsa_init(struct xlp_rsa_softc *sc, int node);
+static	int xlp_rsa_newsession(device_t , uint32_t *, struct cryptoini *);
+static	int xlp_rsa_freesession(device_t , uint64_t);
+static	int xlp_rsa_kprocess(device_t , struct cryptkop *, int);
+static	int xlp_get_rsa_opsize(struct xlp_rsa_command *cmd, unsigned int bits);
+static	void xlp_free_cmd_params(struct xlp_rsa_command *cmd);
+static	int xlp_rsa_inp2hwformat(uint8_t *src, uint8_t *dst,
+    uint32_t paramsize, uint8_t result);
+
+static	int xlp_rsa_probe(device_t);
+static	int xlp_rsa_attach(device_t);
+static	int xlp_rsa_detach(device_t);
+
+static device_method_t xlp_rsa_methods[] = {
+	/* device interface */
+	DEVMETHOD(device_probe, xlp_rsa_probe),
+	DEVMETHOD(device_attach, xlp_rsa_attach),
+	DEVMETHOD(device_detach, xlp_rsa_detach),
+
+	/* bus interface */
+	DEVMETHOD(bus_print_child, bus_generic_print_child),
+	DEVMETHOD(bus_driver_added, bus_generic_driver_added),
+
+	/* crypto device methods */
+	DEVMETHOD(cryptodev_newsession, xlp_rsa_newsession),
+	DEVMETHOD(cryptodev_freesession,xlp_rsa_freesession),
+	DEVMETHOD(cryptodev_kprocess,   xlp_rsa_kprocess),
+
+	DEVMETHOD_END
+};
+
+static driver_t xlp_rsa_driver = {
+	"nlmrsa",
+	xlp_rsa_methods,
+	sizeof(struct xlp_rsa_softc)
+};
+static devclass_t xlp_rsa_devclass;
+
+DRIVER_MODULE(nlmrsa, pci, xlp_rsa_driver, xlp_rsa_devclass, 0, 0);
+MODULE_DEPEND(nlmrsa, crypto, 1, 1, 1);
+
+void
+nlm_xlprsaecc_msgring_handler(int vc, int size, int code, int src_id, 
+    struct nlm_fmn_msg *msg, void *data);
+
+#ifdef NLM_RSA_DEBUG
+int
+print_krp_params(struct cryptkop *krp)
+{
+	int i;
+
+	printf("krp->krp_op	:%d\n",krp->krp_op);
+	printf("krp->krp_status	:%d\n",krp->krp_status);
+	printf("krp->krp_iparams:%d\n",krp->krp_iparams);
+	printf("krp->krp_oparams:%d\n",krp->krp_oparams);
+	for (i=0;ikrp_iparams+krp->krp_oparams;i++) {
+		printf("krp->krp_param[%d].crp_p	:0x%llx\n",i,
+		    (unsigned long long)krp->krp_param[i].crp_p);
+		printf("krp->krp_param[%d].crp_nbits	:%d\n",i,
+		    krp->krp_param[i].crp_nbits);
+		printf("krp->krp_param[%d].crp_nbytes	:%d\n",i,
+		    (krp->krp_param[i].crp_nbits+7)/8);
+	}
+	return 0;
+}
+#endif
+
+static int 
+xlp_rsa_init(struct xlp_rsa_softc *sc, int node)
+{
+	struct xlp_rsa_command *cmd = NULL;
+	uint32_t size, fbvc, dstvc, endsel, regval;
+	struct nlm_fmn_msg m;
+	int err, ret, i;
+	uint64_t base;
+
+	/* Register interrupt handler for the RSA/ECC CMS messages */
+	if (register_msgring_handler(sc->rsaecc_vc_start,
+	    sc->rsaecc_vc_end, nlm_xlprsaecc_msgring_handler, sc) != 0) {
+		err = -1;
+		printf("Couldn't register rsa/ecc msgring handler\n");
+		goto errout;
+	}
+	m.msg[0] = m.msg[1] = m.msg[2] = m.msg[3] = 0;
+	fbvc = nlm_cpuid() / CMS_MAX_VCPU_VC;
+	/* Do the CMS credit initialization */
+	/* Currently it is configured by default to 50 when kernel comes up */
+
+	if ((cmd = malloc(sizeof(struct xlp_rsa_command), M_DEVBUF,
+	    M_NOWAIT | M_ZERO)) == NULL) {
+		err = ENOMEM;
+		printf("Failed to allocate mem for cmd\n");
+		goto errout;
+	}
+	size = sizeof(nlm_rsa_ucode_data);
+	if ((cmd->rsasrc = malloc(size, M_DEVBUF, M_NOWAIT | M_ZERO)) == NULL) {
+		err = ENOMEM;
+		printf("Failed to allocate mem for cmd->rsasrc\n");
+		goto errout;
+	}
+	if (((uintptr_t)cmd->rsasrc & (XLP_L2L3_CACHELINE_SIZE - 1))) {
+		err = EINVAL;
+		printf("cmd->rsasrc is not cacheline aligned\n");
+		goto errout;
+	}
+	memcpy(cmd->rsasrc, (uint8_t *)nlm_rsa_ucode_data, size);
+	m.msg[0] = nlm_crypto_form_rsa_ecc_fmn_entry0(1, 0x70, 0,
+	    vtophys(cmd->rsasrc));
+	m.msg[1] = nlm_crypto_form_rsa_ecc_fmn_entry1(0, 1, fbvc,
+	    vtophys(cmd->rsasrc));
+	/* Software scratch pad */
+	m.msg[2] = (uintptr_t)cmd;
+
+	for (dstvc = sc->rsaecc_vc_start; dstvc <= sc->rsaecc_vc_end; dstvc++) {
+		ret = nlm_fmn_msgsend(dstvc, 3, FMN_SWCODE_RSA, &m);
+		if (ret != 0) {
+			err = -1;
+			printf("%s: msgsnd failed (%x)\n", __func__, ret);
+			goto errout;
+		}
+	}
+	/* Configure so that all VCs send request to all RSA pipes */
+	base = nlm_get_rsa_regbase(node);
+	if (nlm_is_xlp3xx()) {
+		endsel = 1;
+		regval = 0xFFFF;
+	} else {
+		endsel = 3;
+		regval = 0x07FFFFFF;
+	}
+	for (i = 0; i < endsel; i++)
+		nlm_write_rsa_reg(base, RSA_ENG_SEL_0 + i, regval);
+	return (0);
+errout:
+	xlp_free_cmd_params(cmd);
+	return (err);
+}
+
+/* This function is called from an interrupt handler */
+void
+nlm_xlprsaecc_msgring_handler(int vc, int size, int code, int src_id,
+    struct nlm_fmn_msg *msg, void *data)
+{
+	struct xlp_rsa_command *cmd = NULL;
+	struct xlp_rsa_softc *sc = NULL;
+
+	KASSERT(code == FMN_SWCODE_RSA,
+	    ("%s: bad code = %d, expected code = %d\n", __FUNCTION__, code,
+	    FMN_SWCODE_RSA));
+
+	sc = (struct xlp_rsa_softc *)data;
+	KASSERT(src_id >= sc->rsaecc_vc_start && src_id <= sc->rsaecc_vc_end,
+	    ("%s: bad src_id = %d, expect %d - %d\n", __FUNCTION__,
+	    src_id, sc->rsaecc_vc_start, sc->rsaecc_vc_end));
+
+	cmd = (struct xlp_rsa_command *)(uintptr_t)msg->msg[1];
+	KASSERT(cmd != NULL, ("%s:cmd not received properly\n",
+	    __FUNCTION__));
+
+	KASSERT(RSA_ERROR(msg->msg[0]) == 0,
+	    ("%s: Message rcv msg0 %llx msg1 %llx err %x \n", __FUNCTION__,
+	    (unsigned long long)msg->msg[0], (unsigned long long)msg->msg[1],
+	    (int)RSA_ERROR(msg->msg[0])));
+
+	xlp_rsa_inp2hwformat(((uint8_t *)cmd->rsasrc+
+	    (cmd->rsaopsize*cmd->krp->krp_iparams)),
+	    cmd->krp->krp_param[cmd->krp->krp_iparams].crp_p,
+	    ((cmd->krp->krp_param[cmd->krp->krp_iparams].crp_nbits+7)/8), 1);
+
+	if (cmd->krp != NULL)
+		crypto_kdone(cmd->krp);
+
+	xlp_free_cmd_params(cmd);
+
+	return;
+}
+
+static int
+xlp_rsa_probe(device_t dev)
+{
+	struct xlp_rsa_softc *sc;
+
+	if (pci_get_vendor(dev) == PCI_VENDOR_NETLOGIC &&
+	    pci_get_device(dev) == PCI_DEVICE_ID_NLM_RSA) {
+		sc = device_get_softc(dev);
+		return (BUS_PROBE_DEFAULT);
+	}
+	return (ENXIO);
+}
+
+/*
+ * Attach an interface that successfully probed.
+ */
+static int
+xlp_rsa_attach(device_t dev)
+{
+	struct xlp_rsa_softc *sc = device_get_softc(dev);
+	uint64_t base;
+	int qstart, qnum;
+	int freq, node;
+
+	sc->sc_dev = dev;
+
+	node = nlm_get_device_node(pci_get_slot(dev));
+	freq = nlm_set_device_frequency(node, DFS_DEVICE_RSA, 250);
+	if (bootverbose)
+		device_printf(dev, "RSA Freq: %dMHz\n", freq);
+	if(pci_get_device(dev) == PCI_DEVICE_ID_NLM_RSA) {
+		device_set_desc(dev, "XLP RSA/ECC Accelerator");
+		if ((sc->sc_cid = crypto_get_driverid(dev,
+		    CRYPTOCAP_F_HARDWARE)) < 0) {
+			printf("xlp_rsaecc-err:couldn't get the driver id\n");
+			goto error_exit;
+		}
+		if (crypto_kregister(sc->sc_cid, CRK_MOD_EXP, 0) != 0)
+			printf("register failed for CRK_MOD_EXP\n");
+
+		base = nlm_get_rsa_pcibase(node);
+		qstart = nlm_qidstart(base);
+		qnum = nlm_qnum(base);
+		sc->rsaecc_vc_start = qstart;
+		sc->rsaecc_vc_end = qstart + qnum - 1;
+	}
+	if (xlp_rsa_init(sc, node) != 0)
+		goto error_exit;
+	device_printf(dev, "RSA Initialization complete!\n");
+	return (0);
+
+error_exit:
+	return (ENXIO);
+
+}
+
+/*
+ * Detach an interface that successfully probed.
+ */
+static int
+xlp_rsa_detach(device_t dev)
+{
+	return (0);
+}
+
+/*
+ * Allocate a new 'session' and return an encoded session id.  'sidp'
+ * contains our registration id, and should contain an encoded session
+ * id on successful allocation.
+ */
+static int
+xlp_rsa_newsession(device_t dev, u_int32_t *sidp, struct cryptoini *cri)
+{
+	struct xlp_rsa_softc *sc = device_get_softc(dev);
+	int sesn;
+	struct xlp_rsa_session *ses = NULL;
+
+	if (sidp == NULL || cri == NULL || sc == NULL)
+		return (EINVAL);
+
+	if (sc->sc_sessions == NULL) {
+		ses = sc->sc_sessions = malloc(sizeof(struct xlp_rsa_session),
+		    M_DEVBUF, M_NOWAIT);
+		if (ses == NULL)
+			return (ENOMEM);
+		sesn = 0;
+		sc->sc_nsessions = 1;
+	} else {
+		for (sesn = 0; sesn < sc->sc_nsessions; sesn++) {
+			if (!sc->sc_sessions[sesn].hs_used) {
+				ses = &sc->sc_sessions[sesn];
+				break;
+			}
+		}
+
+		if (ses == NULL) {
+			sesn = sc->sc_nsessions;
+			ses = malloc((sesn + 1)*sizeof(struct xlp_rsa_session),
+			    M_DEVBUF, M_NOWAIT);
+			if (ses == NULL)
+				return (ENOMEM);
+			bcopy(sc->sc_sessions, ses, sesn * sizeof(*ses));
+			bzero(sc->sc_sessions, sesn * sizeof(*ses));
+			free(sc->sc_sessions, M_DEVBUF);
+			sc->sc_sessions = ses;
+			ses = &sc->sc_sessions[sesn];
+			sc->sc_nsessions++;
+		}
+	}
+	bzero(ses, sizeof(*ses));
+	ses->sessionid = sesn;
+	ses->hs_used = 1;
+
+	*sidp = XLP_RSA_SID(device_get_unit(sc->sc_dev), sesn);
+	return (0);
+}
+
+/*
+ * Deallocate a session.
+ * XXX this routine should run a zero'd mac/encrypt key into context ram.
+ * XXX to blow away any keys already stored there.
+ */
+static int
+xlp_rsa_freesession(device_t dev, u_int64_t tid)
+{
+	struct xlp_rsa_softc *sc = device_get_softc(dev);
+	int session;
+	u_int32_t sid = CRYPTO_SESID2LID(tid);
+
+	if (sc == NULL)
+		return (EINVAL);
+
+	session = XLP_RSA_SESSION(sid);
+	if (session >= sc->sc_nsessions)
+		return (EINVAL);
+
+	sc->sc_sessions[session].hs_used = 0;
+	return (0);
+}
+
+static void 
+xlp_free_cmd_params(struct xlp_rsa_command *cmd)
+{
+	if (cmd->rsasrc != NULL)
+		free(cmd->rsasrc, M_DEVBUF);
+	if (cmd != NULL)
+		free(cmd, M_DEVBUF);
+	return;
+}
+
+static int
+xlp_get_rsa_opsize(struct xlp_rsa_command *cmd, unsigned int bits)
+{
+	if (bits == 0)
+		return (-1);
+	/* XLP hardware expects always a fixed size with unused bytes
+	 * zeroed out in the input data */
+	if (bits <= 512) {
+		cmd->rsatype = 0x40;
+		cmd->rsaopsize = (512/8);
+		return (0);
+	} else if ((bits > 512) && (bits <= 1024)) {
+		cmd->rsatype = 0x41;
+		cmd->rsaopsize = (1024/8);
+		return (0);
+	} else if ((bits > 1024) && (bits <= 2048)) {
+		cmd->rsatype = 0x42;
+		cmd->rsaopsize = (2048/8);
+		return (0);
+	} else if ((bits > 2048) && (bits <= 4096)) {
+		cmd->rsatype = 0x43;
+		cmd->rsaopsize = (4096/8);
+		return (0);
+	} else if ((bits > 4096) && (bits <= 8192)) {
+		cmd->rsatype = 0x44;
+		cmd->rsaopsize = (8192/8);
+		return (0);
+	} else {
+		return (-1);
+	}
+}
+
+static int
+xlp_rsa_inp2hwformat(uint8_t *src, uint8_t *dst, uint32_t paramsize,
+    uint8_t result)
+{
+	uint32_t pdwords, pbytes;
+	int i=0, j=0, k=0;
+
+	pdwords = (paramsize / 8);
+	pbytes = (paramsize % 8);
+
+	for (i = 0, k = 0; i < pdwords; i++) {
+		/* copy dwords of inp/hw to hw/out format */
+		for (j = 7; j >= 0; j--, k++)
+			dst[(i*8)+j] = src[k];
+	}
+	if (pbytes) {
+		if (!result) {
+			/* copy rem bytes of input data to hw format */
+			for (j = 7; k < paramsize; j--, k++)
+				dst[(i*8)+j] = src[k];
+		} else {
+			/* copy rem bytes of hw data to exp output format */
+			for (j = 7; k < paramsize; j--, k++)
+				dst[k] = src[(i*8)+j];
+		}
+	}
+
+	return (0);
+}
+
+static int
+nlm_crypto_complete_rsa_request(struct xlp_rsa_softc *sc,
+    struct xlp_rsa_command *cmd)
+{
+	unsigned int fbvc;
+	struct nlm_fmn_msg m;
+	int ret;
+
+	fbvc = nlm_cpuid() / CMS_MAX_VCPU_VC;
+	m.msg[0] = m.msg[1] = m.msg[2] = m.msg[3] = 0;
+
+	m.msg[0] = nlm_crypto_form_rsa_ecc_fmn_entry0(1, cmd->rsatype,
+	    cmd->rsafn, vtophys(cmd->rsasrc));
+	m.msg[1] = nlm_crypto_form_rsa_ecc_fmn_entry1(0, 1, fbvc,
+	    vtophys(cmd->rsasrc + (cmd->rsaopsize * cmd->krp->krp_iparams)));
+	/* Software scratch pad */
+	m.msg[2] = (uintptr_t)cmd;
+
+	/* Send the message to rsa engine vc */
+	ret = nlm_fmn_msgsend(sc->rsaecc_vc_start, 3, FMN_SWCODE_RSA, &m);
+        if (ret != 0) {
+#ifdef NLM_SEC_DEBUG
+                printf("%s: msgsnd failed (%x)\n", __func__, ret);
+#endif
+		return (ERESTART);
+        }
+	return (0);
+}
+
+static int
+xlp_rsa_kprocess(device_t dev, struct cryptkop *krp, int hint)
+{
+	struct xlp_rsa_softc *sc = device_get_softc(dev);
+	struct xlp_rsa_command *cmd = NULL;
+	int err = -1, i;
+
+	if (krp == NULL || krp->krp_callback == NULL)
+		return (EINVAL);
+
+	if ((cmd = malloc(sizeof(struct xlp_rsa_command), M_DEVBUF,
+	    M_NOWAIT | M_ZERO)) == NULL) {
+		err = ENOMEM;
+		goto errout;
+	}
+	cmd->krp = krp;
+
+#ifdef NLM_RSA_DEBUG
+	print_krp_params(krp);
+#endif
+	switch (krp->krp_op) {
+	case CRK_MOD_EXP:
+		if (krp->krp_iparams == 3 && krp->krp_oparams == 1)
+			break;
+		goto errout;
+	default:
+		printf("Op:%d not yet supported\n", krp->krp_op);
+		goto errout;
+	}
+
+	if ((xlp_get_rsa_opsize(cmd,
+	    krp->krp_param[krp->krp_iparams-1].crp_nbits)) != 0) {
+		err = EINVAL;
+		goto errout;
+	}
+	cmd->rsafn = 0; /* Mod Exp */
+	if ((cmd->rsasrc = malloc((cmd->rsaopsize *
+	    (krp->krp_iparams+krp->krp_oparams)), M_DEVBUF,
+	    M_NOWAIT | M_ZERO)) == NULL) {
+		err = ENOMEM;
+		goto errout;
+	}
+	if (((uintptr_t)cmd->rsasrc & (XLP_L2L3_CACHELINE_SIZE - 1))) {
+		err = EINVAL;
+		goto errout;
+	}
+
+	for (i=0;ikrp_iparams;i++) {
+		KASSERT(krp->krp_param[i].crp_nbits != 0,
+		    ("%s: parameter[%d]'s length is zero\n", __FUNCTION__, i));
+		xlp_rsa_inp2hwformat(krp->krp_param[i].crp_p,
+		    ((uint8_t *)cmd->rsasrc+(i*cmd->rsaopsize)),
+		    ((krp->krp_param[i].crp_nbits+7)/8), 0);
+	}
+	if (nlm_crypto_complete_rsa_request(sc, cmd) != 0)
+		goto errout;
+
+	return (0);
+errout:
+	xlp_free_cmd_params(cmd);
+	krp->krp_status = err;
+	crypto_kdone(krp);
+	return (err);
+}

Added: head/sys/mips/nlm/dev/sec/nlmrsalib.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sys/mips/nlm/dev/sec/nlmrsalib.h	Tue Mar 27 11:43:46 2012	(r233541)
@@ -0,0 +1,68 @@
+/*-
+ * Copyright (c) 2003-2012 Broadcom Corporation
+ * All Rights Reserved
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY BROADCOM ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL BROADCOM OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+#ifndef _NLMRSALIB_H_
+#define _NLMRSALIB_H_
+
+#define XLP_RSA_SESSION(sid)   ((sid) & 0x000007ff)
+#define XLP_RSA_SID(crd,ses)   (((crd) << 28) | ((ses) & 0x7ff))
+
+#define	NUM_RSAECC_VC	9
+
+#define	RSA_ERROR(__msg0) ((__msg0 >> 53) & 0x1f)
+
+struct xlp_rsa_session {
+	uint32_t sessionid;
+	int hs_used;
+};
+
+struct xlp_rsa_command {
+	uint16_t session_num;
+	struct xlp_rsa_session *ses;
+	struct cryptkop *krp;
+	uint8_t *rsasrc;
+	uint32_t rsaopsize;
+	uint32_t rsatype;
+	uint32_t rsafn;
+};
+
+/*
+ * Holds data specific to nlm security accelerators
+ */
+struct xlp_rsa_softc {
+	device_t sc_dev;	/* device backpointer */
+	uint64_t rsa_base;
+	int sc_cid;
+	struct xlp_rsa_session *sc_sessions;
+	int sc_nsessions;
+	int rsaecc_vc_start;
+	int rsaecc_vc_end;
+};
+
+#endif /* _NLMRSALIB_H_ */

Added: head/sys/mips/nlm/dev/sec/nlmsec.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sys/mips/nlm/dev/sec/nlmsec.c	Tue Mar 27 11:43:46 2012	(r233541)
@@ -0,0 +1,850 @@
+/*-
+ * Copyright (c) 2003-2012 Broadcom Corporation
+ * All Rights Reserved
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY BROADCOM ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL BROADCOM OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#include 
+
+#include "cryptodev_if.h"
+
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+unsigned int creditleft;
+
+void xlp_sec_print_data(struct cryptop *crp);
+
+static	int xlp_sec_init(struct xlp_sec_softc *sc);
+static	int xlp_sec_newsession(device_t , uint32_t *, struct cryptoini *);
+static	int xlp_sec_freesession(device_t , uint64_t);
+static	int xlp_sec_process(device_t , struct cryptop *, int);
+static  int xlp_copyiv(struct xlp_sec_softc *, struct xlp_sec_command *,
+    struct cryptodesc *enccrd);
+static int xlp_get_nsegs(struct cryptop *, unsigned int *);
+static int xlp_alloc_cmd_params(struct xlp_sec_command *, unsigned int);
+static void  xlp_free_cmd_params(struct xlp_sec_command *);
+
+static	int xlp_sec_probe(device_t);
+static	int xlp_sec_attach(device_t);
+static	int xlp_sec_detach(device_t);
+
+static device_method_t xlp_sec_methods[] = {
+	/* device interface */
+	DEVMETHOD(device_probe, xlp_sec_probe),
+	DEVMETHOD(device_attach, xlp_sec_attach),
+	DEVMETHOD(device_detach, xlp_sec_detach),
+
+	/* bus interface */
+	DEVMETHOD(bus_print_child, bus_generic_print_child),
+	DEVMETHOD(bus_driver_added, bus_generic_driver_added),
+
+	/* crypto device methods */
+	DEVMETHOD(cryptodev_newsession, xlp_sec_newsession),
+	DEVMETHOD(cryptodev_freesession,xlp_sec_freesession),
+	DEVMETHOD(cryptodev_process,    xlp_sec_process),
+
+	DEVMETHOD_END
+};
+
+static driver_t xlp_sec_driver = {
+	"nlmsec",
+	xlp_sec_methods,
+	sizeof(struct xlp_sec_softc)
+};
+static devclass_t xlp_sec_devclass;
+
+DRIVER_MODULE(nlmsec, pci, xlp_sec_driver, xlp_sec_devclass, 0, 0);
+MODULE_DEPEND(nlmsec, crypto, 1, 1, 1);
+
+void
+nlm_xlpsec_msgring_handler(int vc, int size, int code, int src_id, 
+    struct nlm_fmn_msg *msg, void *data);
+
+#ifdef NLM_SEC_DEBUG
+
+#define extract_bits(x, bitshift, bitcnt) 				\
+    (((unsigned long long)x >> bitshift) & ((1ULL << bitcnt) - 1))
+
+void
+print_crypto_params(struct xlp_sec_command *cmd, struct nlm_fmn_msg m)
+{
+	unsigned long long msg0,msg1,msg2,msg3,msg4,msg5,msg6,msg7,msg8;
+
+	msg0 = cmd->ctrlp->desc0;
+	msg1 = cmd->paramp->desc0;
+	msg2 = cmd->paramp->desc1;
+	msg3 = cmd->paramp->desc2;
+	msg4 = cmd->paramp->desc3;
+	msg5 = cmd->paramp->segment[0][0];
+	msg6 = cmd->paramp->segment[0][1];
+	msg7 = m.msg[0];
+	msg8 = m.msg[1];
+
+	printf("msg0 %llx msg1 %llx msg2 %llx msg3 %llx msg4 %llx msg5 %llx"
+	    "msg6 %llx msg7 %llx msg8 %llx\n", msg0, msg1, msg2, msg3, msg4,
+	    msg5, msg6, msg7, msg8);
+
+	printf("c0: hmac %d htype %d hmode %d ctype %d cmode %d arc4 %x\n",
+	    (unsigned int)extract_bits(msg0, 61, 1),
+	    (unsigned int)extract_bits(msg0, 52, 8),
+	    (unsigned int)extract_bits(msg0, 43, 8),
+	    (unsigned int)extract_bits(msg0, 34, 8),
+	    (unsigned int)extract_bits(msg0, 25, 8),
+	    (unsigned int)extract_bits(msg0, 0, 23));
+
+	printf("p0: tls %d hsrc %d hl3 %d enc %d ivl %d hd %llx\n",
+	    (unsigned int)extract_bits(msg1, 63, 1),
+	    (unsigned int)extract_bits(msg1,62,1),
+	    (unsigned int)extract_bits(msg1,60,1),
+	    (unsigned int)extract_bits(msg1,59,1),
+	    (unsigned int)extract_bits(msg1,41,16), extract_bits(msg1,0,40));
+
+	printf("p1: clen %u hl %u\n",  (unsigned int)extract_bits(msg2, 32, 32),
+	    (unsigned int)extract_bits(msg2,0,32));
+
+	printf("p2: ivoff %d cbit %d coff %d hbit %d hclb %d hoff %d\n",
+	    (unsigned int)extract_bits(msg3, 45, 17),
+	    (unsigned int)extract_bits(msg3, 42,3),
+	    (unsigned int)extract_bits(msg3, 22,16),
+	    (unsigned int)extract_bits(msg3, 19,3),
+	    (unsigned int)extract_bits(msg3, 18,1),
+	    (unsigned int)extract_bits(msg3, 0, 16));
+
+	printf("p3: desfbid %d tlen %d arc4 %x hmacpad %d\n",
+	    (unsigned int)extract_bits(msg4, 48,16),
+	    (unsigned int)extract_bits(msg4,11,16),
+	    (unsigned int)extract_bits(msg4,6,3),
+	    (unsigned int)extract_bits(msg4,5,1));
+
+	printf("p4: sflen %d sddr %llx \n",
+	    (unsigned int)extract_bits(msg5, 48, 16),extract_bits(msg5, 0, 40));
+
+	printf("p5: dflen %d cl3 %d cclob %d cdest %llx \n",
+	    (unsigned int)extract_bits(msg6, 48, 16),
+	    (unsigned int)extract_bits(msg6, 46, 1),
+	    (unsigned int)extract_bits(msg6, 41, 1), extract_bits(msg6, 0, 40));
+
+	printf("fmn0: fbid %d dfrlen %d dfrv %d cklen %d cdescaddr %llx\n",
+	    (unsigned int)extract_bits(msg7, 48, 16),
+	    (unsigned int)extract_bits(msg7,46,2),
+	    (unsigned int)extract_bits(msg7,45,1),
+	    (unsigned int)extract_bits(msg7,40,5),
+	    (extract_bits(msg7,0,34)<< 6));
+
+	printf("fmn1: arc4 %d hklen %d pdesclen %d pktdescad %llx\n",
+	    (unsigned int)extract_bits(msg8, 63, 1),
+	    (unsigned int)extract_bits(msg8,56,5),
+	    (unsigned int)extract_bits(msg8,43,12),
+	    (extract_bits(msg8,0,34) << 6));
+
+	return;
+}
+
+void 
+xlp_sec_print_data(struct cryptop *crp)
+{
+	int i, key_len;
+	struct cryptodesc *crp_desc;
+
+	printf("session id = 0x%llx, crp_ilen = %d, crp_olen=%d \n",
+	    crp->crp_sid, crp->crp_ilen, crp->crp_olen);
+
+	printf("crp_flags = 0x%x\n", crp->crp_flags);
+
+	printf("crp buf:\n");
+	for (i = 0; i < crp->crp_ilen; i++) {
+		printf("%c  ", crp->crp_buf[i]);
+		if (i % 10 == 0)
+			printf("\n");
+	}
+
+	printf("\n");
+	printf("****************** desc ****************\n");
+	crp_desc = crp->crp_desc;
+	printf("crd_skip=%d, crd_len=%d, crd_flags=0x%x, crd_alg=%d\n",
+	    crp_desc->crd_skip, crp_desc->crd_len, crp_desc->crd_flags,
+	    crp_desc->crd_alg);
+
+	key_len = crp_desc->crd_klen / 8;
+	printf("key(%d) :\n", key_len);
+	for (i = 0; i < key_len; i++)
+		printf("%d", crp_desc->crd_key[i]);
+	printf("\n");
+
+	printf(" IV : \n");
+	for (i = 0; i < EALG_MAX_BLOCK_LEN; i++)
+		printf("%d", crp_desc->crd_iv[i]);
+	printf("\n");
+
+	printf("crd_next=%p\n", crp_desc->crd_next);
+	return;
+}
+
+void
+print_cmd(struct xlp_sec_command *cmd)
+{
+	printf("session_num		:%d\n",cmd->session_num);
+	printf("crp			:0x%x\n",(uint32_t)cmd->crp);
+	printf("enccrd			:0x%x\n",(uint32_t)cmd->enccrd);
+	printf("maccrd			:0x%x\n",(uint32_t)cmd->maccrd);
+	printf("ses			:%d\n",(uint32_t)cmd->ses);
+	printf("ctrlp			:0x%x\n",(uint32_t)cmd->ctrlp);
+	printf("paramp			:0x%x\n",(uint32_t)cmd->paramp);
+	printf("hashdest		:0x%x\n",(uint32_t)cmd->hashdest);
+	printf("hashsrc			:%d\n",cmd->hashsrc);
+	printf("hmacpad			:%d\n",cmd->hmacpad);
+	printf("hashoff			:%d\n",cmd->hashoff);
+	printf("hashlen			:%d\n",cmd->hashlen);
+	printf("cipheroff		:%d\n",cmd->cipheroff);
+	printf("cipherlen		:%d\n",cmd->cipherlen);
+	printf("ivoff			:%d\n",cmd->ivoff);
+	printf("ivlen			:%d\n",cmd->ivlen);
+	printf("hashalg			:%d\n",cmd->hashalg);
+	printf("hashmode		:%d\n",cmd->hashmode);
+	printf("cipheralg		:%d\n",cmd->cipheralg);
+	printf("ciphermode		:%d\n",cmd->ciphermode);
+	printf("nsegs     		:%d\n",cmd->nsegs);
+	printf("hash_dst_len		:%d\n",cmd->hash_dst_len);
+}
+#endif /* NLM_SEC_DEBUG */
+
+static int 
+xlp_sec_init(struct xlp_sec_softc *sc)
+{
+
+	/* Register interrupt handler for the SEC CMS messages */
+	if (register_msgring_handler(sc->sec_vc_start,
+	    sc->sec_vc_end, nlm_xlpsec_msgring_handler, sc) != 0) {
+		printf("Couldn't register sec msgring handler\n");
+		return (-1);
+	}
+
+	/* Do the CMS credit initialization */
+	/* Currently it is configured by default to 50 when kernel comes up */
+
+	return (0);
+}
+
+/* This function is called from an interrupt handler */
+void
+nlm_xlpsec_msgring_handler(int vc, int size, int code, int src_id,
+    struct nlm_fmn_msg *msg, void *data)
+{
+	struct xlp_sec_command *cmd = NULL;
+	struct xlp_sec_softc *sc = NULL;
+	struct cryptodesc *crd = NULL;
+	unsigned int ivlen = 0;
+
+	KASSERT(code == FMN_SWCODE_CRYPTO,
+	    ("%s: bad code = %d, expected code = %d\n", __FUNCTION__,
+	    code, FMN_SWCODE_CRYPTO));
+
+	sc = (struct xlp_sec_softc *)data;
+	KASSERT(src_id >= sc->sec_vc_start && src_id <= sc->sec_vc_end,
+	    ("%s: bad src_id = %d, expect %d - %d\n", __FUNCTION__,
+	    src_id, sc->sec_vc_start, sc->sec_vc_end));
+
+	cmd = (struct xlp_sec_command *)(uintptr_t)msg->msg[0];
+	KASSERT(cmd != NULL && cmd->crp != NULL,
+		("%s :cmd not received properly\n",__FUNCTION__));
+
+	KASSERT(CRYPTO_ERROR(msg->msg[1]) == 0,
+	    ("%s: Message rcv msg0 %llx msg1 %llx err %x \n", __FUNCTION__,
+	    (unsigned long long)msg->msg[0], (unsigned long long)msg->msg[1],
+	    (int)CRYPTO_ERROR(msg->msg[1])));
+
+	crd = cmd->enccrd;
+	/* Copy the last 8 or 16 bytes to the session iv, so that in few
+	 * cases this will be used as IV for the next request
+	 */
+	if (crd != NULL) {
+		if ((crd->crd_alg == CRYPTO_DES_CBC ||
+		    crd->crd_alg == CRYPTO_3DES_CBC ||
+		    crd->crd_alg == CRYPTO_AES_CBC) &&
+		    (crd->crd_flags & CRD_F_ENCRYPT)) {
+			ivlen = ((crd->crd_alg == CRYPTO_AES_CBC) ?
+			    XLP_SEC_AES_IV_LENGTH : XLP_SEC_DES_IV_LENGTH);
+			crypto_copydata(cmd->crp->crp_flags, cmd->crp->crp_buf,
+			    crd->crd_skip + crd->crd_len - ivlen, ivlen,
+			    sc->sc_sessions[cmd->session_num].ses_iv);
+		}
+	}
+
+	/* If there are not enough credits to send, then send request
+	 * will fail with ERESTART and the driver will be blocked until it is
+	 * unblocked here after knowing that there are sufficient credits to
+	 * send the request again.
+	 */
+	if (sc->sc_needwakeup) {
+		atomic_add_int(&creditleft, sc->sec_msgsz);
+		if (creditleft >= (NLM_CRYPTO_LEFT_REQS)) {
+			crypto_unblock(sc->sc_cid, sc->sc_needwakeup);
+			sc->sc_needwakeup &= (~(CRYPTO_SYMQ | CRYPTO_ASYMQ));
+		}
+	}
+	if(cmd->maccrd) {
+		crypto_copyback(cmd->crp->crp_flags,
+		    cmd->crp->crp_buf, cmd->maccrd->crd_inject,
+		    cmd->hash_dst_len, cmd->hashdest);
+	}
+
+	/* This indicates completion of the crypto operation */
+	crypto_done(cmd->crp);
+
+	xlp_free_cmd_params(cmd);

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***

From owner-svn-src-head@FreeBSD.ORG  Tue Mar 27 12:25:48 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 29FA6106566C;
	Tue, 27 Mar 2012 12:25:48 +0000 (UTC)
	(envelope-from jchandra@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 127BC8FC08;
	Tue, 27 Mar 2012 12:25:48 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2RCPmK9085647;
	Tue, 27 Mar 2012 12:25:48 GMT
	(envelope-from jchandra@svn.freebsd.org)
Received: (from jchandra@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2RCPlji085639;
	Tue, 27 Mar 2012 12:25:47 GMT
	(envelope-from jchandra@svn.freebsd.org)
Message-Id: <201203271225.q2RCPlji085639@svn.freebsd.org>
From: "Jayachandran C." 
Date: Tue, 27 Mar 2012 12:25:47 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233542 - in head/sys/mips/nlm: . hal
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 27 Mar 2012 12:25:48 -0000

Author: jchandra
Date: Tue Mar 27 12:25:47 2012
New Revision: 233542
URL: http://svn.freebsd.org/changeset/base/233542

Log:
  Support for EEPROM and CPLD on XLP EVP boards.
  
  On XLP evaluation platform, the board information is stored
  in an I2C eeprom and the network block configuration is available
  from a CPLD connected to the GBU (NOR flash bus). Add support
  for both of these.

Added:
  head/sys/mips/nlm/board_cpld.c   (contents, props changed)
  head/sys/mips/nlm/board_eeprom.c   (contents, props changed)
  head/sys/mips/nlm/hal/gbu.h   (contents, props changed)
Modified:
  head/sys/mips/nlm/board.c
  head/sys/mips/nlm/board.h
  head/sys/mips/nlm/files.xlp
  head/sys/mips/nlm/msgring.h

Modified: head/sys/mips/nlm/board.c
==============================================================================
--- head/sys/mips/nlm/board.c	Tue Mar 27 11:43:46 2012	(r233541)
+++ head/sys/mips/nlm/board.c	Tue Mar 27 12:25:47 2012	(r233542)
@@ -36,44 +36,104 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+#include 
+
 #include 
 #include 
 #include 
 #include 
 #include 
+#include 
 #include 
 
+#include 
 #include 
 
+static uint8_t board_eeprom_buf[EEPROM_SIZE];
+static int board_eeprom_set;
+
 struct xlp_board_info xlp_board_info;
 
-int nlm_setup_xlp_board(void);
+static void
+nlm_print_processor_info(void)
+{
+	uint32_t procid;
+	int prid, rev;
+	char *chip, *revstr;
+
+	procid = mips_rd_prid();
+	prid = (procid >> 8) & 0xff;
+	rev = procid & 0xff;
+
+	switch (prid) {
+	case CHIP_PROCESSOR_ID_XLP_8XX:
+		chip = "XLP 832";
+		break;
+	case CHIP_PROCESSOR_ID_XLP_3XX:
+		chip = "XLP 3xx";
+		break;
+	case CHIP_PROCESSOR_ID_XLP_432:
+	case CHIP_PROCESSOR_ID_XLP_416:
+		chip = "XLP 4xx";
+		break;
+	default:
+		chip = "XLP ?xx";
+		break;
+	}
+	switch (rev) {
+	case 0:
+		revstr = "A0"; break;
+	case 1:
+		revstr = "A1"; break;
+	case 2:
+		revstr = "A2"; break;
+	case 3:
+		revstr = "B0"; break;
+	default:
+		revstr = "??"; break;
+	}
+
+	printf("Processor info:\n");
+	printf("  Netlogic %s %s [%x]\n", chip, revstr, procid);
+}
 
 /*
- * All our knowledge of chip and board that cannot be detected by probing
+ * All our knowledge of chip and board that cannot be detected by probing 
  * at run-time goes here
  */
-
-int
+static int
 nlm_setup_xlp_board(void)
 {
 	struct xlp_board_info	*boardp;
-	int	node;
+	int rv;
+	uint8_t *b;
 
 	/* start with a clean slate */
 	boardp = &xlp_board_info;
-	memset(boardp, 0, sizeof(xlp_board_info));
+	memset(boardp, 0, sizeof(*boardp));
 	boardp->nodemask = 0x1;	/* only node 0 */
+	nlm_print_processor_info();
 
-	for (node = 0; node < XLP_MAX_NODES; node++) {
-		if ((boardp->nodemask & (1 << node)) == 0)
-			continue;
-	}
-	return 0;
+	b =  board_eeprom_buf;
+	rv = nlm_board_eeprom_read(0, EEPROM_I2CBUS, EEPROM_I2CADDR, 0, b,
+	    EEPROM_SIZE);
+	if (rv == 0) {
+		board_eeprom_set = 1;
+		printf("Board info (EEPROM on i2c@%d at %#X):\n",
+		    EEPROM_I2CBUS, EEPROM_I2CADDR);
+		printf("  Model:      %7.7s %2.2s\n", &b[16], &b[24]);
+		printf("  Serial #:   %3.3s-%2.2s\n", &b[27], &b[31]);
+		printf("  MAC addr:   %02x:%02x:%02x:%02x:%02x:%02x\n",
+		    b[2], b[3], b[4], b[5], b[6], b[7]);
+	} else
+		printf("Board Info: Error on EEPROM read (i2c@%d %#X).\n",
+		    EEPROM_I2CBUS, EEPROM_I2CADDR);
+
+	return (0);
 }
 
-int nlm_board_info_setup()
+int nlm_board_info_setup(void)
 {
 	nlm_setup_xlp_board();
-	return 0;
+	return (0);
 }

Modified: head/sys/mips/nlm/board.h
==============================================================================
--- head/sys/mips/nlm/board.h	Tue Mar 27 11:43:46 2012	(r233541)
+++ head/sys/mips/nlm/board.h	Tue Mar 27 12:25:47 2012	(r233542)
@@ -5,7 +5,7 @@
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are
  * met:
- *
+ * 
  * 1. Redistributions of source code must retain the above copyright
  *    notice, this list of conditions and the following disclaimer.
  * 2. Redistributions in binary form must reproduce the above copyright
@@ -32,15 +32,19 @@
 #ifndef __NLM_BOARD_H__
 #define __NLM_BOARD_H__
 
-#define XLP_NAE_NBLOCKS		5
-#define XLP_NAE_NPORTS		4
+#define	XLP_NAE_NBLOCKS		5
+#define	XLP_NAE_NPORTS		4
 #define	XLP_I2C_MAXDEVICES	8
 
-struct xlp_i2c_devinfo {
-	u_int	addr;		/* keep first, for i2c ivars to work */
-	int	bus;
-	char	*device;
-};
+/*
+ * EVP board EEPROM info
+ */
+#define	EEPROM_I2CBUS		1
+#define	EEPROM_I2CADDR		0xAE
+#define	EEPROM_SIZE	 	48
+#define	EEPROM_MACADDR_OFFSET	2
+
+#if !defined(LOCORE) && !defined(__ASSEMBLY__)
 
 struct xlp_port_ivars {
 	int	port;
@@ -65,12 +69,19 @@ struct xlp_nae_ivars {
 struct xlp_board_info {
 	u_int	nodemask;
 	struct xlp_node_info {
-		struct xlp_i2c_devinfo	i2c_devs[XLP_I2C_MAXDEVICES];
 		struct xlp_nae_ivars	nae_ivars;
 	} nodes[XLP_MAX_NODES];
 };
 
-extern struct xlp_board_info xlp_board_info;
 int nlm_board_info_setup(void);
 
+int nlm_board_eeprom_read(int node, int i2cbus, int addr, int offs,
+    uint8_t *buf,int sz);
+uint64_t nlm_board_cpld_base(int node, int chipselect);
+int nlm_board_cpld_majorversion(uint64_t cpldbase);
+int nlm_board_cpld_minorversion(uint64_t cpldbase);
+void nlm_board_cpld_reset(uint64_t cpldbase);
+int nlm_board_cpld_dboard_type(uint64_t cpldbase, int slot);
+#endif
+
 #endif

Added: head/sys/mips/nlm/board_cpld.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sys/mips/nlm/board_cpld.c	Tue Mar 27 12:25:47 2012	(r233542)
@@ -0,0 +1,113 @@
+/*-
+ * Copyright (c) 2003-2012 Broadcom Corporation
+ * All Rights Reserved
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY BROADCOM ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL BROADCOM OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#define CPLD_REVISION		0x0
+#define CPLD_RESET		0x1
+#define CPLD_CTRL		0x2
+#define CPLD_RSVD		0x3
+#define CPLD_PWR_CTRL		0x4
+#define CPLD_MISC		0x5
+#define CPLD_CTRL_STATUS	0x6
+#define CPLD_PWR_INTR_STATUS	0x7
+#define CPLD_DATA		0x8
+
+static __inline
+int nlm_cpld_read(uint64_t base, int reg)
+{
+	uint16_t val;
+
+	val = *(volatile uint16_t *)(long)(base + reg * 2);
+	return bswap16(val);
+}
+
+static __inline void
+nlm_cpld_write(uint64_t base, int reg, uint16_t data)
+{
+	bswap16(data);
+	*(volatile uint16_t *)(long)(base + reg * 2) = data;
+}
+
+int
+nlm_board_cpld_majorversion(uint64_t base)
+{
+	return (nlm_cpld_read(base, CPLD_REVISION) >> 8);
+}
+
+int
+nlm_board_cpld_minorversion(uint64_t base)
+{
+	return (nlm_cpld_read(base, CPLD_REVISION) & 0xff);
+}
+
+uint64_t nlm_board_cpld_base(int node, int chipselect)
+{
+	uint64_t gbubase, cpld_phys;
+
+	gbubase = nlm_get_gbu_regbase(node);
+	cpld_phys = nlm_read_gbu_reg(gbubase, GBU_CS_BASEADDR(chipselect));
+	return (MIPS_PHYS_TO_KSEG1(cpld_phys << 8));
+}
+
+void
+nlm_board_cpld_reset(uint64_t base)
+{
+
+	nlm_cpld_write(base, CPLD_RESET, 1 << 15);
+	for(;;)
+		__asm __volatile("wait");
+}
+
+/* get daughter board type */
+int
+nlm_board_cpld_dboard_type(uint64_t base, int slot)
+{
+	uint16_t val;
+	int shift = 0;
+
+	switch (slot) {
+	case 0: shift = 0; break;
+	case 1: shift = 4; break;
+	case 2: shift = 2; break;
+	case 3: shift = 6; break;
+	}
+	val = nlm_cpld_read(base, CPLD_CTRL_STATUS) >> shift;
+	return (val & 0x3);
+}

Added: head/sys/mips/nlm/board_eeprom.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sys/mips/nlm/board_eeprom.c	Tue Mar 27 12:25:47 2012	(r233542)
@@ -0,0 +1,172 @@
+/*-
+ * Copyright (c) 2003-2012 Broadcom Corporation
+ * All Rights Reserved
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY BROADCOM ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL BROADCOM OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#include 
+#include 
+#include  /* needed by board.h */
+
+#include 
+
+/*
+ * We have to read the EEPROM in early boot (now only for MAC addr)
+ * but later for board information.  Use simple polled mode driver
+ * for I2C
+ */
+#define	oc_read_reg(reg)	nlm_read_reg(eeprom_i2c_base, reg)
+#define	oc_write_reg(reg, val)	nlm_write_reg(eeprom_i2c_base, reg, val)
+
+static uint64_t eeprom_i2c_base;
+
+static int
+oc_wait_on_status(uint8_t bit)
+{
+	int tries = I2C_TIMEOUT;
+	uint8_t status;
+
+	do {
+		status = oc_read_reg(OC_I2C_STATUS_REG);
+	} while ((status & bit) != 0 && --tries > 0);
+
+	return (tries == 0 ? -1: 0);
+}
+
+static int
+oc_rd_cmd(uint8_t cmd)
+{
+	uint8_t data;
+
+		oc_write_reg(OC_I2C_CMD_REG, cmd);
+		if (oc_wait_on_status(OC_STATUS_TIP) < 0)
+			return (-1);
+
+	data = oc_read_reg(OC_I2C_DATA_REG);
+	return (data);
+}
+ 
+static int
+oc_wr_cmd(uint8_t data, uint8_t cmd)
+{
+	oc_write_reg(OC_I2C_DATA_REG, data);
+	oc_write_reg(OC_I2C_CMD_REG, cmd);
+
+	if (oc_wait_on_status(OC_STATUS_TIP) < 0)
+		return (-1);
+	return (0);
+}
+
+int
+nlm_board_eeprom_read(int node, int bus, int addr, int offs, uint8_t *buf,
+    int sz)
+{
+	int rd, i;
+	char *err = NULL;
+
+	eeprom_i2c_base = nlm_pcicfg_base(XLP_IO_I2C_OFFSET(node, bus)) +
+	    XLP_IO_PCI_HDRSZ;
+
+	if (oc_wait_on_status(OC_STATUS_BUSY) < 0) {
+		err = "Not idle";
+		goto err_exit;
+	}
+
+	/* write start */
+	if (oc_wr_cmd(addr, OC_COMMAND_START)) {
+		err = "I2C write start failed.";
+		goto err_exit;
+	}
+
+	if (oc_read_reg(OC_I2C_STATUS_REG) & OC_STATUS_NACK) {
+		err = "No ack after start";
+		goto err_exit_stop;
+	}
+
+	if (oc_read_reg(OC_I2C_STATUS_REG) & OC_STATUS_AL) {
+		err = "I2C Bus Arbitration Lost";
+		goto err_exit_stop;
+	}
+
+	/* Write offset */
+	if (oc_wr_cmd(offs, OC_COMMAND_WRITE)) {
+		err = "I2C write slave offset failed.";
+		goto err_exit_stop;
+	}
+
+	if (oc_read_reg(OC_I2C_STATUS_REG) & OC_STATUS_NACK) {
+		err = "No ack after write";
+		goto err_exit_stop;
+	}
+
+	/* read start */
+	if (oc_wr_cmd(addr | 1, OC_COMMAND_START)) {
+		err = "I2C read start failed.";
+		goto err_exit_stop;
+	}
+
+	if (oc_read_reg(OC_I2C_STATUS_REG) & OC_STATUS_NACK) {
+		err = "No ack after read start";
+		goto err_exit_stop;
+	}
+	
+	for (i = 0; i < sz - 1; i++) {
+		if ((rd = oc_rd_cmd(OC_COMMAND_READ)) < 0) {
+			err = "I2C read data byte failed.";
+			goto err_exit_stop;
+		}
+	buf[i] = rd;
+	}
+
+	/* last byte */
+	if ((rd = oc_rd_cmd(OC_COMMAND_RDNACK)) < 0) {
+		err = "I2C read last data byte failed.";
+		goto err_exit_stop;
+	}
+	buf[sz - 1] = rd;
+
+err_exit_stop:
+	oc_write_reg(OC_I2C_CMD_REG, OC_COMMAND_STOP);
+	if (oc_wait_on_status(OC_STATUS_BUSY) < 0)
+		printf("%s: stop failed", __func__);
+
+err_exit:
+	if (err) {
+		printf("%s: Failed (%s)\n", __func__, err);
+		return (-1);
+	}
+	return (0);
+}

Modified: head/sys/mips/nlm/files.xlp
==============================================================================
--- head/sys/mips/nlm/files.xlp	Tue Mar 27 11:43:46 2012	(r233541)
+++ head/sys/mips/nlm/files.xlp	Tue Mar 27 12:25:47 2012	(r233542)
@@ -9,6 +9,8 @@ mips/nlm/cms.c					standard
 mips/nlm/bus_space_rmi.c			standard
 mips/nlm/bus_space_rmi_pci.c			standard
 mips/nlm/mpreset.S				standard
+mips/nlm/board_eeprom.c				standard
+mips/nlm/board_cpld.c				standard
 mips/nlm/xlp_pci.c				optional pci
 mips/nlm/intern_dev.c				optional pci
 mips/nlm/uart_pci_xlp.c				optional uart

Added: head/sys/mips/nlm/hal/gbu.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sys/mips/nlm/hal/gbu.h	Tue Mar 27 12:25:47 2012	(r233542)
@@ -0,0 +1,100 @@
+/*-
+ * Copyright (c) 2003-2012 Broadcom Corporation
+ * All Rights Reserved
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY BROADCOM ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL BROADCOM OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+#ifndef _NLM_HAL_GBU_H__
+#define	_NLM_HAL_GBU_H__
+
+/* Global Bus Unit (GBU) for flash Specific registers */
+
+#define	GBU_CS_BASEADDR(cs)	(0x0+cs)
+#define	GBU_CS0_BASEADDR	0x0
+#define	GBU_CS1_BASEADDR	0x1
+#define	GBU_CS2_BASEADDR	0x2
+#define	GBU_CS3_BASEADDR	0x3
+#define	GBU_CS4_BASEADDR	0x4
+#define	GBU_CS5_BASEADDR	0x5
+#define	GBU_CS6_BASEADDR	0x6
+#define	GBU_CS7_BASEADDR	0x7
+#define	GBU_CS_BASELIMIT(cs)	(0x8+cs)
+#define	GBU_CS0_BASELIMIT	0x8
+#define	GBU_CS1_BASELIMIT	0x9
+#define	GBU_CS2_BASELIMIT	0xa
+#define	GBU_CS3_BASELIMIT	0xb
+#define	GBU_CS4_BASELIMIT	0xc
+#define	GBU_CS5_BASELIMIT	0xd
+#define	GBU_CS6_BASELIMIT	0xe
+#define	GBU_CS7_BASELIMIT	0xf
+#define	GBU_CS_DEVPARAM(cs)	(0x10+cs)
+#define	GBU_CS0_DEVPARAM	0x10
+#define	GBU_CS1_DEVPARAM	0x11
+#define	GBU_CS2_DEVPARAM	0x12
+#define	GBU_CS3_DEVPARAM	0x13
+#define	GBU_CS4_DEVPARAM	0x14
+#define	GBU_CS5_DEVPARAM	0x15
+#define	GBU_CS6_DEVPARAM	0x16
+#define	GBU_CS7_DEVPARAM	0x17
+#define	GBU_CS_DEVTIME0(cs)	(0x18+cs)
+#define	GBU_CS0_DEVTIME0	0x18
+#define	GBU_CS1_DEVTIME0	0x1a
+#define	GBU_CS2_DEVTIME0	0x1c
+#define	GBU_CS3_DEVTIME0	0x1e
+#define	GBU_CS4_DEVTIME0	0x20
+#define	GBU_CS5_DEVTIME0	0x22
+#define	GBU_CS6_DEVTIME0	0x24
+#define	GBU_CS7_DEVTIME0	0x26
+#define	GBU_CS_DEVTIME1(cs)	(0x19+cs)
+#define	GBU_CS0_DEVTIME1	0x19
+#define	GBU_CS1_DEVTIME1	0x1b
+#define	GBU_CS2_DEVTIME1	0x1d
+#define	GBU_CS3_DEVTIME1	0x1f
+#define	GBU_CS4_DEVTIME1	0x21
+#define	GBU_CS5_DEVTIME1	0x23
+#define	GBU_CS6_DEVTIME1	0x25
+#define	GBU_CS7_DEVTIME1	0x27
+#define	GBU_SYSCTRL		0x28
+#define	GBU_BYTESWAP		0x29
+#define	GBU_DI_TIMEOUT_VAL	0x2d
+#define	GBU_INTSTAT		0x2e
+#define	GBU_INTEN		0x2f
+#define	GBU_STATUS		0x30
+#define	GBU_ERRLOG0		0x2a
+#define	GBU_ERRLOG1		0x2b
+#define	GBU_ERRLOG2		0x2c
+
+#if !defined(LOCORE) && !defined(__ASSEMBLY__)
+
+#define	nlm_read_gbu_reg(b, r)		nlm_read_reg(b, r)
+#define	nlm_write_gbu_reg(b, r, v)	nlm_write_reg(b, r, v)
+#define	nlm_get_gbu_pcibase(node)	\
+				nlm_pcicfg_base(XLP_IO_NOR_OFFSET(node))
+#define	nlm_get_gbu_regbase(node)	\
+				(nlm_get_gbu_pcibase(node) + XLP_IO_PCI_HDRSZ)
+
+#endif /* !LOCORE && !__ASSEMBLY__ */
+#endif /* _NLM_HAL_GBU_H__ */

Modified: head/sys/mips/nlm/msgring.h
==============================================================================
--- head/sys/mips/nlm/msgring.h	Tue Mar 27 11:43:46 2012	(r233541)
+++ head/sys/mips/nlm/msgring.h	Tue Mar 27 12:25:47 2012	(r233542)
@@ -29,12 +29,17 @@
  * $FreeBSD$
  */
 
+#ifndef _NLM_MSGRING_H
+#define	_NLM_MSGRING_H
 #define	CMS_DEFAULT_CREDIT	50
-
 extern uint32_t xlp_msg_thread_mask;
+
+struct nlm_fmn_msg;
 typedef void (*msgring_handler)(int, int, int, int, struct nlm_fmn_msg *, void *);
+
 int register_msgring_handler(int startb, int endb, msgring_handler action,
 		                    void *arg);
 int xlp_handle_msg_vc(u_int vcmask, int max_msgs);
 void xlp_msgring_cpu_init(int, int, int);
 void xlp_cms_enable_intr(int , int , int , int);
+#endif /* _NLM_MSGRING_H */

From owner-svn-src-head@FreeBSD.ORG  Tue Mar 27 14:02:23 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 8E308106566C;
	Tue, 27 Mar 2012 14:02:23 +0000 (UTC)
	(envelope-from fabient@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 791648FC20;
	Tue, 27 Mar 2012 14:02:23 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2RE2NNT088757;
	Tue, 27 Mar 2012 14:02:23 GMT (envelope-from fabient@svn.freebsd.org)
Received: (from fabient@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2RE2Nb7088755;
	Tue, 27 Mar 2012 14:02:23 GMT (envelope-from fabient@svn.freebsd.org)
Message-Id: <201203271402.q2RE2Nb7088755@svn.freebsd.org>
From: Fabien Thomas 
Date: Tue, 27 Mar 2012 14:02:23 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233544 - head/sys/dev/hwpmc
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 27 Mar 2012 14:02:23 -0000

Author: fabient
Date: Tue Mar 27 14:02:22 2012
New Revision: 233544
URL: http://svn.freebsd.org/changeset/base/233544

Log:
  Fix random deadlock on pmcstat exit:
  - Exit the thread when soft shutdown is requested
  - Wakeup owner thread.
  
  Reproduced/tested by looping pmcstat measurement:
  pmcstat -S instructions -O/tmp/test ls
  
  MFC after:	1 week

Modified:
  head/sys/dev/hwpmc/hwpmc_logging.c

Modified: head/sys/dev/hwpmc/hwpmc_logging.c
==============================================================================
--- head/sys/dev/hwpmc/hwpmc_logging.c	Tue Mar 27 14:01:09 2012	(r233543)
+++ head/sys/dev/hwpmc/hwpmc_logging.c	Tue Mar 27 14:02:22 2012	(r233544)
@@ -285,6 +285,7 @@ pmclog_loop(void *arg)
 			if ((lb = TAILQ_FIRST(&po->po_logbuffers)) == NULL) {
 				mtx_unlock_spin(&po->po_mtx);
 
+				/* No more buffers and shutdown required. */
 				if (po->po_flags & PMC_PO_SHUTDOWN) {
 					mtx_unlock(&pmc_kthread_mtx);
 					/*
@@ -293,6 +294,7 @@ pmclog_loop(void *arg)
 					 */
 					fo_close(po->po_file, curthread);
 					mtx_lock(&pmc_kthread_mtx);
+					break;
 				}
 
 				(void) msleep(po, &pmc_kthread_mtx, PWAIT,
@@ -355,6 +357,7 @@ pmclog_loop(void *arg)
 		lb = NULL;
 	}
 
+	wakeup_one(po->po_kthread);
 	po->po_kthread = NULL;
 
 	mtx_unlock(&pmc_kthread_mtx);
@@ -653,8 +656,7 @@ pmclog_deconfigure_log(struct pmc_owner 
 	    ("[pmclog,%d] po=%p no log file", __LINE__, po));
 
 	/* stop the kthread, this will reset the 'OWNS_LOGFILE' flag */
-	if (po->po_kthread)
-		pmclog_stop_kthread(po);
+	pmclog_stop_kthread(po);
 
 	KASSERT(po->po_kthread == NULL,
 	    ("[pmclog,%d] po=%p kthread not stopped", __LINE__, po));

From owner-svn-src-head@FreeBSD.ORG  Tue Mar 27 14:05:12 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id EC47A106566B;
	Tue, 27 Mar 2012 14:05:12 +0000 (UTC)
	(envelope-from jchandra@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id D3E2C8FC17;
	Tue, 27 Mar 2012 14:05:12 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2RE5C3l088877;
	Tue, 27 Mar 2012 14:05:12 GMT
	(envelope-from jchandra@svn.freebsd.org)
Received: (from jchandra@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2RE5Cip088870;
	Tue, 27 Mar 2012 14:05:12 GMT
	(envelope-from jchandra@svn.freebsd.org)
Message-Id: <201203271405.q2RE5Cip088870@svn.freebsd.org>
From: "Jayachandran C." 
Date: Tue, 27 Mar 2012 14:05:12 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233545 - in head/sys/mips: conf nlm nlm/dev/net
	nlm/dev/net/ucore nlm/hal
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 27 Mar 2012 14:05:13 -0000

Author: jchandra
Date: Tue Mar 27 14:05:12 2012
New Revision: 233545
URL: http://svn.freebsd.org/changeset/base/233545

Log:
  xlpge : driver for XLP network accelerator
  
  Features:
  - network driver for the four 10G interfaces and two management ports
    on XLP 8xx.
  - Support 4xx and 3xx variants of the processor.
  - Source code and firmware building for the 16 mips32r2 micro-code engines
    in the Network Accelerator.
  - Basic initialization code for Packet ordering Engine.
  
  Submitted by:	Prabhath Raman (prabhath at netlogicmicro com)
  		[refactored and fixed up for style by jchandra]

Added:
  head/sys/mips/nlm/dev/net/
  head/sys/mips/nlm/dev/net/mdio.c   (contents, props changed)
  head/sys/mips/nlm/dev/net/nae.c   (contents, props changed)
  head/sys/mips/nlm/dev/net/sgmii.c   (contents, props changed)
  head/sys/mips/nlm/dev/net/ucore/
  head/sys/mips/nlm/dev/net/ucore/crt0_basic.S   (contents, props changed)
  head/sys/mips/nlm/dev/net/ucore/ld.ucore.S   (contents, props changed)
  head/sys/mips/nlm/dev/net/ucore/ucore.h   (contents, props changed)
  head/sys/mips/nlm/dev/net/ucore/ucore_app.c   (contents, props changed)
  head/sys/mips/nlm/dev/net/xaui.c   (contents, props changed)
  head/sys/mips/nlm/dev/net/xlpge.c   (contents, props changed)
  head/sys/mips/nlm/dev/net/xlpge.h   (contents, props changed)
  head/sys/mips/nlm/hal/interlaken.h   (contents, props changed)
  head/sys/mips/nlm/hal/mdio.h   (contents, props changed)
  head/sys/mips/nlm/hal/nae.h   (contents, props changed)
  head/sys/mips/nlm/hal/poe.h   (contents, props changed)
  head/sys/mips/nlm/hal/sgmii.h   (contents, props changed)
  head/sys/mips/nlm/hal/ucore_loader.h   (contents, props changed)
  head/sys/mips/nlm/hal/xaui.h   (contents, props changed)
Modified:
  head/sys/mips/conf/std.XLP
  head/sys/mips/nlm/board.c
  head/sys/mips/nlm/board.h
  head/sys/mips/nlm/files.xlp
  head/sys/mips/nlm/hal/iomap.h
  head/sys/mips/nlm/msgring.h

Modified: head/sys/mips/conf/std.XLP
==============================================================================
--- head/sys/mips/conf/std.XLP	Tue Mar 27 14:02:22 2012	(r233544)
+++ head/sys/mips/conf/std.XLP	Tue Mar 27 14:05:12 2012	(r233545)
@@ -71,6 +71,7 @@ device		bpf
 # Network
 device		miibus
 device		ether
+device		xlpge
 #device		re
 device		msk
 device		em

Modified: head/sys/mips/nlm/board.c
==============================================================================
--- head/sys/mips/nlm/board.c	Tue Mar 27 14:02:22 2012	(r233544)
+++ head/sys/mips/nlm/board.c	Tue Mar 27 14:05:12 2012	(r233545)
@@ -44,16 +44,289 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
+#include 
 
 #include 
 #include 
+#include 
 
 static uint8_t board_eeprom_buf[EEPROM_SIZE];
 static int board_eeprom_set;
 
 struct xlp_board_info xlp_board_info;
 
+struct vfbid_tbl {
+	int vfbid;
+	int dest_vc;
+};
+
+/* XXXJC : this should be derived from msg thread mask */
+static struct vfbid_tbl nlm_vfbid[] = {
+	/* NULL FBID should map to cpu0 to detect NAE send msg errors */
+	{127,   0}, /* NAE <-> NAE mappings */
+	{51, 1019}, {50, 1018}, {49, 1017}, {48, 1016},
+	{47, 1015}, {46, 1014}, {45, 1013}, {44, 1012},
+	{43, 1011}, {42, 1010}, {41, 1009}, {40, 1008},
+	{39, 1007}, {38, 1006}, {37, 1005}, {36, 1004},
+	{35, 1003}, {34, 1002}, {33, 1001}, {32, 1000},
+	/* NAE <-> CPU mappings, freeback got to vc 3 of each thread */ 
+	{31,  127}, {30,  123}, {29,  119}, {28,  115},
+	{27,  111}, {26,  107}, {25,  103}, {24,   99},
+	{23,   95}, {22,   91}, {21,   87}, {20,   83},
+	{19,   79}, {18,   75}, {17,   71}, {16,   67},
+	{15,   63}, {14,   59}, {13,   55}, {12,   51},
+	{11,   47}, {10,   43}, { 9,   39}, { 8,   35},
+	{ 7,   31}, { 6,   27}, { 5,   23}, { 4,   19},
+	{ 3,   15}, { 2,   11}, { 1,    7}, { 0,    3},
+};
+
+static struct vfbid_tbl nlm3xx_vfbid[] = {
+	/* NULL FBID should map to cpu0 to detect NAE send msg errors */
+	{127,   0}, /* NAE <-> NAE mappings */
+	{39,  503}, {38,  502}, {37,  501}, {36,  500},
+	{35,  499}, {34,  498}, {33,  497}, {32,  496},
+	/* NAE <-> CPU mappings, freeback got to vc 3 of each thread */ 
+	{31,  127}, {30,  123}, {29,  119}, {28,  115},
+	{27,  111}, {26,  107}, {25,  103}, {24,   99},
+	{23,   95}, {22,   91}, {21,   87}, {20,   83},
+	{19,   79}, {18,   75}, {17,   71}, {16,   67},
+	{15,   63}, {14,   59}, {13,   55}, {12,   51},
+	{11,   47}, {10,   43}, { 9,   39}, { 8,   35},
+	{ 7,   31}, { 6,   27}, { 5,   23}, { 4,   19},
+	{ 3,   15}, { 2,   11}, { 1,    7}, { 0,    3},
+};
+
+int
+nlm_get_vfbid_mapping(int vfbid)
+{
+	int i, nentries;
+	struct vfbid_tbl *p;
+
+	if (nlm_is_xlp3xx()) {
+		nentries = sizeof(nlm3xx_vfbid)/sizeof(struct vfbid_tbl);
+		p = nlm3xx_vfbid;
+	} else {
+		nentries = sizeof(nlm_vfbid)/sizeof(struct vfbid_tbl);
+		p = nlm_vfbid;
+	}
+
+	for (i = 0; i < nentries; i++) {
+		if (p[i].vfbid == vfbid)
+		    return (p[i].dest_vc);
+	}
+
+	return (-1);
+}
+
+int
+nlm_get_poe_distvec(int vec, uint32_t *distvec)
+{
+
+	if (vec != 0)
+		return (-1);  /* we support just vec 0 */
+	nlm_calc_poe_distvec(xlp_msg_thread_mask, 0, 0, 0,
+	    0x1 << XLPGE_RX_VC, distvec);
+	return (0);
+}
+
+/*
+ * All our knowledge of chip and board that cannot be detected by probing
+ * at run-time goes here
+ */
+
+void
+xlpge_get_macaddr(uint8_t *macaddr)
+{
+
+	if (board_eeprom_set == 0) {
+		/* No luck, take some reasonable value */
+		macaddr[0] = 0x00; macaddr[1] = 0x0f; macaddr[2] = 0x30;
+		macaddr[3] = 0x20; macaddr[4] = 0x0d; macaddr[5] = 0x5b;
+	} else
+		memcpy(macaddr, &board_eeprom_buf[EEPROM_MACADDR_OFFSET],
+		    ETHER_ADDR_LEN);
+}
+
+static void
+nlm_setup_port_defaults(struct xlp_port_ivars *p)
+{
+	p->loopback_mode = 0;
+	p->num_channels = 1;
+	p->free_desc_sizes = 2048;
+	p->vlan_pri_en = 0;
+	p->hw_parser_en = 1;
+	p->ieee1588_userval = 0;
+	p->ieee1588_ptpoff = 0;
+	p->ieee1588_tmr1 = 0;
+	p->ieee1588_tmr2 = 0;
+	p->ieee1588_tmr3 = 0;
+	p->ieee1588_inc_intg = 0;
+	p->ieee1588_inc_den = 1;
+	p->ieee1588_inc_num = 1;
+
+	if (nlm_is_xlp3xx()) {
+		p->stg2_fifo_size = XLP3XX_STG2_FIFO_SZ;
+		p->eh_fifo_size = XLP3XX_EH_FIFO_SZ;
+		p->frout_fifo_size = XLP3XX_FROUT_FIFO_SZ;
+		p->ms_fifo_size = XLP3XX_MS_FIFO_SZ;
+		p->pkt_fifo_size = XLP3XX_PKT_FIFO_SZ;
+		p->pktlen_fifo_size = XLP3XX_PKTLEN_FIFO_SZ;
+		p->max_stg2_offset = XLP3XX_MAX_STG2_OFFSET;
+		p->max_eh_offset = XLP3XX_MAX_EH_OFFSET;
+		p->max_frout_offset = XLP3XX_MAX_FREE_OUT_OFFSET;
+		p->max_ms_offset = XLP3XX_MAX_MS_OFFSET;
+		p->max_pmem_offset = XLP3XX_MAX_PMEM_OFFSET;
+		p->stg1_2_credit = XLP3XX_STG1_2_CREDIT;
+		p->stg2_eh_credit = XLP3XX_STG2_EH_CREDIT;
+		p->stg2_frout_credit = XLP3XX_STG2_FROUT_CREDIT;
+		p->stg2_ms_credit = XLP3XX_STG2_MS_CREDIT;
+	} else {
+		p->stg2_fifo_size = XLP8XX_STG2_FIFO_SZ;
+		p->eh_fifo_size = XLP8XX_EH_FIFO_SZ;
+		p->frout_fifo_size = XLP8XX_FROUT_FIFO_SZ;
+		p->ms_fifo_size = XLP8XX_MS_FIFO_SZ;
+		p->pkt_fifo_size = XLP8XX_PKT_FIFO_SZ;
+		p->pktlen_fifo_size = XLP8XX_PKTLEN_FIFO_SZ;
+		p->max_stg2_offset = XLP8XX_MAX_STG2_OFFSET;
+		p->max_eh_offset = XLP8XX_MAX_EH_OFFSET;
+		p->max_frout_offset = XLP8XX_MAX_FREE_OUT_OFFSET;
+		p->max_ms_offset = XLP8XX_MAX_MS_OFFSET;
+		p->max_pmem_offset = XLP8XX_MAX_PMEM_OFFSET;
+		p->stg1_2_credit = XLP8XX_STG1_2_CREDIT;
+		p->stg2_eh_credit = XLP8XX_STG2_EH_CREDIT;
+		p->stg2_frout_credit = XLP8XX_STG2_FROUT_CREDIT;
+		p->stg2_ms_credit = XLP8XX_STG2_MS_CREDIT;
+	}
+
+	switch (p->type) {
+	case SGMIIC:
+		p->num_free_descs = 52;
+		p->iface_fifo_size = 13;
+		p->rxbuf_size = 128;
+		p->rx_slots_reqd = SGMII_CAL_SLOTS;
+		p->tx_slots_reqd = SGMII_CAL_SLOTS;
+		if (nlm_is_xlp3xx())
+		    p->pseq_fifo_size = 30;
+		else
+		    p->pseq_fifo_size = 62;
+		break;
+	case ILC:
+		p->num_free_descs = 150;
+		p->rxbuf_size = 944;
+		p->rx_slots_reqd = IL8_CAL_SLOTS;
+		p->tx_slots_reqd = IL8_CAL_SLOTS;
+		p->pseq_fifo_size = 225;
+		p->iface_fifo_size = 55;
+		break;
+	case XAUIC:
+	default:
+		p->num_free_descs = 150;
+		p->rxbuf_size = 944;
+		p->rx_slots_reqd = XAUI_CAL_SLOTS;
+		p->tx_slots_reqd = XAUI_CAL_SLOTS;
+		if (nlm_is_xlp3xx()) {
+		    p->pseq_fifo_size = 120;
+		    p->iface_fifo_size = 52;
+		} else {
+		    p->pseq_fifo_size = 225;
+		    p->iface_fifo_size = 55;
+		}
+		break;
+	}
+}
+
+/* XLP 8XX evaluation boards have the following phy-addr
+ * assignment. There are two external mdio buses in XLP --
+ * bus 0 and bus 1. The management ports (16 and 17) are
+ * on mdio bus 0 while blocks/complexes[0 to 3] are all 
+ * on mdio bus 1. The phy_addr on bus 0 (mgmt ports 16
+ * and 17) match the port numbers.
+ * These are the details:
+ * block  port   phy_addr   mdio_bus
+ * ====================================
+ * 0         0     4          1
+ * 0         1     7          1
+ * 0         2     6          1
+ * 0         3     5          1
+ * 1         0     8          1
+ * 1         1     11         1
+ * 1         2     10         1
+ * 1         3     9          1
+ * 2         0     0          1
+ * 2         1     3          1
+ * 2         2     2          1
+ * 2         3     1          1
+ * 3         0     12         1
+ * 3         1     15         1
+ * 3         2     14         1
+ * 3         3     13         1
+ *
+ * 4         0     16         0 
+ * 4         1     17         0
+ *
+ * The XLP 3XX evaluation boards have the following phy-addr
+ * assignments.
+ * block  port   phy_addr   mdio_bus
+ * ====================================
+ * 0         0     4          0
+ * 0         1     7          0
+ * 0         2     6          0
+ * 0         3     5          0
+ * 1         0     8          0
+ * 1         1     11         0
+ * 1         2     10         0
+ * 1         3     9          0
+ */
+static void
+nlm_board_get_phyaddr(int block, int port, int *mdio, int *phyaddr)
+{
+
+	/* XXXJC: this is a board feature, check for chip not proper */
+	if (nlm_is_xlp3xx() || (nlm_is_xlp8xx() && block == 4))
+	    *mdio = 0;
+	else
+	    *mdio = 1;
+
+	switch (block) {
+	case 0: switch (port) {
+		case 0: *phyaddr = 4; break;
+		case 1: *phyaddr = 7; break;
+		case 2: *phyaddr = 6; break;
+		case 3: *phyaddr = 5; break;
+		}
+		break;
+	case 1: switch (port) {
+		case 0: *phyaddr = 8; break;
+		case 1: *phyaddr = 11; break;
+		case 2: *phyaddr = 10; break;
+		case 3: *phyaddr = 9; break;
+		}
+		break;
+	case 2: switch (port) {
+		case 0: *phyaddr = 0; break;
+		case 1: *phyaddr = 3; break;
+		case 2: *phyaddr = 2; break;
+		case 3: *phyaddr = 1; break;
+		}
+		break;
+	case 3: switch (port) {
+		case 0: *phyaddr = 12; break;
+		case 1: *phyaddr = 15; break;
+		case 2: *phyaddr = 14; break;
+		case 3: *phyaddr = 13; break;
+		}
+		break;
+	case 4: switch (port) { /* management SGMII */
+		case 0: *phyaddr = 16; break;
+		case 1: *phyaddr = 17; break;
+		}
+		break;
+	}
+}
+
+
 static void
 nlm_print_processor_info(void)
 {
@@ -105,12 +378,17 @@ static int
 nlm_setup_xlp_board(void)
 {
 	struct xlp_board_info	*boardp;
-	int rv;
+	struct xlp_node_info	*nodep;
+	struct xlp_nae_ivars	*naep;
+	struct xlp_block_ivars	*blockp;
+	struct xlp_port_ivars	*portp;
+	uint64_t cpldbase, nae_pcibase;
+	int	node, block, port, rv, dbtype, usecpld;
 	uint8_t *b;
 
 	/* start with a clean slate */
 	boardp = &xlp_board_info;
-	memset(boardp, 0, sizeof(*boardp));
+	memset(boardp, 0, sizeof(xlp_board_info));
 	boardp->nodemask = 0x1;	/* only node 0 */
 	nlm_print_processor_info();
 
@@ -129,6 +407,114 @@ nlm_setup_xlp_board(void)
 		printf("Board Info: Error on EEPROM read (i2c@%d %#X).\n",
 		    EEPROM_I2CBUS, EEPROM_I2CADDR);
 
+
+	/* XXXJC: check for boards with right CPLD, for now
+	 *        4xx PCI cards don't have CPLD with daughter
+	 *        card info */
+	usecpld = !nlm_is_xlp4xx();
+
+	for (node = 0; node < XLP_MAX_NODES; node++) {
+		if ((boardp->nodemask & (1 << node)) == 0)
+			continue;
+		nae_pcibase = nlm_get_nae_pcibase(node);
+		nodep = &boardp->nodes[node];
+		naep = &nodep->nae_ivars;
+		naep->node = node;
+
+		naep->nblocks = nae_num_complex(nae_pcibase);
+		/* 3xx chips lie shamelessly about this */
+		if (nlm_is_xlp3xx())
+			naep->nblocks = naep->nblocks - 1;
+		naep->blockmask = (1 << naep->nblocks) - 1;	/* XXXJC: redundant */
+		naep->xauimask = 0x0;	/* set this based on daughter card */
+		naep->sgmiimask = 0x0;	/* set this based on daughter card */
+
+		/* frequency at which network block runs */
+		naep->freq = 500;
+
+		/* CRC16 polynomial used for flow table generation */
+		naep->flow_crc_poly = 0xffff;
+		naep->hw_parser_en = 1;
+		naep->prepad_en = 1;
+		naep->prepad_size = 3; /* size in 16 byte units */
+
+		naep->ieee_1588_en = 1;
+		cpldbase = nlm_board_cpld_base(node, XLP_EVB_CPLD_CHIPSELECT);
+
+		for (block = 0; block < naep->nblocks; block++) {
+			blockp = &naep->block_ivars[block];
+			blockp->block = block;
+			if (usecpld)
+				dbtype = nlm_board_cpld_dboard_type(cpldbase,
+				    block);
+			else
+				dbtype = DCARD_XAUI;  /* default XAUI */
+
+			if (block == 4) {
+				/* management block 4 on 8xx */
+				blockp->type = SGMIIC;
+				blockp->portmask = 0x3;
+				naep->sgmiimask |= (1 << block);
+			} else {
+				switch (dbtype) {
+				case DCARD_ILAKEN:
+					blockp->type = ILC;
+					blockp->portmask = 0x1;
+					naep->xauimask |= (1 << block);
+					break;
+				case DCARD_SGMII:
+					blockp->type = SGMIIC;
+					blockp->portmask = 0xf;
+					naep->sgmiimask |= (1 << block);
+					break;
+				case DCARD_XAUI:
+				default:
+					blockp->type = XAUIC;
+					blockp->portmask = 0x1;
+					naep->xauimask |= (1 << block);
+					break;
+				}
+			}
+			for (port = 0; port < PORTS_PER_CMPLX; port++) {
+				if ((blockp->portmask & (1 << port)) == 0)
+					continue;
+				portp = &blockp->port_ivars[port];
+				nlm_board_get_phyaddr(block, port,
+				    &portp->mdio_bus, &portp->phy_addr);
+				portp->port = port;
+				portp->block = block;
+				portp->node = node;
+				portp->type = blockp->type;
+				nlm_setup_port_defaults(portp);
+			}
+		}
+	}
+
+	/* pretty print network config */
+	printf("Network config");
+	if (usecpld)
+		printf("(from CPLD@%d):\n", XLP_EVB_CPLD_CHIPSELECT);
+	else
+		printf("(defaults):\n");
+	for (node = 0; node < XLP_MAX_NODES; node++) {
+		if ((boardp->nodemask & (1 << node)) == 0)
+			continue;
+		nodep = &boardp->nodes[node];
+		naep = &nodep->nae_ivars;
+		printf("  NAE@%d Blocks: ", node);
+		for (block = 0; block < naep->nblocks; block++) {
+			char *s = "???";
+
+			blockp = &naep->block_ivars[block];
+			switch (blockp->type) {
+				case SGMIIC : s = "SGMII"; break;
+				case XAUIC  : s = "XAUI"; break;
+				case ILC    : s = "IL"; break;
+			}
+			printf(" [%d %s]", block, s);
+		}
+		printf("\n");
+	}
 	return (0);
 }
 

Modified: head/sys/mips/nlm/board.h
==============================================================================
--- head/sys/mips/nlm/board.h	Tue Mar 27 14:02:22 2012	(r233544)
+++ head/sys/mips/nlm/board.h	Tue Mar 27 14:05:12 2012	(r233545)
@@ -32,9 +32,8 @@
 #ifndef __NLM_BOARD_H__
 #define __NLM_BOARD_H__
 
-#define	XLP_NAE_NBLOCKS		5
-#define	XLP_NAE_NPORTS		4
-#define	XLP_I2C_MAXDEVICES	8
+#define XLP_NAE_NBLOCKS		5
+#define XLP_NAE_NPORTS		4
 
 /*
  * EVP board EEPROM info
@@ -44,13 +43,62 @@
 #define	EEPROM_SIZE	 	48
 #define	EEPROM_MACADDR_OFFSET	2
 
+/*
+ * EVP board CPLD chip select and daughter card info field
+ */
+#define XLP_EVB_CPLD_CHIPSELECT	2
+
+#define DCARD_ILAKEN		0x0
+#define DCARD_SGMII		0x1
+#define DCARD_XAUI		0x2
+#define DCARD_NOT_PRSNT		0x3
+
 #if !defined(LOCORE) && !defined(__ASSEMBLY__)
+/*
+ * NAE configuration
+ */
 
 struct xlp_port_ivars {
 	int	port;
 	int	block;
+	int	node;
 	int	type;
 	int	phy_addr;
+	int	mdio_bus;
+	int	loopback_mode;
+	int	num_channels;
+	int	free_desc_sizes;
+	int	num_free_descs;
+	int	pseq_fifo_size;
+	int	iface_fifo_size;
+	int	rxbuf_size;
+	int	rx_slots_reqd;
+	int	tx_slots_reqd;
+	int	vlan_pri_en;
+	int	stg2_fifo_size;
+	int	eh_fifo_size;
+	int	frout_fifo_size;
+	int	ms_fifo_size;
+	int	pkt_fifo_size;
+	int	pktlen_fifo_size;
+	int	max_stg2_offset;
+	int	max_eh_offset;
+	int	max_frout_offset;
+	int	max_ms_offset;
+	int	max_pmem_offset;
+	int	stg1_2_credit;
+	int	stg2_eh_credit;
+	int	stg2_frout_credit;
+	int	stg2_ms_credit;
+	int	hw_parser_en;
+	u_int	ieee1588_inc_intg;
+	u_int	ieee1588_inc_den;
+	u_int	ieee1588_inc_num;
+	uint64_t ieee1588_userval;
+	uint64_t ieee1588_ptpoff;
+	uint64_t ieee1588_tmr1;
+	uint64_t ieee1588_tmr2;
+	uint64_t ieee1588_tmr3;
 };
 
 struct xlp_block_ivars {
@@ -62,7 +110,16 @@ struct xlp_block_ivars {
 
 struct xlp_nae_ivars {
 	int 	node;
+	int	nblocks;
 	u_int	blockmask;
+	u_int	xauimask;
+	u_int	sgmiimask;
+	int	freq;
+	u_int	flow_crc_poly;
+	u_int	hw_parser_en;
+	u_int	prepad_en;
+	u_int	prepad_size;	/* size in 16 byte units */
+	u_int	ieee_1588_en;
 	struct xlp_block_ivars	block_ivars[XLP_NAE_NBLOCKS];
 };
 
@@ -73,8 +130,16 @@ struct xlp_board_info {
 	} nodes[XLP_MAX_NODES];
 };
 
+extern struct xlp_board_info xlp_board_info;
+
+/* Network configuration */
+int nlm_get_vfbid_mapping(int);
+int nlm_get_poe_distvec(int vec, uint32_t *distvec);
+void xlpge_get_macaddr(uint8_t *macaddr);
+
 int nlm_board_info_setup(void);
 
+/* EEPROM & CPLD */
 int nlm_board_eeprom_read(int node, int i2cbus, int addr, int offs,
     uint8_t *buf,int sz);
 uint64_t nlm_board_cpld_base(int node, int chipselect);
@@ -82,6 +147,6 @@ int nlm_board_cpld_majorversion(uint64_t
 int nlm_board_cpld_minorversion(uint64_t cpldbase);
 void nlm_board_cpld_reset(uint64_t cpldbase);
 int nlm_board_cpld_dboard_type(uint64_t cpldbase, int slot);
-#endif
 
 #endif
+#endif

Added: head/sys/mips/nlm/dev/net/mdio.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sys/mips/nlm/dev/net/mdio.c	Tue Mar 27 14:05:12 2012	(r233545)
@@ -0,0 +1,301 @@
+/*-
+ * Copyright (c) 2003-2012 Broadcom Corporation
+ * All Rights Reserved
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY BROADCOM ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL BROADCOM OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+/* Internal MDIO READ/WRITE Routines */
+int
+nlm_int_gmac_mdio_read(uint64_t nae_base, int bus, int block,
+    int intf_type, int phyaddr, int regidx)
+{
+	uint32_t mdio_ld_cmd;
+	uint32_t ctrlval;
+
+	ctrlval = INT_MDIO_CTRL_SMP 		|
+	    (phyaddr << INT_MDIO_CTRL_PHYADDR_POS) |
+	    (regidx << INT_MDIO_CTRL_DEVTYPE_POS) |
+	    (2 << INT_MDIO_CTRL_OP_POS)		|
+	    (1 << INT_MDIO_CTRL_ST_POS)		|
+	    (7 << INT_MDIO_CTRL_XDIV_POS) 	|
+	    (2 << INT_MDIO_CTRL_TA_POS)		|
+	    (2 << INT_MDIO_CTRL_MIIM_POS) 	|
+	    (1 << INT_MDIO_CTRL_MCDIV_POS);
+
+	mdio_ld_cmd = nlm_read_nae_reg(nae_base,
+	    NAE_REG(block, intf_type, (INT_MDIO_CTRL + bus * 4)));
+	if (mdio_ld_cmd & INT_MDIO_CTRL_CMD_LOAD) {
+		nlm_write_nae_reg(nae_base,
+		    NAE_REG(block, intf_type, (INT_MDIO_CTRL + bus*4)),
+		    (mdio_ld_cmd & ~INT_MDIO_CTRL_CMD_LOAD));
+	}
+
+	nlm_write_nae_reg(nae_base,
+	    NAE_REG(block, intf_type, (INT_MDIO_CTRL + bus * 4)),
+	    ctrlval);
+
+	/* Toggle Load Cmd Bit */
+	nlm_write_nae_reg(nae_base,
+	    NAE_REG(block, intf_type, (INT_MDIO_CTRL + bus * 4)),
+	    ctrlval | (1 << INT_MDIO_CTRL_LOAD_POS));
+
+	/* poll master busy bit until it is not busy */
+	while(nlm_read_nae_reg(nae_base,
+	    NAE_REG(block, intf_type, (INT_MDIO_RD_STAT + bus * 4))) &
+	    INT_MDIO_STAT_MBSY) {
+	}
+
+	nlm_write_nae_reg(nae_base,
+	    NAE_REG(block, intf_type, (INT_MDIO_CTRL + bus * 4)),
+	    ctrlval);
+
+	/* Read the data back */
+	return nlm_read_nae_reg(nae_base,
+	    NAE_REG(block, intf_type, (INT_MDIO_RD_STAT + bus * 4)));
+}
+
+/* Internal MDIO WRITE Routines */
+int
+nlm_int_gmac_mdio_write(uint64_t nae_base, int bus, int block,
+    int intf_type, int phyaddr, int regidx, uint16_t val)
+{
+	uint32_t mdio_ld_cmd;
+	uint32_t ctrlval;
+
+	ctrlval = INT_MDIO_CTRL_SMP		|
+	    (phyaddr << INT_MDIO_CTRL_PHYADDR_POS) |
+	    (regidx << INT_MDIO_CTRL_DEVTYPE_POS) |
+	    (1 << INT_MDIO_CTRL_OP_POS)		|
+	    (1 << INT_MDIO_CTRL_ST_POS)		|
+	    (7 << INT_MDIO_CTRL_XDIV_POS)	|
+	    (2 << INT_MDIO_CTRL_TA_POS)		|
+	    (1 << INT_MDIO_CTRL_MIIM_POS)	|
+	    (1 << INT_MDIO_CTRL_MCDIV_POS);
+
+	mdio_ld_cmd = nlm_read_nae_reg(nae_base,
+	    NAE_REG(block, intf_type, (INT_MDIO_CTRL + bus * 4)));
+	if (mdio_ld_cmd & INT_MDIO_CTRL_CMD_LOAD) {
+		nlm_write_nae_reg(nae_base,
+		    NAE_REG(block, intf_type, (INT_MDIO_CTRL + bus*4)),
+		    (mdio_ld_cmd & ~INT_MDIO_CTRL_CMD_LOAD));
+	}
+
+	/* load data into ctrl data reg */
+	nlm_write_nae_reg(nae_base,
+	    NAE_REG(block, intf_type, (INT_MDIO_CTRL_DATA + bus * 4)),
+	    val);
+
+	nlm_write_nae_reg(nae_base,
+	    NAE_REG(block, intf_type, (INT_MDIO_CTRL + bus * 4)),
+	    ctrlval);
+
+	nlm_write_nae_reg(nae_base,
+	    NAE_REG(block, intf_type, (INT_MDIO_CTRL + bus * 4)),
+	    ctrlval | (1 << INT_MDIO_CTRL_LOAD_POS));
+
+	/* poll master busy bit until it is not busy */
+	while(nlm_read_nae_reg(nae_base,
+	    NAE_REG(block, intf_type, (INT_MDIO_RD_STAT + bus * 4))) &
+	    INT_MDIO_STAT_MBSY) {
+	}
+
+	nlm_write_nae_reg(nae_base,
+	    NAE_REG(block, intf_type, (INT_MDIO_CTRL + bus * 4)),
+	    ctrlval);
+
+	return (0);
+}
+
+int
+nlm_int_gmac_mdio_reset(uint64_t nae_base, int bus, int block,
+    int intf_type)
+{
+	uint32_t val;
+
+	val = (7 << INT_MDIO_CTRL_XDIV_POS) | 
+	    (1 << INT_MDIO_CTRL_MCDIV_POS);
+
+	nlm_write_nae_reg(nae_base,
+	    NAE_REG(block, intf_type, (INT_MDIO_CTRL + bus * 4)), 
+	    val | INT_MDIO_CTRL_RST);
+
+	nlm_write_nae_reg(nae_base,
+	    NAE_REG(block, intf_type, (INT_MDIO_CTRL + bus * 4)), 
+	    val);
+
+        return (0);
+}
+
+/*
+ *  nae_gmac_mdio_read - Read sgmii phy register
+ *
+ *  Input parameters:
+ *         bus          - bus number, nae has two external gmac bus: 0 and 1
+ *         phyaddr      - PHY's address
+ *         regidx       - index of register to read
+ *
+ *  Return value:
+ *         value read (16 bits), or 0xffffffff if an error occurred.
+ */
+int
+nlm_gmac_mdio_read(uint64_t nae_base, int bus, int block,
+    int intf_type, int phyaddr, int regidx)
+{
+	uint32_t mdio_ld_cmd;
+	uint32_t val;
+
+	val = EXT_G_MDIO_CMD_SP |
+	    (phyaddr << EXT_G_MDIO_PHYADDR_POS) |
+	    (regidx << EXT_G_MDIO_REGADDR_POS) |
+	    EXT_G_MDIO_DIV;
+
+	mdio_ld_cmd = nlm_read_nae_reg(nae_base, NAE_REG(block, intf_type,
+	    (EXT_G0_MDIO_CTRL + bus * 4)));
+	if (mdio_ld_cmd & EXT_G_MDIO_CMD_LCD) {
+		nlm_write_nae_reg(nae_base,
+		    NAE_REG(block, intf_type, (EXT_G0_MDIO_CTRL+bus*4)), 
+		    (mdio_ld_cmd & ~EXT_G_MDIO_CMD_LCD));
+		while(nlm_read_nae_reg(nae_base,
+		    NAE_REG(block, intf_type,
+		    (EXT_G0_MDIO_RD_STAT + bus * 4))) &
+		    EXT_G_MDIO_STAT_MBSY);
+	}
+
+	nlm_write_nae_reg(nae_base,
+	    NAE_REG(block, intf_type, (EXT_G0_MDIO_CTRL+bus*4)), 
+	    val);
+
+	nlm_write_nae_reg(nae_base,
+	    NAE_REG(block, intf_type, (EXT_G0_MDIO_CTRL+bus*4)), 
+	    val | (1<<18));
+
+	/* poll master busy bit until it is not busy */
+	while(nlm_read_nae_reg(nae_base,
+	    NAE_REG(block, intf_type, (EXT_G0_MDIO_RD_STAT + bus * 4))) &
+	    EXT_G_MDIO_STAT_MBSY);
+
+	nlm_write_nae_reg(nae_base,
+	    NAE_REG(block, intf_type, (EXT_G0_MDIO_CTRL+bus*4)), 
+	    val);
+
+	/* Read the data back */
+	return nlm_read_nae_reg(nae_base,
+	    NAE_REG(block, intf_type, (EXT_G0_MDIO_RD_STAT + bus * 4)));
+}
+
+/*
+ *  nae_gmac_mdio_write -Write sgmac mii PHY register.
+ *
+ *  Input parameters:
+ *         bus          - bus number, nae has two external gmac bus: 0 and 1
+ *         phyaddr      - PHY to use
+ *         regidx       - register within the PHY
+ *         val          - data to write to register
+ *
+ *  Return value:
+ *         0 - success
+ */
+int
+nlm_gmac_mdio_write(uint64_t nae_base, int bus, int block,
+    int intf_type, int phyaddr, int regidx, uint16_t val)
+{
+	uint32_t mdio_ld_cmd;
+	uint32_t ctrlval;
+
+	ctrlval = EXT_G_MDIO_CMD_SP		|
+	    (phyaddr << EXT_G_MDIO_PHYADDR_POS)	|
+	    (regidx << EXT_G_MDIO_REGADDR_POS)	|
+	    EXT_G_MDIO_DIV;
+
+	mdio_ld_cmd = nlm_read_nae_reg(nae_base, NAE_REG(block, intf_type,
+	    (EXT_G0_MDIO_CTRL + bus * 4)));
+	if (mdio_ld_cmd & EXT_G_MDIO_CMD_LCD) {
+		nlm_write_nae_reg(nae_base,
+		    NAE_REG(block, intf_type, (EXT_G0_MDIO_CTRL+bus*4)), 
+		    (mdio_ld_cmd & ~EXT_G_MDIO_CMD_LCD));
+		while(nlm_read_nae_reg(nae_base,
+		    NAE_REG(block, intf_type,
+		    (EXT_G0_MDIO_RD_STAT + bus * 4))) &
+		    EXT_G_MDIO_STAT_MBSY);
+	}
+
+	/* load data into ctrl data reg */
+	nlm_write_nae_reg(nae_base,
+	    NAE_REG(block, intf_type, (EXT_G0_MDIO_CTRL_DATA+bus*4)), 
+	    val);
+
+	nlm_write_nae_reg(nae_base,
+	    NAE_REG(block, intf_type, (EXT_G0_MDIO_CTRL+bus*4)), 
+	    ctrlval);
+
+	nlm_write_nae_reg(nae_base,
+	    NAE_REG(block, intf_type, (EXT_G0_MDIO_CTRL+bus*4)), 
+	    ctrlval | EXT_G_MDIO_CMD_LCD);
+
+	/* poll master busy bit until it is not busy */
+	while(nlm_read_nae_reg(nae_base,
+	    NAE_REG(block, intf_type,
+	    (EXT_G0_MDIO_RD_STAT + bus * 4))) & EXT_G_MDIO_STAT_MBSY);
+
+	nlm_write_nae_reg(nae_base,
+	    NAE_REG(block, intf_type, (EXT_G0_MDIO_CTRL+bus*4)), 
+	    ctrlval);
+
+	return (0);
+}
+
+/*
+ *  nae_gmac_mdio_reset -Reset sgmii mdio module.
+ *
+ *  Input parameters:
+ *         bus - bus number, nae has two external gmac bus: 0 and 1
+ *
+ *  Return value:
+ *        0 - success
+ */
+int
+nlm_gmac_mdio_reset(uint64_t nae_base, int bus, int block,
+    int intf_type)
+{
+	nlm_write_nae_reg(nae_base,
+	    NAE_REG(block, intf_type, (EXT_G0_MDIO_CTRL+bus*4)), 
+	    EXT_G_MDIO_MMRST | EXT_G_MDIO_DIV);
+	nlm_write_nae_reg(nae_base,
+	    NAE_REG(block, intf_type, (EXT_G0_MDIO_CTRL+bus*4)), 
+	    EXT_G_MDIO_DIV);
+	return (0);
+}

Added: head/sys/mips/nlm/dev/net/nae.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sys/mips/nlm/dev/net/nae.c	Tue Mar 27 14:05:12 2012	(r233545)
@@ -0,0 +1,1536 @@
+/*-
+ * Copyright (c) 2003-2012 Broadcom Corporation
+ * All Rights Reserved
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY BROADCOM ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL BROADCOM OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+void
+nlm_nae_flush_free_fifo(uint64_t nae_base, int nblocks)
+{
+	uint32_t data, fifo_mask;
+
+	fifo_mask = (1 << (4 * nblocks)) - 1;
+
+	nlm_write_nae_reg(nae_base, NAE_RX_FREE_FIFO_POP, fifo_mask);
+	do {
+		data = nlm_read_nae_reg(nae_base, NAE_RX_FREE_FIFO_POP);
+	} while (data != fifo_mask);
+
+	nlm_write_nae_reg(nae_base, NAE_RX_FREE_FIFO_POP, 0);
+}
+
+void
+nlm_program_nae_parser_seq_fifo(uint64_t nae_base, int nblock,
+    struct nae_port_config *cfg)
+{
+	uint32_t val;
+	int start = 0, size, i, j;
+
+	for (i = 0; i < nblock; i++) {
+		for (j = 0; j < PORTS_PER_CMPLX; j++) {
+			if ((i == 4) && (j > 1))
+				size = 0;
+			else
+				size = cfg[(i*4)+j].pseq_fifo_size;
+			start += size;
+		}
+	}
+
+	for (j = 0; j < PORTS_PER_CMPLX; j++) {
+		if ((i == 4) && (j > 1))
+			size = 0;
+		else
+			size = cfg[(i*4)+j].pseq_fifo_size;
+
+		val = (((size & 0x1fff) << 17) |
+		    ((start & 0xfff) << 5) |
+		    (((i * 4) + j) & 0x1f));
+		nlm_write_nae_reg(nae_base, NAE_PARSER_SEQ_FIFO_CFG, val);
+		start += size;
+	}
+}
+
+void
+nlm_setup_rx_cal_cfg(uint64_t nae_base, int total_num_ports,
+    struct nae_port_config *cfg)
+{
+	int rx_slots = 0, port;
+	int cal_len, cal = 0, last_free = 0;
+	uint32_t val;
+
+	for (port = 0; port < total_num_ports; port++) {
+		if (cfg[port].rx_slots_reqd)
+		    rx_slots += cfg[port].rx_slots_reqd;
+		if (rx_slots > MAX_CAL_SLOTS) {
+			rx_slots = MAX_CAL_SLOTS;
+			break;
+		}
+	}
+
+	cal_len = rx_slots - 1;
+
+	do {
+		if (cal >= MAX_CAL_SLOTS)
+			break;
+		last_free = cal;
+		for (port = 0; port < total_num_ports; port++) {
+			if (cfg[port].rx_slots_reqd > 0) {
+				val = (cal_len << 16) | (port << 8) | cal;
+				nlm_write_nae_reg(nae_base,
+				    NAE_RX_IF_SLOT_CAL, val);
+				cal++;
+				cfg[port].rx_slots_reqd--;
+			}
+		}
+		if (last_free == cal)
+			break;
+	} while (1);
+}
+
+void
+nlm_setup_tx_cal_cfg(uint64_t nae_base, int total_num_ports,
+    struct nae_port_config *cfg)
+{
+	int tx_slots = 0, port;
+	int cal = 0, last_free = 0;
+	uint32_t val;
+
+	for (port = 0; port < total_num_ports; port++) {

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***

From owner-svn-src-head@FreeBSD.ORG  Tue Mar 27 14:10:16 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id A16FC106566B;
	Tue, 27 Mar 2012 14:10:16 +0000 (UTC) (envelope-from kib@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 803138FC0C;
	Tue, 27 Mar 2012 14:10:16 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2REAGYQ089067;
	Tue, 27 Mar 2012 14:10:16 GMT (envelope-from kib@svn.freebsd.org)
Received: (from kib@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2REAGwD089064;
	Tue, 27 Mar 2012 14:10:16 GMT (envelope-from kib@svn.freebsd.org)
Message-Id: <201203271410.q2REAGwD089064@svn.freebsd.org>
From: Konstantin Belousov 
Date: Tue, 27 Mar 2012 14:10:16 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233546 - head/libexec/rtld-elf
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 27 Mar 2012 14:10:16 -0000

Author: kib
Date: Tue Mar 27 14:10:15 2012
New Revision: 233546
URL: http://svn.freebsd.org/changeset/base/233546

Log:
  Prevent rtld_verify_object_versions() from being called several times
  for the same object. This can happen when object is a dependency of the
  dlopen()ed dso. When called several times, we waste time due to unneeded
  processing, and memory, because obj->vertab is allocated anew on each
  iteration.
  
  Reviewed by:	kan
  MFC after:	2 weeks

Modified:
  head/libexec/rtld-elf/rtld.c
  head/libexec/rtld-elf/rtld.h

Modified: head/libexec/rtld-elf/rtld.c
==============================================================================
--- head/libexec/rtld-elf/rtld.c	Tue Mar 27 14:05:12 2012	(r233545)
+++ head/libexec/rtld-elf/rtld.c	Tue Mar 27 14:10:15 2012	(r233546)
@@ -4158,6 +4158,10 @@ rtld_verify_object_versions(Obj_Entry *o
     const Obj_Entry *depobj;
     int maxvernum, vernum;
 
+    if (obj->ver_checked)
+	return (0);
+    obj->ver_checked = true;
+
     maxvernum = 0;
     /*
      * Walk over defined and required version records and figure out

Modified: head/libexec/rtld-elf/rtld.h
==============================================================================
--- head/libexec/rtld-elf/rtld.h	Tue Mar 27 14:05:12 2012	(r233545)
+++ head/libexec/rtld-elf/rtld.h	Tue Mar 27 14:10:15 2012	(r233546)
@@ -230,6 +230,7 @@ typedef struct Struct_Obj_Entry {
     bool mainprog : 1;		/* True if this is the main program */
     bool rtld : 1;		/* True if this is the dynamic linker */
     bool relocated : 1;		/* True if processed by relocate_objects() */
+    bool ver_checked : 1;	/* True if processed by rtld_verify_object_versions */
     bool textrel : 1;		/* True if there are relocations to text seg */
     bool symbolic : 1;		/* True if generated with "-Bsymbolic" */
     bool bind_now : 1;		/* True if all relocations should be made first */

From owner-svn-src-head@FreeBSD.ORG  Tue Mar 27 14:24:30 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 6BAAE106566B;
	Tue, 27 Mar 2012 14:24:30 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 569F28FC0C;
	Tue, 27 Mar 2012 14:24:30 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2REOUSi089548;
	Tue, 27 Mar 2012 14:24:30 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2REOUEY089545;
	Tue, 27 Mar 2012 14:24:30 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <201203271424.q2REOUEY089545@svn.freebsd.org>
From: John Baldwin 
Date: Tue, 27 Mar 2012 14:24:30 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233547 - head/sys/ofed/include/linux
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 27 Mar 2012 14:24:30 -0000

Author: jhb
Date: Tue Mar 27 14:24:29 2012
New Revision: 233547
URL: http://svn.freebsd.org/changeset/base/233547

Log:
  Use VM_MEMATTR_UNCACHEABLE instead of VM_MEMATTR_UNCACHED for UC mappings.
  VM_MEMATTR_UNCACHED is actually the x86-specific UC- mode (where a WC
  MTRR can override the PAT setting).

Modified:
  head/sys/ofed/include/linux/io.h
  head/sys/ofed/include/linux/page.h

Modified: head/sys/ofed/include/linux/io.h
==============================================================================
--- head/sys/ofed/include/linux/io.h	Tue Mar 27 14:10:15 2012	(r233546)
+++ head/sys/ofed/include/linux/io.h	Tue Mar 27 14:24:29 2012	(r233547)
@@ -90,7 +90,7 @@ writew(uint16_t b, void *addr)
 
 void *_ioremap_attr(vm_paddr_t phys_addr, unsigned long size, int attr);
 #define	ioremap_nocache(addr, size)					\
-    _ioremap_attr((addr), (size), VM_MEMATTR_UNCACHED)
+    _ioremap_attr((addr), (size), VM_MEMATTR_UNCACHEABLE)
 #define	ioremap_wc(addr, size)						\
     _ioremap_attr((addr), (size), VM_MEMATTR_WRITE_COMBINING)
 #define	ioremap	ioremap_nocache

Modified: head/sys/ofed/include/linux/page.h
==============================================================================
--- head/sys/ofed/include/linux/page.h	Tue Mar 27 14:10:15 2012	(r233546)
+++ head/sys/ofed/include/linux/page.h	Tue Mar 27 14:24:29 2012	(r233547)
@@ -40,7 +40,7 @@
 #define	virt_to_page(x)	PHYS_TO_VM_PAGE(vtophys((x)))
 
 #define	clear_page(page)		memset((page), 0, PAGE_SIZE)
-#define	pgprot_noncached(prot)		VM_MEMATTR_UNCACHED
+#define	pgprot_noncached(prot)		VM_MEMATTR_UNCACHEABLE
 #define	pgprot_writecombine(prot)	VM_MEMATTR_WRITE_COMBINING
 
 #undef	PAGE_MASK

From owner-svn-src-head@FreeBSD.ORG  Tue Mar 27 14:35:00 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 25A10106564A;
	Tue, 27 Mar 2012 14:35:00 +0000 (UTC) (envelope-from jhb@freebsd.org)
Received: from bigwig.baldwin.cx (bigknife-pt.tunnel.tserv9.chi1.ipv6.he.net
	[IPv6:2001:470:1f10:75::2])
	by mx1.freebsd.org (Postfix) with ESMTP id EE7A48FC18;
	Tue, 27 Mar 2012 14:34:59 +0000 (UTC)
Received: from jhbbsd.localnet (unknown [209.249.190.124])
	by bigwig.baldwin.cx (Postfix) with ESMTPSA id 6F8F2B970;
	Tue, 27 Mar 2012 10:34:59 -0400 (EDT)
From: John Baldwin 
To: src-committers@freebsd.org
Date: Tue, 27 Mar 2012 10:34:58 -0400
User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p10; KDE/4.5.5; amd64; ; )
References: <201203271424.q2REOUEY089545@svn.freebsd.org>
In-Reply-To: <201203271424.q2REOUEY089545@svn.freebsd.org>
MIME-Version: 1.0
Content-Type: Text/Plain;
  charset="utf-8"
Content-Transfer-Encoding: 7bit
Message-Id: <201203271034.58875.jhb@freebsd.org>
X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7
	(bigwig.baldwin.cx); Tue, 27 Mar 2012 10:34:59 -0400 (EDT)
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org
Subject: Re: svn commit: r233547 - head/sys/ofed/include/linux
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 27 Mar 2012 14:35:00 -0000

On Tuesday, March 27, 2012 10:24:30 am John Baldwin wrote:
> Author: jhb
> Date: Tue Mar 27 14:24:29 2012
> New Revision: 233547
> URL: http://svn.freebsd.org/changeset/base/233547
> 
> Log:
>   Use VM_MEMATTR_UNCACHEABLE instead of VM_MEMATTR_UNCACHED for UC mappings.
>   VM_MEMATTR_UNCACHED is actually the x86-specific UC- mode (where a WC
>   MTRR can override the PAT setting).
> 
> Modified:
>   head/sys/ofed/include/linux/io.h
>   head/sys/ofed/include/linux/page.h

VM_MEMATTR_UNCACHED vs VM_MEMATTR_UNCACHEABLE is admittedly very ambiguous
(I used those names as that is how Intel labels the PAT modes in the
description of the PAT MSR).  I would like to rename VM_MEMATTR_UNCACHED to
VM_MEMATTR_WEAK_UNCACHEABLE and to remove it from other architectures.  In
the case of mips, this means renaming VM_MEMATTR_UNCACHED to 
VM_MEMATTR_UNCACHEABLE.

Does this sound ok to other folks?

Index: amd64/include/vm.h
===================================================================
--- amd64/include/vm.h	(revision 233508)
+++ amd64/include/vm.h	(working copy)
@@ -38,7 +38,7 @@
 #define	VM_MEMATTR_WRITE_THROUGH	((vm_memattr_t)PAT_WRITE_THROUGH)
 #define	VM_MEMATTR_WRITE_PROTECTED	((vm_memattr_t)PAT_WRITE_PROTECTED)
 #define	VM_MEMATTR_WRITE_BACK		((vm_memattr_t)PAT_WRITE_BACK)
-#define	VM_MEMATTR_UNCACHED		((vm_memattr_t)PAT_UNCACHED)
+#define	VM_MEMATTR_WEAK_UNCACHEABLE	((vm_memattr_t)PAT_UNCACHED)
 
 #define	VM_MEMATTR_DEFAULT		VM_MEMATTR_WRITE_BACK
 
Index: i386/include/vm.h
===================================================================
--- i386/include/vm.h	(revision 233508)
+++ i386/include/vm.h	(working copy)
@@ -38,7 +38,7 @@
 #define	VM_MEMATTR_WRITE_THROUGH	((vm_memattr_t)PAT_WRITE_THROUGH)
 #define	VM_MEMATTR_WRITE_PROTECTED	((vm_memattr_t)PAT_WRITE_PROTECTED)
 #define	VM_MEMATTR_WRITE_BACK		((vm_memattr_t)PAT_WRITE_BACK)
-#define	VM_MEMATTR_UNCACHED		((vm_memattr_t)PAT_UNCACHED)
+#define	VM_MEMATTR_WEAK_UNCACHEABLE	((vm_memattr_t)PAT_UNCACHED)
 
 #define	VM_MEMATTR_DEFAULT		VM_MEMATTR_WRITE_BACK
 
Index: mips/include/vm.h
===================================================================
--- mips/include/vm.h	(revision 233508)
+++ mips/include/vm.h	(working copy)
@@ -32,7 +32,7 @@
 #include 
 
 /* Memory attributes. */
-#define	VM_MEMATTR_UNCACHED	((vm_memattr_t)PTE_C_UNCACHED)
+#define	VM_MEMATTR_UNCACHEABLE	((vm_memattr_t)PTE_C_UNCACHED)
 #define	VM_MEMATTR_DEFAULT	((vm_memattr_t)PTE_C_CACHE)
 
 #endif /* !_MACHINE_VM_H_ */
Index: powerpc/include/vm.h
===================================================================
--- powerpc/include/vm.h	(revision 233508)
+++ powerpc/include/vm.h	(working copy)
@@ -34,7 +34,6 @@
 /* Memory attributes. */
 #define	VM_MEMATTR_DEFAULT		0
 #define	VM_MEMATTR_UNCACHEABLE		0x01
-#define	VM_MEMATTR_UNCACHED		VM_MEMATTR_UNCACHEABLE
 #define	VM_MEMATTR_CACHEABLE		0x02
 #define	VM_MEMATTR_WRITE_COMBINING	0x04
 #define	VM_MEMATTR_WRITE_BACK		0x08

-- 
John Baldwin

From owner-svn-src-head@FreeBSD.ORG  Tue Mar 27 14:48:41 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 0B1C2106564A;
	Tue, 27 Mar 2012 14:48:41 +0000 (UTC)
	(envelope-from jchandra@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id E8E248FC08;
	Tue, 27 Mar 2012 14:48:40 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2REmeFl090397;
	Tue, 27 Mar 2012 14:48:40 GMT
	(envelope-from jchandra@svn.freebsd.org)
Received: (from jchandra@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2REmeeY090392;
	Tue, 27 Mar 2012 14:48:40 GMT
	(envelope-from jchandra@svn.freebsd.org)
Message-Id: <201203271448.q2REmeeY090392@svn.freebsd.org>
From: "Jayachandran C." 
Date: Tue, 27 Mar 2012 14:48:40 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233549 - in head/sys/mips/nlm: . dev
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 27 Mar 2012 14:48:41 -0000

Author: jchandra
Date: Tue Mar 27 14:48:40 2012
New Revision: 233549
URL: http://svn.freebsd.org/changeset/base/233549

Log:
  XLP UART code udpate.
  
  Move XLP PCI UART device to sys/mips/nlm/dev/ directory.  Other
  drivers for the XLP SoC devices will be added here as well.
  Update uart_cpu_xlp.c and uart_pci_xlp.c use macros for uart port,
  speed and IO frequency.

Added:
  head/sys/mips/nlm/dev/uart_pci_xlp.c
     - copied, changed from r233508, head/sys/mips/nlm/uart_pci_xlp.c
Deleted:
  head/sys/mips/nlm/uart_pci_xlp.c
Modified:
  head/sys/mips/nlm/board.h
  head/sys/mips/nlm/files.xlp
  head/sys/mips/nlm/uart_cpu_xlp.c

Modified: head/sys/mips/nlm/board.h
==============================================================================
--- head/sys/mips/nlm/board.h	Tue Mar 27 14:24:46 2012	(r233548)
+++ head/sys/mips/nlm/board.h	Tue Mar 27 14:48:40 2012	(r233549)
@@ -43,6 +43,10 @@
 #define	EEPROM_SIZE	 	48
 #define	EEPROM_MACADDR_OFFSET	2
 
+/* used if there is no FDT */
+#define	BOARD_CONSOLE_SPEED	115200
+#define	BOARD_CONSOLE_UART	0
+
 /*
  * EVP board CPLD chip select and daughter card info field
  */

Copied and modified: head/sys/mips/nlm/dev/uart_pci_xlp.c (from r233508, head/sys/mips/nlm/uart_pci_xlp.c)
==============================================================================
--- head/sys/mips/nlm/uart_pci_xlp.c	Mon Mar 26 13:02:31 2012	(r233508, copy source)
+++ head/sys/mips/nlm/dev/uart_pci_xlp.c	Tue Mar 27 14:48:40 2012	(r233549)
@@ -1,30 +1,29 @@
 /*-
- * Copyright (c) 2011 Netlogic Microsystems Inc.
- *
- * (based on dev/uart/uart_bus_pci.c)
- * Copyright (c) 2006 Marcel Moolenaar
- * Copyright (c) 2001 M. Warner Losh
- * All rights reserved.
+ * Copyright (c) 2003-2012 Broadcom Corporation
+ * All Rights Reserved
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
+ *
  * 1. Redistributions of source code must retain the above copyright
  *    notice, this list of conditions and the following disclaimer.
  * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY BROADCOM ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL BROADCOM OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
 #include 
@@ -56,7 +55,8 @@ static device_method_t uart_soc_methods[
 	DEVMETHOD(device_probe,		uart_soc_probe),
 	DEVMETHOD(device_attach,	uart_bus_attach),
 	DEVMETHOD(device_detach,	uart_bus_detach),
-	{ 0, 0 }
+
+	DEVMETHOD_END
 };
 
 static driver_t uart_soc_driver = {
@@ -77,7 +77,7 @@ uart_soc_probe(device_t dev)
 	sc = device_get_softc(dev);
 	sc->sc_class = &uart_ns8250_class;
 	device_set_desc(dev, "Netlogic SoC UART");
-	return (uart_bus_probe(dev, 2, 133000000, 0, 0));
+	return (uart_bus_probe(dev, 2, XLP_IO_CLK, 0, 0));
 }
 
 DRIVER_MODULE(uart_soc, pci, uart_soc_driver, uart_devclass, 0, 0);

Modified: head/sys/mips/nlm/files.xlp
==============================================================================
--- head/sys/mips/nlm/files.xlp	Tue Mar 27 14:24:46 2012	(r233548)
+++ head/sys/mips/nlm/files.xlp	Tue Mar 27 14:48:40 2012	(r233549)
@@ -13,12 +13,13 @@ mips/nlm/board_eeprom.c				standard
 mips/nlm/board_cpld.c				standard
 mips/nlm/xlp_pci.c				optional pci
 mips/nlm/intern_dev.c				optional pci
-mips/nlm/uart_pci_xlp.c				optional uart
 mips/nlm/uart_cpu_xlp.c				optional uart
 mips/nlm/usb_init.c				optional usb
 #
-# Network driver and micro-core code
+# Simple SoC devices
+mips/nlm/dev/uart_pci_xlp.c			optional uart
 #
+# Network driver and micro-core code
 mips/nlm/dev/net/nae.c				optional xlpge
 mips/nlm/dev/net/mdio.c				optional xlpge
 mips/nlm/dev/net/sgmii.c			optional xlpge

Modified: head/sys/mips/nlm/uart_cpu_xlp.c
==============================================================================
--- head/sys/mips/nlm/uart_cpu_xlp.c	Tue Mar 27 14:24:46 2012	(r233548)
+++ head/sys/mips/nlm/uart_cpu_xlp.c	Tue Mar 27 14:48:40 2012	(r233549)
@@ -58,15 +58,18 @@ __FBSDID("$FreeBSD$");
 
 #include 
 #include 
+#include 
 #include 
 
+#include 
+
 bus_space_tag_t uart_bus_space_io;
 bus_space_tag_t uart_bus_space_mem;
 
 int
 uart_cpu_eqres(struct uart_bas *b1, struct uart_bas *b2)
 {
-	return ((b1->bsh == b2->bsh && b1->bst == b2->bst) ? 1 : 0);
+	return (b1->bsh == b2->bsh && b1->bst == b2->bst);
 }
 
 int
@@ -75,12 +78,12 @@ uart_cpu_getdev(int devtype, struct uart
 	di->ops = uart_getops(&uart_ns8250_class);
 	di->bas.chan = 0;
 	di->bas.bst = rmi_uart_bus_space;
-	di->bas.bsh = nlm_get_uart_regbase(0, 0);
+	di->bas.bsh = nlm_get_uart_regbase(0, BOARD_CONSOLE_UART);
 	
 	di->bas.regshft = 2;
 	/* divisor = rclk / (baudrate * 16); */
-	di->bas.rclk = 133000000;
-	di->baudrate = 115200;
+	di->bas.rclk = XLP_IO_CLK;
+	di->baudrate = BOARD_CONSOLE_SPEED;
 	di->databits = 8;
 	di->stopbits = 1;
 	di->parity = UART_PARITY_NONE;

From owner-svn-src-head@FreeBSD.ORG  Tue Mar 27 15:07:43 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id CFBE6106577F;
	Tue, 27 Mar 2012 15:07:43 +0000 (UTC)
	(envelope-from rstone@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id B95128FC0A;
	Tue, 27 Mar 2012 15:07:43 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2RF7hgN091114;
	Tue, 27 Mar 2012 15:07:43 GMT (envelope-from rstone@svn.freebsd.org)
Received: (from rstone@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2RF7hO2091110;
	Tue, 27 Mar 2012 15:07:43 GMT (envelope-from rstone@svn.freebsd.org)
Message-Id: <201203271507.q2RF7hO2091110@svn.freebsd.org>
From: Ryan Stone 
Date: Tue, 27 Mar 2012 15:07:43 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233552 - in head/sys: cddl/dev/sdt kern sys
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 27 Mar 2012 15:07:43 -0000

Author: rstone
Date: Tue Mar 27 15:07:43 2012
New Revision: 233552
URL: http://svn.freebsd.org/changeset/base/233552

Log:
  Instead of only iterating over the set of known SDT probes when sdt.ko is
  loaded and unloaded, also have sdt.ko register callbacks with kern_sdt.c
  that will be called when a newly loaded KLD module adds more probes or
  a module with probes is unloaded.
  
  This fixes two issues: first, if a module with SDT probes was loaded after
  sdt.ko was loaded, those new probes would not be available in DTrace.
  Second, if a module with SDT probes was unloaded while sdt.ko was loaded,
  the kernel would panic the next time DTrace had cause to try and do
  anything with the no-longer-existent probes.
  
  This makes it possible to create SDT probes in KLD modules, although there
  are still two caveats: first, any SDT probes in a KLD module must be part
  of a DTrace provider that is defined in that module.  At present DTrace
  only destroys probes when the provider is destroyed, so you can still
  panic the system if a KLD module creates new probes in a provider from a
  different module(including the kernel) and then unload the the first module.
  
  Second, the system will panic if you unload a module containing SDT probes
  while there is an active D script that has enabled those probes.
  
  MFC after:	1 month

Modified:
  head/sys/cddl/dev/sdt/sdt.c
  head/sys/kern/kern_sdt.c
  head/sys/sys/sdt.h

Modified: head/sys/cddl/dev/sdt/sdt.c
==============================================================================
--- head/sys/cddl/dev/sdt/sdt.c	Tue Mar 27 15:07:35 2012	(r233551)
+++ head/sys/cddl/dev/sdt/sdt.c	Tue Mar 27 15:07:43 2012	(r233552)
@@ -52,6 +52,8 @@ static void	sdt_destroy(void *, dtrace_i
 static void	sdt_enable(void *, dtrace_id_t, void *);
 static void	sdt_disable(void *, dtrace_id_t, void *);
 static void	sdt_load(void *);
+static int	sdt_provider_unreg_callback(struct sdt_provider *prov, 
+		    void *arg);
 
 static struct cdevsw sdt_cdevsw = {
 	.d_version	= D_VERSION,
@@ -190,7 +192,8 @@ sdt_load(void *dummy)
 
 	sdt_probe_func = dtrace_probe;
 
-	(void) sdt_provider_listall(sdt_provider_reg_callback, NULL);
+	sdt_register_callbacks(sdt_provider_reg_callback, NULL,
+	    sdt_provider_unreg_callback, NULL, sdt_probe_callback, NULL);
 }
 
 static int
@@ -206,7 +209,7 @@ sdt_unload()
 
 	sdt_probe_func = sdt_probe_stub;
 
-	(void) sdt_provider_listall(sdt_provider_unreg_callback, NULL);
+	sdt_deregister_callbacks();
 	
 	destroy_dev(sdt_cdev);
 

Modified: head/sys/kern/kern_sdt.c
==============================================================================
--- head/sys/kern/kern_sdt.c	Tue Mar 27 15:07:35 2012	(r233551)
+++ head/sys/kern/kern_sdt.c	Tue Mar 27 15:07:43 2012	(r233552)
@@ -59,6 +59,16 @@ static struct sx sdt_sx;
  */
 sdt_probe_func_t sdt_probe_func = sdt_probe_stub;
 
+static sdt_provider_listall_func_t sdt_provider_register_func = NULL;
+static sdt_provider_listall_func_t sdt_provider_deregister_func = NULL;
+static sdt_probe_listall_func_t sdt_probe_register_func = NULL;
+
+static void *sdt_provider_register_arg;
+static void *sdt_provider_deregister_arg;
+static void *sdt_probe_register_arg;
+
+static int sdt_provider_listall_locked(sdt_provider_listall_func_t, void *);
+
 /*
  * This is a stub for probe calls in case kernel DTrace support isn't
  * compiled in. It should never get called because there is no DTrace
@@ -85,6 +95,9 @@ sdt_provider_register(void *arg)
 
 	TAILQ_INIT(&prov->probe_list);
 
+	if (sdt_provider_register_func != NULL)
+		sdt_provider_register_func(prov, sdt_provider_register_arg);
+
 	sx_xunlock(&sdt_sx);
 }
 
@@ -100,6 +113,9 @@ sdt_provider_deregister(void *arg)
 
 	TAILQ_REMOVE(&sdt_provider_list, prov, prov_entry);
 
+	if (sdt_provider_deregister_func != NULL)
+		sdt_provider_deregister_func(prov, sdt_provider_deregister_arg);
+
 	sx_xunlock(&sdt_sx);
 }
 
@@ -128,6 +144,9 @@ sdt_probe_register(void *arg)
 
 	probe->state = SDT_INIT;
 
+	if (sdt_probe_register_func != NULL)
+		sdt_probe_register_func(probe, sdt_provider_register_arg);
+
 	sx_xunlock(&sdt_sx);
 }
 
@@ -203,20 +222,31 @@ SYSUNINIT(sdt, SI_SUB_KDTRACE, SI_ORDER_
  * List statically defined tracing providers.
  */
 int
-sdt_provider_listall(sdt_provider_listall_func_t callback_func,void *arg)
+sdt_provider_listall(sdt_provider_listall_func_t callback_func, void *arg)
+{
+	int error;
+
+	sx_xlock(&sdt_sx);
+	error = sdt_provider_listall_locked(callback_func, arg);
+	sx_xunlock(&sdt_sx);
+
+	return (error);
+}
+
+static int
+sdt_provider_listall_locked(sdt_provider_listall_func_t callback_func,
+    void *arg)
 {
 	int error = 0;
 	struct sdt_provider *prov;
 
-	sx_xlock(&sdt_sx);
+	sx_assert(&sdt_sx, SX_XLOCKED);
 
 	TAILQ_FOREACH(prov, &sdt_provider_list, prov_entry) {
 		if ((error = callback_func(prov, arg)) != 0)
 			break;
 	}
 
-	sx_xunlock(&sdt_sx);
-
 	return (error);
 }
 
@@ -271,3 +301,39 @@ sdt_argtype_listall(struct sdt_probe *pr
 
 	return (error);
 }
+
+void sdt_register_callbacks(sdt_provider_listall_func_t register_prov, 
+    void *reg_prov_arg, sdt_provider_listall_func_t deregister_prov, 
+    void *dereg_prov_arg, sdt_probe_listall_func_t register_probe, 
+    void * reg_probe_arg)
+{
+
+	sx_xlock(&sdt_sx);
+	sdt_provider_register_func = register_prov;
+	sdt_provider_deregister_func = deregister_prov;
+	sdt_probe_register_func = register_probe;
+
+	sdt_provider_register_arg = reg_prov_arg;
+	sdt_provider_deregister_arg = dereg_prov_arg;
+	sdt_probe_register_arg = reg_probe_arg;
+
+	sdt_provider_listall_locked(register_prov, reg_prov_arg);
+	sx_xunlock(&sdt_sx);
+}
+
+void sdt_deregister_callbacks(void)
+{
+
+	sx_xlock(&sdt_sx);
+	sdt_provider_listall_locked(sdt_provider_deregister_func, 
+	    sdt_provider_deregister_arg);
+
+	sdt_provider_register_func = NULL;
+	sdt_provider_deregister_func = NULL;
+	sdt_probe_register_func = NULL;
+
+	sdt_provider_register_arg = NULL;
+	sdt_provider_deregister_arg = NULL;
+	sdt_probe_register_arg = NULL;
+	sx_xunlock(&sdt_sx);
+}

Modified: head/sys/sys/sdt.h
==============================================================================
--- head/sys/sys/sdt.h	Tue Mar 27 15:07:35 2012	(r233551)
+++ head/sys/sys/sdt.h	Tue Mar 27 15:07:43 2012	(r233552)
@@ -258,6 +258,10 @@ int sdt_argtype_listall(struct sdt_probe
 int sdt_probe_listall(struct sdt_provider *, sdt_probe_listall_func_t, void *);
 int sdt_provider_listall(sdt_provider_listall_func_t,void *);
 
+void sdt_register_callbacks(sdt_provider_listall_func_t, void *,
+    sdt_provider_listall_func_t, void *, sdt_probe_listall_func_t, void *);
+void sdt_deregister_callbacks(void);
+
 #endif /* KDTRACE_HOOKS */
 
 #endif /* _KERNEL */

From owner-svn-src-head@FreeBSD.ORG  Tue Mar 27 15:13:13 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 46CBC1065675;
	Tue, 27 Mar 2012 15:13:13 +0000 (UTC)
	(envelope-from jchandra@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 27BB38FC12;
	Tue, 27 Mar 2012 15:13:13 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2RFDDui091348;
	Tue, 27 Mar 2012 15:13:13 GMT
	(envelope-from jchandra@svn.freebsd.org)
Received: (from jchandra@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2RFDCDq091343;
	Tue, 27 Mar 2012 15:13:12 GMT
	(envelope-from jchandra@svn.freebsd.org)
Message-Id: <201203271513.q2RFDCDq091343@svn.freebsd.org>
From: "Jayachandran C." 
Date: Tue, 27 Mar 2012 15:13:12 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233553 - head/sys/dev/cfi
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 27 Mar 2012 15:13:13 -0000

Author: jchandra
Date: Tue Mar 27 15:13:12 2012
New Revision: 233553
URL: http://svn.freebsd.org/changeset/base/233553

Log:
  CFI fixes for big endian archs.
  
  The flash commands and responses are little-endian and have to be
  byte swapped on big-endian systems.  However the raw read of data
  need not be swapped.
  
  Make the cfi_read and cfi_write do the swapping, and provide a
  cfi_read_raw which does not byte swap for reading data from
  flash.

Modified:
  head/sys/dev/cfi/cfi_core.c
  head/sys/dev/cfi/cfi_dev.c
  head/sys/dev/cfi/cfi_disk.c
  head/sys/dev/cfi/cfi_var.h

Modified: head/sys/dev/cfi/cfi_core.c
==============================================================================
--- head/sys/dev/cfi/cfi_core.c	Tue Mar 27 15:07:43 2012	(r233552)
+++ head/sys/dev/cfi/cfi_core.c	Tue Mar 27 15:13:12 2012	(r233553)
@@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include    
 #include 
@@ -54,7 +55,7 @@ devclass_t cfi_devclass;
 devclass_t cfi_diskclass;
 
 uint32_t
-cfi_read(struct cfi_softc *sc, u_int ofs)
+cfi_read_raw(struct cfi_softc *sc, u_int ofs)
 {
 	uint32_t val;
 
@@ -76,6 +77,32 @@ cfi_read(struct cfi_softc *sc, u_int ofs
 	return (val);
 }
 
+uint32_t
+cfi_read(struct cfi_softc *sc, u_int ofs)
+{
+	uint32_t val;
+	uint16_t sval;
+
+	ofs &= ~(sc->sc_width - 1);
+	switch (sc->sc_width) {
+	case 1:
+		val = bus_space_read_1(sc->sc_tag, sc->sc_handle, ofs);
+		break;
+	case 2:
+		sval = bus_space_read_2(sc->sc_tag, sc->sc_handle, ofs);
+		val = le16toh(sval);
+		break;
+	case 4:
+		val = bus_space_read_4(sc->sc_tag, sc->sc_handle, ofs);
+		val = le32toh(val);
+		break;
+	default:
+		val = ~0;
+		break;
+	}
+	return (val);
+}
+
 static void
 cfi_write(struct cfi_softc *sc, u_int ofs, u_int val)
 {
@@ -86,10 +113,10 @@ cfi_write(struct cfi_softc *sc, u_int of
 		bus_space_write_1(sc->sc_tag, sc->sc_handle, ofs, val);
 		break;
 	case 2:
-		bus_space_write_2(sc->sc_tag, sc->sc_handle, ofs, val);
+		bus_space_write_2(sc->sc_tag, sc->sc_handle, ofs, htole16(val));
 		break;
 	case 4:
-		bus_space_write_4(sc->sc_tag, sc->sc_handle, ofs, val);
+		bus_space_write_4(sc->sc_tag, sc->sc_handle, ofs, htole32(val));
 		break;
 	}
 }

Modified: head/sys/dev/cfi/cfi_dev.c
==============================================================================
--- head/sys/dev/cfi/cfi_dev.c	Tue Mar 27 15:07:43 2012	(r233552)
+++ head/sys/dev/cfi/cfi_dev.c	Tue Mar 27 15:13:12 2012	(r233553)
@@ -103,7 +103,7 @@ cfi_block_start(struct cfi_softc *sc, u_
 	/* Read the block from flash for byte-serving. */
 	ptr.x8 = sc->sc_wrbuf;
 	for (r = 0; r < sc->sc_wrbufsz; r += sc->sc_width) {
-		val = cfi_read(sc, sc->sc_wrofs + r);
+		val = cfi_read_raw(sc, sc->sc_wrofs + r);
 		switch (sc->sc_width) {
 		case 1:
 			*(ptr.x8)++ = val;
@@ -189,7 +189,7 @@ cfi_devread(struct cdev *dev, struct uio
 	while (error == 0 && uio->uio_resid > 0 &&
 	    uio->uio_offset < sc->sc_size) {
 		ofs = uio->uio_offset;
-		val = cfi_read(sc, ofs);
+		val = cfi_read_raw(sc, ofs);
 		switch (sc->sc_width) {
 		case 1:
 			buf.x8[0] = val;

Modified: head/sys/dev/cfi/cfi_disk.c
==============================================================================
--- head/sys/dev/cfi/cfi_disk.c	Tue Mar 27 15:07:43 2012	(r233552)
+++ head/sys/dev/cfi/cfi_disk.c	Tue Mar 27 15:13:12 2012	(r233553)
@@ -182,19 +182,19 @@ cfi_disk_read(struct cfi_softc *sc, stru
 	if (sc->sc_width == 1) {
 		uint8_t *dp = (uint8_t *)bp->bio_data;
 		while (resid > 0 && bp->bio_offset < sc->sc_size) {
-			*dp++ = cfi_read(sc, bp->bio_offset);
+			*dp++ = cfi_read_raw(sc, bp->bio_offset);
 			bp->bio_offset += 1, resid -= 1;
 		}
 	} else if (sc->sc_width == 2) {
 		uint16_t *dp = (uint16_t *)bp->bio_data;
 		while (resid > 0 && bp->bio_offset < sc->sc_size) {
-			*dp++ = cfi_read(sc, bp->bio_offset);
+			*dp++ = cfi_read_raw(sc, bp->bio_offset);
 			bp->bio_offset += 2, resid -= 2;
 		}
 	} else {
 		uint32_t *dp = (uint32_t *)bp->bio_data;
 		while (resid > 0 && bp->bio_offset < sc->sc_size) {
-			*dp++ = cfi_read(sc, bp->bio_offset);
+			*dp++ = cfi_read_raw(sc, bp->bio_offset);
 			bp->bio_offset += 4, resid -= 4;
 		}
 	}

Modified: head/sys/dev/cfi/cfi_var.h
==============================================================================
--- head/sys/dev/cfi/cfi_var.h	Tue Mar 27 15:07:43 2012	(r233552)
+++ head/sys/dev/cfi/cfi_var.h	Tue Mar 27 15:13:12 2012	(r233553)
@@ -71,6 +71,7 @@ int cfi_probe(device_t);
 int cfi_attach(device_t);
 int cfi_detach(device_t);
 
+uint32_t cfi_read_raw(struct cfi_softc *, u_int);
 uint32_t cfi_read(struct cfi_softc *, u_int);
 uint8_t cfi_read_qry(struct cfi_softc *, u_int);
 int cfi_write_block(struct cfi_softc *);

From owner-svn-src-head@FreeBSD.ORG  Tue Mar 27 15:14:30 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 4708F106566C;
	Tue, 27 Mar 2012 15:14:30 +0000 (UTC) (envelope-from bz@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 188FE8FC22;
	Tue, 27 Mar 2012 15:14:30 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2RFETog091436;
	Tue, 27 Mar 2012 15:14:29 GMT (envelope-from bz@svn.freebsd.org)
Received: (from bz@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2RFETuI091433;
	Tue, 27 Mar 2012 15:14:29 GMT (envelope-from bz@svn.freebsd.org)
Message-Id: <201203271514.q2RFETuI091433@svn.freebsd.org>
From: "Bjoern A. Zeeb" 
Date: Tue, 27 Mar 2012 15:14:29 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233554 - head/sys/netinet
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 27 Mar 2012 15:14:30 -0000

Author: bz
Date: Tue Mar 27 15:14:29 2012
New Revision: 233554
URL: http://svn.freebsd.org/changeset/base/233554

Log:
  Export the udp_cksum sysctl for upcoming SCTP work.  Rather than always,
  SCTP will only do IPv4 UDP checksum calculation as defined by the host
  policy.  When tunneling SCTP always calculates the inner checksum already
  so not doing the outer UDP can save cycles.
  
  While here virtualize the variable.
  
  Requested by:	tuexen
  MFC after:	2 weeks

Modified:
  head/sys/netinet/udp_usrreq.c
  head/sys/netinet/udp_var.h

Modified: head/sys/netinet/udp_usrreq.c
==============================================================================
--- head/sys/netinet/udp_usrreq.c	Tue Mar 27 15:13:12 2012	(r233553)
+++ head/sys/netinet/udp_usrreq.c	Tue Mar 27 15:14:29 2012	(r233554)
@@ -105,9 +105,9 @@ __FBSDID("$FreeBSD$");
  * packets that would otherwise be discarded due to bad checksums, and may
  * cause problems (especially for NFS data blocks).
  */
-static int	udp_cksum = 1;
-SYSCTL_INT(_net_inet_udp, UDPCTL_CHECKSUM, checksum, CTLFLAG_RW, &udp_cksum,
-    0, "compute udp checksum");
+VNET_DEFINE(int, udp_cksum) = 1;
+SYSCTL_VNET_INT(_net_inet_udp, UDPCTL_CHECKSUM, checksum, CTLFLAG_RW,
+    &VNET_NAME(udp_cksum), 0, "compute udp checksum");
 
 int	udp_log_in_vain = 0;
 SYSCTL_INT(_net_inet_udp, OID_AUTO, log_in_vain, CTLFLAG_RW,
@@ -1212,7 +1212,7 @@ udp_output(struct inpcb *inp, struct mbu
 	/*
 	 * Set up checksum and output datagram.
 	 */
-	if (udp_cksum) {
+	if (V_udp_cksum) {
 		if (inp->inp_flags & INP_ONESBCAST)
 			faddr.s_addr = INADDR_BROADCAST;
 		ui->ui_sum = in_pseudo(ui->ui_src.s_addr, faddr.s_addr,

Modified: head/sys/netinet/udp_var.h
==============================================================================
--- head/sys/netinet/udp_var.h	Tue Mar 27 15:13:12 2012	(r233553)
+++ head/sys/netinet/udp_var.h	Tue Mar 27 15:14:29 2012	(r233554)
@@ -139,8 +139,10 @@ VNET_DECLARE(struct inpcbinfo, udbinfo);
 
 extern u_long			udp_sendspace;
 extern u_long			udp_recvspace;
+VNET_DECLARE(int, udp_cksum);
 VNET_DECLARE(struct udpstat, udpstat);
 VNET_DECLARE(int, udp_blackhole);
+#define	V_udp_cksum		VNET(udp_cksum)
 #define	V_udpstat		VNET(udpstat)
 #define	V_udp_blackhole		VNET(udp_blackhole)
 extern int			udp_log_in_vain;

From owner-svn-src-head@FreeBSD.ORG  Tue Mar 27 15:15:31 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 7F7831065670;
	Tue, 27 Mar 2012 15:15:31 +0000 (UTC)
	(envelope-from jkim@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 68F788FC1A;
	Tue, 27 Mar 2012 15:15:31 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2RFFVmw091512;
	Tue, 27 Mar 2012 15:15:31 GMT (envelope-from jkim@svn.freebsd.org)
Received: (from jkim@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2RFFVQq091507;
	Tue, 27 Mar 2012 15:15:31 GMT (envelope-from jkim@svn.freebsd.org)
Message-Id: <201203271515.q2RFFVQq091507@svn.freebsd.org>
From: Jung-uk Kim 
Date: Tue, 27 Mar 2012 15:15:31 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233555 - in head/sys/contrib/dev/acpica:
	components/namespace include
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 27 Mar 2012 15:15:31 -0000

Author: jkim
Date: Tue Mar 27 15:15:30 2012
New Revision: 233555
URL: http://svn.freebsd.org/changeset/base/233555

Log:
  MFV:	r233550
  
  Temporarily revert an upstream commit.  This change caused regressions for
  too many laptop users.  Especially, automatic repair for broken _BIF caused
  strange reference counting issues and kernal panics.  This reverts:
  
  https://github.com/otcshare/acpica/commit/c995fed15ab41f6feae1299876271ea330f5c1c5

Modified:
  head/sys/contrib/dev/acpica/components/namespace/nspredef.c
  head/sys/contrib/dev/acpica/components/namespace/nsrepair.c
  head/sys/contrib/dev/acpica/include/aclocal.h
  head/sys/contrib/dev/acpica/include/acnamesp.h
Directory Properties:
  head/sys/contrib/dev/acpica/   (props changed)
  head/sys/contrib/dev/acpica/components/namespace/   (props changed)
  head/sys/contrib/dev/acpica/include/   (props changed)

Modified: head/sys/contrib/dev/acpica/components/namespace/nspredef.c
==============================================================================
--- head/sys/contrib/dev/acpica/components/namespace/nspredef.c	Tue Mar 27 15:14:29 2012	(r233554)
+++ head/sys/contrib/dev/acpica/components/namespace/nspredef.c	Tue Mar 27 15:15:30 2012	(r233555)
@@ -681,7 +681,7 @@ AcpiNsCheckPackage (
         {
             /* Create the new outer package and populate it */
 
-            Status = AcpiNsWrapWithPackage (Data, *Elements, ReturnObjectPtr);
+            Status = AcpiNsRepairPackageList (Data, ReturnObjectPtr);
             if (ACPI_FAILURE (Status))
             {
                 return (Status);

Modified: head/sys/contrib/dev/acpica/components/namespace/nsrepair.c
==============================================================================
--- head/sys/contrib/dev/acpica/components/namespace/nsrepair.c	Tue Mar 27 15:14:29 2012	(r233554)
+++ head/sys/contrib/dev/acpica/components/namespace/nsrepair.c	Tue Mar 27 15:15:30 2012	(r233555)
@@ -74,10 +74,11 @@
  * Buffer  -> String
  * Buffer  -> Package of Integers
  * Package -> Package of one Package
- * An incorrect standalone object is wrapped with required outer package
  *
  * Additional possible repairs:
+ *
  * Required package elements that are NULL replaced by Integer/String/Buffer
+ * Incorrect standalone package wrapped with required outer package
  *
  ******************************************************************************/
 
@@ -99,6 +100,11 @@ AcpiNsConvertToBuffer (
     ACPI_OPERAND_OBJECT     *OriginalObject,
     ACPI_OPERAND_OBJECT     **ReturnObject);
 
+static ACPI_STATUS
+AcpiNsConvertToPackage (
+    ACPI_OPERAND_OBJECT     *OriginalObject,
+    ACPI_OPERAND_OBJECT     **ReturnObject);
+
 
 /*******************************************************************************
  *
@@ -166,24 +172,10 @@ AcpiNsRepairObject (
     }
     if (ExpectedBtypes & ACPI_RTYPE_PACKAGE)
     {
-        /*
-         * A package is expected. We will wrap the existing object with a
-         * new package object. It is often the case that if a variable-length
-         * package is required, but there is only a single object needed, the
-         * BIOS will return that object instead of wrapping it with a Package
-         * object. Note: after the wrapping, the package will be validated
-         * for correct contents (expected object type or types).
-         */
-        Status = AcpiNsWrapWithPackage (Data, ReturnObject, &NewObject);
+        Status = AcpiNsConvertToPackage (ReturnObject, &NewObject);
         if (ACPI_SUCCESS (Status))
         {
-            /*
-             * The original object just had its reference count
-             * incremented for being inserted into the new package.
-             */
-            *ReturnObjectPtr = NewObject;       /* New Package object */
-            Data->Flags |= ACPI_OBJECT_REPAIRED;
-            return (AE_OK);
+            goto ObjectRepaired;
         }
     }
 
@@ -196,27 +188,24 @@ ObjectRepaired:
 
     /* Object was successfully repaired */
 
+    /*
+     * If the original object is a package element, we need to:
+     * 1. Set the reference count of the new object to match the
+     *    reference count of the old object.
+     * 2. Decrement the reference count of the original object.
+     */
     if (PackageIndex != ACPI_NOT_PACKAGE_ELEMENT)
     {
-        /*
-         * The original object is a package element. We need to
-         * decrement the reference count of the original object,
-         * for removing it from the package.
-         *
-         * However, if the original object was just wrapped with a
-         * package object as part of the repair, we don't need to
-         * change the reference count.
-         */
-        if (!(Data->Flags & ACPI_OBJECT_WRAPPED))
+        NewObject->Common.ReferenceCount =
+            ReturnObject->Common.ReferenceCount;
+
+        if (ReturnObject->Common.ReferenceCount > 1)
         {
-            if (ReturnObject->Common.ReferenceCount > 1)
-            {
-                ReturnObject->Common.ReferenceCount--;
-            }
+            ReturnObject->Common.ReferenceCount--;
         }
 
         ACPI_DEBUG_PRINT ((ACPI_DB_REPAIR,
-            "%s: Converted %s to expected %s at Package index %u\n",
+            "%s: Converted %s to expected %s at index %u\n",
             Data->Pathname, AcpiUtGetObjectTypeName (ReturnObject),
             AcpiUtGetObjectTypeName (NewObject), PackageIndex));
     }
@@ -509,6 +498,71 @@ AcpiNsConvertToBuffer (
 
 /*******************************************************************************
  *
+ * FUNCTION:    AcpiNsConvertToPackage
+ *
+ * PARAMETERS:  OriginalObject      - Object to be converted
+ *              ReturnObject        - Where the new converted object is returned
+ *
+ * RETURN:      Status. AE_OK if conversion was successful.
+ *
+ * DESCRIPTION: Attempt to convert a Buffer object to a Package. Each byte of
+ *              the buffer is converted to a single integer package element.
+ *
+ ******************************************************************************/
+
+static ACPI_STATUS
+AcpiNsConvertToPackage (
+    ACPI_OPERAND_OBJECT     *OriginalObject,
+    ACPI_OPERAND_OBJECT     **ReturnObject)
+{
+    ACPI_OPERAND_OBJECT     *NewObject;
+    ACPI_OPERAND_OBJECT     **Elements;
+    UINT32                  Length;
+    UINT8                   *Buffer;
+
+
+    switch (OriginalObject->Common.Type)
+    {
+    case ACPI_TYPE_BUFFER:
+
+        /* Buffer-to-Package conversion */
+
+        Length = OriginalObject->Buffer.Length;
+        NewObject = AcpiUtCreatePackageObject (Length);
+        if (!NewObject)
+        {
+            return (AE_NO_MEMORY);
+        }
+
+        /* Convert each buffer byte to an integer package element */
+
+        Elements = NewObject->Package.Elements;
+        Buffer = OriginalObject->Buffer.Pointer;
+
+        while (Length--)
+        {
+            *Elements = AcpiUtCreateIntegerObject ((UINT64) *Buffer);
+            if (!*Elements)
+            {
+                AcpiUtRemoveReference (NewObject);
+                return (AE_NO_MEMORY);
+            }
+            Elements++;
+            Buffer++;
+        }
+        break;
+
+    default:
+        return (AE_AML_OPERAND_TYPE);
+    }
+
+    *ReturnObject = NewObject;
+    return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
  * FUNCTION:    AcpiNsRepairNullElement
  *
  * PARAMETERS:  Data                - Pointer to validation data structure
@@ -691,43 +745,42 @@ AcpiNsRemoveNullElements (
 
 /*******************************************************************************
  *
- * FUNCTION:    AcpiNsWrapWithPackage
+ * FUNCTION:    AcpiNsRepairPackageList
  *
  * PARAMETERS:  Data                - Pointer to validation data structure
- *              OriginalObject      - Pointer to the object to repair.
- *              ObjDescPtr          - The new package object is returned here
+ *              ObjDescPtr          - Pointer to the object to repair. The new
+ *                                    package object is returned here,
+ *                                    overwriting the old object.
  *
  * RETURN:      Status, new object in *ObjDescPtr
  *
- * DESCRIPTION: Repair a common problem with objects that are defined to
- *              return a variable-length Package of sub-objects. If there is
- *              only one sub-object, some BIOS code mistakenly simply declares
- *              the single object instead of a Package with one sub-object.
- *              This function attempts to repair this error by wrapping a
- *              Package object around the original object, creating the
- *              correct and expected Package with one sub-object.
+ * DESCRIPTION: Repair a common problem with objects that are defined to return
+ *              a variable-length Package of Packages. If the variable-length
+ *              is one, some BIOS code mistakenly simply declares a single
+ *              Package instead of a Package with one sub-Package. This
+ *              function attempts to repair this error by wrapping a Package
+ *              object around the original Package, creating the correct
+ *              Package with one sub-Package.
  *
  *              Names that can be repaired in this manner include:
- *              _ALR, _CSD, _HPX, _MLS, _PLD, _PRT, _PSS, _TRT, _TSS,
- *              _BCL, _DOD, _FIX, _Sx
+ *              _ALR, _CSD, _HPX, _MLS, _PRT, _PSS, _TRT, TSS
  *
  ******************************************************************************/
 
 ACPI_STATUS
-AcpiNsWrapWithPackage (
+AcpiNsRepairPackageList (
     ACPI_PREDEFINED_DATA    *Data,
-    ACPI_OPERAND_OBJECT     *OriginalObject,
     ACPI_OPERAND_OBJECT     **ObjDescPtr)
 {
     ACPI_OPERAND_OBJECT     *PkgObjDesc;
 
 
-    ACPI_FUNCTION_NAME (NsWrapWithPackage);
+    ACPI_FUNCTION_NAME (NsRepairPackageList);
 
 
     /*
      * Create the new outer package and populate it. The new package will
-     * have a single element, the lone sub-object.
+     * have a single element, the lone subpackage.
      */
     PkgObjDesc = AcpiUtCreatePackageObject (1);
     if (!PkgObjDesc)
@@ -735,15 +788,15 @@ AcpiNsWrapWithPackage (
         return (AE_NO_MEMORY);
     }
 
-    PkgObjDesc->Package.Elements[0] = OriginalObject;
-
-    ACPI_DEBUG_PRINT ((ACPI_DB_REPAIR,
-        "%s: Wrapped %s with expected Package object\n",
-        Data->Pathname, AcpiUtGetObjectTypeName (OriginalObject)));
+    PkgObjDesc->Package.Elements[0] = *ObjDescPtr;
 
     /* Return the new object in the object pointer */
 
     *ObjDescPtr = PkgObjDesc;
-    Data->Flags |= ACPI_OBJECT_REPAIRED | ACPI_OBJECT_WRAPPED;
+    Data->Flags |= ACPI_OBJECT_REPAIRED;
+
+    ACPI_DEBUG_PRINT ((ACPI_DB_REPAIR,
+        "%s: Repaired incorrectly formed Package\n", Data->Pathname));
+
     return (AE_OK);
 }

Modified: head/sys/contrib/dev/acpica/include/aclocal.h
==============================================================================
--- head/sys/contrib/dev/acpica/include/aclocal.h	Tue Mar 27 15:14:29 2012	(r233554)
+++ head/sys/contrib/dev/acpica/include/aclocal.h	Tue Mar 27 15:15:30 2012	(r233555)
@@ -424,7 +424,6 @@ typedef struct acpi_predefined_data
 /* Defines for Flags field above */
 
 #define ACPI_OBJECT_REPAIRED    1
-#define ACPI_OBJECT_WRAPPED     2
 
 
 /*

Modified: head/sys/contrib/dev/acpica/include/acnamesp.h
==============================================================================
--- head/sys/contrib/dev/acpica/include/acnamesp.h	Tue Mar 27 15:14:29 2012	(r233554)
+++ head/sys/contrib/dev/acpica/include/acnamesp.h	Tue Mar 27 15:15:30 2012	(r233555)
@@ -368,9 +368,8 @@ AcpiNsRepairObject (
     ACPI_OPERAND_OBJECT     **ReturnObjectPtr);
 
 ACPI_STATUS
-AcpiNsWrapWithPackage (
+AcpiNsRepairPackageList (
     ACPI_PREDEFINED_DATA    *Data,
-    ACPI_OPERAND_OBJECT     *OriginalObject,
     ACPI_OPERAND_OBJECT     **ObjDescPtr);
 
 ACPI_STATUS

From owner-svn-src-head@FreeBSD.ORG  Tue Mar 27 15:16:39 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 33ED2106566C;
	Tue, 27 Mar 2012 15:16:39 +0000 (UTC)
	(envelope-from jchandra@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 130C08FC19;
	Tue, 27 Mar 2012 15:16:39 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2RFGcoD091601;
	Tue, 27 Mar 2012 15:16:38 GMT
	(envelope-from jchandra@svn.freebsd.org)
Received: (from jchandra@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2RFGcBv091596;
	Tue, 27 Mar 2012 15:16:38 GMT
	(envelope-from jchandra@svn.freebsd.org)
Message-Id: <201203271516.q2RFGcBv091596@svn.freebsd.org>
From: "Jayachandran C." 
Date: Tue, 27 Mar 2012 15:16:38 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233556 - in head/sys/mips: conf nlm nlm/dev
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 27 Mar 2012 15:16:39 -0000

Author: jchandra
Date: Tue Mar 27 15:16:38 2012
New Revision: 233556
URL: http://svn.freebsd.org/changeset/base/233556

Log:
  NOR flash driver for XLP.
  
  The NOR interface on the SoC appears on the top level PCI bus. Add
  a simple driver for this.

Added:
  head/sys/mips/nlm/dev/cfi_pci_xlp.c   (contents, props changed)
Modified:
  head/sys/mips/conf/std.XLP
  head/sys/mips/nlm/files.xlp
  head/sys/mips/nlm/xlp_pci.c

Modified: head/sys/mips/conf/std.XLP
==============================================================================
--- head/sys/mips/conf/std.XLP	Tue Mar 27 15:15:30 2012	(r233555)
+++ head/sys/mips/conf/std.XLP	Tue Mar 27 15:16:38 2012	(r233556)
@@ -106,3 +106,7 @@ device		nlmrsa
 # Options that use crypto
 options 	IPSEC
 options 	GEOM_ELI
+
+# NOR
+device		cfi
+device		cfid

Added: head/sys/mips/nlm/dev/cfi_pci_xlp.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sys/mips/nlm/dev/cfi_pci_xlp.c	Tue Mar 27 15:16:38 2012	(r233556)
@@ -0,0 +1,77 @@
+/*-
+ * Copyright (c) 2003-2012 Broadcom Corporation
+ * All Rights Reserved
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY BROADCOM ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL BROADCOM OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#include 
+
+#include 
+#include 
+
+static int cfi_xlp_probe(device_t dev);
+
+static device_method_t cfi_xlp_methods[] = {
+	/* Device interface */
+	DEVMETHOD(device_probe,		cfi_xlp_probe),
+	DEVMETHOD(device_attach,	cfi_attach),
+	DEVMETHOD(device_detach,	cfi_detach),
+	DEVMETHOD_END
+};
+
+static driver_t cfi_xlp_driver = {
+	cfi_driver_name,
+	cfi_xlp_methods,
+	sizeof(struct cfi_softc),
+};
+
+static int
+cfi_xlp_probe(device_t dev)
+{
+
+	if (pci_get_vendor(dev) != PCI_VENDOR_NETLOGIC ||
+	    pci_get_device(dev) != PCI_DEVICE_ID_NLM_NOR)
+		return (ENXIO);
+
+	device_set_desc(dev, "Netlogic XLP NOR Bus");
+	return (cfi_probe(dev));
+}
+
+DRIVER_MODULE(cfi_xlp, pci, cfi_xlp_driver, cfi_devclass, 0, 0);

Modified: head/sys/mips/nlm/files.xlp
==============================================================================
--- head/sys/mips/nlm/files.xlp	Tue Mar 27 15:15:30 2012	(r233555)
+++ head/sys/mips/nlm/files.xlp	Tue Mar 27 15:16:38 2012	(r233556)
@@ -18,6 +18,7 @@ mips/nlm/usb_init.c				optional usb
 #
 # Simple SoC devices
 mips/nlm/dev/uart_pci_xlp.c			optional uart
+mips/nlm/dev/cfi_pci_xlp.c			optional cfi
 #
 # Network driver and micro-core code
 mips/nlm/dev/net/nae.c				optional xlpge

Modified: head/sys/mips/nlm/xlp_pci.c
==============================================================================
--- head/sys/mips/nlm/xlp_pci.c	Tue Mar 27 15:15:30 2012	(r233555)
+++ head/sys/mips/nlm/xlp_pci.c	Tue Mar 27 15:16:38 2012	(r233556)
@@ -62,6 +62,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -479,6 +480,7 @@ assign_soc_resource(device_t child, int 
     u_long *countp, struct rman **rm, bus_space_tag_t *bst, vm_offset_t *va)
 {
 	int devid, inst, node, unit;
+	uint32_t val;
 
 	devid = pci_get_device(child);
 	inst = pci_get_function(child);
@@ -506,6 +508,15 @@ assign_soc_resource(device_t child, int 
 			*rm = &emul_rman;
 			*bst = uart_bus_space_mem;
 			break;
+		case PCI_DEVICE_ID_NLM_NOR:
+			/* XXXJC: support multiple chip selects */
+			val = nlm_read_pci_reg(nlm_get_gbu_regbase(node), 0);
+			*startp = val << 8;
+			*va = MIPS_PHYS_TO_KSEG1(*startp);
+			/* XXXJC: count is not correct */
+			*countp = 0x100;
+			*rm = &emul_rman;
+			break;
 		}
 		/* calculate end if allocated */
 		if (*rm)

From owner-svn-src-head@FreeBSD.ORG  Tue Mar 27 15:22:11 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 6066A106566C;
	Tue, 27 Mar 2012 15:22:11 +0000 (UTC)
	(envelope-from joel@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 312948FC12;
	Tue, 27 Mar 2012 15:22:11 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2RFMBhg091874;
	Tue, 27 Mar 2012 15:22:11 GMT (envelope-from joel@svn.freebsd.org)
Received: (from joel@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2RFMAiE091871;
	Tue, 27 Mar 2012 15:22:10 GMT (envelope-from joel@svn.freebsd.org)
Message-Id: <201203271522.q2RFMAiE091871@svn.freebsd.org>
From: Joel Dahl 
Date: Tue, 27 Mar 2012 15:22:10 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233557 - head/lib/libc/rpc
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 27 Mar 2012 15:22:11 -0000

Author: joel (doc committer)
Date: Tue Mar 27 15:22:10 2012
New Revision: 233557
URL: http://svn.freebsd.org/changeset/base/233557

Log:
  Minor mdoc nit.

Modified:
  head/lib/libc/rpc/rpc_soc.3

Modified: head/lib/libc/rpc/rpc_soc.3
==============================================================================
--- head/lib/libc/rpc/rpc_soc.3	Tue Mar 27 15:16:38 2012	(r233556)
+++ head/lib/libc/rpc/rpc_soc.3	Tue Mar 27 15:22:10 2012	(r233557)
@@ -111,8 +111,8 @@ Secure
 can be used only if
 .Tn DES
 encryption is available.
-.Bl -tag -width indent -compact
 .Pp
+.Bl -tag -width indent -compact
 .It Xo
 .Ft void
 .Xc

From owner-svn-src-head@FreeBSD.ORG  Tue Mar 27 15:27:21 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 53C981065670;
	Tue, 27 Mar 2012 15:27:21 +0000 (UTC)
	(envelope-from jkim@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 3BE9A8FC12;
	Tue, 27 Mar 2012 15:27:21 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2RFRLPt092104;
	Tue, 27 Mar 2012 15:27:21 GMT (envelope-from jkim@svn.freebsd.org)
Received: (from jkim@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2RFRLs5092102;
	Tue, 27 Mar 2012 15:27:21 GMT (envelope-from jkim@svn.freebsd.org)
Message-Id: <201203271527.q2RFRLs5092102@svn.freebsd.org>
From: Jung-uk Kim 
Date: Tue, 27 Mar 2012 15:27:21 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233558 - head/sys/contrib/dev/acpica/components/parser
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 27 Mar 2012 15:27:21 -0000

Author: jkim
Date: Tue Mar 27 15:27:20 2012
New Revision: 233558
URL: http://svn.freebsd.org/changeset/base/233558

Log:
  MFV:	r233551
  
  Fix two possible memory leaks in error path.
  
  Obtained from:	ACPICA

Modified:
  head/sys/contrib/dev/acpica/components/parser/psargs.c
Directory Properties:
  head/sys/contrib/dev/acpica/   (props changed)
  head/sys/contrib/dev/acpica/components/parser/   (props changed)

Modified: head/sys/contrib/dev/acpica/components/parser/psargs.c
==============================================================================
--- head/sys/contrib/dev/acpica/components/parser/psargs.c	Tue Mar 27 15:22:10 2012	(r233557)
+++ head/sys/contrib/dev/acpica/components/parser/psargs.c	Tue Mar 27 15:27:20 2012	(r233558)
@@ -672,6 +672,7 @@ AcpiPsGetNextField (
                 Arg = AcpiPsAllocOp (AML_INT_BYTELIST_OP);
                 if (!Arg)
                 {
+                    AcpiPsFreeOp (Field);
                     return_PTR (NULL);
                 }
 
@@ -717,6 +718,7 @@ AcpiPsGetNextField (
             Arg = AcpiPsAllocOp (AML_INT_NAMEPATH_OP);
             if (!Arg)
             {
+                AcpiPsFreeOp (Field);
                 return_PTR (NULL);
             }
 

From owner-svn-src-head@FreeBSD.ORG  Tue Mar 27 15:39:56 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 90793106566B;
	Tue, 27 Mar 2012 15:39:56 +0000 (UTC)
	(envelope-from jchandra@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 7997D8FC08;
	Tue, 27 Mar 2012 15:39:56 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2RFdu5C092803;
	Tue, 27 Mar 2012 15:39:56 GMT
	(envelope-from jchandra@svn.freebsd.org)
Received: (from jchandra@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2RFduw6092794;
	Tue, 27 Mar 2012 15:39:56 GMT
	(envelope-from jchandra@svn.freebsd.org)
Message-Id: <201203271539.q2RFduw6092794@svn.freebsd.org>
From: "Jayachandran C." 
Date: Tue, 27 Mar 2012 15:39:56 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233563 - in head/sys/mips/nlm: . hal
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 27 Mar 2012 15:39:56 -0000

Author: jchandra
Date: Tue Mar 27 15:39:55 2012
New Revision: 233563
URL: http://svn.freebsd.org/changeset/base/233563

Log:
  Update memory and resource allocation code for SoC devices
  
  The XLP on-chip devices have PCI configuration headers, but some of the
  devices need custom resource allocation code.
  - devices with no MEM/IO BARs with registers in PCIe extended reg
    space have to be handled in memory resource allocation
  - devices without INTPIN/INTLINE in PCI header can be supported
    by having these faked with a shadow register.
  - Some devices does not allow 8/16 bit access to the register space,
    he default bus space cannot be used for these.
  
  Subclass pci and override attach and resource allocation methods to
  take care of this.
  
  Remove earlier code which did this partially.

Deleted:
  head/sys/mips/nlm/intern_dev.c
Modified:
  head/sys/mips/nlm/files.xlp
  head/sys/mips/nlm/hal/nlm_hal.c
  head/sys/mips/nlm/hal/pcibus.h
  head/sys/mips/nlm/hal/pic.h
  head/sys/mips/nlm/intr_machdep.c
  head/sys/mips/nlm/xlp.h
  head/sys/mips/nlm/xlp_machdep.c
  head/sys/mips/nlm/xlp_pci.c

Modified: head/sys/mips/nlm/files.xlp
==============================================================================
--- head/sys/mips/nlm/files.xlp	Tue Mar 27 15:33:38 2012	(r233562)
+++ head/sys/mips/nlm/files.xlp	Tue Mar 27 15:39:55 2012	(r233563)
@@ -12,7 +12,6 @@ mips/nlm/mpreset.S				standard
 mips/nlm/board_eeprom.c				standard
 mips/nlm/board_cpld.c				standard
 mips/nlm/xlp_pci.c				optional pci
-mips/nlm/intern_dev.c				optional pci
 mips/nlm/uart_cpu_xlp.c				optional uart
 mips/nlm/usb_init.c				optional usb
 #

Modified: head/sys/mips/nlm/hal/nlm_hal.c
==============================================================================
--- head/sys/mips/nlm/hal/nlm_hal.c	Tue Mar 27 15:33:38 2012	(r233562)
+++ head/sys/mips/nlm/hal/nlm_hal.c	Tue Mar 27 15:39:55 2012	(r233563)
@@ -37,23 +37,8 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
 
-#include 
-#include 
-#include 
-#include 
-
-int pic_irt_ehci0;
-int pic_irt_ehci1;
-int pic_irt_uart0;
-int pic_irt_uart1;
-int pic_irt_pcie_lnk0;
-int pic_irt_pcie_lnk1;
-int pic_irt_pcie_lnk2;
-int pic_irt_pcie_lnk3;
-
 uint32_t
 xlp_get_cpu_frequency(int node, int core)
 {
@@ -66,9 +51,9 @@ xlp_get_cpu_frequency(int node, int core
 	pll_divf = ((rstval >> 10) & 0x7f) + 1;
 	pll_divr = ((rstval >> 8)  & 0x3) + 1;
 	if (!nlm_is_xlp8xx_ax())
-		ext_div  = ((rstval >> 30) & 0x3) + 1;
+		ext_div = ((rstval >> 30) & 0x3) + 1;
 	else
-		ext_div  = 1;
+		ext_div = 1;
 	dfs_div  = ((dfsval >> (core << 2)) & 0xf) + 1;
 
 	return ((800000000ULL * pll_divf)/(3 * pll_divr * ext_div * dfs_div));
@@ -122,98 +107,3 @@ nlm_set_device_frequency(int node, int d
 	}
 	return (nlm_get_device_frequency(sysbase, devtype));
 }
-
-void
-nlm_pic_irt_init(int node)
-{
-	pic_irt_ehci0 = nlm_irtstart(nlm_get_usb_pcibase(node, 0));
-	pic_irt_ehci1 = nlm_irtstart(nlm_get_usb_pcibase(node, 3));
-	pic_irt_uart0 = nlm_irtstart(nlm_get_uart_pcibase(node, 0));
-	pic_irt_uart1 = nlm_irtstart(nlm_get_uart_pcibase(node, 1));
-
-	/* Hardcoding the PCIE IRT information as PIC doesn't 
-	   understand any value other than 78,79,80,81 for PCIE0/1/2/3 */
-	pic_irt_pcie_lnk0 = 78;
-	pic_irt_pcie_lnk1 = 79;
-	pic_irt_pcie_lnk2 = 80;
-	pic_irt_pcie_lnk3 = 81;
-}
-/*
- * Find the IRQ for the link, each link has a different interrupt 
- * at the XLP pic
- */
-int xlp_pcie_link_irt(int link)
-{
-
-	if( (link < 0) || (link > 3))
-		return (-1);
-
-	return (pic_irt_pcie_lnk0 + link);
-}
-
-int
-xlp_irt_to_irq(int irt)
-{
-	if (irt == pic_irt_ehci0)
-		return PIC_EHCI_0_IRQ;
-	else if (irt == pic_irt_ehci1)
-		return PIC_EHCI_1_IRQ;
-	else if (irt == pic_irt_uart0)
-		return PIC_UART_0_IRQ;
-	else if (irt == pic_irt_uart1)
-		return PIC_UART_1_IRQ;
-	else if (irt == pic_irt_pcie_lnk0)
-		return PIC_PCIE_0_IRQ;
-	else if (irt == pic_irt_pcie_lnk1)
-		return PIC_PCIE_1_IRQ;
-	else if (irt == pic_irt_pcie_lnk2)
-		return PIC_PCIE_2_IRQ;
-	else if (irt == pic_irt_pcie_lnk3)
-		return PIC_PCIE_3_IRQ;
-	else {
-		if (bootverbose)
-			printf("Cannot find irq for IRT %d\n", irt);
-		return 0;
-	 }
-}
-
-int
-xlp_irq_to_irt(int irq)
-{
-	switch (irq) {
- 		case PIC_EHCI_0_IRQ :
- 			return pic_irt_ehci0;
- 		case PIC_EHCI_1_IRQ :
- 			return pic_irt_ehci1;
-		case PIC_UART_0_IRQ :
-			return pic_irt_uart0;
-		case PIC_UART_1_IRQ :
-			return pic_irt_uart1;
-		case PIC_PCIE_0_IRQ :
-			return pic_irt_pcie_lnk0;
-		case PIC_PCIE_1_IRQ :
-			return pic_irt_pcie_lnk1;
-		case PIC_PCIE_2_IRQ :
-			return pic_irt_pcie_lnk2;
-		case PIC_PCIE_3_IRQ :
-			return pic_irt_pcie_lnk3;
-		default: panic("Bad IRQ %d\n", irq);
-	}
-}
-
-int
-xlp_irq_is_picintr(int irq)
-{
-	switch (irq) {
- 		case PIC_EHCI_0_IRQ :
- 		case PIC_EHCI_1_IRQ :
-		case PIC_UART_0_IRQ :
-		case PIC_UART_1_IRQ :
-		case PIC_PCIE_0_IRQ :
-		case PIC_PCIE_1_IRQ :
-		case PIC_PCIE_2_IRQ :
-		case PIC_PCIE_3_IRQ :
-			return (1);
-		default: return (0);
-	}
-}

Modified: head/sys/mips/nlm/hal/pcibus.h
==============================================================================
--- head/sys/mips/nlm/hal/pcibus.h	Tue Mar 27 15:33:38 2012	(r233562)
+++ head/sys/mips/nlm/hal/pcibus.h	Tue Mar 27 15:39:55 2012	(r233563)
@@ -84,6 +84,9 @@
 /* PCIE_INT_EN0 */
 #define	PCIE_MSI_INT_EN			(1 << 9)
 
+/* XXXJC: Ax workaround */
+#define	PCIE_LINK0_IRT			78
+
 #if !defined(LOCORE) && !defined(__ASSEMBLY__)
 
 #define	nlm_read_pcie_reg(b, r)		nlm_read_reg(b, r)
@@ -93,6 +96,15 @@
 #define	nlm_get_pcie_regbase(node, inst)	\
 				(nlm_get_pcie_base(node, inst) + XLP_IO_PCI_HDRSZ)
 
+static __inline int
+xlp_pcie_link_irt(int link)
+{
+	if ((link < 0) || (link > 3))
+		return (-1);
+
+	return (PCIE_LINK0_IRT + link);
+}
+
 /*
  * Build Intel MSI message and data values from a source.  AMD64 systems
  * seem to be compatible, so we use the same function for both.
@@ -106,8 +118,4 @@
 	 MSI_MIPS_DATA_ASSERT | (irq))
 
 #endif
-
-#ifndef LOCORE
-int xlp_pcie_link_irt(int link);
-#endif
 #endif /* __XLP_PCIBUS_H__ */

Modified: head/sys/mips/nlm/hal/pic.h
==============================================================================
--- head/sys/mips/nlm/hal/pic.h	Tue Mar 27 15:33:38 2012	(r233562)
+++ head/sys/mips/nlm/hal/pic.h	Tue Mar 27 15:39:55 2012	(r233563)
@@ -174,7 +174,7 @@
 
 #define	PIC_IRT_FIRST_IRQ		(PIC_IRQ_BASE)
 #define	PIC_IRT_LAST_IRQ		63
-#define	PIC_IRQ_IS_IRT(irq)		((irq) >= PIC_IRT_FIRST_IRQ)
+#define	XLP_IRQ_IS_PICINTR(irq)		((irq) >= PIC_IRT_FIRST_IRQ)
 
 /*
  *   Misc

Modified: head/sys/mips/nlm/intr_machdep.c
==============================================================================
--- head/sys/mips/nlm/intr_machdep.c	Tue Mar 27 15:33:38 2012	(r233562)
+++ head/sys/mips/nlm/intr_machdep.c	Tue Mar 27 15:39:55 2012	(r233563)
@@ -141,13 +141,13 @@ xlp_establish_intr(const char *name, dri
 		 * PIC based interrupts need ack in PIC, and some SoC
 		 * components need additional acks (e.g. PCI)
 		 */
-		if (xlp_irq_is_picintr(irq))
+		if (XLP_IRQ_IS_PICINTR(irq))
 			errcode = intr_event_create(&ie, src, 0, irq,
 			    xlp_pre_ithread, xlp_post_ithread, xlp_post_filter,
 			    NULL, "hard intr%d:", irq);
 		else {
 			if (filt == NULL)
-				panic("Not supported - non filter percpu intr");
+				panic("Unsupported non filter percpu intr %d", irq);
 			errcode = intr_event_create(&ie, src, 0, irq,
 			    NULL, NULL, NULL, NULL, "hard intr%d:", irq);
 		}

Modified: head/sys/mips/nlm/xlp.h
==============================================================================
--- head/sys/mips/nlm/xlp.h	Tue Mar 27 15:33:38 2012	(r233562)
+++ head/sys/mips/nlm/xlp.h	Tue Mar 27 15:39:55 2012	(r233563)
@@ -35,17 +35,15 @@
 #include 
 
 #define	PIC_UART_0_IRQ	9
-#define	PIC_UART_1_IRQ	10
 
 #define	PIC_PCIE_0_IRQ	11
 #define	PIC_PCIE_1_IRQ	12
 #define	PIC_PCIE_2_IRQ	13
 #define	PIC_PCIE_3_IRQ	14
 
-#define	PIC_EHCI_0_IRQ	39 
+#define	PIC_EHCI_0_IRQ	16 
+#define	PIC_MMC_IRQ	21
 /* 41 used by IRQ_SMP */
-#define	PIC_EHCI_1_IRQ	42 
-#define	PIC_MMC_IRQ	43
 
 
 /* XLP 8xx/4xx A0, A1, A2 CPU COP0 PRIDs */
@@ -75,10 +73,8 @@ extern void xlp_enable_threads(int code)
 #endif
 uint32_t xlp_get_cpu_frequency(int node, int core);
 int nlm_set_device_frequency(int node, int devtype, int frequency);
-void nlm_pic_irt_init(int node);
 int xlp_irt_to_irq(int irt);
 int xlp_irq_to_irt(int irq);
-int xlp_irq_is_picintr(int irq);
 
 static __inline int nlm_processor_id(void)
 {

Modified: head/sys/mips/nlm/xlp_machdep.c
==============================================================================
--- head/sys/mips/nlm/xlp_machdep.c	Tue Mar 27 15:33:38 2012	(r233562)
+++ head/sys/mips/nlm/xlp_machdep.c	Tue Mar 27 15:39:55 2012	(r233563)
@@ -98,7 +98,7 @@ __FBSDID("$FreeBSD$");
 char boot1_env[4096];
 
 uint64_t xlp_cpu_frequency;
-uint64_t xlp_io_base = MIPS_PHYS_TO_KSEG1(XLP_DEFAULT_IO_BASE);
+uint64_t xlp_io_base = MIPS_PHYS_TO_DIRECT_UNCACHED(XLP_DEFAULT_IO_BASE);
 
 int xlp_ncores;
 int xlp_threads_per_core;
@@ -521,7 +521,6 @@ platform_start(__register_t a0 __unused,
 	/* initialize console so that we have printf */
 	boothowto |= (RB_SERIAL | RB_MULTIPLE);	/* Use multiple consoles */
 
-	nlm_pic_irt_init(0); /* complete before interrupts or console init */
 	init_static_kenv(boot1_env, sizeof(boot1_env));
 	xlp_bootargs_init(a0);
 

Modified: head/sys/mips/nlm/xlp_pci.c
==============================================================================
--- head/sys/mips/nlm/xlp_pci.c	Tue Mar 27 15:33:38 2012	(r233562)
+++ head/sys/mips/nlm/xlp_pci.c	Tue Mar 27 15:39:55 2012	(r233563)
@@ -1,32 +1,31 @@
 /*-
- * Copyright (c) 2003-2009 RMI Corporation
- * All rights reserved.
+ * Copyright (c) 2003-2012 Broadcom Corporation
+ * All Rights Reserved
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
+ *
  * 1. Redistributions of source code must retain the above copyright
  *    notice, this list of conditions and the following disclaimer.
  * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. Neither the name of RMI Corporation, nor the names of its contributors,
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * NETLOGIC_BSD */
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY BROADCOM ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL BROADCOM OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
 #include 
 __FBSDID("$FreeBSD$");
 
@@ -39,14 +38,16 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
 #include 
 
-#include 
 #include 
 #include 
+#include 
+
 #include 
 #include 
 #include 
@@ -68,16 +69,260 @@ __FBSDID("$FreeBSD$");
 #include 
 
 #include "pcib_if.h"
+#include "pci_if.h"
+
+#define	EMUL_MEM_START	0x16000000UL
+#define	EMUL_MEM_END	0x18ffffffUL
 
-struct xlp_pcib_softc {
-	bus_dma_tag_t	sc_pci_dmat;	/* PCI DMA tag pointer */
+/* SoC device qurik handling */
+static int irt_irq_map[4 * 256];
+static int irq_irt_map[64];
+
+static void
+xlp_add_irq(int node, int irt, int irq)
+{
+	int nodeirt = node * 256 + irt;
+
+	irt_irq_map[nodeirt] = irq;
+	irq_irt_map[irq] = nodeirt;
+}
+
+int
+xlp_irq_to_irt(int irq)
+{
+	return irq_irt_map[irq];
+}
+
+int
+xlp_irt_to_irq(int nodeirt)
+{
+	return irt_irq_map[nodeirt];
+}
+
+/* Override PCI a bit for SoC devices */
+
+enum {
+	INTERNAL_DEV	= 0x1,	/* internal device, skip on enumeration */
+	MEM_RES_EMUL	= 0x2,	/* no MEM or IO bar, custom res alloc */
+	SHARED_IRQ	= 0x4,
+	DEV_MMIO32	= 0x8,	/* byte access not allowed to mmio */
+};
+
+struct soc_dev_desc {
+	u_int	devid;		/* device ID */
+	int	irqbase;	/* start IRQ */
+	u_int	flags;		/* flags */
+	int	ndevs;		/* to keep track of number of devices */
+};
+
+struct soc_dev_desc xlp_dev_desc[] = {
+	{ PCI_DEVICE_ID_NLM_ICI,               0, INTERNAL_DEV },
+	{ PCI_DEVICE_ID_NLM_PIC,               0, INTERNAL_DEV },
+	{ PCI_DEVICE_ID_NLM_FMN,               0, INTERNAL_DEV },
+	{ PCI_DEVICE_ID_NLM_UART, PIC_UART_0_IRQ, MEM_RES_EMUL | DEV_MMIO32},
+	{ PCI_DEVICE_ID_NLM_I2C,               0, MEM_RES_EMUL | DEV_MMIO32 },
+	{ PCI_DEVICE_ID_NLM_NOR,               0, MEM_RES_EMUL },
+	{ PCI_DEVICE_ID_NLM_MMC,     PIC_MMC_IRQ, MEM_RES_EMUL },
+	{ PCI_DEVICE_ID_NLM_EHCI, PIC_EHCI_0_IRQ, 0 }
+};
+
+struct  xlp_devinfo {
+	struct pci_devinfo pcidev;
+	int	irq;
+	int	flags;
+	u_long	mem_res_start;
 };
 
+static __inline struct soc_dev_desc *
+xlp_find_soc_desc(int devid)
+{
+	struct soc_dev_desc *p;
+	int i, n;
+
+	n = sizeof(xlp_dev_desc) / sizeof(xlp_dev_desc[0]);
+	for (i = 0, p = xlp_dev_desc; i < n; i++, p++)
+		if (p->devid == devid)
+			return (p);
+	return (NULL);
+}
+
+static struct resource *
+xlp_pci_alloc_resource(device_t bus, device_t child, int type, int *rid,
+    u_long start, u_long end, u_long count, u_int flags)
+{
+	struct resource *r;
+	struct xlp_devinfo *xlp_devinfo;
+	int busno;
+
+	/*
+	 * Do custom allocation for MEMORY resource for SoC device if 
+	 * MEM_RES_EMUL flag is set
+	 */
+	busno = pci_get_bus(child);
+	if ((type == SYS_RES_MEMORY || type == SYS_RES_IOPORT) && busno == 0) {
+		xlp_devinfo = (struct xlp_devinfo *)device_get_ivars(child);
+		if ((xlp_devinfo->flags & MEM_RES_EMUL) != 0) {
+			/* no emulation for IO ports */
+			if (type == SYS_RES_IOPORT)
+				return (NULL);
+			start = xlp_devinfo->mem_res_start;
+			count = XLP_PCIE_CFG_SIZE - XLP_IO_PCI_HDRSZ;
+			end = start + count - 1;
+			r = BUS_ALLOC_RESOURCE(device_get_parent(bus), child,
+			    type, rid, start, end, count, flags);
+			if (r == NULL)
+				return (NULL);
+			if ((xlp_devinfo->flags & DEV_MMIO32) != 0)
+				rman_set_bustag(r, rmi_uart_bus_space);
+			return (r);
+		}
+	}
+
+	/* Not custom alloc, use PCI code */
+	return (pci_alloc_resource(bus, child, type, rid, start, end, count,
+	    flags));
+}
+
+static int
+xlp_pci_release_resource(device_t bus, device_t child, int type, int rid,
+    struct resource *r)
+{
+	u_long start;
+
+	/* If custom alloc, handle that */
+	start = rman_get_start(r);
+	if (type == SYS_RES_MEMORY && pci_get_bus(child) == 0 &&
+	    start >= EMUL_MEM_START && start <= EMUL_MEM_END)
+		return (BUS_RELEASE_RESOURCE(device_get_parent(bus), child,
+		    type, rid, r));
+
+	/* use default PCI function */
+	return (bus_generic_rl_release_resource(bus, child, type, rid, r));
+}
+
+static void
+xlp_add_soc_child(device_t pcib, device_t dev, int b, int s, int f)
+{
+	struct pci_devinfo *dinfo;
+	struct xlp_devinfo *xlp_dinfo;
+	struct soc_dev_desc *si;
+	uint64_t pcibase;
+	int domain, node, irt, irq, flags, devoffset, num;
+	uint16_t devid;
+
+	domain = pcib_get_domain(dev);
+	node = s / 8;
+	devoffset = XLP_HDR_OFFSET(node, 0, s % 8, f);
+	if (!nlm_dev_exists(devoffset))
+		return;
+
+	/* Find if there is a desc for the SoC device */
+	devid = PCIB_READ_CONFIG(pcib, b, s, f, PCIR_DEVICE, 2);
+	si = xlp_find_soc_desc(devid);
+
+	/* update flags and irq from desc if available */
+	irq = 0;
+	flags = 0;
+	if (si != NULL) {
+		if (si->irqbase != 0)
+			irq = si->irqbase + si->ndevs;
+		flags = si->flags;
+		si->ndevs++;
+	}
+
+	/* skip internal devices */
+	if ((flags & INTERNAL_DEV) != 0)
+		return;
+
+	/* PCIe interfaces are special, bug in Ax */
+	if (devid == PCI_DEVICE_ID_NLM_PCIE) {
+		xlp_add_irq(node, xlp_pcie_link_irt(f), PIC_PCIE_0_IRQ + f);
+	} else {
+		/* Stash intline and pin in shadow reg for devices */
+		pcibase = nlm_pcicfg_base(devoffset);
+		irt = nlm_irtstart(pcibase);
+		num = nlm_irtnum(pcibase);
+		if (irq != 0 && num > 0) {
+			xlp_add_irq(node, irt, irq);
+			nlm_write_reg(pcibase, XLP_PCI_DEVSCRATCH_REG0,
+			    (1 << 8) | irq);
+		}
+	}
+	dinfo = pci_read_device(pcib, domain, b, s, f, sizeof(*xlp_dinfo));
+	if (dinfo == NULL)
+		return;
+	xlp_dinfo = (struct xlp_devinfo *)dinfo;
+	xlp_dinfo->irq = irq;
+	xlp_dinfo->flags = flags;
+	if ((flags & MEM_RES_EMUL) != 0)
+		xlp_dinfo->mem_res_start = XLP_DEFAULT_IO_BASE + devoffset +
+		    XLP_IO_PCI_HDRSZ;
+	pci_add_child(dev, dinfo);
+}
+
+static int
+xlp_pci_attach(device_t dev)
+{
+	device_t pcib = device_get_parent(dev);
+	int maxslots, s, f, pcifunchigh;
+	int busno;
+	uint8_t hdrtype;
+
+	/*
+	 * The on-chip devices are on a bus that is almost, but not
+	 * quite, completely like PCI. Add those things by hand.
+	 */
+	busno = pcib_get_bus(dev);
+	maxslots = PCIB_MAXSLOTS(pcib);
+	for (s = 0; s <= maxslots; s++) {
+		pcifunchigh = 0;
+		f = 0;
+		hdrtype = PCIB_READ_CONFIG(pcib, busno, s, f, PCIR_HDRTYPE, 1);
+		if ((hdrtype & PCIM_HDRTYPE) > PCI_MAXHDRTYPE)
+			continue;
+		if (hdrtype & PCIM_MFDEV)
+			pcifunchigh = PCI_FUNCMAX;
+		for (f = 0; f <= pcifunchigh; f++)
+			xlp_add_soc_child(pcib, dev, busno, s, f);
+	}
+	return (bus_generic_attach(dev));
+}
+
+static int
+xlp_pci_probe(device_t dev)
+{
+	device_t pcib;
+
+	pcib = device_get_parent(dev);
+	/*
+	 * Only the top level bus has SoC devices, leave the rest to
+	 * Generic PCI code
+	 */
+	if (strcmp(device_get_nameunit(pcib), "pcib0") != 0)
+		return (ENXIO);
+	device_set_desc(dev, "XLP SoCbus");
+	return (BUS_PROBE_DEFAULT);
+}
+
+static devclass_t pci_devclass;
+static device_method_t xlp_pci_methods[] = {
+	/* Device interface */
+	DEVMETHOD(device_probe,		xlp_pci_probe),
+	DEVMETHOD(device_attach,	xlp_pci_attach),
+	DEVMETHOD(bus_alloc_resource,	xlp_pci_alloc_resource),
+	DEVMETHOD(bus_release_resource, xlp_pci_release_resource),
+
+	DEVMETHOD_END
+};
+
+DEFINE_CLASS_1(pci, xlp_pci_driver, xlp_pci_methods, 0, pci_driver);
+DRIVER_MODULE(xlp_pci, pcib, xlp_pci_driver, pci_devclass, 0, 0);
+
 static devclass_t pcib_devclass;
 static struct rman irq_rman, port_rman, mem_rman, emul_rman;
 
 static void
-xlp_pci_init_resources(void)
+xlp_pcib_init_resources(void)
 {
 	irq_rman.rm_start = 0;
 	irq_rman.rm_end = 255;
@@ -112,7 +357,7 @@ xlp_pci_init_resources(void)
 	emul_rman.rm_type = RMAN_ARRAY;
 	emul_rman.rm_descr = "Emulated MEMIO";
 	if (rman_init(&emul_rman)
-	    || rman_manage_region(&emul_rman, 0x16000000UL, 0x18ffffffUL))
+	    || rman_manage_region(&emul_rman, EMUL_MEM_START, EMUL_MEM_END))
 		panic("pci_init_resources emul_rman");
 }
 
@@ -121,7 +366,7 @@ xlp_pcib_probe(device_t dev)
 {
 
 	device_set_desc(dev, "XLP PCI bus");
-	xlp_pci_init_resources();
+	xlp_pcib_init_resources();
 	return (0);
 }
 
@@ -173,20 +418,15 @@ xlp_pcib_read_config(device_t dev, u_int
 	else if ((width == 4) && (reg & 3))
 		return 0xFFFFFFFF;
 
-	data = nlm_read_pci_reg(cfgaddr, regindex);
-
 	/* 
-	 * Fix up read data in some SoC devices 
-	 * to emulate complete PCIe header
+	 * The intline and int pin of SoC devices are DOA, except
+	 * for bridges (slot %8 == 1).
+	 * use the values we stashed in a writable PCI scratch reg.
 	 */
-	if (b == 0) {
-		int dev = s % 8;
+	if (b == 0 && regindex == 0xf && s % 8 > 1)
+		regindex = XLP_PCI_DEVSCRATCH_REG0;
 
-		/* Fake intpin on config read for UART/I2C, USB, SD/Flash */
-		if (regindex == 0xf && 
-		    (dev == 6 || dev == 2 || dev == 7))
-			data |= 0x1 << 8;	/* Fake int pin */
-	}
+	data = nlm_read_pci_reg(cfgaddr, regindex);
 	if (width == 1)
 		return ((data >> ((reg & 3) << 3)) & 0xff);
 	else if (width == 2)
@@ -221,8 +461,12 @@ xlp_pcib_write_config(device_t dev, u_in
 		data = val;
 	}
 
+	/*
+	 * use shadow reg for intpin/intline which are dead
+	 */
+	if (b == 0 && regindex == 0xf && s % 8 > 1)
+		regindex = XLP_PCI_DEVSCRATCH_REG0;
 	nlm_write_pci_reg(cfgaddr, regindex, data);
-	return;
 }
 
 /*
@@ -230,7 +474,7 @@ xlp_pcib_write_config(device_t dev, u_in
  * from the link's IO and MEM address ranges.
  */
 static void
-xlp_pci_hardware_swap_enable(int node, int link)
+xlp_pcib_hardware_swap_enable(int node, int link)
 {
 	uint64_t bbase, linkpcibase;
 	uint32_t bar;
@@ -263,7 +507,7 @@ xlp_pcib_attach(device_t dev)
 	/* enable hardware swap on all nodes/links */
 	for (node = 0; node < XLP_MAX_NODES; node++)
 		for (link = 0; link < 4; link++)
-			xlp_pci_hardware_swap_enable(node, link);
+			xlp_pcib_hardware_swap_enable(node, link);
 
 	device_add_child(dev, "pci", 0);
 	bus_generic_attach(dev);
@@ -384,7 +628,7 @@ bridge_pcie_ack(int irq)
 }
 
 static int
-mips_platform_pci_setup_intr(device_t dev, device_t child,
+mips_platform_pcib_setup_intr(device_t dev, device_t child,
     struct resource *irq, int flags, driver_filter_t *filt,
     driver_intr_t *intr, void *arg, void **cookiep)
 {
@@ -401,11 +645,11 @@ mips_platform_pci_setup_intr(device_t de
 		return (EINVAL);
 	}
 	xlpirq = rman_get_start(irq);
+	if (xlpirq == 0)
+		return (0);
 
-	if (strcmp(device_get_name(dev), "pcib") != 0) {
-		device_printf(dev, "ret 0 on dev\n");
+	if (strcmp(device_get_name(dev), "pcib") != 0)
 		return (0);
-	}
 
 	/* 
 	 * temporary hack for MSI, we support just one device per
@@ -465,7 +709,7 @@ mips_platform_pci_setup_intr(device_t de
 }
 
 static int
-mips_platform_pci_teardown_intr(device_t dev, device_t child,
+mips_platform_pcib_teardown_intr(device_t dev, device_t child,
     struct resource *irq, void *cookie)
 {
 	if (strcmp(device_get_name(child), "pci") == 0) {
@@ -475,146 +719,65 @@ mips_platform_pci_teardown_intr(device_t
 	return (bus_generic_teardown_intr(dev, child, irq, cookie));
 }
 
-static void
-assign_soc_resource(device_t child, int type, u_long *startp, u_long *endp,
-    u_long *countp, struct rman **rm, bus_space_tag_t *bst, vm_offset_t *va)
-{
-	int devid, inst, node, unit;
-	uint32_t val;
-
-	devid = pci_get_device(child);
-	inst = pci_get_function(child);
-	node = pci_get_slot(child) / 8;
-	unit = device_get_unit(child);
-
-	*rm = NULL;
-	*va = 0;
-	*bst = 0;
-	if (type == SYS_RES_MEMORY) { 
-		switch (devid) {
-		case PCI_DEVICE_ID_NLM_UART:
-			*va = nlm_get_uart_regbase(node, inst);
-			*startp = MIPS_KSEG1_TO_PHYS(*va);
-			*countp = 0x100;
-			*rm = &emul_rman;
-			*bst = uart_bus_space_mem;
-			break;
-
-		case PCI_DEVICE_ID_NLM_I2C:
-			*va = nlm_pcicfg_base(XLP_IO_I2C_OFFSET(node, unit)) +
-			    XLP_IO_PCI_HDRSZ;
-			*startp = MIPS_KSEG1_TO_PHYS(*va);
-			*countp = 0x100;
-			*rm = &emul_rman;
-			*bst = uart_bus_space_mem;
-			break;
-		case PCI_DEVICE_ID_NLM_NOR:
-			/* XXXJC: support multiple chip selects */
-			val = nlm_read_pci_reg(nlm_get_gbu_regbase(node), 0);
-			*startp = val << 8;
-			*va = MIPS_PHYS_TO_KSEG1(*startp);
-			/* XXXJC: count is not correct */
-			*countp = 0x100;
-			*rm = &emul_rman;
-			break;
-		}
-		/* calculate end if allocated */
-		if (*rm)
-			*endp = *startp + *countp - 1;
-	} else if (type != SYS_RES_IRQ) {
-		/*
-		 * IRQ allocation is done by route_interrupt,
-		 * for any other request print warning.
-		 */
-		printf("Unknown type %d in req for [%x%x]\n",
-			type, devid, inst);
-	}
-}
-
 static struct resource *
-xlp_pci_alloc_resource(device_t bus, device_t child, int type, int *rid,
+xlp_pcib_alloc_resource(device_t bus, device_t child, int type, int *rid,
     u_long start, u_long end, u_long count, u_int flags)
 {
 	struct rman *rm = NULL;
 	struct resource *rv;
-	vm_offset_t va = 0;
+	void *va;
 	int needactivate = flags & RF_ACTIVE;
-	bus_space_tag_t bst = 0;
 
-	/*
-	 * For SoC PCI devices, we have to assign resources correctly
-	 * since the IRQ and MEM resources depend on the block.
-	 * If the address is not from BAR0, then we use emul_rman
-	 */
-	if (pci_get_bus(child) == 0 &&
-	    pci_get_vendor(child) == PCI_VENDOR_NETLOGIC)
-      		assign_soc_resource(child, type, &start, &end,
-		    &count, &rm, &bst, &va);
-	if (rm == NULL) {
-		switch (type) {
-		case SYS_RES_IRQ:
-			rm = &irq_rman;
-			break;
+	switch (type) {
+	case SYS_RES_IRQ:
+		rm = &irq_rman;
+		break;
 	
-		case SYS_RES_IOPORT:
-			rm = &port_rman;
-			break;
-
-		case SYS_RES_MEMORY:
+	case SYS_RES_IOPORT:
+		rm = &port_rman;
+		break;
+
+	case SYS_RES_MEMORY:
+		if (start >= EMUL_MEM_START && start <= EMUL_MEM_END)
+			rm = &emul_rman;
+		else
 			rm = &mem_rman;
 			break;
 
-		default:
-			return (0);
-		}
+	default:
+		return (0);
 	}
 
 	rv = rman_reserve_resource(rm, start, end, count, flags, child);
-	if (rv == 0)
-		return (0);
+	if (rv == NULL)
+		return (NULL);
 
 	rman_set_rid(rv, *rid);
 
 	if (type == SYS_RES_MEMORY || type == SYS_RES_IOPORT) {
-		if (va == 0)
-			va = (vm_offset_t)pmap_mapdev(start, count);
-		if (bst == 0)
-			bst = rmi_bus_space;
-
-		rman_set_bushandle(rv, va);
-		rman_set_virtual(rv, (void *)va);
-		rman_set_bustag(rv, bst);
+		va = pmap_mapdev(start, count);
+		rman_set_bushandle(rv, (bus_space_handle_t)va);
+		rman_set_bustag(rv, rmi_bus_space);
 	}
-
 	if (needactivate) {
 		if (bus_activate_resource(child, type, *rid, rv)) {
 			rman_release_resource(rv);
 			return (NULL);
 		}
 	}
-
 	return (rv);
 }
 
 static int
-xlp_pci_release_resource(device_t bus, device_t child, int type, int rid,
+xlp_pcib_release_resource(device_t bus, device_t child, int type, int rid,
     struct resource *r)
 {
 
 	return (rman_release_resource(r));
 }
 
-static bus_dma_tag_t
-xlp_pci_get_dma_tag(device_t bus, device_t child)
-{
-	struct xlp_pcib_softc *sc;
-
-	sc = device_get_softc(bus);
-	return (sc->sc_pci_dmat);
-}
-
 static int
-xlp_pci_activate_resource(device_t bus, device_t child, int type, int rid,
+xlp_pcib_activate_resource(device_t bus, device_t child, int type, int rid,
     struct resource *r)
 {
 
@@ -622,7 +785,7 @@ xlp_pci_activate_resource(device_t bus, 
 }
 
 static int
-xlp_pci_deactivate_resource(device_t bus, device_t child, int type, int rid,
+xlp_pcib_deactivate_resource(device_t bus, device_t child, int type, int rid,
     struct resource *r)
 {
 
@@ -630,7 +793,7 @@ xlp_pci_deactivate_resource(device_t bus
 }
 
 static int
-mips_pci_route_interrupt(device_t bus, device_t dev, int pin)
+mips_pcib_route_interrupt(device_t bus, device_t dev, int pin)
 {
 	int irt, link;
 
@@ -685,19 +848,18 @@ static device_method_t xlp_pcib_methods[
 	/* Bus interface */
 	DEVMETHOD(bus_read_ivar, xlp_pcib_read_ivar),
 	DEVMETHOD(bus_write_ivar, xlp_pcib_write_ivar),
-	DEVMETHOD(bus_alloc_resource, xlp_pci_alloc_resource),
-	DEVMETHOD(bus_release_resource, xlp_pci_release_resource),
-	DEVMETHOD(bus_get_dma_tag, xlp_pci_get_dma_tag),
-	DEVMETHOD(bus_activate_resource, xlp_pci_activate_resource),
-	DEVMETHOD(bus_deactivate_resource, xlp_pci_deactivate_resource),
-	DEVMETHOD(bus_setup_intr, mips_platform_pci_setup_intr),
-	DEVMETHOD(bus_teardown_intr, mips_platform_pci_teardown_intr),
+	DEVMETHOD(bus_alloc_resource, xlp_pcib_alloc_resource),
+	DEVMETHOD(bus_release_resource, xlp_pcib_release_resource),
+	DEVMETHOD(bus_activate_resource, xlp_pcib_activate_resource),
+	DEVMETHOD(bus_deactivate_resource, xlp_pcib_deactivate_resource),
+	DEVMETHOD(bus_setup_intr, mips_platform_pcib_setup_intr),
+	DEVMETHOD(bus_teardown_intr, mips_platform_pcib_teardown_intr),
 
 	/* pcib interface */
 	DEVMETHOD(pcib_maxslots, xlp_pcib_maxslots),
 	DEVMETHOD(pcib_read_config, xlp_pcib_read_config),
 	DEVMETHOD(pcib_write_config, xlp_pcib_write_config),
-	DEVMETHOD(pcib_route_interrupt, mips_pci_route_interrupt),
+	DEVMETHOD(pcib_route_interrupt, mips_pcib_route_interrupt),
 
 	DEVMETHOD(pcib_alloc_msi, xlp_alloc_msi),
 	DEVMETHOD(pcib_release_msi, xlp_release_msi),
@@ -709,7 +871,7 @@ static device_method_t xlp_pcib_methods[
 static driver_t xlp_pcib_driver = {
 	"pcib",
 	xlp_pcib_methods,
-	sizeof(struct xlp_pcib_softc),
+	1, /* no softc */
 };
 
 DRIVER_MODULE(pcib, nexus, xlp_pcib_driver, pcib_devclass, 0, 0);

From owner-svn-src-head@FreeBSD.ORG  Tue Mar 27 15:43:33 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 56EB61065676;
	Tue, 27 Mar 2012 15:43:33 +0000 (UTC)
	(envelope-from jchandra@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 254A98FC2A;
	Tue, 27 Mar 2012 15:43:33 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2RFhXi8092970;
	Tue, 27 Mar 2012 15:43:33 GMT
	(envelope-from jchandra@svn.freebsd.org)
Received: (from jchandra@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2RFhW5r092967;
	Tue, 27 Mar 2012 15:43:32 GMT
	(envelope-from jchandra@svn.freebsd.org)
Message-Id: <201203271543.q2RFhW5r092967@svn.freebsd.org>
From: "Jayachandran C." 
Date: Tue, 27 Mar 2012 15:43:32 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233564 - in head/sys/mips: conf nlm
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 27 Mar 2012 15:43:33 -0000

Author: jchandra
Date: Tue Mar 27 15:43:32 2012
New Revision: 233564
URL: http://svn.freebsd.org/changeset/base/233564

Log:
  Resource allocation for XLP SoC SDHCI slots
  
  The on-chip SD slots do not have PCI BARs corresponding to them, so
  this has to be handled in the custom SoC memory allocation.
  
  Provide memory resource for rids corresponding to BAR 0 and 1 in
  the custom allocation code.

Modified:
  head/sys/mips/conf/std.XLP
  head/sys/mips/nlm/xlp_pci.c

Modified: head/sys/mips/conf/std.XLP
==============================================================================
--- head/sys/mips/conf/std.XLP	Tue Mar 27 15:39:55 2012	(r233563)
+++ head/sys/mips/conf/std.XLP	Tue Mar 27 15:43:32 2012	(r233564)
@@ -110,3 +110,8 @@ options 	GEOM_ELI
 # NOR
 device		cfi
 device		cfid
+
+# MMC/SD
+device		mmc			# MMC/SD bus
+device		mmcsd			# MMC/SD memory card
+device		sdhci			# Generic PCI SD Host Controller

Modified: head/sys/mips/nlm/xlp_pci.c
==============================================================================
--- head/sys/mips/nlm/xlp_pci.c	Tue Mar 27 15:39:55 2012	(r233563)
+++ head/sys/mips/nlm/xlp_pci.c	Tue Mar 27 15:43:32 2012	(r233564)
@@ -165,8 +165,22 @@ xlp_pci_alloc_resource(device_t bus, dev
 			/* no emulation for IO ports */
 			if (type == SYS_RES_IOPORT)
 				return (NULL);
+
 			start = xlp_devinfo->mem_res_start;
 			count = XLP_PCIE_CFG_SIZE - XLP_IO_PCI_HDRSZ;
+
+			/* MMC needs to 2 slots with rids 16 and 20 and a
+			 * fixup for size */
+			if (pci_get_device(child) == PCI_DEVICE_ID_NLM_MMC) {
+				count = 0x100;
+				if (*rid == 16)
+					; /* first slot already setup */
+				else if (*rid == 20)
+					start += 0x100; /* second slot */
+				else
+					return (NULL);
+			}
+
 			end = start + count - 1;
 			r = BUS_ALLOC_RESOURCE(device_get_parent(bus), child,
 			    type, rid, start, end, count, flags);
@@ -254,6 +268,8 @@ xlp_add_soc_child(device_t pcib, device_
 	xlp_dinfo = (struct xlp_devinfo *)dinfo;
 	xlp_dinfo->irq = irq;
 	xlp_dinfo->flags = flags;
+
+	/* memory resource from ecfg space, if MEM_RES_EMUL is set */
 	if ((flags & MEM_RES_EMUL) != 0)
 		xlp_dinfo->mem_res_start = XLP_DEFAULT_IO_BASE + devoffset +
 		    XLP_IO_PCI_HDRSZ;

From owner-svn-src-head@FreeBSD.ORG  Tue Mar 27 15:55:57 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id AAC0A106566B;
	Tue, 27 Mar 2012 15:55:57 +0000 (UTC)
	(envelope-from joel@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 7BE418FC14;
	Tue, 27 Mar 2012 15:55:57 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2RFtvUt093595;
	Tue, 27 Mar 2012 15:55:57 GMT (envelope-from joel@svn.freebsd.org)
Received: (from joel@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2RFtvaU093591;
	Tue, 27 Mar 2012 15:55:57 GMT (envelope-from joel@svn.freebsd.org)
Message-Id: <201203271555.q2RFtvaU093591@svn.freebsd.org>
From: Joel Dahl 
Date: Tue, 27 Mar 2012 15:55:57 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233565 - head/lib/libpmc
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 27 Mar 2012 15:55:57 -0000

Author: joel (doc committer)
Date: Tue Mar 27 15:55:56 2012
New Revision: 233565
URL: http://svn.freebsd.org/changeset/base/233565

Log:
  Remove useless Ta macro.

Modified:
  head/lib/libpmc/pmc.mips24k.3
  head/lib/libpmc/pmc.octeon.3
  head/lib/libpmc/pmc.xscale.3

Modified: head/lib/libpmc/pmc.mips24k.3
==============================================================================
--- head/lib/libpmc/pmc.mips24k.3	Tue Mar 27 15:43:32 2012	(r233564)
+++ head/lib/libpmc/pmc.mips24k.3	Tue Mar 27 15:55:56 2012	(r233565)
@@ -376,10 +376,10 @@ aliases supported by
 .Lb libpmc
 and the underlying hardware events used.
 .Bl -column "branch-mispredicts" "cpu_clk_unhalted.core_p"
-.It Em Alias Ta Em Event Ta
-.It Li instructions Ta Li INSTR_EXECUTED Ta
-.It Li branches Ta Li BRANCH_COMPLETED Ta
-.It Li branch-mispredicts Ta Li BRANCH_MISPRED Ta
+.It Em Alias Ta Em Event
+.It Li instructions Ta Li INSTR_EXECUTED
+.It Li branches Ta Li BRANCH_COMPLETED
+.It Li branch-mispredicts Ta Li BRANCH_MISPRED
 .El
 .Sh SEE ALSO
 .Xr pmc 3 ,

Modified: head/lib/libpmc/pmc.octeon.3
==============================================================================
--- head/lib/libpmc/pmc.octeon.3	Tue Mar 27 15:43:32 2012	(r233564)
+++ head/lib/libpmc/pmc.octeon.3	Tue Mar 27 15:55:56 2012	(r233565)
@@ -216,10 +216,10 @@ aliases supported by
 .Lb libpmc
 and the underlying hardware events used.
 .Bl -column "branch-mispredicts" "cpu_clk_unhalted.core_p"
-.It Em Alias Ta Em Event Ta
-.It Li instructions Ta Li RET Ta
-.It Li branches Ta Li BR Ta
-.It Li branch-mispredicts Ta Li BRMIS Ta
+.It Em Alias Ta Em Event
+.It Li instructions Ta Li RET
+.It Li branches Ta Li BR
+.It Li branch-mispredicts Ta Li BS
 .El
 .Sh SEE ALSO
 .Xr pmc 3 ,

Modified: head/lib/libpmc/pmc.xscale.3
==============================================================================
--- head/lib/libpmc/pmc.xscale.3	Tue Mar 27 15:43:32 2012	(r233564)
+++ head/lib/libpmc/pmc.xscale.3	Tue Mar 27 15:55:56 2012	(r233565)
@@ -123,12 +123,12 @@ aliases supported by
 .Lb libpmc
 and the underlying hardware events used.
 .Bl -column "branch-mispredicts" "BRANCH_MISPRED"
-.It Em Alias Ta Em Event Ta
-.It Li branches Ta Li BRANCH_RETIRED Ta
-.It Li branch-mispredicts Ta Li BRANCH_MISPRED Ta
-.It Li dc-misses Ta Li DC_MISS Ta
-.It Li ic-misses Ta Li IC_MISS Ta
-.It Li instructions Ta Li INSTR_RETIRED Ta
+.It Em Alias Ta Em Event
+.It Li branches Ta Li BRANCH_RETIRED
+.It Li branch-mispredicts Ta Li BRANCH_MISPRED
+.It Li dc-misses Ta Li DC_MISS
+.It Li ic-misses Ta Li IC_MISS
+.It Li instructions Ta Li INSTR_RETIRED
 .El
 .Sh SEE ALSO
 .Xr pmc 3 ,

From owner-svn-src-head@FreeBSD.ORG  Tue Mar 27 17:45:51 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 0F94D106566B;
	Tue, 27 Mar 2012 17:45:51 +0000 (UTC)
	(envelope-from bschmidt@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id EF2F78FC15;
	Tue, 27 Mar 2012 17:45:50 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2RHjoWY097057;
	Tue, 27 Mar 2012 17:45:50 GMT
	(envelope-from bschmidt@svn.freebsd.org)
Received: (from bschmidt@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2RHjo4H097055;
	Tue, 27 Mar 2012 17:45:50 GMT
	(envelope-from bschmidt@svn.freebsd.org)
Message-Id: <201203271745.q2RHjo4H097055@svn.freebsd.org>
From: Bernhard Schmidt 
Date: Tue, 27 Mar 2012 17:45:50 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233567 - head/sys/dev/iwn
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 27 Mar 2012 17:45:51 -0000

Author: bschmidt
Date: Tue Mar 27 17:45:50 2012
New Revision: 233567
URL: http://svn.freebsd.org/changeset/base/233567

Log:
  Add support for 6150 series devices.
  
  Tested by:	Shane Riddle 
  MFC after:	1 week

Modified:
  head/sys/dev/iwn/if_iwn.c

Modified: head/sys/dev/iwn/if_iwn.c
==============================================================================
--- head/sys/dev/iwn/if_iwn.c	Tue Mar 27 17:24:51 2012	(r233566)
+++ head/sys/dev/iwn/if_iwn.c	Tue Mar 27 17:45:50 2012	(r233567)
@@ -89,6 +89,8 @@ static const struct iwn_ident iwn_ident_
 	{ 0x8086, 0x008b, "Intel(R) Centrino(R) Wireless-N 1030"	 },
 	{ 0x8086, 0x0090, "Intel(R) Centrino(R) Advanced-N 6230"	 },
 	{ 0x8086, 0x0091, "Intel(R) Centrino(R) Advanced-N 6230"	 },
+	{ 0x8086, 0x0885, "Intel(R) Centrino(R) Wireless-N + WiMAX 6150" },
+	{ 0x8086, 0x0886, "Intel(R) Centrino(R) Wireless-N + WiMAX 6150" },
 	{ 0x8086, 0x0896, "Intel(R) Centrino(R) Wireless-N 130"		 },
 	{ 0x8086, 0x4229, "Intel(R) Wireless WiFi Link 4965"		 },
 	{ 0x8086, 0x422b, "Intel(R) Centrino(R) Ultimate-N 6300"	 },

From owner-svn-src-head@FreeBSD.ORG  Tue Mar 27 18:17:22 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id B2170106566B;
	Tue, 27 Mar 2012 18:17:22 +0000 (UTC)
	(envelope-from bschmidt@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 831778FC12;
	Tue, 27 Mar 2012 18:17:22 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2RIHMvH098024;
	Tue, 27 Mar 2012 18:17:22 GMT
	(envelope-from bschmidt@svn.freebsd.org)
Received: (from bschmidt@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2RIHMAm098022;
	Tue, 27 Mar 2012 18:17:22 GMT
	(envelope-from bschmidt@svn.freebsd.org)
Message-Id: <201203271817.q2RIHMAm098022@svn.freebsd.org>
From: Bernhard Schmidt 
Date: Tue, 27 Mar 2012 18:17:22 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233568 - head/share/man/man4
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 27 Mar 2012 18:17:22 -0000

Author: bschmidt
Date: Tue Mar 27 18:17:22 2012
New Revision: 233568
URL: http://svn.freebsd.org/changeset/base/233568

Log:
  Add a list of available devices which matches the names shown by pciconf.
  While here add 2 missing firmware modules.
  
  MFC after:	1 week

Modified:
  head/share/man/man4/iwn.4

Modified: head/share/man/man4/iwn.4
==============================================================================
--- head/share/man/man4/iwn.4	Tue Mar 27 17:45:50 2012	(r233567)
+++ head/share/man/man4/iwn.4	Tue Mar 27 18:17:22 2012	(r233568)
@@ -25,13 +25,12 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd July 20, 2010
+.Dd March 27, 2012
 .Dt IWN 4
 .Os
 .Sh NAME
 .Nm iwn
-.Nd Intel Wireless WiFi Link 4965/1000/5000/5150/5300/6000/6050 
-IEEE 802.11n driver
+.Nd Intel IEEE 802.11n wireless network driver
 .Sh SYNOPSIS
 To compile this driver into the kernel,
 include the following lines in your
@@ -51,6 +50,8 @@ Choose one from:
 .Cd "device iwn5000fw"
 .Cd "device iwn5150fw"
 .Cd "device iwn6000fw"
+.Cd "device iwn6000g2afw"
+.Cd "device iwn6000g2bfw"
 .Cd "device iwn6050fw"
 .Ed
 .Pp
@@ -71,15 +72,32 @@ iwn1000fw_load="YES"
 iwn5000fw_load="YES"
 iwn5150fw_load="YES"
 iwn6000fw_load="YES"
+iwn6000g2afw_load="YES"
+iwn6000g2bfw_load="YES"
 iwn6050fw_load="YES"
 .Ed
 .Sh DESCRIPTION
 The
 .Nm
-driver provides support for
-.Tn Intel
-Wireless WiFi Link 4965, 1000, 5000 and 6000 series of 
-PCI-Express network adapters.
+driver provides support for:
+.Pp
+.Bl -tag -width Ds -offset indent -compact
+.It Intel Centrino Advanced-N 6200
+.It Intel Centrino Advanced-N 6205
+.It Intel Centrino Advanced-N 6230
+.It Intel Centrino Advanced-N + WiMAX 6250
+.It Intel Centrino Ultimate-N 6300
+.It Intel Centrino Wireless-N 130
+.It Intel Centrino Wireless-N 1000
+.It Intel Centrino Wireless-N 1030
+.It Intel Centrino Wireless-N + WiMAX 6150
+.It Intel Ultimate N WiFi Link 5300
+.It Intel Wireless WiFi Link 4965
+.It Intel WiFi Link 5100
+.It Intel WiMAX/WiFi Link 5150
+.It Intel WiMAX/WiFi Link 5350
+.El
+.Pp
 .Nm
 supports
 .Cm station ,

From owner-svn-src-head@FreeBSD.ORG  Tue Mar 27 18:22:15 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 3BC85106564A;
	Tue, 27 Mar 2012 18:22:15 +0000 (UTC)
	(envelope-from gonzo@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 266828FC18;
	Tue, 27 Mar 2012 18:22:15 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2RIMFWj098213;
	Tue, 27 Mar 2012 18:22:15 GMT (envelope-from gonzo@svn.freebsd.org)
Received: (from gonzo@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2RIMEkn098210;
	Tue, 27 Mar 2012 18:22:14 GMT (envelope-from gonzo@svn.freebsd.org)
Message-Id: <201203271822.q2RIMEkn098210@svn.freebsd.org>
From: Oleksandr Tymoshenko 
Date: Tue, 27 Mar 2012 18:22:14 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233569 - head/sys/dev/hwpmc
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 27 Mar 2012 18:22:15 -0000

Author: gonzo
Date: Tue Mar 27 18:22:14 2012
New Revision: 233569
URL: http://svn.freebsd.org/changeset/base/233569

Log:
  Fix crash on VirtualBox (and probably on some real hardware):
  
  - Do not cover error returned by pmc_core_initialize with the
      result of pmc_uncore_initialize, fail right away.
  - Give a user something to report instead failing silently
  
  Reported by:	Alexandr Kovalenko 

Modified:
  head/sys/dev/hwpmc/hwpmc_core.c
  head/sys/dev/hwpmc/hwpmc_intel.c

Modified: head/sys/dev/hwpmc/hwpmc_core.c
==============================================================================
--- head/sys/dev/hwpmc/hwpmc_core.c	Tue Mar 27 18:17:22 2012	(r233568)
+++ head/sys/dev/hwpmc/hwpmc_core.c	Tue Mar 27 18:22:14 2012	(r233569)
@@ -2406,8 +2406,12 @@ pmc_core_initialize(struct pmc_mdep *md,
 	PMCDBG(MDP,INI,1,"core-init cputype=%d ncpu=%d ipa-version=%d",
 	    md->pmd_cputype, maxcpu, ipa_version);
 
-	if (ipa_version < 1 || ipa_version > 3)	/* Unknown PMC architecture. */
+	if (ipa_version < 1 || ipa_version > 3) {
+		/* Unknown PMC architecture. */
+		printf("hwpc_core: unknown PMC architecture: %d\n",
+		    ipa_version);
 		return (EPROGMISMATCH);
+	}
 
 	core_cputype = md->pmd_cputype;
 

Modified: head/sys/dev/hwpmc/hwpmc_intel.c
==============================================================================
--- head/sys/dev/hwpmc/hwpmc_intel.c	Tue Mar 27 18:17:22 2012	(r233568)
+++ head/sys/dev/hwpmc/hwpmc_intel.c	Tue Mar 27 18:22:14 2012	(r233569)
@@ -239,6 +239,9 @@ pmc_intel_initialize(void)
 		KASSERT(0, ("[intel,%d] Unknown CPU type", __LINE__));
 	}
 
+	if (error)
+		goto error;
+
 	/*
 	 * Init the uncore class.
 	 */

From owner-svn-src-head@FreeBSD.ORG  Tue Mar 27 18:26:36 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 22A78106564A;
	Tue, 27 Mar 2012 18:26:36 +0000 (UTC)
	(envelope-from jchandra@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 0D6398FC17;
	Tue, 27 Mar 2012 18:26:36 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2RIQZhF098378;
	Tue, 27 Mar 2012 18:26:35 GMT
	(envelope-from jchandra@svn.freebsd.org)
Received: (from jchandra@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2RIQZhR098376;
	Tue, 27 Mar 2012 18:26:35 GMT
	(envelope-from jchandra@svn.freebsd.org)
Message-Id: <201203271826.q2RIQZhR098376@svn.freebsd.org>
From: "Jayachandran C." 
Date: Tue, 27 Mar 2012 18:26:35 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233570 - head/sys/mips/nlm
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 27 Mar 2012 18:26:36 -0000

Author: jchandra
Date: Tue Mar 27 18:26:35 2012
New Revision: 233570
URL: http://svn.freebsd.org/changeset/base/233570

Log:
  Fix size of PCI softc.

Modified:
  head/sys/mips/nlm/xlp_pci.c

Modified: head/sys/mips/nlm/xlp_pci.c
==============================================================================
--- head/sys/mips/nlm/xlp_pci.c	Tue Mar 27 18:22:14 2012	(r233569)
+++ head/sys/mips/nlm/xlp_pci.c	Tue Mar 27 18:26:35 2012	(r233570)
@@ -331,7 +331,8 @@ static device_method_t xlp_pci_methods[]
 	DEVMETHOD_END
 };
 
-DEFINE_CLASS_1(pci, xlp_pci_driver, xlp_pci_methods, 0, pci_driver);
+DEFINE_CLASS_1(pci, xlp_pci_driver, xlp_pci_methods, sizeof(struct pci_softc),
+    pci_driver);
 DRIVER_MODULE(xlp_pci, pcib, xlp_pci_driver, pci_devclass, 0, 0);
 
 static devclass_t pcib_devclass;

From owner-svn-src-head@FreeBSD.ORG  Tue Mar 27 18:27:45 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id C88B01065670;
	Tue, 27 Mar 2012 18:27:45 +0000 (UTC)
	(envelope-from bschmidt@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id B2D968FC17;
	Tue, 27 Mar 2012 18:27:45 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2RIRj4w098447;
	Tue, 27 Mar 2012 18:27:45 GMT
	(envelope-from bschmidt@svn.freebsd.org)
Received: (from bschmidt@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2RIRjUL098445;
	Tue, 27 Mar 2012 18:27:45 GMT
	(envelope-from bschmidt@svn.freebsd.org)
Message-Id: <201203271827.q2RIRjUL098445@svn.freebsd.org>
From: Bernhard Schmidt 
Date: Tue, 27 Mar 2012 18:27:45 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233571 - head/sys/dev/iwn
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 27 Mar 2012 18:27:46 -0000

Author: bschmidt
Date: Tue Mar 27 18:27:45 2012
New Revision: 233571
URL: http://svn.freebsd.org/changeset/base/233571

Log:
  strip (R) to match manpage and pci_vendors
  
  MFC after:	1 week

Modified:
  head/sys/dev/iwn/if_iwn.c

Modified: head/sys/dev/iwn/if_iwn.c
==============================================================================
--- head/sys/dev/iwn/if_iwn.c	Tue Mar 27 18:26:35 2012	(r233570)
+++ head/sys/dev/iwn/if_iwn.c	Tue Mar 27 18:27:45 2012	(r233571)
@@ -79,35 +79,35 @@ struct iwn_ident {
 };
 
 static const struct iwn_ident iwn_ident_table[] = {
-	{ 0x8086, 0x0082, "Intel(R) Centrino(R) Advanced-N 6205"	 },
-	{ 0x8086, 0x0083, "Intel(R) Centrino(R) Wireless-N 1000"	 },
-	{ 0x8086, 0x0084, "Intel(R) Centrino(R) Wireless-N 1000"	 },
-	{ 0x8086, 0x0085, "Intel(R) Centrino(R) Advanced-N 6205"	 },
-	{ 0x8086, 0x0087, "Intel(R) Centrino(R) Advanced-N + WiMAX 6250" },
-	{ 0x8086, 0x0089, "Intel(R) Centrino(R) Advanced-N + WiMAX 6250" },
-	{ 0x8086, 0x008a, "Intel(R) Centrino(R) Wireless-N 1030"	 },
-	{ 0x8086, 0x008b, "Intel(R) Centrino(R) Wireless-N 1030"	 },
-	{ 0x8086, 0x0090, "Intel(R) Centrino(R) Advanced-N 6230"	 },
-	{ 0x8086, 0x0091, "Intel(R) Centrino(R) Advanced-N 6230"	 },
-	{ 0x8086, 0x0885, "Intel(R) Centrino(R) Wireless-N + WiMAX 6150" },
-	{ 0x8086, 0x0886, "Intel(R) Centrino(R) Wireless-N + WiMAX 6150" },
-	{ 0x8086, 0x0896, "Intel(R) Centrino(R) Wireless-N 130"		 },
-	{ 0x8086, 0x4229, "Intel(R) Wireless WiFi Link 4965"		 },
-	{ 0x8086, 0x422b, "Intel(R) Centrino(R) Ultimate-N 6300"	 },
-	{ 0x8086, 0x422c, "Intel(R) Centrino(R) Advanced-N 6200"	 },
-	{ 0x8086, 0x422d, "Intel(R) Wireless WiFi Link 4965"		 },
-	{ 0x8086, 0x4230, "Intel(R) Wireless WiFi Link 4965"		 },
-	{ 0x8086, 0x4232, "Intel(R) WiFi Link 5100"			 },
-	{ 0x8086, 0x4233, "Intel(R) Wireless WiFi Link 4965"		 },
-	{ 0x8086, 0x4235, "Intel(R) Ultimate N WiFi Link 5300"		 },
-	{ 0x8086, 0x4236, "Intel(R) Ultimate N WiFi Link 5300"		 },
-	{ 0x8086, 0x4237, "Intel(R) WiFi Link 5100"			 },
-	{ 0x8086, 0x4238, "Intel(R) Centrino(R) Ultimate-N 6300"	 },
-	{ 0x8086, 0x4239, "Intel(R) Centrino(R) Advanced-N 6200"	 },
-	{ 0x8086, 0x423a, "Intel(R) WiMAX/WiFi Link 5350"		 },
-	{ 0x8086, 0x423b, "Intel(R) WiMAX/WiFi Link 5350"		 },
-	{ 0x8086, 0x423c, "Intel(R) WiMAX/WiFi Link 5150"		 },
-	{ 0x8086, 0x423d, "Intel(R) WiMAX/WiFi Link 5150"		 },
+	{ 0x8086, 0x0082, "Intel Centrino Advanced-N 6205"		},
+	{ 0x8086, 0x0083, "Intel Centrino Wireless-N 1000"		},
+	{ 0x8086, 0x0084, "Intel Centrino Wireless-N 1000"		},
+	{ 0x8086, 0x0085, "Intel Centrino Advanced-N 6205"		},
+	{ 0x8086, 0x0087, "Intel Centrino Advanced-N + WiMAX 6250"	},
+	{ 0x8086, 0x0089, "Intel Centrino Advanced-N + WiMAX 6250"	},
+	{ 0x8086, 0x008a, "Intel Centrino Wireless-N 1030"		},
+	{ 0x8086, 0x008b, "Intel Centrino Wireless-N 1030"		},
+	{ 0x8086, 0x0090, "Intel Centrino Advanced-N 6230"		},
+	{ 0x8086, 0x0091, "Intel Centrino Advanced-N 6230"		},
+	{ 0x8086, 0x0885, "Intel Centrino Wireless-N + WiMAX 6150"	},
+	{ 0x8086, 0x0886, "Intel Centrino Wireless-N + WiMAX 6150"	},
+	{ 0x8086, 0x0896, "Intel Centrino Wireless-N 130"		},
+	{ 0x8086, 0x4229, "Intel Wireless WiFi Link 4965"		},
+	{ 0x8086, 0x422b, "Intel Centrino Ultimate-N 6300"		},
+	{ 0x8086, 0x422c, "Intel Centrino Advanced-N 6200"		},
+	{ 0x8086, 0x422d, "Intel Wireless WiFi Link 4965"		},
+	{ 0x8086, 0x4230, "Intel Wireless WiFi Link 4965"		},
+	{ 0x8086, 0x4232, "Intel WiFi Link 5100"			},
+	{ 0x8086, 0x4233, "Intel Wireless WiFi Link 4965"		},
+	{ 0x8086, 0x4235, "Intel Ultimate N WiFi Link 5300"		},
+	{ 0x8086, 0x4236, "Intel Ultimate N WiFi Link 5300"		},
+	{ 0x8086, 0x4237, "Intel WiFi Link 5100"			},
+	{ 0x8086, 0x4238, "Intel Centrino Ultimate-N 6300"		},
+	{ 0x8086, 0x4239, "Intel Centrino Advanced-N 6200"		},
+	{ 0x8086, 0x423a, "Intel WiMAX/WiFi Link 5350"			},
+	{ 0x8086, 0x423b, "Intel WiMAX/WiFi Link 5350"			},
+	{ 0x8086, 0x423c, "Intel WiMAX/WiFi Link 5150"			},
+	{ 0x8086, 0x423d, "Intel WiMAX/WiFi Link 5150"			},
 	{ 0, 0, NULL }
 };
 

From owner-svn-src-head@FreeBSD.ORG  Tue Mar 27 19:12:35 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 6048D106566C;
	Tue, 27 Mar 2012 19:12:35 +0000 (UTC)
	(envelope-from gonzo@hq.bluezbox.com)
Received: from hq.bluezbox.com (hq.bluezbox.com [70.38.37.145])
	by mx1.freebsd.org (Postfix) with ESMTP id 8E09E8FC15;
	Tue, 27 Mar 2012 19:12:34 +0000 (UTC)
Received: from localhost ([127.0.0.1])
	by hq.bluezbox.com with esmtpsa (TLSv1:CAMELLIA256-SHA:256)
	(Exim 4.73 (FreeBSD)) (envelope-from )
	id 1SCbBm-000879-Ev; Tue, 27 Mar 2012 11:32:15 -0700
Message-ID: <4F7207B5.8060802@freebsd.org>
Date: Tue, 27 Mar 2012 11:32:21 -0700
From: Oleksandr Tymoshenko 
User-Agent: Mozilla/5.0 (Windows NT 5.1;
	rv:11.0) Gecko/20120312 Thunderbird/11.0
MIME-Version: 1.0
To: Fabien Thomas 
References: <201203271402.q2RE2Nb7088755@svn.freebsd.org>
In-Reply-To: <201203271402.q2RE2Nb7088755@svn.freebsd.org>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Sender: gonzo@hq.bluezbox.com
X-Spam-Level: ----
X-Spam-Report: Spam detection software, running on the system "hq.bluezbox.com",
	has
	identified this incoming email as possible spam. The original message
	has been attached to this so you can view it (if it isn't spam) or
	label similar future email.  If you have any questions, see
	The administrator of that system for details.
	Content preview:  On 27/03/2012 7:02 AM,
	Fabien Thomas wrote: > Author: fabient
	> Date: Tue Mar 27 14:02:22 2012 > New Revision: 233544 > URL:
	http://svn.freebsd.org/changeset/base/233544
	> > Log: > Fix random deadlock on pmcstat exit: > - Exit the thread
	when soft shutdown is requested > - Wakeup owner thread. > >
	Reproduced/tested
	by looping pmcstat measurement: > pmcstat -S instructions -O/tmp/test
	ls [...] Content analysis details:   (-4.4 points, 5.0 required)
	pts rule name              description
	---- ----------------------
	--------------------------------------------------
	-1.8 ALL_TRUSTED Passed through trusted hosts only via SMTP
	-2.6 BAYES_00 BODY: Bayesian spam probability is 0 to 1%
	[score: 0.0000]
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r233544 - head/sys/dev/hwpmc
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 27 Mar 2012 19:12:35 -0000

On 27/03/2012 7:02 AM, Fabien Thomas wrote:
> Author: fabient
> Date: Tue Mar 27 14:02:22 2012
> New Revision: 233544
> URL: http://svn.freebsd.org/changeset/base/233544
>
> Log:
>    Fix random deadlock on pmcstat exit:
>    - Exit the thread when soft shutdown is requested
>    - Wakeup owner thread.
>
>    Reproduced/tested by looping pmcstat measurement:
>    pmcstat -S instructions -O/tmp/test ls

Thanks for fixing this! I ran into this issue  several times but
didn't have time to track it down.

From owner-svn-src-head@FreeBSD.ORG  Tue Mar 27 19:45:09 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 88B8F106566B;
	Tue, 27 Mar 2012 19:45:09 +0000 (UTC)
	(envelope-from Cy.Schubert@komquats.com)
Received: from idcmail-mo1so.shaw.ca (idcmail-mo1so.shaw.ca [24.71.223.10])
	by mx1.freebsd.org (Postfix) with ESMTP id 2B1728FC12;
	Tue, 27 Mar 2012 19:45:09 +0000 (UTC)
Received: from pd4ml1so-ssvc.prod.shaw.ca ([10.0.141.141])
	by pd2mo1so-svcs.prod.shaw.ca with ESMTP; 27 Mar 2012 13:45:08 -0600
X-Cloudmark-SP-Filtered: true
X-Cloudmark-SP-Result: v=1.1 cv=zu4PKjlF+9DoPrG/TPTQ4CC8dREy1gI1uGhqrRhVwqE=
	c=1 sm=1
	a=g2nFUZfGhBYA:10 a=QrugwKR0C_UA:10 a=wAGQQ9Az6v0A:10 a=BLceEmwcHowA:10
	a=ICAaq7hcmGcA:10 a=kj9zAlcOel0A:10 a=IbtKDeXwb2+SRU442/pi3A==:17
	a=6I5d2MoRAAAA:8 a=BWvPGDcYAAAA:8 a=KQMYF_uwN4BO8LJD1mIA:9
	a=Wh7kbxKHxWDQpkvJsNgA:7 a=CjuIK1q_8ugA:10 a=V7tsTZBp22UA:10
	a=SV7veod9ZcQA:10 a=HpAAvcLHHh0Zw7uRqdWCyQ==:117
Received: from unknown (HELO spqr.komquats.com) ([96.50.7.119])
	by pd4ml1so-dmz.prod.shaw.ca with ESMTP; 27 Mar 2012 13:45:08 -0600
Received: from slippy.cwsent.com (slippy8 [10.2.2.6])
	by spqr.komquats.com (Postfix) with ESMTP id DBD7381;
	Tue, 27 Mar 2012 12:45:07 -0700 (PDT)
Received: from slippy (localhost [127.0.0.1])
	by slippy.cwsent.com (8.14.5/8.14.5) with ESMTP id q2RJj6DZ009507;
	Tue, 27 Mar 2012 12:45:07 -0700 (PDT)
	(envelope-from Cy.Schubert@komquats.com)
Message-Id: <201203271945.q2RJj6DZ009507@slippy.cwsent.com>
X-Mailer: exmh version 2.7.2 01/07/2005 with nmh-1.3
From: Cy Schubert 
X-os: FreeBSD
X-Sender: cy@cwsent.com
X-URL: http://www.komquats.com/
To: Marius Strobl 
In-Reply-To: Message from Marius Strobl  of "Mon,
	26 Mar 2012 08:50:04 +0200."
	<20120326065004.GS37560@alchemy.franken.de>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Date: Tue, 27 Mar 2012 12:45:06 -0700
Cc: Cy Schubert , svn-src-head@FreeBSD.org,
	svn-src-all@FreeBSD.org, src-committers@FreeBSD.org
Subject: Re: svn commit: r233274 - in head/sys/dev/ata: . chipsets
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: Cy Schubert 
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 27 Mar 2012 19:45:09 -0000

In message <20120326065004.GS37560@alchemy.franken.de>, Marius Strobl 
writes:
> On Sun, Mar 25, 2012 at 10:35:33PM -0700, Cy Schubert wrote:
> > In message <201203210857.q2L8vFLB062984@svn.freebsd.org>, Marius Strobl 
> > writes:
> > > Author: marius
> > > Date: Wed Mar 21 08:57:15 2012
> > > New Revision: 233274
> > > URL: http://svn.freebsd.org/changeset/base/233274
> > > 
> > > Log:
> > >   Remove remnants of ATA_LOCKING uses in the ATA_CAM case and wrap it
> > >   along with functions, SYSCTLs and tunables that are not used with
> > >   ATA_CAM in #ifndef ATA_CAM, similar to the existing #ifdef'ed ATA_CAM
> > >   code for the other way around. This makes it easier to understand
> > >   which parts of ata(4) actually are used in the new world order and
> > >   to later on remove the !ATA_CAM bits. It also makes it obvious that
> > >   there is something fishy with the C-bus front-end as well as in the
> > >   ATP850 support, as these used ATA_LOCKING which is defunct in the
> > >   ATA_CAM case. When fixing the former, ATA_LOCKING probably needs to
> > >   be brought back in some form or other.
> > >   
> > >   Reviewed by:	mav
> > >   MFC after:	1 week
> > > 
> > > Modified:
> > >   head/sys/dev/ata/ata-all.c
> > >   head/sys/dev/ata/ata-cbus.c
> > >   head/sys/dev/ata/ata-pci.c
> > >   head/sys/dev/ata/ata-pci.h
> > >   head/sys/dev/ata/ata-queue.c
> > >   head/sys/dev/ata/chipsets/ata-acard.c
> > > 
> > [... diff removed for brevity ...]
> > 
> > Hi,
> > 
> > This commit broke kernels with device atapicam specified:
> > 
> > # ATA and ATAPI devices
> > device          atapicam        # emulate ATAPI devices as SCSI ditto via 
> > CAM
> >                                         # needs CAM to be present (scbus & 
> > pass)
> > 
> > Here are two examples when device atapicam is specified in the kernel 
> > config:
> > 
> 
> <...>
> 
> Apparently, you are using both "device atapicam" and "options ATA_CAM",
> which are mutually exclusive at run-time. As an intentional side-effect,
> r233274 breaks such configurations. The fact that you could compile
> both into the same kernel before was a bug, as ATA_CAM always took
> precedence.
> 
> > 
> > And, the patch to fix the issue:
> 
> No, this is backwards.

Cool, thanks. I've removed device atapicam from my configs. ;)


-- 
Cheers,
Cy Schubert 
FreeBSD UNIX:     Web:  http://www.FreeBSD.org



From owner-svn-src-head@FreeBSD.ORG  Tue Mar 27 20:10:14 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 5E48C106564A;
	Tue, 27 Mar 2012 20:10:14 +0000 (UTC)
	(envelope-from joel@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 495FE8FC0C;
	Tue, 27 Mar 2012 20:10:14 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2RKAERx001880;
	Tue, 27 Mar 2012 20:10:14 GMT (envelope-from joel@svn.freebsd.org)
Received: (from joel@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2RKAE4d001878;
	Tue, 27 Mar 2012 20:10:14 GMT (envelope-from joel@svn.freebsd.org)
Message-Id: <201203272010.q2RKAE4d001878@svn.freebsd.org>
From: Joel Dahl 
Date: Tue, 27 Mar 2012 20:10:14 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233574 - head/usr.bin/tftp
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 27 Mar 2012 20:10:14 -0000

Author: joel (doc committer)
Date: Tue Mar 27 20:10:13 2012
New Revision: 233574
URL: http://svn.freebsd.org/changeset/base/233574

Log:
  Only use macros inside a reference block.
  
  Discussed with:	brueffer

Modified:
  head/usr.bin/tftp/tftp.1

Modified: head/usr.bin/tftp/tftp.1
==============================================================================
--- head/usr.bin/tftp/tftp.1	Tue Mar 27 19:05:49 2012	(r233573)
+++ head/usr.bin/tftp/tftp.1	Tue Mar 27 20:10:13 2012	(r233574)
@@ -222,24 +222,19 @@ Toggle verbose mode.
 .Pp
 The following RFC's are supported:
 .Rs
-RFC 1350
-.%T The TFTP Protocol (Revision 2)
+.%T RFC 1350: The TFTP Protocol (Revision 2)
 .Re
 .Rs
-RFC 2347
-.%T TFTP Option Extension
+.%T RFC 2347: TFTP Option Extension
 .Re
 .Rs
-RFC 2348
-.%T TFTP Blocksize Option
+.%T RFC 2348: TFTP Blocksize Option
 .Re
 .Rs
-RFC 2349
-.%T TFTP Timeout Interval and Transfer Size Options
+.%T RFC 2349: TFTP Timeout Interval and Transfer Size Options
 .Re
 .Rs
-RFC 3617
-.%T Uniform Resource Identifier (URI) Scheme and Applicability Statement for the Trivial File Transfer Protocol (TFTP) 
+.%T RFC 3617: Uniform Resource Identifier (URI) Scheme and Applicability Statement for the Trivial File Transfer Protocol (TFTP) 
 .Re
 .Pp
 The non-standard

From owner-svn-src-head@FreeBSD.ORG  Tue Mar 27 20:36:04 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 72BAE1065672;
	Tue, 27 Mar 2012 20:36:04 +0000 (UTC)
	(envelope-from dumbbell@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 44EC18FC12;
	Tue, 27 Mar 2012 20:36:04 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2RKa4DG002756;
	Tue, 27 Mar 2012 20:36:04 GMT
	(envelope-from dumbbell@svn.freebsd.org)
Received: (from dumbbell@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2RKa4Wb002754;
	Tue, 27 Mar 2012 20:36:04 GMT
	(envelope-from dumbbell@svn.freebsd.org)
Message-Id: <201203272036.q2RKa4Wb002754@svn.freebsd.org>
From: Jean-Sebastien Pedron 
Date: Tue, 27 Mar 2012 20:36:04 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233575 - head/sys/gnu/fs/reiserfs
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 27 Mar 2012 20:36:04 -0000

Author: dumbbell
Date: Tue Mar 27 20:36:03 2012
New Revision: 233575
URL: http://svn.freebsd.org/changeset/base/233575

Log:
  Make ReiserFS MPSAFE
  
  Most functions seemed to be already fine w.r.t. what's done in msdosfs.
  
  MFC after:	1 month

Modified:
  head/sys/gnu/fs/reiserfs/reiserfs_vfsops.c

Modified: head/sys/gnu/fs/reiserfs/reiserfs_vfsops.c
==============================================================================
--- head/sys/gnu/fs/reiserfs/reiserfs_vfsops.c	Tue Mar 27 20:10:13 2012	(r233574)
+++ head/sys/gnu/fs/reiserfs/reiserfs_vfsops.c	Tue Mar 27 20:36:03 2012	(r233575)
@@ -231,6 +231,7 @@ reiserfs_unmount(struct mount *mp, int m
 	g_topology_unlock();
 	PICKUP_GIANT();
 	vrele(rmp->rm_devvp);
+	dev_rel(rmp->rm_dev);
 
 	if (sbi) {
 		reiserfs_log(LOG_DEBUG, "free sbi\n");
@@ -430,21 +431,25 @@ reiserfs_mountfs(struct vnode *devvp, st
 	struct reiserfs_mount *rmp;
 	struct reiserfs_sb_info *sbi;
 	struct reiserfs_super_block *rs;
-	struct cdev *dev = devvp->v_rdev;
+	struct cdev *dev;
 
 	struct g_consumer *cp;
 	struct bufobj *bo;
 
 	//ronly = (mp->mnt_flag & MNT_RDONLY) != 0;
 
+	dev = devvp->v_rdev;
+	dev_ref(dev);
 	DROP_GIANT();
 	g_topology_lock();
 	error = g_vfs_open(devvp, &cp, "reiserfs", /* read-only */ 0);
 	g_topology_unlock();
 	PICKUP_GIANT();
 	VOP_UNLOCK(devvp, 0);
-	if (error)
+	if (error) {
+		dev_rel(dev);
 		return (error);
+	}
 
 	bo = &devvp->v_bufobj;
 	bo->bo_private = cp;
@@ -575,6 +580,7 @@ reiserfs_mountfs(struct vnode *devvp, st
 	mp->mnt_stat.f_fsid.val[1] = mp->mnt_vfc->vfc_typenum;
 	MNT_ILOCK(mp);
 	mp->mnt_flag |= MNT_LOCAL;
+	mp->mnt_kern_flag |= MNTK_MPSAFE;
 	MNT_IUNLOCK(mp);
 #if defined(si_mountpoint)
 	devvp->v_rdev->si_mountpoint = mp;
@@ -590,7 +596,8 @@ out:
 			for (i = 0; i < SB_BMAP_NR(sbi); i++) {
 				if (!SB_AP_BITMAP(sbi)[i].bp_data)
 					break;
-				free(SB_AP_BITMAP(sbi)[i].bp_data, M_REISERFSMNT);
+				free(SB_AP_BITMAP(sbi)[i].bp_data,
+				    M_REISERFSMNT);
 			}
 			free(SB_AP_BITMAP(sbi), M_REISERFSMNT);
 		}
@@ -613,6 +620,7 @@ out:
 		free(sbi, M_REISERFSMNT);
 	if (rmp)
 		free(rmp, M_REISERFSMNT);
+	dev_rel(dev);
 	return (error);
 }
 

From owner-svn-src-head@FreeBSD.ORG  Tue Mar 27 20:39:50 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 12C4F1065670;
	Tue, 27 Mar 2012 20:39:50 +0000 (UTC)
	(envelope-from joel@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id F1D238FC19;
	Tue, 27 Mar 2012 20:39:49 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2RKdnr3002894;
	Tue, 27 Mar 2012 20:39:49 GMT (envelope-from joel@svn.freebsd.org)
Received: (from joel@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2RKdnMa002892;
	Tue, 27 Mar 2012 20:39:49 GMT (envelope-from joel@svn.freebsd.org)
Message-Id: <201203272039.q2RKdnMa002892@svn.freebsd.org>
From: Joel Dahl 
Date: Tue, 27 Mar 2012 20:39:49 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233576 - head/lib/libc/net
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 27 Mar 2012 20:39:50 -0000

Author: joel (doc committer)
Date: Tue Mar 27 20:39:49 2012
New Revision: 233576
URL: http://svn.freebsd.org/changeset/base/233576

Log:
  Minor indentation and paragraph nits.

Modified:
  head/lib/libc/net/nsdispatch.3

Modified: head/lib/libc/net/nsdispatch.3
==============================================================================
--- head/lib/libc/net/nsdispatch.3	Tue Mar 27 20:36:03 2012	(r233575)
+++ head/lib/libc/net/nsdispatch.3	Tue Mar 27 20:39:49 2012	(r233576)
@@ -85,7 +85,7 @@ typedef struct _ns_dtab {
 	void		*mdata;
 } ns_dtab;
 .Ed
-.Bd -ragged -offset indent
+.Pp
 The
 .Fa dtab
 array should consist of one entry for each source type that is
@@ -105,7 +105,6 @@ values for
 .Va method ,
 and
 .Va mdata .
-.Ed
 .Pp
 Additionally, methods may be implemented in NSS modules, in
 which case they are selected using the
@@ -132,7 +131,7 @@ typedef struct _ns_src {
 	uint32_t	 flags;
 } ns_src;
 .Ed
-.Bd -ragged -offset indent
+.Pp
 The
 .Fa defaults
 array should consist of one entry for each source to be configured by
@@ -157,12 +156,13 @@ and
 set to 0.
 .Pp
 For convenience, a global variable defined as:
+.Pp
 .Dl extern const ns_src __nsdefaultsrc[];
+.Pp
 exists which contains a single default entry for the source
 .Sq files
 that may be used by callers which do not require complicated default
 rules.
-.Ed
 .Pp
 .Sq Va ...
 are optional extra arguments, which are passed to the appropriate method

From owner-svn-src-head@FreeBSD.ORG  Tue Mar 27 20:44:43 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 79D131065674
	for ; Tue, 27 Mar 2012 20:44:43 +0000 (UTC)
	(envelope-from pfrankymee@ymail.com)
Received: from mail.flm.ro (frontline1.mediasat.ro [193.226.85.171])
	by mx1.freebsd.org (Postfix) with ESMTP id 71A018FC16
	for ; Tue, 27 Mar 2012 20:44:42 +0000 (UTC)
Received: (qmail 2727 invoked by uid 512); 27 Mar 2012 23:44:38 +0300
Received: from 216.59.3.82 by mail.flm.ro (envelope-from
	, uid 508) with qmail-scanner-1.25-st-qms 
	(spamassassin: 3.2.4. perlscan: 1.25-st-qms.  
	Clear:RC:0(216.59.3.82):SA:0(4.4/5.0):. 
	Processed in 8.782104 secs); 27 Mar 2012 20:44:38 -0000
X-Spam-Status: No, hits=4.4 required=5.0
X-Spam-Level: ++++
X-Antivirus-MYDOMAIN-Mail-From: pfrankymee@ymail.com via mail.flm.ro
X-Antivirus-MYDOMAIN: 1.25-st-qms (Clear:RC:0(216.59.3.82):SA:0(4.4/5.0):.
	Processed in 8.782104 secs Process 2584)
Received: from unknown (HELO WIN-TF1IF2F94JN) (test@flm.ro@216.59.3.82)
	by mail.flm.ro with SMTP; 27 Mar 2012 23:44:29 +0300
Message-ID: <02e9779d-40995-0e4d572417419@win-tf1if2f94jn>
From: "Franky Meersman" 
To: svn-src-head@freebsd.org
Date: Tue, 27 Mar 2012 13:43:18 -0700
MIME-Version: 1.0
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
X-Priority: 3
Subject: Re: Important Reply.
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: Franky Meersman 
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 27 Mar 2012 20:44:43 -0000

Good day,
My name is Franky Meersman, a senior staff and an executive of a bank here in United Kingdom. I am writing to seek your indulgence and assistance. I wish to make a transfer involving an amount of money estimated at 20,000.000.00 (Twenty Million British Pounds Sterling) and I feel strongly that you will be capable of receiving this fund into your account in your country.

I am proposing to make this transfer to a designated bank account of your choice. I could not do this project alone since I am an insider in the bank. A zero account balance or a new account may be opened for this purpose. Thus, for your indulgence and support, I propose an offer of 25% of the total amount to be your compensation and commission after the transfer has been successfully concluded. reply me private (meersmanfr@ymail.com) 447045709908
Thanks and God bless.
Regards
Franky Meersman


From owner-svn-src-head@FreeBSD.ORG  Tue Mar 27 20:50:15 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 1585E106566B;
	Tue, 27 Mar 2012 20:50:15 +0000 (UTC)
	(envelope-from joel@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id F3A228FC08;
	Tue, 27 Mar 2012 20:50:14 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2RKoE2P003255;
	Tue, 27 Mar 2012 20:50:14 GMT (envelope-from joel@svn.freebsd.org)
Received: (from joel@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2RKoEE4003252;
	Tue, 27 Mar 2012 20:50:14 GMT (envelope-from joel@svn.freebsd.org)
Message-Id: <201203272050.q2RKoEE4003252@svn.freebsd.org>
From: Joel Dahl 
Date: Tue, 27 Mar 2012 20:50:14 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233577 - in head: lib/libc/iconv share/man/man4
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 27 Mar 2012 20:50:15 -0000

Author: joel (doc committer)
Date: Tue Mar 27 20:50:14 2012
New Revision: 233577
URL: http://svn.freebsd.org/changeset/base/233577

Log:
  mdoc: add missing El macro.

Modified:
  head/lib/libc/iconv/iconvctl.3
  head/share/man/man4/xnb.4

Modified: head/lib/libc/iconv/iconvctl.3
==============================================================================
--- head/lib/libc/iconv/iconvctl.3	Tue Mar 27 20:39:49 2012	(r233576)
+++ head/lib/libc/iconv/iconvctl.3	Tue Mar 27 20:50:14 2012	(r233577)
@@ -110,6 +110,7 @@ variable, which is passed to
 via
 .Fa argument
 by its address.
+.El
 .\" XXX: fallbacks are unimplemented and trying to set them will always
 .\"      return EOPNOTSUPP but definitions are provided for source-level
 .\"      compatibility.
@@ -140,6 +141,7 @@ Unknown or unimplemented operation.
 The conversion descriptor specified by
 .Fa cd
 is invalid.
+.El
 .Sh SEE ALSO
 .Xr iconv 1 ,
 .Xr iconv 3

Modified: head/share/man/man4/xnb.4
==============================================================================
--- head/share/man/man4/xnb.4	Tue Mar 27 20:39:49 2012	(r233576)
+++ head/share/man/man4/xnb.4	Tue Mar 27 20:50:14 2012	(r233577)
@@ -84,6 +84,7 @@ Runs a builtin suite of unit tests and d
 Does not affect the operation of the driver in any way.
 Note that the test suite simulates error conditions; this will result in
 error messages being printed to the system system log.
+.El
 .Sh SEE ALSO
 .Xr arp 4 ,
 .Xr netintro 4 ,

From owner-svn-src-head@FreeBSD.ORG  Tue Mar 27 21:10:46 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 34B901065674;
	Tue, 27 Mar 2012 21:10:46 +0000 (UTC)
	(envelope-from ivoras@gmail.com)
Received: from mail-yx0-f182.google.com (mail-yx0-f182.google.com
	[209.85.213.182])
	by mx1.freebsd.org (Postfix) with ESMTP id 656DD8FC15;
	Tue, 27 Mar 2012 21:10:45 +0000 (UTC)
Received: by yenl9 with SMTP id l9so403126yen.13
	for ; Tue, 27 Mar 2012 14:10:40 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
	h=mime-version:sender:in-reply-to:references:from:date
	:x-google-sender-auth:message-id:subject:to:cc:content-type
	:content-transfer-encoding;
	bh=xEX8f0jr3Cw3KiA/c4YYwKHxSUFix9WNOy2NqKxCtRQ=;
	b=wzPBGasV8pourwnH0zeL9fjZyFd7887Euc43VJMVqLDP8igOi17+SlrS8CuIIi1tKU
	bjGj+xGDaBUyjUW/k/yXcLUAr2bkCco4k8TmiZ1uhG3Xm+Fv8c19vHqomDC0R4g6ADSX
	h+IN5byy1G9reM/4FtXtZ45CcC1hVDh63z7roFpf/c7+9A0VldNSg48sqDjlQElI2Wmg
	LMAWIayh+d7UbpJqmngw2XOQ5kiePPt1lfJiEi7CQvHRpDpYEu8nwUjVihMYMTj7/pvi
	cA9ZuiNGTSjSzYKGsil6jLBzJue32hS2Skn5QCKO+AFvg5IpNs0gIf9Ki1imMiv1TesG
	3xQg==
Received: by 10.236.184.226 with SMTP id s62mr3710314yhm.119.1332882640906;
	Tue, 27 Mar 2012 14:10:40 -0700 (PDT)
MIME-Version: 1.0
Sender: ivoras@gmail.com
Received: by 10.101.101.10 with HTTP; Tue, 27 Mar 2012 14:10:00 -0700 (PDT)
In-Reply-To: <20120325105958.GB61230@zxy.spb.ru>
References: <201203220848.q2M8mia8015593@svn.freebsd.org>
	<20120325105958.GB61230@zxy.spb.ru>
From: Ivan Voras 
Date: Tue, 27 Mar 2012 23:10:00 +0200
X-Google-Sender-Auth: jFlekms10r8n7gA8MHYsruyOpqk
Message-ID: 
To: Slawa Olhovchenkov 
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
Cc: Stanislav Sedov , svn-src-head@freebsd.org,
	svn-src-all@freebsd.org, src-committers@freebsd.org
Subject: Re: svn commit: r233294 - in head: . contrib/com_err crypto/heimdal
 crypto/heimdal/admin crypto/heimdal/appl crypto/heimdal/appl/afsutil
 crypto/heimdal/appl/ftp crypto/heimdal/appl/ftp/common crypto/he...
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 27 Mar 2012 21:10:46 -0000

On 25 March 2012 12:59, Slawa Olhovchenkov  wrote:
> On Thu, Mar 22, 2012 at 08:48:44AM +0000, Stanislav Sedov wrote:
>
>> =C2=A0 - Heimdal's KDC now require sqlite to operate. =C2=A0We use the b=
undled version
>> =C2=A0 =C2=A0 and install it as libheimsqlite. =C2=A0If some other FreeB=
SD components will
>> =C2=A0 =C2=A0 require it in the future we can rename it to libbsdsqlite =
and use for these
>> =C2=A0 =C2=A0 components as well.
>
> Can some ports (svn, for example) use this library?

Judging from past experience, that would not be a good idea.

However, libbsdsqlite is a *very* good idea, now that there's finally
one user it which cannot be hacked around :) It will help both present
development (the pkgng is also AFAIK using sqlite) and future
developments (all the little binary-blob databases in the system could
finally use something structured and future-proof). I will personally
teach any doubting Thomas on how wonderful sqlite and SQL in general
really is [*] ;)



[*] for their specific, narrow field of application, of course

From owner-svn-src-head@FreeBSD.ORG  Tue Mar 27 21:23:49 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 8D8761065670;
	Tue, 27 Mar 2012 21:23:49 +0000 (UTC) (envelope-from jhb@freebsd.org)
Received: from bigwig.baldwin.cx (bigknife-pt.tunnel.tserv9.chi1.ipv6.he.net
	[IPv6:2001:470:1f10:75::2])
	by mx1.freebsd.org (Postfix) with ESMTP id 607348FC0C;
	Tue, 27 Mar 2012 21:23:49 +0000 (UTC)
Received: from jhbbsd.localnet (unknown [209.249.190.124])
	by bigwig.baldwin.cx (Postfix) with ESMTPSA id BE52FB960;
	Tue, 27 Mar 2012 17:23:48 -0400 (EDT)
From: John Baldwin 
To: "Jayachandran C." 
Date: Tue, 27 Mar 2012 17:21:25 -0400
User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p10; KDE/4.5.5; amd64; ; )
References: <201203271826.q2RIQZhR098376@svn.freebsd.org>
In-Reply-To: <201203271826.q2RIQZhR098376@svn.freebsd.org>
MIME-Version: 1.0
Content-Type: Text/Plain;
  charset="utf-8"
Content-Transfer-Encoding: 7bit
Message-Id: <201203271721.25441.jhb@freebsd.org>
X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7
	(bigwig.baldwin.cx); Tue, 27 Mar 2012 17:23:48 -0400 (EDT)
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r233570 - head/sys/mips/nlm
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 27 Mar 2012 21:23:49 -0000

On Tuesday, March 27, 2012 2:26:35 pm Jayachandran C. wrote:
> Author: jchandra
> Date: Tue Mar 27 18:26:35 2012
> New Revision: 233570
> URL: http://svn.freebsd.org/changeset/base/233570
> 
> Log:
>   Fix size of PCI softc.
> 
> Modified:
>   head/sys/mips/nlm/xlp_pci.c
> 
> Modified: head/sys/mips/nlm/xlp_pci.c
> 
==============================================================================
> --- head/sys/mips/nlm/xlp_pci.c	Tue Mar 27 18:22:14 2012	(r233569)
> +++ head/sys/mips/nlm/xlp_pci.c	Tue Mar 27 18:26:35 2012	(r233570)
> @@ -331,7 +331,8 @@ static device_method_t xlp_pci_methods[]
>  	DEVMETHOD_END
>  };
>  
> -DEFINE_CLASS_1(pci, xlp_pci_driver, xlp_pci_methods, 0, pci_driver);
> +DEFINE_CLASS_1(pci, xlp_pci_driver, xlp_pci_methods, sizeof(struct 
pci_softc),
> +    pci_driver);
>  DRIVER_MODULE(xlp_pci, pcib, xlp_pci_driver, pci_devclass, 0, 0);
>  
>  static devclass_t pcib_devclass;

Oops, not sure how I missed this one earlier. :(

-- 
John Baldwin

From owner-svn-src-head@FreeBSD.ORG  Tue Mar 27 21:23:57 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 54F951065702;
	Tue, 27 Mar 2012 21:23:57 +0000 (UTC)
	(envelope-from peter@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 3AAAC8FC08;
	Tue, 27 Mar 2012 21:23:57 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2RLNvRq004311;
	Tue, 27 Mar 2012 21:23:57 GMT (envelope-from peter@svn.freebsd.org)
Received: (from peter@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2RLNuDu004298;
	Tue, 27 Mar 2012 21:23:56 GMT (envelope-from peter@svn.freebsd.org)
Message-Id: <201203272123.q2RLNuDu004298@svn.freebsd.org>
From: Peter Wemm 
Date: Tue, 27 Mar 2012 21:23:56 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233578 - head/sys/conf
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 27 Mar 2012 21:23:57 -0000

Author: peter
Date: Tue Mar 27 21:23:56 2012
New Revision: 233578
URL: http://svn.freebsd.org/changeset/base/233578

Log:
  Allow (with a license warning) "options ZFS" to work in static kernels.
  
  The 'make depend' rules have to use custom -I paths for the special compat
  includes for the opensolaris/zfs headers.
  
  This option will pull in the couple of files that are shared with dtrace,
  but they appear to correctly use the MODULE_VERSION/MODULE_DEPEND rules
  so loader should do the right thing, as should kldload.
  
  Reviewed by:	pjd (glanced at)

Modified:
  head/sys/conf/files
  head/sys/conf/files.amd64
  head/sys/conf/files.arm
  head/sys/conf/files.i386
  head/sys/conf/files.ia64
  head/sys/conf/files.mips
  head/sys/conf/files.pc98
  head/sys/conf/files.powerpc
  head/sys/conf/files.sparc64
  head/sys/conf/kern.post.mk
  head/sys/conf/kern.pre.mk
  head/sys/conf/options

Modified: head/sys/conf/files
==============================================================================
--- head/sys/conf/files	Tue Mar 27 20:50:14 2012	(r233577)
+++ head/sys/conf/files	Tue Mar 27 21:23:56 2012	(r233578)
@@ -139,6 +139,131 @@ cam/scsi/scsi_sg.c		optional sg
 cam/scsi/scsi_targ_bh.c		optional targbh
 cam/scsi/scsi_target.c		optional targ
 cam/scsi/smp_all.c		optional scbus
+# shared between zfs and dtrace
+cddl/compat/opensolaris/kern/opensolaris.c				optional zfs compile-with "${ZFS_C}"
+cddl/compat/opensolaris/kern/opensolaris_cmn_err.c			optional zfs compile-with "${ZFS_C}"
+cddl/compat/opensolaris/kern/opensolaris_kmem.c				optional zfs compile-with "${ZFS_C}"
+cddl/compat/opensolaris/kern/opensolaris_misc.c				optional zfs compile-with "${ZFS_C}"
+cddl/compat/opensolaris/kern/opensolaris_sunddi.c			optional zfs compile-with "${ZFS_C}"
+# zfs specific
+cddl/compat/opensolaris/kern/opensolaris_acl.c				optional zfs compile-with "${ZFS_C}"
+cddl/compat/opensolaris/kern/opensolaris_kobj.c				optional zfs compile-with "${ZFS_C}"
+cddl/compat/opensolaris/kern/opensolaris_kstat.c			optional zfs compile-with "${ZFS_C}"
+cddl/compat/opensolaris/kern/opensolaris_lookup.c			optional zfs compile-with "${ZFS_C}"
+cddl/compat/opensolaris/kern/opensolaris_policy.c			optional zfs compile-with "${ZFS_C}"
+cddl/compat/opensolaris/kern/opensolaris_string.c			optional zfs compile-with "${ZFS_C}"
+cddl/compat/opensolaris/kern/opensolaris_sysevent.c			optional zfs compile-with "${ZFS_C}"
+cddl/compat/opensolaris/kern/opensolaris_taskq.c			optional zfs compile-with "${ZFS_C}"
+cddl/compat/opensolaris/kern/opensolaris_uio.c				optional zfs compile-with "${ZFS_C}"
+cddl/compat/opensolaris/kern/opensolaris_vfs.c				optional zfs compile-with "${ZFS_C}"
+cddl/compat/opensolaris/kern/opensolaris_zone.c				optional zfs compile-with "${ZFS_C}"
+cddl/contrib/opensolaris/common/acl/acl_common.c			optional zfs compile-with "${ZFS_C}"
+cddl/contrib/opensolaris/common/avl/avl.c				optional zfs compile-with "${ZFS_C}"
+cddl/contrib/opensolaris/common/nvpair/nvpair.c				optional zfs compile-with "${ZFS_C}"
+cddl/contrib/opensolaris/common/nvpair/nvpair_alloc_fixed.c		optional zfs compile-with "${ZFS_C}"
+cddl/contrib/opensolaris/common/unicode/u8_textprep.c			optional zfs compile-with "${ZFS_C}"
+cddl/contrib/opensolaris/common/zfs/zfs_comutil.c			optional zfs compile-with "${ZFS_C}"
+cddl/contrib/opensolaris/common/zfs/zfs_deleg.c				optional zfs compile-with "${ZFS_C}"
+cddl/contrib/opensolaris/common/zfs/zfs_fletcher.c			optional zfs compile-with "${ZFS_C}"
+cddl/contrib/opensolaris/common/zfs/zfs_ioctl_compat.c			optional zfs compile-with "${ZFS_C}"
+cddl/contrib/opensolaris/common/zfs/zfs_namecheck.c			optional zfs compile-with "${ZFS_C}"
+cddl/contrib/opensolaris/common/zfs/zfs_prop.c				optional zfs compile-with "${ZFS_C}"
+cddl/contrib/opensolaris/common/zfs/zpool_prop.c			optional zfs compile-with "${ZFS_C}"
+cddl/contrib/opensolaris/common/zfs/zprop_common.c			optional zfs compile-with "${ZFS_C}"
+cddl/contrib/opensolaris/uts/common/fs/gfs.c				optional zfs compile-with "${ZFS_C}"
+cddl/contrib/opensolaris/uts/common/fs/vnode.c				optional zfs compile-with "${ZFS_C}"
+cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c			optional zfs compile-with "${ZFS_C}"
+cddl/contrib/opensolaris/uts/common/fs/zfs/bplist.c			optional zfs compile-with "${ZFS_C}"
+cddl/contrib/opensolaris/uts/common/fs/zfs/bpobj.c			optional zfs compile-with "${ZFS_C}"
+cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c			optional zfs compile-with "${ZFS_C}"
+cddl/contrib/opensolaris/uts/common/fs/zfs/ddt.c			optional zfs compile-with "${ZFS_C}"
+cddl/contrib/opensolaris/uts/common/fs/zfs/ddt_zap.c			optional zfs compile-with "${ZFS_C}"
+cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c			optional zfs compile-with "${ZFS_C}"
+cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_diff.c			optional zfs compile-with "${ZFS_C}"
+cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_object.c			optional zfs compile-with "${ZFS_C}"
+cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c			optional zfs compile-with "${ZFS_C}"
+cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c			optional zfs compile-with "${ZFS_C}"
+cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_traverse.c		optional zfs compile-with "${ZFS_C}"
+cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c			optional zfs compile-with "${ZFS_C}"
+cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_zfetch.c			optional zfs compile-with "${ZFS_C}"
+cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c			optional zfs compile-with "${ZFS_C}" \
+	warning "kernel contains CDDL licensed ZFS filesystem"
+cddl/contrib/opensolaris/uts/common/fs/zfs/dnode_sync.c			optional zfs compile-with "${ZFS_C}"
+cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c		optional zfs compile-with "${ZFS_C}"
+cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_deadlist.c		optional zfs compile-with "${ZFS_C}"
+cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_deleg.c			optional zfs compile-with "${ZFS_C}"
+cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dir.c			optional zfs compile-with "${ZFS_C}"
+cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c			optional zfs compile-with "${ZFS_C}"
+cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_prop.c			optional zfs compile-with "${ZFS_C}"
+cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c			optional zfs compile-with "${ZFS_C}"
+cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_synctask.c		optional zfs compile-with "${ZFS_C}"
+cddl/contrib/opensolaris/uts/common/fs/zfs/gzip.c			optional zfs compile-with "${ZFS_C}"
+cddl/contrib/opensolaris/uts/common/fs/zfs/lzjb.c			optional zfs compile-with "${ZFS_C}"
+cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c			optional zfs compile-with "${ZFS_C}"
+cddl/contrib/opensolaris/uts/common/fs/zfs/refcount.c			optional zfs compile-with "${ZFS_C}"
+cddl/contrib/opensolaris/uts/common/fs/zfs/rrwlock.c			optional zfs compile-with "${ZFS_C}"
+cddl/contrib/opensolaris/uts/common/fs/zfs/sa.c				optional zfs compile-with "${ZFS_C}"
+cddl/contrib/opensolaris/uts/common/fs/zfs/sha256.c			optional zfs compile-with "${ZFS_C}"
+cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c			optional zfs compile-with "${ZFS_C}"
+cddl/contrib/opensolaris/uts/common/fs/zfs/spa_config.c			optional zfs compile-with "${ZFS_C}"
+cddl/contrib/opensolaris/uts/common/fs/zfs/spa_errlog.c			optional zfs compile-with "${ZFS_C}"
+cddl/contrib/opensolaris/uts/common/fs/zfs/spa_history.c		optional zfs compile-with "${ZFS_C}"
+cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c			optional zfs compile-with "${ZFS_C}"
+cddl/contrib/opensolaris/uts/common/fs/zfs/space_map.c			optional zfs compile-with "${ZFS_C}"
+cddl/contrib/opensolaris/uts/common/fs/zfs/txg.c			optional zfs compile-with "${ZFS_C}"
+cddl/contrib/opensolaris/uts/common/fs/zfs/uberblock.c			optional zfs compile-with "${ZFS_C}"
+cddl/contrib/opensolaris/uts/common/fs/zfs/unique.c			optional zfs compile-with "${ZFS_C}"
+cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c			optional zfs compile-with "${ZFS_C}"
+cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_cache.c			optional zfs compile-with "${ZFS_C}"
+cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_file.c			optional zfs compile-with "${ZFS_C}"
+cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c			optional zfs compile-with "${ZFS_C}"
+cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_label.c			optional zfs compile-with "${ZFS_C}"
+cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_mirror.c		optional zfs compile-with "${ZFS_C}"
+cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_missing.c		optional zfs compile-with "${ZFS_C}"
+cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c			optional zfs compile-with "${ZFS_C}"
+cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_raidz.c			optional zfs compile-with "${ZFS_C}"
+cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_root.c			optional zfs compile-with "${ZFS_C}"
+cddl/contrib/opensolaris/uts/common/fs/zfs/zap.c			optional zfs compile-with "${ZFS_C}"
+cddl/contrib/opensolaris/uts/common/fs/zfs/zap_leaf.c			optional zfs compile-with "${ZFS_C}"
+cddl/contrib/opensolaris/uts/common/fs/zfs/zap_micro.c			optional zfs compile-with "${ZFS_C}"
+cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c			optional zfs compile-with "${ZFS_C}"
+cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_byteswap.c		optional zfs compile-with "${ZFS_C}"
+cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c			optional zfs compile-with "${ZFS_C}"
+cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_debug.c			optional zfs compile-with "${ZFS_C}"
+cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c			optional zfs compile-with "${ZFS_C}"
+cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_fm.c			optional zfs compile-with "${ZFS_C}"
+cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_fuid.c			optional zfs compile-with "${ZFS_C}"
+cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c			optional zfs compile-with "${ZFS_C}"
+cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_log.c			optional zfs compile-with "${ZFS_C}"
+cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_onexit.c			optional zfs compile-with "${ZFS_C}"
+cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_replay.c			optional zfs compile-with "${ZFS_C}"
+cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_rlock.c			optional zfs compile-with "${ZFS_C}"
+cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_sa.c			optional zfs compile-with "${ZFS_C}"
+cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c			optional zfs compile-with "${ZFS_C}"
+cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c			optional zfs compile-with "${ZFS_C}"
+cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c			optional zfs compile-with "${ZFS_C}"
+cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c			optional zfs compile-with "${ZFS_C}"
+cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c			optional zfs compile-with "${ZFS_C}"
+cddl/contrib/opensolaris/uts/common/fs/zfs/zio_checksum.c		optional zfs compile-with "${ZFS_C}"
+cddl/contrib/opensolaris/uts/common/fs/zfs/zio_compress.c		optional zfs compile-with "${ZFS_C}"
+cddl/contrib/opensolaris/uts/common/fs/zfs/zio_inject.c			optional zfs compile-with "${ZFS_C}"
+cddl/contrib/opensolaris/uts/common/fs/zfs/zle.c			optional zfs compile-with "${ZFS_C}"
+cddl/contrib/opensolaris/uts/common/fs/zfs/zrlock.c			optional zfs compile-with "${ZFS_C}"
+cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c			optional zfs compile-with "${ZFS_C}"
+cddl/contrib/opensolaris/uts/common/os/callb.c				optional zfs compile-with "${ZFS_C}"
+cddl/contrib/opensolaris/uts/common/os/fm.c				optional zfs compile-with "${ZFS_C}"
+cddl/contrib/opensolaris/uts/common/os/list.c				optional zfs compile-with "${ZFS_C}"
+cddl/contrib/opensolaris/uts/common/os/nvpair_alloc_system.c		optional zfs compile-with "${ZFS_C}"
+cddl/contrib/opensolaris/uts/common/zmod/adler32.c			optional zfs compile-with "${ZFS_C}"
+cddl/contrib/opensolaris/uts/common/zmod/deflate.c			optional zfs compile-with "${ZFS_C}"
+cddl/contrib/opensolaris/uts/common/zmod/inffast.c			optional zfs compile-with "${ZFS_C}"
+cddl/contrib/opensolaris/uts/common/zmod/inflate.c			optional zfs compile-with "${ZFS_C}"
+cddl/contrib/opensolaris/uts/common/zmod/inftrees.c			optional zfs compile-with "${ZFS_C}"
+cddl/contrib/opensolaris/uts/common/zmod/opensolaris_crc32.c		optional zfs compile-with "${ZFS_C}"
+cddl/contrib/opensolaris/uts/common/zmod/trees.c			optional zfs compile-with "${ZFS_C}"
+cddl/contrib/opensolaris/uts/common/zmod/zmod.c				optional zfs compile-with "${ZFS_C}"
+cddl/contrib/opensolaris/uts/common/zmod/zmod_subr.c			optional zfs compile-with "${ZFS_C}"
+cddl/contrib/opensolaris/uts/common/zmod/zutil.c			optional zfs compile-with "${ZFS_C}"
 contrib/altq/altq/altq_cbq.c	optional altq \
 	compile-with "${NORMAL_C} -I$S/contrib/pf"
 contrib/altq/altq/altq_cdnr.c	optional altq
@@ -415,7 +540,7 @@ crypto/rijndael/rijndael-api.c	optional 
 crypto/sha1.c			optional carp | crypto | ipsec | \
 					 netgraph_mppc_encryption | sctp
 crypto/sha2/sha2.c		optional crypto | geom_bde | ipsec | random | \
-					 sctp
+					 sctp | zfs
 ddb/db_access.c			optional	ddb
 ddb/db_break.c			optional	ddb
 ddb/db_capture.c		optional	ddb

Modified: head/sys/conf/files.amd64
==============================================================================
--- head/sys/conf/files.amd64	Tue Mar 27 20:50:14 2012	(r233577)
+++ head/sys/conf/files.amd64	Tue Mar 27 21:23:56 2012	(r233578)
@@ -133,6 +133,7 @@ amd64/amd64/uio_machdep.c	standard
 amd64/amd64/uma_machdep.c	standard
 amd64/amd64/vm_machdep.c	standard
 amd64/pci/pci_cfgreg.c		optional	pci
+cddl/contrib/opensolaris/common/atomic/amd64/opensolaris_atomic.S	optional zfs compile-with "${ZFS_S}"
 crypto/aesni/aesencdec_amd64.S	optional aesni
 crypto/aesni/aeskeys_amd64.S	optional aesni
 crypto/aesni/aesni.c		optional aesni

Modified: head/sys/conf/files.arm
==============================================================================
--- head/sys/conf/files.arm	Tue Mar 27 20:50:14 2012	(r233577)
+++ head/sys/conf/files.arm	Tue Mar 27 21:23:56 2012	(r233578)
@@ -47,6 +47,7 @@ arm/arm/vm_machdep.c		standard
 arm/fpe-arm/armfpe_glue.S	optional	armfpe
 arm/fpe-arm/armfpe_init.c	optional	armfpe
 arm/fpe-arm/armfpe.S		optional	armfpe
+cddl/compat/opensolaris/kern/opensolaris_atomic.c	optional zfs compile-with "${ZFS_C}"
 dev/hwpmc/hwpmc_arm.c		optional	hwpmc
 dev/ofw/openfirm.c		optional	fdt
 dev/ofw/openfirmio.c		optional	fdt

Modified: head/sys/conf/files.i386
==============================================================================
--- head/sys/conf/files.i386	Tue Mar 27 20:50:14 2012	(r233577)
+++ head/sys/conf/files.i386	Tue Mar 27 21:23:56 2012	(r233578)
@@ -71,6 +71,7 @@ hptrr_lib.o			optional	hptrr			\
 	compile-with	"uudecode < $S/dev/hptrr/i386-elf.hptrr_lib.o.uu" \
 	no-implicit-rule
 #
+cddl/contrib/opensolaris/common/atomic/i386/opensolaris_atomic.S	optional zfs compile-with "${ZFS_S}"
 compat/linprocfs/linprocfs.c	optional linprocfs
 compat/linsysfs/linsysfs.c	optional linsysfs
 compat/linux/linux_emul.c	optional compat_linux

Modified: head/sys/conf/files.ia64
==============================================================================
--- head/sys/conf/files.ia64	Tue Mar 27 20:50:14 2012	(r233577)
+++ head/sys/conf/files.ia64	Tue Mar 27 21:23:56 2012	(r233578)
@@ -28,6 +28,7 @@ ukbdmap.h			optional	ukbd_dflt_keymap	\
 	no-obj no-implicit-rule before-depend				\
 	clean		"ukbdmap.h"
 #
+cddl/contrib/opensolaris/common/atomic/ia64/opensolaris_atomic.S	optional zfs compile-with "${ZFS_S}"
 compat/freebsd32/freebsd32_ioctl.c	optional	compat_freebsd32
 compat/freebsd32/freebsd32_misc.c	optional	compat_freebsd32
 compat/freebsd32/freebsd32_syscalls.c	optional	compat_freebsd32

Modified: head/sys/conf/files.mips
==============================================================================
--- head/sys/conf/files.mips	Tue Mar 27 20:50:14 2012	(r233577)
+++ head/sys/conf/files.mips	Tue Mar 27 21:23:56 2012	(r233578)
@@ -85,6 +85,7 @@ libkern/ucmpdi2.c		standard
 #libkern/mips/strcmp.S		standard
 #libkern/mips/strncmp.S		standard
 
+cddl/compat/opensolaris/kern/opensolaris_atomic.c	optional zfs compile-with "${ZFS_C}"
 compat/freebsd32/freebsd32_ioctl.c	optional	compat_freebsd32
 compat/freebsd32/freebsd32_misc.c	optional	compat_freebsd32
 compat/freebsd32/freebsd32_syscalls.c	optional	compat_freebsd32

Modified: head/sys/conf/files.pc98
==============================================================================
--- head/sys/conf/files.pc98	Tue Mar 27 20:50:14 2012	(r233577)
+++ head/sys/conf/files.pc98	Tue Mar 27 21:23:56 2012	(r233578)
@@ -38,6 +38,7 @@ ukbdmap.h			optional	ukbd_dflt_keymap	\
 	no-obj no-implicit-rule before-depend				\
 	clean		"ukbdmap.h"
 #
+cddl/contrib/opensolaris/common/atomic/i386/opensolaris_atomic.S	optional zfs compile-with "${ZFS_S}"
 compat/linprocfs/linprocfs.c	optional linprocfs
 compat/linsysfs/linsysfs.c	optional linsysfs
 compat/linux/linux_emul.c	optional compat_linux
@@ -204,7 +205,6 @@ i386/svr4/svr4_locore.s		optional compat
 	dependency	"svr4_assym.h"	\
 	warning "COMPAT_SVR4 is broken and should be avoided"
 i386/svr4/svr4_machdep.c	optional compat_svr4
-#
 kern/kern_clocksource.c		standard
 kern/imgact_aout.c		optional compat_aout
 kern/imgact_gzip.c		optional gzip

Modified: head/sys/conf/files.powerpc
==============================================================================
--- head/sys/conf/files.powerpc	Tue Mar 27 20:50:14 2012	(r233577)
+++ head/sys/conf/files.powerpc	Tue Mar 27 21:23:56 2012	(r233578)
@@ -14,6 +14,9 @@ font.h				optional	sc			\
 	no-obj no-implicit-rule before-depend				\
 	clean	"font.h ${SC_DFLT_FONT}-8x14 ${SC_DFLT_FONT}-8x16 ${SC_DFLT_FONT}-8x8"
 #
+# There is only an asm version on ppc64.
+cddl/compat/opensolaris/kern/opensolaris_atomic.c			optional zfs powerpc compile-with "${ZFS_C}"
+cddl/contrib/opensolaris/common/atomic/powerpc64/opensolaris_atomic.S	optional zfs powerpc64 compile-with "${ZFS_S}"
 crypto/blowfish/bf_enc.c	optional	crypto | ipsec
 crypto/des/des_enc.c		optional	crypto | ipsec | netsmb
 dev/bm/if_bm.c			optional	bm powermac

Modified: head/sys/conf/files.sparc64
==============================================================================
--- head/sys/conf/files.sparc64	Tue Mar 27 20:50:14 2012	(r233577)
+++ head/sys/conf/files.sparc64	Tue Mar 27 21:23:56 2012	(r233578)
@@ -22,6 +22,7 @@ ukbdmap.h			optional	ukbd_dflt_keymap	\
 	no-obj no-implicit-rule before-depend				\
 	clean		"ukbdmap.h"
 #
+cddl/contrib/opensolaris/common/atomic/sparc64/opensolaris_atomic.S	optional zfs compile-with "${ZFS_S}"
 crypto/blowfish/bf_enc.c	optional	crypto | ipsec
 crypto/des/des_enc.c		optional	crypto | ipsec | netsmb
 dev/atkbdc/atkbd.c		optional	atkbd atkbdc

Modified: head/sys/conf/kern.post.mk
==============================================================================
--- head/sys/conf/kern.post.mk	Tue Mar 27 20:50:14 2012	(r233577)
+++ head/sys/conf/kern.post.mk	Tue Mar 27 21:23:56 2012	(r233578)
@@ -152,6 +152,12 @@ genassym.o: $S/$M/$M/genassym.c
 
 ${SYSTEM_OBJS} genassym.o vers.o: opt_global.h
 
+# We have "special" -I include paths for opensolaris/zfs files in 'depend'.
+CFILES_NOZFS=	${CFILES:N*/opensolaris/*}
+SFILES_NOZFS=	${SFILES:N*/opensolaris/*}
+CFILES_ZFS=	${CFILES:M*/opensolaris/*}
+SFILES_ZFS=	${SFILES:M*/opensolaris/*}
+
 kernel-depend: .depend
 # The argument list can be very long, so use make -V and xargs to
 # pass it to mkdep.
@@ -160,10 +166,14 @@ SRCS=	assym.s vnode_if.h ${BEFORE_DEPEND
 	${MFILES:T:S/.m$/.h/}
 .depend: .PRECIOUS ${SRCS}
 	rm -f .newdep
-	${MAKE} -V CFILES -V SYSTEM_CFILES -V GEN_CFILES | \
+	${MAKE} -V CFILES_NOZFS -V SYSTEM_CFILES -V GEN_CFILES | \
 	    MKDEP_CPP="${CC} -E" CC="${CC}" xargs mkdep -a -f .newdep ${CFLAGS}
-	${MAKE} -V SFILES | \
+	${MAKE} -V CFILES_ZFS | \
+	    MKDEP_CPP="${CC} -E" CC="${CC}" xargs mkdep -a -f .newdep ${ZFS_CFLAGS}
+	${MAKE} -V SFILES_NOZFS | \
 	    MKDEP_CPP="${CC} -E" xargs mkdep -a -f .newdep ${ASM_CFLAGS}
+	${MAKE} -V SFILES_ZFS | \
+	    MKDEP_CPP="${CC} -E" xargs mkdep -a -f .newdep ${ZFS_ASM_CFLAGS}
 	rm -f .depend
 	mv .newdep .depend
 

Modified: head/sys/conf/kern.pre.mk
==============================================================================
--- head/sys/conf/kern.pre.mk	Tue Mar 27 20:50:14 2012	(r233577)
+++ head/sys/conf/kern.pre.mk	Tue Mar 27 21:23:56 2012	(r233578)
@@ -131,6 +131,12 @@ NORMAL_C_NOWERROR= ${CC} -c ${CFLAGS} ${
 NORMAL_M= ${AWK} -f $S/tools/makeobjops.awk ${.IMPSRC} -c ; \
 	  ${CC} -c ${CFLAGS} ${WERROR} ${PROF} ${.PREFIX}.c
 
+# Special flags for managing the compat compiles for ZFS
+ZFS_CFLAGS=	-DFREEBSD_NAMECACHE -DBUILDING_ZFS -nostdinc -I$S/cddl/compat/opensolaris -I$S/cddl/contrib/opensolaris/uts/common/fs/zfs -I$S/cddl/contrib/opensolaris/uts/common/zmod -I$S/cddl/contrib/opensolaris/uts/common -I$S -I$S/cddl/contrib/opensolaris/common/zfs -I$S/cddl/contrib/opensolaris/common ${CFLAGS} -Wno-unknown-pragmas -Wno-missing-prototypes -Wno-undef -Wno-strict-prototypes -Wno-cast-qual -Wno-parentheses -Wno-redundant-decls -Wno-missing-braces -Wno-uninitialized -Wno-unused -Wno-inline -Wno-switch -Wno-pointer-arith -Wno-unknown-pragmas
+ZFS_ASM_CFLAGS= -x assembler-with-cpp -DLOCORE ${ZFS_CFLAGS}
+ZFS_C=		${CC} -c ${ZFS_CFLAGS} ${WERROR} ${PROF} ${.IMPSRC}
+ZFS_S=		${CC} -c ${ZFS_ASM_CFLAGS} ${WERROR} ${.IMPSRC}
+
 .if ${MK_CTF} != "no"
 NORMAL_CTFCONVERT=	${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
 .elif ${MAKE_VERSION} >= 5201111300

Modified: head/sys/conf/options
==============================================================================
--- head/sys/conf/options	Tue Mar 27 20:50:14 2012	(r233577)
+++ head/sys/conf/options	Tue Mar 27 21:23:56 2012	(r233578)
@@ -837,6 +837,8 @@ XBOX			opt_xbox.h
 # XFS
 XFS
 
+ZFS			opt_dontuse.h
+
 # Interrupt filtering
 INTR_FILTER
 

From owner-svn-src-head@FreeBSD.ORG  Tue Mar 27 21:52:22 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 91C2B1065672;
	Tue, 27 Mar 2012 21:52:22 +0000 (UTC)
	(envelope-from c.jayachandran@gmail.com)
Received: from mail-wi0-f178.google.com (mail-wi0-f178.google.com
	[209.85.212.178])
	by mx1.freebsd.org (Postfix) with ESMTP id 843AB8FC12;
	Tue, 27 Mar 2012 21:52:21 +0000 (UTC)
Received: by wibhq7 with SMTP id hq7so281439wib.13
	for ; Tue, 27 Mar 2012 14:52:20 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
	h=mime-version:sender:in-reply-to:references:date
	:x-google-sender-auth:message-id:subject:from:to:cc:content-type
	:content-transfer-encoding;
	bh=LZtI/0mNJUmgZOuWNkH9mIjr+qpSlnQgdnvksOtpleU=;
	b=CvE9p+9qwWHWYIyu6kZ3TpYPLrf50SkBaePnSZDNfgRVtA+how+90EfSXztTRSVjx8
	n9zqB5bWDvFBpOWn2kG7K7QSWKPS3I0EB2PcelhZaKDND9I+QJ4yA8LPuGhB4vFp4xWr
	YPQ+HmJV8cXt4mvIX9hi4MUsj5RHAiWsU5V+0s48RyInaOC+HMa9eETHrb4f+E4dsti2
	skQ6MhMNCo60rh6tJfDTVMXOPimvy+dnmohmN7/Gj5UNE2PZwsmsaD1zH6Fp9SgvYihc
	4bUugKu4a9gis/vyoHnuyrTbTVccMMJummPGefLlUbJi+GBMlitKjl0aLoL3HPfO/Jmt
	tCUw==
MIME-Version: 1.0
Received: by 10.216.225.12 with SMTP id y12mr15348167wep.39.1332885140276;
	Tue, 27 Mar 2012 14:52:20 -0700 (PDT)
Sender: c.jayachandran@gmail.com
Received: by 10.216.62.81 with HTTP; Tue, 27 Mar 2012 14:52:20 -0700 (PDT)
In-Reply-To: <201203271721.25441.jhb@freebsd.org>
References: <201203271826.q2RIQZhR098376@svn.freebsd.org>
	<201203271721.25441.jhb@freebsd.org>
Date: Wed, 28 Mar 2012 03:22:20 +0530
X-Google-Sender-Auth: fAPXHG-NvU10m2DLqED1mmW9r6M
Message-ID: 
From: "Jayachandran C." 
To: John Baldwin 
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r233570 - head/sys/mips/nlm
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 27 Mar 2012 21:52:22 -0000

On Wed, Mar 28, 2012 at 2:51 AM, John Baldwin  wrote:
> On Tuesday, March 27, 2012 2:26:35 pm Jayachandran C. wrote:
>> Author: jchandra
>> Date: Tue Mar 27 18:26:35 2012
>> New Revision: 233570
>> URL: http://svn.freebsd.org/changeset/base/233570
>>
>> Log:
>> =A0 Fix size of PCI softc.
>>
>> Modified:
>> =A0 head/sys/mips/nlm/xlp_pci.c
>>
>> Modified: head/sys/mips/nlm/xlp_pci.c
>>
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D
>> --- head/sys/mips/nlm/xlp_pci.c =A0 =A0 =A0 Tue Mar 27 18:22:14 2012 =A0=
 =A0 =A0 =A0(r233569)
>> +++ head/sys/mips/nlm/xlp_pci.c =A0 =A0 =A0 Tue Mar 27 18:26:35 2012 =A0=
 =A0 =A0 =A0(r233570)
>> @@ -331,7 +331,8 @@ static device_method_t xlp_pci_methods[]
>> =A0 =A0 =A0 DEVMETHOD_END
>> =A0};
>>
>> -DEFINE_CLASS_1(pci, xlp_pci_driver, xlp_pci_methods, 0, pci_driver);
>> +DEFINE_CLASS_1(pci, xlp_pci_driver, xlp_pci_methods, sizeof(struct
> pci_softc),
>> + =A0 =A0pci_driver);
>> =A0DRIVER_MODULE(xlp_pci, pcib, xlp_pci_driver, pci_devclass, 0, 0);
>>
>> =A0static devclass_t pcib_devclass;
>
> Oops, not sure how I missed this one earlier. :(

It is completely my fault :)   I did not notice the PCI dma tag change
when I moved this code from my user branch to HEAD today.

JC.

From owner-svn-src-head@FreeBSD.ORG  Tue Mar 27 22:37:29 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 3DD4D106564A;
	Tue, 27 Mar 2012 22:37:29 +0000 (UTC)
	(envelope-from alexander@leidinger.net)
Received: from mail.ebusiness-leidinger.de (mail.ebusiness-leidinger.de
	[217.11.53.44])
	by mx1.freebsd.org (Postfix) with ESMTP id E7C338FC16;
	Tue, 27 Mar 2012 22:37:28 +0000 (UTC)
Received: from outgoing.leidinger.net (p4FC43B8B.dip.t-dialin.net
	[79.196.59.139])
	by mail.ebusiness-leidinger.de (Postfix) with ESMTPSA id 1F6618442DE;
	Wed, 28 Mar 2012 00:27:58 +0200 (CEST)
Received: from unknown (IO.Leidinger.net [192.168.1.12])
	by outgoing.leidinger.net (Postfix) with ESMTPS id 604212A43;
	Wed, 28 Mar 2012 00:27:55 +0200 (CEST)
Date: Wed, 28 Mar 2012 00:27:56 +0200
From: Alexander Leidinger 
To: Ryan Stone 
Message-ID: <20120328002756.0000118e@unknown>
In-Reply-To: <201203271507.q2RF7hO2091110@svn.freebsd.org>
References: <201203271507.q2RF7hO2091110@svn.freebsd.org>
X-Mailer: Claws Mail 3.7.10cvs42 (GTK+ 2.16.6; i586-pc-mingw32msvc)
Mime-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
X-EBL-MailScanner-Information: Please contact the ISP for more information
X-EBL-MailScanner-ID: 1F6618442DE.A3356
X-EBL-MailScanner: Found to be clean
X-EBL-MailScanner-SpamCheck: not spam, spamhaus-ZEN,
	SpamAssassin (not cached, score=-0.024, required 6,
	autolearn=disabled, ALL_TRUSTED -1.00, AWL -0.29,
	J_CHICKENPOX_32 0.60, J_CHICKENPOX_52 0.60, TW_SV 0.08,
	T_RP_MATCHES_RCVD -0.01)
X-EBL-MailScanner-From: alexander@leidinger.net
X-EBL-MailScanner-Watermark: 1333492079.32643@Vfr9MOMRcGe2bA3LfqaOVQ
X-EBL-Spam-Status: No
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r233552 - in head/sys: cddl/dev/sdt kern sys
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 27 Mar 2012 22:37:29 -0000

On Tue, 27 Mar 2012 15:07:43 +0000 (UTC) Ryan Stone
 wrote:

> Author: rstone
> Date: Tue Mar 27 15:07:43 2012
> New Revision: 233552
> URL: http://svn.freebsd.org/changeset/base/233552
> 
> Log:
>   Instead of only iterating over the set of known SDT probes when
> sdt.ko is loaded and unloaded, also have sdt.ko register callbacks
> with kern_sdt.c that will be called when a newly loaded KLD module
> adds more probes or a module with probes is unloaded.

Great!
Is this automatic, or do I need to do something in the newly loaded KLD?

>   This makes it possible to create SDT probes in KLD modules,
> although there are still two caveats: first, any SDT probes in a KLD
> module must be part of a DTrace provider that is defined in that
> module.

To make sure I understand it correctly:
If I have the provider "linuxulator", all probes for this provider
need to be within the KLD. No other KLD is allowed to reference this
provider. To stay with the linuxulator example: if a module which
depends upon linux.ko wants to have some SDT probes, it has to use a
different provider.

Bye,
Alexander.

-- 
http://www.Leidinger.net    Alexander @ Leidinger.net: PGP ID = B0063FE7
http://www.FreeBSD.org       netchild @ FreeBSD.org  : PGP ID = 72077137

From owner-svn-src-head@FreeBSD.ORG  Tue Mar 27 23:26:59 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 84677106566C;
	Tue, 27 Mar 2012 23:26:59 +0000 (UTC)
	(envelope-from jkim@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 6F8B68FC12;
	Tue, 27 Mar 2012 23:26:59 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2RNQxIw008083;
	Tue, 27 Mar 2012 23:26:59 GMT (envelope-from jkim@svn.freebsd.org)
Received: (from jkim@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2RNQxJC008081;
	Tue, 27 Mar 2012 23:26:59 GMT (envelope-from jkim@svn.freebsd.org)
Message-Id: <201203272326.q2RNQxJC008081@svn.freebsd.org>
From: Jung-uk Kim 
Date: Tue, 27 Mar 2012 23:26:59 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233579 - head/sys/dev/acpica
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 27 Mar 2012 23:26:59 -0000

Author: jkim
Date: Tue Mar 27 23:26:58 2012
New Revision: 233579
URL: http://svn.freebsd.org/changeset/base/233579

Log:
  Restore interrupt state after executing AcpiEnterSleepState().

Modified:
  head/sys/dev/acpica/acpi.c

Modified: head/sys/dev/acpica/acpi.c
==============================================================================
--- head/sys/dev/acpica/acpi.c	Tue Mar 27 21:23:56 2012	(r233578)
+++ head/sys/dev/acpica/acpi.c	Tue Mar 27 23:26:58 2012	(r233579)
@@ -1968,6 +1968,7 @@ static void
 acpi_shutdown_final(void *arg, int howto)
 {
     struct acpi_softc *sc = (struct acpi_softc *)arg;
+    register_t intr;
     ACPI_STATUS status;
 
     /*
@@ -1983,13 +1984,15 @@ acpi_shutdown_final(void *arg, int howto
 	    return;
 	}
 	device_printf(sc->acpi_dev, "Powering system off\n");
-	ACPI_DISABLE_IRQS();
+	intr = intr_disable();
 	status = AcpiEnterSleepState(ACPI_STATE_S5, acpi_sleep_flags);
-	if (ACPI_FAILURE(status))
+	if (ACPI_FAILURE(status)) {
+	    intr_restore(intr);
 	    device_printf(sc->acpi_dev, "power-off failed - %s\n",
 		AcpiFormatException(status));
-	else {
+	} else {
 	    DELAY(1000000);
+	    intr_restore(intr);
 	    device_printf(sc->acpi_dev, "power-off failed - timeout\n");
 	}
     } else if ((howto & RB_HALT) == 0 && sc->acpi_handle_reboot) {
@@ -2641,7 +2644,8 @@ enum acpi_sleep_state {
 static ACPI_STATUS
 acpi_EnterSleepState(struct acpi_softc *sc, int state)
 {
-    ACPI_STATUS	status;
+    register_t intr;
+    ACPI_STATUS status;
     enum acpi_sleep_state slp_state;
 
     ACPI_FUNCTION_TRACE_U32((char *)(uintptr_t)__func__, state);
@@ -2730,8 +2734,9 @@ acpi_EnterSleepState(struct acpi_softc *
 	if (state == ACPI_STATE_S4)
 	    AcpiEnable();
     } else {
-	ACPI_DISABLE_IRQS();
+	intr = intr_disable();
 	status = AcpiEnterSleepState(state, acpi_sleep_flags);
+	intr_restore(intr);
 	if (ACPI_FAILURE(status)) {
 	    device_printf(sc->acpi_dev, "AcpiEnterSleepState failed - %s\n",
 			  AcpiFormatException(status));

From owner-svn-src-head@FreeBSD.ORG  Tue Mar 27 23:43:02 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 1FFCD106564A;
	Tue, 27 Mar 2012 23:43:02 +0000 (UTC)
	(envelope-from jkim@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 0974D8FC15;
	Tue, 27 Mar 2012 23:43:02 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2RNh144008591;
	Tue, 27 Mar 2012 23:43:01 GMT (envelope-from jkim@svn.freebsd.org)
Received: (from jkim@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2RNh17d008588;
	Tue, 27 Mar 2012 23:43:01 GMT (envelope-from jkim@svn.freebsd.org)
Message-Id: <201203272343.q2RNh17d008588@svn.freebsd.org>
From: Jung-uk Kim 
Date: Tue, 27 Mar 2012 23:43:01 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233580 - in head: share/man/man4 sys/dev/atkbdc
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 27 Mar 2012 23:43:02 -0000

Author: jkim
Date: Tue Mar 27 23:43:01 2012
New Revision: 233580
URL: http://svn.freebsd.org/changeset/base/233580

Log:
  - Do not clobber softc when psm(4) is reintialized.
  - Make INITAFTERSUSPEND flag independent of HOOKRESUME flag.
  - Automatically set INITAFTERSUSPEND flag when ALPS GlidePoint is detected.
  - Always probe Synaptics Touchpad.  Allow MOUSE_SYN_GETHWINFO ioctl and
  automatically set INITAFTERSUSPEND flag when a supported device is detected,
  regardless of "hw.psm.synaptics_support" tunable setting.
  - Update psm(4) to reflect the above changes.
  - Remove long-time defunct SYNCHACK flag while I am in the neighborhood.
  
  MFC after:	1 month

Modified:
  head/share/man/man4/psm.4
  head/sys/dev/atkbdc/psm.c

Modified: head/share/man/man4/psm.4
==============================================================================
--- head/share/man/man4/psm.4	Tue Mar 27 23:26:58 2012	(r233579)
+++ head/share/man/man4/psm.4	Tue Mar 27 23:43:01 2012	(r233580)
@@ -26,7 +26,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd April 8, 2008
+.Dd March 27, 2012
 .Dt PSM 4
 .Os
 .Sh NAME
@@ -329,9 +329,6 @@ It will cause the
 .Nm
 driver to reset and re-initialize the pointing device
 after the `resume' event.
-It has no effect unless the
-.Em HOOKRESUME
-flag is set as well.
 .El
 .Sh LOADER TUNABLES
 Extended support for Synaptics touchpads can be enabled by setting
@@ -445,10 +442,8 @@ Microsoft IntelliMouse
 .El
 .Pp
 .It Dv MOUSE_SYN_GETHWINFO Ar synapticshw_t *synhw
-Retrieves extra information associated with Synaptics Touchpads.
-Only available when
-.Va hw.psm.synaptics_support
-has been enabled.
+Retrieves extra information associated with Synaptics Touchpad.
+Only available when a supported device has been detected.
 .Bd -literal
 typedef struct synapticshw {
     int infoMajor;	/* major hardware revision */
@@ -837,12 +832,11 @@ In contrast, some pad products, e.g.\& s
 and Interlink VersaPad, treat the tapping action
 as fourth button events.
 .Pp
-It is reported that Interlink VersaPad requires both
-.Em HOOKRESUME
-and
+It is reported that ALPS GlidePoint, Synaptics Touchpad, and
+Interlink VersaPad require
 .Em INITAFTERSUSPEND
-flags in order to recover from suspended state.
-These flags are automatically set when VersaPad is detected by the
+flag in order to recover from suspended state.
+This flag is automatically set when one of these devices is detected by the
 .Nm
 driver.
 .Pp

Modified: head/sys/dev/atkbdc/psm.c
==============================================================================
--- head/sys/dev/atkbdc/psm.c	Tue Mar 27 23:26:58 2012	(r233579)
+++ head/sys/dev/atkbdc/psm.c	Tue Mar 27 23:43:01 2012	(r233580)
@@ -318,13 +318,11 @@ static devclass_t psm_devclass;
 #define	PSM_CONFIG_IGNPORTERROR	0x1000  /* ignore error in aux port test */
 #define	PSM_CONFIG_HOOKRESUME	0x2000	/* hook the system resume event */
 #define	PSM_CONFIG_INITAFTERSUSPEND 0x4000 /* init the device at the resume event */
-#define	PSM_CONFIG_SYNCHACK	0x8000	/* enable `out-of-sync' hack */
 
 #define	PSM_CONFIG_FLAGS	\
     (PSM_CONFIG_RESOLUTION |	\
     PSM_CONFIG_ACCEL |		\
     PSM_CONFIG_NOCHECKSYNC |	\
-    PSM_CONFIG_SYNCHACK |	\
     PSM_CONFIG_NOIDPROBE |	\
     PSM_CONFIG_NORESET |	\
     PSM_CONFIG_FORCETAP |	\
@@ -415,7 +413,7 @@ static int	tame_mouse(struct psm_softc *
 		    u_char *);
 
 /* vendor specific features */
-typedef int	probefunc_t(struct psm_softc *);
+typedef int	probefunc_t(KBDC, struct psm_softc *);
 
 static int	mouse_id_proc1(KBDC, int, int, int *);
 static int	mouse_ext_command(KBDC, int);
@@ -822,24 +820,10 @@ doinitialize(struct psm_softc *sc, mouse
 	}
 	empty_both_buffers(kbdc, 10);	/* remove stray data if any */
 
-	if (sc->config & PSM_CONFIG_NOIDPROBE)
-		i = GENERIC_MOUSE_ENTRY;
-	else {
-		/* FIXME: hardware ID, mouse buttons? */
-
-		/* other parameters */
-		for (i = 0; vendortype[i].probefunc != NULL; ++i)
-			if ((*vendortype[i].probefunc)(sc)) {
-				if (verbose >= 2)
-					log(LOG_ERR, "psm%d: found %s\n",
-					    sc->unit,
-					    model_name(vendortype[i].model));
-				break;
-			}
-	}
-
-	sc->hw.model = vendortype[i].model;
-	sc->mode.packetsize = vendortype[i].packetsize;
+	/* Re-enable the mouse. */
+	for (i = 0; vendortype[i].probefunc != NULL; ++i)
+		if (vendortype[i].model == sc->hw.model)
+			(*vendortype[i].probefunc)(sc->kbdc, NULL);
 
 	/* set mouse parameters */
 	if (mode != (mousemode_t *)NULL) {
@@ -1149,7 +1133,7 @@ psmprobe(device_t dev)
 #if defined(PSM_HOOKRESUME) || defined(PSM_HOOKAPM)
 	sc->config |=
 #ifdef PSM_RESETAFTERSUSPEND
-	PSM_CONFIG_HOOKRESUME | PSM_CONFIG_INITAFTERSUSPEND;
+	PSM_CONFIG_INITAFTERSUSPEND;
 #else
 	PSM_CONFIG_HOOKRESUME;
 #endif
@@ -1338,7 +1322,7 @@ psmprobe(device_t dev)
 
 		/* other parameters */
 		for (i = 0; vendortype[i].probefunc != NULL; ++i)
-			if ((*vendortype[i].probefunc)(sc)) {
+			if ((*vendortype[i].probefunc)(sc->kbdc, sc)) {
 				if (verbose >= 2)
 					printf("psm%d: found %s\n", unit,
 					    model_name(vendortype[i].model));
@@ -1454,6 +1438,19 @@ psmattach(device_t dev)
 	sc->bdev = make_dev(&psm_cdevsw, 0, 0, 0, 0666, "bpsm%d", unit);
 	sc->bdev->si_drv1 = sc;
 
+	/* Some touchpad devices need full reinitialization after suspend. */
+	switch (sc->hw.model) {
+	case MOUSE_MODEL_SYNAPTICS:
+	case MOUSE_MODEL_GLIDEPOINT:
+	case MOUSE_MODEL_VERSAPAD:
+		sc->config |= PSM_CONFIG_INITAFTERSUSPEND;
+		break;
+	default:
+		if (sc->synhw.infoMajor >= 4)
+			sc->config |= PSM_CONFIG_INITAFTERSUSPEND;
+		break;
+	}
+
 	if (!verbose)
 		printf("psm%d: model %s, device ID %d\n",
 		    unit, model_name(sc->hw.model), sc->hw.hwid & 0x00ff);
@@ -1952,7 +1949,7 @@ psmioctl(struct cdev *dev, u_long cmd, c
 
 	case MOUSE_SYN_GETHWINFO:
 		s = spltty();
-		if (synaptics_support && sc->hw.model == MOUSE_MODEL_SYNAPTICS)
+		if (sc->synhw.infoMajor >= 4)
 			*(synapticshw_t *)addr = sc->synhw;
 		else
 			error = EINVAL;
@@ -3566,12 +3563,12 @@ mouse_ext_command(KBDC kbdc, int command
 #ifdef notyet
 /* Logitech MouseMan Cordless II */
 static int
-enable_lcordless(struct psm_softc *sc)
+enable_lcordless(KDBC kbdc, struct psm_softc *sc)
 {
 	int status[3];
 	int ch;
 
-	if (!mouse_id_proc1(sc->kbdc, PSMD_RES_HIGH, 2, status))
+	if (!mouse_id_proc1(kbdc, PSMD_RES_HIGH, 2, status))
 		return (FALSE);
 	if (status[1] == PSMD_RES_HIGH)
 		return (FALSE);
@@ -3588,7 +3585,7 @@ enable_lcordless(struct psm_softc *sc)
 
 /* Genius NetScroll Mouse, MouseSystems SmartScroll Mouse */
 static int
-enable_groller(struct psm_softc *sc)
+enable_groller(KBDC kbdc, struct psm_softc *sc)
 {
 	int status[3];
 
@@ -3613,18 +3610,19 @@ enable_groller(struct psm_softc *sc)
 	 * byte 3 report rate (?)
 	 */
 
-	if (!mouse_id_proc1(sc->kbdc, PSMD_RES_HIGH, 1, status))
+	if (!mouse_id_proc1(kbdc, PSMD_RES_HIGH, 1, status))
 		return (FALSE);
 	if ((status[1] != '3') || (status[2] != 'D'))
 		return (FALSE);
 	/* FIXME: SmartScroll Mouse has 5 buttons! XXX */
-	sc->hw.buttons = 4;
+	if (sc != NULL)
+		sc->hw.buttons = 4;
 	return (TRUE);
 }
 
 /* Genius NetMouse/NetMouse Pro, ASCII Mie Mouse, NetScroll Optical */
 static int
-enable_gmouse(struct psm_softc *sc)
+enable_gmouse(KBDC kbdc, struct psm_softc *sc)
 {
 	int status[3];
 
@@ -3638,7 +3636,7 @@ enable_gmouse(struct psm_softc *sc)
 	 * say they have three buttons too and they do have a button on the
 	 * side...
 	 */
-	if (!mouse_id_proc1(sc->kbdc, PSMD_RES_HIGH, 1, status))
+	if (!mouse_id_proc1(kbdc, PSMD_RES_HIGH, 1, status))
 		return (FALSE);
 	if ((status[1] != '3') || (status[2] != 'U'))
 		return (FALSE);
@@ -3647,7 +3645,7 @@ enable_gmouse(struct psm_softc *sc)
 
 /* ALPS GlidePoint */
 static int
-enable_aglide(struct psm_softc *sc)
+enable_aglide(KBDC kbdc, struct psm_softc *sc)
 {
 	int status[3];
 
@@ -3658,9 +3656,9 @@ enable_aglide(struct psm_softc *sc)
 	 * NOTE: ALPS produces several models of GlidePoint. Some of those
 	 * do not respond to this sequence, thus, cannot be detected this way.
 	 */
-	if (set_mouse_sampling_rate(sc->kbdc, 100) != 100)
+	if (set_mouse_sampling_rate(kbdc, 100) != 100)
 		return (FALSE);
-	if (!mouse_id_proc1(sc->kbdc, PSMD_RES_LOW, 2, status))
+	if (!mouse_id_proc1(kbdc, PSMD_RES_LOW, 2, status))
 		return (FALSE);
 	if ((status[1] == PSMD_RES_LOW) || (status[2] == 100))
 		return (FALSE);
@@ -3669,10 +3667,9 @@ enable_aglide(struct psm_softc *sc)
 
 /* Kensington ThinkingMouse/Trackball */
 static int
-enable_kmouse(struct psm_softc *sc)
+enable_kmouse(KBDC kbdc, struct psm_softc *sc)
 {
 	static u_char rate[] = { 20, 60, 40, 20, 20, 60, 40, 20, 20 };
-	KBDC kbdc = sc->kbdc;
 	int status[3];
 	int id1;
 	int id2;
@@ -3723,9 +3720,8 @@ enable_kmouse(struct psm_softc *sc)
 
 /* Logitech MouseMan+/FirstMouse+, IBM ScrollPoint Mouse */
 static int
-enable_mmanplus(struct psm_softc *sc)
+enable_mmanplus(KBDC kbdc, struct psm_softc *sc)
 {
-	KBDC kbdc = sc->kbdc;
 	int data[3];
 
 	/* the special sequence to enable the fourth button and the roller. */
@@ -3766,8 +3762,10 @@ enable_mmanplus(struct psm_softc *sc)
 	if (MOUSE_PS2PLUS_PACKET_TYPE(data) != 0)
 		return (FALSE);
 
-	sc->hw.hwid &= 0x00ff;
-	sc->hw.hwid |= data[2] << 8;	/* save model ID */
+	if (sc != NULL) {
+		sc->hw.hwid &= 0x00ff;
+		sc->hw.hwid |= data[2] << 8;	/* save model ID */
+	}
 
 	/*
 	 * MouseMan+ (or FirstMouse+) is now in its native mode, in which
@@ -3780,11 +3778,10 @@ enable_mmanplus(struct psm_softc *sc)
 
 /* MS IntelliMouse Explorer */
 static int
-enable_msexplorer(struct psm_softc *sc)
+enable_msexplorer(KBDC kbdc, struct psm_softc *sc)
 {
 	static u_char rate0[] = { 200, 100, 80, };
 	static u_char rate1[] = { 200, 200, 80, };
-	KBDC kbdc = sc->kbdc;
 	int id;
 	int i;
 
@@ -3793,7 +3790,7 @@ enable_msexplorer(struct psm_softc *sc)
 	 * straight to Explorer mode, but need to be set to Intelli mode
 	 * first.
 	 */
-	enable_msintelli(sc);
+	enable_msintelli(kbdc, sc);
 
 	/* the special sequence to enable the extra buttons and the roller. */
 	for (i = 0; i < sizeof(rate1)/sizeof(rate1[0]); ++i)
@@ -3804,8 +3801,10 @@ enable_msexplorer(struct psm_softc *sc)
 	if (id != PSM_EXPLORER_ID)
 		return (FALSE);
 
-	sc->hw.hwid = id;
-	sc->hw.buttons = 5;		/* IntelliMouse Explorer XXX */
+	if (sc != NULL) {
+		sc->hw.buttons = 5;	/* IntelliMouse Explorer XXX */
+		sc->hw.hwid = id;
+	}
 
 	/*
 	 * XXX: this is a kludge to fool some KVM switch products
@@ -3820,14 +3819,14 @@ enable_msexplorer(struct psm_softc *sc)
 	for (i = 0; i < sizeof(rate0)/sizeof(rate0[0]); ++i)
 		if (set_mouse_sampling_rate(kbdc, rate0[i]) != rate0[i])
 			break;
-	id = get_aux_id(kbdc);
+	get_aux_id(kbdc);
 
 	return (TRUE);
 }
 
 /* MS IntelliMouse */
 static int
-enable_msintelli(struct psm_softc *sc)
+enable_msintelli(KBDC kbdc, struct psm_softc *sc)
 {
 	/*
 	 * Logitech MouseMan+ and FirstMouse+ will also respond to this
@@ -3835,7 +3834,6 @@ enable_msintelli(struct psm_softc *sc)
 	 */
 
 	static u_char rate[] = { 200, 100, 80, };
-	KBDC kbdc = sc->kbdc;
 	int id;
 	int i;
 
@@ -3848,22 +3846,23 @@ enable_msintelli(struct psm_softc *sc)
 	if (id != PSM_INTELLI_ID)
 		return (FALSE);
 
-	sc->hw.hwid = id;
-	sc->hw.buttons = 3;
+	if (sc != NULL) {
+		sc->hw.buttons = 3;
+		sc->hw.hwid = id;
+	}
 
 	return (TRUE);
 }
 
 /* A4 Tech 4D Mouse */
 static int
-enable_4dmouse(struct psm_softc *sc)
+enable_4dmouse(KBDC kbdc, struct psm_softc *sc)
 {
 	/*
 	 * Newer wheel mice from A4 Tech may use the 4D+ protocol.
 	 */
 
 	static u_char rate[] = { 200, 100, 80, 60, 40, 20 };
-	KBDC kbdc = sc->kbdc;
 	int id;
 	int i;
 
@@ -3879,21 +3878,22 @@ enable_4dmouse(struct psm_softc *sc)
 	if (id != PSM_4DMOUSE_ID)
 		return (FALSE);
 
-	sc->hw.hwid = id;
-	sc->hw.buttons = 3;		/* XXX some 4D mice have 4? */
+	if (sc != NULL) {
+		sc->hw.buttons = 3;	/* XXX some 4D mice have 4? */
+		sc->hw.hwid = id;
+	}
 
 	return (TRUE);
 }
 
 /* A4 Tech 4D+ Mouse */
 static int
-enable_4dplus(struct psm_softc *sc)
+enable_4dplus(KBDC kbdc, struct psm_softc *sc)
 {
 	/*
 	 * Newer wheel mice from A4 Tech seem to use this protocol.
 	 * Older models are recognized as either 4D Mouse or IntelliMouse.
 	 */
-	KBDC kbdc = sc->kbdc;
 	int id;
 
 	/*
@@ -3909,16 +3909,17 @@ enable_4dplus(struct psm_softc *sc)
 	id = get_aux_id(kbdc);
 	switch (id) {
 	case PSM_4DPLUS_ID:
-		sc->hw.buttons = 4;
 		break;
 	case PSM_4DPLUS_RFSW35_ID:
-		sc->hw.buttons = 3;
 		break;
 	default:
 		return (FALSE);
 	}
 
-	sc->hw.hwid = id;
+	if (sc != NULL) {
+		sc->hw.buttons = (id == PSM_4DPLUS_ID) ? 4 : 3;
+		sc->hw.hwid = id;
+	}
 
 	return (TRUE);
 }
@@ -4307,18 +4308,13 @@ synaptics_sysctl_create_tree(struct psm_
 }
 
 static int
-enable_synaptics(struct psm_softc *sc)
+enable_synaptics(KBDC kbdc, struct psm_softc *sc)
 {
+	synapticshw_t synhw;
 	int status[3];
-	KBDC kbdc;
+	int buttons;
 
-	if (!synaptics_support)
-		return (FALSE);
-
-	kbdc = sc->kbdc;
 	VLOG(3, (LOG_DEBUG, "synaptics: BEGIN init\n"));
-	sc->hw.buttons = 3;
-	sc->squelch = 0;
 
 	/*
 	 * Just to be on the safe side: this avoids troubles with
@@ -4336,14 +4332,15 @@ enable_synaptics(struct psm_softc *sc)
 	if (status[1] != 0x47)
 		return (FALSE);
 
-	sc->synhw.infoMinor = status[0];
-	sc->synhw.infoMajor = status[2] & 0x0f;
+	bzero(&synhw, sizeof(synhw));
+	synhw.infoMinor = status[0];
+	synhw.infoMajor = status[2] & 0x0f;
 
 	if (verbose >= 2)
-		printf("Synaptics Touchpad v%d.%d\n", sc->synhw.infoMajor,
-		    sc->synhw.infoMinor);
+		printf("Synaptics Touchpad v%d.%d\n", synhw.infoMajor,
+		    synhw.infoMinor);
 
-	if (sc->synhw.infoMajor < 4) {
+	if (synhw.infoMajor < 4) {
 		printf("  Unsupported (pre-v4) Touchpad detected\n");
 		return (FALSE);
 	}
@@ -4358,25 +4355,25 @@ enable_synaptics(struct psm_softc *sc)
 		return (FALSE);
 	}
 
-	sc->synhw.infoRot180   = (status[0] & 0x80) >> 7;
-	sc->synhw.infoPortrait = (status[0] & 0x40) >> 6;
-	sc->synhw.infoSensor   =  status[0] & 0x3f;
-	sc->synhw.infoHardware = (status[1] & 0xfe) >> 1;
-	sc->synhw.infoNewAbs   = (status[2] & 0x80) >> 7;
-	sc->synhw.capPen       = (status[2] & 0x40) >> 6;
-	sc->synhw.infoSimplC   = (status[2] & 0x20) >> 5;
-	sc->synhw.infoGeometry =  status[2] & 0x0f;
+	synhw.infoRot180   = (status[0] & 0x80) != 0;
+	synhw.infoPortrait = (status[0] & 0x40) != 0;
+	synhw.infoSensor   =  status[0] & 0x3f;
+	synhw.infoHardware = (status[1] & 0xfe) >> 1;
+	synhw.infoNewAbs   = (status[2] & 0x80) != 0;
+	synhw.capPen       = (status[2] & 0x40) != 0;
+	synhw.infoSimplC   = (status[2] & 0x20) != 0;
+	synhw.infoGeometry =  status[2] & 0x0f;
 
 	if (verbose >= 2) {
 		printf("  Model information:\n");
-		printf("   infoRot180: %d\n", sc->synhw.infoRot180);
-		printf("   infoPortrait: %d\n", sc->synhw.infoPortrait);
-		printf("   infoSensor: %d\n", sc->synhw.infoSensor);
-		printf("   infoHardware: %d\n", sc->synhw.infoHardware);
-		printf("   infoNewAbs: %d\n", sc->synhw.infoNewAbs);
-		printf("   capPen: %d\n", sc->synhw.capPen);
-		printf("   infoSimplC: %d\n", sc->synhw.infoSimplC);
-		printf("   infoGeometry: %d\n", sc->synhw.infoGeometry);
+		printf("   infoRot180: %d\n", synhw.infoRot180);
+		printf("   infoPortrait: %d\n", synhw.infoPortrait);
+		printf("   infoSensor: %d\n", synhw.infoSensor);
+		printf("   infoHardware: %d\n", synhw.infoHardware);
+		printf("   infoNewAbs: %d\n", synhw.infoNewAbs);
+		printf("   capPen: %d\n", synhw.capPen);
+		printf("   infoSimplC: %d\n", synhw.infoSimplC);
+		printf("   infoGeometry: %d\n", synhw.infoGeometry);
 	}
 
 	/* Read the extended capability bits. */
@@ -4390,46 +4387,42 @@ enable_synaptics(struct psm_softc *sc)
 	}
 
 	/* Set the different capabilities when they exist. */
-	if ((status[0] & 0x80) >> 7) {
-		sc->synhw.capExtended    = (status[0] & 0x80) >> 7;
-		sc->synhw.capPassthrough = (status[2] & 0x80) >> 7;
-		sc->synhw.capSleep       = (status[2] & 0x10) >> 4;
-		sc->synhw.capFourButtons = (status[2] & 0x08) >> 3;
-		sc->synhw.capMultiFinger = (status[2] & 0x02) >> 1;
-		sc->synhw.capPalmDetect  = (status[2] & 0x01);
+	buttons = 0;
+	synhw.capExtended = (status[0] & 0x80) != 0;
+	if (synhw.capExtended) {
+		synhw.capPassthrough = (status[2] & 0x80) != 0;
+		synhw.capSleep       = (status[2] & 0x10) != 0;
+		synhw.capFourButtons = (status[2] & 0x08) != 0;
+		synhw.capMultiFinger = (status[2] & 0x02) != 0;
+		synhw.capPalmDetect  = (status[2] & 0x01) != 0;
 
 		if (verbose >= 2) {
 			printf("  Extended capabilities:\n");
-			printf("   capExtended: %d\n", sc->synhw.capExtended);
-			printf("   capPassthrough: %d\n",
-			    sc->synhw.capPassthrough);
-			printf("   capSleep: %d\n", sc->synhw.capSleep);
-			printf("   capFourButtons: %d\n",
-			    sc->synhw.capFourButtons);
-			printf("   capMultiFinger: %d\n",
-			    sc->synhw.capMultiFinger);
-			printf("   capPalmDetect: %d\n",
-			    sc->synhw.capPalmDetect);
+			printf("   capExtended: %d\n", synhw.capExtended);
+			printf("   capPassthrough: %d\n", synhw.capPassthrough);
+			printf("   capSleep: %d\n", synhw.capSleep);
+			printf("   capFourButtons: %d\n", synhw.capFourButtons);
+			printf("   capMultiFinger: %d\n", synhw.capMultiFinger);
+			printf("   capPalmDetect: %d\n", synhw.capPalmDetect);
 		}
 
 		/*
 		 * If we have bits set in status[0] & 0x70, then we can load
 		 * more information about buttons using query 0x09.
 		 */
-		if (status[0] & 0x70) {
+		if ((status[0] & 0x70) != 0) {
 			if (mouse_ext_command(kbdc, 0x09) == 0)
 				return (FALSE);
 			if (get_mouse_status(kbdc, status, 0, 3) != 3)
 				return (FALSE);
-			sc->hw.buttons = ((status[1] & 0xf0) >> 4) + 3;
-			if (verbose >= 2)
-				printf("  Additional Buttons: %d\n",
-				    sc->hw.buttons -3);
-		}
-	} else {
-		sc->synhw.capExtended = 0;
-
-		if (verbose >= 2)
+			buttons = (status[1] & 0xf0) >> 4;
+		} else
+			buttons = synhw.capFourButtons ? 1 : 0;
+	}
+	if (verbose >= 2) {
+		if (synhw.capExtended)
+			printf("  Additional Buttons: %d\n", buttons);
+		else
 			printf("  No extended capabilities\n");
 	}
 
@@ -4449,43 +4442,34 @@ enable_synaptics(struct psm_softc *sc)
 		return (FALSE);
 	}
 
+	if (sc != NULL)
+		sc->synhw = synhw;
+	if (!synaptics_support)
+		return (FALSE);
+
 	/* Set the mode byte; request wmode where available. */
-	if (sc->synhw.capExtended)
-		mouse_ext_command(kbdc, 0xc1);
-	else
-		mouse_ext_command(kbdc, 0xc0);
+	mouse_ext_command(kbdc, synhw.capExtended ? 0xc1 : 0xc0);
 
 	/* "Commit" the Set Mode Byte command sent above. */
 	set_mouse_sampling_rate(kbdc, 20);
 
-	/*
-	 * Report the correct number of buttons
-	 *
-	 * XXX: I'm not sure this is used anywhere.
-	 */
-	if (sc->synhw.capExtended && sc->synhw.capFourButtons)
-		sc->hw.buttons = 4;
-
-	VLOG(3, (LOG_DEBUG, "synaptics: END init (%d buttons)\n",
-	    sc->hw.buttons));
+	buttons += 3;
+	VLOG(3, (LOG_DEBUG, "synaptics: END init (%d buttons)\n", buttons));
 
-	/* Create sysctl tree. */
-	synaptics_sysctl_create_tree(sc);
+	if (sc != NULL) {
+		/* Create sysctl tree. */
+		synaptics_sysctl_create_tree(sc);
 
-	/*
-	 * The touchpad will have to be reinitialized after
-	 * suspend/resume.
-	 */
-	sc->config |= PSM_CONFIG_HOOKRESUME | PSM_CONFIG_INITAFTERSUSPEND;
+		sc->hw.buttons = buttons;
+	}
 
 	return (TRUE);
 }
 
 /* Interlink electronics VersaPad */
 static int
-enable_versapad(struct psm_softc *sc)
+enable_versapad(KBDC kbdc, struct psm_softc *sc)
 {
-	KBDC kbdc = sc->kbdc;
 	int data[3];
 
 	set_mouse_resolution(kbdc, PSMD_RES_MEDIUM_HIGH); /* set res. 2 */
@@ -4500,8 +4484,6 @@ enable_versapad(struct psm_softc *sc)
 		return (FALSE);
 	set_mouse_scaling(kbdc, 1);			/* set scale 1:1 */
 
-	sc->config |= PSM_CONFIG_HOOKRESUME | PSM_CONFIG_INITAFTERSUSPEND;
-
 	return (TRUE);				/* PS/2 absolute mode */
 }
 
@@ -4539,7 +4521,8 @@ psmresume(device_t dev)
 
 	VLOG(2, (LOG_NOTICE, "psm%d: system resume hook called.\n", unit));
 
-	if (!(sc->config & PSM_CONFIG_HOOKRESUME))
+	if ((sc->config &
+	    (PSM_CONFIG_HOOKRESUME | PSM_CONFIG_INITAFTERSUSPEND)) == 0)
 		return (0);
 
 	err = reinitialize(sc, sc->config & PSM_CONFIG_INITAFTERSUSPEND);

From owner-svn-src-head@FreeBSD.ORG  Wed Mar 28 01:08:56 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 68E821065674;
	Wed, 28 Mar 2012 01:08:56 +0000 (UTC)
	(envelope-from yongari@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 535DA8FC08;
	Wed, 28 Mar 2012 01:08:56 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2S18uaj011485;
	Wed, 28 Mar 2012 01:08:56 GMT (envelope-from yongari@svn.freebsd.org)
Received: (from yongari@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2S18uP4011482;
	Wed, 28 Mar 2012 01:08:56 GMT (envelope-from yongari@svn.freebsd.org)
Message-Id: <201203280108.q2S18uP4011482@svn.freebsd.org>
From: Pyun YongHyeon 
Date: Wed, 28 Mar 2012 01:08:56 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233585 - head/sys/dev/fxp
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 28 Mar 2012 01:08:56 -0000

Author: yongari
Date: Wed Mar 28 01:08:55 2012
New Revision: 233585
URL: http://svn.freebsd.org/changeset/base/233585

Log:
  Partially revert r223608 and selectively allow microcode loading
  for 82550C.  For 82550 controllers this change restores CPUSaver
  microcode loading.  Due to silicon bug on 82550 and 82550C with
  server extension, these controllers seem to require CPUSaver
  microcode to receive fragmented UDP datagrams.  However the
  microcode shouldn't be used on client featured 82550C as it locks
  up the controller.  In addition, client featured 82550C does not
  have the silicon bug.  Also clear temporary memory used for
  microcode loading since the same memory area is used for other
  commands.
  While I'm here use 82550C in probe message instead of generic
  82550.
  
  Reported by:	Andreas Longwitz  incore de>
  Tested by:	Andreas Longwitz  incore de>
  MFC after:	2 weeks

Modified:
  head/sys/dev/fxp/if_fxp.c
  head/sys/dev/fxp/if_fxpvar.h

Modified: head/sys/dev/fxp/if_fxp.c
==============================================================================
--- head/sys/dev/fxp/if_fxp.c	Wed Mar 28 00:11:57 2012	(r233584)
+++ head/sys/dev/fxp/if_fxp.c	Wed Mar 28 01:08:55 2012	(r233585)
@@ -194,7 +194,7 @@ static const struct fxp_ident const fxp_
     { 0x1229,	0x08,	0, "Intel 82559 Pro/100 Ethernet" },
     { 0x1229,	0x09,	0, "Intel 82559ER Pro/100 Ethernet" },
     { 0x1229,	0x0c,	0, "Intel 82550 Pro/100 Ethernet" },
-    { 0x1229,	0x0d,	0, "Intel 82550 Pro/100 Ethernet" },
+    { 0x1229,	0x0d,	0, "Intel 82550C Pro/100 Ethernet" },
     { 0x1229,	0x0e,	0, "Intel 82550 Pro/100 Ethernet" },
     { 0x1229,	0x0f,	0, "Intel 82551 Pro/100 Ethernet" },
     { 0x1229,	0x10,	0, "Intel 82551 Pro/100 Ethernet" },
@@ -525,6 +525,18 @@ fxp_attach(device_t dev)
 			sc->flags |= FXP_FLAG_WOLCAP;
 	}
 
+	if (sc->revision == FXP_REV_82550_C) {
+		/*
+		 * 82550C with server extension requires microcode to
+		 * receive fragmented UDP datagrams.  However if the
+		 * microcode is used for client-only featured 82550C
+		 * it locks up controller.
+		 */
+		fxp_read_eeprom(sc, &data, 3, 1);
+		if ((data & 0x0400) == 0)
+			sc->flags |= FXP_FLAG_NO_UCODE;
+	}
+
 	/* Receiver lock-up workaround detection. */
 	if (sc->revision < FXP_REV_82558_A4) {
 		fxp_read_eeprom(sc, &data, 3, 1);
@@ -3014,10 +3026,8 @@ static uint32_t fxp_ucode_d101a[] = D101
 static uint32_t fxp_ucode_d101b0[] = D101_B0_RCVBUNDLE_UCODE;
 static uint32_t fxp_ucode_d101ma[] = D101M_B_RCVBUNDLE_UCODE;
 static uint32_t fxp_ucode_d101s[] = D101S_RCVBUNDLE_UCODE;
-#ifdef notyet
 static uint32_t fxp_ucode_d102[] = D102_B_RCVBUNDLE_UCODE;
 static uint32_t fxp_ucode_d102c[] = D102_C_RCVBUNDLE_UCODE;
-#endif
 static uint32_t fxp_ucode_d102e[] = D102_E_RCVBUNDLE_UCODE;
 
 #define UCODE(x)	x, sizeof(x)/sizeof(uint32_t)
@@ -3035,12 +3045,10 @@ static const struct ucode {
 	    D101M_CPUSAVER_DWORD, D101M_CPUSAVER_BUNDLE_MAX_DWORD },
 	{ FXP_REV_82559S_A, UCODE(fxp_ucode_d101s),
 	    D101S_CPUSAVER_DWORD, D101S_CPUSAVER_BUNDLE_MAX_DWORD },
-#ifdef notyet
 	{ FXP_REV_82550, UCODE(fxp_ucode_d102),
 	    D102_B_CPUSAVER_DWORD, D102_B_CPUSAVER_BUNDLE_MAX_DWORD },
 	{ FXP_REV_82550_C, UCODE(fxp_ucode_d102c),
 	    D102_C_CPUSAVER_DWORD, D102_C_CPUSAVER_BUNDLE_MAX_DWORD },
-#endif
 	{ FXP_REV_82551_F, UCODE(fxp_ucode_d102e),
 	    D102_E_CPUSAVER_DWORD, D102_E_CPUSAVER_BUNDLE_MAX_DWORD },
 	{ FXP_REV_82551_10, UCODE(fxp_ucode_d102e),
@@ -3055,6 +3063,9 @@ fxp_load_ucode(struct fxp_softc *sc)
 	struct fxp_cb_ucode *cbp;
 	int i;
 
+	if (sc->flags & FXP_FLAG_NO_UCODE)
+		return;
+
 	for (uc = ucode_table; uc->ucode != NULL; uc++)
 		if (sc->revision == uc->revision)
 			break;
@@ -3087,6 +3098,7 @@ fxp_load_ucode(struct fxp_softc *sc)
 	    sc->tunable_int_delay,
 	    uc->bundle_max_offset == 0 ? 0 : sc->tunable_bundle_max);
 	sc->flags |= FXP_FLAG_UCODE;
+	bzero(cbp, FXP_TXCB_SZ);
 }
 
 #define FXP_SYSCTL_STAT_ADD(c, h, n, p, d)	\

Modified: head/sys/dev/fxp/if_fxpvar.h
==============================================================================
--- head/sys/dev/fxp/if_fxpvar.h	Wed Mar 28 00:11:57 2012	(r233584)
+++ head/sys/dev/fxp/if_fxpvar.h	Wed Mar 28 01:08:55 2012	(r233585)
@@ -236,6 +236,7 @@ struct fxp_softc {
 #define FXP_FLAG_WOLCAP		0x2000	/* WOL capability */
 #define FXP_FLAG_WOL		0x4000	/* WOL active */
 #define FXP_FLAG_RXBUG		0x8000	/* Rx lock-up bug */
+#define FXP_FLAG_NO_UCODE	0x10000	/* ucode is not applicable */
 
 /* Macros to ease CSR access. */
 #define	CSR_READ_1(sc, reg)		bus_read_1(sc->fxp_res[0], reg)

From owner-svn-src-head@FreeBSD.ORG  Wed Mar 28 01:27:27 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id E3FD8106566C;
	Wed, 28 Mar 2012 01:27:27 +0000 (UTC)
	(envelope-from yongari@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id CD8828FC17;
	Wed, 28 Mar 2012 01:27:27 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2S1RRZP012088;
	Wed, 28 Mar 2012 01:27:27 GMT (envelope-from yongari@svn.freebsd.org)
Received: (from yongari@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2S1RRbk012084;
	Wed, 28 Mar 2012 01:27:27 GMT (envelope-from yongari@svn.freebsd.org)
Message-Id: <201203280127.q2S1RRbk012084@svn.freebsd.org>
From: Pyun YongHyeon 
Date: Wed, 28 Mar 2012 01:27:27 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233586 - head/sys/dev/fxp
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 28 Mar 2012 01:27:28 -0000

Author: yongari
Date: Wed Mar 28 01:27:27 2012
New Revision: 233586
URL: http://svn.freebsd.org/changeset/base/233586

Log:
  Load entire EEPROM contents in device attach time and verify
  whether the checksum of EEPROM is valid or not.  Because driver
  heavily relies on EEPROM information when it selectively enables
  features/workarounds, it would be helpful to know whether driver
  sees valid EEPROM.
  While I'm here remove all other EEPROM accesses since the entire
  EEPROM is loaded at device attach time.
  
  MFC after:	2 weeks

Modified:
  head/sys/dev/fxp/if_fxp.c
  head/sys/dev/fxp/if_fxpreg.h
  head/sys/dev/fxp/if_fxpvar.h

Modified: head/sys/dev/fxp/if_fxp.c
==============================================================================
--- head/sys/dev/fxp/if_fxp.c	Wed Mar 28 01:08:55 2012	(r233585)
+++ head/sys/dev/fxp/if_fxp.c	Wed Mar 28 01:27:27 2012	(r233586)
@@ -248,6 +248,7 @@ static uint16_t		fxp_eeprom_getword(stru
 static void 		fxp_eeprom_putword(struct fxp_softc *sc, int offset,
 			    uint16_t data);
 static void		fxp_autosize_eeprom(struct fxp_softc *sc);
+static void		fxp_load_eeprom(struct fxp_softc *sc);
 static void		fxp_read_eeprom(struct fxp_softc *sc, u_short *data,
 			    int offset, int words);
 static void		fxp_write_eeprom(struct fxp_softc *sc, u_short *data,
@@ -426,7 +427,7 @@ fxp_attach(device_t dev)
 	struct fxp_rx *rxp;
 	struct ifnet *ifp;
 	uint32_t val;
-	uint16_t data, myea[ETHER_ADDR_LEN / 2];
+	uint16_t data;
 	u_char eaddr[ETHER_ADDR_LEN];
 	int error, flags, i, pmc, prefer_iomap;
 
@@ -498,6 +499,7 @@ fxp_attach(device_t dev)
 	 * Find out how large of an SEEPROM we have.
 	 */
 	fxp_autosize_eeprom(sc);
+	fxp_load_eeprom(sc);
 
 	/*
 	 * Find out the chip revision; lump all 82557 revs together.
@@ -507,7 +509,7 @@ fxp_attach(device_t dev)
 		/* Assume ICH controllers are 82559. */
 		sc->revision = FXP_REV_82559_A0;
 	} else {
-		fxp_read_eeprom(sc, &data, 5, 1);
+		data = sc->eeprom[FXP_EEPROM_MAP_CNTR];
 		if ((data >> 8) == 1)
 			sc->revision = FXP_REV_82557;
 		else
@@ -519,7 +521,7 @@ fxp_attach(device_t dev)
 	 */
 	if (sc->revision >= FXP_REV_82558_A4 &&
 	    sc->revision != FXP_REV_82559S_A) {
-		fxp_read_eeprom(sc, &data, 10, 1);
+		data = sc->eeprom[FXP_EEPROM_MAP_ID];
 		if ((data & 0x20) != 0 &&
 		    pci_find_cap(sc->dev, PCIY_PMG, &pmc) == 0)
 			sc->flags |= FXP_FLAG_WOLCAP;
@@ -532,14 +534,14 @@ fxp_attach(device_t dev)
 		 * microcode is used for client-only featured 82550C
 		 * it locks up controller.
 		 */
-		fxp_read_eeprom(sc, &data, 3, 1);
+		data = sc->eeprom[FXP_EEPROM_MAP_COMPAT];
 		if ((data & 0x0400) == 0)
 			sc->flags |= FXP_FLAG_NO_UCODE;
 	}
 
 	/* Receiver lock-up workaround detection. */
 	if (sc->revision < FXP_REV_82558_A4) {
-		fxp_read_eeprom(sc, &data, 3, 1);
+		data = sc->eeprom[FXP_EEPROM_MAP_COMPAT];
 		if ((data & 0x03) != 0x03) {
 			sc->flags |= FXP_FLAG_RXBUG;
 			device_printf(dev, "Enabling Rx lock-up workaround\n");
@@ -549,7 +551,7 @@ fxp_attach(device_t dev)
 	/*
 	 * Determine whether we must use the 503 serial interface.
 	 */
-	fxp_read_eeprom(sc, &data, 6, 1);
+	data = sc->eeprom[FXP_EEPROM_MAP_PRI_PHY];
 	if (sc->revision == FXP_REV_82557 && (data & FXP_PHY_DEVICE_MASK) != 0
 	    && (data & FXP_PHY_SERIAL_ONLY))
 		sc->flags |= FXP_FLAG_SERIAL_MEDIA;
@@ -569,7 +571,7 @@ fxp_attach(device_t dev)
 	 */
 	if ((sc->ident->ich >= 2 && sc->ident->ich <= 3) ||
 	    (sc->ident->ich == 0 && sc->revision >= FXP_REV_82559_A0)) {
-		fxp_read_eeprom(sc, &data, 10, 1);
+		data = sc->eeprom[FXP_EEPROM_MAP_ID];
 		if (data & 0x02) {			/* STB enable */
 			uint16_t cksum;
 			int i;
@@ -577,20 +579,19 @@ fxp_attach(device_t dev)
 			device_printf(dev,
 			    "Disabling dynamic standby mode in EEPROM\n");
 			data &= ~0x02;
-			fxp_write_eeprom(sc, &data, 10, 1);
+			sc->eeprom[FXP_EEPROM_MAP_ID] = data;
+			fxp_write_eeprom(sc, &data, FXP_EEPROM_MAP_ID, 1);
 			device_printf(dev, "New EEPROM ID: 0x%x\n", data);
 			cksum = 0;
-			for (i = 0; i < (1 << sc->eeprom_size) - 1; i++) {
-				fxp_read_eeprom(sc, &data, i, 1);
-				cksum += data;
-			}
+			for (i = 0; i < (1 << sc->eeprom_size) - 1; i++)
+				cksum += sc->eeprom[i];
 			i = (1 << sc->eeprom_size) - 1;
 			cksum = 0xBABA - cksum;
-			fxp_read_eeprom(sc, &data, i, 1);
 			fxp_write_eeprom(sc, &cksum, i, 1);
 			device_printf(dev,
 			    "EEPROM checksum @ 0x%x: 0x%x -> 0x%x\n",
-			    i, data, cksum);
+			    i, sc->eeprom[i], cksum);
+			sc->eeprom[i] = cksum;
 #if 1
 			/*
 			 * If the user elects to continue, try the software
@@ -791,21 +792,20 @@ fxp_attach(device_t dev)
 	/*
 	 * Read MAC address.
 	 */
-	fxp_read_eeprom(sc, myea, 0, 3);
-	eaddr[0] = myea[0] & 0xff;
-	eaddr[1] = myea[0] >> 8;
-	eaddr[2] = myea[1] & 0xff;
-	eaddr[3] = myea[1] >> 8;
-	eaddr[4] = myea[2] & 0xff;
-	eaddr[5] = myea[2] >> 8;
+	eaddr[0] = sc->eeprom[FXP_EEPROM_MAP_IA0] & 0xff;
+	eaddr[1] = sc->eeprom[FXP_EEPROM_MAP_IA0] >> 8;
+	eaddr[2] = sc->eeprom[FXP_EEPROM_MAP_IA1] & 0xff;
+	eaddr[3] = sc->eeprom[FXP_EEPROM_MAP_IA1] >> 8;
+	eaddr[4] = sc->eeprom[FXP_EEPROM_MAP_IA2] & 0xff;
+	eaddr[5] = sc->eeprom[FXP_EEPROM_MAP_IA2] >> 8;
 	if (bootverbose) {
 		device_printf(dev, "PCI IDs: %04x %04x %04x %04x %04x\n",
 		    pci_get_vendor(dev), pci_get_device(dev),
 		    pci_get_subvendor(dev), pci_get_subdevice(dev),
 		    pci_get_revid(dev));
-		fxp_read_eeprom(sc, &data, 10, 1);
 		device_printf(dev, "Dynamic Standby mode is %s\n",
-		    data & 0x02 ? "enabled" : "disabled");
+		    sc->eeprom[FXP_EEPROM_MAP_ID] & 0x02 ? "enabled" :
+		    "disabled");
 	}
 
 	/*
@@ -1301,6 +1301,23 @@ fxp_write_eeprom(struct fxp_softc *sc, u
 		fxp_eeprom_putword(sc, offset + i, data[i]);
 }
 
+static void
+fxp_load_eeprom(struct fxp_softc *sc)
+{
+	int i;
+	uint16_t cksum;
+
+	fxp_read_eeprom(sc, sc->eeprom, 0, 1 << sc->eeprom_size);
+	cksum = 0;
+	for (i = 0; i < (1 << sc->eeprom_size) - 1; i++)
+		cksum += sc->eeprom[i];
+	cksum = 0xBABA - cksum;
+	if (cksum != sc->eeprom[(1 << sc->eeprom_size) - 1])
+		device_printf(sc->dev,
+		    "EEPROM checksum mismatch! (0x%04x -> 0x%04x)\n",
+		    cksum, sc->eeprom[(1 << sc->eeprom_size) - 1]);
+}
+
 /*
  * Grab the softc lock and call the real fxp_start_body() routine
  */

Modified: head/sys/dev/fxp/if_fxpreg.h
==============================================================================
--- head/sys/dev/fxp/if_fxpreg.h	Wed Mar 28 01:08:55 2012	(r233585)
+++ head/sys/dev/fxp/if_fxpreg.h	Wed Mar 28 01:27:27 2012	(r233586)
@@ -448,6 +448,24 @@ struct fxp_stats {
 #define FXP_EEPROM_OPC_READ	0x6
 
 /*
+ * EEPROM map
+ */
+#define	FXP_EEPROM_MAP_IA0	0x00		/* Station address */
+#define	FXP_EEPROM_MAP_IA1	0x01
+#define	FXP_EEPROM_MAP_IA2	0x02
+#define	FXP_EEPROM_MAP_COMPAT	0x03		/* Compatibility */
+#define	FXP_EEPROM_MAP_CNTR	0x05		/* Controller/connector type */
+#define	FXP_EEPROM_MAP_PRI_PHY	0x06		/* Primary PHY record */
+#define	FXP_EEPROM_MAP_SEC_PHY	0x07		/* Secondary PHY record */
+#define	FXP_EEPROM_MAP_PWA0	0x08		/* Printed wire assembly num. */
+#define	FXP_EEPROM_MAP_PWA1	0x09		/* Printed wire assembly num. */
+#define	FXP_EEPROM_MAP_ID	0x0A		/* EEPROM ID */
+#define	FXP_EEPROM_MAP_SUBSYS	0x0B		/* Subsystem ID */
+#define	FXP_EEPROM_MAP_SUBVEN	0x0C		/* Subsystem vendor ID */
+#define	FXP_EEPROM_MAP_CKSUM64	0x3F		/* 64-word EEPROM checksum */
+#define	FXP_EEPROM_MAP_CKSUM256	0xFF		/* 256-word EEPROM checksum */
+
+/*
  * Management Data Interface opcodes
  */
 #define FXP_MDI_WRITE		0x1

Modified: head/sys/dev/fxp/if_fxpvar.h
==============================================================================
--- head/sys/dev/fxp/if_fxpvar.h	Wed Mar 28 01:08:55 2012	(r233585)
+++ head/sys/dev/fxp/if_fxpvar.h	Wed Mar 28 01:27:27 2012	(r233586)
@@ -219,6 +219,7 @@ struct fxp_softc {
 	int if_flags;
 	uint8_t rfa_size;
 	uint32_t tx_cmd;
+	uint16_t eeprom[256];
 };
 
 #define FXP_FLAG_MWI_ENABLE	0x0001	/* MWI enable */

From owner-svn-src-head@FreeBSD.ORG  Wed Mar 28 01:52:39 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 7587D106566B;
	Wed, 28 Mar 2012 01:52:39 +0000 (UTC)
	(envelope-from yongari@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 612388FC1B;
	Wed, 28 Mar 2012 01:52:39 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2S1qd9L012890;
	Wed, 28 Mar 2012 01:52:39 GMT (envelope-from yongari@svn.freebsd.org)
Received: (from yongari@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2S1qdhh012888;
	Wed, 28 Mar 2012 01:52:39 GMT (envelope-from yongari@svn.freebsd.org)
Message-Id: <201203280152.q2S1qdhh012888@svn.freebsd.org>
From: Pyun YongHyeon 
Date: Wed, 28 Mar 2012 01:52:39 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233587 - head/sys/dev/fxp
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 28 Mar 2012 01:52:39 -0000

Author: yongari
Date: Wed Mar 28 01:52:38 2012
New Revision: 233587
URL: http://svn.freebsd.org/changeset/base/233587

Log:
  Remove unnecessary #if as the software workaround for PCI protocol
  violation should be activated unless the system is cold-booted
  after updating EEPROM.
  The PCI protocol violation happens only when established link is
  10Mbps so the workaround should be updated whenever link state
  change is detected.  Previously the workaround was activated only
  when user checks current media status with ifconfig(8).

Modified:
  head/sys/dev/fxp/if_fxp.c

Modified: head/sys/dev/fxp/if_fxp.c
==============================================================================
--- head/sys/dev/fxp/if_fxp.c	Wed Mar 28 01:27:27 2012	(r233586)
+++ head/sys/dev/fxp/if_fxp.c	Wed Mar 28 01:52:38 2012	(r233587)
@@ -592,13 +592,11 @@ fxp_attach(device_t dev)
 			    "EEPROM checksum @ 0x%x: 0x%x -> 0x%x\n",
 			    i, sc->eeprom[i], cksum);
 			sc->eeprom[i] = cksum;
-#if 1
 			/*
 			 * If the user elects to continue, try the software
 			 * workaround, as it is better than nothing.
 			 */
 			sc->flags |= FXP_FLAG_CU_RESUME_BUG;
-#endif
 		}
 	}
 
@@ -2611,12 +2609,6 @@ fxp_ifmedia_sts(struct ifnet *ifp, struc
 	mii_pollstat(mii);
 	ifmr->ifm_active = mii->mii_media_active;
 	ifmr->ifm_status = mii->mii_media_status;
-
-	if (IFM_SUBTYPE(ifmr->ifm_active) == IFM_10_T &&
-	    sc->flags & FXP_FLAG_CU_RESUME_BUG)
-		sc->cu_resume_bug = 1;
-	else
-		sc->cu_resume_bug = 0;
 	FXP_UNLOCK(sc);
 }
 
@@ -2809,6 +2801,11 @@ fxp_miibus_statchg(device_t dev)
 	    (IFM_AVALID | IFM_ACTIVE))
 		return;
 
+	if (IFM_SUBTYPE(mii->mii_media_active) == IFM_10_T &&
+	    sc->flags & FXP_FLAG_CU_RESUME_BUG)
+		sc->cu_resume_bug = 1;
+	else
+		sc->cu_resume_bug = 0;
 	/*
 	 * Call fxp_init_body in order to adjust the flow control settings.
 	 * Note that the 82557 doesn't support hardware flow control.

From owner-svn-src-head@FreeBSD.ORG  Wed Mar 28 08:11:47 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 2D8E2106564A;
	Wed, 28 Mar 2012 08:11:47 +0000 (UTC)
	(envelope-from tuexen@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 190038FC12;
	Wed, 28 Mar 2012 08:11:47 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2S8Bk29025478;
	Wed, 28 Mar 2012 08:11:46 GMT (envelope-from tuexen@svn.freebsd.org)
Received: (from tuexen@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2S8BkRZ025476;
	Wed, 28 Mar 2012 08:11:46 GMT (envelope-from tuexen@svn.freebsd.org)
Message-Id: <201203280811.q2S8BkRZ025476@svn.freebsd.org>
From: Michael Tuexen 
Date: Wed, 28 Mar 2012 08:11:46 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233597 - head/sys/netinet
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 28 Mar 2012 08:11:47 -0000

Author: tuexen
Date: Wed Mar 28 08:11:46 2012
New Revision: 233597
URL: http://svn.freebsd.org/changeset/base/233597

Log:
  Honor the net.inet.udp.checksum sysctl when using SCTP/UDP/IPv4
  encapsulation.
  MFCing requires MFCing http://svn.freebsd.org/changeset/base/233554
  MFC after: 2 weeks

Modified:
  head/sys/netinet/sctp_output.c

Modified: head/sys/netinet/sctp_output.c
==============================================================================
--- head/sys/netinet/sctp_output.c	Wed Mar 28 06:49:29 2012	(r233596)
+++ head/sys/netinet/sctp_output.c	Wed Mar 28 08:11:46 2012	(r233597)
@@ -53,6 +53,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 
 
@@ -4064,7 +4065,11 @@ sctp_lowlevel_chunk_output(struct sctp_i
 				udp->uh_sport = htons(SCTP_BASE_SYSCTL(sctp_udp_tunneling_port));
 				udp->uh_dport = port;
 				udp->uh_ulen = htons(packet_length - sizeof(struct ip));
-				udp->uh_sum = in_pseudo(ip->ip_src.s_addr, ip->ip_dst.s_addr, udp->uh_ulen + htons(IPPROTO_UDP));
+				if (V_udp_cksum) {
+					udp->uh_sum = in_pseudo(ip->ip_src.s_addr, ip->ip_dst.s_addr, udp->uh_ulen + htons(IPPROTO_UDP));
+				} else {
+					udp->uh_sum = 0;
+				}
 				sctphdr = (struct sctphdr *)((caddr_t)udp + sizeof(struct udphdr));
 			} else {
 				sctphdr = (struct sctphdr *)((caddr_t)ip + sizeof(struct ip));
@@ -4127,7 +4132,9 @@ sctp_lowlevel_chunk_output(struct sctp_i
 					SCTP_STAT_INCR(sctps_sendnocrc);
 				}
 #endif
-				SCTP_ENABLE_UDP_CSUM(o_pak);
+				if (V_udp_cksum) {
+					SCTP_ENABLE_UDP_CSUM(o_pak);
+				}
 			} else {
 #if defined(SCTP_WITH_NO_CSUM)
 				SCTP_STAT_INCR(sctps_sendnocrc);
@@ -11007,8 +11014,13 @@ sctp_send_shutdown_complete2(struct mbuf
 		udp->uh_dport = port;
 		udp->uh_ulen = htons(sizeof(struct sctp_shutdown_complete_msg) + sizeof(struct udphdr));
 #ifdef INET
-		if (iph_out)
-			udp->uh_sum = in_pseudo(iph_out->ip_src.s_addr, iph_out->ip_dst.s_addr, udp->uh_ulen + htons(IPPROTO_UDP));
+		if (iph_out) {
+			if (V_udp_cksum) {
+				udp->uh_sum = in_pseudo(iph_out->ip_src.s_addr, iph_out->ip_dst.s_addr, udp->uh_ulen + htons(IPPROTO_UDP));
+			} else {
+				udp->uh_sum = 0;
+			}
+		}
 #endif
 		offset_out += sizeof(struct udphdr);
 		comp_cp = (struct sctp_shutdown_complete_msg *)((caddr_t)comp_cp + sizeof(struct udphdr));
@@ -11047,7 +11059,9 @@ sctp_send_shutdown_complete2(struct mbuf
 			comp_cp->sh.checksum = sctp_calculate_cksum(mout, offset_out);
 			SCTP_STAT_INCR(sctps_sendswcrc);
 #endif
-			SCTP_ENABLE_UDP_CSUM(mout);
+			if (V_udp_cksum) {
+				SCTP_ENABLE_UDP_CSUM(mout);
+			}
 		} else {
 #if defined(SCTP_WITH_NO_CSUM)
 			SCTP_STAT_INCR(sctps_sendnocrc);
@@ -12024,7 +12038,11 @@ sctp_send_abort(struct mbuf *m, int iphl
 		bzero(&ro, sizeof ro);
 		if (port) {
 			udp->uh_ulen = htons(len - sizeof(struct ip));
-			udp->uh_sum = in_pseudo(iph_out->ip_src.s_addr, iph_out->ip_dst.s_addr, udp->uh_ulen + htons(IPPROTO_UDP));
+			if (V_udp_cksum) {
+				udp->uh_sum = in_pseudo(iph_out->ip_src.s_addr, iph_out->ip_dst.s_addr, udp->uh_ulen + htons(IPPROTO_UDP));
+			} else {
+				udp->uh_sum = 0;
+			}
 		}
 		SCTPDBG(SCTP_DEBUG_OUTPUT2, "sctp_send_abort calling ip_output:\n");
 		SCTPDBG_PKT(SCTP_DEBUG_OUTPUT2, iph_out, &abm->sh);
@@ -12043,7 +12061,9 @@ sctp_send_abort(struct mbuf *m, int iphl
 			abm->sh.checksum = sctp_calculate_cksum(mout, iphlen_out);
 			SCTP_STAT_INCR(sctps_sendswcrc);
 #endif
-			SCTP_ENABLE_UDP_CSUM(o_pak);
+			if (V_udp_cksum) {
+				SCTP_ENABLE_UDP_CSUM(o_pak);
+			}
 		} else {
 #if defined(SCTP_WITH_NO_CSUM)
 			SCTP_STAT_INCR(sctps_sendnocrc);
@@ -12286,7 +12306,11 @@ sctp_send_operr_to(struct mbuf *m, int i
 		bzero(&ro, sizeof ro);
 		if (port) {
 			udp->uh_ulen = htons(len - sizeof(struct ip));
-			udp->uh_sum = in_pseudo(iph_out->ip_src.s_addr, iph_out->ip_dst.s_addr, udp->uh_ulen + htons(IPPROTO_UDP));
+			if (V_udp_cksum) {
+				udp->uh_sum = in_pseudo(iph_out->ip_src.s_addr, iph_out->ip_dst.s_addr, udp->uh_ulen + htons(IPPROTO_UDP));
+			} else {
+				udp->uh_sum = 0;
+			}
 		}
 		/* set IPv4 length */
 		iph_out->ip_len = len;
@@ -12303,7 +12327,9 @@ sctp_send_operr_to(struct mbuf *m, int i
 			sh_out->checksum = sctp_calculate_cksum(mout, iphlen_out);
 			SCTP_STAT_INCR(sctps_sendswcrc);
 #endif
-			SCTP_ENABLE_UDP_CSUM(o_pak);
+			if (V_udp_cksum) {
+				SCTP_ENABLE_UDP_CSUM(o_pak);
+			}
 		} else {
 #if defined(SCTP_WITH_NO_CSUM)
 			SCTP_STAT_INCR(sctps_sendnocrc);

From owner-svn-src-head@FreeBSD.ORG  Wed Mar 28 12:11:55 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 51B74106564A;
	Wed, 28 Mar 2012 12:11:55 +0000 (UTC)
	(envelope-from theraven@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 3C5C28FC16;
	Wed, 28 Mar 2012 12:11:55 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2SCBtTu035207;
	Wed, 28 Mar 2012 12:11:55 GMT
	(envelope-from theraven@svn.freebsd.org)
Received: (from theraven@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2SCBsNm035197;
	Wed, 28 Mar 2012 12:11:54 GMT
	(envelope-from theraven@svn.freebsd.org)
Message-Id: <201203281211.q2SCBsNm035197@svn.freebsd.org>
From: David Chisnall 
Date: Wed, 28 Mar 2012 12:11:54 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233600 - head/include
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 28 Mar 2012 12:11:55 -0000

Author: theraven
Date: Wed Mar 28 12:11:54 2012
New Revision: 233600
URL: http://svn.freebsd.org/changeset/base/233600

Log:
  Correctly expose xlocale functions if people include the headers in the wrong
  order (as some ports apparently do).
  
  Approved by:	dim (mentor)

Modified:
  head/include/ctype.h
  head/include/inttypes.h
  head/include/langinfo.h
  head/include/monetary.h
  head/include/stdio.h
  head/include/stdlib.h
  head/include/string.h
  head/include/time.h
  head/include/wchar.h

Modified: head/include/ctype.h
==============================================================================
--- head/include/ctype.h	Wed Mar 28 11:37:06 2012	(r233599)
+++ head/include/ctype.h	Wed Mar 28 12:11:54 2012	(r233600)
@@ -79,7 +79,7 @@ int	isrune(int);
 int	isspecial(int);
 #endif
 
-#if __POSIX_VISIBLE >= 200809
+#if __POSIX_VISIBLE >= 200809 || defined(_XLOCALE_H_)
 #include 
 #endif
 __END_DECLS

Modified: head/include/inttypes.h
==============================================================================
--- head/include/inttypes.h	Wed Mar 28 11:37:06 2012	(r233599)
+++ head/include/inttypes.h	Wed Mar 28 12:11:54 2012	(r233600)
@@ -45,6 +45,9 @@ typedef struct {
 } imaxdiv_t;
 
 __BEGIN_DECLS
+#ifdef _XLOCALE_H_
+#include 
+#endif
 intmax_t	imaxabs(intmax_t) __pure2;
 imaxdiv_t	imaxdiv(intmax_t, intmax_t) __pure2;
 

Modified: head/include/langinfo.h
==============================================================================
--- head/include/langinfo.h	Wed Mar 28 11:37:06 2012	(r233599)
+++ head/include/langinfo.h	Wed Mar 28 12:11:54 2012	(r233600)
@@ -131,7 +131,7 @@ typedef	__nl_item	nl_item;
 __BEGIN_DECLS
 char	*nl_langinfo(nl_item);
 
-#if __POSIX_VISIBLE >= 200809
+#if __POSIX_VISIBLE >= 200809 || defined(_XLOCALE_H_)
 #include 
 #endif
 __END_DECLS

Modified: head/include/monetary.h
==============================================================================
--- head/include/monetary.h	Wed Mar 28 11:37:06 2012	(r233599)
+++ head/include/monetary.h	Wed Mar 28 12:11:54 2012	(r233600)
@@ -43,6 +43,9 @@ typedef	__ssize_t	ssize_t;
 #endif
 
 __BEGIN_DECLS
+#ifdef _XLOCALE_H_
+#include 
+#endif
 ssize_t	strfmon(char * __restrict, size_t, const char * __restrict, ...);
 __END_DECLS
 

Modified: head/include/stdio.h
==============================================================================
--- head/include/stdio.h	Wed Mar 28 11:37:06 2012	(r233599)
+++ head/include/stdio.h	Wed Mar 28 12:11:54 2012	(r233600)
@@ -225,6 +225,9 @@ __END_DECLS
 #define	stderr	__stderrp
 
 __BEGIN_DECLS
+#ifdef _XLOCALE_H_
+#include 
+#endif
 /*
  * Functions defined in ANSI C standard.
  */

Modified: head/include/stdlib.h
==============================================================================
--- head/include/stdlib.h	Wed Mar 28 11:37:06 2012	(r233599)
+++ head/include/stdlib.h	Wed Mar 28 12:11:54 2012	(r233600)
@@ -72,6 +72,9 @@ typedef struct {
 #define	RAND_MAX	0x7fffffff
 
 __BEGIN_DECLS
+#ifdef _XLOCALE_H_
+#include 
+#endif
 extern int __mb_cur_max;
 extern int ___mb_cur_max(void);
 #define	MB_CUR_MAX	(___mb_cur_max())

Modified: head/include/string.h
==============================================================================
--- head/include/string.h	Wed Mar 28 11:37:06 2012	(r233599)
+++ head/include/string.h	Wed Mar 28 12:11:54 2012	(r233600)
@@ -133,7 +133,7 @@ void	 swab(const void * __restrict, void
 
 #endif /* __BSD_VISIBLE */
 
-#if __POSIX_VISIBLE >= 200809
+#if __POSIX_VISIBLE >= 200809 || defined(_XLOCALE_H_)
 #include 
 #endif
 __END_DECLS

Modified: head/include/time.h
==============================================================================
--- head/include/time.h	Wed Mar 28 11:37:06 2012	(r233599)
+++ head/include/time.h	Wed Mar 28 12:11:54 2012	(r233600)
@@ -184,7 +184,7 @@ time_t timelocal(struct tm * const);
 time_t timegm(struct tm * const);
 #endif /* __BSD_VISIBLE */
 
-#if __POSIX_VISIBLE >= 200809
+#if __POSIX_VISIBLE >= 200809 || defined(_XLOCALE_H_)
 #include 
 #endif
 __END_DECLS

Modified: head/include/wchar.h
==============================================================================
--- head/include/wchar.h	Wed Mar 28 11:37:06 2012	(r233599)
+++ head/include/wchar.h	Wed Mar 28 12:11:54 2012	(r233600)
@@ -225,7 +225,7 @@ size_t	wcslcat(wchar_t *, const wchar_t 
 size_t	wcslcpy(wchar_t *, const wchar_t *, size_t);
 #endif
 
-#if __POSIX_VISIBLE >= 200809
+#if __POSIX_VISIBLE >= 200809 || defined(_XLOCALE_H_)
 #include 
 #endif
 __END_DECLS

From owner-svn-src-head@FreeBSD.ORG  Wed Mar 28 12:30:16 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id B471B1065672;
	Wed, 28 Mar 2012 12:30:16 +0000 (UTC) (envelope-from zec@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 9FF588FC08;
	Wed, 28 Mar 2012 12:30:16 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2SCUGOL035842;
	Wed, 28 Mar 2012 12:30:16 GMT (envelope-from zec@svn.freebsd.org)
Received: (from zec@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2SCUGaK035840;
	Wed, 28 Mar 2012 12:30:16 GMT (envelope-from zec@svn.freebsd.org)
Message-Id: <201203281230.q2SCUGaK035840@svn.freebsd.org>
From: Marko Zec 
Date: Wed, 28 Mar 2012 12:30:16 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233601 - head/sys/netinet
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 28 Mar 2012 12:30:16 -0000

Author: zec
Date: Wed Mar 28 12:30:16 2012
New Revision: 233601
URL: http://svn.freebsd.org/changeset/base/233601

Log:
  Permit tcpdrop in VNET jails.
  
  Submitted by:	Miljenko Mikuc
  MFC after:	3 days

Modified:
  head/sys/netinet/tcp_subr.c

Modified: head/sys/netinet/tcp_subr.c
==============================================================================
--- head/sys/netinet/tcp_subr.c	Wed Mar 28 12:11:54 2012	(r233600)
+++ head/sys/netinet/tcp_subr.c	Wed Mar 28 12:30:16 2012	(r233601)
@@ -2184,7 +2184,7 @@ sysctl_drop(SYSCTL_HANDLER_ARGS)
 	return (error);
 }
 
-SYSCTL_PROC(_net_inet_tcp, TCPCTL_DROP, drop,
+SYSCTL_VNET_PROC(_net_inet_tcp, TCPCTL_DROP, drop,
     CTLTYPE_STRUCT|CTLFLAG_WR|CTLFLAG_SKIP, NULL,
     0, sysctl_drop, "", "Drop TCP connection");
 

From owner-svn-src-head@FreeBSD.ORG  Wed Mar 28 13:28:10 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 849D0106566C;
	Wed, 28 Mar 2012 13:28:10 +0000 (UTC) (envelope-from mav@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 6F9428FC0C;
	Wed, 28 Mar 2012 13:28:10 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2SDSAB4038049;
	Wed, 28 Mar 2012 13:28:10 GMT (envelope-from mav@svn.freebsd.org)
Received: (from mav@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2SDSAc0038047;
	Wed, 28 Mar 2012 13:28:10 GMT (envelope-from mav@svn.freebsd.org)
Message-Id: <201203281328.q2SDSAc0038047@svn.freebsd.org>
From: Alexander Motin 
Date: Wed, 28 Mar 2012 13:28:10 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233606 - head/sys/dev/sound/pci/hda
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 28 Mar 2012 13:28:10 -0000

Author: mav
Date: Wed Mar 28 13:28:09 2012
New Revision: 233606
URL: http://svn.freebsd.org/changeset/base/233606

Log:
  Stop HDA controller polling callout on suspend and reset it on resume.
  
  PR:		kern/166382
  MFC after:	1 week

Modified:
  head/sys/dev/sound/pci/hda/hdac.c

Modified: head/sys/dev/sound/pci/hda/hdac.c
==============================================================================
--- head/sys/dev/sound/pci/hda/hdac.c	Wed Mar 28 12:46:12 2012	(r233605)
+++ head/sys/dev/sound/pci/hda/hdac.c	Wed Mar 28 13:28:09 2012	(r233606)
@@ -1558,8 +1558,10 @@ hdac_suspend(device_t dev)
 	HDA_BOOTHVERBOSE(
 		device_printf(dev, "Reset controller...\n");
 	);
+	callout_stop(&sc->poll_callout);
 	hdac_reset(sc, 0);
 	hdac_unlock(sc);
+	callout_drain(&sc->poll_callout);
 	taskqueue_drain(taskqueue_thread, &sc->unsolq_task);
 	HDA_BOOTHVERBOSE(
 		device_printf(dev, "Suspend done\n");
@@ -1608,6 +1610,7 @@ hdac_resume(device_t dev)
 	    HDAC_GCTL_UNSOL);
 	HDAC_WRITE_4(&sc->mem, HDAC_INTCTL, HDAC_INTCTL_CIE | HDAC_INTCTL_GIE);
 	DELAY(1000);
+	hdac_poll_reinit(sc);
 	hdac_unlock(sc);
 
 	error = bus_generic_resume(dev);

From owner-svn-src-head@FreeBSD.ORG  Wed Mar 28 13:47:08 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 3308A106564A;
	Wed, 28 Mar 2012 13:47:08 +0000 (UTC) (envelope-from kib@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 1D9E48FC0A;
	Wed, 28 Mar 2012 13:47:08 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2SDl7ME038680;
	Wed, 28 Mar 2012 13:47:07 GMT (envelope-from kib@svn.freebsd.org)
Received: (from kib@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2SDl721038678;
	Wed, 28 Mar 2012 13:47:07 GMT (envelope-from kib@svn.freebsd.org)
Message-Id: <201203281347.q2SDl721038678@svn.freebsd.org>
From: Konstantin Belousov 
Date: Wed, 28 Mar 2012 13:47:07 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233607 - head/sys/ufs/ffs
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 28 Mar 2012 13:47:08 -0000

Author: kib
Date: Wed Mar 28 13:47:07 2012
New Revision: 233607
URL: http://svn.freebsd.org/changeset/base/233607

Log:
  Update comment.
  
  MFC after:	3 days

Modified:
  head/sys/ufs/ffs/ffs_vfsops.c

Modified: head/sys/ufs/ffs/ffs_vfsops.c
==============================================================================
--- head/sys/ufs/ffs/ffs_vfsops.c	Wed Mar 28 13:28:09 2012	(r233606)
+++ head/sys/ufs/ffs/ffs_vfsops.c	Wed Mar 28 13:47:07 2012	(r233607)
@@ -1479,7 +1479,7 @@ loop:
 
 	MNT_VNODE_FOREACH(vp, mp, mvp) {
 		/*
-		 * Depend on the mntvnode_slock to keep things stable enough
+		 * Depend on the vnode interlock to keep things stable enough
 		 * for a quick test.  Since there might be hundreds of
 		 * thousands of vnodes, we cannot afford even a subroutine
 		 * call unless there's a good chance that we have work to do.

From owner-svn-src-head@FreeBSD.ORG  Wed Mar 28 13:56:18 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id F1340106564A;
	Wed, 28 Mar 2012 13:56:18 +0000 (UTC) (envelope-from kib@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id DADE18FC0C;
	Wed, 28 Mar 2012 13:56:18 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2SDuIDJ039027;
	Wed, 28 Mar 2012 13:56:18 GMT (envelope-from kib@svn.freebsd.org)
Received: (from kib@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2SDuIxH039025;
	Wed, 28 Mar 2012 13:56:18 GMT (envelope-from kib@svn.freebsd.org)
Message-Id: <201203281356.q2SDuIxH039025@svn.freebsd.org>
From: Konstantin Belousov 
Date: Wed, 28 Mar 2012 13:56:18 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233608 - head/sys/ufs/ufs
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 28 Mar 2012 13:56:19 -0000

Author: kib
Date: Wed Mar 28 13:56:18 2012
New Revision: 233608
URL: http://svn.freebsd.org/changeset/base/233608

Log:
  Microoptimize: in qsync loop over mount vnodes, only unlock mount
  interlock after we committed to try to vget() the vnode.
  
  Submitted by:	bde
  Reviewed by:	mckusick
  Tested by:	pho
  MFC after:	1 week

Modified:
  head/sys/ufs/ufs/ufs_quota.c

Modified: head/sys/ufs/ufs/ufs_quota.c
==============================================================================
--- head/sys/ufs/ufs/ufs_quota.c	Wed Mar 28 13:47:07 2012	(r233607)
+++ head/sys/ufs/ufs/ufs_quota.c	Wed Mar 28 13:56:18 2012	(r233608)
@@ -1061,12 +1061,11 @@ qsync(struct mount *mp)
 again:
 	MNT_VNODE_FOREACH(vp, mp, mvp) {
 		VI_LOCK(vp);
-		MNT_IUNLOCK(mp);
 		if (vp->v_type == VNON) {
 			VI_UNLOCK(vp);
-			MNT_ILOCK(mp);
 			continue;
 		}
+		MNT_IUNLOCK(mp);
 		error = vget(vp, LK_EXCLUSIVE | LK_INTERLOCK, td);
 		if (error) {
 			MNT_ILOCK(mp);

From owner-svn-src-head@FreeBSD.ORG  Wed Mar 28 14:06:48 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 40E1E1065670;
	Wed, 28 Mar 2012 14:06:48 +0000 (UTC) (envelope-from kib@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 2C6758FC0C;
	Wed, 28 Mar 2012 14:06:48 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2SE6mlZ039440;
	Wed, 28 Mar 2012 14:06:48 GMT (envelope-from kib@svn.freebsd.org)
Received: (from kib@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2SE6lu3039438;
	Wed, 28 Mar 2012 14:06:47 GMT (envelope-from kib@svn.freebsd.org)
Message-Id: <201203281406.q2SE6lu3039438@svn.freebsd.org>
From: Konstantin Belousov 
Date: Wed, 28 Mar 2012 14:06:47 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233609 - head/sys/ufs/ffs
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 28 Mar 2012 14:06:48 -0000

Author: kib
Date: Wed Mar 28 14:06:47 2012
New Revision: 233609
URL: http://svn.freebsd.org/changeset/base/233609

Log:
  Reviewed by:	bde, mckusick
  Tested by:	pho
  MFC after:	2 weeks

Modified:
  head/sys/ufs/ffs/ffs_vfsops.c

Modified: head/sys/ufs/ffs/ffs_vfsops.c
==============================================================================
--- head/sys/ufs/ffs/ffs_vfsops.c	Wed Mar 28 13:56:18 2012	(r233608)
+++ head/sys/ufs/ffs/ffs_vfsops.c	Wed Mar 28 14:06:47 2012	(r233609)
@@ -80,6 +80,8 @@ static int	ffs_mountfs(struct vnode *, s
 static void	ffs_oldfscompat_read(struct fs *, struct ufsmount *,
 		    ufs2_daddr_t);
 static void	ffs_ifree(struct ufsmount *ump, struct inode *ip);
+static int	ffs_sync_lazy(struct mount *mp);
+
 static vfs_init_t ffs_init;
 static vfs_uninit_t ffs_uninit;
 static vfs_extattrctl_t ffs_extattrctl;
@@ -1411,11 +1413,78 @@ ffs_statfs(mp, sbp)
 }
 
 /*
+ * For a lazy sync, we only care about access times, quotas and the
+ * superblock.  Other filesystem changes are already converted to
+ * cylinder group blocks or inode blocks updates and are written to
+ * disk by syncer.
+ */
+static int
+ffs_sync_lazy(mp)
+     struct mount *mp;
+{
+	struct vnode *mvp, *vp;
+	struct inode *ip;
+	struct thread *td;
+	int allerror, error;
+
+	allerror = 0;
+	td = curthread;
+	if ((mp->mnt_flag & MNT_NOATIME) != 0)
+		goto qupdate;
+	MNT_ILOCK(mp);
+	MNT_VNODE_FOREACH(vp, mp, mvp) {
+		VI_LOCK(vp);
+		if (vp->v_iflag & VI_DOOMED || vp->v_type == VNON) {
+			VI_UNLOCK(vp);
+			continue;
+		}
+		ip = VTOI(vp);
+
+		/*
+		 * The IN_ACCESS flag is converted to IN_MODIFIED by
+		 * ufs_close() and ufs_getattr() by the calls to
+		 * ufs_itimes_locked(), without subsequent
+		 * UFS_UPDATE().  Test also all the other timestamp
+		 * flags too, to pick up any other cases that could be
+		 * missed.
+		 */
+		if ((ip->i_flag & (IN_ACCESS | IN_CHANGE | IN_MODIFIED |
+		    IN_UPDATE)) == 0) {
+			VI_UNLOCK(vp);
+			continue;
+		}
+		MNT_IUNLOCK(mp);
+		if ((error = vget(vp, LK_EXCLUSIVE | LK_NOWAIT | LK_INTERLOCK,
+		    td)) != 0) {
+			MNT_ILOCK(mp);
+			continue;
+		}
+		error = ffs_update(vp, 0);
+		if (error != 0)
+			allerror = error;
+		vput(vp);
+		MNT_ILOCK(mp);
+	}
+	MNT_IUNLOCK(mp);
+
+qupdate:
+#ifdef QUOTA
+	qsync(mp);
+#endif
+
+	if (VFSTOUFS(mp)->um_fs->fs_fmod != 0 &&
+	    (error = ffs_sbupdate(VFSTOUFS(mp), MNT_LAZY, 0)) != 0)
+		allerror = error;
+	return (allerror);
+}
+
+/*
  * Go through the disk queues to initiate sandbagged IO;
  * go through the inodes to write those that have been modified;
  * initiate the writing of the super block if it has been modified.
  *
- * Note: we are always called with the filesystem marked `MPBUSY'.
+ * Note: we are always called with the filesystem marked busy using
+ * vfs_busy().
  */
 static int
 ffs_sync(mp, waitfor)
@@ -1444,15 +1513,9 @@ ffs_sync(mp, waitfor)
 	if (fs->fs_fmod != 0 && fs->fs_ronly != 0 && ump->um_fsckpid == 0)
 		panic("%s: ffs_sync: modification on read-only filesystem",
 		    fs->fs_fsmnt);
-	/*
-	 * For a lazy sync, we just care about the filesystem metadata.
-	 */
-	if (waitfor == MNT_LAZY) {
-		secondary_accwrites = 0;
-		secondary_writes = 0;
-		lockreq = 0;
-		goto metasync;
-	}
+	if (waitfor == MNT_LAZY)
+		return (ffs_sync_lazy(mp));
+
 	/*
 	 * Write back each (modified) inode.
 	 */
@@ -1527,7 +1590,6 @@ loop:
 	qsync(mp);
 #endif
 
-metasync:
 	devvp = ump->um_devvp;
 	bo = &devvp->v_bufobj;
 	BO_LOCK(bo);

From owner-svn-src-head@FreeBSD.ORG  Wed Mar 28 14:16:16 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 57CAF1065670;
	Wed, 28 Mar 2012 14:16:16 +0000 (UTC) (envelope-from kib@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 42ED98FC18;
	Wed, 28 Mar 2012 14:16:16 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2SEGG8I039861;
	Wed, 28 Mar 2012 14:16:16 GMT (envelope-from kib@svn.freebsd.org)
Received: (from kib@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2SEGGTH039859;
	Wed, 28 Mar 2012 14:16:16 GMT (envelope-from kib@svn.freebsd.org)
Message-Id: <201203281416.q2SEGGTH039859@svn.freebsd.org>
From: Konstantin Belousov 
Date: Wed, 28 Mar 2012 14:16:16 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233610 - head/sys/ufs/ffs
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 28 Mar 2012 14:16:16 -0000

Author: kib
Date: Wed Mar 28 14:16:15 2012
New Revision: 233610
URL: http://svn.freebsd.org/changeset/base/233610

Log:
  Do trivial reformatting of the comment to record the missed commit
  message for r233609:
  Restore the writes of atimes, quotas and superblock from syncer vnode.
  
  Noted by:   rdivacky

Modified:
  head/sys/ufs/ffs/ffs_vfsops.c

Modified: head/sys/ufs/ffs/ffs_vfsops.c
==============================================================================
--- head/sys/ufs/ffs/ffs_vfsops.c	Wed Mar 28 14:06:47 2012	(r233609)
+++ head/sys/ufs/ffs/ffs_vfsops.c	Wed Mar 28 14:16:15 2012	(r233610)
@@ -1443,10 +1443,9 @@ ffs_sync_lazy(mp)
 		/*
 		 * The IN_ACCESS flag is converted to IN_MODIFIED by
 		 * ufs_close() and ufs_getattr() by the calls to
-		 * ufs_itimes_locked(), without subsequent
-		 * UFS_UPDATE().  Test also all the other timestamp
-		 * flags too, to pick up any other cases that could be
-		 * missed.
+		 * ufs_itimes_locked(), without subsequent UFS_UPDATE().
+		 * Test also all the other timestamp flags too, to pick up
+		 * any other cases that could be missed.
 		 */
 		if ((ip->i_flag & (IN_ACCESS | IN_CHANGE | IN_MODIFIED |
 		    IN_UPDATE)) == 0) {

From owner-svn-src-head@FreeBSD.ORG  Wed Mar 28 14:39:27 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 73E42106566C;
	Wed, 28 Mar 2012 14:39:27 +0000 (UTC)
	(envelope-from yanegomi@gmail.com)
Received: from mail-pb0-f54.google.com (mail-pb0-f54.google.com
	[209.85.160.54])
	by mx1.freebsd.org (Postfix) with ESMTP id 2F1908FC1A;
	Wed, 28 Mar 2012 14:39:26 +0000 (UTC)
Received: by pbcwz17 with SMTP id wz17so2176507pbc.13
	for ; Wed, 28 Mar 2012 07:39:26 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
	h=references:in-reply-to:mime-version:content-transfer-encoding
	:content-type:message-id:cc:x-mailer:from:subject:date:to;
	bh=hsZ62ANVfpQ5H24jpiPHOkNzmElkLzPkFl6YHK/6v80=;
	b=yJ8i6Mf01o8zjtV79XXu0LdZyZPCaY4K0ZsZLNYeewLnUL1YCaOPZMlsFpeSJ+oXLV
	/8J3dpjMlqH+T1L4Injyo26NWUSZ+Yj6RrRiFSWQDRX83I1irOqcUvVttZfl9X3zw692
	toVDL4wN8GNRB9GRP2pZbD9O8R0Am0zqSWwnqrKBfgzpvzWUi1/mcLUa8xrsusDwAnab
	h23IACSHjkK83StDNVo4dQs2RlqBpvzT9rXNOaJq5eZgI9ERl1mIGZPSWFKQCQKMpHVM
	Qoh400Ir4Vh0ToHYV7wCxHldsrBm6IZe7jwLUIYbe8ZKZcemF1XMrTXdOjB+G79jE80v
	HUVA==
Received: by 10.68.225.163 with SMTP id rl3mr8237271pbc.103.1332945566245;
	Wed, 28 Mar 2012 07:39:26 -0700 (PDT)
Received: from [192.168.20.12] (c-24-6-49-154.hsd1.ca.comcast.net.
	[24.6.49.154])
	by mx.google.com with ESMTPS id y9sm2821958pbu.40.2012.03.28.07.39.23
	(version=TLSv1/SSLv3 cipher=OTHER);
	Wed, 28 Mar 2012 07:39:24 -0700 (PDT)
References: <201203281406.q2SE6lu3039438@svn.freebsd.org>
In-Reply-To: <201203281406.q2SE6lu3039438@svn.freebsd.org>
Mime-Version: 1.0 (1.0)
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=us-ascii
Message-Id: <66EEDF11-D07C-4EA0-9B30-CC45C73869AC@gmail.com>
X-Mailer: iPhone Mail (9B176)
From: Garrett Cooper 
Date: Wed, 28 Mar 2012 07:39:21 -0700
To: Konstantin Belousov 
Cc: "svn-src-head@freebsd.org" ,
	"svn-src-all@freebsd.org" ,
	"src-committers@freebsd.org" 
Subject: Re: svn commit: r233609 - head/sys/ufs/ffs
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 28 Mar 2012 14:39:27 -0000

On Mar 28, 2012, at 7:06 AM, Konstantin Belousov  wrote:

> Author: kib
> Date: Wed Mar 28 14:06:47 2012
> New Revision: 233609
> URL: http://svn.freebsd.org/changeset/base/233609
>=20
> Log:
>  Reviewed by:    bde, mckusick
>  Tested by:    pho
>  MFC after:    2 weeks

What does this commit do? Can you run svn propedit --revprop svn:log to fix t=
he commit message?

Thanks,
-Garrett=

From owner-svn-src-head@FreeBSD.ORG  Wed Mar 28 16:23:41 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 73410106566B;
	Wed, 28 Mar 2012 16:23:41 +0000 (UTC)
	(envelope-from fabient@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 5C1618FC0A;
	Wed, 28 Mar 2012 16:23:41 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2SGNfxl044232;
	Wed, 28 Mar 2012 16:23:41 GMT (envelope-from fabient@svn.freebsd.org)
Received: (from fabient@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2SGNfH8044229;
	Wed, 28 Mar 2012 16:23:41 GMT (envelope-from fabient@svn.freebsd.org)
Message-Id: <201203281623.q2SGNfH8044229@svn.freebsd.org>
From: Fabien Thomas 
Date: Wed, 28 Mar 2012 16:23:41 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233611 - head/usr.sbin/pmcstat
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 28 Mar 2012 16:23:41 -0000

Author: fabient
Date: Wed Mar 28 16:23:40 2012
New Revision: 233611
URL: http://svn.freebsd.org/changeset/base/233611

Log:
  - Support inlined location in calltree output.
    In case of multiple level of inlining all the locations are flattened.
    Require recent binutils/addr2line (head works or binutils from ports
    with the right $PATH order).
  - Multiple fixes in the calltree output (recursion case, ...)
  - Fix the calltree top view that previously hide some shared nodes.
  
  Tested with Kcachegrind(kdesdk4)/qcachegrind(head).
  
  Sponsored by: NETASQ

Modified:
  head/usr.sbin/pmcstat/pmcpl_calltree.c
  head/usr.sbin/pmcstat/pmcstat_log.c

Modified: head/usr.sbin/pmcstat/pmcpl_calltree.c
==============================================================================
--- head/usr.sbin/pmcstat/pmcpl_calltree.c	Wed Mar 28 14:16:15 2012	(r233610)
+++ head/usr.sbin/pmcstat/pmcpl_calltree.c	Wed Mar 28 16:23:40 2012	(r233611)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2009, Fabien Thomas
+ * Copyright (c) 2012, Fabien Thomas
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -58,20 +58,18 @@ __FBSDID("$FreeBSD$");
 #include "pmcstat_top.h"
 #include "pmcpl_calltree.h"
 
-#define PMCPL_CT_GROWSIZE	4
-
-static pmcstat_interned_string pmcpl_ct_prevfn;
+#define	PMCPL_CT_GROWSIZE	4
 
 static int pmcstat_skiplink = 0;
 
 struct pmcpl_ct_node;
 
 /* Get the sample value for PMC a. */
-#define PMCPL_CT_SAMPLE(a, b) \
+#define	PMCPL_CT_SAMPLE(a, b) \
 	((a) < (b)->npmcs ? (b)->sb[a] : 0)
 
 /* Get the sample value in percent related to rsamples. */
-#define PMCPL_CT_SAMPLEP(a, b) \
+#define	PMCPL_CT_SAMPLEP(a, b) \
 	(PMCPL_CT_SAMPLE(a, b) * 100.0 / rsamples->sb[a])
 
 struct pmcpl_ct_sample {
@@ -95,10 +93,13 @@ struct pmcpl_ct_instr {
  * Each calltree node is tracked by a pmcpl_ct_node struct.
  */
 struct pmcpl_ct_node {
-#define PMCPL_PCT_TAG	0x00000001	/* Loop detection. */
-	uint32_t		pct_flags;
 	struct pmcstat_image	*pct_image;
 	uintfptr_t		pct_func;
+
+	struct pmcstat_symbol	*pct_sym;
+	pmcstat_interned_string	pct_ifl;
+	pmcstat_interned_string	pct_ifn;
+
 	struct pmcpl_ct_sample	pct_samples;
 
 	int			pct_narc;
@@ -109,17 +110,25 @@ struct pmcpl_ct_node {
 	int			pct_ninstr;
 	int			pct_instr_c;
 	struct pmcpl_ct_instr	*pct_instr;
+
+#define PMCPL_PCT_ADDR	0
+#define PMCPL_PCT_NAME	1
+	char			pct_type;
+#define	PMCPL_PCT_WHITE	0
+#define	PMCPL_PCT_GREY	1
+#define	PMCPL_PCT_BLACK	2
+	char			pct_color;
 };
 
 struct pmcpl_ct_node_hash {
 	struct pmcpl_ct_node  *pch_ctnode;
-	LIST_ENTRY(pmcpl_ct_node_hash) pch_next;
+	STAILQ_ENTRY(pmcpl_ct_node_hash) pch_next;
 };
 
 struct pmcpl_ct_sample pmcpl_ct_callid;
 
-#define PMCPL_CT_MAXCOL		PMC_CALLCHAIN_DEPTH_MAX	
-#define PMCPL_CT_MAXLINE	1024	/* TODO: dynamic. */
+#define	PMCPL_CT_MAXCOL		PMC_CALLCHAIN_DEPTH_MAX
+#define	PMCPL_CT_MAXLINE	1024	/* TODO: dynamic. */
 
 struct pmcpl_ct_line {
 	unsigned	ln_sum;
@@ -127,12 +136,13 @@ struct pmcpl_ct_line {
 };
 
 struct pmcpl_ct_line	pmcpl_ct_topmax[PMCPL_CT_MAXLINE+1];
-struct pmcpl_ct_node	*pmcpl_ct_topscreen[PMCPL_CT_MAXCOL+1][PMCPL_CT_MAXLINE+1];
+struct pmcpl_ct_node
+    *pmcpl_ct_topscreen[PMCPL_CT_MAXCOL+1][PMCPL_CT_MAXLINE+1];
 
 /*
  * All nodes indexed by function/image name are placed in a hash table.
  */
-static LIST_HEAD(,pmcpl_ct_node_hash) pmcpl_ct_node_hash[PMCSTAT_NHASH];
+static STAILQ_HEAD(,pmcpl_ct_node_hash) pmcpl_ct_node_hash[PMCSTAT_NHASH];
 
 /*
  * Root node for the graph.
@@ -256,7 +266,8 @@ pmcpl_ct_instr_grow(int cursize, int *ma
  */
 
 static void
-pmcpl_ct_instr_add(struct pmcpl_ct_node *ct, int pmcin, uintfptr_t pc)
+pmcpl_ct_instr_add(struct pmcpl_ct_node *ct, int pmcin,
+    uintfptr_t pc, unsigned v)
 {
 	int i;
 	struct pmcpl_ct_instr *in;
@@ -265,7 +276,7 @@ pmcpl_ct_instr_add(struct pmcpl_ct_node 
 		if (ct->pct_instr[i].pctf_func == pc) {
 			in = &ct->pct_instr[i];
 			pmcpl_ct_samples_grow(&in->pctf_samples);
-			in->pctf_samples.sb[pmcin]++;
+			in->pctf_samples.sb[pmcin] += v;
 			return;
 		}
 	}
@@ -275,7 +286,7 @@ pmcpl_ct_instr_add(struct pmcpl_ct_node 
 	in->pctf_func = pc;
 	pmcpl_ct_samples_init(&in->pctf_samples);
 	pmcpl_ct_samples_grow(&in->pctf_samples);
-	in->pctf_samples.sb[pmcin] = 1;
+	in->pctf_samples.sb[pmcin] = v;
 	ct->pct_ninstr++;
 }
 
@@ -284,19 +295,19 @@ pmcpl_ct_instr_add(struct pmcpl_ct_node 
  */
 
 static struct pmcpl_ct_node *
-pmcpl_ct_node_allocate(struct pmcstat_image *image, uintfptr_t pc)
+pmcpl_ct_node_allocate(void)
 {
 	struct pmcpl_ct_node *ct;
 
 	if ((ct = malloc(sizeof(*ct))) == NULL)
 		err(EX_OSERR, "ERROR: Cannot allocate callgraph node");
 
-	ct->pct_flags	= 0;
-	ct->pct_image 	= image;
-	ct->pct_func	= pc;
-
 	pmcpl_ct_samples_init(&ct->pct_samples);
 
+	ct->pct_sym	= NULL;
+	ct->pct_image	= NULL;
+	ct->pct_func	= 0;
+
 	ct->pct_narc	= 0;
 	ct->pct_arc_c	= 0;
 	ct->pct_arc	= NULL;
@@ -305,6 +316,8 @@ pmcpl_ct_node_allocate(struct pmcstat_im
 	ct->pct_instr_c	= 0;
 	ct->pct_instr	= NULL;
 
+	ct->pct_color   = PMCPL_PCT_WHITE;
+
 	return (ct);
 }
 
@@ -338,10 +351,10 @@ pmcpl_ct_node_cleartag(void)
 	struct pmcpl_ct_node_hash *pch;
 
 	for (i = 0; i < PMCSTAT_NHASH; i++)
-		LIST_FOREACH(pch, &pmcpl_ct_node_hash[i], pch_next)
-			pch->pch_ctnode->pct_flags &= ~PMCPL_PCT_TAG;
+		STAILQ_FOREACH(pch, &pmcpl_ct_node_hash[i], pch_next)
+			pch->pch_ctnode->pct_color = PMCPL_PCT_WHITE;
 
-	pmcpl_ct_root->pct_flags &= ~PMCPL_PCT_TAG;
+	pmcpl_ct_root->pct_color = PMCPL_PCT_WHITE;
 }
 
 /*
@@ -355,11 +368,9 @@ pmcpl_ct_node_dumptop(int pmcin, struct 
 	int i, terminal;
 	struct pmcpl_ct_arc *arc;
 
-	if (ct->pct_flags & PMCPL_PCT_TAG)
+	if (ct->pct_color == PMCPL_PCT_GREY)
 		return 0;
 
-	ct->pct_flags |= PMCPL_PCT_TAG;
-
 	if (x >= PMCPL_CT_MAXCOL) {
 		pmcpl_ct_topscreen[x][*y] = NULL;
 		return 1;
@@ -374,11 +385,11 @@ pmcpl_ct_node_dumptop(int pmcin, struct 
 	terminal = 1;
 	for (i = 0; i < ct->pct_narc; i++) {
 		arc = &ct->pct_arc[i];
-		if (PMCPL_CT_SAMPLE(pmcin,
+		if (arc->pcta_child->pct_color != PMCPL_PCT_GREY &&
+		    PMCPL_CT_SAMPLE(pmcin,
 		    &arc->pcta_samples) != 0 &&
 		    PMCPL_CT_SAMPLEP(pmcin,
-		    &arc->pcta_samples) > pmcstat_threshold &&
-		    (arc->pcta_child->pct_flags & PMCPL_PCT_TAG) == 0) {
+		    &arc->pcta_samples) > pmcstat_threshold) {
 			terminal = 0;
 			break;
 		}
@@ -395,6 +406,7 @@ pmcpl_ct_node_dumptop(int pmcin, struct 
 		return 0;
 	}
 
+	ct->pct_color = PMCPL_PCT_GREY;
 	for (i = 0; i < ct->pct_narc; i++) {
 		if (PMCPL_CT_SAMPLE(pmcin,
 		    &ct->pct_arc[i].pcta_samples) == 0)
@@ -403,10 +415,13 @@ pmcpl_ct_node_dumptop(int pmcin, struct 
 		    &ct->pct_arc[i].pcta_samples) > pmcstat_threshold) {
 			if (pmcpl_ct_node_dumptop(pmcin,
 			        ct->pct_arc[i].pcta_child,
-			        rsamples, x+1, y))
+			        rsamples, x+1, y)) {
+				ct->pct_color = PMCPL_PCT_BLACK;
 				return 1;
+			}
 		}
 	}
+	ct->pct_color = PMCPL_PCT_BLACK;
 
 	return 0;
 }
@@ -446,7 +461,6 @@ pmcpl_ct_node_printtop(struct pmcpl_ct_s
 	float v;
 	char ns[30], vs[10], is[20];
 	struct pmcpl_ct_node *ct;
-	struct pmcstat_symbol *sym;
 	const char *space = " ";
 
 	/*
@@ -503,10 +517,9 @@ pmcpl_ct_node_printtop(struct pmcpl_ct_s
 				strlcpy(ns, ".", sizeof(ns));
 				ns_len = 1;
 			} else {
-			sym = pmcstat_symbol_search(ct->pct_image, ct->pct_func);
-			if (sym != NULL) {
+			if (ct->pct_sym != NULL) {
 				ns_len = snprintf(ns, sizeof(ns), "%s",
-				    pmcstat_string_unintern(sym->ps_name));
+				    pmcstat_string_unintern(ct->pct_sym->ps_name));
 			} else
 				ns_len = snprintf(ns, sizeof(ns), "%p",
 				    (void *)ct->pct_func);
@@ -547,7 +560,6 @@ pmcpl_ct_topdisplay(void)
 
 	rsamples = &r;
 	pmcpl_ct_samples_root(rsamples);
-
 	pmcpl_ct_node_cleartag();
 
 	PMCSTAT_PRINTW("%5.5s %s\n", "%SAMP", "CALLTREE");
@@ -589,81 +601,92 @@ pmcpl_ct_topkeypress(int c, WINDOW *w)
  * `ppm'.
  */
 
-static struct pmcpl_ct_node *
-pmcpl_ct_node_hash_lookup_pc(struct pmcpl_ct_node *parent,
-    struct pmcstat_pcmap *ppm, uintfptr_t pc, int pmcin)
+static void
+pmcpl_ct_node_update(struct pmcpl_ct_node *parent,
+    struct pmcpl_ct_node *child, int pmcin, unsigned v, int cd)
 {
-	struct pmcstat_symbol *sym;
-	struct pmcstat_image *image;
-	struct pmcpl_ct_node *ct;
-	struct pmcpl_ct_node_hash *h;
 	struct pmcpl_ct_arc *arc;
-	uintfptr_t loadaddress;
 	int i;
-	unsigned int hash;
 
 	assert(parent != NULL);
 
-	image = ppm->ppm_image;
-
-	loadaddress = ppm->ppm_lowpc + image->pi_vaddr - image->pi_start;
-	pc -= loadaddress;	/* Convert to an offset in the image. */
+	/*
+	 * Find related arc in parent node and
+	 * increment the sample count.
+	 */
+	for (i = 0; i < parent->pct_narc; i++) {
+		if (parent->pct_arc[i].pcta_child == child) {
+			arc = &parent->pct_arc[i];
+			pmcpl_ct_samples_grow(&arc->pcta_samples);
+			arc->pcta_samples.sb[pmcin] += v;
+			/* Estimate call count. */
+			if (cd) {
+			pmcpl_ct_samples_grow(&arc->pcta_callid);
+			if (pmcpl_ct_callid.sb[pmcin] -
+			    arc->pcta_callid.sb[pmcin] > 1)
+				arc->pcta_call++;
+			arc->pcta_callid.sb[pmcin] =
+			    pmcpl_ct_callid.sb[pmcin];
+			}
+			return;
+		}
+	}
 
 	/*
-	 * Try determine the function at this offset.  If we can't
-	 * find a function round leave the `pc' value alone.
+	 * No arc found for us, add ourself to the parent.
 	 */
-	if ((sym = pmcstat_symbol_search(image, pc)) != NULL)
-		pc = sym->ps_start;
-	else
-		pmcstat_stats.ps_samples_unknown_function++;
+	pmcpl_ct_arc_grow(parent->pct_narc,
+	    &parent->pct_arc_c, &parent->pct_arc);
+	arc = &parent->pct_arc[parent->pct_narc];
+	pmcpl_ct_samples_grow(&arc->pcta_samples);
+	arc->pcta_samples.sb[pmcin] = v;
+	arc->pcta_call = 1;
+	if (cd) {
+		pmcpl_ct_samples_grow(&arc->pcta_callid);
+		arc->pcta_callid.sb[pmcin] = pmcpl_ct_callid.sb[pmcin];
+	}
+	arc->pcta_child = child;
+	parent->pct_narc++;
+}
+
+/*
+ * Lookup by image/pc.
+ */
+
+static struct pmcpl_ct_node *
+pmcpl_ct_node_hash_lookup(struct pmcstat_image *image, uintfptr_t pc,
+    struct pmcstat_symbol *sym, char *fl, char *fn)
+{
+	int i;
+	unsigned int hash;
+	struct pmcpl_ct_node *ct;
+	struct pmcpl_ct_node_hash *h;
+	pmcstat_interned_string	ifl, ifn;
+
+	if (fn != NULL) {
+		ifl = pmcstat_string_intern(fl);
+		ifn = pmcstat_string_intern(fn);
+	} else {
+		ifl = 0;
+		ifn = 0;
+	}
 
 	for (hash = i = 0; i < (int)sizeof(uintfptr_t); i++)
 		hash += (pc >> i) & 0xFF;
 
 	hash &= PMCSTAT_HASH_MASK;
 
-	ct = NULL;
-	LIST_FOREACH(h, &pmcpl_ct_node_hash[hash], pch_next) {
+	STAILQ_FOREACH(h, &pmcpl_ct_node_hash[hash], pch_next) {
 		ct = h->pch_ctnode;
 
 		assert(ct != NULL);
 
 		if (ct->pct_image == image && ct->pct_func == pc) {
-			/*
-			 * Find related arc in parent node and
-			 * increment the sample count.
-			 */
-			for (i = 0; i < parent->pct_narc; i++) {
-				if (parent->pct_arc[i].pcta_child == ct) {
-					arc = &parent->pct_arc[i];
-					pmcpl_ct_samples_grow(&arc->pcta_samples);
-					arc->pcta_samples.sb[pmcin]++;
-					/* Estimate call count. */
-					pmcpl_ct_samples_grow(&arc->pcta_callid);
-					if (pmcpl_ct_callid.sb[pmcin] -
-					    arc->pcta_callid.sb[pmcin] > 1)
-						arc->pcta_call++;
-					arc->pcta_callid.sb[pmcin] =
-					    pmcpl_ct_callid.sb[pmcin];
-					return (ct);
-				}
-			}
-
-			/*
-			 * No arc found for us, add ourself to the parent.
-			 */
-			pmcpl_ct_arc_grow(parent->pct_narc,
-			    &parent->pct_arc_c, &parent->pct_arc);
-			arc = &parent->pct_arc[parent->pct_narc];
-			pmcpl_ct_samples_grow(&arc->pcta_samples);
-			arc->pcta_samples.sb[pmcin] = 1;
-			arc->pcta_call = 1;
-			pmcpl_ct_samples_grow(&arc->pcta_callid);
-			arc->pcta_callid.sb[pmcin] = pmcpl_ct_callid.sb[pmcin];
-			arc->pcta_child = ct;
-			parent->pct_narc++;
-			return (ct);
+			if (fn == NULL)
+				return (ct);
+			if (ct->pct_type == PMCPL_PCT_NAME &&
+			    ct->pct_ifl == ifl && ct->pct_ifn == ifn)
+				return (ct);
 		}
 	}
 
@@ -671,23 +694,22 @@ pmcpl_ct_node_hash_lookup_pc(struct pmcp
 	 * We haven't seen this (pmcid, pc) tuple yet, so allocate a
 	 * new callgraph node and a new hash table entry for it.
 	 */
-	ct = pmcpl_ct_node_allocate(image, pc);
+	ct = pmcpl_ct_node_allocate();
 	if ((h = malloc(sizeof(*h))) == NULL)
 		err(EX_OSERR, "ERROR: Could not allocate callgraph node");
 
-	h->pch_ctnode = ct;
-	LIST_INSERT_HEAD(&pmcpl_ct_node_hash[hash], h, pch_next);
+	if (fn != NULL) {
+		ct->pct_type = PMCPL_PCT_NAME;
+		ct->pct_ifl = ifl;
+		ct->pct_ifn = ifn;
+	} else
+		ct->pct_type = PMCPL_PCT_ADDR;
+	ct->pct_image = image;
+	ct->pct_func = pc;
+	ct->pct_sym = sym;
 
-	pmcpl_ct_arc_grow(parent->pct_narc,
-	    &parent->pct_arc_c, &parent->pct_arc);
-	arc = &parent->pct_arc[parent->pct_narc];
-	pmcpl_ct_samples_grow(&arc->pcta_samples);
-	arc->pcta_samples.sb[pmcin] = 1;
-	arc->pcta_call = 1;
-	pmcpl_ct_samples_grow(&arc->pcta_callid);
-	arc->pcta_callid.sb[pmcin] = pmcpl_ct_callid.sb[pmcin];
-	arc->pcta_child = ct;
-	parent->pct_narc++;
+	h->pch_ctnode = ct;
+	STAILQ_INSERT_HEAD(&pmcpl_ct_node_hash[hash], h, pch_next);
 	return (ct);
 }
 
@@ -699,10 +721,14 @@ void
 pmcpl_ct_process(struct pmcstat_process *pp, struct pmcstat_pmcrecord *pmcr,
     uint32_t nsamples, uintfptr_t *cc, int usermode, uint32_t cpu)
 {
-	int n, pmcin;
+	int i, n, pmcin;
+	uintfptr_t pc, loadaddress;
+	struct pmcstat_image *image;
+	struct pmcstat_symbol *sym;
 	struct pmcstat_pcmap *ppm[PMC_CALLCHAIN_DEPTH_MAX];
 	struct pmcstat_process *km;
-	struct pmcpl_ct_node *parent, *child;
+	struct pmcpl_ct_node *ct;
+	struct pmcpl_ct_node *ctl[PMC_CALLCHAIN_DEPTH_MAX+1];
 
 	(void) cpu;
 
@@ -741,30 +767,114 @@ pmcpl_ct_process(struct pmcstat_process 
 	pmcpl_ct_callid.sb[pmcin]++;
 
 	/*
-	 * Iterate remaining addresses.
+	 * Build node list.
 	 */
-	for (parent = pmcpl_ct_root, child = NULL; n >= 0; n--) {
-		child = pmcpl_ct_node_hash_lookup_pc(parent, ppm[n], cc[n],
-		    pmcin);
-		if (child == NULL) {
+	ctl[0] = pmcpl_ct_root;
+	for (i = 1; n >= 0; n--) {
+		image = ppm[n]->ppm_image;
+		loadaddress = ppm[n]->ppm_lowpc +
+		    image->pi_vaddr - image->pi_start;
+		/* Convert to an offset in the image. */
+		pc = cc[n] - loadaddress;
+		/*
+		 * Try determine the function at this offset.  If we can't
+		 * find a function round leave the `pc' value alone.
+		 */
+		if ((sym = pmcstat_symbol_search(image, pc)) != NULL)
+			pc = sym->ps_start;
+		else
+			pmcstat_stats.ps_samples_unknown_function++;
+
+		ct = pmcpl_ct_node_hash_lookup(image, pc, sym, NULL, NULL);
+		if (ct == NULL) {
 			pmcstat_stats.ps_callchain_dubious_frames++;
 			continue;
 		}
-		parent = child;
+		ctl[i++] = ct;
 	}
+	/* No valid node found. */
+	if (i == 1)
+		return;
+	n = i;
+
+	ct = ctl[0];
+	for (i = 1; i < n; i++)
+		pmcpl_ct_node_update(ctl[i-1], ctl[i], pmcin, 1, 1);
 
 	/*
 	 * Increment the sample count for this PMC.
 	 */
-	if (child != NULL) {
-		pmcpl_ct_samples_grow(&child->pct_samples);
-		child->pct_samples.sb[pmcin]++;
-
-		/* Update per instruction sample if required. */
-		if (args.pa_ctdumpinstr)
-			pmcpl_ct_instr_add(child, pmcin, cc[0] -
-			    (ppm[0]->ppm_lowpc + ppm[0]->ppm_image->pi_vaddr -
-			     ppm[0]->ppm_image->pi_start));
+	pmcpl_ct_samples_grow(&ctl[n-1]->pct_samples);
+	ctl[n-1]->pct_samples.sb[pmcin]++;
+
+	/* Update per instruction sample if required. */
+	if (args.pa_ctdumpinstr)
+		pmcpl_ct_instr_add(ctl[n-1], pmcin, cc[0] -
+		    (ppm[0]->ppm_lowpc + ppm[0]->ppm_image->pi_vaddr -
+		     ppm[0]->ppm_image->pi_start), 1);
+}
+
+/*
+ * Print node child cost.
+ */
+
+static void
+pmcpl_ct_node_printchild(struct pmcpl_ct_node *ct, uintfptr_t paddr,
+    int pline)
+{
+	int i, j, line;
+	uintfptr_t addr;
+	struct pmcpl_ct_node *child;
+	char sourcefile[PATH_MAX];
+	char funcname[PATH_MAX];
+
+	/*
+	 * Child cost.
+	 * TODO: attach child cost to the real position in the funtion.
+	 * TODO: cfn= / call  addr() / addr(call ) 
+	 */
+	for (i=0 ; ipct_narc; i++) {
+		child = ct->pct_arc[i].pcta_child;
+		/* Object binary. */
+		fprintf(args.pa_graphfile, "cob=%s\n",
+		    pmcstat_string_unintern(child->pct_image->pi_fullpath));
+		/* Child function name. */
+		addr = child->pct_image->pi_vaddr + child->pct_func;
+		line = 0;
+		/* Child function source file. */
+		if (child->pct_type == PMCPL_PCT_NAME) {
+			fprintf(args.pa_graphfile, "cfi=%s\ncfn=%s\n",
+			    pmcstat_string_unintern(child->pct_ifl),
+			    pmcstat_string_unintern(child->pct_ifn));
+		} else if (pmcstat_image_addr2line(child->pct_image, addr,
+		    sourcefile, sizeof(sourcefile), &line,
+		    funcname, sizeof(funcname))) {
+			fprintf(args.pa_graphfile, "cfi=%s\ncfn=%s\n",
+				sourcefile, funcname);
+		} else {
+			if (child->pct_sym != NULL)
+				fprintf(args.pa_graphfile,
+				    "cfi=???\ncfn=%s\n",
+				    pmcstat_string_unintern(
+				        child->pct_sym->ps_name));
+			else
+				fprintf(args.pa_graphfile,
+				    "cfi=???\ncfn=%p\n", (void *)addr);
+		}
+
+		/* Child function address, line and call count. */
+		fprintf(args.pa_graphfile, "calls=%u %p %u\n",
+		    ct->pct_arc[i].pcta_call, (void *)addr, line);
+
+		/*
+		 * Call address, line, sample.
+		 * TODO: Associate call address to the right location.
+		 */
+		fprintf(args.pa_graphfile, "%p %u", (void *)paddr, pline);
+		for (j = 0; jpct_arc[i].pcta_samples));
+		fprintf(args.pa_graphfile, "\n");
 	}
 }
 
@@ -775,40 +885,37 @@ pmcpl_ct_process(struct pmcstat_process 
 static void
 pmcpl_ct_node_printself(struct pmcpl_ct_node *ct)
 {
-	int i, j, line;
-	uintptr_t addr;
-	struct pmcstat_symbol *sym;
+	int i, j, fline, line;
+	uintfptr_t faddr, addr;
 	char sourcefile[PATH_MAX];
 	char funcname[PATH_MAX];
 
 	/*
 	 * Object binary.
 	 */
-#ifdef PMCPL_CT_OPTIMIZEFN
-	if (pmcpl_ct_prevfn != ct->pct_image->pi_fullpath) {
-#endif
-		pmcpl_ct_prevfn = ct->pct_image->pi_fullpath;
-		fprintf(args.pa_graphfile, "ob=%s\n",
-		    pmcstat_string_unintern(pmcpl_ct_prevfn));
-#ifdef PMCPL_CT_OPTIMIZEFN
-	}
-#endif
+	fprintf(args.pa_graphfile, "ob=%s\n",
+	    pmcstat_string_unintern(ct->pct_image->pi_fullpath));
 
 	/*
 	 * Function name.
 	 */
-	if (pmcstat_image_addr2line(ct->pct_image, ct->pct_func,
-	    sourcefile, sizeof(sourcefile), &line,
+	faddr = ct->pct_image->pi_vaddr + ct->pct_func;
+	fline = 0;
+	if (ct->pct_type == PMCPL_PCT_NAME) {
+		fprintf(args.pa_graphfile, "fl=%s\nfn=%s\n",
+		    pmcstat_string_unintern(ct->pct_ifl),
+		    pmcstat_string_unintern(ct->pct_ifn));
+	} else if (pmcstat_image_addr2line(ct->pct_image, faddr,
+	    sourcefile, sizeof(sourcefile), &fline,
 	    funcname, sizeof(funcname))) {
-		fprintf(args.pa_graphfile, "fn=%s\n",
-		    funcname);
+		fprintf(args.pa_graphfile, "fl=%s\nfn=%s\n",
+		    sourcefile, funcname);
 	} else {
-		sym = pmcstat_symbol_search(ct->pct_image, ct->pct_func);
-		if (sym != NULL)
-			fprintf(args.pa_graphfile, "fn=%s\n",
-			    pmcstat_string_unintern(sym->ps_name));
+		if (ct->pct_sym != NULL)
+			fprintf(args.pa_graphfile, "fl=???\nfn=%s\n",
+			    pmcstat_string_unintern(ct->pct_sym->ps_name));
 		else
-			fprintf(args.pa_graphfile, "fn=%p\n",
+			fprintf(args.pa_graphfile, "fl=???\nfn=%p\n",
 			    (void *)(ct->pct_image->pi_vaddr + ct->pct_func));
 	}
 
@@ -816,15 +923,18 @@ pmcpl_ct_node_printself(struct pmcpl_ct_
 	 * Self cost.
 	 */
 	if (ct->pct_ninstr > 0) {
+		/*
+		 * Per location cost.
+		 */
 		for (i = 0; i < ct->pct_ninstr; i++) {
 			addr = ct->pct_image->pi_vaddr +
 			    ct->pct_instr[i].pctf_func;
 			line = 0;
-			if (pmcstat_image_addr2line(ct->pct_image, addr,
+			pmcstat_image_addr2line(ct->pct_image, addr,
 			    sourcefile, sizeof(sourcefile), &line,
-			    funcname, sizeof(funcname)))
-				fprintf(args.pa_graphfile, "fl=%s\n", sourcefile);
-			fprintf(args.pa_graphfile, "%p %u", (void *)addr, line);
+			    funcname, sizeof(funcname));
+			fprintf(args.pa_graphfile, "%p %u",
+			    (void *)addr, line);
 			for (j = 0; jpct_image->pi_vaddr + ct->pct_func;
-		line = 0;
-		if (pmcstat_image_addr2line(ct->pct_image, addr,
-		    sourcefile, sizeof(sourcefile), &line,
-		    funcname, sizeof(funcname)))
-			fprintf(args.pa_graphfile, "fl=%s\n", sourcefile);
-		fprintf(args.pa_graphfile, "* *");
+		/* Global cost function cost. */
+		fprintf(args.pa_graphfile, "%p %u", (void *)faddr, fline);
 		for (i = 0; ipct_samples));
 		fprintf(args.pa_graphfile, "\n");
 	}
+
+	pmcpl_ct_node_printchild(ct, faddr, fline);
+}
+
+static void
+pmcpl_ct_printnode(struct pmcpl_ct_node *ct)
+{
+	int i;
+
+	if (ct == pmcpl_ct_root) {
+		fprintf(args.pa_graphfile, "fn=root\n");
+		fprintf(args.pa_graphfile, "0x0 1");
+		for (i = 0; ipch_ctnode = ct;
+	STAILQ_INSERT_TAIL(&q, pch, pch_next);
+	ct->pct_color = PMCPL_PCT_BLACK;
+
+	while (!STAILQ_EMPTY(&q)) {
+		pch = STAILQ_FIRST(&q);
+		STAILQ_REMOVE_HEAD(&q, pch_next);
+		pmcpl_ct_printnode(pch->pch_ctnode);
+		for (i = 0; ipch_ctnode->pct_narc; i++) {
+			child = pch->pch_ctnode->pct_arc[i].pcta_child;
+			if (child->pct_color == PMCPL_PCT_WHITE) {
+				child->pct_color = PMCPL_PCT_BLACK;
+				if ((pchc = malloc(sizeof(*pchc))) == NULL)
+					err(EX_OSERR,
+					    "ERROR: Cannot allocate queue");
+				pchc->pch_ctnode = child;
+				STAILQ_INSERT_TAIL(&q, pchc, pch_next);
+			}
+		}
+		free(pch);
+	}
+}
+
+/*
+ * Detect and fix inlined location.
+ */
+
+static void
+_pmcpl_ct_expand_inline(struct pmcpl_ct_node *ct)
+{
+	int i, j;
+	unsigned fline, line, v;
+	uintfptr_t faddr, addr, pc;
 	char sourcefile[PATH_MAX];
-	char funcname[PATH_MAX];
+	char ffuncname[PATH_MAX], funcname[PATH_MAX];
+	char buffer[PATH_MAX];
+	struct pmcpl_ct_node *child;
 
 	/*
-	 * Child cost.
-	 * TODO: attach child cost to the real position in the function.
-	 * TODO: cfn= / call  addr() / addr(call ) 
+	 * Resolve parent and compare to each instr location.
 	 */
-	for (i=0 ; ipct_narc; i++) {
-		child = ct->pct_arc[i].pcta_child;
+	faddr = ct->pct_image->pi_vaddr + ct->pct_func;
+	fline = 0;
+	if (!pmcstat_image_addr2line(ct->pct_image, faddr,
+	    sourcefile, sizeof(sourcefile), &fline,
+	    ffuncname, sizeof(ffuncname)))
+		return;
 
-		/* Object binary. */
-#ifdef PMCPL_CT_OPTIMIZEFN
-		if (pmcpl_ct_prevfn != child->pct_image->pi_fullpath) {
-#endif
-			pmcpl_ct_prevfn = child->pct_image->pi_fullpath;
-			fprintf(args.pa_graphfile, "cob=%s\n",
-			    pmcstat_string_unintern(pmcpl_ct_prevfn));
-#if PMCPL_CT_OPTIMIZEFN
-		}
-#endif
-		/* Child function name. */
-		addr = child->pct_image->pi_vaddr + child->pct_func;
-		/* Child function source file. */
-		if (pmcstat_image_addr2line(child->pct_image, addr,
+	for (i = 0; i < ct->pct_ninstr; i++) {
+		addr = ct->pct_image->pi_vaddr +
+		    ct->pct_instr[i].pctf_func;
+		line = 0;
+		if (!pmcstat_image_addr2line(ct->pct_image, addr,
 		    sourcefile, sizeof(sourcefile), &line,
-		    funcname, sizeof(funcname))) {
-			fprintf(args.pa_graphfile, "cfn=%s\n", funcname);
-			fprintf(args.pa_graphfile, "cfl=%s\n", sourcefile);
-		} else {
-			sym = pmcstat_symbol_search(child->pct_image,
-			    child->pct_func);
-			if (sym != NULL)
-				fprintf(args.pa_graphfile, "cfn=%s\n",
-				    pmcstat_string_unintern(sym->ps_name));
-			else
-				fprintf(args.pa_graphfile, "cfn=%p\n", (void *)addr);
-		}
+		    funcname, sizeof(funcname)))
+			continue;
 
-		/* Child function address, line and call count. */
-		fprintf(args.pa_graphfile, "calls=%u %p %u\n",
-		    ct->pct_arc[i].pcta_call, (void *)addr, line);
+		if (strcmp(funcname, ffuncname) == 0)
+			continue;
 
-		if (ct->pct_image != NULL) {
-			/* Call address, line, sample. */
-			addr = ct->pct_image->pi_vaddr + ct->pct_func;
-			line = 0;
-			if (pmcstat_image_addr2line(ct->pct_image, addr, sourcefile,
-			    sizeof(sourcefile), &line,
-			    funcname, sizeof(funcname)))
-				fprintf(args.pa_graphfile, "%p %u", (void *)addr, line);
-			else
-				fprintf(args.pa_graphfile, "* *");
+		/*
+		 * - Lookup/create inline node by function name.
+		 * - Move instr PMCs to the inline node.
+		 * - Link nodes.
+		 * The lookup create a specific node per image/pc.
+		 */
+		if (args.pa_verbosity >= 2)
+			fprintf(args.pa_printfile,
+			    "WARNING: inlined function at %p %s in %s\n",
+			    (void *)addr, funcname, ffuncname);
+
+		snprintf(buffer, sizeof(buffer), "%s@%s",
+			funcname, ffuncname);
+		child = pmcpl_ct_node_hash_lookup(ct->pct_image,
+		    ct->pct_func, ct->pct_sym, sourcefile, buffer);
+		assert(child != NULL);
+		pc = ct->pct_instr[i].pctf_func;
+		for (j = 0; jpct_instr[i].pctf_samples);
+			if (v == 0)
+				continue;
+			pmcpl_ct_instr_add(child, j, pc, v);
+			pmcpl_ct_node_update(ct, child, j, v, 0);
+			if (j < ct->pct_samples.npmcs)
+				ct->pct_samples.sb[j] -=
+				    ct->pct_instr[i].pctf_samples.sb[j];
+			ct->pct_instr[i].pctf_samples.sb[j] = 0;
 		}
-		else
-			fprintf(args.pa_graphfile, "* *");
-		for (j = 0; jpct_arc[i].pcta_samples));
-		fprintf(args.pa_graphfile, "\n");
 	}
 }
 
+static void
+pmcpl_ct_expand_inline(void)
+{
+	int i;
+	struct pmcpl_ct_node_hash *pch;
+
+	if (!args.pa_ctdumpinstr)
+		return;
+
+	for (i = 0; i < PMCSTAT_NHASH; i++)
+		STAILQ_FOREACH(pch, &pmcpl_ct_node_hash[i], pch_next)
+			if (pch->pch_ctnode->pct_type == PMCPL_PCT_ADDR)
+				_pmcpl_ct_expand_inline(pch->pch_ctnode);
+}
+
 /*
  * Clean the PMC name for Kcachegrind formula
  */
@@ -941,13 +1112,12 @@ pmcpl_ct_fixup_pmcname(char *s)
 static void
 pmcpl_ct_print(void)
 {
-	int n, i;
-	struct pmcpl_ct_node_hash *pch;
-	struct pmcpl_ct_sample rsamples;
+	int i;
 	char name[40];
+	struct pmcpl_ct_sample rsamples;
 
 	pmcpl_ct_samples_root(&rsamples);
-	pmcpl_ct_prevfn = NULL;
+	pmcpl_ct_expand_inline();
 
 	fprintf(args.pa_graphfile,
 		"version: 1\n"
@@ -964,25 +1134,8 @@ pmcpl_ct_print(void)
 	for (i=0; ipch_ctnode);
-			pmcpl_ct_node_printchild(pch->pch_ctnode);
-	}
-
+	pmcpl_ct_bfs(pmcpl_ct_root);
 	pmcpl_ct_samples_free(&rsamples);
 }
 
@@ -1003,11 +1156,10 @@ pmcpl_ct_init(void)
 {
 	int i;
 
-	pmcpl_ct_prevfn = NULL;
-	pmcpl_ct_root = pmcpl_ct_node_allocate(NULL, 0);
+	pmcpl_ct_root = pmcpl_ct_node_allocate();
 
 	for (i = 0; i < PMCSTAT_NHASH; i++)
-		LIST_INIT(&pmcpl_ct_node_hash[i]);
+		STAILQ_INIT(&pmcpl_ct_node_hash[i]);
 
 	pmcpl_ct_samples_init(&pmcpl_ct_callid);
 
@@ -1030,7 +1182,7 @@ pmcpl_ct_shutdown(FILE *mf)
 	 */
 
 	for (i = 0; i < PMCSTAT_NHASH; i++) {
-		LIST_FOREACH_SAFE(pch, &pmcpl_ct_node_hash[i], pch_next,
+		STAILQ_FOREACH_SAFE(pch, &pmcpl_ct_node_hash[i], pch_next,
 		    pchtmp) {
 			pmcpl_ct_node_free(pch->pch_ctnode);
 			free(pch);

Modified: head/usr.sbin/pmcstat/pmcstat_log.c
==============================================================================
--- head/usr.sbin/pmcstat/pmcstat_log.c	Wed Mar 28 14:16:15 2012	(r233610)
+++ head/usr.sbin/pmcstat/pmcstat_log.c	Wed Mar 28 16:23:40 2012	(r233611)
@@ -429,7 +429,9 @@ pmcstat_image_get_aout_params(struct pmc
 
 	if ((fd = open(buffer, O_RDONLY, 0)) < 0 ||
 	    (nbytes = read(fd, &ex, sizeof(ex))) < 0) {
-		warn("WARNING: Cannot determine type of \"%s\"", path);
+		if (args.pa_verbosity >= 2)
+			warn("WARNING: Cannot determine type of \"%s\"",
+			    path);
 		image->pi_type = PMCSTAT_IMAGE_INDETERMINABLE;
 		if (fd != -1)
 			(void) close(fd);
@@ -639,8 +641,9 @@ pmcstat_image_get_elf_params(struct pmcs
 	if ((fd = open(buffer, O_RDONLY, 0)) < 0 ||
 	    (e = elf_begin(fd, ELF_C_READ, NULL)) == NULL ||
 	    (elf_kind(e) != ELF_K_ELF)) {
-		warnx("WARNING: Cannot determine the type of \"%s\".",
-		    buffer);
+		if (args.pa_verbosity >= 2)
+			warnx("WARNING: Cannot determine the type of \"%s\".",
+			    buffer);
 		goto done;
 	}
 
@@ -946,6 +949,7 @@ pmcstat_image_addr2line(struct pmcstat_i
     char *funcname, size_t funcname_len)
 {
 	static int addr2line_warn = 0;
+	unsigned l;
 
 	char *sep, cmdline[PATH_MAX], imagepath[PATH_MAX];
 	int fd;
@@ -961,6 +965,11 @@ pmcstat_image_addr2line(struct pmcstat_i
 			    pmcstat_string_unintern(image->pi_fullpath));
 		} else
 			close(fd);
+		/*
+		 * New addr2line support recursive inline function with -i
+		 * but the format does not add a marker when no more entries
+		 * are available.
+		 */
 		snprintf(cmdline, sizeof(cmdline), "addr2line -Cfe \"%s\"",
 		    imagepath);
 		image->pi_addr2line = popen(cmdline, "r+");
@@ -1002,10 +1011,10 @@ pmcstat_image_addr2line(struct pmcstat_i
 		return (0);
 	}
 	*sep = '\0';
-	*sourceline = atoi(sep+1);
-	if (*sourceline == 0)

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***

From owner-svn-src-head@FreeBSD.ORG  Wed Mar 28 16:32:18 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 25AE8106564A;
	Wed, 28 Mar 2012 16:32:18 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 109108FC0A;
	Wed, 28 Mar 2012 16:32:18 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2SGWHj3044576;
	Wed, 28 Mar 2012 16:32:17 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2SGWH4h044574;
	Wed, 28 Mar 2012 16:32:17 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <201203281632.q2SGWH4h044574@svn.freebsd.org>
From: John Baldwin 
Date: Wed, 28 Mar 2012 16:32:17 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233613 - head/sys/x86/include
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 28 Mar 2012 16:32:18 -0000

Author: jhb
Date: Wed Mar 28 16:32:17 2012
New Revision: 233613
URL: http://svn.freebsd.org/changeset/base/233613

Log:
  Move the DTrace return IDT vector back up from 0x20 to 0x92.  The 0x20
  vector is currently dedicated to servicing IRQ 0 from the 8259A's, so
  it shouldn't be overloaded for DTrace.
  
  Tested by:	rstone
  MFC after:	1 week

Modified:
  head/sys/x86/include/segments.h

Modified: head/sys/x86/include/segments.h
==============================================================================
--- head/sys/x86/include/segments.h	Wed Mar 28 16:32:15 2012	(r233612)
+++ head/sys/x86/include/segments.h	Wed Mar 28 16:32:17 2012	(r233613)
@@ -215,8 +215,8 @@ union descriptor {
 #define	IDT_MC		18	/* #MC: Machine Check */
 #define	IDT_XF		19	/* #XF: SIMD Floating-Point Exception */
 #define	IDT_IO_INTS	NRSVIDT	/* Base of IDT entries for I/O interrupts. */
-#define	IDT_DTRACE_RET	0x20	/* DTrace pid provider Interrupt Vector */
 #define	IDT_SYSCALL	0x80	/* System Call Interrupt Vector */
+#define	IDT_DTRACE_RET	0x92	/* DTrace pid provider Interrupt Vector */
 
 #if defined(__i386__) || defined(__ia64__)
 /*

From owner-svn-src-head@FreeBSD.ORG  Wed Mar 28 17:21:37 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 64390106564A;
	Wed, 28 Mar 2012 17:21:37 +0000 (UTC)
	(envelope-from rysto32@gmail.com)
Received: from mail-wg0-f50.google.com (mail-wg0-f50.google.com [74.125.82.50])
	by mx1.freebsd.org (Postfix) with ESMTP id 766E58FC0A;
	Wed, 28 Mar 2012 17:21:36 +0000 (UTC)
Received: by wgbds12 with SMTP id ds12so1156490wgb.31
	for ; Wed, 28 Mar 2012 10:21:35 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
	h=mime-version:in-reply-to:references:date:message-id:subject:from:to
	:cc:content-type:content-transfer-encoding;
	bh=r7ITcT70u4163+SMU1Ok3rE575By0DLSOWebieu9bCE=;
	b=o6egFRTIqHZVVLECGx1tqRDqoLeeVHpKy+yY1uuQ5ImT80RdMq8YuOI0t4YxMFptEq
	wWQsrO1a4QLRZxkfvIYTyPs7UYz8Sm5od2q+z4zjmLCjUU4Y5cwGGk0HOHTdiqb+pcLH
	ecrS5b8XeM8mXoeNp9bCwQNi2aTyk7W54mZzXuIiL94VsmmTTg2p8jAMnUFHfUZhZoAR
	AU8gnNnRex1bsHkqLF3ny+ZYE1svhx5ILvPH1XQxmn7rYuCIqZ3whj0eCNztNvrXEK7a
	uP/+DA8vmSGPabqggV98ACSTSbXtw0Ln4bZFuWdGxzHlh+Smq/F9uBcxDfz2BnmJJn7B
	7tZQ==
MIME-Version: 1.0
Received: by 10.180.81.37 with SMTP id w5mr8913504wix.16.1332955295228; Wed,
	28 Mar 2012 10:21:35 -0700 (PDT)
Received: by 10.180.79.137 with HTTP; Wed, 28 Mar 2012 10:21:35 -0700 (PDT)
In-Reply-To: <20120328002756.0000118e@unknown>
References: <201203271507.q2RF7hO2091110@svn.freebsd.org>
	<20120328002756.0000118e@unknown>
Date: Wed, 28 Mar 2012 13:21:35 -0400
Message-ID: 
From: Ryan Stone 
To: Alexander Leidinger 
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Cc: svn-src-head@freebsd.org, Ryan Stone ,
	src-committers@freebsd.org, svn-src-all@freebsd.org
Subject: Re: svn commit: r233552 - in head/sys: cddl/dev/sdt kern sys
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 28 Mar 2012 17:21:37 -0000

On Tue, Mar 27, 2012 at 6:27 PM, Alexander Leidinger
 wrote:
> Great!
> Is this automatic, or do I need to do something in the newly loaded KLD?

Nothing special. You can follow exactly the same set of steps as for
adding probes to the kernel itself:
http://wiki.freebsd.org/DTrace/HowToAddSDTProbes

>> =A0 This makes it possible to create SDT probes in KLD modules,
>> although there are still two caveats: first, any SDT probes in a KLD
>> module must be part of a DTrace provider that is defined in that
>> module.
>
> To make sure I understand it correctly:
> If I have the provider "linuxulator", all probes for this provider
> need to be within the KLD. No other KLD is allowed to reference this
> provider. To stay with the linuxulator example: if a module which
> depends upon linux.ko wants to have some SDT probes, it has to use a
> different provider.

Exactly correct.

From owner-svn-src-head@FreeBSD.ORG  Wed Mar 28 17:21:59 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id B52B41065673;
	Wed, 28 Mar 2012 17:21:59 +0000 (UTC)
	(envelope-from jkim@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 9EFFE8FC16;
	Wed, 28 Mar 2012 17:21:59 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2SHLx8H046680;
	Wed, 28 Mar 2012 17:21:59 GMT (envelope-from jkim@svn.freebsd.org)
Received: (from jkim@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2SHLxLo046675;
	Wed, 28 Mar 2012 17:21:59 GMT (envelope-from jkim@svn.freebsd.org)
Message-Id: <201203281721.q2SHLxLo046675@svn.freebsd.org>
From: Jung-uk Kim 
Date: Wed, 28 Mar 2012 17:21:59 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233617 - in head/sys/contrib/dev/acpica:
	components/namespace include
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 28 Mar 2012 17:21:59 -0000

Author: jkim
Date: Wed Mar 28 17:21:59 2012
New Revision: 233617
URL: http://svn.freebsd.org/changeset/base/233617

Log:
  MFV:	r233615
  
  Revert r233555 and apply a fix for the reference counting regressions.
  
  Tested by:	andreast, lme, nwhitehorn,
  		Sevan / Venture37 (venture37 at gmail dot com)
  Submitted by:	Robert Moore (robert dot moore at intel dot com)

Modified:
  head/sys/contrib/dev/acpica/components/namespace/nspredef.c
  head/sys/contrib/dev/acpica/components/namespace/nsrepair.c
  head/sys/contrib/dev/acpica/include/aclocal.h
  head/sys/contrib/dev/acpica/include/acnamesp.h
Directory Properties:
  head/sys/contrib/dev/acpica/   (props changed)
  head/sys/contrib/dev/acpica/components/namespace/   (props changed)
  head/sys/contrib/dev/acpica/include/   (props changed)

Modified: head/sys/contrib/dev/acpica/components/namespace/nspredef.c
==============================================================================
--- head/sys/contrib/dev/acpica/components/namespace/nspredef.c	Wed Mar 28 16:54:22 2012	(r233616)
+++ head/sys/contrib/dev/acpica/components/namespace/nspredef.c	Wed Mar 28 17:21:59 2012	(r233617)
@@ -681,7 +681,7 @@ AcpiNsCheckPackage (
         {
             /* Create the new outer package and populate it */
 
-            Status = AcpiNsRepairPackageList (Data, ReturnObjectPtr);
+            Status = AcpiNsWrapWithPackage (Data, *Elements, ReturnObjectPtr);
             if (ACPI_FAILURE (Status))
             {
                 return (Status);

Modified: head/sys/contrib/dev/acpica/components/namespace/nsrepair.c
==============================================================================
--- head/sys/contrib/dev/acpica/components/namespace/nsrepair.c	Wed Mar 28 16:54:22 2012	(r233616)
+++ head/sys/contrib/dev/acpica/components/namespace/nsrepair.c	Wed Mar 28 17:21:59 2012	(r233617)
@@ -74,11 +74,10 @@
  * Buffer  -> String
  * Buffer  -> Package of Integers
  * Package -> Package of one Package
+ * An incorrect standalone object is wrapped with required outer package
  *
  * Additional possible repairs:
- *
  * Required package elements that are NULL replaced by Integer/String/Buffer
- * Incorrect standalone package wrapped with required outer package
  *
  ******************************************************************************/
 
@@ -100,11 +99,6 @@ AcpiNsConvertToBuffer (
     ACPI_OPERAND_OBJECT     *OriginalObject,
     ACPI_OPERAND_OBJECT     **ReturnObject);
 
-static ACPI_STATUS
-AcpiNsConvertToPackage (
-    ACPI_OPERAND_OBJECT     *OriginalObject,
-    ACPI_OPERAND_OBJECT     **ReturnObject);
-
 
 /*******************************************************************************
  *
@@ -172,10 +166,24 @@ AcpiNsRepairObject (
     }
     if (ExpectedBtypes & ACPI_RTYPE_PACKAGE)
     {
-        Status = AcpiNsConvertToPackage (ReturnObject, &NewObject);
+        /*
+         * A package is expected. We will wrap the existing object with a
+         * new package object. It is often the case that if a variable-length
+         * package is required, but there is only a single object needed, the
+         * BIOS will return that object instead of wrapping it with a Package
+         * object. Note: after the wrapping, the package will be validated
+         * for correct contents (expected object type or types).
+         */
+        Status = AcpiNsWrapWithPackage (Data, ReturnObject, &NewObject);
         if (ACPI_SUCCESS (Status))
         {
-            goto ObjectRepaired;
+            /*
+             * The original object just had its reference count
+             * incremented for being inserted into the new package.
+             */
+            *ReturnObjectPtr = NewObject;       /* New Package object */
+            Data->Flags |= ACPI_OBJECT_REPAIRED;
+            return (AE_OK);
         }
     }
 
@@ -188,24 +196,30 @@ ObjectRepaired:
 
     /* Object was successfully repaired */
 
-    /*
-     * If the original object is a package element, we need to:
-     * 1. Set the reference count of the new object to match the
-     *    reference count of the old object.
-     * 2. Decrement the reference count of the original object.
-     */
     if (PackageIndex != ACPI_NOT_PACKAGE_ELEMENT)
     {
-        NewObject->Common.ReferenceCount =
-            ReturnObject->Common.ReferenceCount;
-
-        if (ReturnObject->Common.ReferenceCount > 1)
+        /*
+         * The original object is a package element. We need to
+         * decrement the reference count of the original object,
+         * for removing it from the package.
+         *
+         * However, if the original object was just wrapped with a
+         * package object as part of the repair, we don't need to
+         * change the reference count.
+         */
+        if (!(Data->Flags & ACPI_OBJECT_WRAPPED))
         {
-            ReturnObject->Common.ReferenceCount--;
+            NewObject->Common.ReferenceCount =
+                ReturnObject->Common.ReferenceCount;
+
+            if (ReturnObject->Common.ReferenceCount > 1)
+            {
+                ReturnObject->Common.ReferenceCount--;
+            }
         }
 
         ACPI_DEBUG_PRINT ((ACPI_DB_REPAIR,
-            "%s: Converted %s to expected %s at index %u\n",
+            "%s: Converted %s to expected %s at Package index %u\n",
             Data->Pathname, AcpiUtGetObjectTypeName (ReturnObject),
             AcpiUtGetObjectTypeName (NewObject), PackageIndex));
     }
@@ -498,71 +512,6 @@ AcpiNsConvertToBuffer (
 
 /*******************************************************************************
  *
- * FUNCTION:    AcpiNsConvertToPackage
- *
- * PARAMETERS:  OriginalObject      - Object to be converted
- *              ReturnObject        - Where the new converted object is returned
- *
- * RETURN:      Status. AE_OK if conversion was successful.
- *
- * DESCRIPTION: Attempt to convert a Buffer object to a Package. Each byte of
- *              the buffer is converted to a single integer package element.
- *
- ******************************************************************************/
-
-static ACPI_STATUS
-AcpiNsConvertToPackage (
-    ACPI_OPERAND_OBJECT     *OriginalObject,
-    ACPI_OPERAND_OBJECT     **ReturnObject)
-{
-    ACPI_OPERAND_OBJECT     *NewObject;
-    ACPI_OPERAND_OBJECT     **Elements;
-    UINT32                  Length;
-    UINT8                   *Buffer;
-
-
-    switch (OriginalObject->Common.Type)
-    {
-    case ACPI_TYPE_BUFFER:
-
-        /* Buffer-to-Package conversion */
-
-        Length = OriginalObject->Buffer.Length;
-        NewObject = AcpiUtCreatePackageObject (Length);
-        if (!NewObject)
-        {
-            return (AE_NO_MEMORY);
-        }
-
-        /* Convert each buffer byte to an integer package element */
-
-        Elements = NewObject->Package.Elements;
-        Buffer = OriginalObject->Buffer.Pointer;
-
-        while (Length--)
-        {
-            *Elements = AcpiUtCreateIntegerObject ((UINT64) *Buffer);
-            if (!*Elements)
-            {
-                AcpiUtRemoveReference (NewObject);
-                return (AE_NO_MEMORY);
-            }
-            Elements++;
-            Buffer++;
-        }
-        break;
-
-    default:
-        return (AE_AML_OPERAND_TYPE);
-    }
-
-    *ReturnObject = NewObject;
-    return (AE_OK);
-}
-
-
-/*******************************************************************************
- *
  * FUNCTION:    AcpiNsRepairNullElement
  *
  * PARAMETERS:  Data                - Pointer to validation data structure
@@ -745,42 +694,43 @@ AcpiNsRemoveNullElements (
 
 /*******************************************************************************
  *
- * FUNCTION:    AcpiNsRepairPackageList
+ * FUNCTION:    AcpiNsWrapWithPackage
  *
  * PARAMETERS:  Data                - Pointer to validation data structure
- *              ObjDescPtr          - Pointer to the object to repair. The new
- *                                    package object is returned here,
- *                                    overwriting the old object.
+ *              OriginalObject      - Pointer to the object to repair.
+ *              ObjDescPtr          - The new package object is returned here
  *
  * RETURN:      Status, new object in *ObjDescPtr
  *
- * DESCRIPTION: Repair a common problem with objects that are defined to return
- *              a variable-length Package of Packages. If the variable-length
- *              is one, some BIOS code mistakenly simply declares a single
- *              Package instead of a Package with one sub-Package. This
- *              function attempts to repair this error by wrapping a Package
- *              object around the original Package, creating the correct
- *              Package with one sub-Package.
+ * DESCRIPTION: Repair a common problem with objects that are defined to
+ *              return a variable-length Package of sub-objects. If there is
+ *              only one sub-object, some BIOS code mistakenly simply declares
+ *              the single object instead of a Package with one sub-object.
+ *              This function attempts to repair this error by wrapping a
+ *              Package object around the original object, creating the
+ *              correct and expected Package with one sub-object.
  *
  *              Names that can be repaired in this manner include:
- *              _ALR, _CSD, _HPX, _MLS, _PRT, _PSS, _TRT, TSS
+ *              _ALR, _CSD, _HPX, _MLS, _PLD, _PRT, _PSS, _TRT, _TSS,
+ *              _BCL, _DOD, _FIX, _Sx
  *
  ******************************************************************************/
 
 ACPI_STATUS
-AcpiNsRepairPackageList (
+AcpiNsWrapWithPackage (
     ACPI_PREDEFINED_DATA    *Data,
+    ACPI_OPERAND_OBJECT     *OriginalObject,
     ACPI_OPERAND_OBJECT     **ObjDescPtr)
 {
     ACPI_OPERAND_OBJECT     *PkgObjDesc;
 
 
-    ACPI_FUNCTION_NAME (NsRepairPackageList);
+    ACPI_FUNCTION_NAME (NsWrapWithPackage);
 
 
     /*
      * Create the new outer package and populate it. The new package will
-     * have a single element, the lone subpackage.
+     * have a single element, the lone sub-object.
      */
     PkgObjDesc = AcpiUtCreatePackageObject (1);
     if (!PkgObjDesc)
@@ -788,15 +738,15 @@ AcpiNsRepairPackageList (
         return (AE_NO_MEMORY);
     }
 
-    PkgObjDesc->Package.Elements[0] = *ObjDescPtr;
+    PkgObjDesc->Package.Elements[0] = OriginalObject;
+
+    ACPI_DEBUG_PRINT ((ACPI_DB_REPAIR,
+        "%s: Wrapped %s with expected Package object\n",
+        Data->Pathname, AcpiUtGetObjectTypeName (OriginalObject)));
 
     /* Return the new object in the object pointer */
 
     *ObjDescPtr = PkgObjDesc;
-    Data->Flags |= ACPI_OBJECT_REPAIRED;
-
-    ACPI_DEBUG_PRINT ((ACPI_DB_REPAIR,
-        "%s: Repaired incorrectly formed Package\n", Data->Pathname));
-
+    Data->Flags |= ACPI_OBJECT_REPAIRED | ACPI_OBJECT_WRAPPED;
     return (AE_OK);
 }

Modified: head/sys/contrib/dev/acpica/include/aclocal.h
==============================================================================
--- head/sys/contrib/dev/acpica/include/aclocal.h	Wed Mar 28 16:54:22 2012	(r233616)
+++ head/sys/contrib/dev/acpica/include/aclocal.h	Wed Mar 28 17:21:59 2012	(r233617)
@@ -424,6 +424,7 @@ typedef struct acpi_predefined_data
 /* Defines for Flags field above */
 
 #define ACPI_OBJECT_REPAIRED    1
+#define ACPI_OBJECT_WRAPPED     2
 
 
 /*

Modified: head/sys/contrib/dev/acpica/include/acnamesp.h
==============================================================================
--- head/sys/contrib/dev/acpica/include/acnamesp.h	Wed Mar 28 16:54:22 2012	(r233616)
+++ head/sys/contrib/dev/acpica/include/acnamesp.h	Wed Mar 28 17:21:59 2012	(r233617)
@@ -368,8 +368,9 @@ AcpiNsRepairObject (
     ACPI_OPERAND_OBJECT     **ReturnObjectPtr);
 
 ACPI_STATUS
-AcpiNsRepairPackageList (
+AcpiNsWrapWithPackage (
     ACPI_PREDEFINED_DATA    *Data,
+    ACPI_OPERAND_OBJECT     *OriginalObject,
     ACPI_OPERAND_OBJECT     **ObjDescPtr);
 
 ACPI_STATUS

From owner-svn-src-head@FreeBSD.ORG  Wed Mar 28 17:25:29 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id D1261106564A;
	Wed, 28 Mar 2012 17:25:29 +0000 (UTC)
	(envelope-from nwhitehorn@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id BB1268FC0A;
	Wed, 28 Mar 2012 17:25:29 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2SHPTu7046845;
	Wed, 28 Mar 2012 17:25:29 GMT
	(envelope-from nwhitehorn@svn.freebsd.org)
Received: (from nwhitehorn@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2SHPT5i046842;
	Wed, 28 Mar 2012 17:25:29 GMT
	(envelope-from nwhitehorn@svn.freebsd.org)
Message-Id: <201203281725.q2SHPT5i046842@svn.freebsd.org>
From: Nathan Whitehorn 
Date: Wed, 28 Mar 2012 17:25:29 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233618 - head/sys/powerpc/aim
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 28 Mar 2012 17:25:30 -0000

Author: nwhitehorn
Date: Wed Mar 28 17:25:29 2012
New Revision: 233618
URL: http://svn.freebsd.org/changeset/base/233618

Log:
  More PMAP performance improvements: skip 256 MB segments entirely if they
  are are not mapped during ranged operations and reduce the scope of the
  tlbie lock only to the actual tlbie instruction instead of the entire
  sequence. There are a few more optimization possibilities here as well.

Modified:
  head/sys/powerpc/aim/mmu_oea64.c
  head/sys/powerpc/aim/moea64_native.c

Modified: head/sys/powerpc/aim/mmu_oea64.c
==============================================================================
--- head/sys/powerpc/aim/mmu_oea64.c	Wed Mar 28 17:21:59 2012	(r233617)
+++ head/sys/powerpc/aim/mmu_oea64.c	Wed Mar 28 17:25:29 2012	(r233618)
@@ -1981,10 +1981,18 @@ moea64_protect(mmu_t mmu, pmap_t pm, vm_
 	LOCK_TABLE_RD();
 	PMAP_LOCK(pm);
 	if ((eva - sva)/PAGE_SIZE < pm->pm_stats.resident_count) {
-		for (; sva < eva; sva += PAGE_SIZE) {
+		while (sva < eva) {
+			#ifdef __powerpc64__
+			if (pm != kernel_pmap &&
+			    user_va_to_slb_entry(pm, sva) == NULL) {
+				sva = roundup2(sva + 1, SEGMENT_LENGTH);
+				continue;
+			}
+			#endif
 			pvo = moea64_pvo_find_va(pm, sva);
 			if (pvo != NULL)
 				moea64_pvo_protect(mmu, pm, pvo, prot);
+			sva += PAGE_SIZE;
 		}
 	} else {
 		LIST_FOREACH_SAFE(pvo, &pm->pmap_pvo, pvo_plink, tpvo) {
@@ -2095,10 +2103,18 @@ moea64_remove(mmu_t mmu, pmap_t pm, vm_o
 	LOCK_TABLE_WR();
 	PMAP_LOCK(pm);
 	if ((eva - sva)/PAGE_SIZE < pm->pm_stats.resident_count) {
-		for (; sva < eva; sva += PAGE_SIZE) {
+		while (sva < eva) {
+			#ifdef __powerpc64__
+			if (pm != kernel_pmap &&
+			    user_va_to_slb_entry(pm, sva) == NULL) {
+				sva = roundup2(sva + 1, SEGMENT_LENGTH);
+				continue;
+			}
+			#endif
 			pvo = moea64_pvo_find_va(pm, sva);
 			if (pvo != NULL)
 				moea64_pvo_remove(mmu, pvo);
+			sva += PAGE_SIZE;
 		}
 	} else {
 		LIST_FOREACH_SAFE(pvo, &pm->pmap_pvo, pvo_plink, tpvo) {
@@ -2566,7 +2582,7 @@ moea64_mapdev_attr(mmu_t mmu, vm_offset_
 
 	ppa = trunc_page(pa);
 	offset = pa & PAGE_MASK;
-	size = roundup(offset + size, PAGE_SIZE);
+	size = roundup2(offset + size, PAGE_SIZE);
 
 	va = kmem_alloc_nofault(kernel_map, size);
 
@@ -2597,7 +2613,7 @@ moea64_unmapdev(mmu_t mmu, vm_offset_t v
 
 	base = trunc_page(va);
 	offset = va & PAGE_MASK;
-	size = roundup(offset + size, PAGE_SIZE);
+	size = roundup2(offset + size, PAGE_SIZE);
 
 	kmem_free(kernel_map, base, size);
 }

Modified: head/sys/powerpc/aim/moea64_native.c
==============================================================================
--- head/sys/powerpc/aim/moea64_native.c	Wed Mar 28 17:21:59 2012	(r233617)
+++ head/sys/powerpc/aim/moea64_native.c	Wed Mar 28 17:25:29 2012	(r233618)
@@ -103,6 +103,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -152,15 +153,13 @@ TLBIE(uint64_t vpn) {
 	vpn &= ~(0xffffULL << 48);
 
 #ifdef __powerpc64__
+	sched_pin();
+	__asm __volatile("ptesync");
 	mtx_lock(&tlbie_mutex);
-	__asm __volatile("\
-	    ptesync; \
-	    tlbie %0; \
-	    eieio; \
-	    tlbsync; \
-	    ptesync;" 
-	:: "r"(vpn) : "memory");
+	__asm __volatile("tlbie %0" :: "r"(vpn) : "memory");
 	mtx_unlock(&tlbie_mutex);
+	__asm __volatile("eieio; tlbsync; ptesync");
+	sched_unpin();
 #else
 	vpn_hi = (uint32_t)(vpn >> 32);
 	vpn_lo = (uint32_t)vpn;

From owner-svn-src-head@FreeBSD.ORG  Wed Mar 28 17:58:38 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 78F98106566B;
	Wed, 28 Mar 2012 17:58:38 +0000 (UTC)
	(envelope-from jkim@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 6410B8FC16;
	Wed, 28 Mar 2012 17:58:38 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2SHwcCG047904;
	Wed, 28 Mar 2012 17:58:38 GMT (envelope-from jkim@svn.freebsd.org)
Received: (from jkim@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2SHwcZ5047902;
	Wed, 28 Mar 2012 17:58:38 GMT (envelope-from jkim@svn.freebsd.org)
Message-Id: <201203281758.q2SHwcZ5047902@svn.freebsd.org>
From: Jung-uk Kim 
Date: Wed, 28 Mar 2012 17:58:38 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233619 - head/sys/dev/atkbdc
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 28 Mar 2012 17:58:38 -0000

Author: jkim
Date: Wed Mar 28 17:58:37 2012
New Revision: 233619
URL: http://svn.freebsd.org/changeset/base/233619

Log:
  Add a PNP ID for Japanese 106-key keyboard.
  
  PR:		kern/166459
  MFC after:	3 days

Modified:
  head/sys/dev/atkbdc/atkbdc_isa.c

Modified: head/sys/dev/atkbdc/atkbdc_isa.c
==============================================================================
--- head/sys/dev/atkbdc/atkbdc_isa.c	Wed Mar 28 17:25:29 2012	(r233618)
+++ head/sys/dev/atkbdc/atkbdc_isa.c	Wed Mar 28 17:58:37 2012	(r233619)
@@ -87,6 +87,7 @@ static driver_t atkbdc_isa_driver = {
 
 static struct isa_pnp_id atkbdc_ids[] = {
 	{ 0x0303d041, "Keyboard controller (i8042)" },	/* PNP0303 */
+	{ 0x2003d041, "Keyboard controller (i8042)" },	/* PNP0320 */
 	{ 0 }
 };
 

From owner-svn-src-head@FreeBSD.ORG  Wed Mar 28 18:38:13 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id AF65F106571A;
	Wed, 28 Mar 2012 18:38:13 +0000 (UTC)
	(envelope-from jimharris@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 9A0EE8FC15;
	Wed, 28 Mar 2012 18:38:13 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2SIcDcK049237;
	Wed, 28 Mar 2012 18:38:13 GMT
	(envelope-from jimharris@svn.freebsd.org)
Received: (from jimharris@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2SIcDHe049233;
	Wed, 28 Mar 2012 18:38:13 GMT
	(envelope-from jimharris@svn.freebsd.org)
Message-Id: <201203281838.q2SIcDHe049233@svn.freebsd.org>
From: Jim Harris 
Date: Wed, 28 Mar 2012 18:38:13 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233622 - head/sys/dev/isci
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 28 Mar 2012 18:38:13 -0000

Author: jimharris
Date: Wed Mar 28 18:38:13 2012
New Revision: 233622
URL: http://svn.freebsd.org/changeset/base/233622

Log:
  Ensure consistent target IDs for direct-attached devices.
  
  Sponsored by: Intel
  Reported by: sbruno, 
  Tested by: 
  Reviewed by: scottl
  Approved by: scottl
  MFC after: 3 days

Modified:
  head/sys/dev/isci/isci.h
  head/sys/dev/isci/isci_controller.c
  head/sys/dev/isci/isci_domain.c

Modified: head/sys/dev/isci/isci.h
==============================================================================
--- head/sys/dev/isci/isci.h	Wed Mar 28 18:35:07 2012	(r233621)
+++ head/sys/dev/isci/isci.h	Wed Mar 28 18:38:13 2012	(r233622)
@@ -89,10 +89,10 @@ struct ISCI_REMOTE_DEVICE {
 };
 
 struct ISCI_DOMAIN {
-	struct ISCI_CONTROLLER	*controller;
-	SCI_DOMAIN_HANDLE_T	sci_object;
-	uint8_t			index;
-
+	struct ISCI_CONTROLLER		*controller;
+	SCI_DOMAIN_HANDLE_T		sci_object;
+	uint8_t				index;
+	struct ISCI_REMOTE_DEVICE	*da_remote_device;
 };
 
 struct ISCI_MEMORY

Modified: head/sys/dev/isci/isci_controller.c
==============================================================================
--- head/sys/dev/isci/isci_controller.c	Wed Mar 28 18:35:07 2012	(r233621)
+++ head/sys/dev/isci/isci_controller.c	Wed Mar 28 18:38:13 2012	(r233622)
@@ -430,7 +430,18 @@ int isci_controller_allocate_memory(stru
 		remote_device->frozen_lun_mask = 0;
 		sci_fast_list_element_init(remote_device,
 		    &remote_device->pending_device_reset_element);
-		sci_pool_put(controller->remote_device_pool, remote_device);
+
+		/*
+		 * For the first SCI_MAX_DOMAINS device objects, do not put
+		 *  them in the pool, rather assign them to each domain.  This
+		 *  ensures that any device attached directly to port "i" will
+		 *  always get CAM target id "i".
+		 */
+		if (i < SCI_MAX_DOMAINS)
+			controller->domain[i].da_remote_device = remote_device;
+		else
+			sci_pool_put(controller->remote_device_pool,
+			    remote_device);
 		remote_device_memory_ptr += remote_device_size;
 	}
 

Modified: head/sys/dev/isci/isci_domain.c
==============================================================================
--- head/sys/dev/isci/isci_domain.c	Wed Mar 28 18:35:07 2012	(r233621)
+++ head/sys/dev/isci/isci_domain.c	Wed Mar 28 18:38:13 2012	(r233622)
@@ -202,10 +202,14 @@ scif_cb_domain_da_device_added(SCI_CONTR
 	struct ISCI_REMOTE_DEVICE *remote_device;
 	struct ISCI_DOMAIN *isci_domain =
 	    (struct ISCI_DOMAIN *)sci_object_get_association(domain);
-	struct ISCI_CONTROLLER *isci_controller =
-	    (struct ISCI_CONTROLLER *)sci_object_get_association(controller);
 
-	sci_pool_get(isci_controller->remote_device_pool, remote_device);
+	/*
+	 * For direct-attached devices, do not pull the device object from
+	 *  the pool.  Rather, use the one stored in the domain object which
+	 *  will ensure that we always get consistent target ids for direct
+	 *  attached devices.
+	 */
+	remote_device = isci_domain->da_remote_device;
 
 	scif_remote_device_construct(domain,
 	    (uint8_t*)remote_device + sizeof(struct ISCI_REMOTE_DEVICE),
@@ -287,6 +291,8 @@ scif_cb_domain_device_removed(SCI_CONTRO
 {
 	struct ISCI_REMOTE_DEVICE *isci_remote_device =
 	    (struct ISCI_REMOTE_DEVICE *)sci_object_get_association(remote_device);
+	struct ISCI_DOMAIN *isci_domain =
+	    (struct ISCI_DOMAIN *)sci_object_get_association(domain);
 	struct ISCI_CONTROLLER *isci_controller =
 	    (struct ISCI_CONTROLLER *)sci_object_get_association(controller);
 	uint32_t path = cam_sim_path(isci_controller->sim);
@@ -301,7 +307,13 @@ scif_cb_domain_device_removed(SCI_CONTRO
 
 	scif_remote_device_destruct(remote_device);
 
-	sci_pool_put(isci_controller->remote_device_pool, isci_remote_device);
+	/*
+	 * Only put the remote device back into the pool if it was an
+	 *  expander-attached device.
+	 */
+	if (isci_remote_device != isci_domain->da_remote_device)
+		sci_pool_put(isci_controller->remote_device_pool,
+		    isci_remote_device);
 }
 
 void

From owner-svn-src-head@FreeBSD.ORG  Wed Mar 28 18:53:49 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 4EBD61065673;
	Wed, 28 Mar 2012 18:53:49 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 398328FC19;
	Wed, 28 Mar 2012 18:53:49 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2SIrnGl049786;
	Wed, 28 Mar 2012 18:53:49 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2SIrnPs049784;
	Wed, 28 Mar 2012 18:53:49 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <201203281853.q2SIrnPs049784@svn.freebsd.org>
From: John Baldwin 
Date: Wed, 28 Mar 2012 18:53:49 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233623 - head/sys/x86/acpica
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 28 Mar 2012 18:53:49 -0000

Author: jhb
Date: Wed Mar 28 18:53:48 2012
New Revision: 233623
URL: http://svn.freebsd.org/changeset/base/233623

Log:
  Allocate the ioapics[] array dynamically since it is only needed for the
  duration of madt_setup_io().  This avoids having the array take up
  permanent space in the BSS.
  
  Inspired by:	bde
  MFC after:	2 weeks

Modified:
  head/sys/x86/acpica/madt.c

Modified: head/sys/x86/acpica/madt.c
==============================================================================
--- head/sys/x86/acpica/madt.c	Wed Mar 28 18:38:13 2012	(r233622)
+++ head/sys/x86/acpica/madt.c	Wed Mar 28 18:53:48 2012	(r233623)
@@ -50,15 +50,15 @@ __FBSDID("$FreeBSD$");
 #include 
 
 /* These two arrays are indexed by APIC IDs. */
-struct ioapic_info {
+static struct {
 	void *io_apic;
 	UINT32 io_vector;
-} static ioapics[MAX_APIC_ID + 1];
+} *ioapics;
 
-struct lapic_info {
+static struct lapic_info {
 	u_int la_enabled:1;
 	u_int la_acpi_id:8;
-} static lapics[MAX_APIC_ID + 1];
+} lapics[MAX_APIC_ID + 1];
 
 static int madt_found_sci_override;
 static ACPI_TABLE_MADT *madt;
@@ -162,7 +162,10 @@ madt_setup_io(void)
 		printf("Try disabling either ACPI or apic support.\n");
 		panic("Using MADT but ACPI doesn't work");
 	}
-		    
+
+	ioapics = malloc(sizeof(*ioapics) * (MAX_APIC_ID + 1), M_MADT,
+	    M_WAITOK | M_ZERO);
+
 	/* First, we run through adding I/O APIC's. */
 	madt_walk_table(madt_parse_apics, NULL);
 
@@ -194,6 +197,9 @@ madt_setup_io(void)
 	/* Finally, we throw the switch to enable the I/O APIC's. */
 	acpi_SetDefaultIntrModel(ACPI_INTR_APIC);
 
+	free(ioapics, M_MADT);
+	ioapics = NULL;
+
 	return (0);
 }
 

From owner-svn-src-head@FreeBSD.ORG  Wed Mar 28 19:20:28 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id BB9241065670;
	Wed, 28 Mar 2012 19:20:28 +0000 (UTC)
	(envelope-from joel@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id A68CA8FC0C;
	Wed, 28 Mar 2012 19:20:28 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2SJKSxq050769;
	Wed, 28 Mar 2012 19:20:28 GMT (envelope-from joel@svn.freebsd.org)
Received: (from joel@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2SJKSOg050767;
	Wed, 28 Mar 2012 19:20:28 GMT (envelope-from joel@svn.freebsd.org)
Message-Id: <201203281920.q2SJKSOg050767@svn.freebsd.org>
From: Joel Dahl 
Date: Wed, 28 Mar 2012 19:20:28 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233625 - head/lib/libc/iconv
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 28 Mar 2012 19:20:28 -0000

Author: joel (doc committer)
Date: Wed Mar 28 19:20:28 2012
New Revision: 233625
URL: http://svn.freebsd.org/changeset/base/233625

Log:
  Fix Fo arguments.
  
  Reviewed by:	gabor

Modified:
  head/lib/libc/iconv/iconvlist.3

Modified: head/lib/libc/iconv/iconvlist.3
==============================================================================
--- head/lib/libc/iconv/iconvlist.3	Wed Mar 28 19:07:18 2012	(r233624)
+++ head/lib/libc/iconv/iconvlist.3	Wed Mar 28 19:20:28 2012	(r233625)
@@ -46,7 +46,7 @@
 .Sh SYNOPSIS
 .In iconv.h
 .Ft void
-.Fo iconvlist "char ***names" "size_t count" "bool paired"
+.Fo iconvlist
 .Fa "int \*[lp]*do_one\*[rp]\*[lp]unsigned int *count, const char * const *names, void *arg\*[rp]"
 .Fa "void *arg"
 .Fc

From owner-svn-src-head@FreeBSD.ORG  Wed Mar 28 20:49:12 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 25811106566C;
	Wed, 28 Mar 2012 20:49:12 +0000 (UTC)
	(envelope-from mckusick@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 061828FC12;
	Wed, 28 Mar 2012 20:49:12 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2SKnBb3053580;
	Wed, 28 Mar 2012 20:49:11 GMT
	(envelope-from mckusick@svn.freebsd.org)
Received: (from mckusick@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2SKnBLw053575;
	Wed, 28 Mar 2012 20:49:11 GMT
	(envelope-from mckusick@svn.freebsd.org)
Message-Id: <201203282049.q2SKnBLw053575@svn.freebsd.org>
From: Kirk McKusick 
Date: Wed, 28 Mar 2012 20:49:11 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233627 - in head/sys: geom sys ufs/ffs vm
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 28 Mar 2012 20:49:12 -0000

Author: mckusick
Date: Wed Mar 28 20:49:11 2012
New Revision: 233627
URL: http://svn.freebsd.org/changeset/base/233627

Log:
  Keep track of the mount point associated with a special device
  to enable the collection of counts of synchronous and asynchronous
  reads and writes for its associated filesystem. The counts are
  displayed using `mount -v'.
  
  Ensure that buffers used for paging indicate the vnode from
  which they are operating so that counts of paging I/O operations
  from the filesystem are collected.
  
  This checkin only adds the setting of the mount point for the
  UFS/FFS filesystem, but it would be trivial to add the setting
  and clearing of the mount point at filesystem mount/unmount
  time for other filesystems too.
  
  Reviewed by: kib

Modified:
  head/sys/geom/geom_vfs.c
  head/sys/sys/conf.h
  head/sys/ufs/ffs/ffs_vfsops.c
  head/sys/vm/vnode_pager.c

Modified: head/sys/geom/geom_vfs.c
==============================================================================
--- head/sys/geom/geom_vfs.c	Wed Mar 28 19:40:58 2012	(r233626)
+++ head/sys/geom/geom_vfs.c	Wed Mar 28 20:49:11 2012	(r233627)
@@ -95,6 +95,36 @@ g_vfs_done(struct bio *bip)
 	struct g_vfs_softc *sc;
 	struct buf *bp;
 	int vfslocked, destroy;
+	struct mount *mp;
+	struct vnode *vp;
+
+	/*
+	 * Collect statistics on synchronous and asynchronous read
+	 * and write counts for disks that have associated filesystems.
+	 * Since this run by the g_up thread it is single threaded and
+	 * we do not need to use atomic increments on the counters.
+	 */
+	bp = bip->bio_caller2;
+	vp = bp->b_vp;
+	if (vp == NULL)
+		mp = NULL;
+	else if (vn_isdisk(vp, NULL))
+		mp = vp->v_rdev->si_mountpt;
+	else
+		mp = vp->v_mount;
+	if (mp != NULL) {
+		if (bp->b_iocmd == BIO_WRITE) {
+			if (LK_HOLDER(bp->b_lock.lk_lock) == LK_KERNPROC)
+				mp->mnt_stat.f_asyncwrites++;
+			else
+				mp->mnt_stat.f_syncwrites++;
+		} else {
+			if (LK_HOLDER(bp->b_lock.lk_lock) == LK_KERNPROC)
+				mp->mnt_stat.f_asyncreads++;
+			else
+				mp->mnt_stat.f_syncreads++;
+		}
+	}
 
 	cp = bip->bio_from;
 	sc = cp->geom->softc;
@@ -103,7 +133,6 @@ g_vfs_done(struct bio *bip)
 		g_print_bio(bip);
 		printf("error = %d\n", bip->bio_error);
 	}
-	bp = bip->bio_caller2;
 	bp->b_error = bip->bio_error;
 	bp->b_ioflags = bip->bio_flags;
 	if (bip->bio_error)

Modified: head/sys/sys/conf.h
==============================================================================
--- head/sys/sys/conf.h	Wed Mar 28 19:40:58 2012	(r233626)
+++ head/sys/sys/conf.h	Wed Mar 28 20:49:11 2012	(r233627)
@@ -52,7 +52,7 @@ struct cdevsw;
 struct file;
 
 struct cdev {
-	void		*__si_reserved;
+	void		*si_spare0;
 	u_int		si_flags;
 #define	SI_ETERNAL	0x0001	/* never destroyed */
 #define	SI_ALIAS	0x0002	/* carrier of alias name */
@@ -78,7 +78,7 @@ struct cdev {
 	LIST_HEAD(, cdev)	si_children;
 	LIST_ENTRY(cdev)	si_siblings;
 	struct cdev *si_parent;
-	void		*si_spare0;
+	struct mount	*si_mountpt;
 	void		*si_drv1, *si_drv2;
 	struct cdevsw	*si_devsw;
 	int		si_iosize_max;	/* maximum I/O size (for physio &al) */

Modified: head/sys/ufs/ffs/ffs_vfsops.c
==============================================================================
--- head/sys/ufs/ffs/ffs_vfsops.c	Wed Mar 28 19:40:58 2012	(r233626)
+++ head/sys/ufs/ffs/ffs_vfsops.c	Wed Mar 28 20:49:11 2012	(r233627)
@@ -407,6 +407,8 @@ ffs_mount(struct mount *mp)
 				vn_finished_write(mp);
 				return (error);
 			}
+			if (devvp->v_type == VCHR && devvp->v_rdev != NULL)
+				devvp->v_rdev->si_mountpt = mp;
 			if (fs->fs_snapinum[0] != 0)
 				ffs_snapshot_mount(mp);
 			vn_finished_write(mp);
@@ -1050,6 +1052,8 @@ ffs_mountfs(devvp, mp, td)
 			ffs_flushfiles(mp, FORCECLOSE, td);
 			goto out;
 		}
+		if (devvp->v_type == VCHR && devvp->v_rdev != NULL)
+			devvp->v_rdev->si_mountpt = mp;
 		if (fs->fs_snapinum[0] != 0)
 			ffs_snapshot_mount(mp);
 		fs->fs_fmod = 1;
@@ -1295,6 +1299,8 @@ ffs_unmount(mp, mntflags)
 	g_vfs_close(ump->um_cp);
 	g_topology_unlock();
 	PICKUP_GIANT();
+	if (ump->um_devvp->v_type == VCHR && ump->um_devvp->v_rdev != NULL)
+		ump->um_devvp->v_rdev->si_mountpt = NULL;
 	vrele(ump->um_devvp);
 	dev_rel(ump->um_dev);
 	mtx_destroy(UFS_MTX(ump));

Modified: head/sys/vm/vnode_pager.c
==============================================================================
--- head/sys/vm/vnode_pager.c	Wed Mar 28 19:40:58 2012	(r233626)
+++ head/sys/vm/vnode_pager.c	Wed Mar 28 20:49:11 2012	(r233627)
@@ -543,6 +543,7 @@ vnode_pager_input_smlfs(object, m)
 			bp->b_data = (caddr_t)sf_buf_kva(sf) + i * bsize;
 			bp->b_blkno = fileaddr;
 			pbgetbo(bo, bp);
+			bp->b_vp = vp;
 			bp->b_bcount = bsize;
 			bp->b_bufsize = bsize;
 			bp->b_runningbufspace = bp->b_bufsize;
@@ -560,6 +561,7 @@ vnode_pager_input_smlfs(object, m)
 			/*
 			 * free the buffer header back to the swap buffer pool
 			 */
+			bp->b_vp = NULL;
 			pbrelbo(bp);
 			relpbuf(bp, &vnode_pbuf_freecnt);
 			if (error)
@@ -918,6 +920,7 @@ vnode_pager_generic_getpages(vp, m, byte
 	bp->b_wcred = crhold(curthread->td_ucred);
 	bp->b_blkno = firstaddr;
 	pbgetbo(bo, bp);
+	bp->b_vp = vp;
 	bp->b_bcount = size;
 	bp->b_bufsize = size;
 	bp->b_runningbufspace = bp->b_bufsize;
@@ -944,6 +947,7 @@ vnode_pager_generic_getpages(vp, m, byte
 	/*
 	 * free the buffer header back to the swap buffer pool
 	 */
+	bp->b_vp = NULL;
 	pbrelbo(bp);
 	relpbuf(bp, &vnode_pbuf_freecnt);
 

From owner-svn-src-head@FreeBSD.ORG  Wed Mar 28 20:58:32 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 3C8031065670;
	Wed, 28 Mar 2012 20:58:32 +0000 (UTC)
	(envelope-from fabient@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 22A9B8FC1A;
	Wed, 28 Mar 2012 20:58:32 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2SKwWe2053938;
	Wed, 28 Mar 2012 20:58:32 GMT (envelope-from fabient@svn.freebsd.org)
Received: (from fabient@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2SKwVsJ053900;
	Wed, 28 Mar 2012 20:58:31 GMT (envelope-from fabient@svn.freebsd.org)
Message-Id: <201203282058.q2SKwVsJ053900@svn.freebsd.org>
From: Fabien Thomas 
Date: Wed, 28 Mar 2012 20:58:31 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233628 - in head: lib/libpmc sys/amd64/amd64
	sys/amd64/include sys/arm/include sys/conf sys/dev/hwpmc
	sys/i386/i386 sys/i386/include sys/kern sys/mips/include
	sys/modules/hwpmc sys/pow...
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 28 Mar 2012 20:58:32 -0000

Author: fabient
Date: Wed Mar 28 20:58:30 2012
New Revision: 233628
URL: http://svn.freebsd.org/changeset/base/233628

Log:
  Add software PMC support.
  
  New kernel events can be added at various location for sampling or counting.
  This will for example allow easy system profiling whatever the processor is
  with known tools like pmcstat(8).
  
  Simultaneous usage of software PMC and hardware PMC is possible, for example
  looking at the lock acquire failure, page fault while sampling on
  instructions.
  
  Sponsored by: NETASQ
  MFC after:	1 month

Added:
  head/lib/libpmc/pmc.soft.3   (contents, props changed)
  head/sys/dev/hwpmc/hwpmc_soft.c   (contents, props changed)
  head/sys/dev/hwpmc/hwpmc_soft.h   (contents, props changed)
Modified:
  head/lib/libpmc/Makefile
  head/lib/libpmc/libpmc.c
  head/lib/libpmc/pmc.3
  head/lib/libpmc/pmc.atom.3
  head/lib/libpmc/pmc.core.3
  head/lib/libpmc/pmc.core2.3
  head/lib/libpmc/pmc.corei7.3
  head/lib/libpmc/pmc.corei7uc.3
  head/lib/libpmc/pmc.iaf.3
  head/lib/libpmc/pmc.k7.3
  head/lib/libpmc/pmc.k8.3
  head/lib/libpmc/pmc.mips24k.3
  head/lib/libpmc/pmc.octeon.3
  head/lib/libpmc/pmc.p4.3
  head/lib/libpmc/pmc.p5.3
  head/lib/libpmc/pmc.p6.3
  head/lib/libpmc/pmc.sandybridge.3
  head/lib/libpmc/pmc.sandybridgeuc.3
  head/lib/libpmc/pmc.tsc.3
  head/lib/libpmc/pmc.ucf.3
  head/lib/libpmc/pmc.westmere.3
  head/lib/libpmc/pmc.westmereuc.3
  head/lib/libpmc/pmc.xscale.3
  head/lib/libpmc/pmclog.c
  head/lib/libpmc/pmclog.h
  head/sys/amd64/amd64/trap.c
  head/sys/amd64/include/pmc_mdep.h
  head/sys/arm/include/pmc_mdep.h
  head/sys/conf/files
  head/sys/dev/hwpmc/hwpmc_amd.c
  head/sys/dev/hwpmc/hwpmc_core.c
  head/sys/dev/hwpmc/hwpmc_intel.c
  head/sys/dev/hwpmc/hwpmc_logging.c
  head/sys/dev/hwpmc/hwpmc_mips.c
  head/sys/dev/hwpmc/hwpmc_mod.c
  head/sys/dev/hwpmc/hwpmc_piv.c
  head/sys/dev/hwpmc/hwpmc_powerpc.c
  head/sys/dev/hwpmc/hwpmc_ppro.c
  head/sys/dev/hwpmc/hwpmc_tsc.c
  head/sys/dev/hwpmc/hwpmc_x86.c
  head/sys/dev/hwpmc/hwpmc_xscale.c
  head/sys/dev/hwpmc/pmc_events.h
  head/sys/i386/i386/trap.c
  head/sys/i386/include/pmc_mdep.h
  head/sys/kern/kern_clock.c
  head/sys/kern/kern_lock.c
  head/sys/kern/kern_mutex.c
  head/sys/kern/kern_pmc.c
  head/sys/kern/kern_rwlock.c
  head/sys/kern/kern_sx.c
  head/sys/kern/subr_trap.c
  head/sys/mips/include/pmc_mdep.h
  head/sys/modules/hwpmc/Makefile
  head/sys/powerpc/include/pmc_mdep.h
  head/sys/sys/pmc.h
  head/sys/sys/pmckern.h
  head/sys/sys/pmclog.h
  head/usr.sbin/pmcstat/pmcstat_log.c

Modified: head/lib/libpmc/Makefile
==============================================================================
--- head/lib/libpmc/Makefile	Wed Mar 28 20:49:11 2012	(r233627)
+++ head/lib/libpmc/Makefile	Wed Mar 28 20:58:30 2012	(r233628)
@@ -20,6 +20,7 @@ MAN+=	pmc_read.3
 MAN+=	pmc_set.3
 MAN+=	pmc_start.3
 MAN+=	pmclog.3
+MAN+=	pmc.soft.3
 
 # PMC-dependent manual pages
 .if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64"

Modified: head/lib/libpmc/libpmc.c
==============================================================================
--- head/lib/libpmc/libpmc.c	Wed Mar 28 20:49:11 2012	(r233627)
+++ head/lib/libpmc/libpmc.c	Wed Mar 28 20:58:30 2012	(r233628)
@@ -77,11 +77,12 @@ static int tsc_allocate_pmc(enum pmc_eve
 static int xscale_allocate_pmc(enum pmc_event _pe, char *_ctrspec,
     struct pmc_op_pmcallocate *_pmc_config);
 #endif
-
 #if defined(__mips__)
 static int mips_allocate_pmc(enum pmc_event _pe, char* ctrspec,
 			     struct pmc_op_pmcallocate *_pmc_config);
 #endif /* __mips__ */
+static int soft_allocate_pmc(enum pmc_event _pe, char *_ctrspec,
+    struct pmc_op_pmcallocate *_pmc_config);
 
 #if defined(__powerpc__)
 static int ppc7450_allocate_pmc(enum pmc_event _pe, char* ctrspec,
@@ -156,6 +157,8 @@ PMC_CLASSDEP_TABLE(octeon, OCTEON);
 PMC_CLASSDEP_TABLE(ucf, UCF);
 PMC_CLASSDEP_TABLE(ppc7450, PPC7450);
 
+static struct pmc_event_descr soft_event_table[PMC_EV_DYN_COUNT];
+
 #undef	__PMC_EV_ALIAS
 #define	__PMC_EV_ALIAS(N,CODE) 	{ N, PMC_EV_##CODE },
 
@@ -215,21 +218,22 @@ static const struct pmc_event_descr west
 		PMC_CLASS_##C, __VA_ARGS__			\
 	}
 
-PMC_MDEP_TABLE(atom, IAP, PMC_CLASS_IAF, PMC_CLASS_TSC);
-PMC_MDEP_TABLE(core, IAP, PMC_CLASS_TSC);
-PMC_MDEP_TABLE(core2, IAP, PMC_CLASS_IAF, PMC_CLASS_TSC);
-PMC_MDEP_TABLE(corei7, IAP, PMC_CLASS_IAF, PMC_CLASS_TSC, PMC_CLASS_UCF, PMC_CLASS_UCP);
-PMC_MDEP_TABLE(sandybridge, IAP, PMC_CLASS_IAF, PMC_CLASS_TSC, PMC_CLASS_UCF, PMC_CLASS_UCP);
-PMC_MDEP_TABLE(westmere, IAP, PMC_CLASS_IAF, PMC_CLASS_TSC, PMC_CLASS_UCF, PMC_CLASS_UCP);
-PMC_MDEP_TABLE(k7, K7, PMC_CLASS_TSC);
-PMC_MDEP_TABLE(k8, K8, PMC_CLASS_TSC);
-PMC_MDEP_TABLE(p4, P4, PMC_CLASS_TSC);
-PMC_MDEP_TABLE(p5, P5, PMC_CLASS_TSC);
-PMC_MDEP_TABLE(p6, P6, PMC_CLASS_TSC);
-PMC_MDEP_TABLE(xscale, XSCALE, PMC_CLASS_XSCALE);
-PMC_MDEP_TABLE(mips24k, MIPS24K, PMC_CLASS_MIPS24K);
-PMC_MDEP_TABLE(octeon, OCTEON, PMC_CLASS_OCTEON);
-PMC_MDEP_TABLE(ppc7450, PPC7450, PMC_CLASS_PPC7450);
+PMC_MDEP_TABLE(atom, IAP, PMC_CLASS_SOFT, PMC_CLASS_IAF, PMC_CLASS_TSC);
+PMC_MDEP_TABLE(core, IAP, PMC_CLASS_SOFT, PMC_CLASS_TSC);
+PMC_MDEP_TABLE(core2, IAP, PMC_CLASS_SOFT, PMC_CLASS_IAF, PMC_CLASS_TSC);
+PMC_MDEP_TABLE(corei7, IAP, PMC_CLASS_SOFT, PMC_CLASS_IAF, PMC_CLASS_TSC, PMC_CLASS_UCF, PMC_CLASS_UCP);
+PMC_MDEP_TABLE(sandybridge, IAP, PMC_CLASS_SOFT, PMC_CLASS_IAF, PMC_CLASS_TSC, PMC_CLASS_UCF, PMC_CLASS_UCP);
+PMC_MDEP_TABLE(westmere, IAP, PMC_CLASS_SOFT, PMC_CLASS_IAF, PMC_CLASS_TSC, PMC_CLASS_UCF, PMC_CLASS_UCP);
+PMC_MDEP_TABLE(k7, K7, PMC_CLASS_SOFT, PMC_CLASS_TSC);
+PMC_MDEP_TABLE(k8, K8, PMC_CLASS_SOFT, PMC_CLASS_TSC);
+PMC_MDEP_TABLE(p4, P4, PMC_CLASS_SOFT, PMC_CLASS_TSC);
+PMC_MDEP_TABLE(p5, P5, PMC_CLASS_SOFT, PMC_CLASS_TSC);
+PMC_MDEP_TABLE(p6, P6, PMC_CLASS_SOFT, PMC_CLASS_TSC);
+PMC_MDEP_TABLE(xscale, XSCALE, PMC_CLASS_SOFT, PMC_CLASS_XSCALE);
+PMC_MDEP_TABLE(mips24k, MIPS24K, PMC_CLASS_SOFT, PMC_CLASS_MIPS24K);
+PMC_MDEP_TABLE(octeon, OCTEON, PMC_CLASS_SOFT, PMC_CLASS_OCTEON);
+PMC_MDEP_TABLE(ppc7450, PPC7450, PMC_CLASS_SOFT, PMC_CLASS_PPC7450);
+PMC_MDEP_TABLE(generic, SOFT, PMC_CLASS_SOFT);
 
 static const struct pmc_event_descr tsc_event_table[] =
 {
@@ -279,16 +283,24 @@ PMC_CLASS_TABLE_DESC(tsc, TSC, tsc, tsc)
 #if	defined(__XSCALE__)
 PMC_CLASS_TABLE_DESC(xscale, XSCALE, xscale, xscale);
 #endif
-
 #if defined(__mips__)
 PMC_CLASS_TABLE_DESC(mips24k, MIPS24K, mips24k, mips);
 PMC_CLASS_TABLE_DESC(octeon, OCTEON, octeon, mips);
 #endif /* __mips__ */
-
 #if defined(__powerpc__)
 PMC_CLASS_TABLE_DESC(ppc7450, PPC7450, ppc7450, ppc7450);
 #endif
 
+static struct pmc_class_descr soft_class_table_descr =
+{
+	.pm_evc_name  = "SOFT-",
+	.pm_evc_name_size = sizeof("SOFT-") - 1,
+	.pm_evc_class = PMC_CLASS_SOFT,
+	.pm_evc_event_table = NULL,
+	.pm_evc_event_table_size = 0,
+	.pm_evc_allocate_pmc = soft_allocate_pmc
+};
+
 #undef	PMC_CLASS_TABLE_DESC
 
 static const struct pmc_class_descr **pmc_class_table;
@@ -343,9 +355,12 @@ static const char * pmc_state_names[] = 
 	__PMC_STATES()
 };
 
-static int pmc_syscall = -1;		/* filled in by pmc_init() */
-
-static struct pmc_cpuinfo cpu_info;	/* filled in by pmc_init() */
+/*
+ * Filled in by pmc_init().
+ */
+static int pmc_syscall = -1;
+static struct pmc_cpuinfo cpu_info;
+static struct pmc_op_getdyneventinfo soft_event_info;
 
 /* Event masks for events */
 struct pmc_masks {
@@ -2179,6 +2194,25 @@ tsc_allocate_pmc(enum pmc_event pe, char
 }
 #endif
 
+static struct pmc_event_alias generic_aliases[] = {
+	EV_ALIAS("instructions",		"SOFT-CLOCK.HARD"),
+	EV_ALIAS(NULL, NULL)
+};
+
+static int
+soft_allocate_pmc(enum pmc_event pe, char *ctrspec,
+    struct pmc_op_pmcallocate *pmc_config)
+{
+	(void)ctrspec;
+	(void)pmc_config;
+
+	if (pe < PMC_EV_SOFT_FIRST || pe > PMC_EV_SOFT_LAST)
+		return (-1);
+
+	pmc_config->pm_caps |= (PMC_CAP_READ | PMC_CAP_WRITE);
+	return (0);
+}
+
 #if	defined(__XSCALE__)
 
 static struct pmc_event_alias xscale_aliases[] = {
@@ -2663,6 +2697,10 @@ pmc_event_names_of_class(enum pmc_class 
 		ev = ppc7450_event_table;
 		count = PMC_EVENT_TABLE_SIZE(ppc7450);
 		break;
+	case PMC_CLASS_SOFT:
+		ev = soft_event_table;
+		count = soft_event_info.pm_nevent;
+		break;
 	default:
 		errno = EINVAL;
 		return (-1);
@@ -2676,6 +2714,7 @@ pmc_event_names_of_class(enum pmc_class 
 
 	for (;count--; ev++, names++)
 		*names = ev->pm_ev_name;
+
 	return (0);
 }
 
@@ -2780,11 +2819,34 @@ pmc_init(void)
 		pmc_class_table[n] = NULL;
 
 	/*
+	 * Get soft events list.
+	 */
+	soft_event_info.pm_class = PMC_CLASS_SOFT;
+	if (PMC_CALL(GETDYNEVENTINFO, &soft_event_info) < 0)
+		return (pmc_syscall = -1);
+
+	/* Map soft events to static list. */
+	for (n = 0; n < soft_event_info.pm_nevent; n++) {
+		soft_event_table[n].pm_ev_name =
+		    soft_event_info.pm_events[n].pm_ev_name;
+		soft_event_table[n].pm_ev_code =
+		    soft_event_info.pm_events[n].pm_ev_code;
+	}
+	soft_class_table_descr.pm_evc_event_table_size = \
+	    soft_event_info.pm_nevent;
+	soft_class_table_descr.pm_evc_event_table = \
+	    soft_event_table;
+
+	/*
 	 * Fill in the class table.
 	 */
 	n = 0;
+
+	/* Fill soft events information. */
+	pmc_class_table[n++] = &soft_class_table_descr;
 #if defined(__amd64__) || defined(__i386__)
-	pmc_class_table[n++] = &tsc_class_table_descr;
+	if (cpu_info.pm_cputype != PMC_CPU_GENERIC)
+		pmc_class_table[n++] = &tsc_class_table_descr;
 
 	/*
  	 * Check if this CPU has fixed function counters.
@@ -2867,6 +2929,9 @@ pmc_init(void)
 		pmc_class_table[n] = &p4_class_table_descr;
 		break;
 #endif
+	case PMC_CPU_GENERIC:
+		PMC_MDEP_INIT(generic);
+		break;
 #if defined(__XSCALE__)
 	case PMC_CPU_INTEL_XSCALE:
 		PMC_MDEP_INIT(xscale);
@@ -3035,18 +3100,19 @@ _pmc_name_of_event(enum pmc_event pe, en
 		evfence = xscale_event_table + PMC_EVENT_TABLE_SIZE(xscale);
 	} else if (pe >= PMC_EV_MIPS24K_FIRST && pe <= PMC_EV_MIPS24K_LAST) {
 		ev = mips24k_event_table;
-		evfence = mips24k_event_table + PMC_EVENT_TABLE_SIZE(mips24k
-);
+		evfence = mips24k_event_table + PMC_EVENT_TABLE_SIZE(mips24k);
 	} else if (pe >= PMC_EV_OCTEON_FIRST && pe <= PMC_EV_OCTEON_LAST) {
 		ev = octeon_event_table;
 		evfence = octeon_event_table + PMC_EVENT_TABLE_SIZE(octeon);
 	} else if (pe >= PMC_EV_PPC7450_FIRST && pe <= PMC_EV_PPC7450_LAST) {
 		ev = ppc7450_event_table;
-		evfence = ppc7450_event_table + PMC_EVENT_TABLE_SIZE(ppc7450
-);
+		evfence = ppc7450_event_table + PMC_EVENT_TABLE_SIZE(ppc7450);
 	} else if (pe == PMC_EV_TSC_TSC) {
 		ev = tsc_event_table;
 		evfence = tsc_event_table + PMC_EVENT_TABLE_SIZE(tsc);
+	} else if (pe >= PMC_EV_SOFT_FIRST && pe <= PMC_EV_SOFT_LAST) {
+		ev = soft_event_table;
+		evfence = soft_event_table + soft_event_info.pm_nevent;
 	}
 
 	for (; ev != evfence; ev++)

Modified: head/lib/libpmc/pmc.3
==============================================================================
--- head/lib/libpmc/pmc.3	Wed Mar 28 20:49:11 2012	(r233627)
+++ head/lib/libpmc/pmc.3	Wed Mar 28 20:58:30 2012	(r233628)
@@ -223,6 +223,8 @@ and
 CPUs.
 .It Li PMC_CLASS_TSC
 The timestamp counter on i386 and amd64 architecture CPUs.
+.It Li PMC_CLASS_SOFT
+Software events.
 .El
 .Ss PMC Capabilities
 Capabilities of performance monitoring hardware are denoted using
@@ -525,6 +527,7 @@ API is
 .Xr pmc.p4 3 ,
 .Xr pmc.p5 3 ,
 .Xr pmc.p6 3 ,
+.Xr pmc.soft 3 ,
 .Xr pmc.tsc 3 ,
 .Xr pmclog 3 ,
 .Xr hwpmc 4 ,

Modified: head/lib/libpmc/pmc.atom.3
==============================================================================
--- head/lib/libpmc/pmc.atom.3	Wed Mar 28 20:49:11 2012	(r233627)
+++ head/lib/libpmc/pmc.atom.3	Wed Mar 28 20:58:30 2012	(r233628)
@@ -1176,6 +1176,7 @@ and the underlying hardware events used 
 .Xr pmc.p4 3 ,
 .Xr pmc.p5 3 ,
 .Xr pmc.p6 3 ,
+.Xr pmc.soft 3 ,
 .Xr pmc.tsc 3 ,
 .Xr pmc_cpuinfo 3 ,
 .Xr pmclog 3 ,

Modified: head/lib/libpmc/pmc.core.3
==============================================================================
--- head/lib/libpmc/pmc.core.3	Wed Mar 28 20:49:11 2012	(r233627)
+++ head/lib/libpmc/pmc.core.3	Wed Mar 28 20:58:30 2012	(r233628)
@@ -792,6 +792,7 @@ may not count some transitions.
 .Xr pmc.p4 3 ,
 .Xr pmc.p5 3 ,
 .Xr pmc.p6 3 ,
+.Xr pmc.soft 3 ,
 .Xr pmc.tsc 3 ,
 .Xr pmclog 3 ,
 .Xr hwpmc 4

Modified: head/lib/libpmc/pmc.core2.3
==============================================================================
--- head/lib/libpmc/pmc.core2.3	Wed Mar 28 20:49:11 2012	(r233627)
+++ head/lib/libpmc/pmc.core2.3	Wed Mar 28 20:58:30 2012	(r233628)
@@ -1107,6 +1107,7 @@ and the underlying hardware events used.
 .Xr pmc.p4 3 ,
 .Xr pmc.p5 3 ,
 .Xr pmc.p6 3 ,
+.Xr pmc.soft 3 ,
 .Xr pmc.tsc 3 ,
 .Xr pmc_cpuinfo 3 ,
 .Xr pmclog 3 ,

Modified: head/lib/libpmc/pmc.corei7.3
==============================================================================
--- head/lib/libpmc/pmc.corei7.3	Wed Mar 28 20:49:11 2012	(r233627)
+++ head/lib/libpmc/pmc.corei7.3	Wed Mar 28 20:58:30 2012	(r233628)
@@ -1559,6 +1559,7 @@ Counts number of segment register loads.
 .Xr pmc.corei7uc 3 ,
 .Xr pmc.westmere 3 ,
 .Xr pmc.westmereuc 3 ,
+.Xr pmc.soft 3 ,
 .Xr pmc.tsc 3 ,
 .Xr pmc_cpuinfo 3 ,
 .Xr pmclog 3 ,

Modified: head/lib/libpmc/pmc.corei7uc.3
==============================================================================
--- head/lib/libpmc/pmc.corei7uc.3	Wed Mar 28 20:49:11 2012	(r233627)
+++ head/lib/libpmc/pmc.corei7uc.3	Wed Mar 28 20:58:30 2012	(r233628)
@@ -863,6 +863,7 @@ refreshed or needs to go into a power do
 .Xr pmc.corei7 3 ,
 .Xr pmc.westmere 3 ,
 .Xr pmc.westmereuc 3 ,
+.Xr pmc.soft 3 ,
 .Xr pmc.tsc 3 ,
 .Xr pmc_cpuinfo 3 ,
 .Xr pmclog 3 ,

Modified: head/lib/libpmc/pmc.iaf.3
==============================================================================
--- head/lib/libpmc/pmc.iaf.3	Wed Mar 28 20:49:11 2012	(r233627)
+++ head/lib/libpmc/pmc.iaf.3	Wed Mar 28 20:58:30 2012	(r233628)
@@ -132,6 +132,7 @@ CPU, use the event specifier
 .Xr pmc.p4 3 ,
 .Xr pmc.p5 3 ,
 .Xr pmc.p6 3 ,
+.Xr pmc.soft 3 ,
 .Xr pmc.tsc 3 ,
 .Xr pmc_cpuinfo 3 ,
 .Xr pmclog 3 ,

Modified: head/lib/libpmc/pmc.k7.3
==============================================================================
--- head/lib/libpmc/pmc.k7.3	Wed Mar 28 20:49:11 2012	(r233627)
+++ head/lib/libpmc/pmc.k7.3	Wed Mar 28 20:58:30 2012	(r233628)
@@ -249,6 +249,7 @@ and the underlying hardware events used.
 .Xr pmc.p4 3 ,
 .Xr pmc.p5 3 ,
 .Xr pmc.p6 3 ,
+.Xr pmc.soft 3 ,
 .Xr pmc.tsc 3 ,
 .Xr pmclog 3 ,
 .Xr hwpmc 4

Modified: head/lib/libpmc/pmc.k8.3
==============================================================================
--- head/lib/libpmc/pmc.k8.3	Wed Mar 28 20:49:11 2012	(r233627)
+++ head/lib/libpmc/pmc.k8.3	Wed Mar 28 20:58:30 2012	(r233628)
@@ -783,6 +783,7 @@ and the underlying hardware events used.
 .Xr pmc.p4 3 ,
 .Xr pmc.p5 3 ,
 .Xr pmc.p6 3 ,
+.Xr pmc.soft 3 ,
 .Xr pmc.tsc 3 ,
 .Xr pmclog 3 ,
 .Xr hwpmc 4

Modified: head/lib/libpmc/pmc.mips24k.3
==============================================================================
--- head/lib/libpmc/pmc.mips24k.3	Wed Mar 28 20:49:11 2012	(r233627)
+++ head/lib/libpmc/pmc.mips24k.3	Wed Mar 28 20:58:30 2012	(r233628)
@@ -392,6 +392,7 @@ and the underlying hardware events used.
 .Xr pmc.p4 3 ,
 .Xr pmc.p5 3 ,
 .Xr pmc.p6 3 ,
+.Xr pmc.soft 3 ,
 .Xr pmc.tsc 3 ,
 .Xr pmc_cpuinfo 3 ,
 .Xr pmclog 3 ,

Modified: head/lib/libpmc/pmc.octeon.3
==============================================================================
--- head/lib/libpmc/pmc.octeon.3	Wed Mar 28 20:49:11 2012	(r233627)
+++ head/lib/libpmc/pmc.octeon.3	Wed Mar 28 20:58:30 2012	(r233628)
@@ -232,6 +232,7 @@ and the underlying hardware events used.
 .Xr pmc.p4 3 ,
 .Xr pmc.p5 3 ,
 .Xr pmc.p6 3 ,
+.Xr pmc.soft 3 ,
 .Xr pmc.tsc 3 ,
 .Xr pmc_cpuinfo 3 ,
 .Xr pmclog 3 ,

Modified: head/lib/libpmc/pmc.p4.3
==============================================================================
--- head/lib/libpmc/pmc.p4.3	Wed Mar 28 20:49:11 2012	(r233627)
+++ head/lib/libpmc/pmc.p4.3	Wed Mar 28 20:58:30 2012	(r233628)
@@ -1208,6 +1208,7 @@ and the underlying hardware events used.
 .Xr pmc.k8 3 ,
 .Xr pmc.p5 3 ,
 .Xr pmc.p6 3 ,
+.Xr pmc.soft 3 ,
 .Xr pmc.tsc 3 ,
 .Xr pmclog 3 ,
 .Xr hwpmc 4

Modified: head/lib/libpmc/pmc.p5.3
==============================================================================
--- head/lib/libpmc/pmc.p5.3	Wed Mar 28 20:49:11 2012	(r233627)
+++ head/lib/libpmc/pmc.p5.3	Wed Mar 28 20:58:30 2012	(r233628)
@@ -444,6 +444,7 @@ and the underlying hardware events used.
 .Xr pmc.k8 3 ,
 .Xr pmc.p4 3 ,
 .Xr pmc.p6 3 ,
+.Xr pmc.soft 3 ,
 .Xr pmc.tsc 3 ,
 .Xr pmclog 3 ,
 .Xr hwpmc 4

Modified: head/lib/libpmc/pmc.p6.3
==============================================================================
--- head/lib/libpmc/pmc.p6.3	Wed Mar 28 20:49:11 2012	(r233627)
+++ head/lib/libpmc/pmc.p6.3	Wed Mar 28 20:58:30 2012	(r233628)
@@ -1010,6 +1010,7 @@ and the underlying hardware events used.
 .Xr pmc.k8 3 ,
 .Xr pmc.p4 3 ,
 .Xr pmc.p5 3 ,
+.Xr pmc.soft 3 ,
 .Xr pmc.tsc 3 ,
 .Xr pmclog 3 ,
 .Xr hwpmc 4

Modified: head/lib/libpmc/pmc.sandybridge.3
==============================================================================
--- head/lib/libpmc/pmc.sandybridge.3	Wed Mar 28 20:49:11 2012	(r233627)
+++ head/lib/libpmc/pmc.sandybridge.3	Wed Mar 28 20:58:30 2012	(r233628)
@@ -907,6 +907,7 @@ Split locks in SQ.
 .Xr pmc.p5 3 ,
 .Xr pmc.p6 3 ,
 .Xr pmc.sandybridgeuc 3 ,
+.Xr pmc.soft 3 ,
 .Xr pmc.tsc 3 ,
 .Xr pmc.ucf 3 ,
 .Xr pmc.westmere 3 ,

Modified: head/lib/libpmc/pmc.sandybridgeuc.3
==============================================================================
--- head/lib/libpmc/pmc.sandybridgeuc.3	Wed Mar 28 20:49:11 2012	(r233627)
+++ head/lib/libpmc/pmc.sandybridgeuc.3	Wed Mar 28 20:58:30 2012	(r233628)
@@ -208,6 +208,7 @@ Counts the number of core-outgoing entri
 .Xr pmc.p5 3 ,
 .Xr pmc.p6 3 ,
 .Xr pmc.sandybridge 3 ,
+.Xr pmc.soft 3 ,
 .Xr pmc.tsc 3 ,
 .Xr pmc.ucf 3 ,
 .Xr pmc.westmere 3 ,

Added: head/lib/libpmc/pmc.soft.3
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/lib/libpmc/pmc.soft.3	Wed Mar 28 20:58:30 2012	(r233628)
@@ -0,0 +1,104 @@
+.\" Copyright (c) 2012 Fabien Thomas.  All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\"    notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\"    notice, this list of conditions and the following disclaimer in the
+.\"    documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd March 28, 2012
+.Os
+.Dt PMC.SOFT 3
+.Sh NAME
+.Nm pmc.soft
+.Nd measurements using software based events
+.Sh LIBRARY
+.Lb libpmc
+.Sh SYNOPSIS
+.In pmc.h
+.Sh DESCRIPTION
+Software events are used to collect various source of software events.
+.Ss PMC Features
+16 sampling counters using software events based on various sources.
+These PMCs support the following capabilities:
+.Bl -column "PMC_CAP_INTERRUPT" "Support"
+.It Em Capability Ta Em Support
+.It PMC_CAP_CASCADE Ta \&No
+.It PMC_CAP_EDGE Ta \&No
+.It PMC_CAP_INTERRUPT Ta Yes
+.It PMC_CAP_INVERT Ta \&No
+.It PMC_CAP_READ Ta Yes
+.It PMC_CAP_PRECISE Ta \&No
+.It PMC_CAP_SYSTEM Ta Yes
+.It PMC_CAP_TAGGING Ta \&No
+.It PMC_CAP_THRESHOLD Ta \&No
+.It PMC_CAP_USER Ta Yes
+.It PMC_CAP_WRITE Ta Yes
+.El
+.Ss Event Qualifiers
+There is no supported event qualifier.
+.Pp
+The event specifiers supported by software are:
+.Bl -tag -width indent
+.It Li CLOCK.HARD
+Hard clock ticks.
+.It Li CLOCK.STAT
+Stat clock ticks.
+.It Li LOCK.FAILED
+Lock acquisition failed.
+.It Li PAGE_FAULT.ALL
+All page fault type.
+.It Li PAGE_FAULT.READ
+Read page fault.
+.It Li PAGE_FAULT.WRITE
+Write page fault.
+.El
+.Sh SEE ALSO
+.Xr pmc 3 ,
+.Xr pmc.atom 3 ,
+.Xr pmc.core 3 ,
+.Xr pmc.iaf 3 ,
+.Xr pmc.ucf 3 ,
+.Xr pmc.k7 3 ,
+.Xr pmc.k8 3 ,
+.Xr pmc.p4 3 ,
+.Xr pmc.p5 3 ,
+.Xr pmc.p6 3 ,
+.Xr pmc.corei7 3 ,
+.Xr pmc.corei7uc 3 ,
+.Xr pmc.westmereuc 3 ,
+.Xr pmc.tsc 3 ,
+.Xr pmc_cpuinfo 3 ,
+.Xr pmclog 3 ,
+.Xr hwpmc 4
+.Sh HISTORY
+The
+.Nm pmc
+library first appeared in
+.Fx 6.0 .
+.Sh AUTHORS
+The
+.Lb libpmc
+library was written by
+.An "Joseph Koshy"
+.Aq jkoshy@FreeBSD.org .
+Software PMC was written by
+.An "Fabien Thomas"
+.Aq fabient@FreeBSD.org .

Modified: head/lib/libpmc/pmc.tsc.3
==============================================================================
--- head/lib/libpmc/pmc.tsc.3	Wed Mar 28 20:49:11 2012	(r233627)
+++ head/lib/libpmc/pmc.tsc.3	Wed Mar 28 20:58:30 2012	(r233628)
@@ -68,6 +68,7 @@ maps to the TSC.
 .Xr pmc.p4 3 ,
 .Xr pmc.p5 3 ,
 .Xr pmc.p6 3 ,
+.Xr pmc.soft 3 ,
 .Xr pmclog 3 ,
 .Xr hwpmc 4
 .Sh HISTORY

Modified: head/lib/libpmc/pmc.ucf.3
==============================================================================
--- head/lib/libpmc/pmc.ucf.3	Wed Mar 28 20:49:11 2012	(r233627)
+++ head/lib/libpmc/pmc.ucf.3	Wed Mar 28 20:58:30 2012	(r233628)
@@ -96,6 +96,7 @@ offset C0H under device number 0 and Fun
 .Xr pmc.corei7uc 3 ,
 .Xr pmc.westmere 3 ,
 .Xr pmc.westmereuc 3 ,
+.Xr pmc.soft 3 ,
 .Xr pmc.tsc 3 ,
 .Xr pmc_cpuinfo 3 ,
 .Xr pmclog 3 ,

Modified: head/lib/libpmc/pmc.westmere.3
==============================================================================
--- head/lib/libpmc/pmc.westmere.3	Wed Mar 28 20:49:11 2012	(r233627)
+++ head/lib/libpmc/pmc.westmere.3	Wed Mar 28 20:58:30 2012	(r233628)
@@ -1381,6 +1381,7 @@ Counts number of SID integer 64 bit shif
 .Xr pmc.corei7 3 ,
 .Xr pmc.corei7uc 3 ,
 .Xr pmc.westmereuc 3 ,
+.Xr pmc.soft 3 ,
 .Xr pmc.tsc 3 ,
 .Xr pmc_cpuinfo 3 ,
 .Xr pmclog 3 ,

Modified: head/lib/libpmc/pmc.westmereuc.3
==============================================================================
--- head/lib/libpmc/pmc.westmereuc.3	Wed Mar 28 20:49:11 2012	(r233627)
+++ head/lib/libpmc/pmc.westmereuc.3	Wed Mar 28 20:58:30 2012	(r233628)
@@ -1066,6 +1066,7 @@ disabled.
 .Xr pmc.corei7 3 ,
 .Xr pmc.corei7uc 3 ,
 .Xr pmc.westmere 3 ,
+.Xr pmc.soft 3 ,
 .Xr pmc.tsc 3 ,
 .Xr pmc_cpuinfo 3 ,
 .Xr pmclog 3 ,

Modified: head/lib/libpmc/pmc.xscale.3
==============================================================================
--- head/lib/libpmc/pmc.xscale.3	Wed Mar 28 20:49:11 2012	(r233627)
+++ head/lib/libpmc/pmc.xscale.3	Wed Mar 28 20:58:30 2012	(r233628)
@@ -134,6 +134,7 @@ and the underlying hardware events used.
 .Xr pmc 3 ,
 .Xr pmc_cpuinfo 3 ,
 .Xr pmclog 3 ,
+.Xr pmc.soft 3 ,
 .Xr hwpmc 4
 .Sh HISTORY
 The

Modified: head/lib/libpmc/pmclog.c
==============================================================================
--- head/lib/libpmc/pmclog.c	Wed Mar 28 20:49:11 2012	(r233627)
+++ head/lib/libpmc/pmclog.c	Wed Mar 28 20:58:30 2012	(r233628)
@@ -369,6 +369,12 @@ pmclog_get_event(void *cookie, char **da
 		    == NULL)
 			goto error;
 		break;
+	case PMCLOG_TYPE_PMCALLOCATEDYN:
+		PMCLOG_READ32(le,ev->pl_u.pl_ad.pl_pmcid);
+		PMCLOG_READ32(le,ev->pl_u.pl_ad.pl_event);
+		PMCLOG_READ32(le,ev->pl_u.pl_ad.pl_flags);
+		PMCLOG_READSTRING(le,ev->pl_u.pl_ad.pl_evname,PMC_NAME_MAX);
+		break;
 	case PMCLOG_TYPE_PMCATTACH:
 		PMCLOG_GET_PATHLEN(pathlen,evlen,pmclog_pmcattach);
 		PMCLOG_READ32(le,ev->pl_u.pl_t.pl_pmcid);

Modified: head/lib/libpmc/pmclog.h
==============================================================================
--- head/lib/libpmc/pmclog.h	Wed Mar 28 20:49:11 2012	(r233627)
+++ head/lib/libpmc/pmclog.h	Wed Mar 28 20:58:30 2012	(r233628)
@@ -88,6 +88,13 @@ struct pmclog_ev_pmcallocate {
 	pmc_id_t	pl_pmcid;
 };
 
+struct pmclog_ev_pmcallocatedyn {
+	uint32_t	pl_event;
+	char 		pl_evname[PMC_NAME_MAX];
+	uint32_t	pl_flags;
+	pmc_id_t	pl_pmcid;
+};
+
 struct pmclog_ev_pmcattach {
 	pmc_id_t	pl_pmcid;
 	pid_t		pl_pid;
@@ -146,6 +153,7 @@ struct pmclog_ev {
 		struct pmclog_ev_map_out	pl_mo;
 		struct pmclog_ev_pcsample	pl_s;
 		struct pmclog_ev_pmcallocate	pl_a;
+		struct pmclog_ev_pmcallocatedyn	pl_ad;
 		struct pmclog_ev_pmcattach	pl_t;
 		struct pmclog_ev_pmcdetach	pl_d;
 		struct pmclog_ev_proccsw	pl_c;

Modified: head/sys/amd64/amd64/trap.c
==============================================================================
--- head/sys/amd64/amd64/trap.c	Wed Mar 28 20:49:11 2012	(r233627)
+++ head/sys/amd64/amd64/trap.c	Wed Mar 28 20:58:30 2012	(r233628)
@@ -71,6 +71,9 @@ __FBSDID("$FreeBSD$");
 #include 
 #ifdef HWPMC_HOOKS
 #include 
+PMC_SOFT_DEFINE( , , page_fault, all);
+PMC_SOFT_DEFINE( , , page_fault, read);
+PMC_SOFT_DEFINE( , , page_fault, write);
 #endif
 
 #include 
@@ -743,8 +746,20 @@ trap_pfault(frame, usermode)
 		 */
 		rv = vm_fault(map, va, ftype, VM_FAULT_NORMAL);
 	}
-	if (rv == KERN_SUCCESS)
+	if (rv == KERN_SUCCESS) {
+#ifdef HWPMC_HOOKS
+		if (ftype == VM_PROT_READ || ftype == VM_PROT_WRITE) {
+			PMC_SOFT_CALL_TF( , , page_fault, all, frame);
+			if (ftype == VM_PROT_READ)
+				PMC_SOFT_CALL_TF( , , page_fault, read,
+				    frame);
+			else
+				PMC_SOFT_CALL_TF( , , page_fault, write,
+				    frame);
+		}
+#endif
 		return (0);
+	}
 nogo:
 	if (!usermode) {
 		if (td->td_intr_nesting_level == 0 &&

Modified: head/sys/amd64/include/pmc_mdep.h
==============================================================================
--- head/sys/amd64/include/pmc_mdep.h	Wed Mar 28 20:49:11 2012	(r233627)
+++ head/sys/amd64/include/pmc_mdep.h	Wed Mar 28 20:58:30 2012	(r233628)
@@ -50,13 +50,13 @@ struct pmc_mdep;
  * measurement architecture have PMCs of the following classes: TSC,
  * IAF, IAP, UCF and UCP.
  */
-#define	PMC_MDEP_CLASS_INDEX_TSC	0
-#define	PMC_MDEP_CLASS_INDEX_K8		1
-#define	PMC_MDEP_CLASS_INDEX_P4		1
-#define	PMC_MDEP_CLASS_INDEX_IAP	1
-#define	PMC_MDEP_CLASS_INDEX_IAF	2
-#define	PMC_MDEP_CLASS_INDEX_UCP	3
-#define	PMC_MDEP_CLASS_INDEX_UCF	4
+#define	PMC_MDEP_CLASS_INDEX_TSC	1
+#define	PMC_MDEP_CLASS_INDEX_K8		2
+#define	PMC_MDEP_CLASS_INDEX_P4		2
+#define	PMC_MDEP_CLASS_INDEX_IAP	2
+#define	PMC_MDEP_CLASS_INDEX_IAF	3
+#define	PMC_MDEP_CLASS_INDEX_UCP	4
+#define	PMC_MDEP_CLASS_INDEX_UCF	5
 
 /*
  * On the amd64 platform we support the following PMCs.
@@ -119,6 +119,15 @@ union pmc_md_pmc {
 
 #define	PMC_IN_USERSPACE(va) ((va) <= VM_MAXUSER_ADDRESS)
 
+/* Build a fake kernel trapframe from current instruction pointer. */
+#define PMC_FAKE_TRAPFRAME(TF)						\
+	do {								\
+	(TF)->tf_cs = 0; (TF)->tf_rflags = 0;				\
+	__asm __volatile("movq %%rbp,%0" : "=r" ((TF)->tf_rbp));	\
+	__asm __volatile("movq %%rsp,%0" : "=r" ((TF)->tf_rsp));	\
+	__asm __volatile("call 1f \n\t1: pop %0" : "=r"((TF)->tf_rip));	\
+	} while (0)
+
 /*
  * Prototypes
  */

Modified: head/sys/arm/include/pmc_mdep.h
==============================================================================
--- head/sys/arm/include/pmc_mdep.h	Wed Mar 28 20:49:11 2012	(r233627)
+++ head/sys/arm/include/pmc_mdep.h	Wed Mar 28 20:58:30 2012	(r233628)
@@ -29,7 +29,7 @@
 #ifndef _MACHINE_PMC_MDEP_H_
 #define	_MACHINE_PMC_MDEP_H_
 
-#define	PMC_MDEP_CLASS_INDEX_XSCALE	0
+#define	PMC_MDEP_CLASS_INDEX_XSCALE	1
 /*
  * On the ARM platform we support the following PMCs.
  *

Modified: head/sys/conf/files
==============================================================================
--- head/sys/conf/files	Wed Mar 28 20:49:11 2012	(r233627)
+++ head/sys/conf/files	Wed Mar 28 20:58:30 2012	(r233628)
@@ -1260,6 +1260,7 @@ dev/hme/if_hme_sbus.c		optional hme sbus
 dev/hptiop/hptiop.c		optional hptiop scbus
 dev/hwpmc/hwpmc_logging.c	optional hwpmc
 dev/hwpmc/hwpmc_mod.c		optional hwpmc
+dev/hwpmc/hwpmc_soft.c		optional hwpmc
 dev/ichsmb/ichsmb.c		optional ichsmb
 dev/ichsmb/ichsmb_pci.c		optional ichsmb pci
 dev/ida/ida.c			optional ida

Modified: head/sys/dev/hwpmc/hwpmc_amd.c
==============================================================================
--- head/sys/dev/hwpmc/hwpmc_amd.c	Wed Mar 28 20:49:11 2012	(r233627)
+++ head/sys/dev/hwpmc/hwpmc_amd.c	Wed Mar 28 20:58:30 2012	(r233628)
@@ -687,7 +687,8 @@ amd_intr(int cpu, struct trapframe *tf)
 		wrmsr(perfctr, AMD_RELOAD_COUNT_TO_PERFCTR_VALUE(v));
 
 		/* Restart the counter if logging succeeded. */
-		error = pmc_process_interrupt(cpu, pm, tf, TRAPF_USERMODE(tf));
+		error = pmc_process_interrupt(cpu, PMC_HR, pm, tf,
+		    TRAPF_USERMODE(tf));
 		if (error == 0)
 			wrmsr(evsel, config | AMD_PMC_ENABLE);
 	}
@@ -874,7 +875,7 @@ amd_pcpu_fini(struct pmc_mdep *md, int c
 struct pmc_mdep *
 pmc_amd_initialize(void)
 {
-	int classindex, error, i, nclasses, ncpus;
+	int classindex, error, i, ncpus;
 	struct pmc_classdep *pcd;
 	enum pmc_cputype cputype;
 	struct pmc_mdep *pmc_mdep;
@@ -926,12 +927,9 @@ pmc_amd_initialize(void)
 	 * These processors have two classes of PMCs: the TSC and
 	 * programmable PMCs.
 	 */
-	nclasses = 2;
-	pmc_mdep = malloc(sizeof(struct pmc_mdep) + nclasses * sizeof (struct pmc_classdep),
-	    M_PMC, M_WAITOK|M_ZERO);
+	pmc_mdep = pmc_mdep_alloc(2);
 
 	pmc_mdep->pmd_cputype = cputype;
-	pmc_mdep->pmd_nclass  = nclasses;
 
 	ncpus = pmc_cpu_max();
 

Modified: head/sys/dev/hwpmc/hwpmc_core.c
==============================================================================
--- head/sys/dev/hwpmc/hwpmc_core.c	Wed Mar 28 20:49:11 2012	(r233627)
+++ head/sys/dev/hwpmc/hwpmc_core.c	Wed Mar 28 20:58:30 2012	(r233628)
@@ -2239,7 +2239,7 @@ core_intr(int cpu, struct trapframe *tf)
 		if (pm->pm_state != PMC_STATE_RUNNING)
 			continue;
 
-		error = pmc_process_interrupt(cpu, pm, tf,
+		error = pmc_process_interrupt(cpu, PMC_HR, pm, tf,
 		    TRAPF_USERMODE(tf));
 
 		v = pm->pm_sc.pm_reloadcount;
@@ -2326,7 +2326,7 @@ core2_intr(int cpu, struct trapframe *tf
 		    !PMC_IS_SAMPLING_MODE(PMC_TO_MODE(pm)))
 			continue;
 
-		error = pmc_process_interrupt(cpu, pm, tf,
+		error = pmc_process_interrupt(cpu, PMC_HR, pm, tf,
 		    TRAPF_USERMODE(tf));
 		if (error)
 			intrenable &= ~flag;
@@ -2354,7 +2354,7 @@ core2_intr(int cpu, struct trapframe *tf
 		    !PMC_IS_SAMPLING_MODE(PMC_TO_MODE(pm)))
 			continue;
 
-		error = pmc_process_interrupt(cpu, pm, tf,
+		error = pmc_process_interrupt(cpu, PMC_HR, pm, tf,
 		    TRAPF_USERMODE(tf));
 		if (error)
 			intrenable &= ~flag;

Modified: head/sys/dev/hwpmc/hwpmc_intel.c
==============================================================================
--- head/sys/dev/hwpmc/hwpmc_intel.c	Wed Mar 28 20:49:11 2012	(r233627)
+++ head/sys/dev/hwpmc/hwpmc_intel.c	Wed Mar 28 20:58:30 2012	(r233628)
@@ -162,12 +162,10 @@ pmc_intel_initialize(void)
 		return (NULL);
 	}
 
-	pmc_mdep = malloc(sizeof(struct pmc_mdep) + nclasses *
-	    sizeof(struct pmc_classdep), M_PMC, M_WAITOK|M_ZERO);
+	/* Allocate base class and initialize machine dependent struct */
+	pmc_mdep = pmc_mdep_alloc(nclasses);
 
 	pmc_mdep->pmd_cputype 	 = cputype;
-	pmc_mdep->pmd_nclass	 = nclasses;
-
 	pmc_mdep->pmd_switch_in	 = intel_switch_in;
 	pmc_mdep->pmd_switch_out = intel_switch_out;
 

Modified: head/sys/dev/hwpmc/hwpmc_logging.c
==============================================================================
--- head/sys/dev/hwpmc/hwpmc_logging.c	Wed Mar 28 20:49:11 2012	(r233627)
+++ head/sys/dev/hwpmc/hwpmc_logging.c	Wed Mar 28 20:58:30 2012	(r233628)
@@ -129,6 +129,7 @@ static struct mtx pmc_kthread_mtx;	/* sl
 
 /* Emit a string.  Caution: does NOT update _le, so needs to be last */
 #define	PMCLOG_EMITSTRING(S,L)	do { bcopy((S), _le, (L)); } while (0)
+#define	PMCLOG_EMITNULLSTRING(L) do { bzero(_le, (L)); } while (0)
 
 #define	PMCLOG_DESPATCH(PO)						\
 		pmclog_release((PO));					\
@@ -835,16 +836,33 @@ void
 pmclog_process_pmcallocate(struct pmc *pm)
 {
 	struct pmc_owner *po;
+	struct pmc_soft *ps;
 
 	po = pm->pm_owner;
 
 	PMCDBG(LOG,ALL,1, "pm=%p", pm);
 
-	PMCLOG_RESERVE(po, PMCALLOCATE, sizeof(struct pmclog_pmcallocate));
-	PMCLOG_EMIT32(pm->pm_id);
-	PMCLOG_EMIT32(pm->pm_event);
-	PMCLOG_EMIT32(pm->pm_flags);
-	PMCLOG_DESPATCH(po);
+	if (PMC_TO_CLASS(pm) == PMC_CLASS_SOFT) {
+		PMCLOG_RESERVE(po, PMCALLOCATEDYN,
+		    sizeof(struct pmclog_pmcallocatedyn));
+		PMCLOG_EMIT32(pm->pm_id);
+		PMCLOG_EMIT32(pm->pm_event);
+		PMCLOG_EMIT32(pm->pm_flags);
+		ps = pmc_soft_ev_acquire(pm->pm_event);
+		if (ps != NULL)
+			PMCLOG_EMITSTRING(ps->ps_ev.pm_ev_name,PMC_NAME_MAX);
+		else
+			PMCLOG_EMITNULLSTRING(PMC_NAME_MAX);
+		pmc_soft_ev_release(ps);
+		PMCLOG_DESPATCH(po);
+	} else {
+		PMCLOG_RESERVE(po, PMCALLOCATE,
+		    sizeof(struct pmclog_pmcallocate));
+		PMCLOG_EMIT32(pm->pm_id);
+		PMCLOG_EMIT32(pm->pm_event);
+		PMCLOG_EMIT32(pm->pm_flags);
+		PMCLOG_DESPATCH(po);
+	}
 }
 
 void

Modified: head/sys/dev/hwpmc/hwpmc_mips.c
==============================================================================
--- head/sys/dev/hwpmc/hwpmc_mips.c	Wed Mar 28 20:49:11 2012	(r233627)
+++ head/sys/dev/hwpmc/hwpmc_mips.c	Wed Mar 28 20:58:30 2012	(r233628)
@@ -287,7 +287,7 @@ mips_pmc_intr(int cpu, struct trapframe 
 		retval = 1;
 		if (pm->pm_state != PMC_STATE_RUNNING)
 			continue;
-		error = pmc_process_interrupt(cpu, pm, tf,
+		error = pmc_process_interrupt(cpu, PMC_HR, pm, tf,
 		    TRAPF_USERMODE(tf));
 		if (error) {
 			/* Clear/disable the relevant counter */

Modified: head/sys/dev/hwpmc/hwpmc_mod.c
==============================================================================
--- head/sys/dev/hwpmc/hwpmc_mod.c	Wed Mar 28 20:49:11 2012	(r233627)
+++ head/sys/dev/hwpmc/hwpmc_mod.c	Wed Mar 28 20:58:30 2012	(r233628)
@@ -70,6 +70,8 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+#include "hwpmc_soft.h"
+
 /*
  * Types
  */
@@ -182,7 +184,7 @@ static int	pmc_attach_one_process(struct
 static int	pmc_can_allocate_rowindex(struct proc *p, unsigned int ri,
     int cpu);
 static int	pmc_can_attach(struct pmc *pm, struct proc *p);
-static void	pmc_capture_user_callchain(int cpu, struct trapframe *tf);
+static void	pmc_capture_user_callchain(int cpu, int soft, struct trapframe *tf);
 static void	pmc_cleanup(void);
 static int	pmc_detach_process(struct proc *p, struct pmc *pm);
 static int	pmc_detach_one_process(struct proc *p, struct pmc *pm,
@@ -206,7 +208,7 @@ static void	pmc_process_csw_out(struct t
 static void	pmc_process_exit(void *arg, struct proc *p);
 static void	pmc_process_fork(void *arg, struct proc *p1,
     struct proc *p2, int n);
-static void	pmc_process_samples(int cpu);
+static void	pmc_process_samples(int cpu, int soft);
 static void	pmc_release_pmc_descriptor(struct pmc *pmc);
 static void	pmc_remove_owner(struct pmc_owner *po);
 static void	pmc_remove_process_descriptor(struct pmc_process *pp);
@@ -218,12 +220,16 @@ static int	pmc_stop(struct pmc *pm);
 static int	pmc_syscall_handler(struct thread *td, void *syscall_args);
 static void	pmc_unlink_target_process(struct pmc *pmc,
     struct pmc_process *pp);
+static int generic_switch_in(struct pmc_cpu *pc, struct pmc_process *pp);
+static int generic_switch_out(struct pmc_cpu *pc, struct pmc_process *pp);
+static struct pmc_mdep *pmc_generic_cpu_initialize(void);
+static void pmc_generic_cpu_finalize(struct pmc_mdep *md);
 
 /*
  * Kernel tunables and sysctl(8) interface.
  */
 
-SYSCTL_NODE(_kern, OID_AUTO, hwpmc, CTLFLAG_RW, 0, "HWPMC parameters");
+SYSCTL_DECL(_kern_hwpmc);
 
 static int pmc_callchaindepth = PMC_CALLCHAIN_DEPTH;
 TUNABLE_INT(PMC_SYSCTL_NAME_PREFIX "callchaindepth", &pmc_callchaindepth);
@@ -1833,7 +1839,9 @@ const char *pmc_hooknames[] = {
 	"KLDUNLOAD",
 	"MMAP",
 	"MUNMAP",
-	"CALLCHAIN"
+	"CALLCHAIN-NMI",
+	"CALLCHAIN-SOFT",
+	"SOFTSAMPLING"
 };
 #endif
 
@@ -1992,7 +2000,8 @@ pmc_hook_handler(struct thread *td, int 
 		 * lose the interrupt sample.
 		 */
 		CPU_CLR_ATOMIC(PCPU_GET(cpuid), &pmc_cpumask);
-		pmc_process_samples(PCPU_GET(cpuid));
+		pmc_process_samples(PCPU_GET(cpuid), PMC_HR);
+		pmc_process_samples(PCPU_GET(cpuid), PMC_SR);
 		break;
 
 
@@ -2022,11 +2031,30 @@ pmc_hook_handler(struct thread *td, int 
 		 */
 		KASSERT(td == curthread, ("[pmc,%d] td != curthread",
 		    __LINE__));
-		pmc_capture_user_callchain(PCPU_GET(cpuid),
+
+		pmc_capture_user_callchain(PCPU_GET(cpuid), PMC_HR,
 		    (struct trapframe *) arg);
 		td->td_pflags &= ~TDP_CALLCHAIN;
 		break;
 
+	case PMC_FN_USER_CALLCHAIN_SOFT:
+		/*
+		 * Record a call chain.
+		 */
+		KASSERT(td == curthread, ("[pmc,%d] td != curthread",
+		    __LINE__));
+		pmc_capture_user_callchain(PCPU_GET(cpuid), PMC_SR,
+		    (struct trapframe *) arg);
+		td->td_pflags &= ~TDP_CALLCHAIN;
+		break;
+
+	case PMC_FN_SOFT_SAMPLING:
+		/*
+		 * Call soft PMC sampling intr.
+		 */
+		pmc_soft_intr((struct pmckern_soft *) arg);
+		break;
+
 	default:
 #ifdef	DEBUG
 		KASSERT(0, ("[pmc,%d] unknown hook %d\n", __LINE__, function));
@@ -2221,18 +2249,17 @@ pmc_destroy_pmc_descriptor(struct pmc *p
 static void
 pmc_wait_for_pmc_idle(struct pmc *pm)
 {
-#ifdef	DEBUG
+#ifdef DEBUG
 	volatile int maxloop;
 
 	maxloop = 100 * pmc_cpu_max();
 #endif
-
 	/*
 	 * Loop (with a forced context switch) till the PMC's runcount
 	 * comes down to zero.
 	 */
 	while (atomic_load_acq_32(&pm->pm_runcount) > 0) {
-#ifdef	DEBUG
+#ifdef DEBUG
 		maxloop--;
 		KASSERT(maxloop > 0,
 		    ("[pmc,%d] (ri%d, rc%d) waiting too long for "
@@ -2972,6 +2999,53 @@ pmc_syscall_handler(struct thread *td, v
 	}
 	break;
 
+	/*
+	 * Retrieve soft events list.
+	 */
+	case PMC_OP_GETDYNEVENTINFO:
+	{
+		enum pmc_class			cl;
+		enum pmc_event			ev;
+		struct pmc_op_getdyneventinfo	*gei;
+		struct pmc_dyn_event_descr	dev;
+		struct pmc_soft			*ps;
+		uint32_t			nevent;
+
+		sx_assert(&pmc_sx, SX_LOCKED);
+
+		gei = (struct pmc_op_getdyneventinfo *) arg;
+
+		if ((error = copyin(&gei->pm_class, &cl, sizeof(cl))) != 0)
+			break;
+
+		/* Only SOFT class is dynamic. */
+		if (cl != PMC_CLASS_SOFT) {
+			error = EINVAL;
+			break;
+		}
+
+		nevent = 0;
+		for (ev = PMC_EV_SOFT_FIRST; ev <= PMC_EV_SOFT_LAST; ev++) {
+			ps = pmc_soft_ev_acquire(ev);
+			if (ps == NULL)
+				continue;
+			bcopy(&ps->ps_ev, &dev, sizeof(dev));
+			pmc_soft_ev_release(ps);
+
+			error = copyout(&dev,
+			    &gei->pm_events[nevent],
+			    sizeof(struct pmc_dyn_event_descr));
+			if (error != 0)
+				break;
+			nevent++;
+		}
+		if (error != 0)
+			break;
+
+		error = copyout(&nevent, &gei->pm_nevent,

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***

From owner-svn-src-head@FreeBSD.ORG  Wed Mar 28 21:21:20 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 1FF5F106564A;
	Wed, 28 Mar 2012 21:21:20 +0000 (UTC)
	(envelope-from mckusick@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id E5B398FC08;
	Wed, 28 Mar 2012 21:21:19 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2SLLJhf054697;
	Wed, 28 Mar 2012 21:21:19 GMT
	(envelope-from mckusick@svn.freebsd.org)
Received: (from mckusick@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2SLLJIu054695;
	Wed, 28 Mar 2012 21:21:19 GMT
	(envelope-from mckusick@svn.freebsd.org)
Message-Id: <201203282121.q2SLLJIu054695@svn.freebsd.org>
From: Kirk McKusick 
Date: Wed, 28 Mar 2012 21:21:19 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233629 - head/sys/ufs/ffs
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 28 Mar 2012 21:21:20 -0000

Author: mckusick
Date: Wed Mar 28 21:21:19 2012
New Revision: 233629
URL: http://svn.freebsd.org/changeset/base/233629

Log:
  A refinement of change 232351 to avoid a race with a forcible unmount.
  While we have a snapshot vnode unlocked to avoid a deadlock with another
  inode in the same inode block being updated, the filesystem containing
  it may be forcibly unmounted. When that happens the snapshot vnode is
  revoked. We need to check for that condition and fail appropriately.
  
  This change will be included along with 232351 when it is MFC'ed to 9.
  
  Spotted by:  kib
  Reviewed by: kib

Modified:
  head/sys/ufs/ffs/ffs_inode.c

Modified: head/sys/ufs/ffs/ffs_inode.c
==============================================================================
--- head/sys/ufs/ffs/ffs_inode.c	Wed Mar 28 20:58:30 2012	(r233628)
+++ head/sys/ufs/ffs/ffs_inode.c	Wed Mar 28 21:21:19 2012	(r233629)
@@ -106,6 +106,7 @@ ffs_update(vp, waitfor)
 	flags = 0;
 	if (IS_SNAPSHOT(ip))
 		flags = GB_LOCK_NOWAIT;
+loop:
 	error = breadn_flags(ip->i_devvp,
 	     fsbtodb(fs, ino_to_fsba(fs, ip->i_number)),
 	     (int) fs->fs_bsize, 0, 0, 0, NOCRED, flags, &bp);
@@ -115,13 +116,27 @@ ffs_update(vp, waitfor)
 			return (error);
 		}
 		KASSERT((IS_SNAPSHOT(ip)), ("EBUSY from non-snapshot"));
-		vref(vp);	/* Protect against ffs_snapgone() */
+		/*
+		 * Wait for our inode block to become available.
+		 *
+		 * Hold a reference to the vnode to protect against
+		 * ffs_snapgone(). Since we hold a reference, it can only
+		 * get reclaimed (VI_DOOMED flag) in a forcible downgrade
+		 * or unmount. For an unmount, the entire filesystem will be
+		 * gone, so we cannot attempt to touch anything associated
+		 * with it while the vnode is unlocked; all we can do is 
+		 * pause briefly and try again. If when we relock the vnode
+		 * we discover that it has been reclaimed, updating it is no
+		 * longer necessary and we can just return an error.
+		 */
+		vref(vp);
 		VOP_UNLOCK(vp, 0);
-		(void) bread(ip->i_devvp,
-		     fsbtodb(fs, ino_to_fsba(fs, ip->i_number)),
-		     (int) fs->fs_bsize, NOCRED, &bp);
+		pause("ffsupd", 1);
 		vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
 		vrele(vp);
+		if ((vp->v_iflag & VI_DOOMED) != 0)
+			return (ENOENT);
+		goto loop;
 	}
 	if (DOINGSOFTDEP(vp))
 		softdep_update_inodeblock(ip, bp, waitfor);

From owner-svn-src-head@FreeBSD.ORG  Wed Mar 28 21:55:57 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 8D17C106564A;
	Wed, 28 Mar 2012 21:55:57 +0000 (UTC) (envelope-from marck@rinet.ru)
Received: from woozle.rinet.ru (woozle.rinet.ru [195.54.192.68])
	by mx1.freebsd.org (Postfix) with ESMTP id 0C66C8FC16;
	Wed, 28 Mar 2012 21:55:56 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
	by woozle.rinet.ru (8.14.5/8.14.5) with ESMTP id q2SLtn78042168;
	Thu, 29 Mar 2012 01:55:49 +0400 (MSK) (envelope-from marck@rinet.ru)
Date: Thu, 29 Mar 2012 01:55:49 +0400 (MSK)
From: Dmitry Morozovsky 
To: Kirk McKusick 
In-Reply-To: <201203282121.q2SLLJIu054695@svn.freebsd.org>
Message-ID: 
References: <201203282121.q2SLLJIu054695@svn.freebsd.org>
User-Agent: Alpine 2.00 (BSF 1167 2008-08-23)
X-NCC-RegID: ru.rinet
X-OpenPGP-Key-ID: 6B691B03
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.7
	(woozle.rinet.ru [0.0.0.0]); Thu, 29 Mar 2012 01:55:49 +0400 (MSK)
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r233629 - head/sys/ufs/ffs
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 28 Mar 2012 21:55:57 -0000

Dear Kirk,

On Wed, 28 Mar 2012, Kirk McKusick wrote:

> Author: mckusick
> Date: Wed Mar 28 21:21:19 2012
> New Revision: 233629
> URL: http://svn.freebsd.org/changeset/base/233629
> 
> Log:
>   A refinement of change 232351 to avoid a race with a forcible unmount.
>   While we have a snapshot vnode unlocked to avoid a deadlock with another
>   inode in the same inode block being updated, the filesystem containing
>   it may be forcibly unmounted. When that happens the snapshot vnode is
>   revoked. We need to check for that condition and fail appropriately.

Thank you and Kostik very much!

How far we are from enabling snapshot of SU+J UFS back?

[snip]

-- 
Sincerely,
D.Marck                                     [DM5020, MCK-RIPE, DM3-RIPN]
[ FreeBSD committer:                                 marck@FreeBSD.org ]
------------------------------------------------------------------------
*** Dmitry Morozovsky --- D.Marck --- Wild Woozle --- marck@rinet.ru ***
------------------------------------------------------------------------

From owner-svn-src-head@FreeBSD.ORG  Wed Mar 28 23:51:07 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 76CDF1065686;
	Wed, 28 Mar 2012 23:51:07 +0000 (UTC)
	(envelope-from jimharris@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 61FA18FC19;
	Wed, 28 Mar 2012 23:51:07 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2SNp79w065598;
	Wed, 28 Mar 2012 23:51:07 GMT
	(envelope-from jimharris@svn.freebsd.org)
Received: (from jimharris@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2SNp73v065596;
	Wed, 28 Mar 2012 23:51:07 GMT
	(envelope-from jimharris@svn.freebsd.org)
Message-Id: <201203282351.q2SNp73v065596@svn.freebsd.org>
From: Jim Harris 
Date: Wed, 28 Mar 2012 23:51:07 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233631 - head/lib/libc/sys
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 28 Mar 2012 23:51:07 -0000

Author: jimharris
Date: Wed Mar 28 23:51:06 2012
New Revision: 233631
URL: http://svn.freebsd.org/changeset/base/233631

Log:
  Fix comment to specify correct struct name.
  
  Reviewed by: gjb
  Approved by: sbruno

Modified:
  head/lib/libc/sys/kldstat.2

Modified: head/lib/libc/sys/kldstat.2
==============================================================================
--- head/lib/libc/sys/kldstat.2	Wed Mar 28 21:34:55 2012	(r233630)
+++ head/lib/libc/sys/kldstat.2	Wed Mar 28 23:51:06 2012	(r233631)
@@ -25,7 +25,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd April 23, 2011
+.Dd March 28, 2012
 .Dt KLDSTAT 2
 .Os
 .Sh NAME
@@ -47,7 +47,7 @@ into
 .Fa stat .
 .Bd -literal
 struct kld_file_stat {
-	int         version;        /* set to sizeof(linker_file_stat) */
+	int         version;    /* set to sizeof(struct kld_file_stat) */
 	char        name[MAXPATHLEN];
 	int         refs;
 	int         id;

From owner-svn-src-head@FreeBSD.ORG  Thu Mar 29 02:02:14 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id B6433106564A;
	Thu, 29 Mar 2012 02:02:14 +0000 (UTC)
	(envelope-from nwhitehorn@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id A158E8FC0A;
	Thu, 29 Mar 2012 02:02:14 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2T22EvB070046;
	Thu, 29 Mar 2012 02:02:14 GMT
	(envelope-from nwhitehorn@svn.freebsd.org)
Received: (from nwhitehorn@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2T22E9I070042;
	Thu, 29 Mar 2012 02:02:14 GMT
	(envelope-from nwhitehorn@svn.freebsd.org)
Message-Id: <201203290202.q2T22E9I070042@svn.freebsd.org>
From: Nathan Whitehorn 
Date: Thu, 29 Mar 2012 02:02:14 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233635 - head/sys/powerpc/include
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Mar 2012 02:02:14 -0000

Author: nwhitehorn
Date: Thu Mar 29 02:02:14 2012
New Revision: 233635
URL: http://svn.freebsd.org/changeset/base/233635

Log:
  Allow multiple inclusion of trap.h. This has always been broken, but
  until recently never caused problems.

Modified:
  head/sys/powerpc/include/trap.h
  head/sys/powerpc/include/trap_aim.h
  head/sys/powerpc/include/trap_booke.h

Modified: head/sys/powerpc/include/trap.h
==============================================================================
--- head/sys/powerpc/include/trap.h	Thu Mar 29 01:46:56 2012	(r233634)
+++ head/sys/powerpc/include/trap.h	Thu Mar 29 02:02:14 2012	(r233635)
@@ -6,7 +6,3 @@
 #include 
 #endif
 
-#ifndef LOCORE
-struct trapframe;
-void    trap(struct trapframe *);
-#endif

Modified: head/sys/powerpc/include/trap_aim.h
==============================================================================
--- head/sys/powerpc/include/trap_aim.h	Thu Mar 29 01:46:56 2012	(r233634)
+++ head/sys/powerpc/include/trap_aim.h	Thu Mar 29 02:02:14 2012	(r233635)
@@ -119,4 +119,9 @@
 #define	EXC_PGM_PRIV		(1UL << 18)
 #define	EXC_PGM_TRAP		(1UL << 17)
 
+#ifndef LOCORE
+struct	trapframe;
+void    trap(struct trapframe *);
+#endif
+
 #endif	/* _POWERPC_TRAP_H_ */

Modified: head/sys/powerpc/include/trap_booke.h
==============================================================================
--- head/sys/powerpc/include/trap_booke.h	Thu Mar 29 01:46:56 2012	(r233634)
+++ head/sys/powerpc/include/trap_booke.h	Thu Mar 29 02:02:14 2012	(r233635)
@@ -52,4 +52,9 @@
 
 #define	EXC_LAST	255
 
+#ifndef LOCORE
+struct	trapframe;
+void    trap(struct trapframe *);
+#endif
+
 #endif	/* _POWERPC_TRAP_H_ */

From owner-svn-src-head@FreeBSD.ORG  Thu Mar 29 02:02:23 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id D8C6C106566B;
	Thu, 29 Mar 2012 02:02:23 +0000 (UTC)
	(envelope-from jmallett@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id C2A188FC08;
	Thu, 29 Mar 2012 02:02:23 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2T22N0H070086;
	Thu, 29 Mar 2012 02:02:23 GMT
	(envelope-from jmallett@svn.freebsd.org)
Received: (from jmallett@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2T22NjW070084;
	Thu, 29 Mar 2012 02:02:23 GMT
	(envelope-from jmallett@svn.freebsd.org)
Message-Id: <201203290202.q2T22NjW070084@svn.freebsd.org>
From: Juli Mallett 
Date: Thu, 29 Mar 2012 02:02:23 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233636 - head/sys/mips/nlm/dev/net
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Mar 2012 02:02:23 -0000

Author: jmallett
Date: Thu Mar 29 02:02:23 2012
New Revision: 233636
URL: http://svn.freebsd.org/changeset/base/233636

Log:
  Fix little-endian built.

Modified:
  head/sys/mips/nlm/dev/net/nae.c

Modified: head/sys/mips/nlm/dev/net/nae.c
==============================================================================
--- head/sys/mips/nlm/dev/net/nae.c	Thu Mar 29 02:02:14 2012	(r233635)
+++ head/sys/mips/nlm/dev/net/nae.c	Thu Mar 29 02:02:23 2012	(r233636)
@@ -194,7 +194,7 @@ nlm_reset_nae(int node)
 
 #if BYTE_ORDER == LITTLE_ENDIAN
 	if (nlm_is_xlp8xx_ax()) {
-		uchar_t	val;
+		uint8_t	val;
 		/* membar fixup */
 		val = (bar0 >> 24) & 0xff;
 		bar0 = (val << 24) | (val << 16) | (val << 8) | val;

From owner-svn-src-head@FreeBSD.ORG  Thu Mar 29 02:03:07 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 6B49B1065674;
	Thu, 29 Mar 2012 02:03:07 +0000 (UTC)
	(envelope-from jmallett@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 563758FC0C;
	Thu, 29 Mar 2012 02:03:07 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2T237Zx070141;
	Thu, 29 Mar 2012 02:03:07 GMT
	(envelope-from jmallett@svn.freebsd.org)
Received: (from jmallett@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2T2370C070139;
	Thu, 29 Mar 2012 02:03:07 GMT
	(envelope-from jmallett@svn.freebsd.org)
Message-Id: <201203290203.q2T2370C070139@svn.freebsd.org>
From: Juli Mallett 
Date: Thu, 29 Mar 2012 02:03:07 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233637 - head/sys/mips/nlm
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Mar 2012 02:03:07 -0000

Author: jmallett
Date: Thu Mar 29 02:03:06 2012
New Revision: 233637
URL: http://svn.freebsd.org/changeset/base/233637

Log:
  Supply endianness implied by the -m flag when compiling ucore code.

Modified:
  head/sys/mips/nlm/files.xlp

Modified: head/sys/mips/nlm/files.xlp
==============================================================================
--- head/sys/mips/nlm/files.xlp	Thu Mar 29 02:02:23 2012	(r233636)
+++ head/sys/mips/nlm/files.xlp	Thu Mar 29 02:03:06 2012	(r233637)
@@ -26,7 +26,7 @@ mips/nlm/dev/net/sgmii.c			optional xlpg
 mips/nlm/dev/net/xaui.c				optional xlpge
 mips/nlm/dev/net/xlpge.c			optional xlpge
 ucore_app.bin					optional xlpge	\
-	compile-with	"${CC} -march=mips32 -mabi=32 -msoft-float -I. -I$S -O3 -funroll-loops -finline-limit=20000 -fno-tree-loop-optimize -fomit-frame-pointer -mno-branch-likely -fno-pic -mno-abicalls -ffunction-sections -fdata-sections -G0 -Wall -Werror -c $S/$M/nlm/dev/net/ucore/crt0_basic.S  $S/$M/nlm/dev/net/ucore/ucore_app.c && ${LD} -melf32btsmip_fbsd -d -warn-common -T$S/$M/nlm/dev/net/ucore/ld.ucore.S crt0_basic.o ucore_app.o -o ucore_app && ${OBJCOPY} -S -O binary -R .note -R .comment ucore_app ${.TARGET}" \
+	compile-with	"${CC} -EB -march=mips32 -mabi=32 -msoft-float -I. -I$S -O3 -funroll-loops -finline-limit=20000 -fno-tree-loop-optimize -fomit-frame-pointer -mno-branch-likely -fno-pic -mno-abicalls -ffunction-sections -fdata-sections -G0 -Wall -Werror -c $S/$M/nlm/dev/net/ucore/crt0_basic.S  $S/$M/nlm/dev/net/ucore/ucore_app.c && ${LD} -melf32btsmip_fbsd -d -warn-common -T$S/$M/nlm/dev/net/ucore/ld.ucore.S crt0_basic.o ucore_app.o -o ucore_app && ${OBJCOPY} -S -O binary -R .note -R .comment ucore_app ${.TARGET}" \
 	no-obj no-implicit-rule	before-depend			\
 	clean		"crt0_basic.o ucore_app.o ucore_app ucore_app.bin"
 ucore_app_bin.h					optional xlpge	\

From owner-svn-src-head@FreeBSD.ORG  Thu Mar 29 02:04:16 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 964811065674;
	Thu, 29 Mar 2012 02:04:16 +0000 (UTC)
	(envelope-from jmallett@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 80CBC8FC1B;
	Thu, 29 Mar 2012 02:04:16 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2T24G5H070213;
	Thu, 29 Mar 2012 02:04:16 GMT
	(envelope-from jmallett@svn.freebsd.org)
Received: (from jmallett@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2T24Glj070210;
	Thu, 29 Mar 2012 02:04:16 GMT
	(envelope-from jmallett@svn.freebsd.org)
Message-Id: <201203290204.q2T24Glj070210@svn.freebsd.org>
From: Juli Mallett 
Date: Thu, 29 Mar 2012 02:04:16 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233638 - head/sys/mips/mips
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Mar 2012 02:04:16 -0000

Author: jmallett
Date: Thu Mar 29 02:04:15 2012
New Revision: 233638
URL: http://svn.freebsd.org/changeset/base/233638

Log:
  Disable FP instruction emulation by default on !o32 because of ABI concerns.
  
  Note that in practice this isn't needed because we get a coprocessor unusable
  exception first, but that's actually something like a bug.

Modified:
  head/sys/mips/mips/trap.c

Modified: head/sys/mips/mips/trap.c
==============================================================================
--- head/sys/mips/mips/trap.c	Thu Mar 29 02:03:06 2012	(r233637)
+++ head/sys/mips/mips/trap.c	Thu Mar 29 02:04:15 2012	(r233638)
@@ -290,6 +290,20 @@ static int allow_unaligned_acc = 1;
 SYSCTL_INT(_vm, OID_AUTO, allow_unaligned_acc, CTLFLAG_RW,
     &allow_unaligned_acc, 0, "Allow unaligned accesses");
 
+/*
+ * FP emulation is assumed to work on O32, but the code is outdated and crufty
+ * enough that it's a more sensible default to have it disabled when using
+ * other ABIs.  At the very least, it needs a lot of help in using
+ * type-semantic ABI-oblivious macros for everything it does.
+ */
+#if defined(__mips_o32)
+static int emulate_fp = 1;
+#else
+static int emulate_fp = 0;
+#endif
+SYSCTL_INT(_machdep, OID_AUTO, emulate_fp, CTLFLAG_RW,
+    &allow_unaligned_acc, 0, "Emulate unimplemented FPU instructions");
+
 static int emulate_unaligned_access(struct trapframe *frame, int mode);
 
 extern void fswintrberr(void); /* XXX */
@@ -988,6 +1002,11 @@ dofault:
 #endif
 
 	case T_FPE + T_USER:
+		if (!emulate_fp) {
+			i = SIGILL;
+			addr = trapframe->pc;
+			break;
+		}
 		MipsFPTrap(trapframe->sr, trapframe->cause, trapframe->pc);
 		goto out;
 

From owner-svn-src-head@FreeBSD.ORG  Thu Mar 29 02:05:11 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id E2F3E1065670;
	Thu, 29 Mar 2012 02:05:11 +0000 (UTC)
	(envelope-from jmallett@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id CE0378FC14;
	Thu, 29 Mar 2012 02:05:11 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2T25BDa070281;
	Thu, 29 Mar 2012 02:05:11 GMT
	(envelope-from jmallett@svn.freebsd.org)
Received: (from jmallett@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2T25BW0070279;
	Thu, 29 Mar 2012 02:05:11 GMT
	(envelope-from jmallett@svn.freebsd.org)
Message-Id: <201203290205.q2T25BW0070279@svn.freebsd.org>
From: Juli Mallett 
Date: Thu, 29 Mar 2012 02:05:11 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233639 - head/sys/mips/cavium
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Mar 2012 02:05:12 -0000

Author: jmallett
Date: Thu Mar 29 02:05:11 2012
New Revision: 233639
URL: http://svn.freebsd.org/changeset/base/233639

Log:
  Turn on messages from the Simple Executive codebase, what few there are.

Modified:
  head/sys/mips/cavium/cvmx_config.h

Modified: head/sys/mips/cavium/cvmx_config.h
==============================================================================
--- head/sys/mips/cavium/cvmx_config.h	Thu Mar 29 02:04:15 2012	(r233638)
+++ head/sys/mips/cavium/cvmx_config.h	Thu Mar 29 02:05:11 2012	(r233639)
@@ -159,6 +159,9 @@
 #define CVMX_ENABLE_PKO_FUNCTIONS
 #endif
 
+/* Enable debug and informational printfs */
+#define CVMX_CONFIG_ENABLE_DEBUG_PRINTS 	1
+
 /************************* Config Specific Defines ************************/
 #define CVMX_LLM_NUM_PORTS 1
 #define CVMX_PKO_QUEUES_PER_PORT_INTERFACE0 1			/**< PKO queues per port for interface 0 (ports 0-15) */

From owner-svn-src-head@FreeBSD.ORG  Thu Mar 29 02:46:44 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 354C11065672;
	Thu, 29 Mar 2012 02:46:44 +0000 (UTC)
	(envelope-from davidxu@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 15FBC8FC0A;
	Thu, 29 Mar 2012 02:46:44 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2T2khxF072052;
	Thu, 29 Mar 2012 02:46:43 GMT (envelope-from davidxu@svn.freebsd.org)
Received: (from davidxu@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2T2khhF072050;
	Thu, 29 Mar 2012 02:46:43 GMT (envelope-from davidxu@svn.freebsd.org)
Message-Id: <201203290246.q2T2khhF072050@svn.freebsd.org>
From: David Xu 
Date: Thu, 29 Mar 2012 02:46:43 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233642 - head/sys/kern
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Mar 2012 02:46:44 -0000

Author: davidxu
Date: Thu Mar 29 02:46:43 2012
New Revision: 233642
URL: http://svn.freebsd.org/changeset/base/233642

Log:
  Reduce code size by creating common timed sleeping function.

Modified:
  head/sys/kern/kern_umtx.c

Modified: head/sys/kern/kern_umtx.c
==============================================================================
--- head/sys/kern/kern_umtx.c	Thu Mar 29 02:45:50 2012	(r233641)
+++ head/sys/kern/kern_umtx.c	Thu Mar 29 02:46:43 2012	(r233642)
@@ -1030,6 +1030,42 @@ tstohz(const struct timespec *tsp)
 	return tvtohz(&tv);
 }
 
+static int
+umtxq_nanosleep(struct thread *td, int clockid, int absolute,
+	struct timespec *timeout, const char *mesg)
+{
+	struct umtx_q *uq;
+	struct timespec ets, cts, tts;
+	int error;
+
+	uq = td->td_umtxq;
+	umtxq_unlock(&uq->uq_key);
+	if (!absolute) {
+		kern_clock_gettime(td, clockid, &ets);
+		timespecadd(&ets, timeout);
+		tts = *timeout;
+	} else { /* absolute time */
+		ets = *timeout;
+		tts = *timeout;
+		kern_clock_gettime(td, clockid, &cts);
+		timespecsub(&tts, &cts);
+	}
+	umtxq_lock(&uq->uq_key);
+	for (;;) {
+		error = umtxq_sleep(uq, mesg, tstohz(&tts));
+		if (error != ETIMEDOUT)
+			break;
+		kern_clock_gettime(td, clockid, &cts);
+		if (timespeccmp(&cts, &ets, >=)) {
+			error = ETIMEDOUT;
+			break;
+		}
+		tts = ets;
+		timespecsub(&tts, &cts);
+	}
+	return (error);
+}
+
 /*
  * Fetch and compare value, sleep on the address if value is not changed.
  */
@@ -1038,7 +1074,6 @@ do_wait(struct thread *td, void *addr, u
 	struct _umtx_time *timeout, int compat32, int is_private)
 {
 	struct umtx_q *uq;
-	struct timespec ets, cts, tts;
 	u_long tmp;
 	int error = 0;
 
@@ -1054,45 +1089,21 @@ do_wait(struct thread *td, void *addr, u
 		tmp = fuword(addr);
         else
 		tmp = (unsigned int)fuword32(addr);
-	if (tmp != id) {
-		umtxq_lock(&uq->uq_key);
-		umtxq_remove(uq);
-		umtxq_unlock(&uq->uq_key);
-	} else if (timeout == NULL) {
-		umtxq_lock(&uq->uq_key);
-		error = umtxq_sleep(uq, "uwait", 0);
-		umtxq_remove(uq);
-		umtxq_unlock(&uq->uq_key);
-	} else {
-		kern_clock_gettime(td, timeout->_clockid, &cts);
-		if ((timeout->_flags & UMTX_ABSTIME) == 0) {
-			ets = cts;
-			timespecadd(&ets, &timeout->_timeout);
-		} else {
-			ets = timeout->_timeout;
-		}
-		umtxq_lock(&uq->uq_key);
-		for (;;) {
-			if (timespeccmp(&cts, &ets, >=)) {
-				error = ETIMEDOUT;
-				break;
-			}
-			tts = ets;
-			timespecsub(&tts, &cts);
-			error = umtxq_sleep(uq, "uwait", tstohz(&tts));
-			if (!(uq->uq_flags & UQF_UMTXQ)) {
-				error = 0;
-				break;
-			}
-			if (error != ETIMEDOUT)
-				break;
-			umtxq_unlock(&uq->uq_key);
-			kern_clock_gettime(td, timeout->_clockid, &cts);
-			umtxq_lock(&uq->uq_key);
-		}
-		umtxq_remove(uq);
-		umtxq_unlock(&uq->uq_key);
+	umtxq_lock(&uq->uq_key);
+	if (tmp == id) {
+		if (timeout == NULL)
+			error = umtxq_sleep(uq, "uwait", 0);
+		else
+			error = umtxq_nanosleep(td, timeout->_clockid, 
+		   		((timeout->_flags & UMTX_ABSTIME) != 0),
+				&timeout->_timeout, "uwait");
 	}
+
+	if ((uq->uq_flags & UQF_UMTXQ) == 0)
+		error = 0;
+	else
+		umtxq_remove(uq);
+	umtxq_unlock(&uq->uq_key);
 	umtx_key_release(&uq->uq_key);
 	if (error == ERESTART)
 		error = EINTR;
@@ -2340,7 +2351,6 @@ do_cv_wait(struct thread *td, struct uco
 	struct timespec *timeout, u_long wflags)
 {
 	struct umtx_q *uq;
-	struct timespec cts, ets, tts;
 	uint32_t flags;
 	uint32_t clockid;
 	int error;
@@ -2382,32 +2392,12 @@ do_cv_wait(struct thread *td, struct uco
 	
 	umtxq_lock(&uq->uq_key);
 	if (error == 0) {
-		if (timeout == NULL) {
+		if (timeout == NULL)
 			error = umtxq_sleep(uq, "ucond", 0);
-		} else {
-			if ((wflags & CVWAIT_ABSTIME) == 0) {
-				kern_clock_gettime(td, clockid, &ets);
-				timespecadd(&ets, timeout);
-				tts = *timeout;
-			} else { /* absolute time */
-				ets = *timeout;
-				tts = *timeout;
-				kern_clock_gettime(td, clockid, &cts);
-				timespecsub(&tts, &cts);
-			}
-			for (;;) {
-				error = umtxq_sleep(uq, "ucond", tstohz(&tts));
-				if (error != ETIMEDOUT)
-					break;
-				kern_clock_gettime(td, clockid, &cts);
-				if (timespeccmp(&cts, &ets, >=)) {
-					error = ETIMEDOUT;
-					break;
-				}
-				tts = ets;
-				timespecsub(&tts, &cts);
-			}
-		}
+		else
+			error = umtxq_nanosleep(td, clockid, 
+			    ((wflags & CVWAIT_ABSTIME) != 0),
+			    timeout, "ucond");
 	}
 
 	if ((uq->uq_flags & UQF_UMTXQ) == 0)
@@ -2856,7 +2846,6 @@ static int
 do_sem_wait(struct thread *td, struct _usem *sem, struct _umtx_time *timeout)
 {
 	struct umtx_q *uq;
-	struct timespec cts, ets, tts;
 	uint32_t flags, count;
 	int error;
 
@@ -2881,37 +2870,15 @@ do_sem_wait(struct thread *td, struct _u
 		umtx_key_release(&uq->uq_key);
 		return (0);
 	}
-
 	umtxq_lock(&uq->uq_key);
 	umtxq_unbusy(&uq->uq_key);
 
-	if (timeout == NULL) {
+	if (timeout == NULL)
 		error = umtxq_sleep(uq, "usem", 0);
-	} else {
-		umtxq_unlock(&uq->uq_key);
-		kern_clock_gettime(td, timeout->_clockid, &cts);
-		if ((timeout->_flags & UMTX_ABSTIME) == 0) {
-			ets = cts;
-			timespecadd(&ets, &timeout->_timeout);
-		} else {
-			ets = timeout->_timeout;
-		}
-		umtxq_lock(&uq->uq_key);
-		for (;;) {
-			if (timespeccmp(&cts, &ets, >=)) {
-				error = ETIMEDOUT;
-				break;
-			}
-			tts = ets;
-			timespecsub(&tts, &cts);
-			error = umtxq_sleep(uq, "usem", tstohz(&tts));
-			if (error != ETIMEDOUT)
-				break;
-			umtxq_unlock(&uq->uq_key);
-			kern_clock_gettime(td, timeout->_clockid, &cts);
-			umtxq_lock(&uq->uq_key);
-		}
-	}
+	else
+		error = umtxq_nanosleep(td, timeout->_clockid,
+	   	    ((timeout->_flags & UMTX_ABSTIME) != 0),
+		    &timeout->_timeout, "usem");
 
 	if ((uq->uq_flags & UQF_UMTXQ) == 0)
 		error = 0;

From owner-svn-src-head@FreeBSD.ORG  Thu Mar 29 02:54:36 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id E4888106564A;
	Thu, 29 Mar 2012 02:54:36 +0000 (UTC)
	(envelope-from jmallett@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id CA7EB8FC0C;
	Thu, 29 Mar 2012 02:54:36 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2T2saiV072521;
	Thu, 29 Mar 2012 02:54:36 GMT
	(envelope-from jmallett@svn.freebsd.org)
Received: (from jmallett@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2T2sate072489;
	Thu, 29 Mar 2012 02:54:36 GMT
	(envelope-from jmallett@svn.freebsd.org)
Message-Id: <201203290254.q2T2sate072489@svn.freebsd.org>
From: Juli Mallett 
Date: Thu, 29 Mar 2012 02:54:36 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233644 - in head: . gnu/lib/libgcc
	gnu/usr.bin/binutils gnu/usr.bin/cc gnu/usr.bin/gdb
	gnu/usr.bin/gdb/libgdb kerberos5/lib/libkafs5 share/man/man5
	share/mk sys/conf sys/mips/atheros s...
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Mar 2012 02:54:37 -0000

Author: jmallett
Date: Thu Mar 29 02:54:35 2012
New Revision: 233644
URL: http://svn.freebsd.org/changeset/base/233644

Log:
  Assume a big-endian default on MIPS and drop the "eb" suffix from MACHINE_ARCH.
  This makes our naming scheme more closely match other systems and the
  expectations of much third-party software.  MIPS builds which are little-endian
  should require and exhibit no changes.  Big-endian TARGET_ARCHes must be
  changed:
  	From:		To:
  	mipseb		mips
  	mipsn32eb	mipsn32
  	mips64eb	mips64
  
  An entry has been added to UPDATING and some foot-shooting protection (complete
  with warnings which should become errors in the near future) to the top-level
  base system Makefile.

Modified:
  head/Makefile
  head/Makefile.inc1
  head/UPDATING
  head/gnu/lib/libgcc/Makefile
  head/gnu/usr.bin/binutils/Makefile.inc0
  head/gnu/usr.bin/cc/Makefile.tgt
  head/gnu/usr.bin/gdb/Makefile.inc
  head/gnu/usr.bin/gdb/libgdb/Makefile
  head/kerberos5/lib/libkafs5/Makefile
  head/share/man/man5/src.conf.5
  head/share/mk/bsd.endian.mk
  head/share/mk/sys.mk
  head/sys/conf/kern.pre.mk
  head/sys/conf/kmod.mk
  head/sys/mips/atheros/std.ar71xx
  head/sys/mips/cavium/std.octeon1
  head/sys/mips/conf/AR71XX_BASE
  head/sys/mips/conf/AR91XX_BASE
  head/sys/mips/conf/SWARM
  head/sys/mips/conf/SWARM64
  head/sys/mips/conf/SWARM64_SMP
  head/sys/mips/conf/SWARM_SMP
  head/sys/mips/conf/XLP
  head/sys/mips/conf/XLP64
  head/sys/mips/conf/XLPN32
  head/sys/mips/conf/XLR
  head/sys/mips/conf/XLR64
  head/sys/mips/conf/XLRN32
  head/sys/mips/include/param.h
  head/usr.bin/xlint/Makefile.inc
  head/usr.sbin/Makefile.mips

Modified: head/Makefile
==============================================================================
--- head/Makefile	Thu Mar 29 02:47:01 2012	(r233643)
+++ head/Makefile	Thu Mar 29 02:54:35 2012	(r233644)
@@ -132,20 +132,19 @@ _MAKE=	PATH=${PATH} ${BINMAKE} -f Makefi
 
 # Guess machine architecture from machine type, and vice versa.
 .if !defined(TARGET_ARCH) && defined(TARGET)
-_TARGET_ARCH=	${TARGET:S/pc98/i386/:S/mips/mipsel/}
+_TARGET_ARCH=	${TARGET:S/pc98/i386/}
 .elif !defined(TARGET) && defined(TARGET_ARCH) && \
     ${TARGET_ARCH} != ${MACHINE_ARCH}
-_TARGET=		${TARGET_ARCH:C/mips.*e[lb]/mips/:C/armeb/arm/}
+_TARGET=		${TARGET_ARCH:C/mips(n32|64)?(el)?/mips/:C/armeb/arm/}
 .endif
-# Legacy names, for a transition period mips:mips -> mipsel:mips
+# Legacy names, for another transition period mips:mips(n32|64)?eb -> mips:mips\1
 .if defined(TARGET) && defined(TARGET_ARCH) && \
-    ${TARGET_ARCH} == "mips" && ${TARGET} == "mips"
-.warning "TARGET_ARCH of mips is deprecated in favor of mipsel or mipseb"
-.if defined(TARGET_BIG_ENDIAN)
-_TARGET_ARCH=mipseb
-.else
-_TARGET_ARCH=mipsel
+    ${TARGET} == "mips" && ${TARGET_ARCH:Mmips*eb}
+_TARGET_ARCH=		${TARGET_ARCH:C/eb$//}
+.warning "TARGET_ARCH of ${TARGET_ARCH} is deprecated in favor of ${_TARGET_ARCH}"
 .endif
+.if defined(TARGET) && ${TARGET} == "mips" && defined(TARGET_BIG_ENDIAN)
+.warning "TARGET_BIG_ENDIAN is no longer necessary for MIPS.  Big-endian is not the default."
 .endif
 # arm with TARGET_BIG_ENDIAN -> armeb
 .if defined(TARGET_ARCH) && ${TARGET_ARCH} == "arm" && defined(TARGET_BIG_ENDIAN)
@@ -331,7 +330,7 @@ kernel-toolchains:
 .if make(universe) || make(universe_kernels) || make(tinderbox) || make(targets)
 TARGETS?=amd64 arm i386 ia64 mips pc98 powerpc sparc64
 TARGET_ARCHES_arm?=	arm armeb
-TARGET_ARCHES_mips?=	mipsel mipseb mips64el mips64eb mipsn32eb
+TARGET_ARCHES_mips?=	mipsel mips mips64el mips64 mipsn32
 TARGET_ARCHES_powerpc?=	powerpc powerpc64
 TARGET_ARCHES_pc98?=	i386
 .for target in ${TARGETS}

Modified: head/Makefile.inc1
==============================================================================
--- head/Makefile.inc1	Thu Mar 29 02:47:01 2012	(r233643)
+++ head/Makefile.inc1	Thu Mar 29 02:54:35 2012	(r233644)
@@ -136,7 +136,7 @@ VERSION!=	uname -srp
 VERSION+=	${OSRELDATE}
 .endif
 
-KNOWN_ARCHES?=	amd64 arm armeb/arm i386 i386/pc98 ia64 mipsel/mips mipseb/mips mips64el/mips mips64eb/mips mipsn32el/mips mipsn32eb/mips powerpc powerpc64/powerpc sparc64
+KNOWN_ARCHES?=	amd64 arm armeb/arm i386 i386/pc98 ia64 mipsel/mips mips/mips mips64el/mips mips64/mips mipsn32el/mips mipsn32/mips powerpc powerpc64/powerpc sparc64
 .if ${TARGET} == ${TARGET_ARCH}
 _t=		${TARGET}
 .else

Modified: head/UPDATING
==============================================================================
--- head/UPDATING	Thu Mar 29 02:47:01 2012	(r233643)
+++ head/UPDATING	Thu Mar 29 02:54:35 2012	(r233644)
@@ -22,6 +22,13 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 10
 	machines to maximize performance.  (To disable malloc debugging, run
 	ln -s aj /etc/malloc.conf.)
 
+20120328:
+	Big-endian MIPS TARGET_ARCH values no longer end in "eb".  mips64eb
+	is now spelled mips64.  mipsn32eb is now spelled mipsn32.  mipseb is
+	now spelled mips.  This is to aid compatibility with third-party
+	software that expects this naming scheme in uname(3).  Little-endian
+	settings are unchanged.
+
 20120306:
 	Disable by default the option VFS_ALLOW_NONMPSAFE for all supported
 	platforms.

Modified: head/gnu/lib/libgcc/Makefile
==============================================================================
--- head/gnu/lib/libgcc/Makefile	Thu Mar 29 02:47:01 2012	(r233643)
+++ head/gnu/lib/libgcc/Makefile	Thu Mar 29 02:54:35 2012	(r233644)
@@ -122,7 +122,7 @@ LIB2FUNCS_EXTRA = floatunsidf.c floatuns
 .if ${TARGET_CPUARCH} == mips
 LIB2FUNCS_EXTRA = floatunsidf.c floatunsisf.c
 # ABIs other than o32 need this
-.if ${TARGET_ARCH:Mmipse[lb]} == ""
+.if ${TARGET_ARCH} != "mips" && ${TARGET_ARCH} != "mipsel"
 LIB2FUNCS_EXTRA+= floatdidf.c fixunsdfsi.c
 LIB2FUNCS_EXTRA+= floatdisf.c floatundidf.c
 LIB2FUNCS_EXTRA+= fixsfdi.c floatundisf.c

Modified: head/gnu/usr.bin/binutils/Makefile.inc0
==============================================================================
--- head/gnu/usr.bin/binutils/Makefile.inc0	Thu Mar 29 02:47:01 2012	(r233643)
+++ head/gnu/usr.bin/binutils/Makefile.inc0	Thu Mar 29 02:54:35 2012	(r233644)
@@ -7,7 +7,7 @@
 VERSION=	"2.17.50 [FreeBSD] 2007-07-03"
 
 .if defined(TARGET_ARCH)
-TARGET_CPUARCH=${TARGET_ARCH:C/mips.*e[bl]/mips/:C/armeb/arm/:C/powerpc64/powerpc/}
+TARGET_CPUARCH=${TARGET_ARCH:C/mips(n32|64)?(el)?/mips/:C/armeb/arm/:C/powerpc64/powerpc/}
 .else
 TARGET_CPUARCH=${MACHINE_CPUARCH}
 .endif
@@ -16,7 +16,8 @@ TARGET_VENDOR?=	unknown
 TARGET_OS?=	freebsd
 BINUTILS_ARCH=${TARGET_ARCH:C/amd64/x86_64/}
 TARGET_TUPLE?=	${BINUTILS_ARCH}-${TARGET_VENDOR}-${TARGET_OS}
-.if ${TARGET_ARCH} == "armeb" || ${TARGET_ARCH:Mmips*eb} != ""
+.if ${TARGET_ARCH} == "armeb" || \
+	(${TARGET_CPUARCH} == "mips" && ${TARGET_ARCH:Mmips*el} == "")
 TARGET_BIG_ENDIAN=t
 .endif
 

Modified: head/gnu/usr.bin/cc/Makefile.tgt
==============================================================================
--- head/gnu/usr.bin/cc/Makefile.tgt	Thu Mar 29 02:47:01 2012	(r233643)
+++ head/gnu/usr.bin/cc/Makefile.tgt	Thu Mar 29 02:54:35 2012	(r233644)
@@ -4,7 +4,7 @@
 # MACHINE_CPUARCH, but there's no easy way to export make functions...
 
 .if defined(TARGET_ARCH)
-TARGET_CPUARCH=${TARGET_ARCH:C/mips.*e[bl]/mips/:C/armeb/arm/:C/powerpc64/powerpc/}
+TARGET_CPUARCH=${TARGET_ARCH:C/mips(n32|64)?(el)?/mips/:C/armeb/arm/:C/powerpc64/powerpc/}
 .else
 TARGET_CPUARCH=${MACHINE_CPUARCH}
 .endif
@@ -17,7 +17,8 @@ TARGET_CPU_DEFAULT= MASK_GNU_AS|MASK_GNU
 .if ${TARGET_ARCH} == "sparc64"
 TARGET_CPU_DEFAULT= TARGET_CPU_ultrasparc
 .endif
-.if ${TARGET_ARCH} == "armeb" || ${TARGET_ARCH:Mmips*eb} != ""
+.if ${TARGET_ARCH} == "armeb" || \
+	(${TARGET_CPUARCH} == "mips" && ${TARGET_ARCH:Mmips*el} == "")
 TARGET_BIG_ENDIAN=t
 .endif
 .if ${TARGET_ARCH} == "powerpc64"

Modified: head/gnu/usr.bin/gdb/Makefile.inc
==============================================================================
--- head/gnu/usr.bin/gdb/Makefile.inc	Thu Mar 29 02:47:01 2012	(r233643)
+++ head/gnu/usr.bin/gdb/Makefile.inc	Thu Mar 29 02:54:35 2012	(r233644)
@@ -20,7 +20,7 @@ OBJ_GDB= ${OBJ_ROOT}/gdb
 # MACHINE_CPUARCH, but there's no easy way to export make functions...
 
 .if defined(TARGET_ARCH)
-TARGET_CPUARCH=${TARGET_ARCH:C/mips.*e[bl]/mips/:C/armeb/arm/:C/powerpc64/powerpc/}
+TARGET_CPUARCH=${TARGET_ARCH:C/mips(n32|64)?(el)?/mips/:C/armeb/arm/:C/powerpc64/powerpc/}
 .else
 TARGET_CPUARCH=${MACHINE_CPUARCH}
 .endif

Modified: head/gnu/usr.bin/gdb/libgdb/Makefile
==============================================================================
--- head/gnu/usr.bin/gdb/libgdb/Makefile	Thu Mar 29 02:47:01 2012	(r233643)
+++ head/gnu/usr.bin/gdb/libgdb/Makefile	Thu Mar 29 02:54:35 2012	(r233644)
@@ -4,7 +4,7 @@
 # MACHINE_CPUARCH, but there's no easy way to export make functions...
 
 .if defined(TARGET_ARCH)
-TARGET_CPUARCH=${TARGET_ARCH:C/mips.*e[bl]/mips/:C/armeb/arm/:C/powerpc64/powerpc/}
+TARGET_CPUARCH=${TARGET_ARCH:C/mips(n32|64)?(el)?/mips/:C/armeb/arm/:C/powerpc64/powerpc/}
 .else
 TARGET_CPUARCH=${MACHINE_CPUARCH}
 .endif

Modified: head/kerberos5/lib/libkafs5/Makefile
==============================================================================
--- head/kerberos5/lib/libkafs5/Makefile	Thu Mar 29 02:47:01 2012	(r233643)
+++ head/kerberos5/lib/libkafs5/Makefile	Thu Mar 29 02:54:35 2012	(r233644)
@@ -10,8 +10,7 @@ MAN=	kafs5.3
 # Linking with libkrb5 uncovers a bug in binutils.
 # See http://repo.or.cz/w/binutils.git/commit/ee05170bf71819c99cb5a36a44735c231ae03c56 .
 #
-.if ${MACHINE_ARCH} != "mipsn32eb" && ${MACHINE_ARCH} != "mipsel" && \
-    ${MACHINE_ARCH} != "mipseb" && ${MACHINE_ARCH} != "mips"
+.if ${MACHINE} != "mips"
 LDADD+=	-lkrb5
 LDFLAGS=	-Wl,--no-undefined
 .endif

Modified: head/share/man/man5/src.conf.5
==============================================================================
--- head/share/man/man5/src.conf.5	Thu Mar 29 02:47:01 2012	(r233643)
+++ head/share/man/man5/src.conf.5	Thu Mar 29 02:54:35 2012	(r233644)
@@ -270,7 +270,7 @@ When set, it also enforces the following
 Set to not build the Clang C/C++ compiler.
 .Pp
 It is a default setting on
-arm/arm, arm/armeb, ia64/ia64, mips/mipsel, mips/mipseb, mips/mips64el, mips/mips64eb, mips/mipsn32eb and sparc64/sparc64.
+arm/arm, arm/armeb, ia64/ia64, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32eb and sparc64/sparc64.
 When set, it also enforces the following options:
 .Pp
 .Bl -item -compact
@@ -384,7 +384,7 @@ Set to build Flattened Device Tree suppo
 This includes the device tree compiler (dtc) and libfdt support library.
 .Pp
 It is a default setting on
-arm/arm, arm/armeb, mips/mipsel, mips/mipseb, mips/mips64el, mips/mips64eb, mips/mipsn32eb, powerpc/powerpc and powerpc/powerpc64.
+arm/arm, arm/armeb, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, powerpc/powerpc and powerpc/powerpc64.
 .It Va WITHOUT_FLOPPY
 .\" from FreeBSD: head/tools/build/options/WITHOUT_FLOPPY 221540 2011-05-06 19:13:03Z ru
 Set to not build or install programs

Modified: head/share/mk/bsd.endian.mk
==============================================================================
--- head/share/mk/bsd.endian.mk	Thu Mar 29 02:47:01 2012	(r233643)
+++ head/share/mk/bsd.endian.mk	Thu Mar 29 02:54:35 2012	(r233644)
@@ -10,6 +10,6 @@ TARGET_ENDIANNESS= 1234
     ${MACHINE_ARCH} == "powerpc64" || \
     ${MACHINE_ARCH} == "sparc64" || \
     ${MACHINE_ARCH} == "armeb" || \
-    ${MACHINE_ARCH:Mmips*eb} != ""
+    ${MACHINE_ARCH:Mmips*} != ""
 TARGET_ENDIANNESS= 4321
 .endif

Modified: head/share/mk/sys.mk
==============================================================================
--- head/share/mk/sys.mk	Thu Mar 29 02:47:01 2012	(r233643)
+++ head/share/mk/sys.mk	Thu Mar 29 02:54:35 2012	(r233644)
@@ -13,7 +13,7 @@ unix		?=	We run FreeBSD, not UNIX.
 # and/or endian.  This is called MACHINE_CPU in NetBSD, but that's used
 # for something different in FreeBSD.
 #
-MACHINE_CPUARCH=${MACHINE_ARCH:C/mips.*e[lb]/mips/:C/armeb/arm/:C/powerpc64/powerpc/}
+MACHINE_CPUARCH=${MACHINE_ARCH:C/mips(n32|64)?(el)?/mips/:C/armeb/arm/:C/powerpc64/powerpc/}
 .endif
 
 # If the special target .POSIX appears (without prerequisites or

Modified: head/sys/conf/kern.pre.mk
==============================================================================
--- head/sys/conf/kern.pre.mk	Thu Mar 29 02:47:01 2012	(r233643)
+++ head/sys/conf/kern.pre.mk	Thu Mar 29 02:54:35 2012	(r233644)
@@ -6,7 +6,7 @@
 .include 
 
 # backwards compat option for older systems.
-MACHINE_CPUARCH?=${MACHINE_ARCH:C/mipse[lb]/mips/:C/armeb/arm/:C/powerpc64/powerpc/}
+MACHINE_CPUARCH?=${MACHINE_ARCH:C/mips(n32|64)?(el)?/mips/:C/armeb/arm/:C/powerpc64/powerpc/}
 
 # Can be overridden by makeoptions or /etc/make.conf
 KERNEL_KO?=	kernel

Modified: head/sys/conf/kmod.mk
==============================================================================
--- head/sys/conf/kmod.mk	Thu Mar 29 02:47:01 2012	(r233643)
+++ head/sys/conf/kmod.mk	Thu Mar 29 02:54:35 2012	(r233644)
@@ -61,7 +61,7 @@
 #
 
 # backwards compat option for older systems.
-MACHINE_CPUARCH?=${MACHINE_ARCH:C/mipse[lb]/mips/:C/armeb/arm/:C/powerpc64/powerpc/}
+MACHINE_CPUARCH?=${MACHINE_ARCH:C/mips(n32|64)?(el)?/mips/:C/armeb/arm/:C/powerpc64/powerpc/}
 
 AWK?=		awk
 KMODLOAD?=	/sbin/kldload

Modified: head/sys/mips/atheros/std.ar71xx
==============================================================================
--- head/sys/mips/atheros/std.ar71xx	Thu Mar 29 02:47:01 2012	(r233643)
+++ head/sys/mips/atheros/std.ar71xx	Thu Mar 29 02:54:35 2012	(r233644)
@@ -4,5 +4,5 @@
 
 files		"../atheros/files.ar71xx"
 
-machine		mips mipseb
+machine		mips mips
 cpu		CPU_MIPS4KC

Modified: head/sys/mips/cavium/std.octeon1
==============================================================================
--- head/sys/mips/cavium/std.octeon1	Thu Mar 29 02:47:01 2012	(r233643)
+++ head/sys/mips/cavium/std.octeon1	Thu Mar 29 02:54:35 2012	(r233644)
@@ -5,5 +5,5 @@
 # $FreeBSD$
 # 
 files	"../cavium/files.octeon1"
-machine	mips mips64eb
+machine	mips mips64
 cpu		CPU_CNMIPS

Modified: head/sys/mips/conf/AR71XX_BASE
==============================================================================
--- head/sys/mips/conf/AR71XX_BASE	Thu Mar 29 02:47:01 2012	(r233643)
+++ head/sys/mips/conf/AR71XX_BASE	Thu Mar 29 02:54:35 2012	(r233644)
@@ -7,7 +7,7 @@
 # $FreeBSD$
 #
 
-machine		mips mipseb
+machine		mips mips
 ident		AR71XX_BASE
 cpu		CPU_MIPS4KC
 makeoptions	KERNLOADADDR=0x80050000

Modified: head/sys/mips/conf/AR91XX_BASE
==============================================================================
--- head/sys/mips/conf/AR91XX_BASE	Thu Mar 29 02:47:01 2012	(r233643)
+++ head/sys/mips/conf/AR91XX_BASE	Thu Mar 29 02:54:35 2012	(r233644)
@@ -10,7 +10,7 @@
 # $FreeBSD$
 #
 
-machine         mips mipseb
+machine         mips mips
 ident		AR91XX_BASE
 cpu		CPU_MIPS4KC
 makeoptions	KERNLOADADDR=0x80050000

Modified: head/sys/mips/conf/SWARM
==============================================================================
--- head/sys/mips/conf/SWARM	Thu Mar 29 02:47:01 2012	(r233643)
+++ head/sys/mips/conf/SWARM	Thu Mar 29 02:54:35 2012	(r233644)
@@ -6,7 +6,7 @@ include		"std.SWARM"
 
 ident		SWARM
 
-machine		mips mipseb
+machine		mips mips
 
 makeoptions	ARCH_FLAGS="-mabi=32 -march=mips32"
 makeoptions	LDSCRIPT_NAME=	ldscript.mips.cfe

Modified: head/sys/mips/conf/SWARM64
==============================================================================
--- head/sys/mips/conf/SWARM64	Thu Mar 29 02:47:01 2012	(r233643)
+++ head/sys/mips/conf/SWARM64	Thu Mar 29 02:54:35 2012	(r233644)
@@ -6,7 +6,7 @@ include		"std.SWARM"
 
 ident		SWARM64
 
-machine		mips mips64eb
+machine		mips mips64
 makeoptions	ARCH_FLAGS="-mabi=64 -march=mips64"
 makeoptions	LDSCRIPT_NAME=ldscript.mips.cfe
 makeoptions	KERNLOADADDR=0xffffffff80001000

Modified: head/sys/mips/conf/SWARM64_SMP
==============================================================================
--- head/sys/mips/conf/SWARM64_SMP	Thu Mar 29 02:47:01 2012	(r233643)
+++ head/sys/mips/conf/SWARM64_SMP	Thu Mar 29 02:54:35 2012	(r233644)
@@ -9,7 +9,7 @@ ident		SWARM64_SMP
 options		SMP
 options		PRINTF_BUFR_SIZE=128
 
-machine		mips mips64eb
+machine		mips mips64
 makeoptions	ARCH_FLAGS="-mabi=64 -march=mips64"
 makeoptions	LDSCRIPT_NAME=ldscript.mips.cfe
 makeoptions	KERNLOADADDR=0xffffffff80001000

Modified: head/sys/mips/conf/SWARM_SMP
==============================================================================
--- head/sys/mips/conf/SWARM_SMP	Thu Mar 29 02:47:01 2012	(r233643)
+++ head/sys/mips/conf/SWARM_SMP	Thu Mar 29 02:54:35 2012	(r233644)
@@ -9,7 +9,7 @@ ident		SWARM_SMP
 options		SMP
 options		PRINTF_BUFR_SIZE=128
 
-machine		mips mipseb
+machine		mips mips
 
 makeoptions	ARCH_FLAGS="-mabi=32 -march=mips32"
 makeoptions	LDSCRIPT_NAME=	ldscript.mips.cfe

Modified: head/sys/mips/conf/XLP
==============================================================================
--- head/sys/mips/conf/XLP	Thu Mar 29 02:47:01 2012	(r233643)
+++ head/sys/mips/conf/XLP	Thu Mar 29 02:54:35 2012	(r233644)
@@ -17,7 +17,7 @@
 #
 # $FreeBSD$
 
-machine 	mips mipseb
+machine 	mips mips
 ident           XLP
 
 makeoptions	KERNLOADADDR=0x80100000

Modified: head/sys/mips/conf/XLP64
==============================================================================
--- head/sys/mips/conf/XLP64	Thu Mar 29 02:47:01 2012	(r233643)
+++ head/sys/mips/conf/XLP64	Thu Mar 29 02:54:35 2012	(r233644)
@@ -17,7 +17,7 @@
 #
 # $FreeBSD$
 
-machine 	mips mips64eb
+machine 	mips mips64
 ident           XLP64
 
 makeoptions	ARCH_FLAGS="-march=mips64r2 -mabi=64"

Modified: head/sys/mips/conf/XLPN32
==============================================================================
--- head/sys/mips/conf/XLPN32	Thu Mar 29 02:47:01 2012	(r233643)
+++ head/sys/mips/conf/XLPN32	Thu Mar 29 02:54:35 2012	(r233644)
@@ -17,7 +17,7 @@
 #
 # $FreeBSD$
 
-machine 	mips mipsn32eb
+machine 	mips mipsn32
 ident           XLPN32
 
 makeoptions	ARCH_FLAGS="-march=mips64 -mabi=n32"

Modified: head/sys/mips/conf/XLR
==============================================================================
--- head/sys/mips/conf/XLR	Thu Mar 29 02:47:01 2012	(r233643)
+++ head/sys/mips/conf/XLR	Thu Mar 29 02:54:35 2012	(r233644)
@@ -45,7 +45,7 @@
 #
 # $FreeBSD$
 
-machine 	mips mipseb
+machine 	mips mips
 ident 		XLR
 include		"../rmi/std.xlr"
 

Modified: head/sys/mips/conf/XLR64
==============================================================================
--- head/sys/mips/conf/XLR64	Thu Mar 29 02:47:01 2012	(r233643)
+++ head/sys/mips/conf/XLR64	Thu Mar 29 02:54:35 2012	(r233644)
@@ -17,7 +17,7 @@
 #
 # $FreeBSD$
 
-machine 	mips mips64eb
+machine 	mips mips64
 ident 		XLR64
 include		"../rmi/std.xlr"
 

Modified: head/sys/mips/conf/XLRN32
==============================================================================
--- head/sys/mips/conf/XLRN32	Thu Mar 29 02:47:01 2012	(r233643)
+++ head/sys/mips/conf/XLRN32	Thu Mar 29 02:54:35 2012	(r233644)
@@ -17,7 +17,7 @@
 #
 # $FreeBSD$
 
-machine 	mips mipsn32eb
+machine 	mips mipsn32
 ident 		XLRN32
 include		"../rmi/std.xlr"
 

Modified: head/sys/mips/include/param.h
==============================================================================
--- head/sys/mips/include/param.h	Thu Mar 29 02:47:01 2012	(r233643)
+++ head/sys/mips/include/param.h	Thu Mar 29 02:54:35 2012	(r233644)
@@ -59,14 +59,14 @@
 #ifndef MACHINE_ARCH
 #if _BYTE_ORDER == _BIG_ENDIAN
 #ifdef __mips_n64
-#define	MACHINE_ARCH	"mips64eb"
+#define	MACHINE_ARCH	"mips64"
 #ifndef	MACHINE_ARCH32
-#define	MACHINE_ARCH32	"mipseb"
+#define	MACHINE_ARCH32	"mips"
 #endif
 #elif defined(__mips_n32)
-#define	MACHINE_ARCH	"mipsn32eb"
+#define	MACHINE_ARCH	"mipsn32"
 #else
-#define	MACHINE_ARCH	"mipseb"
+#define	MACHINE_ARCH	"mips"
 #endif
 #else
 #ifdef __mips_n64

Modified: head/usr.bin/xlint/Makefile.inc
==============================================================================
--- head/usr.bin/xlint/Makefile.inc	Thu Mar 29 02:47:01 2012	(r233643)
+++ head/usr.bin/xlint/Makefile.inc	Thu Mar 29 02:54:35 2012	(r233644)
@@ -8,7 +8,7 @@ WARNS?=		0
 # These assignments duplicate much of the functionality of
 # MACHINE_CPUARCH, but there's no easy way to export make functions...
 .if defined(TARGET_ARCH)
-TARGET_CPUARCH=	${TARGET_ARCH:C/mips.*e[bl]/mips/:C/armeb/arm/}
+TARGET_CPUARCH=	${TARGET_ARCH:C/mips(n32|64)?(el)?/mips/:C/armeb/arm/}
 .else
 TARGET_CPUARCH=	${MACHINE_CPUARCH}
 TARGET_ARCH=	${MACHINE_ARCH}

Modified: head/usr.sbin/Makefile.mips
==============================================================================
--- head/usr.sbin/Makefile.mips	Thu Mar 29 02:47:01 2012	(r233643)
+++ head/usr.sbin/Makefile.mips	Thu Mar 29 02:54:35 2012	(r233644)
@@ -1,6 +1,6 @@
 # $FreeBSD$
 
-# uathload broken for n32 and n64 due to toolchain issues
-.if ${MACHINE_ARCH:Mmipse[lb]} == ""
+# uathload broken for n32 and n64 due to toolchain issues, only build for o32
+.if ${MACHINE_ARCH} != "mips" && ${MACHINE_ARCH} != "mipsel"
 SUBDIR:=	${SUBDIR:Nuathload}
 .endif

From owner-svn-src-head@FreeBSD.ORG  Thu Mar 29 03:05:00 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 0A0AD106564A;
	Thu, 29 Mar 2012 03:05:00 +0000 (UTC)
	(envelope-from jmallett@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id E92F38FC0A;
	Thu, 29 Mar 2012 03:04:59 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2T34xKK073014;
	Thu, 29 Mar 2012 03:04:59 GMT
	(envelope-from jmallett@svn.freebsd.org)
Received: (from jmallett@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2T34x1F073011;
	Thu, 29 Mar 2012 03:04:59 GMT
	(envelope-from jmallett@svn.freebsd.org)
Message-Id: <201203290304.q2T34x1F073011@svn.freebsd.org>
From: Juli Mallett 
Date: Thu, 29 Mar 2012 03:04:59 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233645 - in head: . share/man/man5
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Mar 2012 03:05:00 -0000

Author: jmallett
Date: Thu Mar 29 03:04:59 2012
New Revision: 233645
URL: http://svn.freebsd.org/changeset/base/233645

Log:
  o) Fix mips/mips -> mips for Makefile.inc1.
  o) Rebuild src.conf.5.

Modified:
  head/Makefile.inc1
  head/share/man/man5/src.conf.5

Modified: head/Makefile.inc1
==============================================================================
--- head/Makefile.inc1	Thu Mar 29 02:54:35 2012	(r233644)
+++ head/Makefile.inc1	Thu Mar 29 03:04:59 2012	(r233645)
@@ -136,7 +136,7 @@ VERSION!=	uname -srp
 VERSION+=	${OSRELDATE}
 .endif
 
-KNOWN_ARCHES?=	amd64 arm armeb/arm i386 i386/pc98 ia64 mipsel/mips mips/mips mips64el/mips mips64/mips mipsn32el/mips mipsn32/mips powerpc powerpc64/powerpc sparc64
+KNOWN_ARCHES?=	amd64 arm armeb/arm i386 i386/pc98 ia64 mips mipsel/mips mips64el/mips mips64/mips mipsn32el/mips mipsn32/mips powerpc powerpc64/powerpc sparc64
 .if ${TARGET} == ${TARGET_ARCH}
 _t=		${TARGET}
 .else

Modified: head/share/man/man5/src.conf.5
==============================================================================
--- head/share/man/man5/src.conf.5	Thu Mar 29 02:54:35 2012	(r233644)
+++ head/share/man/man5/src.conf.5	Thu Mar 29 03:04:59 2012	(r233645)
@@ -1,7 +1,7 @@
 .\" DO NOT EDIT-- this file is automatically generated.
 .\" from FreeBSD: head/tools/build/options/makeman 221733 2011-05-10 13:01:11Z ru
 .\" $FreeBSD$
-.Dd February 29, 2012
+.Dd March 25, 2012
 .Dt SRC.CONF 5
 .Os
 .Sh NAME
@@ -270,7 +270,7 @@ When set, it also enforces the following
 Set to not build the Clang C/C++ compiler.
 .Pp
 It is a default setting on
-arm/arm, arm/armeb, ia64/ia64, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32eb and sparc64/sparc64.
+arm/arm, arm/armeb, ia64/ia64, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32 and sparc64/sparc64.
 When set, it also enforces the following options:
 .Pp
 .Bl -item -compact

From owner-svn-src-head@FreeBSD.ORG  Thu Mar 29 03:13:44 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 47BDC106566B;
	Thu, 29 Mar 2012 03:13:44 +0000 (UTC)
	(envelope-from jmallett@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 31C8A8FC18;
	Thu, 29 Mar 2012 03:13:44 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2T3DiSb073476;
	Thu, 29 Mar 2012 03:13:44 GMT
	(envelope-from jmallett@svn.freebsd.org)
Received: (from jmallett@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2T3Dh8p073473;
	Thu, 29 Mar 2012 03:13:43 GMT
	(envelope-from jmallett@svn.freebsd.org)
Message-Id: <201203290313.q2T3Dh8p073473@svn.freebsd.org>
From: Juli Mallett 
Date: Thu, 29 Mar 2012 03:13:43 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233646 - head/lib/libgeom
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Mar 2012 03:13:44 -0000

Author: jmallett
Date: Thu Mar 29 03:13:43 2012
New Revision: 233646
URL: http://svn.freebsd.org/changeset/base/233646

Log:
  Fix 32-bit libgeom consumers run on 64-bit kernels with COMPAT_FREEBSD32.
  
  Kernel pointer values are used as opaque unique identifiers, which are then
  used to reconstruct references between various providers, classes, etc., inside
  libgeom from the source XML.  Unfortunately, they're converted to pointer-width
  integers (in the form of pointers) to do this, and 32-bit userland pointers
  cannot hold sensible representations (however opaque) of 64-bit kernel pointers
  on all systems.
  
  In the case where the leading bits are zero and 32 distinct bits of pointer can
  be identified, this will happen to work.  On systems where the upper 32-bits of
  kernel pointers are non-zero and the same for all kernel pointers, this will
  result in double frees and all kinds of bizarre crashes and linkage between
  objects inside libgeom.
  
  To mitigate this problem, treat the opaque identifiers in the XML as C strings
  instead, and internalize them to give unique and consistent per-object pointer
  values in userland for each identifier in the XML.  This allows us to keep the
  libgeom logic the same with only minor changes to initial setup and parsing.
  
  It might be more sensible for speed reasons to treat the identifiers as numbers
  of a large size (uintmax_t, say) rather than strings, but strings seem fine for
  now.
  
  (As an added side-effect, this makes it slightly easier to identify unresolved
   references, but nothing has been added to inform the user of those.)

Modified:
  head/lib/libgeom/geom_xml2tree.c
  head/lib/libgeom/libgeom.h

Modified: head/lib/libgeom/geom_xml2tree.c
==============================================================================
--- head/lib/libgeom/geom_xml2tree.c	Thu Mar 29 03:04:59 2012	(r233645)
+++ head/lib/libgeom/geom_xml2tree.c	Thu Mar 29 03:13:43 2012	(r233646)
@@ -55,9 +55,56 @@ struct mystate {
 	int			level;
 	struct sbuf		*sbuf[20];
 	struct gconf		*config;
-	int			nident;
+	unsigned		nident;
 };
 
+static void *
+internalize_ident(struct mystate *mt, const char *element, const char *str)
+{
+	struct gident *gip;
+	unsigned i;
+
+	if (mt->nident != 0 && mt->mesh->lg_ident == NULL) {
+		warn("Cannot continue due to previous memory exhaustion.");
+		return (NULL);
+	}
+
+	for (i = 0; i < mt->nident; i++) {
+		if (strcmp(mt->mesh->lg_ident[i].lg_id, str) != 0)
+			continue;
+		return ((void *)(uintptr_t)(i + 1));
+	}
+
+	i = mt->nident;
+	mt->nident++;
+	mt->mesh->lg_ident = reallocf(mt->mesh->lg_ident, (mt->nident + 1) * sizeof mt->mesh->lg_ident[0]);
+	if (mt->mesh->lg_ident == NULL) {
+		warn("Cannot allocate memory during processing of '%s' "
+		    "element for identifier '%s'", element, str);
+		return (NULL);
+	}
+
+	gip = &mt->mesh->lg_ident[i];
+	gip->lg_id = strdup(str);
+	if (gip->lg_id == NULL) {
+		free(mt->mesh->lg_ident);
+		mt->mesh->lg_ident = NULL;
+		warn("Cannot allocate memory during processing of '%s' "
+		    "element for identifier '%s'", element, str);
+		return (NULL);
+	}
+	gip->lg_ptr = NULL;
+	gip->lg_what = ISUNRESOLVED;
+
+	/* Terminator entry.  */
+	gip = &mt->mesh->lg_ident[i + 1];
+	gip->lg_id = NULL;
+	gip->lg_ptr = NULL;
+	gip->lg_what = ISUNRESOLVED;
+
+	return ((void *)(uintptr_t)(i + 1));
+}
+
 static void
 StartElement(void *userData, const char *name, const char **attr)
 {
@@ -73,10 +120,9 @@ StartElement(void *userData, const char 
 	ref = NULL;
 	for (i = 0; attr[i] != NULL; i += 2) {
 		if (!strcmp(attr[i], "id")) {
-			id = (void *)strtoul(attr[i + 1], NULL, 0);
-			mt->nident++;
+			id = internalize_ident(mt, name, attr[i + 1]);
 		} else if (!strcmp(attr[i], "ref")) {
-			ref = (void *)strtoul(attr[i + 1], NULL, 0);
+			ref = internalize_ident(mt, name, attr[i + 1]);
 		} else
 			printf("%*.*s[%s = %s]\n",
 			    mt->level + 1, mt->level + 1, "",
@@ -317,11 +363,16 @@ CharData(void *userData , const XML_Char
 struct gident *
 geom_lookupid(struct gmesh *gmp, const void *id)
 {
-	struct gident *gip;
+	unsigned i;
 
-	for (gip = gmp->lg_ident; gip->lg_id != NULL; gip++)
-		if (gip->lg_id == id)
-			return (gip);
+	if (gmp->lg_ident == NULL)
+		return (NULL);
+
+	for (i = 0; gmp->lg_ident[i].lg_id != NULL; i++) {
+		if (i + 1 != (unsigned)(uintptr_t)id)
+			continue;
+		return (&gmp->lg_ident[i]);
+	}
 	return (NULL);
 }
 
@@ -334,6 +385,7 @@ geom_xml2tree(struct gmesh *gmp, char *p
 	struct ggeom *ge;
 	struct gprovider *pr;
 	struct gconsumer *co;
+	struct gident *gip;
 	int i;
 
 	memset(gmp, 0, sizeof *gmp);
@@ -356,33 +408,30 @@ geom_xml2tree(struct gmesh *gmp, char *p
 		free(mt);
 		return (-1);
 	}
-	gmp->lg_ident = calloc(sizeof *gmp->lg_ident, mt->nident + 1);
-	free(mt);
-	if (gmp->lg_ident == NULL)
+	if (gmp->lg_ident == NULL && mt->nident != 0) {
+		free(mt);
 		return (ENOMEM);
-	i = 0;
+	}
+	free(mt);
 	/* Collect all identifiers */
 	LIST_FOREACH(cl, &gmp->lg_class, lg_class) {
-		gmp->lg_ident[i].lg_id = cl->lg_id;
-		gmp->lg_ident[i].lg_ptr = cl;
-		gmp->lg_ident[i].lg_what = ISCLASS;
-		i++;
+		gip = geom_lookupid(gmp, cl->lg_id);
+		gip->lg_ptr = cl;
+		gip->lg_what = ISCLASS;
+
 		LIST_FOREACH(ge, &cl->lg_geom, lg_geom) {
-			gmp->lg_ident[i].lg_id = ge->lg_id;
-			gmp->lg_ident[i].lg_ptr = ge;
-			gmp->lg_ident[i].lg_what = ISGEOM;
-			i++;
+			gip = geom_lookupid(gmp, ge->lg_id);
+			gip->lg_ptr = ge;
+			gip->lg_what = ISGEOM;
 			LIST_FOREACH(pr, &ge->lg_provider, lg_provider) {
-				gmp->lg_ident[i].lg_id = pr->lg_id;
-				gmp->lg_ident[i].lg_ptr = pr;
-				gmp->lg_ident[i].lg_what = ISPROVIDER;
-				i++;
+				gip = geom_lookupid(gmp, pr->lg_id);
+				gip->lg_ptr = pr;
+				gip->lg_what = ISPROVIDER;
 			}
 			LIST_FOREACH(co, &ge->lg_consumer, lg_consumer) {
-				gmp->lg_ident[i].lg_id = co->lg_id;
-				gmp->lg_ident[i].lg_ptr = co;
-				gmp->lg_ident[i].lg_what = ISCONSUMER;
-				i++;
+				gip = geom_lookupid(gmp, co->lg_id);
+				gip->lg_ptr = co;
+				gip->lg_what = ISCONSUMER;
 			}
 		}
 	}
@@ -449,7 +498,10 @@ geom_deletetree(struct gmesh *gmp)
 	struct ggeom *ge;
 	struct gprovider *pr;
 	struct gconsumer *co;
+	unsigned i;
 
+	for (i = 0; gmp->lg_ident[i].lg_id != NULL; i++)
+		free(gmp->lg_ident[i].lg_id);
 	free(gmp->lg_ident);
 	gmp->lg_ident = NULL;
 	for (;;) {

Modified: head/lib/libgeom/libgeom.h
==============================================================================
--- head/lib/libgeom/libgeom.h	Thu Mar 29 03:04:59 2012	(r233645)
+++ head/lib/libgeom/libgeom.h	Thu Mar 29 03:13:43 2012	(r233646)
@@ -71,7 +71,8 @@ struct gident {
 	enum {	ISCLASS,
 		ISGEOM,
 		ISPROVIDER,
-		ISCONSUMER }	lg_what;
+		ISCONSUMER,
+		ISUNRESOLVED }	lg_what;
 };
 
 struct gmesh {

From owner-svn-src-head@FreeBSD.ORG  Thu Mar 29 03:36:01 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx2.freebsd.org (mx2.freebsd.org [69.147.83.53])
	by hub.freebsd.org (Postfix) with ESMTP id DB1651065673;
	Thu, 29 Mar 2012 03:36:01 +0000 (UTC)
	(envelope-from dougb@FreeBSD.org)
Received: from [127.0.0.1] (hub.freebsd.org [IPv6:2001:4f8:fff6::36])
	by mx2.freebsd.org (Postfix) with ESMTP id 594EC1548AA;
	Thu, 29 Mar 2012 03:36:01 +0000 (UTC)
Message-ID: <4F73D8A0.3040608@FreeBSD.org>
Date: Wed, 28 Mar 2012 20:36:00 -0700
From: Doug Barton 
Organization: http://www.FreeBSD.org/
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64;
	rv:11.0) Gecko/20120327 Thunderbird/11.0.1
MIME-Version: 1.0
To: Ivan Voras 
References: <201203220848.q2M8mia8015593@svn.freebsd.org>
	<20120325105958.GB61230@zxy.spb.ru>
	
In-Reply-To: 
X-Enigmail-Version: 1.4
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Cc: Stanislav Sedov , svn-src-head@freebsd.org,
	svn-src-all@freebsd.org, src-committers@freebsd.org,
	Slawa Olhovchenkov 
Subject: Re: svn commit: r233294 - in head: . contrib/com_err crypto/heimdal
 crypto/heimdal/admin crypto/heimdal/appl
 crypto/heimdal/appl/afsutil crypto/heimdal/appl/ftp
 crypto/heimdal/appl/ftp/common crypto/he...
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Mar 2012 03:36:02 -0000

On 3/27/2012 2:10 PM, Ivan Voras wrote:
> It will help both present
> development (the pkgng is also AFAIK using sqlite)

All of the stuff that pkgng relies on (including the tool itself) are
going to be in the ports collection, where they belong. We should have
moved pkg_* there years ago, but this change is at least a step in the
right direction.

Doug

From owner-svn-src-head@FreeBSD.ORG  Thu Mar 29 04:03:37 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx2.freebsd.org (mx2.freebsd.org [69.147.83.53])
	by hub.freebsd.org (Postfix) with ESMTP id CAD3B1065673;
	Thu, 29 Mar 2012 04:03:37 +0000 (UTC)
	(envelope-from dougb@FreeBSD.org)
Received: from [127.0.0.1] (hub.freebsd.org [IPv6:2001:4f8:fff6::36])
	by mx2.freebsd.org (Postfix) with ESMTP id CE7FA1A4CD6;
	Thu, 29 Mar 2012 04:03:10 +0000 (UTC)
Message-ID: <4F73DEFE.4060306@FreeBSD.org>
Date: Wed, 28 Mar 2012 21:03:10 -0700
From: Doug Barton 
Organization: http://www.FreeBSD.org/
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64;
	rv:11.0) Gecko/20120327 Thunderbird/11.0.1
MIME-Version: 1.0
To: Joel Dahl 
References: <201203281920.q2SJKSOg050767@svn.freebsd.org>
In-Reply-To: <201203281920.q2SJKSOg050767@svn.freebsd.org>
X-Enigmail-Version: 1.4
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r233625 - head/lib/libc/iconv
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Mar 2012 04:03:37 -0000

Joel,

Thanks for doing this cleanup. It's unglamorous, but very necessary. You
probably have this planned already, but I wanted to make sure that you
have MFC'ing this work on your list. Merging back the formatting changes
makes it much easier to merge (and then verify) changes to the content
down the road.

Doug

From owner-svn-src-head@FreeBSD.ORG  Thu Mar 29 05:02:14 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 9F14B1065670;
	Thu, 29 Mar 2012 05:02:14 +0000 (UTC)
	(envelope-from eadler@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 85FF58FC12;
	Thu, 29 Mar 2012 05:02:14 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2T52EmA076929;
	Thu, 29 Mar 2012 05:02:14 GMT (envelope-from eadler@svn.freebsd.org)
Received: (from eadler@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2T52DBT076882;
	Thu, 29 Mar 2012 05:02:13 GMT (envelope-from eadler@svn.freebsd.org)
Message-Id: <201203290502.q2T52DBT076882@svn.freebsd.org>
From: Eitan Adler 
Date: Thu, 29 Mar 2012 05:02:13 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233648 - in head: bin/pwait bin/setfacl bin/sh
	games/pom lib/libbluetooth lib/libc/gen lib/libc/locale
	lib/libc/net lib/libc/posix1e lib/libc/stdio lib/libc/stdlib
	lib/libc/string lib/...
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Mar 2012 05:02:14 -0000

Author: eadler
Date: Thu Mar 29 05:02:12 2012
New Revision: 233648
URL: http://svn.freebsd.org/changeset/base/233648

Log:
  Remove trailing whitespace per mdoc lint warning
  
  Disussed with:	gavin
  No objection from:	doc
  Approved by:	joel
  MFC after:	3 days

Modified:
  head/bin/pwait/pwait.1
  head/bin/setfacl/setfacl.1
  head/bin/sh/sh.1
  head/games/pom/pom.6
  head/lib/libbluetooth/bluetooth.3
  head/lib/libc/gen/fts.3
  head/lib/libc/gen/getpagesizes.3
  head/lib/libc/gen/sysconf.3
  head/lib/libc/locale/ctype.3
  head/lib/libc/locale/ctype_l.3
  head/lib/libc/locale/digittoint.3
  head/lib/libc/locale/isalnum.3
  head/lib/libc/locale/isalpha.3
  head/lib/libc/locale/isblank.3
  head/lib/libc/locale/iscntrl.3
  head/lib/libc/net/sctp_bindx.3
  head/lib/libc/net/sctp_connectx.3
  head/lib/libc/net/sctp_freepaddrs.3
  head/lib/libc/net/sctp_getaddrlen.3
  head/lib/libc/net/sctp_getassocid.3
  head/lib/libc/net/sctp_getpaddrs.3
  head/lib/libc/net/sctp_opt_info.3
  head/lib/libc/net/sctp_recvmsg.3
  head/lib/libc/net/sctp_send.3
  head/lib/libc/net/sctp_sendmsg.3
  head/lib/libc/net/sourcefilter.3
  head/lib/libc/posix1e/acl_add_flag_np.3
  head/lib/libc/posix1e/acl_create_entry.3
  head/lib/libc/stdio/getline.3
  head/lib/libc/stdlib/at_quick_exit.3
  head/lib/libc/stdlib/getenv.3
  head/lib/libc/string/memchr.3
  head/lib/libc/sys/cap_new.2
  head/lib/libc/sys/cpuset.2
  head/lib/libc/sys/cpuset_getaffinity.2
  head/lib/libc/sys/jail.2
  head/lib/libc/sys/kqueue.2
  head/lib/libc/sys/pathconf.2
  head/lib/libc/sys/ptrace.2
  head/lib/libc/sys/quotactl.2
  head/lib/libc/sys/sctp_generic_sendmsg.2
  head/lib/libc/sys/sctp_peeloff.2
  head/lib/libc/sys/select.2
  head/lib/libc/sys/sendfile.2
  head/lib/libelf/elf.3
  head/lib/libelf/elf_getdata.3
  head/lib/libfetch/fetch.3
  head/lib/libgssapi/gss_release_buffer.3
  head/lib/libgssapi/gss_release_oid_set.3
  head/lib/libgssapi/mech.5
  head/lib/libpam/modules/pam_nologin/pam_nologin.8
  head/lib/libpmc/pmc.core.3
  head/lib/libpmc/pmc.xscale.3
  head/lib/libpmc/pmc_capabilities.3
  head/lib/librpcsec_gss/rpc_gss_seccreate.3
  head/lib/libtacplus/libtacplus.3
  head/lib/libulog/utempter_add_record.3
  head/lib/libusb/libusb20.3
  head/lib/libutil/login_cap.3
  head/lib/libutil/quotafile.3
  head/libexec/tftpd/tftpd.8
  head/sbin/camcontrol/camcontrol.8
  head/sbin/devfs/devfs.8
  head/sbin/gvinum/gvinum.8
  head/sbin/ifconfig/ifconfig.8
  head/sbin/ipfw/ipfw.8
  head/sbin/mdmfs/mdmfs.8
  head/sbin/mount_unionfs/mount_unionfs.8
  head/sbin/ping6/ping6.8
  head/sbin/quotacheck/quotacheck.8
  head/sbin/rcorder/rcorder.8
  head/share/man/man3/pthread_attr_affinity_np.3
  head/share/man/man3/pthread_cond_timedwait.3
  head/share/man/man3/pthread_cond_wait.3
  head/share/man/man4/acpi_hp.4
  head/share/man/man4/acpi_wmi.4
  head/share/man/man4/ada.4
  head/share/man/man4/aibs.4
  head/share/man/man4/ath.4
  head/share/man/man4/atp.4
  head/share/man/man4/carp.4
  head/share/man/man4/coda.4
  head/share/man/man4/epair.4
  head/share/man/man4/gem.4
  head/share/man/man4/gre.4
  head/share/man/man4/ipmi.4
  head/share/man/man4/ipw.4
  head/share/man/man4/isci.4
  head/share/man/man4/iscsi_initiator.4
  head/share/man/man4/iwi.4
  head/share/man/man4/iwn.4
  head/share/man/man4/iwnfw.4
  head/share/man/man4/ixgbe.4
  head/share/man/man4/ksyms.4
  head/share/man/man4/ktr.4
  head/share/man/man4/man4.i386/glxsb.4
  head/share/man/man4/man4.powerpc/abtn.4
  head/share/man/man4/man4.powerpc/akbd.4
  head/share/man/man4/man4.powerpc/bm.4
  head/share/man/man4/man4.powerpc/cuda.4
  head/share/man/man4/man4.powerpc/smu.4
  head/share/man/man4/man4.powerpc/snd_ai2s.4
  head/share/man/man4/md.4
  head/share/man/man4/mld.4
  head/share/man/man4/mmc.4
  head/share/man/man4/mos.4
  head/share/man/man4/mps.4
  head/share/man/man4/mwl.4
  head/share/man/man4/net80211.4
  head/share/man/man4/netmap.4
  head/share/man/man4/ng_car.4
  head/share/man/man4/ng_deflate.4
  head/share/man/man4/ng_nat.4
  head/share/man/man4/ng_netflow.4
  head/share/man/man4/ng_patch.4
  head/share/man/man4/ng_ppp.4
  head/share/man/man4/ng_pred1.4
  head/share/man/man4/ng_tty.4
  head/share/man/man4/nvram2env.4
  head/share/man/man4/nxge.4
  head/share/man/man4/pcm.4
  head/share/man/man4/pts.4
  head/share/man/man4/ral.4
  head/share/man/man4/run.4
  head/share/man/man4/runfw.4
  head/share/man/man4/sfxge.4
  head/share/man/man4/smp.4
  head/share/man/man4/snd_emu10kx.4
  head/share/man/man4/snd_ich.4
  head/share/man/man4/tpm.4
  head/share/man/man4/uark.4
  head/share/man/man4/uath.4
  head/share/man/man4/ufoma.4
  head/share/man/man4/uipaq.4
  head/share/man/man4/upgt.4
  head/share/man/man4/vge.4
  head/share/man/man4/virtio.4
  head/share/man/man4/vxge.4
  head/share/man/man4/wbwd.4
  head/share/man/man4/wi.4
  head/share/man/man4/wlan_acl.4
  head/share/man/man4/wlan_amrr.4
  head/share/man/man4/wpi.4
  head/share/man/man4/xen.4
  head/share/man/man4/xnb.4
  head/share/man/man5/ar.5
  head/share/man/man5/fdescfs.5
  head/share/man/man5/fs.5
  head/share/man/man5/fstab.5
  head/share/man/man5/nsmb.conf.5
  head/share/man/man5/quota.user.5
  head/share/man/man5/services.5
  head/share/man/man7/release.7
  head/share/man/man8/picobsd.8
  head/share/man/man9/BUS_DESCRIBE_INTR.9
  head/share/man/man9/BUS_SETUP_INTR.9
  head/share/man/man9/DB_COMMAND.9
  head/share/man/man9/DEVICE_PROBE.9
  head/share/man/man9/SYSINIT.9
  head/share/man/man9/buf_ring.9
  head/share/man/man9/condvar.9
  head/share/man/man9/devclass_get_maxunit.9
  head/share/man/man9/device_get_children.9
  head/share/man/man9/drbr.9
  head/share/man/man9/eventtimers.9
  head/share/man/man9/firmware.9
  head/share/man/man9/ieee80211.9
  head/share/man/man9/ieee80211_amrr.9
  head/share/man/man9/ieee80211_bmiss.9
  head/share/man/man9/ieee80211_input.9
  head/share/man/man9/ieee80211_node.9
  head/share/man/man9/ieee80211_output.9
  head/share/man/man9/ieee80211_proto.9
  head/share/man/man9/ieee80211_radiotap.9
  head/share/man/man9/ieee80211_regdomain.9
  head/share/man/man9/ieee80211_scan.9
  head/share/man/man9/ieee80211_vap.9
  head/share/man/man9/kproc.9
  head/share/man/man9/kthread.9
  head/share/man/man9/lock.9
  head/share/man/man9/locking.9
  head/share/man/man9/malloc.9
  head/share/man/man9/mi_switch.9
  head/share/man/man9/osd.9
  head/share/man/man9/rmlock.9
  head/share/man/man9/shm_map.9
  head/share/man/man9/sleep.9
  head/share/man/man9/spl.9
  head/share/man/man9/sysctl_ctx_init.9
  head/share/man/man9/taskqueue.9
  head/share/man/man9/timeout.9
  head/share/man/man9/usbdi.9
  head/share/man/man9/vm_map_find.9
  head/share/man/man9/watchdog.9
  head/sys/boot/common/loader.8
  head/sys/boot/forth/loader.conf.5
  head/tools/tools/ath/athrd/athrd.1
  head/tools/tools/ether_reflect/ether_reflect.1
  head/tools/tools/vimage/vimage.8
  head/usr.bin/bsdiff/bsdiff/bsdiff.1
  head/usr.bin/calendar/calendar.1
  head/usr.bin/comm/comm.1
  head/usr.bin/csup/cpasswd.1
  head/usr.bin/csup/csup.1
  head/usr.bin/find/find.1
  head/usr.bin/fstat/fuser.1
  head/usr.bin/ipcrm/ipcrm.1
  head/usr.bin/locale/locale.1
  head/usr.bin/lockf/lockf.1
  head/usr.bin/ministat/ministat.1
  head/usr.bin/printf/printf.1
  head/usr.bin/procstat/procstat.1
  head/usr.bin/sed/sed.1
  head/usr.bin/tftp/tftp.1
  head/usr.bin/top/top.local.1
  head/usr.bin/touch/touch.1
  head/usr.sbin/adduser/adduser.conf.5
  head/usr.sbin/bluetooth/ath3kfw/ath3kfw.8
  head/usr.sbin/bsdinstall/bsdinstall.8
  head/usr.sbin/bsnmpd/modules/snmp_wlan/snmp_wlan.3
  head/usr.sbin/bsnmpd/tools/bsnmptools/bsnmpget.1
  head/usr.sbin/cdcontrol/cdcontrol.1
  head/usr.sbin/config/config.8
  head/usr.sbin/ctladm/ctladm.8
  head/usr.sbin/edquota/edquota.8
  head/usr.sbin/freebsd-update/freebsd-update.8
  head/usr.sbin/gpioctl/gpioctl.8
  head/usr.sbin/i2c/i2c.8
  head/usr.sbin/mountd/exports.5
  head/usr.sbin/mptutil/mptutil.8
  head/usr.sbin/newsyslog/newsyslog.conf.5
  head/usr.sbin/pciconf/pciconf.8
  head/usr.sbin/pkg_install/updating/pkg_updating.1
  head/usr.sbin/rtadvd/rtadvd.8
  head/usr.sbin/setfib/setfib.1
  head/usr.sbin/tcpdump/tcpdump/tcpdump.1
  head/usr.sbin/timed/timed/timed.8
  head/usr.sbin/wlandebug/wlandebug.8

Modified: head/bin/pwait/pwait.1
==============================================================================
--- head/bin/pwait/pwait.1	Thu Mar 29 04:54:34 2012	(r233647)
+++ head/bin/pwait/pwait.1	Thu Mar 29 05:02:12 2012	(r233648)
@@ -46,7 +46,7 @@
 .Sh DESCRIPTION
 The
 .Nm
-utility will wait until each of the given processes has terminated. 
+utility will wait until each of the given processes has terminated.
 .Pp
 The following option is available:
 .Bl -tag -width indent

Modified: head/bin/setfacl/setfacl.1
==============================================================================
--- head/bin/setfacl/setfacl.1	Thu Mar 29 04:54:34 2012	(r233647)
+++ head/bin/setfacl/setfacl.1	Thu Mar 29 05:02:12 2012	(r233648)
@@ -295,7 +295,7 @@ The ACL qualifier field describes the us
 the ACL entry.
 It may consist of one of the following: uid or
 user name, or gid or group name.  In entries whose tag type is
-one of 
+one of
 .Dq Li owner@ ,
 .Dq Li group@ ,
 or

Modified: head/bin/sh/sh.1
==============================================================================
--- head/bin/sh/sh.1	Thu Mar 29 04:54:34 2012	(r233647)
+++ head/bin/sh/sh.1	Thu Mar 29 05:02:12 2012	(r233648)
@@ -1631,7 +1631,7 @@ All values are of type
 .It Constants
 Decimal, octal (starting with
 .Li 0 )
-and hexadecimal (starting with 
+and hexadecimal (starting with
 .Li 0x )
 integer constants.
 .It Variables

Modified: head/games/pom/pom.6
==============================================================================
--- head/games/pom/pom.6	Thu Mar 29 04:54:34 2012	(r233647)
+++ head/games/pom/pom.6	Thu Mar 29 05:02:12 2012	(r233648)
@@ -35,7 +35,7 @@
 .Nm pom
 .Nd display the phase of the moon
 .Sh SYNOPSIS
-.Nm 
+.Nm
 .Op Fl p
 .Op Fl d Ar yyyy.mm.dd
 .Op Fl t Ar hh:mm:ss

Modified: head/lib/libbluetooth/bluetooth.3
==============================================================================
--- head/lib/libbluetooth/bluetooth.3	Thu Mar 29 04:54:34 2012	(r233647)
+++ head/lib/libbluetooth/bluetooth.3	Thu Mar 29 05:02:12 2012	(r233648)
@@ -511,7 +511,7 @@ The function returns 0 on success, or -1
 .Pp
 The
 .Fn bt_devfilter_pkt_set ,
-.Fn bt_devfilter_pkt_clr 
+.Fn bt_devfilter_pkt_clr
 and
 .Fn bt_devfilter_pkt_tst
 functions can be used to modify and test the
@@ -526,7 +526,7 @@ packet type.
 .Pp
 The
 .Fn bt_devfilter_evt_set ,
-.Fn bt_devfilter_evt_clr 
+.Fn bt_devfilter_evt_clr
 and
 .Fn bt_devfilter_evt_tst
 functions can be used to modify and test the

Modified: head/lib/libc/gen/fts.3
==============================================================================
--- head/lib/libc/gen/fts.3	Thu Mar 29 04:54:34 2012	(r233647)
+++ head/lib/libc/gen/fts.3	Thu Mar 29 05:02:12 2012	(r233648)
@@ -802,12 +802,12 @@ principally to provide for alternative i
 .Nm
 functionality using different data structures.
 .Sh BUGS
-The 
+The
 .Fn fts_open
 function will automatically set the
 .Dv FTS_NOCHDIR
-option if the 
+option if the
 .Dv FTS_LOGICAL
-option is provided, or if it cannot 
+option is provided, or if it cannot
 .Xr open 2
 the current directory.

Modified: head/lib/libc/gen/getpagesizes.3
==============================================================================
--- head/lib/libc/gen/getpagesizes.3	Thu Mar 29 04:54:34 2012	(r233647)
+++ head/lib/libc/gen/getpagesizes.3	Thu Mar 29 05:02:12 2012	(r233648)
@@ -56,7 +56,7 @@ array referenced by
 These page sizes are expressed in bytes.
 In this case,
 .Fn getpagesizes
-returns the number of such page sizes that it assigned to the array. 
+returns the number of such page sizes that it assigned to the array.
 .Sh RETURN VALUES
 If successful, the
 .Fn getpagesizes

Modified: head/lib/libc/gen/sysconf.3
==============================================================================
--- head/lib/libc/gen/sysconf.3	Thu Mar 29 04:54:34 2012	(r233647)
+++ head/lib/libc/gen/sysconf.3	Thu Mar 29 05:02:12 2012	(r233648)
@@ -211,7 +211,7 @@ Maximum number of functions that may be 
 .It Li _SC_XOPEN_VERSION
 An integer value greater than or equal to 4,
 indicating the version of the X/Open Portability Guide to which this
-system conforms. 
+system conforms.
 .It Li _SC_XOPEN_XCU_VERSION
 An integer value indicating the version of the XCU Specification to which
 this system conforms.

Modified: head/lib/libc/locale/ctype.3
==============================================================================
--- head/lib/libc/locale/ctype.3	Thu Mar 29 04:54:34 2012	(r233647)
+++ head/lib/libc/locale/ctype.3	Thu Mar 29 05:02:12 2012	(r233648)
@@ -55,7 +55,7 @@
 .Nm toascii ,
 .Nm tolower ,
 .Nm toupper
-.Nd character classification functions 
+.Nd character classification functions
 .Sh LIBRARY
 .Lb libc
 .Sh SYNOPSIS

Modified: head/lib/libc/locale/ctype_l.3
==============================================================================
--- head/lib/libc/locale/ctype_l.3	Thu Mar 29 04:54:34 2012	(r233647)
+++ head/lib/libc/locale/ctype_l.3	Thu Mar 29 05:02:12 2012	(r233648)
@@ -102,11 +102,11 @@
 .Fn toupper_l "int c" "locale_t loc"
 .Sh DESCRIPTION
 The above functions perform character tests and conversions on the integer
-.Fa c 
+.Fa c
 in the locale
 .Fa loc .
 They behave in the same way as the versions without the _l suffix, but use the
-specified locale rather than the global or per-thread locale.  
+specified locale rather than the global or per-thread locale.
 .In ctype.h ,
 or as true functions in the C library.
 See the specific manual pages for more information.

Modified: head/lib/libc/locale/digittoint.3
==============================================================================
--- head/lib/libc/locale/digittoint.3	Thu Mar 29 04:54:34 2012	(r233647)
+++ head/lib/libc/locale/digittoint.3	Thu Mar 29 05:02:12 2012	(r233648)
@@ -49,7 +49,7 @@ function converts a numeric character to
 The character can be any decimal digit or hexadecimal digit.
 With hexadecimal characters, the case of the values does not matter.
 .Pp
-The 
+The
 .Fn digittoint_l
 function takes an explicit locale argument, whereas the
 .Fn digittoint

Modified: head/lib/libc/locale/isalnum.3
==============================================================================
--- head/lib/libc/locale/isalnum.3	Thu Mar 29 04:54:34 2012	(r233647)
+++ head/lib/libc/locale/isalnum.3	Thu Mar 29 05:02:12 2012	(r233648)
@@ -77,7 +77,7 @@ In the ASCII character set, this include
 .It "\&171\ ``y'' \t172\ ``z''"
 .El
 .Pp
-The 
+The
 .Fn isalnum_l
 function takes an explicit locale argument, whereas the
 .Fn isalnum

Modified: head/lib/libc/locale/isalpha.3
==============================================================================
--- head/lib/libc/locale/isalpha.3	Thu Mar 29 04:54:34 2012	(r233647)
+++ head/lib/libc/locale/isalpha.3	Thu Mar 29 05:02:12 2012	(r233648)
@@ -74,7 +74,7 @@ In the ASCII character set, this include
 .It "\&164\ ``t'' \t165\ ``u'' \t166\ ``v'' \t167\ ``w'' \t170\ ``x''"
 .It "\&171\ ``y'' \t172\ ``z''"
 .El
-The 
+The
 .Fn isalpha_l
 function takes an explicit locale argument, whereas the
 .Fn isalpha

Modified: head/lib/libc/locale/isblank.3
==============================================================================
--- head/lib/libc/locale/isblank.3	Thu Mar 29 04:54:34 2012	(r233647)
+++ head/lib/libc/locale/isblank.3	Thu Mar 29 05:02:12 2012	(r233648)
@@ -59,7 +59,7 @@ The value of the argument must be repres
 or the value of
 .Dv EOF .
 .Pp
-The 
+The
 .Fn isblank_l
 function takes an explicit locale argument, whereas the
 .Fn isblank

Modified: head/lib/libc/locale/iscntrl.3
==============================================================================
--- head/lib/libc/locale/iscntrl.3	Thu Mar 29 04:54:34 2012	(r233647)
+++ head/lib/libc/locale/iscntrl.3	Thu Mar 29 05:02:12 2012	(r233648)
@@ -67,7 +67,7 @@ In the ASCII character set, this include
 .It "\&036\ RS \t037\ US \t177\ DEL"
 .El
 .Pp
-The 
+The
 .Fn iscntrl_l
 function takes an explicit locale argument, whereas the
 .Fn iscntrl

Modified: head/lib/libc/net/sctp_bindx.3
==============================================================================
--- head/lib/libc/net/sctp_bindx.3	Thu Mar 29 04:54:34 2012	(r233647)
+++ head/lib/libc/net/sctp_bindx.3	Thu Mar 29 05:02:12 2012	(r233648)
@@ -55,7 +55,7 @@ This allows a user to bind a subset of
 addresses.
 The
 .Fn sctp_bindx
-call operates similarly to 
+call operates similarly to
 .Fn bind
 but allows a list of addresses and also allows a bind or an
 unbind.
@@ -98,7 +98,7 @@ This value is returned if the
 field is not one of the allowed values (see above).
 .It Bq Er ENOMEM
 This value is returned if the number of addresses
-being added causes a memory allocation failure in 
+being added causes a memory allocation failure in
 the call.
 .It Bq Er EBADF
 The argument

Modified: head/lib/libc/net/sctp_connectx.3
==============================================================================
--- head/lib/libc/net/sctp_connectx.3	Thu Mar 29 04:54:34 2012	(r233647)
+++ head/lib/libc/net/sctp_connectx.3	Thu Mar 29 05:02:12 2012	(r233648)
@@ -58,18 +58,18 @@ This allows a fault tolerant method
 of initiating an association.
 When one of the peers addresses
 is unreachable, the subsequent listed addresses will also be used
-to set up the association with the peer. 
+to set up the association with the peer.
 .Pp
-The user also needs to consider that any address listed in an 
+The user also needs to consider that any address listed in an
 .Fn sctp_connectx
 call is also considered "confirmed".
 A confirmed address is one in
 which the SCTP transport will trust is a part of the association
 and it will not send a confirmation heartbeat to it with
-a random nonce. 
+a random nonce.
 .Pp
 If the peer SCTP stack does not list one or more of
-the provided addresses in its response message then 
+the provided addresses in its response message then
 the extra addresses sent in the
 .Fn sctp_connectx
 call will be silently discarded from the association.

Modified: head/lib/libc/net/sctp_freepaddrs.3
==============================================================================
--- head/lib/libc/net/sctp_freepaddrs.3	Thu Mar 29 04:54:34 2012	(r233647)
+++ head/lib/libc/net/sctp_freepaddrs.3	Thu Mar 29 05:02:12 2012	(r233648)
@@ -46,9 +46,9 @@
 .In sys/socket.h
 .In netinet/sctp.h
 .Ft void
-.Fn sctp_freepaddrs "struct sockaddr *" 
+.Fn sctp_freepaddrs "struct sockaddr *"
 .Ft void
-.Fn sctp_freeladdrs "struct sockaddr *" 
+.Fn sctp_freeladdrs "struct sockaddr *"
 .Sh DESCRIPTION
 The
 .Fn sctp_freepaddrs

Modified: head/lib/libc/net/sctp_getaddrlen.3
==============================================================================
--- head/lib/libc/net/sctp_getaddrlen.3	Thu Mar 29 04:54:34 2012	(r233647)
+++ head/lib/libc/net/sctp_getaddrlen.3	Thu Mar 29 05:02:12 2012	(r233648)
@@ -62,7 +62,7 @@ system calls.
 If for some reason a SCTP socket cannot
 be created or the
 .Fn getsockopt
-call fails, an error will be returned 
+call fails, an error will be returned
 with
 .Va errno
 set as specified in the

Modified: head/lib/libc/net/sctp_getassocid.3
==============================================================================
--- head/lib/libc/net/sctp_getassocid.3	Thu Mar 29 04:54:34 2012	(r233647)
+++ head/lib/libc/net/sctp_getassocid.3	Thu Mar 29 05:02:12 2012	(r233648)
@@ -50,7 +50,7 @@ The
 .Fn sctp_getassocid
 call attempts to look up the specified socket address
 .Fa addr
-and find the respective association identification. 
+and find the respective association identification.
 .Sh RETURN VALUES
 The call returns the association id upon success and
 0 is returned upon failure.

Modified: head/lib/libc/net/sctp_getpaddrs.3
==============================================================================
--- head/lib/libc/net/sctp_getpaddrs.3	Thu Mar 29 04:54:34 2012	(r233647)
+++ head/lib/libc/net/sctp_getpaddrs.3	Thu Mar 29 05:02:12 2012	(r233648)
@@ -53,7 +53,7 @@
 The
 .Fn sctp_getpaddrs
 function is used to get the list of the peers addresses.
-The 
+The
 .Fn sctp_getladdrs
 function is used to get the list of the local addresses.
 The association of interest is identified by the

Modified: head/lib/libc/net/sctp_opt_info.3
==============================================================================
--- head/lib/libc/net/sctp_opt_info.3	Thu Mar 29 04:54:34 2012	(r233647)
+++ head/lib/libc/net/sctp_opt_info.3	Thu Mar 29 05:02:12 2012	(r233648)
@@ -50,7 +50,7 @@
 The
 .Fn sctp_opt_info
 call provides a multi-os compatible method for getting
-specific 
+specific
 .Fn getsockopt
 data where an association identification needs to be passed
 into the operating system.
@@ -70,7 +70,7 @@ who wish to write portable code amongst 
 this call should be used for the following SCTP
 socket options.
 .Pp
-.Dv SCTP_RTOINFO 
+.Dv SCTP_RTOINFO
 .Pp
 .Dv SCTP_ASSOCINFO
 .Pp

Modified: head/lib/libc/net/sctp_recvmsg.3
==============================================================================
--- head/lib/libc/net/sctp_recvmsg.3	Thu Mar 29 04:54:34 2012	(r233647)
+++ head/lib/libc/net/sctp_recvmsg.3	Thu Mar 29 05:02:12 2012	(r233648)
@@ -56,11 +56,11 @@ is used to receive a message from anothe
 The
 .Fn sctp_recvmsg
 call is used by one-to-one (SOCK_STREAM) type sockets after a
-successful 
+successful
 .Fn connect
-call or after the application has performed a 
-.Fn listen 
-followed by a successful 
+call or after the application has performed a
+.Fn listen
+followed by a successful
 .Fn accept .
 For a one-to-many (SOCK_SEQPACKET) type socket, an endpoint may call
 .Fn sctp_recvmsg
@@ -77,7 +77,7 @@ with a positive backlog to enable the re
 .Pp
 The address of the sender is held in the
 .Fa from
-argument with 
+argument with
 .Fa fromlen
 specifying its size.
 At the completion of a successful
@@ -88,16 +88,16 @@ will hold the address of the peer and
 .Fa fromlen
 will hold the length of that address.
 Note that
-the address is bounded by the initial value of 
+the address is bounded by the initial value of
 .Fa fromlen
 which is used as an in/out variable.
 .Pp
-The length of the message 
+The length of the message
 .Fa msg
 to be received is bounded by
 .Fa len .
 If the message is too long to fit in the users
-receive buffer, then the 
+receive buffer, then the
 .Fa flags
 argument will
 .Em not
@@ -105,16 +105,16 @@ have the
 .Dv MSG_EOF
 flag applied.
 If the message is a complete message then
-the 
+the
 .Fa flags
 argument will have
 .Dv MSG_EOF
 set.
-Locally detected errors are 
+Locally detected errors are
 indicated by a return value of -1 with
 .Va errno
 set accordingly.
-The 
+The
 .Fa flags
 argument may also hold the value
 .Dv MSG_NOTIFICATION .
@@ -141,7 +141,7 @@ The
 system call may be used to determine when it is possible to
 receive a message.
 .Pp
-The 
+The
 .Fa sinfo
 argument is defined as follows.
 .Bd -literal
@@ -161,7 +161,7 @@ struct sctp_sndrcvinfo {
 The
 .Fa sinfo->sinfo_ppid
 field is an opaque 32 bit value that is passed transparently
-through the stack from the peer endpoint. 
+through the stack from the peer endpoint.
 Note that the stack passes this value without regard to byte
 order.
 .Pp
@@ -182,7 +182,7 @@ was delivered in order within the stream
 .Pp
 The
 .Fa sinfo->sinfo_stream
-field is the SCTP stream that the message was received on. 
+field is the SCTP stream that the message was received on.
 Streams in SCTP are reliable (or partially reliable) flows of ordered
 messages.
 .Pp
@@ -194,7 +194,7 @@ context with the
 socket option.
 Optionally a user process can use this value to index some application
 specific data structure for all data coming from a specific
-association. 
+association.
 .Pp
 The
 .Fa sinfo->sinfo_ssn
@@ -230,12 +230,12 @@ sockets this value can be used to send d
 the use of an address field.
 It is also quite useful in
 setting various socket options on the specific association
-(see 
+(see
 .Xr sctp 4 ) .
 .Pp
 The
 .Fa sinfo->info_timetolive
-field is not used by 
+field is not used by
 .Fn sctp_recvmsg .
 .Sh RETURN VALUES
 The call returns the number of bytes received, or -1

Modified: head/lib/libc/net/sctp_send.3
==============================================================================
--- head/lib/libc/net/sctp_send.3	Thu Mar 29 04:54:34 2012	(r233647)
+++ head/lib/libc/net/sctp_send.3	Thu Mar 29 05:02:12 2012	(r233648)
@@ -62,14 +62,14 @@ is used to transmit a message to another
 .Fn sctp_send
 may be used to send data to an existing association for both
 one-to-many (SOCK_SEQPACKET) and one-to-one (SOCK_STREAM) socket types.
-The length of the message 
+The length of the message
 .Fa msg
 is given by
 .Fa len .
 If the message is too long to pass atomically through the
 underlying protocol,
 .Va errno
-is set to 
+is set to
 .Er EMSGSIZE ,
 -1 is returned, and
 the message is not transmitted.
@@ -88,7 +88,7 @@ The
 system call may be used to determine when it is possible to
 send more data on one-to-one type (SOCK_STREAM) sockets.
 .Pp
-The 
+The
 .Fa sinfo
 structure is used to control various SCTP features
 and has the following format:
@@ -106,7 +106,7 @@ struct sctp_sndrcvinfo {
 };
 .Ed
 .Pp
-The 
+The
 .Fa sinfo->sinfo_ppid
 argument is an opaque 32 bit value that is passed transparently
 through the stack to the peer endpoint. It will be available on
@@ -131,7 +131,7 @@ argument may include one or more of the 
 #define SCTP_PR_SCTP_RTX  0x0003	/* Number of retransmissions based PR-SCTP */
 .Ed
 .Pp
-The flag 
+The flag
 .Dv SCTP_EOF
 is used to instruct the SCTP stack to queue this message
 and then start a graceful shutdown of the association.
@@ -158,7 +158,7 @@ is used to specify that a specific addre
 Normally
 SCTP will use only one of a multi-homed peers addresses as the primary
 address to send to.
-By default, no matter what the 
+By default, no matter what the
 .Fa to
 argument is, this primary address is used to send data.
 By specifying
@@ -193,14 +193,14 @@ skipped and no longer transmitted.
 Note that this policy does
 not even assure that the data will ever be sent.
 In times of a congestion
-with large amounts of data being queued, the 
+with large amounts of data being queued, the
 .Fa sinfo->sinfo_timetolive
 may expire before the first transmission is ever made.
 .Pp
 The
 .Dv SCTP_PR_SCTP_BUF
 based policy transforms the
-.Fa sinfo->sinfo_timetolive 
+.Fa sinfo->sinfo_timetolive
 field into a total number of bytes allowed on the outbound
 send queue.
 If that number or more bytes are in queue, then
@@ -208,19 +208,19 @@ other buffer-based sends are looked to b
 skipped.
 Note that this policy may also result in the data
 never being sent if no buffer based sends are in queue and
-the maximum specified by 
-.Fa timetolive 
+the maximum specified by
+.Fa timetolive
 bytes is in queue.
 .Pp
 The
 .Dv SCTP_PR_SCTP_RTX
 policy transforms the
-.Fa sinfo->sinfo_timetolive 
+.Fa sinfo->sinfo_timetolive
 into a number of retransmissions to allow.
 This policy
 always assures that at a minimum one send attempt is
 made of the data.
-After which no more than 
+After which no more than
 .Fa sinfo->sinfo_timetolive
 retransmissions will be made before the data is skipped.
 .Pp
@@ -228,11 +228,11 @@ retransmissions will be made before the 
 is the SCTP stream that you wish to send the
 message on.
 Streams in SCTP are reliable (or partially reliable) flows of ordered
-messages. 
+messages.
 .Pp
 The
 .Fa sinfo->sinfo_assoc_id
-field is used to 
+field is used to
 select the association to send to on a one-to-many socket.
 For a one-to-one socket, this field is ignored.
 .Pp
@@ -256,16 +256,16 @@ The fields
 .Fa sinfo->sinfo_ssn ,
 .Fa sinfo->sinfo_tsn ,
 and
-.Fa sinfo->sinfo_cumtsn 
+.Fa sinfo->sinfo_cumtsn
 are used only when receiving messages and are thus ignored by
 .Fn sctp_send .
 The function
-.Fn sctp_sendx 
-has the same properties as 
+.Fn sctp_sendx
+has the same properties as
 .Fn sctp_send
 with the additional arguments of an array of sockaddr structures
 passed in.
-With the 
+With the
 .Fa addrs
 argument being given as an array of addresses to be sent to and
 the
@@ -277,7 +277,7 @@ when an implicit association is being se
 This allows the
 user the equivalent behavior as doing a
 .Fn sctp_connectx
-followed by a 
+followed by a
 .Fn sctp_send
 to the association.
 Note that if the

Modified: head/lib/libc/net/sctp_sendmsg.3
==============================================================================
--- head/lib/libc/net/sctp_sendmsg.3	Thu Mar 29 04:54:34 2012	(r233647)
+++ head/lib/libc/net/sctp_sendmsg.3	Thu Mar 29 05:02:12 2012	(r233648)
@@ -72,10 +72,10 @@ Data sent in such an instance will resul
 the data being sent on the third leg of the SCTP four-way handshake.
 Note that if
 the socket is a one-to-one type (SOCK_STREAM) socket then an association must
-be in existence (by use of the 
+be in existence (by use of the
 .Xr connect 2
 system call).
-Calling 
+Calling
 .Fn sctp_sendmsg
 or
 .Fn sctp_sendmsgx
@@ -90,14 +90,14 @@ The address of the target is given by
 with
 .Fa tolen
 specifying its size.
-The length of the message 
+The length of the message
 .Fa msg
 is given by
 .Fa len .
 If the message is too long to pass atomically through the
 underlying protocol,
 .Va errno
-is set to 
+is set to
 .Er EMSGSIZE ,
 -1 is returned, and
 the message is not transmitted.
@@ -117,7 +117,7 @@ The
 system call may be used to determine when it is possible to
 send more data on one-to-one type (SOCK_STREAM) sockets.
 .Pp
-The 
+The
 .Fa ppid
 argument is an opaque 32 bit value that is passed transparently
 through the stack to the peer endpoint.
@@ -143,7 +143,7 @@ argument may include one or more of the 
 #define SCTP_PR_SCTP_RTX  0x0003	/* Number of retransmissions based PR-SCTP */
 .Ed
 .Pp
-The flag 
+The flag
 .Dv SCTP_EOF
 is used to instruct the SCTP stack to queue this message
 and then start a graceful shutdown of the association.
@@ -170,7 +170,7 @@ is used to specify that an specific addr
 Normally
 SCTP will use only one of a multi-homed peers addresses as the primary
 address to send to.
-By default, no matter what the 
+By default, no matter what the
 .Fa to
 argument is, this primary address is used to send data.
 By specifying
@@ -205,14 +205,14 @@ skipped and no longer transmitted.
 Note that this policy does
 not even assure that the data will ever be sent.
 In times of a congestion
-with large amounts of data being queued, the 
+with large amounts of data being queued, the
 .Fa timetolive
 may expire before the first transmission is ever made.
 .Pp
 The
 .Dv SCTP_PR_SCTP_BUF
 based policy transforms the
-.Fa timetolive 
+.Fa timetolive
 field into a total number of bytes allowed on the outbound
 send queue.
 If that number or more bytes are in queue, then
@@ -220,19 +220,19 @@ other buffer based sends are looked to b
 skipped.
 Note that this policy may also result in the data
 never being sent if no buffer based sends are in queue and
-the maximum specified by 
-.Fa timetolive 
+the maximum specified by
+.Fa timetolive
 bytes is in queue.
 .Pp
 The
 .Dv SCTP_PR_SCTP_RTX
 policy transforms the
-.Fa timetolive 
+.Fa timetolive
 into a number of retransmissions to allow.
 This policy
 always assures that at a minimum one send attempt is
 made of the data.
-After which no more than 
+After which no more than
 .Fa timetolive
 retransmissions will be made before the data is skipped.
 .Pp
@@ -241,7 +241,7 @@ is the SCTP stream that you wish to send
 message on.
 Streams in SCTP are reliable (or partially reliable) flows of ordered
 messages.
-The 
+The
 .Fa context
 field is used only in the event the message cannot be sent.
 This is an opaque
@@ -251,7 +251,7 @@ is given if that notification is enabled
 Normally a user process can use this value to index some application
 specific data structure when a send cannot be fulfilled.
 .Fn sctp_sendmsgx
-is identical to 
+is identical to
 .Fn sctp_sendmsg
 with the exception that it takes an array of sockaddr structures in the
 argument
@@ -262,7 +262,7 @@ which specifies how many addresses are i
 This allows a
 caller to implicitly set up an association passing multiple addresses
 as if
-.Fn sctp_connectx 
+.Fn sctp_connectx
 had been called to set up the association.
 .Sh RETURN VALUES
 The call returns the number of characters sent, or -1
@@ -325,7 +325,7 @@ is not connected and is a one-to-one sty
 .Xr sctp 4
 .Sh BUGS
 Because in the one-to-many style socket
-.Fn sctp_sendmsg 
+.Fn sctp_sendmsg
 or
 .Fn sctp_sendmsgx
 may have multiple associations under one endpoint, a

Modified: head/lib/libc/net/sourcefilter.3
==============================================================================
--- head/lib/libc/net/sourcefilter.3	Thu Mar 29 04:54:34 2012	(r233647)
+++ head/lib/libc/net/sourcefilter.3	Thu Mar 29 05:02:12 2012	(r233648)
@@ -220,7 +220,7 @@ operation.
 .Sh SEE ALSO
 .Xr ip 4 ,
 .Xr ip6 4 ,
-.Xr multicast 4, 
+.Xr multicast 4,
 .Xr ifmcstat 8
 .Rs
 .%A D. Thaler

Modified: head/lib/libc/posix1e/acl_add_flag_np.3
==============================================================================
--- head/lib/libc/posix1e/acl_add_flag_np.3	Thu Mar 29 04:54:34 2012	(r233647)
+++ head/lib/libc/posix1e/acl_add_flag_np.3	Thu Mar 29 05:02:12 2012	(r233648)
@@ -30,7 +30,7 @@
 .Os
 .Sh NAME
 .Nm acl_add_flag_np
-.Nd add flags to a flagset 
+.Nd add flags to a flagset
 .Sh LIBRARY
 .Lb libc
 .Sh SYNOPSIS

Modified: head/lib/libc/posix1e/acl_create_entry.3
==============================================================================
--- head/lib/libc/posix1e/acl_create_entry.3	Thu Mar 29 04:54:34 2012	(r233647)
+++ head/lib/libc/posix1e/acl_create_entry.3	Thu Mar 29 05:02:12 2012	(r233648)
@@ -39,7 +39,7 @@
 .In sys/acl.h
 .Ft int
 .Fn acl_create_entry "acl_t *acl_p" "acl_entry_t *entry_p"
-.Ft int 
+.Ft int
 .Fn acl_create_entry_np "acl_t *acl_p" "acl_entry_t *entry_p" "int index"
 .Sh DESCRIPTION
 The

Modified: head/lib/libc/stdio/getline.3
==============================================================================
--- head/lib/libc/stdio/getline.3	Thu Mar 29 04:54:34 2012	(r233647)
+++ head/lib/libc/stdio/getline.3	Thu Mar 29 05:02:12 2012	(r233648)
@@ -78,7 +78,7 @@ and
 .Fn getline
 functions return the number of characters written, excluding the
 terminating
-.Dv NUL 
+.Dv NUL
 character.
 The value \-1 is returned if an error occurs, or if end-of-file is reached.
 .Sh EXAMPLES

Modified: head/lib/libc/stdlib/at_quick_exit.3
==============================================================================
--- head/lib/libc/stdlib/at_quick_exit.3	Thu Mar 29 04:54:34 2012	(r233647)
+++ head/lib/libc/stdlib/at_quick_exit.3	Thu Mar 29 05:02:12 2012	(r233648)
@@ -1,6 +1,6 @@
 .\"  Copyright (c) 2011 David Chisnall
 .\"  All rights reserved.
-.\" 
+.\"
 .\"  Redistribution and use in source and binary forms, with or without
 .\"  modification, are permitted provided that the following conditions
 .\"  are met:
@@ -9,7 +9,7 @@
 .\"  2. Redistributions in binary form must reproduce the above copyright
 .\"     notice, this list of conditions and the following disclaimer in the
 .\"     documentation and/or other materials provided with the distribution.
-.\" 
+.\"
 .\"  THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 .\"  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 .\"  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -21,7 +21,7 @@
 .\"  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 .\"  OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\"  SUCH DAMAGE.
-.\" 
+.\"
 .\"  $FreeBSD$
 .\"
 .Dd December 7, 2011
@@ -40,16 +40,16 @@
 The
 .Fn at_quick_exit
 function registers a cleanup function to be called when the program exits as a
-result of calling 
+result of calling
 .Xr quick_exit 3 .
 The cleanup functions are called in the reverse order and will not be called if
-the program exits by calling 
+the program exits by calling
 .Xr exit 3 ,
 .Xr _Exit 3 ,
 or
 .Xr abort 3 .
 .Sh RETURN VALUES
-The 
+The
 .Fn at_quick_exit
 function returns the value 0 if successful and a non-zero value on failure.
 .Sh SEE ALSO

Modified: head/lib/libc/stdlib/getenv.3
==============================================================================
--- head/lib/libc/stdlib/getenv.3	Thu Mar 29 04:54:34 2012	(r233647)
+++ head/lib/libc/stdlib/getenv.3	Thu Mar 29 05:02:12 2012	(r233648)
@@ -201,7 +201,7 @@ function appeared in
 Until
 .Fx 7.0 ,
 .Fn putenv
-would make a copy of 
+would make a copy of
 .Fa string
 and insert it into the environment using
 .Fn setenv .

Modified: head/lib/libc/string/memchr.3
==============================================================================
--- head/lib/libc/string/memchr.3	Thu Mar 29 04:54:34 2012	(r233647)
+++ head/lib/libc/string/memchr.3	Thu Mar 29 05:02:12 2012	(r233648)
@@ -94,7 +94,7 @@ conforms to
 .St -isoC .
 .Pp
 The
-.Fn memrchr       
+.Fn memrchr
 function is a GNU extension and conforms to no standard.
 .Sh HISTORY
 The

Modified: head/lib/libc/sys/cap_new.2
==============================================================================
--- head/lib/libc/sys/cap_new.2	Thu Mar 29 04:54:34 2012	(r233647)
+++ head/lib/libc/sys/cap_new.2	Thu Mar 29 05:02:12 2012	(r233648)
@@ -464,7 +464,7 @@ Support for capabilities and capabilitie
 Project.
 .Sh AUTHORS
 These functions and the capability facility were created by
-.An "Robert N. M. Watson" 
+.An "Robert N. M. Watson"
 at the University of Cambridge Computer Laboratory with support from a grant
 from Google, Inc.
 .Sh BUGS

Modified: head/lib/libc/sys/cpuset.2
==============================================================================
--- head/lib/libc/sys/cpuset.2	Thu Mar 29 04:54:34 2012	(r233647)
+++ head/lib/libc/sys/cpuset.2	Thu Mar 29 05:02:12 2012	(r233648)
@@ -77,7 +77,7 @@ while application developers will manipu
 To select the correct set a value of type
 .Ft cpulevel_t
 is used.
-The following values for 
+The following values for
 .Fa level
 are supported:
 .Bl -column CPU_LEVEL_CPUSET -offset indent
@@ -137,7 +137,7 @@ Children inherit this set after a call t
 .Xr fork 2 .
 .Pp
 .Fn cpuset_setid
-attempts to set the id of the object specified by the 
+attempts to set the id of the object specified by the
 .Fa which
 argument.
 Currently
@@ -149,12 +149,12 @@ Upon successful completion all of the th
 be running on CPUs permitted by the set.
 .Pp
 .Fn cpuset_getid
-retrieves a set id from the object indicated by 
+retrieves a set id from the object indicated by
 .Fa which
 and stores it in the space pointed to by
 .Fa setid .
 The retrieved id may be that of either the root or assigned set
-depending on the value of 
+depending on the value of
 .Fa level .
 .Fa level
 should be

Modified: head/lib/libc/sys/cpuset_getaffinity.2
==============================================================================
--- head/lib/libc/sys/cpuset_getaffinity.2	Thu Mar 29 04:54:34 2012	(r233647)
+++ head/lib/libc/sys/cpuset_getaffinity.2	Thu Mar 29 05:02:12 2012	(r233648)
@@ -45,7 +45,7 @@
 .Fn cpuset_getaffinity
 and
 .Fn cpuset_setaffinity
-allow the manipulation of sets of CPUs available to processes, threads, 
+allow the manipulation of sets of CPUs available to processes, threads,
 interrupts, jails and other resources.
 These functions may manipulate sets of CPUs that contain many processes
 or per-object anonymous masks that effect only a single object.

Modified: head/lib/libc/sys/jail.2
==============================================================================
--- head/lib/libc/sys/jail.2	Thu Mar 29 04:54:34 2012	(r233647)
+++ head/lib/libc/sys/jail.2	Thu Mar 29 05:02:12 2012	(r233648)
@@ -334,7 +334,7 @@ flag is not set.
 The jail referred to by a
 .Va jid
 is not accessible by the process, because the process is in a different
-jail. 
+jail.
 .It Bq Er EEXIST
 The jail referred to by a
 .Va jid
@@ -382,7 +382,7 @@ parameter does not exist.
 The jail referred to by a
 .Va jid
 is not accessible by the process, because the process is in a different
-jail. 
+jail.
 .It Bq Er ENOENT
 The
 .Va lastjid

Modified: head/lib/libc/sys/kqueue.2
==============================================================================
--- head/lib/libc/sys/kqueue.2	Thu Mar 29 04:54:34 2012	(r233647)
+++ head/lib/libc/sys/kqueue.2	Thu Mar 29 05:02:12 2012	(r233648)
@@ -203,7 +203,7 @@ will not return it.
 The filter itself is not disabled.
 .It EV_DISPATCH
 Disable the event source immediately after delivery of an event.
-See 
+See
 .Dv EV_DISABLE
 above.
 .It EV_DELETE
@@ -217,7 +217,7 @@ any pending events.
 When passed as input, it forces
 .Dv EV_ERROR
 to always be returned.
-When a filter is successfully added the 
+When a filter is successfully added the
 .Va data
 field will be zero.
 .It EV_ONESHOT
@@ -449,10 +449,10 @@ Establishes a user event identified by
 .Va ident
 which is not associated with any kernel mechanism but is triggered by
 user level code.
-The lower 24 bits of the 
+The lower 24 bits of the
 .Va fflags
 may be used for user defined flags and manipulated using the following:
-.Bl -tag -width XXNOTE_FFLAGSMASK 
+.Bl -tag -width XXNOTE_FFLAGSMASK
 .It Dv NOTE_FFNOP
 Ignore the input
 .Va fflags .

Modified: head/lib/libc/sys/pathconf.2
==============================================================================
--- head/lib/libc/sys/pathconf.2	Thu Mar 29 04:54:34 2012	(r233647)
+++ head/lib/libc/sys/pathconf.2	Thu Mar 29 05:02:12 2012	(r233648)
@@ -173,7 +173,7 @@ return a positive number that represents
 bytes.
 The offsets of holes returned will be aligned to this same value.
 A special value of 1 is returned if the file system does not specify the minimum
-hole size but still reports holes.  
+hole size but still reports holes.
 .El
 .Sh RETURN VALUES
 If the call to

Modified: head/lib/libc/sys/ptrace.2
==============================================================================
--- head/lib/libc/sys/ptrace.2	Thu Mar 29 04:54:34 2012	(r233647)
+++ head/lib/libc/sys/ptrace.2	Thu Mar 29 05:02:12 2012	(r233648)
@@ -441,7 +441,7 @@ This request is used to iterate over the
 process.
 The
 .Fa addr
-argument specifies a pointer to a 
+argument specifies a pointer to a
 .Vt "struct ptrace_vm_entry" ,
 which is defined as follows:
 .Bd -literal

Modified: head/lib/libc/sys/quotactl.2
==============================================================================
--- head/lib/libc/sys/quotactl.2	Thu Mar 29 04:54:34 2012	(r233647)
+++ head/lib/libc/sys/quotactl.2	Thu Mar 29 05:02:12 2012	(r233648)
@@ -113,7 +113,7 @@ Only the super-user may turn quotas off.
 .It Dv Q_GETQUOTASIZE
 Get the wordsize used to represent the quotas for the user or group
 (as determined by the command type).
-Possible values are 32 for the old-style quota file 
+Possible values are 32 for the old-style quota file
 and 64 for the new-style quota file.
 The
 .Fa addr
@@ -199,7 +199,7 @@ The
 .Fa id
 argument to
 .Dv Q_GETQUOTA ,
-.Dv Q_SETQUOTA 
+.Dv Q_SETQUOTA
 or
 .Dv Q_SETUSE
 is a negative value.

Modified: head/lib/libc/sys/sctp_generic_sendmsg.2
==============================================================================
--- head/lib/libc/sys/sctp_generic_sendmsg.2	Thu Mar 29 04:54:34 2012	(r233647)
+++ head/lib/libc/sys/sctp_generic_sendmsg.2	Thu Mar 29 05:02:12 2012	(r233648)
@@ -54,7 +54,7 @@ and
 .Fn sctp_generic_sendmsg_iov
 are the true system calls used by the
 .Xr sctp_sendmsg 3
-and 
+and
 .Xr sctp_send 3
 function calls.
 These are more efficient since they are
@@ -68,7 +68,7 @@ For detailed usage please see either the
 .Xr sctp_send 3
 or
 .Xr sctp_sendmsg 3
-function calls. 
+function calls.
 .Sh RETURN VALUES
 The call returns the number of bytes written on success and -1 upon failure.
 .Sh ERRORS

Modified: head/lib/libc/sys/sctp_peeloff.2
==============================================================================
--- head/lib/libc/sys/sctp_peeloff.2	Thu Mar 29 04:54:34 2012	(r233647)
+++ head/lib/libc/sys/sctp_peeloff.2	Thu Mar 29 05:02:12 2012	(r233648)
@@ -60,7 +60,7 @@ The
 system call can return the following errors:
 .Bl -tag -width Er
 .It Bq Er ENOTCONN
-The 
+The
 .Fa id
 given to the call does not map to a valid
 association.

Modified: head/lib/libc/sys/select.2
==============================================================================
--- head/lib/libc/sys/select.2	Thu Mar 29 04:54:34 2012	(r233647)
+++ head/lib/libc/sys/select.2	Thu Mar 29 05:02:12 2012	(r233648)
@@ -222,6 +222,6 @@ Thus, it is unwise to assume that the ti
 by the
 .Fn select
 system call.
-.Fx 
+.Fx
 does not modify the return value, which can cause problems for applications
 ported from other systems.

Modified: head/lib/libc/sys/sendfile.2
==============================================================================
--- head/lib/libc/sys/sendfile.2	Thu Mar 29 04:54:34 2012	(r233647)

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***

From owner-svn-src-head@FreeBSD.ORG  Thu Mar 29 06:19:01 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 62580106566B;
	Thu, 29 Mar 2012 06:19:01 +0000 (UTC)
	(envelope-from joel@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 34DB28FC0C;
	Thu, 29 Mar 2012 06:19:01 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2T6J1iG079420;
	Thu, 29 Mar 2012 06:19:01 GMT (envelope-from joel@svn.freebsd.org)
Received: (from joel@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2T6J05u079418;
	Thu, 29 Mar 2012 06:19:00 GMT (envelope-from joel@svn.freebsd.org)
Message-Id: <201203290619.q2T6J05u079418@svn.freebsd.org>
From: Joel Dahl 
Date: Thu, 29 Mar 2012 06:19:00 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233650 - head/lib/libpmc
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Mar 2012 06:19:01 -0000

Author: joel (doc committer)
Date: Thu Mar 29 06:19:00 2012
New Revision: 233650
URL: http://svn.freebsd.org/changeset/base/233650

Log:
  mdoc: sort prologue macros.

Modified:
  head/lib/libpmc/pmc.soft.3

Modified: head/lib/libpmc/pmc.soft.3
==============================================================================
--- head/lib/libpmc/pmc.soft.3	Thu Mar 29 06:01:11 2012	(r233649)
+++ head/lib/libpmc/pmc.soft.3	Thu Mar 29 06:19:00 2012	(r233650)
@@ -24,8 +24,8 @@
 .\" $FreeBSD$
 .\"
 .Dd March 28, 2012
-.Os
 .Dt PMC.SOFT 3
+.Os
 .Sh NAME
 .Nm pmc.soft
 .Nd measurements using software based events

From owner-svn-src-head@FreeBSD.ORG  Thu Mar 29 06:37:03 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 718DD1065673;
	Thu, 29 Mar 2012 06:37:03 +0000 (UTC) (envelope-from ae@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 43B538FC16;
	Thu, 29 Mar 2012 06:37:03 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2T6b3QV080005;
	Thu, 29 Mar 2012 06:37:03 GMT (envelope-from ae@svn.freebsd.org)
Received: (from ae@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2T6b38b080003;
	Thu, 29 Mar 2012 06:37:03 GMT (envelope-from ae@svn.freebsd.org)
Message-Id: <201203290637.q2T6b38b080003@svn.freebsd.org>
From: "Andrey V. Elsukov" 
Date: Thu, 29 Mar 2012 06:37:03 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233651 - head/sys/geom/part
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Mar 2012 06:37:03 -0000

Author: ae
Date: Thu Mar 29 06:37:02 2012
New Revision: 233651
URL: http://svn.freebsd.org/changeset/base/233651

Log:
  Do proper cleanup for the GPT case when an error occurs.

Modified:
  head/sys/geom/part/g_part_ldm.c

Modified: head/sys/geom/part/g_part_ldm.c
==============================================================================
--- head/sys/geom/part/g_part_ldm.c	Thu Mar 29 06:19:00 2012	(r233650)
+++ head/sys/geom/part/g_part_ldm.c	Thu Mar 29 06:37:02 2012	(r233651)
@@ -1371,14 +1371,15 @@ g_part_ldm_read(struct g_part_table *bas
 	/* Read and parse LDM private headers. */
 	error = ldm_privhdr_check(&db, cp, table->is_gpt);
 	if (error != 0)
-		return (error);
+		goto gpt_cleanup;
 	basetable->gpt_first = table->is_gpt ? 0: db.ph.start;
 	basetable->gpt_last = basetable->gpt_first + db.ph.size - 1;
 	table->db_offset = db.ph.db_offset;
 	/* Make additional checks for GPT */
 	if (table->is_gpt) {
-		if (ldm_gpt_check(&db, cp) != 0)
-			return (ENXIO);
+		error = ldm_gpt_check(&db, cp);
+		if (error != 0)
+			goto gpt_cleanup;
 		/*
 		 * Now we should reset database offset to zero, because our
 		 * consumer cp is attached to the ms-ldm-metadata partition
@@ -1389,12 +1390,25 @@ g_part_ldm_read(struct g_part_table *bas
 	/* Read and parse LDM TOC headers. */
 	error = ldm_tochdr_check(&db, cp);
 	if (error != 0)
-		return (error);
+		goto gpt_cleanup;
 	/* Read and parse LDM VMDB header. */
 	error = ldm_vmdbhdr_check(&db, cp);
 	if (error != 0)
-		return (error);
+		goto gpt_cleanup;
 	error = ldm_vmdb_parse(&db, cp);
+	/*
+	 * For the GPT case we must detach and destroy
+	 * second consumer before return.
+	 */
+gpt_cleanup:
+	if (table->is_gpt) {
+		g_topology_lock();
+		g_access(cp, -1, 0, 0);
+		g_detach(cp);
+		g_destroy_consumer(cp);
+		g_topology_unlock();
+		cp = cp2;
+	}
 	if (error != 0)
 		return (error);
 	/* Search current disk in the disk list. */
@@ -1408,15 +1422,6 @@ g_part_ldm_read(struct g_part_table *bas
 		ldm_vmdb_free(&db);
 		return (ENXIO);
 	}
-	if (table->is_gpt) {
-		/* Second consumer is no longer needed. */
-		g_topology_lock();
-		g_access(cp, -1, 0, 0);
-		g_detach(cp);
-		g_destroy_consumer(cp);
-		g_topology_unlock();
-		cp = cp2;
-	}
 	index = 1;
 	LIST_FOREACH(vol, &db.volumes, entry) {
 		LIST_FOREACH(comp, &vol->components, entry) {

From owner-svn-src-head@FreeBSD.ORG  Thu Mar 29 07:29:27 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id BD553106566C;
	Thu, 29 Mar 2012 07:29:27 +0000 (UTC) (envelope-from ae@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id A89EF8FC14;
	Thu, 29 Mar 2012 07:29:27 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2T7TRSn081605;
	Thu, 29 Mar 2012 07:29:27 GMT (envelope-from ae@svn.freebsd.org)
Received: (from ae@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2T7TRif081603;
	Thu, 29 Mar 2012 07:29:27 GMT (envelope-from ae@svn.freebsd.org)
Message-Id: <201203290729.q2T7TRif081603@svn.freebsd.org>
From: "Andrey V. Elsukov" 
Date: Thu, 29 Mar 2012 07:29:27 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233652 - head/sys/geom/part
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Mar 2012 07:29:27 -0000

Author: ae
Date: Thu Mar 29 07:29:27 2012
New Revision: 233652
URL: http://svn.freebsd.org/changeset/base/233652

Log:
  VMDB offset should be greater than logical volume size only for MBR.

Modified:
  head/sys/geom/part/g_part_ldm.c

Modified: head/sys/geom/part/g_part_ldm.c
==============================================================================
--- head/sys/geom/part/g_part_ldm.c	Thu Mar 29 06:37:02 2012	(r233651)
+++ head/sys/geom/part/g_part_ldm.c	Thu Mar 29 07:29:27 2012	(r233652)
@@ -495,7 +495,7 @@ ldm_privhdr_check(struct ldm_db *db, str
 		g_free(buf);
 		if (hdr.start > last ||
 		    hdr.start + hdr.size - 1 > last ||
-		    (hdr.start + hdr.size - 1 > hdr.db_offset && is_gpt) ||
+		    (hdr.start + hdr.size - 1 > hdr.db_offset && !is_gpt) ||
 		    hdr.db_size != LDM_DB_SIZE ||
 		    hdr.db_offset + LDM_DB_SIZE - 1 > last ||
 		    hdr.th_offset[0] >= LDM_DB_SIZE ||

From owner-svn-src-head@FreeBSD.ORG  Thu Mar 29 10:32:34 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id C1BF11065672;
	Thu, 29 Mar 2012 10:32:34 +0000 (UTC) (envelope-from kib@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id AC3DB8FC12;
	Thu, 29 Mar 2012 10:32:34 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2TAWYg6088907;
	Thu, 29 Mar 2012 10:32:34 GMT (envelope-from kib@svn.freebsd.org)
Received: (from kib@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2TAWYVa088905;
	Thu, 29 Mar 2012 10:32:34 GMT (envelope-from kib@svn.freebsd.org)
Message-Id: <201203291032.q2TAWYVa088905@svn.freebsd.org>
From: Konstantin Belousov 
Date: Thu, 29 Mar 2012 10:32:34 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233655 - head/libexec/rtld-elf
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Mar 2012 10:32:34 -0000

Author: kib
Date: Thu Mar 29 10:32:34 2012
New Revision: 233655
URL: http://svn.freebsd.org/changeset/base/233655

Log:
  Import DragonFly BSD commit
  
    From: Sascha Wildner 
    Date: Fri, 2 Mar 2012 09:15:56 +0000 (+0100)
    Subject: rtld: Add a special case in do_dlsym() for TLS stored symbols.
    X-Git-Url: http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff_plain/1388aaafe730c85693936aaf9bc6d83fc2d981be?hp=bca4412595a8979ab9f1bf36068c806ce88a667a
  
    rtld: Add a special case in do_dlsym() for TLS stored symbols.
  
    Submitted-by: Markus Pfeiffer 
  
  Discussed with:	kan
  MFC after:	1 week

Modified:
  head/libexec/rtld-elf/rtld.c

Modified: head/libexec/rtld-elf/rtld.c
==============================================================================
--- head/libexec/rtld-elf/rtld.c	Thu Mar 29 09:19:00 2012	(r233654)
+++ head/libexec/rtld-elf/rtld.c	Thu Mar 29 10:32:34 2012	(r233655)
@@ -2618,6 +2618,7 @@ do_dlsym(void *handle, const char *name,
     const Elf_Sym *def;
     SymLook req;
     RtldLockState lockstate;
+    tls_index ti;
     int res;
 
     def = NULL;
@@ -2732,7 +2733,11 @@ do_dlsym(void *handle, const char *name,
 	    return (make_function_pointer(def, defobj));
 	else if (ELF_ST_TYPE(def->st_info) == STT_GNU_IFUNC)
 	    return (rtld_resolve_ifunc(defobj, def));
-	else
+	else if (ELF_ST_TYPE(def->st_info) == STT_TLS) {
+	    ti.ti_module = defobj->tlsindex;
+	    ti.ti_offset = def->st_value;
+	    return (__tls_get_addr(&ti));
+	} else
 	    return (defobj->relocbase + def->st_value);
     }
 

From owner-svn-src-head@FreeBSD.ORG  Thu Mar 29 11:12:23 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id B5E091065674;
	Thu, 29 Mar 2012 11:12:23 +0000 (UTC) (envelope-from slw@zxy.spb.ru)
Received: from zxy.spb.ru (zxy.spb.ru [195.70.199.98])
	by mx1.freebsd.org (Postfix) with ESMTP id 66C508FC15;
	Thu, 29 Mar 2012 11:12:23 +0000 (UTC)
Received: from slw by zxy.spb.ru with local (Exim 4.69 (FreeBSD))
	(envelope-from )
	id 1SDDHY-000CSg-9L; Thu, 29 Mar 2012 15:12:44 +0400
Date: Thu, 29 Mar 2012 15:12:44 +0400
From: Slawa Olhovchenkov 
To: Doug Barton 
Message-ID: <20120329111244.GE61230@zxy.spb.ru>
References: <201203220848.q2M8mia8015593@svn.freebsd.org>
	<20120325105958.GB61230@zxy.spb.ru>
	
	<4F73D8A0.3040608@FreeBSD.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <4F73D8A0.3040608@FreeBSD.org>
User-Agent: Mutt/1.5.21 (2010-09-15)
X-SA-Exim-Connect-IP: 
X-SA-Exim-Mail-From: slw@zxy.spb.ru
X-SA-Exim-Scanned: No (on zxy.spb.ru); SAEximRunCond expanded to false
Cc: Stanislav Sedov , svn-src-head@freebsd.org,
	svn-src-all@freebsd.org, src-committers@freebsd.org,
	Ivan Voras 
Subject: Re: svn commit: r233294 - in head: . contrib/com_err crypto/heimdal
 crypto/heimdal/admin crypto/heimdal/appl crypto/heimdal/appl/afsutil
 crypto/heimdal/appl/ftp crypto/heimdal/appl/ftp/common crypto/he...
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Mar 2012 11:12:23 -0000

On Wed, Mar 28, 2012 at 08:36:00PM -0700, Doug Barton wrote:

> On 3/27/2012 2:10 PM, Ivan Voras wrote:
> > It will help both present
> > development (the pkgng is also AFAIK using sqlite)
> 
> All of the stuff that pkgng relies on (including the tool itself) are
> going to be in the ports collection, where they belong. We should have
> moved pkg_* there years ago, but this change is at least a step in the
> right direction.

pkg_install in ports?
How to install pkg_install? pkunzip.zip?

From owner-svn-src-head@FreeBSD.ORG  Thu Mar 29 11:16:24 2012
Return-Path: 
Delivered-To: svn-src-head@FreeBSD.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 2DD401065673;
	Thu, 29 Mar 2012 11:16:24 +0000 (UTC)
	(envelope-from theraven@FreeBSD.org)
Received: from theravensnest.org (theravensnest.org [109.169.23.128])
	by mx1.freebsd.org (Postfix) with ESMTP id B95848FC0C;
	Thu, 29 Mar 2012 11:16:23 +0000 (UTC)
Received: from [192.168.0.2] (cpc1-cwma8-2-0-cust257.7-3.cable.virginmedia.com
	[82.20.153.2]) (authenticated bits=0)
	by theravensnest.org (8.14.4/8.14.4) with ESMTP id q2TBGJPl068413
	(version=TLSv1/SSLv3 cipher=DHE-DSS-AES128-SHA bits=128 verify=NO);
	Thu, 29 Mar 2012 12:16:20 +0100 (BST)
	(envelope-from theraven@FreeBSD.org)
Mime-Version: 1.0 (Apple Message framework v1257)
Content-Type: text/plain; charset=iso-8859-1
From: David Chisnall 
In-Reply-To: <4F73D8A0.3040608@FreeBSD.org>
Date: Thu, 29 Mar 2012 12:16:14 +0100
Content-Transfer-Encoding: quoted-printable
Message-Id: 
References: <201203220848.q2M8mia8015593@svn.freebsd.org>
	<20120325105958.GB61230@zxy.spb.ru>
	
	<4F73D8A0.3040608@FreeBSD.org>
To: Doug Barton 
X-Mailer: Apple Mail (2.1257)
Cc: src-committers@FreeBSD.org, svn-src-all@FreeBSD.org,
	Stanislav Sedov , Ivan Voras ,
	Slawa Olhovchenkov , svn-src-head@FreeBSD.org
Subject: Re: svn commit: r233294 - in head: . contrib/com_err crypto/heimdal
	crypto/heimdal/admin crypto/heimdal/appl
	crypto/heimdal/appl/afsutil crypto/heimdal/appl/ftp
	crypto/heimdal/appl/ftp/common crypto/he...
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Mar 2012 11:16:24 -0000

On 29 Mar 2012, at 04:36, Doug Barton wrote:

> All of the stuff that pkgng relies on (including the tool itself) are
> going to be in the ports collection, where they belong. We should have
> moved pkg_* there years ago, but this change is at least a step in the
> right direction.

Wait... what?  Why should pkgng be in ports (other than now, while it's =
under development)?  I'd like to see it used for managing some of the =
optional parts of the base system and probably eventually replacing =
freebsd-update, not have it as another bolt-on that is not part of the =
core system.  Not to mention the bootstrapping problem if every user who =
wants to use binary packages needs to use ports to build pkgng.

David=

From owner-svn-src-head@FreeBSD.ORG  Thu Mar 29 11:20:19 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id E7C3D1065670;
	Thu, 29 Mar 2012 11:20:19 +0000 (UTC)
	(envelope-from trasz@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id C8F9A8FC18;
	Thu, 29 Mar 2012 11:20:19 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2TBKJc9090403;
	Thu, 29 Mar 2012 11:20:19 GMT (envelope-from trasz@svn.freebsd.org)
Received: (from trasz@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2TBKJrt090401;
	Thu, 29 Mar 2012 11:20:19 GMT (envelope-from trasz@svn.freebsd.org)
Message-Id: <201203291120.q2TBKJrt090401@svn.freebsd.org>
From: Edward Tomasz Napierala 
Date: Thu, 29 Mar 2012 11:20:19 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233656 - head/sbin/growfs
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Mar 2012 11:20:20 -0000

Author: trasz
Date: Thu Mar 29 11:20:19 2012
New Revision: 233656
URL: http://svn.freebsd.org/changeset/base/233656

Log:
  Remove disklabel handling code from growfs.  This should be done
  via geom_part(4), and it doesn't belong in growfs anyway.
  
  Reviewed by:	kib, mckusick
  Sponsored by:	The FreeBSD Foundation

Modified:
  head/sbin/growfs/growfs.c

Modified: head/sbin/growfs/growfs.c
==============================================================================
--- head/sbin/growfs/growfs.c	Thu Mar 29 10:32:34 2012	(r233655)
+++ head/sbin/growfs/growfs.c	Thu Mar 29 11:20:19 2012	(r233656)
@@ -50,7 +50,6 @@ All rights reserved.\n";
 __FBSDID("$FreeBSD$");
 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -115,7 +114,6 @@ union dinode {
 static ufs2_daddr_t 	inoblk;			/* inode block address */
 static char		inobuf[MAXBSIZE];	/* inode block */
 static ino_t		maxino;			/* last valid inode */
-static int		unlabeled; /* unlabeled partition, e.g. vinum volume */
 
 /*
  * An array of elements of type struct gfs_bpp describes all blocks to
@@ -143,8 +141,6 @@ static void	setblock(struct fs *, unsign
 static void	initcg(int, time_t, int, unsigned int);
 static void	updjcg(int, time_t, int, int, unsigned int);
 static void	updcsloc(time_t, int, int, unsigned int);
-static struct disklabel	*get_disklabel(int);
-static void	return_disklabel(int, struct disklabel *, unsigned int);
 static union dinode *ginode(ino_t, int, int);
 static void	frag_adjust(ufs2_daddr_t, int);
 static int	cond_bl_upd(ufs2_daddr_t *, struct gfs_bpp *, int, int,
@@ -1814,8 +1810,7 @@ charsperline(void)
 }
 
 /*
- * Get the size of the partition if we can't figure it out from the disklabel,
- * e.g. from vinum volumes.
+ * Get the size of the partition.
  */
 static void
 get_dev_size(int fd, int *size)
@@ -1841,8 +1836,7 @@ get_dev_size(int fd, int *size)
  * and it does some basic checkings. The old file system size is determined
  * and after some more checks like we can really access the new last block
  * on the disk etc. we calculate the new parameters for the superblock. After
- * having done this we just call growfs() which will do the work.  Before
- * we finish the only thing left is to update the disklabel.
+ * having done this we just call growfs() which will do the work.
  * We still have to provide support for snapshots. Therefore we first have to
  * understand what data structures are always replicated in the snapshot on
  * creation, for all other blocks we touch during our procedure, we have to
@@ -1860,15 +1854,13 @@ int
 main(int argc, char **argv)
 {
 	DBG_FUNC("main")
-	char *device, *special, *cp;
+	char *device, *special;
 	int ch;
 	unsigned int size = 0;
 	size_t len;
 	unsigned int Nflag = 0;
 	int ExpertFlag = 0;
 	struct stat st;
-	struct disklabel *lp;
-	struct partition *pp;
 	int i, fsi, fso;
 	u_int32_t p_size;
 	char reply[5];
@@ -1960,24 +1952,11 @@ main(int argc, char **argv)
 		err(1, "%s", device);
 
 	/*
-	 * Try to read a label and guess the slice if not specified. This
-	 * code should guess the right thing and avoid to bother the user
-	 * with the task of specifying the option -v on vinum volumes.
-	 */
-	cp = device + strlen(device) - 1;
-	lp = get_disklabel(fsi);
-	pp = NULL;
-	if (lp != NULL) {
-		if (isdigit(*cp))
-			pp = &lp->d_partitions[2];
-		else if (*cp>='a' && *cp<='h')
-			pp = &lp->d_partitions[*cp - 'a'];
-		else
-			errx(1, "unknown device");
-		p_size = pp->p_size;
-	} else {
-		get_dev_size(fsi, &p_size);
-	}
+	 * Try to guess the slice if not specified. This code should guess
+	 * the right thing and avoid to bother the user with the task
+	 * of specifying the option -v on vinum volumes.
+	 */
+	get_dev_size(fsi, &p_size);
 
 	/*
 	 * Check if that partition is suitable for growing a file system.
@@ -2007,8 +1986,7 @@ main(int argc, char **argv)
 	DBG_DUMP_FS(&sblock, "old sblock");
 
 	/*
-	 * Determine size to grow to. Default to the full size specified in
-	 * the disk label.
+	 * Determine size to grow to. Default to the device size.
 	 */
 	sblock.fs_size = dbtofsb(&osblock, p_size);
 	if (size != 0) {
@@ -2068,7 +2046,7 @@ main(int argc, char **argv)
 	/*
 	 * Now calculate new superblock values and check for reasonable
 	 * bound for new file system size:
-	 *     fs_size:    is derived from label or user input
+	 *     fs_size:    is derived from user input
 	 *     fs_dsize:   should get updated in the routines creating or
 	 *                 updating the cylinder groups on the fly
 	 *     fs_cstotal: should get updated in the routines creating or
@@ -2120,18 +2098,6 @@ main(int argc, char **argv)
 	 */
 	growfs(fsi, fso, Nflag);
 
-	/*
-	 * Update the disk label.
-	 */
-	if (!unlabeled) {
-		pp->p_fsize = sblock.fs_fsize;
-		pp->p_frag = sblock.fs_frag;
-		pp->p_cpg = sblock.fs_fpg;
-
-		return_disklabel(fso, lp, Nflag);
-		DBG_PRINT0("label rewritten\n");
-	}
-
 	close(fsi);
 	if (fso > -1)
 		close(fso);
@@ -2143,68 +2109,6 @@ main(int argc, char **argv)
 }
 
 /*
- * Write the updated disklabel back to disk.
- */
-static void
-return_disklabel(int fd, struct disklabel *lp, unsigned int Nflag)
-{
-	DBG_FUNC("return_disklabel")
-	u_short	sum;
-	u_short	*ptr;
-
-	DBG_ENTER;
-
-	if (!lp) {
-		DBG_LEAVE;
-		return;
-	}
-	if (!Nflag) {
-		lp->d_checksum = 0;
-		sum = 0;
-		ptr = (u_short *)lp;
-
-		/*
-		 * recalculate checksum
-		 */
-		while (ptr < (u_short *)&lp->d_partitions[lp->d_npartitions])
-			sum ^= *ptr++;
-		lp->d_checksum=sum;
-
-		if (ioctl(fd, DIOCWDINFO, (char *)lp) < 0)
-			errx(1, "DIOCWDINFO failed");
-	}
-	free(lp);
-
-	DBG_LEAVE;
-	return ;
-}
-
-/*
- * Read the disklabel from disk.
- */
-static struct disklabel *
-get_disklabel(int fd)
-{
-	DBG_FUNC("get_disklabel")
-	static struct disklabel *lab;
-
-	DBG_ENTER;
-
-	lab = (struct disklabel *)malloc(sizeof(struct disklabel));
-	if (!lab)
-		errx(1, "malloc failed");
-
-	if (!ioctl(fd, DIOCGDINFO, (char *)lab))
-		return (lab);
-
-	unlabeled++;
-
-	DBG_LEAVE;
-	return (NULL);
-}
-
-
-/*
  * Dump a line of usage.
  */
 static void

From owner-svn-src-head@FreeBSD.ORG  Thu Mar 29 11:28:12 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 5642C106564A;
	Thu, 29 Mar 2012 11:28:12 +0000 (UTC)
	(envelope-from jlaffaye.freebsd@gmail.com)
Received: from mail-bk0-f54.google.com (mail-bk0-f54.google.com
	[209.85.214.54])
	by mx1.freebsd.org (Postfix) with ESMTP id A29088FC0A;
	Thu, 29 Mar 2012 11:28:10 +0000 (UTC)
Received: by bkcjc3 with SMTP id jc3so2413435bkc.13
	for ; Thu, 29 Mar 2012 04:28:09 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
	h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject
	:references:in-reply-to:content-type:content-transfer-encoding;
	bh=C3h0TZqsOj+xbPGFpSQXka4ZiDYYPNF584in0yzRloA=;
	b=IwYPNZXBm56ZdUadKLVYj0ogfnRYx5BlrdME4/5auo3k04BavtnP6w34XCuxi6gFBA
	wbDAGjUjCIc8hfrLHGCnCkMh9UDcExHHwk1jH9GR/bBSI5clTundXB1PXGCSZEZER+AT
	JHtdX1FGfju0kMnU/M/eqzZFfarYBopQ17uGmDbCKJStt+Dm6i3WQPGxKVS3NZLF8pbb
	aPw+hnc1dWupNH98GY7uBG7ZbfHfsD5L6X+RcKoiOuJ6kS9CDPrPMhEnj69GSVKxotoy
	BQCIzrNUDPljz3UDoMjmUaaVjytaZDnPbfFD/OdyAMlxvHJID/1kf9W1nuX5Fbl5v09d
	d9Bg==
Received: by 10.204.151.86 with SMTP id b22mr14026413bkw.81.1333020489194;
	Thu, 29 Mar 2012 04:28:09 -0700 (PDT)
Received: from [10.42.116.106] (proxy.ovh.net. [213.186.50.98])
	by mx.google.com with ESMTPS id f5sm13002673bke.9.2012.03.29.04.28.06
	(version=SSLv3 cipher=OTHER); Thu, 29 Mar 2012 04:28:07 -0700 (PDT)
Sender: Julien Laffaye 
Message-ID: <4F744745.4070204@freebsd.org>
Date: Thu, 29 Mar 2012 13:28:05 +0200
From: Julien Laffaye 
User-Agent: Mozilla/5.0 (X11; Linux i686;
	rv:7.0.1) Gecko/20110929 Thunderbird/7.0.1
MIME-Version: 1.0
To: David Chisnall 
References: <201203220848.q2M8mia8015593@svn.freebsd.org>
	<20120325105958.GB61230@zxy.spb.ru>
	
	<4F73D8A0.3040608@FreeBSD.org>
	
In-Reply-To: 
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Cc: Doug Barton , svn-src-all@FreeBSD.org,
	Stanislav Sedov , src-committers@FreeBSD.org,
	Ivan Voras ,
	Slawa Olhovchenkov , svn-src-head@FreeBSD.org
Subject: Re: svn commit: r233294 - in head: . contrib/com_err crypto/heimdal
 crypto/heimdal/admin crypto/heimdal/appl
 crypto/heimdal/appl/afsutil crypto/heimdal/appl/ftp
 crypto/heimdal/appl/ftp/common crypto/he...
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Mar 2012 11:28:12 -0000

On 03/29/2012 01:16 PM, David Chisnall wrote:
> On 29 Mar 2012, at 04:36, Doug Barton wrote:
>
>> All of the stuff that pkgng relies on (including the tool itself) are
>> going to be in the ports collection, where they belong. We should have
>> moved pkg_* there years ago, but this change is at least a step in the
>> right direction.
> Wait... what?  Why should pkgng be in ports (other than now, while it's under development)?  I'd like to see it used for managing some of the optional parts of the base system and probably eventually replacing freebsd-update, not have it as another bolt-on that is not part of the core system.  Not to mention the bootstrapping problem if every user who wants to use binary packages needs to use ports to build pkgng.
Its in ports to be able to update pkgng more often. Otherwise, we would 
have to deal with old version of pkgng forever (at least as long as 
FreeBSD branches are supported). Now that it is in the ports, it is also 
a package so it knows how to upgrade itself. That means we can now 
upgrade the version of pkgng even on old FreeBSD installations. Last but 
not least, we also have fewer ABI constraints if we have to break it.
As for the boostrap problem, the bsdinstaller will install the pkgng 
package for you, so you'll have the pkg(8) command right after the first 
boot.

From owner-svn-src-head@FreeBSD.ORG  Thu Mar 29 11:32:58 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 3E513106566B;
	Thu, 29 Mar 2012 11:32:58 +0000 (UTC)
	(envelope-from jlaffaye.freebsd@gmail.com)
Received: from mail-bk0-f54.google.com (mail-bk0-f54.google.com
	[209.85.214.54])
	by mx1.freebsd.org (Postfix) with ESMTP id DE4538FC0C;
	Thu, 29 Mar 2012 11:32:56 +0000 (UTC)
Received: by bkcjc3 with SMTP id jc3so2418210bkc.13
	for ; Thu, 29 Mar 2012 04:32:55 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
	h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject
	:references:in-reply-to:content-type:content-transfer-encoding;
	bh=5PiPMg52HJR1hqh1qRagjEGMNhU0+Ds2BS4h/MXsdKs=;
	b=seHWDKIcmNwirm6QNFek9kf8anXEs9NzFULXu1XqbofvTSDGQuGlKU6H7KRrEMjNa+
	mGiUGAuNCPLZvlstKpXHuLzrbDdYW5c75M/SAZ2ceUeP1z/6rl/Ll1p+BqVOhZ+x3PX6
	LL+ZJVP/nO4v4xQooDXXOsMq25wynvCkAFRTCNaZfHDBrnunwFs6vMSxUJFhE+dcgn2z
	mykzZzgSaO8YNluBX6uf+MgEJ63w/C/DWpQ1494Gv3YH1d+t/WtVMI6H7vG2W3qmYLfv
	HYT6iHqYJyzNWVaeng2jSEM7zpF6FUiA1HoEZh5retR4ZaZMckzL+rA52bhNfwcXeYMU
	ZekA==
Received: by 10.204.148.89 with SMTP id o25mr13969773bkv.52.1333020775649;
	Thu, 29 Mar 2012 04:32:55 -0700 (PDT)
Received: from [10.42.116.106] (proxy.ovh.net. [213.186.50.98])
	by mx.google.com with ESMTPS id r14sm13013914bkv.11.2012.03.29.04.32.54
	(version=SSLv3 cipher=OTHER); Thu, 29 Mar 2012 04:32:54 -0700 (PDT)
Sender: Julien Laffaye 
Message-ID: <4F744865.2000200@freebsd.org>
Date: Thu, 29 Mar 2012 13:32:53 +0200
From: Julien Laffaye 
User-Agent: Mozilla/5.0 (X11; Linux i686;
	rv:7.0.1) Gecko/20110929 Thunderbird/7.0.1
MIME-Version: 1.0
To: Ivan Voras 
References: <201203220848.q2M8mia8015593@svn.freebsd.org>
	<20120325105958.GB61230@zxy.spb.ru>
	
In-Reply-To: 
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Cc: Stanislav Sedov , svn-src-head@freebsd.org,
	svn-src-all@freebsd.org, src-committers@freebsd.org,
	Slawa Olhovchenkov 
Subject: Re: svn commit: r233294 - in head: . contrib/com_err crypto/heimdal
 crypto/heimdal/admin crypto/heimdal/appl
 crypto/heimdal/appl/afsutil crypto/heimdal/appl/ftp
 crypto/heimdal/appl/ftp/common crypto/he...
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Mar 2012 11:32:58 -0000

On 03/27/2012 11:10 PM, Ivan Voras wrote:
> On 25 March 2012 12:59, Slawa Olhovchenkov  wrote:
>> On Thu, Mar 22, 2012 at 08:48:44AM +0000, Stanislav Sedov wrote:
>>
>>>    - Heimdal's KDC now require sqlite to operate.  We use the bundled version
>>>      and install it as libheimsqlite.  If some other FreeBSD components will
>>>      require it in the future we can rename it to libbsdsqlite and use for these
>>>      components as well.
>> Can some ports (svn, for example) use this library?
> Judging from past experience, that would not be a good idea.
>
> However, libbsdsqlite is a *very* good idea, now that there's finally
> one user it which cannot be hacked around :) It will help both present
> development (the pkgng is also AFAIK using sqlite) and future
> developments (all the little binary-blob databases in the system could
> finally use something structured and future-proof). I will personally
> teach any doubting Thomas on how wonderful sqlite and SQL in general
> really is [*] ;)
Just a reminder: pkgng does not install libsqlite3.so, the libpkg.so is 
statically linked against libsqlite3.a
sqlite is an implementation detail of pkgng and is not visible.

From owner-svn-src-head@FreeBSD.ORG  Thu Mar 29 11:46:30 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 8CB27106564A;
	Thu, 29 Mar 2012 11:46:30 +0000 (UTC)
	(envelope-from jchandra@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 771998FC16;
	Thu, 29 Mar 2012 11:46:30 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2TBkU70091244;
	Thu, 29 Mar 2012 11:46:30 GMT
	(envelope-from jchandra@svn.freebsd.org)
Received: (from jchandra@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2TBkU95091241;
	Thu, 29 Mar 2012 11:46:30 GMT
	(envelope-from jchandra@svn.freebsd.org)
Message-Id: <201203291146.q2TBkU95091241@svn.freebsd.org>
From: "Jayachandran C." 
Date: Thu, 29 Mar 2012 11:46:30 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233657 - head/sys/mips/nlm/dev/net/ucore
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Mar 2012 11:46:30 -0000

Author: jchandra
Date: Thu Mar 29 11:46:29 2012
New Revision: 233657
URL: http://svn.freebsd.org/changeset/base/233657

Log:
  Remove unnecessary assembly code.
  
  The compiler should generate lw/sw corresponding to register
  operations.

Modified:
  head/sys/mips/nlm/dev/net/ucore/ucore.h
  head/sys/mips/nlm/dev/net/ucore/ucore_app.c

Modified: head/sys/mips/nlm/dev/net/ucore/ucore.h
==============================================================================
--- head/sys/mips/nlm/dev/net/ucore/ucore.h	Thu Mar 29 11:20:19 2012	(r233656)
+++ head/sys/mips/nlm/dev/net/ucore/ucore.h	Thu Mar 29 11:46:29 2012	(r233657)
@@ -45,8 +45,8 @@
 #define	UCORE_FR_FIFOEMPTY	0x802c
 #define	UCORE_PKT_DISTR		0x8030
 
-#define	PACKET_MEMORY		(0xFFE00)
-#define	PACKET_DATA_OFFSET	(64)
+#define	PACKET_MEMORY		0xFFE00
+#define	PACKET_DATA_OFFSET	64
 #define	SHARED_SCRATCH_MEM	0x18000
 
 /* Distribution mode */
@@ -57,8 +57,8 @@
 #define	VAL_PDL(x)		(((x) & 0xf) << 4)
 
 /*output buffer done*/
-#define	VAL_FSV(x)		(x<<19)
-#define	VAL_FFS(x)		(x<<14)
+#define	VAL_FSV(x)		(x << 19)
+#define	VAL_FFS(x)		(x << 14)
 
 #define	FWD_DEST_ONLY		1
 #define	FWD_ENQ_DIST_VEC	2
@@ -69,37 +69,33 @@
 
 #define	USE_HASH_DST		(1 << 20)
 
+static __inline unsigned int
+nlm_read_ucore_reg(int reg)
+{
+	volatile unsigned int *addr = (volatile void *)reg;
+
+	return (*addr);
+}
+
+static __inline void
+nlm_write_ucore_reg(int reg, unsigned int val)
+{
+	volatile unsigned int *addr = (volatile void *)reg;
+
+	*addr = val;
+}
 
 #define	NLM_DEFINE_UCORE(name, reg)				\
-static __inline__ unsigned int nlm_read_ucore_##name(void)	\
+static __inline unsigned int					\
+nlm_read_ucore_##name(void)					\
 {								\
-	unsigned int __rv;                                      \
-	__asm__ __volatile__ (                                  \
-	".set	push\n"                                         \
-	".set	noreorder\n"                                    \
-	".set	mips32\n"                                       \
-	"li	$8, %1\n"					\
-	"lw	%0, ($8)\n"					\
-	".set	pop\n"                                          \
-	: "=r" (__rv)						\
-	: "i" (reg)						\
-	: "$8"							\
-	); 		                			\
-        return __rv;						\
+	return nlm_read_ucore_reg(reg);				\
 }								\
 								\
-static __inline__ void nlm_write_ucore_##name(unsigned int val)	\
+static __inline void						\
+nlm_write_ucore_##name(unsigned int v)				\
 {								\
-	__asm__ __volatile__(                                   \
-	".set	push\n"                                         \
-	".set	noreorder\n"                                    \
-	".set	mips32\n"                                       \
-	"li	$8, %1\n"					\
-	"sw	%0, ($8)\n"					\
-	".set	pop\n"                                          \
-	:: "r" (val), "i" (reg)					\
-	: "$8"							\
-	);							\
+	nlm_write_ucore_reg(reg, v);				\
 } struct __hack
 
 

Modified: head/sys/mips/nlm/dev/net/ucore/ucore_app.c
==============================================================================
--- head/sys/mips/nlm/dev/net/ucore/ucore_app.c	Thu Mar 29 11:20:19 2012	(r233656)
+++ head/sys/mips/nlm/dev/net/ucore/ucore_app.c	Thu Mar 29 11:46:29 2012	(r233657)
@@ -38,7 +38,7 @@ int main(void)
 	int intf, hw_parser_error, context;
 #endif
 	unsigned int pktrdy;
-	int num_cachelines = 1518 >> 6; /* pktsize / L3 cacheline size */
+	int num_cachelines = 1518 / 64 ; /* pktsize / L3 cacheline size */
 
 
 	/* Spray packets to using distribution vector */

From owner-svn-src-head@FreeBSD.ORG  Thu Mar 29 13:36:53 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id CB95C1065675;
	Thu, 29 Mar 2012 13:36:53 +0000 (UTC) (envelope-from rrs@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id B4BF38FC12;
	Thu, 29 Mar 2012 13:36:53 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2TDar0s095127;
	Thu, 29 Mar 2012 13:36:53 GMT (envelope-from rrs@svn.freebsd.org)
Received: (from rrs@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2TDargs095114;
	Thu, 29 Mar 2012 13:36:53 GMT (envelope-from rrs@svn.freebsd.org)
Message-Id: <201203291336.q2TDargs095114@svn.freebsd.org>
From: Randall Stewart 
Date: Thu, 29 Mar 2012 13:36:53 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233660 - head/sys/netinet
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Mar 2012 13:36:53 -0000

Author: rrs
Date: Thu Mar 29 13:36:53 2012
New Revision: 233660
URL: http://svn.freebsd.org/changeset/base/233660

Log:
  Make stream our stream reset implementation
  compliant to RFC6525.
  
  MFC after:	1 month

Modified:
  head/sys/netinet/sctp.h
  head/sys/netinet/sctp_constants.h
  head/sys/netinet/sctp_header.h
  head/sys/netinet/sctp_input.c
  head/sys/netinet/sctp_output.c
  head/sys/netinet/sctp_output.h
  head/sys/netinet/sctp_pcb.h
  head/sys/netinet/sctp_peeloff.c
  head/sys/netinet/sctp_structs.h
  head/sys/netinet/sctp_uio.h
  head/sys/netinet/sctp_usrreq.c
  head/sys/netinet/sctputil.c
  head/sys/netinet/sctputil.h

Modified: head/sys/netinet/sctp.h
==============================================================================
--- head/sys/netinet/sctp.h	Thu Mar 29 13:01:29 2012	(r233659)
+++ head/sys/netinet/sctp.h	Thu Mar 29 13:36:53 2012	(r233660)
@@ -155,8 +155,22 @@ struct sctp_paramhdr {
  * field.
  */
 
-/* these should probably go into sockets API */
-#define SCTP_RESET_STREAMS		0x00001004	/* wo */
+#define SCTP_ENABLE_STREAM_RESET	0x00000900	/* struct
+							 * sctp_assoc_value */
+#define SCTP_RESET_STREAMS		0x00000901	/* struct
+							 * sctp_reset_streams */
+#define SCTP_RESET_ASSOC		0x00000902	/* sctp_assoc_t */
+#define SCTP_ADD_STREAMS		0x00000903	/* struct
+							 * sctp_add_streams */
+
+/* For enable stream reset */
+#define SCTP_ENABLE_RESET_STREAM_REQ 	0x00000001
+#define SCTP_ENABLE_RESET_ASSOC_REQ 	0x00000002
+#define SCTP_ENABLE_CHANGE_ASSOC_REQ 	0x00000004
+#define SCTP_ENABLE_VALUE_MASK		0x00000007
+/* For reset streams */
+#define SCTP_STREAM_RESET_INCOMING	0x00000001
+#define SCTP_STREAM_RESET_OUTGOING	0x00000002
 
 
 /* here on down are more implementation specific */

Modified: head/sys/netinet/sctp_constants.h
==============================================================================
--- head/sys/netinet/sctp_constants.h	Thu Mar 29 13:01:29 2012	(r233659)
+++ head/sys/netinet/sctp_constants.h	Thu Mar 29 13:36:53 2012	(r233660)
@@ -418,7 +418,8 @@ __FBSDID("$FreeBSD$");
 #define SCTP_STR_RESET_IN_REQUEST	0x000e
 #define SCTP_STR_RESET_TSN_REQUEST	0x000f
 #define SCTP_STR_RESET_RESPONSE		0x0010
-#define SCTP_STR_RESET_ADD_STREAMS	0x0011
+#define SCTP_STR_RESET_ADD_OUT_STREAMS	0x0011
+#define SCTP_STR_RESET_ADD_IN_STREAMS   0x0012
 
 #define SCTP_MAX_RESET_PARAMS 2
 #define SCTP_STREAM_RESET_TSN_DELTA    0x1000

Modified: head/sys/netinet/sctp_header.h
==============================================================================
--- head/sys/netinet/sctp_header.h	Thu Mar 29 13:01:29 2012	(r233659)
+++ head/sys/netinet/sctp_header.h	Thu Mar 29 13:36:53 2012	(r233660)
@@ -501,7 +501,7 @@ struct sctp_stream_reset_add_strm {
 
 #define SCTP_STREAM_RESET_NOTHING   0x00000000	/* Nothing for me to do */
 #define SCTP_STREAM_RESET_PERFORMED 0x00000001	/* Did it */
-#define SCTP_STREAM_RESET_DENIED    0x00000002	/* refused to do it */
+#define SCTP_STREAM_RESET_REJECT    0x00000002	/* refused to do it */
 #define SCTP_STREAM_RESET_ERROR_STR 0x00000003	/* bad Stream no */
 #define SCTP_STREAM_RESET_TRY_LATER 0x00000004	/* collision, try again */
 #define SCTP_STREAM_RESET_BAD_SEQNO 0x00000005	/* bad str-reset seq no */

Modified: head/sys/netinet/sctp_input.c
==============================================================================
--- head/sys/netinet/sctp_input.c	Thu Mar 29 13:01:29 2012	(r233659)
+++ head/sys/netinet/sctp_input.c	Thu Mar 29 13:36:53 2012	(r233660)
@@ -2790,6 +2790,7 @@ sctp_handle_cookie_echo(struct mbuf *m, 
 			inp->sctp_ecn_enable = (*inp_p)->sctp_ecn_enable;
 			inp->partial_delivery_point = (*inp_p)->partial_delivery_point;
 			inp->sctp_context = (*inp_p)->sctp_context;
+			inp->local_strreset_support = (*inp_p)->local_strreset_support;
 			inp->inp_starting_point_for_iterator = NULL;
 			/*
 			 * copy in the authentication parameters from the
@@ -3612,20 +3613,35 @@ sctp_handle_stream_reset_response(struct
 				if (asoc->stream_reset_outstanding)
 					asoc->stream_reset_outstanding--;
 				if (action != SCTP_STREAM_RESET_PERFORMED) {
-					sctp_ulp_notify(SCTP_NOTIFY_STR_RESET_FAILED_IN, stcb, number_entries, srparam->list_of_streams, SCTP_SO_NOT_LOCKED);
+					sctp_ulp_notify(SCTP_NOTIFY_STR_RESET_FAILED_IN, stcb,
+					    number_entries, srparam->list_of_streams, SCTP_SO_NOT_LOCKED);
 				}
-			} else if (type == SCTP_STR_RESET_ADD_STREAMS) {
+			} else if (type == SCTP_STR_RESET_ADD_OUT_STREAMS) {
 				/* Ok we now may have more streams */
+				int num_stream;
+
+				num_stream = stcb->asoc.strm_pending_add_size;
+				if (num_stream > (stcb->asoc.strm_realoutsize - stcb->asoc.streamoutcnt)) {
+					/* TSNH */
+					num_stream = stcb->asoc.strm_realoutsize - stcb->asoc.streamoutcnt;
+				}
+				stcb->asoc.strm_pending_add_size = 0;
 				if (asoc->stream_reset_outstanding)
 					asoc->stream_reset_outstanding--;
 				if (action == SCTP_STREAM_RESET_PERFORMED) {
 					/* Put the new streams into effect */
-					stcb->asoc.streamoutcnt = stcb->asoc.strm_realoutsize;
-					sctp_ulp_notify(SCTP_NOTIFY_STR_RESET_ADD_OK, stcb,
-					    (uint32_t) stcb->asoc.streamoutcnt, NULL, SCTP_SO_NOT_LOCKED);
+					stcb->asoc.streamoutcnt += num_stream;
+					sctp_notify_stream_reset_add(stcb, stcb->asoc.streamincnt, stcb->asoc.streamoutcnt, 0);
 				} else {
-					sctp_ulp_notify(SCTP_NOTIFY_STR_RESET_ADD_FAIL, stcb,
-					    (uint32_t) stcb->asoc.streamoutcnt, NULL, SCTP_SO_NOT_LOCKED);
+					sctp_notify_stream_reset_add(stcb, stcb->asoc.streamincnt, stcb->asoc.streamoutcnt,
+					    SCTP_STREAM_CHANGED_DENIED);
+				}
+			} else if (type == SCTP_STR_RESET_ADD_IN_STREAMS) {
+				if (asoc->stream_reset_outstanding)
+					asoc->stream_reset_outstanding--;
+				if (action != SCTP_STREAM_RESET_PERFORMED) {
+					sctp_notify_stream_reset_add(stcb, stcb->asoc.streamincnt, stcb->asoc.streamoutcnt,
+					    SCTP_STREAM_CHANGED_DENIED);
 				}
 			} else if (type == SCTP_STR_RESET_TSN_REQUEST) {
 				/**
@@ -3667,7 +3683,10 @@ sctp_handle_stream_reset_response(struct
 
 					sctp_reset_out_streams(stcb, 0, (uint16_t *) NULL);
 					sctp_reset_in_stream(stcb, 0, (uint16_t *) NULL);
-
+					sctp_notify_stream_reset_tsn(stcb, stcb->asoc.sending_seq, (stcb->asoc.mapping_array_base_tsn + 1), 0);
+				} else {
+					sctp_notify_stream_reset_tsn(stcb, stcb->asoc.sending_seq, (stcb->asoc.mapping_array_base_tsn + 1),
+					    SCTP_STREAM_RESET_FAILED);
 				}
 			}
 			/* get rid of the request and get the request flags */
@@ -3700,8 +3719,7 @@ sctp_handle_str_reset_request_in(struct 
 		if (trunc) {
 			/* Can't do it, since they exceeded our buffer size  */
 			asoc->last_reset_action[1] = asoc->last_reset_action[0];
-			asoc->last_reset_action[0] = SCTP_STREAM_RESET_DENIED;
-			sctp_add_stream_reset_result(chk, seq, asoc->last_reset_action[0]);
+			asoc->last_reset_action[0] = SCTP_STREAM_RESET_REJECT;
 		} else if (stcb->asoc.stream_reset_out_is_outstanding == 0) {
 			len = ntohs(req->ph.param_length);
 			number_entries = ((len - sizeof(struct sctp_stream_reset_in_request)) / sizeof(uint16_t));
@@ -3723,8 +3741,8 @@ sctp_handle_str_reset_request_in(struct 
 			/* Can't do it, since we have sent one out */
 			asoc->last_reset_action[1] = asoc->last_reset_action[0];
 			asoc->last_reset_action[0] = SCTP_STREAM_RESET_TRY_LATER;
-			sctp_add_stream_reset_result(chk, seq, asoc->last_reset_action[0]);
 		}
+		sctp_add_stream_reset_result(chk, seq, asoc->last_reset_action[0]);
 		asoc->str_reset_seq_in++;
 	} else if (asoc->str_reset_seq_in - 1 == seq) {
 		sctp_add_stream_reset_result(chk, seq, asoc->last_reset_action[0]);
@@ -3786,7 +3804,7 @@ sctp_handle_str_reset_request_tsn(struct
 		sctp_reset_in_stream(stcb, 0, (uint16_t *) NULL);
 		stcb->asoc.last_reset_action[1] = stcb->asoc.last_reset_action[0];
 		stcb->asoc.last_reset_action[0] = SCTP_STREAM_RESET_PERFORMED;
-
+		sctp_notify_stream_reset_tsn(stcb, stcb->asoc.sending_seq, (stcb->asoc.mapping_array_base_tsn + 1), 0);
 		asoc->str_reset_seq_in++;
 	} else if (asoc->str_reset_seq_in - 1 == seq) {
 		sctp_add_stream_reset_result_tsn(chk, seq, asoc->last_reset_action[0],
@@ -3831,12 +3849,10 @@ sctp_handle_str_reset_request_out(struct
 		/* move the reset action back one */
 		asoc->last_reset_action[1] = asoc->last_reset_action[0];
 		if (trunc) {
-			sctp_add_stream_reset_result(chk, seq, SCTP_STREAM_RESET_DENIED);
-			asoc->last_reset_action[0] = SCTP_STREAM_RESET_DENIED;
+			asoc->last_reset_action[0] = SCTP_STREAM_RESET_REJECT;
 		} else if (SCTP_TSN_GE(asoc->cumulative_tsn, tsn)) {
 			/* we can do it now */
 			sctp_reset_in_stream(stcb, number_entries, req->list_of_streams);
-			sctp_add_stream_reset_result(chk, seq, SCTP_STREAM_RESET_PERFORMED);
 			asoc->last_reset_action[0] = SCTP_STREAM_RESET_PERFORMED;
 		} else {
 			/*
@@ -3851,8 +3867,8 @@ sctp_handle_str_reset_request_out(struct
 			    siz, SCTP_M_STRESET);
 			if (liste == NULL) {
 				/* gak out of memory */
-				sctp_add_stream_reset_result(chk, seq, SCTP_STREAM_RESET_DENIED);
-				asoc->last_reset_action[0] = SCTP_STREAM_RESET_DENIED;
+				sctp_add_stream_reset_result(chk, seq, SCTP_STREAM_RESET_REJECT);
+				asoc->last_reset_action[0] = SCTP_STREAM_RESET_REJECT;
 				return;
 			}
 			liste->tsn = tsn;
@@ -3860,9 +3876,9 @@ sctp_handle_str_reset_request_out(struct
 			memcpy(&liste->req, req,
 			    (sizeof(struct sctp_stream_reset_out_request) + (number_entries * sizeof(uint16_t))));
 			TAILQ_INSERT_TAIL(&asoc->resetHead, liste, next_resp);
-			sctp_add_stream_reset_result(chk, seq, SCTP_STREAM_RESET_PERFORMED);
 			asoc->last_reset_action[0] = SCTP_STREAM_RESET_PERFORMED;
 		}
+		sctp_add_stream_reset_result(chk, seq, asoc->last_reset_action[0]);
 		asoc->str_reset_seq_in++;
 	} else if ((asoc->str_reset_seq_in - 1) == seq) {
 		/*
@@ -3889,7 +3905,7 @@ sctp_handle_str_reset_add_strm(struct sc
 	 * Peer is requesting to add more streams. If its within our
 	 * max-streams we will allow it.
 	 */
-	uint16_t num_stream, i;
+	uint32_t num_stream, i;
 	uint32_t seq;
 	struct sctp_association *asoc = &stcb->asoc;
 	struct sctp_queued_to_read *ctl, *nctl;
@@ -3900,12 +3916,12 @@ sctp_handle_str_reset_add_strm(struct sc
 	/* Now what would be the new total? */
 	if (asoc->str_reset_seq_in == seq) {
 		num_stream += stcb->asoc.streamincnt;
-		if (num_stream > stcb->asoc.max_inbound_streams) {
+		if ((num_stream > stcb->asoc.max_inbound_streams) ||
+		    (num_stream > 0xffff)) {
 			/* We must reject it they ask for to many */
 	denied:
-			sctp_add_stream_reset_result(chk, seq, SCTP_STREAM_RESET_DENIED);
 			stcb->asoc.last_reset_action[1] = stcb->asoc.last_reset_action[0];
-			stcb->asoc.last_reset_action[0] = SCTP_STREAM_RESET_DENIED;
+			stcb->asoc.last_reset_action[0] = SCTP_STREAM_RESET_REJECT;
 		} else {
 			/* Ok, we can do that :-) */
 			struct sctp_stream_in *oldstrm;
@@ -3941,13 +3957,12 @@ sctp_handle_str_reset_add_strm(struct sc
 			SCTP_FREE(oldstrm, SCTP_M_STRMI);
 			/* update the size */
 			stcb->asoc.streamincnt = num_stream;
-			/* Send the ack */
-			sctp_add_stream_reset_result(chk, seq, SCTP_STREAM_RESET_PERFORMED);
 			stcb->asoc.last_reset_action[1] = stcb->asoc.last_reset_action[0];
 			stcb->asoc.last_reset_action[0] = SCTP_STREAM_RESET_PERFORMED;
-			sctp_ulp_notify(SCTP_NOTIFY_STR_RESET_INSTREAM_ADD_OK, stcb,
-			    (uint32_t) stcb->asoc.streamincnt, NULL, SCTP_SO_NOT_LOCKED);
+			sctp_notify_stream_reset_add(stcb, stcb->asoc.streamincnt, stcb->asoc.streamoutcnt, 0);
 		}
+		sctp_add_stream_reset_result(chk, seq, asoc->last_reset_action[0]);
+		asoc->str_reset_seq_in++;
 	} else if ((asoc->str_reset_seq_in - 1) == seq) {
 		/*
 		 * one seq back, just echo back last action since my
@@ -3966,6 +3981,63 @@ sctp_handle_str_reset_add_strm(struct sc
 	}
 }
 
+static void
+sctp_handle_str_reset_add_out_strm(struct sctp_tcb *stcb, struct sctp_tmit_chunk *chk,
+    struct sctp_stream_reset_add_strm *str_add)
+{
+	/*
+	 * Peer is requesting to add more streams. If its within our
+	 * max-streams we will allow it.
+	 */
+	uint16_t num_stream;
+	uint32_t seq;
+	struct sctp_association *asoc = &stcb->asoc;
+
+	/* Get the number. */
+	seq = ntohl(str_add->request_seq);
+	num_stream = ntohs(str_add->number_of_streams);
+	/* Now what would be the new total? */
+	if (asoc->str_reset_seq_in == seq) {
+		if (stcb->asoc.stream_reset_outstanding) {
+			/* We must reject it we have something pending */
+			stcb->asoc.last_reset_action[1] = stcb->asoc.last_reset_action[0];
+			stcb->asoc.last_reset_action[0] = SCTP_STREAM_RESET_REJECT;
+		} else {
+			/* Ok, we can do that :-) */
+			int mychk;
+
+			mychk = stcb->asoc.streamoutcnt;
+			mychk += num_stream;
+			if (mychk < 0x10000) {
+				stcb->asoc.last_reset_action[1] = stcb->asoc.last_reset_action[0];
+				stcb->asoc.last_reset_action[0] = SCTP_STREAM_RESET_PERFORMED;
+				if (sctp_send_str_reset_req(stcb, 0, NULL, 0, 0, 0, 1, num_stream, 0, 1)) {
+					stcb->asoc.last_reset_action[0] = SCTP_STREAM_RESET_REJECT;
+				}
+			} else {
+				stcb->asoc.last_reset_action[1] = stcb->asoc.last_reset_action[0];
+				stcb->asoc.last_reset_action[0] = SCTP_STREAM_RESET_REJECT;
+			}
+		}
+		sctp_add_stream_reset_result(chk, seq, stcb->asoc.last_reset_action[0]);
+		asoc->str_reset_seq_in++;
+	} else if ((asoc->str_reset_seq_in - 1) == seq) {
+		/*
+		 * one seq back, just echo back last action since my
+		 * response was lost.
+		 */
+		sctp_add_stream_reset_result(chk, seq, asoc->last_reset_action[0]);
+	} else if ((asoc->str_reset_seq_in - 2) == seq) {
+		/*
+		 * two seq back, just echo back last action since my
+		 * response was lost.
+		 */
+		sctp_add_stream_reset_result(chk, seq, asoc->last_reset_action[1]);
+	} else {
+		sctp_add_stream_reset_result(chk, seq, SCTP_STREAM_RESET_BAD_SEQNO);
+	}
+}
+
 #ifdef __GNUC__
 __attribute__((noinline))
 #endif
@@ -3977,7 +4049,7 @@ __attribute__((noinline))
 	struct sctp_paramhdr pstore;
 	uint8_t cstore[SCTP_CHUNK_BUFFER_SIZE];
 
-	uint32_t seq;
+	uint32_t seq = 0;
 	int num_req = 0;
 	int trunc = 0;
 	struct sctp_tmit_chunk *chk;
@@ -4041,7 +4113,6 @@ strres_nochunk:
 		} else {
 			trunc = 0;
 		}
-
 		if (num_param > SCTP_MAX_RESET_PARAMS) {
 			/* hit the max of parameters already sorry.. */
 			break;
@@ -4059,26 +4130,29 @@ strres_nochunk:
 				}
 			}
 			sctp_handle_str_reset_request_out(stcb, chk, req_out, trunc);
-		} else if (ptype == SCTP_STR_RESET_ADD_STREAMS) {
+		} else if (ptype == SCTP_STR_RESET_ADD_OUT_STREAMS) {
 			struct sctp_stream_reset_add_strm *str_add;
 
 			str_add = (struct sctp_stream_reset_add_strm *)ph;
 			num_req++;
 			sctp_handle_str_reset_add_strm(stcb, chk, str_add);
+		} else if (ptype == SCTP_STR_RESET_ADD_IN_STREAMS) {
+			struct sctp_stream_reset_add_strm *str_add;
+
+			str_add = (struct sctp_stream_reset_add_strm *)ph;
+			num_req++;
+			sctp_handle_str_reset_add_out_strm(stcb, chk, str_add);
 		} else if (ptype == SCTP_STR_RESET_IN_REQUEST) {
 			struct sctp_stream_reset_in_request *req_in;
 
 			num_req++;
-
 			req_in = (struct sctp_stream_reset_in_request *)ph;
-
 			sctp_handle_str_reset_request_in(stcb, chk, req_in, trunc);
 		} else if (ptype == SCTP_STR_RESET_TSN_REQUEST) {
 			struct sctp_stream_reset_tsn_request *req_tsn;
 
 			num_req++;
 			req_tsn = (struct sctp_stream_reset_tsn_request *)ph;
-
 			if (sctp_handle_str_reset_request_tsn(stcb, chk, req_tsn)) {
 				ret_code = 1;
 				goto strres_nochunk;

Modified: head/sys/netinet/sctp_output.c
==============================================================================
--- head/sys/netinet/sctp_output.c	Thu Mar 29 13:01:29 2012	(r233659)
+++ head/sys/netinet/sctp_output.c	Thu Mar 29 13:36:53 2012	(r233660)
@@ -11716,7 +11716,7 @@ sctp_add_stream_reset_result_tsn(struct 
 }
 
 static void
-sctp_add_a_stream(struct sctp_tmit_chunk *chk,
+sctp_add_an_out_stream(struct sctp_tmit_chunk *chk,
     uint32_t seq,
     uint16_t adding)
 {
@@ -11733,7 +11733,7 @@ sctp_add_a_stream(struct sctp_tmit_chunk
 	len = sizeof(struct sctp_stream_reset_add_strm);
 
 	/* Fill it out. */
-	addstr->ph.param_type = htons(SCTP_STR_RESET_ADD_STREAMS);
+	addstr->ph.param_type = htons(SCTP_STR_RESET_ADD_OUT_STREAMS);
 	addstr->ph.param_length = htons(len);
 	addstr->request_seq = htonl(seq);
 	addstr->number_of_streams = htons(adding);
@@ -11748,15 +11748,49 @@ sctp_add_a_stream(struct sctp_tmit_chunk
 	return;
 }
 
+static void
+sctp_add_an_in_stream(struct sctp_tmit_chunk *chk,
+    uint32_t seq,
+    uint16_t adding)
+{
+	int len, old_len;
+	struct sctp_chunkhdr *ch;
+	struct sctp_stream_reset_add_strm *addstr;
+
+	ch = mtod(chk->data, struct sctp_chunkhdr *);
+	old_len = len = SCTP_SIZE32(ntohs(ch->chunk_length));
+
+	/* get to new offset for the param. */
+	addstr = (struct sctp_stream_reset_add_strm *)((caddr_t)ch + len);
+	/* now how long will this param be? */
+	len = sizeof(struct sctp_stream_reset_add_strm);
+	/* Fill it out. */
+	addstr->ph.param_type = htons(SCTP_STR_RESET_ADD_IN_STREAMS);
+	addstr->ph.param_length = htons(len);
+	addstr->request_seq = htonl(seq);
+	addstr->number_of_streams = htons(adding);
+	addstr->reserved = 0;
+
+	/* now fix the chunk length */
+	ch->chunk_length = htons(len + old_len);
+	chk->send_size = len + old_len;
+	chk->book_size = SCTP_SIZE32(chk->send_size);
+	chk->book_size_scale = 0;
+	SCTP_BUF_LEN(chk->data) = SCTP_SIZE32(chk->send_size);
+	return;
+}
+
+
+
 int
 sctp_send_str_reset_req(struct sctp_tcb *stcb,
     int number_entries, uint16_t * list,
     uint8_t send_out_req,
-    uint32_t resp_seq,
     uint8_t send_in_req,
     uint8_t send_tsn_req,
     uint8_t add_stream,
-    uint16_t adding
+    uint16_t adding_o,
+    uint16_t adding_i, uint8_t peer_asked
 )
 {
 
@@ -11823,18 +11857,86 @@ sctp_send_str_reset_req(struct sctp_tcb 
 	seq = stcb->asoc.str_reset_seq_out;
 	if (send_out_req) {
 		sctp_add_stream_reset_out(chk, number_entries, list,
-		    seq, resp_seq, (stcb->asoc.sending_seq - 1));
+		    seq, (stcb->asoc.str_reset_seq_in - 1), (stcb->asoc.sending_seq - 1));
 		asoc->stream_reset_out_is_outstanding = 1;
 		seq++;
 		asoc->stream_reset_outstanding++;
 	}
-	if (add_stream) {
-		sctp_add_a_stream(chk, seq, adding);
+	if ((add_stream & 1) &&
+	    ((stcb->asoc.strm_realoutsize - stcb->asoc.streamoutcnt) < adding_o)) {
+		/* Need to allocate more */
+		struct sctp_stream_out *oldstream;
+		struct sctp_stream_queue_pending *sp, *nsp;
+		int i;
+
+		oldstream = stcb->asoc.strmout;
+		/* get some more */
+		SCTP_MALLOC(stcb->asoc.strmout, struct sctp_stream_out *,
+		    ((stcb->asoc.streamoutcnt + adding_o) * sizeof(struct sctp_stream_out)),
+		    SCTP_M_STRMO);
+		if (stcb->asoc.strmout == NULL) {
+			uint8_t x;
+
+			stcb->asoc.strmout = oldstream;
+			/* Turn off the bit */
+			x = add_stream & 0xfe;
+			add_stream = x;
+			goto skip_stuff;
+		}
+		/*
+		 * Ok now we proceed with copying the old out stuff and
+		 * initializing the new stuff.
+		 */
+		SCTP_TCB_SEND_LOCK(stcb);
+		stcb->asoc.ss_functions.sctp_ss_clear(stcb, &stcb->asoc, 0, 1);
+		for (i = 0; i < stcb->asoc.streamoutcnt; i++) {
+			TAILQ_INIT(&stcb->asoc.strmout[i].outqueue);
+			stcb->asoc.strmout[i].next_sequence_sent = oldstream[i].next_sequence_sent;
+			stcb->asoc.strmout[i].last_msg_incomplete = oldstream[i].last_msg_incomplete;
+			stcb->asoc.strmout[i].stream_no = i;
+			stcb->asoc.ss_functions.sctp_ss_init_stream(&stcb->asoc.strmout[i], &oldstream[i]);
+			/* now anything on those queues? */
+			TAILQ_FOREACH_SAFE(sp, &oldstream[i].outqueue, next, nsp) {
+				TAILQ_REMOVE(&oldstream[i].outqueue, sp, next);
+				TAILQ_INSERT_TAIL(&stcb->asoc.strmout[i].outqueue, sp, next);
+			}
+			/* Now move assoc pointers too */
+			if (stcb->asoc.last_out_stream == &oldstream[i]) {
+				stcb->asoc.last_out_stream = &stcb->asoc.strmout[i];
+			}
+			if (stcb->asoc.locked_on_sending == &oldstream[i]) {
+				stcb->asoc.locked_on_sending = &stcb->asoc.strmout[i];
+			}
+		}
+		/* now the new streams */
+		stcb->asoc.ss_functions.sctp_ss_init(stcb, &stcb->asoc, 1);
+		for (i = stcb->asoc.streamoutcnt; i < (stcb->asoc.streamoutcnt + adding_o); i++) {
+			stcb->asoc.strmout[i].next_sequence_sent = 0x0;
+			TAILQ_INIT(&stcb->asoc.strmout[i].outqueue);
+			stcb->asoc.strmout[i].stream_no = i;
+			stcb->asoc.strmout[i].last_msg_incomplete = 0;
+			stcb->asoc.ss_functions.sctp_ss_init_stream(&stcb->asoc.strmout[i], NULL);
+		}
+		stcb->asoc.strm_realoutsize = stcb->asoc.streamoutcnt + adding_o;
+		SCTP_FREE(oldstream, SCTP_M_STRMO);
+		SCTP_TCB_SEND_UNLOCK(stcb);
+	}
+skip_stuff:
+	if ((add_stream & 1) && (adding_o > 0)) {
+		asoc->strm_pending_add_size = adding_o;
+		asoc->peer_req_out = peer_asked;
+		sctp_add_an_out_stream(chk, seq, adding_o);
+		seq++;
+		asoc->stream_reset_outstanding++;
+	}
+	if ((add_stream & 2) && (adding_i > 0)) {
+		sctp_add_an_in_stream(chk, seq, adding_i);
 		seq++;
 		asoc->stream_reset_outstanding++;
 	}
 	if (send_in_req) {
 		sctp_add_stream_reset_in(chk, number_entries, list, seq);
+		seq++;
 		asoc->stream_reset_outstanding++;
 	}
 	if (send_tsn_req) {
@@ -11842,7 +11944,6 @@ sctp_send_str_reset_req(struct sctp_tcb 
 		asoc->stream_reset_outstanding++;
 	}
 	asoc->str_reset = chk;
-
 	/* insert the chunk for sending */
 	TAILQ_INSERT_TAIL(&asoc->control_send_queue,
 	    chk,

Modified: head/sys/netinet/sctp_output.h
==============================================================================
--- head/sys/netinet/sctp_output.h	Thu Mar 29 13:01:29 2012	(r233659)
+++ head/sys/netinet/sctp_output.h	Thu Mar 29 13:36:53 2012	(r233660)
@@ -194,15 +194,13 @@ sctp_add_stream_reset_result_tsn(struct 
 
 int
 sctp_send_str_reset_req(struct sctp_tcb *stcb,
-    int number_entries,
-    uint16_t * list,
+    int number_entries, uint16_t * list,
     uint8_t send_out_req,
-    uint32_t resp_seq,
     uint8_t send_in_req,
     uint8_t send_tsn_req,
-    uint8_t add_str,
-    uint16_t adding);
-
+    uint8_t add_stream,
+    uint16_t adding_o,
+    uint16_t adding_i, uint8_t from_peer);
 
 void
 sctp_send_abort(struct mbuf *, int, struct sctphdr *, uint32_t,

Modified: head/sys/netinet/sctp_pcb.h
==============================================================================
--- head/sys/netinet/sctp_pcb.h	Thu Mar 29 13:01:29 2012	(r233659)
+++ head/sys/netinet/sctp_pcb.h	Thu Mar 29 13:36:53 2012	(r233660)
@@ -399,6 +399,7 @@ struct sctp_inpcb {
 	uint32_t sctp_frag_point;
 	uint32_t partial_delivery_point;
 	uint32_t sctp_context;
+	uint8_t local_strreset_support;
 	uint32_t sctp_cmt_on_off;
 	uint32_t sctp_ecn_enable;
 	struct sctp_nonpad_sndrcvinfo def_send;

Modified: head/sys/netinet/sctp_peeloff.c
==============================================================================
--- head/sys/netinet/sctp_peeloff.c	Thu Mar 29 13:01:29 2012	(r233659)
+++ head/sys/netinet/sctp_peeloff.c	Thu Mar 29 13:36:53 2012	(r233660)
@@ -127,6 +127,7 @@ sctp_do_peeloff(struct socket *head, str
 	n_inp->sctp_ecn_enable = inp->sctp_ecn_enable;
 	n_inp->partial_delivery_point = inp->partial_delivery_point;
 	n_inp->sctp_context = inp->sctp_context;
+	n_inp->local_strreset_support = inp->local_strreset_support;
 	n_inp->inp_starting_point_for_iterator = NULL;
 	/* copy in the authentication parameters from the original endpoint */
 	if (n_inp->sctp_ep.local_hmacs)
@@ -202,6 +203,7 @@ sctp_get_peeloff(struct socket *head, sc
 	n_inp->sctp_ecn_enable = inp->sctp_ecn_enable;
 	n_inp->partial_delivery_point = inp->partial_delivery_point;
 	n_inp->sctp_context = inp->sctp_context;
+	n_inp->local_strreset_support = inp->local_strreset_support;
 	n_inp->inp_starting_point_for_iterator = NULL;
 
 	/* copy in the authentication parameters from the original endpoint */

Modified: head/sys/netinet/sctp_structs.h
==============================================================================
--- head/sys/netinet/sctp_structs.h	Thu Mar 29 13:01:29 2012	(r233659)
+++ head/sys/netinet/sctp_structs.h	Thu Mar 29 13:36:53 2012	(r233660)
@@ -1095,6 +1095,7 @@ struct sctp_association {
 	uint16_t streamincnt;
 	uint16_t streamoutcnt;
 	uint16_t strm_realoutsize;
+	uint16_t strm_pending_add_size;
 	/* my maximum number of retrans of INIT and SEND */
 	/* copied from SCTP but should be individually setable */
 	uint16_t max_init_times;
@@ -1156,6 +1157,9 @@ struct sctp_association {
 	/* Flag to tell if ECN is allowed */
 	uint8_t ecn_allowed;
 
+	/* Did the peer make the stream config (add out) request */
+	uint8_t peer_req_out;
+
 	/* flag to indicate if peer can do asconf */
 	uint8_t peer_supports_asconf;
 	/* EY - flag to indicate if peer can do nr_sack */
@@ -1166,6 +1170,7 @@ struct sctp_association {
 	uint8_t peer_supports_auth;
 	/* stream resets are supported by the peer */
 	uint8_t peer_supports_strreset;
+	uint8_t local_strreset_support;
 
 	uint8_t peer_supports_nat;
 	/*

Modified: head/sys/netinet/sctp_uio.h
==============================================================================
--- head/sys/netinet/sctp_uio.h	Thu Mar 29 13:01:29 2012	(r233659)
+++ head/sys/netinet/sctp_uio.h	Thu Mar 29 13:36:53 2012	(r233660)
@@ -438,23 +438,51 @@ struct sctp_sender_dry_event {
 
 
 /*
- * stream reset event
+ * Stream reset event - subscribe to SCTP_STREAM_RESET_EVENT
  */
 struct sctp_stream_reset_event {
 	uint16_t strreset_type;
 	uint16_t strreset_flags;
 	uint32_t strreset_length;
 	sctp_assoc_t strreset_assoc_id;
-	uint16_t strreset_list[];
+	uint16_t strreset_stream_list[];
 };
 
-/* flags in strreset_flags field */
-#define SCTP_STRRESET_INBOUND_STR  0x0001
-#define SCTP_STRRESET_OUTBOUND_STR 0x0002
-#define SCTP_STRRESET_ALL_STREAMS  0x0004
-#define SCTP_STRRESET_STREAM_LIST  0x0008
-#define SCTP_STRRESET_FAILED       0x0010
-#define SCTP_STRRESET_ADD_STREAM   0x0020
+/* flags in stream_reset_event (strreset_flags) */
+#define SCTP_STREAM_RESET_DENIED        0x0004	/* SCTP_STRRESET_FAILED */
+#define SCTP_STREAM_RESET_FAILED        0x0008	/* SCTP_STRRESET_FAILED */
+#define SCTP_STREAM_CHANGED_DENIED	0x0010
+
+/*
+ * Assoc reset event - subscribe to SCTP_ASSOC_RESET_EVENT
+ */
+struct sctp_assoc_reset_event {
+	uint16_t assocreset_type;
+	uint16_t assocreset_flags;
+	uint32_t assocreset_length;
+	sctp_assoc_t assocreset_assoc_id;
+	uint32_t assocreset_local_tsn;
+	uint32_t assocreset_remote_tsn;
+};
+
+#define SCTP_ASSOC_RESET_DENIED		0x0004
+#define SCTP_ASSOC_RESET_FAILED		0x0008
+
+/*
+ * Stream change event - subscribe to SCTP_STREAM_CHANGE_EVENT
+ */
+struct sctp_stream_change_event {
+	uint16_t strchange_type;
+	uint16_t strchange_flags;
+	uint32_t strchange_length;
+	sctp_assoc_t strchange_assoc_id;
+	uint16_t strchange_instrms;
+	uint16_t strchange_outstrms;
+};
+
+#define SCTP_STREAM_CHANGE_DENIED	0x0004
+#define SCTP_STREAM_CHANGE_FAILED	0x0008
+
 
 /* SCTP notification event */
 struct sctp_tlv {
@@ -477,6 +505,9 @@ union sctp_notification {
 	struct sctp_authkey_event sn_auth_event;
 	struct sctp_sender_dry_event sn_sender_dry_event;
 	struct sctp_stream_reset_event sn_strreset_event;
+	struct sctp_assoc_reset_event sn_assocreset_event;
+	struct sctp_stream_change_event sn_strchange_event;
+
 };
 
 /* notification types */
@@ -493,6 +524,9 @@ union sctp_notification {
 #define SCTP_STREAM_RESET_EVENT			0x0009
 #define SCTP_SENDER_DRY_EVENT			0x000a
 #define SCTP_NOTIFICATIONS_STOPPED_EVENT	0x000b	/* we don't send this */
+#define SCTP_ASSOC_RESET_EVENT			0x000c
+#define SCTP_STREAM_CHANGE_EVENT		0x000d
+
 /*
  * socket option structs
  */
@@ -707,19 +741,18 @@ struct sctp_blk_args {
  */
 #define SCTP_MAX_EXPLICT_STR_RESET   1000
 
-#define SCTP_RESET_LOCAL_RECV  0x0001
-#define SCTP_RESET_LOCAL_SEND  0x0002
-#define SCTP_RESET_BOTH        0x0003
-#define SCTP_RESET_TSN         0x0004
-#define SCTP_RESET_ADD_STREAMS 0x0005
-
-struct sctp_stream_reset {
-	sctp_assoc_t strrst_assoc_id;
-	uint16_t strrst_flags;
-	uint16_t strrst_num_streams;	/* 0 == ALL */
-	uint16_t strrst_list[];	/* list if strrst_num_streams is not 0 */
+struct sctp_reset_streams {
+	sctp_assoc_t srs_assoc_id;
+	uint16_t srs_flags;
+	uint16_t srs_number_streams;	/* 0 == ALL */
+	uint16_t srs_stream_list[];	/* list if strrst_num_streams is not 0 */
 };
 
+struct sctp_add_streams {
+	sctp_assoc_t sas_assoc_id;
+	uint16_t sas_instrms;
+	uint16_t sas_outstrms;
+};
 
 struct sctp_get_nonce_values {
 	sctp_assoc_t gn_assoc_id;

Modified: head/sys/netinet/sctp_usrreq.c
==============================================================================
--- head/sys/netinet/sctp_usrreq.c	Thu Mar 29 13:01:29 2012	(r233659)
+++ head/sys/netinet/sctp_usrreq.c	Thu Mar 29 13:36:53 2012	(r233660)
@@ -4088,17 +4088,52 @@ sctp_setopt(struct socket *so, int optna
 			}
 			break;
 		}
+	case SCTP_ENABLE_STREAM_RESET:
+		{
+			struct sctp_assoc_value *av;
+			uint8_t set_value = 0;
 
+			SCTP_CHECK_AND_CAST(av, optval, struct sctp_assoc_value, optsize);
+			if (av->assoc_value & (~SCTP_ENABLE_VALUE_MASK)) {
+				SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
+				error = EINVAL;
+				break;
+			}
+			set_value = av->assoc_value & SCTP_ENABLE_VALUE_MASK;
+			SCTP_FIND_STCB(inp, stcb, av->assoc_id);
+			if (stcb) {
+				stcb->asoc.local_strreset_support = set_value;
+				SCTP_TCB_UNLOCK(stcb);
+			} else {
+				if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
+				    (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
+				    (av->assoc_id == SCTP_FUTURE_ASSOC) ||
+				    (av->assoc_id == SCTP_ALL_ASSOC)) {
+					SCTP_INP_WLOCK(inp);
+					inp->local_strreset_support = set_value;
+					SCTP_INP_WUNLOCK(inp);
+				}
+				if ((av->assoc_id == SCTP_CURRENT_ASSOC) ||
+				    (av->assoc_id == SCTP_ALL_ASSOC)) {
+					SCTP_INP_RLOCK(inp);
+					LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
+						SCTP_TCB_LOCK(stcb);
+						stcb->asoc.local_strreset_support = set_value;
+						SCTP_TCB_UNLOCK(stcb);
+					}
+					SCTP_INP_RUNLOCK(inp);
+				}
+			}
+			break;
+		}
 	case SCTP_RESET_STREAMS:
 		{
-			struct sctp_stream_reset *strrst;
-			uint8_t send_in = 0, send_tsn = 0, send_out = 0,
-			        addstream = 0;
-			uint16_t addstrmcnt = 0;
-			int i;
+			struct sctp_reset_streams *strrst;
+			int i, send_out = 0;
+			int send_in = 0;
 
-			SCTP_CHECK_AND_CAST(strrst, optval, struct sctp_stream_reset, optsize);
-			SCTP_FIND_STCB(inp, stcb, strrst->strrst_assoc_id);
+			SCTP_CHECK_AND_CAST(strrst, optval, struct sctp_reset_streams, optsize);
+			SCTP_FIND_STCB(inp, stcb, strrst->srs_assoc_id);
 
 			if (stcb == NULL) {
 				SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, ENOENT);
@@ -4107,13 +4142,19 @@ sctp_setopt(struct socket *so, int optna
 			}
 			if (stcb->asoc.peer_supports_strreset == 0) {
 				/*
-				 * Peer does not support it, we return
-				 * protocol not supported since this is true
-				 * for this feature and this peer, not the
-				 * socket request in general.
+				 * Peer does not support the chunk type.
 				 */
-				SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EPROTONOSUPPORT);
-				error = EPROTONOSUPPORT;
+				SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EOPNOTSUPP);
+				error = EOPNOTSUPP;
+				SCTP_TCB_UNLOCK(stcb);
+				break;
+			}
+			if (!(stcb->asoc.local_strreset_support & SCTP_ENABLE_RESET_STREAM_REQ)) {
+				/*
+				 * User did not enable the operation.
+				 */
+				SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EPERM);
+				error = EPERM;
 				SCTP_TCB_UNLOCK(stcb);
 				break;
 			}
@@ -4123,129 +4164,137 @@ sctp_setopt(struct socket *so, int optna
 				SCTP_TCB_UNLOCK(stcb);
 				break;
 			}
-			if (strrst->strrst_flags == SCTP_RESET_LOCAL_RECV) {
-				send_in = 1;
-			} else if (strrst->strrst_flags == SCTP_RESET_LOCAL_SEND) {
-				send_out = 1;
-			} else if (strrst->strrst_flags == SCTP_RESET_BOTH) {
+			if (strrst->srs_flags & SCTP_STREAM_RESET_INCOMING) {
 				send_in = 1;
+			}
+			if (strrst->srs_flags & SCTP_STREAM_RESET_OUTGOING) {
 				send_out = 1;
-			} else if (strrst->strrst_flags == SCTP_RESET_TSN) {
-				send_tsn = 1;
-			} else if (strrst->strrst_flags == SCTP_RESET_ADD_STREAMS) {
-				if (send_tsn ||
-				    send_in ||
-				    send_out) {
-					/* We can't do that and add streams */
+			}
+			if ((send_in == 0) && (send_out == 0)) {
+				SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
+				error = EINVAL;
+				SCTP_TCB_UNLOCK(stcb);
+				break;
+			}
+			for (i = 0; i < strrst->srs_number_streams; i++) {
+				if ((send_in) &&
+				    (strrst->srs_stream_list[i] > stcb->asoc.streamincnt)) {
+					SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
 					error = EINVAL;
-					goto skip_stuff;
+					break;
 				}
-				if (stcb->asoc.stream_reset_outstanding) {
-					error = EBUSY;
-					goto skip_stuff;
+				if ((send_out) &&
+				    (strrst->srs_stream_list[i] > stcb->asoc.streamoutcnt)) {
+					SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
+					error = EINVAL;
+					break;
 				}
+			}
+			if (error) {
+				SCTP_TCB_UNLOCK(stcb);
+				break;
+			}
+			error = sctp_send_str_reset_req(stcb, strrst->srs_number_streams,
+			    strrst->srs_stream_list,
+			    send_out, send_in, 0, 0, 0, 0, 0);
+
+			sctp_chunk_output(inp, stcb, SCTP_OUTPUT_FROM_STRRST_REQ, SCTP_SO_LOCKED);
+			SCTP_TCB_UNLOCK(stcb);
+			break;
+		}
+	case SCTP_ADD_STREAMS:
+		{
+			struct sctp_add_streams *stradd;
+			uint8_t addstream = 0;
+			uint16_t add_o_strmcnt = 0;
+			uint16_t add_i_strmcnt = 0;
+
+			SCTP_CHECK_AND_CAST(stradd, optval, struct sctp_add_streams, optsize);
+			SCTP_FIND_STCB(inp, stcb, stradd->sas_assoc_id);
+			if (stcb == NULL) {
+				SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, ENOENT);
+				error = ENOENT;
+				break;
+			}
+			if ((stradd->sas_outstrms == 0) &&
+			    (stradd->sas_instrms == 0)) {
+				error = EINVAL;
+				goto skip_stuff;
+			}
+			if (stradd->sas_outstrms) {
 				addstream = 1;
 				/* We allocate here */
-				addstrmcnt = strrst->strrst_num_streams;
-				if ((int)(addstrmcnt + stcb->asoc.streamoutcnt) > 0xffff) {
+				add_o_strmcnt = stradd->sas_outstrms;
+				if ((((int)add_o_strmcnt) + ((int)stcb->asoc.streamoutcnt)) > 0x0000ffff) {
 					/* You can't have more than 64k */
 					error = EINVAL;
 					goto skip_stuff;
 				}
-				if ((stcb->asoc.strm_realoutsize - stcb->asoc.streamoutcnt) < addstrmcnt) {
-					/* Need to allocate more */
-					struct sctp_stream_out *oldstream;
-					struct sctp_stream_queue_pending *sp,
-					                         *nsp;
-
-					oldstream = stcb->asoc.strmout;
-					/* get some more */
-					SCTP_MALLOC(stcb->asoc.strmout, struct sctp_stream_out *,
-					    ((stcb->asoc.streamoutcnt + addstrmcnt) * sizeof(struct sctp_stream_out)),
-					    SCTP_M_STRMO);
-					if (stcb->asoc.strmout == NULL) {
-						stcb->asoc.strmout = oldstream;
-						error = ENOMEM;
-						goto skip_stuff;
-					}
-					/*
-					 * Ok now we proceed with copying
-					 * the old out stuff and
-					 * initializing the new stuff.
-					 */
-					SCTP_TCB_SEND_LOCK(stcb);
-					stcb->asoc.ss_functions.sctp_ss_clear(stcb, &stcb->asoc, 0, 1);
-					for (i = 0; i < stcb->asoc.streamoutcnt; i++) {
-						TAILQ_INIT(&stcb->asoc.strmout[i].outqueue);
-						stcb->asoc.strmout[i].next_sequence_sent = oldstream[i].next_sequence_sent;
-						stcb->asoc.strmout[i].last_msg_incomplete = oldstream[i].last_msg_incomplete;
-						stcb->asoc.strmout[i].stream_no = i;
-						stcb->asoc.ss_functions.sctp_ss_init_stream(&stcb->asoc.strmout[i], &oldstream[i]);
-						/*
-						 * now anything on those
-						 * queues?
-						 */
-						TAILQ_FOREACH_SAFE(sp, &oldstream[i].outqueue, next, nsp) {
-							TAILQ_REMOVE(&oldstream[i].outqueue, sp, next);
-							TAILQ_INSERT_TAIL(&stcb->asoc.strmout[i].outqueue, sp, next);
-						}
-						/*
-						 * Now move assoc pointers
-						 * too
-						 */
-						if (stcb->asoc.last_out_stream == &oldstream[i]) {
-							stcb->asoc.last_out_stream = &stcb->asoc.strmout[i];
-						}
-						if (stcb->asoc.locked_on_sending == &oldstream[i]) {
-							stcb->asoc.locked_on_sending = &stcb->asoc.strmout[i];
-						}
-					}
-					/* now the new streams */
-					stcb->asoc.ss_functions.sctp_ss_init(stcb, &stcb->asoc, 1);
-					for (i = stcb->asoc.streamoutcnt; i < (stcb->asoc.streamoutcnt + addstrmcnt); i++) {
-						stcb->asoc.strmout[i].next_sequence_sent = 0x0;
-						TAILQ_INIT(&stcb->asoc.strmout[i].outqueue);
-						stcb->asoc.strmout[i].stream_no = i;
-						stcb->asoc.strmout[i].last_msg_incomplete = 0;
-						stcb->asoc.ss_functions.sctp_ss_init_stream(&stcb->asoc.strmout[i], NULL);
-					}
-					stcb->asoc.strm_realoutsize = stcb->asoc.streamoutcnt + addstrmcnt;
-					SCTP_FREE(oldstream, SCTP_M_STRMO);
-				}
-				SCTP_TCB_SEND_UNLOCK(stcb);
-				goto skip_stuff;
-			} else {
-				SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
-				error = EINVAL;
-				SCTP_TCB_UNLOCK(stcb);
-				break;
 			}
-			for (i = 0; i < strrst->strrst_num_streams; i++) {
-				if ((send_in) &&
+			if (stradd->sas_instrms) {
+				int cnt;
 
-				    (strrst->strrst_list[i] > stcb->asoc.streamincnt)) {
-					SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
+				addstream |= 2;
+				/*
+				 * We allocate inside
+				 * sctp_send_str_reset_req()
+				 */
+				add_i_strmcnt = stradd->sas_instrms;
+				cnt = add_i_strmcnt;
+				cnt += stcb->asoc.streamincnt;
+				if (cnt > 0x0000ffff) {
+					/* You can't have more than 64k */
 					error = EINVAL;
-					goto get_out;
+					goto skip_stuff;
 				}
-				if ((send_out) &&
-				    (strrst->strrst_list[i] > stcb->asoc.streamoutcnt)) {
-					SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
+				if (cnt > (int)stcb->asoc.max_inbound_streams) {
+					/* More than you are allowed */
 					error = EINVAL;
-					goto get_out;
+					goto skip_stuff;
 				}
 			}
+			error = sctp_send_str_reset_req(stcb, 0, NULL, 0, 0, 0, addstream, add_o_strmcnt, add_i_strmcnt, 0);
+			sctp_chunk_output(inp, stcb, SCTP_OUTPUT_FROM_STRRST_REQ, SCTP_SO_LOCKED);
 	skip_stuff:
-			if (error) {
-		get_out:
+			SCTP_TCB_UNLOCK(stcb);
+			break;
+		}
+	case SCTP_RESET_ASSOC:
+		{
+			uint32_t *value;
+
+			SCTP_CHECK_AND_CAST(value, optval, uint32_t, optsize);
+			SCTP_FIND_STCB(inp, stcb, (sctp_assoc_t) * value);
+			if (stcb == NULL) {
+				SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, ENOENT);
+				error = ENOENT;
+				break;
+			}
+			if (stcb->asoc.peer_supports_strreset == 0) {
+				/*
+				 * Peer does not support the chunk type.
+				 */
+				SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EOPNOTSUPP);
+				error = EOPNOTSUPP;
 				SCTP_TCB_UNLOCK(stcb);
 				break;

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***

From owner-svn-src-head@FreeBSD.ORG  Thu Mar 29 13:43:06 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id A0FD7106566B;
	Thu, 29 Mar 2012 13:43:06 +0000 (UTC)
	(envelope-from ivoras@gmail.com)
Received: from mail-gy0-f182.google.com (mail-gy0-f182.google.com
	[209.85.160.182])
	by mx1.freebsd.org (Postfix) with ESMTP id 0E2628FC18;
	Thu, 29 Mar 2012 13:43:05 +0000 (UTC)
Received: by ghrr20 with SMTP id r20so1765216ghr.13
	for ; Thu, 29 Mar 2012 06:43:05 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
	h=mime-version:sender:in-reply-to:references:from:date
	:x-google-sender-auth:message-id:subject:to:cc:content-type;
	bh=SwMQv/3tp10KVMCQPqOCPWWpJDcjos7/1hZb/Yf6wRQ=;
	b=BrJRUHe9mgObJC4K8rjO/ujh94ujH3/MljtcFaU4vUXVocATtyMmh+aGzM5j7kcVeY
	zaJQtd8B9Ev1ckSpOhuOjl7XusdBumz5BD6h/xmsAytQ8K8GyZlUrEnb4iySlWkgZzQ8
	rNgS2phJq38dPx9LVVdO3BeLQMr/9Ndf23C05QuSwLZDTcyTA+IHxqBicmEitScrzbvA
	lM3dQizZ8PQlCpBHJOhRu4z7bPnVo6U8aqf82cLnERX9oAmP8QgRqCXaNwobBlxKJ8MP
	OZp2SFwJVFlCdn2Vx4Droy8/N3xtNVD3re59CS4S2tfwMg3f+BHBwU6svOni1aJe1zpd
	fzqQ==
Received: by 10.236.200.197 with SMTP id z45mr34013466yhn.99.1333028585582;
	Thu, 29 Mar 2012 06:43:05 -0700 (PDT)
MIME-Version: 1.0
Sender: ivoras@gmail.com
Received: by 10.101.101.10 with HTTP; Thu, 29 Mar 2012 06:42:25 -0700 (PDT)
In-Reply-To: <4F744865.2000200@freebsd.org>
References: <201203220848.q2M8mia8015593@svn.freebsd.org>
	<20120325105958.GB61230@zxy.spb.ru>
	
	<4F744865.2000200@freebsd.org>
From: Ivan Voras 
Date: Thu, 29 Mar 2012 15:42:25 +0200
X-Google-Sender-Auth: hVpLLB9kb8k5dqojUMBJtC2Atg4
Message-ID: 
To: Julien Laffaye 
Content-Type: text/plain; charset=UTF-8
Cc: Stanislav Sedov , svn-src-head@freebsd.org,
	svn-src-all@freebsd.org, src-committers@freebsd.org,
	Slawa Olhovchenkov 
Subject: Re: svn commit: r233294 - in head: . contrib/com_err crypto/heimdal
 crypto/heimdal/admin crypto/heimdal/appl crypto/heimdal/appl/afsutil
 crypto/heimdal/appl/ftp crypto/heimdal/appl/ftp/common crypto/he...
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Mar 2012 13:43:06 -0000

On 29 March 2012 13:32, Julien Laffaye  wrote:

> Just a reminder: pkgng does not install libsqlite3.so, the libpkg.so is
> statically linked against libsqlite3.a

Well, now it doesn't need to be.

(sqlite doesn't introduce new ground-breaking features more often than
FreeBSD does releases, and its API and ABI are very stable)

From owner-svn-src-head@FreeBSD.ORG  Thu Mar 29 13:46:16 2012
Return-Path: 
Delivered-To: svn-src-head@FreeBSD.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 6A0B7106566C;
	Thu, 29 Mar 2012 13:46:16 +0000 (UTC)
	(envelope-from bapt@FreeBSD.org)
Received: from freefall.freebsd.org (freefall.freebsd.org
	[IPv6:2001:4f8:fff6::28])
	by mx1.freebsd.org (Postfix) with ESMTP id 44DA28FC0C;
	Thu, 29 Mar 2012 13:46:16 +0000 (UTC)
Received: from freefall.freebsd.org (localhost [127.0.0.1])
	by freefall.freebsd.org (8.14.5/8.14.5) with ESMTP id q2TDkGRh005062;
	Thu, 29 Mar 2012 13:46:16 GMT (envelope-from bapt@FreeBSD.org)
Received: (from bapt@localhost)
	by freefall.freebsd.org (8.14.5/8.14.5/Submit) id q2TDkFE0005061;
	Thu, 29 Mar 2012 13:46:15 GMT (envelope-from bapt@FreeBSD.org)
X-Authentication-Warning: freefall.freebsd.org: bapt set sender to
	bapt@FreeBSD.org using -f
Date: Thu, 29 Mar 2012 15:46:11 +0200
From: Baptiste Daroussin 
To: Ivan Voras 
Message-ID: <20120329134611.GA46922@azathoth.lan>
References: <201203220848.q2M8mia8015593@svn.freebsd.org>
	<20120325105958.GB61230@zxy.spb.ru>
	
	<4F744865.2000200@freebsd.org>
	
MIME-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha1;
	protocol="application/pgp-signature"; boundary="oyUTqETQ0mS9luUI"
Content-Disposition: inline
In-Reply-To: 
User-Agent: Mutt/1.5.21 (2010-09-15)
Cc: src-committers@FreeBSD.org, Julien Laffaye ,
	svn-src-all@FreeBSD.org, Stanislav Sedov ,
	Slawa Olhovchenkov , svn-src-head@FreeBSD.org
Subject: Re: svn commit: r233294 - in head: . contrib/com_err crypto/heimdal
 crypto/heimdal/admin crypto/heimdal/appl crypto/heimdal/appl/afsutil
 crypto/heimdal/appl/ftp crypto/heimdal/appl/ftp/common crypto/he...
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Mar 2012 13:46:16 -0000


--oyUTqETQ0mS9luUI
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Thu, Mar 29, 2012 at 03:42:25PM +0200, Ivan Voras wrote:
> On 29 March 2012 13:32, Julien Laffaye  wrote:
>=20
> > Just a reminder: pkgng does not install libsqlite3.so, the libpkg.so is
> > statically linked against libsqlite3.a
>=20
> Well, now it doesn't need to be.
>=20
> (sqlite doesn't introduce new ground-breaking features more often than
> FreeBSD does releases, and its API and ABI are very stable)

=46rom my point of view it will depends on the options activated to build
libsqlite3.so because most of the feature are compiled time enabled and
disabled, other than that I down't see why we can't use sqlite from base.

regards,
Bapt

--oyUTqETQ0mS9luUI
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.18 (FreeBSD)

iEYEARECAAYFAk90Z6MACgkQ8kTtMUmk6Ey0AwCgh9OVBRO+Vd0Ydcx/l4dnBgPs
FDkAoK5HyE1r37oe+WoktMO6w7EyJNri
=y7Tx
-----END PGP SIGNATURE-----

--oyUTqETQ0mS9luUI--

From owner-svn-src-head@FreeBSD.ORG  Thu Mar 29 14:35:04 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id F03F71065674;
	Thu, 29 Mar 2012 14:35:03 +0000 (UTC) (envelope-from jh@FreeBSD.org)
Received: from gw03.mail.saunalahti.fi (gw03.mail.saunalahti.fi
	[195.197.172.111])
	by mx1.freebsd.org (Postfix) with ESMTP id 9C7948FC14;
	Thu, 29 Mar 2012 14:35:03 +0000 (UTC)
Received: from jh (a91-153-115-208.elisa-laajakaista.fi [91.153.115.208])
	by gw03.mail.saunalahti.fi (Postfix) with SMTP id 72B9A216671;
	Thu, 29 Mar 2012 17:25:40 +0300 (EEST)
Date: Thu, 29 Mar 2012 17:25:40 +0300
From: Jaakko Heinonen 
To: Dimitry Andric 
Message-ID: <20120329142539.GA51516@jh>
References: <201203241007.q2OA7MtS024789@svn.freebsd.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <201203241007.q2OA7MtS024789@svn.freebsd.org>
User-Agent: Mutt/1.5.21 (2010-09-15)
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r233419 - head/sys/x86/include
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Mar 2012 14:35:04 -0000


Hi,

On 2012-03-24, Dimitry Andric wrote:
>   Fix the following clang warning in sys/dev/dcons/dcons.c, caused by the
>   recent changes in sys/x86/include/endian.h:
>   
>     sys/dev/dcons/dcons.c:190:15: error: implicit conversion from '__uint32_t' (aka 'unsigned int') to '__uint16_t' (aka 'unsigned short') changes value from 1684238190 to 28526 [-Werror,-Wconstant-conversion]
>   	  buf->magic = ntohl(DCONS_MAGIC);
>   		       ^~~~~~~~~~~~~~~~~~
>     sys/sys/param.h:306:18: note: expanded from:
>     #define ntohl(x)        __ntohl(x)
>   			  ^
>     ./x86/endian.h:128:20: note: expanded from:
>     #define __ntohl(x)      __bswap32(x)
>   			  ^
>     ./x86/endian.h:78:20: note: expanded from:
>   	      __bswap32_gen((__uint32_t)(x)) : __bswap32_var(x))
>   			    ^
>     ./x86/endian.h:68:26: note: expanded from:
>   	  (((__uint32_t)__bswap16(x) << 16) | __bswap16((x) >> 16))
>   				  ^
>     ./x86/endian.h:75:53: note: expanded from:
>   	      __bswap16_gen((__uint16_t)(x)) : __bswap16_var(x)))
>   					       ~~~~~~~~~~~~~ ^
>   
>   This is because the __bswapXX_gen() macros (for x86) call the regular
>   __bswapXX() macros.  Since the __bswapXX_gen() variants are only called
>   when their arguments are constant, there is no need to do that constancy
>   check recursively.  Also, it causes the above error with clang.
>   
>   Fix it by calling __bswap16_gen() from __bswap32_gen(), and similarly,
>   __bswap32_gen() from  __bswap64_gen().
>   
>   While here, add extra parentheses around the __bswap16_gen() macro
>   expansion, to prevent unexpected side effects.
> 
> Modified:
>   head/sys/x86/include/endian.h

This commit seems to have broken kernel dumping for me. I always get:

# savecore
savecore: error reading first dump header at offset 4143647740 in /dev/ada0s1b: Invalid argument

The offset varies.

FreeBSD x 10.0-CURRENT FreeBSD 10.0-CURRENT #826 r233419M: Thu Mar 29 15:46:12 EEST 2012 x@x:X  i386

Dumping works with r233418.

-- 
Jaakko

From owner-svn-src-head@FreeBSD.ORG  Thu Mar 29 14:53:15 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 68DEF106564A;
	Thu, 29 Mar 2012 14:53:15 +0000 (UTC)
	(envelope-from hselasky@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 537F88FC1A;
	Thu, 29 Mar 2012 14:53:15 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2TErFn2097842;
	Thu, 29 Mar 2012 14:53:15 GMT
	(envelope-from hselasky@svn.freebsd.org)
Received: (from hselasky@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2TErFYE097838;
	Thu, 29 Mar 2012 14:53:15 GMT
	(envelope-from hselasky@svn.freebsd.org)
Message-Id: <201203291453.q2TErFYE097838@svn.freebsd.org>
From: Hans Petter Selasky 
Date: Thu, 29 Mar 2012 14:53:15 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233661 - in head/sys: dev/syscons sys
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Mar 2012 14:53:15 -0000

Author: hselasky
Date: Thu Mar 29 14:53:14 2012
New Revision: 233661
URL: http://svn.freebsd.org/changeset/base/233661

Log:
  Fix for NULL-pointer panic during boot, if keys are pressed too early.
  
  MFC after:	1 week

Modified:
  head/sys/dev/syscons/syscons.c
  head/sys/sys/tty.h

Modified: head/sys/dev/syscons/syscons.c
==============================================================================
--- head/sys/dev/syscons/syscons.c	Thu Mar 29 13:36:53 2012	(r233660)
+++ head/sys/dev/syscons/syscons.c	Thu Mar 29 14:53:14 2012	(r233661)
@@ -740,7 +740,7 @@ sckbdevent(keyboard_t *thiskbd, int even
     while ((c = scgetc(sc, SCGETC_NONBLOCK)) != NOKEY) {
 
 	cur_tty = SC_DEV(sc, sc->cur_scp->index);
-	if (!tty_opened(cur_tty))
+	if (!tty_opened_ns(cur_tty))
 	    continue;
 
 	if ((*sc->cur_scp->tsw->te_input)(sc->cur_scp, c, cur_tty))
@@ -1134,7 +1134,7 @@ sctty_ioctl(struct tty *tp, u_long cmd, 
     case VT_OPENQRY:    	/* return free virtual console */
 	for (i = sc->first_vty; i < sc->first_vty + sc->vtys; i++) {
 	    tp = SC_DEV(sc, i);
-	    if (!tty_opened(tp)) {
+	    if (!tty_opened_ns(tp)) {
 		*(int *)data = i + 1;
 		return 0;
 	    }
@@ -1694,6 +1694,7 @@ sc_cnputc(struct consdev *cd, int c)
 	 * spinlock.
 	 */
 	tp = SC_DEV(scp->sc, scp->index);
+	/* XXX "tp" can be NULL */
 	tty_lock(tp);
 	if (tty_opened(tp))
 	    sctty_outwakeup(tp);
@@ -2414,7 +2415,7 @@ sc_switch_scr(sc_softc_t *sc, u_int next
      */
     tp = SC_DEV(sc, cur_scp->index);
     if ((cur_scp->index != next_scr)
-	&& tty_opened(tp)
+	&& tty_opened_ns(tp)
 	&& (cur_scp->smode.mode == VT_AUTO)
 	&& ISGRAPHSC(cur_scp)) {
 	splx(s);
@@ -2431,7 +2432,7 @@ sc_switch_scr(sc_softc_t *sc, u_int next
      */
     if ((sc_console == NULL) || (next_scr != sc_console->index)) {
 	tp = SC_DEV(sc, next_scr);
-	if (!tty_opened(tp)) {
+	if (!tty_opened_ns(tp)) {
 	    splx(s);
 	    sc_bell(cur_scp, bios_value.bell_pitch, BELL_DURATION);
 	    DPRINTF(5, ("error 2, requested vty isn't open!\n"));
@@ -3470,7 +3471,7 @@ next_code:
 			    sc_draw_cursor_image(scp);
 			}
 			tp = SC_DEV(sc, scp->index);
-			if (!kdb_active && tty_opened(tp))
+			if (!kdb_active && tty_opened_ns(tp))
 			    sctty_outwakeup(tp);
 #endif
 		    }
@@ -3565,7 +3566,7 @@ next_code:
 			sc->first_vty + i != this_scr; 
 			i = (i + 1)%sc->vtys) {
 		    struct tty *tp = SC_DEV(sc, sc->first_vty + i);
-		    if (tty_opened(tp)) {
+		    if (tty_opened_ns(tp)) {
 			sc_switch_scr(scp->sc, sc->first_vty + i);
 			break;
 		    }
@@ -3578,7 +3579,7 @@ next_code:
 			sc->first_vty + i != this_scr;
 			i = (i + sc->vtys - 1)%sc->vtys) {
 		    struct tty *tp = SC_DEV(sc, sc->first_vty + i);
-		    if (tty_opened(tp)) {
+		    if (tty_opened_ns(tp)) {
 			sc_switch_scr(scp->sc, sc->first_vty + i);
 			break;
 		    }
@@ -3774,7 +3775,7 @@ sc_paste(scr_stat *scp, const u_char *p,
     u_char *rmap;
 
     tp = SC_DEV(scp->sc, scp->sc->cur_scp->index);
-    if (!tty_opened(tp))
+    if (!tty_opened_ns(tp))
 	return;
     rmap = scp->sc->scr_rmap;
     for (; count > 0; --count)
@@ -3788,7 +3789,7 @@ sc_respond(scr_stat *scp, const u_char *
     struct tty *tp;
 
     tp = SC_DEV(scp->sc, scp->sc->cur_scp->index);
-    if (!tty_opened(tp))
+    if (!tty_opened_ns(tp))
 	return;
     ttydisc_rint_simple(tp, p, count);
     if (wakeup) {
@@ -3830,7 +3831,7 @@ blink_screen(void *arg)
 	scp->sc->blink_in_progress = 0;
     	mark_all(scp);
 	tp = SC_DEV(scp->sc, scp->index);
-	if (tty_opened(tp))
+	if (tty_opened_ns(tp))
 	    sctty_outwakeup(tp);
 	if (scp->sc->delayed_next_scr)
 	    sc_switch_scr(scp->sc, scp->sc->delayed_next_scr - 1);

Modified: head/sys/sys/tty.h
==============================================================================
--- head/sys/sys/tty.h	Thu Mar 29 13:36:53 2012	(r233660)
+++ head/sys/sys/tty.h	Thu Mar 29 14:53:14 2012	(r233661)
@@ -197,6 +197,8 @@ void	tty_hiwat_in_block(struct tty *tp);
 void	tty_hiwat_in_unblock(struct tty *tp);
 dev_t	tty_udev(struct tty *tp);
 #define	tty_opened(tp)		((tp)->t_flags & TF_OPENED)
+/* NULL-safe version of "tty_opened()" */
+#define	tty_opened_ns(tp)	((tp) != NULL && tty_opened(tp))
 #define	tty_gone(tp)		((tp)->t_flags & TF_GONE)
 #define	tty_softc(tp)		((tp)->t_devswsoftc)
 #define	tty_devname(tp)		devtoname((tp)->t_dev)

From owner-svn-src-head@FreeBSD.ORG  Thu Mar 29 14:59:55 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id B8294106566B;
	Thu, 29 Mar 2012 14:59:55 +0000 (UTC) (envelope-from ed@hoeg.nl)
Received: from mx0.hoeg.nl (mx0.hoeg.nl [IPv6:2a01:4f8:101:5343::aa])
	by mx1.freebsd.org (Postfix) with ESMTP id B90CA8FC14;
	Thu, 29 Mar 2012 14:59:54 +0000 (UTC)
Received: by mx0.hoeg.nl (Postfix, from userid 1000)
	id B16242A28CD4; Thu, 29 Mar 2012 16:59:45 +0200 (CEST)
Date: Thu, 29 Mar 2012 16:59:45 +0200
From: Ed Schouten 
To: Hans Petter Selasky 
Message-ID: <20120329145945.GC36321@hoeg.nl>
References: <201203291453.q2TErFYE097838@svn.freebsd.org>
MIME-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha1;
	protocol="application/pgp-signature"; boundary="i7F3eY7HS/tUJxUd"
Content-Disposition: inline
In-Reply-To: <201203291453.q2TErFYE097838@svn.freebsd.org>
User-Agent: Mutt/1.5.21 (2010-09-15)
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r233661 - in head/sys: dev/syscons sys
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Mar 2012 14:59:55 -0000


--i7F3eY7HS/tUJxUd
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

* Hans Petter Selasky , 20120329 16:53:
> Modified: head/sys/sys/tty.h
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D
> --- head/sys/sys/tty.h	Thu Mar 29 13:36:53 2012	(r233660)
> +++ head/sys/sys/tty.h	Thu Mar 29 14:53:14 2012	(r233661)
> @@ -197,6 +197,8 @@ void	tty_hiwat_in_block(struct tty *tp);
>  void	tty_hiwat_in_unblock(struct tty *tp);
>  dev_t	tty_udev(struct tty *tp);
>  #define	tty_opened(tp)		((tp)->t_flags & TF_OPENED)
> +/* NULL-safe version of "tty_opened()" */
> +#define	tty_opened_ns(tp)	((tp) !=3D NULL && tty_opened(tp))
>  #define	tty_gone(tp)		((tp)->t_flags & TF_GONE)
>  #define	tty_softc(tp)		((tp)->t_devswsoftc)
>  #define	tty_devname(tp)		devtoname((tp)->t_dev)

Huh? Hm? Hm! :-(

Please don't make this part of the TTY API. Just add a wrapper to
syscons.c.

--=20
 Ed Schouten 
 WWW: http://80386.nl/

--i7F3eY7HS/tUJxUd
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (FreeBSD)

iQIcBAEBAgAGBQJPdHjhAAoJEG5e2P40kaK7YBMP/1LlWaa9/oKMOU9mf3KS6oRd
fJ6VjXDLr/cydzpMOt91jQldqUxhQ/vQ/LTJTNRvN0Vglx1gk+gkNsOqiIWKdVn3
Oqbp22Ptpd0xjkoT2/xXxs+WXWUcHzMDKKhLkk4x/FIW13e0L8UsIULxnvjPHSES
ywyvm0XZcuNoi8zK1Qylc2KNPvFboEDCUj8yLb9oCEDHWS0/5wEwB3mWZQaXUavI
rTKIT/quRE6yHIiSFY4qUURRE2i5anj0P3Iy3pOIZwJXVnd5Xz/wBCb29+xlxR6Z
p4on9YVprItjMP/AgakFfkGxjgJbf0ol+y9Nbp6HzCMNoocaaWeI16JfABHU+hgd
HzOOZxms3KjUrZH5C0BbvAebHJfTDL5al6glSATNz1PlpvKBRzl6JnsPUb1al6a2
wppvK8KMIaQiZS+xh4OkNMVP68363JVp+Lkaakpl5QQTB7d85Y2hQZDb4SQM0QPD
0MVzc3ycU9pR06cdJitSInDxH3rVzXaDYbmII2xUY5eE3W0jkQ1d3RhEfbSOYWZj
tqGmemFdEISIKl+RjlsQYjNOlXwJQhBFs92gZixlq3paC9qyehdLJGi5bX9NH4dO
9GKifpUPYYbswbYtgEhr90D5CQ+vlWbX/GawkzM9125cjR3Njk2zUZbnCbTNF7BJ
wq59XB9lCx1P0JUwmFg0
=Mrtq
-----END PGP SIGNATURE-----

--i7F3eY7HS/tUJxUd--

From owner-svn-src-head@FreeBSD.ORG  Thu Mar 29 15:31:10 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 51FEB106564A;
	Thu, 29 Mar 2012 15:31:10 +0000 (UTC)
	(envelope-from hselasky@freebsd.org)
Received: from swip.net (mailfe02.c2i.net [212.247.154.34])
	by mx1.freebsd.org (Postfix) with ESMTP id 686998FC24;
	Thu, 29 Mar 2012 15:31:09 +0000 (UTC)
X-T2-Spam-Status: No, hits=0.5 required=5.0 tests=ALL_TRUSTED,
	BAYES_50,SPF_SOFTFAIL
Received: from [176.74.212.201] (account mc467741@c2i.net HELO
	laptop002.hselasky.homeunix.org)
	by mailfe02.swip.net (CommuniGate Pro SMTP 5.4.4)
	with ESMTPA id 258336303; Thu, 29 Mar 2012 17:25:59 +0200
Received-SPF: softfail receiver=mailfe02.swip.net; client-ip=176.74.212.201;
	envelope-from=hselasky@freebsd.org
From: Hans Petter Selasky 
To: Ed Schouten 
Date: Thu, 29 Mar 2012 17:24:37 +0200
User-Agent: KMail/1.13.5 (FreeBSD/8.3-PRERELEASE; KDE/4.4.5; amd64; ; )
References: <201203291453.q2TErFYE097838@svn.freebsd.org>
	<20120329145945.GC36321@hoeg.nl>
In-Reply-To: <20120329145945.GC36321@hoeg.nl>
X-Face: 'mmZ:T{)),Oru^0c+/}w'`gU1$ubmG?lp!=R4Wy\ELYo2)@'UZ24N@d2+AyewRX}mAm; Yp
	|U[@, _z/([?1bCfM{_"B<.J>mICJCHAzzGHI{y7{%JVz%R~yJHIji`y>Y}k1C4TfysrsUI
	-%GU9V5]iUZF&nRn9mJ'?&>O
MIME-Version: 1.0
Content-Type: Text/Plain;
  charset="iso-8859-15"
Content-Transfer-Encoding: 7bit
Message-Id: <201203291724.37401.hselasky@freebsd.org>
Cc: "svn-src-head@freebsd.org" ,
	"svn-src-all@freebsd.org" ,
	"src-committers@freebsd.org" 
Subject: Re: svn commit: r233661 - in head/sys: dev/syscons sys
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Mar 2012 15:31:10 -0000

On Thursday 29 March 2012 16:59:45 Ed Schouten wrote:
> * Hans Petter Selasky , 20120329 16:53:
> > Modified: head/sys/sys/tty.h
> > =========================================================================
> > ===== --- head/sys/sys/tty.h	Thu Mar 29 13:36:53 2012	(r233660)
> > +++ head/sys/sys/tty.h	Thu Mar 29 14:53:14 2012	(r233661)
> > @@ -197,6 +197,8 @@ void	tty_hiwat_in_block(struct tty *tp);
> > 
> >  void	tty_hiwat_in_unblock(struct tty *tp);
> >  dev_t	tty_udev(struct tty *tp);
> >  #define	tty_opened(tp)		((tp)->t_flags & TF_OPENED)
> > 
> > +/* NULL-safe version of "tty_opened()" */
> > +#define	tty_opened_ns(tp)	((tp) != NULL && tty_opened(tp))
> > 
> >  #define	tty_gone(tp)		((tp)->t_flags & TF_GONE)
> >  #define	tty_softc(tp)		((tp)->t_devswsoftc)
> >  #define	tty_devname(tp)		devtoname((tp)->t_dev)
> 
> Huh? Hm? Hm! :-(
> 
> Please don't make this part of the TTY API. Just add a wrapper to
> syscons.c.

Ok, I'll move the define to syscons.c if no other clients have use for this.

--HPS

From owner-svn-src-head@FreeBSD.ORG  Thu Mar 29 15:33:45 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 1E6F31065670;
	Thu, 29 Mar 2012 15:33:45 +0000 (UTC)
	(envelope-from hselasky@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 08AC68FC1B;
	Thu, 29 Mar 2012 15:33:45 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2TFXiD3099146;
	Thu, 29 Mar 2012 15:33:44 GMT
	(envelope-from hselasky@svn.freebsd.org)
Received: (from hselasky@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2TFXisu099144;
	Thu, 29 Mar 2012 15:33:44 GMT
	(envelope-from hselasky@svn.freebsd.org)
Message-Id: <201203291533.q2TFXisu099144@svn.freebsd.org>
From: Hans Petter Selasky 
Date: Thu, 29 Mar 2012 15:33:44 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233662 - head/sys/dev/pci
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Mar 2012 15:33:45 -0000

Author: hselasky
Date: Thu Mar 29 15:33:44 2012
New Revision: 233662
URL: http://svn.freebsd.org/changeset/base/233662

Log:
  Fix for boot issue: Don't disable BARs on AGP devices. In general:
  Don't disable BARs on any PCI display devices, because doing that can
  sometimes cause the main memory bus to stop working, causing all
  memory reads to return nothing but 0xFFFFFFFF, even though the memory
  location was previously written.  After a while a privileged
  instruction fault will appear and then nothing more can be debugged.
  The reason for this behaviour is unknown.
  
  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 Mar 29 14:53:14 2012	(r233661)
+++ head/sys/dev/pci/pci.c	Thu Mar 29 15:33:44 2012	(r233662)
@@ -2590,6 +2590,27 @@ pci_write_bar(device_t dev, struct pci_m
 	struct pci_devinfo *dinfo;
 	int ln2range;
 
+	/*
+	 * Don't disable BARs on AGP devices. In general: Don't
+	 * disable BARs on any PCI display devices, because doing that
+	 * can sometimes cause the main memory bus to stop working,
+	 * causing all memory reads to return nothing but 0xFFFFFFFF,
+	 * even though the memory location was previously written.
+	 * After a while a privileged instruction fault will appear
+	 * and then nothing more can be debugged.
+	 * The reason for this behaviour is unknown.
+	 */
+	if (base == 0 && pci_get_class(dev) == PCIC_DISPLAY) {
+		device_printf(device_get_parent(dev),
+		    "pci%d:%d:%d:%d BARs on display devices "
+		    "should not be disabled.\n",
+		    pci_get_domain(dev),
+		    pci_get_bus(dev),
+		    pci_get_slot(dev),
+		    pci_get_function(dev));
+		return;
+	}
+
 	/* The device ROM BAR is always a 32-bit memory BAR. */
 	dinfo = device_get_ivars(dev);
 	if (PCIR_IS_BIOS(&dinfo->cfg, pm->pm_reg))

From owner-svn-src-head@FreeBSD.ORG  Thu Mar 29 15:43:08 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 15EBC106566C;
	Thu, 29 Mar 2012 15:43:08 +0000 (UTC)
	(envelope-from jimharris@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 001A88FC17;
	Thu, 29 Mar 2012 15:43:07 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2TFh7hv099463;
	Thu, 29 Mar 2012 15:43:07 GMT
	(envelope-from jimharris@svn.freebsd.org)
Received: (from jimharris@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2TFh7Ip099461;
	Thu, 29 Mar 2012 15:43:07 GMT
	(envelope-from jimharris@svn.freebsd.org)
Message-Id: <201203291543.q2TFh7Ip099461@svn.freebsd.org>
From: Jim Harris 
Date: Thu, 29 Mar 2012 15:43:07 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233663 - head/sys/dev/isci/scil
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Mar 2012 15:43:08 -0000

Author: jimharris
Date: Thu Mar 29 15:43:07 2012
New Revision: 233663
URL: http://svn.freebsd.org/changeset/base/233663

Log:
  Fix bug where isci(4) would report only 15 bytes of returned data on a
  READ_CAP_16 command to a SATA target.
  
  Sponsored by: Intel
  Reviewed by: sbruno
  Approved by: sbruno
  MFC after: 3 days

Modified:
  head/sys/dev/isci/scil/sati_read_capacity.c

Modified: head/sys/dev/isci/scil/sati_read_capacity.c
==============================================================================
--- head/sys/dev/isci/scil/sati_read_capacity.c	Thu Mar 29 15:33:44 2012	(r233662)
+++ head/sys/dev/isci/scil/sati_read_capacity.c	Thu Mar 29 15:43:07 2012	(r233663)
@@ -308,6 +308,10 @@ void sati_read_capacity_16_translate_dat
    sati_set_data_byte(sequence, scsi_io, 10, (U8)((sector_size >> 8)  & 0xFF));
    sati_set_data_byte(sequence, scsi_io, 11, (U8)(sector_size & 0xFF));
 
+   //Explicitly set byte 12 to 0.  SATI requires that all bytes in the data
+   //response be explicitly set to some value.
+   sati_set_data_byte(sequence, scsi_io, 12, 0);
+
    //Check Bit 13 of ATA_IDENTIFY_DEVICE_DATA physical_logical_sector_info
    //(Word 106) is enabled
    physical_per_logical_enable_bit = (identify_device_data->physical_logical_sector_info

From owner-svn-src-head@FreeBSD.ORG  Thu Mar 29 15:47:30 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id BE8E6106564A;
	Thu, 29 Mar 2012 15:47:30 +0000 (UTC)
	(envelope-from hselasky@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id AA2418FC1A;
	Thu, 29 Mar 2012 15:47:30 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2TFlUnJ099652;
	Thu, 29 Mar 2012 15:47:30 GMT
	(envelope-from hselasky@svn.freebsd.org)
Received: (from hselasky@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2TFlUab099649;
	Thu, 29 Mar 2012 15:47:30 GMT
	(envelope-from hselasky@svn.freebsd.org)
Message-Id: <201203291547.q2TFlUab099649@svn.freebsd.org>
From: Hans Petter Selasky 
Date: Thu, 29 Mar 2012 15:47:30 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233664 - in head/sys: dev/syscons sys
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Mar 2012 15:47:30 -0000

Author: hselasky
Date: Thu Mar 29 15:47:29 2012
New Revision: 233664
URL: http://svn.freebsd.org/changeset/base/233664

Log:
  Move tty_opened_ns() into syscons.c which is currently the
  only client of this macro.
  
  Suggested by:	ed @
  MFC after:	1 week

Modified:
  head/sys/dev/syscons/syscons.c
  head/sys/sys/tty.h

Modified: head/sys/dev/syscons/syscons.c
==============================================================================
--- head/sys/dev/syscons/syscons.c	Thu Mar 29 15:43:07 2012	(r233663)
+++ head/sys/dev/syscons/syscons.c	Thu Mar 29 15:47:29 2012	(r233664)
@@ -86,6 +86,9 @@ __FBSDID("$FreeBSD$");
 
 #define KEYCODE_BS		0x0e		/* "<-- Backspace" key, XXX */
 
+/* NULL-safe version of "tty_opened()" */
+#define	tty_opened_ns(tp)	((tp) != NULL && tty_opened(tp))
+
 typedef struct default_attr {
 	int		std_color;		/* normal hardware color */
 	int		rev_color;		/* reverse hardware color */

Modified: head/sys/sys/tty.h
==============================================================================
--- head/sys/sys/tty.h	Thu Mar 29 15:43:07 2012	(r233663)
+++ head/sys/sys/tty.h	Thu Mar 29 15:47:29 2012	(r233664)
@@ -197,8 +197,6 @@ void	tty_hiwat_in_block(struct tty *tp);
 void	tty_hiwat_in_unblock(struct tty *tp);
 dev_t	tty_udev(struct tty *tp);
 #define	tty_opened(tp)		((tp)->t_flags & TF_OPENED)
-/* NULL-safe version of "tty_opened()" */
-#define	tty_opened_ns(tp)	((tp) != NULL && tty_opened(tp))
 #define	tty_gone(tp)		((tp)->t_flags & TF_GONE)
 #define	tty_softc(tp)		((tp)->t_devswsoftc)
 #define	tty_devname(tp)		devtoname((tp)->t_dev)

From owner-svn-src-head@FreeBSD.ORG  Thu Mar 29 16:02:40 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id D6965106566C;
	Thu, 29 Mar 2012 16:02:40 +0000 (UTC)
	(envelope-from joel@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id BE5538FC12;
	Thu, 29 Mar 2012 16:02:40 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2TG2en2000313;
	Thu, 29 Mar 2012 16:02:40 GMT (envelope-from joel@svn.freebsd.org)
Received: (from joel@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2TG2eKi000303;
	Thu, 29 Mar 2012 16:02:40 GMT (envelope-from joel@svn.freebsd.org)
Message-Id: <201203291602.q2TG2eKi000303@svn.freebsd.org>
From: Joel Dahl 
Date: Thu, 29 Mar 2012 16:02:40 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233665 - in head: bin/ps lib/libc/posix1e lib/libc/sys
	lib/libutil usr.bin/rctl
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Mar 2012 16:02:40 -0000

Author: joel (doc committer)
Date: Thu Mar 29 16:02:40 2012
New Revision: 233665
URL: http://svn.freebsd.org/changeset/base/233665

Log:
  mandoc complains loudly when s are misused in columnated lists. Fix
  this syntax violation and while I'm here also convert  to Ta and adjust
  quotation marks in order to prevent this problem in the future.

Modified:
  head/bin/ps/ps.1
  head/lib/libc/posix1e/acl_add_flag_np.3
  head/lib/libc/posix1e/acl_add_perm.3
  head/lib/libc/posix1e/acl_set_entry_type_np.3
  head/lib/libc/posix1e/acl_set_tag_type.3
  head/lib/libc/posix1e/acl_to_text.3
  head/lib/libc/sys/ktrace.2
  head/lib/libutil/login.conf.5
  head/usr.bin/rctl/rctl.8

Modified: head/bin/ps/ps.1
==============================================================================
--- head/bin/ps/ps.1	Thu Mar 29 15:47:29 2012	(r233664)
+++ head/bin/ps/ps.1	Thu Mar 29 16:02:40 2012	(r233665)
@@ -292,37 +292,37 @@ The flags associated with the process as
 the include file
 .In sys/proc.h :
 .Bl -column P_SINGLE_BOUNDARY 0x40000000
-.It Dv "P_ADVLOCK" Ta No "0x00001	Process may hold a POSIX advisory lock"
-.It Dv "P_CONTROLT" Ta No "0x00002	Has a controlling terminal"
-.It Dv "P_KTHREAD" Ta No "0x00004	Kernel thread"
-.It Dv "P_FOLLOWFORK" Ta No "0x00008	Attach debugger to new children"
-.It Dv "P_PPWAIT" Ta No "0x00010	Parent is waiting for child to exec/exit"
-.It Dv "P_PROFIL" Ta No "0x00020	Has started profiling"
-.It Dv "P_STOPPROF" Ta No "0x00040	Has thread in requesting to stop prof"
-.It Dv "P_HADTHREADS" Ta No "0x00080	Has had threads (no cleanup shortcuts)"
-.It Dv "P_SUGID" Ta No "0x00100		Had set id privileges since last exec"
-.It Dv "P_SYSTEM" Ta No "0x00200	System proc: no sigs, stats or swapping"
-.It Dv "P_SINGLE_EXIT" Ta No "0x00400	Threads suspending should exit, not wait"
-.It Dv "P_TRACED" Ta No "0x00800	Debugged process being traced"
-.It Dv "P_WAITED" Ta No "0x01000	Someone is waiting for us"
-.It Dv "P_WEXIT" Ta No "0x02000		Working on exiting"
-.It Dv "P_EXEC" Ta No "0x04000		Process called exec"
-.It Dv "P_WKILLED" Ta No "0x08000	Killed, shall go to kernel/user boundary ASAP"
-.It Dv "P_CONTINUED" Ta No "0x10000	Proc has continued from a stopped state"
-.It Dv "P_STOPPED_SIG" Ta No "0x20000	Stopped due to SIGSTOP/SIGTSTP"
-.It Dv "P_STOPPED_TRACE" Ta No "0x40000	Stopped because of tracing"
-.It Dv "P_STOPPED_SINGLE" Ta No "0x80000	Only one thread can continue"
-.It Dv "P_PROTECTED" Ta No "0x100000	Do not kill on memory overcommit"
-.It Dv "P_SIGEVENT" Ta No "0x200000	Process pending signals changed"
-.It Dv "P_SINGLE_BOUNDARY" Ta No "0x400000	Threads should suspend at user boundary"
-.It Dv "P_HWPMC" Ta No "0x800000	Process is using HWPMCs"
-.It Dv "P_JAILED" Ta No "0x1000000	Process is in jail"
-.It Dv "P_ORPHAN" Ta No "0x2000000	Orphaned by original parent, reparented to debugger"
-.It Dv "P_INEXEC" Ta No "0x4000000	Process is in execve()"
-.It Dv "P_STATCHILD" Ta No "0x8000000	Child process stopped or exited"
-.It Dv "P_INMEM" Ta No "0x10000000	Loaded into memory"
-.It Dv "P_SWAPPINGOUT" Ta No "0x20000000	Process is being swapped out"
-.It Dv "P_SWAPPINGIN" Ta No "0x40000000	Process is being swapped in"
+.It Dv "P_ADVLOCK" Ta No "0x00001" Ta "Process may hold a POSIX advisory lock"
+.It Dv "P_CONTROLT" Ta No "0x00002" Ta "Has a controlling terminal"
+.It Dv "P_KTHREAD" Ta No "0x00004" Ta "Kernel thread"
+.It Dv "P_FOLLOWFORK" Ta No "0x00008" Ta "Attach debugger to new children"
+.It Dv "P_PPWAIT" Ta No "0x00010" Ta "Parent is waiting for child to exec/exit"
+.It Dv "P_PROFIL" Ta No "0x00020" Ta "Has started profiling"
+.It Dv "P_STOPPROF" Ta No "0x00040" Ta "Has thread in requesting to stop prof"
+.It Dv "P_HADTHREADS" Ta No "0x00080" Ta "Has had threads (no cleanup shortcuts)"
+.It Dv "P_SUGID" Ta No "0x00100" Ta "Had set id privileges since last exec"
+.It Dv "P_SYSTEM" Ta No "0x00200" Ta "System proc: no sigs, stats or swapping"
+.It Dv "P_SINGLE_EXIT" Ta No "0x00400" Ta "Threads suspending should exit, not wait"
+.It Dv "P_TRACED" Ta No "0x00800" Ta "Debugged process being traced"
+.It Dv "P_WAITED" Ta No "0x01000" Ta "Someone is waiting for us"
+.It Dv "P_WEXIT" Ta No "0x02000" Ta "Working on exiting"
+.It Dv "P_EXEC" Ta No "0x04000" Ta "Process called exec"
+.It Dv "P_WKILLED" Ta No "0x08000" Ta "Killed, shall go to kernel/user boundary ASAP"
+.It Dv "P_CONTINUED" Ta No "0x10000" Ta "Proc has continued from a stopped state"
+.It Dv "P_STOPPED_SIG" Ta No "0x20000" Ta "Stopped due to SIGSTOP/SIGTSTP"
+.It Dv "P_STOPPED_TRACE" Ta No "0x40000" Ta "Stopped because of tracing"
+.It Dv "P_STOPPED_SINGLE" Ta No "0x80000" Ta "Only one thread can continue"
+.It Dv "P_PROTECTED" Ta No "0x100000" Ta "Do not kill on memory overcommit"
+.It Dv "P_SIGEVENT" Ta No "0x200000" Ta "Process pending signals changed"
+.It Dv "P_SINGLE_BOUNDARY" Ta No "0x400000" Ta "Threads should suspend at user boundary"
+.It Dv "P_HWPMC" Ta No "0x800000" Ta "Process is using HWPMCs"
+.It Dv "P_JAILED" Ta No "0x1000000" Ta "Process is in jail"
+.It Dv "P_ORPHAN" Ta No "0x2000000" Ta "Orphaned by original parent, reparented to debugger"
+.It Dv "P_INEXEC" Ta No "0x4000000" Ta "Process is in execve()"
+.It Dv "P_STATCHILD" Ta No "0x8000000" Ta "Child process stopped or exited"
+.It Dv "P_INMEM" Ta No "0x10000000" Ta "Loaded into memory"
+.It Dv "P_SWAPPINGOUT" Ta No "0x20000000" Ta "Process is being swapped out"
+.It Dv "P_SWAPPINGIN" Ta No "0x40000000" Ta "Process is being swapped in"
 .El
 .It Cm label
 The MAC label of the process.

Modified: head/lib/libc/posix1e/acl_add_flag_np.3
==============================================================================
--- head/lib/libc/posix1e/acl_add_flag_np.3	Thu Mar 29 15:47:29 2012	(r233664)
+++ head/lib/libc/posix1e/acl_add_flag_np.3	Thu Mar 29 16:02:40 2012	(r233665)
@@ -52,10 +52,10 @@ that already exist in the flagset.
 .Pp
 Valid values are:
 .Bl -column -offset 3n "ACL_ENTRY_NO_PROPAGATE_INHERIT"
-.It ACL_ENTRY_FILE_INHERIT		Will be inherited by files.
-.It ACL_ENTRY_DIRECTORY_INHERIT	Will be inherited by directories.
-.It ACL_ENTRY_NO_PROPAGATE_INHERIT	Will not propagate.
-.It ACL_ENTRY_INHERIT_ONLY		Inherit-only.
+.It ACL_ENTRY_FILE_INHERIT Ta "Will be inherited by files."
+.It ACL_ENTRY_DIRECTORY_INHERIT Ta "Will be inherited by directories."
+.It ACL_ENTRY_NO_PROPAGATE_INHERIT Ta "Will not propagate."
+.It ACL_ENTRY_INHERIT_ONLY Ta "Inherit-only."
 .El
 .Sh RETURN VALUES
 .Rv -std acl_add_flag_np

Modified: head/lib/libc/posix1e/acl_add_perm.3
==============================================================================
--- head/lib/libc/posix1e/acl_add_perm.3	Thu Mar 29 15:47:29 2012	(r233664)
+++ head/lib/libc/posix1e/acl_add_perm.3	Thu Mar 29 16:02:40 2012	(r233665)
@@ -59,22 +59,22 @@ For POSIX.1e ACLs, valid values are:
 .Pp
 For NFSv4 ACLs, valid values are:
 .Bl -column -offset 3n "ACL_WRITE_NAMED_ATTRS"
-.It ACL_READ_DATA		Read permission
-.It ACL_LIST_DIRECTORY		Same as ACL_READ_DATA
-.It ACL_WRITE_DATA		Write permission, or permission to create files
-.It ACL_ADD_FILE		Same as ACL_READ_DATA
-.It ACL_APPEND_DATA		Permission to create directories.  Ignored for files
-.It ACL_ADD_SUBDIRECTORY	Same as ACL_APPEND_DATA
-.It ACL_READ_NAMED_ATTRS	Ignored
-.It ACL_WRITE_NAMED_ATTRS	Ignored
-.It ACL_EXECUTE			Execute permission
-.It ACL_DELETE_CHILD		Permission to delete files and subdirectories
-.It ACL_READ_ATTRIBUTES		Permission to read basic attributes
-.It ACL_WRITE_ATTRIBUTES	Permission to change basic attributes
-.It ACL_DELETE			Permission to delete the object this ACL is placed on
-.It ACL_READ_ACL		Permission to read ACL
-.It ACL_WRITE_ACL		Permission to change the ACL and file mode
-.It ACL_SYNCHRONIZE		Ignored
+.It ACL_READ_DATA Ta "Read permission"
+.It ACL_LIST_DIRECTORY Ta "Same as ACL_READ_DATA"
+.It ACL_WRITE_DATA Ta "Write permission, or permission to create files"
+.It ACL_ADD_FILE Ta "Same as ACL_READ_DATA"
+.It ACL_APPEND_DATA Ta "Permission to create directories.  Ignored for files"
+.It ACL_ADD_SUBDIRECTORY Ta "Same as ACL_APPEND_DATA"
+.It ACL_READ_NAMED_ATTRS Ta "Ignored"
+.It ACL_WRITE_NAMED_ATTRS Ta "Ignored"
+.It ACL_EXECUTE Ta "Execute permission"
+.It ACL_DELETE_CHILD Ta "Permission to delete files and subdirectories"
+.It ACL_READ_ATTRIBUTES Ta "Permission to read basic attributes"
+.It ACL_WRITE_ATTRIBUTES Ta "Permission to change basic attributes"
+.It ACL_DELETE Ta "Permission to delete the object this ACL is placed on"
+.It ACL_READ_ACL Ta "Permission to read ACL"
+.It ACL_WRITE_ACL Ta "Permission to change the ACL and file mode"
+.It ACL_SYNCHRONIZE Ta "Ignored"
 .El
 .Pp
 Calling

Modified: head/lib/libc/posix1e/acl_set_entry_type_np.3
==============================================================================
--- head/lib/libc/posix1e/acl_set_entry_type_np.3	Thu Mar 29 15:47:29 2012	(r233664)
+++ head/lib/libc/posix1e/acl_set_entry_type_np.3	Thu Mar 29 16:02:40 2012	(r233665)
@@ -49,8 +49,8 @@ to the value referred to by
 .Pp
 Valid values are:
 .Bl -column -offset 3n "ACL_ENTRY_TYPE_ALLOW"
-.It ACL_ENTRY_TYPE_ALLOW	"allow" type entry
-.It ACL_ENTRY_TYPE_DENY		"deny" type entry
+.It ACL_ENTRY_TYPE_ALLOW Ta "allow" type entry
+.It ACL_ENTRY_TYPE_DENY Ta "deny" type entry
 .El
 .Pp
 This call brands the ACL as NFSv4.

Modified: head/lib/libc/posix1e/acl_set_tag_type.3
==============================================================================
--- head/lib/libc/posix1e/acl_set_tag_type.3	Thu Mar 29 15:47:29 2012	(r233664)
+++ head/lib/libc/posix1e/acl_set_tag_type.3	Thu Mar 29 16:02:40 2012	(r233665)
@@ -49,14 +49,14 @@ to the value of
 .Pp
 Valid values are:
 .Bl -column -offset 3n "ACL_OTHER_OBJ"
-.It ACL_USER_OBJ	Permissions apply to file owner
-.It ACL_USER		Permissions apply to additional user specified by qualifier
-.It ACL_GROUP_OBJ	Permissions apply to file group
-.It ACL_GROUP		Permissions apply to additional group specified by qualifier
-.It ACL_MASK		Permissions specify mask
-.It ACL_OTHER		Permissions apply to "other"
-.It ACL_OTHER_OBJ	Same as ACL_OTHER
-.It ACL_EVERYONE	Permissions apply to "everyone@"
+.It ACL_USER_OBJ Ta "Permissions apply to file owner"
+.It ACL_USER Ta "Permissions apply to additional user specified by qualifier"
+.It ACL_GROUP_OBJ Ta "Permissions apply to file group"
+.It ACL_GROUP Ta "Permissions apply to additional group specified by qualifier"
+.It ACL_MASK Ta "Permissions specify mask"
+.It ACL_OTHER Ta Permissions apply to "other"
+.It ACL_OTHER_OBJ Ta "Same as ACL_OTHER"
+.It ACL_EVERYONE Ta Permissions apply to "everyone@"
 .El
 .Pp
 Calling

Modified: head/lib/libc/posix1e/acl_to_text.3
==============================================================================
--- head/lib/libc/posix1e/acl_to_text.3	Thu Mar 29 15:47:29 2012	(r233664)
+++ head/lib/libc/posix1e/acl_to_text.3	Thu Mar 29 16:02:40 2012	(r233665)
@@ -67,9 +67,9 @@ The flags specified are formed by
 .Em or Ns 'ing
 the following values
 .Bl -column -offset 3n "ACL_TEXT_NUMERIC_IDS"
-.It ACL_TEXT_VERBOSE		Format ACL using verbose form
-.It ACL_TEXT_NUMERIC_IDS	Do not resolve IDs into user or group names
-.It ACL_TEXT_APPEND_ID		In addition to user and group names, append numeric IDs
+.It ACL_TEXT_VERBOSE Ta "Format ACL using verbose form"
+.It ACL_TEXT_NUMERIC_IDS Ta "Do not resolve IDs into user or group names"
+.It ACL_TEXT_APPEND_ID Ta "In addition to user and group names, append numeric IDs"
 .El
 .Pp
 This function allocates any memory necessary to contain the string and

Modified: head/lib/libc/sys/ktrace.2
==============================================================================
--- head/lib/libc/sys/ktrace.2	Thu Mar 29 15:47:29 2012	(r233664)
+++ head/lib/libc/sys/ktrace.2	Thu Mar 29 16:02:40 2012	(r233665)
@@ -67,12 +67,12 @@ The
 argument specifies the requested ktrace operation.
 The defined operations are:
 .Bl -column KTRFLAG_DESCENDXXX -offset indent
-.It "KTROP_SET		Enable trace points specified in"
+.It KTROP_SET Ta "Enable trace points specified in"
 .Fa trpoints .
-.It "KTROP_CLEAR	Disable trace points specified in"
+.It KTROP_CLEAR Ta "Disable trace points specified in"
 .Fa trpoints .
-.It "KTROP_CLEARFILE	Stop all tracing."
-.It "KTRFLAG_DESCEND	The tracing change should apply to the"
+.It KTROP_CLEARFILE Ta "Stop all tracing."
+.It KTRFLAG_DESCEND Ta "The tracing change should apply to the"
 specified process and all its current children.
 .El
 .Pp
@@ -81,20 +81,20 @@ The
 argument specifies the trace points of interest.
 The defined trace points are:
 .Bl -column KTRFAC_PROCCTORXXX -offset indent
-.It "KTRFAC_SYSCALL	Trace system calls."
-.It "KTRFAC_SYSRET	Trace return values from system calls."
-.It "KTRFAC_NAMEI	Trace name lookup operations."
-.It "KTRFAC_GENIO	Trace all I/O (note that this option can"
+.It KTRFAC_SYSCALL Ta "Trace system calls."
+.It KTRFAC_SYSRET Ta "Trace return values from system calls."
+.It KTRFAC_NAMEI Ta "Trace name lookup operations."
+.It KTRFAC_GENIO Ta "Trace all I/O (note that this option can"
 generate much output).
-.It "KTRFAC_PSIG	Trace posted signals."
-.It "KTRFAC_CSW	Trace context switch points."
-.It "KTRFAC_USER	Trace application-specific events."
-.It "KTRFAC_STRUCT	Trace certain data structures."
-.It "KTRFAC_SYSCTL	Trace sysctls."
-.It "KTRFAC_PROCCTOR	Trace process construction."
-.It "KTRFAC_PROCDTOR	Trace process destruction."
-.It "KTRFAC_CAPFAIL	Trace capability failures."
-.It "KTRFAC_INHERIT	Inherit tracing to future children."
+.It KTRFAC_PSIG Ta "Trace posted signals."
+.It KTRFAC_CSW Ta "Trace context switch points."
+.It KTRFAC_USER Ta "Trace application-specific events."
+.It KTRFAC_STRUCT Ta "Trace certain data structures."
+.It KTRFAC_SYSCTL Ta "Trace sysctls."
+.It KTRFAC_PROCCTOR Ta "Trace process construction."
+.It KTRFAC_PROCDTOR Ta "Trace process destruction."
+.It KTRFAC_CAPFAIL Ta "Trace capability failures."
+.It KTRFAC_INHERIT Ta "Inherit tracing to future children."
 .El
 .Pp
 Each tracing event outputs a record composed of a generic header

Modified: head/lib/libutil/login.conf.5
==============================================================================
--- head/lib/libutil/login.conf.5	Thu Mar 29 15:47:29 2012	(r233664)
+++ head/lib/libutil/login.conf.5	Thu Mar 29 16:02:40 2012	(r233665)
@@ -224,7 +224,7 @@ directory of the user.
 See
 .Xr ftpd 8
 for details.
-.It "label	string			Default MAC policy; see"
+.It "label	string		Default MAC policy; see"
 .Xr maclabel 7 .
 .It "lang	string		Set $LANG environment variable to the specified value.
 .It "manpath	path		Default search path for manpages.

Modified: head/usr.bin/rctl/rctl.8
==============================================================================
--- head/usr.bin/rctl/rctl.8	Thu Mar 29 15:47:29 2012	(r233664)
+++ head/usr.bin/rctl/rctl.8	Thu Mar 29 16:02:40 2012	(r233665)
@@ -121,33 +121,33 @@ A filter that matches all defined rules 
 "::maxproc".
 .Sh RESOURCES
 .Bl -column -offset 3n "pseudoterminals"
-.It "cputime		CPU time, in seconds"
-.It "datasize		data size, in bytes"
-.It "stacksize		stack size, in bytes"
-.It "coredumpsize	core dump size, in bytes"
-.It "memoryuse		resident set size, in bytes"
-.It "memorylocked	locked memory, in bytes"
-.It "maxproc		number of processes"
-.It "openfiles		file descriptor table size"
-.It "vmemoryuse		address space limit, in bytes"
-.It "pseudoterminals	number of PTYs"
-.It "swapuse		swap usage, in bytes"
-.It "nthr		number of threads"
-.It "msgqqueued		number of queued SysV messages"
-.It "msgqsize		SysV message queue size, in bytes"
-.It "nmsgq		number of SysV message queues"
-.It "nsem		number of SysV semaphores"
-.It "nsemop		number of SysV semaphores modified in a single semop(2) call"
-.It "nshm		number of SysV shared memory segments"
-.It "shmsize		SysV shared memory size, in bytes"
-.It "wallclock		wallclock time, in seconds"
+.It cputime Ta "CPU time, in seconds"
+.It datasize Ta "data size, in bytes"
+.It stacksize Ta "stack size, in bytes"
+.It coredumpsize Ta "core dump size, in bytes"
+.It memoryuse Ta "resident set size, in bytes"
+.It memorylocked Ta "locked memory, in bytes"
+.It maxproc Ta "number of processes"
+.It openfiles Ta "file descriptor table size"
+.It vmemoryuse Ta "address space limit, in bytes"
+.It pseudoterminals Ta "number of PTYs"
+.It swapuse Ta "swap usage, in bytes"
+.It nthr Ta "number of threads"
+.It msgqqueued Ta "number of queued SysV messages"
+.It msgqsize Ta "SysV message queue size, in bytes"
+.It nmsgq Ta "number of SysV message queues"
+.It nsem Ta "number of SysV semaphores"
+.It nsemop Ta "number of SysV semaphores modified in a single semop(2) call"
+.It nshm Ta "number of SysV shared memory segments"
+.It shmsize Ta "SysV shared memory size, in bytes"
+.It wallclock Ta "wallclock time, in seconds"
 .El
 .Pp
 .Sh ACTIONS
 .Bl -column -offset 3n "pseudoterminals"
-.It "deny	deny the allocation; not supported for cpu and wallclock"
-.It "log		log a warning to the console"
-.It "devctl	send notification to"
+.It deny Ta "deny the allocation; not supported for cpu and wallclock"
+.It log Ta "log a warning to the console"
+.It devctl Ta "send notification to"
 .Xr devd 8
 .It "sig*	e.g. sigterm; send a signal to the offending process"
 .El

From owner-svn-src-head@FreeBSD.ORG  Thu Mar 29 16:04:42 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id D8974106564A;
	Thu, 29 Mar 2012 16:04:42 +0000 (UTC)
	(envelope-from nwhitehorn@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id AA5888FC19;
	Thu, 29 Mar 2012 16:04:42 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2TG4gnF000402;
	Thu, 29 Mar 2012 16:04:42 GMT
	(envelope-from nwhitehorn@svn.freebsd.org)
Received: (from nwhitehorn@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2TG4gQo000400;
	Thu, 29 Mar 2012 16:04:42 GMT
	(envelope-from nwhitehorn@svn.freebsd.org)
Message-Id: <201203291604.q2TG4gQo000400@svn.freebsd.org>
From: Nathan Whitehorn 
Date: Thu, 29 Mar 2012 16:04:42 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233666 - head/sys/boot/powerpc/ps3
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Mar 2012 16:04:42 -0000

Author: nwhitehorn
Date: Thu Mar 29 16:04:42 2012
New Revision: 233666
URL: http://svn.freebsd.org/changeset/base/233666

Log:
  Fix build after changes to trap headers.

Modified:
  head/sys/boot/powerpc/ps3/start.S

Modified: head/sys/boot/powerpc/ps3/start.S
==============================================================================
--- head/sys/boot/powerpc/ps3/start.S	Thu Mar 29 16:02:40 2012	(r233665)
+++ head/sys/boot/powerpc/ps3/start.S	Thu Mar 29 16:04:42 2012	(r233666)
@@ -25,6 +25,8 @@
  * $FreeBSD$
  */
 
+#define LOCORE
+
 #include 
 
 /*

From owner-svn-src-head@FreeBSD.ORG  Thu Mar 29 16:07:23 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 1F629106564A;
	Thu, 29 Mar 2012 16:07:23 +0000 (UTC)
	(envelope-from joel@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 0A4878FC20;
	Thu, 29 Mar 2012 16:07:23 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2TG7Mmm000522;
	Thu, 29 Mar 2012 16:07:22 GMT (envelope-from joel@svn.freebsd.org)
Received: (from joel@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2TG7Mt9000519;
	Thu, 29 Mar 2012 16:07:22 GMT (envelope-from joel@svn.freebsd.org)
Message-Id: <201203291607.q2TG7Mt9000519@svn.freebsd.org>
From: Joel Dahl 
Date: Thu, 29 Mar 2012 16:07:22 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233667 - in head: lib/libusb usr.bin/rctl
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Mar 2012 16:07:23 -0000

Author: joel (doc committer)
Date: Thu Mar 29 16:07:22 2012
New Revision: 233667
URL: http://svn.freebsd.org/changeset/base/233667

Log:
  Remove superfluous paragraph macro.

Modified:
  head/lib/libusb/libusb20.3
  head/usr.bin/rctl/rctl.8

Modified: head/lib/libusb/libusb20.3
==============================================================================
--- head/lib/libusb/libusb20.3	Thu Mar 29 16:04:42 2012	(r233666)
+++ head/lib/libusb/libusb20.3	Thu Mar 29 16:07:22 2012	(r233667)
@@ -235,7 +235,6 @@ applications should consider using
 .
 .Sh USB TRANSFER OPERATIONS
 .
-.Pp
 .
 .Fn libusb20_tr_close
 will release all kernel resources associated with an USB
@@ -534,7 +533,6 @@ with an USB transfer.
 .
 .Sh USB DEVICE OPERATIONS
 .
-.Pp
 .
 .Fn libusb20_dev_get_backend_name
 returns a zero terminated string describing the backend used.
@@ -1000,7 +998,6 @@ The buffer pointer cannot be NULL.
 .
 .
 .Sh USB DEBUGGING
-.Pp
 .Ft const char *
 .Fn libusb20_strerror "int code"
 Get the ASCII representation of the error given by the

Modified: head/usr.bin/rctl/rctl.8
==============================================================================
--- head/usr.bin/rctl/rctl.8	Thu Mar 29 16:04:42 2012	(r233666)
+++ head/usr.bin/rctl/rctl.8	Thu Mar 29 16:07:22 2012	(r233667)
@@ -142,7 +142,6 @@ A filter that matches all defined rules 
 .It shmsize Ta "SysV shared memory size, in bytes"
 .It wallclock Ta "wallclock time, in seconds"
 .El
-.Pp
 .Sh ACTIONS
 .Bl -column -offset 3n "pseudoterminals"
 .It deny Ta "deny the allocation; not supported for cpu and wallclock"
@@ -161,7 +160,6 @@ Attempt to add rule with action not supp
 in error.
 .Pp
 Note that limiting RSS may kill the machine due to thrashing.
-.Pp
 .Sh EXIT STATUS
 .Ex -std
 .Sh EXAMPLES

From owner-svn-src-head@FreeBSD.ORG  Thu Mar 29 16:20:21 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 5B06B1065700;
	Thu, 29 Mar 2012 16:20:21 +0000 (UTC)
	(envelope-from joel@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 2CB558FC16;
	Thu, 29 Mar 2012 16:20:21 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2TGKL2o000988;
	Thu, 29 Mar 2012 16:20:21 GMT (envelope-from joel@svn.freebsd.org)
Received: (from joel@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2TGKKlh000986;
	Thu, 29 Mar 2012 16:20:20 GMT (envelope-from joel@svn.freebsd.org)
Message-Id: <201203291620.q2TGKKlh000986@svn.freebsd.org>
From: Joel Dahl 
Date: Thu, 29 Mar 2012 16:20:20 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233669 - head/lib/libc/sys
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Mar 2012 16:20:21 -0000

Author: joel (doc committer)
Date: Thu Mar 29 16:20:20 2012
New Revision: 233669
URL: http://svn.freebsd.org/changeset/base/233669

Log:
  mdoc: Ud takes no argument.

Modified:
  head/lib/libc/sys/kse.2

Modified: head/lib/libc/sys/kse.2
==============================================================================
--- head/lib/libc/sys/kse.2	Thu Mar 29 16:19:34 2012	(r233668)
+++ head/lib/libc/sys/kse.2	Thu Mar 29 16:20:20 2012	(r233669)
@@ -676,4 +676,4 @@ This manual page was written by
 .An "Archie Cobbs" Aq archie@FreeBSD.org .
 .Sh BUGS
 The KSE code is
-.Ud .
+.Ud

From owner-svn-src-head@FreeBSD.ORG  Thu Mar 29 16:48:37 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 94BBF1065675;
	Thu, 29 Mar 2012 16:48:37 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 8046B8FC08;
	Thu, 29 Mar 2012 16:48:37 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2TGmbm3001906;
	Thu, 29 Mar 2012 16:48:37 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2TGmbEh001904;
	Thu, 29 Mar 2012 16:48:37 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <201203291648.q2TGmbEh001904@svn.freebsd.org>
From: John Baldwin 
Date: Thu, 29 Mar 2012 16:48:37 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233670 - head/sys/mips/include
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Mar 2012 16:48:37 -0000

Author: jhb
Date: Thu Mar 29 16:48:36 2012
New Revision: 233670
URL: http://svn.freebsd.org/changeset/base/233670

Log:
  Use VM_MEMATTR_UNCACHEABLE for the constant for UC memory rather than
  VM_MEMATTR_UNCACHED.  VM_MEMATTR_UNCACHEABLE is the constant other
  platforms use.
  
  MFC after:	2 weeks

Modified:
  head/sys/mips/include/vm.h

Modified: head/sys/mips/include/vm.h
==============================================================================
--- head/sys/mips/include/vm.h	Thu Mar 29 16:20:20 2012	(r233669)
+++ head/sys/mips/include/vm.h	Thu Mar 29 16:48:36 2012	(r233670)
@@ -32,7 +32,7 @@
 #include 
 
 /* Memory attributes. */
-#define	VM_MEMATTR_UNCACHED	((vm_memattr_t)PTE_C_UNCACHED)
+#define	VM_MEMATTR_UNCACHEABLE	((vm_memattr_t)PTE_C_UNCACHED)
 #define	VM_MEMATTR_DEFAULT	((vm_memattr_t)PTE_C_CACHE)
 
 #endif /* !_MACHINE_VM_H_ */

From owner-svn-src-head@FreeBSD.ORG  Thu Mar 29 16:51:23 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 9501E1065674;
	Thu, 29 Mar 2012 16:51:23 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 66C968FC1D;
	Thu, 29 Mar 2012 16:51:23 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2TGpN0V002023;
	Thu, 29 Mar 2012 16:51:23 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2TGpNNo002019;
	Thu, 29 Mar 2012 16:51:23 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <201203291651.q2TGpNNo002019@svn.freebsd.org>
From: John Baldwin 
Date: Thu, 29 Mar 2012 16:51:23 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233671 - in head/sys: amd64/include i386/include
	powerpc/include
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Mar 2012 16:51:23 -0000

Author: jhb
Date: Thu Mar 29 16:51:22 2012
New Revision: 233671
URL: http://svn.freebsd.org/changeset/base/233671

Log:
  - Rename VM_MEMATTR_UNCACHED to VM_MEMATTR_WEAK_UNCACHEABLE on x86 to
    be less ambiguous and more clearly identify what it means.  This
    attribute is what Intel refers to as UC-, and it's only difference
    relative to normal UC memory is that a WC MTRR will override a UC-
    PAT entry causing the memory to be treated as WC, whereas a UC PAT
    entry will always override the MTRR.
  - Remove the VM_MEMATTR_UNCACHED alias from powerpc.

Modified:
  head/sys/amd64/include/vm.h
  head/sys/i386/include/vm.h
  head/sys/powerpc/include/vm.h

Modified: head/sys/amd64/include/vm.h
==============================================================================
--- head/sys/amd64/include/vm.h	Thu Mar 29 16:48:36 2012	(r233670)
+++ head/sys/amd64/include/vm.h	Thu Mar 29 16:51:22 2012	(r233671)
@@ -38,7 +38,7 @@
 #define	VM_MEMATTR_WRITE_THROUGH	((vm_memattr_t)PAT_WRITE_THROUGH)
 #define	VM_MEMATTR_WRITE_PROTECTED	((vm_memattr_t)PAT_WRITE_PROTECTED)
 #define	VM_MEMATTR_WRITE_BACK		((vm_memattr_t)PAT_WRITE_BACK)
-#define	VM_MEMATTR_UNCACHED		((vm_memattr_t)PAT_UNCACHED)
+#define	VM_MEMATTR_WEAK_UNCACHEABLE	((vm_memattr_t)PAT_UNCACHED)
 
 #define	VM_MEMATTR_DEFAULT		VM_MEMATTR_WRITE_BACK
 

Modified: head/sys/i386/include/vm.h
==============================================================================
--- head/sys/i386/include/vm.h	Thu Mar 29 16:48:36 2012	(r233670)
+++ head/sys/i386/include/vm.h	Thu Mar 29 16:51:22 2012	(r233671)
@@ -38,7 +38,7 @@
 #define	VM_MEMATTR_WRITE_THROUGH	((vm_memattr_t)PAT_WRITE_THROUGH)
 #define	VM_MEMATTR_WRITE_PROTECTED	((vm_memattr_t)PAT_WRITE_PROTECTED)
 #define	VM_MEMATTR_WRITE_BACK		((vm_memattr_t)PAT_WRITE_BACK)
-#define	VM_MEMATTR_UNCACHED		((vm_memattr_t)PAT_UNCACHED)
+#define	VM_MEMATTR_WEAK_UNCACHEABLE	((vm_memattr_t)PAT_UNCACHED)
 
 #define	VM_MEMATTR_DEFAULT		VM_MEMATTR_WRITE_BACK
 

Modified: head/sys/powerpc/include/vm.h
==============================================================================
--- head/sys/powerpc/include/vm.h	Thu Mar 29 16:48:36 2012	(r233670)
+++ head/sys/powerpc/include/vm.h	Thu Mar 29 16:51:22 2012	(r233671)
@@ -34,7 +34,6 @@
 /* Memory attributes. */
 #define	VM_MEMATTR_DEFAULT		0
 #define	VM_MEMATTR_UNCACHEABLE		0x01
-#define	VM_MEMATTR_UNCACHED		VM_MEMATTR_UNCACHEABLE
 #define	VM_MEMATTR_CACHEABLE		0x02
 #define	VM_MEMATTR_WRITE_COMBINING	0x04
 #define	VM_MEMATTR_WRITE_BACK		0x08

From owner-svn-src-head@FreeBSD.ORG  Thu Mar 29 17:04:05 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 2DB47106564A;
	Thu, 29 Mar 2012 17:04:05 +0000 (UTC)
	(envelope-from joel@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 186608FC14;
	Thu, 29 Mar 2012 17:04:05 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2TH44lL002425;
	Thu, 29 Mar 2012 17:04:04 GMT (envelope-from joel@svn.freebsd.org)
Received: (from joel@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2TH441E002423;
	Thu, 29 Mar 2012 17:04:04 GMT (envelope-from joel@svn.freebsd.org)
Message-Id: <201203291704.q2TH441E002423@svn.freebsd.org>
From: Joel Dahl 
Date: Thu, 29 Mar 2012 17:04:04 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233672 - head/share/man/man4
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Mar 2012 17:04:05 -0000

Author: joel (doc committer)
Date: Thu Mar 29 17:04:04 2012
New Revision: 233672
URL: http://svn.freebsd.org/changeset/base/233672

Log:
  Put quotation marks around a string.

Modified:
  head/share/man/man4/ulpt.4

Modified: head/share/man/man4/ulpt.4
==============================================================================
--- head/share/man/man4/ulpt.4	Thu Mar 29 16:51:22 2012	(r233671)
+++ head/share/man/man4/ulpt.4	Thu Mar 29 17:04:04 2012	(r233672)
@@ -57,7 +57,7 @@ bi- or uni-directional protocol.
 The bits in the minor number select various features of the driver.
 .Bl -column "Minor Bit" "Functionxxxxxxxxxxxxxxxxxxxxxxxxxxxx" -offset indent
 .Em "Minor Bit	Function"
-64	Do not initialize (reset) the device on the port.
+64	"Do not initialize (reset) the device on the port."
 .El
 .Pp
 Some printers cannot handle the reset on open; in case of problems try the

From owner-svn-src-head@FreeBSD.ORG  Thu Mar 29 17:39:19 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 8C82D1065674;
	Thu, 29 Mar 2012 17:39:19 +0000 (UTC)
	(envelope-from adrian@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 772A48FC08;
	Thu, 29 Mar 2012 17:39:19 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2THdJ8N003510;
	Thu, 29 Mar 2012 17:39:19 GMT (envelope-from adrian@svn.freebsd.org)
Received: (from adrian@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2THdJqo003506;
	Thu, 29 Mar 2012 17:39:19 GMT (envelope-from adrian@svn.freebsd.org)
Message-Id: <201203291739.q2THdJqo003506@svn.freebsd.org>
From: Adrian Chadd 
Date: Thu, 29 Mar 2012 17:39:19 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233673 - head/sys/dev/ath
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Mar 2012 17:39:19 -0000

Author: adrian
Date: Thu Mar 29 17:39:18 2012
New Revision: 233673
URL: http://svn.freebsd.org/changeset/base/233673

Log:
  Defer the rescheduling of TID -> TXQ frames in some instances.
  
  Right now ath_txq_sched() is mainly called from the TX ath_tx_processq()
  routine, which is (mostly) done as part of the taskqueue.  It shouldn't
  be called outside the taskqueue.
  
  But now that I'm about to flip back on BAR TX, I'm going to start
  stressing the ath_tx_tid_pause() and ath_tx_tid_resume() paths.
  What I don't want to have happen is a reschedule of the TID traffic
  _during_ the completion of TX frames.
  
  Ideally I'd like to have a way to flag back up to the processing code
  that the current hardware queue should be rechecked for software TID
  queue frames.  But for now, this should suffice for the BAR TX case.
  
  I may eventually delete this code once I've brought some further
  sanity to the general TX queue/completion path.

Modified:
  head/sys/dev/ath/if_ath.c
  head/sys/dev/ath/if_ath_tx.c
  head/sys/dev/ath/if_athvar.h

Modified: head/sys/dev/ath/if_ath.c
==============================================================================
--- head/sys/dev/ath/if_ath.c	Thu Mar 29 17:04:04 2012	(r233672)
+++ head/sys/dev/ath/if_ath.c	Thu Mar 29 17:39:18 2012	(r233673)
@@ -191,6 +191,7 @@ static void	ath_tx_cleanup(struct ath_so
 static void	ath_tx_proc_q0(void *, int);
 static void	ath_tx_proc_q0123(void *, int);
 static void	ath_tx_proc(void *, int);
+static void	ath_txq_sched_tasklet(void *, int);
 static int	ath_chan_set(struct ath_softc *, struct ieee80211_channel *);
 static void	ath_draintxq(struct ath_softc *, ATH_RESET_TYPE reset_type);
 static void	ath_stoprecv(struct ath_softc *, int);
@@ -398,6 +399,7 @@ ath_attach(u_int16_t devid, struct ath_s
 	TASK_INIT(&sc->sc_bmisstask, 0, ath_bmiss_proc, sc);
 	TASK_INIT(&sc->sc_bstucktask,0, ath_bstuck_proc, sc);
 	TASK_INIT(&sc->sc_resettask,0, ath_reset_proc, sc);
+	TASK_INIT(&sc->sc_txqtask,0, ath_txq_sched_tasklet, sc);
 
 	/*
 	 * Allocate hardware transmit queues: one queue for
@@ -5132,6 +5134,38 @@ ath_tx_proc(void *arg, int npending)
 #undef	TXQACTIVE
 
 /*
+ * Deferred processing of TXQ rescheduling.
+ */
+static void
+ath_txq_sched_tasklet(void *arg, int npending)
+{
+	struct ath_softc *sc = arg;
+	int i;
+
+	/* XXX is skipping ok? */
+	ATH_PCU_LOCK(sc);
+#if 0
+	if (sc->sc_inreset_cnt > 0) {
+		device_printf(sc->sc_dev,
+		    "%s: sc_inreset_cnt > 0; skipping\n", __func__);
+		ATH_PCU_UNLOCK(sc);
+		return;
+	}
+#endif
+	sc->sc_txproc_cnt++;
+	ATH_PCU_UNLOCK(sc);
+
+	for (i = 0; i < HAL_NUM_TX_QUEUES; i++) {
+		if (ATH_TXQ_SETUP(sc, i))
+			ath_txq_sched(sc, &sc->sc_txq[i]);
+	}
+
+	ATH_PCU_LOCK(sc);
+	sc->sc_txproc_cnt--;
+	ATH_PCU_UNLOCK(sc);
+}
+
+/*
  * Return a buffer to the pool and update the 'busy' flag on the
  * previous 'tail' entry.
  *

Modified: head/sys/dev/ath/if_ath_tx.c
==============================================================================
--- head/sys/dev/ath/if_ath_tx.c	Thu Mar 29 17:04:04 2012	(r233672)
+++ head/sys/dev/ath/if_ath_tx.c	Thu Mar 29 17:39:18 2012	(r233673)
@@ -2623,7 +2623,8 @@ ath_tx_tid_resume(struct ath_softc *sc, 
 
 	ath_tx_tid_sched(sc, tid);
 	/* Punt some frames to the hardware if needed */
-	ath_txq_sched(sc, sc->sc_ac2q[tid->ac]);
+	//ath_txq_sched(sc, sc->sc_ac2q[tid->ac]);
+	taskqueue_enqueue(sc->sc_tq, &sc->sc_txqtask);
 }
 
 /*

Modified: head/sys/dev/ath/if_athvar.h
==============================================================================
--- head/sys/dev/ath/if_athvar.h	Thu Mar 29 17:04:04 2012	(r233672)
+++ head/sys/dev/ath/if_athvar.h	Thu Mar 29 17:39:18 2012	(r233673)
@@ -490,6 +490,7 @@ struct ath_softc {
 	struct ath_txq		sc_txq[HAL_NUM_TX_QUEUES];
 	struct ath_txq		*sc_ac2q[5];	/* WME AC -> h/w q map */ 
 	struct task		sc_txtask;	/* tx int processing */
+	struct task		sc_txqtask;	/* tx proc processing */
 	int			sc_wd_timer;	/* count down for wd timer */
 	struct callout		sc_wd_ch;	/* tx watchdog timer */
 	struct ath_tx_radiotap_header sc_tx_th;

From owner-svn-src-head@FreeBSD.ORG  Thu Mar 29 17:50:02 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 126621065674;
	Thu, 29 Mar 2012 17:50:02 +0000 (UTC) (envelope-from kib@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id E91E88FC0A;
	Thu, 29 Mar 2012 17:50:01 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2THo14T003877;
	Thu, 29 Mar 2012 17:50:01 GMT (envelope-from kib@svn.freebsd.org)
Received: (from kib@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2THo1Pu003875;
	Thu, 29 Mar 2012 17:50:01 GMT (envelope-from kib@svn.freebsd.org)
Message-Id: <201203291750.q2THo1Pu003875@svn.freebsd.org>
From: Konstantin Belousov 
Date: Thu, 29 Mar 2012 17:50:01 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233674 - head/libexec/rtld-elf
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Mar 2012 17:50:02 -0000

Author: kib
Date: Thu Mar 29 17:50:01 2012
New Revision: 233674
URL: http://svn.freebsd.org/changeset/base/233674

Log:
  Fix ia64 build after r233655.
  
  MFC after:	1 week

Modified:
  head/libexec/rtld-elf/rtld.c

Modified: head/libexec/rtld-elf/rtld.c
==============================================================================
--- head/libexec/rtld-elf/rtld.c	Thu Mar 29 17:39:18 2012	(r233673)
+++ head/libexec/rtld-elf/rtld.c	Thu Mar 29 17:50:01 2012	(r233674)
@@ -2618,7 +2618,9 @@ do_dlsym(void *handle, const char *name,
     const Elf_Sym *def;
     SymLook req;
     RtldLockState lockstate;
+#ifndef __ia64__
     tls_index ti;
+#endif
     int res;
 
     def = NULL;
@@ -2734,9 +2736,13 @@ do_dlsym(void *handle, const char *name,
 	else if (ELF_ST_TYPE(def->st_info) == STT_GNU_IFUNC)
 	    return (rtld_resolve_ifunc(defobj, def));
 	else if (ELF_ST_TYPE(def->st_info) == STT_TLS) {
+#ifdef __ia64__
+	    return (__tls_get_addr(defobj->tlsindex, def->st_value));
+#else
 	    ti.ti_module = defobj->tlsindex;
 	    ti.ti_offset = def->st_value;
 	    return (__tls_get_addr(&ti));
+#endif
 	} else
 	    return (defobj->relocbase + def->st_value);
     }

From owner-svn-src-head@FreeBSD.ORG  Thu Mar 29 18:11:39 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id E62A3106564A;
	Thu, 29 Mar 2012 18:11:39 +0000 (UTC)
	(envelope-from kostikbel@gmail.com)
Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200])
	by mx1.freebsd.org (Postfix) with ESMTP id 722AE8FC17;
	Thu, 29 Mar 2012 18:11:39 +0000 (UTC)
Received: from skuns.kiev.zoral.com.ua (localhost [127.0.0.1])
	by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id q2TIBS9B024164;
	Thu, 29 Mar 2012 21:11:28 +0300 (EEST)
	(envelope-from kostikbel@gmail.com)
Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1])
	by deviant.kiev.zoral.com.ua (8.14.5/8.14.5) with ESMTP id
	q2TIBRms007641; Thu, 29 Mar 2012 21:11:27 +0300 (EEST)
	(envelope-from kostikbel@gmail.com)
Received: (from kostik@localhost)
	by deviant.kiev.zoral.com.ua (8.14.5/8.14.5/Submit) id q2TIBRCk007640; 
	Thu, 29 Mar 2012 21:11:27 +0300 (EEST)
	(envelope-from kostikbel@gmail.com)
X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to
	kostikbel@gmail.com using -f
Date: Thu, 29 Mar 2012 21:11:25 +0300
From: Konstantin Belousov 
To: ia64@freebsd.org
Message-ID: <20120329181125.GB2358@deviant.kiev.zoral.com.ua>
References: <201203291750.q2THo1Pu003875@svn.freebsd.org>
Mime-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha1;
	protocol="application/pgp-signature"; boundary="KnD4IZsf9tI8pAcs"
Content-Disposition: inline
In-Reply-To: <201203291750.q2THo1Pu003875@svn.freebsd.org>
User-Agent: Mutt/1.4.2.3i
X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua
X-Virus-Status: Clean
X-Spam-Status: No, score=-4.0 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00
	autolearn=ham version=3.2.5
X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on
	skuns.kiev.zoral.com.ua
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r233674 - head/libexec/rtld-elf
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Mar 2012 18:11:40 -0000


--KnD4IZsf9tI8pAcs
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Thu, Mar 29, 2012 at 05:50:01PM +0000, Konstantin Belousov wrote:
> Author: kib
> Date: Thu Mar 29 17:50:01 2012
> New Revision: 233674
> URL: http://svn.freebsd.org/changeset/base/233674
>=20
> Log:
>   Fix ia64 build after r233655.
>  =20
>   MFC after:	1 week
>=20
> Modified:
>   head/libexec/rtld-elf/rtld.c
>=20
> Modified: head/libexec/rtld-elf/rtld.c
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D
> --- head/libexec/rtld-elf/rtld.c	Thu Mar 29 17:39:18 2012	(r233673)
> +++ head/libexec/rtld-elf/rtld.c	Thu Mar 29 17:50:01 2012	(r233674)
> @@ -2618,7 +2618,9 @@ do_dlsym(void *handle, const char *name,
>      const Elf_Sym *def;
>      SymLook req;
>      RtldLockState lockstate;
> +#ifndef __ia64__
>      tls_index ti;
> +#endif
>      int res;
> =20
>      def =3D NULL;
> @@ -2734,9 +2736,13 @@ do_dlsym(void *handle, const char *name,
>  	else if (ELF_ST_TYPE(def->st_info) =3D=3D STT_GNU_IFUNC)
>  	    return (rtld_resolve_ifunc(defobj, def));
>  	else if (ELF_ST_TYPE(def->st_info) =3D=3D STT_TLS) {
> +#ifdef __ia64__
> +	    return (__tls_get_addr(defobj->tlsindex, def->st_value));
> +#else
>  	    ti.ti_module =3D defobj->tlsindex;
>  	    ti.ti_offset =3D def->st_value;
>  	    return (__tls_get_addr(&ti));
> +#endif
>  	} else
>  	    return (defobj->relocbase + def->st_value);
>      }
While this band-aid fixes the build, the change is obviously bad.
The reason to have this #ifdef is that ia64 is the only architecture
that declares __tls_get_addr() as

void *__tls_get_addr(unsigned long module, unsigned long offset);

while all other architectures do

typedef struct {
    unsigned long ti_module;
    unsigned long ti_offset;
} tls_index;
void *__tls_get_addr(tls_index *ti);

But e.g. on amd64 the ABI of both declarations is the same. From my
cursory look at ia64 ABI document, the same hold for ia64.

Can anybody with ia64 clue and test machine confirm that the following
works, i.e. ABI is not broken ?

diff --git a/libexec/rtld-elf/ia64/reloc.c b/libexec/rtld-elf/ia64/reloc.c
index 01e20b8..31319f3 100644
--- a/libexec/rtld-elf/ia64/reloc.c
+++ b/libexec/rtld-elf/ia64/reloc.c
@@ -650,9 +650,9 @@ allocate_initial_tls(Obj_Entry *list)
     __asm __volatile("mov r13 =3D %0" :: "r"(tpval));
 }
=20
-void *__tls_get_addr(unsigned long module, unsigned long offset)
+void *__tls_get_addr(tls_index *ti)
 {
     register Elf_Addr** tp __asm__("r13");
=20
-    return tls_get_addr_common(tp, module, offset);
+    return tls_get_addr_common(tp, ti->ti_module, ti->ti_offset);
 }
diff --git a/libexec/rtld-elf/ia64/rtld_machdep.h b/libexec/rtld-elf/ia64/r=
tld_machdep.h
index 4a68ff7..df877f2 100644
--- a/libexec/rtld-elf/ia64/rtld_machdep.h
+++ b/libexec/rtld-elf/ia64/rtld_machdep.h
@@ -64,7 +64,12 @@ void call_init_pointer(const struct Struct_Obj_Entry *, =
Elf_Addr);
 	round(prev_offset + prev_size, align)
 #define calculate_tls_end(off, size) 	((off) + (size))
=20
-extern void *__tls_get_addr(unsigned long module, unsigned long offset);
+typedef struct {
+    unsigned long ti_module;
+    unsigned long ti_offset;
+} tls_index;
+
+extern void *__tls_get_addr(tls_index *ti);
=20
 #define	RTLD_DEFAULT_STACK_PF_EXEC	0
 #define	RTLD_DEFAULT_STACK_EXEC		0
diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c
index d3ce3c6..828b8b4 100644
--- a/libexec/rtld-elf/rtld.c
+++ b/libexec/rtld-elf/rtld.c
@@ -2618,9 +2618,7 @@ do_dlsym(void *handle, const char *name, void *retadd=
r, const Ver_Entry *ve,
     const Elf_Sym *def;
     SymLook req;
     RtldLockState lockstate;
-#ifndef __ia64__
     tls_index ti;
-#endif
     int res;
=20
     def =3D NULL;
@@ -2736,13 +2734,9 @@ do_dlsym(void *handle, const char *name, void *retad=
dr, const Ver_Entry *ve,
 	else if (ELF_ST_TYPE(def->st_info) =3D=3D STT_GNU_IFUNC)
 	    return (rtld_resolve_ifunc(defobj, def));
 	else if (ELF_ST_TYPE(def->st_info) =3D=3D STT_TLS) {
-#ifdef __ia64__
-	    return (__tls_get_addr(defobj->tlsindex, def->st_value));
-#else
 	    ti.ti_module =3D defobj->tlsindex;
 	    ti.ti_offset =3D def->st_value;
 	    return (__tls_get_addr(&ti));
-#endif
 	} else
 	    return (defobj->relocbase + def->st_value);
     }

--KnD4IZsf9tI8pAcs
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (FreeBSD)

iEYEARECAAYFAk90pc0ACgkQC3+MBN1Mb4hLOACfSfBauPd73ygp1fcTnFb34vqP
IIwAoJu0N/Q2SpTTCwQBxvuddEF6WoX4
=blHj
-----END PGP SIGNATURE-----

--KnD4IZsf9tI8pAcs--

From owner-svn-src-head@FreeBSD.ORG  Thu Mar 29 18:58:03 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 079E71065670;
	Thu, 29 Mar 2012 18:58:03 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id E69B08FC0C;
	Thu, 29 Mar 2012 18:58:02 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2TIw2NG005961;
	Thu, 29 Mar 2012 18:58:02 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2TIw2jA005959;
	Thu, 29 Mar 2012 18:58:02 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <201203291858.q2TIw2jA005959@svn.freebsd.org>
From: John Baldwin 
Date: Thu, 29 Mar 2012 18:58:02 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233675 - head/sys/x86/isa
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Mar 2012 18:58:03 -0000

Author: jhb
Date: Thu Mar 29 18:58:02 2012
New Revision: 233675
URL: http://svn.freebsd.org/changeset/base/233675

Log:
  Restore proper use of bounce buffers for ISA DMA.  When locking was
  added, the call to pmap_kextract() was moved up, and as a result the
  code never updated the physical address to use for DMA if a bounce
  buffer was used.  Restore the earlier location of pmap_kextract() so
  it takes bounce buffers into account.
  
  Tested by:	kargl
  MFC after:	1 week

Modified:
  head/sys/x86/isa/isa_dma.c

Modified: head/sys/x86/isa/isa_dma.c
==============================================================================
--- head/sys/x86/isa/isa_dma.c	Thu Mar 29 17:50:01 2012	(r233674)
+++ head/sys/x86/isa/isa_dma.c	Thu Mar 29 18:58:02 2012	(r233675)
@@ -237,8 +237,6 @@ isa_dmastart(int flags, caddr_t addr, u_
 	caddr_t newaddr;
 	int dma_range_checked;
 
-	/* translate to physical */
-	phys = pmap_extract(kernel_pmap, (vm_offset_t)addr);
 	dma_range_checked = isa_dmarangecheck(addr, nbytes, chan);
 
 #ifdef DIAGNOSTIC
@@ -281,6 +279,9 @@ isa_dmastart(int flags, caddr_t addr, u_
 		addr = newaddr;
 	}
 
+	/* translate to physical */
+	phys = pmap_extract(kernel_pmap, (vm_offset_t)addr);
+
 	if (flags & ISADMA_RAW) {
 	    dma_auto_mode |= (1 << chan);
 	} else { 

From owner-svn-src-head@FreeBSD.ORG  Thu Mar 29 19:03:23 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 21C61106564A;
	Thu, 29 Mar 2012 19:03:23 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 0A7F28FC0A;
	Thu, 29 Mar 2012 19:03:23 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2TJ3Mb1006182;
	Thu, 29 Mar 2012 19:03:22 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2TJ3MFw006173;
	Thu, 29 Mar 2012 19:03:22 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <201203291903.q2TJ3MFw006173@svn.freebsd.org>
From: John Baldwin 
Date: Thu, 29 Mar 2012 19:03:22 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233676 - in head/sys: amd64/amd64 amd64/include
	dev/acpica dev/pci i386/i386 i386/include x86/pci x86/x86
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Mar 2012 19:03:23 -0000

Author: jhb
Date: Thu Mar 29 19:03:22 2012
New Revision: 233676
URL: http://svn.freebsd.org/changeset/base/233676

Log:
  Use a more proper fix for enabling HT MSI mapping windows on Host-PCI
  bridges.  Rather than blindly enabling the windows on all of them, only
  enable the window when an MSI interrupt is enabled for a device behind
  the bridge, similar to what already happens for HT PCI-PCI bridges.
  
  To implement this, each x86 Host-PCI bridge driver has to be able to
  locate it's actual backing device on bus 0.  For ACPI, use the _ADR
  method to find the slot and function of the device.  For the non-ACPI
  case, the legacy(4) driver already scans bus 0 looking for Host-PCI
  bridge devices.  Now it saves the slot and function of each bridge that
  it finds as ivars that the Host-PCI bridge driver can then use in its
  pcib_map_msi() method.
  
  This fixes machines where non-MSI interrupts were broken by the previous
  round of HT MSI changes.
  
  Tested by:	bapt
  MFC after:	1 week

Modified:
  head/sys/amd64/amd64/legacy.c
  head/sys/amd64/include/legacyvar.h
  head/sys/dev/acpica/acpi_pcib_acpi.c
  head/sys/dev/pci/pci.c
  head/sys/i386/i386/legacy.c
  head/sys/i386/include/legacyvar.h
  head/sys/x86/pci/pci_bus.c
  head/sys/x86/x86/mptable_pci.c

Modified: head/sys/amd64/amd64/legacy.c
==============================================================================
--- head/sys/amd64/amd64/legacy.c	Thu Mar 29 18:58:02 2012	(r233675)
+++ head/sys/amd64/amd64/legacy.c	Thu Mar 29 19:03:22 2012	(r233676)
@@ -53,7 +53,9 @@ __FBSDID("$FreeBSD$");
 
 static MALLOC_DEFINE(M_LEGACYDEV, "legacydrv", "legacy system device");
 struct legacy_device {
-	int			lg_pcibus;
+	int	lg_pcibus;
+	int	lg_pcislot;
+	int	lg_pcifunc;
 };
 
 #define DEVTOAT(dev)	((struct legacy_device *)device_get_ivars(dev))
@@ -161,6 +163,8 @@ legacy_add_child(device_t bus, u_int ord
 	if (atdev == NULL)
 		return(NULL);
 	atdev->lg_pcibus = -1;
+	atdev->lg_pcislot = -1;
+	atdev->lg_pcifunc = -1;
 
 	child = device_add_child_ordered(bus, order, name, unit);
 	if (child == NULL)
@@ -184,6 +188,12 @@ legacy_read_ivar(device_t dev, device_t 
 	case LEGACY_IVAR_PCIBUS:
 		*result = atdev->lg_pcibus;
 		break;
+	case LEGACY_IVAR_PCISLOT:
+		*result = atdev->lg_pcislot;
+		break;
+	case LEGACY_IVAR_PCIFUNC:
+		*result = atdev->lg_pcifunc;
+		break;
 	default:
 		return ENOENT;
 	}
@@ -202,6 +212,12 @@ legacy_write_ivar(device_t dev, device_t
 	case LEGACY_IVAR_PCIBUS:
 		atdev->lg_pcibus = value;
 		break;
+	case LEGACY_IVAR_PCISLOT:
+		atdev->lg_pcislot = value;
+		break;
+	case LEGACY_IVAR_PCIFUNC:
+		atdev->lg_pcifunc = value;
+		break;
 	default:
 		return ENOENT;
 	}

Modified: head/sys/amd64/include/legacyvar.h
==============================================================================
--- head/sys/amd64/include/legacyvar.h	Thu Mar 29 18:58:02 2012	(r233675)
+++ head/sys/amd64/include/legacyvar.h	Thu Mar 29 19:03:22 2012	(r233676)
@@ -31,7 +31,9 @@
 
 enum legacy_device_ivars {
 	LEGACY_IVAR_PCIDOMAIN,
-	LEGACY_IVAR_PCIBUS
+	LEGACY_IVAR_PCIBUS,
+	LEGACY_IVAR_PCISLOT,
+	LEGACY_IVAR_PCIFUNC
 };
 
 #define LEGACY_ACCESSOR(var, ivar, type)				\
@@ -39,6 +41,8 @@ enum legacy_device_ivars {
 
 LEGACY_ACCESSOR(pcidomain,		PCIDOMAIN,	uint32_t)
 LEGACY_ACCESSOR(pcibus,			PCIBUS,		uint32_t)
+LEGACY_ACCESSOR(pcislot,		PCISLOT,	int)
+LEGACY_ACCESSOR(pcifunc,		PCIFUNC,	int)
 
 #undef LEGACY_ACCESSOR
 
@@ -53,5 +57,7 @@ int	legacy_pcib_write_ivar(device_t dev,
     uintptr_t value);
 struct resource *legacy_pcib_alloc_resource(device_t dev, device_t child,
     int type, int *rid, u_long start, u_long end, u_long count, u_int flags);
+int	legacy_pcib_map_msi(device_t pcib, device_t dev, int irq,
+    uint64_t *addr, uint32_t *data);
 
 #endif /* !_MACHINE_LEGACYVAR_H_ */

Modified: head/sys/dev/acpica/acpi_pcib_acpi.c
==============================================================================
--- head/sys/dev/acpica/acpi_pcib_acpi.c	Thu Mar 29 18:58:02 2012	(r233675)
+++ head/sys/dev/acpica/acpi_pcib_acpi.c	Thu Mar 29 19:03:22 2012	(r233676)
@@ -59,8 +59,9 @@ struct acpi_hpcib_softc {
     ACPI_HANDLE		ap_handle;
     int			ap_flags;
 
-    int			ap_segment;	/* analagous to Alpha 'hose' */
+    int			ap_segment;	/* PCI domain */
     int			ap_bus;		/* bios-assigned bus number */
+    int			ap_addr;	/* device/func of PCI-Host bridge */
 
     ACPI_BUFFER		ap_prt;		/* interrupt routing table */
 #ifdef NEW_PCIB
@@ -276,7 +277,7 @@ acpi_pcib_acpi_attach(device_t dev)
     struct acpi_hpcib_softc	*sc;
     ACPI_STATUS			status;
     static int bus0_seen = 0;
-    u_int addr, slot, func, busok;
+    u_int slot, func, busok;
     uint8_t busno;
 
     ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__);
@@ -286,7 +287,7 @@ acpi_pcib_acpi_attach(device_t dev)
     sc->ap_handle = acpi_get_handle(dev);
 
     /*
-     * Get our segment number by evaluating _SEG
+     * Get our segment number by evaluating _SEG.
      * It's OK for this to not exist.
      */
     status = acpi_GetInteger(sc->ap_handle, "_SEG", &sc->ap_segment);
@@ -300,6 +301,18 @@ acpi_pcib_acpi_attach(device_t dev)
 	sc->ap_segment = 0;
     }
 
+    /*
+     * Get the address (device and function) of the associated
+     * PCI-Host bridge device from _ADR.  Assume we don't have one if
+     * it doesn't exist.
+     */
+    status = acpi_GetInteger(sc->ap_handle, "_ADR", &sc->ap_addr);
+    if (ACPI_FAILURE(status)) {
+	device_printf(dev, "could not evaluate _ADR - %s\n",
+	    AcpiFormatException(status));
+	sc->ap_addr = -1;
+    }
+
 #ifdef NEW_PCIB
     /*
      * Determine which address ranges this bridge decodes and setup
@@ -354,18 +367,10 @@ acpi_pcib_acpi_attach(device_t dev)
     busok = 1;
     if (sc->ap_segment == 0 && sc->ap_bus == 0 && bus0_seen) {
 	busok = 0;
-	status = acpi_GetInteger(sc->ap_handle, "_ADR", &addr);
-	if (ACPI_FAILURE(status)) {
-	    if (status != AE_NOT_FOUND) {
-		device_printf(dev, "could not evaluate _ADR - %s\n",
-		    AcpiFormatException(status));
-		return_VALUE (ENXIO);
-	    } else
-		device_printf(dev, "couldn't find _ADR\n");
-	} else {
+	if (sc->ap_addr != -1) {
 	    /* XXX: We assume bus 0. */
-	    slot = ACPI_ADR_PCI_SLOT(addr);
-	    func = ACPI_ADR_PCI_FUNC(addr);
+	    slot = ACPI_ADR_PCI_SLOT(sc->ap_addr);
+	    func = ACPI_ADR_PCI_FUNC(sc->ap_addr);
 	    if (bootverbose)
 		device_printf(dev, "reading config registers from 0:%d:%d\n",
 		    slot, func);
@@ -488,10 +493,24 @@ static int
 acpi_pcib_map_msi(device_t pcib, device_t dev, int irq, uint64_t *addr,
     uint32_t *data)
 {
-	device_t bus;
+	struct acpi_hpcib_softc *sc;
+	device_t bus, hostb;
+	int error;
 
 	bus = device_get_parent(pcib);
-	return (PCIB_MAP_MSI(device_get_parent(bus), dev, irq, addr, data));
+	error = PCIB_MAP_MSI(device_get_parent(bus), dev, irq, addr, data);
+	if (error)
+		return (error);
+
+	sc = device_get_softc(dev);
+	if (sc->ap_addr == -1)
+		return (0);
+	/* XXX: Assumes all bridges are on bus 0. */
+	hostb = pci_find_dbsf(sc->ap_segment, 0, ACPI_ADR_PCI_SLOT(sc->ap_addr),
+	    ACPI_ADR_PCI_FUNC(sc->ap_addr));
+	if (hostb != NULL)
+		pci_ht_map_msi(hostb, *addr);
+	return (0);
 }
 
 struct resource *

Modified: head/sys/dev/pci/pci.c
==============================================================================
--- head/sys/dev/pci/pci.c	Thu Mar 29 18:58:02 2012	(r233675)
+++ head/sys/dev/pci/pci.c	Thu Mar 29 19:03:22 2012	(r233676)
@@ -751,7 +751,7 @@ pci_read_cap(device_t pcib, pcicfgregs *
 		}
 	}
 
-#if defined(__i386__) || defined(__amd64__) || defined(__powerpc__)
+#if defined(__powerpc__)
 	/*
 	 * Enable the MSI mapping window for all HyperTransport
 	 * slaves.  PCI-PCI bridges have their windows enabled via

Modified: head/sys/i386/i386/legacy.c
==============================================================================
--- head/sys/i386/i386/legacy.c	Thu Mar 29 18:58:02 2012	(r233675)
+++ head/sys/i386/i386/legacy.c	Thu Mar 29 19:03:22 2012	(r233676)
@@ -58,7 +58,9 @@ __FBSDID("$FreeBSD$");
 
 static MALLOC_DEFINE(M_LEGACYDEV, "legacydrv", "legacy system device");
 struct legacy_device {
-	int			lg_pcibus;
+	int	lg_pcibus;
+	int	lg_pcislot;
+	int	lg_pcifunc;
 };
 
 #define DEVTOAT(dev)	((struct legacy_device *)device_get_ivars(dev))
@@ -182,6 +184,8 @@ legacy_add_child(device_t bus, u_int ord
 	if (atdev == NULL)
 		return(NULL);
 	atdev->lg_pcibus = -1;
+	atdev->lg_pcislot = -1;
+	atdev->lg_pcifunc = -1;
 
 	child = device_add_child_ordered(bus, order, name, unit);
 	if (child == NULL)
@@ -205,6 +209,12 @@ legacy_read_ivar(device_t dev, device_t 
 	case LEGACY_IVAR_PCIBUS:
 		*result = atdev->lg_pcibus;
 		break;
+	case LEGACY_IVAR_PCISLOT:
+		*result = atdev->lg_pcislot;
+		break;
+	case LEGACY_IVAR_PCIFUNC:
+		*result = atdev->lg_pcifunc;
+		break;
 	default:
 		return ENOENT;
 	}
@@ -223,6 +233,12 @@ legacy_write_ivar(device_t dev, device_t
 	case LEGACY_IVAR_PCIBUS:
 		atdev->lg_pcibus = value;
 		break;
+	case LEGACY_IVAR_PCISLOT:
+		atdev->lg_pcislot = value;
+		break;
+	case LEGACY_IVAR_PCIFUNC:
+		atdev->lg_pcifunc = value;
+		break;
 	default:
 		return ENOENT;
 	}

Modified: head/sys/i386/include/legacyvar.h
==============================================================================
--- head/sys/i386/include/legacyvar.h	Thu Mar 29 18:58:02 2012	(r233675)
+++ head/sys/i386/include/legacyvar.h	Thu Mar 29 19:03:22 2012	(r233676)
@@ -31,7 +31,9 @@
 
 enum legacy_device_ivars {
 	LEGACY_IVAR_PCIDOMAIN,
-	LEGACY_IVAR_PCIBUS
+	LEGACY_IVAR_PCIBUS,
+	LEGACY_IVAR_PCISLOT,
+	LEGACY_IVAR_PCIFUNC
 };
 
 #define LEGACY_ACCESSOR(var, ivar, type)				\
@@ -39,6 +41,8 @@ enum legacy_device_ivars {
 
 LEGACY_ACCESSOR(pcidomain,		PCIDOMAIN,	uint32_t)
 LEGACY_ACCESSOR(pcibus,			PCIBUS,		uint32_t)
+LEGACY_ACCESSOR(pcislot,		PCISLOT,	int)
+LEGACY_ACCESSOR(pcifunc,		PCIFUNC,	int)
 
 #undef LEGACY_ACCESSOR
 
@@ -53,5 +57,7 @@ int	legacy_pcib_write_ivar(device_t dev,
     uintptr_t value);
 struct resource *legacy_pcib_alloc_resource(device_t dev, device_t child,
     int type, int *rid, u_long start, u_long end, u_long count, u_int flags);
+int	legacy_pcib_map_msi(device_t pcib, device_t dev, int irq,
+    uint64_t *addr, uint32_t *data);
 
 #endif /* !_MACHINE_LEGACYVAR_H_ */

Modified: head/sys/x86/pci/pci_bus.c
==============================================================================
--- head/sys/x86/pci/pci_bus.c	Thu Mar 29 18:58:02 2012	(r233675)
+++ head/sys/x86/pci/pci_bus.c	Thu Mar 29 19:03:22 2012	(r233676)
@@ -112,14 +112,28 @@ legacy_pcib_alloc_msix(device_t pcib, de
 	return (PCIB_ALLOC_MSIX(device_get_parent(bus), dev, irq));
 }
 
-static int
+int
 legacy_pcib_map_msi(device_t pcib, device_t dev, int irq, uint64_t *addr,
     uint32_t *data)
 {
-	device_t bus;
+	device_t bus, hostb;
+	int error, func, slot;
 
 	bus = device_get_parent(pcib);
-	return (PCIB_MAP_MSI(device_get_parent(bus), dev, irq, addr, data));
+	error = PCIB_MAP_MSI(device_get_parent(bus), dev, irq, addr, data);
+	if (error)
+		return (error);
+
+	slot = legacy_get_pcislot(pcib);
+	func = legacy_get_pcifunc(pcib);
+	if (slot == -1 || func == -1)
+		return (0);
+	hostb = pci_find_bsf(0, slot, func);
+	KASSERT(hostb != NULL, ("%s: missing hostb for 0:%d:%d", __func__,
+	    slot, func));
+	pci_ht_map_msi(hostb, *addr);
+	return (0);
+	
 }
 
 static const char *
@@ -453,6 +467,8 @@ legacy_pcib_identify(driver_t *driver, d
 					      "pcib", busnum);
 			device_set_desc(child, s);
 			legacy_set_pcibus(child, busnum);
+			legacy_set_pcislot(child, slot);
+			legacy_set_pcifunc(child, func);
 
 			found = 1;
 			if (id == 0x12258086)

Modified: head/sys/x86/x86/mptable_pci.c
==============================================================================
--- head/sys/x86/x86/mptable_pci.c	Thu Mar 29 18:58:02 2012	(r233675)
+++ head/sys/x86/x86/mptable_pci.c	Thu Mar 29 19:03:22 2012	(r233676)
@@ -97,16 +97,6 @@ mptable_hostb_alloc_msix(device_t pcib, 
 	return (PCIB_ALLOC_MSIX(device_get_parent(bus), dev, irq));
 }
 
-static int
-mptable_hostb_map_msi(device_t pcib, device_t dev, int irq, uint64_t *addr,
-    uint32_t *data)
-{
-	device_t bus;
-
-	bus = device_get_parent(pcib);
-	return (PCIB_MAP_MSI(device_get_parent(bus), dev, irq, addr, data));
-}
-
 #ifdef NEW_PCIB
 static int
 mptable_is_isa_range(u_long start, u_long end)
@@ -214,7 +204,7 @@ static device_method_t mptable_hostb_met
 	DEVMETHOD(pcib_release_msi,	pcib_release_msi),
 	DEVMETHOD(pcib_alloc_msix,	mptable_hostb_alloc_msix),
 	DEVMETHOD(pcib_release_msix,	pcib_release_msix),
-	DEVMETHOD(pcib_map_msi,		mptable_hostb_map_msi),
+	DEVMETHOD(pcib_map_msi,		legacy_pcib_map_msi),
 
 	DEVMETHOD_END
 };

From owner-svn-src-head@FreeBSD.ORG  Thu Mar 29 19:26:40 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 851DF106564A;
	Thu, 29 Mar 2012 19:26:40 +0000 (UTC)
	(envelope-from jkim@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 56D048FC08;
	Thu, 29 Mar 2012 19:26:40 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2TJQe4Y006954;
	Thu, 29 Mar 2012 19:26:40 GMT (envelope-from jkim@svn.freebsd.org)
Received: (from jkim@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2TJQerd006952;
	Thu, 29 Mar 2012 19:26:40 GMT (envelope-from jkim@svn.freebsd.org)
Message-Id: <201203291926.q2TJQerd006952@svn.freebsd.org>
From: Jung-uk Kim 
Date: Thu, 29 Mar 2012 19:26:40 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233677 - head/sys/dev/pci
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Mar 2012 19:26:40 -0000

Author: jkim
Date: Thu Mar 29 19:26:39 2012
New Revision: 233677
URL: http://svn.freebsd.org/changeset/base/233677

Log:
  Revert r233662 and generalize the hack.  Writing zero to BAR actually does
  not disable it and it is even harmful as hselasky found out.  Historically,
  this code was originated from (OLDCARD) CardBus driver and later leaked into
  PCI driver when CardBus was newbus'ified and refactored with PCI driver.
  However, it is not really necessary even for CardBus.
  
  Reviewed by:	hselasky, imp, jhb

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

Modified: head/sys/dev/pci/pci.c
==============================================================================
--- head/sys/dev/pci/pci.c	Thu Mar 29 19:03:22 2012	(r233676)
+++ head/sys/dev/pci/pci.c	Thu Mar 29 19:26:39 2012	(r233677)
@@ -2590,27 +2590,6 @@ pci_write_bar(device_t dev, struct pci_m
 	struct pci_devinfo *dinfo;
 	int ln2range;
 
-	/*
-	 * Don't disable BARs on AGP devices. In general: Don't
-	 * disable BARs on any PCI display devices, because doing that
-	 * can sometimes cause the main memory bus to stop working,
-	 * causing all memory reads to return nothing but 0xFFFFFFFF,
-	 * even though the memory location was previously written.
-	 * After a while a privileged instruction fault will appear
-	 * and then nothing more can be debugged.
-	 * The reason for this behaviour is unknown.
-	 */
-	if (base == 0 && pci_get_class(dev) == PCIC_DISPLAY) {
-		device_printf(device_get_parent(dev),
-		    "pci%d:%d:%d:%d BARs on display devices "
-		    "should not be disabled.\n",
-		    pci_get_domain(dev),
-		    pci_get_bus(dev),
-		    pci_get_slot(dev),
-		    pci_get_function(dev));
-		return;
-	}
-
 	/* The device ROM BAR is always a 32-bit memory BAR. */
 	dinfo = device_get_ivars(dev);
 	if (PCIR_IS_BIOS(&dinfo->cfg, pm->pm_reg))
@@ -2838,16 +2817,15 @@ pci_add_map(device_t bus, device_t dev, 
 	    prefetch ? RF_PREFETCHABLE : 0);
 	if (res == NULL) {
 		/*
-		 * If the allocation fails, clear the BAR and delete
-		 * the resource list entry to force
-		 * pci_alloc_resource() to allocate resources from the
-		 * parent.
+		 * If the allocation fails, delete the resource list entry
+		 * to force pci_alloc_resource() to allocate resources
+		 * from the parent.
 		 */
 		resource_list_delete(rl, type, reg);
-		start = 0;
-	} else
+	} else {
 		start = rman_get_start(res);
-	pci_write_bar(dev, pm, start);
+		pci_write_bar(dev, pm, start);
+	}
 	return (barlen);
 }
 
@@ -4381,19 +4359,6 @@ pci_delete_resource(device_t dev, device
 			    type, rid, rman_get_start(rle->res));
 			return;
 		}
-
-#ifndef __PCI_BAR_ZERO_VALID
-		/*
-		 * If this is a BAR, clear the BAR so it stops
-		 * decoding before releasing the resource.
-		 */
-		switch (type) {
-		case SYS_RES_IOPORT:
-		case SYS_RES_MEMORY:
-			pci_write_bar(child, pci_find_bar(child, rid), 0);
-			break;
-		}
-#endif
 		resource_list_unreserve(rl, dev, child, type, rid);
 	}
 	resource_list_delete(rl, type, rid);

From owner-svn-src-head@FreeBSD.ORG  Thu Mar 29 19:29:25 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 2E1A6106564A;
	Thu, 29 Mar 2012 19:29:25 +0000 (UTC)
	(envelope-from jkim@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 19B248FC19;
	Thu, 29 Mar 2012 19:29:25 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2TJTOvI007067;
	Thu, 29 Mar 2012 19:29:24 GMT (envelope-from jkim@svn.freebsd.org)
Received: (from jkim@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2TJTOhJ007065;
	Thu, 29 Mar 2012 19:29:24 GMT (envelope-from jkim@svn.freebsd.org)
Message-Id: <201203291929.q2TJTOhJ007065@svn.freebsd.org>
From: Jung-uk Kim 
Date: Thu, 29 Mar 2012 19:29:24 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233678 - head/sys/dev/pci
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Mar 2012 19:29:25 -0000

Author: jkim
Date: Thu Mar 29 19:29:24 2012
New Revision: 233678
URL: http://svn.freebsd.org/changeset/base/233678

Log:
  Fix couple of style nits.

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

Modified: head/sys/dev/pci/pci.c
==============================================================================
--- head/sys/dev/pci/pci.c	Thu Mar 29 19:26:39 2012	(r233677)
+++ head/sys/dev/pci/pci.c	Thu Mar 29 19:29:24 2012	(r233678)
@@ -3894,7 +3894,7 @@ pci_describe_device(device_t dev)
 	if ((desc = malloc(strlen(vp) + strlen(dp) + 3, M_DEVBUF, M_NOWAIT)) !=
 	    NULL)
 		sprintf(desc, "%s, %s", vp, dp);
- out:
+out:
 	if (vp != NULL)
 		free(vp, M_DEVBUF);
 	if (dp != NULL)
@@ -4170,7 +4170,7 @@ pci_reserve_map(device_t dev, device_t c
 		    count, *rid, type, rman_get_start(res));
 	map = rman_get_start(res);
 	pci_write_bar(child, pm, map);
-out:;
+out:
 	return (res);
 }
 

From owner-svn-src-head@FreeBSD.ORG  Thu Mar 29 20:11:17 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 3CC831065680;
	Thu, 29 Mar 2012 20:11:17 +0000 (UTC)
	(envelope-from trociny@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 0E8AB8FC21;
	Thu, 29 Mar 2012 20:11:17 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2TKBGn3008423;
	Thu, 29 Mar 2012 20:11:16 GMT (envelope-from trociny@svn.freebsd.org)
Received: (from trociny@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2TKBG67008421;
	Thu, 29 Mar 2012 20:11:16 GMT (envelope-from trociny@svn.freebsd.org)
Message-Id: <201203292011.q2TKBG67008421@svn.freebsd.org>
From: Mikolaj Golub 
Date: Thu, 29 Mar 2012 20:11:16 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233679 - head/sbin/hastd
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Mar 2012 20:11:17 -0000

Author: trociny
Date: Thu Mar 29 20:11:16 2012
New Revision: 233679
URL: http://svn.freebsd.org/changeset/base/233679

Log:
  If hastd is invoked with "-P pidfile" option always create pidfile
  regardless of whether -F (foreground) option is set or not.
  
  Also, if -P option is specified, ignore pidfile setting from configuration
  not only on start but on reload too. This fixes the issue when for hastd
  run with -P option reload caused the pidfile change.
  
  Reviewed by:	pjd
  MFC after:	1 week

Modified:
  head/sbin/hastd/hastd.c

Modified: head/sbin/hastd/hastd.c
==============================================================================
--- head/sbin/hastd/hastd.c	Thu Mar 29 19:29:24 2012	(r233678)
+++ head/sbin/hastd/hastd.c	Thu Mar 29 20:11:16 2012	(r233679)
@@ -66,6 +66,8 @@ const char *cfgpath = HAST_CONFIG;
 static struct hastd_config *cfg;
 /* Was SIGINT or SIGTERM signal received? */
 bool sigexit_received = false;
+/* Path to pidfile. */
+static const char *pidfile;
 /* PID file handle. */
 struct pidfh *pfh;
 /* Do we run in foreground? */
@@ -537,7 +539,8 @@ hastd_reload(void)
 	/*
 	 * Check if pidfile's path has changed.
 	 */
-	if (!foreground && strcmp(cfg->hc_pidfile, newcfg->hc_pidfile) != 0) {
+	if (!foreground && pidfile == NULL &&
+	    strcmp(cfg->hc_pidfile, newcfg->hc_pidfile) != 0) {
 		newpfh = pidfile_open(newcfg->hc_pidfile, 0600, &otherpid);
 		if (newpfh == NULL) {
 			if (errno == EEXIST) {
@@ -1163,14 +1166,12 @@ int
 main(int argc, char *argv[])
 {
 	struct hastd_listen *lst;
-	const char *pidfile;
 	pid_t otherpid;
 	int debuglevel;
 	sigset_t mask;
 
 	foreground = false;
 	debuglevel = 0;
-	pidfile = NULL;
 
 	for (;;) {
 		int ch;
@@ -1230,7 +1231,7 @@ main(int argc, char *argv[])
 		}
 	}
 
-	if (!foreground) {
+	if (pidfile != NULL || !foreground) {
 		pfh = pidfile_open(cfg->hc_pidfile, 0600, &otherpid);
 		if (pfh == NULL) {
 			if (errno == EEXIST) {
@@ -1291,7 +1292,8 @@ main(int argc, char *argv[])
 
 		/* Start logging to syslog. */
 		pjdlog_mode_set(PJDLOG_MODE_SYSLOG);
-
+	}
+	if (pidfile != NULL || !foreground) {
 		/* Write PID to a file. */
 		if (pidfile_write(pfh) == -1) {
 			pjdlog_errno(LOG_WARNING,

From owner-svn-src-head@FreeBSD.ORG  Thu Mar 29 20:23:36 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 56884106566C;
	Thu, 29 Mar 2012 20:23:36 +0000 (UTC)
	(envelope-from joel@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 36E008FC16;
	Thu, 29 Mar 2012 20:23:36 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2TKNamo008892;
	Thu, 29 Mar 2012 20:23:36 GMT (envelope-from joel@svn.freebsd.org)
Received: (from joel@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2TKNaRi008889;
	Thu, 29 Mar 2012 20:23:36 GMT (envelope-from joel@svn.freebsd.org)
Message-Id: <201203292023.q2TKNaRi008889@svn.freebsd.org>
From: Joel Dahl 
Date: Thu, 29 Mar 2012 20:23:35 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233680 - in head: lib/libc/rpc share/man/man9
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Mar 2012 20:23:36 -0000

Author: joel (doc committer)
Date: Thu Mar 29 20:23:35 2012
New Revision: 233680
URL: http://svn.freebsd.org/changeset/base/233680

Log:
  Remove unnecessary Xo/Xc.
  
  Reviewed by:	brueffer

Modified:
  head/lib/libc/rpc/rpc_soc.3
  head/share/man/man9/locking.9

Modified: head/lib/libc/rpc/rpc_soc.3
==============================================================================
--- head/lib/libc/rpc/rpc_soc.3	Thu Mar 29 20:11:16 2012	(r233679)
+++ head/lib/libc/rpc/rpc_soc.3	Thu Mar 29 20:23:35 2012	(r233680)
@@ -394,12 +394,10 @@ the supported values of
 .Fa req
 and their argument types and what they do are:
 .Bl -column "CLSET_RETRY_TIMEOUT" "struct sockaddr_in"
-.It Dv CLSET_TIMEOUT Ta Xo
+.It Dv CLSET_TIMEOUT Ta
 .Vt "struct timeval" Ta "set total timeout"
-.Xc
-.It Dv CLGET_TIMEOUT Ta Xo
+.It Dv CLGET_TIMEOUT Ta
 .Vt "struct timeval" Ta "get total timeout"
-.Xc
 .El
 .Pp
 Note: if you set the timeout using
@@ -408,21 +406,18 @@ the timeout argument passed to
 .Fn clnt_call
 will be ignored in all future calls.
 .Bl -column "CLSET_RETRY_TIMEOUT" "struct sockaddr_in"
-.It Dv CLGET_SERVER_ADDR Ta Xo
+.It Dv CLGET_SERVER_ADDR Ta
 .Vt "struct sockaddr_in" Ta "get server's address"
-.Xc
 .El
 .Pp
 The following operations are valid for
 .Tn UDP
 only:
 .Bl -column "CLSET_RETRY_TIMEOUT" "struct sockaddr_in"
-.It Dv CLSET_RETRY_TIMEOUT Ta Xo
+.It Dv CLSET_RETRY_TIMEOUT Ta
 .Vt "struct timeval" Ta "set the retry timeout"
-.Xc
-.It Dv CLGET_RETRY_TIMEOUT Ta Xo
+.It Dv CLGET_RETRY_TIMEOUT Ta
 .Vt "struct timeval" Ta "get the retry timeout"
-.Xc
 .El
 .Pp
 The retry timeout is the time that

Modified: head/share/man/man9/locking.9
==============================================================================
--- head/share/man/man9/locking.9	Thu Mar 29 20:11:16 2012	(r233679)
+++ head/share/man/man9/locking.9	Thu Mar 29 20:23:35 2012	(r233680)
@@ -293,9 +293,7 @@ running inside an interrupt thread.
 The following table shows what you can and can not do while holding
 one of the synchronization primitives discussed:
 .Bl -column ".Ic xxxxxxxxxxxxxxxxxxx" ".Xr XXXXXXXXX" ".Xr XXXXXXX" ".Xr XXXXXXX" ".Xr XXXXXXX" ".Xr XXXXXX" -offset indent
-.It Xo
-.Em "You have: You want:" Ta spin mtx Ta mutex Ta sx Ta rwlock Ta rmlock Ta sleep
-.Xc
+.It .Em "You have: You want:" Ta spin mtx Ta mutex Ta sx Ta rwlock Ta rmlock Ta sleep
 .It spin mtx  Ta \&ok-1 Ta \&no Ta \&no Ta \&no Ta \&no Ta \&no-3
 .It mutex     Ta \&ok Ta \&ok-1 Ta \&no Ta \&ok Ta \&ok Ta \&no-3
 .It sx        Ta \&ok Ta \&ok Ta \&ok-2 Ta \&ok Ta \&ok Ta \&ok-4
@@ -336,9 +334,7 @@ for details.
 The next table shows what can be used in different contexts.
 At this time this is a rather easy to remember table.
 .Bl -column ".Ic Xxxxxxxxxxxxxxxxxxx" ".Xr XXXXXXXXX" ".Xr XXXXXXX" ".Xr XXXXXXX" ".Xr XXXXXXX" ".Xr XXXXXX" -offset indent
-.It Xo
-.Em "Context:"  Ta spin mtx Ta mutex Ta sx Ta rwlock Ta rmlock Ta sleep
-.Xc
+.It .Em "Context:"  Ta spin mtx Ta mutex Ta sx Ta rwlock Ta rmlock Ta sleep
 .It interrupt filter:  Ta \&ok Ta \&no Ta \&no Ta \&no Ta \&no Ta \&no
 .It interrupt thread:  Ta \&ok Ta \&ok Ta \&no Ta \&ok Ta \&ok Ta \&no
 .It callout:    Ta \&ok Ta \&ok Ta \&no Ta \&ok Ta \&no Ta \&no

From owner-svn-src-head@FreeBSD.ORG  Thu Mar 29 20:55:46 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 51446106564A;
	Thu, 29 Mar 2012 20:55:46 +0000 (UTC)
	(envelope-from joel@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 3C3698FC23;
	Thu, 29 Mar 2012 20:55:46 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2TKtk9f009957;
	Thu, 29 Mar 2012 20:55:46 GMT (envelope-from joel@svn.freebsd.org)
Received: (from joel@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2TKtk6G009955;
	Thu, 29 Mar 2012 20:55:46 GMT (envelope-from joel@svn.freebsd.org)
Message-Id: <201203292055.q2TKtk6G009955@svn.freebsd.org>
From: Joel Dahl 
Date: Thu, 29 Mar 2012 20:55:46 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233681 - head/share/man/man9
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Mar 2012 20:55:46 -0000

Author: joel (doc committer)
Date: Thu Mar 29 20:55:45 2012
New Revision: 233681
URL: http://svn.freebsd.org/changeset/base/233681

Log:
  Fix typo from last commit.
  
  Noticed by:	brueffer

Modified:
  head/share/man/man9/locking.9

Modified: head/share/man/man9/locking.9
==============================================================================
--- head/share/man/man9/locking.9	Thu Mar 29 20:23:35 2012	(r233680)
+++ head/share/man/man9/locking.9	Thu Mar 29 20:55:45 2012	(r233681)
@@ -293,7 +293,7 @@ running inside an interrupt thread.
 The following table shows what you can and can not do while holding
 one of the synchronization primitives discussed:
 .Bl -column ".Ic xxxxxxxxxxxxxxxxxxx" ".Xr XXXXXXXXX" ".Xr XXXXXXX" ".Xr XXXXXXX" ".Xr XXXXXXX" ".Xr XXXXXX" -offset indent
-.It .Em "You have: You want:" Ta spin mtx Ta mutex Ta sx Ta rwlock Ta rmlock Ta sleep
+.It Em "You have: You want:" Ta spin mtx Ta mutex Ta sx Ta rwlock Ta rmlock Ta sleep
 .It spin mtx  Ta \&ok-1 Ta \&no Ta \&no Ta \&no Ta \&no Ta \&no-3
 .It mutex     Ta \&ok Ta \&ok-1 Ta \&no Ta \&ok Ta \&ok Ta \&no-3
 .It sx        Ta \&ok Ta \&ok Ta \&ok-2 Ta \&ok Ta \&ok Ta \&ok-4
@@ -334,7 +334,7 @@ for details.
 The next table shows what can be used in different contexts.
 At this time this is a rather easy to remember table.
 .Bl -column ".Ic Xxxxxxxxxxxxxxxxxxx" ".Xr XXXXXXXXX" ".Xr XXXXXXX" ".Xr XXXXXXX" ".Xr XXXXXXX" ".Xr XXXXXX" -offset indent
-.It .Em "Context:"  Ta spin mtx Ta mutex Ta sx Ta rwlock Ta rmlock Ta sleep
+.It Em "Context:"  Ta spin mtx Ta mutex Ta sx Ta rwlock Ta rmlock Ta sleep
 .It interrupt filter:  Ta \&ok Ta \&no Ta \&no Ta \&no Ta \&no Ta \&no
 .It interrupt thread:  Ta \&ok Ta \&ok Ta \&no Ta \&ok Ta \&ok Ta \&no
 .It callout:    Ta \&ok Ta \&ok Ta \&no Ta \&ok Ta \&no Ta \&no

From owner-svn-src-head@FreeBSD.ORG  Thu Mar 29 21:54:20 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 7C014106564A;
	Thu, 29 Mar 2012 21:54:20 +0000 (UTC)
	(envelope-from adrian@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 669B88FC14;
	Thu, 29 Mar 2012 21:54:20 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2TLsKHq011735;
	Thu, 29 Mar 2012 21:54:20 GMT (envelope-from adrian@svn.freebsd.org)
Received: (from adrian@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2TLsK8A011733;
	Thu, 29 Mar 2012 21:54:20 GMT (envelope-from adrian@svn.freebsd.org)
Message-Id: <201203292154.q2TLsK8A011733@svn.freebsd.org>
From: Adrian Chadd 
Date: Thu, 29 Mar 2012 21:54:20 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233682 - head/sys/dev/ath
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Mar 2012 21:54:20 -0000

Author: adrian
Date: Thu Mar 29 21:54:19 2012
New Revision: 233682
URL: http://svn.freebsd.org/changeset/base/233682

Log:
  oops, add a missing lock.

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

Modified: head/sys/dev/ath/if_ath.c
==============================================================================
--- head/sys/dev/ath/if_ath.c	Thu Mar 29 20:55:45 2012	(r233681)
+++ head/sys/dev/ath/if_ath.c	Thu Mar 29 21:54:19 2012	(r233682)
@@ -5156,8 +5156,11 @@ ath_txq_sched_tasklet(void *arg, int npe
 	ATH_PCU_UNLOCK(sc);
 
 	for (i = 0; i < HAL_NUM_TX_QUEUES; i++) {
-		if (ATH_TXQ_SETUP(sc, i))
+		if (ATH_TXQ_SETUP(sc, i)) {
+			ATH_TXQ_LOCK(&sc->sc_txq[i]);
 			ath_txq_sched(sc, &sc->sc_txq[i]);
+			ATH_TXQ_UNLOCK(&sc->sc_txq[i]);
+		}
 	}
 
 	ATH_PCU_LOCK(sc);

From owner-svn-src-head@FreeBSD.ORG  Thu Mar 29 23:30:17 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id C645F106564A;
	Thu, 29 Mar 2012 23:30:17 +0000 (UTC) (envelope-from dim@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id B11E18FC08;
	Thu, 29 Mar 2012 23:30:17 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2TNUHrr014845;
	Thu, 29 Mar 2012 23:30:17 GMT (envelope-from dim@svn.freebsd.org)
Received: (from dim@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2TNUHbu014843;
	Thu, 29 Mar 2012 23:30:17 GMT (envelope-from dim@svn.freebsd.org)
Message-Id: <201203292330.q2TNUHbu014843@svn.freebsd.org>
From: Dimitry Andric 
Date: Thu, 29 Mar 2012 23:30:17 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233683 - head/sys/x86/include
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Mar 2012 23:30:17 -0000

Author: dim
Date: Thu Mar 29 23:30:17 2012
New Revision: 233683
URL: http://svn.freebsd.org/changeset/base/233683

Log:
  Revert sys/x86/include/endian.h to what it was before r233419, as that
  revision has two problems:
  - It can produce worse code with both clang and gcc.
  - It doesn't fix the actual issue introduced in r232721, which will be
    fixed in the next commit.
  
  Submitted by:	bde, tijl and jh
  Pointy hat to:	dim

Modified:
  head/sys/x86/include/endian.h

Modified: head/sys/x86/include/endian.h
==============================================================================
--- head/sys/x86/include/endian.h	Thu Mar 29 21:54:19 2012	(r233682)
+++ head/sys/x86/include/endian.h	Thu Mar 29 23:30:17 2012	(r233683)
@@ -63,11 +63,11 @@
 #define	BYTE_ORDER	_BYTE_ORDER
 #endif
 
-#define	__bswap16_gen(x)	((__uint16_t)((x) << 8 | (x) >> 8))
+#define	__bswap16_gen(x)	(__uint16_t)((x) << 8 | (x) >> 8)
 #define	__bswap32_gen(x)		\
-	(((__uint32_t)__bswap16_gen(x) << 16) | __bswap16_gen((x) >> 16))
+	(((__uint32_t)__bswap16(x) << 16) | __bswap16((x) >> 16))
 #define	__bswap64_gen(x)		\
-	(((__uint64_t)__bswap32_gen(x) << 32) | __bswap32_gen((x) >> 32))
+	(((__uint64_t)__bswap32(x) << 32) | __bswap32((x) >> 32))
 
 #ifdef __GNUCLIKE_BUILTIN_CONSTANT_P
 #define	__bswap16(x)				\

From owner-svn-src-head@FreeBSD.ORG  Thu Mar 29 23:31:49 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 309261065673;
	Thu, 29 Mar 2012 23:31:49 +0000 (UTC) (envelope-from dim@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 1C1B88FC1C;
	Thu, 29 Mar 2012 23:31:49 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2TNVmLv014922;
	Thu, 29 Mar 2012 23:31:48 GMT (envelope-from dim@svn.freebsd.org)
Received: (from dim@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2TNVmwN014920;
	Thu, 29 Mar 2012 23:31:48 GMT (envelope-from dim@svn.freebsd.org)
Message-Id: <201203292331.q2TNVmwN014920@svn.freebsd.org>
From: Dimitry Andric 
Date: Thu, 29 Mar 2012 23:31:48 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233684 - head/sys/x86/include
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Mar 2012 23:31:49 -0000

Author: dim
Date: Thu Mar 29 23:31:48 2012
New Revision: 233684
URL: http://svn.freebsd.org/changeset/base/233684

Log:
  Fix an issue introduced in sys/x86/include/endian.h with r232721.  In
  that revision, the bswapXX_const() macros were renamed to bswapXX_gen().
  
  Also, bswap64_gen() was implemented as two calls to bswap32(), and
  similarly, bswap32_gen() as two calls to bswap16().  This mainly helps
  our base gcc to produce more efficient assembly.
  
  However, the arguments are not properly masked, which results in the
  wrong value being calculated in some instances.  For example,
  bswap32(0x12345678) returns 0x7c563412, and bswap64(0x123456789abcdef0)
  returns 0xfcdefc9a7c563412.
  
  Fix this by appropriately masking the arguments to bswap16() in
  bswap32_gen(), and to bswap32() in bswap64_gen().  This should also
  silence warnings from clang.
  
  Submitted by:	jh

Modified:
  head/sys/x86/include/endian.h

Modified: head/sys/x86/include/endian.h
==============================================================================
--- head/sys/x86/include/endian.h	Thu Mar 29 23:30:17 2012	(r233683)
+++ head/sys/x86/include/endian.h	Thu Mar 29 23:31:48 2012	(r233684)
@@ -65,9 +65,9 @@
 
 #define	__bswap16_gen(x)	(__uint16_t)((x) << 8 | (x) >> 8)
 #define	__bswap32_gen(x)		\
-	(((__uint32_t)__bswap16(x) << 16) | __bswap16((x) >> 16))
+	(((__uint32_t)__bswap16((x) & 0xffff) << 16) | __bswap16((x) >> 16))
 #define	__bswap64_gen(x)		\
-	(((__uint64_t)__bswap32(x) << 32) | __bswap32((x) >> 32))
+	(((__uint64_t)__bswap32((x) & 0xffffffff) << 32) | __bswap32((x) >> 32))
 
 #ifdef __GNUCLIKE_BUILTIN_CONSTANT_P
 #define	__bswap16(x)				\

From owner-svn-src-head@FreeBSD.ORG  Fri Mar 30 04:46:40 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 1EDF61065674;
	Fri, 30 Mar 2012 04:46:40 +0000 (UTC)
	(envelope-from yongari@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id F30F38FC12;
	Fri, 30 Mar 2012 04:46:39 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2U4kdY6025104;
	Fri, 30 Mar 2012 04:46:39 GMT (envelope-from yongari@svn.freebsd.org)
Received: (from yongari@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2U4kd3n025101;
	Fri, 30 Mar 2012 04:46:39 GMT (envelope-from yongari@svn.freebsd.org)
Message-Id: <201203300446.q2U4kd3n025101@svn.freebsd.org>
From: Pyun YongHyeon 
Date: Fri, 30 Mar 2012 04:46:39 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233688 - head/sys/dev/ale
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 30 Mar 2012 04:46:40 -0000

Author: yongari
Date: Fri Mar 30 04:46:39 2012
New Revision: 233688
URL: http://svn.freebsd.org/changeset/base/233688

Log:
  Remove task queue based link state change handler. Driver no longer
  needs to defer link state handling.
  While I'm here, mark IFF_DRV_RUNNING before changing media.  If
  link is established without any delay, that link state change
  handling could be lost.

Modified:
  head/sys/dev/ale/if_ale.c
  head/sys/dev/ale/if_alevar.h

Modified: head/sys/dev/ale/if_ale.c
==============================================================================
--- head/sys/dev/ale/if_ale.c	Thu Mar 29 23:59:02 2012	(r233687)
+++ head/sys/dev/ale/if_ale.c	Fri Mar 30 04:46:39 2012	(r233688)
@@ -115,7 +115,6 @@ static void	ale_init_tx_ring(struct ale_
 static void	ale_int_task(void *, int);
 static int	ale_intr(void *);
 static int	ale_ioctl(struct ifnet *, u_long, caddr_t);
-static void	ale_link_task(void *, int);
 static void	ale_mac_config(struct ale_softc *);
 static int	ale_miibus_readreg(device_t, int, int);
 static void	ale_miibus_statchg(device_t);
@@ -253,10 +252,45 @@ static void
 ale_miibus_statchg(device_t dev)
 {
 	struct ale_softc *sc;
+	struct mii_data *mii;
+	struct ifnet *ifp;
+	uint32_t reg;
 
 	sc = device_get_softc(dev);
+	mii = device_get_softc(sc->ale_miibus);
+	ifp = sc->ale_ifp;
+	if (mii == NULL || ifp == NULL ||
+	    (ifp->if_drv_flags & IFF_DRV_RUNNING) == 0)
+		return;
 
-	taskqueue_enqueue(taskqueue_swi, &sc->ale_link_task);
+	sc->ale_flags &= ~ALE_FLAG_LINK;
+	if ((mii->mii_media_status & (IFM_ACTIVE | IFM_AVALID)) ==
+	    (IFM_ACTIVE | IFM_AVALID)) {
+		switch (IFM_SUBTYPE(mii->mii_media_active)) {
+		case IFM_10_T:
+		case IFM_100_TX:
+			sc->ale_flags |= ALE_FLAG_LINK;
+			break;
+		case IFM_1000_T:
+			if ((sc->ale_flags & ALE_FLAG_FASTETHER) == 0)
+				sc->ale_flags |= ALE_FLAG_LINK;
+			break;
+		default:
+			break;
+		}
+	}
+
+	/* Stop Rx/Tx MACs. */
+	ale_stop_mac(sc);
+
+	/* Program MACs with resolved speed/duplex/flow-control. */
+	if ((sc->ale_flags & ALE_FLAG_LINK) != 0) {
+		ale_mac_config(sc);
+		/* Reenable Tx/Rx MACs. */
+		reg = CSR_READ_4(sc, ALE_MAC_CFG);
+		reg |= MAC_CFG_TX_ENB | MAC_CFG_RX_ENB;
+		CSR_WRITE_4(sc, ALE_MAC_CFG, reg);
+	}
 }
 
 static void
@@ -425,7 +459,6 @@ ale_attach(device_t dev)
 	    MTX_DEF);
 	callout_init_mtx(&sc->ale_tick_ch, &sc->ale_mtx, 0);
 	TASK_INIT(&sc->ale_int_task, 0, ale_int_task, sc);
-	TASK_INIT(&sc->ale_link_task, 0, ale_link_task, sc);
 
 	/* Map the device. */
 	pci_enable_busmaster(dev);
@@ -679,7 +712,6 @@ ale_detach(device_t dev)
 		ALE_UNLOCK(sc);
 		callout_drain(&sc->ale_tick_ch);
 		taskqueue_drain(sc->ale_tq, &sc->ale_int_task);
-		taskqueue_drain(taskqueue_swi, &sc->ale_link_task);
 	}
 
 	if (sc->ale_tq != NULL) {
@@ -2076,57 +2108,6 @@ ale_mac_config(struct ale_softc *sc)
 }
 
 static void
-ale_link_task(void *arg, int pending)
-{
-	struct ale_softc *sc;
-	struct mii_data *mii;
-	struct ifnet *ifp;
-	uint32_t reg;
-
-	sc = (struct ale_softc *)arg;
-
-	ALE_LOCK(sc);
-	mii = device_get_softc(sc->ale_miibus);
-	ifp = sc->ale_ifp;
-	if (mii == NULL || ifp == NULL ||
-	    (ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) {
-		ALE_UNLOCK(sc);
-		return;
-	}
-
-	sc->ale_flags &= ~ALE_FLAG_LINK;
-	if ((mii->mii_media_status & (IFM_ACTIVE | IFM_AVALID)) ==
-	    (IFM_ACTIVE | IFM_AVALID)) {
-		switch (IFM_SUBTYPE(mii->mii_media_active)) {
-		case IFM_10_T:
-		case IFM_100_TX:
-			sc->ale_flags |= ALE_FLAG_LINK;
-			break;
-		case IFM_1000_T:
-			if ((sc->ale_flags & ALE_FLAG_FASTETHER) == 0)
-				sc->ale_flags |= ALE_FLAG_LINK;
-			break;
-		default:
-			break;
-		}
-	}
-
-	/* Stop Rx/Tx MACs. */
-	ale_stop_mac(sc);
-
-	/* Program MACs with resolved speed/duplex/flow-control. */
-	if ((sc->ale_flags & ALE_FLAG_LINK) != 0) {
-		ale_mac_config(sc);
-		/* Reenable Tx/Rx MACs. */
-		reg = CSR_READ_4(sc, ALE_MAC_CFG);
-		reg |= MAC_CFG_TX_ENB | MAC_CFG_RX_ENB;
-		CSR_WRITE_4(sc, ALE_MAC_CFG, reg);
-	}
-
-	ALE_UNLOCK(sc);
-}
-
-static void
 ale_stats_clear(struct ale_softc *sc)
 {
 	struct smb sb;
@@ -2876,14 +2857,14 @@ ale_init_locked(struct ale_softc *sc)
 	CSR_WRITE_4(sc, ALE_INTR_STATUS, 0xFFFFFFFF);
 	CSR_WRITE_4(sc, ALE_INTR_STATUS, 0);
 
+	ifp->if_drv_flags |= IFF_DRV_RUNNING;
+	ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
+
 	sc->ale_flags &= ~ALE_FLAG_LINK;
 	/* Switch to the current media. */
 	mii_mediachg(mii);
 
 	callout_reset(&sc->ale_tick_ch, hz, ale_tick, sc);
-
-	ifp->if_drv_flags |= IFF_DRV_RUNNING;
-	ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
 }
 
 static void

Modified: head/sys/dev/ale/if_alevar.h
==============================================================================
--- head/sys/dev/ale/if_alevar.h	Thu Mar 29 23:59:02 2012	(r233687)
+++ head/sys/dev/ale/if_alevar.h	Fri Mar 30 04:46:39 2012	(r233688)
@@ -221,7 +221,6 @@ struct ale_softc {
 	int			ale_pagesize;
 
 	struct task		ale_int_task;
-	struct task		ale_link_task;
 	struct taskqueue	*ale_tq;
 	struct mtx		ale_mtx;
 };

From owner-svn-src-head@FreeBSD.ORG  Fri Mar 30 05:27:06 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 86C57106566C;
	Fri, 30 Mar 2012 05:27:06 +0000 (UTC)
	(envelope-from yongari@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 714F78FC12;
	Fri, 30 Mar 2012 05:27:06 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2U5R6Yv026366;
	Fri, 30 Mar 2012 05:27:06 GMT (envelope-from yongari@svn.freebsd.org)
Received: (from yongari@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2U5R64X026364;
	Fri, 30 Mar 2012 05:27:06 GMT (envelope-from yongari@svn.freebsd.org)
Message-Id: <201203300527.q2U5R64X026364@svn.freebsd.org>
From: Pyun YongHyeon 
Date: Fri, 30 Mar 2012 05:27:06 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233689 - head/sys/dev/ale
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 30 Mar 2012 05:27:06 -0000

Author: yongari
Date: Fri Mar 30 05:27:05 2012
New Revision: 233689
URL: http://svn.freebsd.org/changeset/base/233689

Log:
  Do not report current link status if driver is not running.
  This change also workarounds dhclient's link state handling bug by
  not giving current link status.
  
  Unlike other controllers, ale(4)'s PHY hibernation perfectly works
  such that driver does not see a valid link if the controller is not
  brought up.  If dhclient(8) runs on ale(4) it will blindly waits
  until link UP and then gives up after 10 seconds.  Because
  dhclient(8) still thinks interface got a valid link when IFM_AVALID
  is not set for selected media,  this change makes dhclient initiate
  DHCP without waiting for link UP.

Modified:
  head/sys/dev/ale/if_ale.c

Modified: head/sys/dev/ale/if_ale.c
==============================================================================
--- head/sys/dev/ale/if_ale.c	Fri Mar 30 04:46:39 2012	(r233688)
+++ head/sys/dev/ale/if_ale.c	Fri Mar 30 05:27:05 2012	(r233689)
@@ -301,6 +301,10 @@ ale_mediastatus(struct ifnet *ifp, struc
 
 	sc = ifp->if_softc;
 	ALE_LOCK(sc);
+	if ((ifp->if_flags & IFF_UP) == 0) {
+		ALE_UNLOCK(sc);
+		return;
+	}
 	mii = device_get_softc(sc->ale_miibus);
 
 	mii_pollstat(mii);

From owner-svn-src-head@FreeBSD.ORG  Fri Mar 30 05:40:27 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 05343106566C;
	Fri, 30 Mar 2012 05:40:27 +0000 (UTC)
	(envelope-from davidxu@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id E24688FC08;
	Fri, 30 Mar 2012 05:40:26 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2U5eQ8s026813;
	Fri, 30 Mar 2012 05:40:26 GMT (envelope-from davidxu@svn.freebsd.org)
Received: (from davidxu@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2U5eQWB026811;
	Fri, 30 Mar 2012 05:40:26 GMT (envelope-from davidxu@svn.freebsd.org)
Message-Id: <201203300540.q2U5eQWB026811@svn.freebsd.org>
From: David Xu 
Date: Fri, 30 Mar 2012 05:40:26 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233690 - head/sys/kern
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 30 Mar 2012 05:40:27 -0000

Author: davidxu
Date: Fri Mar 30 05:40:26 2012
New Revision: 233690
URL: http://svn.freebsd.org/changeset/base/233690

Log:
  Merge umtxq_sleep and umtxq_nanosleep into a single function by using
  an abs_timeout structure which describes timeout info.

Modified:
  head/sys/kern/kern_umtx.c

Modified: head/sys/kern/kern_umtx.c
==============================================================================
--- head/sys/kern/kern_umtx.c	Fri Mar 30 05:27:05 2012	(r233689)
+++ head/sys/kern/kern_umtx.c	Fri Mar 30 05:40:26 2012	(r233690)
@@ -187,6 +187,12 @@ struct umtxq_chain {
 
 #define BUSY_SPINS		200
 
+struct abs_timeout {
+	int clockid;
+	struct timespec cur;
+	struct timespec end;
+};
+
 static uma_zone_t		umtx_pi_zone;
 static struct umtxq_chain	umtxq_chains[2][UMTX_CHAINS];
 static MALLOC_DEFINE(M_UMTX, "umtx", "UMTX queue memory");
@@ -211,7 +217,7 @@ static void umtxq_busy(struct umtx_key *
 static void umtxq_unbusy(struct umtx_key *key);
 static void umtxq_insert_queue(struct umtx_q *uq, int q);
 static void umtxq_remove_queue(struct umtx_q *uq, int q);
-static int umtxq_sleep(struct umtx_q *uq, const char *wmesg, int timo);
+static int umtxq_sleep(struct umtx_q *uq, const char *wmesg, struct abs_timeout *);
 static int umtxq_count(struct umtx_key *key);
 static struct umtx_pi *umtx_pi_alloc(int);
 static void umtx_pi_free(struct umtx_pi *pi);
@@ -547,23 +553,84 @@ umtxq_signal_thread(struct umtx_q *uq)
 	wakeup(uq);
 }
 
+static inline int 
+tstohz(const struct timespec *tsp)
+{
+	struct timeval tv;
+
+	TIMESPEC_TO_TIMEVAL(&tv, tsp);
+	return tvtohz(&tv);
+}
+
+static void
+abs_timeout_init(struct abs_timeout *timo, int clockid, int absolute,
+	const struct timespec *timeout)
+{
+
+	timo->clockid = clockid;
+	if (!absolute) {
+		kern_clock_gettime(curthread, clockid, &timo->end);
+		timo->cur = timo->end;
+		timespecadd(&timo->end, timeout);
+	} else {
+		timo->end = *timeout;
+		kern_clock_gettime(curthread, clockid, &timo->cur);
+	}
+}
+
+static void
+abs_timeout_init2(struct abs_timeout *timo, const struct _umtx_time *umtxtime)
+{
+
+	abs_timeout_init(timo, umtxtime->_clockid,
+		(umtxtime->_flags & UMTX_ABSTIME) != 0,
+		&umtxtime->_timeout);
+}
+
+static int
+abs_timeout_update(struct abs_timeout *timo)
+{
+	kern_clock_gettime(curthread, timo->clockid, &timo->cur);
+	return (timespeccmp(&timo->cur, &timo->end, >=));
+}
+
+static int
+abs_timeout_gethz(struct abs_timeout *timo)
+{
+	struct timespec tts;
+
+	tts = timo->end;
+	timespecsub(&tts, &timo->cur);
+	return (tstohz(&tts));
+}
+
 /*
  * Put thread into sleep state, before sleeping, check if
  * thread was removed from umtx queue.
  */
 static inline int
-umtxq_sleep(struct umtx_q *uq, const char *wmesg, int timo)
+umtxq_sleep(struct umtx_q *uq, const char *wmesg, struct abs_timeout *timo)
 {
 	struct umtxq_chain *uc;
 	int error;
 
 	uc = umtxq_getchain(&uq->uq_key);
 	UMTXQ_LOCKED_ASSERT(uc);
-	if (!(uq->uq_flags & UQF_UMTXQ))
-		return (0);
-	error = msleep(uq, &uc->uc_lock, PCATCH, wmesg, timo);
-	if (error == EWOULDBLOCK)
-		error = ETIMEDOUT;
+	for (;;) {
+		if (!(uq->uq_flags & UQF_UMTXQ))
+			return (0);
+		error = msleep(uq, &uc->uc_lock, PCATCH, wmesg,
+		    timo == NULL ? 0 : abs_timeout_gethz(timo));
+		if (error != EWOULDBLOCK)
+			break;
+		umtxq_unlock(&uq->uq_key);
+		if (abs_timeout_update(timo)) {
+			error = ETIMEDOUT;
+			umtxq_lock(&uq->uq_key);
+			break;
+		}
+		umtxq_lock(&uq->uq_key);
+	}
 	return (error);
 }
 
@@ -627,14 +694,18 @@ umtx_key_release(struct umtx_key *key)
  * Lock a umtx object.
  */
 static int
-_do_lock_umtx(struct thread *td, struct umtx *umtx, u_long id, int timo)
+do_lock_umtx(struct thread *td, struct umtx *umtx, u_long id,
+	const struct timespec *timeout)
 {
+	struct abs_timeout timo;
 	struct umtx_q *uq;
 	u_long owner;
 	u_long old;
 	int error = 0;
 
 	uq = td->td_umtxq;
+	if (timeout != NULL)
+		abs_timeout_init(&timo, CLOCK_REALTIME, 0, timeout);
 
 	/*
 	 * Care must be exercised when dealing with umtx structure. It
@@ -675,7 +746,7 @@ _do_lock_umtx(struct thread *td, struct 
 		 * exit immediately.
 		 */
 		if (error != 0)
-			return (error);
+			break;
 
 		if ((error = umtx_key_get(umtx, TYPE_SIMPLE_LOCK,
 			AUTO_SHARE, &uq->uq_key)) != 0)
@@ -711,48 +782,18 @@ _do_lock_umtx(struct thread *td, struct 
 		 */
 		umtxq_lock(&uq->uq_key);
 		if (old == owner)
-			error = umtxq_sleep(uq, "umtx", timo);
+			error = umtxq_sleep(uq, "umtx", timeout == NULL ? NULL :
+			    &timo);
 		umtxq_remove(uq);
 		umtxq_unlock(&uq->uq_key);
 		umtx_key_release(&uq->uq_key);
 	}
 
-	return (0);
-}
-
-/*
- * Lock a umtx object.
- */
-static int
-do_lock_umtx(struct thread *td, struct umtx *umtx, u_long id,
-	struct timespec *timeout)
-{
-	struct timespec ts, ts2, ts3;
-	struct timeval tv;
-	int error;
-
 	if (timeout == NULL) {
-		error = _do_lock_umtx(td, umtx, id, 0);
 		/* Mutex locking is restarted if it is interrupted. */
 		if (error == EINTR)
 			error = ERESTART;
 	} else {
-		getnanouptime(&ts);
-		timespecadd(&ts, timeout);
-		TIMESPEC_TO_TIMEVAL(&tv, timeout);
-		for (;;) {
-			error = _do_lock_umtx(td, umtx, id, tvtohz(&tv));
-			if (error != ETIMEDOUT)
-				break;
-			getnanouptime(&ts2);
-			if (timespeccmp(&ts2, &ts, >=)) {
-				error = ETIMEDOUT;
-				break;
-			}
-			ts3 = ts;
-			timespecsub(&ts3, &ts2);
-			TIMESPEC_TO_TIMEVAL(&tv, &ts3);
-		}
 		/* Timed-locking is not restarted. */
 		if (error == ERESTART)
 			error = EINTR;
@@ -827,8 +868,10 @@ do_unlock_umtx(struct thread *td, struct
  * Lock a umtx object.
  */
 static int
-_do_lock_umtx32(struct thread *td, uint32_t *m, uint32_t id, int timo)
+do_lock_umtx32(struct thread *td, uint32_t *m, uint32_t id,
+	const struct timespec *timeout)
 {
+	struct abs_timeout timo;
 	struct umtx_q *uq;
 	uint32_t owner;
 	uint32_t old;
@@ -836,6 +879,9 @@ _do_lock_umtx32(struct thread *td, uint3
 
 	uq = td->td_umtxq;
 
+	if (timeout != NULL)
+		abs_timeout_init(&timo, CLOCK_REALTIME, 0, timeout);
+
 	/*
 	 * Care must be exercised when dealing with umtx structure. It
 	 * can fault on any access.
@@ -910,48 +956,18 @@ _do_lock_umtx32(struct thread *td, uint3
 		 */
 		umtxq_lock(&uq->uq_key);
 		if (old == owner)
-			error = umtxq_sleep(uq, "umtx", timo);
+			error = umtxq_sleep(uq, "umtx", timeout == NULL ?
+			    NULL : timo);
 		umtxq_remove(uq);
 		umtxq_unlock(&uq->uq_key);
 		umtx_key_release(&uq->uq_key);
 	}
 
-	return (0);
-}
-
-/*
- * Lock a umtx object.
- */
-static int
-do_lock_umtx32(struct thread *td, void *m, uint32_t id,
-	struct timespec *timeout)
-{
-	struct timespec ts, ts2, ts3;
-	struct timeval tv;
-	int error;
-
 	if (timeout == NULL) {
-		error = _do_lock_umtx32(td, m, id, 0);
 		/* Mutex locking is restarted if it is interrupted. */
 		if (error == EINTR)
 			error = ERESTART;
 	} else {
-		getnanouptime(&ts);
-		timespecadd(&ts, timeout);
-		TIMESPEC_TO_TIMEVAL(&tv, timeout);
-		for (;;) {
-			error = _do_lock_umtx32(td, m, id, tvtohz(&tv));
-			if (error != ETIMEDOUT)
-				break;
-			getnanouptime(&ts2);
-			if (timespeccmp(&ts2, &ts, >=)) {
-				error = ETIMEDOUT;
-				break;
-			}
-			ts3 = ts;
-			timespecsub(&ts3, &ts2);
-			TIMESPEC_TO_TIMEVAL(&tv, &ts3);
-		}
 		/* Timed-locking is not restarted. */
 		if (error == ERESTART)
 			error = EINTR;
@@ -1021,51 +1037,6 @@ do_unlock_umtx32(struct thread *td, uint
 }
 #endif
 
-static inline int 
-tstohz(const struct timespec *tsp)
-{
-	struct timeval tv;
-
-	TIMESPEC_TO_TIMEVAL(&tv, tsp);
-	return tvtohz(&tv);
-}
-
-static int
-umtxq_nanosleep(struct thread *td, int clockid, int absolute,
-	struct timespec *timeout, const char *mesg)
-{
-	struct umtx_q *uq;
-	struct timespec ets, cts, tts;
-	int error;
-
-	uq = td->td_umtxq;
-	umtxq_unlock(&uq->uq_key);
-	if (!absolute) {
-		kern_clock_gettime(td, clockid, &ets);
-		timespecadd(&ets, timeout);
-		tts = *timeout;
-	} else { /* absolute time */
-		ets = *timeout;
-		tts = *timeout;
-		kern_clock_gettime(td, clockid, &cts);
-		timespecsub(&tts, &cts);
-	}
-	umtxq_lock(&uq->uq_key);
-	for (;;) {
-		error = umtxq_sleep(uq, mesg, tstohz(&tts));
-		if (error != ETIMEDOUT)
-			break;
-		kern_clock_gettime(td, clockid, &cts);
-		if (timespeccmp(&cts, &ets, >=)) {
-			error = ETIMEDOUT;
-			break;
-		}
-		tts = ets;
-		timespecsub(&tts, &cts);
-	}
-	return (error);
-}
-
 /*
  * Fetch and compare value, sleep on the address if value is not changed.
  */
@@ -1073,6 +1044,7 @@ static int
 do_wait(struct thread *td, void *addr, u_long id,
 	struct _umtx_time *timeout, int compat32, int is_private)
 {
+	struct abs_timeout timo;
 	struct umtx_q *uq;
 	u_long tmp;
 	int error = 0;
@@ -1082,6 +1054,9 @@ do_wait(struct thread *td, void *addr, u
 		is_private ? THREAD_SHARE : AUTO_SHARE, &uq->uq_key)) != 0)
 		return (error);
 
+	if (timeout != NULL)
+		abs_timeout_init2(&timo, timeout);
+
 	umtxq_lock(&uq->uq_key);
 	umtxq_insert(uq);
 	umtxq_unlock(&uq->uq_key);
@@ -1090,15 +1065,9 @@ do_wait(struct thread *td, void *addr, u
         else
 		tmp = (unsigned int)fuword32(addr);
 	umtxq_lock(&uq->uq_key);
-	if (tmp == id) {
-		if (timeout == NULL)
-			error = umtxq_sleep(uq, "uwait", 0);
-		else
-			error = umtxq_nanosleep(td, timeout->_clockid, 
-		   		((timeout->_flags & UMTX_ABSTIME) != 0),
-				&timeout->_timeout, "uwait");
-	}
-
+	if (tmp == id)
+		error = umtxq_sleep(uq, "uwait", timeout == NULL ?
+		    NULL : &timo);
 	if ((uq->uq_flags & UQF_UMTXQ) == 0)
 		error = 0;
 	else
@@ -1133,9 +1102,10 @@ kern_umtx_wake(struct thread *td, void *
  * Lock PTHREAD_PRIO_NONE protocol POSIX mutex.
  */
 static int
-_do_lock_normal(struct thread *td, struct umutex *m, uint32_t flags, int timo,
-	int mode)
+do_lock_normal(struct thread *td, struct umutex *m, uint32_t flags,
+	struct _umtx_time *timeout, int mode)
 {
+	struct abs_timeout timo;
 	struct umtx_q *uq;
 	uint32_t owner, old, id;
 	int error = 0;
@@ -1143,6 +1113,9 @@ _do_lock_normal(struct thread *td, struc
 	id = td->td_tid;
 	uq = td->td_umtxq;
 
+	if (timeout != NULL)
+		abs_timeout_init2(&timo, timeout);
+
 	/*
 	 * Care must be exercised when dealing with umtx structure. It
 	 * can fault on any access.
@@ -1194,7 +1167,7 @@ _do_lock_normal(struct thread *td, struc
 		 * If we caught a signal, we have retried and now
 		 * exit immediately.
 		 */
-		if (error != 0)
+		if (error != 0) 
 			return (error);
 
 		if ((error = umtx_key_get(m, TYPE_NORMAL_UMUTEX,
@@ -1232,7 +1205,8 @@ _do_lock_normal(struct thread *td, struc
 		umtxq_lock(&uq->uq_key);
 		umtxq_unbusy(&uq->uq_key);
 		if (old == owner)
-			error = umtxq_sleep(uq, "umtxn", timo);
+			error = umtxq_sleep(uq, "umtxn", timeout == NULL ?
+			    NULL : &timo);
 		umtxq_remove(uq);
 		umtxq_unlock(&uq->uq_key);
 		umtx_key_release(&uq->uq_key);
@@ -1574,7 +1548,7 @@ umtx_pi_adjust(struct thread *td, u_char
  */
 static int
 umtxq_sleep_pi(struct umtx_q *uq, struct umtx_pi *pi,
-	uint32_t owner, const char *wmesg, int timo)
+	uint32_t owner, const char *wmesg, struct abs_timeout *timo)
 {
 	struct umtxq_chain *uc;
 	struct thread *td, *td1;
@@ -1620,14 +1594,9 @@ umtxq_sleep_pi(struct umtx_q *uq, struct
 	mtx_unlock_spin(&umtx_lock);
 	umtxq_unbusy(&uq->uq_key);
 
-	if (uq->uq_flags & UQF_UMTXQ) {
-		error = msleep(uq, &uc->uc_lock, PCATCH, wmesg, timo);
-		if (error == EWOULDBLOCK)
-			error = ETIMEDOUT;
-		if (uq->uq_flags & UQF_UMTXQ) {
-			umtxq_remove(uq);
-		}
-	}
+	error = umtxq_sleep(uq, wmesg, timo);
+	umtxq_remove(uq);
+
 	mtx_lock_spin(&umtx_lock);
 	uq->uq_pi_blocked = NULL;
 	thread_lock(td);
@@ -1718,9 +1687,10 @@ umtx_pi_insert(struct umtx_pi *pi)
  * Lock a PI mutex.
  */
 static int
-_do_lock_pi(struct thread *td, struct umutex *m, uint32_t flags, int timo,
-	int try)
+do_lock_pi(struct thread *td, struct umutex *m, uint32_t flags,
+    struct _umtx_time *timeout, int try)
 {
+	struct abs_timeout timo;
 	struct umtx_q *uq;
 	struct umtx_pi *pi, *new_pi;
 	uint32_t id, owner, old;
@@ -1732,6 +1702,10 @@ _do_lock_pi(struct thread *td, struct um
 	if ((error = umtx_key_get(m, TYPE_PI_UMUTEX, GET_SHARE(flags),
 	    &uq->uq_key)) != 0)
 		return (error);
+
+	if (timeout != NULL)
+		abs_timeout_init2(&timo, timeout);
+
 	umtxq_lock(&uq->uq_key);
 	pi = umtx_pi_lookup(&uq->uq_key);
 	if (pi == NULL) {
@@ -1848,7 +1822,7 @@ _do_lock_pi(struct thread *td, struct um
 		 */
 		if (old == owner)
 			error = umtxq_sleep_pi(uq, pi, owner & ~UMUTEX_CONTESTED,
-				 "umtxpi", timo);
+			    "umtxpi", timeout == NULL ? NULL : &timo);
 		else {
 			umtxq_unbusy(&uq->uq_key);
 			umtxq_unlock(&uq->uq_key);
@@ -1967,9 +1941,10 @@ do_unlock_pi(struct thread *td, struct u
  * Lock a PP mutex.
  */
 static int
-_do_lock_pp(struct thread *td, struct umutex *m, uint32_t flags, int timo,
-	int try)
+do_lock_pp(struct thread *td, struct umutex *m, uint32_t flags,
+    struct _umtx_time *timeout, int try)
 {
+	struct abs_timeout timo;
 	struct umtx_q *uq, *uq2;
 	struct umtx_pi *pi;
 	uint32_t ceiling;
@@ -1981,6 +1956,10 @@ _do_lock_pp(struct thread *td, struct um
 	if ((error = umtx_key_get(m, TYPE_PP_UMUTEX, GET_SHARE(flags),
 	    &uq->uq_key)) != 0)
 		return (error);
+
+	if (timeout != NULL)
+		abs_timeout_init2(&timo, timeout);
+
 	su = (priv_check(td, PRIV_SCHED_RTPRIO) == 0);
 	for (;;) {
 		old_inherited_pri = uq->uq_inherited_pri;
@@ -2044,7 +2023,8 @@ _do_lock_pp(struct thread *td, struct um
 		umtxq_lock(&uq->uq_key);
 		umtxq_insert(uq);
 		umtxq_unbusy(&uq->uq_key);
-		error = umtxq_sleep(uq, "umtxpp", timo);
+		error = umtxq_sleep(uq, "umtxpp", timeout == NULL ?
+		    NULL : &timo);
 		umtxq_remove(uq);
 		umtxq_unlock(&uq->uq_key);
 
@@ -2244,7 +2224,7 @@ do_set_ceiling(struct thread *td, struct
 		umtxq_lock(&uq->uq_key);
 		umtxq_insert(uq);
 		umtxq_unbusy(&uq->uq_key);
-		error = umtxq_sleep(uq, "umtxpp", 0);
+		error = umtxq_sleep(uq, "umtxpp", NULL);
 		umtxq_remove(uq);
 		umtxq_unlock(&uq->uq_key);
 	}
@@ -2259,29 +2239,13 @@ do_set_ceiling(struct thread *td, struct
 	return (error);
 }
 
-static int
-_do_lock_umutex(struct thread *td, struct umutex *m, int flags, int timo,
-	int mode)
-{
-	switch(flags & (UMUTEX_PRIO_INHERIT | UMUTEX_PRIO_PROTECT)) {
-	case 0:
-		return (_do_lock_normal(td, m, flags, timo, mode));
-	case UMUTEX_PRIO_INHERIT:
-		return (_do_lock_pi(td, m, flags, timo, mode));
-	case UMUTEX_PRIO_PROTECT:
-		return (_do_lock_pp(td, m, flags, timo, mode));
-	}
-	return (EINVAL);
-}
-
 /*
  * Lock a userland POSIX mutex.
  */
 static int
 do_lock_umutex(struct thread *td, struct umutex *m,
-	struct _umtx_time *timeout, int mode)
+    struct _umtx_time *timeout, int mode)
 {
-	struct timespec cts, ets, tts;
 	uint32_t flags;
 	int error;
 
@@ -2289,32 +2253,23 @@ do_lock_umutex(struct thread *td, struct
 	if (flags == -1)
 		return (EFAULT);
 
+	switch(flags & (UMUTEX_PRIO_INHERIT | UMUTEX_PRIO_PROTECT)) {
+	case 0:
+		error = do_lock_normal(td, m, flags, timeout, mode);
+		break;
+	case UMUTEX_PRIO_INHERIT:
+		error = do_lock_pi(td, m, flags, timeout, mode);
+		break;
+	case UMUTEX_PRIO_PROTECT:
+		error = do_lock_pp(td, m, flags, timeout, mode);
+		break;
+	default:
+		return (EINVAL);
+	}
 	if (timeout == NULL) {
-		error = _do_lock_umutex(td, m, flags, 0, mode);
-		/* Mutex locking is restarted if it is interrupted. */
 		if (error == EINTR && mode != _UMUTEX_WAIT)
 			error = ERESTART;
 	} else {
-		kern_clock_gettime(td, timeout->_clockid, &cts);
-		if ((timeout->_flags & UMTX_ABSTIME) == 0) {
-			ets = cts;
-			timespecadd(&ets, &timeout->_timeout);
-			tts = timeout->_timeout;
-		} else {
-			ets = timeout->_timeout;
-			tts = timeout->_timeout;
-			timespecsub(&tts, &cts);
-		}
-		for (;;) {
-			error = _do_lock_umutex(td, m, flags, tstohz(&tts), mode);
-			if (error != ETIMEDOUT)
-				break;
-			kern_clock_gettime(td, timeout->_clockid, &cts);
-			if (timespeccmp(&cts, &ets, >=))
-				break;
-			tts = ets;
-			timespecsub(&tts, &cts);
-		}
 		/* Timed-locking is not restarted. */
 		if (error == ERESTART)
 			error = EINTR;
@@ -2350,6 +2305,7 @@ static int
 do_cv_wait(struct thread *td, struct ucond *cv, struct umutex *m,
 	struct timespec *timeout, u_long wflags)
 {
+	struct abs_timeout timo;
 	struct umtx_q *uq;
 	uint32_t flags;
 	uint32_t clockid;
@@ -2389,15 +2345,15 @@ do_cv_wait(struct thread *td, struct uco
 	umtxq_unlock(&uq->uq_key);
 
 	error = do_unlock_umutex(td, m);
+
+	if (timeout != NULL);
+		abs_timeout_init(&timo, clockid, ((wflags & CVWAIT_ABSTIME) != 0),
+			timeout);
 	
 	umtxq_lock(&uq->uq_key);
 	if (error == 0) {
-		if (timeout == NULL)
-			error = umtxq_sleep(uq, "ucond", 0);
-		else
-			error = umtxq_nanosleep(td, clockid, 
-			    ((wflags & CVWAIT_ABSTIME) != 0),
-			    timeout, "ucond");
+		error = umtxq_sleep(uq, "ucond", timeout == NULL ?
+		    NULL : &timo);
 	}
 
 	if ((uq->uq_flags & UQF_UMTXQ) == 0)
@@ -2486,8 +2442,9 @@ do_cv_broadcast(struct thread *td, struc
 }
 
 static int
-do_rw_rdlock(struct thread *td, struct urwlock *rwlock, long fflag, int timo)
+do_rw_rdlock(struct thread *td, struct urwlock *rwlock, long fflag, struct _umtx_time *timeout)
 {
+	struct abs_timeout timo;
 	struct umtx_q *uq;
 	uint32_t flags, wrflags;
 	int32_t state, oldstate;
@@ -2500,6 +2457,9 @@ do_rw_rdlock(struct thread *td, struct u
 	if (error != 0)
 		return (error);
 
+	if (timeout != NULL)
+		abs_timeout_init2(&timo, timeout);
+
 	wrflags = URWLOCK_WRITE_OWNER;
 	if (!(fflag & URWLOCK_PREFER_READER) && !(flags & URWLOCK_PREFER_READER))
 		wrflags |= URWLOCK_WRITE_WAITERS;
@@ -2560,7 +2520,8 @@ sleep:
 			umtxq_insert(uq);
 			umtxq_unbusy(&uq->uq_key);
 
-			error = umtxq_sleep(uq, "urdlck", timo);
+			error = umtxq_sleep(uq, "urdlck", timeout == NULL ?
+			    NULL : &timo);
 
 			umtxq_busy(&uq->uq_key);
 			umtxq_remove(uq);
@@ -2589,43 +2550,15 @@ sleep:
 		umtxq_unlock(&uq->uq_key);
 	}
 	umtx_key_release(&uq->uq_key);
-	return (error);
-}
-
-static int
-do_rw_rdlock2(struct thread *td, void *obj, long val, struct _umtx_time *timeout)
-{
-	struct timespec cts, ets, tts;
-	int error;
-
-	kern_clock_gettime(td, timeout->_clockid, &cts);
-	if ((timeout->_flags & UMTX_ABSTIME) == 0) {
-		ets = cts;
-		timespecadd(&ets, &timeout->_timeout);
-		tts = timeout->_timeout;
-	} else {
-		ets = timeout->_timeout;
-		tts = timeout->_timeout;
-		timespecsub(&tts, &cts);
-	}
-	for (;;) {
-		error = do_rw_rdlock(td, obj, val, tstohz(&tts));
-		if (error != ETIMEDOUT)
-			break;
-		kern_clock_gettime(td, timeout->_clockid, &cts);
-		if (timespeccmp(&cts, &ets, >=))
-			break;
-		tts = ets;
-		timespecsub(&tts, &cts);
-	}
 	if (error == ERESTART)
 		error = EINTR;
 	return (error);
 }
 
 static int
-do_rw_wrlock(struct thread *td, struct urwlock *rwlock, int timo)
+do_rw_wrlock(struct thread *td, struct urwlock *rwlock, struct _umtx_time *timeout)
 {
+	struct abs_timeout timo;
 	struct umtx_q *uq;
 	uint32_t flags;
 	int32_t state, oldstate;
@@ -2639,6 +2572,9 @@ do_rw_wrlock(struct thread *td, struct u
 	if (error != 0)
 		return (error);
 
+	if (timeout != NULL)
+		abs_timeout_init2(&timo, timeout);
+
 	blocked_readers = 0;
 	for (;;) {
 		state = fuword32(__DEVOLATILE(int32_t *, &rwlock->rw_state));
@@ -2698,7 +2634,8 @@ sleep:
 			umtxq_insert_queue(uq, UMTX_EXCLUSIVE_QUEUE);
 			umtxq_unbusy(&uq->uq_key);
 
-			error = umtxq_sleep(uq, "uwrlck", timo);
+			error = umtxq_sleep(uq, "uwrlck", timeout == NULL ?
+			    NULL : &timo);
 
 			umtxq_busy(&uq->uq_key);
 			umtxq_remove_queue(uq, UMTX_EXCLUSIVE_QUEUE);
@@ -2729,35 +2666,6 @@ sleep:
 	}
 
 	umtx_key_release(&uq->uq_key);
-	return (error);
-}
-
-static int
-do_rw_wrlock2(struct thread *td, void *obj, struct _umtx_time *timeout)
-{
-	struct timespec cts, ets, tts;
-	int error;
-
-	kern_clock_gettime(td, timeout->_clockid, &cts);
-	if ((timeout->_flags & UMTX_ABSTIME) == 0) {
-		ets = cts;
-		timespecadd(&ets, &timeout->_timeout);
-		tts = timeout->_timeout;
-	} else {
-		ets = timeout->_timeout;
-		tts = timeout->_timeout;
-		timespecsub(&tts, &cts);
-	}
-	for (;;) {
-		error = do_rw_wrlock(td, obj, tstohz(&tts));
-		if (error != ETIMEDOUT)
-			break;
-		kern_clock_gettime(td, timeout->_clockid, &cts);
-		if (timespeccmp(&cts, &ets, >=))
-			break;
-		tts = ets;
-		timespecsub(&tts, &cts);
-	}
 	if (error == ERESTART)
 		error = EINTR;
 	return (error);
@@ -2845,6 +2753,7 @@ out:
 static int
 do_sem_wait(struct thread *td, struct _usem *sem, struct _umtx_time *timeout)
 {
+	struct abs_timeout timo;
 	struct umtx_q *uq;
 	uint32_t flags, count;
 	int error;
@@ -2854,6 +2763,10 @@ do_sem_wait(struct thread *td, struct _u
 	error = umtx_key_get(sem, TYPE_SEM, GET_SHARE(flags), &uq->uq_key);
 	if (error != 0)
 		return (error);
+
+	if (timeout != NULL)
+		abs_timeout_init2(&timo, timeout);
+
 	umtxq_lock(&uq->uq_key);
 	umtxq_busy(&uq->uq_key);
 	umtxq_insert(uq);
@@ -2873,12 +2786,7 @@ do_sem_wait(struct thread *td, struct _u
 	umtxq_lock(&uq->uq_key);
 	umtxq_unbusy(&uq->uq_key);
 
-	if (timeout == NULL)
-		error = umtxq_sleep(uq, "usem", 0);
-	else
-		error = umtxq_nanosleep(td, timeout->_clockid,
-	   	    ((timeout->_flags & UMTX_ABSTIME) != 0),
-		    &timeout->_timeout, "usem");
+	error = umtxq_sleep(uq, "usem", timeout == NULL ? NULL : &timo);
 
 	if ((uq->uq_flags & UQF_UMTXQ) == 0)
 		error = 0;
@@ -2925,7 +2833,7 @@ int
 sys__umtx_lock(struct thread *td, struct _umtx_lock_args *uap)
     /* struct umtx *umtx */
 {
-	return _do_lock_umtx(td, uap->umtx, td->td_tid, 0);
+	return do_lock_umtx(td, uap->umtx, td->td_tid, 0);
 }
 
 int
@@ -3191,7 +3099,7 @@ __umtx_op_rw_rdlock(struct thread *td, s
 		   (size_t)uap->uaddr1, &timeout);
 		if (error != 0)
 			return (error);
-		error = do_rw_rdlock2(td, uap->obj, uap->val, &timeout);
+		error = do_rw_rdlock(td, uap->obj, uap->val, &timeout);
 	}
 	return (error);
 }
@@ -3211,7 +3119,7 @@ __umtx_op_rw_wrlock(struct thread *td, s
 		if (error != 0)
 			return (error);
 
-		error = do_rw_wrlock2(td, uap->obj, &timeout);
+		error = do_rw_wrlock(td, uap->obj, &timeout);
 	}
 	return (error);
 }

From owner-svn-src-head@FreeBSD.ORG  Fri Mar 30 05:49:33 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 26707106564A;
	Fri, 30 Mar 2012 05:49:33 +0000 (UTC)
	(envelope-from davidxu@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 113EC8FC0A;
	Fri, 30 Mar 2012 05:49:33 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2U5nWX1027135;
	Fri, 30 Mar 2012 05:49:32 GMT (envelope-from davidxu@svn.freebsd.org)
Received: (from davidxu@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2U5nW6f027133;
	Fri, 30 Mar 2012 05:49:32 GMT (envelope-from davidxu@svn.freebsd.org)
Message-Id: <201203300549.q2U5nW6f027133@svn.freebsd.org>
From: David Xu 
Date: Fri, 30 Mar 2012 05:49:32 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233691 - head/sys/kern
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 30 Mar 2012 05:49:33 -0000

Author: davidxu
Date: Fri Mar 30 05:49:32 2012
New Revision: 233691
URL: http://svn.freebsd.org/changeset/base/233691

Log:
  Remove trailing space.

Modified:
  head/sys/kern/kern_umtx.c

Modified: head/sys/kern/kern_umtx.c
==============================================================================
--- head/sys/kern/kern_umtx.c	Fri Mar 30 05:40:26 2012	(r233690)
+++ head/sys/kern/kern_umtx.c	Fri Mar 30 05:49:32 2012	(r233691)
@@ -1167,7 +1167,7 @@ do_lock_normal(struct thread *td, struct
 		 * If we caught a signal, we have retried and now
 		 * exit immediately.
 		 */
-		if (error != 0) 
+		if (error != 0)
 			return (error);
 
 		if ((error = umtx_key_get(m, TYPE_NORMAL_UMUTEX,

From owner-svn-src-head@FreeBSD.ORG  Fri Mar 30 08:25:35 2012
Return-Path: 
Delivered-To: svn-src-head@FreeBSD.ORG
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id B2C0B106566C;
	Fri, 30 Mar 2012 08:25:35 +0000 (UTC) (envelope-from ache@vniz.net)
Received: from vniz.net (vniz.net [194.87.13.69])
	by mx1.freebsd.org (Postfix) with ESMTP id CFABE8FC1A;
	Fri, 30 Mar 2012 08:25:31 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
	by vniz.net (8.14.5/8.14.5) with ESMTP id q2U8PT7i047248;
	Fri, 30 Mar 2012 12:25:29 +0400 (MSK) (envelope-from ache@vniz.net)
Received: (from ache@localhost)
	by localhost (8.14.5/8.14.5/Submit) id q2U8PTuG047247;
	Fri, 30 Mar 2012 12:25:29 +0400 (MSK) (envelope-from ache)
Date: Fri, 30 Mar 2012 12:25:28 +0400
From: Andrey Chernov 
To: Dimitry Andric 
Message-ID: <20120330082528.GA47173@vniz.net>
Mail-Followup-To: Andrey Chernov ,
	Dimitry Andric , src-committers@FreeBSD.ORG,
	svn-src-all@FreeBSD.ORG, svn-src-head@FreeBSD.ORG
References: <201203292331.q2TNVmwN014920@svn.freebsd.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <201203292331.q2TNVmwN014920@svn.freebsd.org>
User-Agent: Mutt/1.5.21 (2010-09-15)
Cc: svn-src-head@FreeBSD.ORG, svn-src-all@FreeBSD.ORG,
	src-committers@FreeBSD.ORG
Subject: Re: svn commit: r233684 - head/sys/x86/include
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 30 Mar 2012 08:25:35 -0000

On Thu, Mar 29, 2012 at 11:31:48PM +0000, Dimitry Andric wrote:
>   However, the arguments are not properly masked, which results in the
>   wrong value being calculated in some instances.  For example,
>   bswap32(0x12345678) returns 0x7c563412, and bswap64(0x123456789abcdef0)
>   returns 0xfcdefc9a7c563412.

Is sign extension considered in that place? Shifting any signed value to 
">>" direction (char, short, int, etc.) replicates sign bit, so cast to 
corresponding unsigned value must be done first, which may take less 
instructions, than masking (I am not sure about this part, just 
guessing). Casting in that case applies to the argument (x) not to result 
(x >> YY).

>  
>  #define	__bswap16_gen(x)	(__uint16_t)((x) << 8 | (x) >> 8)
>  #define	__bswap32_gen(x)		\
> -	(((__uint32_t)__bswap16(x) << 16) | __bswap16((x) >> 16))
> +	(((__uint32_t)__bswap16((x) & 0xffff) << 16) | __bswap16((x) >> 16))
>  #define	__bswap64_gen(x)		\
> -	(((__uint64_t)__bswap32(x) << 32) | __bswap32((x) >> 32))
> +	(((__uint64_t)__bswap32((x) & 0xffffffff) << 32) | __bswap32((x) >> 32))
>  
>  #ifdef __GNUCLIKE_BUILTIN_CONSTANT_P
>  #define	__bswap16(x)				\


-- 
http://ache.vniz.net/

From owner-svn-src-head@FreeBSD.ORG  Fri Mar 30 08:33:08 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id CB095106564A;
	Fri, 30 Mar 2012 08:33:08 +0000 (UTC) (envelope-from mav@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id B603B8FC08;
	Fri, 30 Mar 2012 08:33:08 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2U8X8It032243;
	Fri, 30 Mar 2012 08:33:08 GMT (envelope-from mav@svn.freebsd.org)
Received: (from mav@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2U8X8qM032241;
	Fri, 30 Mar 2012 08:33:08 GMT (envelope-from mav@svn.freebsd.org)
Message-Id: <201203300833.q2U8X8qM032241@svn.freebsd.org>
From: Alexander Motin 
Date: Fri, 30 Mar 2012 08:33:08 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233692 - head/sys/dev/sound/pci/hda
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 30 Mar 2012 08:33:08 -0000

Author: mav
Date: Fri Mar 30 08:33:08 2012
New Revision: 233692
URL: http://svn.freebsd.org/changeset/base/233692

Log:
  Reenable unsolicited responses on CODEC if hdaa_sense_init() called again.
  This fixes jack connection events handling after suspend/resume.
  
  PR:		kern/166382
  MFC after:	1 week

Modified:
  head/sys/dev/sound/pci/hda/hdaa.c

Modified: head/sys/dev/sound/pci/hda/hdaa.c
==============================================================================
--- head/sys/dev/sound/pci/hda/hdaa.c	Fri Mar 30 05:49:32 2012	(r233691)
+++ head/sys/dev/sound/pci/hda/hdaa.c	Fri Mar 30 08:33:08 2012	(r233692)
@@ -612,10 +612,11 @@ hdaa_sense_init(struct hdaa_devinfo *dev
 		if (w == NULL || w->enable == 0 || w->type !=
 		    HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_PIN_COMPLEX)
 			continue;
-		if (HDA_PARAM_AUDIO_WIDGET_CAP_UNSOL_CAP(w->param.widget_cap) &&
-		    w->unsol < 0) {
-			w->unsol = HDAC_UNSOL_ALLOC(
-			    device_get_parent(devinfo->dev), devinfo->dev, w->nid);
+		if (HDA_PARAM_AUDIO_WIDGET_CAP_UNSOL_CAP(w->param.widget_cap)) {
+			if (w->unsol < 0)
+				w->unsol = HDAC_UNSOL_ALLOC(
+				    device_get_parent(devinfo->dev),
+				    devinfo->dev, w->nid);
 			hda_command(devinfo->dev,
 			    HDA_CMD_SET_UNSOLICITED_RESPONSE(0, w->nid,
 			    HDA_CMD_SET_UNSOLICITED_RESPONSE_ENABLE | w->unsol));

From owner-svn-src-head@FreeBSD.ORG  Fri Mar 30 09:03:54 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 3B8121065676;
	Fri, 30 Mar 2012 09:03:54 +0000 (UTC)
	(envelope-from davidxu@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 262C18FC12;
	Fri, 30 Mar 2012 09:03:54 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2U93si6033215;
	Fri, 30 Mar 2012 09:03:54 GMT (envelope-from davidxu@svn.freebsd.org)
Received: (from davidxu@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2U93rda033213;
	Fri, 30 Mar 2012 09:03:53 GMT (envelope-from davidxu@svn.freebsd.org)
Message-Id: <201203300903.q2U93rda033213@svn.freebsd.org>
From: David Xu 
Date: Fri, 30 Mar 2012 09:03:53 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233693 - head/sys/kern
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 30 Mar 2012 09:03:54 -0000

Author: davidxu
Date: Fri Mar 30 09:03:53 2012
New Revision: 233693
URL: http://svn.freebsd.org/changeset/base/233693

Log:
  Fix COMPAT_FREEBSD32 build.
  
  Submitted by: Andreas Tobler < andreast at fgznet dot ch >

Modified:
  head/sys/kern/kern_umtx.c

Modified: head/sys/kern/kern_umtx.c
==============================================================================
--- head/sys/kern/kern_umtx.c	Fri Mar 30 08:33:08 2012	(r233692)
+++ head/sys/kern/kern_umtx.c	Fri Mar 30 09:03:53 2012	(r233693)
@@ -957,7 +957,7 @@ do_lock_umtx32(struct thread *td, uint32
 		umtxq_lock(&uq->uq_key);
 		if (old == owner)
 			error = umtxq_sleep(uq, "umtx", timeout == NULL ?
-			    NULL : timo);
+			    NULL : &timo);
 		umtxq_remove(uq);
 		umtxq_unlock(&uq->uq_key);
 		umtx_key_release(&uq->uq_key);
@@ -3372,7 +3372,7 @@ __umtx_op_rw_rdlock_compat32(struct thre
 		    (size_t)uap->uaddr1, &timeout);
 		if (error != 0)
 			return (error);
-		error = do_rw_rdlock2(td, uap->obj, uap->val, &timeout);
+		error = do_rw_rdlock(td, uap->obj, uap->val, &timeout);
 	}
 	return (error);
 }
@@ -3391,7 +3391,7 @@ __umtx_op_rw_wrlock_compat32(struct thre
 		    (size_t)uap->uaddr1, &timeout);
 		if (error != 0)
 			return (error);
-		error = do_rw_wrlock2(td, uap->obj, &timeout);
+		error = do_rw_wrlock(td, uap->obj, &timeout);
 	}
 	return (error);
 }

From owner-svn-src-head@FreeBSD.ORG  Fri Mar 30 10:24:58 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 55DDE106566B;
	Fri, 30 Mar 2012 10:24:58 +0000 (UTC)
	(envelope-from kostikbel@gmail.com)
Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200])
	by mx1.freebsd.org (Postfix) with ESMTP id 874F18FC0A;
	Fri, 30 Mar 2012 10:24:56 +0000 (UTC)
Received: from skuns.kiev.zoral.com.ua (localhost [127.0.0.1])
	by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id q2UAOlxT003151;
	Fri, 30 Mar 2012 13:24:47 +0300 (EEST)
	(envelope-from kostikbel@gmail.com)
Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1])
	by deviant.kiev.zoral.com.ua (8.14.5/8.14.5) with ESMTP id
	q2UAOkvI012694; Fri, 30 Mar 2012 13:24:46 +0300 (EEST)
	(envelope-from kostikbel@gmail.com)
Received: (from kostik@localhost)
	by deviant.kiev.zoral.com.ua (8.14.5/8.14.5/Submit) id q2UAOk4g012693; 
	Fri, 30 Mar 2012 13:24:46 +0300 (EEST)
	(envelope-from kostikbel@gmail.com)
X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to
	kostikbel@gmail.com using -f
Date: Fri, 30 Mar 2012 13:24:46 +0300
From: Konstantin Belousov 
To: ia64@freebsd.org
Message-ID: <20120330102446.GF2358@deviant.kiev.zoral.com.ua>
References: <201203291750.q2THo1Pu003875@svn.freebsd.org>
	<20120329181125.GB2358@deviant.kiev.zoral.com.ua>
Mime-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha1;
	protocol="application/pgp-signature"; boundary="PTB34xPa4pLPpogV"
Content-Disposition: inline
In-Reply-To: <20120329181125.GB2358@deviant.kiev.zoral.com.ua>
User-Agent: Mutt/1.4.2.3i
X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua
X-Virus-Status: Clean
X-Spam-Status: No, score=-4.0 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00
	autolearn=ham version=3.2.5
X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on
	skuns.kiev.zoral.com.ua
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r233674 - head/libexec/rtld-elf
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 30 Mar 2012 10:24:58 -0000


--PTB34xPa4pLPpogV
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Thu, Mar 29, 2012 at 09:11:25PM +0300, Konstantin Belousov wrote:
> On Thu, Mar 29, 2012 at 05:50:01PM +0000, Konstantin Belousov wrote:
> > Author: kib
> > Date: Thu Mar 29 17:50:01 2012
> > New Revision: 233674
> > URL: http://svn.freebsd.org/changeset/base/233674
> >=20
> > Log:
> >   Fix ia64 build after r233655.
> >  =20
> >   MFC after:	1 week
> >=20
> > Modified:
> >   head/libexec/rtld-elf/rtld.c
> >=20
> > Modified: head/libexec/rtld-elf/rtld.c
> > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D
> > --- head/libexec/rtld-elf/rtld.c	Thu Mar 29 17:39:18 2012	(r233673)
> > +++ head/libexec/rtld-elf/rtld.c	Thu Mar 29 17:50:01 2012	(r233674)
> > @@ -2618,7 +2618,9 @@ do_dlsym(void *handle, const char *name,
> >      const Elf_Sym *def;
> >      SymLook req;
> >      RtldLockState lockstate;
> > +#ifndef __ia64__
> >      tls_index ti;
> > +#endif
> >      int res;
> > =20
> >      def =3D NULL;
> > @@ -2734,9 +2736,13 @@ do_dlsym(void *handle, const char *name,
> >  	else if (ELF_ST_TYPE(def->st_info) =3D=3D STT_GNU_IFUNC)
> >  	    return (rtld_resolve_ifunc(defobj, def));
> >  	else if (ELF_ST_TYPE(def->st_info) =3D=3D STT_TLS) {
> > +#ifdef __ia64__
> > +	    return (__tls_get_addr(defobj->tlsindex, def->st_value));
> > +#else
> >  	    ti.ti_module =3D defobj->tlsindex;
> >  	    ti.ti_offset =3D def->st_value;
> >  	    return (__tls_get_addr(&ti));
> > +#endif
> >  	} else
> >  	    return (defobj->relocbase + def->st_value);
> >      }
> While this band-aid fixes the build, the change is obviously bad.
> The reason to have this #ifdef is that ia64 is the only architecture
> that declares __tls_get_addr() as
>=20
> void *__tls_get_addr(unsigned long module, unsigned long offset);
>=20
> while all other architectures do
>=20
> typedef struct {
>     unsigned long ti_module;
>     unsigned long ti_offset;
> } tls_index;
> void *__tls_get_addr(tls_index *ti);
>=20
> But e.g. on amd64 the ABI of both declarations is the same. From my
> cursory look at ia64 ABI document, the same hold for ia64.
Answering my own question, no, it is not the same ABI on amd64.
It would be if __tls_get_addr() took tls_index, and not pointer to
tls_index. This is the part which I missed.

It is indeed the same ABI on ia64, but due to different calling conventions
(pass by value on ia64 vs. pointer to structure on everything else) the
patch below cannot work.

Sorry for the noise.
>=20
> Can anybody with ia64 clue and test machine confirm that the following
> works, i.e. ABI is not broken ?
>=20
> diff --git a/libexec/rtld-elf/ia64/reloc.c b/libexec/rtld-elf/ia64/reloc.c
> index 01e20b8..31319f3 100644
> --- a/libexec/rtld-elf/ia64/reloc.c
> +++ b/libexec/rtld-elf/ia64/reloc.c
> @@ -650,9 +650,9 @@ allocate_initial_tls(Obj_Entry *list)
>      __asm __volatile("mov r13 =3D %0" :: "r"(tpval));
>  }
> =20
> -void *__tls_get_addr(unsigned long module, unsigned long offset)
> +void *__tls_get_addr(tls_index *ti)
>  {
>      register Elf_Addr** tp __asm__("r13");
> =20
> -    return tls_get_addr_common(tp, module, offset);
> +    return tls_get_addr_common(tp, ti->ti_module, ti->ti_offset);
>  }
> diff --git a/libexec/rtld-elf/ia64/rtld_machdep.h b/libexec/rtld-elf/ia64=
/rtld_machdep.h
> index 4a68ff7..df877f2 100644
> --- a/libexec/rtld-elf/ia64/rtld_machdep.h
> +++ b/libexec/rtld-elf/ia64/rtld_machdep.h
> @@ -64,7 +64,12 @@ void call_init_pointer(const struct Struct_Obj_Entry *=
, Elf_Addr);
>  	round(prev_offset + prev_size, align)
>  #define calculate_tls_end(off, size) 	((off) + (size))
> =20
> -extern void *__tls_get_addr(unsigned long module, unsigned long offset);
> +typedef struct {
> +    unsigned long ti_module;
> +    unsigned long ti_offset;
> +} tls_index;
> +
> +extern void *__tls_get_addr(tls_index *ti);
> =20
>  #define	RTLD_DEFAULT_STACK_PF_EXEC	0
>  #define	RTLD_DEFAULT_STACK_EXEC		0
> diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c
> index d3ce3c6..828b8b4 100644
> --- a/libexec/rtld-elf/rtld.c
> +++ b/libexec/rtld-elf/rtld.c
> @@ -2618,9 +2618,7 @@ do_dlsym(void *handle, const char *name, void *reta=
ddr, const Ver_Entry *ve,
>      const Elf_Sym *def;
>      SymLook req;
>      RtldLockState lockstate;
> -#ifndef __ia64__
>      tls_index ti;
> -#endif
>      int res;
> =20
>      def =3D NULL;
> @@ -2736,13 +2734,9 @@ do_dlsym(void *handle, const char *name, void *ret=
addr, const Ver_Entry *ve,
>  	else if (ELF_ST_TYPE(def->st_info) =3D=3D STT_GNU_IFUNC)
>  	    return (rtld_resolve_ifunc(defobj, def));
>  	else if (ELF_ST_TYPE(def->st_info) =3D=3D STT_TLS) {
> -#ifdef __ia64__
> -	    return (__tls_get_addr(defobj->tlsindex, def->st_value));
> -#else
>  	    ti.ti_module =3D defobj->tlsindex;
>  	    ti.ti_offset =3D def->st_value;
>  	    return (__tls_get_addr(&ti));
> -#endif
>  	} else
>  	    return (defobj->relocbase + def->st_value);
>      }



--PTB34xPa4pLPpogV
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (FreeBSD)

iEYEARECAAYFAk91ie4ACgkQC3+MBN1Mb4gNDgCglpceGqsElMwUlWjHlwOxSkBa
u+4AoJVZmVTqHeEQZ6dDbS/t2GcWc9SN
=rZYw
-----END PGP SIGNATURE-----

--PTB34xPa4pLPpogV--

From owner-svn-src-head@FreeBSD.ORG  Fri Mar 30 10:25:42 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 26494106564A;
	Fri, 30 Mar 2012 10:25:42 +0000 (UTC)
	(envelope-from brde@optusnet.com.au)
Received: from mail04.syd.optusnet.com.au (mail04.syd.optusnet.com.au
	[211.29.132.185])
	by mx1.freebsd.org (Postfix) with ESMTP id 6A3228FC1E;
	Fri, 30 Mar 2012 10:25:40 +0000 (UTC)
Received: from c211-30-171-136.carlnfd1.nsw.optusnet.com.au
	(c211-30-171-136.carlnfd1.nsw.optusnet.com.au [211.30.171.136])
	by mail04.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id
	q2UAPc3T018733
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO);
	Fri, 30 Mar 2012 21:25:39 +1100
Date: Fri, 30 Mar 2012 21:25:38 +1100 (EST)
From: Bruce Evans 
X-X-Sender: bde@besplex.bde.org
To: Dimitry Andric 
In-Reply-To: <201203292330.q2TNUHbu014843@svn.freebsd.org>
Message-ID: <20120330211008.K1071@besplex.bde.org>
References: <201203292330.q2TNUHbu014843@svn.freebsd.org>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r233683 - head/sys/x86/include
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 30 Mar 2012 10:25:42 -0000

On Thu, 29 Mar 2012, Dimitry Andric wrote:

> Log:
>  Revert sys/x86/include/endian.h to what it was before r233419, as that
>  revision has two problems:
>  - It can produce worse code with both clang and gcc.
>  - It doesn't fix the actual issue introduced in r232721, which will be
>    fixed in the next commit.
>
>  Submitted by:	bde, tijl and jh
>  Pointy hat to:	dim

Thanks.  I didn't know that there was an actualy bug to be fixed...

> Modified:
>  head/sys/x86/include/endian.h
>
> Modified: head/sys/x86/include/endian.h
> ==============================================================================
> --- head/sys/x86/include/endian.h	Thu Mar 29 21:54:19 2012	(r233682)
> +++ head/sys/x86/include/endian.h	Thu Mar 29 23:30:17 2012	(r233683)
> @@ -63,11 +63,11 @@
> #define	BYTE_ORDER	_BYTE_ORDER
> #endif
>
> -#define	__bswap16_gen(x)	((__uint16_t)((x) << 8 | (x) >> 8))
> +#define	__bswap16_gen(x)	(__uint16_t)((x) << 8 | (x) >> 8)
> #define	__bswap32_gen(x)		\
> -	(((__uint32_t)__bswap16_gen(x) << 16) | __bswap16_gen((x) >> 16))
> +	(((__uint32_t)__bswap16(x) << 16) | __bswap16((x) >> 16))
> #define	__bswap64_gen(x)		\
> -	(((__uint64_t)__bswap32_gen(x) << 32) | __bswap32_gen((x) >> 32))
> +	(((__uint64_t)__bswap32(x) << 32) | __bswap32((x) >> 32))
>
> #ifdef __GNUCLIKE_BUILTIN_CONSTANT_P
> #define	__bswap16(x)				\
>

... it seems that there was no bug.  After looking at the next commit,
the bug backed out here is now clear, and I don't like the next commit
either (more details on that in a reply to it).  Using the non-generic
versions ensured that there were no extra bits.  In the `const' case,
this is implemented using casts.  But the generic versions don't have
these casts.

Bruce

From owner-svn-src-head@FreeBSD.ORG  Fri Mar 30 12:11:13 2012
Return-Path: 
Delivered-To: svn-src-head@FreeBSD.ORG
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id A5E8F1065670;
	Fri, 30 Mar 2012 12:11:13 +0000 (UTC) (envelope-from dim@FreeBSD.org)
Received: from tensor.andric.com (cl-327.ede-01.nl.sixxs.net
	[IPv6:2001:7b8:2ff:146::2])
	by mx1.freebsd.org (Postfix) with ESMTP id 626C08FC16;
	Fri, 30 Mar 2012 12:11:13 +0000 (UTC)
Received: from [IPv6:2001:7b8:3a7:0:5513:9c82:30fc:da6f] (unknown
	[IPv6:2001:7b8:3a7:0:5513:9c82:30fc:da6f])
	(using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits))
	(No client certificate requested)
	by tensor.andric.com (Postfix) with ESMTPSA id 9042B5C37;
	Fri, 30 Mar 2012 14:11:12 +0200 (CEST)
Message-ID: <4F75A2E9.4040108@FreeBSD.org>
Date: Fri, 30 Mar 2012 14:11:21 +0200
From: Dimitry Andric 
Organization: The FreeBSD Project
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64;
	rv:12.0) Gecko/20120321 Thunderbird/12.0
MIME-Version: 1.0
To: Andrey Chernov , src-committers@FreeBSD.ORG, 
	svn-src-all@FreeBSD.ORG, svn-src-head@FreeBSD.ORG
References: <201203292331.q2TNVmwN014920@svn.freebsd.org>
	<20120330082528.GA47173@vniz.net>
In-Reply-To: <20120330082528.GA47173@vniz.net>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Cc: 
Subject: Re: svn commit: r233684 - head/sys/x86/include
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 30 Mar 2012 12:11:13 -0000

On 2012-03-30 10:25, Andrey Chernov wrote:
> On Thu, Mar 29, 2012 at 11:31:48PM +0000, Dimitry Andric wrote:
>>    However, the arguments are not properly masked, which results in the
>>    wrong value being calculated in some instances.  For example,
>>    bswap32(0x12345678) returns 0x7c563412, and bswap64(0x123456789abcdef0)
>>    returns 0xfcdefc9a7c563412.
>
> Is sign extension considered in that place? Shifting any signed value to
> ">>" direction (char, short, int, etc.) replicates sign bit, so cast to
> corresponding unsigned value must be done first, which may take less
> instructions, than masking (I am not sure about this part, just
> guessing). Casting in that case applies to the argument (x) not to result
> (x>>  YY).

Yes, the arguments are all converted to unsigned types where necessary.
The __bswapXX_gen() macros are only used internally by the __bswapXX()
macros and the __bswapXX_var() inline functions.

In case of the __bswapXX() macros, you can see that the argument to
__bswapXX_gen() is first explicitly cast to an unsigned type, for
example with __bswap32():

#define __bswap32(x)                    \
         (__builtin_constant_p(x) ?      \
             __bswap32_gen((__uint32_t)(x)) : __bswap32_var(x))

Therefore, right shifting will not give any problems.  For the call to
__bswap32_var(), such casting is not needed, since the argument will be
implicitly converted to __uint32_t.

As Bruce has mentioned, you could add more explicit casts and additional
parentheses, but those would be superfluous.

From owner-svn-src-head@FreeBSD.ORG  Fri Mar 30 12:12:01 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 8F9D51065670;
	Fri, 30 Mar 2012 12:12:01 +0000 (UTC)
	(envelope-from brde@optusnet.com.au)
Received: from mail07.syd.optusnet.com.au (mail07.syd.optusnet.com.au
	[211.29.132.188])
	by mx1.freebsd.org (Postfix) with ESMTP id 05C608FC1F;
	Fri, 30 Mar 2012 12:12:00 +0000 (UTC)
Received: from c211-30-171-136.carlnfd1.nsw.optusnet.com.au
	(c211-30-171-136.carlnfd1.nsw.optusnet.com.au [211.30.171.136])
	by mail07.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id
	q2UCBvbw025025
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO);
	Fri, 30 Mar 2012 23:11:58 +1100
Date: Fri, 30 Mar 2012 23:11:57 +1100 (EST)
From: Bruce Evans 
X-X-Sender: bde@besplex.bde.org
To: Dimitry Andric 
In-Reply-To: <201203292331.q2TNVmwN014920@svn.freebsd.org>
Message-ID: <20120330212607.H1071@besplex.bde.org>
References: <201203292331.q2TNVmwN014920@svn.freebsd.org>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org, tijl@freebsd.org
Subject: Re: svn commit: r233684 - head/sys/x86/include
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 30 Mar 2012 12:12:01 -0000

On Thu, 29 Mar 2012, Dimitry Andric wrote:

> Log:
>  Fix an issue introduced in sys/x86/include/endian.h with r232721.  In
>  that revision, the bswapXX_const() macros were renamed to bswapXX_gen().
>
>  Also, bswap64_gen() was implemented as two calls to bswap32(), and
>  similarly, bswap32_gen() as two calls to bswap16().  This mainly helps
>  our base gcc to produce more efficient assembly.
>
>  However, the arguments are not properly masked, which results in the
>  wrong value being calculated in some instances.  For example,
>  bswap32(0x12345678) returns 0x7c563412, and bswap64(0x123456789abcdef0)
>  returns 0xfcdefc9a7c563412.

No, bswap32() and bswap64() were properly masked in r232721, and not only
that, they were cast to the correct type, as required to prevent related
problems when they are used.  It was the next commit, rmumble, that broke
this, by using uncast expressions sub-expressions for bswap32_gen() and
bswap64_gen().

>  Fix this by appropriately masking the arguments to bswap16() in
>  bswap32_gen(), and to bswap32() in bswap64_gen().  This should also
>  silence warnings from clang.

Sorry, this is inappropriate.  It has no effect except to silence the
warnings from clang in a confusing way.

>  Submitted by:	jh
>
> Modified:
>  head/sys/x86/include/endian.h
>
> Modified: head/sys/x86/include/endian.h
> ==============================================================================
> --- head/sys/x86/include/endian.h	Thu Mar 29 23:30:17 2012	(r233683)
> +++ head/sys/x86/include/endian.h	Thu Mar 29 23:31:48 2012	(r233684)
> @@ -65,9 +65,9 @@
>
> #define	__bswap16_gen(x)	(__uint16_t)((x) << 8 | (x) >> 8)
> #define	__bswap32_gen(x)		\
> -	(((__uint32_t)__bswap16(x) << 16) | __bswap16((x) >> 16))
> +	(((__uint32_t)__bswap16((x) & 0xffff) << 16) | __bswap16((x) >> 16))
> #define	__bswap64_gen(x)		\
> -	(((__uint64_t)__bswap32(x) << 32) | __bswap32((x) >> 32))
> +	(((__uint64_t)__bswap32((x) & 0xffffffff) << 32) | __bswap32((x) >> 32))

This has no effect except to make it clear to clang (but not to humans)
that the implicit conversions do the right thing.  It would have worked
around the bug in a previous version and accidentally fixed the warning
in the same way as this version.

For example, consider bswap32(0x12345678).  This becomes __bswap32_gen(
0x12345678) after a null cast of the arg to __uint32_t.  (We don't cast
the result of __bswap32_gen(), and depend on minor magic (mainly on
32-bit ints) for this to be unnecessary.).  The next reduction, for the
correct version which has the above expression without the 0xfff mask, is:

     (((__uint32_t)__bswap16(0x12345678) << 16) | __bswap16(0x12345678 >> 16))

The __bswap16() macros work unsurprisingly (except for the conditional
operator in them!) and give constants of type uint16_t which I denote
by a US suffix.  The result of evaluating them is:

     (((__uint32_t)0x7856US << 16) | 0x3412US)

and the result is the unsurprising 0x78563412.

Note that for the 'gen' part, everything is explicitly cast, as required
for the result to be correct, and there is no reason for clang to warn,
and it doesn't.  However, for the `var' part, clang warns spuriously.
This is a bug in clang, since the `var' part is not even used.
0x12345678 >> 16 is 0x1234 which is representable by __uint16_t, so there
is no warning for it.  However, __bswap16(0x12345678) expands to
essentially:

 	1 ? __bswap16_gen(0x12345678) : __bswap16_var(0x12345678)

Here __bswap16_var() takes a __uint16_t arg, so an implicit value-losing
cast is required to call it.  clang warns about this although
__bswap16_var() is not actually called.

Masking with 0xffff fixes this accidentally by converting 0x12345678
to 0x5678.  Now it is representable as a __uint16_t, so clang doesn't
warn about downcasting it when not-calling __bswap16_var() on it.

A previous version broke the result by changing __bswap16() to
__bswap16_gen().  In the critical expression:

     (((__uint32_t)__bswap16_gen(0x12345678) << 16) | __bswap16_gen(0x12345678 >> 16)),

0x12345678 >> 16 has only 16 bits, so there are no problems with it.  But
in __bswap16_gen(0x12345678), the value has extra bits which the macro
is intentionally designed not to handle (callers are required to pass it
only 16 bits.  Its result is (0x12345678 << 8) | (0x12345678 >> 8) cast
to __uint16_t.  Compilers should warn about the overflow in this.  If
they just shift the bits out, the result is 0x34567800 | 0x00123456 =
0x34567c56 cast down = 0x7c56.  It's surprising that this has only 1
bit incorrect.

Masking with 0xffff fixes this by discarding the extra bits, which gives
the same value although a different type than the unbroken version
(the unbroken version casts the arg to __uint16_t before invoking
__bswap16_gen() although not before invoking __bswap16_var() since it
knows that the prototype will do an implicit cast for the latter and
it doesn't want to know about the clang bug.

>
> #ifdef __GNUCLIKE_BUILTIN_CONSTANT_P
> #define	__bswap16(x)				\
>

The correct fix for working around the clang bugs is as I said before:
cast the arg in the place where there is a problem:

% Index: endian.h
% ===================================================================
% RCS file: /home/ncvs/src/sys/x86/include/endian.h,v
% retrieving revision 1.7
% diff -u -2 -r1.7 endian.h
% --- endian.h	29 Mar 2012 23:31:48 -0000	1.7
% +++ endian.h	30 Mar 2012 11:20:37 -0000
% @@ -66,18 +66,18 @@
%  #define	__bswap16_gen(x)	(__uint16_t)((x) << 8 | (x) >> 8)
%  #define	__bswap32_gen(x)		\
% -	(((__uint32_t)__bswap16((x) & 0xffff) << 16) | __bswap16((x) >> 16))
% +	(((__uint32_t)__bswap16(x) << 16) | __bswap16((x) >> 16))
%  #define	__bswap64_gen(x)		\
% -	(((__uint64_t)__bswap32((x) & 0xffffffff) << 32) | __bswap32((x) >> 32))
% +	(((__uint64_t)__bswap32(x) << 32) | __bswap32((x) >> 32))

Remove accidental fix.

% 
%  #ifdef __GNUCLIKE_BUILTIN_CONSTANT_P
%  #define	__bswap16(x)				\
%  	((__uint16_t)(__builtin_constant_p(x) ?	\
% -	    __bswap16_gen((__uint16_t)(x)) : __bswap16_var(x)))
% +	    __bswap16_gen((__uint16_t)(x)) : __bswap16_var((__uint16_t)(x))))

Don't forget to fix __bswap16() too.  To see the problem without this fix,
try __bswap16(0x123456).  The arg is weird and has more than 16-bits, so
clang warns about downcasting it for not-calling __bswap16_var() on it.

Other weird cases are supposed to be fixed too -- the arg is always cast
down explicitly if it is weird and too wide to start.

%  #define	__bswap32(x)			\
%  	(__builtin_constant_p(x) ?	\
% -	    __bswap32_gen((__uint32_t)(x)) : __bswap32_var(x))
% +	    __bswap32_gen((__uint32_t)(x)) : __bswap32_var((__uint32_t)(x)))
%  #define	__bswap64(x)			\
%  	(__builtin_constant_p(x) ?	\
% -	    __bswap64_gen((__uint64_t)(x)) : __bswap64_var(x))
% +	    __bswap64_gen((__uint64_t)(x)) : __bswap64_var((__uint64_t)(x)))
%  #else
%  /* XXX these are broken for use in static initializers. */

I haven't lloked at tijl's larger rewrite yet.

Bruce

From owner-svn-src-head@FreeBSD.ORG  Fri Mar 30 12:25:17 2012
Return-Path: 
Delivered-To: svn-src-head@FreeBSD.ORG
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id C4A9C1065770;
	Fri, 30 Mar 2012 12:25:17 +0000 (UTC) (envelope-from ache@vniz.net)
Received: from vniz.net (vniz.net [194.87.13.69])
	by mx1.freebsd.org (Postfix) with ESMTP id 30DA78FC34;
	Fri, 30 Mar 2012 12:25:16 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
	by vniz.net (8.14.5/8.14.5) with ESMTP id q2UCPFO8048826;
	Fri, 30 Mar 2012 16:25:15 +0400 (MSK) (envelope-from ache@vniz.net)
Received: (from ache@localhost)
	by localhost (8.14.5/8.14.5/Submit) id q2UCPFo6048825;
	Fri, 30 Mar 2012 16:25:15 +0400 (MSK) (envelope-from ache)
Date: Fri, 30 Mar 2012 16:25:14 +0400
From: Andrey Chernov 
To: Dimitry Andric 
Message-ID: <20120330122514.GA48762@vniz.net>
Mail-Followup-To: Andrey Chernov ,
	Dimitry Andric , src-committers@FreeBSD.ORG,
	svn-src-all@FreeBSD.ORG, svn-src-head@FreeBSD.ORG
References: <201203292331.q2TNVmwN014920@svn.freebsd.org>
	<20120330082528.GA47173@vniz.net> <4F75A2E9.4040108@FreeBSD.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <4F75A2E9.4040108@FreeBSD.org>
User-Agent: Mutt/1.5.21 (2010-09-15)
Cc: svn-src-head@FreeBSD.ORG, svn-src-all@FreeBSD.ORG,
	src-committers@FreeBSD.ORG
Subject: Re: svn commit: r233684 - head/sys/x86/include
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 30 Mar 2012 12:25:18 -0000

On Fri, Mar 30, 2012 at 02:11:21PM +0200, Dimitry Andric wrote:
> In case of the __bswapXX() macros, you can see that the argument to
> __bswapXX_gen() is first explicitly cast to an unsigned type, for
> example with __bswap32():
> 
> #define __bswap32(x)                    \
>          (__builtin_constant_p(x) ?      \
>              __bswap32_gen((__uint32_t)(x)) : __bswap32_var(x))
> 
> Therefore, right shifting will not give any problems.  For the call to
> __bswap32_var(), such casting is not needed, since the argument will be
> implicitly converted to __uint32_t.
> 
> As Bruce has mentioned, you could add more explicit casts and additional
> parentheses, but those would be superfluous.

I mention right shift just as potential problem. I really want to target 
casting vs. masking problem (masking provide more instructions).

bde@ already suggest the same thing I generally mean in more details in 
his recent answer with the patch:

% +         __bswap16_gen((__uint16_t)(x)) : __bswap16_var((__uint16_t)(x))))

-- 
http://ache.vniz.net/

From owner-svn-src-head@FreeBSD.ORG  Fri Mar 30 12:30:37 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 7D955106566C;
	Fri, 30 Mar 2012 12:30:37 +0000 (UTC)
	(envelope-from brde@optusnet.com.au)
Received: from mail15.syd.optusnet.com.au (mail15.syd.optusnet.com.au
	[211.29.132.196])
	by mx1.freebsd.org (Postfix) with ESMTP id 091468FC0A;
	Fri, 30 Mar 2012 12:30:36 +0000 (UTC)
Received: from c211-30-171-136.carlnfd1.nsw.optusnet.com.au
	(c211-30-171-136.carlnfd1.nsw.optusnet.com.au [211.30.171.136])
	by mail15.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id
	q2UCUXDl030124
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO);
	Fri, 30 Mar 2012 23:30:34 +1100
Date: Fri, 30 Mar 2012 23:30:33 +1100 (EST)
From: Bruce Evans 
X-X-Sender: bde@besplex.bde.org
To: Andrey Chernov 
In-Reply-To: <20120330082528.GA47173@vniz.net>
Message-ID: <20120330231216.G1071@besplex.bde.org>
References: <201203292331.q2TNVmwN014920@svn.freebsd.org>
	<20120330082528.GA47173@vniz.net>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org, Dimitry Andric 
Subject: Re: svn commit: r233684 - head/sys/x86/include
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 30 Mar 2012 12:30:37 -0000

On Fri, 30 Mar 2012, Andrey Chernov wrote:

> On Thu, Mar 29, 2012 at 11:31:48PM +0000, Dimitry Andric wrote:
>>   However, the arguments are not properly masked, which results in the
>>   wrong value being calculated in some instances.  For example,
>>   bswap32(0x12345678) returns 0x7c563412, and bswap64(0x123456789abcdef0)
>>   returns 0xfcdefc9a7c563412.
>
> Is sign extension considered in that place? Shifting any signed value to
> ">>" direction (char, short, int, etc.) replicates sign bit, so cast to
> corresponding unsigned value must be done first, which may take less
> instructions, than masking (I am not sure about this part, just
> guessing). Casting in that case applies to the argument (x) not to result
> (x >> YY).

There are lots of casts to uint* which are supposed to be sufficent,
although some shortcuts are taken, especially in the 'gen' macros.
The main thing to watch out for is C90's broken sign "value-preserving"
promotion rule turning unsigned types into signed ones, so that sign
extension bugs may occur later.

>>  #define	__bswap16_gen(x)	(__uint16_t)((x) << 8 | (x) >> 8)

For example, this macro is private, and callers are required to know that
its arg needs to be uint16_t or possibly smaller, and to not forget to
cast to that if necessary.  Then there are no problems evaluating
((x) << 8 | (x) >> 8), but it has type plain int.  But we want the result
to have type uint16_t and cast to that (this cast should probably be in
callers too).  So the plain int doesn't escape, but whenever the uint16_t
is used, it gets promoted to plain int and its users should be careful
with this.

>>  #define	__bswap32_gen(x)		\
>> -	(((__uint32_t)__bswap16(x) << 16) | __bswap16((x) >> 16))
>> +	(((__uint32_t)__bswap16((x) & 0xffff) << 16) | __bswap16((x) >> 16))

Here the cast to uint32_t is because the caller _is_ being careful with this.
If the expression were plain __bswap16((x) << 16, then when __bswap16()
returns 0x8000, the shift gives (plain int)0x80000000 = -0x7fffffff - 1
with 32-bit ints.  This would work in practice on normal 2's complement
machines, but is unportable.

Note that the result of the whole expression is not cast to uint32_t.
We depend on ints being precisely 32 bits, so that the the result of the
expression, which is either plain int or unsigned int (provided that ints
have at least 32 bits with no padding bits), is in fact precisely uint32_t.
This is another reason why casting the result of the gen macros belongs
in callers.  (We mostly don't cast, but use one to cast down the result
of the conditional expression in the 16-bit case after the default
promotions cast up to plain int.  Omitting the corresponding cast for the 
other widths again depends on ints being 32 bits.)

>>  #define	__bswap64_gen(x)		\
>> -	(((__uint64_t)__bswap32(x) << 32) | __bswap32((x) >> 32))
>> +	(((__uint64_t)__bswap32((x) & 0xffffffff) << 32) | __bswap32((x) >> 32))

Now we must cast up for the completely different reason that __bswap32()
returns only uint32_t ints, and with 32 bit ints the implicit upwards
conversion is null, but we need to shift to 64 bits, so we must start with
at least 64 bits.

>>
>>  #ifdef __GNUCLIKE_BUILTIN_CONSTANT_P
>>  #define	__bswap16(x)				\

Bruce

From owner-svn-src-head@FreeBSD.ORG  Fri Mar 30 12:34:35 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 89661106564A;
	Fri, 30 Mar 2012 12:34:35 +0000 (UTC)
	(envelope-from joel@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 72BCB8FC0A;
	Fri, 30 Mar 2012 12:34:35 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2UCYZ6n041169;
	Fri, 30 Mar 2012 12:34:35 GMT (envelope-from joel@svn.freebsd.org)
Received: (from joel@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2UCYZp3041167;
	Fri, 30 Mar 2012 12:34:35 GMT (envelope-from joel@svn.freebsd.org)
Message-Id: <201203301234.q2UCYZp3041167@svn.freebsd.org>
From: Joel Dahl 
Date: Fri, 30 Mar 2012 12:34:35 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233698 - head/lib/libutil
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 30 Mar 2012 12:34:35 -0000

Author: joel (doc committer)
Date: Fri Mar 30 12:34:34 2012
New Revision: 233698
URL: http://svn.freebsd.org/changeset/base/233698

Log:
  mdoc: terminate quoted strings.

Modified:
  head/lib/libutil/login.conf.5

Modified: head/lib/libutil/login.conf.5
==============================================================================
--- head/lib/libutil/login.conf.5	Fri Mar 30 09:38:35 2012	(r233697)
+++ head/lib/libutil/login.conf.5	Fri Mar 30 12:34:34 2012	(r233698)
@@ -226,64 +226,64 @@ See
 for details.
 .It "label	string		Default MAC policy; see"
 .Xr maclabel 7 .
-.It "lang	string		Set $LANG environment variable to the specified value.
-.It "manpath	path		Default search path for manpages.
-.It "nocheckmail	bool	false	Display mail status at login.
-.It "nologin	file		If the file exists it will be displayed and
+.It "lang	string		Set $LANG environment variable to the specified value."
+.It "manpath	path		Default search path for manpages."
+.It "nocheckmail	bool	false	Display mail status at login."
+.It "nologin	file		If the file exists it will be displayed and"
 the login session will be terminated.
-.It "path	path	/bin /usr/bin	Default search path.
-.It "priority	number		Initial priority (nice) level.
-.It "requirehome 	bool	false	Require a valid home directory to login.
-.It "setenv	list		A comma-separated list of environment variables and
+.It "path	path	/bin /usr/bin	Default search path."
+.It "priority	number		Initial priority (nice) level."
+.It "requirehome 	bool	false	Require a valid home directory to login."
+.It "setenv	list		A comma-separated list of environment variables and"
 values to which they are to be set.
-.It "shell	prog		Session shell to execute rather than the
+.It "shell	prog		Session shell to execute rather than the"
 shell specified in the passwd file.
 The SHELL environment variable will
 contain the shell specified in the password file.
-.It "term	string		Default terminal type if not able to determine
+.It "term	string		Default terminal type if not able to determine"
 from other means.
-.It "timezone	string		Default value of $TZ environment variable.
-.It "umask	number	022	Initial umask. Should always have a leading 0 to
+.It "timezone	string		Default value of $TZ environment variable."
+.It "umask	number	022	Initial umask. Should always have a leading 0 to"
 ensure octal interpretation.
-.It "welcome	file	/etc/motd	File containing welcome message.
+.It "welcome	file	/etc/motd	File containing welcome message."
 .El
 .Sh AUTHENTICATION
 .Bl -column passwd_prompt indent indent
-.It Sy "Name	Type	Notes	Description
+.It Sy "Name	Type	Notes	Description"
 .\" .It "approve	program 	Program to approve login.
-.It "copyright	file		File containing additional copyright information
-.It "host.allow	list		List of remote host wildcards from which users in
+.It "copyright	file		File containing additional copyright information"
+.It "host.allow	list		List of remote host wildcards from which users in"
 the class may access.
-.It "host.deny	list		List of remote host wildcards from which users
+.It "host.deny	list		List of remote host wildcards from which users"
 in the class may not access.
-.It "login_prompt	string		The login prompt given by
+.It "login_prompt	string		The login prompt given by"
 .Xr login 1
-.It "login-backoff	number	3	The number of login attempts
+.It "login-backoff	number	3	The number of login attempts"
 allowed before the backoff delay is inserted after each subsequent
 attempt.
 The backoff delay is the number of tries above
 .Em login-backoff
 multiplied by 5 seconds.
-.It "login-retries	number	10	The number of login attempts
+.It "login-retries	number	10	The number of login attempts"
 allowed before the login fails.
-.It "passwd_format	string	md5	The encryption format that new or
+.It "passwd_format	string	md5	The encryption format that new or"
 changed passwords will use.
 Valid values include "des", "md5" and "blf".
 NIS clients using a
 .No non- Ns Fx
 NIS server should probably use "des".
-.It "passwd_prompt	string		The password prompt presented by
+.It "passwd_prompt	string		The password prompt presented by"
 .Xr login 1
-.It "times.allow 	list		List of time periods during which
+.It "times.allow 	list		List of time periods during which"
 logins are allowed.
-.It "times.deny	list		List of time periods during which logins are
+.It "times.deny	list		List of time periods during which logins are"
 disallowed.
-.It "ttys.allow	list		List of ttys and ttygroups which users
+.It "ttys.allow	list		List of ttys and ttygroups which users"
 in the class may use for access.
-.It "ttys.deny	list		List of ttys and ttygroups which users
+.It "ttys.deny	list		List of ttys and ttygroups which users"
 in the class may not use for access.
-.It "warnexpire	time		Advance notice for pending account expiry.
-.It "warnpassword	time		Advance notice for pending password expiry.
+.It "warnexpire	time		Advance notice for pending account expiry."
+.It "warnpassword	time		Advance notice for pending password expiry."
 .\".It "widepasswords	bool	false	Use the wide password format. The wide password
 .\" format allows up to 128 significant characters in the password.
 .El
@@ -388,46 +388,46 @@ The following capabilities are reserved 
 may be supported by third-party software.
 They are not implemented in the base system.
 .Bl -column host.accounted indent indent
-.It Sy "Name	Type	Notes	Description
-.It "accounted	bool	false	Enable session time accounting for all users
+.It Sy "Name	Type	Notes	Description"
+.It "accounted	bool	false	Enable session time accounting for all users"
 in this class.
-.It "auth	list	passwd	Allowed authentication styles.
+.It "auth	list	passwd	Allowed authentication styles."
 The first item is the default style.
-.It "auth-" Ns Ar type Ta "list		Allowed authentication styles for the
+.It "auth-" Ns Ar type Ta "list		Allowed authentication styles for the"
 authentication
 .Ar type .
-.It "autodelete	time		Time after expiry when account is auto-deleted.
-.It "bootfull	bool	false	Enable 'boot only if ttygroup is full' strategy
+.It "autodelete	time		Time after expiry when account is auto-deleted."
+.It "bootfull	bool	false	Enable 'boot only if ttygroup is full' strategy"
 when terminating sessions.
-.It "daytime	time		Maximum login time per day.
-.It "expireperiod	time		Time for expiry allocation.
-.It "graceexpire 	time		Grace days for expired account.
-.It "gracetime	time		Additional grace login time allowed.
-.It "host.accounted	list		List of remote host wildcards from which
+.It "daytime	time		Maximum login time per day."
+.It "expireperiod	time		Time for expiry allocation."
+.It "graceexpire 	time		Grace days for expired account."
+.It "gracetime	time		Additional grace login time allowed."
+.It "host.accounted	list		List of remote host wildcards from which"
 login sessions will be accounted.
-.It "host.exempt 	list		List of remote host wildcards from which
+.It "host.exempt 	list		List of remote host wildcards from which"
 login session accounting is exempted.
-.It "idletime	time		Maximum idle time before logout.
-.It "minpasswordlen	number	6	The minimum length a local
+.It "idletime	time		Maximum idle time before logout."
+.It "minpasswordlen	number	6	The minimum length a local"
 password may be.
-.It "mixpasswordcase	bool	true	Whether
+.It "mixpasswordcase	bool	true	Whether"
 .Xr passwd 1
 will warn the user if an all lower case password is entered.
-.It "monthtime 	time		Maximum login time per month.
-.It "passwordtime	time		Used by
+.It "monthtime 	time		Maximum login time per month."
+.It "passwordtime	time		Used by"
 .Xr passwd 1
 to set next password expiry date.
-.It "refreshtime 	time		New time allowed on account refresh.
-.It "refreshperiod	str		How often account time is refreshed.
-.It "sessiontime 	time		Maximum login time per session.
-.It "sessionlimit	number		Maximum number of concurrent
+.It "refreshtime 	time		New time allowed on account refresh."
+.It "refreshperiod	str		How often account time is refreshed."
+.It "sessiontime 	time		Maximum login time per session."
+.It "sessionlimit	number		Maximum number of concurrent"
 login sessions on ttys in any group.
-.It "ttys.accounted	list		List of ttys and ttygroups for which
+.It "ttys.accounted	list		List of ttys and ttygroups for which"
 login accounting is active.
-.It "ttys.exempt	list		List of ttys and ttygroups for which login accounting
+.It "ttys.exempt	list		List of ttys and ttygroups for which login accounting"
 is exempt.
-.It "warntime	time		Advance notice for pending out-of-time.
-.It "weektime	time		Maximum login time per week.
+.It "warntime	time		Advance notice for pending out-of-time."
+.It "weektime	time		Maximum login time per week."
 .El
 .Pp
 The

From owner-svn-src-head@FreeBSD.ORG  Fri Mar 30 12:48:37 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 57E2A106564A;
	Fri, 30 Mar 2012 12:48:37 +0000 (UTC)
	(envelope-from theraven@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 4284E8FC0C;
	Fri, 30 Mar 2012 12:48:37 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2UCmb6v041693;
	Fri, 30 Mar 2012 12:48:37 GMT
	(envelope-from theraven@svn.freebsd.org)
Received: (from theraven@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2UCmbHT041691;
	Fri, 30 Mar 2012 12:48:37 GMT
	(envelope-from theraven@svn.freebsd.org)
Message-Id: <201203301248.q2UCmbHT041691@svn.freebsd.org>
From: David Chisnall 
Date: Fri, 30 Mar 2012 12:48:37 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233699 - head/contrib/libstdc++/libsupc++
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 30 Mar 2012 12:48:37 -0000

Author: theraven
Date: Fri Mar 30 12:48:36 2012
New Revision: 233699
URL: http://svn.freebsd.org/changeset/base/233699

Log:
  Undo the earlier revert of the ABI change in libsupc++.  On further discussion,
  posting an errata notice with 9.1 is the less painful solution.
  
  Approved by:	dim (mentor)

Modified:
  head/contrib/libstdc++/libsupc++/typeinfo

Modified: head/contrib/libstdc++/libsupc++/typeinfo
==============================================================================
--- head/contrib/libstdc++/libsupc++/typeinfo	Fri Mar 30 12:34:34 2012	(r233698)
+++ head/contrib/libstdc++/libsupc++/typeinfo	Fri Mar 30 12:48:36 2012	(r233699)
@@ -100,6 +100,12 @@ namespace std 
     bool operator!=(const type_info& __arg) const
     { return !operator==(__arg); }
 
+    // Return true if this is a pointer type of some kind
+    virtual bool __is_pointer_p() const;
+
+    // Return true if this is a function type
+    virtual bool __is_function_p() const;
+
     // Try and catch a thrown type. Store an adjusted pointer to the
     // caught type in THR_OBJ. If THR_TYPE is not a pointer type, then
     // THR_OBJ points to the thrown object. If THR_TYPE is a pointer
@@ -113,12 +119,6 @@ namespace std 
     virtual bool __do_upcast(const __cxxabiv1::__class_type_info *__target,
 			     void **__obj_ptr) const;
 
-    // Return true if this is a pointer type of some kind
-    virtual bool __is_pointer_p() const;
-
-    // Return true if this is a function type
-    virtual bool __is_function_p() const;
-
   protected:
     const char *__name;
     

From owner-svn-src-head@FreeBSD.ORG  Fri Mar 30 12:57:15 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 2F77D1065672;
	Fri, 30 Mar 2012 12:57:15 +0000 (UTC)
	(envelope-from davidxu@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 1A4F78FC19;
	Fri, 30 Mar 2012 12:57:15 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2UCvEU6042044;
	Fri, 30 Mar 2012 12:57:14 GMT (envelope-from davidxu@svn.freebsd.org)
Received: (from davidxu@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2UCvE4l042042;
	Fri, 30 Mar 2012 12:57:14 GMT (envelope-from davidxu@svn.freebsd.org)
Message-Id: <201203301257.q2UCvE4l042042@svn.freebsd.org>
From: David Xu 
Date: Fri, 30 Mar 2012 12:57:14 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233700 - head/sys/kern
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 30 Mar 2012 12:57:15 -0000

Author: davidxu
Date: Fri Mar 30 12:57:14 2012
New Revision: 233700
URL: http://svn.freebsd.org/changeset/base/233700

Log:
  Remove trailing semicolon, it is a typo.

Modified:
  head/sys/kern/kern_umtx.c

Modified: head/sys/kern/kern_umtx.c
==============================================================================
--- head/sys/kern/kern_umtx.c	Fri Mar 30 12:48:36 2012	(r233699)
+++ head/sys/kern/kern_umtx.c	Fri Mar 30 12:57:14 2012	(r233700)
@@ -2346,7 +2346,7 @@ do_cv_wait(struct thread *td, struct uco
 
 	error = do_unlock_umutex(td, m);
 
-	if (timeout != NULL);
+	if (timeout != NULL)
 		abs_timeout_init(&timo, clockid, ((wflags & CVWAIT_ABSTIME) != 0),
 			timeout);
 	

From owner-svn-src-head@FreeBSD.ORG  Fri Mar 30 13:30:48 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 5C3331065670;
	Fri, 30 Mar 2012 13:30:48 +0000 (UTC)
	(envelope-from stefan@fafoe.narf.at)
Received: from fep11.mx.upcmail.net (fep11.mx.upcmail.net [62.179.121.31])
	by mx1.freebsd.org (Postfix) with ESMTP id 33D878FC17;
	Fri, 30 Mar 2012 13:30:46 +0000 (UTC)
Received: from edge03.upcmail.net ([192.168.13.238]) by viefep11-int.chello.at
	(InterMail vM.8.01.05.04 201-2260-151-105-20111014) with ESMTP
	id <20120330133045.PMAG993.viefep11-int.chello.at@edge03.upcmail.net>; 
	Fri, 30 Mar 2012 15:30:45 +0200
Received: from mole.fafoe.narf.at ([80.109.55.137])
	by edge03.upcmail.net with edge
	id rpWl1i00f2xdvHc03pWl34; Fri, 30 Mar 2012 15:30:45 +0200
X-SourceIP: 80.109.55.137
Received: by mole.fafoe.narf.at (Postfix, from userid 1001)
	id 56B896D42D; Fri, 30 Mar 2012 15:30:45 +0200 (CEST)
Date: Fri, 30 Mar 2012 15:30:45 +0200
From: Stefan Farfeleder 
To: David Xu 
Message-ID: <20120330133045.GD1423@mole.fafoe.narf.at>
References: <201203301257.q2UCvE4l042042@svn.freebsd.org>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="huq684BweRXVnRxX"
Content-Disposition: inline
In-Reply-To: <201203301257.q2UCvE4l042042@svn.freebsd.org>
User-Agent: Mutt/1.5.21 (2010-09-15)
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r233700 - head/sys/kern
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 30 Mar 2012 13:30:48 -0000


--huq684BweRXVnRxX
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Hi,

here are a few similar cases.

Stefan

--huq684BweRXVnRxX
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment; filename="extra-semicolon-if.diff"

Index: tools/regression/lib/libc/nss/test-gethostby.c
===================================================================
--- tools/regression/lib/libc/nss/test-gethostby.c	(revision 233700)
+++ tools/regression/lib/libc/nss/test-gethostby.c	(working copy)
@@ -109,7 +109,7 @@
 	else {
 		error = 0;
 		he = getipnodebyname(name, af, ipnode_flags, &error);
-		if (he == NULL);
+		if (he == NULL)
 			errno = error;
 	}
 	
Index: cddl/compat/opensolaris/misc/deviceid.c
===================================================================
--- cddl/compat/opensolaris/misc/deviceid.c	(revision 233700)
+++ cddl/compat/opensolaris/misc/deviceid.c	(working copy)
@@ -45,7 +45,7 @@
 		return (EINVAL);
 	}
 	*retminor_name = strdup("");
-	if (*retminor_name == NULL);
+	if (*retminor_name == NULL)
 		return (ENOMEM);
 	return (0);
 }
Index: sys/sparc64/pci/fire.c
===================================================================
--- sys/sparc64/pci/fire.c	(revision 233700)
+++ sys/sparc64/pci/fire.c	(working copy)
@@ -446,7 +446,7 @@
 		    FO_PCI_TLU_CTRL_CFG_MASK) >> FO_PCI_TLU_CTRL_CFG_SHFT;
 		i = sizeof(fire_freq_nak_tmr_thrs) /
 		    sizeof(*fire_freq_nak_tmr_thrs);
-		if (mps >= i);
+		if (mps >= i)
 			mps = i - 1;
 		FIRE_PCI_SET(sc, FO_PCI_LPU_TXLNK_FREQ_LAT_TMR_THRS,
 		    (fire_freq_nak_tmr_thrs[mps][lw] <<
Index: sys/contrib/rdma/rdma_addr.c
===================================================================
--- sys/contrib/rdma/rdma_addr.c	(revision 233700)
+++ sys/contrib/rdma/rdma_addr.c	(working copy)
@@ -172,7 +172,7 @@
 	*dst = *dst_in;
 
 	rtalloc(&iproute);
-	if (iproute.ro_rt == NULL);
+	if (iproute.ro_rt == NULL)
 		return;
 
 	arpresolve(iproute.ro_rt->rt_ifp, iproute.ro_rt, NULL, 
Index: sys/dev/gpio/gpioc.c
===================================================================
--- sys/dev/gpio/gpioc.c	(revision 233700)
+++ sys/dev/gpio/gpioc.c	(working copy)
@@ -102,7 +102,7 @@
 	struct gpioc_softc *sc = device_get_softc(dev);
 	int err;
 
-	if (sc->sc_ctl_dev);
+	if (sc->sc_ctl_dev)
 		destroy_dev(sc->sc_ctl_dev);
 
 	if ((err = bus_generic_detach(dev)) != 0)

--huq684BweRXVnRxX--

From owner-svn-src-head@FreeBSD.ORG  Fri Mar 30 15:08:09 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id E1DC2106564A;
	Fri, 30 Mar 2012 15:08:09 +0000 (UTC)
	(envelope-from marius@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id B3F018FC16;
	Fri, 30 Mar 2012 15:08:09 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2UF89FD046571;
	Fri, 30 Mar 2012 15:08:09 GMT (envelope-from marius@svn.freebsd.org)
Received: (from marius@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2UF89et046568;
	Fri, 30 Mar 2012 15:08:09 GMT (envelope-from marius@svn.freebsd.org)
Message-Id: <201203301508.q2UF89et046568@svn.freebsd.org>
From: Marius Strobl 
Date: Fri, 30 Mar 2012 15:08:09 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233701 - head/sys/sparc64/pci
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 30 Mar 2012 15:08:10 -0000

Author: marius
Date: Fri Mar 30 15:08:09 2012
New Revision: 233701
URL: http://svn.freebsd.org/changeset/base/233701

Log:
  - Remove erroneous trailing semicolon. [1]
  - Correctly determine the maximum payload size for setting the TX link
    frequent NACK latency and replay timer thresholds.
  
  Submitted by:	stefanf [1]
  MFC after:	3 days

Modified:
  head/sys/sparc64/pci/fire.c
  head/sys/sparc64/pci/firereg.h

Modified: head/sys/sparc64/pci/fire.c
==============================================================================
--- head/sys/sparc64/pci/fire.c	Fri Mar 30 12:57:14 2012	(r233700)
+++ head/sys/sparc64/pci/fire.c	Fri Mar 30 15:08:09 2012	(r233701)
@@ -443,10 +443,11 @@ fire_attach(device_t dev)
 			lw = 0;
 		}
 		mps = (FIRE_PCI_READ_8(sc, FO_PCI_TLU_CTRL) &
-		    FO_PCI_TLU_CTRL_CFG_MASK) >> FO_PCI_TLU_CTRL_CFG_SHFT;
+		    FO_PCI_TLU_CTRL_CFG_MPS_MASK) >>
+		    FO_PCI_TLU_CTRL_CFG_MPS_SHFT;
 		i = sizeof(fire_freq_nak_tmr_thrs) /
 		    sizeof(*fire_freq_nak_tmr_thrs);
-		if (mps >= i);
+		if (mps >= i)
 			mps = i - 1;
 		FIRE_PCI_SET(sc, FO_PCI_LPU_TXLNK_FREQ_LAT_TMR_THRS,
 		    (fire_freq_nak_tmr_thrs[mps][lw] <<

Modified: head/sys/sparc64/pci/firereg.h
==============================================================================
--- head/sys/sparc64/pci/firereg.h	Fri Mar 30 12:57:14 2012	(r233700)
+++ head/sys/sparc64/pci/firereg.h	Fri Mar 30 15:08:09 2012	(r233701)
@@ -345,6 +345,13 @@
 #define	FO_PCI_TLU_CTRL_CFG_MASK		0x000000000000ffffULL
 #define	FO_PCI_TLU_CTRL_CFG_SHFT		0
 #define	FO_PCI_TLU_CTRL_CFG_REMAIN_DETECT_QUIET	0x0000000000000100ULL
+#define	FO_PCI_TLU_CTRL_CFG_PAD_LOOPBACK_EN	0x0000000000000080ULL
+#define	FO_PCI_TLU_CTRL_CFG_EWRAP_LOOPBACK_EN	0x0000000000000040ULL
+#define	FO_PCI_TLU_CTRL_CFG_DIGITAL_LOOPBACK_EN	0x0000000000000020ULL
+#define	FO_PCI_TLU_CTRL_CFG_MPS_MASK		0x000000000000001cULL
+#define	FO_PCI_TLU_CTRL_CFG_MPS_SHFT		2
+#define	FO_PCI_TLU_CTRL_CFG_COMMON_CLK_CFG	0x0000000000000002ULL
+#define	FO_PCI_TLU_CTRL_CFG_PORT		0x0000000000000001ULL
 
 /*
  * PCI TLU other event interrupt enable, interrupt status and status clear

From owner-svn-src-head@FreeBSD.ORG  Fri Mar 30 16:32:42 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 0ABD5106566B;
	Fri, 30 Mar 2012 16:32:42 +0000 (UTC)
	(envelope-from jkim@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id EA1198FC1A;
	Fri, 30 Mar 2012 16:32:41 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2UGWfBQ049236;
	Fri, 30 Mar 2012 16:32:41 GMT (envelope-from jkim@svn.freebsd.org)
Received: (from jkim@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2UGWfKB049234;
	Fri, 30 Mar 2012 16:32:41 GMT (envelope-from jkim@svn.freebsd.org)
Message-Id: <201203301632.q2UGWfKB049234@svn.freebsd.org>
From: Jung-uk Kim 
Date: Fri, 30 Mar 2012 16:32:41 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233702 - head/sys/amd64/amd64
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 30 Mar 2012 16:32:42 -0000

Author: jkim
Date: Fri Mar 30 16:32:41 2012
New Revision: 233702
URL: http://svn.freebsd.org/changeset/base/233702

Log:
  Work around Erratum 721 for AMD Family 10h and 12h processors.
  
  "Under a highly specific and detailed set of internal timing conditions,
  the processor may incorrectly update the stack pointer after a long series
  of push and/or near-call instructions, or a long series of pop and/or
  near-return instructions.  The processor must be in 64-bit mode for this
  erratum to occur."
  
  MFC after:	3 days

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

Modified: head/sys/amd64/amd64/initcpu.c
==============================================================================
--- head/sys/amd64/amd64/initcpu.c	Fri Mar 30 15:08:09 2012	(r233701)
+++ head/sys/amd64/amd64/initcpu.c	Fri Mar 30 16:32:41 2012	(r233702)
@@ -79,6 +79,27 @@ SYSCTL_UINT(_hw, OID_AUTO, via_feature_r
 SYSCTL_UINT(_hw, OID_AUTO, via_feature_xcrypt, CTLFLAG_RD,
 	&via_feature_xcrypt, 0, "VIA xcrypt feature available in CPU");
 
+static void
+init_amd(void)
+{
+
+	/*
+	 * Work around Erratum 721 for Family 10h and 12h processors.
+	 * These processors may incorrectly update the stack pointer
+	 * after a long series of push and/or near-call instructions,
+	 * or a long series of pop and/or near-return instructions.
+	 *
+	 * http://support.amd.com/us/Processor_TechDocs/41322_10h_Rev_Gd.pdf
+	 * http://support.amd.com/us/Processor_TechDocs/44739_12h_Rev_Gd.pdf
+	 */
+	switch (CPUID_TO_FAMILY(cpu_id)) {
+	case 0x10:
+	case 0x12:
+		wrmsr(0xc0011029, rdmsr(0xc0011029) | 1);
+		break;
+	}
+}
+
 /*
  * Initialize special VIA features
  */
@@ -135,8 +156,14 @@ initializecpu(void)
 		wrmsr(MSR_EFER, msr);
 		pg_nx = PG_NX;
 	}
-	if (cpu_vendor_id == CPU_VENDOR_CENTAUR)
+	switch (cpu_vendor_id) {
+	case CPU_VENDOR_AMD:
+		init_amd();
+		break;
+	case CPU_VENDOR_CENTAUR:
 		init_via();
+		break;
+	}
 }
 
 void

From owner-svn-src-head@FreeBSD.ORG  Fri Mar 30 17:03:07 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 165F91065670;
	Fri, 30 Mar 2012 17:03:07 +0000 (UTC)
	(envelope-from jkim@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 01AE48FC15;
	Fri, 30 Mar 2012 17:03:07 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2UH36c6050304;
	Fri, 30 Mar 2012 17:03:06 GMT (envelope-from jkim@svn.freebsd.org)
Received: (from jkim@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2UH3603050301;
	Fri, 30 Mar 2012 17:03:06 GMT (envelope-from jkim@svn.freebsd.org)
Message-Id: <201203301703.q2UH3603050301@svn.freebsd.org>
From: Jung-uk Kim 
Date: Fri, 30 Mar 2012 17:03:06 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233704 - in head/sys/amd64: acpica amd64
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 30 Mar 2012 17:03:07 -0000

Author: jkim
Date: Fri Mar 30 17:03:06 2012
New Revision: 233704
URL: http://svn.freebsd.org/changeset/base/233704

Log:
  Re-initialize model-specific MSRs when we resume CPUs.
  
  MFC after:	1 week

Modified:
  head/sys/amd64/acpica/acpi_wakeup.c
  head/sys/amd64/amd64/mp_machdep.c

Modified: head/sys/amd64/acpica/acpi_wakeup.c
==============================================================================
--- head/sys/amd64/acpica/acpi_wakeup.c	Fri Mar 30 16:54:21 2012	(r233703)
+++ head/sys/amd64/acpica/acpi_wakeup.c	Fri Mar 30 17:03:06 2012	(r233704)
@@ -284,6 +284,7 @@ acpi_sleep_machdep(struct acpi_softc *sc
 	} else {
 		pmap_init_pat();
 		load_cr3(susppcbs[0]->pcb_cr3);
+		initializecpu();
 		PCPU_SET(switchtime, 0);
 		PCPU_SET(switchticks, ticks);
 #ifdef SMP

Modified: head/sys/amd64/amd64/mp_machdep.c
==============================================================================
--- head/sys/amd64/amd64/mp_machdep.c	Fri Mar 30 16:54:21 2012	(r233703)
+++ head/sys/amd64/amd64/mp_machdep.c	Fri Mar 30 17:03:06 2012	(r233704)
@@ -1425,6 +1425,7 @@ cpususpend_handler(void)
 	} else {
 		pmap_init_pat();
 		load_cr3(susppcbs[cpu]->pcb_cr3);
+		initializecpu();
 		PCPU_SET(switchtime, 0);
 		PCPU_SET(switchticks, ticks);
 	}

From owner-svn-src-head@FreeBSD.ORG  Fri Mar 30 19:10:15 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 18397106564A;
	Fri, 30 Mar 2012 19:10:15 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id F2ACC8FC17;
	Fri, 30 Mar 2012 19:10:14 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2UJAED1054465;
	Fri, 30 Mar 2012 19:10:14 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2UJAE5q054456;
	Fri, 30 Mar 2012 19:10:14 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <201203301910.q2UJAE5q054456@svn.freebsd.org>
From: John Baldwin 
Date: Fri, 30 Mar 2012 19:10:14 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233707 - in head/sys: amd64/amd64 amd64/include conf
	i386/i386 i386/include i386/xbox pc98/include x86/include
	x86/pci x86/x86
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 30 Mar 2012 19:10:15 -0000

Author: jhb
Date: Fri Mar 30 19:10:14 2012
New Revision: 233707
URL: http://svn.freebsd.org/changeset/base/233707

Log:
  Move the legacy(4) driver to x86.

Added:
  head/sys/x86/include/legacyvar.h
     - copied, changed from r233702, head/sys/amd64/include/legacyvar.h
  head/sys/x86/x86/legacy.c
     - copied, changed from r233702, head/sys/i386/i386/legacy.c
Deleted:
  head/sys/amd64/amd64/legacy.c
  head/sys/amd64/include/legacyvar.h
  head/sys/i386/i386/legacy.c
  head/sys/i386/include/legacyvar.h
  head/sys/pc98/include/legacyvar.h
Modified:
  head/sys/conf/files.amd64
  head/sys/conf/files.i386
  head/sys/conf/files.pc98
  head/sys/i386/xbox/xboxfb.c
  head/sys/x86/pci/pci_bus.c
  head/sys/x86/x86/mptable_pci.c

Modified: head/sys/conf/files.amd64
==============================================================================
--- head/sys/conf/files.amd64	Fri Mar 30 17:38:57 2012	(r233706)
+++ head/sys/conf/files.amd64	Fri Mar 30 19:10:14 2012	(r233707)
@@ -113,7 +113,6 @@ amd64/amd64/identcpu.c		standard
 amd64/amd64/in_cksum.c		optional	inet | inet6
 amd64/amd64/initcpu.c		standard
 amd64/amd64/io.c		optional	io
-amd64/amd64/legacy.c		standard
 amd64/amd64/locore.S		standard	no-obj
 amd64/amd64/machdep.c		standard
 amd64/amd64/mem.c		optional	mem
@@ -477,6 +476,7 @@ x86/x86/busdma_machdep.c	standard
 x86/x86/dump_machdep.c		standard
 x86/x86/intr_machdep.c		standard
 x86/x86/io_apic.c		standard
+x86/x86/legacy.c		standard
 x86/x86/local_apic.c		standard
 x86/x86/mca.c			standard
 x86/x86/mptable.c		optional	mptable

Modified: head/sys/conf/files.i386
==============================================================================
--- head/sys/conf/files.i386	Fri Mar 30 17:38:57 2012	(r233706)
+++ head/sys/conf/files.i386	Fri Mar 30 19:10:14 2012	(r233707)
@@ -408,7 +408,6 @@ i386/i386/in_cksum.c		optional inet | in
 i386/i386/initcpu.c		standard
 i386/i386/io.c			optional io
 i386/i386/k6_mem.c		optional mem
-i386/i386/legacy.c		optional native
 i386/i386/locore.s		optional native	no-obj
 i386/xen/locore.s		optional xen	no-obj
 i386/i386/longrun.c		optional cpu_enable_longrun
@@ -529,6 +528,7 @@ x86/x86/busdma_machdep.c	standard
 x86/x86/dump_machdep.c		standard
 x86/x86/intr_machdep.c		standard
 x86/x86/io_apic.c		optional apic
+x86/x86/legacy.c		optional native
 x86/x86/local_apic.c		optional apic
 x86/x86/mca.c			standard
 x86/x86/mptable.c		optional apic native

Modified: head/sys/conf/files.pc98
==============================================================================
--- head/sys/conf/files.pc98	Fri Mar 30 17:38:57 2012	(r233706)
+++ head/sys/conf/files.pc98	Fri Mar 30 19:10:14 2012	(r233707)
@@ -147,7 +147,6 @@ i386/i386/in_cksum.c		optional inet | in
 i386/i386/initcpu.c		standard
 i386/i386/io.c			optional io
 i386/i386/k6_mem.c		optional mem
-i386/i386/legacy.c		standard
 i386/i386/locore.s		standard	no-obj
 i386/i386/mem.c			optional mem
 i386/i386/minidump_machdep.c	standard
@@ -252,6 +251,7 @@ x86/x86/busdma_machdep.c	standard
 x86/x86/dump_machdep.c		standard
 x86/x86/intr_machdep.c		standard
 x86/x86/io_apic.c		optional apic
+x86/x86/legacy.c		standard
 x86/x86/local_apic.c		optional apic
 x86/x86/mca.c			standard
 x86/x86/mptable.c		optional apic

Modified: head/sys/i386/xbox/xboxfb.c
==============================================================================
--- head/sys/i386/xbox/xboxfb.c	Fri Mar 30 17:38:57 2012	(r233706)
+++ head/sys/i386/xbox/xboxfb.c	Fri Mar 30 19:10:14 2012	(r233707)
@@ -54,7 +54,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 

Copied and modified: head/sys/x86/include/legacyvar.h (from r233702, head/sys/amd64/include/legacyvar.h)
==============================================================================
--- head/sys/amd64/include/legacyvar.h	Fri Mar 30 16:32:41 2012	(r233702, copy source)
+++ head/sys/x86/include/legacyvar.h	Fri Mar 30 19:10:14 2012	(r233707)
@@ -26,8 +26,8 @@
  * $FreeBSD$
  */
 
-#ifndef _MACHINE_LEGACYVAR_H_
-#define	_MACHINE_LEGACYVAR_H_
+#ifndef _X86_LEGACYVAR_H_
+#define	_X86_LEGACYVAR_H_
 
 enum legacy_device_ivars {
 	LEGACY_IVAR_PCIDOMAIN,
@@ -60,4 +60,4 @@ struct resource *legacy_pcib_alloc_resou
 int	legacy_pcib_map_msi(device_t pcib, device_t dev, int irq,
     uint64_t *addr, uint32_t *data);
 
-#endif /* !_MACHINE_LEGACYVAR_H_ */
+#endif /* !_X86_LEGACYVAR_H_ */

Modified: head/sys/x86/pci/pci_bus.c
==============================================================================
--- head/sys/x86/pci/pci_bus.c	Fri Mar 30 17:38:57 2012	(r233706)
+++ head/sys/x86/pci/pci_bus.c	Fri Mar 30 19:10:14 2012	(r233707)
@@ -45,7 +45,7 @@ __FBSDID("$FreeBSD$");
 #ifdef CPU_ELAN
 #include 
 #endif
-#include 
+#include 
 #include 
 #include 
 

Copied and modified: head/sys/x86/x86/legacy.c (from r233702, head/sys/i386/i386/legacy.c)
==============================================================================
--- head/sys/i386/i386/legacy.c	Fri Mar 30 16:32:41 2012	(r233702, copy source)
+++ head/sys/x86/x86/legacy.c	Fri Mar 30 19:10:14 2012	(r233707)
@@ -27,6 +27,10 @@
  * SUCH DAMAGE.
  */
 
+#ifdef __i386__
+#include "opt_eisa.h"
+#include "opt_mca.h"
+#endif
 #include 
 __FBSDID("$FreeBSD$");
 
@@ -47,14 +51,13 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-#include "opt_mca.h"
 #ifdef DEV_MCA
 #include 
 #endif
 
 #include 
-#include 
 #include 
+#include 
 
 static MALLOC_DEFINE(M_LEGACYDEV, "legacydrv", "legacy system device");
 struct legacy_device {
@@ -129,11 +132,11 @@ legacy_attach(device_t dev)
 	bus_generic_probe(dev);
 	bus_generic_attach(dev);
 
-#ifndef PC98
 	/*
 	 * If we didn't see EISA or ISA on a pci bridge, create some
 	 * connection points now so they show up "on motherboard".
 	 */
+#ifdef DEV_EISA
 	if (!devclass_get_device(devclass_find("eisa"), 0)) {
 		child = BUS_ADD_CHILD(dev, 0, "eisa", 0);
 		if (child == NULL)

Modified: head/sys/x86/x86/mptable_pci.c
==============================================================================
--- head/sys/x86/x86/mptable_pci.c	Fri Mar 30 17:38:57 2012	(r233706)
+++ head/sys/x86/x86/mptable_pci.c	Fri Mar 30 19:10:14 2012	(r233707)
@@ -46,7 +46,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 
 #include "pcib_if.h"

From owner-svn-src-head@FreeBSD.ORG  Fri Mar 30 19:49:46 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id DE4F91065695;
	Fri, 30 Mar 2012 19:49:46 +0000 (UTC) (envelope-from dim@FreeBSD.org)
Received: from tensor.andric.com (cl-327.ede-01.nl.sixxs.net
	[IPv6:2001:7b8:2ff:146::2])
	by mx1.freebsd.org (Postfix) with ESMTP id 9120A8FC23;
	Fri, 30 Mar 2012 19:49:46 +0000 (UTC)
Received: from [IPv6:2001:7b8:3a7:0:5513:9c82:30fc:da6f] (unknown
	[IPv6:2001:7b8:3a7:0:5513:9c82:30fc:da6f])
	(using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits))
	(No client certificate requested)
	by tensor.andric.com (Postfix) with ESMTPSA id C68005C37;
	Fri, 30 Mar 2012 21:49:45 +0200 (CEST)
Message-ID: <4F760E5F.5030300@FreeBSD.org>
Date: Fri, 30 Mar 2012 21:49:51 +0200
From: Dimitry Andric 
Organization: The FreeBSD Project
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64;
	rv:12.0) Gecko/20120321 Thunderbird/12.0
MIME-Version: 1.0
To: Stefan Farfeleder 
References: <201203301257.q2UCvE4l042042@svn.freebsd.org>
	<20120330133045.GD1423@mole.fafoe.narf.at>
In-Reply-To: <20120330133045.GD1423@mole.fafoe.narf.at>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org, Scott Long ,
	David Xu 
Subject: Re: svn commit: r233700 - head/sys/kern
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 30 Mar 2012 19:49:47 -0000

On 2012-03-30 15:30, Stefan Farfeleder wrote:
> here are a few similar cases.

Hm, what about this one that clang warns about:

   sys/dev/asr/asr.c:2420:57: warning: for loop has empty body [-Wempty-body]
	  for (ha = &Asr_softc_list; *ha; ha = &((*ha)->ha_next));
								 ^
   sys/dev/asr/asr.c:2420:57: note: put the semicolon on a separate line to silence this warning [-Wempty-body]

I'm not sure about it though, the code looks like this:

static int
asr_attach(device_t dev)
{
[...]
         Asr_softc_t              *sc, **ha;
[...]
         LIST_INIT(&(sc->ha_ccb));
         /* Link us into the HA list */
         for (ha = &Asr_softc_list; *ha; ha = &((*ha)->ha_next));
                 *(ha) = sc;

It seems the for loop walks the list until the end, then tacks 'sc' onto
it.

So to 'fix' the warning, and make the meaning more explicit, we should
probably rewrite that fragment as:

         LIST_INIT(&(sc->ha_ccb));
         /* Link us into the HA list */
         for (ha = &Asr_softc_list; *ha; ha = &((*ha)->ha_next))
		;
	*(ha) = sc;

Is this OK?

From owner-svn-src-head@FreeBSD.ORG  Fri Mar 30 19:54:48 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id AD206106566C;
	Fri, 30 Mar 2012 19:54:48 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 96C3C8FC0A;
	Fri, 30 Mar 2012 19:54:48 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2UJsmoh055839;
	Fri, 30 Mar 2012 19:54:48 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2UJsm9a055836;
	Fri, 30 Mar 2012 19:54:48 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <201203301954.q2UJsm9a055836@svn.freebsd.org>
From: John Baldwin 
Date: Fri, 30 Mar 2012 19:54:48 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233708 - head/sys/dev/e1000
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 30 Mar 2012 19:54:48 -0000

Author: jhb
Date: Fri Mar 30 19:54:48 2012
New Revision: 233708
URL: http://svn.freebsd.org/changeset/base/233708

Log:
  Fix a few issues with transmit handling in em(4) and igb(4):
  - Do not define the foo_start() methods or set if_start in the ifnet if
    multiq transmit is enabled.  Also, set if_transmit and if_qflush before
    ether_ifattach rather than after when multiq transmit is enabled.  This
    helps to ensure that the drivers never try to mix different transmit
    methods.
  - Properly restart transmit during resume.  igb(4) was not restarting it
    at all, and em(4) was restarting even if the link was down and was
    calling the wrong method if multiq transmit was enabled.
  - Remove all the 'more' handling for transmit completions.  Transmit
    completion processing does not have a processing limit, so it always
    runs to completion and never has more work to do when it returns.
    Instead, the previous code was returning 'true' anytime there were
    packets in the queue that weren't still in the process of being
    transmitted.  The effect was that the driver would continuously
    reschedule a task to process TX completions in effect running at 100%
    CPU polling the hardware until it finished transmitting all of the
    packets in the ring.  Now it will just wait for the next TX completion
    interrupt.
  - Restart packet transmission when the link becomes active.
  - Fix the MSI-X queue interrupt handlers to restart packet transmission if
    there are pending packets in the relevant software queue (IFQ or buf_ring)
    after processing TX completions.  This is the root cause for the OACTIVE
    hangs as if the MSI-X queue handler drained all the pending packets from
    the TX ring, nothing would ever restart it.  As such, remove some
    previously-added workarounds to reschedule a task to poll the TX ring
    anytime OACTIVE was set.
  
  Tested by:	sbruno
  Reviewed by:	jfv
  MFC after:	1 week

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

Modified: head/sys/dev/e1000/if_em.c
==============================================================================
--- head/sys/dev/e1000/if_em.c	Fri Mar 30 19:10:14 2012	(r233707)
+++ head/sys/dev/e1000/if_em.c	Fri Mar 30 19:54:48 2012	(r233708)
@@ -193,13 +193,14 @@ static int	em_detach(device_t);
 static int	em_shutdown(device_t);
 static int	em_suspend(device_t);
 static int	em_resume(device_t);
-static void	em_start(struct ifnet *);
-static void	em_start_locked(struct ifnet *, struct tx_ring *);
 #ifdef EM_MULTIQUEUE
 static int	em_mq_start(struct ifnet *, struct mbuf *);
 static int	em_mq_start_locked(struct ifnet *,
 		    struct tx_ring *, struct mbuf *);
 static void	em_qflush(struct ifnet *);
+#else
+static void	em_start(struct ifnet *);
+static void	em_start_locked(struct ifnet *, struct tx_ring *);
 #endif
 static int	em_ioctl(struct ifnet *, u_long, caddr_t);
 static void	em_init(void *);
@@ -234,7 +235,7 @@ static void	em_enable_intr(struct adapte
 static void	em_disable_intr(struct adapter *);
 static void	em_update_stats_counters(struct adapter *);
 static void	em_add_hw_stats(struct adapter *adapter);
-static bool	em_txeof(struct tx_ring *);
+static void	em_txeof(struct tx_ring *);
 static bool	em_rxeof(struct rx_ring *, int, int *);
 #ifndef __NO_STRICT_ALIGNMENT
 static int	em_fixup_rx(struct rx_ring *);
@@ -847,6 +848,7 @@ static int
 em_resume(device_t dev)
 {
 	struct adapter *adapter = device_get_softc(dev);
+	struct tx_ring	*txr = adapter->tx_rings;
 	struct ifnet *ifp = adapter->ifp;
 
 	EM_CORE_LOCK(adapter);
@@ -854,8 +856,22 @@ em_resume(device_t dev)
 		e1000_resume_workarounds_pchlan(&adapter->hw);
 	em_init_locked(adapter);
 	em_init_manageability(adapter);
+
+	if ((ifp->if_flags & IFF_UP) &&
+	    (ifp->if_drv_flags & IFF_DRV_RUNNING) && adapter->link_active) {
+		for (int i = 0; i < adapter->num_queues; i++, txr++) {
+			EM_TX_LOCK(txr);
+#ifdef EM_MULTIQUEUE
+			if (!drbr_empty(ifp, txr->br))
+				em_mq_start_locked(ifp, txr, NULL);
+#else
+			if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))
+				em_start_locked(ifp, txr);
+#endif
+			EM_TX_UNLOCK(txr);
+		}
+	}
 	EM_CORE_UNLOCK(adapter);
-	em_start(ifp);
 
 	return bus_generic_resume(dev);
 }
@@ -959,7 +975,7 @@ em_qflush(struct ifnet *ifp)
 	}
 	if_qflush(ifp);
 }
-#endif /* EM_MULTIQUEUE */
+#else  /* !EM_MULTIQUEUE */
 
 static void
 em_start_locked(struct ifnet *ifp, struct tx_ring *txr)
@@ -1020,14 +1036,9 @@ em_start(struct ifnet *ifp)
 		em_start_locked(ifp, txr);
 		EM_TX_UNLOCK(txr);
 	}
-	/*
-	** If we went inactive schedule
-	** a task to clean up.
-	*/
-	if (ifp->if_drv_flags & IFF_DRV_OACTIVE)
-		taskqueue_enqueue(txr->tq, &txr->tx_task);
 	return;
 }
+#endif /* EM_MULTIQUEUE */
 
 /*********************************************************************
  *  Ioctl entry point
@@ -1424,7 +1435,8 @@ em_poll(struct ifnet *ifp, enum poll_cmd
 	if (!drbr_empty(ifp, txr->br))
 		em_mq_start_locked(ifp, txr, NULL);
 #else
-	em_start_locked(ifp, txr);
+	if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))
+		em_start_locked(ifp, txr);
 #endif
 	EM_TX_UNLOCK(txr);
 
@@ -1497,10 +1509,11 @@ em_handle_que(void *context, int pending
 		if (!drbr_empty(ifp, txr->br))
 			em_mq_start_locked(ifp, txr, NULL);
 #else
-		em_start_locked(ifp, txr);
+		if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))
+			em_start_locked(ifp, txr);
 #endif
 		EM_TX_UNLOCK(txr);
-		if (more || (ifp->if_drv_flags & IFF_DRV_OACTIVE)) {
+		if (more) {
 			taskqueue_enqueue(adapter->tq, &adapter->que_task);
 			return;
 		}
@@ -1521,17 +1534,21 @@ em_msix_tx(void *arg)
 {
 	struct tx_ring *txr = arg;
 	struct adapter *adapter = txr->adapter;
-	bool		more;
+	struct ifnet	*ifp = adapter->ifp;
 
 	++txr->tx_irq;
 	EM_TX_LOCK(txr);
-	more = em_txeof(txr);
+	em_txeof(txr);
+#ifdef EM_MULTIQUEUE
+	if (!drbr_empty(ifp, txr->br))
+		em_mq_start_locked(ifp, txr, NULL);
+#else
+	if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))
+		em_start_locked(ifp, txr);
+#endif
+	/* Reenable this interrupt */
+	E1000_WRITE_REG(&adapter->hw, E1000_IMS, txr->ims);
 	EM_TX_UNLOCK(txr);
-	if (more)
-		taskqueue_enqueue(txr->tq, &txr->tx_task);
-	else
-		/* Reenable this interrupt */
-		E1000_WRITE_REG(&adapter->hw, E1000_IMS, txr->ims);
 	return;
 }
 
@@ -1609,7 +1626,8 @@ em_handle_tx(void *context, int pending)
 	if (!drbr_empty(ifp, txr->br))
 		em_mq_start_locked(ifp, txr, NULL);
 #else
-	em_start_locked(ifp, txr);
+	if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))
+		em_start_locked(ifp, txr);
 #endif
 	E1000_WRITE_REG(&adapter->hw, E1000_IMS, txr->ims);
 	EM_TX_UNLOCK(txr);
@@ -1619,6 +1637,7 @@ static void
 em_handle_link(void *context, int pending)
 {
 	struct adapter	*adapter = context;
+	struct tx_ring	*txr = adapter->tx_rings;
 	struct ifnet *ifp = adapter->ifp;
 
 	if (!(ifp->if_drv_flags & IFF_DRV_RUNNING))
@@ -1630,6 +1649,19 @@ em_handle_link(void *context, int pendin
 	callout_reset(&adapter->timer, hz, em_local_timer, adapter);
 	E1000_WRITE_REG(&adapter->hw, E1000_IMS,
 	    EM_MSIX_LINK | E1000_IMS_LSC);
+	if (adapter->link_active) {
+		for (int i = 0; i < adapter->num_queues; i++, txr++) {
+			EM_TX_LOCK(txr);
+#ifdef EM_MULTIQUEUE
+			if (!drbr_empty(ifp, txr->br))
+				em_mq_start_locked(ifp, txr, NULL);
+#else
+			if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))
+				em_start_locked(ifp, txr);
+#endif
+			EM_TX_UNLOCK(txr);
+		}
+	}
 	EM_CORE_UNLOCK(adapter);
 }
 
@@ -2902,20 +2934,21 @@ em_setup_interface(device_t dev, struct 
 	ifp->if_softc = adapter;
 	ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
 	ifp->if_ioctl = em_ioctl;
+#ifdef EM_MULTIQUEUE
+	/* Multiqueue stack interface */
+	ifp->if_transmit = em_mq_start;
+	ifp->if_qflush = em_qflush;
+#else
 	ifp->if_start = em_start;
 	IFQ_SET_MAXLEN(&ifp->if_snd, adapter->num_tx_desc - 1);
 	ifp->if_snd.ifq_drv_maxlen = adapter->num_tx_desc - 1;
 	IFQ_SET_READY(&ifp->if_snd);
+#endif	
 
 	ether_ifattach(ifp, adapter->hw.mac.addr);
 
 	ifp->if_capabilities = ifp->if_capenable = 0;
 
-#ifdef EM_MULTIQUEUE
-	/* Multiqueue stack interface */
-	ifp->if_transmit = em_mq_start;
-	ifp->if_qflush = em_qflush;
-#endif	
 
 	ifp->if_capabilities |= IFCAP_HWCSUM | IFCAP_VLAN_HWCSUM;
 	ifp->if_capabilities |= IFCAP_TSO4;
@@ -3742,7 +3775,7 @@ em_tso_setup(struct tx_ring *txr, struct
  *  tx_buffer is put back on the free queue.
  *
  **********************************************************************/
-static bool
+static void
 em_txeof(struct tx_ring *txr)
 {
 	struct adapter	*adapter = txr->adapter;
@@ -3762,14 +3795,14 @@ em_txeof(struct tx_ring *txr)
 		selwakeuppri(&na->tx_si, PI_NET);
 		EM_CORE_UNLOCK(adapter);
 		EM_TX_LOCK(txr);
-		return (FALSE);
+		return;
 	}
 #endif /* DEV_NETMAP */
 
 	/* No work, make sure watchdog is off */
         if (txr->tx_avail == adapter->num_tx_desc) {
 		txr->queue_status = EM_QUEUE_IDLE;
-                return (FALSE);
+                return;
 	}
 
 	processed = 0;
@@ -3858,10 +3891,7 @@ em_txeof(struct tx_ring *txr)
 	/* Disable watchdog if all clean */
 	if (txr->tx_avail == adapter->num_tx_desc) {
 		txr->queue_status = EM_QUEUE_IDLE;
-		return (FALSE);
 	} 
-
-	return (TRUE);
 }
 
 

Modified: head/sys/dev/e1000/if_igb.c
==============================================================================
--- head/sys/dev/e1000/if_igb.c	Fri Mar 30 19:10:14 2012	(r233707)
+++ head/sys/dev/e1000/if_igb.c	Fri Mar 30 19:54:48 2012	(r233708)
@@ -171,13 +171,14 @@ static int	igb_detach(device_t);
 static int	igb_shutdown(device_t);
 static int	igb_suspend(device_t);
 static int	igb_resume(device_t);
-static void	igb_start(struct ifnet *);
-static void	igb_start_locked(struct tx_ring *, struct ifnet *ifp);
 #if __FreeBSD_version >= 800000
 static int	igb_mq_start(struct ifnet *, struct mbuf *);
 static int	igb_mq_start_locked(struct ifnet *,
 		    struct tx_ring *, struct mbuf *);
 static void	igb_qflush(struct ifnet *);
+#else
+static void	igb_start(struct ifnet *);
+static void	igb_start_locked(struct tx_ring *, struct ifnet *ifp);
 #endif
 static int	igb_ioctl(struct ifnet *, u_long, caddr_t);
 static void	igb_init(void *);
@@ -261,6 +262,7 @@ static void	igb_msix_que(void *);
 static void	igb_msix_link(void *);
 static void	igb_handle_que(void *context, int pending);
 static void	igb_handle_link(void *context, int pending);
+static void	igb_handle_link_locked(struct adapter *);
 
 static void	igb_set_sysctl_value(struct adapter *, const char *,
 		    const char *, int *, int);
@@ -807,6 +809,7 @@ static int
 igb_resume(device_t dev)
 {
 	struct adapter *adapter = device_get_softc(dev);
+	struct tx_ring	*txr = adapter->tx_rings;
 	struct ifnet *ifp = adapter->ifp;
 
 	IGB_CORE_LOCK(adapter);
@@ -814,9 +817,21 @@ igb_resume(device_t dev)
 	igb_init_manageability(adapter);
 
 	if ((ifp->if_flags & IFF_UP) &&
-	    (ifp->if_drv_flags & IFF_DRV_RUNNING))
-		igb_start(ifp);
-
+	    (ifp->if_drv_flags & IFF_DRV_RUNNING) && adapter->link_active) {
+		for (int i = 0; i < adapter->num_queues; i++, txr++) {
+			IGB_TX_LOCK(txr);
+#if __FreeBSD_version >= 800000
+			/* Process the stack queue only if not depleted */
+			if (((txr->queue_status & IGB_QUEUE_DEPLETED) == 0) &&
+			    !drbr_empty(ifp, txr->br))
+				igb_mq_start_locked(ifp, txr, NULL);
+#else
+			if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))
+				igb_start_locked(txr, ifp);
+#endif
+			IGB_TX_UNLOCK(txr);
+		}
+	}
 	IGB_CORE_UNLOCK(adapter);
 
 	return bus_generic_resume(dev);
@@ -1330,19 +1345,19 @@ igb_handle_que(void *context, int pendin
 		more = igb_rxeof(que, adapter->rx_process_limit, NULL);
 
 		IGB_TX_LOCK(txr);
-		if (igb_txeof(txr))
-			more = TRUE;
+		igb_txeof(txr);
 #if __FreeBSD_version >= 800000
 		/* Process the stack queue only if not depleted */
 		if (((txr->queue_status & IGB_QUEUE_DEPLETED) == 0) &&
 		    !drbr_empty(ifp, txr->br))
 			igb_mq_start_locked(ifp, txr, NULL);
 #else
-		igb_start_locked(txr, ifp);
+		if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))
+			igb_start_locked(txr, ifp);
 #endif
 		IGB_TX_UNLOCK(txr);
 		/* Do we need another? */
-		if (more || (ifp->if_drv_flags & IFF_DRV_OACTIVE)) {
+		if (more) {
 			taskqueue_enqueue(que->tq, &que->que_task);
 			return;
 		}
@@ -1365,8 +1380,35 @@ igb_handle_link(void *context, int pendi
 {
 	struct adapter *adapter = context;
 
+	IGB_CORE_LOCK(adapter);
+	igb_handle_link_locked(adapter);
+	IGB_CORE_UNLOCK(adapter);
+}
+
+static void
+igb_handle_link_locked(struct adapter *adapter)
+{
+	struct tx_ring	*txr = adapter->tx_rings;
+	struct ifnet *ifp = adapter->ifp;
+
+	IGB_CORE_LOCK_ASSERT(adapter);
 	adapter->hw.mac.get_link_status = 1;
 	igb_update_link_status(adapter);
+	if ((ifp->if_drv_flags & IFF_DRV_RUNNING) && adapter->link_active) {
+		for (int i = 0; i < adapter->num_queues; i++, txr++) {
+			IGB_TX_LOCK(txr);
+#if __FreeBSD_version >= 800000
+			/* Process the stack queue only if not depleted */
+			if (((txr->queue_status & IGB_QUEUE_DEPLETED) == 0) &&
+			    !drbr_empty(ifp, txr->br))
+				igb_mq_start_locked(ifp, txr, NULL);
+#else
+			if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))
+				igb_start_locked(txr, ifp);
+#endif
+			IGB_TX_UNLOCK(txr);
+		}
+	}
 }
 
 /*********************************************************************
@@ -1446,7 +1488,7 @@ igb_poll(struct ifnet *ifp, enum poll_cm
 		reg_icr = E1000_READ_REG(&adapter->hw, E1000_ICR);
 		/* Link status change */
 		if (reg_icr & (E1000_ICR_RXSEQ | E1000_ICR_LSC))
-			igb_handle_link(adapter, 0);
+			igb_handle_link_locked(adapter);
 
 		if (reg_icr & E1000_ICR_RXO)
 			adapter->rx_overruns++;
@@ -1463,7 +1505,8 @@ igb_poll(struct ifnet *ifp, enum poll_cm
 	if (!drbr_empty(ifp, txr->br))
 		igb_mq_start_locked(ifp, txr, NULL);
 #else
-	igb_start_locked(txr, ifp);
+	if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))
+		igb_start_locked(txr, ifp);
 #endif
 	IGB_TX_UNLOCK(txr);
 	return POLL_RETURN_COUNT(rx_done);
@@ -1480,16 +1523,26 @@ igb_msix_que(void *arg)
 {
 	struct igb_queue *que = arg;
 	struct adapter *adapter = que->adapter;
+	struct ifnet   *ifp = adapter->ifp;
 	struct tx_ring *txr = que->txr;
 	struct rx_ring *rxr = que->rxr;
 	u32		newitr = 0;
-	bool		more_tx, more_rx;
+	bool		more_rx;
 
 	E1000_WRITE_REG(&adapter->hw, E1000_EIMC, que->eims);
 	++que->irqs;
 
 	IGB_TX_LOCK(txr);
-	more_tx = igb_txeof(txr);
+	igb_txeof(txr);
+#if __FreeBSD_version >= 800000
+	/* Process the stack queue only if not depleted */
+	if (((txr->queue_status & IGB_QUEUE_DEPLETED) == 0) &&
+	    !drbr_empty(ifp, txr->br))
+		igb_mq_start_locked(ifp, txr, NULL);
+#else
+	if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))
+		igb_start_locked(txr, ifp);
+#endif
 	IGB_TX_UNLOCK(txr);
 
 	more_rx = igb_rxeof(que, adapter->rx_process_limit, NULL);
@@ -1547,7 +1600,7 @@ igb_msix_que(void *arg)
 
 no_calc:
 	/* Schedule a clean task if needed*/
-	if (more_tx || more_rx)
+	if (more_rx)
 		taskqueue_enqueue(que->tq, &que->que_task);
 	else
 		/* Reenable this interrupt */

From owner-svn-src-head@FreeBSD.ORG  Fri Mar 30 20:17:40 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 21F271065670;
	Fri, 30 Mar 2012 20:17:40 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 0C4028FC19;
	Fri, 30 Mar 2012 20:17:40 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2UKHdW6056595;
	Fri, 30 Mar 2012 20:17:39 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2UKHdnv056593;
	Fri, 30 Mar 2012 20:17:39 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <201203302017.q2UKHdnv056593@svn.freebsd.org>
From: John Baldwin 
Date: Fri, 30 Mar 2012 20:17:39 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233709 - head/sys/x86/x86
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 30 Mar 2012 20:17:40 -0000

Author: jhb
Date: Fri Mar 30 20:17:39 2012
New Revision: 233709
URL: http://svn.freebsd.org/changeset/base/233709

Log:
  Attempt to make machine check handling a bit more robust:
  - Don't malloc() new MCA records for machine checks logged due to a
    CMCI or MC# exception.  Instead, use a pre-allocated pool of records.
    When a CMCI or MC# exception fires, schedule a swi to refill the pool.
    The pool is sized to hold at least one record per available machine
    bank, and one record per CPU. This should handle the case of all CPUs
    triggering a single bank at once as well as the case a single CPU
    triggering all of its banks.  The periodic scans still use malloc()
    since they are run from a safe context.
  - Since we have to create an swi to handle refills, make the periodic scan
    a second swi for the same thread instead of having a separate taskqueue
    thread for the scans.
  
  Suggested by:	mdf (avoiding malloc())
  MFC after:	2 weeks

Modified:
  head/sys/x86/x86/mca.c

Modified: head/sys/x86/x86/mca.c
==============================================================================
--- head/sys/x86/x86/mca.c	Fri Mar 30 19:54:48 2012	(r233708)
+++ head/sys/x86/x86/mca.c	Fri Mar 30 20:17:39 2012	(r233709)
@@ -50,7 +50,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -85,6 +84,7 @@ struct mca_internal {
 static MALLOC_DEFINE(M_MCA, "MCA", "Machine Check Architecture");
 
 static int mca_count;		/* Number of records stored. */
+static int mca_banks;		/* Number of per-CPU register banks. */
 
 static SYSCTL_NODE(_hw, OID_AUTO, mca, CTLFLAG_RD, NULL,
     "Machine Check Architecture");
@@ -103,16 +103,16 @@ int workaround_erratum383;
 SYSCTL_INT(_hw_mca, OID_AUTO, erratum383, CTLFLAG_RD, &workaround_erratum383, 0,
     "Is the workaround for Erratum 383 on AMD Family 10h processors enabled?");
 
+static STAILQ_HEAD(, mca_internal) mca_freelist;
+static int mca_freecount;
 static STAILQ_HEAD(, mca_internal) mca_records;
 static struct callout mca_timer;
 static int mca_ticks = 3600;	/* Check hourly by default. */
-static struct taskqueue *mca_tq;
-static struct task mca_task;
 static struct mtx mca_lock;
+static void *mca_refill_swi, *mca_scan_swi;
 
 #ifdef DEV_APIC
 static struct cmc_state **cmc_state;	/* Indexed by cpuid, bank */
-static int cmc_banks;
 static int cmc_throttle = 60;	/* Time in seconds to throttle CMCI. */
 #endif
 
@@ -416,21 +416,60 @@ mca_check_status(int bank, struct mca_re
 	return (1);
 }
 
-static void __nonnull(1)
-mca_record_entry(const struct mca_record *record)
+static void
+mca_fill_freelist(void)
 {
 	struct mca_internal *rec;
+	int desired;
 
-	rec = malloc(sizeof(*rec), M_MCA, M_NOWAIT);
-	if (rec == NULL) {
-		printf("MCA: Unable to allocate space for an event.\n");
-		mca_log(record);
-		return;
+	/*
+	 * Ensure we have at least one record for each bank and one
+	 * record per CPU.
+	 */
+	desired = imax(mp_ncpus, mca_banks);
+	mtx_lock_spin(&mca_lock);
+	while (mca_freecount < desired) {
+		mtx_unlock_spin(&mca_lock);
+		rec = malloc(sizeof(*rec), M_MCA, M_WAITOK);
+		mtx_lock_spin(&mca_lock);
+		STAILQ_INSERT_TAIL(&mca_freelist, rec, link);
+		mca_freecount++;
+	}
+	mtx_unlock_spin(&mca_lock);
+}
+
+static void
+mca_refill(void *arg)
+{
+
+	mca_fill_freelist();
+}
+
+static void __nonnull(2)
+mca_record_entry(enum scan_mode mode, const struct mca_record *record)
+{
+	struct mca_internal *rec;
+
+	if (mode == POLLED) {
+		rec = malloc(sizeof(*rec), M_MCA, M_WAITOK);
+		mtx_lock_spin(&mca_lock);
+	} else {
+		mtx_lock_spin(&mca_lock);
+		rec = STAILQ_FIRST(&mca_freelist);
+		if (rec == NULL) {
+			mtx_unlock_spin(&mca_lock);
+			printf("MCA: Unable to allocate space for an event.\n");
+			mca_log(record);
+			return;
+		}
+		STAILQ_REMOVE_HEAD(&mca_freelist, link);
+		mca_freecount--;
+		if (mca_refill_swi != NULL)
+			swi_sched(mca_refill_swi, 0);
 	}
 
 	rec->rec = *record;
 	rec->logged = 0;
-	mtx_lock_spin(&mca_lock);
 	STAILQ_INSERT_TAIL(&mca_records, rec, link);
 	mca_count++;
 	mtx_unlock_spin(&mca_lock);
@@ -552,7 +591,7 @@ mca_scan(enum scan_mode mode)
 				recoverable = 0;
 				mca_log(&rec);
 			}
-			mca_record_entry(&rec);
+			mca_record_entry(mode, &rec);
 		}
 	
 #ifdef DEV_APIC
@@ -564,6 +603,8 @@ mca_scan(enum scan_mode mode)
 			cmci_update(mode, i, valid, &rec);
 #endif
 	}
+	if (mode == POLLED)
+		mca_fill_freelist();
 	return (mode == MCE ? recoverable : count);
 }
 
@@ -573,7 +614,7 @@ mca_scan(enum scan_mode mode)
  * them to the console.
  */
 static void
-mca_scan_cpus(void *context, int pending)
+mca_scan_cpus(void *arg)
 {
 	struct mca_internal *mca;
 	struct thread *td;
@@ -608,7 +649,7 @@ static void
 mca_periodic_scan(void *arg)
 {
 
-	taskqueue_enqueue(mca_tq, &mca_task);
+	swi_sched(mca_scan_swi, 1);
 	callout_reset(&mca_timer, mca_ticks * hz, mca_periodic_scan, NULL);
 }
 
@@ -622,36 +663,37 @@ sysctl_mca_scan(SYSCTL_HANDLER_ARGS)
 	if (error)
 		return (error);
 	if (i)
-		taskqueue_enqueue(mca_tq, &mca_task);
+		swi_sched(mca_scan_swi, 1);
 	return (0);
 }
 
 static void
 mca_startup(void *dummy)
 {
+	struct intr_event *ie;
 
 	if (!mca_enabled || !(cpu_feature & CPUID_MCA))
 		return;
 
-	mca_tq = taskqueue_create("mca", M_WAITOK, taskqueue_thread_enqueue,
-	    &mca_tq);
-	taskqueue_start_threads(&mca_tq, 1, PI_SWI(SWI_TQ), "mca taskq");
-	callout_reset(&mca_timer, mca_ticks * hz, mca_periodic_scan,
-		    NULL);
+	ie = NULL;
+	swi_add(&ie, "mca:scan", mca_scan_cpus, NULL, SWI_TQ, INTR_MPSAFE,
+	    &mca_scan_swi);
+	swi_add(&ie, "mca:refill", mca_refill, NULL, SWI_TQ, INTR_MPSAFE,
+	    &mca_refill_swi);
+	callout_reset(&mca_timer, mca_ticks * hz, mca_periodic_scan, NULL);
 }
 SYSINIT(mca_startup, SI_SUB_SMP, SI_ORDER_ANY, mca_startup, NULL);
 
 #ifdef DEV_APIC
 static void
-cmci_setup(uint64_t mcg_cap)
+cmci_setup(void)
 {
 	int i;
 
 	cmc_state = malloc((mp_maxid + 1) * sizeof(struct cmc_state **),
 	    M_MCA, M_WAITOK);
-	cmc_banks = mcg_cap & MCG_CAP_COUNT;
 	for (i = 0; i <= mp_maxid; i++)
-		cmc_state[i] = malloc(sizeof(struct cmc_state) * cmc_banks,
+		cmc_state[i] = malloc(sizeof(struct cmc_state) * mca_banks,
 		    M_MCA, M_WAITOK | M_ZERO);
 	SYSCTL_ADD_PROC(NULL, SYSCTL_STATIC_CHILDREN(_hw_mca), OID_AUTO,
 	    "cmc_throttle", CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE,
@@ -673,10 +715,12 @@ mca_setup(uint64_t mcg_cap)
 	    CPUID_TO_FAMILY(cpu_id) == 0x10 && amd10h_L1TP)
 		workaround_erratum383 = 1;
 
+	mca_banks = mcg_cap & MCG_CAP_COUNT;
 	mtx_init(&mca_lock, "mca", NULL, MTX_SPIN);
 	STAILQ_INIT(&mca_records);
-	TASK_INIT(&mca_task, 0, mca_scan_cpus, NULL);
 	callout_init(&mca_timer, CALLOUT_MPSAFE);
+	STAILQ_INIT(&mca_freelist);
+	mca_fill_freelist();
 	SYSCTL_ADD_INT(NULL, SYSCTL_STATIC_CHILDREN(_hw_mca), OID_AUTO,
 	    "count", CTLFLAG_RD, &mca_count, 0, "Record count");
 	SYSCTL_ADD_PROC(NULL, SYSCTL_STATIC_CHILDREN(_hw_mca), OID_AUTO,
@@ -690,7 +734,7 @@ mca_setup(uint64_t mcg_cap)
 	    sysctl_mca_scan, "I", "Force an immediate scan for machine checks");
 #ifdef DEV_APIC
 	if (mcg_cap & MCG_CAP_CMCI_P)
-		cmci_setup(mcg_cap);
+		cmci_setup();
 #endif
 }
 
@@ -708,7 +752,7 @@ cmci_monitor(int i)
 	struct cmc_state *cc;
 	uint64_t ctl;
 
-	KASSERT(i < cmc_banks, ("CPU %d has more MC banks", PCPU_GET(cpuid)));
+	KASSERT(i < mca_banks, ("CPU %d has more MC banks", PCPU_GET(cpuid)));
 
 	ctl = rdmsr(MSR_MC_CTL2(i));
 	if (ctl & MC_CTL2_CMCI_EN)
@@ -752,7 +796,7 @@ cmci_resume(int i)
 	struct cmc_state *cc;
 	uint64_t ctl;
 
-	KASSERT(i < cmc_banks, ("CPU %d has more MC banks", PCPU_GET(cpuid)));
+	KASSERT(i < mca_banks, ("CPU %d has more MC banks", PCPU_GET(cpuid)));
 
 	/* Ignore banks not monitored by this CPU. */
 	if (!(PCPU_GET(cmci_mask) & 1 << i))

From owner-svn-src-head@FreeBSD.ORG  Fri Mar 30 20:39:04 2012
Return-Path: 
Delivered-To: svn-src-head@FreeBSD.org
Received: from mx2.freebsd.org (mx2.freebsd.org [69.147.83.53])
	by hub.freebsd.org (Postfix) with ESMTP id 3E62A1065670;
	Fri, 30 Mar 2012 20:39:04 +0000 (UTC)
	(envelope-from dougb@FreeBSD.org)
Received: from [127.0.0.1] (hub.freebsd.org [IPv6:2001:4f8:fff6::36])
	by mx2.freebsd.org (Postfix) with ESMTP id C5328158072;
	Fri, 30 Mar 2012 20:38:00 +0000 (UTC)
Message-ID: <4F7619A8.4020404@FreeBSD.org>
Date: Fri, 30 Mar 2012 13:38:00 -0700
From: Doug Barton 
Organization: http://www.FreeBSD.org/
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64;
	rv:11.0) Gecko/20120327 Thunderbird/11.0.1
MIME-Version: 1.0
To: David Chisnall 
References: <201203220848.q2M8mia8015593@svn.freebsd.org>
	<20120325105958.GB61230@zxy.spb.ru>
	
	<4F73D8A0.3040608@FreeBSD.org>
	
In-Reply-To: 
X-Enigmail-Version: 1.4
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Cc: src-committers@FreeBSD.org, svn-src-all@FreeBSD.org,
	Stanislav Sedov , Ivan Voras ,
	Slawa Olhovchenkov , svn-src-head@FreeBSD.org
Subject: Re: svn commit: r233294 - in head: . contrib/com_err crypto/heimdal
 crypto/heimdal/admin crypto/heimdal/appl
 crypto/heimdal/appl/afsutil crypto/heimdal/appl/ftp
 crypto/heimdal/appl/ftp/common crypto/he...
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 30 Mar 2012 20:39:04 -0000

On 3/29/2012 4:16 AM, David Chisnall wrote:
> On 29 Mar 2012, at 04:36, Doug Barton wrote:
> 
>> All of the stuff that pkgng relies on (including the tool itself)
>> are going to be in the ports collection, where they belong. We
>> should have moved pkg_* there years ago, but this change is at
>> least a step in the right direction.
> 
> Wait... what?  Why should pkgng be in ports (other than now, while
> it's under development)?  I'd like to see it used for managing some
> of the optional parts of the base system and probably eventually
> replacing freebsd-update, not have it as another bolt-on that is not
> part of the core system.  Not to mention the bootstrapping problem if
> every user who wants to use binary packages needs to use ports to
> build pkgng.

The bootstrapping problem has been discussed in detail on -ports@,
#bsdports, etc.; and the solutions are well known, and quite simple. A)
the installer needs to be modified to install certain packages by
default, and B) we need a tiny binary in the base (something like
pkg_bootstrap, but hopefully with a better name) to bring the
ports/package tools up to date. And optionally, C) a button on whatever
post-install configurator we end up with to do the same task.

Someone else already gave part of the picture as to why this change
needs to be made, but to add a bit more detail ... We currently have (at
minimum) a 5 year cycle of introducing new features to the pkg_* tools
specifically, and often to the ports generally. No, that's not a typo.
That's how long it takes to introduce something to the newest FreeBSD
version, and then have that change percolate over time to all of the
supported FreeBSD versions. We can't continue to operate like that.

If FreeBSD is going to survive as a project it has to be able to
innovate. In order to do that we have to take the best parts of the
"FreeBSD is a complete system" model and at the same time be willing to
be honest with ourselves about where and how that model is holding us
back. The whole concept of "If it's important, it must be in the base"
is one example. The flip side of that, "If it's not in the base, it's
not important" is even more dangerous/destructive.

We absolutely have to move to a model where "The Base" is a smaller
version of what we're shipping now, and more of the 3rd party stuff is
moved out to ports only. I'm not talking about a Linux distro model
where everything is a package, but we have to stop thinking that just
because something is done in Linux means that we can never consider
adopting the best parts of the concepts for FreeBSD.

We need to see the ports as part of the "The FreeBSD System."

Doug

From owner-svn-src-head@FreeBSD.ORG  Fri Mar 30 22:52:09 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 8D449106570F;
	Fri, 30 Mar 2012 22:52:09 +0000 (UTC) (envelope-from dim@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 7805D8FC08;
	Fri, 30 Mar 2012 22:52:09 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2UMq9Gj061354;
	Fri, 30 Mar 2012 22:52:09 GMT (envelope-from dim@svn.freebsd.org)
Received: (from dim@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2UMq9ut061352;
	Fri, 30 Mar 2012 22:52:09 GMT (envelope-from dim@svn.freebsd.org)
Message-Id: <201203302252.q2UMq9ut061352@svn.freebsd.org>
From: Dimitry Andric 
Date: Fri, 30 Mar 2012 22:52:09 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233710 - head/sys/dev/isci
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 30 Mar 2012 22:52:09 -0000

Author: dim
Date: Fri Mar 30 22:52:08 2012
New Revision: 233710
URL: http://svn.freebsd.org/changeset/base/233710

Log:
  Fix the following compilation warning with clang trunk in isci(4):
  
    sys/dev/isci/isci_task_request.c:198:7: error: case value not in enumerated type 'SCI_TASK_STATUS' (aka 'enum _SCI_TASK_STATUS') [-Werror,-Wswitch]
      case SCI_FAILURE_TIMEOUT:
             ^
  
  This is because the switch is done on a SCI_TASK_STATUS enum type, but
  the SCI_FAILURE_TIMEOUT value belongs to SCI_STATUS instead.
  
  Because the list of SCI_TASK_STATUS values cannot be modified at this
  time, use the simplest way to get rid of this warning, which is to cast
  the switch argument to int.  No functional change.
  
  Reviewed by:	jimharris
  MFC after:	3 days

Modified:
  head/sys/dev/isci/isci_task_request.c

Modified: head/sys/dev/isci/isci_task_request.c
==============================================================================
--- head/sys/dev/isci/isci_task_request.c	Fri Mar 30 20:17:39 2012	(r233709)
+++ head/sys/dev/isci/isci_task_request.c	Fri Mar 30 22:52:08 2012	(r233710)
@@ -188,7 +188,7 @@ isci_task_request_complete(SCI_CONTROLLE
 
 	isci_remote_device->is_resetting = FALSE;
 
-	switch (completion_status) {
+	switch ((int)completion_status) {
 	case SCI_TASK_SUCCESS:
 	case SCI_TASK_FAILURE_RESPONSE_VALID:
 		break;

From owner-svn-src-head@FreeBSD.ORG  Fri Mar 30 23:05:49 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 71ED7106567A;
	Fri, 30 Mar 2012 23:05:49 +0000 (UTC)
	(envelope-from ambrisko@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 5AD598FC21;
	Fri, 30 Mar 2012 23:05:49 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2UN5nUS061847;
	Fri, 30 Mar 2012 23:05:49 GMT
	(envelope-from ambrisko@svn.freebsd.org)
Received: (from ambrisko@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2UN5nxA061843;
	Fri, 30 Mar 2012 23:05:49 GMT
	(envelope-from ambrisko@svn.freebsd.org)
Message-Id: <201203302305.q2UN5nxA061843@svn.freebsd.org>
From: Doug Ambrisko 
Date: Fri, 30 Mar 2012 23:05:49 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233711 - in head/sys: conf dev/mfi modules/mfi
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 30 Mar 2012 23:05:49 -0000

Author: ambrisko
Date: Fri Mar 30 23:05:48 2012
New Revision: 233711
URL: http://svn.freebsd.org/changeset/base/233711

Log:
  MFhead_mfi r227068
  	First cut of new HW support from LSI and merge into FreeBSD.
  	Supports Drake Skinny and ThunderBolt cards.
  MFhead_mfi r227574
  	Style
  MFhead_mfi r227579
  	Use bus_addr_t instead of uintXX_t.
  MFhead_mfi r227580
  	MSI support
  MFhead_mfi r227612
  	More bus_addr_t and remove "#ifdef __amd64__".
  MFhead_mfi r227905
  	Improved timeout support from Scott.
  MFhead_mfi r228108
  	Make file.
  MFhead_mfi r228208
  	Fixed botched merge of Skinny support and enhanced handling
  	in call back routine.
  MFhead_mfi r228279
  	Remove superfluous !TAILQ_EMPTY() checks before TAILQ_FOREACH().
  MFhead_mfi r228310
  	Move mfi_decode_evt() to taskqueue.
  MFhead_mfi r228320
  	Implement MFI_DEBUG for 64bit S/G lists.
  MFhead_mfi r231988
  	Restore structure layout by reverting the array header to
  	use [0] instead of [1].
  MFhead_mfi r232412
  	Put wildcard pattern later in the match table.
  MFhead_mfi r232413
  	Use lower case for hexadecimal numbers to match surrounding
  	style.
  MFhead_mfi r232414
  	Add more Thunderbolt variants.
  MFhead_mfi r232888
  	Don't act on events prior to boot or when shutting down.
  	Add hw.mfi.detect_jbod_change to enable or disable acting
  	on JBOD type of disks being added on insert and removed on
  	removing.  Switch hw.mfi.msi to 1 by default since it works
  	better on newer cards.
  MFhead_mfi r233016
  	Release driver lock before taking Giant when deleting children.
  	Use TAILQ_FOREACH_SAFE when items can be deleted.  Make code a
  	little simplier to follow.  Fix a couple more style issues.
  MFhead_mfi r233620
  	Update mfi_spare/mfi_array with the actual number of elements
  	for array_ref and pd.  Change these max. #define names to avoid
  	name space collisions.  This will require an update to mfiutil
  	It avoids mfiutil having to do a magic calculation.
  
  	Add a note and #define to state that a "SYSTEM" disk is really
  	what the firmware calls a "JBOD" drive.
  
  Thanks to the many that helped, LSI for the initial code drop,
  mav, delphij, jhb, sbruno that all helped with code and testing.

Added:
  head/sys/dev/mfi/mfi_syspd.c   (contents, props changed)
     - copied, changed from r227068, projects/head_mfi/sys/dev/mfi/mfi_syspd.c
  head/sys/dev/mfi/mfi_tbolt.c   (contents, props changed)
     - copied, changed from r227068, projects/head_mfi/sys/dev/mfi/mfi_tbolt.c
Modified:
  head/sys/conf/files
  head/sys/dev/mfi/mfi.c
  head/sys/dev/mfi/mfi_cam.c
  head/sys/dev/mfi/mfi_debug.c
  head/sys/dev/mfi/mfi_disk.c
  head/sys/dev/mfi/mfi_ioctl.h
  head/sys/dev/mfi/mfi_linux.c
  head/sys/dev/mfi/mfi_pci.c
  head/sys/dev/mfi/mfireg.h
  head/sys/dev/mfi/mfivar.h
  head/sys/modules/mfi/Makefile
Directory Properties:
  head/sys/   (props changed)
  head/sys/conf/   (props changed)

Modified: head/sys/conf/files
==============================================================================
--- head/sys/conf/files	Fri Mar 30 22:52:08 2012	(r233710)
+++ head/sys/conf/files	Fri Mar 30 23:05:48 2012	(r233711)
@@ -1558,6 +1558,8 @@ dev/mfi/mfi.c			optional mfi
 dev/mfi/mfi_debug.c		optional mfi
 dev/mfi/mfi_pci.c		optional mfi pci
 dev/mfi/mfi_disk.c		optional mfi
+dev/mfi/mfi_syspd.c		optional mfi
+dev/mfi/mfi_tbolt.c		optional mfi
 dev/mfi/mfi_linux.c		optional mfi compat_linux
 dev/mfi/mfi_cam.c		optional mfip scbus
 dev/mii/acphy.c			optional miibus | acphy

Modified: head/sys/dev/mfi/mfi.c
==============================================================================
--- head/sys/dev/mfi/mfi.c	Fri Mar 30 22:52:08 2012	(r233710)
+++ head/sys/dev/mfi/mfi.c	Fri Mar 30 23:05:48 2012	(r233711)
@@ -53,6 +53,7 @@
 #include 
 __FBSDID("$FreeBSD$");
 
+#include "opt_compat.h"
 #include "opt_mfi.h"
 
 #include 
@@ -72,6 +73,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -79,10 +81,11 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
+#include 
 
 static int	mfi_alloc_commands(struct mfi_softc *);
 static int	mfi_comms_init(struct mfi_softc *);
-static int	mfi_wait_command(struct mfi_softc *, struct mfi_command *);
 static int	mfi_get_controller_info(struct mfi_softc *);
 static int	mfi_get_log_state(struct mfi_softc *,
 		    struct mfi_evt_log_state **);
@@ -93,29 +96,39 @@ static void	mfi_data_cb(void *, bus_dma_
 static void	mfi_startup(void *arg);
 static void	mfi_intr(void *arg);
 static void	mfi_ldprobe(struct mfi_softc *sc);
+static void	mfi_syspdprobe(struct mfi_softc *sc);
+static void	mfi_handle_evt(void *context, int pending);
 static int	mfi_aen_register(struct mfi_softc *sc, int seq, int locale);
 static void	mfi_aen_complete(struct mfi_command *);
-static int	mfi_aen_setup(struct mfi_softc *, uint32_t);
 static int	mfi_add_ld(struct mfi_softc *sc, int);
 static void	mfi_add_ld_complete(struct mfi_command *);
+static int	mfi_add_sys_pd(struct mfi_softc *sc, int);
+static void	mfi_add_sys_pd_complete(struct mfi_command *);
 static struct mfi_command * mfi_bio_command(struct mfi_softc *);
 static void	mfi_bio_complete(struct mfi_command *);
-static int	mfi_mapcmd(struct mfi_softc *, struct mfi_command *);
+static struct mfi_command *mfi_build_ldio(struct mfi_softc *,struct bio*);
+static struct mfi_command *mfi_build_syspdio(struct mfi_softc *,struct bio*);
 static int	mfi_send_frame(struct mfi_softc *, struct mfi_command *);
-static void	mfi_complete(struct mfi_softc *, struct mfi_command *);
 static int	mfi_abort(struct mfi_softc *, struct mfi_command *);
 static int	mfi_linux_ioctl_int(struct cdev *, u_long, caddr_t, int, struct thread *);
 static void	mfi_timeout(void *);
 static int	mfi_user_command(struct mfi_softc *,
 		    struct mfi_ioc_passthru *);
-static void 	mfi_enable_intr_xscale(struct mfi_softc *sc);
-static void 	mfi_enable_intr_ppc(struct mfi_softc *sc);
-static int32_t 	mfi_read_fw_status_xscale(struct mfi_softc *sc);
-static int32_t 	mfi_read_fw_status_ppc(struct mfi_softc *sc);
-static int 	mfi_check_clear_intr_xscale(struct mfi_softc *sc);
-static int 	mfi_check_clear_intr_ppc(struct mfi_softc *sc);
-static void 	mfi_issue_cmd_xscale(struct mfi_softc *sc,uint32_t bus_add,uint32_t frame_cnt);
-static void 	mfi_issue_cmd_ppc(struct mfi_softc *sc,uint32_t bus_add,uint32_t frame_cnt);
+static void	mfi_enable_intr_xscale(struct mfi_softc *sc);
+static void	mfi_enable_intr_ppc(struct mfi_softc *sc);
+static int32_t	mfi_read_fw_status_xscale(struct mfi_softc *sc);
+static int32_t	mfi_read_fw_status_ppc(struct mfi_softc *sc);
+static int	mfi_check_clear_intr_xscale(struct mfi_softc *sc);
+static int	mfi_check_clear_intr_ppc(struct mfi_softc *sc);
+static void 	mfi_issue_cmd_xscale(struct mfi_softc *sc, bus_addr_t bus_add,
+		    uint32_t frame_cnt);
+static void 	mfi_issue_cmd_ppc(struct mfi_softc *sc, bus_addr_t bus_add,
+		    uint32_t frame_cnt);
+static int mfi_config_lock(struct mfi_softc *sc, uint32_t opcode);
+static void mfi_config_unlock(struct mfi_softc *sc, int locked);
+static int mfi_check_command_pre(struct mfi_softc *sc, struct mfi_command *cm);
+static void mfi_check_command_post(struct mfi_softc *sc, struct mfi_command *cm);
+static int mfi_check_for_sscd(struct mfi_softc *sc, struct mfi_command *cm);
 
 SYSCTL_NODE(_hw, OID_AUTO, mfi, CTLFLAG_RD, 0, "MFI driver parameters");
 static int	mfi_event_locale = MFI_EVT_LOCALE_ALL;
@@ -133,6 +146,11 @@ TUNABLE_INT("hw.mfi.max_cmds", &mfi_max_
 SYSCTL_INT(_hw_mfi, OID_AUTO, max_cmds, CTLFLAG_RD, &mfi_max_cmds,
 	   0, "Max commands");
 
+static int	mfi_detect_jbod_change = 1;
+TUNABLE_INT("hw.mfi.detect_jbod_change", &mfi_detect_jbod_change);
+SYSCTL_INT(_hw_mfi, OID_AUTO, detect_jbod_change, CTLFLAG_RW,
+	   &mfi_detect_jbod_change, 0, "Detect a change to a JBOD");
+
 /* Management interface */
 static d_open_t		mfi_open;
 static d_close_t	mfi_close;
@@ -152,6 +170,7 @@ static struct cdevsw mfi_cdevsw = {
 MALLOC_DEFINE(M_MFIBUF, "mfibuf", "Buffers for the MFI driver");
 
 #define MFI_INQ_LENGTH SHORT_INQUIRY_LENGTH
+struct mfi_skinny_dma_info mfi_skinny;
 
 static void
 mfi_enable_intr_xscale(struct mfi_softc *sc)
@@ -162,12 +181,17 @@ mfi_enable_intr_xscale(struct mfi_softc 
 static void
 mfi_enable_intr_ppc(struct mfi_softc *sc)
 {
-	MFI_WRITE4(sc, MFI_ODCR0, 0xFFFFFFFF);
 	if (sc->mfi_flags & MFI_FLAGS_1078) {
+		MFI_WRITE4(sc, MFI_ODCR0, 0xFFFFFFFF);
 		MFI_WRITE4(sc, MFI_OMSK, ~MFI_1078_EIM);
-	} else if (sc->mfi_flags & MFI_FLAGS_GEN2) {
+	}
+	else if (sc->mfi_flags & MFI_FLAGS_GEN2) {
+		MFI_WRITE4(sc, MFI_ODCR0, 0xFFFFFFFF);
 		MFI_WRITE4(sc, MFI_OMSK, ~MFI_GEN2_EIM);
 	}
+	else if (sc->mfi_flags & MFI_FLAGS_SKINNY) {
+		MFI_WRITE4(sc, MFI_OMSK, ~0x00000001);
+	}
 }
 
 static int32_t
@@ -205,35 +229,51 @@ mfi_check_clear_intr_ppc(struct mfi_soft
 		if (!(status & MFI_1078_RM)) {
 			return 1;
 		}
-	} else if (sc->mfi_flags & MFI_FLAGS_GEN2) {
+	}
+	else if (sc->mfi_flags & MFI_FLAGS_GEN2) {
 		if (!(status & MFI_GEN2_RM)) {
 			return 1;
 		}
 	}
-
-	MFI_WRITE4(sc, MFI_ODCR0, status);
+	else if (sc->mfi_flags & MFI_FLAGS_SKINNY) {
+		if (!(status & MFI_SKINNY_RM)) {
+			return 1;
+		}
+	}
+	if (sc->mfi_flags & MFI_FLAGS_SKINNY)
+		MFI_WRITE4(sc, MFI_OSTS, status);
+	else
+		MFI_WRITE4(sc, MFI_ODCR0, status);
 	return 0;
 }
 
 static void
-mfi_issue_cmd_xscale(struct mfi_softc *sc,uint32_t bus_add,uint32_t frame_cnt)
+mfi_issue_cmd_xscale(struct mfi_softc *sc, bus_addr_t bus_add, uint32_t frame_cnt)
 {
 	MFI_WRITE4(sc, MFI_IQP,(bus_add >>3)|frame_cnt);
 }
 
 static void
-mfi_issue_cmd_ppc(struct mfi_softc *sc,uint32_t bus_add,uint32_t frame_cnt)
+mfi_issue_cmd_ppc(struct mfi_softc *sc, bus_addr_t bus_add, uint32_t frame_cnt)
 {
-	MFI_WRITE4(sc, MFI_IQP, (bus_add |frame_cnt <<1)|1 );
+	if (sc->mfi_flags & MFI_FLAGS_SKINNY) {
+	    MFI_WRITE4(sc, MFI_IQPL, (bus_add | frame_cnt <<1)|1 );
+	    MFI_WRITE4(sc, MFI_IQPH, 0x00000000);
+	} else {
+	    MFI_WRITE4(sc, MFI_IQP, (bus_add | frame_cnt <<1)|1 );
+	}
 }
 
-static int
+int
 mfi_transition_firmware(struct mfi_softc *sc)
 {
 	uint32_t fw_state, cur_state;
 	int max_wait, i;
+	uint32_t cur_abs_reg_val = 0;
+	uint32_t prev_abs_reg_val = 0;
 
-	fw_state = sc->mfi_read_fw_status(sc)& MFI_FWSTATE_MASK;
+	cur_abs_reg_val = sc->mfi_read_fw_status(sc);
+	fw_state = cur_abs_reg_val & MFI_FWSTATE_MASK;
 	while (fw_state != MFI_FWSTATE_READY) {
 		if (bootverbose)
 			device_printf(sc->mfi_dev, "Waiting for firmware to "
@@ -244,38 +284,60 @@ mfi_transition_firmware(struct mfi_softc
 			device_printf(sc->mfi_dev, "Firmware fault\n");
 			return (ENXIO);
 		case MFI_FWSTATE_WAIT_HANDSHAKE:
-			MFI_WRITE4(sc, MFI_IDB, MFI_FWINIT_CLEAR_HANDSHAKE);
-			max_wait = 2;
+			if (sc->mfi_flags & MFI_FLAGS_SKINNY || sc->mfi_flags & MFI_FLAGS_TBOLT)
+			    MFI_WRITE4(sc, MFI_SKINNY_IDB, MFI_FWINIT_CLEAR_HANDSHAKE);
+			else
+			    MFI_WRITE4(sc, MFI_IDB, MFI_FWINIT_CLEAR_HANDSHAKE);
+			max_wait = MFI_RESET_WAIT_TIME;
 			break;
 		case MFI_FWSTATE_OPERATIONAL:
-			MFI_WRITE4(sc, MFI_IDB, MFI_FWINIT_READY);
-			max_wait = 10;
+			if (sc->mfi_flags & MFI_FLAGS_SKINNY || sc->mfi_flags & MFI_FLAGS_TBOLT)
+			    MFI_WRITE4(sc, MFI_SKINNY_IDB, 7);
+			else
+			    MFI_WRITE4(sc, MFI_IDB, MFI_FWINIT_READY);
+			max_wait = MFI_RESET_WAIT_TIME;
 			break;
 		case MFI_FWSTATE_UNDEFINED:
 		case MFI_FWSTATE_BB_INIT:
-			max_wait = 2;
+			max_wait = MFI_RESET_WAIT_TIME;
+			break;
+		case MFI_FWSTATE_FW_INIT_2:
+			max_wait = MFI_RESET_WAIT_TIME;
 			break;
 		case MFI_FWSTATE_FW_INIT:
-		case MFI_FWSTATE_DEVICE_SCAN:
 		case MFI_FWSTATE_FLUSH_CACHE:
-			max_wait = 20;
+			max_wait = MFI_RESET_WAIT_TIME;
+			break;
+		case MFI_FWSTATE_DEVICE_SCAN:
+			max_wait = MFI_RESET_WAIT_TIME; /* wait for 180 seconds */
+			prev_abs_reg_val = cur_abs_reg_val;
 			break;
 		case MFI_FWSTATE_BOOT_MESSAGE_PENDING:
-			MFI_WRITE4(sc, MFI_IDB, MFI_FWINIT_HOTPLUG);
-			max_wait = 10;
+			if (sc->mfi_flags & MFI_FLAGS_SKINNY || sc->mfi_flags & MFI_FLAGS_TBOLT)
+			    MFI_WRITE4(sc, MFI_SKINNY_IDB, MFI_FWINIT_HOTPLUG);
+			else
+			    MFI_WRITE4(sc, MFI_IDB, MFI_FWINIT_HOTPLUG);
+			max_wait = MFI_RESET_WAIT_TIME;
 			break;
 		default:
-			device_printf(sc->mfi_dev,"Unknown firmware state %#x\n",
+			device_printf(sc->mfi_dev, "Unknown firmware state %#x\n",
 			    fw_state);
 			return (ENXIO);
 		}
 		for (i = 0; i < (max_wait * 10); i++) {
-			fw_state = sc->mfi_read_fw_status(sc) & MFI_FWSTATE_MASK;
+			cur_abs_reg_val = sc->mfi_read_fw_status(sc);
+			fw_state = cur_abs_reg_val & MFI_FWSTATE_MASK;
 			if (fw_state == cur_state)
 				DELAY(100000);
 			else
 				break;
 		}
+		if (fw_state == MFI_FWSTATE_DEVICE_SCAN) {
+			/* Check the device scanning progress */
+			if (prev_abs_reg_val != cur_abs_reg_val) {
+				continue;
+			}
+		}
 		if (fw_state == cur_state) {
 			device_printf(sc->mfi_dev, "Firmware stuck in state "
 			    "%#x\n", fw_state);
@@ -286,26 +348,35 @@ mfi_transition_firmware(struct mfi_softc
 }
 
 static void
-mfi_addr32_cb(void *arg, bus_dma_segment_t *segs, int nsegs, int error)
+mfi_addr_cb(void *arg, bus_dma_segment_t *segs, int nsegs, int error)
 {
-	uint32_t *addr;
+	bus_addr_t *addr;
 
 	addr = arg;
 	*addr = segs[0].ds_addr;
 }
 
+
 int
 mfi_attach(struct mfi_softc *sc)
 {
 	uint32_t status;
 	int error, commsz, framessz, sensesz;
 	int frames, unit, max_fw_sge;
+	uint32_t tb_mem_size = 0;
+
+	if (sc == NULL)
+		return EINVAL;
 
-	device_printf(sc->mfi_dev, "Megaraid SAS driver Ver 3.00 \n");
+	device_printf(sc->mfi_dev, "Megaraid SAS driver Ver %s \n",
+	    MEGASAS_VERSION);
 
 	mtx_init(&sc->mfi_io_lock, "MFI I/O lock", NULL, MTX_DEF);
 	sx_init(&sc->mfi_config_lock, "MFI config");
 	TAILQ_INIT(&sc->mfi_ld_tqh);
+	TAILQ_INIT(&sc->mfi_syspd_tqh);
+	TAILQ_INIT(&sc->mfi_evt_queue);
+	TASK_INIT(&sc->mfi_evt_task, 0, mfi_handle_evt, sc);
 	TAILQ_INIT(&sc->mfi_aen_pids);
 	TAILQ_INIT(&sc->mfi_cam_ccbq);
 
@@ -314,15 +385,29 @@ mfi_attach(struct mfi_softc *sc)
 	mfi_initq_busy(sc);
 	mfi_initq_bio(sc);
 
+	sc->adpreset = 0;
+	sc->last_seq_num = 0;
+	sc->disableOnlineCtrlReset = 1;
+	sc->issuepend_done = 1;
+	sc->hw_crit_error = 0;
+
 	if (sc->mfi_flags & MFI_FLAGS_1064R) {
 		sc->mfi_enable_intr = mfi_enable_intr_xscale;
 		sc->mfi_read_fw_status = mfi_read_fw_status_xscale;
 		sc->mfi_check_clear_intr = mfi_check_clear_intr_xscale;
 		sc->mfi_issue_cmd = mfi_issue_cmd_xscale;
-	}
-	else {
+	} else if (sc->mfi_flags & MFI_FLAGS_TBOLT) {
+		sc->mfi_enable_intr = mfi_tbolt_enable_intr_ppc;
+		sc->mfi_disable_intr = mfi_tbolt_disable_intr_ppc;
+		sc->mfi_read_fw_status = mfi_tbolt_read_fw_status_ppc;
+		sc->mfi_check_clear_intr = mfi_tbolt_check_clear_intr_ppc;
+		sc->mfi_issue_cmd = mfi_tbolt_issue_cmd_ppc;
+		sc->mfi_adp_reset = mfi_tbolt_adp_reset;
+		sc->mfi_tbolt = 1;
+		TAILQ_INIT(&sc->mfi_cmd_tbolt_tqh);
+	} else {
 		sc->mfi_enable_intr =  mfi_enable_intr_ppc;
- 		sc->mfi_read_fw_status = mfi_read_fw_status_ppc;
+		sc->mfi_read_fw_status = mfi_read_fw_status_ppc;
 		sc->mfi_check_clear_intr = mfi_check_clear_intr_ppc;
 		sc->mfi_issue_cmd = mfi_issue_cmd_ppc;
 	}
@@ -335,6 +420,32 @@ mfi_attach(struct mfi_softc *sc)
 		return (ENXIO);
 	}
 
+	/* Start: LSIP200113393 */
+	if (bus_dma_tag_create( sc->mfi_parent_dmat,	/* parent */
+				1, 0,			/* algnmnt, boundary */
+				BUS_SPACE_MAXADDR_32BIT,/* lowaddr */
+				BUS_SPACE_MAXADDR,	/* highaddr */
+				NULL, NULL,		/* filter, filterarg */
+				MEGASAS_MAX_NAME*sizeof(bus_addr_t),			/* maxsize */
+				1,			/* msegments */
+				MEGASAS_MAX_NAME*sizeof(bus_addr_t),			/* maxsegsize */
+				0,			/* flags */
+				NULL, NULL,		/* lockfunc, lockarg */
+				&sc->verbuf_h_dmat)) {
+		device_printf(sc->mfi_dev, "Cannot allocate verbuf_h_dmat DMA tag\n");
+		return (ENOMEM);
+	}
+	if (bus_dmamem_alloc(sc->verbuf_h_dmat, (void **)&sc->verbuf,
+	    BUS_DMA_NOWAIT, &sc->verbuf_h_dmamap)) {
+		device_printf(sc->mfi_dev, "Cannot allocate verbuf_h_dmamap memory\n");
+		return (ENOMEM);
+	}
+	bzero(sc->verbuf, MEGASAS_MAX_NAME*sizeof(bus_addr_t));
+	bus_dmamap_load(sc->verbuf_h_dmat, sc->verbuf_h_dmamap,
+	    sc->verbuf, MEGASAS_MAX_NAME*sizeof(bus_addr_t),
+	    mfi_addr_cb, &sc->verbuf_h_busaddr, 0);
+	/* End: LSIP200113393 */
+
 	/*
 	 * Get information needed for sizing the contiguous memory for the
 	 * frame pool.  Size down the sgl parameter since we know that
@@ -347,6 +458,100 @@ mfi_attach(struct mfi_softc *sc)
 	max_fw_sge = (status & MFI_FWSTATE_MAXSGL_MASK) >> 16;
 	sc->mfi_max_sge = min(max_fw_sge, ((MFI_MAXPHYS / PAGE_SIZE) + 1));
 
+	/* ThunderBolt Support get the contiguous memory */
+
+	if (sc->mfi_flags & MFI_FLAGS_TBOLT) {
+		mfi_tbolt_init_globals(sc);
+		device_printf(sc->mfi_dev, "MaxCmd = %x MaxSgl = %x state = %x \n",
+		    sc->mfi_max_fw_cmds, sc->mfi_max_sge, status);
+		tb_mem_size = mfi_tbolt_get_memory_requirement(sc);
+
+		if (bus_dma_tag_create( sc->mfi_parent_dmat,	/* parent */
+				1, 0,			/* algnmnt, boundary */
+				BUS_SPACE_MAXADDR_32BIT,/* lowaddr */
+				BUS_SPACE_MAXADDR,	/* highaddr */
+				NULL, NULL,		/* filter, filterarg */
+				tb_mem_size,		/* maxsize */
+				1,			/* msegments */
+				tb_mem_size,		/* maxsegsize */
+				0,			/* flags */
+				NULL, NULL,		/* lockfunc, lockarg */
+				&sc->mfi_tb_dmat)) {
+			device_printf(sc->mfi_dev, "Cannot allocate comms DMA tag\n");
+			return (ENOMEM);
+		}
+		if (bus_dmamem_alloc(sc->mfi_tb_dmat, (void **)&sc->request_message_pool,
+		BUS_DMA_NOWAIT, &sc->mfi_tb_dmamap)) {
+			device_printf(sc->mfi_dev, "Cannot allocate comms memory\n");
+			return (ENOMEM);
+		}
+		bzero(sc->request_message_pool, tb_mem_size);
+		bus_dmamap_load(sc->mfi_tb_dmat, sc->mfi_tb_dmamap,
+		sc->request_message_pool, tb_mem_size, mfi_addr_cb, &sc->mfi_tb_busaddr, 0);
+
+		/* For ThunderBolt memory init */
+		if (bus_dma_tag_create( sc->mfi_parent_dmat,	/* parent */
+				0x100, 0,		/* alignmnt, boundary */
+				BUS_SPACE_MAXADDR_32BIT,/* lowaddr */
+				BUS_SPACE_MAXADDR,	/* highaddr */
+				NULL, NULL,		/* filter, filterarg */
+				MFI_FRAME_SIZE,		/* maxsize */
+				1,			/* msegments */
+				MFI_FRAME_SIZE,		/* maxsegsize */
+				0,			/* flags */
+				NULL, NULL,		/* lockfunc, lockarg */
+				&sc->mfi_tb_init_dmat)) {
+		device_printf(sc->mfi_dev, "Cannot allocate init DMA tag\n");
+		return (ENOMEM);
+		}
+		if (bus_dmamem_alloc(sc->mfi_tb_init_dmat, (void **)&sc->mfi_tb_init,
+		    BUS_DMA_NOWAIT, &sc->mfi_tb_init_dmamap)) {
+			device_printf(sc->mfi_dev, "Cannot allocate init memory\n");
+			return (ENOMEM);
+		}
+		bzero(sc->mfi_tb_init, MFI_FRAME_SIZE);
+		bus_dmamap_load(sc->mfi_tb_init_dmat, sc->mfi_tb_init_dmamap,
+		sc->mfi_tb_init, MFI_FRAME_SIZE, mfi_addr_cb,
+		    &sc->mfi_tb_init_busaddr, 0);
+		if (mfi_tbolt_init_desc_pool(sc, sc->request_message_pool,
+		    tb_mem_size)) {
+			device_printf(sc->mfi_dev,
+			    "Thunderbolt pool preparation error\n");
+			return 0;
+		}
+
+		/*
+		  Allocate DMA memory mapping for MPI2 IOC Init descriptor,
+		  we are taking it diffrent from what we have allocated for Request
+		  and reply descriptors to avoid confusion later
+		*/
+		tb_mem_size = sizeof(struct MPI2_IOC_INIT_REQUEST);
+		if (bus_dma_tag_create( sc->mfi_parent_dmat,	/* parent */
+				1, 0,			/* algnmnt, boundary */
+				BUS_SPACE_MAXADDR_32BIT,/* lowaddr */
+				BUS_SPACE_MAXADDR,	/* highaddr */
+				NULL, NULL,		/* filter, filterarg */
+				tb_mem_size,		/* maxsize */
+				1,			/* msegments */
+				tb_mem_size,		/* maxsegsize */
+				0,			/* flags */
+				NULL, NULL,		/* lockfunc, lockarg */
+				&sc->mfi_tb_ioc_init_dmat)) {
+			device_printf(sc->mfi_dev,
+			    "Cannot allocate comms DMA tag\n");
+			return (ENOMEM);
+		}
+		if (bus_dmamem_alloc(sc->mfi_tb_ioc_init_dmat,
+		    (void **)&sc->mfi_tb_ioc_init_desc,
+		    BUS_DMA_NOWAIT, &sc->mfi_tb_ioc_init_dmamap)) {
+			device_printf(sc->mfi_dev, "Cannot allocate comms memory\n");
+			return (ENOMEM);
+		}
+		bzero(sc->mfi_tb_ioc_init_desc, tb_mem_size);
+		bus_dmamap_load(sc->mfi_tb_ioc_init_dmat, sc->mfi_tb_ioc_init_dmamap,
+		sc->mfi_tb_ioc_init_desc, tb_mem_size, mfi_addr_cb,
+		    &sc->mfi_tb_ioc_init_busaddr, 0);
+	}
 	/*
 	 * Create the dma tag for data buffers.  Used both for block I/O
 	 * and for various internal data queries.
@@ -396,8 +601,7 @@ mfi_attach(struct mfi_softc *sc)
 	}
 	bzero(sc->mfi_comms, commsz);
 	bus_dmamap_load(sc->mfi_comms_dmat, sc->mfi_comms_dmamap,
-	    sc->mfi_comms, commsz, mfi_addr32_cb, &sc->mfi_comms_busaddr, 0);
-
+	    sc->mfi_comms, commsz, mfi_addr_cb, &sc->mfi_comms_busaddr, 0);
 	/*
 	 * Allocate DMA memory for the command frames.  Keep them in the
 	 * lower 4GB for efficiency.  Calculate the size of the commands at
@@ -414,6 +618,8 @@ mfi_attach(struct mfi_softc *sc)
 	} else {
 		sc->mfi_sge_size = sizeof(struct mfi_sg32);
 	}
+	if (sc->mfi_flags & MFI_FLAGS_SKINNY)
+		sc->mfi_sge_size = sizeof(struct mfi_sg_skinny);
 	frames = (sc->mfi_sge_size * sc->mfi_max_sge - 1) / MFI_FRAME_SIZE + 2;
 	sc->mfi_cmd_size = frames * MFI_FRAME_SIZE;
 	framessz = sc->mfi_cmd_size * sc->mfi_max_fw_cmds;
@@ -438,8 +644,7 @@ mfi_attach(struct mfi_softc *sc)
 	}
 	bzero(sc->mfi_frames, framessz);
 	bus_dmamap_load(sc->mfi_frames_dmat, sc->mfi_frames_dmamap,
-	    sc->mfi_frames, framessz, mfi_addr32_cb, &sc->mfi_frames_busaddr,0);
-
+	    sc->mfi_frames, framessz, mfi_addr_cb, &sc->mfi_frames_busaddr,0);
 	/*
 	 * Allocate DMA memory for the frame sense data.  Keep them in the
 	 * lower 4GB for efficiency
@@ -465,32 +670,47 @@ mfi_attach(struct mfi_softc *sc)
 		return (ENOMEM);
 	}
 	bus_dmamap_load(sc->mfi_sense_dmat, sc->mfi_sense_dmamap,
-	    sc->mfi_sense, sensesz, mfi_addr32_cb, &sc->mfi_sense_busaddr, 0);
-
+	    sc->mfi_sense, sensesz, mfi_addr_cb, &sc->mfi_sense_busaddr, 0);
 	if ((error = mfi_alloc_commands(sc)) != 0)
 		return (error);
 
-	if ((error = mfi_comms_init(sc)) != 0)
-		return (error);
+	/* Before moving the FW to operational state, check whether
+	 * hostmemory is required by the FW or not
+	 */
 
-	if ((error = mfi_get_controller_info(sc)) != 0)
-		return (error);
+	/* ThunderBolt MFI_IOC2 INIT */
+	if (sc->mfi_flags & MFI_FLAGS_TBOLT) {
+		sc->mfi_disable_intr(sc);
+		if ((error = mfi_tbolt_init_MFI_queue(sc)) != 0) {
+			device_printf(sc->mfi_dev,
+			    "TB Init has failed with error %d\n",error);
+			return error;
+		}
 
-	mtx_lock(&sc->mfi_io_lock);
-	if ((error = mfi_aen_setup(sc, 0), 0) != 0) {
-		mtx_unlock(&sc->mfi_io_lock);
-		return (error);
-	}
-	mtx_unlock(&sc->mfi_io_lock);
+		if ((error = mfi_tbolt_alloc_cmd(sc)) != 0)
+			return error;
+		if (bus_setup_intr(sc->mfi_dev, sc->mfi_irq,
+		    INTR_MPSAFE|INTR_TYPE_BIO, NULL, mfi_intr_tbolt, sc,
+		    &sc->mfi_intr)) {
+			device_printf(sc->mfi_dev, "Cannot set up interrupt\n");
+			return (EINVAL);
+		}
+		sc->mfi_enable_intr(sc);
+		sc->map_id = 0;
+	} else {
+		if ((error = mfi_comms_init(sc)) != 0)
+			return (error);
 
-	/*
-	 * Set up the interrupt handler.
-	 */
-	if (bus_setup_intr(sc->mfi_dev, sc->mfi_irq, INTR_MPSAFE|INTR_TYPE_BIO,
-	    NULL, mfi_intr, sc, &sc->mfi_intr)) {
-		device_printf(sc->mfi_dev, "Cannot set up interrupt\n");
-		return (EINVAL);
+		if (bus_setup_intr(sc->mfi_dev, sc->mfi_irq,
+		    INTR_MPSAFE|INTR_TYPE_BIO, NULL, mfi_intr, sc, &sc->mfi_intr)) {
+			device_printf(sc->mfi_dev, "Cannot set up interrupt\n");
+			return (EINVAL);
+		}
+		sc->mfi_enable_intr(sc);
 	}
+	if ((error = mfi_get_controller_info(sc)) != 0)
+		return (error);
+	sc->disableOnlineCtrlReset = 0;
 
 	/* Register a config hook to probe the bus for arrays */
 	sc->mfi_ich.ich_func = mfi_startup;
@@ -500,6 +720,10 @@ mfi_attach(struct mfi_softc *sc)
 		    "hook\n");
 		return (EINVAL);
 	}
+	if ((error = mfi_aen_setup(sc, 0), 0) != 0) {
+		mtx_unlock(&sc->mfi_io_lock);
+		return (error);
+	}
 
 	/*
 	 * Register a shutdown handler.
@@ -571,8 +795,11 @@ mfi_alloc_commands(struct mfi_softc *sc)
 		cm->cm_sc = sc;
 		cm->cm_index = i;
 		if (bus_dmamap_create(sc->mfi_buffer_dmat, 0,
-		    &cm->cm_dmamap) == 0)
+		    &cm->cm_dmamap) == 0) {
+			mtx_lock(&sc->mfi_io_lock);
 			mfi_release_command(cm);
+			mtx_unlock(&sc->mfi_io_lock);
+		}
 		else
 			break;
 		sc->mfi_total_cmds++;
@@ -587,6 +814,8 @@ mfi_release_command(struct mfi_command *
 	struct mfi_frame_header *hdr;
 	uint32_t *hdr_data;
 
+	mtx_assert(&cm->cm_sc->mfi_io_lock, MA_OWNED);
+
 	/*
 	 * Zero out the important fields of the frame, but make sure the
 	 * context field is preserved.  For efficiency, handle the fields
@@ -611,24 +840,31 @@ mfi_release_command(struct mfi_command *
 	cm->cm_data = NULL;
 	cm->cm_sg = 0;
 	cm->cm_total_frame_size = 0;
+	cm->retry_for_fw_reset = 0;
 
 	mfi_enqueue_free(cm);
 }
 
 static int
-mfi_dcmd_command(struct mfi_softc *sc, struct mfi_command **cmp, uint32_t opcode,
-    void **bufp, size_t bufsize)
+mfi_dcmd_command(struct mfi_softc *sc, struct mfi_command **cmp,
+    uint32_t opcode, void **bufp, size_t bufsize)
 {
 	struct mfi_command *cm;
 	struct mfi_dcmd_frame *dcmd;
 	void *buf = NULL;
-	
+	uint32_t context = 0;
+
 	mtx_assert(&sc->mfi_io_lock, MA_OWNED);
-	
+
 	cm = mfi_dequeue_free(sc);
 	if (cm == NULL)
 		return (EBUSY);
 
+	/* Zero out the MFI frame */
+	context = cm->cm_frame->header.context;
+	bzero(cm->cm_frame, sizeof(union mfi_frame));
+	cm->cm_frame->header.context = context;
+
 	if ((bufsize > 0) && (bufp != NULL)) {
 		if (*bufp == NULL) {
 			buf = malloc(bufsize, M_MFIBUF, M_NOWAIT|M_ZERO);
@@ -648,6 +884,7 @@ mfi_dcmd_command(struct mfi_softc *sc, s
 	dcmd->header.timeout = 0;
 	dcmd->header.flags = 0;
 	dcmd->header.data_len = bufsize;
+	dcmd->header.scsi_status = 0;
 	dcmd->opcode = opcode;
 	cm->cm_sg = &dcmd->sgl;
 	cm->cm_total_frame_size = MFI_DCMD_FRAME_SIZE;
@@ -669,11 +906,17 @@ mfi_comms_init(struct mfi_softc *sc)
 	struct mfi_init_frame *init;
 	struct mfi_init_qinfo *qinfo;
 	int error;
+	uint32_t context = 0;
 
 	mtx_lock(&sc->mfi_io_lock);
 	if ((cm = mfi_dequeue_free(sc)) == NULL)
 		return (EBUSY);
 
+	/* Zero out the MFI frame */
+	context = cm->cm_frame->header.context;
+	bzero(cm->cm_frame, sizeof(union mfi_frame));
+	cm->cm_frame->header.context = context;
+
 	/*
 	 * Abuse the SG list area of the frame to hold the init_qinfo
 	 * object;
@@ -734,9 +977,11 @@ mfi_get_controller_info(struct mfi_softc
 	    BUS_DMASYNC_POSTREAD);
 	bus_dmamap_unload(sc->mfi_buffer_dmat, cm->cm_dmamap);
 
-	max_sectors_1 = (1 << ci->stripe_sz_ops.min) * ci->max_strips_per_io;
+	max_sectors_1 = (1 << ci->stripe_sz_ops.max) * ci->max_strips_per_io;
 	max_sectors_2 = ci->max_request_size;
 	sc->mfi_max_io = min(max_sectors_1, max_sectors_2);
+	sc->disableOnlineCtrlReset =
+	    ci->properties.OnOffProperties.disableOnlineCtrlReset;
 
 out:
 	if (ci)
@@ -753,6 +998,7 @@ mfi_get_log_state(struct mfi_softc *sc, 
 	struct mfi_command *cm = NULL;
 	int error;
 
+	mtx_lock(&sc->mfi_io_lock);
 	error = mfi_dcmd_command(sc, &cm, MFI_DCMD_CTRL_EVENT_GETINFO,
 	    (void **)log_state, sizeof(**log_state));
 	if (error)
@@ -771,11 +1017,12 @@ mfi_get_log_state(struct mfi_softc *sc, 
 out:
 	if (cm)
 		mfi_release_command(cm);
+	mtx_unlock(&sc->mfi_io_lock);
 
 	return (error);
 }
 
-static int
+int
 mfi_aen_setup(struct mfi_softc *sc, uint32_t seq_start)
 {
 	struct mfi_evt_log_state *log_state = NULL;
@@ -789,6 +1036,7 @@ mfi_aen_setup(struct mfi_softc *sc, uint
 
 	if (seq_start == 0) {
 		error = mfi_get_log_state(sc, &log_state);
+		sc->mfi_boot_seq_num = log_state->boot_seq_num;
 		if (error) {
 			if (log_state)
 				free(log_state, M_MFIBUF);
@@ -810,7 +1058,7 @@ mfi_aen_setup(struct mfi_softc *sc, uint
 	return 0;
 }
 
-static int
+int
 mfi_wait_command(struct mfi_softc *sc, struct mfi_command *cm)
 {
 
@@ -883,6 +1131,64 @@ mfi_free(struct mfi_softc *sc)
 	if (sc->mfi_comms_dmat != NULL)
 		bus_dma_tag_destroy(sc->mfi_comms_dmat);
 
+	/* ThunderBolt contiguous memory free here */
+	if (sc->mfi_flags & MFI_FLAGS_TBOLT) {
+		if (sc->mfi_tb_busaddr != 0)
+			bus_dmamap_unload(sc->mfi_tb_dmat, sc->mfi_tb_dmamap);
+		if (sc->request_message_pool != NULL)
+			bus_dmamem_free(sc->mfi_tb_dmat, sc->request_message_pool,
+			    sc->mfi_tb_dmamap);
+		if (sc->mfi_tb_dmat != NULL)
+			bus_dma_tag_destroy(sc->mfi_tb_dmat);
+
+		/* Version buffer memory free */
+		/* Start LSIP200113393 */
+		if (sc->verbuf_h_busaddr != 0)
+			bus_dmamap_unload(sc->verbuf_h_dmat, sc->verbuf_h_dmamap);
+		if (sc->verbuf != NULL)
+			bus_dmamem_free(sc->verbuf_h_dmat, sc->verbuf,
+			    sc->verbuf_h_dmamap);
+		if (sc->verbuf_h_dmat != NULL)
+			bus_dma_tag_destroy(sc->verbuf_h_dmat);
+
+		/* End LSIP200113393 */
+		/* ThunderBolt INIT packet memory Free */
+		if (sc->mfi_tb_init_busaddr != 0)
+			bus_dmamap_unload(sc->mfi_tb_init_dmat, sc->mfi_tb_init_dmamap);
+		if (sc->mfi_tb_init != NULL)
+			bus_dmamem_free(sc->mfi_tb_init_dmat, sc->mfi_tb_init,
+			    sc->mfi_tb_init_dmamap);
+		if (sc->mfi_tb_init_dmat != NULL)
+			bus_dma_tag_destroy(sc->mfi_tb_init_dmat);
+
+		/* ThunderBolt IOC Init Desc memory free here */
+		if (sc->mfi_tb_ioc_init_busaddr != 0)
+			bus_dmamap_unload(sc->mfi_tb_ioc_init_dmat,
+			    sc->mfi_tb_ioc_init_dmamap);
+		if (sc->mfi_tb_ioc_init_desc != NULL)
+			bus_dmamem_free(sc->mfi_tb_ioc_init_dmat,
+			    sc->mfi_tb_ioc_init_desc,
+			    sc->mfi_tb_ioc_init_dmamap);
+		if (sc->mfi_tb_ioc_init_dmat != NULL)
+			bus_dma_tag_destroy(sc->mfi_tb_ioc_init_dmat);
+		for (int i = 0; i < sc->mfi_max_fw_cmds; i++) {
+			if (sc->mfi_cmd_pool_tbolt != NULL) {
+				if (sc->mfi_cmd_pool_tbolt[i] != NULL) {
+					free(sc->mfi_cmd_pool_tbolt[i],
+					    M_MFIBUF);
+					sc->mfi_cmd_pool_tbolt[i] = NULL;
+				}
+			}
+		}
+		if (sc->mfi_cmd_pool_tbolt != NULL) {
+			free(sc->mfi_cmd_pool_tbolt, M_MFIBUF);
+			sc->mfi_cmd_pool_tbolt = NULL;
+		}
+		if (sc->request_desc_pool != NULL) {
+			free(sc->request_desc_pool, M_MFIBUF);
+			sc->request_desc_pool = NULL;
+		}
+	}
 	if (sc->mfi_buffer_dmat != NULL)
 		bus_dma_tag_destroy(sc->mfi_buffer_dmat);
 	if (sc->mfi_parent_dmat != NULL)
@@ -909,6 +1215,8 @@ mfi_startup(void *arg)
 	sx_xlock(&sc->mfi_config_lock);
 	mtx_lock(&sc->mfi_io_lock);
 	mfi_ldprobe(sc);
+	if (sc->mfi_flags & MFI_FLAGS_SKINNY)
+	    mfi_syspdprobe(sc);
 	mtx_unlock(&sc->mfi_io_lock);
 	sx_xunlock(&sc->mfi_config_lock);
 }
@@ -925,12 +1233,7 @@ mfi_intr(void *arg)
 	if (sc->mfi_check_clear_intr(sc))
 		return;
 
-	/*
-	 * Do a dummy read to flush the interrupt ACK that we just performed,
-	 * ensuring that everything is really, truly consistent.
-	 */
-	(void)sc->mfi_read_fw_status(sc);
-
+restart:
 	pi = sc->mfi_comms->hw_pi;
 	ci = sc->mfi_comms->hw_ci;
 	mtx_lock(&sc->mfi_io_lock);
@@ -955,6 +1258,14 @@ mfi_intr(void *arg)
 	mfi_startio(sc);
 	mtx_unlock(&sc->mfi_io_lock);
 
+	/*
+	 * Dummy read to flush the bus; this ensures that the indexes are up
+	 * to date.  Restart processing if more commands have come it.
+	 */
+	(void)sc->mfi_read_fw_status(sc);
+	if (pi != sc->mfi_comms->hw_pi)
+		goto restart;
+
 	return;
 }
 
@@ -975,6 +1286,9 @@ mfi_shutdown(struct mfi_softc *sc)
 	if (sc->mfi_aen_cm != NULL)
 		mfi_abort(sc, sc->mfi_aen_cm);
 
+	if (sc->map_update_cmd != NULL)
+		mfi_abort(sc, sc->map_update_cmd);
+
 	dcmd = &cm->cm_frame->dcmd;
 	dcmd->header.flags = MFI_FRAME_DIR_NONE;
 	cm->cm_flags = MFI_CMD_POLLED;
@@ -990,6 +1304,81 @@ mfi_shutdown(struct mfi_softc *sc)
 }
 
 static void
+mfi_syspdprobe(struct mfi_softc *sc)
+{
+	struct mfi_frame_header *hdr;
+	struct mfi_command *cm = NULL;
+	struct mfi_pd_list *pdlist = NULL;
+	struct mfi_system_pd *syspd, *tmp;
+	int error, i, found;
+
+	sx_assert(&sc->mfi_config_lock, SA_XLOCKED);
+	mtx_assert(&sc->mfi_io_lock, MA_OWNED);
+	/* Add SYSTEM PD's */
+	error = mfi_dcmd_command(sc, &cm, MFI_DCMD_PD_LIST_QUERY,
+	    (void **)&pdlist, sizeof(*pdlist));
+	if (error){
+		device_printf(sc->mfi_dev,
+		    "Error while forming SYSTEM PD list\n");
+		goto out;
+	}
+
+	cm->cm_flags = MFI_CMD_DATAIN | MFI_CMD_POLLED;
+	cm->cm_frame->dcmd.mbox[0] = MR_PD_QUERY_TYPE_EXPOSED_TO_HOST;
+	cm->cm_frame->dcmd.mbox[1] = 0;
+	if (mfi_mapcmd(sc, cm) != 0) {
+		device_printf(sc->mfi_dev,
+		    "Failed to get syspd device listing\n");
+		goto out;
+	}
+	bus_dmamap_sync(sc->mfi_buffer_dmat,cm->cm_dmamap,
+	    BUS_DMASYNC_POSTREAD);
+	bus_dmamap_unload(sc->mfi_buffer_dmat, cm->cm_dmamap);
+	hdr = &cm->cm_frame->header;
+	if (hdr->cmd_status != MFI_STAT_OK) {
+		device_printf(sc->mfi_dev,
+		    "MFI_DCMD_PD_LIST_QUERY failed %x\n", hdr->cmd_status);
+		goto out;
+	}
+	/* Get each PD and add it to the system */
+	for (i = 0; i < pdlist->count; i++) {
+		if (pdlist->addr[i].device_id ==
+		    pdlist->addr[i].encl_device_id)
+			continue;
+		found = 0;
+		TAILQ_FOREACH(syspd, &sc->mfi_syspd_tqh, pd_link) {
+			if (syspd->pd_id == pdlist->addr[i].device_id)
+				found = 1;
+		}
+		if (found == 0)
+			mfi_add_sys_pd(sc, pdlist->addr[i].device_id);
+	}
+	/* Delete SYSPD's whose state has been changed */
+	TAILQ_FOREACH_SAFE(syspd, &sc->mfi_syspd_tqh, pd_link, tmp) {
+		found = 0;
+		for (i = 0; i < pdlist->count; i++) {
+			if (syspd->pd_id == pdlist->addr[i].device_id)
+				found = 1;
+		}
+		if (found == 0) {
+			printf("DELETE\n");
+			mtx_unlock(&sc->mfi_io_lock);
+			mtx_lock(&Giant);
+			device_delete_child(sc->mfi_dev, syspd->pd_dev);
+			mtx_unlock(&Giant);
+			mtx_lock(&sc->mfi_io_lock);
+		}
+	}
+out:
+	if (pdlist)
+	    free(pdlist, M_MFIBUF);
+	if (cm)
+	    mfi_release_command(cm);
+
+	return;
+}
+
+static void
 mfi_ldprobe(struct mfi_softc *sc)
 {
 	struct mfi_frame_header *hdr;
@@ -1083,10 +1472,124 @@ format_class(int8_t class)
 static void
 mfi_decode_evt(struct mfi_softc *sc, struct mfi_evt_detail *detail)
 {
+	struct mfi_system_pd *syspd = NULL;
 
 	device_printf(sc->mfi_dev, "%d (%s/0x%04x/%s) - %s\n", detail->seq,
 	    format_timestamp(detail->time), detail->evt_class.members.locale,
-	    format_class(detail->evt_class.members.evt_class), detail->description);
+	    format_class(detail->evt_class.members.evt_class),
+	    detail->description);
+
+        /* Don't act on old AEN's or while shutting down */
+        if (detail->seq < sc->mfi_boot_seq_num || sc->mfi_detaching)
+                return;
+
+	switch (detail->arg_type) {
+	case MR_EVT_ARGS_NONE:
+		if (detail->code == MR_EVT_CTRL_HOST_BUS_SCAN_REQUESTED) {
+		    device_printf(sc->mfi_dev, "HostBus scan raised\n");
+			if (mfi_detect_jbod_change) {
+				/*
+				 * Probe for new SYSPD's and Delete
+				 * invalid SYSPD's
+				 */
+				sx_xlock(&sc->mfi_config_lock);
+				mtx_lock(&sc->mfi_io_lock);
+				mfi_syspdprobe(sc);
+				mtx_unlock(&sc->mfi_io_lock);
+				sx_xunlock(&sc->mfi_config_lock);
+			}
+		}
+		break;
+	case MR_EVT_ARGS_LD_STATE:
+		/* During load time driver reads all the events starting
+		 * from the one that has been logged after shutdown. Avoid
+		 * these old events.
+		 */
+		if (detail->args.ld_state.new_state == MFI_LD_STATE_OFFLINE ) {
+			/* Remove the LD */
+			struct mfi_disk *ld;
+			TAILQ_FOREACH(ld, &sc->mfi_ld_tqh, ld_link) {
+				if (ld->ld_id ==
+				    detail->args.ld_state.ld.target_id)
+					break;
+			}
+			/*
+			Fix: for kernel panics when SSCD is removed
+			KASSERT(ld != NULL, ("volume dissappeared"));
+			*/
+			if (ld != NULL) {
+				mtx_lock(&Giant);
+				device_delete_child(sc->mfi_dev, ld->ld_dev);
+				mtx_unlock(&Giant);
+			}
+		}
+		break;
+	case MR_EVT_ARGS_PD:
+		if (detail->code == MR_EVT_PD_REMOVED) {
+			if (mfi_detect_jbod_change) {
+				/*
+				 * If the removed device is a SYSPD then
+				 * delete it
+				 */
+				TAILQ_FOREACH(syspd, &sc->mfi_syspd_tqh,
+				    pd_link) {
+					if (syspd->pd_id ==
+					    detail->args.pd.device_id) {
+						mtx_lock(&Giant);
+						device_delete_child(
+						    sc->mfi_dev,
+						    syspd->pd_dev);
+						mtx_unlock(&Giant);
+						break;
+					}
+				}
+			}
+		}
+		if (detail->code == MR_EVT_PD_INSERTED) {
+			if (mfi_detect_jbod_change) {
+				/* Probe for new SYSPD's */
+				sx_xlock(&sc->mfi_config_lock);
+				mtx_lock(&sc->mfi_io_lock);
+				mfi_syspdprobe(sc);
+				mtx_unlock(&sc->mfi_io_lock);
+				sx_xunlock(&sc->mfi_config_lock);
+			}
+		}
+		break;
+	}
+}

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***

From owner-svn-src-head@FreeBSD.ORG  Fri Mar 30 23:39:40 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 22F04106564A;
	Fri, 30 Mar 2012 23:39:40 +0000 (UTC)
	(envelope-from ambrisko@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id E80BB8FC0C;
	Fri, 30 Mar 2012 23:39:39 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2UNddvu063081;
	Fri, 30 Mar 2012 23:39:39 GMT
	(envelope-from ambrisko@svn.freebsd.org)
Received: (from ambrisko@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2UNddkK063078;
	Fri, 30 Mar 2012 23:39:39 GMT
	(envelope-from ambrisko@svn.freebsd.org)
Message-Id: <201203302339.q2UNddkK063078@svn.freebsd.org>
From: Doug Ambrisko 
Date: Fri, 30 Mar 2012 23:39:39 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233713 - head/usr.sbin/mfiutil
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 30 Mar 2012 23:39:40 -0000

Author: ambrisko
Date: Fri Mar 30 23:39:39 2012
New Revision: 233713
URL: http://svn.freebsd.org/changeset/base/233713

Log:
  MFhead_mfi r233621
          Remove the magic mfi_array is 288 bytes and just use the
          sizeof the array since it is not 288 bytes.
  
          Change reporting of a "SYSTEM" disk to "JBOD" to match
          LSI MegaCli and firmware reporting.
  
          This means that fiutil command to "create jbod" is now a
          little confusing since a RAID per drive is not really what
          LSI defines JBOD to be.  This should be fixed in the future
          and support added to really create LSI JBOD and enable that
          feature on cards that support it.

Modified:
  head/usr.sbin/mfiutil/mfi_config.c
  head/usr.sbin/mfiutil/mfi_drive.c
Directory Properties:
  head/   (props changed)

Modified: head/usr.sbin/mfiutil/mfi_config.c
==============================================================================
--- head/usr.sbin/mfiutil/mfi_config.c	Fri Mar 30 23:24:44 2012	(r233712)
+++ head/usr.sbin/mfiutil/mfi_config.c	Fri Mar 30 23:39:39 2012	(r233713)
@@ -211,9 +211,8 @@ clear_config(int ac, char **av)
 }
 MFI_COMMAND(top, clear, clear_config);
 
-#define	MFI_ARRAY_SIZE		288
-#define	MAX_DRIVES_PER_ARRAY						\
-	((MFI_ARRAY_SIZE - sizeof(struct mfi_array)) / 8)
+#define MAX_DRIVES_PER_ARRAY MFI_MAX_ROW_SIZE
+#define MFI_ARRAY_SIZE sizeof(struct mfi_array)
 
 #define	RT_RAID0	0
 #define	RT_RAID1	1
@@ -305,7 +304,7 @@ parse_array(int fd, int raid_type, char 
 
 	/* Validate the number of drives for this array. */
 	if (count >= MAX_DRIVES_PER_ARRAY) {
-		warnx("Too many drives for a single array: max is %zu",
+		warnx("Too many drives for a single array: max is %d",
 		    MAX_DRIVES_PER_ARRAY);
 		return (EINVAL);
 	}

Modified: head/usr.sbin/mfiutil/mfi_drive.c
==============================================================================
--- head/usr.sbin/mfiutil/mfi_drive.c	Fri Mar 30 23:24:44 2012	(r233712)
+++ head/usr.sbin/mfiutil/mfi_drive.c	Fri Mar 30 23:39:39 2012	(r233713)
@@ -149,7 +149,7 @@ mfi_pdstate(enum mfi_pd_state state)
 	case MFI_PD_STATE_COPYBACK:
 		return ("COPYBACK");
 	case MFI_PD_STATE_SYSTEM:
-		return ("SYSTEM");
+		return ("JBOD");
 	default:
 		sprintf(buf, "PSTATE 0x%04x", state);
 		return (buf);

From owner-svn-src-head@FreeBSD.ORG  Sat Mar 31 06:48:42 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 0C493106564A;
	Sat, 31 Mar 2012 06:48:42 +0000 (UTC)
	(envelope-from davidxu@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id D19508FC14;
	Sat, 31 Mar 2012 06:48:41 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2V6mfVq088251;
	Sat, 31 Mar 2012 06:48:41 GMT (envelope-from davidxu@svn.freebsd.org)
Received: (from davidxu@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2V6mfQE088249;
	Sat, 31 Mar 2012 06:48:41 GMT (envelope-from davidxu@svn.freebsd.org)
Message-Id: <201203310648.q2V6mfQE088249@svn.freebsd.org>
From: David Xu 
Date: Sat, 31 Mar 2012 06:48:41 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233729 - head/sys/kern
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 31 Mar 2012 06:48:42 -0000

Author: davidxu
Date: Sat Mar 31 06:48:41 2012
New Revision: 233729
URL: http://svn.freebsd.org/changeset/base/233729

Log:
  Remove stale comments.

Modified:
  head/sys/kern/kern_umtx.c

Modified: head/sys/kern/kern_umtx.c
==============================================================================
--- head/sys/kern/kern_umtx.c	Sat Mar 31 06:44:48 2012	(r233728)
+++ head/sys/kern/kern_umtx.c	Sat Mar 31 06:48:41 2012	(r233729)
@@ -1216,9 +1216,6 @@ do_lock_normal(struct thread *td, struct
 }
 
 /*
- * Lock PTHREAD_PRIO_NONE protocol POSIX mutex.
- */
-/*
  * Unlock PTHREAD_PRIO_NONE protocol POSIX mutex.
  */
 static int

From owner-svn-src-head@FreeBSD.ORG  Sat Mar 31 07:08:36 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id AC190106566B;
	Sat, 31 Mar 2012 07:08:36 +0000 (UTC)
	(envelope-from joel@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 7D4048FC08;
	Sat, 31 Mar 2012 07:08:36 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2V78a7d089109;
	Sat, 31 Mar 2012 07:08:36 GMT (envelope-from joel@svn.freebsd.org)
Received: (from joel@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2V78amG089107;
	Sat, 31 Mar 2012 07:08:36 GMT (envelope-from joel@svn.freebsd.org)
Message-Id: <201203310708.q2V78amG089107@svn.freebsd.org>
From: Joel Dahl 
Date: Sat, 31 Mar 2012 07:08:36 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233733 - head/share/man/man4
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 31 Mar 2012 07:08:36 -0000

Author: joel (doc committer)
Date: Sat Mar 31 07:08:35 2012
New Revision: 233733
URL: http://svn.freebsd.org/changeset/base/233733

Log:
  mdoc: use It for each item in the list and separate each cell with Ta.

Modified:
  head/share/man/man4/ahc.4

Modified: head/share/man/man4/ahc.4
==============================================================================
--- head/share/man/man4/ahc.4	Sat Mar 31 06:58:16 2012	(r233732)
+++ head/share/man/man4/ahc.4	Sat Mar 31 07:08:35 2012	(r233733)
@@ -147,21 +147,21 @@ Note that wide and twin channel features
 by a particular chip, may be disabled in a particular motherboard or card
 design.
 .Bd -ragged -offset indent
-.Bl -column "aic7770 " "10 " "EISA/VL  " "10MHz " "16bit " "SCBs " Features
-.Em "Chip       MIPS    Bus      MaxSync   MaxWidth  SCBs  Features"
-aic7770     10    EISA/VL    10MHz     16Bit     4    1
-aic7850     10    PCI/32     10MHz      8Bit     3
-aic7860     10    PCI/32     20MHz      8Bit     3
-aic7870     10    PCI/32     10MHz     16Bit    16
-aic7880     10    PCI/32     20MHz     16Bit    16
-aic7890     20    PCI/32     40MHz     16Bit    16        3 4 5 6 7 8
-aic7891     20    PCI/64     40MHz     16Bit    16        3 4 5 6 7 8
-aic7892     20    PCI/64     80MHz     16Bit    16        3 4 5 6 7 8
-aic7895     15    PCI/32     20MHz     16Bit    16      2 3 4 5
-aic7895C    15    PCI/32     20MHz     16Bit    16      2 3 4 5     8
-aic7896     20    PCI/32     40MHz     16Bit    16      2 3 4 5 6 7 8
-aic7897     20    PCI/64     40MHz     16Bit    16      2 3 4 5 6 7 8
-aic7899     20    PCI/64     80MHz     16Bit    16      2 3 4 5 6 7 8
+.Bl -column "aic7895CX" "MIPSX" "EISA/VLX" "MaxSyncX" "MaxWidthX" "SCBsX" "2 3 4 5 6 7 8X"
+.It Em "Chip" Ta "MIPS" Ta "Bus" Ta "MaxSync" Ta "MaxWidth" Ta "SCBs" Ta "Features"
+.It "aic7770" Ta "10" Ta "EISA/VL" Ta "10MHz" Ta "16Bit" Ta "4" Ta "1"
+.It "aic7850" Ta "10" Ta "PCI/32" Ta "10MHz" Ta "8Bit" Ta "3" Ta ""
+.It "aic7860" Ta "10" Ta "PCI/32" Ta "20MHz" Ta "8Bit" Ta "3" Ta ""
+.It "aic7870" Ta "10" Ta "PCI/32" Ta "10MHz" Ta "16Bit" Ta "16" Ta ""
+.It "aic7880" Ta "10" Ta "PCI/32" Ta "20MHz" Ta "16Bit" Ta "16" Ta ""
+.It "aic7890" Ta "20" Ta "PCI/32" Ta "40MHz" Ta "16Bit" Ta "16" Ta "3 4 5 6 7 8"
+.It "aic7891" Ta "20" Ta "PCI/64" Ta "40MHz" Ta "16Bit" Ta "16" Ta "3 4 5 6 7 8"
+.It "aic7892" Ta "20" Ta "PCI/64" Ta "80MHz" Ta "16Bit" Ta "16" Ta "3 4 5 6 7 8"
+.It "aic7895" Ta "15" Ta "PCI/32" Ta "20MHz" Ta "16Bit" Ta "16" Ta "2 3 4 5"
+.It "aic7895C" Ta "15" Ta "PCI/32" Ta "20MHz" Ta "16Bit" Ta "16" Ta "2 3 4 5 8"
+.It "aic7896" Ta "20" Ta "PCI/32" Ta "40MHz" Ta "16Bit" Ta "16" Ta "2 3 4 5 6 7 8"
+.It "aic7897" Ta "20" Ta "PCI/64" Ta "40MHz" Ta "16Bit" Ta "16" Ta "2 3 4 5 6 7 8"
+.It "aic7899" Ta "20" Ta "PCI/64" Ta "80MHz" Ta "16Bit" Ta "16" Ta "2 3 4 5 6 7 8"
 .El
 .Pp
 .Bl -enum -compact

From owner-svn-src-head@FreeBSD.ORG  Sat Mar 31 07:10:17 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 99768106566C;
	Sat, 31 Mar 2012 07:10:17 +0000 (UTC)
	(envelope-from joel@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 84BD08FC08;
	Sat, 31 Mar 2012 07:10:17 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2V7AH67089201;
	Sat, 31 Mar 2012 07:10:17 GMT (envelope-from joel@svn.freebsd.org)
Received: (from joel@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2V7AHIM089199;
	Sat, 31 Mar 2012 07:10:17 GMT (envelope-from joel@svn.freebsd.org)
Message-Id: <201203310710.q2V7AHIM089199@svn.freebsd.org>
From: Joel Dahl 
Date: Sat, 31 Mar 2012 07:10:17 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233734 - head/share/man/man9
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 31 Mar 2012 07:10:17 -0000

Author: joel (doc committer)
Date: Sat Mar 31 07:10:16 2012
New Revision: 233734
URL: http://svn.freebsd.org/changeset/base/233734

Log:
  Remove end of line whitespace.

Modified:
  head/share/man/man9/ieee80211_crypto.9

Modified: head/share/man/man9/ieee80211_crypto.9
==============================================================================
--- head/share/man/man9/ieee80211_crypto.9	Sat Mar 31 07:08:35 2012	(r233733)
+++ head/share/man/man9/ieee80211_crypto.9	Sat Mar 31 07:10:16 2012	(r233734)
@@ -127,7 +127,7 @@ driver is unable to provide necessary ha
 cipher modules register their services using
 .Fn ieee80211_crypto_register
 and supply a template that describes their operation.
-This 
+This
 .Vt ieee80211_cipher
 structure defines protocol-related state such as the number of bytes
 of space in the 802.11 header to reserve/remove during encap/decap
@@ -153,7 +153,7 @@ hardware.
 .Sh CRYPTO KEY MANAGEMENT
 The
 .Nm net80211
-layer implements a per-vap 4-element 
+layer implements a per-vap 4-element
 .Dq global key table
 and a per-station
 .Dq unicast key
@@ -235,7 +235,7 @@ to the driver that are already prepared 
 For receive, drivers mark frames with the
 .Dv M_WEP
 mbuf flag to indicate the hardware has decrypted the payload.
-If frames have the 
+If frames have the
 .Dv IEEE80211_FC1_WEP
 bit marked in their 802.11 header and are not tagged with
 .Dv M_WEP

From owner-svn-src-head@FreeBSD.ORG  Sat Mar 31 11:20:49 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 1AB05106566C;
	Sat, 31 Mar 2012 11:20:49 +0000 (UTC)
	(envelope-from glebius@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 054308FC0A;
	Sat, 31 Mar 2012 11:20:49 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2VBKmi1099515;
	Sat, 31 Mar 2012 11:20:48 GMT (envelope-from glebius@svn.freebsd.org)
Received: (from glebius@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2VBKmJT099513;
	Sat, 31 Mar 2012 11:20:48 GMT (envelope-from glebius@svn.freebsd.org)
Message-Id: <201203311120.q2VBKmJT099513@svn.freebsd.org>
From: Gleb Smirnoff 
Date: Sat, 31 Mar 2012 11:20:48 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233745 - head/sys/netinet/ipfw
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 31 Mar 2012 11:20:49 -0000

Author: glebius
Date: Sat Mar 31 11:20:48 2012
New Revision: 233745
URL: http://svn.freebsd.org/changeset/base/233745

Log:
  Don't check malloc(M_WAITOK) results.

Modified:
  head/sys/netinet/ipfw/ip_fw_sockopt.c

Modified: head/sys/netinet/ipfw/ip_fw_sockopt.c
==============================================================================
--- head/sys/netinet/ipfw/ip_fw_sockopt.c	Sat Mar 31 10:47:40 2012	(r233744)
+++ head/sys/netinet/ipfw/ip_fw_sockopt.c	Sat Mar 31 11:20:48 2012	(r233745)
@@ -163,8 +163,6 @@ ipfw_add_rule(struct ip_fw_chain *chain,
 
 	l = RULESIZE(input_rule);
 	rule = malloc(l, M_IPFW, M_WAITOK | M_ZERO);
-	if (rule == NULL)
-		return (ENOSPC);
 	/* get_map returns with IPFW_UH_WLOCK if successful */
 	map = get_map(chain, 1, 0 /* not locked */);
 	if (map == NULL) {
@@ -1010,8 +1008,6 @@ ipfw_ctl(struct sockopt *sopt)
 			if (size >= sopt->sopt_valsize)
 				break;
 			buf = malloc(size, M_TEMP, M_WAITOK);
-			if (buf == NULL)
-				break;
 			IPFW_UH_RLOCK(chain);
 			/* check again how much space we need */
 			want = chain->static_len + ipfw_dyn_len();

From owner-svn-src-head@FreeBSD.ORG  Sat Mar 31 11:23:10 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 7E0051065672;
	Sat, 31 Mar 2012 11:23:10 +0000 (UTC) (envelope-from mav@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 699ED8FC17;
	Sat, 31 Mar 2012 11:23:10 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2VBNAmM099662;
	Sat, 31 Mar 2012 11:23:10 GMT (envelope-from mav@svn.freebsd.org)
Received: (from mav@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2VBNAuU099660;
	Sat, 31 Mar 2012 11:23:10 GMT (envelope-from mav@svn.freebsd.org)
Message-Id: <201203311123.q2VBNAuU099660@svn.freebsd.org>
From: Alexander Motin 
Date: Sat, 31 Mar 2012 11:23:10 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233746 - head/sys/cam/scsi
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 31 Mar 2012 11:23:10 -0000

Author: mav
Date: Sat Mar 31 11:23:09 2012
New Revision: 233746
URL: http://svn.freebsd.org/changeset/base/233746

Log:
  Be more conservative in using READ CAPACITY(16) command. Previous code
  checked PROTECT bit in INQUIRY data for all SPC devices, while it is defined
  only since SPC-3. But there are some SPC-2 USB devices were reported, that
  have PROTECT bit set, return no error for READ CAPACITY(16) command, but
  return wrong sector count value in response.
  
  MFC after:	3 days

Modified:
  head/sys/cam/scsi/scsi_da.c

Modified: head/sys/cam/scsi/scsi_da.c
==============================================================================
--- head/sys/cam/scsi/scsi_da.c	Sat Mar 31 11:20:48 2012	(r233745)
+++ head/sys/cam/scsi/scsi_da.c	Sat Mar 31 11:23:09 2012	(r233746)
@@ -1631,9 +1631,7 @@ daregister(struct cam_periph *periph, vo
 		softc->minimum_cmd_size = 16;
 
 	/* Predict whether device may support READ CAPACITY(16). */
-	if (SID_ANSI_REV(&cgd->inq_data) >= SCSI_REV_SPC3 ||
-	    (SID_ANSI_REV(&cgd->inq_data) >= SCSI_REV_SPC &&
-	     (cgd->inq_data.spc3_flags & SPC3_SID_PROTECT))) {
+	if (SID_ANSI_REV(&cgd->inq_data) >= SCSI_REV_SPC3) {
 		softc->flags |= DA_FLAG_CAN_RC16;
 		softc->state = DA_STATE_PROBE2;
 	}

From owner-svn-src-head@FreeBSD.ORG  Sat Mar 31 13:56:24 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id BBB74106566C;
	Sat, 31 Mar 2012 13:56:24 +0000 (UTC)
	(envelope-from marius@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id A62828FC0C;
	Sat, 31 Mar 2012 13:56:24 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2VDuOQC004850;
	Sat, 31 Mar 2012 13:56:24 GMT (envelope-from marius@svn.freebsd.org)
Received: (from marius@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2VDuOYx004848;
	Sat, 31 Mar 2012 13:56:24 GMT (envelope-from marius@svn.freebsd.org)
Message-Id: <201203311356.q2VDuOYx004848@svn.freebsd.org>
From: Marius Strobl 
Date: Sat, 31 Mar 2012 13:56:24 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233747 - head/sys/sparc64/sparc64
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 31 Mar 2012 13:56:24 -0000

Author: marius
Date: Sat Mar 31 13:56:24 2012
New Revision: 233747
URL: http://svn.freebsd.org/changeset/base/233747

Log:
  Fix panic on kernel traps having a mapping in trap_sig b0rked in r206086.
  Repored by:	David E. Cross
  
  MFC after:	3 days

Modified:
  head/sys/sparc64/sparc64/trap.c

Modified: head/sys/sparc64/sparc64/trap.c
==============================================================================
--- head/sys/sparc64/sparc64/trap.c	Sat Mar 31 11:23:09 2012	(r233746)
+++ head/sys/sparc64/sparc64/trap.c	Sat Mar 31 13:56:24 2012	(r233747)
@@ -215,6 +215,9 @@ static const int trap_sig[] = {
 	-1,			/* kernel stack fault */
 };
 
+CTASSERT(sizeof(trap_msg) / sizeof(*trap_msg) == T_MAX);
+CTASSERT(sizeof(trap_sig) / sizeof(*trap_sig) == T_MAX);
+
 CTASSERT(sizeof(struct trapframe) == 256);
 
 int debugger_on_signal = 0;
@@ -298,7 +301,7 @@ trap(struct trapframe *tf)
 			sig = trap_cecc();
 			break;
 		default:
-			if (tf->tf_type < 0 || tf->tf_type >= T_MAX)
+			if (tf->tf_type < 0 || tf->tf_type > T_MAX)
 				panic("trap: bad trap type %#lx (user)",
 				    tf->tf_type);
 			else if (trap_sig[tf->tf_type] == -1)
@@ -402,12 +405,10 @@ trap(struct trapframe *tf)
 
 		if (error != 0) {
 			tf->tf_type &= ~T_KERNEL;
-			if (tf->tf_type < 0 || tf->tf_type >= T_MAX)
+			if (tf->tf_type < 0 || tf->tf_type > T_MAX)
 				panic("trap: bad trap type %#lx (kernel)",
 				    tf->tf_type);
-			else if (trap_sig[tf->tf_type] == -1)
-				panic("trap: %s (kernel)",
-				    trap_msg[tf->tf_type]);
+			panic("trap: %s (kernel)", trap_msg[tf->tf_type]);
 		}
 	}
 	CTR1(KTR_TRAP, "trap: td=%p return", td);

From owner-svn-src-head@FreeBSD.ORG  Sat Mar 31 14:03:17 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 7EFA5106564A;
	Sat, 31 Mar 2012 14:03:17 +0000 (UTC)
	(envelope-from marius@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 69A088FC0A;
	Sat, 31 Mar 2012 14:03:17 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2VE3HH3005100;
	Sat, 31 Mar 2012 14:03:17 GMT (envelope-from marius@svn.freebsd.org)
Received: (from marius@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2VE3HRP005098;
	Sat, 31 Mar 2012 14:03:17 GMT (envelope-from marius@svn.freebsd.org)
Message-Id: <201203311403.q2VE3HRP005098@svn.freebsd.org>
From: Marius Strobl 
Date: Sat, 31 Mar 2012 14:03:17 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233748 - head/sys/sparc64/sparc64
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 31 Mar 2012 14:03:17 -0000

Author: marius
Date: Sat Mar 31 14:03:16 2012
New Revision: 233748
URL: http://svn.freebsd.org/changeset/base/233748

Log:
  Remove checks that are redundant due to tf_type being unsigned.
  
  MFC after:	3 days

Modified:
  head/sys/sparc64/sparc64/trap.c

Modified: head/sys/sparc64/sparc64/trap.c
==============================================================================
--- head/sys/sparc64/sparc64/trap.c	Sat Mar 31 13:56:24 2012	(r233747)
+++ head/sys/sparc64/sparc64/trap.c	Sat Mar 31 14:03:16 2012	(r233748)
@@ -301,7 +301,7 @@ trap(struct trapframe *tf)
 			sig = trap_cecc();
 			break;
 		default:
-			if (tf->tf_type < 0 || tf->tf_type > T_MAX)
+			if (tf->tf_type > T_MAX)
 				panic("trap: bad trap type %#lx (user)",
 				    tf->tf_type);
 			else if (trap_sig[tf->tf_type] == -1)
@@ -405,7 +405,7 @@ trap(struct trapframe *tf)
 
 		if (error != 0) {
 			tf->tf_type &= ~T_KERNEL;
-			if (tf->tf_type < 0 || tf->tf_type > T_MAX)
+			if (tf->tf_type > T_MAX)
 				panic("trap: bad trap type %#lx (kernel)",
 				    tf->tf_type);
 			panic("trap: %s (kernel)", trap_msg[tf->tf_type]);

From owner-svn-src-head@FreeBSD.ORG  Sat Mar 31 14:25:12 2012
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id A3A60106566C;
	Sat, 31 Mar 2012 14:25:12 +0000 (UTC)
	(envelope-from theraven@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 8CDE48FC0A;
	Sat, 31 Mar 2012 14:25:12 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2VEPC06005794;
	Sat, 31 Mar 2012 14:25:12 GMT
	(envelope-from theraven@svn.freebsd.org)
Received: (from theraven@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2VEPCRZ005790;
	Sat, 31 Mar 2012 14:25:12 GMT
	(envelope-from theraven@svn.freebsd.org)
Message-Id: <201203311425.q2VEPCRZ005790@svn.freebsd.org>
From: David Chisnall 
Date: Sat, 31 Mar 2012 14:25:12 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233749 - in head/gnu/lib: libstdc++ libsupc++
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 31 Mar 2012 14:25:12 -0000

Author: theraven
Date: Sat Mar 31 14:25:12 2012
New Revision: 233749
URL: http://svn.freebsd.org/changeset/base/233749

Log:
  Make libsupc++ build as a shared library and make libstdc++ a filter library
  for it.
  
  This allows people to swap out libsupc++ for libcxxrt easily, so we can begin
  the libstdc++ -> libc++ migration.
  
  Approved by:	dim (mentor)

Added:
  head/gnu/lib/libsupc++/Version.map
     - copied, changed from r232970, head/contrib/libstdc++/config/abi/pre/gnu.ver
Modified:
  head/gnu/lib/libstdc++/Makefile
  head/gnu/lib/libsupc++/Makefile

Modified: head/gnu/lib/libstdc++/Makefile
==============================================================================
--- head/gnu/lib/libstdc++/Makefile	Sat Mar 31 14:03:16 2012	(r233748)
+++ head/gnu/lib/libstdc++/Makefile	Sat Mar 31 14:25:12 2012	(r233749)
@@ -25,7 +25,7 @@ CXXFLAGS+=	-fno-implicit-templates -ffun
 PO_CXXFLAGS=	${CXXFLAGS:N-ffunction-sections}
 
 DPADD=		${LIBM}
-LDADD=		-lm
+LDADD=		-lm  -Wl,-f,libsupc++.so.1
 
 # libstdc++ sources
 SRCS+=	bitmap_allocator.cc pool_allocator.cc \

Modified: head/gnu/lib/libsupc++/Makefile
==============================================================================
--- head/gnu/lib/libsupc++/Makefile	Sat Mar 31 14:03:16 2012	(r233748)
+++ head/gnu/lib/libsupc++/Makefile	Sat Mar 31 14:25:12 2012	(r233749)
@@ -7,8 +7,8 @@ SRCDIR=	${.CURDIR}/../../../contrib/libs
 
 .PATH: ${SRCDIR} ${GCCLIB}/libiberty
 
-# Static only.
 LIB=	supc++
+SHLIB_MAJOR=1
 SRCS+=	del_op.cc del_opnt.cc del_opv.cc del_opvnt.cc eh_alloc.cc eh_arm.cc \
 	eh_aux_runtime.cc eh_call.cc eh_catch.cc eh_exception.cc eh_globals.cc \
 	eh_personality.cc eh_term_handler.cc eh_terminate.cc eh_throw.cc \
@@ -36,4 +36,9 @@ unwind.h: ${GCCDIR}/unwind-generic.h
 SRCS+=		unwind.h
 CLEANFILES+=	unwind.h
 
+# Symbol versioning
+
+VERSION_MAP=	${.CURDIR}/Version.map
+
+
 .include 

Copied and modified: head/gnu/lib/libsupc++/Version.map (from r232970, head/contrib/libstdc++/config/abi/pre/gnu.ver)
==============================================================================
--- head/contrib/libstdc++/config/abi/pre/gnu.ver	Wed Mar 14 14:34:14 2012	(r232970, copy source)
+++ head/gnu/lib/libsupc++/Version.map	Sat Mar 31 14:25:12 2012	(r233749)
@@ -19,676 +19,7 @@
 ## Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
 ## USA.
 
-GLIBCXX_3.4 {
-
-  global:
-
-    # Names inside the 'extern' block are demangled names.
-    extern "C++"
-    {
-      std::[A-Za]*;
-#     std::ba[a-r]*;
-      std::basic_[a-e]*;
-      std::basic_f[a-r]*;
-#     std::basic_fstream;
-      std::basic_f[t-z]*;
-      std::basic_[g-h]*;
-      std::basic_i[a-e]*;
-#     std::basic_ifstream;
-      std::basic_i[g-r]*;
-      std::basic_istr[a-d]*;
-#     std::basic_istream;
-      std::basic_istr[f-z]*;
-      std::basic_i[t-z]*;
-      std::basic_[j-n]*;
-      std::basic_o[a-e]*;
-#     std::basic_ofstream;
-#     std::basic_o[g-z]*;
-      std::basic_o[g-r]*;
-      std::basic_ostr[a-d]*;
-      std::basic_ostr[f-z]*;
-      std::basic_[p-r]*;
-      std::basic_streambuf*;
-#     std::basic_string
-#     std::basic_stringbuf
-      std::basic_stringstream*;
-      std::basic_[t-z]*;
-      std::ba[t-z]*;
-      std::b[b-z]*;
-      std::c[a-g]*;
-#     std::char_traits;
-      std::c[i-z]*;
-      std::[d-h]*;
-      std::i[a-n]*;
-      std::ios_base::[A-Ha-z]*;
-      std::ios_base::_M_grow_words*;
-      std::ios_base::_M_init*;
-      std::ios_base::Init::[A-Za-z]*;
-      std::ios_base::[J-Za-z]*;
-      std::i[p-r]*;
-#     std::istream
-#     std::istreambuf_iterator
-      std::istringstream*;
-      std::istrstream*;
-      std::i[t-z]*;
-      std::[A-Zj-k]*;
-      std::length_error*;
-      std::logic_error*;
-      std::locale::[A-Za-e]*;
-      std::locale::facet::[A-Za-z]*;
-      std::locale::facet::_S_get_c_locale*;	
-      std::locale::facet::_S_clone_c_locale*;
-      std::locale::facet::_S_create_c_locale*;
-      std::locale::facet::_S_destroy_c_locale*;
-      std::locale::[A-Zg-h]*;
-      std::locale::id::[A-Za-z]*;
-      std::locale::id::_M_id*;
-      std::locale::[A-Zj-z]*;
-      std::locale::_[A-Ha-z]*;
-      std::locale::_Impl::[A-Za-z]*;
-#     std::locale::_Impl::_M_[A-Za-z]*;
-      std::locale::_[J-Ra-z]*;
-      std::locale::_S_normalize_category*;
-      std::locale::_[T-Za-z]*;
-#     std::[A-Zm-r]*;
-      std::[A-Zm]*;
-      std::n[^u]*;
-      std::nu[^m]*;
-      std::num[^e]*;
-      std::[p-r]*;
-      std::ostrstream*;
-      std::out_of_range*;
-      std::overflow_error*;
-      std::set_new_handler*;
-      std::set_terminate*;
-      std::set_unexpected*;
-#     std::string
-      std::strstream*;
-      std::strstreambuf*;
-      std::[A-Zt-z]*;
-      std::_List_node_base::hook*;
-      std::_List_node_base::swap*;
-      std::_List_node_base::unhook*;
-      std::_List_node_base::reverse*;
-      std::_List_node_base::transfer*;
-      std::__throw_*;
-      std::__timepunct*;
-      std::__numeric_limits_base*;
-      std::__num_base::_S_format_float*;
-      std::__num_base::_S_format_int*;
-      std::__num_base::_S_atoms_in;
-      std::__num_base::_S_atoms_out;
-      std::__moneypunct_cache*;
-      std::__numpunct_cache*;
-      std::__timepunct_cache*;
-      __gnu_debug::_Error_formatter*
-    };
-
-    # Names not in an 'extern' block are mangled names.
-
-    # __gnu_debug::_Safe_sequence_base and _Safe_iterator_base
-    _ZN11__gnu_debug19_Safe_sequence_base13_M_detach_allEv;
-    _ZN11__gnu_debug19_Safe_sequence_base18_M_detach_singularEv;
-    _ZN11__gnu_debug19_Safe_sequence_base22_M_revalidate_singularEv;
-    _ZN11__gnu_debug19_Safe_sequence_base7_M_swapERS0_;
-    _ZN11__gnu_debug19_Safe_iterator_base9_M_attachEPNS_19_Safe_sequence_baseEb;
-    _ZN11__gnu_debug19_Safe_iterator_base9_M_detachEv;
-    _ZNK11__gnu_debug19_Safe_iterator_base11_M_singularEv;
-    _ZNK11__gnu_debug19_Safe_iterator_base14_M_can_compareERKS0_;
-
-    # std::string
-    _ZNSsC*;
-    _ZNSsD*;
-    _ZNSs[0-9][a-z]*;
-    _ZNSs12_Alloc_hiderC*;
-    _ZNSs12_M_leak_hardEv;
-    _ZNSs12_S_constructE[jm]cRKSaIcE;
-    _ZNSs12_S_empty_repEv;
-    _ZNSs13_S_copy_chars*;
-    _ZNSs[0-9][0-9]_M_replace*;
-    _ZNSs4_Rep10_M_destroy*;
-    _ZNSs4_Rep10_M_dispose*;
-    _ZNSs4_Rep10_M_refcopyEv;
-    _ZNSs4_Rep10_M_refdataEv;
-    _ZNSs4_Rep12_S_empty_repEv;
-    _ZNSs4_Rep13_M_set_leakedEv;
-    _ZNSs4_Rep15_M_set_sharableEv;
-    _ZNSs4_Rep7_M_grab*;
-    _ZNSs4_Rep8_M_clone*;
-    _ZNSs4_Rep9_S_createE[jm][jm]*;
-    _ZNSs7_M_dataEPc;
-    _ZNSs7_M_leakEv;
-    _ZNSs9_M_mutateE[jm][jm][jm];
-    _ZNSs4_Rep20_S_empty_rep_storageE;
-    _ZNSs4_Rep11_S_max_sizeE;
-    _ZNSs4_Rep11_S_terminalE;
-    _ZNSsaSE*;
-    _ZNSsixE*;
-    _ZNSspLE*;
-    _ZNKSs[0-9][a-z]*;
-    _ZNKSs[0-9][0-9][a-z]*;
-    _ZNKSs[a-z]*;
-    _ZNKSs4_Rep12_M_is_leakedEv;
-    _ZNKSs4_Rep12_M_is_sharedEv;
-    _ZNKSs6_M_repEv;
-    _ZNKSs7_M_dataEv;
-    _ZNKSs7_M_iendEv;
-    _ZNKSs8_M_check*;
-    _ZNKSs8_M_limit*;
-    _ZNKSs9_M_ibeginEv;
-    _ZStplIcSt11char_traitsIcESaIcEESbIT_T0_T1_E*;
-
-    # std::wstring
-    _ZNSbIwSt11char_traitsIwESaIwEEC*;
-    _ZNSbIwSt11char_traitsIwESaIwEED*;
-    _ZNSbIwSt11char_traitsIwESaIwEE[0-9][a-z]*;
-    _ZNSbIwSt11char_traitsIwESaIwEE12_Alloc_hiderC*;
-    _ZNSbIwSt11char_traitsIwESaIwEE12_M_leak_hardEv;
-    _ZNSbIwSt11char_traitsIwESaIwEE12_S_constructE[jm]wRKS1_;
-    _ZNSbIwSt11char_traitsIwESaIwEE12_S_empty_repEv;
-    _ZNSbIwSt11char_traitsIwESaIwEE13_S_copy_chars*;
-    _ZNSbIwSt11char_traitsIwESaIwEE[0-9][0-9]_M_replace*;
-    _ZNSbIwSt11char_traitsIwESaIwEE4_Rep10_M_destroy*;
-    _ZNSbIwSt11char_traitsIwESaIwEE4_Rep10_M_dispose*;
-    _ZNSbIwSt11char_traitsIwESaIwEE4_Rep10_M_refcopyEv;
-    _ZNSbIwSt11char_traitsIwESaIwEE4_Rep10_M_refdataEv;
-    _ZNSbIwSt11char_traitsIwESaIwEE4_Rep12_S_empty_repEv;
-    _ZNSbIwSt11char_traitsIwESaIwEE4_Rep13_M_set_leakedEv;
-    _ZNSbIwSt11char_traitsIwESaIwEE4_Rep15_M_set_sharableEv;
-    _ZNSbIwSt11char_traitsIwESaIwEE4_Rep7_M_grab*;
-    _ZNSbIwSt11char_traitsIwESaIwEE4_Rep8_M_clone*;
-    _ZNSbIwSt11char_traitsIwESaIwEE4_Rep9_S_createE[jm][jm]*;
-    _ZNSbIwSt11char_traitsIwESaIwEE7_M_dataEPw;
-    _ZNSbIwSt11char_traitsIwESaIwEE7_M_leakEv;
-    _ZNSbIwSt11char_traitsIwESaIwEE9_M_mutateE[jm][jm][jm];
-    _ZNSbIwSt11char_traitsIwESaIwEE4_Rep20_S_empty_rep_storageE;
-    _ZNSbIwSt11char_traitsIwESaIwEE4_Rep11_S_max_sizeE;
-    _ZNSbIwSt11char_traitsIwESaIwEE4_Rep11_S_terminalE;
-    _ZNSbIwSt11char_traitsIwESaIwEEaSE*;
-    _ZNSbIwSt11char_traitsIwESaIwEEixE*;
-    _ZNSbIwSt11char_traitsIwESaIwEEpLE*;
-    _ZNKSbIwSt11char_traitsIwESaIwEE[0-9][a-z]*;
-    _ZNKSbIwSt11char_traitsIwESaIwEE[0-9][0-9][a-z]*;
-    _ZNKSbIwSt11char_traitsIwESaIwEE[a-z]*;
-    _ZNKSbIwSt11char_traitsIwESaIwEE4_Rep12_M_is_leakedEv;
-    _ZNKSbIwSt11char_traitsIwESaIwEE4_Rep12_M_is_sharedEv;
-    _ZNKSbIwSt11char_traitsIwESaIwEE6_M_repEv;
-    _ZNKSbIwSt11char_traitsIwESaIwEE7_M_dataEv;
-    _ZNKSbIwSt11char_traitsIwESaIwEE7_M_iendEv;
-    _ZNKSbIwSt11char_traitsIwESaIwEE8_M_check*;
-    _ZNKSbIwSt11char_traitsIwESaIwEE8_M_limit*;
-    _ZNKSbIwSt11char_traitsIwESaIwEE9_M_ibeginEv;
-    _ZStplIwSt11char_traitsIwESaIwEESbIT_T0_T1_E*;
-
-    # std::basic_stringbuf
-    _ZNSt15basic_stringbufI[cw]St11char_traitsI[cw]ESaI[cw]EE[CD]*;
-    _ZNSt15basic_stringbufI[cw]St11char_traitsI[cw]ESaI[cw]EE[0-9][a-r]*;
-    _ZNSt15basic_stringbufI[cw]St11char_traitsI[cw]ESaI[cw]EE[0-9]seek*;
-    _ZNSt15basic_stringbufI[cw]St11char_traitsI[cw]ESaI[cw]EE[0-9]set*;
-    _ZNKSt15basic_stringbufIcSt11char_traitsIcESaIcEE3strEv;
-    _ZNKSt15basic_stringbufIwSt11char_traitsIwESaIwEE3strEv;
-    _ZNSt15basic_stringbufIcSt11char_traitsIcESaIcEE3strERKSs;
-    _ZNSt15basic_stringbufIwSt11char_traitsIwESaIwEE3strERKSbIwS1_S2_E;
-    _ZNSt15basic_stringbufI[cw]St11char_traitsI[cw]ESaI[cw]EE[0-9][t-z]*;
-    _ZNSt15basic_stringbufI[cw]St11char_traitsI[cw]ESaI[cw]EE[0-9]_M_[a-z]*;
-    _ZNSt15basic_stringbufI[cw]St11char_traitsI[cw]ESaI[cw]EE[0-9][0-9]_M_[a-z]*;
-
-
-    # std::basic_iostream constructors, destructors
-    _ZNSdC*;
-    _ZNSdD*;
-
-    # std::basic_fstream
-    _ZNSt13basic_fstreamI[cw]St11char_traitsI[cw]EEC*;
-    _ZNSt13basic_fstreamI[cw]St11char_traitsI[cw]EED*;
-    _ZNSt13basic_fstreamI[cw]St11char_traitsI[cw]EE5closeEv;
-    _ZNSt13basic_fstreamI[cw]St11char_traitsI[cw]EE7is_openEv;
-    _ZNSt13basic_fstreamI[cw]St11char_traitsI[cw]EE4open*;
-    _ZNKSt13basic_fstreamI[cw]St11char_traitsI[cw]EE5rdbufEv;
-
-    # std::basic_ifstream
-    _ZNSt14basic_ifstreamI[cw]St11char_traitsI[cw]EEC*;
-    _ZNSt14basic_ifstreamI[cw]St11char_traitsI[cw]EED*;
-    _ZNSt14basic_ifstreamI[cw]St11char_traitsI[cw]EE5closeEv;
-    _ZNSt14basic_ifstreamI[cw]St11char_traitsI[cw]EE7is_openEv;
-    _ZNSt14basic_ifstreamI[cw]St11char_traitsI[cw]EE4open*;
-    _ZNKSt14basic_ifstreamI[cw]St11char_traitsI[cw]EE5rdbufEv;
-
-    # std::basic_ofstream
-    _ZNSt14basic_ofstreamI[cw]St11char_traitsI[cw]EEC*;
-    _ZNSt14basic_ofstreamI[cw]St11char_traitsI[cw]EED*;
-    _ZNSt14basic_ofstreamI[cw]St11char_traitsI[cw]EE5closeEv;
-    _ZNSt14basic_ofstreamI[cw]St11char_traitsI[cw]EE7is_openEv;
-    _ZNSt14basic_ofstreamI[cw]St11char_traitsI[cw]EE4open*;
-    _ZNKSt14basic_ofstreamI[cw]St11char_traitsI[cw]EE5rdbufEv;
-
-    # std::basic_istream
-    _ZNSiC*;
-    _ZNSiD*;
-    _ZNKSi[0-9][a-z]*;
-    _ZNSi[0-9][a-h]*;
-    _ZNSi[0-9][j-z]*;
-    _ZNSi6ignoreE[il][il];
-    _ZNSirsE*[^g];
-
-    # std::basic_istream
-    _ZNSt13basic_istreamIwSt11char_traitsIwEEC*;
-    _ZNSt13basic_istreamIwSt11char_traitsIwEED*;
-    _ZNKSt13basic_istreamIwSt11char_traitsIwEE[0-9][a-z]*;
-    _ZNSt13basic_istreamIwSt11char_traitsIwEE[0-9][a-h]*;
-    _ZNSt13basic_istreamIwSt11char_traitsIwEE[0-9][j-z]*;
-    _ZNSt13basic_istreamIwSt11char_traitsIwEE6ignoreE[il][ijlm];
-    _ZNSt13basic_istreamIwSt11char_traitsIwEErsE*[^g];
-
-    # std::istream operators and extractors
-    _ZSt7getlineI[cw]St11char_traitsI[cw]ESaI[cw]EERSt13basic_istream*;
-    _ZSt2wsI[cw]St11char_traitsI[cw]EE*;
-    _ZStrsI[cw]St11char_traitsI[cw]EERSt13basic_istream*;
-    _ZStrsI[cw]St11char_traitsI[cw]ESaI[cw]EERSt13basic_istream*;
-    _ZStrsISt11char_traitsI[cw]EERSt13basic_istream*;
-    _ZStrsId[cw]St11char_traitsI[cw]EERSt13basic_istream*;
-    _ZStrsIe[cw]St11char_traitsI[cw]EERSt13basic_istream*;
-    _ZStrsIf[cw]St11char_traitsI[cw]EERSt13basic_istream*;
-
-    # std::basic_ostream
-    _ZNSoC*;
-    _ZNSoD*;
-    _ZNKSo6sentrycvbEv;
-    _ZNSo8_M_writeEPKc[il];
-    _ZNSo[0-9][a-z]*;
-    _ZNSolsE*[^g];
-
-    # std::basic_ostream
-    _ZNSt13basic_ostreamIwSt11char_traitsIwEEC*;
-    _ZNSt13basic_ostreamIwSt11char_traitsIwEED*;
-    _ZNKSt13basic_ostreamIwSt11char_traitsIwEE[0-9][a-z]*;
-    _ZNSt13basic_ostreamIwSt11char_traitsIwEE3putEw;
-    _ZNSt13basic_ostreamIwSt11char_traitsIwEE5flushEv;
-    _ZNSt13basic_ostreamIwSt11char_traitsIwEE5seekpE*;
-    _ZNSt13basic_ostreamIwSt11char_traitsIwEE5tellpEv;
-    _ZNSt13basic_ostreamIwSt11char_traitsIwEE5writeEPKw*;
-    _ZNSt13basic_ostreamIwSt11char_traitsIwEE6sentry*;
-    _ZNSt13basic_ostreamIwSt11char_traitsIwEE8_M_writeEPKw[il];
-    _ZNSt13basic_ostreamIwSt11char_traitsIwEElsE*[^g];
-
-    # std::ostream operators and inserters
-    _ZSt4end[ls]I[cw]St11char_traitsI[cw]EERSt13basic_ostream*;
-    _ZSt5flushI[cw]St11char_traitsI[cw]EERSt13basic_ostream*;
-    _ZStlsI[cw]St11char_traitsI[cw]EERSt13basic_ostream*;
-    _ZStlsI[cw]St11char_traitsI[cw]ESaI[cw]EERSt13basic_ostream*;
-    _ZStlsISt11char_traitsI[cw]EERSt13basic_ostream*;
-    _ZStlsId[cw]St11char_traitsI[cw]EERSt13basic_ostream*;
-    _ZStlsIe[cw]St11char_traitsI[cw]EERSt13basic_ostream*;
-    _ZStlsIf[cw]St11char_traitsI[cw]EERSt13basic_ostream*;
-
-    # std::locale destructors
-    _ZNSt6localeD*;
-	
-    # std::locale::facet destructors
-    _ZNSt6locale5facetD*;
-	 
-    # std::locale::_Impl constructors, destructors
-    _ZNSt6locale5_ImplC*;
-    _ZNSt6locale5_ImplD*;
-
-    # std::ios_base, std::ios_base::Init destructors
-    _ZNSt8ios_baseD*;
-    _ZNSt8ios_base4InitD*;
-
-    # bool std::has_facet 
-    _ZSt9has_facetIS*;
-
-    # std::num_get
-    _ZNKSt7num_getI[cw]St19istreambuf_iteratorI[cw]St11char_traitsI[cw]EEE*;
-
-    # std::num_put
-    _ZNKSt7num_putI[cw]St19ostreambuf_iteratorI[cw]St11char_traitsI[cw]EEE*;
-
-    # std::money_get
-    _ZNKSt9money_getI[cw]St19istreambuf_iteratorI[cw]St11char_traitsI[cw]EEE*;
-
-    # std::money_put
-    _ZNKSt9money_putI[cw]St19ostreambuf_iteratorI[cw]St11char_traitsI[cw]EEE*;
-
-    # std::numeric_limits
-    _ZNSt14numeric_limitsI[^g]*;
-
-    # std::_Rb_tree
-    _ZSt18_Rb_tree_decrementPKSt18_Rb_tree_node_base;
-    _ZSt18_Rb_tree_decrementPSt18_Rb_tree_node_base;
-    _ZSt18_Rb_tree_incrementPKSt18_Rb_tree_node_base;
-    _ZSt18_Rb_tree_incrementPSt18_Rb_tree_node_base;
-    _ZSt20_Rb_tree_black_countPKSt18_Rb_tree_node_baseS1_;
-    _ZSt20_Rb_tree_rotate_leftPSt18_Rb_tree_node_baseRS0_;
-    _ZSt21_Rb_tree_rotate_rightPSt18_Rb_tree_node_baseRS0_;
-    _ZSt28_Rb_tree_rebalance_for_erasePSt18_Rb_tree_node_baseRS_;
-    _ZSt29_Rb_tree_insert_and_rebalancebPSt18_Rb_tree_node_baseS0_RS_;
-
-    # std::__basic_file
-    _ZNKSt12__basic_fileIcE7is_openEv;
-    _ZNSt12__basic_fileIcE2fdEv;
-    _ZNSt12__basic_fileIcE4openEPKcSt13_Ios_Openmodei;
-    _ZNSt12__basic_fileIcE4syncEv;
-    _ZNSt12__basic_fileIcE5closeEv;
-    _ZNSt12__basic_fileIcE6xsgetn*;
-    _ZNSt12__basic_fileIcE6xsputn*;
-    _ZNSt12__basic_fileIcE7seekoff*;
-    _ZNSt12__basic_fileIcE8sys_openE*St13_Ios_Openmode;
-    _ZNSt12__basic_fileIcE8xsputn_2*;
-    _ZNSt12__basic_fileIcE9showmanycEv;
-    _ZNSt12__basic_fileIcEC*;
-    _ZNSt12__basic_fileIcED*;
-
-    # std::__convert_to_v
-    _ZSt14__convert_to_vI[^g]*;
-
-    # __gnu_cxx::stdio_sync_filebuf
-    _ZTVN9__gnu_cxx18stdio_sync_filebufI[cw]St11char_traitsI[cw]EEE;
-
-    # __gnu_cxx::__atomic_add
-    # __gnu_cxx::__exchange_and_add
-    _ZN9__gnu_cxx12__atomic_addEPV[il]i;
-    _ZN9__gnu_cxx18__exchange_and_addEPV[il]i;
-
-    # debug mode
-    _ZN10__gnu_norm15_List_node_base4hook*;
-    _ZN10__gnu_norm15_List_node_base4swap*;
-    _ZN10__gnu_norm15_List_node_base6unhookEv;
-    _ZN10__gnu_norm15_List_node_base7reverseEv;
-    _ZN10__gnu_norm15_List_node_base8transfer*;
-
-    # operator new(size_t)
-    _Znw[jm];
-    # operator new(size_t, std::nothrow_t const&)
-    _Znw[jm]RKSt9nothrow_t;
-
-    # operator delete(void*)
-    _ZdlPv;
-    # operator delete(void*, std::nothrow_t const&)
-    _ZdlPvRKSt9nothrow_t;
-
-    # operator new[](size_t)
-    _Zna[jm];
-    # operator new[](size_t, std::nothrow_t const&)
-    _Zna[jm]RKSt9nothrow_t;
-
-    # operator delete[](void*)
-    _ZdaPv;
-    # operator delete[](void*, std::nothrow_t const&)
-    _ZdaPvRKSt9nothrow_t;
-
-    # virtual table
-    _ZTVNSt8ios_base7failureE;
-    _ZTVNSt6locale5facetE;
-    _ZTVS[a-z];
-    _ZTVSt[0-9][A-Za-z]*;
-    _ZTVSt[0-9][0-9][A-Za-z]*;
-    _ZTVSt11__timepunctI[cw]E;
-    _ZTVSt23__codecvt_abstract_baseI[cw]c11__mbstate_tE;
-    _ZTVSt21__ctype_abstract_baseI[cw]E;
-
-    # VTT structure
-    _ZTTS[a-z];
-    _ZTTSt[0-9][A-Za-z]*;
-    _ZTTSt[0-9][0-9][A-Za-z]*;
-
-    # typeinfo structure
-    _ZTIS[a-z];
-    _ZTINSt8ios_base7failureE;
-    _ZTINSt6locale5facetE;
-    _ZTISt[0-9][A-Za-z]*;
-    _ZTISt[0-9][0-9][A-Za-z]*;
-    _ZTISt11__timepunctI[cw]E;
-    _ZTISt10__num_base;
-    _ZTISt21__ctype_abstract_baseI[cw]E;
-    _ZTISt23__codecvt_abstract_baseI[cw]c11__mbstate_tE;
-    _ZTIN9__gnu_cxx18stdio_sync_filebufI[cw]St11char_traitsI[cw]EEE;
-    _ZTIN9__gnu_cxx13stdio_filebufI[cw]St11char_traitsI[cw]EEE;
-
-    # typeinfo name
-    _ZTSNSt8ios_base7failureE;
-    _ZTSNSt6locale5facetE;
-    _ZTSS[a-z];
-    _ZTSSt[0-9][A-Za-z]*;
-    _ZTSSt[0-9][0-9][A-Za-z]*;
-    _ZTSSt11__timepunctI[cw]E;
-    _ZTSSt10__num_base;
-    _ZTSSt21__ctype_abstract_baseI[cw]E;
-    _ZTSSt23__codecvt_abstract_baseI[cw]c11__mbstate_tE;
-    _ZTSN9__gnu_cxx18stdio_sync_filebufI[cw]St11char_traitsI[cw]EEE;
-    _ZTSN9__gnu_cxx13stdio_filebufI[cw]St11char_traitsI[cw]EEE;
-
-    # std::bad_alloc::~bad_alloc, std::bad_cast::~bad_cast,
-    # std::bad_typeid::~bad_typeid, std::bad_exception::~bad_exception
-    _ZNSt9bad_allocD*;
-    _ZNSt8bad_castD*;
-    _ZNSt10bad_typeidD*;
-    _ZNSt13bad_exceptionD*;
-
-    # function-scope static objects requires a guard variable.
-    _ZGVNSt[^1]*;
-    _ZGVNSt1[^7]*;
-
-    # virtual function thunks
-    _ZThn8_NS*;
-    _ZThn16_NS*;
-    _ZTv0_n12_NS*;
-    _ZTv0_n24_NS*;
-
-    # stub functions from libmath
-    sinf;
-    sinl;
-    sinhf;
-    sinhl;
-    cosf;
-    cosl;
-    coshf;
-    coshl;
-    tanf;
-    tanl;
-    tanhf;
-    tanhl;
-    atan2f;
-    atan2l;
-    expf;
-    expl;
-    hypotf;
-    hypotl;
-    hypot;
-    logf;
-    logl;
-    log10f;
-    log10l;
-    powf;
-    powl;
-    sqrtf;
-    sqrtl;
-    copysignf;
-    __signbit;
-    __signbitf;
-    __signbitl;
-
-   # GLIBCXX_ABI compatibility only.
-    # std::string
-    _ZNKSs11_M_disjunctEPKc;
-    _ZNKSs15_M_check_lengthE[jm][jm]PKc;
-    _ZNSs4_Rep26_M_set_length_and_sharableE*;
-    _ZNSs7_M_copyEPcPKc[jm];
-    _ZNSs7_M_moveEPcPKc[jm];
-    _ZNSs9_M_assignEPc[jm]c;
-
-    # std::wstring
-    _ZNKSbIwSt11char_traitsIwESaIwEE11_M_disjunctEPKw;
-    _ZNKSbIwSt11char_traitsIwESaIwEE15_M_check_lengthE[jm][jm]PKc;
-    _ZNSbIwSt11char_traitsIwESaIwEE4_Rep26_M_set_length_and_sharableE*;
-    _ZNSbIwSt11char_traitsIwESaIwEE7_M_copyEPwPKw[jm];
-    _ZNSbIwSt11char_traitsIwESaIwEE7_M_moveEPwPKw[jm];
-    _ZNSbIwSt11char_traitsIwESaIwEE9_M_assignEPw[jm]w;
-
-    _ZNKSt13basic_fstreamI[cw]St11char_traitsI[cw]EE7is_openEv;
-    _ZNKSt14basic_ifstreamI[cw]St11char_traitsI[cw]EE7is_openEv;
-    _ZNKSt14basic_ofstreamI[cw]St11char_traitsI[cw]EE7is_openEv;
-
-    _ZNSi6ignoreE[ilv];
-    _ZNSt13basic_istreamIwSt11char_traitsIwEE6ignoreE[ilv];
-
-    _ZNSt11char_traitsI[cw]E2eqERK[cw]S2_;
-
-    _ZNSt19istreambuf_iteratorI[cw]St11char_traitsI[cw]EEppEv;
-
-    # std::locale::Impl _M_ members
-    _ZNSt6locale5_Impl16_M_install_facetEPKNS_2idEPKNS_5facetE;
-    _ZNSt6locale5_Impl16_M_replace_facetEPKS0_PKNS_2idE;
-    _ZNSt6locale5_Impl19_M_replace_categoryEPKS0_PKPKNS_2idE;
-    _ZNSt6locale5_Impl21_M_replace_categoriesEPKS0_i;
-
-  # DO NOT DELETE THIS LINE.  Port-specific symbols, if any, will be here.
-
-  local:
-    *;
-};
-
-GLIBCXX_3.4.1 {
- 
-    _ZNSt12__basic_fileIcE4fileEv;
- 
-} GLIBCXX_3.4;
- 
-GLIBCXX_3.4.2 {
-
-    _ZN9__gnu_cxx18stdio_sync_filebufI[cw]St11char_traitsI[cw]EE4fileEv;
-
-    _ZN9__gnu_cxx17__pool_alloc_base9_M_refillE[jm];
-    _ZN9__gnu_cxx17__pool_alloc_base16_M_get_free_listE[jm];
-    _ZN9__gnu_cxx17__pool_alloc_base12_M_get_mutexEv;
-
-} GLIBCXX_3.4.1;
-
-GLIBCXX_3.4.3 {
- 
-    # stub functions from libmath
-    acosf;
-    acosl;
-    asinf;
-    asinl;
-    atanf;
-    atanl;
-    ceilf;
-    ceill;
-    floorf;
-    floorl;
-    fmodf;
-    fmodl;
-    frexpf;
-    frexpl;
-    ldexpf;
-    ldexpl;
-    modff;
-    modfl;
-
-} GLIBCXX_3.4.2;
-
-GLIBCXX_3.4.4 {
-
-    _ZN9__gnu_cxx6__poolILb0EE13_M_initializeEv;
-    _ZN9__gnu_cxx6__poolILb1EE13_M_initializeEPFvPvE;
-    _ZN9__gnu_cxx6__poolILb1EE21_M_destroy_thread_keyEPv;
-    _ZN9__gnu_cxx6__poolILb1EE16_M_get_thread_idEv;
-    _ZN9__gnu_cxx6__poolILb[01]EE16_M_reserve_blockE[jm][jm];
-    _ZN9__gnu_cxx6__poolILb[01]EE16_M_reclaim_blockEPc[jm];
-    _ZN9__gnu_cxx6__poolILb[01]EE10_M_destroyEv;
-
-    _ZN9__gnu_cxx9free_list6_M_getE*;
-    _ZN9__gnu_cxx9free_list8_M_clearEv;
-
-} GLIBCXX_3.4.3;
-
-GLIBCXX_3.4.5 {
-
-    # std::string
-    _ZNKSs11_M_disjunctEPKc;
-    _ZNKSs15_M_check_lengthE[jm][jm]PKc;
-    _ZNSs4_Rep26_M_set_length_and_sharableE*;
-    _ZNSs7_M_copyEPcPKc[jm];
-    _ZNSs7_M_moveEPcPKc[jm];
-    _ZNSs9_M_assignEPc[jm]c;
-
-    # std::wstring
-    _ZNKSbIwSt11char_traitsIwESaIwEE11_M_disjunctEPKw;
-    _ZNKSbIwSt11char_traitsIwESaIwEE15_M_check_lengthE[jm][jm]PKc;
-    _ZNSbIwSt11char_traitsIwESaIwEE4_Rep26_M_set_length_and_sharableE*;
-    _ZNSbIwSt11char_traitsIwESaIwEE7_M_copyEPwPKw[jm];
-    _ZNSbIwSt11char_traitsIwESaIwEE7_M_moveEPwPKw[jm];
-    _ZNSbIwSt11char_traitsIwESaIwEE9_M_assignEPw[jm]w;
-
-    _ZNKSt13basic_fstreamI[cw]St11char_traitsI[cw]EE7is_openEv;
-    _ZNKSt14basic_ifstreamI[cw]St11char_traitsI[cw]EE7is_openEv;
-    _ZNKSt14basic_ofstreamI[cw]St11char_traitsI[cw]EE7is_openEv;
-
-    _ZNSi6ignoreE[ilv];
-    _ZNSt13basic_istreamIwSt11char_traitsIwEE6ignoreE[ilv];
-
-    _ZNSt11char_traitsI[cw]E2eqERK[cw]S2_;
-
-    _ZNSt19istreambuf_iteratorI[cw]St11char_traitsI[cw]EEppEv;
-
-} GLIBCXX_3.4.4;
-
-GLIBCXX_3.4.6 {
-
-    _ZSt17__copy_streambufsI[cw]St11char_traitsI[cw]EEiPSt15basic_streambuf*;
-    _ZNSt8ios_base17_M_call_callbacksENS_5eventE;
-    _ZNSt8ios_base20_M_dispose_callbacksEv;
-    _ZNSt6locale5facet13_S_get_c_nameEv;
-
-    _ZNSt15basic_stringbufI[cw]St11char_traitsI[cw]ESaI[cw]EE9showmanycEv;
-
-    _ZNKSt15basic_stringbufIwSt11char_traitsIwESaIwEE3strEv;
-
-    _ZN9__gnu_cxx6__poolILb1EE13_M_initializeEv;
-
-} GLIBCXX_3.4.5;
-
-GLIBCXX_3.4.7 {
-
-    _ZNSt6locale5_Impl16_M_install_cacheEPKNS_5facetE[jm];
-
-} GLIBCXX_3.4.6;
-
-GLIBCXX_3.4.8 {
-
-    _ZSt17__copy_streambufsI[cw]St11char_traitsI[cw]EElPSt15basic_streambuf*;
-
-} GLIBCXX_3.4.7;
-
-GLIBCXX_3.4.9 {
-
-    _ZNSt6__norm15_List_node_base4hook*;
-    _ZNSt6__norm15_List_node_base4swap*;
-    _ZNSt6__norm15_List_node_base6unhookEv;
-    _ZNSt6__norm15_List_node_base7reverseEv;
-    _ZNSt6__norm15_List_node_base8transfer*;
-
-    _ZNSo9_M_insertI[^g]*;
-    _ZNSt13basic_ostreamIwSt11char_traitsIwEE9_M_insertI[^g]*;
-    _ZNSi10_M_extractI[^g]*;
-    _ZNSt13basic_istreamIwSt11char_traitsIwEE10_M_extractI[^g]*;
-
-    _ZSt21__copy_streambufs_eofI[cw]St11char_traitsI[cw]EE[il]PSt15basic_streambuf*;
-
-    _ZSt16__ostream_insert*;
-
-    _ZN11__gnu_debug19_Safe_sequence_base12_M_get_mutexEv;
-    _ZN11__gnu_debug19_Safe_iterator_base16_M_attach_singleEPNS_19_Safe_sequence_baseEb;
-    _ZN11__gnu_debug19_Safe_iterator_base16_M_detach_singleEv;
-    _ZN11__gnu_debug19_Safe_iterator_base12_M_get_mutexEv;
-
-    _ZNKSt9bad_alloc4whatEv;
-    _ZNKSt8bad_cast4whatEv;
-    _ZNKSt10bad_typeid4whatEv;
-    _ZNKSt13bad_exception4whatEv;
-
-} GLIBCXX_3.4.8;
+## $FreeBSD$
 
 
 # Symbols in the support library (libsupc++) have their own tag.