From owner-svn-src-stable-9@FreeBSD.ORG  Sun May 20 01:40:13 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 7DCF61065672;
	Sun, 20 May 2012 01:40:13 +0000 (UTC) (envelope-from gjb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 66DF68FC0A;
	Sun, 20 May 2012 01:40: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 q4K1eDWN058476;
	Sun, 20 May 2012 01:40:13 GMT (envelope-from gjb@svn.freebsd.org)
Received: (from gjb@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4K1eDwN058474;
	Sun, 20 May 2012 01:40:13 GMT (envelope-from gjb@svn.freebsd.org)
Message-Id: <201205200140.q4K1eDwN058474@svn.freebsd.org>
From: Glen Barber <gjb@FreeBSD.org>
Date: Sun, 20 May 2012 01:40:13 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r235673 - stable/9/share/man/man4
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sun, 20 May 2012 01:40:13 -0000

Author: gjb (doc committer)
Date: Sun May 20 01:40:12 2012
New Revision: 235673
URL: http://svn.freebsd.org/changeset/base/235673

Log:
  MFC r235567:
  
  mdoc(7) style/formatting fixes.
  
  While here, fix a few nits igor(1) does not like.

Modified:
  stable/9/share/man/man4/siftr.4
Directory Properties:
  stable/9/share/man/man4/   (props changed)

Modified: stable/9/share/man/man4/siftr.4
==============================================================================
--- stable/9/share/man/man4/siftr.4	Sat May 19 23:51:48 2012	(r235672)
+++ stable/9/share/man/man4/siftr.4	Sun May 20 01:40:12 2012	(r235673)
@@ -91,7 +91,7 @@ utilises the
 .Xr sysctl 8
 interface to export its configuration variables to user-space.
 The following variables are available:
-.Bl -tag -offset indent
+.Bl -tag -offset indent -width Va
 .It Va net.inet.siftr.enabled
 controls whether the module performs its
 measurements or not.
@@ -104,7 +104,7 @@ packet filtering hooks are only inserted
 .Va net.inet.siftr.enabled
 is set to 1.
 .El
-.Bl -tag -offset indent
+.Bl -tag -offset indent -width Va
 .It Va net.inet.siftr.ppl
 controls how many inbound/outbound packets for a given TCP connection will cause
 a log message to be generated for the connection.
@@ -113,13 +113,13 @@ every packet of every TCP connection.
 The value can be set to any integer in the range [1,2^32], and can be changed at
 any time, even while the module is enabled.
 .El
-.Bl -tag -offset indent
+.Bl -tag -offset indent -width Va
 .It Va net.inet.siftr.logfile
 controls the path to the file that the module writes its log messages to.
 By default, the file /var/log/siftr.log is used.
 The path can be changed at any time, even while the module is enabled.
 .El
-.Bl -tag -offset indent
+.Bl -tag -offset indent -width Va
 .It Va net.inet.siftr.genhashes
 controls whether a hash is generated for each TCP packet seen by
 .Nm .
@@ -150,36 +150,36 @@ sysname=FreeBSD    sysver=604000    ipmo
 .Ed
 .Pp
 Field descriptions are as follows:
-.Bl -tag -offset indent
+.Bl -tag -offset indent -width Va
 .It Va enable_time_secs
 time at which the module was enabled, in seconds since the UNIX epoch.
 .El
-.Bl -tag -offset indent
+.Bl -tag -offset indent -width Va
 .It Va enable_time_usecs
 time at which the module was enabled, in microseconds since enable_time_secs.
 .El
-.Bl -tag -offset indent
+.Bl -tag -offset indent -width Va
 .It Va siftrver
 version of
 .Nm .
 .El
-.Bl -tag -offset indent
+.Bl -tag -offset indent -width Va
 .It Va hz
 tick rate of the kernel in ticks per second.
 .El
-.Bl -tag -offset indent
+.Bl -tag -offset indent -width Va
 .It Va tcp_rtt_scale
 smoothed RTT estimate scaling factor.
 .El
-.Bl -tag -offset indent
+.Bl -tag -offset indent -width Va
 .It Va sysname
 operating system name.
 .El
-.Bl -tag -offset indent
+.Bl -tag -offset indent -width Va
 .It Va sysver
 operating system version.
 .El
-.Bl -tag -offset indent
+.Bl -tag -offset indent -width Va
 .It Va ipmode
 IP mode as defined at compile time.
 An ipmode of "4" means IPv6 is not supported and IP addresses are logged in
@@ -202,7 +202,7 @@ o,0xbec491a5,1238556193.463551,172.16.7.
 .Ed
 .Pp
 Field descriptions are as follows:
-.Bl -tag -offset indent
+.Bl -tag -offset indent -width Va
 .It Va 1
 Direction of packet that triggered the log message.
 Either
@@ -211,77 +211,77 @@ for in, or
 .Qq o
 for out.
 .El
-.Bl -tag -offset indent
+.Bl -tag -offset indent -width Va
 .It Va 2
 Hash of the packet that triggered the log message.
 .El
-.Bl -tag -offset indent
+.Bl -tag -offset indent -width Va
 .It Va 3
 Time at which the packet that triggered the log message was processed by
 the
 .Xr pfil 9
 hook function, in seconds and microseconds since the UNIX epoch.
 .El
-.Bl -tag -offset indent
+.Bl -tag -offset indent -width Va
 .It Va 4
 The IPv4 or IPv6 address of the local host, in dotted quad (IPv4 packet)
 or colon-separated hex (IPv6 packet) notation.
 .El
-.Bl -tag -offset indent
+.Bl -tag -offset indent -width Va
 .It Va 5
 The TCP port that the local host is communicating via.
 .El
-.Bl -tag -offset indent
+.Bl -tag -offset indent -width Va
 .It Va 6
 The IPv4 or IPv6 address of the foreign host, in dotted quad (IPv4 packet)
 or colon-separated hex (IPv6 packet) notation.
 .El
-.Bl -tag -offset indent
+.Bl -tag -offset indent -width Va
 .It Va 7
 The TCP port that the foreign host is communicating via.
 .El
-.Bl -tag -offset indent
+.Bl -tag -offset indent -width Va
 .It Va 8
 The slow start threshold for the flow, in bytes.
 .El
-.Bl -tag -offset indent
+.Bl -tag -offset indent -width Va
 .It Va 9
 The current congestion window for the flow, in bytes.
 .El
-.Bl -tag -offset indent
+.Bl -tag -offset indent -width Va
 .It Va 10
 The current bandwidth-controlled window for the flow, in bytes.
 .El
-.Bl -tag -offset indent
+.Bl -tag -offset indent -width Va
 .It Va 11
 The current sending window for the flow, in bytes.
 The post scaled value is reported, except during the initial handshake (first
 few packets), during which time the unscaled value is reported.
 .El
-.Bl -tag -offset indent
+.Bl -tag -offset indent -width Va
 .It Va 12
 The current receive window for the flow, in bytes.
 The post scaled value is always reported.
 .El
-.Bl -tag -offset indent
+.Bl -tag -offset indent -width Va
 .It Va 13
 The current window scaling factor for the sending window.
 .El
-.Bl -tag -offset indent
+.Bl -tag -offset indent -width Va
 .It Va 14
 The current window scaling factor for the receiving window.
 .El
-.Bl -tag -offset indent
+.Bl -tag -offset indent -width Va
 .It Va 15
 The current state of the TCP finite state machine, as defined
 in
 .Aq Pa netinet/tcp_fsm.h .
 .El
-.Bl -tag -offset indent
+.Bl -tag -offset indent -width Va
 .It Va 16
 The maximum segment size for the flow, in bytes.
 .El
-.Bl -tag -offset indent
+.Bl -tag -offset indent -width Va
 .It Va 17
 The current smoothed RTT estimate for the flow, in units of TCP_RTT_SCALE * HZ,
 where TCP_RTT_SCALE is a define found in tcp_var.h, and HZ is the kernel's tick
@@ -289,46 +289,46 @@ timer.
 Divide by TCP_RTT_SCALE * HZ to get the RTT in secs. TCP_RTT_SCALE and HZ are
 reported in the enable log message.
 .El
-.Bl -tag -offset indent
+.Bl -tag -offset indent -width Va
 .It Va 18
 SACK enabled indicator. 1 if SACK enabled, 0 otherwise.
 .El
-.Bl -tag -offset indent
+.Bl -tag -offset indent -width Va
 .It Va 19
 The current state of the TCP flags for the flow.
 See
 .Aq Pa netinet/tcp_var.h
 for information about the various flags.
 .El
-.Bl -tag -offset indent
+.Bl -tag -offset indent -width Va
 .It Va 20
 The current retransmission timeout length for the flow, in units of HZ, where HZ
 is the kernel's tick timer.
 Divide by HZ to get the timeout length in seconds. HZ is reported in the
 enable log message.
 .El
-.Bl -tag -offset indent
+.Bl -tag -offset indent -width Va
 .It Va 21
 The current size of the socket send buffer in bytes.
 .El
-.Bl -tag -offset indent
+.Bl -tag -offset indent -width Va
 .It Va 22
 The current number of bytes in the socket send buffer.
 .El
-.Bl -tag -offset indent
+.Bl -tag -offset indent -width Va
 .It Va 23
 The current size of the socket receive buffer in bytes.
 .El
-.Bl -tag -offset indent
+.Bl -tag -offset indent -width Va
 .It Va 24
 The current number of bytes in the socket receive buffer.
 .El
-.Bl -tag -offset indent
+.Bl -tag -offset indent -width Va
 .It Va 25
 The current number of unacknowledged bytes in-flight.
 Bytes acknowledged via SACK are not excluded from this count.
 .El
-.Bl -tag -offset indent
+.Bl -tag -offset indent -width Va
 .It Va 26
 The current number of segments in the reassembly queue.
 .El
@@ -350,82 +350,82 @@ flow_list=172.16.7.28;22-172.16.2.5;5593
 .Ed
 .Pp
 Field descriptions are as follows:
-.Bl -tag -offset indent
+.Bl -tag -offset indent -width Va
 .It Va disable_time_secs
 Time at which the module was disabled, in seconds since the UNIX epoch.
 .El
-.Bl -tag -offset indent
+.Bl -tag -offset indent -width Va
 .It Va disable_time_usecs
 Time at which the module was disabled, in microseconds since disable_time_secs.
 .El
-.Bl -tag -offset indent
+.Bl -tag -offset indent -width Va
 .It Va num_inbound_tcp_pkts
 Number of TCP packets that traversed up the network stack.
 This only includes inbound TCP packets during the periods when
 .Nm
 was enabled.
 .El
-.Bl -tag -offset indent
+.Bl -tag -offset indent -width Va
 .It Va num_outbound_tcp_pkts
 Number of TCP packets that traversed down the network stack.
 This only includes outbound TCP packets during the periods when
 .Nm
 was enabled.
 .El
-.Bl -tag -offset indent
+.Bl -tag -offset indent -width Va
 .It Va total_tcp_pkts
 The summation of num_inbound_tcp_pkts and num_outbound_tcp_pkts.
 .El
-.Bl -tag -offset indent
+.Bl -tag -offset indent -width Va
 .It Va num_inbound_skipped_pkts_malloc
 Number of inbound packets that were not processed because of failed malloc() calls.
 .El
-.Bl -tag -offset indent
+.Bl -tag -offset indent -width Va
 .It Va num_outbound_skipped_pkts_malloc
 Number of outbound packets that were not processed because of failed malloc() calls.
 .El
-.Bl -tag -offset indent
+.Bl -tag -offset indent -width Va
 .It Va num_inbound_skipped_pkts_mtx
 Number of inbound packets that were not processed because of failure to add the
 packet to the packet processing queue.
 .El
-.Bl -tag -offset indent
+.Bl -tag -offset indent -width Va
 .It Va num_outbound_skipped_pkts_mtx
 Number of outbound packets that were not processed because of failure to add the
 packet to the packet processing queue.
 .El
-.Bl -tag -offset indent
+.Bl -tag -offset indent -width Va
 .It Va num_inbound_skipped_pkts_tcb
 Number of inbound packets that were not processed because of failure to find the
 TCP control block associated with the packet.
 .El
-.Bl -tag -offset indent
+.Bl -tag -offset indent -width Va
 .It Va num_outbound_skipped_pkts_tcb
 Number of outbound packets that were not processed because of failure to find
 the TCP control block associated with the packet.
 .El
-.Bl -tag -offset indent
+.Bl -tag -offset indent -width Va
 .It Va num_inbound_skipped_pkts_icb
 Number of inbound packets that were not processed because of failure to find the
 IP control block associated with the packet.
 .El
-.Bl -tag -offset indent
+.Bl -tag -offset indent -width Va
 .It Va num_outbound_skipped_pkts_icb
 Number of outbound packets that were not processed because of failure to find
 the IP control block associated with the packet.
 .El
-.Bl -tag -offset indent
+.Bl -tag -offset indent -width Va
 .It Va total_skipped_tcp_pkts
 The summation of all skipped packet counters.
 .El
-.Bl -tag -offset indent
+.Bl -tag -offset indent -width Va
 .It Va flow_list
 A CSV list of TCP flows that triggered data log messages to be generated since
 the module was loaded.
 Each flow entry in the CSV list is
 formatted as
 .Qq local_ip;local_port-foreign_ip;foreign_port .
-If there are no entries in the list (i.e. no data log messages were generated),
+If there are no entries in the list (i.e., no data log messages were generated),
 the value will be blank.
 If there is at least one entry in the list, a trailing comma will always be
 present.
@@ -498,10 +498,10 @@ the system to trigger a dump of the stat
 flow.
 With the PPL set to 1, we are in effect sampling each TCP flow's control block
 state as frequently as flow packets enter/leave the system.
-For example, setting PPL to 2 halves the sampling rate i.e. every second flow
+For example, setting PPL to 2 halves the sampling rate i.e., every second flow
 packet (inbound OR outbound) causes a dump of the control block state.
 .Pp
-The distinction between interrogating individual packets vs interrogating the
+The distinction between interrogating individual packets versus interrogating the
 control block is important, because
 .Nm
 does not remove the need for packet capturing tools like
@@ -543,7 +543,7 @@ If one thread holds the lock, the other 
 This does introduce some additional bounded delay into the kernel's packet
 processing code path.
 .Pp
-In some cases (e.g. low memory, connection termination), TCP packets that enter
+In some cases (e.g., low memory, connection termination), TCP packets that enter
 the
 .Nm
 .Xr pfil 9

From owner-svn-src-stable-9@FreeBSD.ORG  Sun May 20 14:15:13 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id A7B4A106566C;
	Sun, 20 May 2012 14:15:13 +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 918798FC08;
	Sun, 20 May 2012 14:15: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 q4KEFDYc096364;
	Sun, 20 May 2012 14:15:13 GMT (envelope-from kib@svn.freebsd.org)
Received: (from kib@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4KEFDp8096362;
	Sun, 20 May 2012 14:15:13 GMT (envelope-from kib@svn.freebsd.org)
Message-Id: <201205201415.q4KEFDp8096362@svn.freebsd.org>
From: Konstantin Belousov <kib@FreeBSD.org>
Date: Sun, 20 May 2012 14:15:13 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r235688 - stable/9/sys/amd64/amd64
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sun, 20 May 2012 14:15:13 -0000

Author: kib
Date: Sun May 20 14:15:13 2012
New Revision: 235688
URL: http://svn.freebsd.org/changeset/base/235688

Log:
  MFC r235538:
  Fix typo.
  
  MFC r235555:
  Use singular form for a modifier.

Modified:
  stable/9/sys/amd64/amd64/fpu.c
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/amd64/amd64/fpu.c
==============================================================================
--- stable/9/sys/amd64/amd64/fpu.c	Sun May 20 10:02:24 2012	(r235687)
+++ stable/9/sys/amd64/amd64/fpu.c	Sun May 20 14:15:13 2012	(r235688)
@@ -141,7 +141,7 @@ CTASSERT(sizeof(struct savefpu_ymm) == 8
 /*
  * This requirement is to make it easier for asm code to calculate
  * offset of the fpu save area from the pcb address. FPU save area
- * must by 64-bytes aligned.
+ * must be 64-byte aligned.
  */
 CTASSERT(sizeof(struct pcb) % XSAVE_AREA_ALIGN == 0);
 

From owner-svn-src-stable-9@FreeBSD.ORG  Sun May 20 15:10:13 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id E62761065673;
	Sun, 20 May 2012 15:10:13 +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 D0E958FC14;
	Sun, 20 May 2012 15:10: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 q4KFAD0V098956;
	Sun, 20 May 2012 15:10:13 GMT (envelope-from dim@svn.freebsd.org)
Received: (from dim@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4KFAD99098954;
	Sun, 20 May 2012 15:10:13 GMT (envelope-from dim@svn.freebsd.org)
Message-Id: <201205201510.q4KFAD99098954@svn.freebsd.org>
From: Dimitry Andric <dim@FreeBSD.org>
Date: Sun, 20 May 2012 15:10:13 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r235690 - stable/9/usr.sbin/bluetooth/hccontrol
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sun, 20 May 2012 15:10:14 -0000

Author: dim
Date: Sun May 20 15:10:13 2012
New Revision: 235690
URL: http://svn.freebsd.org/changeset/base/235690

Log:
  MFC r228976:
  
  Reencode files to UTF-8. Drop CP1252 em-dash.

Modified:
  stable/9/usr.sbin/bluetooth/hccontrol/host_controller_baseband.c
Directory Properties:
  stable/9/usr.sbin/bluetooth/hccontrol/   (props changed)

Modified: stable/9/usr.sbin/bluetooth/hccontrol/host_controller_baseband.c
==============================================================================
--- stable/9/usr.sbin/bluetooth/hccontrol/host_controller_baseband.c	Sun May 20 14:33:28 2012	(r235689)
+++ stable/9/usr.sbin/bluetooth/hccontrol/host_controller_baseband.c	Sun May 20 15:10:13 2012	(r235690)
@@ -1632,8 +1632,8 @@ struct hci_command	host_controller_baseb
 "begins the next page scan. The Page_Scan_Window configuration parameter\n" \
 "defines the amount of time for the duration of the page scan. \n" \
 "The Page_Scan_Window can only be less than or equal to the Page_Scan_Interval.\n\n" \
-"\t<interval> - Range: 0x0012 -– 0x100, Time = N * 0.625 msec\n" \
-"\t<window>   - Range: 0x0012 -– 0x100, Time = N * 0.625 msen",
+"\t<interval> - Range: 0x0012 -- 0x100, Time = N * 0.625 msec\n" \
+"\t<window>   - Range: 0x0012 -- 0x100, Time = N * 0.625 msen",
 &hci_write_page_scan_activity
 },
 {
@@ -1654,8 +1654,8 @@ struct hci_command	host_controller_baseb
 "until it begins the next inquiry scan. The Inquiry_Scan_Window configuration\n" \
 "parameter defines the amount of time for the duration of the inquiry scan.\n" \
 "The Inquiry_Scan_Window can only be less than or equal to the Inquiry_Scan_Interval.\n\n" \
-"\t<interval> - Range: 0x0012 -– 0x100, Time = N * 0.625 msec\n" \
-"\t<window>   - Range: 0x0012 -– 0x100, Time = N * 0.625 msen",
+"\t<interval> - Range: 0x0012 -- 0x100, Time = N * 0.625 msec\n" \
+"\t<window>   - Range: 0x0012 -- 0x100, Time = N * 0.625 msen",
 &hci_write_inquiry_scan_activity
 },
 {

From owner-svn-src-stable-9@FreeBSD.ORG  Sun May 20 18:21:07 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 604B0106566C;
	Sun, 20 May 2012 18:21:07 +0000 (UTC) (envelope-from dim@FreeBSD.org)
Received: from springbank.echomania.com (andric.com
	[IPv6:2001:888:2003:1001:230:48ff:fe51:76b6])
	by mx1.freebsd.org (Postfix) with ESMTP id EA7E58FC1B;
	Sun, 20 May 2012 18:21:06 +0000 (UTC)
X-Virus-Scanned: Debian amavisd-new at springbank.echomania.com
Received: from [192.168.1.6] (tensor.andric.com [87.251.56.140])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by springbank.echomania.com (Postfix) with ESMTPSA id A7B41A70D2;
	Sun, 20 May 2012 20:20:44 +0200 (CEST)
Message-ID: <4FB9360F.9020606@FreeBSD.org>
Date: Sun, 20 May 2012 20:21:03 +0200
From: Dimitry Andric <dim@FreeBSD.org>
Organization: The FreeBSD Project
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64;
	rv:13.0) Gecko/20120425 Thunderbird/13.0
MIME-Version: 1.0
To: src-committers@freebsd.org, svn-src-all@freebsd.org, 
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
References: <201205201510.q4KFAD99098954@svn.freebsd.org>
In-Reply-To: <201205201510.q4KFAD99098954@svn.freebsd.org>
X-Enigmail-Version: 1.5a1pre
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Cc: 
Subject: Re: svn commit: r235690 - stable/9/usr.sbin/bluetooth/hccontrol
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sun, 20 May 2012 18:21:07 -0000

On 2012-05-20 17:10, Dimitry Andric wrote:> Author: dim
> Date: Sun May 20 15:10:13 2012
> New Revision: 235690
> URL: http://svn.freebsd.org/changeset/base/235690
> 
> Log:
>   MFC r228976:
>   
>   Reencode files to UTF-8. Drop CP1252 em-dash.

Note: as of this MFC, stable/9 world + GENERIC should compile cleanly
with clang 3.1 (the newly merged version).

From owner-svn-src-stable-9@FreeBSD.ORG  Sun May 20 20:25:23 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 71518106566C;
	Sun, 20 May 2012 20:25:23 +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 5B7958FC14;
	Sun, 20 May 2012 20:25: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 q4KKPNPB014172;
	Sun, 20 May 2012 20:25:23 GMT (envelope-from bz@svn.freebsd.org)
Received: (from bz@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4KKPNAx014170;
	Sun, 20 May 2012 20:25:23 GMT (envelope-from bz@svn.freebsd.org)
Message-Id: <201205202025.q4KKPNAx014170@svn.freebsd.org>
From: "Bjoern A. Zeeb" <bz@FreeBSD.org>
Date: Sun, 20 May 2012 20:25:23 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r235696 - stable/9/lib/libipsec
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sun, 20 May 2012 20:25:23 -0000

Author: bz
Date: Sun May 20 20:25:22 2012
New Revision: 235696
URL: http://svn.freebsd.org/changeset/base/235696

Log:
  MFC r231532:
  
   MFp4 204292:
  
   Ignore the NAT_T extension types so we can at least dump the SADB from
   the in-base libipsec/setkey without error when NAT_T support is present
   in the kernel, though not printing the additional information yet.
   However in case there is no NAT_T support in kernel still consider them
   to be an error.

Modified:
  stable/9/lib/libipsec/pfkey.c
Directory Properties:
  stable/9/lib/libipsec/   (props changed)

Modified: stable/9/lib/libipsec/pfkey.c
==============================================================================
--- stable/9/lib/libipsec/pfkey.c	Sun May 20 18:25:45 2012	(r235695)
+++ stable/9/lib/libipsec/pfkey.c	Sun May 20 20:25:22 2012	(r235696)
@@ -1778,6 +1778,18 @@ pfkey_align(msg, mhp)
 		case SADB_X_EXT_SA2:
 			mhp[ext->sadb_ext_type] = (caddr_t)ext;
 			break;
+		case SADB_X_EXT_NAT_T_TYPE:
+		case SADB_X_EXT_NAT_T_SPORT:
+		case SADB_X_EXT_NAT_T_DPORT:
+		/* case SADB_X_EXT_NAT_T_OA: is OAI */
+		case SADB_X_EXT_NAT_T_OAI:
+		case SADB_X_EXT_NAT_T_OAR:
+		case SADB_X_EXT_NAT_T_FRAG:
+			if (feature_present("ipsec_natt")) {
+				mhp[ext->sadb_ext_type] = (caddr_t)ext;
+				break;
+			}
+			/* FALLTHROUGH */
 		default:
 			__ipsec_errcode = EIPSEC_INVAL_EXTTYPE;
 			return -1;

From owner-svn-src-stable-9@FreeBSD.ORG  Sun May 20 22:06:32 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id D49A0106566B;
	Sun, 20 May 2012 22:06:32 +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 BF2398FC14;
	Sun, 20 May 2012 22:06: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 q4KM6Wpv019546;
	Sun, 20 May 2012 22:06:32 GMT (envelope-from bz@svn.freebsd.org)
Received: (from bz@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4KM6W9E019544;
	Sun, 20 May 2012 22:06:32 GMT (envelope-from bz@svn.freebsd.org)
Message-Id: <201205202206.q4KM6W9E019544@svn.freebsd.org>
From: "Bjoern A. Zeeb" <bz@FreeBSD.org>
Date: Sun, 20 May 2012 22:06:32 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r235700 - stable/9/usr.sbin/jls
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sun, 20 May 2012 22:06:32 -0000

Author: bz
Date: Sun May 20 22:06:32 2012
New Revision: 235700
URL: http://svn.freebsd.org/changeset/base/235700

Log:
  MFC r232613:
  
   Fix building with WITHOUT_INET_SUPPORT set.
  
   Reviewed by:	jamie (actually provided the real fix)

Modified:
  stable/9/usr.sbin/jls/jls.c
Directory Properties:
  stable/9/usr.sbin/jls/   (props changed)

Modified: stable/9/usr.sbin/jls/jls.c
==============================================================================
--- stable/9/usr.sbin/jls/jls.c	Sun May 20 21:05:51 2012	(r235699)
+++ stable/9/usr.sbin/jls/jls.c	Sun May 20 22:06:32 2012	(r235700)
@@ -403,11 +403,13 @@ print_jail(int pflags, int jflags)
 #ifdef INET
 		    (!ip4_ok || params[1].jp_valuelen == 0) ? "-"
 		    : inet_ntoa(*(struct in_addr *)params[1].jp_value),
+		    (char *)params[2-!ip4_ok].jp_value,
+		    (char *)params[3-!ip4_ok].jp_value);
 #else
 		    "-",
+		    (char *)params[1].jp_value,
+		    (char *)params[2].jp_value);
 #endif
-		    (char *)params[2-!ip4_ok].jp_value,
-		    (char *)params[3-!ip4_ok].jp_value);
 	else {
 		param_values = alloca(nparams * sizeof(*param_values));
 		for (i = 0; i < nparams; i++) {

From owner-svn-src-stable-9@FreeBSD.ORG  Sun May 20 22:22:08 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 34E4D106564A;
	Sun, 20 May 2012 22:22:07 +0000 (UTC) (envelope-from mm@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 76B218FC08;
	Sun, 20 May 2012 22:22: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 q4KMLxcb020452;
	Sun, 20 May 2012 22:21:59 GMT (envelope-from mm@svn.freebsd.org)
Received: (from mm@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4KMLxFk020445;
	Sun, 20 May 2012 22:21:59 GMT (envelope-from mm@svn.freebsd.org)
Message-Id: <201205202221.q4KMLxFk020445@svn.freebsd.org>
From: Martin Matuska <mm@FreeBSD.org>
Date: Sun, 20 May 2012 22:21:59 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r235701 - in stable/9/cddl/contrib/opensolaris: cmd/zdb
	cmd/zfs lib/libzfs/common
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sun, 20 May 2012 22:22:08 -0000

Author: mm
Date: Sun May 20 22:21:59 2012
New Revision: 235701
URL: http://svn.freebsd.org/changeset/base/235701

Log:
  MFC r235212, r235216, r235217:
  
  MFC r325212 [1]:
  Import illumos changeset 13618:c6ae14a341e8
  2088 zdb could use a reasonable manual page
  
  Rewrite new zdb manpage to mdoc(7)
  
  MFC r235216 [2]:
  Add support for force unmounting ZFS filesystems during "zfs rename"
  with the -f flag.
  
  Reimplementation of the illumos changeset 13677:a0cbef703c12
  2635 'zfs rename -f' to perform force unmount
  
  MFC r235217 [3]:
  Remove unreachable break in zfs_main.c
  
  Partial import of illumos changeset 13622:e5889df1eaac
  2077 lots of unreachable breaks in illumos gate
  
  References:
  https://www.illumos.org/issues/2088 [1]
  https://www.illumos.org/issues/2635 [2]
  https://www.illumos.org/issues/2077 [3]
  
  PR:		164447 [1], 164447 [2], 167370 [3]
  Suggested by:	Marcelo Araujo <araujo@FreeBSD.org>
  Obtained from:	illumos (issue #2088 [1], #2635 [2], #2077 [3])

Modified:
  stable/9/cddl/contrib/opensolaris/cmd/zdb/zdb.8
  stable/9/cddl/contrib/opensolaris/cmd/zdb/zdb.c
  stable/9/cddl/contrib/opensolaris/cmd/zfs/zfs.8
  stable/9/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c
  stable/9/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h
  stable/9/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c
Directory Properties:
  stable/9/cddl/contrib/opensolaris/   (props changed)

Modified: stable/9/cddl/contrib/opensolaris/cmd/zdb/zdb.8
==============================================================================
--- stable/9/cddl/contrib/opensolaris/cmd/zdb/zdb.8	Sun May 20 22:06:32 2012	(r235700)
+++ stable/9/cddl/contrib/opensolaris/cmd/zdb/zdb.8	Sun May 20 22:21:59 2012	(r235701)
@@ -1,61 +1,286 @@
 '\" te
-.\" Copyright (c) 2011, Martin Matuska <mm@FreeBSD.org>.
+.\" Copyright (c) 2012, Martin Matuska <mm@FreeBSD.org>.
 .\" All Rights Reserved.
 .\"
-.\" The contents of this file are subject to the terms of the
-.\" Common Development and Distribution License (the "License").
-.\" You may not use this file except in compliance with the License.
-.\"
-.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-.\" or http://www.opensolaris.org/os/licensing.
-.\" See the License for the specific language governing permissions
-.\" and limitations under the License.
-.\"
-.\" When distributing Covered Code, include this CDDL HEADER in each
-.\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-.\" If applicable, add the following below this CDDL HEADER, with the
-.\" fields enclosed by brackets "[]" replaced with your own identifying
-.\" information: Portions Copyright [yyyy] [name of copyright owner]
+.\" This file and its contents are supplied under the terms of the
+.\" Common Development and Distribution License ("CDDL"), version 1.0.
+.\" You may only use this file in accordance with the terms of version
+.\" 1.0 of the CDDL.
 .\"
-.\" Copyright (c) 2004, Sun Microsystems, Inc. All Rights Reserved.
+.\" A full copy of the text of the CDDL should have accompanied this
+.\" source.  A copy of the CDDL is also available via the Internet at
+.\" http://www.illumos.org/license/CDDL.
+.\"
+.\"
+.\" Copyright 2012, Richard Lowe.
+.\" Copyright (c) 2012, Marcelo Araujo <araujo@FreeBSD.org>.
+.\" All Rights Reserved.
 .\"
 .\" $FreeBSD$
 .\"
-.Dd November 26, 2011
+.Dd May 10, 2012
 .Dt ZDB 8
 .Os
 .Sh NAME
 .Nm zdb
-.Nd ZFS debugger
+.Nd Display zpool debugging and consistency information
 .Sh SYNOPSIS
 .Nm
-.Ar pool
+.Op Fl CumdibcsDvhLXFPA
+.Op Fl e Op Fl p Ar path...
+.Op Fl t Ar txg
+.Ar poolname
+.Op Ar object ...
+.Nm
+.Op Fl divPA
+.Op Fl e Op Fl p Ar path...
+.Ar dataset
+.Op Ar object ...
+.Nm
+.Fl m Op Fl LXFPA
+.Op Fl t Ar txg
+.Op Fl e Op Fl p Ar path...
+.Ar poolname
+.Nm
+.Fl R Op Fl A
+.Op Fl e Op Fl p Ar path...
+.Ar poolname
+.Ar vdev Ns : Ns Ar offset Ns : Ns Ar size Ns Op Ns : Ns Ar flags
+.Nm
+.Fl S
+.Op Fl AP
+.Op Fl e Op Fl p Ar path...
+.Ar poolname
+.Nm
+.Fl l
+.Op Fl uA
+.Ar device
+.Nm
+.Fl C
+.Op Fl A
+.Op Fl U Ar cache
 .Sh DESCRIPTION
 The
 .Nm
-command is used by support engineers to diagnose failures and
-gather statistics. Since the
-.Tn ZFS
-file system is always consistent on disk and is self-repairing,
-.Nm
-should only be run under the direction by a support engineer.
-.Pp
-If no arguments are specified,
-.Nm
-performs basic consistency checks on the pool and associated datasets, and
-report any problems detected.
-.Nm
-Any options supported by this command are internal to Sun and subject to change
-at any time.
-.Sh EXIT STATUS
-The following exit values are returned:
-.Bl -tag -offset 2n -width 2n
-.It 0
-The pool is consistent.
-.It 1
-An error was detected.
-.It 2
-Invalid command line options were specified.
+utility displays information about a ZFS pool useful for debugging and
+performs some amount of consistency checking.
+It is a not a general purpose tool and options (and facilities) may change.
+This is neither a
+.Xr fsck 8
+nor a
+.Xr fsdb 8
+utility.
+.Pp
+The output of this command in general reflects the on-disk structure of a ZFS
+pool, and is inherently unstable.
+The precise output of most invocations is not documented, a knowledge of ZFS
+internals is assumed.
+.Pp
+When operating on an imported and active pool it is possible, though unlikely,
+that zdb may interpret inconsistent pool data and behave erratically.
+.Sh OPTIONS
+Display options:
+.Bl -tag -width indent
+.It Fl b
+Display statistics regarding the number, size (logical, physical and
+allocated) and deduplication of blocks.
+.It Fl c
+Verify the checksum of all metadata blocks while printing block statistics
+(see
+.Fl b Ns ).
+.Pp
+If specified multiple times, verify the checksums of all blocks.
+.It Fl C
+Display information about the configuration. If specified with no other
+options, instead display information about the cache file
+.Ns ( Pa /etc/zfs/zpool.cache Ns ).
+To specify the cache file to display, see
+.Fl U
+.Pp
+If specified multiple times, and a pool name is also specified display both
+the cached configuration and the on-disk configuration.
+If specified multiple times with
+.FL e
+also display the configuration that would be used were the pool to be
+imported.
+.It Fl d
+Display information about datasets. Specified once, displays basic dataset
+information: ID, create transaction, size, and object count.
+.Pp
+If specified multiple times provides greater and greater verbosity.
+.Pp
+If object IDs are specified, display information about those specific objects only.
+.It Fl D
+Display deduplication statistics, including the deduplication ratio (dedup),
+compression ratio (compress), inflation due to the zfs copies property
+(copies), and an overall effective ratio (dedup * compress / copies).
+.Pp
+If specified twice, display a histogram of deduplication statistics, showing
+the allocated (physically present on disk) and referenced (logically
+referenced in the pool) block counts and sizes by reference count.
+.It Fl h
+Display pool history similar to
+.Cm zpool history ,
+but include internal changes, transaction, and dataset information.
+.It Fl i
+Display information about intent log (ZIL) entries relating to each
+dataset.
+If specified multiple times, display counts of each intent log transaction
+type.
+.It Fl l Ar device
+Display the vdev labels from the specified device.
+If the
+.Fl u
+option is also specified, also display the uberblocks on this device.
+.It Fl L
+Disable leak tracing and the loading of space maps.
+By default,
+.Nm 
+verifies that all non-free blocks are referenced, which can be very expensive.
+.It Fl m
+Display the offset, spacemap, and free space of each metaslab.
+When specified twice, also display information about the maximum contiguous
+free space and the percentage of free space in each space map.
+When specified three times display every spacemap record.
+.It Xo
+.Fl R Ar poolname
+.Ar vdev Ns : Ns Ar offset Ns : Ns Ar size Ns Op Ns : Ns Ar flags
+.Xc
+Read and display a block from the specified device. By default the block is
+displayed as a hex dump, but see the description of the
+.Fl r
+flag, below.
+.Pp
+The block is specified in terms of a colon-separated tuple
+.Ar vdev
+(an integer vdev identifier)
+.Ar offset
+(the offset within the vdev)
+.Ar size
+(the size of the block to read) and, optionally,
+.Ar flags
+(a set of flags, described below).
+.Bl -tag -width indent
+.It Sy b offset
+Print block pointer
+.It Sy d
+Decompress the block
+.It Sy e
+Byte swap the block
+.It Sy g
+Dump gang block header
+.It Sy i
+Dump indirect block
+.It Sy r
+Dump raw uninterpreted block data
+.El
+.It Fl s
+Report statistics on
+.Nm Ns 's
+I/O.
+Display operation counts, bandwidth, and error counts of I/O to the pool from
+.Nm .
+.It Fl S
+Simulate the effects of deduplication, constructing a DDT and then display
+that DDT as with \fB-DD\fR.
+.It Fl u
+Display the current uberblock.
+.El
+.Pp
+Other options:
+.Bl -tag -width indent
+.It Fl A
+Do not abort should any assertion fail.
+.It Fl AA
+Enable panic recovery, certain errors which would otherwise be fatal are
+demoted to warnings.
+.It Fl AAA
+Do not abort if asserts fail and also enable panic recovery.
+.It Fl e Op Fl p Ar path...
+Operate on an exported pool, not present in
+.Pa /etc/zfs/zpool.cache .
+The
+.Fl p
+flag specifies the path under which devices are to be searched.
+.It Fl F
+Attempt to make an unreadable pool readable by trying progressively older
+transactions.
+.It Fl P
+Print numbers in an unscaled form more amenable to parsing, eg. 1000000 rather
+than 1M.
+.It Fl t Ar transaction
+Specify the highest transaction to use when searching for uberblocks.
+See also the
+.Fl u
+and
+.Fl l
+options for a means to see the available uberblocks and their associated
+transaction numbers.
+.It Fl U Ar cachefile
+Use a cache file other than
+.Pa /etc/zfs/zpool.cache .
+This option is only valid with
+.Fl C
+.It Fl v
+Enable verbosity.
+Specify multiple times for increased verbosity.
+.It Fl X
+Attempt
+.Ql extreme
+transaction rewind, that is attempt the same recovery as
+.Fl F
+but read transactions otherwise deemed too old.
+.El
+.Pp
+Specifying a display option more than once enables verbosity for only that
+option, with more occurrences enabling more verbosity.
+.Pp
+If no options are specified, all information about the named pool will be
+displayed at default verbosity.
+.Sh EXAMPLES
+.Bl -tag -width 0n
+.It Sy Example 1 Display the configuration of imported pool 'rpool'
+.Bd -literal -offset 2n
+.Li # Ic zdb -C rpool
+
+MOS Configuration:
+        version: 28
+        name: 'rpool'
+ ...
+.Ed
+.It Sy Example 2 Display basic dataset information about 'rpool'
+.Bd -literal -offset 2n
+.Li # Ic zdb -d rpool
+Dataset mos [META], ID 0, cr_txg 4, 26.9M, 1051 objects
+Dataset rpool/swap [ZVOL], ID 59, cr_txg 356, 486M, 2 objects
+...
+.Ed
+.It Xo Sy Example 3 Display basic information about object 0 in
+.Sy 'rpool/export/home'
+.Xc
+.Bd -literal -offset 2n
+.Li # Ic zdb -d rpool/export/home 0
+Dataset rpool/export/home [ZPL], ID 137, cr_txg 1546, 32K, 8 objects
+
+    Object  lvl   iblk   dblk  dsize  lsize   %full  type
+         0    7    16K    16K  15.0K    16K   25.00  DMU dnode
+.Ed
+.It Xo Sy Example 4 Display the predicted effect of enabling deduplication on
+.Sy 'rpool'
+.Xc
+.Bd -literal -offset 2n
+.Li # Ic zdb -S rpool
+Simulated DDT histogram:
+
+bucket             allocated                      referenced          
+______  ______________________________  ______________________________
+refcnt  blocks   LSIZE   PSIZE   DSIZE  blocks   LSIZE   PSIZE   DSIZE
+------  ------   -----   -----   -----  ------   -----   -----   -----
+     1    694K   27.1G   15.0G   15.0G    694K   27.1G   15.0G   15.0G
+     2   35.0K   1.33G    699M    699M   74.7K   2.79G   1.45G   1.45G
+ ...
+dedup = 1.11, compress = 1.80, copies = 1.00, dedup * compress / copies = 2.00
+.Ed
 .El
 .Sh SEE ALSO
 .Xr zfs 8 ,
@@ -64,16 +289,18 @@ Invalid command line options were specif
 This manual page is a
 .Xr mdoc 7
 reimplementation of the
-.Tn OpenSolaris
+.Tn illumos
 manual page
 .Em zdb(1M) ,
 modified and customized for
 .Fx
 and licensed under the
-.Tn Common Development and Distribution License
+Common Development and Distribution License
 .Pq Tn CDDL .
 .Pp
 The
 .Xr mdoc 7
 implementation of this manual page was initially written by
-.An Martin Matuska Aq mm@FreeBSD.org .
+.An Martin Matuska Aq mm@FreeBSD.org
+and
+.An Marcelo Araujo Aq araujo@FreeBSD.org .

Modified: stable/9/cddl/contrib/opensolaris/cmd/zdb/zdb.c
==============================================================================
--- stable/9/cddl/contrib/opensolaris/cmd/zdb/zdb.c	Sun May 20 22:06:32 2012	(r235700)
+++ stable/9/cddl/contrib/opensolaris/cmd/zdb/zdb.c	Sun May 20 22:21:59 2012	(r235701)
@@ -102,13 +102,16 @@ static void
 usage(void)
 {
 	(void) fprintf(stderr,
-	    "Usage: %s [-CumdibcsDvhL] poolname [object...]\n"
-	    "       %s [-div] dataset [object...]\n"
-	    "       %s -m [-L] poolname [vdev [metaslab...]]\n"
-	    "       %s -R poolname vdev:offset:size[:flags]\n"
-	    "       %s -S poolname\n"
-	    "       %s -l [-u] device\n"
-	    "       %s -C\n\n",
+            "Usage: %s [-CumdibcsDvhLXFPA] [-t txg] [-e [-p path...]]"
+            "poolname [object...]\n"
+            "       %s [-divPA] [-e -p path...] dataset [object...]\n"
+            "       %s -m [-LXFPA] [-t txg] [-e [-p path...]]"
+            "poolname [vdev [metaslab...]]\n"
+            "       %s -R [-A] [-e [-p path...]] poolname "
+            "vdev:offset:size[:flags]\n"
+            "       %s -S [-PA] [-e [-p path...]] poolname\n"
+            "       %s -l [-uA] device\n"
+            "       %s -C [-A] [-U config]\n\n",
 	    cmdname, cmdname, cmdname, cmdname, cmdname, cmdname, cmdname);
 
 	(void) fprintf(stderr, "    Dataset name must include at least one "
@@ -150,7 +153,7 @@ usage(void)
 	    "has altroot/not in a cachefile\n");
 	(void) fprintf(stderr, "        -p <path> -- use one or more with "
 	    "-e to specify path to vdev dir\n");
-	(void) fprintf(stderr, "	-P print numbers parsable\n");
+	(void) fprintf(stderr, "	-P print numbers in parseable form\n");
 	(void) fprintf(stderr, "        -t <txg> -- highest txg to use when "
 	    "searching for uberblocks\n");
 	(void) fprintf(stderr, "Specify an option more than once (e.g. -bb) "

Modified: stable/9/cddl/contrib/opensolaris/cmd/zfs/zfs.8
==============================================================================
--- stable/9/cddl/contrib/opensolaris/cmd/zfs/zfs.8	Sun May 20 22:06:32 2012	(r235700)
+++ stable/9/cddl/contrib/opensolaris/cmd/zfs/zfs.8	Sun May 20 22:21:59 2012	(r235701)
@@ -18,7 +18,7 @@
 .\" information: Portions Copyright [yyyy] [name of copyright owner]
 .\"
 .\" Copyright (c) 2010, Sun Microsystems, Inc. All Rights Reserved.
-.\" Copyright (c) 2011 by Delphix. All rights reserved.
+.\" Copyright (c) 2012 by Delphix. All rights reserved.
 .\" Copyright (c) 2012 Nexenta Systems, Inc. All Rights Reserved.
 .\" Copyright (c) 2011, Pawel Jakub Dawidek <pjd@FreeBSD.org>
 .\"
@@ -77,10 +77,12 @@
 .Ar clone-filesystem
 .Nm
 .Cm rename
+.Op Fl f
 .Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot
 .Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot
 .Nm
 .Cm rename
+.Op Fl f
 .Fl p
 .Ar filesystem Ns | Ns Ar volume
 .Ar filesystem Ns | Ns Ar volume
@@ -1638,12 +1640,14 @@ subcommand can be used to rename any con
 .It Xo
 .Nm
 .Cm rename
+.Op Fl f
 .Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot
 .Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot
 .Xc
 .It Xo
 .Nm
 .Cm rename
+.Op Fl f
 .Fl p
 .Ar filesystem Ns | Ns Ar volume
 .Ar filesystem Ns | Ns Ar volume
@@ -1677,6 +1681,11 @@ property is set to
 or
 .Cm none ,
 file system is not unmounted even if this option is not given.
+.It Fl f
+Force unmount any filesystems that need to be unmounted in the process.
+This flag has no effect if used together with the
+.Fl u
+flag.
 .El
 .It Xo
 .Nm

Modified: stable/9/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c
==============================================================================
--- stable/9/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c	Sun May 20 22:06:32 2012	(r235700)
+++ stable/9/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c	Sun May 20 22:21:59 2012	(r235701)
@@ -22,10 +22,11 @@
 /*
  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
  * Copyright 2012 Nexenta Systems, Inc. All rights reserved.
- * Copyright (c) 2011 by Delphix. All rights reserved.
+ * Copyright (c) 2012 by Delphix. All rights reserved.
+ * Copyright 2012 Milan Jurik. All rights reserved.
  * Copyright (c) 2011-2012 Pawel Jakub Dawidek <pawel@dawidek.net>.
  * All rights reserved.
- * Copyright (c) 2011 Martin Matuska <mm@FreeBSD.org>. All rights reserved.
+ * Copyright (c) 2012 Martin Matuska <mm@FreeBSD.org>. All rights reserved.
  */
 
 #include <assert.h>
@@ -256,9 +257,10 @@ get_usage(zfs_help_t idx)
 		"snapshot>\n"
 		"\treceive [-vnFu] [-d | -e] <filesystem>\n"));
 	case HELP_RENAME:
-		return (gettext("\trename <filesystem|volume|snapshot> "
+		return (gettext("\trename [-f] <filesystem|volume|snapshot> "
 		    "<filesystem|volume|snapshot>\n"
-		    "\trename -p <filesystem|volume> <filesystem|volume>\n"
+		    "\trename [-f] -p <filesystem|volume> "
+		    "<filesystem|volume>\n"
 		    "\trename -r <snapshot> <snapshot>\n"
 		    "\trename -u [-p] <filesystem> <filesystem>"));
 	case HELP_ROLLBACK:
@@ -758,7 +760,6 @@ zfs_do_create(int argc, char **argv)
 			(void) fprintf(stderr, gettext("missing size "
 			    "argument\n"));
 			goto badusage;
-			break;
 		case '?':
 			(void) fprintf(stderr, gettext("invalid option '%c'\n"),
 			    optopt);
@@ -3080,8 +3081,8 @@ zfs_do_list(int argc, char **argv)
 }
 
 /*
- * zfs rename <fs | snap | vol> <fs | snap | vol>
- * zfs rename -p <fs | vol> <fs | vol>
+ * zfs rename [-f] <fs | snap | vol> <fs | snap | vol>
+ * zfs rename [-f] -p <fs | vol> <fs | vol>
  * zfs rename -r <snap> <snap>
  * zfs rename -u [-p] <fs> <fs>
  *
@@ -3101,7 +3102,7 @@ zfs_do_rename(int argc, char **argv)
 	boolean_t parents = B_FALSE;
 
 	/* check options */
-	while ((c = getopt(argc, argv, "pru")) != -1) {
+	while ((c = getopt(argc, argv, "fpru")) != -1) {
 		switch (c) {
 		case 'p':
 			parents = B_TRUE;
@@ -3112,6 +3113,9 @@ zfs_do_rename(int argc, char **argv)
 		case 'u':
 			flags.nounmount = B_TRUE;
 			break;
+		case 'f':
+			flags.forceunmount = B_TRUE;
+			break;
 		case '?':
 		default:
 			(void) fprintf(stderr, gettext("invalid option '%c'\n"),

Modified: stable/9/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h
==============================================================================
--- stable/9/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h	Sun May 20 22:06:32 2012	(r235700)
+++ stable/9/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h	Sun May 20 22:21:59 2012	(r235701)
@@ -26,6 +26,7 @@
  * All rights reserved.
  * Copyright (c) 2011 by Delphix. All rights reserved.
  * All rights reserved.
+ * Copyright (c) 2012 Martin Matuska <mm@FreeBSD.org>. All rights reserved.
  */
 
 #ifndef	_LIBZFS_H
@@ -541,6 +542,9 @@ typedef struct renameflags {
 
 	/* don't unmount file systems */
 	int nounmount : 1;
+
+	/* force unmount file systems */
+	int forceunmount : 1;
 } renameflags_t;
 
 extern int zfs_rename(zfs_handle_t *, const char *, renameflags_t flags);

Modified: stable/9/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c
==============================================================================
--- stable/9/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c	Sun May 20 22:06:32 2012	(r235700)
+++ stable/9/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c	Sun May 20 22:21:59 2012	(r235701)
@@ -25,6 +25,7 @@
  * Copyright (c) 2011 by Delphix. All rights reserved.
  * Copyright (c) 2011-2012 Pawel Jakub Dawidek <pawel@dawidek.net>.
  * All rights reserved.
+ * Copyright (c) 2012 Martin Matuska <mm@FreeBSD.org>. All rights reserved.
  */
 
 #include <ctype.h>
@@ -3721,7 +3722,8 @@ zfs_rename(zfs_handle_t *zhp, const char
 
 	} else {
 		if ((cl = changelist_gather(zhp, ZFS_PROP_NAME,
-		    flags.nounmount ? CL_GATHER_DONT_UNMOUNT : 0, 0)) == NULL) {
+		    flags.nounmount ? CL_GATHER_DONT_UNMOUNT : 0,
+		    flags.forceunmount ? MS_FORCE : 0)) == NULL) {
 			return (-1);
 		}
 

From owner-svn-src-stable-9@FreeBSD.ORG  Sun May 20 22:55:24 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id AACAB106566B;
	Sun, 20 May 2012 22:55:24 +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 9521D8FC08;
	Sun, 20 May 2012 22:55: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 q4KMtOVi021954;
	Sun, 20 May 2012 22:55:24 GMT (envelope-from bz@svn.freebsd.org)
Received: (from bz@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4KMtOEp021952;
	Sun, 20 May 2012 22:55:24 GMT (envelope-from bz@svn.freebsd.org)
Message-Id: <201205202255.q4KMtOEp021952@svn.freebsd.org>
From: "Bjoern A. Zeeb" <bz@FreeBSD.org>
Date: Sun, 20 May 2012 22:55:24 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r235703 - stable/9/sys/netinet6
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sun, 20 May 2012 22:55:24 -0000

Author: bz
Date: Sun May 20 22:55:24 2012
New Revision: 235703
URL: http://svn.freebsd.org/changeset/base/235703

Log:
  MFC r232514:
  
   In nd6_options() ignore the RFC 6106 options completely rather than printing
   them if nd6_debug is enabled as unknown.  Leave a comment about the RFC4191
   option as I am undecided so far.

Modified:
  stable/9/sys/netinet6/nd6.c
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/netinet6/nd6.c
==============================================================================
--- stable/9/sys/netinet6/nd6.c	Sun May 20 22:23:58 2012	(r235702)
+++ stable/9/sys/netinet6/nd6.c	Sun May 20 22:55:24 2012	(r235703)
@@ -380,6 +380,14 @@ nd6_options(union nd_opts *ndopts)
 			ndopts->nd_opts_pi_end =
 				(struct nd_opt_prefix_info *)nd_opt;
 			break;
+		/* What about ND_OPT_ROUTE_INFO? RFC 4191 */
+		case ND_OPT_RDNSS:	/* RFC 6106 */
+		case ND_OPT_DNSSL:	/* RFC 6106 */
+			/*
+			 * Silently ignore options we know and do not care about
+			 * in the kernel.
+			 */
+			break;
 		default:
 			/*
 			 * Unknown options must be silently ignored,

From owner-svn-src-stable-9@FreeBSD.ORG  Sun May 20 23:33:11 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 0A53B1065670;
	Sun, 20 May 2012 23:33:11 +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 E96FC8FC08;
	Sun, 20 May 2012 23:33: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 q4KNXAeG023700;
	Sun, 20 May 2012 23:33:10 GMT (envelope-from bz@svn.freebsd.org)
Received: (from bz@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4KNXAxq023698;
	Sun, 20 May 2012 23:33:10 GMT (envelope-from bz@svn.freebsd.org)
Message-Id: <201205202333.q4KNXAxq023698@svn.freebsd.org>
From: "Bjoern A. Zeeb" <bz@FreeBSD.org>
Date: Sun, 20 May 2012 23:33:10 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r235705 - stable/9/sys/netinet
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sun, 20 May 2012 23:33:11 -0000

Author: bz
Date: Sun May 20 23:33:10 2012
New Revision: 235705
URL: http://svn.freebsd.org/changeset/base/235705

Log:
  MFC r232513:
  
   Correct typo in the RFC number for the constants based on IANA assignments
   for IPv6 Neighbor Discovery Option types for "IPv6 Router Advertisement
   Options for DNS Configuration".  It is RFC 6106.

Modified:
  stable/9/sys/netinet/icmp6.h
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/netinet/icmp6.h
==============================================================================
--- stable/9/sys/netinet/icmp6.h	Sun May 20 22:58:37 2012	(r235704)
+++ stable/9/sys/netinet/icmp6.h	Sun May 20 23:33:10 2012	(r235705)
@@ -298,8 +298,8 @@ struct nd_opt_hdr {		/* Neighbor discove
 #define ND_OPT_REDIRECTED_HEADER	4
 #define ND_OPT_MTU			5
 #define ND_OPT_ROUTE_INFO		24	/* RFC 4191 */
-#define ND_OPT_RDNSS			25	/* RFC 6016 */
-#define ND_OPT_DNSSL			31	/* RFC 6016 */
+#define ND_OPT_RDNSS			25	/* RFC 6106 */
+#define ND_OPT_DNSSL			31	/* RFC 6106 */
 
 struct nd_opt_prefix_info {	/* prefix information */
 	u_int8_t	nd_opt_pi_type;

From owner-svn-src-stable-9@FreeBSD.ORG  Mon May 21 00:15:35 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 90C541065672;
	Mon, 21 May 2012 00:15:35 +0000 (UTC) (envelope-from gjb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 3D8B28FC08;
	Mon, 21 May 2012 00:15: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 q4L0FYg4025692;
	Mon, 21 May 2012 00:15:34 GMT (envelope-from gjb@svn.freebsd.org)
Received: (from gjb@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4L0FYRc025690;
	Mon, 21 May 2012 00:15:34 GMT (envelope-from gjb@svn.freebsd.org)
Message-Id: <201205210015.q4L0FYRc025690@svn.freebsd.org>
From: Glen Barber <gjb@FreeBSD.org>
Date: Mon, 21 May 2012 00:15:34 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r235707 - stable/9/usr.bin/join
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 21 May 2012 00:15:35 -0000

Author: gjb (doc committer)
Date: Mon May 21 00:15:34 2012
New Revision: 235707
URL: http://svn.freebsd.org/changeset/base/235707

Log:
  MFC r235597:
  
  Fix a typo that crept in.

Modified:
  stable/9/usr.bin/join/join.1
Directory Properties:
  stable/9/usr.bin/join/   (props changed)

Modified: stable/9/usr.bin/join/join.1
==============================================================================
--- stable/9/usr.bin/join/join.1	Mon May 21 00:03:13 2012	(r235706)
+++ stable/9/usr.bin/join/join.1	Mon May 21 00:15:34 2012	(r235707)
@@ -107,7 +107,7 @@ representing the join field.
 The elements of list must be either comma
 .Pq Ql \&,
 or whitespace separated.
-(The letter requires quoting to protect it from the shell, or, a simpler
+(The latter requires quoting to protect it from the shell, or, a simpler
 approach is to use multiple
 .Fl o
 options.)

From owner-svn-src-stable-9@FreeBSD.ORG  Mon May 21 14:47:35 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id C46EE106566C;
	Mon, 21 May 2012 14:47:35 +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 AE87B8FC16;
	Mon, 21 May 2012 14:47: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 q4LElZdE062157;
	Mon, 21 May 2012 14:47:35 GMT
	(envelope-from hselasky@svn.freebsd.org)
Received: (from hselasky@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4LElZNm062155;
	Mon, 21 May 2012 14:47:35 GMT
	(envelope-from hselasky@svn.freebsd.org)
Message-Id: <201205211447.q4LElZNm062155@svn.freebsd.org>
From: Hans Petter Selasky <hselasky@FreeBSD.org>
Date: Mon, 21 May 2012 14:47:35 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r235724 - stable/9/sys/dev/usb/input
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 21 May 2012 14:47:36 -0000

Author: hselasky
Date: Mon May 21 14:47:34 2012
New Revision: 235724
URL: http://svn.freebsd.org/changeset/base/235724

Log:
  MFC r235451:
  Move reset of USB mouse parameters from the USB mouse attach to
  the USB mouse device open. Protect against multi character
  device open. Some other nits.

Modified:
  stable/9/sys/dev/usb/input/ums.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/dev/   (props changed)

Modified: stable/9/sys/dev/usb/input/ums.c
==============================================================================
--- stable/9/sys/dev/usb/input/ums.c	Mon May 21 13:31:26 2012	(r235723)
+++ stable/9/sys/dev/usb/input/ums.c	Mon May 21 14:47:34 2012	(r235724)
@@ -134,6 +134,7 @@ struct ums_softc {
 	struct usb_xfer *sc_xfer[UMS_N_TRANSFER];
 
 	int sc_pollrate;
+	int sc_fflags;
 
 	uint8_t	sc_buttons;
 	uint8_t	sc_iid;
@@ -677,32 +678,13 @@ ums_attach(device_t dev)
 	DPRINTF("size=%d, id=%d\n", isize, sc->sc_iid);
 #endif
 
-	if (sc->sc_buttons > MOUSE_MSC_MAXBUTTON)
-		sc->sc_hw.buttons = MOUSE_MSC_MAXBUTTON;
-	else
-		sc->sc_hw.buttons = sc->sc_buttons;
-
-	sc->sc_hw.iftype = MOUSE_IF_USB;
-	sc->sc_hw.type = MOUSE_MOUSE;
-	sc->sc_hw.model = MOUSE_MODEL_GENERIC;
-	sc->sc_hw.hwid = 0;
-
-	sc->sc_mode.protocol = MOUSE_PROTO_MSC;
-	sc->sc_mode.rate = -1;
-	sc->sc_mode.resolution = MOUSE_RES_UNKNOWN;
-	sc->sc_mode.accelfactor = 0;
-	sc->sc_mode.level = 0;
-	sc->sc_mode.packetsize = MOUSE_MSC_PACKETSIZE;
-	sc->sc_mode.syncmask[0] = MOUSE_MSC_SYNCMASK;
-	sc->sc_mode.syncmask[1] = MOUSE_MSC_SYNC;
-
 	err = usb_fifo_attach(uaa->device, sc, &sc->sc_mtx,
 	    &ums_fifo_methods, &sc->sc_fifo,
 	    device_get_unit(dev), -1, uaa->info.bIfaceIndex,
   	    UID_ROOT, GID_OPERATOR, 0644);
-	if (err) {
+	if (err)
 		goto detach;
-	}
+
 	SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev),
 	    SYSCTL_CHILDREN(device_get_sysctl_tree(dev)),
 	    OID_AUTO, "parseinfo", CTLTYPE_STRING|CTLFLAG_RD,
@@ -825,7 +807,7 @@ ums_put_queue(struct ums_softc *sc, int3
 static void
 ums_reset_buf(struct ums_softc *sc)
 {
-	/* reset read queue */
+	/* reset read queue, must be called locked */
 	usb_fifo_reset(sc->sc_fifo.fp[USB_FIFO_RX]);
 }
 
@@ -836,7 +818,33 @@ ums_open(struct usb_fifo *fifo, int ffla
 
 	DPRINTFN(2, "\n");
 
-	if (fflags & FREAD) {
+	/* check for duplicate open, should not happen */
+	if (sc->sc_fflags & fflags)
+		return (EBUSY);
+
+	/* check for first open */
+	if (sc->sc_fflags == 0) {
+
+		/* reset all USB mouse parameters */
+
+		if (sc->sc_buttons > MOUSE_MSC_MAXBUTTON)
+			sc->sc_hw.buttons = MOUSE_MSC_MAXBUTTON;
+		else
+			sc->sc_hw.buttons = sc->sc_buttons;
+
+		sc->sc_hw.iftype = MOUSE_IF_USB;
+		sc->sc_hw.type = MOUSE_MOUSE;
+		sc->sc_hw.model = MOUSE_MODEL_GENERIC;
+		sc->sc_hw.hwid = 0;
+
+		sc->sc_mode.protocol = MOUSE_PROTO_MSC;
+		sc->sc_mode.rate = -1;
+		sc->sc_mode.resolution = MOUSE_RES_UNKNOWN;
+		sc->sc_mode.accelfactor = 0;
+		sc->sc_mode.level = 0;
+		sc->sc_mode.packetsize = MOUSE_MSC_PACKETSIZE;
+		sc->sc_mode.syncmask[0] = MOUSE_MSC_SYNCMASK;
+		sc->sc_mode.syncmask[1] = MOUSE_MSC_SYNC;
 
 		/* reset status */
 
@@ -847,21 +855,31 @@ ums_open(struct usb_fifo *fifo, int ffla
 		sc->sc_status.dy = 0;
 		sc->sc_status.dz = 0;
 		/* sc->sc_status.dt = 0; */
+	}
 
+	if (fflags & FREAD) {
+		/* allocate RX buffer */
 		if (usb_fifo_alloc_buffer(fifo,
 		    UMS_BUF_SIZE, UMS_IFQ_MAXLEN)) {
 			return (ENOMEM);
 		}
 	}
+
+	sc->sc_fflags |= fflags & (FREAD | FWRITE);
 	return (0);
 }
 
 static void
 ums_close(struct usb_fifo *fifo, int fflags)
 {
-	if (fflags & FREAD) {
+	struct ums_softc *sc = usb_fifo_softc(fifo);
+
+	DPRINTFN(2, "\n");
+
+	if (fflags & FREAD)
 		usb_fifo_free_buffer(fifo);
-	}
+
+	sc->sc_fflags &= ~(fflags & (FREAD | FWRITE));
 }
 
 static int
@@ -891,7 +909,7 @@ ums_ioctl(struct usb_fifo *fifo, u_long 
 			/* don't change the current setting */
 		} else if ((mode.level < 0) || (mode.level > 1)) {
 			error = EINVAL;
-			goto done;
+			break;
 		} else {
 			sc->sc_mode.level = mode.level;
 		}
@@ -928,7 +946,7 @@ ums_ioctl(struct usb_fifo *fifo, u_long 
 	case MOUSE_SETLEVEL:
 		if (*(int *)addr < 0 || *(int *)addr > 1) {
 			error = EINVAL;
-			goto done;
+			break;
 		}
 		sc->sc_mode.level = *(int *)addr;
 
@@ -975,9 +993,9 @@ ums_ioctl(struct usb_fifo *fifo, u_long 
 		}
 	default:
 		error = ENOTTY;
+		break;
 	}
 
-done:
 	mtx_unlock(&sc->sc_mtx);
 	return (error);
 }

From owner-svn-src-stable-9@FreeBSD.ORG  Mon May 21 19:58:41 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 665871065673;
	Mon, 21 May 2012 19:58:41 +0000 (UTC)
	(envelope-from sbruno@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 479C88FC14;
	Mon, 21 May 2012 19:58: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 q4LJwe8q070840;
	Mon, 21 May 2012 19:58:40 GMT (envelope-from sbruno@svn.freebsd.org)
Received: (from sbruno@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4LJweXG070838;
	Mon, 21 May 2012 19:58:40 GMT (envelope-from sbruno@svn.freebsd.org)
Message-Id: <201205211958.q4LJweXG070838@svn.freebsd.org>
From: Sean Bruno <sbruno@FreeBSD.org>
Date: Mon, 21 May 2012 19:58:40 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r235738 - in stable/9/sys: . dev/mfi
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 21 May 2012 19:58:41 -0000

Author: sbruno
Date: Mon May 21 19:58:40 2012
New Revision: 235738
URL: http://svn.freebsd.org/changeset/base/235738

Log:
  MFC r235634
  
  Fix and update battery status bits according to linux driver

Modified:
  stable/9/sys/dev/mfi/mfireg.h
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/Makefile   (props changed)
  stable/9/sys/amd64/   (props changed)
  stable/9/sys/arm/   (props changed)
  stable/9/sys/bsm/   (props changed)
  stable/9/sys/cam/   (props changed)
  stable/9/sys/cddl/   (props changed)
  stable/9/sys/compat/   (props changed)
  stable/9/sys/contrib/   (props changed)
  stable/9/sys/crypto/   (props changed)
  stable/9/sys/ddb/   (props changed)
  stable/9/sys/dev/   (props changed)
  stable/9/sys/dev/aac/   (props changed)
  stable/9/sys/dev/acpi_support/   (props changed)
  stable/9/sys/dev/acpica/   (props changed)
  stable/9/sys/dev/adb/   (props changed)
  stable/9/sys/dev/adlink/   (props changed)
  stable/9/sys/dev/advansys/   (props changed)
  stable/9/sys/dev/ae/   (props changed)
  stable/9/sys/dev/age/   (props changed)
  stable/9/sys/dev/agp/   (props changed)
  stable/9/sys/dev/aha/   (props changed)
  stable/9/sys/dev/ahb/   (props changed)
  stable/9/sys/dev/ahci/   (props changed)
  stable/9/sys/dev/aic/   (props changed)
  stable/9/sys/dev/aic7xxx/   (props changed)
  stable/9/sys/dev/alc/   (props changed)
  stable/9/sys/dev/ale/   (props changed)
  stable/9/sys/dev/amd/   (props changed)
  stable/9/sys/dev/amdsbwd/   (props changed)
  stable/9/sys/dev/amdtemp/   (props changed)
  stable/9/sys/dev/amr/   (props changed)
  stable/9/sys/dev/an/   (props changed)
  stable/9/sys/dev/arcmsr/   (props changed)
  stable/9/sys/dev/asmc/   (props changed)
  stable/9/sys/dev/asr/   (props changed)
  stable/9/sys/dev/ata/   (props changed)
  stable/9/sys/dev/ath/   (props changed)
  stable/9/sys/dev/atkbdc/   (props changed)
  stable/9/sys/dev/auxio/   (props changed)
  stable/9/sys/dev/bce/   (props changed)
  stable/9/sys/dev/bfe/   (props changed)
  stable/9/sys/dev/bge/   (props changed)
  stable/9/sys/dev/bktr/   (props changed)
  stable/9/sys/dev/bm/   (props changed)
  stable/9/sys/dev/buslogic/   (props changed)
  stable/9/sys/dev/bwi/   (props changed)
  stable/9/sys/dev/bwn/   (props changed)
  stable/9/sys/dev/bxe/   (props changed)
  stable/9/sys/dev/cardbus/   (props changed)
  stable/9/sys/dev/cas/   (props changed)
  stable/9/sys/dev/ce/   (props changed)
  stable/9/sys/dev/cesa/   (props changed)
  stable/9/sys/dev/cfe/   (props changed)
  stable/9/sys/dev/cfi/   (props changed)
  stable/9/sys/dev/ciss/   (props changed)
  stable/9/sys/dev/cm/   (props changed)
  stable/9/sys/dev/cmx/   (props changed)
  stable/9/sys/dev/coretemp/   (props changed)
  stable/9/sys/dev/cp/   (props changed)
  stable/9/sys/dev/cpuctl/   (props changed)
  stable/9/sys/dev/cpufreq/   (props changed)
  stable/9/sys/dev/cs/   (props changed)
  stable/9/sys/dev/ct/   (props changed)
  stable/9/sys/dev/ctau/   (props changed)
  stable/9/sys/dev/cx/   (props changed)
  stable/9/sys/dev/cxgb/   (props changed)
  stable/9/sys/dev/cxgbe/   (props changed)
  stable/9/sys/dev/cy/   (props changed)
  stable/9/sys/dev/dc/   (props changed)
  stable/9/sys/dev/dcons/   (props changed)
  stable/9/sys/dev/de/   (props changed)
  stable/9/sys/dev/digi/   (props changed)
  stable/9/sys/dev/dpms/   (props changed)
  stable/9/sys/dev/dpt/   (props changed)
  stable/9/sys/dev/drm/   (props changed)
  stable/9/sys/dev/ed/   (props changed)
  stable/9/sys/dev/eisa/   (props changed)
  stable/9/sys/dev/en/   (props changed)
  stable/9/sys/dev/ep/   (props changed)
  stable/9/sys/dev/esp/   (props changed)
  stable/9/sys/dev/et/   (props changed)
  stable/9/sys/dev/ex/   (props changed)
  stable/9/sys/dev/exca/   (props changed)
  stable/9/sys/dev/fatm/   (props changed)
  stable/9/sys/dev/fb/   (props changed)
  stable/9/sys/dev/fdc/   (props changed)
  stable/9/sys/dev/fdt/   (props changed)
  stable/9/sys/dev/fe/   (props changed)
  stable/9/sys/dev/firewire/   (props changed)
  stable/9/sys/dev/flash/   (props changed)
  stable/9/sys/dev/fxp/   (props changed)
  stable/9/sys/dev/gem/   (props changed)
  stable/9/sys/dev/glxiic/   (props changed)
  stable/9/sys/dev/glxsb/   (props changed)
  stable/9/sys/dev/gpio/   (props changed)
  stable/9/sys/dev/hatm/   (props changed)
  stable/9/sys/dev/hifn/   (props changed)
  stable/9/sys/dev/hme/   (props changed)
  stable/9/sys/dev/hpt27xx/   (props changed)
  stable/9/sys/dev/hptiop/   (props changed)
  stable/9/sys/dev/hptmv/   (props changed)
  stable/9/sys/dev/hptrr/   (props changed)
  stable/9/sys/dev/hwpmc/   (props changed)
  stable/9/sys/dev/ic/   (props changed)
  stable/9/sys/dev/ichsmb/   (props changed)
  stable/9/sys/dev/ichwd/   (props changed)
  stable/9/sys/dev/ida/   (props changed)
  stable/9/sys/dev/ie/   (props changed)
  stable/9/sys/dev/ieee488/   (props changed)
  stable/9/sys/dev/if_ndis/   (props changed)
  stable/9/sys/dev/iicbus/   (props changed)
  stable/9/sys/dev/iir/   (props changed)
  stable/9/sys/dev/io/   (props changed)
  stable/9/sys/dev/ipmi/   (props changed)
  stable/9/sys/dev/ips/   (props changed)
  stable/9/sys/dev/ipw/   (props changed)
  stable/9/sys/dev/isci/   (props changed)
  stable/9/sys/dev/iscsi/   (props changed)
  stable/9/sys/dev/isp/   (props changed)
  stable/9/sys/dev/ispfw/   (props changed)
  stable/9/sys/dev/iwi/   (props changed)
  stable/9/sys/dev/iwn/   (props changed)
  stable/9/sys/dev/ixgb/   (props changed)
  stable/9/sys/dev/jme/   (props changed)
  stable/9/sys/dev/joy/   (props changed)
  stable/9/sys/dev/kbd/   (props changed)
  stable/9/sys/dev/kbdmux/   (props changed)
  stable/9/sys/dev/ksyms/   (props changed)
  stable/9/sys/dev/le/   (props changed)
  stable/9/sys/dev/led/   (props changed)
  stable/9/sys/dev/lge/   (props changed)
  stable/9/sys/dev/lindev/   (props changed)
  stable/9/sys/dev/lmc/   (props changed)
  stable/9/sys/dev/malo/   (props changed)
  stable/9/sys/dev/mc146818/   (props changed)
  stable/9/sys/dev/mca/   (props changed)
  stable/9/sys/dev/mcd/   (props changed)
  stable/9/sys/dev/md/   (props changed)
  stable/9/sys/dev/mem/   (props changed)
  stable/9/sys/dev/mge/   (props changed)
  stable/9/sys/dev/mii/   (props changed)
  stable/9/sys/dev/mk48txx/   (props changed)
  stable/9/sys/dev/mlx/   (props changed)
  stable/9/sys/dev/mly/   (props changed)
  stable/9/sys/dev/mmc/   (props changed)
  stable/9/sys/dev/mn/   (props changed)
  stable/9/sys/dev/mps/   (props changed)
  stable/9/sys/dev/mpt/   (props changed)
  stable/9/sys/dev/mse/   (props changed)
  stable/9/sys/dev/msk/   (props changed)
  stable/9/sys/dev/mvs/   (props changed)
  stable/9/sys/dev/mwl/   (props changed)
  stable/9/sys/dev/mxge/   (props changed)
  stable/9/sys/dev/my/   (props changed)
  stable/9/sys/dev/ncv/   (props changed)
  stable/9/sys/dev/netmap/   (props changed)
  stable/9/sys/dev/nfe/   (props changed)
  stable/9/sys/dev/nge/   (props changed)
  stable/9/sys/dev/nmdm/   (props changed)
  stable/9/sys/dev/nsp/   (props changed)
  stable/9/sys/dev/null/   (props changed)
  stable/9/sys/dev/nve/   (props changed)
  stable/9/sys/dev/nvram/   (props changed)
  stable/9/sys/dev/nvram2env/   (props changed)
  stable/9/sys/dev/nxge/   (props changed)
  stable/9/sys/dev/oce/   (props changed)
  stable/9/sys/dev/ofw/   (props changed)
  stable/9/sys/dev/patm/   (props changed)
  stable/9/sys/dev/pbio/   (props changed)
  stable/9/sys/dev/pccard/   (props changed)
  stable/9/sys/dev/pccbb/   (props changed)
  stable/9/sys/dev/pcf/   (props changed)
  stable/9/sys/dev/pci/   (props changed)
  stable/9/sys/dev/pcn/   (props changed)
  stable/9/sys/dev/pdq/   (props changed)
  stable/9/sys/dev/powermac_nvram/   (props changed)
  stable/9/sys/dev/ppbus/   (props changed)
  stable/9/sys/dev/ppc/   (props changed)
  stable/9/sys/dev/pst/   (props changed)
  stable/9/sys/dev/pty/   (props changed)
  stable/9/sys/dev/puc/   (props changed)
  stable/9/sys/dev/qlxgb/   (props changed)
  stable/9/sys/dev/quicc/   (props changed)
  stable/9/sys/dev/ral/   (props changed)
  stable/9/sys/dev/random/   (props changed)
  stable/9/sys/dev/rc/   (props changed)
  stable/9/sys/dev/re/   (props changed)
  stable/9/sys/dev/rndtest/   (props changed)
  stable/9/sys/dev/rp/   (props changed)
  stable/9/sys/dev/rt/   (props changed)
  stable/9/sys/dev/safe/   (props changed)
  stable/9/sys/dev/sbni/   (props changed)
  stable/9/sys/dev/scc/   (props changed)
  stable/9/sys/dev/scd/   (props changed)
  stable/9/sys/dev/sdhci/   (props changed)
  stable/9/sys/dev/sec/   (props changed)
  stable/9/sys/dev/sf/   (props changed)
  stable/9/sys/dev/sfxge/   (props changed)
  stable/9/sys/dev/sge/   (props changed)
  stable/9/sys/dev/si/   (props changed)
  stable/9/sys/dev/siba/   (props changed)
  stable/9/sys/dev/siis/   (props changed)
  stable/9/sys/dev/sio/   (props changed)
  stable/9/sys/dev/sis/   (props changed)
  stable/9/sys/dev/sk/   (props changed)
  stable/9/sys/dev/smbus/   (props changed)
  stable/9/sys/dev/smc/   (props changed)
  stable/9/sys/dev/sn/   (props changed)
  stable/9/sys/dev/snc/   (props changed)
  stable/9/sys/dev/snp/   (props changed)
  stable/9/sys/dev/sound/   (props changed)
  stable/9/sys/dev/speaker/   (props changed)
  stable/9/sys/dev/spibus/   (props changed)
  stable/9/sys/dev/ste/   (props changed)
  stable/9/sys/dev/stg/   (props changed)
  stable/9/sys/dev/stge/   (props changed)
  stable/9/sys/dev/streams/   (props changed)
  stable/9/sys/dev/sym/   (props changed)
  stable/9/sys/dev/syscons/   (props changed)
  stable/9/sys/dev/tdfx/   (props changed)
  stable/9/sys/dev/ti/   (props changed)
  stable/9/sys/dev/tl/   (props changed)
  stable/9/sys/dev/tpm/   (props changed)
  stable/9/sys/dev/trm/   (props changed)
  stable/9/sys/dev/tsec/   (props changed)
  stable/9/sys/dev/twa/   (props changed)
  stable/9/sys/dev/twe/   (props changed)
  stable/9/sys/dev/tws/   (props changed)
  stable/9/sys/dev/tx/   (props changed)
  stable/9/sys/dev/txp/   (props changed)
  stable/9/sys/dev/uart/   (props changed)
  stable/9/sys/dev/ubsec/   (props changed)
  stable/9/sys/dev/usb/   (props changed)
  stable/9/sys/dev/utopia/   (props changed)
  stable/9/sys/dev/vge/   (props changed)
  stable/9/sys/dev/viawd/   (props changed)
  stable/9/sys/dev/vkbd/   (props changed)
  stable/9/sys/dev/vr/   (props changed)
  stable/9/sys/dev/vte/   (props changed)
  stable/9/sys/dev/vx/   (props changed)
  stable/9/sys/dev/vxge/   (props changed)
  stable/9/sys/dev/watchdog/   (props changed)
  stable/9/sys/dev/wb/   (props changed)
  stable/9/sys/dev/wds/   (props changed)
  stable/9/sys/dev/wi/   (props changed)
  stable/9/sys/dev/wl/   (props changed)
  stable/9/sys/dev/wpi/   (props changed)
  stable/9/sys/dev/xe/   (props changed)
  stable/9/sys/dev/xen/   (props changed)
  stable/9/sys/dev/xl/   (props changed)
  stable/9/sys/gdb/   (props changed)
  stable/9/sys/geom/   (props changed)
  stable/9/sys/gnu/   (props changed)
  stable/9/sys/i386/   (props changed)
  stable/9/sys/ia64/   (props changed)
  stable/9/sys/isa/   (props changed)
  stable/9/sys/kern/   (props changed)
  stable/9/sys/kgssapi/   (props changed)
  stable/9/sys/libkern/   (props changed)
  stable/9/sys/mips/   (props changed)
  stable/9/sys/net/   (props changed)
  stable/9/sys/net80211/   (props changed)
  stable/9/sys/netatalk/   (props changed)
  stable/9/sys/netgraph/   (props changed)
  stable/9/sys/netinet/   (props changed)
  stable/9/sys/netinet6/   (props changed)
  stable/9/sys/netipsec/   (props changed)
  stable/9/sys/netipx/   (props changed)
  stable/9/sys/netnatm/   (props changed)
  stable/9/sys/netncp/   (props changed)
  stable/9/sys/netsmb/   (props changed)
  stable/9/sys/nfs/   (props changed)
  stable/9/sys/nfsclient/   (props changed)
  stable/9/sys/nfsserver/   (props changed)
  stable/9/sys/nlm/   (props changed)
  stable/9/sys/ofed/   (props changed)
  stable/9/sys/opencrypto/   (props changed)
  stable/9/sys/pc98/   (props changed)
  stable/9/sys/pci/   (props changed)
  stable/9/sys/powerpc/   (props changed)
  stable/9/sys/rpc/   (props changed)
  stable/9/sys/security/   (props changed)
  stable/9/sys/sparc64/   (props changed)
  stable/9/sys/sys/   (props changed)
  stable/9/sys/teken/   (props changed)
  stable/9/sys/tools/   (props changed)
  stable/9/sys/ufs/   (props changed)
  stable/9/sys/vm/   (props changed)
  stable/9/sys/x86/   (props changed)
  stable/9/sys/xdr/   (props changed)
  stable/9/sys/xen/   (props changed)

Modified: stable/9/sys/dev/mfi/mfireg.h
==============================================================================
--- stable/9/sys/dev/mfi/mfireg.h	Mon May 21 19:53:22 2012	(r235737)
+++ stable/9/sys/dev/mfi/mfireg.h	Mon May 21 19:58:40 2012	(r235738)
@@ -1377,8 +1377,13 @@ struct mfi_bbu_status {
 #define	MFI_BBU_STATE_PACK_MISSING	(1 << 0)
 #define	MFI_BBU_STATE_VOLTAGE_LOW	(1 << 1)
 #define	MFI_BBU_STATE_TEMPERATURE_HIGH	(1 << 2)
-#define	MFI_BBU_STATE_CHARGE_ACTIVE	(1 << 0)
-#define	MFI_BBU_STATE_DISCHARGE_ACTIVE	(1 << 0)
+#define	MFI_BBU_STATE_CHARGE_ACTIVE	(1 << 3)
+#define	MFI_BBU_STATE_DISCHARGE_ACTIVE	(1 << 4)
+#define	MFI_BBU_STATE_LEARN_CYC_REQ	(1 << 5)
+#define	MFI_BBU_STATE_LEARN_CYC_ACTIVE	(1 << 6)
+#define	MFI_BBU_STATE_LEARN_CYC_FAIL	(1 << 7)
+#define	MFI_BBU_STATE_LEARN_CYC_TIMEOUT	(1 << 8)
+#define	MFI_BBU_STATE_I2C_ERR_DETECT	(1 << 9)
 	uint8_t			pad[20];
 	union mfi_bbu_status_detail detail;
 } __packed;

From owner-svn-src-stable-9@FreeBSD.ORG  Mon May 21 21:14:10 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 97B351065670;
	Mon, 21 May 2012 21:14:10 +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 816838FC1B;
	Mon, 21 May 2012 21:14: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 q4LLEAvJ072960;
	Mon, 21 May 2012 21:14:10 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4LLEAmR072954;
	Mon, 21 May 2012 21:14:10 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <201205212114.q4LLEAmR072954@svn.freebsd.org>
From: John Baldwin <jhb@FreeBSD.org>
Date: Mon, 21 May 2012 21:14:10 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r235741 - in stable/9/sys: ddb gdb kern sys
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 21 May 2012 21:14:10 -0000

Author: jhb
Date: Mon May 21 21:14:09 2012
New Revision: 235741
URL: http://svn.freebsd.org/changeset/base/235741

Log:
  MFC 234190,234196,234280:
  - Extend the KDB interface to add a per-debugger callback to print a
    backtrace for an arbitrary thread (rather than the calling thread).
    A kdb_backtrace_thread() wrapper function uses the configured debugger
    if possible, otherwise it falls back to using stack(9) if that is
    available.
  - Replace a direct call to db_trace_thread() in propagate_priority()
    with a call to kdb_backtrace_thread() instead.

Modified:
  stable/9/sys/ddb/db_main.c
  stable/9/sys/gdb/gdb_main.c
  stable/9/sys/kern/subr_kdb.c
  stable/9/sys/kern/subr_turnstile.c
  stable/9/sys/sys/kdb.h
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/amd64/include/xen/   (props changed)
  stable/9/sys/boot/   (props changed)
  stable/9/sys/boot/i386/efi/   (props changed)
  stable/9/sys/boot/ia64/efi/   (props changed)
  stable/9/sys/boot/ia64/ski/   (props changed)
  stable/9/sys/boot/powerpc/boot1.chrp/   (props changed)
  stable/9/sys/boot/powerpc/ofw/   (props changed)
  stable/9/sys/cddl/contrib/opensolaris/   (props changed)
  stable/9/sys/conf/   (props changed)
  stable/9/sys/contrib/dev/acpica/   (props changed)
  stable/9/sys/contrib/octeon-sdk/   (props changed)
  stable/9/sys/contrib/pf/   (props changed)
  stable/9/sys/contrib/x86emu/   (props changed)
  stable/9/sys/dev/   (props changed)
  stable/9/sys/dev/e1000/   (props changed)
  stable/9/sys/dev/ixgbe/   (props changed)
  stable/9/sys/fs/   (props changed)
  stable/9/sys/fs/ntfs/   (props changed)
  stable/9/sys/modules/   (props changed)

Modified: stable/9/sys/ddb/db_main.c
==============================================================================
--- stable/9/sys/ddb/db_main.c	Mon May 21 21:10:00 2012	(r235740)
+++ stable/9/sys/ddb/db_main.c	Mon May 21 21:14:09 2012	(r235741)
@@ -51,8 +51,10 @@ SYSCTL_NODE(_debug, OID_AUTO, ddb, CTLFL
 static dbbe_init_f db_init;
 static dbbe_trap_f db_trap;
 static dbbe_trace_f db_trace_self_wrapper;
+static dbbe_trace_thread_f db_trace_thread_wrapper;
 
-KDB_BACKEND(ddb, db_init, db_trace_self_wrapper, db_trap);
+KDB_BACKEND(ddb, db_init, db_trace_self_wrapper, db_trace_thread_wrapper,
+    db_trap);
 
 vm_offset_t ksym_start, ksym_end;
 
@@ -246,3 +248,15 @@ db_trace_self_wrapper(void)
 		db_trace_self();
 	(void)kdb_jmpbuf(prev_jb);
 }
+
+static void
+db_trace_thread_wrapper(struct thread *td)
+{
+	jmp_buf jb;
+	void *prev_jb;
+
+	prev_jb = kdb_jmpbuf(jb);
+	if (setjmp(jb) == 0)
+		db_trace_thread(td, -1);
+	(void)kdb_jmpbuf(prev_jb);
+}

Modified: stable/9/sys/gdb/gdb_main.c
==============================================================================
--- stable/9/sys/gdb/gdb_main.c	Mon May 21 21:10:00 2012	(r235740)
+++ stable/9/sys/gdb/gdb_main.c	Mon May 21 21:14:09 2012	(r235741)
@@ -44,7 +44,7 @@ __FBSDID("$FreeBSD$");
 static dbbe_init_f gdb_init;
 static dbbe_trap_f gdb_trap;
 
-KDB_BACKEND(gdb, gdb_init, NULL, gdb_trap);
+KDB_BACKEND(gdb, gdb_init, NULL, NULL, gdb_trap);
 
 static struct gdb_dbgport null_gdb_dbgport;
 DATA_SET(gdb_dbgport_set, null_gdb_dbgport);

Modified: stable/9/sys/kern/subr_kdb.c
==============================================================================
--- stable/9/sys/kern/subr_kdb.c	Mon May 21 21:10:00 2012	(r235740)
+++ stable/9/sys/kern/subr_kdb.c	Mon May 21 21:14:09 2012	(r235741)
@@ -73,7 +73,7 @@ struct trapframe *kdb_frame = NULL;
 static int	kdb_break_to_debugger = KDB_BREAK_TO_DEBUGGER;
 static int	kdb_alt_break_to_debugger = KDB_ALT_BREAK_TO_DEBUGGER;
 
-KDB_BACKEND(null, NULL, NULL, NULL);
+KDB_BACKEND(null, NULL, NULL, NULL, NULL);
 SET_DECLARE(kdb_dbbe_set, struct kdb_dbbe);
 
 static int kdb_sysctl_available(SYSCTL_HANDLER_ARGS);
@@ -371,6 +371,7 @@ kdb_backtrace(void)
 		struct stack st;
 
 		printf("KDB: stack backtrace:\n");
+		stack_zero(&st);
 		stack_save(&st);
 		stack_print_ddb(&st);
 	}
@@ -378,6 +379,30 @@ kdb_backtrace(void)
 }
 
 /*
+ * Similar to kdb_backtrace() except that it prints a backtrace of an
+ * arbitrary thread rather than the calling thread.
+ */
+void
+kdb_backtrace_thread(struct thread *td)
+{
+
+	if (kdb_dbbe != NULL && kdb_dbbe->dbbe_trace_thread != NULL) {
+		printf("KDB: stack backtrace of thread %d:\n", td->td_tid);
+		kdb_dbbe->dbbe_trace_thread(td);
+	}
+#ifdef STACK
+	else {
+		struct stack st;
+
+		printf("KDB: stack backtrace of thread %d:\n", td->td_tid);
+		stack_zero(&st);
+		stack_save_td(&st, td);
+		stack_print_ddb(&st);
+	}
+#endif
+}
+
+/*
  * Set/change the current backend.
  */
 

Modified: stable/9/sys/kern/subr_turnstile.c
==============================================================================
--- stable/9/sys/kern/subr_turnstile.c	Mon May 21 21:10:00 2012	(r235740)
+++ stable/9/sys/kern/subr_turnstile.c	Mon May 21 21:14:09 2012	(r235741)
@@ -65,6 +65,7 @@ __FBSDID("$FreeBSD$");
 
 #include <sys/param.h>
 #include <sys/systm.h>
+#include <sys/kdb.h>
 #include <sys/kernel.h>
 #include <sys/ktr.h>
 #include <sys/lock.h>
@@ -78,7 +79,6 @@ __FBSDID("$FreeBSD$");
 #include <vm/uma.h>
 
 #ifdef DDB
-#include <sys/kdb.h>
 #include <ddb/ddb.h>
 #include <sys/lockmgr.h>
 #include <sys/sx.h>
@@ -216,9 +216,7 @@ propagate_priority(struct thread *td)
 			printf(
 		"Sleeping thread (tid %d, pid %d) owns a non-sleepable lock\n",
 			    td->td_tid, td->td_proc->p_pid);
-#ifdef DDB
-			db_trace_thread(td, -1);
-#endif
+			kdb_backtrace_thread(td);
 			panic("sleeping thread");
 		}
 

Modified: stable/9/sys/sys/kdb.h
==============================================================================
--- stable/9/sys/sys/kdb.h	Mon May 21 21:10:00 2012	(r235740)
+++ stable/9/sys/sys/kdb.h	Mon May 21 21:14:09 2012	(r235741)
@@ -31,31 +31,34 @@
 
 #include <machine/setjmp.h>
 
+struct pcb;
+struct thread;
+struct trapframe;
+
 typedef int dbbe_init_f(void);
 typedef void dbbe_trace_f(void);
+typedef void dbbe_trace_thread_f(struct thread *);
 typedef int dbbe_trap_f(int, int);
 
 struct kdb_dbbe {
 	const char	*dbbe_name;
 	dbbe_init_f	*dbbe_init;
 	dbbe_trace_f	*dbbe_trace;
+	dbbe_trace_thread_f *dbbe_trace_thread;
 	dbbe_trap_f	*dbbe_trap;
 	int		dbbe_active;
 };
 
-#define	KDB_BACKEND(name, init, trace, trap)		\
+#define	KDB_BACKEND(name, init, trace, trace_thread, trap) \
 	static struct kdb_dbbe name##_dbbe = {		\
 		.dbbe_name = #name,			\
 		.dbbe_init = init,			\
 		.dbbe_trace = trace,			\
+		.dbbe_trace_thread = trace_thread,	\
 		.dbbe_trap = trap			\
 	};						\
 	DATA_SET(kdb_dbbe_set, name##_dbbe)
 
-struct pcb;
-struct thread;
-struct trapframe;
-
 extern int kdb_active;			/* Non-zero while in debugger. */
 extern int debugger_on_panic;		/* enter the debugger on panic. */
 extern struct kdb_dbbe *kdb_dbbe;	/* Default debugger backend or NULL. */
@@ -67,6 +70,7 @@ int	kdb_alt_break(int, int *);
 int	kdb_alt_break_gdb(int, int *);
 int	kdb_break(void);
 void	kdb_backtrace(void);
+void	kdb_backtrace_thread(struct thread *);
 int	kdb_dbbe_select(const char *);
 void	kdb_enter(const char *, const char *);
 void	kdb_init(void);

From owner-svn-src-stable-9@FreeBSD.ORG  Mon May 21 21:18:38 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 96E4B106566B;
	Mon, 21 May 2012 21:18:38 +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 6ADCC8FC0A;
	Mon, 21 May 2012 21:18:38 +0000 (UTC)
Received: from jhbbsd.localnet (unknown [209.249.190.124])
	by bigwig.baldwin.cx (Postfix) with ESMTPSA id D5D29B922;
	Mon, 21 May 2012 17:18:37 -0400 (EDT)
From: John Baldwin <jhb@freebsd.org>
To: Sean Bruno <sbruno@freebsd.org>
Date: Mon, 21 May 2012 17:18:34 -0400
User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p13; KDE/4.5.5; amd64; ; )
References: <201205211958.q4LJweXG070838@svn.freebsd.org>
In-Reply-To: <201205211958.q4LJweXG070838@svn.freebsd.org>
MIME-Version: 1.0
Message-Id: <201205211718.34896.jhb@freebsd.org>
Content-Type: Text/Plain;
  charset="utf-8"
Content-Transfer-Encoding: 7bit
X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7
	(bigwig.baldwin.cx); Mon, 21 May 2012 17:18:37 -0400 (EDT)
Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org, svn-src-stable-9@freebsd.org
Subject: Re: svn commit: r235738 - in stable/9/sys: . dev/mfi
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 21 May 2012 21:18:38 -0000

On Monday, May 21, 2012 3:58:40 pm Sean Bruno wrote:
> Author: sbruno
> Date: Mon May 21 19:58:40 2012
> New Revision: 235738
> URL: http://svn.freebsd.org/changeset/base/235738
> 
> Log:
>   MFC r235634
>   
>   Fix and update battery status bits according to linux driver

Hmm, svn seems to have crapped itself.

We should probably at least remove the unnecessary mergeinfo from files.

Ah, it looks like the MFC of the last round of ixgbe changes was merged into a 
sparse checkout, and that is causing the pain.  I will try to fix this, but 
can other folks hold off on merging to stable/9/sys while I do so?

-- 
John Baldwin

From owner-svn-src-stable-9@FreeBSD.ORG  Mon May 21 21:30:10 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 1DACD106564A;
	Mon, 21 May 2012 21:30:10 +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 B233A8FC0A;
	Mon, 21 May 2012 21:30: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 q4LLU0T2073422;
	Mon, 21 May 2012 21:30:00 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4LLU0Zq073421;
	Mon, 21 May 2012 21:30:00 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <201205212130.q4LLU0Zq073421@svn.freebsd.org>
From: John Baldwin <jhb@FreeBSD.org>
Date: Mon, 21 May 2012 21:30:00 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r235743 - stable/9/sys
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 21 May 2012 21:30:10 -0000

Author: jhb
Date: Mon May 21 21:29:59 2012
New Revision: 235743
URL: http://svn.freebsd.org/changeset/base/235743

Log:
  Toss bogus mergeinfo.

Modified:
Directory Properties:
  stable/9/sys/Makefile   (props changed)
  stable/9/sys/amd64/   (props changed)
  stable/9/sys/arm/   (props changed)
  stable/9/sys/bsm/   (props changed)
  stable/9/sys/cam/   (props changed)
  stable/9/sys/cddl/   (props changed)
  stable/9/sys/compat/   (props changed)
  stable/9/sys/contrib/   (props changed)
  stable/9/sys/crypto/   (props changed)
  stable/9/sys/ddb/   (props changed)
  stable/9/sys/dev/aac/   (props changed)
  stable/9/sys/dev/acpi_support/   (props changed)
  stable/9/sys/dev/acpica/   (props changed)
  stable/9/sys/dev/adb/   (props changed)
  stable/9/sys/dev/adlink/   (props changed)
  stable/9/sys/dev/advansys/   (props changed)
  stable/9/sys/dev/ae/   (props changed)
  stable/9/sys/dev/age/   (props changed)
  stable/9/sys/dev/agp/   (props changed)
  stable/9/sys/dev/aha/   (props changed)
  stable/9/sys/dev/ahb/   (props changed)
  stable/9/sys/dev/ahci/   (props changed)
  stable/9/sys/dev/aic/   (props changed)
  stable/9/sys/dev/aic7xxx/   (props changed)
  stable/9/sys/dev/alc/   (props changed)
  stable/9/sys/dev/ale/   (props changed)
  stable/9/sys/dev/amd/   (props changed)
  stable/9/sys/dev/amdsbwd/   (props changed)
  stable/9/sys/dev/amdtemp/   (props changed)
  stable/9/sys/dev/amr/   (props changed)
  stable/9/sys/dev/an/   (props changed)
  stable/9/sys/dev/arcmsr/   (props changed)
  stable/9/sys/dev/asmc/   (props changed)
  stable/9/sys/dev/asr/   (props changed)
  stable/9/sys/dev/ata/   (props changed)
  stable/9/sys/dev/ath/   (props changed)
  stable/9/sys/dev/atkbdc/   (props changed)
  stable/9/sys/dev/auxio/   (props changed)
  stable/9/sys/dev/bce/   (props changed)
  stable/9/sys/dev/bfe/   (props changed)
  stable/9/sys/dev/bge/   (props changed)
  stable/9/sys/dev/bktr/   (props changed)
  stable/9/sys/dev/bm/   (props changed)
  stable/9/sys/dev/buslogic/   (props changed)
  stable/9/sys/dev/bwi/   (props changed)
  stable/9/sys/dev/bwn/   (props changed)
  stable/9/sys/dev/bxe/   (props changed)
  stable/9/sys/dev/cardbus/   (props changed)
  stable/9/sys/dev/cas/   (props changed)
  stable/9/sys/dev/ce/   (props changed)
  stable/9/sys/dev/cesa/   (props changed)
  stable/9/sys/dev/cfe/   (props changed)
  stable/9/sys/dev/cfi/   (props changed)
  stable/9/sys/dev/ciss/   (props changed)
  stable/9/sys/dev/cm/   (props changed)
  stable/9/sys/dev/cmx/   (props changed)
  stable/9/sys/dev/coretemp/   (props changed)
  stable/9/sys/dev/cp/   (props changed)
  stable/9/sys/dev/cpuctl/   (props changed)
  stable/9/sys/dev/cpufreq/   (props changed)
  stable/9/sys/dev/cs/   (props changed)
  stable/9/sys/dev/ct/   (props changed)
  stable/9/sys/dev/ctau/   (props changed)
  stable/9/sys/dev/cx/   (props changed)
  stable/9/sys/dev/cxgb/   (props changed)
  stable/9/sys/dev/cxgbe/   (props changed)
  stable/9/sys/dev/cy/   (props changed)
  stable/9/sys/dev/dc/   (props changed)
  stable/9/sys/dev/dcons/   (props changed)
  stable/9/sys/dev/de/   (props changed)
  stable/9/sys/dev/digi/   (props changed)
  stable/9/sys/dev/dpms/   (props changed)
  stable/9/sys/dev/dpt/   (props changed)
  stable/9/sys/dev/drm/   (props changed)
  stable/9/sys/dev/ed/   (props changed)
  stable/9/sys/dev/eisa/   (props changed)
  stable/9/sys/dev/en/   (props changed)
  stable/9/sys/dev/ep/   (props changed)
  stable/9/sys/dev/esp/   (props changed)
  stable/9/sys/dev/et/   (props changed)
  stable/9/sys/dev/ex/   (props changed)
  stable/9/sys/dev/exca/   (props changed)
  stable/9/sys/dev/fatm/   (props changed)
  stable/9/sys/dev/fb/   (props changed)
  stable/9/sys/dev/fdc/   (props changed)
  stable/9/sys/dev/fdt/   (props changed)
  stable/9/sys/dev/fe/   (props changed)
  stable/9/sys/dev/firewire/   (props changed)
  stable/9/sys/dev/flash/   (props changed)
  stable/9/sys/dev/fxp/   (props changed)
  stable/9/sys/dev/gem/   (props changed)
  stable/9/sys/dev/glxiic/   (props changed)
  stable/9/sys/dev/glxsb/   (props changed)
  stable/9/sys/dev/gpio/   (props changed)
  stable/9/sys/dev/hatm/   (props changed)
  stable/9/sys/dev/hifn/   (props changed)
  stable/9/sys/dev/hme/   (props changed)
  stable/9/sys/dev/hpt27xx/   (props changed)
  stable/9/sys/dev/hptiop/   (props changed)
  stable/9/sys/dev/hptmv/   (props changed)
  stable/9/sys/dev/hptrr/   (props changed)
  stable/9/sys/dev/hwpmc/   (props changed)
  stable/9/sys/dev/ic/   (props changed)
  stable/9/sys/dev/ichsmb/   (props changed)
  stable/9/sys/dev/ichwd/   (props changed)
  stable/9/sys/dev/ida/   (props changed)
  stable/9/sys/dev/ie/   (props changed)
  stable/9/sys/dev/ieee488/   (props changed)
  stable/9/sys/dev/if_ndis/   (props changed)
  stable/9/sys/dev/iicbus/   (props changed)
  stable/9/sys/dev/iir/   (props changed)
  stable/9/sys/dev/io/   (props changed)
  stable/9/sys/dev/ipmi/   (props changed)
  stable/9/sys/dev/ips/   (props changed)
  stable/9/sys/dev/ipw/   (props changed)
  stable/9/sys/dev/isci/   (props changed)
  stable/9/sys/dev/iscsi/   (props changed)
  stable/9/sys/dev/isp/   (props changed)
  stable/9/sys/dev/ispfw/   (props changed)
  stable/9/sys/dev/iwi/   (props changed)
  stable/9/sys/dev/iwn/   (props changed)
  stable/9/sys/dev/ixgb/   (props changed)
  stable/9/sys/dev/jme/   (props changed)
  stable/9/sys/dev/joy/   (props changed)
  stable/9/sys/dev/kbd/   (props changed)
  stable/9/sys/dev/kbdmux/   (props changed)
  stable/9/sys/dev/ksyms/   (props changed)
  stable/9/sys/dev/le/   (props changed)
  stable/9/sys/dev/led/   (props changed)
  stable/9/sys/dev/lge/   (props changed)
  stable/9/sys/dev/lindev/   (props changed)
  stable/9/sys/dev/lmc/   (props changed)
  stable/9/sys/dev/malo/   (props changed)
  stable/9/sys/dev/mc146818/   (props changed)
  stable/9/sys/dev/mca/   (props changed)
  stable/9/sys/dev/mcd/   (props changed)
  stable/9/sys/dev/md/   (props changed)
  stable/9/sys/dev/mem/   (props changed)
  stable/9/sys/dev/mge/   (props changed)
  stable/9/sys/dev/mii/   (props changed)
  stable/9/sys/dev/mk48txx/   (props changed)
  stable/9/sys/dev/mlx/   (props changed)
  stable/9/sys/dev/mly/   (props changed)
  stable/9/sys/dev/mmc/   (props changed)
  stable/9/sys/dev/mn/   (props changed)
  stable/9/sys/dev/mps/   (props changed)
  stable/9/sys/dev/mpt/   (props changed)
  stable/9/sys/dev/mse/   (props changed)
  stable/9/sys/dev/msk/   (props changed)
  stable/9/sys/dev/mvs/   (props changed)
  stable/9/sys/dev/mwl/   (props changed)
  stable/9/sys/dev/mxge/   (props changed)
  stable/9/sys/dev/my/   (props changed)
  stable/9/sys/dev/ncv/   (props changed)
  stable/9/sys/dev/netmap/   (props changed)
  stable/9/sys/dev/nfe/   (props changed)
  stable/9/sys/dev/nge/   (props changed)
  stable/9/sys/dev/nmdm/   (props changed)
  stable/9/sys/dev/nsp/   (props changed)
  stable/9/sys/dev/null/   (props changed)
  stable/9/sys/dev/nve/   (props changed)
  stable/9/sys/dev/nvram/   (props changed)
  stable/9/sys/dev/nvram2env/   (props changed)
  stable/9/sys/dev/nxge/   (props changed)
  stable/9/sys/dev/oce/   (props changed)
  stable/9/sys/dev/ofw/   (props changed)
  stable/9/sys/dev/patm/   (props changed)
  stable/9/sys/dev/pbio/   (props changed)
  stable/9/sys/dev/pccard/   (props changed)
  stable/9/sys/dev/pccbb/   (props changed)
  stable/9/sys/dev/pcf/   (props changed)
  stable/9/sys/dev/pci/   (props changed)
  stable/9/sys/dev/pcn/   (props changed)
  stable/9/sys/dev/pdq/   (props changed)
  stable/9/sys/dev/powermac_nvram/   (props changed)
  stable/9/sys/dev/ppbus/   (props changed)
  stable/9/sys/dev/ppc/   (props changed)
  stable/9/sys/dev/pst/   (props changed)
  stable/9/sys/dev/pty/   (props changed)
  stable/9/sys/dev/puc/   (props changed)
  stable/9/sys/dev/qlxgb/   (props changed)
  stable/9/sys/dev/quicc/   (props changed)
  stable/9/sys/dev/ral/   (props changed)
  stable/9/sys/dev/random/   (props changed)
  stable/9/sys/dev/rc/   (props changed)
  stable/9/sys/dev/re/   (props changed)
  stable/9/sys/dev/rndtest/   (props changed)
  stable/9/sys/dev/rp/   (props changed)
  stable/9/sys/dev/rt/   (props changed)
  stable/9/sys/dev/safe/   (props changed)
  stable/9/sys/dev/sbni/   (props changed)
  stable/9/sys/dev/scc/   (props changed)
  stable/9/sys/dev/scd/   (props changed)
  stable/9/sys/dev/sdhci/   (props changed)
  stable/9/sys/dev/sec/   (props changed)
  stable/9/sys/dev/sf/   (props changed)
  stable/9/sys/dev/sfxge/   (props changed)
  stable/9/sys/dev/sge/   (props changed)
  stable/9/sys/dev/si/   (props changed)
  stable/9/sys/dev/siba/   (props changed)
  stable/9/sys/dev/siis/   (props changed)
  stable/9/sys/dev/sio/   (props changed)
  stable/9/sys/dev/sis/   (props changed)
  stable/9/sys/dev/sk/   (props changed)
  stable/9/sys/dev/smbus/   (props changed)
  stable/9/sys/dev/smc/   (props changed)
  stable/9/sys/dev/sn/   (props changed)
  stable/9/sys/dev/snc/   (props changed)
  stable/9/sys/dev/snp/   (props changed)
  stable/9/sys/dev/sound/   (props changed)
  stable/9/sys/dev/speaker/   (props changed)
  stable/9/sys/dev/spibus/   (props changed)
  stable/9/sys/dev/ste/   (props changed)
  stable/9/sys/dev/stg/   (props changed)
  stable/9/sys/dev/stge/   (props changed)
  stable/9/sys/dev/streams/   (props changed)
  stable/9/sys/dev/sym/   (props changed)
  stable/9/sys/dev/syscons/   (props changed)
  stable/9/sys/dev/tdfx/   (props changed)
  stable/9/sys/dev/ti/   (props changed)
  stable/9/sys/dev/tl/   (props changed)
  stable/9/sys/dev/tpm/   (props changed)
  stable/9/sys/dev/trm/   (props changed)
  stable/9/sys/dev/tsec/   (props changed)
  stable/9/sys/dev/twa/   (props changed)
  stable/9/sys/dev/twe/   (props changed)
  stable/9/sys/dev/tws/   (props changed)
  stable/9/sys/dev/tx/   (props changed)
  stable/9/sys/dev/txp/   (props changed)
  stable/9/sys/dev/uart/   (props changed)
  stable/9/sys/dev/ubsec/   (props changed)
  stable/9/sys/dev/usb/   (props changed)
  stable/9/sys/dev/utopia/   (props changed)
  stable/9/sys/dev/vge/   (props changed)
  stable/9/sys/dev/viawd/   (props changed)
  stable/9/sys/dev/vkbd/   (props changed)
  stable/9/sys/dev/vr/   (props changed)
  stable/9/sys/dev/vte/   (props changed)
  stable/9/sys/dev/vx/   (props changed)
  stable/9/sys/dev/vxge/   (props changed)
  stable/9/sys/dev/watchdog/   (props changed)
  stable/9/sys/dev/wb/   (props changed)
  stable/9/sys/dev/wds/   (props changed)
  stable/9/sys/dev/wi/   (props changed)
  stable/9/sys/dev/wl/   (props changed)
  stable/9/sys/dev/wpi/   (props changed)
  stable/9/sys/dev/xe/   (props changed)
  stable/9/sys/dev/xen/   (props changed)
  stable/9/sys/dev/xl/   (props changed)
  stable/9/sys/gdb/   (props changed)
  stable/9/sys/geom/   (props changed)
  stable/9/sys/gnu/   (props changed)
  stable/9/sys/i386/   (props changed)
  stable/9/sys/ia64/   (props changed)
  stable/9/sys/isa/   (props changed)
  stable/9/sys/kern/   (props changed)
  stable/9/sys/kgssapi/   (props changed)
  stable/9/sys/libkern/   (props changed)
  stable/9/sys/mips/   (props changed)
  stable/9/sys/net/   (props changed)
  stable/9/sys/net80211/   (props changed)
  stable/9/sys/netatalk/   (props changed)
  stable/9/sys/netgraph/   (props changed)
  stable/9/sys/netinet/   (props changed)
  stable/9/sys/netinet6/   (props changed)
  stable/9/sys/netipsec/   (props changed)
  stable/9/sys/netipx/   (props changed)
  stable/9/sys/netnatm/   (props changed)
  stable/9/sys/netncp/   (props changed)
  stable/9/sys/netsmb/   (props changed)
  stable/9/sys/nfs/   (props changed)
  stable/9/sys/nfsclient/   (props changed)
  stable/9/sys/nfsserver/   (props changed)
  stable/9/sys/nlm/   (props changed)
  stable/9/sys/ofed/   (props changed)
  stable/9/sys/opencrypto/   (props changed)
  stable/9/sys/pc98/   (props changed)
  stable/9/sys/pci/   (props changed)
  stable/9/sys/powerpc/   (props changed)
  stable/9/sys/rpc/   (props changed)
  stable/9/sys/security/   (props changed)
  stable/9/sys/sparc64/   (props changed)
  stable/9/sys/sys/   (props changed)
  stable/9/sys/teken/   (props changed)
  stable/9/sys/tools/   (props changed)
  stable/9/sys/ufs/   (props changed)
  stable/9/sys/vm/   (props changed)
  stable/9/sys/x86/   (props changed)
  stable/9/sys/xdr/   (props changed)
  stable/9/sys/xen/   (props changed)

From owner-svn-src-stable-9@FreeBSD.ORG  Mon May 21 23:54:22 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 8D0A0106566C;
	Mon, 21 May 2012 23:54:22 +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 74F4C8FC17;
	Mon, 21 May 2012 23:54: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 q4LNsMJZ079092;
	Mon, 21 May 2012 23:54:22 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4LNsMAB079091;
	Mon, 21 May 2012 23:54:22 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <201205212354.q4LNsMAB079091@svn.freebsd.org>
From: John Baldwin <jhb@FreeBSD.org>
Date: Mon, 21 May 2012 23:54:22 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r235763 - in stable/9/sys: . amd64/include/xen boot
	boot/i386/efi boot/ia64/efi boot/ia64/ski
	boot/powerpc/boot1.chrp boot/powerpc/ofw
	cddl/contrib/opensolaris conf contrib/dev/acpica c...
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 21 May 2012 23:54:22 -0000

Author: jhb
Date: Mon May 21 23:54:21 2012
New Revision: 235763
URL: http://svn.freebsd.org/changeset/base/235763

Log:
  Repair mergeinfo from merges done into a sparse checkout.

Modified:
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/amd64/include/xen/   (props changed)
  stable/9/sys/boot/   (props changed)
  stable/9/sys/boot/i386/efi/   (props changed)
  stable/9/sys/boot/ia64/efi/   (props changed)
  stable/9/sys/boot/ia64/ski/   (props changed)
  stable/9/sys/boot/powerpc/boot1.chrp/   (props changed)
  stable/9/sys/boot/powerpc/ofw/   (props changed)
  stable/9/sys/cddl/contrib/opensolaris/   (props changed)
  stable/9/sys/conf/   (props changed)
  stable/9/sys/contrib/dev/acpica/   (props changed)
  stable/9/sys/contrib/octeon-sdk/   (props changed)
  stable/9/sys/contrib/pf/   (props changed)
  stable/9/sys/contrib/x86emu/   (props changed)
  stable/9/sys/dev/   (props changed)
  stable/9/sys/dev/e1000/   (props changed)
  stable/9/sys/fs/   (props changed)
  stable/9/sys/fs/ntfs/   (props changed)
  stable/9/sys/modules/   (props changed)

From owner-svn-src-stable-9@FreeBSD.ORG  Tue May 22 00:00:30 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 9B9921065679;
	Tue, 22 May 2012 00:00: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 04D1C8FC16;
	Tue, 22 May 2012 00:00: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 q4M00H2j079324;
	Tue, 22 May 2012 00:00:17 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4M00HiU079322;
	Tue, 22 May 2012 00:00:17 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <201205220000.q4M00HiU079322@svn.freebsd.org>
From: John Baldwin <jhb@FreeBSD.org>
Date: Tue, 22 May 2012 00:00:17 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r235764 - stable/9/sys/net
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 22 May 2012 00:00:30 -0000

Author: jhb
Date: Tue May 22 00:00:17 2012
New Revision: 235764
URL: http://svn.freebsd.org/changeset/base/235764

Log:
  MFC 234098:
  Add media types for 40G media that might be used with FreeBSD.

Modified:
  stable/9/sys/net/if_media.h
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/amd64/include/xen/   (props changed)
  stable/9/sys/boot/   (props changed)
  stable/9/sys/boot/i386/efi/   (props changed)
  stable/9/sys/boot/ia64/efi/   (props changed)
  stable/9/sys/boot/ia64/ski/   (props changed)
  stable/9/sys/boot/powerpc/boot1.chrp/   (props changed)
  stable/9/sys/boot/powerpc/ofw/   (props changed)
  stable/9/sys/cddl/contrib/opensolaris/   (props changed)
  stable/9/sys/conf/   (props changed)
  stable/9/sys/contrib/dev/acpica/   (props changed)
  stable/9/sys/contrib/octeon-sdk/   (props changed)
  stable/9/sys/contrib/pf/   (props changed)
  stable/9/sys/contrib/x86emu/   (props changed)
  stable/9/sys/dev/   (props changed)
  stable/9/sys/dev/e1000/   (props changed)
  stable/9/sys/dev/ixgbe/   (props changed)
  stable/9/sys/fs/   (props changed)
  stable/9/sys/fs/ntfs/   (props changed)
  stable/9/sys/modules/   (props changed)

Modified: stable/9/sys/net/if_media.h
==============================================================================
--- stable/9/sys/net/if_media.h	Mon May 21 23:54:21 2012	(r235763)
+++ stable/9/sys/net/if_media.h	Tue May 22 00:00:17 2012	(r235764)
@@ -150,6 +150,9 @@ uint64_t	ifmedia_baudrate(int);
 #define	IFM_10G_LRM	24		/* 10GBase-LRM 850nm Multi-mode */
 #define	IFM_UNKNOWN	25		/* media types not defined yet */
 #define	IFM_10G_T	26		/* 10GBase-T - RJ45 */
+#define	IFM_40G_CR4	27		/* 40GBase-CR4 */
+#define	IFM_40G_SR4	28		/* 40GBase-SR4 */
+#define	IFM_40G_LR4	29		/* 40GBase-LR4 */
 
 /* note 31 is the max! */
 
@@ -366,6 +369,9 @@ struct ifmedia_description {
 	{ IFM_10G_TWINAX_LONG,	"10Gbase-Twinax-Long" },		\
 	{ IFM_UNKNOWN,	"Unknown" },					\
 	{ IFM_10G_T,	"10Gbase-T" },					\
+	{ IFM_40G_CR4,	"40Gbase-CR4" },				\
+	{ IFM_40G_SR4,	"40Gbase-SR4" },				\
+	{ IFM_40G_LR4,	"40Gbase-LR4" },				\
 	{ 0, NULL },							\
 }
 
@@ -664,6 +670,9 @@ struct ifmedia_baudrate {
 	{ IFM_ETHER | IFM_10G_TWINAX_LONG,	IF_Gbps(10ULL) },	\
 	{ IFM_ETHER | IFM_10G_LRM,	IF_Gbps(10ULL) },		\
 	{ IFM_ETHER | IFM_10G_T,	IF_Gbps(10ULL) },		\
+	{ IFM_ETHER | IFM_40G_CR4,	IF_Gbps(40ULL) },		\
+	{ IFM_ETHER | IFM_40G_SR4,	IF_Gbps(40ULL) },		\
+	{ IFM_ETHER | IFM_40G_LR4,	IF_Gbps(40ULL) },		\
 									\
 	{ IFM_TOKEN | IFM_TOK_STP4,	IF_Mbps(4) },			\
 	{ IFM_TOKEN | IFM_TOK_STP16,	IF_Mbps(16) },			\

From owner-svn-src-stable-9@FreeBSD.ORG  Tue May 22 00:08:50 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 1B1F51065678;
	Tue, 22 May 2012 00:08:50 +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 E06C48FC25;
	Tue, 22 May 2012 00:08:49 +0000 (UTC)
Received: from John-Baldwins-MacBook-Air.local
	(c-68-39-198-164.hsd1.de.comcast.net [68.39.198.164])
	by bigwig.baldwin.cx (Postfix) with ESMTPSA id DD610B922;
	Mon, 21 May 2012 20:08:48 -0400 (EDT)
Message-ID: <4FBAD919.2010706@FreeBSD.org>
Date: Mon, 21 May 2012 20:08:57 -0400
From: John Baldwin <jhb@FreeBSD.org>
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7;
	rv:12.0) Gecko/20120428 Thunderbird/12.0.1
MIME-Version: 1.0
To: John Baldwin <jhb@freebsd.org>
References: <201205211958.q4LJweXG070838@svn.freebsd.org>
	<201205211718.34896.jhb@freebsd.org>
In-Reply-To: <201205211718.34896.jhb@freebsd.org>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7
	(bigwig.baldwin.cx); Mon, 21 May 2012 20:08:49 -0400 (EDT)
Cc: svn-src-stable@freebsd.org, Sean Bruno <sbruno@freebsd.org>,
	src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable-9@freebsd.org
Subject: Re: svn commit: r235738 - in stable/9/sys: . dev/mfi
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 22 May 2012 00:08:50 -0000

On 5/21/12 5:18 PM, John Baldwin wrote:
> On Monday, May 21, 2012 3:58:40 pm Sean Bruno wrote:
>> Author: sbruno
>> Date: Mon May 21 19:58:40 2012
>> New Revision: 235738
>> URL: http://svn.freebsd.org/changeset/base/235738
>>
>> Log:
>>   MFC r235634
>>   
>>   Fix and update battery status bits according to linux driver
> 
> Hmm, svn seems to have crapped itself.
> 
> We should probably at least remove the unnecessary mergeinfo from files.
> 
> Ah, it looks like the MFC of the last round of ixgbe changes was merged into a 
> sparse checkout, and that is causing the pain.  I will try to fix this, but 
> can other folks hold off on merging to stable/9/sys while I do so?

I think I have this cleaned up.  However, I have only tried using a 1.6
client so far (and it was merging things fine before).  Sean, I think
you are using a 1.7 client, yes?

If anyone does a merge and notices that it adds a ton of new mergeinfo,
can you please wait to commit until after someone else has looked at it?
 Hopefully the mergeinfo stuff I adjusted will fix this.  (And I'm
done with my current guesses at fixing.)

-- 
John Baldwin

From owner-svn-src-stable-9@FreeBSD.ORG  Tue May 22 02:11:09 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 567DD106564A;
	Tue, 22 May 2012 02:11:09 +0000 (UTC) (envelope-from pfg@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 3F30D8FC08;
	Tue, 22 May 2012 02:11: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 q4M2B9wh082554;
	Tue, 22 May 2012 02:11:09 GMT (envelope-from pfg@svn.freebsd.org)
Received: (from pfg@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4M2B9sW082552;
	Tue, 22 May 2012 02:11:09 GMT (envelope-from pfg@svn.freebsd.org)
Message-Id: <201205220211.q4M2B9sW082552@svn.freebsd.org>
From: "Pedro F. Giffuni" <pfg@FreeBSD.org>
Date: Tue, 22 May 2012 02:11:09 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r235768 - stable/9/sys/dev/sound/pci
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 22 May 2012 02:11:09 -0000

Author: pfg
Date: Tue May 22 02:11:08 2012
New Revision: 235768
URL: http://svn.freebsd.org/changeset/base/235768

Log:
  MFC:	r233362
  
  Don't cast a bus address to a uint8_t pointer just to add an offset to
  it.  Instead, add the offset directly to the bus address.
  
  Approved by:	jhb (mentor)

Modified:
  stable/9/sys/dev/sound/pci/emu10kx.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/dev/   (props changed)

Modified: stable/9/sys/dev/sound/pci/emu10kx.c
==============================================================================
--- stable/9/sys/dev/sound/pci/emu10kx.c	Tue May 22 01:28:32 2012	(r235767)
+++ stable/9/sys/dev/sound/pci/emu10kx.c	Tue May 22 02:11:08 2012	(r235768)
@@ -1137,7 +1137,7 @@ emu_memalloc(struct emu_mem *mem, uint32
 	ofs = 0;
 	for (idx = start; idx < start + blksz; idx++) {
 		mem->bmap[idx >> 3] |= 1 << (idx & 7);
-		tmp = (uint32_t) (u_long) ((uint8_t *) blk->buf_addr + ofs);
+		tmp = (uint32_t) (blk->buf_addr + ofs);
 		mem->ptb_pages[idx] = (tmp << 1) | idx;
 		ofs += EMUPAGESIZE;
 	}

From owner-svn-src-stable-9@FreeBSD.ORG  Tue May 22 02:24:53 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 8689B106566C;
	Tue, 22 May 2012 02:24:53 +0000 (UTC) (envelope-from pfg@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 57FF58FC22;
	Tue, 22 May 2012 02:24: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 q4M2Orpv082861;
	Tue, 22 May 2012 02:24:53 GMT (envelope-from pfg@svn.freebsd.org)
Received: (from pfg@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4M2Or4Q082858;
	Tue, 22 May 2012 02:24:53 GMT (envelope-from pfg@svn.freebsd.org)
Message-Id: <201205220224.q4M2Or4Q082858@svn.freebsd.org>
From: "Pedro F. Giffuni" <pfg@FreeBSD.org>
Date: Tue, 22 May 2012 02:24:53 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r235769 - in stable/9/sys: amd64/conf i386/conf
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 22 May 2012 02:24:53 -0000

Author: pfg
Date: Tue May 22 02:24:52 2012
New Revision: 235769
URL: http://svn.freebsd.org/changeset/base/235769

Log:
  MFC:	r233310
  
  Add snd_cmi, snd_csa and snd_emu10kx to GENERIC on i386 and amd64.
  
  The GPL infected parts which were blocking the inclusion of snd_csa
  and snd_emu10kx in GENERIC have recently been removed from the tree.
  
  Requested by:	joel
  Discussed with:	jhb, joel, Yuriy Tsibizov <yuriy.tsibizov@gfk.ru>
  Approved by:	jhb (mentor)

Modified:
  stable/9/sys/amd64/conf/GENERIC
  stable/9/sys/i386/conf/GENERIC
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/amd64/conf/GENERIC
==============================================================================
--- stable/9/sys/amd64/conf/GENERIC	Tue May 22 02:11:08 2012	(r235768)
+++ stable/9/sys/amd64/conf/GENERIC	Tue May 22 02:24:52 2012	(r235769)
@@ -337,6 +337,9 @@ device		dcons_crom	# Configuration ROM f
 
 # Sound support
 device		sound		# Generic sound driver (required)
+device		snd_cmi		# CMedia CMI8338/CMI8738
+device		snd_csa		# Crystal Semiconductor CS461x/428x
+device		snd_emu10kx	# Creative SoundBlaster Live! and Audigy
 device		snd_es137x	# Ensoniq AudioPCI ES137x
 device		snd_hda		# Intel High Definition Audio
 device		snd_ich		# Intel, NVidia and other ICH AC'97 Audio

Modified: stable/9/sys/i386/conf/GENERIC
==============================================================================
--- stable/9/sys/i386/conf/GENERIC	Tue May 22 02:11:08 2012	(r235768)
+++ stable/9/sys/i386/conf/GENERIC	Tue May 22 02:24:52 2012	(r235769)
@@ -350,6 +350,9 @@ device		dcons_crom	# Configuration ROM f
 
 # Sound support
 device		sound		# Generic sound driver (required)
+device		snd_cmi		# CMedia CMI8338/CMI8738
+device		snd_csa		# Crystal Semiconductor CS461x/428x
+device		snd_emu10kx	# Creative SoundBlaster Live! and Audigy
 device		snd_es137x	# Ensoniq AudioPCI ES137x
 device		snd_hda		# Intel High Definition Audio
 device		snd_ich		# Intel, NVidia and other ICH AC'97 Audio

From owner-svn-src-stable-9@FreeBSD.ORG  Tue May 22 14:40:41 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id F1B5E1065677;
	Tue, 22 May 2012 14:40:40 +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 D609A8FC1C;
	Tue, 22 May 2012 14:40: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 q4MEee30007385;
	Tue, 22 May 2012 14:40:40 GMT
	(envelope-from theraven@svn.freebsd.org)
Received: (from theraven@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4MEeeic007359;
	Tue, 22 May 2012 14:40:40 GMT
	(envelope-from theraven@svn.freebsd.org)
Message-Id: <201205221440.q4MEeeic007359@svn.freebsd.org>
From: David Chisnall <theraven@FreeBSD.org>
Date: Tue, 22 May 2012 14:40:40 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r235785 - in stable/9: contrib/gdtoa etc/mtree include
	include/xlocale lib/libc/gdtoa lib/libc/gen lib/libc/locale
	lib/libc/regex lib/libc/stdio lib/libc/stdlib
	lib/libc/stdtime lib/lib...
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 22 May 2012 14:40:41 -0000

Author: theraven
Date: Tue May 22 14:40:39 2012
New Revision: 235785
URL: http://svn.freebsd.org/changeset/base/235785

Log:
  MFC the xlocale implementation.
  
  Merged revisions: 227487,227753,227807,227818,227999,228002,228875,230156,231673,232498,232601,232620,232626,232926-232927,232929,232931,232935,233173,233600,234573,234578,235239
  
  This currently defines __NO_TLS on ARM (unlike head), because the required
  support function has not been MFC'd.

Added:
  stable/9/include/xlocale/
     - copied from r232498, head/include/xlocale/
  stable/9/include/xlocale.h
     - copied, changed from r227753, head/include/xlocale.h
  stable/9/lib/libc/locale/DESIGN.xlocale
     - copied unchanged from r227753, head/lib/libc/locale/DESIGN.xlocale
  stable/9/lib/libc/locale/ctype.c
     - copied unchanged from r227753, head/lib/libc/locale/ctype.c
  stable/9/lib/libc/locale/ctype_l.3
     - copied unchanged from r232935, head/lib/libc/locale/ctype_l.3
  stable/9/lib/libc/locale/duplocale.3
     - copied unchanged from r227753, head/lib/libc/locale/duplocale.3
  stable/9/lib/libc/locale/freelocale.3
     - copied unchanged from r227753, head/lib/libc/locale/freelocale.3
  stable/9/lib/libc/locale/newlocale.3
     - copied unchanged from r227753, head/lib/libc/locale/newlocale.3
  stable/9/lib/libc/locale/querylocale.3
     - copied unchanged from r227753, head/lib/libc/locale/querylocale.3
  stable/9/lib/libc/locale/uselocale.3
     - copied unchanged from r227753, head/lib/libc/locale/uselocale.3
  stable/9/lib/libc/locale/xlocale.3
     - copied unchanged from r227753, head/lib/libc/locale/xlocale.3
  stable/9/lib/libc/locale/xlocale.c
     - copied, changed from r227753, head/lib/libc/locale/xlocale.c
  stable/9/lib/libc/locale/xlocale_private.h
     - copied, changed from r227753, head/lib/libc/locale/xlocale_private.h
Modified:
  stable/9/contrib/gdtoa/gdtoaimp.h
  stable/9/contrib/gdtoa/strtod.c
  stable/9/contrib/gdtoa/strtodg.c
  stable/9/contrib/gdtoa/strtof.c
  stable/9/contrib/gdtoa/strtorQ.c
  stable/9/contrib/gdtoa/strtord.c
  stable/9/contrib/gdtoa/strtorx.c
  stable/9/etc/mtree/BSD.include.dist
  stable/9/include/Makefile
  stable/9/include/ctype.h
  stable/9/include/inttypes.h
  stable/9/include/langinfo.h
  stable/9/include/locale.h
  stable/9/include/monetary.h
  stable/9/include/runetype.h
  stable/9/include/stdio.h
  stable/9/include/stdlib.h
  stable/9/include/string.h
  stable/9/include/time.h
  stable/9/include/wchar.h
  stable/9/include/wctype.h
  stable/9/include/xlocale/_ctype.h
  stable/9/lib/libc/gdtoa/machdep_ldisQ.c
  stable/9/lib/libc/gdtoa/machdep_ldisd.c
  stable/9/lib/libc/gdtoa/machdep_ldisx.c
  stable/9/lib/libc/gen/_pthread_stubs.c
  stable/9/lib/libc/gen/fnmatch.c
  stable/9/lib/libc/gen/glob.c
  stable/9/lib/libc/locale/Makefile.inc
  stable/9/lib/libc/locale/Symbol.map
  stable/9/lib/libc/locale/ascii.c
  stable/9/lib/libc/locale/big5.c
  stable/9/lib/libc/locale/btowc.3
  stable/9/lib/libc/locale/btowc.c
  stable/9/lib/libc/locale/collate.c
  stable/9/lib/libc/locale/collate.h
  stable/9/lib/libc/locale/collcmp.c
  stable/9/lib/libc/locale/ctype.3
  stable/9/lib/libc/locale/digittoint.3
  stable/9/lib/libc/locale/euc.c
  stable/9/lib/libc/locale/gb18030.c
  stable/9/lib/libc/locale/gb2312.c
  stable/9/lib/libc/locale/gbk.c
  stable/9/lib/libc/locale/isalnum.3
  stable/9/lib/libc/locale/isalpha.3
  stable/9/lib/libc/locale/isblank.3
  stable/9/lib/libc/locale/iscntrl.3
  stable/9/lib/libc/locale/isdigit.3
  stable/9/lib/libc/locale/lmessages.c
  stable/9/lib/libc/locale/lmessages.h
  stable/9/lib/libc/locale/lmonetary.c
  stable/9/lib/libc/locale/lmonetary.h
  stable/9/lib/libc/locale/lnumeric.c
  stable/9/lib/libc/locale/lnumeric.h
  stable/9/lib/libc/locale/localeconv.3
  stable/9/lib/libc/locale/localeconv.c
  stable/9/lib/libc/locale/mblen.c
  stable/9/lib/libc/locale/mblocal.h
  stable/9/lib/libc/locale/mbrlen.c
  stable/9/lib/libc/locale/mbrtowc.c
  stable/9/lib/libc/locale/mbsinit.c
  stable/9/lib/libc/locale/mbsnrtowcs.c
  stable/9/lib/libc/locale/mbsrtowcs.c
  stable/9/lib/libc/locale/mbstowcs.c
  stable/9/lib/libc/locale/mbtowc.c
  stable/9/lib/libc/locale/mskanji.c
  stable/9/lib/libc/locale/nextwctype.c
  stable/9/lib/libc/locale/nl_langinfo.c
  stable/9/lib/libc/locale/nomacros.c
  stable/9/lib/libc/locale/none.c
  stable/9/lib/libc/locale/runetype.c
  stable/9/lib/libc/locale/setlocale.c
  stable/9/lib/libc/locale/setrunelocale.c
  stable/9/lib/libc/locale/table.c
  stable/9/lib/libc/locale/tolower.c
  stable/9/lib/libc/locale/toupper.c
  stable/9/lib/libc/locale/utf8.c
  stable/9/lib/libc/locale/wcrtomb.c
  stable/9/lib/libc/locale/wcsftime.c
  stable/9/lib/libc/locale/wcsnrtombs.c
  stable/9/lib/libc/locale/wcsrtombs.c
  stable/9/lib/libc/locale/wcstod.c
  stable/9/lib/libc/locale/wcstof.c
  stable/9/lib/libc/locale/wcstoimax.c
  stable/9/lib/libc/locale/wcstol.c
  stable/9/lib/libc/locale/wcstold.c
  stable/9/lib/libc/locale/wcstoll.c
  stable/9/lib/libc/locale/wcstombs.c
  stable/9/lib/libc/locale/wcstoul.c
  stable/9/lib/libc/locale/wcstoull.c
  stable/9/lib/libc/locale/wcstoumax.c
  stable/9/lib/libc/locale/wctob.c
  stable/9/lib/libc/locale/wctomb.c
  stable/9/lib/libc/locale/wctrans.c
  stable/9/lib/libc/locale/wctype.c
  stable/9/lib/libc/locale/wcwidth.c
  stable/9/lib/libc/regex/regcomp.c
  stable/9/lib/libc/stdio/Symbol.map
  stable/9/lib/libc/stdio/asprintf.c
  stable/9/lib/libc/stdio/fgetwc.c
  stable/9/lib/libc/stdio/fgetwln.c
  stable/9/lib/libc/stdio/fgetws.c
  stable/9/lib/libc/stdio/fprintf.c
  stable/9/lib/libc/stdio/fputwc.c
  stable/9/lib/libc/stdio/fputws.c
  stable/9/lib/libc/stdio/fscanf.c
  stable/9/lib/libc/stdio/fwprintf.c
  stable/9/lib/libc/stdio/fwscanf.c
  stable/9/lib/libc/stdio/getwc.c
  stable/9/lib/libc/stdio/getwchar.c
  stable/9/lib/libc/stdio/local.h
  stable/9/lib/libc/stdio/printf.c
  stable/9/lib/libc/stdio/printfcommon.h
  stable/9/lib/libc/stdio/putwc.c
  stable/9/lib/libc/stdio/putwchar.c
  stable/9/lib/libc/stdio/scanf.c
  stable/9/lib/libc/stdio/snprintf.c
  stable/9/lib/libc/stdio/sprintf.c
  stable/9/lib/libc/stdio/sscanf.c
  stable/9/lib/libc/stdio/swprintf.c
  stable/9/lib/libc/stdio/swscanf.c
  stable/9/lib/libc/stdio/ungetwc.c
  stable/9/lib/libc/stdio/vasprintf.c
  stable/9/lib/libc/stdio/vdprintf.c
  stable/9/lib/libc/stdio/vfprintf.c
  stable/9/lib/libc/stdio/vfscanf.c
  stable/9/lib/libc/stdio/vfwprintf.c
  stable/9/lib/libc/stdio/vfwscanf.c
  stable/9/lib/libc/stdio/vprintf.c
  stable/9/lib/libc/stdio/vscanf.c
  stable/9/lib/libc/stdio/vsnprintf.c
  stable/9/lib/libc/stdio/vsprintf.c
  stable/9/lib/libc/stdio/vsscanf.c
  stable/9/lib/libc/stdio/vswprintf.c
  stable/9/lib/libc/stdio/vswscanf.c
  stable/9/lib/libc/stdio/vwprintf.c
  stable/9/lib/libc/stdio/vwscanf.c
  stable/9/lib/libc/stdio/wprintf.c
  stable/9/lib/libc/stdio/wscanf.c
  stable/9/lib/libc/stdlib/Symbol.map
  stable/9/lib/libc/stdlib/atof.c
  stable/9/lib/libc/stdlib/atoi.c
  stable/9/lib/libc/stdlib/atol.c
  stable/9/lib/libc/stdlib/atoll.c
  stable/9/lib/libc/stdlib/strfmon.c
  stable/9/lib/libc/stdlib/strtoimax.c
  stable/9/lib/libc/stdlib/strtol.c
  stable/9/lib/libc/stdlib/strtoll.c
  stable/9/lib/libc/stdlib/strtoul.c
  stable/9/lib/libc/stdlib/strtoull.c
  stable/9/lib/libc/stdlib/strtoumax.c
  stable/9/lib/libc/stdtime/strftime.c
  stable/9/lib/libc/stdtime/strptime.c
  stable/9/lib/libc/stdtime/timelocal.c
  stable/9/lib/libc/stdtime/timelocal.h
  stable/9/lib/libc/string/Symbol.map
  stable/9/lib/libc/string/strcasecmp.c
  stable/9/lib/libc/string/strcasestr.c
  stable/9/lib/libc/string/strcoll.c
  stable/9/lib/libc/string/strxfrm.c
  stable/9/lib/libc/string/wcscoll.c
  stable/9/lib/libc/string/wcswidth.c
  stable/9/lib/libc/string/wcsxfrm.c
  stable/9/sys/sys/cdefs.h
Directory Properties:
  stable/9/contrib/gdtoa/   (props changed)
  stable/9/etc/   (props changed)
  stable/9/include/   (props changed)
  stable/9/lib/libc/   (props changed)
  stable/9/lib/libc/stdtime/   (props changed)
  stable/9/sys/   (props changed)

Modified: stable/9/contrib/gdtoa/gdtoaimp.h
==============================================================================
--- stable/9/contrib/gdtoa/gdtoaimp.h	Tue May 22 13:14:21 2012	(r235784)
+++ stable/9/contrib/gdtoa/gdtoaimp.h	Tue May 22 14:40:39 2012	(r235785)
@@ -201,6 +201,7 @@ THIS SOFTWARE.
 #include "namespace.h"
 #include <pthread.h>
 #include "un-namespace.h"
+#include "xlocale_private.h"
 
 #ifdef KR_headers
 #define Char char
@@ -525,11 +526,11 @@ extern void memcpy_D2A ANSI((void*, cons
 #define	strtoIQ		__strtoIQ
 #define	strtoIx		__strtoIx
 #define	strtoIxL	__strtoIxL
-#define	strtord		__strtord
+#define	strtord_l		__strtord_l
 #define	strtordd	__strtordd
 #define	strtorf		__strtorf
-#define	strtorQ		__strtorQ
-#define	strtorx		__strtorx
+#define	strtorQ_l		__strtorQ_l
+#define	strtorx_l		__strtorx_l
 #define	strtorxL	__strtorxL
 #define	strtodI		__strtodI
 #define	strtopd		__strtopd
@@ -634,7 +635,7 @@ extern void memcpy_D2A ANSI((void*, cons
  extern Bigint *s2b ANSI((CONST char*, int, int, ULong, int));
  extern Bigint *set_ones ANSI((Bigint*, int));
  extern char *strcp ANSI((char*, const char*));
- extern int strtodg ANSI((CONST char*, char**, FPI*, Long*, ULong*));
+ extern int strtodg_l ANSI((CONST char*, char**, FPI*, Long*, ULong*, locale_t));
 
  extern int strtoId ANSI((CONST char *, char **, double *, double *));
  extern int strtoIdd ANSI((CONST char *, char **, double *, double *));
@@ -644,17 +645,18 @@ extern void memcpy_D2A ANSI((void*, cons
  extern int strtoIx ANSI((CONST char *, char **, void *, void *));
  extern int strtoIxL ANSI((CONST char *, char **, void *, void *));
  extern double strtod ANSI((const char *s00, char **se));
+ extern double strtod_l ANSI((const char *s00, char **se, locale_t));
  extern int strtopQ ANSI((CONST char *, char **, Void *));
  extern int strtopf ANSI((CONST char *, char **, float *));
  extern int strtopd ANSI((CONST char *, char **, double *));
  extern int strtopdd ANSI((CONST char *, char **, double *));
  extern int strtopx ANSI((CONST char *, char **, Void *));
  extern int strtopxL ANSI((CONST char *, char **, Void *));
- extern int strtord ANSI((CONST char *, char **, int, double *));
+ extern int strtord_l ANSI((CONST char *, char **, int, double *, locale_t));
  extern int strtordd ANSI((CONST char *, char **, int, double *));
  extern int strtorf ANSI((CONST char *, char **, int, float *));
- extern int strtorQ ANSI((CONST char *, char **, int, void *));
- extern int strtorx ANSI((CONST char *, char **, int, void *));
+ extern int strtorQ_l ANSI((CONST char *, char **, int, void *, locale_t));
+ extern int strtorx_l ANSI((CONST char *, char **, int, void *, locale_t));
  extern int strtorxL ANSI((CONST char *, char **, int, void *));
  extern Bigint *sum ANSI((Bigint*, Bigint*));
  extern int trailz ANSI((Bigint*));

Modified: stable/9/contrib/gdtoa/strtod.c
==============================================================================
--- stable/9/contrib/gdtoa/strtod.c	Tue May 22 13:14:21 2012	(r235784)
+++ stable/9/contrib/gdtoa/strtod.c	Tue May 22 14:40:39 2012	(r235785)
@@ -82,11 +82,11 @@ sulp
 #endif /*}*/
 
  double
-strtod
+strtod_l
 #ifdef KR_headers
-	(s00, se) CONST char *s00; char **se;
+	(s00, se, loc) CONST char *s00; char **se; locale_t loc
 #else
-	(CONST char *s00, char **se)
+	(CONST char *s00, char **se, locale_t loc)
 #endif
 {
 #ifdef Avoid_Underflow
@@ -108,14 +108,14 @@ strtod
 #endif
 #ifdef USE_LOCALE /*{{*/
 #ifdef NO_LOCALE_CACHE
-	char *decimalpoint = localeconv()->decimal_point;
+	char *decimalpoint = localeconv_l(loc)->decimal_point;
 	int dplen = strlen(decimalpoint);
 #else
 	char *decimalpoint;
 	static char *decimalpoint_cache;
 	static int dplen;
 	if (!(s0 = decimalpoint_cache)) {
-		s0 = localeconv()->decimal_point;
+		s0 = localeconv_l(loc)->decimal_point;
 		if ((decimalpoint_cache = (char*)MALLOC(strlen(s0) + 1))) {
 			strcpy(decimalpoint_cache, s0);
 			s0 = decimalpoint_cache;
@@ -1074,3 +1074,14 @@ strtod
 	return sign ? -dval(&rv) : dval(&rv);
 	}
 
+ double
+strtod
+#ifdef KR_headers
+	(s00, se, loc) CONST char *s00; char **se; locale_t
+#else
+	(CONST char *s00, char **se)
+#endif
+{
+	return strtod_l(s00, se, __get_locale());
+}
+

Modified: stable/9/contrib/gdtoa/strtodg.c
==============================================================================
--- stable/9/contrib/gdtoa/strtodg.c	Tue May 22 13:14:21 2012	(r235784)
+++ stable/9/contrib/gdtoa/strtodg.c	Tue May 22 14:40:39 2012	(r235785)
@@ -313,12 +313,12 @@ mantbits(U *d)
 	}
 
  int
-strtodg
+strtodg_l
 #ifdef KR_headers
-	(s00, se, fpi, exp, bits)
-	CONST char *s00; char **se; FPI *fpi; Long *exp; ULong *bits;
+	(s00, se, fpi, exp, bits, loc)
+	CONST char *s00; char **se; FPI *fpi; Long *exp; ULong *bits; locale_t loc;
 #else
-	(CONST char *s00, char **se, FPI *fpi, Long *exp, ULong *bits)
+	(CONST char *s00, char **se, FPI *fpi, Long *exp, ULong *bits, locale_t loc)
 #endif
 {
 	int abe, abits, asub;
@@ -334,14 +334,14 @@ strtodg
 	Bigint *ab, *bb, *bb1, *bd, *bd0, *bs, *delta, *rvb, *rvb0;
 #ifdef USE_LOCALE /*{{*/
 #ifdef NO_LOCALE_CACHE
-	char *decimalpoint = localeconv()->decimal_point;
+	char *decimalpoint = localeconv_l(loc)->decimal_point;
 	int dplen = strlen(decimalpoint);
 #else
 	char *decimalpoint;
 	static char *decimalpoint_cache;
 	static int dplen;
 	if (!(s0 = decimalpoint_cache)) {
-		s0 = localeconv()->decimal_point;
+		s0 = localeconv_l(loc)->decimal_point;
 		if ((decimalpoint_cache = (char*)MALLOC(strlen(s0) + 1))) {
 			strcpy(decimalpoint_cache, s0);
 			s0 = decimalpoint_cache;

Modified: stable/9/contrib/gdtoa/strtof.c
==============================================================================
--- stable/9/contrib/gdtoa/strtof.c	Tue May 22 13:14:21 2012	(r235784)
+++ stable/9/contrib/gdtoa/strtof.c	Tue May 22 14:40:39 2012	(r235785)
@@ -35,9 +35,9 @@ THIS SOFTWARE.
 
  float
 #ifdef KR_headers
-strtof(s, sp) CONST char *s; char **sp;
+strtof_l(s, sp, loc) CONST char *s; char **sp; locale_t loc;
 #else
-strtof(CONST char *s, char **sp)
+strtof_l(CONST char *s, char **sp, locale_t loc)
 #endif
 {
 	static FPI fpi0 = { 24, 1-127-24+1,  254-127-24+1, 1, SI };
@@ -51,7 +51,7 @@ strtof(CONST char *s, char **sp)
 #define fpi &fpi0
 #endif
 
-	k = strtodg(s, sp, fpi, &exp, bits);
+	k = strtodg_l(s, sp, fpi, &exp, bits, loc);
 	switch(k & STRTOG_Retmask) {
 	  case STRTOG_NoNumber:
 	  case STRTOG_Zero:
@@ -82,3 +82,13 @@ strtof(CONST char *s, char **sp)
 		u.L[0] |= 0x80000000L;
 	return u.f;
 	}
+ float
+#ifdef KR_headers
+strtof(s, sp) CONST char *s; char **sp;
+#else
+strtof(CONST char *s, char **sp)
+#endif
+{
+	return strtof_l(s, sp, __get_locale());
+}
+

Modified: stable/9/contrib/gdtoa/strtorQ.c
==============================================================================
--- stable/9/contrib/gdtoa/strtorQ.c	Tue May 22 13:14:21 2012	(r235784)
+++ stable/9/contrib/gdtoa/strtorQ.c	Tue May 22 14:40:39 2012	(r235785)
@@ -103,9 +103,10 @@ ULtoQ(ULong *L, ULong *bits, Long exp, i
 
  int
 #ifdef KR_headers
-strtorQ(s, sp, rounding, L) CONST char *s; char **sp; int rounding; void *L;
+strtorQ_l(s, sp, rounding, L, locale) CONST char *s; char **sp; int rounding;
+void *L; locale_t locale;
 #else
-strtorQ(CONST char *s, char **sp, int rounding, void *L)
+strtorQ_l(CONST char *s, char **sp, int rounding, void *L, locale_t locale)
 #endif
 {
 	static FPI fpi0 = { 113, 1-16383-113+1, 32766-16383-113+1, 1, SI };
@@ -120,7 +121,7 @@ strtorQ(CONST char *s, char **sp, int ro
 		fpi1.rounding = rounding;
 		fpi = &fpi1;
 		}
-	k = strtodg(s, sp, fpi, &exp, bits);
+	k = strtodg_l(s, sp, fpi, &exp, bits, locale);
 	ULtoQ((ULong*)L, bits, exp, k);
 	return k;
 	}

Modified: stable/9/contrib/gdtoa/strtord.c
==============================================================================
--- stable/9/contrib/gdtoa/strtord.c	Tue May 22 13:14:21 2012	(r235784)
+++ stable/9/contrib/gdtoa/strtord.c	Tue May 22 14:40:39 2012	(r235785)
@@ -70,9 +70,10 @@ ULtod(ULong *L, ULong *bits, Long exp, i
 
  int
 #ifdef KR_headers
-strtord(s, sp, rounding, d) CONST char *s; char **sp; int rounding; double *d;
+strtord_l(s, sp, rounding, d, locale) CONST char *s; char **sp; int rounding;
+double *d; locale_t locale;
 #else
-strtord(CONST char *s, char **sp, int rounding, double *d)
+strtord_l(CONST char *s, char **sp, int rounding, double *d, locale_t locale)
 #endif
 {
 	static FPI fpi0 = { 53, 1-1023-53+1, 2046-1023-53+1, 1, SI };
@@ -87,7 +88,8 @@ strtord(CONST char *s, char **sp, int ro
 		fpi1.rounding = rounding;
 		fpi = &fpi1;
 		}
-	k = strtodg(s, sp, fpi, &exp, bits);
+	k = strtodg_l(s, sp, fpi, &exp, bits, locale);
 	ULtod((ULong*)d, bits, exp, k);
 	return k;
 	}
+

Modified: stable/9/contrib/gdtoa/strtorx.c
==============================================================================
--- stable/9/contrib/gdtoa/strtorx.c	Tue May 22 13:14:21 2012	(r235784)
+++ stable/9/contrib/gdtoa/strtorx.c	Tue May 22 14:40:39 2012	(r235785)
@@ -106,9 +106,10 @@ ULtox(UShort *L, ULong *bits, Long exp, 
 
  int
 #ifdef KR_headers
-strtorx(s, sp, rounding, L) CONST char *s; char **sp; int rounding; void *L;
+strtorx_l(s, sp, rounding, L, locale) CONST char *s; char **sp; int rounding;
+void *L; locale_t locale;
 #else
-strtorx(CONST char *s, char **sp, int rounding, void *L)
+strtorx_l(CONST char *s, char **sp, int rounding, void *L, locale_t locale)
 #endif
 {
 	static FPI fpi0 = { 64, 1-16383-64+1, 32766 - 16383 - 64 + 1, 1, SI };
@@ -123,7 +124,7 @@ strtorx(CONST char *s, char **sp, int ro
 		fpi1.rounding = rounding;
 		fpi = &fpi1;
 		}
-	k = strtodg(s, sp, fpi, &exp, bits);
+	k = strtodg_l(s, sp, fpi, &exp, bits, locale);
 	ULtox((UShort*)L, bits, exp, k);
 	return k;
 	}

Modified: stable/9/etc/mtree/BSD.include.dist
==============================================================================
--- stable/9/etc/mtree/BSD.include.dist	Tue May 22 13:14:21 2012	(r235784)
+++ stable/9/etc/mtree/BSD.include.dist	Tue May 22 14:40:39 2012	(r235785)
@@ -325,4 +325,6 @@
     ..
     vm
     ..
+    xlocale
+    ..
 ..

Modified: stable/9/include/Makefile
==============================================================================
--- stable/9/include/Makefile	Tue May 22 13:14:21 2012	(r235784)
+++ stable/9/include/Makefile	Tue May 22 14:40:39 2012	(r235785)
@@ -6,7 +6,7 @@
 .include <bsd.own.mk>
 
 CLEANFILES= osreldate.h version vers.c
-SUBDIR= arpa gssapi protocols rpcsvc rpc
+SUBDIR= arpa gssapi protocols rpcsvc rpc xlocale
 INCS=	a.out.h ar.h assert.h bitstring.h complex.h cpio.h _ctype.h ctype.h \
 	db.h \
 	dirent.h dlfcn.h elf.h elf-hints.h err.h fmtmsg.h fnmatch.h fstab.h \
@@ -24,7 +24,7 @@ INCS=	a.out.h ar.h assert.h bitstring.h 
 	strings.h sysexits.h tar.h termios.h tgmath.h \
 	time.h timeconv.h timers.h ttyent.h \
 	ulimit.h unistd.h utime.h utmpx.h uuid.h varargs.h vis.h \
-	wchar.h wctype.h wordexp.h
+	wchar.h wctype.h wordexp.h xlocale.h
 
 MHDRS=	float.h floatingpoint.h stdarg.h
 

Modified: stable/9/include/ctype.h
==============================================================================
--- stable/9/include/ctype.h	Tue May 22 13:14:21 2012	(r235784)
+++ stable/9/include/ctype.h	Tue May 22 14:40:39 2012	(r235785)
@@ -78,6 +78,10 @@ int	isphonogram(int);
 int	isrune(int);
 int	isspecial(int);
 #endif
+
+#if __POSIX_VISIBLE >= 200809 || defined(_XLOCALE_H_)
+#include <xlocale/_ctype.h>
+#endif
 __END_DECLS
 
 #define	isalnum(c)	__sbistype((c), _CTYPE_A|_CTYPE_D)

Modified: stable/9/include/inttypes.h
==============================================================================
--- stable/9/include/inttypes.h	Tue May 22 13:14:21 2012	(r235784)
+++ stable/9/include/inttypes.h	Tue May 22 14:40:39 2012	(r235785)
@@ -45,6 +45,9 @@ typedef struct {
 } imaxdiv_t;
 
 __BEGIN_DECLS
+#ifdef _XLOCALE_H_
+#include <xlocale/_inttypes.h>
+#endif
 intmax_t	imaxabs(intmax_t) __pure2;
 imaxdiv_t	imaxdiv(intmax_t, intmax_t) __pure2;
 

Modified: stable/9/include/langinfo.h
==============================================================================
--- stable/9/include/langinfo.h	Tue May 22 13:14:21 2012	(r235784)
+++ stable/9/include/langinfo.h	Tue May 22 14:40:39 2012	(r235785)
@@ -130,6 +130,10 @@ typedef	__nl_item	nl_item;
 
 __BEGIN_DECLS
 char	*nl_langinfo(nl_item);
+
+#if __POSIX_VISIBLE >= 200809 || defined(_XLOCALE_H_)
+#include <xlocale/_langinfo.h>
+#endif
 __END_DECLS
 
 #endif /* !_LANGINFO_H_ */

Modified: stable/9/include/locale.h
==============================================================================
--- stable/9/include/locale.h	Tue May 22 13:14:21 2012	(r235784)
+++ stable/9/include/locale.h	Tue May 22 14:40:39 2012	(r235785)
@@ -77,6 +77,11 @@ struct lconv {
 __BEGIN_DECLS
 struct lconv	*localeconv(void);
 char		*setlocale(int, const char *);
+
+#if __POSIX_VISIBLE >= 200809
+#include <xlocale/_locale.h>
+#endif
 __END_DECLS
 
+
 #endif /* _LOCALE_H_ */

Modified: stable/9/include/monetary.h
==============================================================================
--- stable/9/include/monetary.h	Tue May 22 13:14:21 2012	(r235784)
+++ stable/9/include/monetary.h	Tue May 22 14:40:39 2012	(r235785)
@@ -43,6 +43,9 @@ typedef	__ssize_t	ssize_t;
 #endif
 
 __BEGIN_DECLS
+#ifdef _XLOCALE_H_
+#include <xlocale/_monetary.h>
+#endif
 ssize_t	strfmon(char * __restrict, size_t, const char * __restrict, ...);
 __END_DECLS
 

Modified: stable/9/include/runetype.h
==============================================================================
--- stable/9/include/runetype.h	Tue May 22 13:14:21 2012	(r235784)
+++ stable/9/include/runetype.h	Tue May 22 14:40:39 2012	(r235785)
@@ -83,8 +83,24 @@ typedef struct {
 } _RuneLocale;
 
 #define	_RUNE_MAGIC_1	"RuneMagi"	/* Indicates version 0 of RuneLocale */
+__BEGIN_DECLS
+extern const _RuneLocale _DefaultRuneLocale;
+extern const _RuneLocale *_CurrentRuneLocale;
+#if defined(__NO_TLS) || defined(__RUNETYPE_INTERNAL)
+extern const _RuneLocale *__getCurrentRuneLocale(void);
+#else
+extern _Thread_local const _RuneLocale *_ThreadRuneLocale;
+static __inline const _RuneLocale *__getCurrentRuneLocale(void)
+{
 
-extern _RuneLocale _DefaultRuneLocale;
-extern _RuneLocale *_CurrentRuneLocale;
+	if (_ThreadRuneLocale) 
+		return _ThreadRuneLocale;
+	if (_CurrentRuneLocale) 
+		return _CurrentRuneLocale;
+	return &_DefaultRuneLocale;
+}
+#endif /* __NO_TLS || __RUNETYPE_INTERNAL */
+#define _CurrentRuneLocale (__getCurrentRuneLocale())
+__END_DECLS
 
 #endif	/* !_RUNETYPE_H_ */

Modified: stable/9/include/stdio.h
==============================================================================
--- stable/9/include/stdio.h	Tue May 22 13:14:21 2012	(r235784)
+++ stable/9/include/stdio.h	Tue May 22 14:40:39 2012	(r235785)
@@ -107,7 +107,7 @@ struct __sbuf {
  * inline functions.  To preserve ABI compat, these members must not
  * be disturbed.  These members are marked below with (*).
  */
-typedef	struct __sFILE {
+struct __sFILE {
 	unsigned char *_p;	/* (*) current position in (some) buffer */
 	int	_r;		/* (*) read space left for getc() */
 	int	_w;		/* (*) write space left for putc() */
@@ -144,8 +144,11 @@ typedef	struct __sFILE {
 	int	_fl_count;	/* recursive lock count */
 	int	_orientation;	/* orientation for fwide() */
 	__mbstate_t _mbstate;	/* multibyte conversion state */
-} FILE;
-
+};
+#ifndef _STDFILE_DECLARED
+#define _STDFILE_DECLARED
+typedef struct __sFILE FILE;
+#endif
 #ifndef _STDSTREAM_DECLARED
 __BEGIN_DECLS
 extern FILE *__stdinp;
@@ -222,6 +225,9 @@ __END_DECLS
 #define	stderr	__stderrp
 
 __BEGIN_DECLS
+#ifdef _XLOCALE_H_
+#include <xlocale/_stdio.h>
+#endif
 /*
  * Functions defined in ANSI C standard.
  */
@@ -468,12 +474,15 @@ static __inline int __sputc(int _c, FILE
 		(*(p)->_p = (c), (int)*(p)->_p++))
 #endif
 
+extern int __isthreaded;
+
+#ifndef __cplusplus
+
 #define	__sfeof(p)	(((p)->_flags & __SEOF) != 0)
 #define	__sferror(p)	(((p)->_flags & __SERR) != 0)
 #define	__sclearerr(p)	((void)((p)->_flags &= ~(__SERR|__SEOF)))
 #define	__sfileno(p)	((p)->_file)
 
-extern int __isthreaded;
 
 #define	feof(p)		(!__isthreaded ? __sfeof(p) : (feof)(p))
 #define	ferror(p)	(!__isthreaded ? __sferror(p) : (ferror)(p))
@@ -506,6 +515,7 @@ extern int __isthreaded;
 #define	getchar_unlocked()	getc_unlocked(stdin)
 #define	putchar_unlocked(x)	putc_unlocked(x, stdout)
 #endif
+#endif /* __cplusplus */
 
 __END_DECLS
 #endif /* !_STDIO_H_ */

Modified: stable/9/include/stdlib.h
==============================================================================
--- stable/9/include/stdlib.h	Tue May 22 13:14:21 2012	(r235784)
+++ stable/9/include/stdlib.h	Tue May 22 14:40:39 2012	(r235785)
@@ -71,10 +71,14 @@ typedef struct {
 
 #define	RAND_MAX	0x7fffffff
 
+__BEGIN_DECLS
+#ifdef _XLOCALE_H_
+#include <xlocale/_stdlib.h>
+#endif
 extern int __mb_cur_max;
-#define	MB_CUR_MAX	__mb_cur_max
+extern int ___mb_cur_max(void);
+#define	MB_CUR_MAX	(___mb_cur_max())
 
-__BEGIN_DECLS
 void	 abort(void) __dead2;
 int	 abs(int) __pure2;
 int	 atexit(void (*)(void));

Modified: stable/9/include/string.h
==============================================================================
--- stable/9/include/string.h	Tue May 22 13:14:21 2012	(r235784)
+++ stable/9/include/string.h	Tue May 22 14:40:39 2012	(r235785)
@@ -132,6 +132,10 @@ void	 swab(const void * __restrict, void
 #endif /* _SWAB_DECLARED */
 
 #endif /* __BSD_VISIBLE */
+
+#if __POSIX_VISIBLE >= 200809 || defined(_XLOCALE_H_)
+#include <xlocale/_string.h>
+#endif
 __END_DECLS
 
 #endif /* _STRING_H_ */

Modified: stable/9/include/time.h
==============================================================================
--- stable/9/include/time.h	Tue May 22 13:14:21 2012	(r235784)
+++ stable/9/include/time.h	Tue May 22 14:40:39 2012	(r235785)
@@ -183,6 +183,10 @@ void tzsetwall(void);
 time_t timelocal(struct tm * const);
 time_t timegm(struct tm * const);
 #endif /* __BSD_VISIBLE */
+
+#if __POSIX_VISIBLE >= 200809 || defined(_XLOCALE_H_)
+#include <xlocale/_time.h>
+#endif
 __END_DECLS
 
 #endif /* !_TIME_H_ */

Modified: stable/9/include/wchar.h
==============================================================================
--- stable/9/include/wchar.h	Tue May 22 13:14:21 2012	(r235784)
+++ stable/9/include/wchar.h	Tue May 22 14:40:39 2012	(r235785)
@@ -97,20 +97,23 @@ typedef	__wint_t	wint_t;
 #define	WEOF 	((wint_t)-1)
 #endif
 
-struct __sFILE;
+#ifndef _STDFILE_DECLARED
+#define _STDFILE_DECLARED
+typedef struct __sFILE FILE;
+#endif
 struct tm;
 
 __BEGIN_DECLS
 wint_t	btowc(int);
-wint_t	fgetwc(struct __sFILE *);
+wint_t	fgetwc(FILE *);
 wchar_t	*
-	fgetws(wchar_t * __restrict, int, struct __sFILE * __restrict);
-wint_t	fputwc(wchar_t, struct __sFILE *);
-int	fputws(const wchar_t * __restrict, struct __sFILE * __restrict);
-int	fwide(struct __sFILE *, int);
-int	fwprintf(struct __sFILE * __restrict, const wchar_t * __restrict, ...);
-int	fwscanf(struct __sFILE * __restrict, const wchar_t * __restrict, ...);
-wint_t	getwc(struct __sFILE *);
+	fgetws(wchar_t * __restrict, int, FILE * __restrict);
+wint_t	fputwc(wchar_t, FILE *);
+int	fputws(const wchar_t * __restrict, FILE * __restrict);
+int	fwide(FILE *, int);
+int	fwprintf(FILE * __restrict, const wchar_t * __restrict, ...);
+int	fwscanf(FILE * __restrict, const wchar_t * __restrict, ...);
+wint_t	getwc(FILE *);
 wint_t	getwchar(void);
 size_t	mbrlen(const char * __restrict, size_t, mbstate_t * __restrict);
 size_t	mbrtowc(wchar_t * __restrict, const char * __restrict, size_t,
@@ -118,13 +121,13 @@ size_t	mbrtowc(wchar_t * __restrict, con
 int	mbsinit(const mbstate_t *);
 size_t	mbsrtowcs(wchar_t * __restrict, const char ** __restrict, size_t,
 	    mbstate_t * __restrict);
-wint_t	putwc(wchar_t, struct __sFILE *);
+wint_t	putwc(wchar_t, FILE *);
 wint_t	putwchar(wchar_t);
 int	swprintf(wchar_t * __restrict, size_t n, const wchar_t * __restrict,
 	    ...);
 int	swscanf(const wchar_t * __restrict, const wchar_t * __restrict, ...);
-wint_t	ungetwc(wint_t, struct __sFILE *);
-int	vfwprintf(struct __sFILE * __restrict, const wchar_t * __restrict,
+wint_t	ungetwc(wint_t, FILE *);
+int	vfwprintf(FILE * __restrict, const wchar_t * __restrict,
 	    __va_list);
 int	vswprintf(wchar_t * __restrict, size_t n, const wchar_t * __restrict,
 	    __va_list);
@@ -167,9 +170,9 @@ int	wprintf(const wchar_t * __restrict, 
 int	wscanf(const wchar_t * __restrict, ...);
 
 #ifndef _STDSTREAM_DECLARED
-extern struct __sFILE *__stdinp;
-extern struct __sFILE *__stdoutp;
-extern struct __sFILE *__stderrp;
+extern FILE *__stdinp;
+extern FILE *__stdoutp;
+extern FILE *__stderrp;
 #define	_STDSTREAM_DECLARED
 #endif
 
@@ -179,7 +182,7 @@ extern struct __sFILE *__stderrp;
 #define	putwchar(wc)	fputwc(wc, __stdoutp)
 
 #if __ISO_C_VISIBLE >= 1999
-int	vfwscanf(struct __sFILE * __restrict, const wchar_t * __restrict,
+int	vfwscanf(FILE * __restrict, const wchar_t * __restrict,
 	    __va_list);
 int	vswscanf(const wchar_t * __restrict, const wchar_t * __restrict,
 	    __va_list);
@@ -217,10 +220,14 @@ size_t	wcsnrtombs(char * __restrict, con
 #endif
 
 #if __BSD_VISIBLE
-wchar_t	*fgetwln(struct __sFILE * __restrict, size_t * __restrict);
+wchar_t	*fgetwln(FILE * __restrict, size_t * __restrict);
 size_t	wcslcat(wchar_t *, const wchar_t *, size_t);
 size_t	wcslcpy(wchar_t *, const wchar_t *, size_t);
 #endif
+
+#if __POSIX_VISIBLE >= 200809 || defined(_XLOCALE_H_)
+#include <xlocale/_wchar.h>
+#endif
 __END_DECLS
 
 #endif /* !_WCHAR_H_ */

Modified: stable/9/include/wctype.h
==============================================================================
--- stable/9/include/wctype.h	Tue May 22 13:14:21 2012	(r235784)
+++ stable/9/include/wctype.h	Tue May 22 14:40:39 2012	(r235785)
@@ -87,6 +87,11 @@ wint_t	iswrune(wint_t);
 wint_t	iswspecial(wint_t);
 wint_t	nextwctype(wint_t, wctype_t);
 #endif
+
+#if __POSIX_VISIBLE >= 200809
+#define _XLOCALE_WCTYPES 1
+#include <xlocale/_ctype.h>
+#endif /* __POSIX_VISIBLE >= 200809 */
 __END_DECLS
 
 #define	iswalnum(wc)		__istype((wc), _CTYPE_A|_CTYPE_D)

Copied and modified: stable/9/include/xlocale.h (from r227753, head/include/xlocale.h)
==============================================================================
--- head/include/xlocale.h	Sun Nov 20 14:45:42 2011	(r227753, copy source)
+++ stable/9/include/xlocale.h	Tue May 22 14:40:39 2012	(r235785)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2011 The FreeBSD Foundation
+ * Copyright (c) 2011, 2012 The FreeBSD Foundation
  * All rights reserved.
  *
  * This software was developed by David Chisnall under sponsorship from
@@ -8,16 +8,16 @@
  * 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.
+ * 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
+ * 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)
@@ -33,225 +33,52 @@
 #define _XLOCALE_H_
 
 #include <locale.h>
-
 __BEGIN_DECLS
+#include <xlocale/_locale.h>
 
-/*
- * Extended locale versions of the locale-aware functions from string.h.
- *
- * Include <string.h> before <xlocale.h> to expose these.
- */
 #ifdef _STRING_H_
-int	 strcoll_l(const char *, const char *, locale_t);
-size_t	 strxfrm_l(char *, const char *, size_t, locale_t);
-int	 strcasecmp_l(const char *, const char *, locale_t);
-char	*strcasestr_l(const char *, const char *, locale_t);
-int	 strncasecmp_l(const char *, const char *, size_t, locale_t);
+#include <xlocale/_string.h>
 #endif
-/*
- * Extended locale versions of the locale-aware functions from inttypes.h.
- *
- * Include <inttypes.h> before <xlocale.h> to expose these.
- */
+
 #ifdef _INTTYPES_H_
-intmax_t 
-strtoimax_l(const char * __restrict, char ** __restrict, int, locale_t);
-uintmax_t
-strtoumax_l(const char * __restrict, char ** __restrict, int, locale_t);
-intmax_t 
-wcstoimax_l(const wchar_t * __restrict, wchar_t ** __restrict, int , locale_t);
-uintmax_t
-wcstoumax_l(const wchar_t * __restrict, wchar_t ** __restrict, int, locale_t);
+#include <xlocale/_inttypes.h>
 #endif
-/*
- * Extended locale versions of the locale-aware functions from monetary.h.
- *
- * Include <monetary.h> before <xlocale.h> to expose these.
- */
+
 #ifdef _MONETARY_H_
-ssize_t strfmon_l(char *, size_t, locale_t, const char *, ...)
-#	if __GNUC__ > 2 || __GNUC__ == 2 && __GNUC_MINOR__ >= 7
-	__attribute__((__format__ (__strfmon__, 4, 5)))
-#	endif
-	;
+#include <xlocale/_monetary.h>
 #endif
 
-/*
- * Extended locale versions of the locale-aware functions from stdlib.h.
- *
- * Include <stdlib.h> before <xlocale.h> to expose these.
- */
 #ifdef _STDLIB_H_
-double	 atof_l(const char *, locale_t);
-int	 atoi_l(const char *, locale_t);
-long	 atol_l(const char *, locale_t);
-long long	 atoll_l(const char *, locale_t);
-int	 mblen_l(const char *, size_t, locale_t);
-size_t
-mbstowcs_l(wchar_t * __restrict, const char * __restrict, size_t, locale_t);
-int
-mbtowc_l(wchar_t * __restrict, const char * __restrict, size_t, locale_t);
-double	 strtod_l(const char *, char **, locale_t);
-float	 strtof_l(const char *, char **, locale_t);
-long	 strtol_l(const char *, char **, int, locale_t);
-long	 double strtold_l(const char *, char **, locale_t);
-long long	 strtoll_l(const char *, char **, int, locale_t);
-unsigned long	 strtoul_l(const char *, char **, int, locale_t);
-unsigned long long	 strtoull_l(const char *, char **, int, locale_t);
-size_t
-wcstombs_l(char * __restrict, const wchar_t * __restrict, size_t, locale_t);
-int	 wctomb_l(char *, wchar_t, locale_t);
-
-int	 ___mb_cur_max_l(locale_t);
-#define MB_CUR_MAX_L(x) (___mb_cur_max_l(x))
-
+#include <xlocale/_stdlib.h>
 #endif
-/*
- * Extended locale versions of the locale-aware functions from time.h.
- *
- * Include <time.h> before <xlocale.h> to expose these.
- */
+
 #ifdef _TIME_H_
-size_t
-strftime_l(char * __restrict, size_t, const char * __restrict, const
-           struct tm * __restrict, locale_t)
-#	if __GNUC__ > 2 || __GNUC__ == 2 && __GNUC_MINOR__ >= 7
-	__attribute__((__format__ (__strftime__, 3, 0)))
-#	endif
-	;
-char *
-strptime_l(const char * __restrict, const char * __restrict,
-           struct tm * __restrict, locale_t);
+#include <xlocale/_time.h>
 #endif
+
 #ifdef _LANGINFO_H_
-char	*nl_langinfo_l(nl_item, locale_t);
+#include <xlocale/_langinfo.h>
 #endif
+
 #ifdef _CTYPE_H_
-#include <_xlocale_ctype.h>
+#include <xlocale/_ctype.h>
 #endif
+
 #ifdef _WCTYPE_H_
-#define XLOCALE_WCTYPES 1
-#include <_xlocale_ctype.h>
+#define _XLOCALE_WCTYPES 1
+#include <xlocale/_ctype.h>
 #endif
 
 #ifdef _STDIO_H_
-int	 fprintf_l(FILE * __restrict, locale_t, const char * __restrict, ...)
-		__printflike(3, 4);
-int	 fscanf_l(FILE * __restrict, locale_t, const char * __restrict, ...)
-		__scanflike(3, 4);
-int	 printf_l(locale_t, const char * __restrict, ...) __printflike(2, 3);
-int	 scanf_l(locale_t, const char * __restrict, ...) __scanflike(2, 3);
-int	 sprintf_l(char * __restrict, locale_t, const char * __restrict, ...)
-		__printflike(3, 4);
-int	 sscanf_l(const char * __restrict, locale_t, const char * __restrict, ...)
-		__scanflike(3, 4);
-int	 vfprintf_l(FILE * __restrict, locale_t, const char * __restrict, __va_list)
-		__printflike(3, 0);
-int	 vprintf_l(locale_t, const char * __restrict, __va_list) __printflike(2, 0);
-int	 vsprintf_l(char * __restrict, locale_t, const char * __restrict, __va_list)
-		__printflike(3, 0);
-
-int	 snprintf_l(char * __restrict, size_t, locale_t, const char * __restrict,
-		...) __printflike(4, 5);
-int	 vfscanf_l(FILE * __restrict, locale_t, const char * __restrict, __va_list)
-		__scanflike(3, 0);
-int	 vscanf_l(locale_t, const char * __restrict, __va_list) __scanflike(2, 0);
-int	 vsnprintf_l(char * __restrict, size_t, locale_t, const char * __restrict,
-		va_list) __printflike(4, 0);
-int	 vsscanf_l(const char * __restrict, locale_t, const char * __restrict,
-		va_list) __scanflike(3, 0);
-int	 dprintf_l(int, locale_t, const char * __restrict, ...) __printflike(3, 4);
-int	 vdprintf_l(int, locale_t, const char * __restrict, __va_list)
-		__printflike(3, 0);
-int	 asprintf_l(char **, locale_t, const char *, ...) __printflike(3, 4);
-int	 vasprintf_l(char **, locale_t, const char *, __va_list) __printflike(3, 0);
+#include <xlocale/_stdio.h>
 #endif
-#ifdef _WCHAR_H_
-wint_t	 btowc_l(int, locale_t);
-wint_t	 fgetwc_l(FILE *, locale_t);
-wchar_t *
-fgetws_l(wchar_t * __restrict, int, FILE * __restrict, locale_t);
-wint_t	 fputwc_l(wchar_t, FILE *, locale_t);
-int
-fputws_l(const wchar_t * __restrict, FILE * __restrict, locale_t);
-int
-fwprintf_l(FILE * __restrict, locale_t, const wchar_t * __restrict,
-		...);
-int
-fwscanf_l(FILE * __restrict, locale_t, const wchar_t * __restrict, ...);
-wint_t	 getwc_l(FILE *, locale_t);
-wint_t	 getwchar_l(locale_t);
-size_t
-mbrlen_l(const char * __restrict, size_t, mbstate_t * __restrict, locale_t);
-size_t
-mbrtowc_l(wchar_t * __restrict, const char * __restrict, size_t,
-		mbstate_t * __restrict, locale_t);
-int	 mbsinit_l(const mbstate_t *, locale_t);
-size_t
-mbsrtowcs_l(wchar_t * __restrict, const char ** __restrict, size_t,
-		mbstate_t * __restrict, locale_t);
-wint_t	 putwc_l(wchar_t, FILE *, locale_t);
-wint_t	 putwchar_l(wchar_t, locale_t);
-int
-swprintf_l(wchar_t * __restrict, size_t n, locale_t,
-		const wchar_t * __restrict, ...);
-int
-swscanf_l(const wchar_t * __restrict, locale_t, const wchar_t * __restrict,
-		...);
-wint_t	 ungetwc_l(wint_t, FILE *, locale_t);
-int
-vfwprintf_l(FILE * __restrict, locale_t, const wchar_t * __restrict,
-		__va_list);
-int
-vswprintf_l(wchar_t * __restrict, size_t n, locale_t,
-		const wchar_t * __restrict, __va_list);
-int	 vwprintf_l(locale_t, const wchar_t * __restrict, __va_list);
-size_t
-wcrtomb_l(char * __restrict, wchar_t, mbstate_t * __restrict, locale_t);
-int	 wcscoll_l(const wchar_t *, const wchar_t *, locale_t);
-size_t
-wcsftime_l(wchar_t * __restrict, size_t, const wchar_t * __restrict,
-		const struct tm * __restrict, locale_t);
-size_t 
-wcsrtombs_l(char * __restrict, const wchar_t ** __restrict, size_t,
-		mbstate_t * __restrict, locale_t);
-double	 wcstod_l(const wchar_t * __restrict, wchar_t ** __restrict, locale_t);
-long
-wcstol_l(const wchar_t * __restrict, wchar_t ** __restrict, int, locale_t);
-unsigned long
-wcstoul_l(const wchar_t * __restrict, wchar_t ** __restrict, int, locale_t);
-int	 wcswidth_l(const wchar_t *, size_t, locale_t);
-size_t
-wcsxfrm_l(wchar_t * __restrict, const wchar_t * __restrict, size_t, locale_t);
-int	 wctob_l(wint_t, locale_t);
-int	 wcwidth_l(wchar_t, locale_t);
-int	 wprintf_l(locale_t, const wchar_t * __restrict, ...);
-int	 wscanf_l(locale_t, const wchar_t * __restrict, ...);
-
-int
-vfwscanf_l(FILE * __restrict, locale_t, const wchar_t * __restrict,
-		__va_list);
-int	 vswscanf_l(const wchar_t * __restrict, locale_t,
-const wchar_t	*__restrict, __va_list);
-int	 vwscanf_l(locale_t, const wchar_t * __restrict, __va_list);
-float 	wcstof_l(const wchar_t * __restrict, wchar_t ** __restrict, locale_t);
-long double
-wcstold_l(const wchar_t * __restrict, wchar_t ** __restrict, locale_t);
-long long
-wcstoll_l(const wchar_t * __restrict, wchar_t ** __restrict, int, locale_t);
-unsigned long long
-wcstoull_l(const wchar_t * __restrict, wchar_t ** __restrict, int, locale_t);
-size_t
-mbsnrtowcs_l(wchar_t * __restrict, const char ** __restrict, size_t, size_t,
-		mbstate_t * __restrict, locale_t);
-int	 wcscasecmp_l(const wchar_t *, const wchar_t *, locale_t);
-int	 wcsncasecmp_l(const wchar_t *, const wchar_t *, size_t, locale_t);
-size_t
-wcsnrtombs_l(char * __restrict, const wchar_t ** __restrict, size_t, size_t,
-		mbstate_t * __restrict, locale_t);
 
+#ifdef _WCHAR_H_
+#include <xlocale/_wchar.h>
 #endif
 
+
+
 struct lconv	*localeconv_l(locale_t);
 __END_DECLS
 

Modified: stable/9/include/xlocale/_ctype.h
==============================================================================
--- head/include/xlocale/_ctype.h	Sun Mar  4 15:31:13 2012	(r232498)
+++ stable/9/include/xlocale/_ctype.h	Tue May 22 14:40:39 2012	(r235785)
@@ -55,11 +55,11 @@ _RuneLocale	*__runes_for_locale(locale_t
 #ifndef _XLOCALE_INLINE
 #if __GNUC__ && !__GNUC_STDC_INLINE__
 /* GNU89 inline has nonstandard semantics. */
-#define _XLOCALE_INLINE extern inline
+#define _XLOCALE_INLINE extern __inline
 #else
 /* Hack to work around people who define inline away */
 #ifdef inline
-#define _XLOCALE_INLINE __inline static
+#define _XLOCALE_INLINE static __inline
 #else
 /* Define with C++ / C99 compatible semantics */
 #define _XLOCALE_INLINE inline
@@ -68,19 +68,24 @@ _RuneLocale	*__runes_for_locale(locale_t
 #endif /* _XLOCALE_INLINE */
 
 #ifdef _XLOCALE_WCTYPES
-static __inline int
-__maskrune_l(__ct_rune_t _c, unsigned long _f, locale_t locale)
+_XLOCALE_INLINE int
+__maskrune_l(__ct_rune_t __c, unsigned long __f, locale_t __loc);
+_XLOCALE_INLINE int
+__istype_l(__ct_rune_t __c, unsigned long __f, locale_t __loc);
+
+_XLOCALE_INLINE int
+__maskrune_l(__ct_rune_t __c, unsigned long __f, locale_t __loc)
 {
-	int mb_sb_limit;
-	_RuneLocale *runes = __runes_for_locale(locale, &mb_sb_limit);
-	return (_c < 0 || _c >= _CACHED_RUNES) ? ___runetype_l(_c, locale) :
-	       runes->__runetype[_c] & _f;
+	int __limit;
+	_RuneLocale *runes = __runes_for_locale(__loc, &__limit);
+	return ((__c < 0 || __c >= _CACHED_RUNES) ? ___runetype_l(__c, __loc) :
+	        runes->__runetype[__c]) & __f;
 }
 
-static __inline int
-__istype_l(__ct_rune_t _c, unsigned long _f, locale_t locale)
+_XLOCALE_INLINE int
+__istype_l(__ct_rune_t __c, unsigned long __f, locale_t __loc)
 {
-	return (!!__maskrune_l(_c, _f, locale));
+	return (!!__maskrune_l(__c, __f, __loc));
 }
 
 #define XLOCALE_ISCTYPE(fname, cat) \
@@ -88,25 +93,30 @@ __istype_l(__ct_rune_t _c, unsigned long
 		_XLOCALE_INLINE int isw##fname##_l(int __c, locale_t __l)\
 		{ return __istype_l(__c, cat, __l); }
 #else
-static __inline int
-__sbmaskrune_l(__ct_rune_t _c, unsigned long _f, locale_t locale)
+_XLOCALE_INLINE int
+__sbmaskrune_l(__ct_rune_t __c, unsigned long __f, locale_t __loc);
+_XLOCALE_INLINE int
+__sbistype_l(__ct_rune_t __c, unsigned long __f, locale_t __loc);
+
+_XLOCALE_INLINE int
+__sbmaskrune_l(__ct_rune_t __c, unsigned long __f, locale_t __loc)
 {
-	int mb_sb_limit;
-	_RuneLocale *runes = __runes_for_locale(locale, &mb_sb_limit);
-	return (_c < 0 || _c >= mb_sb_limit) ? 0 :
-	       runes->__runetype[_c] & _f;
+	int __limit;
+	_RuneLocale *runes = __runes_for_locale(__loc, &__limit);
+	return (__c < 0 || __c >= __limit) ? 0 :
+	       runes->__runetype[__c] & __f;
 }
 
-static __inline int
-__sbistype_l(__ct_rune_t _c, unsigned long _f, locale_t locale)
+_XLOCALE_INLINE int
+__sbistype_l(__ct_rune_t __c, unsigned long __f, locale_t __loc)
 {
-	return (!!__sbmaskrune_l(_c, _f, locale));
+	return (!!__sbmaskrune_l(__c, __f, __loc));
 }
 
-#define XLOCALE_ISCTYPE(fname, cat) \
-		_XLOCALE_INLINE int is##fname##_l(int c, locale_t l); \
-		_XLOCALE_INLINE int is##fname##_l(int c, locale_t l)\
-		{ return __sbistype_l(c, cat, l); }
+#define XLOCALE_ISCTYPE(__fname, __cat) \
+		_XLOCALE_INLINE int is##__fname##_l(int, locale_t); \
+		_XLOCALE_INLINE int is##__fname##_l(int __c, locale_t __l)\
+		{ return __sbistype_l(__c, __cat, __l); }
 #endif
 
 XLOCALE_ISCTYPE(alnum, _CTYPE_A|_CTYPE_D)
@@ -136,15 +146,15 @@ _XLOCALE_INLINE int towupper_l(int, loca
 
 _XLOCALE_INLINE int towlower_l(int __c, locale_t __l)
 {
-	int mb_sb_limit;
-	_RuneLocale *__runes = __runes_for_locale(__l, &mb_sb_limit);
+	int __limit;
+	_RuneLocale *__runes = __runes_for_locale(__l, &__limit);
 	return (__c < 0 || __c >= _CACHED_RUNES) ? ___tolower_l(__c, __l) :
 	       __runes->__maplower[__c];
 }
 _XLOCALE_INLINE int towupper_l(int __c, locale_t __l)
 {
-	int mb_sb_limit;
-	_RuneLocale *__runes = __runes_for_locale(__l, &mb_sb_limit);
+	int __limit;
+	_RuneLocale *__runes = __runes_for_locale(__l, &__limit);
 	return (__c < 0 || __c >= _CACHED_RUNES) ? ___toupper_l(__c, __l) :
 	       __runes->__mapupper[__c];
 }

Modified: stable/9/lib/libc/gdtoa/machdep_ldisQ.c
==============================================================================
--- stable/9/lib/libc/gdtoa/machdep_ldisQ.c	Tue May 22 13:14:21 2012	(r235784)
+++ stable/9/lib/libc/gdtoa/machdep_ldisQ.c	Tue May 22 14:40:39 2012	(r235785)
@@ -2,6 +2,11 @@
  * Copyright (c) 2003 David Schultz <das@FreeBSD.ORG>
  * All rights reserved.
  *
+ * Copyright (c) 2011 The FreeBSD Foundation
+ * All rights reserved.
+ * Portions of this software were developed by David Chisnall
+ * under sponsorship from the FreeBSD Foundation.
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
@@ -38,10 +43,10 @@ __FBSDID("$FreeBSD$");
 #include "gdtoaimp.h"
 
 long double
-strtold(const char * __restrict s, char ** __restrict sp)
+strtold_l(const char * __restrict s, char ** __restrict sp, locale_t locale)
 {
 	long double result;
 
-	strtorQ(s, sp, FLT_ROUNDS, &result);
+	strtorQ_l(s, sp, FLT_ROUNDS, &result, locale);

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

From owner-svn-src-stable-9@FreeBSD.ORG  Tue May 22 15:26:56 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 84F6C106566C;
	Tue, 22 May 2012 15:26:56 +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 6C6238FC16;
	Tue, 22 May 2012 15:26: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 q4MFQuEO009834;
	Tue, 22 May 2012 15:26:56 GMT
	(envelope-from theraven@svn.freebsd.org)
Received: (from theraven@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4MFQuUN009818;
	Tue, 22 May 2012 15:26:56 GMT
	(envelope-from theraven@svn.freebsd.org)
Message-Id: <201205221526.q4MFQuUN009818@svn.freebsd.org>
From: David Chisnall <theraven@FreeBSD.org>
Date: Tue, 22 May 2012 15:26:56 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r235786 - in stable/9: include lib/libc/stdlib
	lib/msun/src sys/sys
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 22 May 2012 15:26:56 -0000

Author: theraven
Date: Tue May 22 15:26:55 2012
New Revision: 235786
URL: http://svn.freebsd.org/changeset/base/235786

Log:
  Merge quick_exit and changes required for C++11 code to compile against FreeBSD headers.
  
  Merges changes from: r227472 r227475 r227475 r227476 r227476 r227490 r227490 r228322 r228323 r228329 r228330 r228528 r228529 r228529 r228901 r228918 r228918 r232971 r232971
  
  Also bump __FreeBSD_version for this and the xlocale merge.

Added:
  stable/9/lib/libc/stdlib/at_quick_exit.3
     - copied, changed from r228323, head/lib/libc/stdlib/at_quick_exit.3
  stable/9/lib/libc/stdlib/quick_exit.3
     - copied, changed from r228323, head/lib/libc/stdlib/quick_exit.3
  stable/9/lib/libc/stdlib/quick_exit.c
     - copied, changed from r228323, head/lib/libc/stdlib/quick_exit.c
Modified:
  stable/9/include/ctype.h
  stable/9/include/stdlib.h
  stable/9/include/wctype.h
  stable/9/lib/libc/stdlib/Makefile.inc
  stable/9/lib/libc/stdlib/Symbol.map
  stable/9/lib/libc/stdlib/atexit.3
  stable/9/lib/libc/stdlib/exit.3
  stable/9/lib/msun/src/math.h
  stable/9/sys/sys/_null.h
  stable/9/sys/sys/cdefs.h
  stable/9/sys/sys/param.h
  stable/9/sys/sys/stdint.h
Directory Properties:
  stable/9/include/   (props changed)
  stable/9/lib/libc/   (props changed)
  stable/9/lib/msun/   (props changed)
  stable/9/sys/   (props changed)

Modified: stable/9/include/ctype.h
==============================================================================
--- stable/9/include/ctype.h	Tue May 22 14:40:39 2012	(r235785)
+++ stable/9/include/ctype.h	Tue May 22 15:26:55 2012	(r235786)
@@ -84,6 +84,7 @@ int	isspecial(int);
 #endif
 __END_DECLS
 
+#ifndef __cplusplus
 #define	isalnum(c)	__sbistype((c), _CTYPE_A|_CTYPE_D)
 #define	isalpha(c)	__sbistype((c), _CTYPE_A)
 #define	iscntrl(c)	__sbistype((c), _CTYPE_C)
@@ -97,6 +98,7 @@ __END_DECLS
 #define	isxdigit(c)	__isctype((c), _CTYPE_X) /* ANSI -- locale independent */
 #define	tolower(c)	__sbtolower(c)
 #define	toupper(c)	__sbtoupper(c)
+#endif /* !__cplusplus */
 
 #if __XSI_VISIBLE
 /*
@@ -116,7 +118,7 @@ __END_DECLS
 #define	toascii(c)	((c) & 0x7F)
 #endif
 
-#if __ISO_C_VISIBLE >= 1999
+#if __ISO_C_VISIBLE >= 1999 && !defined(__cplusplus)
 #define	isblank(c)	__sbistype((c), _CTYPE_B)
 #endif
 

Modified: stable/9/include/stdlib.h
==============================================================================
--- stable/9/include/stdlib.h	Tue May 22 14:40:39 2012	(r235785)
+++ stable/9/include/stdlib.h	Tue May 22 15:26:55 2012	(r235786)
@@ -79,7 +79,7 @@ extern int __mb_cur_max;
 extern int ___mb_cur_max(void);
 #define	MB_CUR_MAX	(___mb_cur_max())
 
-void	 abort(void) __dead2;
+_Noreturn void	 abort(void);
 int	 abs(int) __pure2;
 int	 atexit(void (*)(void));
 double	 atof(const char *);
@@ -89,7 +89,7 @@ void	*bsearch(const void *, const void *
 	    size_t, int (*)(const void *, const void *));
 void	*calloc(size_t, size_t) __malloc_like;
 div_t	 div(int, int) __pure2;
-void	 exit(int) __dead2;
+_Noreturn void	 exit(int);
 void	 free(void *);
 char	*getenv(const char *);
 long	 labs(long) __pure2;
@@ -148,10 +148,18 @@ unsigned long long
 	 strtoull(const char * __restrict, char ** __restrict, int);
 #endif /* __LONG_LONG_SUPPORTED */
 
-void	 _Exit(int) __dead2;
+_Noreturn void	 _Exit(int);
 #endif /* __ISO_C_VISIBLE >= 1999 */
 
 /*
+ * If we're in a mode greater than C99, expose C1x functions.
+ */
+#if __ISO_C_VISIBLE >= 2011 || __cplusplus >= 201103L
+_Noreturn void
+	quick_exit(int);
+int	at_quick_exit(void (*)(void));
+#endif /* __ISO_C_VISIBLE >= 2011 */
+/*
  * Extensions made by POSIX relative to C.  We don't know yet which edition
  * of POSIX made these extensions, so assume they've always been there until
  * research can be done.

Modified: stable/9/include/wctype.h
==============================================================================
--- stable/9/include/wctype.h	Tue May 22 14:40:39 2012	(r235785)
+++ stable/9/include/wctype.h	Tue May 22 15:26:55 2012	(r235786)
@@ -94,6 +94,7 @@ wint_t	nextwctype(wint_t, wctype_t);
 #endif /* __POSIX_VISIBLE >= 200809 */
 __END_DECLS
 
+#ifndef __cplusplus
 #define	iswalnum(wc)		__istype((wc), _CTYPE_A|_CTYPE_D)
 #define	iswalpha(wc)		__istype((wc), _CTYPE_A)
 #define	iswblank(wc)		__istype((wc), _CTYPE_B)
@@ -118,6 +119,7 @@ __END_DECLS
 #define	iswphonogram(wc)	__istype((wc), _CTYPE_Q)
 #define	iswrune(wc)		__istype((wc), 0xFFFFFF00L)
 #define	iswspecial(wc)		__istype((wc), _CTYPE_T)
-#endif
+#endif /* __BSD_VISIBLE */
+#endif /* __cplusplus */
 
 #endif		/* _WCTYPE_H_ */

Modified: stable/9/lib/libc/stdlib/Makefile.inc
==============================================================================
--- stable/9/lib/libc/stdlib/Makefile.inc	Tue May 22 14:40:39 2012	(r235785)
+++ stable/9/lib/libc/stdlib/Makefile.inc	Tue May 22 15:26:55 2012	(r235786)
@@ -8,8 +8,8 @@ MISRCS+=_Exit.c a64l.c abort.c abs.c ate
 	bsearch.c div.c exit.c getenv.c getopt.c getopt_long.c \
 	getsubopt.c hcreate.c heapsort.c imaxabs.c imaxdiv.c \
 	insque.c l64a.c labs.c ldiv.c llabs.c lldiv.c lsearch.c malloc.c \
-	merge.c ptsname.c qsort.c qsort_r.c radixsort.c rand.c random.c \
-	reallocf.c realpath.c remque.c strfmon.c strtoimax.c \
+	merge.c ptsname.c qsort.c qsort_r.c quick_exit.c radixsort.c rand.c \
+	random.c reallocf.c realpath.c remque.c strfmon.c strtoimax.c \
 	strtol.c strtoll.c strtoq.c strtoul.c strtonum.c strtoull.c \
         strtoumax.c strtouq.c system.c tdelete.c tfind.c tsearch.c twalk.c
 
@@ -18,10 +18,12 @@ SYM_MAPS+= ${.CURDIR}/stdlib/Symbol.map
 # machine-dependent stdlib sources
 .sinclude "${.CURDIR}/${LIBC_ARCH}/stdlib/Makefile.inc"
 
-MAN+=	a64l.3 abort.3 abs.3 alloca.3 atexit.3 atof.3 atoi.3 atol.3 bsearch.3 \
+MAN+=	a64l.3 abort.3 abs.3 alloca.3 atexit.3 atof.3 atoi.3 atol.3 \
+	at_quick_exit.3 bsearch.3 \
 	div.3 exit.3 getenv.3 getopt.3 getopt_long.3 getsubopt.3 \
 	hcreate.3 imaxabs.3 imaxdiv.3 insque.3 labs.3 ldiv.3 llabs.3 lldiv.3 \
 	lsearch.3 malloc.3 memory.3 posix_memalign.3 ptsname.3 qsort.3 \
+	quick_exit.3 \
 	radixsort.3 rand.3 random.3 \
 	realpath.3 strfmon.3 strtod.3 strtol.3 strtonum.3 strtoul.3 system.3 \
 	tsearch.3

Modified: stable/9/lib/libc/stdlib/Symbol.map
==============================================================================
--- stable/9/lib/libc/stdlib/Symbol.map	Tue May 22 14:40:39 2012	(r235785)
+++ stable/9/lib/libc/stdlib/Symbol.map	Tue May 22 15:26:55 2012	(r235786)
@@ -97,6 +97,8 @@ FBSD_1.3 {
 	atoi_l;
 	atol_l;
 	atoll_l;
+	at_quick_exit;
+	quick_exit;
 	strtod_l;
 	strtol_l;
 	strtoll_l;

Copied and modified: stable/9/lib/libc/stdlib/at_quick_exit.3 (from r228323, head/lib/libc/stdlib/at_quick_exit.3)
==============================================================================
--- head/lib/libc/stdlib/at_quick_exit.3	Wed Dec  7 16:12:54 2011	(r228323, copy source)
+++ stable/9/lib/libc/stdlib/at_quick_exit.3	Tue May 22 15:26:55 2012	(r235786)
@@ -23,13 +23,13 @@
 .\"  SUCH DAMAGE.
 .\" 
 .\"  $FreeBSD$
-.\" /
-.Dd December 7, 2011o.Dt ATEXIT 3
+.\"
+.Dd December 7, 2011
 .Dt AT_QUICK_EXIT 3
 .Os
 .Sh NAME
 .Nm at_quick_exit
-.Nd Registers a cleanup function to run on quick exit.
+.Nd registers a cleanup function to run on quick exit
 .Sh LIBRARY
 .Lb libc
 .Sh SYNOPSIS
@@ -48,10 +48,13 @@ the program exits by calling 
 .Xr _Exit 3 ,
 or
 .Xr abort 3 .
-.El
+.Sh RETURN VALUES
+The 
+.Fn at_quick_exit
+function returns the value 0 if successful and a non-zero value on failure.
 .Sh SEE ALSO
 .Xr exit 3 ,
-.Xr at_quick_exit 3
+.Xr quick_exit 3
 .Sh STANDARDS
 The
 .Fn at_quick_exit

Modified: stable/9/lib/libc/stdlib/atexit.3
==============================================================================
--- stable/9/lib/libc/stdlib/atexit.3	Tue May 22 14:40:39 2012	(r235785)
+++ stable/9/lib/libc/stdlib/atexit.3	Tue May 22 15:26:55 2012	(r235786)
@@ -79,6 +79,7 @@ No memory was available to add the funct
 The existing list of functions is unmodified.
 .El
 .Sh SEE ALSO
+.Xr at_quick_exit 3
 .Xr exit 3
 .Sh STANDARDS
 The

Modified: stable/9/lib/libc/stdlib/exit.3
==============================================================================
--- stable/9/lib/libc/stdlib/exit.3	Tue May 22 14:40:39 2012	(r235785)
+++ stable/9/lib/libc/stdlib/exit.3	Tue May 22 15:26:55 2012	(r235786)
@@ -118,7 +118,9 @@ never return.
 .Xr _exit 2 ,
 .Xr wait 2 ,
 .Xr atexit 3 ,
+.Xr at_quick_exit 3 ,
 .Xr intro 3 ,
+.Xr quick_exit 3 ,
 .Xr sysexits 3 ,
 .Xr tmpfile 3
 .Sh STANDARDS

Copied and modified: stable/9/lib/libc/stdlib/quick_exit.3 (from r228323, head/lib/libc/stdlib/quick_exit.3)
==============================================================================
--- head/lib/libc/stdlib/quick_exit.3	Wed Dec  7 16:12:54 2011	(r228323, copy source)
+++ stable/9/lib/libc/stdlib/quick_exit.3	Tue May 22 15:26:55 2012	(r235786)
@@ -23,13 +23,13 @@
 .\"  SUCH DAMAGE.
 .\" 
 .\"  $FreeBSD$
-.\" /
-.Dd December 7, 2011o.Dt ATEXIT 3
+.\"
+.Dd December 7, 2011
 .Dt QUICK_EXIT 3
 .Os
 .Sh NAME
 .Nm quick_exit
-.Nd Exits a program quickly, running minimal cleanup
+.Nd exits a program quickly, running minimal cleanup
 .Sh LIBRARY
 .Lb libc
 .Sh SYNOPSIS
@@ -44,12 +44,14 @@ with
 .Xr at_quick_exit 3
 but not any C++ destructors or cleanup code registered with
 .Xr atexit 3 .
-.El
+.Sh RETURN VALUES
+The
+.Fn quick_exit
+function does not return.
 .Sh SEE ALSO
-.Xr exit 3 ,
-.Xr at_quick_exit 3
+.Xr at_quick_exit 3 ,
+.Xr exit 3
 .Sh STANDARDS
 The
 .Fn quick_exit
 function conforms to the C1x draft specification.
-

Copied and modified: stable/9/lib/libc/stdlib/quick_exit.c (from r228323, head/lib/libc/stdlib/quick_exit.c)
==============================================================================
--- head/lib/libc/stdlib/quick_exit.c	Wed Dec  7 16:12:54 2011	(r228323, copy source)
+++ stable/9/lib/libc/stdlib/quick_exit.c	Tue May 22 15:26:55 2012	(r235786)
@@ -51,10 +51,12 @@ static struct quick_exit_handler *handle
 int
 at_quick_exit(void (*func)(void))
 {
-	struct quick_exit_handler *h = malloc(sizeof(struct quick_exit_handler));
+	struct quick_exit_handler *h;
+	
+	h = malloc(sizeof(*h));
 
 	if (NULL == h)
-		return 1;
+		return (1);
 	h->cleanup = func;
 	pthread_mutex_lock(&atexit_mutex);
 	h->next = handlers;

Modified: stable/9/lib/msun/src/math.h
==============================================================================
--- stable/9/lib/msun/src/math.h	Tue May 22 14:40:39 2012	(r235785)
+++ stable/9/lib/msun/src/math.h	Tue May 22 15:26:55 2012	(r235786)
@@ -398,32 +398,32 @@ float	significandf(float);
  * long double versions of ISO/POSIX math functions
  */
 #if __ISO_C_VISIBLE >= 1999
-#if 0
+#if _DECLARE_C99_LDBL_MATH
 long double	acoshl(long double);
 #endif
 long double	acosl(long double);
-#if 0
+#if _DECLARE_C99_LDBL_MATH
 long double	asinhl(long double);
 #endif
 long double	asinl(long double);
 long double	atan2l(long double, long double);
-#if 0
+#if _DECLARE_C99_LDBL_MATH
 long double	atanhl(long double);
 #endif
 long double	atanl(long double);
 long double	cbrtl(long double);
 long double	ceill(long double);
 long double	copysignl(long double, long double) __pure2;
-#if 0
+#if _DECLARE_C99_LDBL_MATH
 long double	coshl(long double);
 #endif
 long double	cosl(long double);
-#if 0
+#if _DECLARE_C99_LDBL_MATH
 long double	erfcl(long double);
 long double	erfl(long double);
 #endif
 long double	exp2l(long double);
-#if 0
+#if _DECLARE_C99_LDBL_MATH
 long double	expl(long double);
 long double	expm1l(long double);
 #endif
@@ -438,18 +438,18 @@ long double	frexpl(long double value, in
 long double	hypotl(long double, long double);
 int		ilogbl(long double) __pure2;
 long double	ldexpl(long double, int);
-#if 0
+#if _DECLARE_C99_LDBL_MATH
 long double	lgammal(long double);
 #endif
 long long	llrintl(long double);
 long long	llroundl(long double);
-#if 0
+#if _DECLARE_C99_LDBL_MATH
 long double	log10l(long double);
 long double	log1pl(long double);
 long double	log2l(long double);
 #endif
 long double	logbl(long double);
-#if 0
+#if _DECLARE_C99_LDBL_MATH
 long double	logl(long double);
 #endif
 long		lrintl(long double);
@@ -461,7 +461,7 @@ long double	nextafterl(long double, long
 double		nexttoward(double, long double);
 float		nexttowardf(float, long double);
 long double	nexttowardl(long double, long double);
-#if 0
+#if _DECLARE_C99_LDBL_MATH
 long double	powl(long double, long double);
 #endif
 long double	remainderl(long double, long double);
@@ -470,16 +470,16 @@ long double	rintl(long double);
 long double	roundl(long double);
 long double	scalblnl(long double, long);
 long double	scalbnl(long double, int);
-#if 0
+#if _DECLARE_C99_LDBL_MATH
 long double	sinhl(long double);
 #endif
 long double	sinl(long double);
 long double	sqrtl(long double);
-#if 0
+#if _DECLARE_C99_LDBL_MATH
 long double	tanhl(long double);
 #endif
 long double	tanl(long double);
-#if 0
+#if _DECLARE_C99_LDBL_MATH
 long double	tgammal(long double);
 #endif
 long double	truncl(long double);

Modified: stable/9/sys/sys/_null.h
==============================================================================
--- stable/9/sys/sys/_null.h	Tue May 22 14:40:39 2012	(r235785)
+++ stable/9/sys/sys/_null.h	Tue May 22 15:26:55 2012	(r235786)
@@ -31,7 +31,9 @@
 #if !defined(__cplusplus)
 #define	NULL	((void *)0)
 #else
-#if defined(__GNUG__) && defined(__GNUC__) && __GNUC__ >= 4
+#if __cplusplus >= 201103L
+#define	NULL	nullptr
+#elif defined(__GNUG__) && defined(__GNUC__) && __GNUC__ >= 4
 #define	NULL	__null
 #else
 #if defined(__LP64__)

Modified: stable/9/sys/sys/cdefs.h
==============================================================================
--- stable/9/sys/sys/cdefs.h	Tue May 22 14:40:39 2012	(r235785)
+++ stable/9/sys/sys/cdefs.h	Tue May 22 15:26:55 2012	(r235786)
@@ -308,6 +308,17 @@
 #define	__LONG_LONG_SUPPORTED
 #endif
 
+/* C++11 exposes a load of C99 stuff */
+#if __cplusplus >= 201103L
+#	define	__LONG_LONG_SUPPORTED
+#	ifndef __STDC_LIMIT_MACROS
+#		define __STDC_LIMIT_MACROS
+#	endif
+#	ifndef __STDC_CONSTANT_MACROS
+#		define __STDC_CONSTANT_MACROS
+#	endif
+#endif
+
 /*
  * GCC 2.95 provides `__restrict' as an extension to C90 to support the
  * C99-specific `restrict' type qualifier.  We happen to use `__restrict' as

Modified: stable/9/sys/sys/param.h
==============================================================================
--- stable/9/sys/sys/param.h	Tue May 22 14:40:39 2012	(r235785)
+++ stable/9/sys/sys/param.h	Tue May 22 15:26:55 2012	(r235786)
@@ -58,7 +58,7 @@
  *		in the range 5 to 9.
  */
 #undef __FreeBSD_version
-#define __FreeBSD_version 900505	/* Master, propagated to newvers */
+#define __FreeBSD_version 900506	/* Master, propagated to newvers */
 
 /*
  * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD,

Modified: stable/9/sys/sys/stdint.h
==============================================================================
--- stable/9/sys/sys/stdint.h	Tue May 22 14:40:39 2012	(r235785)
+++ stable/9/sys/sys/stdint.h	Tue May 22 15:26:55 2012	(r235786)
@@ -64,4 +64,11 @@ typedef	__uintmax_t		uintmax_t;
 #define	_UINTMAX_T_DECLARED
 #endif
 
+/* GNU and Darwin define this and people seem to think it's portable */
+#if defined(UINTPTR_MAX) && defined(UINT64_MAX) && (UINTPTR_MAX == UINT64_MAX)
+#define	__WORDSIZE		64
+#else
+#define	__WORDSIZE		32
+#endif
+
 #endif /* !_SYS_STDINT_H_ */

From owner-svn-src-stable-9@FreeBSD.ORG  Tue May 22 17:44:01 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id D47AF106564A;
	Tue, 22 May 2012 17:44:01 +0000 (UTC)
	(envelope-from iwasaki@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id BC6268FC14;
	Tue, 22 May 2012 17:44: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 q4MHi1ix016888;
	Tue, 22 May 2012 17:44:01 GMT (envelope-from iwasaki@svn.freebsd.org)
Received: (from iwasaki@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4MHi1SL016883;
	Tue, 22 May 2012 17:44:01 GMT (envelope-from iwasaki@svn.freebsd.org)
Message-Id: <201205221744.q4MHi1SL016883@svn.freebsd.org>
From: Mitsuru IWASAKI <iwasaki@FreeBSD.org>
Date: Tue, 22 May 2012 17:44:01 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r235796 - in stable/9/sys: i386/acpica i386/i386
	i386/include kern pc98/pc98 sys
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 22 May 2012 17:44:01 -0000

Author: iwasaki
Date: Tue May 22 17:44:01 2012
New Revision: 235796
URL: http://svn.freebsd.org/changeset/base/235796

Log:
  MFC 235622,235639,235683:
  
  Merge SMP/i386 suspend/resume support.

Modified:
  stable/9/sys/i386/acpica/acpi_wakecode.S
  stable/9/sys/i386/acpica/acpi_wakeup.c
  stable/9/sys/i386/i386/apic_vector.s
  stable/9/sys/i386/i386/genassym.c
  stable/9/sys/i386/i386/initcpu.c
  stable/9/sys/i386/i386/machdep.c
  stable/9/sys/i386/i386/mp_machdep.c
  stable/9/sys/i386/i386/swtch.s
  stable/9/sys/i386/include/apicvar.h
  stable/9/sys/i386/include/md_var.h
  stable/9/sys/i386/include/pcb.h
  stable/9/sys/i386/include/smp.h
  stable/9/sys/kern/subr_smp.c
  stable/9/sys/pc98/pc98/machdep.c
  stable/9/sys/sys/smp.h
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/i386/acpica/acpi_wakecode.S
==============================================================================
--- stable/9/sys/i386/acpica/acpi_wakecode.S	Tue May 22 17:30:02 2012	(r235795)
+++ stable/9/sys/i386/acpica/acpi_wakecode.S	Tue May 22 17:44:01 2012	(r235796)
@@ -1,6 +1,8 @@
 /*-
  * Copyright (c) 2001 Takanori Watanabe <takawata@jp.freebsd.org>
- * Copyright (c) 2001 Mitsuru IWASAKI <iwasaki@jp.freebsd.org>
+ * Copyright (c) 2001-2012 Mitsuru IWASAKI <iwasaki@jp.freebsd.org>
+ * Copyright (c) 2003 Peter Wemm
+ * Copyright (c) 2008-2012 Jung-uk Kim <jkim@FreeBSD.org>
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -28,7 +30,9 @@
  */
 
 #include <machine/asmacros.h>
+#include <machine/ppireg.h>
 #include <machine/specialreg.h>
+#include <machine/timerreg.h>
 
 #include "assym.s"
 
@@ -39,221 +43,163 @@
  * Depending on the previous sleep state, we may need to initialize more
  * of the system (i.e., S3 suspend-to-RAM vs. S4 suspend-to-disk).
  */
-	.align 4
-	.code16
-wakeup_16:
-	nop
-	cli
-	cld
 
+	.data				/* So we can modify it */
+
+	ALIGN_TEXT
+	.code16
+wakeup_start:
 	/*
 	 * Set up segment registers for real mode, a small stack for
 	 * any calls we make, and clear any flags.
 	 */
-	movw	%cs,%ax
-	movw	%ax,%ds
-	movw	%ax,%ss
-	movw	$PAGE_SIZE,%sp
-	pushl	$0
-	popfl
+	cli				/* make sure no interrupts */
+	mov	%cs, %ax		/* copy %cs to %ds.  Remember these */
+	mov	%ax, %ds		/* are offsets rather than selectors */
+	mov	%ax, %ss
+	movw	$PAGE_SIZE, %sp
+	xorw	%ax, %ax
+	pushw	%ax
+	popfw
 
 	/* To debug resume hangs, beep the speaker if the user requested. */
-	cmpl	$1,resume_beep
-	jne	nobeep
-	movb	$0xc0,%al
-	outb	%al,$0x42
-	movb	$0x04,%al
-	outb	%al,$0x42
-	inb	$0x61,%al
-	orb	$0x3,%al
-	outb	%al,$0x61
-nobeep:
+	testb	$~0, resume_beep - wakeup_start
+	jz	1f
+	movb	$0, resume_beep - wakeup_start
+
+	/* Set PIC timer2 to beep. */
+	movb	$(TIMER_SEL2 | TIMER_SQWAVE | TIMER_16BIT), %al
+	outb	%al, $TIMER_MODE
+
+	/* Turn on speaker. */
+	inb	$IO_PPI, %al
+	orb	$PIT_SPKR, %al
+	outb	%al, $IO_PPI
+
+	/* Set frequency. */
+	movw	$0x4c0, %ax
+	outb	%al, $TIMER_CNTR2
+	shrw	$8, %ax
+	outb	%al, $TIMER_CNTR2
+1:
 
 	/* Re-initialize video BIOS if the reset_video tunable is set. */
-	cmpl	$1,reset_video
-	jne	nobiosreset
-	lcall	$0xc000,$3
+	testb	$~0, reset_video - wakeup_start
+	jz	1f
+	movb	$0, reset_video - wakeup_start
+	lcall	$0xc000, $3
+
+	/* When we reach here, int 0x10 should be ready.  Hide cursor. */
+	movb	$0x01, %ah
+	movb	$0x20, %ch
+	int	$0x10
+
+	/* Re-start in case the previous BIOS call clobbers them. */
+	jmp	wakeup_start
+1:
 
 	/*
-	 * Set up segment registers for real mode again in case the
-	 * previous BIOS call clobbers them.
+	 * Find relocation base and patch the gdt descript and ljmp targets
 	 */
-	movw	%cs,%ax
-	movw	%ax,%ds
-	movw	%ax,%ss
-nobiosreset:
-
-	/* Load GDT for real mode.  Use 32 bit prefix for addresses >16 MB. */
-	lgdtl	physical_gdt
-
-	/* Restore CR2, CR3 and CR4 */
-	movl	previous_cr2,%eax
-	movl	%eax,%cr2
-	movl	previous_cr3,%eax
-	movl	%eax,%cr3
-	movl	previous_cr4,%eax
-	movl	%eax,%cr4
-
-	/* Transfer some values to protected mode with an inline stack */
-#define NVALUES	9
-#define TRANSFER_STACK32(val, idx)	\
-	movl	val,%eax;		\
-	movl	%eax,wakeup_32stack+(idx+1)+(idx*4)
-
-	TRANSFER_STACK32(previous_ss,		(NVALUES - 9))
-	TRANSFER_STACK32(previous_fs,		(NVALUES - 8))
-	TRANSFER_STACK32(previous_ds,		(NVALUES - 7))
-	TRANSFER_STACK32(physical_gdt+2,	(NVALUES - 6))
-	TRANSFER_STACK32(where_to_recover,	(NVALUES - 5))
-	TRANSFER_STACK32(previous_idt+2,	(NVALUES - 4))
-	TRANSFER_STACK32(previous_ldt,		(NVALUES - 3))
-	TRANSFER_STACK32(previous_gdt+2,	(NVALUES - 2))
-	TRANSFER_STACK32(previous_tr,		(NVALUES - 1))
-	TRANSFER_STACK32(previous_cr0,		(NVALUES - 0))
+	xorl	%ebx, %ebx
+	mov	%cs, %bx
+	sall	$4, %ebx		/* %ebx is now our relocation base */
 
-	mov	physical_esp,%esi	/* to be used in 32bit code */
+	/*
+	 * Load the descriptor table pointer.  We'll need it when running
+	 * in 16-bit protected mode.
+	 */
+	lgdtl	bootgdtdesc - wakeup_start
 
 	/* Enable protected mode */
-	movl	%cr0,%eax
-	orl	$(CR0_PE),%eax
-	movl	%eax,%cr0
+	movl	$CR0_PE, %eax
+	mov	%eax, %cr0
 
+	/*
+	 * Now execute a far jump to turn on protected mode.  This
+	 * causes the segment registers to turn into selectors and causes
+	 * %cs to be loaded from the gdt.
+	 *
+	 * The following instruction is:
+	 * ljmpl $bootcode32 - bootgdt, $wakeup_32 - wakeup_start
+	 * but gas cannot assemble that.  And besides, we patch the targets
+	 * in early startup and its a little clearer what we are patching.
+	 */
 wakeup_sw32:
-	/* Switch to protected mode by intersegmental jump */
-	ljmpl	$KCSEL,$0x12345678	/* Code location, to be replaced */
+	.byte	0x66			/* size override to 32 bits */
+	.byte	0xea			/* opcode for far jump */
+	.long	wakeup_32 - wakeup_start /* offset in segment */
+	.word	bootcode32 - bootgdt	/* index in gdt for 32 bit code */
 
 	/*
-	 * Now switched to protected mode without paging enabled.
-	 *	%esi: KERNEL stack pointer (physical address)
+	 * At this point, we are running in 32 bit legacy protected mode.
 	 */
+	ALIGN_TEXT
 	.code32
 wakeup_32:
-	nop
 
-	/* Set up segment registers for protected mode */
-	movw	$KDSEL,%ax		/* KDSEL to segment registers */
-	movw	%ax,%ds
-	movw	%ax,%es
-	movw	%ax,%gs
-	movw	%ax,%ss
-	movw	$KPSEL,%ax		/* KPSEL to %fs */
-	movw	%ax,%fs
-	movl	%esi,%esp		/* physical address stack pointer */
-
-wakeup_32stack:
-	/* Operands are overwritten in 16 bit code by TRANSFER_STACK32 macro */
-	pushl	$0xabcdef09		/* ss + dummy */
-	pushl	$0xabcdef08		/* fs + gs */
-	pushl	$0xabcdef07		/* ds + es */
-	pushl	$0xabcdef06		/* gdt:base (physical address) */
-	pushl	$0xabcdef05		/* recover address */
-	pushl	$0xabcdef04		/* idt:base */
-	pushl	$0xabcdef03		/* ldt + idt:limit */
-	pushl	$0xabcdef02		/* gdt:base */
-	pushl	$0xabcdef01		/* TR + gdt:limit */
-	pushl	$0xabcdef00		/* CR0 */
-
-	movl	%esp,%ebp
-#define CR0_REGISTER		0(%ebp)
-#define TASK_REGISTER		4(%ebp)
-#define PREVIOUS_GDT		6(%ebp)
-#define PREVIOUS_LDT		12(%ebp)
-#define PREVIOUS_IDT		14(%ebp)
-#define RECOVER_ADDR		20(%ebp)
-#define PHYSICAL_GDT_BASE	24(%ebp)
-#define PREVIOUS_DS		28(%ebp)
-#define PREVIOUS_ES		30(%ebp)
-#define PREVIOUS_FS		32(%ebp)
-#define PREVIOUS_GS		34(%ebp)
-#define PREVIOUS_SS		36(%ebp)
-
-	/* Fixup TSS type field */
-#define TSS_TYPEFIX_MASK	0xf9
-	xorl	%esi,%esi
-	movl	PHYSICAL_GDT_BASE,%ebx
-	movw	TASK_REGISTER,%si
-	leal	(%ebx,%esi),%eax	/* get TSS segment descriptor */
-	andb	$TSS_TYPEFIX_MASK,5(%eax)
-
-	/* Prepare to return to sleep/wakeup code point */
-	lgdtl	PREVIOUS_GDT
-	lidtl	PREVIOUS_IDT
-
-	/* Pack values from the GDT to be loaded into segment registers. */
-	movl	PREVIOUS_DS,%ebx
-	movl	PREVIOUS_FS,%ecx
-	movl	PREVIOUS_SS,%edx
-	movw	TASK_REGISTER,%si
-	shll	$16,%esi
-	movw	PREVIOUS_LDT,%si
-	movl	RECOVER_ADDR,%edi
-
-	/* Enable paging and etc. */
-	movl	CR0_REGISTER,%eax
-	movl	%eax,%cr0
+	mov	$bootdata32 - bootgdt, %eax
+	mov	%ax, %ds
 
-	/* Flush the prefetch queue */
-	jmp	1f
-1:	jmp	1f
-1:
+	/* Get PCB and return address. */
+	movl	wakeup_pcb - wakeup_start(%ebx), %esi
+	movl	wakeup_ret - wakeup_start(%ebx), %edi
+
+	/* Restore CR4 and CR3. */
+	movl	wakeup_cr4 - wakeup_start(%ebx), %eax
+	mov	%eax, %cr4
+	movl	wakeup_cr3 - wakeup_start(%ebx), %eax
+	mov	%eax, %cr3
 
 	/*
-	 * Now we are in kernel virtual memory addressing with the following
-	 * original register values:
-	 *	%ebx: ds + es
-	 *	%ecx: fs + gs
-	 *	%edx: ss + dummy
-	 *	%esi: LDTR + TR
-	 *	%edi: recover address
-	 * We'll load these back into the segment registers now.
+	 * Finally, switch to long bit mode by enabling paging.  We have
+	 * to be very careful here because all the segmentation disappears
+	 * out from underneath us.  The spec says we can depend on the
+	 * subsequent pipelined branch to execute, but *only if* everthing
+	 * is still identity mapped.  If any mappings change, the pipeline
+	 * will flush.
 	 */
-	nop
-
-	movl	%esi,%eax		/* LDTR + TR */
-	lldt	%ax			/* load LDT register */
-	shrl	$16,%eax
-	ltr	%ax			/* load task register */
-
-	/* Restore segment registers */
-	movl	%ebx,%eax		/* ds + es */
-	movw	%ax,%ds
-	shrl	$16,%eax
-	movw	%ax,%es
-	movl	%ecx,%eax		/* fs + gs */
-	movw	%ax,%fs
-	shrl	$16,%eax
-	movw	%ax,%gs
-	movl	%edx,%eax		/* ss */
-	movw	%ax,%ss
+	mov	%cr0, %eax
+	orl	$CR0_PG, %eax
+	mov	%eax, %cr0
 
-	/* Jump to acpi_restorecpu() */
+	jmp	1f
+1:
+	/* Jump to return address. */
 	jmp	*%edi
 
-/* used in real mode */
-physical_gdt:		.word 0
-			.long 0
-physical_esp:		.long 0
-previous_cr2:		.long 0
-previous_cr3:		.long 0
-previous_cr4:		.long 0
-resume_beep:		.long 0
-reset_video:		.long 0
+	.data
 
-/*
- * Transfer from real mode to protected mode.  The order of these variables
- * is very important, DO NOT INSERT OR CHANGE unless you know why.
- */
-previous_cr0:		.long 0
-previous_tr:		.word 0
-previous_gdt:		.word 0
-			.long 0
-previous_ldt:		.word 0
-previous_idt:		.word 0
-			.long 0
-where_to_recover:	.long 0
-previous_ds:		.word 0
-previous_es:		.word 0
-previous_fs:		.word 0
-previous_gs:		.word 0
-previous_ss:		.word 0
-dummy:			.word 0
+resume_beep:
+	.byte	0
+reset_video:
+	.byte	0
+
+	ALIGN_DATA
+bootgdt:
+	.long	0x00000000
+	.long	0x00000000
+
+bootcode32:
+	.long	0x0000ffff
+	.long	0x00cf9b00
+
+bootdata32:
+	.long	0x0000ffff
+	.long	0x00cf9300
+bootgdtend:
+
+bootgdtdesc:
+	.word	bootgdtend - bootgdt	/* Length */
+	.long	bootgdt - wakeup_start	/* Offset plus %ds << 4 */
+
+	ALIGN_DATA
+wakeup_cr4:
+	.long	0
+wakeup_cr3:
+	.long	0
+wakeup_pcb:
+	.long	0
+wakeup_ret:
+	.long	0
+dummy:

Modified: stable/9/sys/i386/acpica/acpi_wakeup.c
==============================================================================
--- stable/9/sys/i386/acpica/acpi_wakeup.c	Tue May 22 17:30:02 2012	(r235795)
+++ stable/9/sys/i386/acpica/acpi_wakeup.c	Tue May 22 17:44:01 2012	(r235796)
@@ -1,6 +1,8 @@
 /*-
  * Copyright (c) 2001 Takanori Watanabe <takawata@jp.freebsd.org>
- * Copyright (c) 2001 Mitsuru IWASAKI <iwasaki@jp.freebsd.org>
+ * Copyright (c) 2001-2012 Mitsuru IWASAKI <iwasaki@jp.freebsd.org>
+ * Copyright (c) 2003 Peter Wemm
+ * Copyright (c) 2008-2012 Jung-uk Kim <jkim@FreeBSD.org>
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -29,26 +31,29 @@
 __FBSDID("$FreeBSD$");
 
 #include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
 #include <sys/bus.h>
-#include <sys/lock.h>
+#include <sys/eventhandler.h>
+#include <sys/kernel.h>
 #include <sys/malloc.h>
 #include <sys/memrange.h>
-#include <sys/proc.h>
-#include <sys/sysctl.h>
+#include <sys/smp.h>
 
 #include <vm/vm.h>
 #include <vm/pmap.h>
-#include <vm/vm_object.h>
-#include <vm/vm_page.h>
-#include <vm/vm_map.h>
 
-#include <machine/bus.h>
-#include <machine/cpufunc.h>
+#include <machine/clock.h>
 #include <machine/intr_machdep.h>
 #include <x86/mca.h>
-#include <machine/segments.h>
+#include <machine/pcb.h>
+#include <machine/pmap.h>
+#include <machine/specialreg.h>
+#include <machine/md_var.h>
+
+#ifdef SMP
+#include <x86/apicreg.h>
+#include <machine/smp.h>
+#include <machine/vmparam.h>
+#endif
 
 #include <contrib/dev/acpica/include/acpi.h>
 
@@ -57,164 +62,186 @@ __FBSDID("$FreeBSD$");
 #include "acpi_wakecode.h"
 #include "acpi_wakedata.h"
 
-/* Make sure the code is less than one page and leave room for the stack. */
+/* Make sure the code is less than a page and leave room for the stack. */
 CTASSERT(sizeof(wakecode) < PAGE_SIZE - 1024);
 
-#ifndef _SYS_CDEFS_H_
-#error this file needs sys/cdefs.h as a prerequisite
+extern int		acpi_resume_beep;
+extern int		acpi_reset_video;
+
+#ifdef SMP
+extern struct pcb	**susppcbs;
+#else
+static struct pcb	**susppcbs;
 #endif
 
-extern uint32_t	acpi_resume_beep;
-extern uint32_t	acpi_reset_video;
-extern void	initializecpu(void);
-
-static struct region_descriptor __used	saved_idt, saved_gdt;
-static struct region_descriptor	*p_gdt;
-static uint16_t __used 	saved_ldt;
-
-static uint32_t	__used	r_eax, r_ebx, r_ecx, r_edx, r_ebp, r_esi, r_edi,
-			r_efl, r_cr0, r_cr2, r_cr3, r_cr4, ret_addr;
-
-static uint16_t	__used	r_cs, r_ds, r_es, r_fs, r_gs, r_ss, r_tr;
-static uint32_t	__used	r_esp;
-
-static void		acpi_printcpu(void);
-static void		acpi_realmodeinst(void *arg, bus_dma_segment_t *segs,
-					  int nsegs, int error);
-static void		acpi_alloc_wakeup_handler(void);
-
-/* XXX shut gcc up */
-extern int		acpi_savecpu(void);
-extern int		acpi_restorecpu(void);
-
-#ifdef __GNUCLIKE_ASM
-__asm__("				\n\
-	.text				\n\
-	.p2align 2, 0x90		\n\
-	.type acpi_restorecpu, @function\n\
-acpi_restorecpu:			\n\
-	.align 4			\n\
-	movl	r_eax,%eax		\n\
-	movl	r_ebx,%ebx		\n\
-	movl	r_ecx,%ecx		\n\
-	movl	r_edx,%edx		\n\
-	movl	r_ebp,%ebp		\n\
-	movl	r_esi,%esi		\n\
-	movl	r_edi,%edi		\n\
-	movl	r_esp,%esp		\n\
-					\n\
-	pushl	r_efl			\n\
-	popfl				\n\
-					\n\
-	movl	ret_addr,%eax		\n\
-	movl	%eax,(%esp)		\n\
-	xorl	%eax,%eax		\n\
-	ret				\n\
-					\n\
-	.text				\n\
-	.p2align 2, 0x90		\n\
-	.type acpi_savecpu, @function	\n\
-acpi_savecpu:				\n\
-	movw	%cs,r_cs		\n\
-	movw	%ds,r_ds		\n\
-	movw	%es,r_es		\n\
-	movw	%fs,r_fs		\n\
-	movw	%gs,r_gs		\n\
-	movw	%ss,r_ss		\n\
-					\n\
-	movl	%eax,r_eax		\n\
-	movl	%ebx,r_ebx		\n\
-	movl	%ecx,r_ecx		\n\
-	movl	%edx,r_edx		\n\
-	movl	%ebp,r_ebp		\n\
-	movl	%esi,r_esi		\n\
-	movl	%edi,r_edi		\n\
-					\n\
-	movl	%cr0,%eax		\n\
-	movl	%eax,r_cr0		\n\
-	movl	%cr2,%eax		\n\
-	movl	%eax,r_cr2		\n\
-	movl	%cr3,%eax		\n\
-	movl	%eax,r_cr3		\n\
-	movl	%cr4,%eax		\n\
-	movl	%eax,r_cr4		\n\
-					\n\
-	pushfl				\n\
-	popl	r_efl			\n\
-					\n\
-	movl	%esp,r_esp		\n\
-					\n\
-	sgdt	saved_gdt		\n\
-	sidt	saved_idt		\n\
-	sldt	saved_ldt		\n\
-	str	r_tr			\n\
-					\n\
-	movl	(%esp),%eax		\n\
-	movl	%eax,ret_addr		\n\
-	movl	$1,%eax			\n\
-	ret				\n\
-");
-#endif /* __GNUCLIKE_ASM */
+static void		*acpi_alloc_wakeup_handler(void);
+static void		acpi_stop_beep(void *);
+
+#ifdef SMP
+static int		acpi_wakeup_ap(struct acpi_softc *, int);
+static void		acpi_wakeup_cpus(struct acpi_softc *, const cpuset_t *);
+#endif
+
+#define ACPI_PAGETABLES	0
+#define	WAKECODE_VADDR(sc)	((sc)->acpi_wakeaddr + (ACPI_PAGETABLES * PAGE_SIZE))
+#define	WAKECODE_PADDR(sc)	((sc)->acpi_wakephys + (ACPI_PAGETABLES * PAGE_SIZE))
+#define	WAKECODE_FIXUP(offset, type, val) do	{	\
+	type	*addr;					\
+	addr = (type *)(WAKECODE_VADDR(sc) + offset);	\
+	*addr = val;					\
+} while (0)
 
 static void
-acpi_printcpu(void)
+acpi_stop_beep(void *arg)
 {
-	printf("======== acpi_printcpu() debug dump ========\n");
-	printf("gdt[%04x:%08x] idt[%04x:%08x] ldt[%04x] tr[%04x] efl[%08x]\n",
-		saved_gdt.rd_limit, saved_gdt.rd_base,
-		saved_idt.rd_limit, saved_idt.rd_base,
-		saved_ldt, r_tr, r_efl);
-	printf("eax[%08x] ebx[%08x] ecx[%08x] edx[%08x]\n",
-		r_eax, r_ebx, r_ecx, r_edx);
-	printf("esi[%08x] edi[%08x] ebp[%08x] esp[%08x]\n",
-		r_esi, r_edi, r_ebp, r_esp);
-	printf("cr0[%08x] cr2[%08x] cr3[%08x] cr4[%08x]\n",
-		r_cr0, r_cr2, r_cr3, r_cr4);
-	printf("cs[%04x] ds[%04x] es[%04x] fs[%04x] gs[%04x] ss[%04x]\n",
-		r_cs, r_ds, r_es, r_fs, r_gs, r_ss);
+
+	if (acpi_resume_beep != 0)
+		timer_spkr_release();
 }
 
-#define WAKECODE_FIXUP(offset, type, val) do	{		\
-	type	*addr;						\
-	addr = (type *)(sc->acpi_wakeaddr + offset);		\
-	*addr = val;						\
-} while (0)
+#ifdef SMP
+static int
+acpi_wakeup_ap(struct acpi_softc *sc, int cpu)
+{
+	int		vector = (WAKECODE_PADDR(sc) >> 12) & 0xff;
+	int		apic_id = cpu_apic_ids[cpu];
+	int		ms;
+
+	WAKECODE_FIXUP(wakeup_pcb, struct pcb *, susppcbs[cpu]);
+
+	/* do an INIT IPI: assert RESET */
+	lapic_ipi_raw(APIC_DEST_DESTFLD | APIC_TRIGMOD_EDGE |
+	    APIC_LEVEL_ASSERT | APIC_DESTMODE_PHY | APIC_DELMODE_INIT, apic_id);
+
+	/* wait for pending status end */
+	lapic_ipi_wait(-1);
+
+	/* do an INIT IPI: deassert RESET */
+	lapic_ipi_raw(APIC_DEST_ALLESELF | APIC_TRIGMOD_LEVEL |
+	    APIC_LEVEL_DEASSERT | APIC_DESTMODE_PHY | APIC_DELMODE_INIT, 0);
+
+	/* wait for pending status end */
+	DELAY(10000);		/* wait ~10mS */
+	lapic_ipi_wait(-1);
 
-#define WAKECODE_BCOPY(offset, type, val) do	{		\
-	void	*addr;						\
-	addr = (void *)(sc->acpi_wakeaddr + offset);		\
-	bcopy(&(val), addr, sizeof(type));			\
-} while (0)
+	/*
+	 * next we do a STARTUP IPI: the previous INIT IPI might still be
+	 * latched, (P5 bug) this 1st STARTUP would then terminate
+	 * immediately, and the previously started INIT IPI would continue. OR
+	 * the previous INIT IPI has already run. and this STARTUP IPI will
+	 * run. OR the previous INIT IPI was ignored. and this STARTUP IPI
+	 * will run.
+	 */
+
+	/* do a STARTUP IPI */
+	lapic_ipi_raw(APIC_DEST_DESTFLD | APIC_TRIGMOD_EDGE |
+	    APIC_LEVEL_DEASSERT | APIC_DESTMODE_PHY | APIC_DELMODE_STARTUP |
+	    vector, apic_id);
+	lapic_ipi_wait(-1);
+	DELAY(200);		/* wait ~200uS */
+
+	/*
+	 * finally we do a 2nd STARTUP IPI: this 2nd STARTUP IPI should run IF
+	 * the previous STARTUP IPI was cancelled by a latched INIT IPI. OR
+	 * this STARTUP IPI will be ignored, as only ONE STARTUP IPI is
+	 * recognized after hardware RESET or INIT IPI.
+	 */
+
+	lapic_ipi_raw(APIC_DEST_DESTFLD | APIC_TRIGMOD_EDGE |
+	    APIC_LEVEL_DEASSERT | APIC_DESTMODE_PHY | APIC_DELMODE_STARTUP |
+	    vector, apic_id);
+	lapic_ipi_wait(-1);
+	DELAY(200);		/* wait ~200uS */
+
+	/* Wait up to 5 seconds for it to start. */
+	for (ms = 0; ms < 5000; ms++) {
+		if (susppcbs[cpu]->pcb_eip == 0)
+			return (1);	/* return SUCCESS */
+		DELAY(1000);
+	}
+	return (0);		/* return FAILURE */
+}
+
+#define	WARMBOOT_TARGET		0
+#define	WARMBOOT_OFF		(KERNBASE + 0x0467)
+#define	WARMBOOT_SEG		(KERNBASE + 0x0469)
+
+#define	CMOS_REG		(0x70)
+#define	CMOS_DATA		(0x71)
+#define	BIOS_RESET		(0x0f)
+#define	BIOS_WARM		(0x0a)
 
-/* Turn off bits 1&2 of the PIT, stopping the beep. */
 static void
-acpi_stop_beep(void *arg)
+acpi_wakeup_cpus(struct acpi_softc *sc, const cpuset_t *wakeup_cpus)
 {
-	outb(0x61, inb(0x61) & ~0x3);
+	uint32_t	mpbioswarmvec;
+	int		cpu;
+	u_char		mpbiosreason;
+
+	/* save the current value of the warm-start vector */
+	mpbioswarmvec = *((uint32_t *)WARMBOOT_OFF);
+	outb(CMOS_REG, BIOS_RESET);
+	mpbiosreason = inb(CMOS_DATA);
+
+	/* setup a vector to our boot code */
+	*((volatile u_short *)WARMBOOT_OFF) = WARMBOOT_TARGET;
+	*((volatile u_short *)WARMBOOT_SEG) = WAKECODE_PADDR(sc) >> 4;
+	outb(CMOS_REG, BIOS_RESET);
+	outb(CMOS_DATA, BIOS_WARM);	/* 'warm-start' */
+
+	/* Wake up each AP. */
+	for (cpu = 1; cpu < mp_ncpus; cpu++) {
+		if (!CPU_ISSET(cpu, wakeup_cpus))
+			continue;
+		if (acpi_wakeup_ap(sc, cpu) == 0) {
+			/* restore the warmstart vector */
+			*(uint32_t *)WARMBOOT_OFF = mpbioswarmvec;
+			panic("acpi_wakeup: failed to resume AP #%d (PHY #%d)",
+			    cpu, cpu_apic_ids[cpu]);
+		}
+	}
+
+	/* restore the warmstart vector */
+	*(uint32_t *)WARMBOOT_OFF = mpbioswarmvec;
+
+	outb(CMOS_REG, BIOS_RESET);
+	outb(CMOS_DATA, mpbiosreason);
 }
+#endif
 
 int
 acpi_sleep_machdep(struct acpi_softc *sc, int state)
 {
-	ACPI_STATUS		status;
-	struct pmap		*pm;
-	int			ret;
-	uint32_t		cr3;
-	u_long			ef;
+#ifdef SMP
+	cpuset_t	wakeup_cpus;
+#endif
+	register_t	cr3, rf;
+	ACPI_STATUS	status;
+	struct pmap	*pm;
+	int		ret;
 
 	ret = -1;
-	if (sc->acpi_wakeaddr == 0)
+
+	if (sc->acpi_wakeaddr == 0ul)
 		return (ret);
 
-	AcpiSetFirmwareWakingVector(sc->acpi_wakephys);
+#ifdef SMP
+	wakeup_cpus = all_cpus;
+	CPU_CLR(PCPU_GET(cpuid), &wakeup_cpus);
+#endif
+
+	if (acpi_resume_beep != 0)
+		timer_spkr_acquire();
 
-	ef = intr_disable();
+	AcpiSetFirmwareWakingVector(WAKECODE_PADDR(sc));
+
+	rf = intr_disable();
 	intr_suspend();
 
 	/*
-	 * Temporarily switch to the kernel pmap because it provides an
-	 * identity mapping (setup at boot) for the low physical memory
-	 * region containing the wakeup code.
+	 * Temporarily switch to the kernel pmap because it provides
+	 * an identity mapping (setup at boot) for the low physical
+	 * memory region containing the wakeup code.
 	 */
 	pm = kernel_pmap;
 	cr3 = rcr3();
@@ -224,39 +251,22 @@ acpi_sleep_machdep(struct acpi_softc *sc
 	load_cr3(vtophys(pm->pm_pdir));
 #endif
 
-	ret_addr = 0;
-	if (acpi_savecpu()) {
-		/* Execute Sleep */
-
-		p_gdt = (struct region_descriptor *)
-				(sc->acpi_wakeaddr + physical_gdt);
-		p_gdt->rd_limit = saved_gdt.rd_limit;
-		p_gdt->rd_base = vtophys(saved_gdt.rd_base);
-
-		WAKECODE_FIXUP(physical_esp, uint32_t, vtophys(r_esp));
-		WAKECODE_FIXUP(previous_cr0, uint32_t, r_cr0);
-		WAKECODE_FIXUP(previous_cr2, uint32_t, r_cr2);
-		WAKECODE_FIXUP(previous_cr3, uint32_t, r_cr3);
-		WAKECODE_FIXUP(previous_cr4, uint32_t, r_cr4);
-
-		WAKECODE_FIXUP(resume_beep, uint32_t, acpi_resume_beep);
-		WAKECODE_FIXUP(reset_video, uint32_t, acpi_reset_video);
-
-		WAKECODE_FIXUP(previous_tr,  uint16_t, r_tr);
-		WAKECODE_BCOPY(previous_gdt, struct region_descriptor, saved_gdt);
-		WAKECODE_FIXUP(previous_ldt, uint16_t, saved_ldt);
-		WAKECODE_BCOPY(previous_idt, struct region_descriptor, saved_idt);
-
-		WAKECODE_FIXUP(where_to_recover, void *, acpi_restorecpu);
-
-		WAKECODE_FIXUP(previous_ds,  uint16_t, r_ds);
-		WAKECODE_FIXUP(previous_es,  uint16_t, r_es);
-		WAKECODE_FIXUP(previous_fs,  uint16_t, r_fs);
-		WAKECODE_FIXUP(previous_gs,  uint16_t, r_gs);
-		WAKECODE_FIXUP(previous_ss,  uint16_t, r_ss);
+	if (suspendctx(susppcbs[0])) {
+#ifdef SMP
+		if (!CPU_EMPTY(&wakeup_cpus) &&
+		    suspend_cpus(wakeup_cpus) == 0) {
+			device_printf(sc->acpi_dev, "Failed to suspend APs\n");
+			goto out;
+		}
+#endif
+
+		WAKECODE_FIXUP(resume_beep, uint8_t, (acpi_resume_beep != 0));
+		WAKECODE_FIXUP(reset_video, uint8_t, (acpi_reset_video != 0));
 
-		if (bootverbose)
-			acpi_printcpu();
+		WAKECODE_FIXUP(wakeup_cr4, register_t, susppcbs[0]->pcb_cr4);
+		WAKECODE_FIXUP(wakeup_cr3, register_t, susppcbs[0]->pcb_cr3);
+
+		WAKECODE_FIXUP(wakeup_pcb, struct pcb *, susppcbs[0]);
 
 		/* Call ACPICA to enter the desired sleep state */
 		if (state == ACPI_STATE_S4 && sc->acpi_s4bios)
@@ -266,8 +276,8 @@ acpi_sleep_machdep(struct acpi_softc *sc
 
 		if (status != AE_OK) {
 			device_printf(sc->acpi_dev,
-				"AcpiEnterSleepState failed - %s\n",
-				AcpiFormatException(status));
+			    "AcpiEnterSleepState failed - %s\n",
+			    AcpiFormatException(status));
 			goto out;
 		}
 
@@ -275,97 +285,96 @@ acpi_sleep_machdep(struct acpi_softc *sc
 			ia32_pause();
 	} else {
 		pmap_init_pat();
+		initializecpu();
 		PCPU_SET(switchtime, 0);
 		PCPU_SET(switchticks, ticks);
-		if (bootverbose) {
-			acpi_savecpu();
-			acpi_printcpu();
-		}
+#ifdef SMP
+		if (!CPU_EMPTY(&wakeup_cpus))
+			acpi_wakeup_cpus(sc, &wakeup_cpus);
+#endif
 		ret = 0;
 	}
 
 out:
+#ifdef SMP
+	if (!CPU_EMPTY(&wakeup_cpus))
+		restart_cpus(wakeup_cpus);
+#endif
+
 	load_cr3(cr3);
 	mca_resume();
 	intr_resume();
-	intr_restore(ef);
+	intr_restore(rf);
+
+	AcpiSetFirmwareWakingVector(0);
 
 	if (ret == 0 && mem_range_softc.mr_op != NULL &&
 	    mem_range_softc.mr_op->reinit != NULL)
 		mem_range_softc.mr_op->reinit(&mem_range_softc);
 
-	/* If we beeped, turn it off after a delay. */
-	if (acpi_resume_beep)
-		timeout(acpi_stop_beep, NULL, 3 * hz);
-
 	return (ret);
 }
 
-static bus_dma_tag_t	acpi_waketag;
-static bus_dmamap_t	acpi_wakemap;
-static vm_offset_t	acpi_wakeaddr;
-
-static void
+static void *
 acpi_alloc_wakeup_handler(void)
 {
-	void *wakeaddr;
-
-	if (!cold)
-		return;
+	void		*wakeaddr;
+	int		i;
 
 	/*
 	 * Specify the region for our wakeup code.  We want it in the low 1 MB
-	 * region, excluding video memory and above (0xa0000).  We ask for
-	 * it to be page-aligned, just to be safe.
+	 * region, excluding real mode IVT (0-0x3ff), BDA (0x400-0x4ff), EBDA
+	 * (less than 128KB, below 0xa0000, must be excluded by SMAP and DSDT),
+	 * and ROM area (0xa0000 and above).  The temporary page tables must be
+	 * page-aligned.
 	 */
-	if (bus_dma_tag_create(/*parent*/ NULL,
-	    /*alignment*/ PAGE_SIZE, /*no boundary*/ 0,
-	    /*lowaddr*/ 0x9ffff, /*highaddr*/ BUS_SPACE_MAXADDR, NULL, NULL,
-	    /*maxsize*/ PAGE_SIZE, /*segments*/ 1, /*maxsegsize*/ PAGE_SIZE,
-	    0, busdma_lock_mutex, &Giant, &acpi_waketag) != 0) {
-		printf("acpi_alloc_wakeup_handler: can't create wake tag\n");
-		return;
+	wakeaddr = contigmalloc((ACPI_PAGETABLES + 1) * PAGE_SIZE, M_DEVBUF,
+	    M_NOWAIT, 0x500, 0xa0000, PAGE_SIZE, 0ul);
+	if (wakeaddr == NULL) {
+		printf("%s: can't alloc wake memory\n", __func__);
+		return (NULL);
 	}
-	if (bus_dmamem_alloc(acpi_waketag, &wakeaddr, BUS_DMA_NOWAIT,
-	    &acpi_wakemap) != 0) {
-		printf("acpi_alloc_wakeup_handler: can't alloc wake memory\n");
-		return;
+	if (EVENTHANDLER_REGISTER(power_resume, acpi_stop_beep, NULL,
+	    EVENTHANDLER_PRI_LAST) == NULL) {
+		printf("%s: can't register event handler\n", __func__);
+		contigfree(wakeaddr, (ACPI_PAGETABLES + 1) * PAGE_SIZE, M_DEVBUF);
+		return (NULL);
 	}
-	acpi_wakeaddr = (vm_offset_t)wakeaddr;
-}
-
-SYSINIT(acpiwakeup, SI_SUB_KMEM, SI_ORDER_ANY, acpi_alloc_wakeup_handler, 0);
-
-static void
-acpi_realmodeinst(void *arg, bus_dma_segment_t *segs, int nsegs, int error)
-{
-	struct acpi_softc *sc;
-	uint32_t *addr;
-
-	/* Overwrite the ljmp target with the real address */
-	sc = arg;
-	sc->acpi_wakephys = segs[0].ds_addr;
-	addr = (uint32_t *)&wakecode[wakeup_sw32 + 2];
-	*addr = sc->acpi_wakephys + wakeup_32;
-
-	/* Copy the wake code into our low page and save its physical addr. */
-	bcopy(wakecode, (void *)sc->acpi_wakeaddr, sizeof(wakecode));
-	if (bootverbose) {
-		device_printf(sc->acpi_dev, "wakeup code va %#x pa %#jx\n",
-		    acpi_wakeaddr, (uintmax_t)sc->acpi_wakephys);
+	susppcbs = malloc(mp_ncpus * sizeof(*susppcbs), M_DEVBUF, M_WAITOK);
+	for (i = 0; i < mp_ncpus; i++) {
+		susppcbs[i] = malloc(sizeof(**susppcbs), M_DEVBUF, M_WAITOK);
 	}
+
+	return (wakeaddr);
 }
 
 void
 acpi_install_wakeup_handler(struct acpi_softc *sc)
 {
-	if (acpi_wakeaddr == 0)
+	static void	*wakeaddr = NULL;
+
+	if (wakeaddr != NULL)
+		return;
+
+	wakeaddr = acpi_alloc_wakeup_handler();
+	if (wakeaddr == NULL)
 		return;
 
-	sc->acpi_waketag = acpi_waketag;
-	sc->acpi_wakeaddr = acpi_wakeaddr;
-	sc->acpi_wakemap = acpi_wakemap;
+	sc->acpi_wakeaddr = (vm_offset_t)wakeaddr;
+	sc->acpi_wakephys = vtophys(wakeaddr);
 
-	bus_dmamap_load(sc->acpi_waketag, sc->acpi_wakemap,
-	    (void *)sc->acpi_wakeaddr, PAGE_SIZE, acpi_realmodeinst, sc, 0);
+	bcopy(wakecode, (void *)WAKECODE_VADDR(sc), sizeof(wakecode));
+
+	/* Patch GDT base address, ljmp target. */
+	WAKECODE_FIXUP((bootgdtdesc + 2), uint32_t,
+	    WAKECODE_PADDR(sc) + bootgdt);
+	WAKECODE_FIXUP((wakeup_sw32 + 2), uint32_t,
+	    WAKECODE_PADDR(sc) + wakeup_32);
+
+	/* Save pointers to some global data. */
+	WAKECODE_FIXUP(wakeup_ret, void *, resumectx);
+
+	if (bootverbose)
+		device_printf(sc->acpi_dev, "wakeup code va %#x pa %#jx\n",
+		    sc->acpi_wakeaddr, (uintmax_t)sc->acpi_wakephys);
 }

Modified: stable/9/sys/i386/i386/apic_vector.s
==============================================================================
--- stable/9/sys/i386/i386/apic_vector.s	Tue May 22 17:30:02 2012	(r235795)
+++ stable/9/sys/i386/i386/apic_vector.s	Tue May 22 17:44:01 2012	(r235796)
@@ -334,6 +334,26 @@ IDTVEC(cpustop)
 	iret
 
 /*
+ * Executed by a CPU when it receives an IPI_SUSPEND from another CPU.
+ */
+#ifndef XEN
+	.text
+	SUPERALIGN_TEXT
+IDTVEC(cpususpend)
+	PUSH_FRAME
+	SET_KERNEL_SREGS
+	cld
+
+	movl	lapic, %eax
+	movl	$0, LA_EOI(%eax)	/* End Of Interrupt to APIC */
+
+	call	cpususpend_handler
+
+	POP_FRAME
+	jmp	doreti_iret
+#endif
+
+/*
  * Executed by a CPU when it receives a RENDEZVOUS IPI from another CPU.
  *
  * - Calls the generic rendezvous action function.

Modified: stable/9/sys/i386/i386/genassym.c
==============================================================================
--- stable/9/sys/i386/i386/genassym.c	Tue May 22 17:30:02 2012	(r235795)
+++ stable/9/sys/i386/i386/genassym.c	Tue May 22 17:44:01 2012	(r235796)
@@ -121,7 +121,10 @@ ASSYM(VM_MAXUSER_ADDRESS, VM_MAXUSER_ADD
 ASSYM(KERNBASE, KERNBASE);

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

From owner-svn-src-stable-9@FreeBSD.ORG  Tue May 22 18:30:14 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id C4EAD106566B;
	Tue, 22 May 2012 18:30:14 +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 ADF8D8FC0C;
	Tue, 22 May 2012 18:30: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 q4MIUECp020233;
	Tue, 22 May 2012 18:30:14 GMT
	(envelope-from theraven@svn.freebsd.org)
Received: (from theraven@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4MIUEtw020224;
	Tue, 22 May 2012 18:30:14 GMT
	(envelope-from theraven@svn.freebsd.org)
Message-Id: <201205221830.q4MIUEtw020224@svn.freebsd.org>
From: David Chisnall <theraven@FreeBSD.org>
Date: Tue, 22 May 2012 18:30:14 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r235798 - in stable/9: . contrib/libc++
	contrib/libcxxrt etc/mtree lib lib/libc++ lib/libcxxrt share/mk
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 22 May 2012 18:30:14 -0000

Author: theraven
Date: Tue May 22 18:30:14 2012
New Revision: 235798
URL: http://svn.freebsd.org/changeset/base/235798

Log:
  Merged libcxxrt and libc++.  Now available for testing on 9-stable with
  -stdlib=libc++.  Changes to libstdc++ not yet merged, so it is not yet possible
  to mix libstdc++ and libc++ in the same program.
  
  Merged revisions: 226702,226785,227006,227755,227983,227987,228531,228630,228761,229067,230127,232950,233098,234715-234716,234772

Added:
  stable/9/contrib/libc++/
     - copied from r235786, head/contrib/libc++/
  stable/9/contrib/libcxxrt/
     - copied from r235786, head/contrib/libcxxrt/
     - copied from r227983, head/lib/libc++/
     - copied from r227983, head/lib/libcxxrt/
  stable/9/lib/libcxxrt/Version.map
     - copied, changed from r233174, head/lib/libcxxrt/Version.map
Directory Properties:
  stable/9/lib/libc++/   (props changed)
  stable/9/lib/libcxxrt/   (props changed)
Modified:
  stable/9/Makefile.inc1   (contents, props changed)
  stable/9/etc/mtree/BSD.include.dist
  stable/9/lib/Makefile
  stable/9/lib/libc++/Makefile
  stable/9/lib/libcxxrt/Makefile
  stable/9/share/mk/bsd.libnames.mk
  stable/9/share/mk/bsd.own.mk
Directory Properties:
  stable/9/etc/   (props changed)
  stable/9/lib/   (props changed)
  stable/9/share/mk/   (props changed)

Modified: stable/9/Makefile.inc1
==============================================================================
--- stable/9/Makefile.inc1	Tue May 22 18:18:06 2012	(r235797)
+++ stable/9/Makefile.inc1	Tue May 22 18:30:14 2012	(r235798)
@@ -1235,6 +1235,9 @@ _startup_libs+=	lib/csu/${MACHINE_CPUARC
 _startup_libs+=	gnu/lib/libgcc
 _startup_libs+=	lib/libcompiler_rt
 _startup_libs+=	lib/libc
+.if ${MK_LIBCPLUSPLUS} != "no"
+_startup_libs+=	lib/libcxxrt
+.endif
 
 gnu/lib/libgcc__L: lib/libc__L
 

Modified: stable/9/etc/mtree/BSD.include.dist
==============================================================================
--- stable/9/etc/mtree/BSD.include.dist	Tue May 22 18:18:06 2012	(r235797)
+++ stable/9/etc/mtree/BSD.include.dist	Tue May 22 18:30:14 2012	(r235798)
@@ -76,6 +76,10 @@
             tr1
             ..
         ..
+        v1
+            ext
+            ..
+        ..
     ..
     cam
         ata

Modified: stable/9/lib/Makefile
==============================================================================
--- stable/9/lib/Makefile	Tue May 22 18:18:06 2012	(r235797)
+++ stable/9/lib/Makefile	Tue May 22 18:30:14 2012	(r235798)
@@ -48,7 +48,9 @@ SUBDIR_ORDERED=	${_csu} \
 	libsbuf \
 	libtacplus \
 	libutil \
-	${_libypclnt}
+	${_libypclnt} \
+	${_libcxxrt} \
+	${_libcplusplus}
 
 SUBDIR=	${SUBDIR_ORDERED} \
 	libalias \
@@ -211,6 +213,11 @@ _libsmb=	libsmb
 _libmp=		libmp
 .endif
 
+.if ${MK_LIBCPLUSPLUS} != "no"
+_libcxxrt=	libcxxrt
+_libcplusplus=	libc++
+.endif
+
 .if ${MK_PMC} != "no"
 _libpmc=	libpmc
 .endif

Modified: stable/9/lib/libc++/Makefile
==============================================================================
--- head/lib/libc++/Makefile	Fri Nov 25 20:59:04 2011	(r227983)
+++ stable/9/lib/libc++/Makefile	Tue May 22 18:30:14 2012	(r235798)
@@ -39,7 +39,7 @@ WARNS=          0
 CXXFLAGS+=      -I${HDRDIR} -I${LIBCXXRTDIR} -std=c++0x -nostdlib -DLIBCXXRT
 
 DPADD=          ${LIBCXXRT}
-LDADD=          -L${.OBJDIR}/../libcxxrt/ -lcxxrt
+LDADD=          -lcxxrt
 LDFLAGS+=       --verbose
 INCSGROUPS=     STD EXT
 
@@ -58,6 +58,7 @@ STD_HEADERS=    __bit_reference\
                 __tree\
                 __tuple\
                 __tuple_03\
+                __undef_min_max\
                 algorithm\
                 array\
                 atomic\

Modified: stable/9/lib/libcxxrt/Makefile
==============================================================================
--- head/lib/libcxxrt/Makefile	Fri Nov 25 20:59:04 2011	(r227983)
+++ stable/9/lib/libcxxrt/Makefile	Tue May 22 18:30:14 2012	(r235798)
@@ -21,6 +21,6 @@ SRCS+=        libelftc_dem_gnu3.c\
 
 WARNS=        0
 CFLAGS+=      -I${SRCDIR}
-LDADD+=       -pthread
+VERSION_MAP=  ${.CURDIR}/Version.map
 
 .include <bsd.lib.mk>

Copied and modified: stable/9/lib/libcxxrt/Version.map (from r233174, head/lib/libcxxrt/Version.map)
==============================================================================
--- head/lib/libcxxrt/Version.map	Mon Mar 19 11:53:33 2012	(r233174, copy source)
+++ stable/9/lib/libcxxrt/Version.map	Tue May 22 18:30:14 2012	(r235798)
@@ -301,6 +301,11 @@ CXXRT_1.0 {
         "typeinfo name for std::exception";
         "typeinfo name for std::type_info";
 
+        "std::type_info::__is_function_p() const";
+        "std::type_info::__do_upcast(__cxxabiv1::__class_type_info const*, void**) const";
+        "std::type_info::__is_pointer_p() const";
+
+
         "operator delete[](void*)";
         "operator delete(void*)";
         "operator new[](unsigned long)";

Modified: stable/9/share/mk/bsd.libnames.mk
==============================================================================
--- stable/9/share/mk/bsd.libnames.mk	Tue May 22 18:18:06 2012	(r235797)
+++ stable/9/share/mk/bsd.libnames.mk	Tue May 22 18:30:14 2012	(r235798)
@@ -26,6 +26,8 @@ LIBBSDXML?=	${DESTDIR}${LIBDIR}/libbsdxm
 LIBBSM?=	${DESTDIR}${LIBDIR}/libbsm.a
 LIBBSNMP?=	${DESTDIR}${LIBDIR}/libbsnmp.a
 LIBBZ2?=	${DESTDIR}${LIBDIR}/libbz2.a
+LIBCXXRT?=	${DESTDIR}${LIBDIR}/libcxxrt.a
+LIBCPLUSPLUS?=	${DESTDIR}${LIBDIR}/libc++.a
 LIBC?=		${DESTDIR}${LIBDIR}/libc.a
 LIBC_PIC?=	${DESTDIR}${LIBDIR}/libc_pic.a
 LIBCALENDAR?=	${DESTDIR}${LIBDIR}/libcalendar.a

Modified: stable/9/share/mk/bsd.own.mk
==============================================================================
--- stable/9/share/mk/bsd.own.mk	Tue May 22 18:18:06 2012	(r235797)
+++ stable/9/share/mk/bsd.own.mk	Tue May 22 18:30:14 2012	(r235798)
@@ -418,6 +418,7 @@ __DEFAULT_NO_OPTIONS = \
     HESIOD \
     ICONV \
     IDEA \
+    LIBCPLUSPLUS \
     OFED \
     SHARED_TOOLCHAIN
 
@@ -572,6 +573,10 @@ MK_GDB:=	no
 MK_CLANG_IS_CC:= no
 .endif
 
+MK_LIBCPLUSPLUS?= no
+
+MK_LIBCPLUSPLUS?= no
+
 #
 # Set defaults for the MK_*_SUPPORT variables.
 #

From owner-svn-src-stable-9@FreeBSD.ORG  Tue May 22 18:42:16 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@FreeBSD.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id BDBE8106566B;
	Tue, 22 May 2012 18:42:16 +0000 (UTC)
	(envelope-from seanbru@yahoo-inc.com)
Received: from mrout1-b.corp.bf1.yahoo.com (mrout1-b.corp.bf1.yahoo.com
	[98.139.253.104])
	by mx1.freebsd.org (Postfix) with ESMTP id 5F2DE8FC0A;
	Tue, 22 May 2012 18:42:16 +0000 (UTC)
Received: from [IPv6:::1] (rideseveral.corp.yahoo.com [10.73.160.231])
	by mrout1-b.corp.bf1.yahoo.com (8.14.4/8.14.4/y.out) with ESMTP id
	q4MIfwu2098025; Tue, 22 May 2012 11:41:58 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=yahoo-inc.com;
	s=cobra; t=1337712119;
	bh=zb7WRBswLMGn0sHRAWA5HjXvvDyXZnjH4b2a9VcRW3w=;
	h=Subject:From:To:Cc:In-Reply-To:References:Content-Type:Date:
	Message-ID:Mime-Version:Content-Transfer-Encoding;
	b=i/NOb+R8MR3MWdAIRSaVZppdvxpltUZLSEJ1+iqaDaS1sw6nvO4u5xfyEz139jF5D
	ObncCX50YBHnYECrCXf0MJLBxdxiQ+VHIkpAyU3Q0MnLtTc1hsGrWSWI75gLtFU6Nf
	HAJypifhWKKBbOPkHUD9LZSeHpcd+G2Y7Yi2rLLE=
From: Sean Bruno <seanbru@yahoo-inc.com>
To: John Baldwin <jhb@FreeBSD.org>
In-Reply-To: <4FBAD919.2010706@FreeBSD.org>
References: <201205211958.q4LJweXG070838@svn.freebsd.org>
	<201205211718.34896.jhb@freebsd.org>  <4FBAD919.2010706@FreeBSD.org>
Content-Type: text/plain; charset="UTF-8"
Date: Tue, 22 May 2012 11:41:57 -0700
Message-ID: <1337712117.2916.10.camel@powernoodle-l7.corp.yahoo.com>
Mime-Version: 1.0
X-Mailer: Evolution 2.32.1 FreeBSD GNOME Team Port 
Content-Transfer-Encoding: 7bit
X-Milter-Version: master.31+4-gbc07cd5+
X-CLX-ID: 712118000
Cc: "svn-src-stable@FreeBSD.org" <svn-src-stable@FreeBSD.org>,
	Sean Bruno <sbruno@FreeBSD.org>,
	"src-committers@FreeBSD.org" <src-committers@FreeBSD.org>,
	"svn-src-all@FreeBSD.org" <svn-src-all@FreeBSD.org>,
	"svn-src-stable-9@FreeBSD.org" <svn-src-stable-9@FreeBSD.org>
Subject: Re: svn commit: r235738 - in stable/9/sys: . dev/mfi
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 22 May 2012 18:42:16 -0000

On Mon, 2012-05-21 at 17:08 -0700, John Baldwin wrote:
> On 5/21/12 5:18 PM, John Baldwin wrote:
> > On Monday, May 21, 2012 3:58:40 pm Sean Bruno wrote:
> >> Author: sbruno
> >> Date: Mon May 21 19:58:40 2012
> >> New Revision: 235738
> >> URL: http://svn.freebsd.org/changeset/base/235738
> >>
> >> Log:
> >>   MFC r235634
> >>   
> >>   Fix and update battery status bits according to linux driver
> > 
> > Hmm, svn seems to have crapped itself.
> > 
> > We should probably at least remove the unnecessary mergeinfo from files.
> > 
> > Ah, it looks like the MFC of the last round of ixgbe changes was merged into a 
> > sparse checkout, and that is causing the pain.  I will try to fix this, but 
> > can other folks hold off on merging to stable/9/sys while I do so?
> 
> I think I have this cleaned up.  However, I have only tried using a 1.6
> client so far (and it was merging things fine before).  Sean, I think
> you are using a 1.7 client, yes?
> 
Correct:


[sbruno@ref9-xen64 /dumpster/scratch/sbruno-scratch/9]$ svn --version
svn, version 1.7.2 (r1207936)
   compiled Dec 10 2011, 23:46:28

Copyright (C) 2011 The Apache Software Foundation.
This software consists of contributions made by many people; see the
NOTICE
file for more information.
Subversion is open source software, see http://subversion.apache.org/

The following repository access (RA) modules are available:

* ra_neon : Module for accessing a repository via WebDAV protocol using
Neon.
  - handles 'http' scheme
  - handles 'https' scheme
* ra_svn : Module for accessing a repository using the svn network
protocol.
  - handles 'svn' scheme
* ra_local : Module for accessing a repository on local disk.
  - handles 'file' scheme


> If anyone does a merge and notices that it adds a ton of new mergeinfo,
> can you please wait to commit until after someone else has looked at it?
>  Hopefully the mergeinfo stuff I adjusted will fix this.  (And I'm
> done with my current guesses at fixing.)
> 


Sean


From owner-svn-src-stable-9@FreeBSD.ORG  Tue May 22 19:53:25 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 9AB43106566C;
	Tue, 22 May 2012 19:53:25 +0000 (UTC)
	(envelope-from delphij@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 85ED48FC16;
	Tue, 22 May 2012 19:53: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 q4MJrPqB024185;
	Tue, 22 May 2012 19:53:25 GMT (envelope-from delphij@svn.freebsd.org)
Received: (from delphij@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4MJrPCL024183;
	Tue, 22 May 2012 19:53:25 GMT (envelope-from delphij@svn.freebsd.org)
Message-Id: <201205221953.q4MJrPCL024183@svn.freebsd.org>
From: Xin LI <delphij@FreeBSD.org>
Date: Tue, 22 May 2012 19:53:25 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r235805 - stable/9/sys/netinet
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 22 May 2012 19:53:25 -0000

Author: delphij
Date: Tue May 22 19:53:25 2012
New Revision: 235805
URL: http://svn.freebsd.org/changeset/base/235805

Log:
  MFC r235036:
  
  Add ToS definitions for DiffServ Codepoints as per RFC2474.
  
  Obtained from:	OpenBSD

Modified:
  stable/9/sys/netinet/ip.h
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/netinet/ip.h
==============================================================================
--- stable/9/sys/netinet/ip.h	Tue May 22 19:50:21 2012	(r235804)
+++ stable/9/sys/netinet/ip.h	Tue May 22 19:53:25 2012	(r235805)
@@ -92,6 +92,31 @@ struct ip {
 #define	IPTOS_PREC_ROUTINE		0x00
 
 /*
+ * Definitions for DiffServ Codepoints as per RFC2474
+ */
+#define	IPTOS_DSCP_CS0		0x00
+#define	IPTOS_DSCP_CS1		0x20
+#define	IPTOS_DSCP_AF11		0x28
+#define	IPTOS_DSCP_AF12		0x30
+#define	IPTOS_DSCP_AF13		0x38
+#define	IPTOS_DSCP_CS2		0x40
+#define	IPTOS_DSCP_AF21		0x48
+#define	IPTOS_DSCP_AF22		0x50
+#define	IPTOS_DSCP_AF23		0x58
+#define	IPTOS_DSCP_CS3		0x60
+#define	IPTOS_DSCP_AF31		0x68
+#define	IPTOS_DSCP_AF32		0x70
+#define	IPTOS_DSCP_AF33		0x78
+#define	IPTOS_DSCP_CS4		0x80
+#define	IPTOS_DSCP_AF41		0x88
+#define	IPTOS_DSCP_AF42		0x90
+#define	IPTOS_DSCP_AF43		0x98
+#define	IPTOS_DSCP_CS5		0xa0
+#define	IPTOS_DSCP_EF		0xb8
+#define	IPTOS_DSCP_CS6		0xc0
+#define	IPTOS_DSCP_CS7		0xe0
+
+/*
  * ECN (Explicit Congestion Notification) codepoints in RFC3168 mapped to the
  * lower 2 bits of the TOS field.
  */

From owner-svn-src-stable-9@FreeBSD.ORG  Tue May 22 20:26:15 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 7994C106564A;
	Tue, 22 May 2012 20:26:15 +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 64FD58FC16;
	Tue, 22 May 2012 20:26: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 q4MKQF4e025732;
	Tue, 22 May 2012 20:26:15 GMT (envelope-from dim@svn.freebsd.org)
Received: (from dim@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4MKQFO0025730;
	Tue, 22 May 2012 20:26:15 GMT (envelope-from dim@svn.freebsd.org)
Message-Id: <201205222026.q4MKQFO0025730@svn.freebsd.org>
From: Dimitry Andric <dim@FreeBSD.org>
Date: Tue, 22 May 2012 20:26:15 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r235806 - stable/9/sys/sys
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 22 May 2012 20:26:15 -0000

Author: dim
Date: Tue May 22 20:26:14 2012
New Revision: 235806
URL: http://svn.freebsd.org/changeset/base/235806

Log:
  MFC r227478:
  
  Fix kernel build breakage after r227475.  I had forgotten kernels are
  built with -Wundef, as opposed to world.
  
  Additionally, cdefs.h tends to not use indentation for preprocessor
  directives, so remove that too.
  
  Pointy hat to:	me

Modified:
  stable/9/sys/sys/cdefs.h
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/sys/cdefs.h
==============================================================================
--- stable/9/sys/sys/cdefs.h	Tue May 22 19:53:25 2012	(r235805)
+++ stable/9/sys/sys/cdefs.h	Tue May 22 20:26:14 2012	(r235806)
@@ -309,14 +309,14 @@
 #endif
 
 /* C++11 exposes a load of C99 stuff */
-#if __cplusplus >= 201103L
-#	define	__LONG_LONG_SUPPORTED
-#	ifndef __STDC_LIMIT_MACROS
-#		define __STDC_LIMIT_MACROS
-#	endif
-#	ifndef __STDC_CONSTANT_MACROS
-#		define __STDC_CONSTANT_MACROS
-#	endif
+#if defined(__cplusplus) && __cplusplus >= 201103L
+#define	__LONG_LONG_SUPPORTED
+#ifndef	__STDC_LIMIT_MACROS
+#define	__STDC_LIMIT_MACROS
+#endif
+#ifndef	__STDC_CONSTANT_MACROS
+#define	__STDC_CONSTANT_MACROS
+#endif
 #endif
 
 /*

From owner-svn-src-stable-9@FreeBSD.ORG  Wed May 23 02:02:30 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 693401065688;
	Wed, 23 May 2012 02:02:30 +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 5183D8FC18;
	Wed, 23 May 2012 02:02: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 q4N22UYM041841;
	Wed, 23 May 2012 02:02:30 GMT (envelope-from yongari@svn.freebsd.org)
Received: (from yongari@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4N22UDA041838;
	Wed, 23 May 2012 02:02:30 GMT (envelope-from yongari@svn.freebsd.org)
Message-Id: <201205230202.q4N22UDA041838@svn.freebsd.org>
From: Pyun YongHyeon <yongari@FreeBSD.org>
Date: Wed, 23 May 2012 02:02:30 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r235818 - stable/9/sys/dev/bce
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Wed, 23 May 2012 02:02:30 -0000

Author: yongari
Date: Wed May 23 02:02:29 2012
New Revision: 235818
URL: http://svn.freebsd.org/changeset/base/235818

Log:
  MFC r235151:
    Implement basic remote PHY support. Remote PHY allows the
    controller to perform MDIO type accesses to a remote transceiver
    using message pages defined through MRBE(multirate backplane
    ethernet).  It's used in blade systems(e.g Dell Blade m610) which
    are connected to pass-through blades rather than traditional
    switches.
    This change directly manipulates firmware's mailboxes to control
    remote PHY such that it does not use mii(4).  Alternatively, as
    David said, it could be implemented in brgphy(4) by creating a fake
    PHY and let brgphy(4) do necessary mii accesses and bce(4) can
    implement mailbox accesses based on the type of brgphy(4)'s mii
    accesses. Personally, I think it would make brgphy(4) hard to
    maintain since it would have to access many bce(4) registers in
    brgphy(4). Given that there are users who are suffering from lack
    of remote PHY support, it would be better to get working system
    rather than waiting for complete/perfect implementation.

Modified:
  stable/9/sys/dev/bce/if_bce.c
  stable/9/sys/dev/bce/if_bcereg.h
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/amd64/include/xen/   (props changed)
  stable/9/sys/boot/   (props changed)
  stable/9/sys/boot/i386/efi/   (props changed)
  stable/9/sys/boot/ia64/efi/   (props changed)
  stable/9/sys/boot/ia64/ski/   (props changed)
  stable/9/sys/boot/powerpc/boot1.chrp/   (props changed)
  stable/9/sys/boot/powerpc/ofw/   (props changed)
  stable/9/sys/cddl/contrib/opensolaris/   (props changed)
  stable/9/sys/conf/   (props changed)
  stable/9/sys/contrib/dev/acpica/   (props changed)
  stable/9/sys/contrib/octeon-sdk/   (props changed)
  stable/9/sys/contrib/pf/   (props changed)
  stable/9/sys/contrib/x86emu/   (props changed)
  stable/9/sys/dev/   (props changed)
  stable/9/sys/dev/e1000/   (props changed)
  stable/9/sys/dev/ixgbe/   (props changed)
  stable/9/sys/fs/   (props changed)
  stable/9/sys/fs/ntfs/   (props changed)
  stable/9/sys/modules/   (props changed)

Modified: stable/9/sys/dev/bce/if_bce.c
==============================================================================
--- stable/9/sys/dev/bce/if_bce.c	Wed May 23 01:49:50 2012	(r235817)
+++ stable/9/sys/dev/bce/if_bce.c	Wed May 23 02:02:29 2012	(r235818)
@@ -364,6 +364,7 @@ static int  bce_nvram_write		(struct bce
 static void bce_get_rx_buffer_sizes(struct bce_softc *, int);
 static void bce_get_media			(struct bce_softc *);
 static void bce_init_media			(struct bce_softc *);
+static u32 bce_get_rphy_link		(struct bce_softc *);
 static void bce_dma_map_addr		(void *, bus_dma_segment_t *, int, int);
 static int  bce_dma_alloc			(device_t);
 static void bce_dma_free			(struct bce_softc *);
@@ -372,6 +373,7 @@ static void bce_release_resources	(struc
 /****************************************************************************/
 /* BCE Firmware Synchronization and Load                                    */
 /****************************************************************************/
+static void bce_fw_cap_init			(struct bce_softc *);
 static int  bce_fw_sync			(struct bce_softc *, u32);
 static void bce_load_rv2p_fw		(struct bce_softc *, u32 *, u32, u32);
 static void bce_load_cpu_fw		(struct bce_softc *,
@@ -418,6 +420,7 @@ static void bce_watchdog			(struct bce_s
 static int  bce_ifmedia_upd		(struct ifnet *);
 static int  bce_ifmedia_upd_locked	(struct ifnet *);
 static void bce_ifmedia_sts		(struct ifnet *, struct ifmediareq *);
+static void bce_ifmedia_sts_rphy	(struct bce_softc *, struct ifmediareq *);
 static void bce_init_locked		(struct bce_softc *);
 static void bce_init				(void *);
 static void bce_mgmt_init_locked	(struct bce_softc *sc);
@@ -757,6 +760,13 @@ bce_print_adapter_info(struct bce_softc 
 			printf("2.5G"); i++;
 		}
 
+		if (sc->bce_phy_flags & BCE_PHY_REMOTE_CAP_FLAG) {
+			if (i > 0) printf("|");
+			printf("Remote PHY(%s)",
+			    sc->bce_phy_flags & BCE_PHY_REMOTE_PORT_FIBER_FLAG ?
+			    "FIBER" : "TP"); i++;
+		}
+
 		if (sc->bce_flags & BCE_MFW_ENABLE_FLAG) {
 			if (i > 0) printf("|");
 			printf("MFW); MFW (%s)\n", sc->bce_mfw_ver);
@@ -1297,6 +1307,9 @@ bce_attach(device_t dev)
 	if (val & BCE_PCICFG_MISC_STATUS_32BIT_DET)
 		sc->bce_flags |= BCE_PCI_32BIT_FLAG;
 
+	/* Find the media type for the adapter. */
+	bce_get_media(sc);
+
 	/* Reset controller and announce to bootcode that driver is present. */
 	if (bce_reset(sc, BCE_DRV_MSG_CODE_RESET)) {
 		BCE_PRINTF("%s(%d): Controller reset failed!\n",
@@ -1344,9 +1357,6 @@ bce_attach(device_t dev)
 	/* Update statistics once every second. */
 	sc->bce_stats_ticks = 1000000 & 0xffff00;
 
-	/* Find the media type for the adapter. */
-	bce_get_media(sc);
-
 	/* Store data needed by PHY driver for backplane applications */
 	sc->bce_shared_hw_cfg = bce_shmem_rd(sc, BCE_SHARED_HW_CFG_CONFIG);
 	sc->bce_port_hw_cfg   = bce_shmem_rd(sc, BCE_PORT_HW_CFG_CONFIG);
@@ -1386,6 +1396,15 @@ bce_attach(device_t dev)
 		ifp->if_capabilities = BCE_IF_CAPABILITIES;
 	}
 
+#if __FreeBSD_version >= 800505
+	/*
+	 * Introducing IFCAP_LINKSTATE didn't bump __FreeBSD_version
+	 * so it's approximate value.
+	 */
+	if ((sc->bce_phy_flags & BCE_PHY_REMOTE_CAP_FLAG) != 0)
+		ifp->if_capabilities |= IFCAP_LINKSTATE;
+#endif
+
 	ifp->if_capenable = ifp->if_capabilities;
 
 	/*
@@ -1409,14 +1428,52 @@ bce_attach(device_t dev)
 	/* Handle any special PHY initialization for SerDes PHYs. */
 	bce_init_media(sc);
 
-	/* MII child bus by attaching the PHY. */
-	rc = mii_attach(dev, &sc->bce_miibus, ifp, bce_ifmedia_upd,
-	    bce_ifmedia_sts, BMSR_DEFCAPMASK, sc->bce_phy_addr,
-	    MII_OFFSET_ANY, MIIF_DOPAUSE);
-	if (rc != 0) {
-		BCE_PRINTF("%s(%d): attaching PHYs failed\n", __FILE__,
-		    __LINE__);
-		goto bce_attach_fail;
+	if ((sc->bce_phy_flags & BCE_PHY_REMOTE_CAP_FLAG) != 0) {
+		ifmedia_init(&sc->bce_ifmedia, IFM_IMASK, bce_ifmedia_upd,
+		    bce_ifmedia_sts);
+		/*
+		 * We can't manually override remote PHY's link and assume
+		 * PHY port configuration(Fiber or TP) is not changed after
+		 * device attach.  This may not be correct though.
+		 */
+		if ((sc->bce_phy_flags & BCE_PHY_REMOTE_PORT_FIBER_FLAG) != 0) {
+			if (sc->bce_phy_flags & BCE_PHY_2_5G_CAPABLE_FLAG) {
+				ifmedia_add(&sc->bce_ifmedia,
+				    IFM_ETHER | IFM_2500_SX, 0, NULL);
+				ifmedia_add(&sc->bce_ifmedia,
+				    IFM_ETHER | IFM_2500_SX | IFM_FDX, 0, NULL);
+			}
+			ifmedia_add(&sc->bce_ifmedia,
+			    IFM_ETHER | IFM_1000_SX, 0, NULL);
+			ifmedia_add(&sc->bce_ifmedia,
+			    IFM_ETHER | IFM_1000_SX | IFM_FDX, 0, NULL);
+		} else {
+			ifmedia_add(&sc->bce_ifmedia,
+			    IFM_ETHER | IFM_10_T, 0, NULL);
+			ifmedia_add(&sc->bce_ifmedia,
+			    IFM_ETHER | IFM_10_T | IFM_FDX, 0, NULL);
+			ifmedia_add(&sc->bce_ifmedia,
+			    IFM_ETHER | IFM_100_TX, 0, NULL);
+			ifmedia_add(&sc->bce_ifmedia,
+			    IFM_ETHER | IFM_100_TX | IFM_FDX, 0, NULL);
+			ifmedia_add(&sc->bce_ifmedia,
+			    IFM_ETHER | IFM_1000_T, 0, NULL);
+			ifmedia_add(&sc->bce_ifmedia,
+			    IFM_ETHER | IFM_1000_T | IFM_FDX, 0, NULL);
+		}
+		ifmedia_add(&sc->bce_ifmedia, IFM_ETHER | IFM_AUTO, 0, NULL);
+		ifmedia_set(&sc->bce_ifmedia, IFM_ETHER | IFM_AUTO);
+		sc->bce_ifmedia.ifm_media = sc->bce_ifmedia.ifm_cur->ifm_media;
+	} else {
+		/* MII child bus by attaching the PHY. */
+		rc = mii_attach(dev, &sc->bce_miibus, ifp, bce_ifmedia_upd,
+		    bce_ifmedia_sts, BMSR_DEFCAPMASK, sc->bce_phy_addr,
+		    MII_OFFSET_ANY, MIIF_DOPAUSE);
+		if (rc != 0) {
+			BCE_PRINTF("%s(%d): attaching PHYs failed\n", __FILE__,
+			    __LINE__);
+			goto bce_attach_fail;
+		}
 	}
 
 	/* Attach to the Ethernet interface list. */
@@ -1521,8 +1578,12 @@ bce_detach(device_t dev)
 	ether_ifdetach(ifp);
 
 	/* If we have a child device on the MII bus remove it too. */
-	bus_generic_detach(dev);
-	device_delete_child(dev, sc->bce_miibus);
+	if ((sc->bce_phy_flags & BCE_PHY_REMOTE_CAP_FLAG) != 0)
+		ifmedia_removeall(&sc->bce_ifmedia);
+	else {
+		bus_generic_detach(dev);
+		device_delete_child(dev, sc->bce_miibus);
+	}
 
 	/* Release all remaining resources. */
 	bce_release_resources(sc);
@@ -1983,13 +2044,23 @@ bce_miibus_statchg(device_t dev)
 {
 	struct bce_softc *sc;
 	struct mii_data *mii;
-	int val;
+	struct ifmediareq ifmr;
+	int media_active, media_status, val;
 
 	sc = device_get_softc(dev);
 
 	DBENTER(BCE_VERBOSE_PHY);
 
-	mii = device_get_softc(sc->bce_miibus);
+	if ((sc->bce_phy_flags & BCE_PHY_REMOTE_CAP_FLAG) != 0) {
+		bzero(&ifmr, sizeof(ifmr));
+		bce_ifmedia_sts_rphy(sc, &ifmr);
+		media_active = ifmr.ifm_active;
+		media_status = ifmr.ifm_status;
+	} else {
+		mii = device_get_softc(sc->bce_miibus);
+		media_active = mii->mii_media_active;
+		media_status = mii->mii_media_status;
+	}
 
 	val = REG_RD(sc, BCE_EMAC_MODE);
 	val &= ~(BCE_EMAC_MODE_PORT | BCE_EMAC_MODE_HALF_DUPLEX |
@@ -1997,7 +2068,7 @@ bce_miibus_statchg(device_t dev)
 	    BCE_EMAC_MODE_25G);
 
 	/* Set MII or GMII interface based on the PHY speed. */
-	switch (IFM_SUBTYPE(mii->mii_media_active)) {
+	switch (IFM_SUBTYPE(media_active)) {
 	case IFM_10_T:
 		if (BCE_CHIP_NUM(sc) != BCE_CHIP_NUM_5706) {
 			DBPRINT(sc, BCE_INFO_PHY,
@@ -2026,7 +2097,7 @@ bce_miibus_statchg(device_t dev)
 	}
 
 	/* Set half or full duplex based on PHY settings. */
-	if ((mii->mii_media_active & IFM_GMASK) == IFM_HDX) {
+	if ((IFM_OPTIONS(media_active) & IFM_FDX) == 0) {
 		DBPRINT(sc, BCE_INFO_PHY,
 		    "Setting Half-Duplex interface.\n");
 		val |= BCE_EMAC_MODE_HALF_DUPLEX;
@@ -2036,7 +2107,7 @@ bce_miibus_statchg(device_t dev)
 
 	REG_WR(sc, BCE_EMAC_MODE, val);
 
- 	if ((mii->mii_media_active & IFM_ETH_RXPAUSE) != 0) {
+	if ((IFM_OPTIONS(media_active) & IFM_ETH_RXPAUSE) != 0) {
 		DBPRINT(sc, BCE_INFO_PHY,
 		    "%s(): Enabling RX flow control.\n", __FUNCTION__);
 		BCE_SETBIT(sc, BCE_EMAC_RX_MODE, BCE_EMAC_RX_MODE_FLOW_EN);
@@ -2046,7 +2117,7 @@ bce_miibus_statchg(device_t dev)
 		BCE_CLRBIT(sc, BCE_EMAC_RX_MODE, BCE_EMAC_RX_MODE_FLOW_EN);
 	}
 
- 	if ((mii->mii_media_active & IFM_ETH_TXPAUSE) != 0) {
+	if ((IFM_OPTIONS(media_active) & IFM_ETH_TXPAUSE) != 0) {
 		DBPRINT(sc, BCE_INFO_PHY,
 		    "%s(): Enabling TX flow control.\n", __FUNCTION__);
 		BCE_SETBIT(sc, BCE_EMAC_TX_MODE, BCE_EMAC_TX_MODE_FLOW_EN);
@@ -3130,7 +3201,8 @@ bce_get_media_exit:
 static void
 bce_init_media(struct bce_softc *sc)
 {
-	if ((sc->bce_phy_flags & BCE_PHY_IEEE_CLAUSE_45_FLAG) != 0) {
+	if ((sc->bce_phy_flags & (BCE_PHY_IEEE_CLAUSE_45_FLAG |
+	    BCE_PHY_REMOTE_CAP_FLAG)) == BCE_PHY_IEEE_CLAUSE_45_FLAG) {
 		/*
 		 * Configure 5709S/5716S PHYs to use traditional IEEE
 		 * Clause 22 method. Otherwise we have no way to attach
@@ -5018,6 +5090,8 @@ bce_reset(struct bce_softc *sc, u32 rese
 	if (rc)
 		BCE_PRINTF("%s(%d): Firmware did not complete "
 		    "initialization!\n", __FILE__, __LINE__);
+	/* Get firmware capabilities. */
+	bce_fw_cap_init(sc);
 
 bce_reset_exit:
 	DBEXIT(BCE_VERBOSE_RESET);
@@ -6081,6 +6155,55 @@ bce_free_pg_chain(struct bce_softc *sc)
 }
 
 
+static u32
+bce_get_rphy_link(struct bce_softc *sc)
+{
+	u32 advertise, link;
+	int fdpx;
+
+	advertise = 0;
+	fdpx = 0;
+	if ((sc->bce_phy_flags & BCE_PHY_REMOTE_PORT_FIBER_FLAG) != 0)
+		link = bce_shmem_rd(sc, BCE_RPHY_SERDES_LINK);
+	else
+		link = bce_shmem_rd(sc, BCE_RPHY_COPPER_LINK);
+	if (link & BCE_NETLINK_ANEG_ENB)
+		advertise |= BCE_NETLINK_ANEG_ENB;
+	if (link & BCE_NETLINK_SPEED_10HALF)
+		advertise |= BCE_NETLINK_SPEED_10HALF;
+	if (link & BCE_NETLINK_SPEED_10FULL) {
+		advertise |= BCE_NETLINK_SPEED_10FULL;
+		fdpx++;
+	}
+	if (link & BCE_NETLINK_SPEED_100HALF)
+		advertise |= BCE_NETLINK_SPEED_100HALF;
+	if (link & BCE_NETLINK_SPEED_100FULL) {
+		advertise |= BCE_NETLINK_SPEED_100FULL;
+		fdpx++;
+	}
+	if (link & BCE_NETLINK_SPEED_1000HALF)
+		advertise |= BCE_NETLINK_SPEED_1000HALF;
+	if (link & BCE_NETLINK_SPEED_1000FULL) {
+		advertise |= BCE_NETLINK_SPEED_1000FULL;
+		fdpx++;
+	}
+	if (link & BCE_NETLINK_SPEED_2500HALF)
+		advertise |= BCE_NETLINK_SPEED_2500HALF;
+	if (link & BCE_NETLINK_SPEED_2500FULL) {
+		advertise |= BCE_NETLINK_SPEED_2500FULL;
+		fdpx++;
+	}
+	if (fdpx)
+		advertise |= BCE_NETLINK_FC_PAUSE_SYM |
+		    BCE_NETLINK_FC_PAUSE_ASYM;
+	if ((sc->bce_phy_flags & BCE_PHY_REMOTE_PORT_FIBER_FLAG) == 0)
+		advertise |= BCE_NETLINK_PHY_APP_REMOTE |
+		    BCE_NETLINK_ETH_AT_WIRESPEED;
+
+	return (advertise);
+}
+
+
 /****************************************************************************/
 /* Set media options.                                                       */
 /*                                                                          */
@@ -6116,21 +6239,110 @@ bce_ifmedia_upd_locked(struct ifnet *ifp
 	struct bce_softc *sc = ifp->if_softc;
 	struct mii_data *mii;
 	struct mii_softc *miisc;
-	int error;
+	struct ifmedia *ifm;
+	u32 link;
+	int error, fdx;
 
 	DBENTER(BCE_VERBOSE_PHY);
 
 	error = 0;
 	BCE_LOCK_ASSERT(sc);
 
-	mii = device_get_softc(sc->bce_miibus);
+	sc->bce_link_up = FALSE;
+	if ((sc->bce_phy_flags & BCE_PHY_REMOTE_CAP_FLAG) != 0) {
+		ifm = &sc->bce_ifmedia;
+		if (IFM_TYPE(ifm->ifm_media) != IFM_ETHER)
+			return (EINVAL);
+		link = 0;
+		fdx = IFM_OPTIONS(ifm->ifm_media) & IFM_FDX;
+		switch(IFM_SUBTYPE(ifm->ifm_media)) {
+		case IFM_AUTO:
+			/*
+			 * Check advertised link of remote PHY by reading
+			 * BCE_RPHY_SERDES_LINK or BCE_RPHY_COPPER_LINK.
+			 * Always use the same link type of remote PHY.
+			 */
+			link = bce_get_rphy_link(sc);
+			break;
+		case IFM_2500_SX:
+			if ((sc->bce_phy_flags &
+			    (BCE_PHY_REMOTE_PORT_FIBER_FLAG |
+			    BCE_PHY_2_5G_CAPABLE_FLAG)) == 0)
+				return (EINVAL);
+			/*
+			 * XXX
+			 * Have to enable forced 2.5Gbps configuration.
+			 */
+			if (fdx != 0)
+				link |= BCE_NETLINK_SPEED_2500FULL;
+			else
+				link |= BCE_NETLINK_SPEED_2500HALF;
+			break;
+		case IFM_1000_SX:
+			if ((sc->bce_phy_flags &
+			    BCE_PHY_REMOTE_PORT_FIBER_FLAG) == 0)
+				return (EINVAL);
+			/*
+			 * XXX
+			 * Have to disable 2.5Gbps configuration.
+			 */
+			if (fdx != 0)
+				link = BCE_NETLINK_SPEED_1000FULL;
+			else
+				link = BCE_NETLINK_SPEED_1000HALF;
+			break;
+		case IFM_1000_T:
+			if (sc->bce_phy_flags & BCE_PHY_REMOTE_PORT_FIBER_FLAG)
+				return (EINVAL);
+			if (fdx != 0)
+				link = BCE_NETLINK_SPEED_1000FULL;
+			else
+				link = BCE_NETLINK_SPEED_1000HALF;
+			break;
+		case IFM_100_TX:
+			if (sc->bce_phy_flags & BCE_PHY_REMOTE_PORT_FIBER_FLAG)
+				return (EINVAL);
+			if (fdx != 0)
+				link = BCE_NETLINK_SPEED_100FULL;
+			else
+				link = BCE_NETLINK_SPEED_100HALF;
+			break;
+		case IFM_10_T:
+			if (sc->bce_phy_flags & BCE_PHY_REMOTE_PORT_FIBER_FLAG)
+				return (EINVAL);
+			if (fdx != 0)
+				link = BCE_NETLINK_SPEED_10FULL;
+			else
+				link = BCE_NETLINK_SPEED_10HALF;
+			break;
+		default:
+			return (EINVAL);
+		}
+		if (IFM_SUBTYPE(ifm->ifm_media) != IFM_AUTO) {
+			/*
+			 * XXX
+			 * Advertise pause capability for full-duplex media.
+			 */
+			if (fdx != 0)
+				link |= BCE_NETLINK_FC_PAUSE_SYM |
+				    BCE_NETLINK_FC_PAUSE_ASYM;
+			if ((sc->bce_phy_flags &
+			    BCE_PHY_REMOTE_PORT_FIBER_FLAG) == 0)
+				link |= BCE_NETLINK_PHY_APP_REMOTE |
+				    BCE_NETLINK_ETH_AT_WIRESPEED;
+		}
 
-	/* Make sure the MII bus has been enumerated. */
-	if (mii) {
-		sc->bce_link_up = FALSE;
-		LIST_FOREACH(miisc, &mii->mii_phys, mii_list)
-		    PHY_RESET(miisc);
-		error = mii_mediachg(mii);
+		bce_shmem_wr(sc, BCE_MB_ARGS_0, link);
+		error = bce_fw_sync(sc, BCE_DRV_MSG_CODE_CMD_SET_LINK);
+	} else {
+		mii = device_get_softc(sc->bce_miibus);
+
+		/* Make sure the MII bus has been enumerated. */
+		if (mii) {
+			LIST_FOREACH(miisc, &mii->mii_phys, mii_list)
+				PHY_RESET(miisc);
+			error = mii_mediachg(mii);
+		}
 	}
 
 	DBEXIT(BCE_VERBOSE_PHY);
@@ -6138,6 +6350,85 @@ bce_ifmedia_upd_locked(struct ifnet *ifp
 }
 
 
+static void
+bce_ifmedia_sts_rphy(struct bce_softc *sc, struct ifmediareq *ifmr)
+{
+	struct ifnet *ifp;
+	u32 link;
+
+	ifp = sc->bce_ifp;
+	BCE_LOCK_ASSERT(sc);
+
+	ifmr->ifm_status = IFM_AVALID;
+	ifmr->ifm_active = IFM_ETHER;
+	link = bce_shmem_rd(sc, BCE_LINK_STATUS);
+	/* XXX Handle heart beat status? */
+	if ((link & BCE_LINK_STATUS_LINK_UP) != 0)
+		ifmr->ifm_status |= IFM_ACTIVE;
+	else {
+		ifmr->ifm_active |= IFM_NONE;
+		ifp->if_baudrate = 0;
+		return;
+	}
+	switch (link & BCE_LINK_STATUS_SPEED_MASK) {
+	case BCE_LINK_STATUS_10HALF:
+		ifmr->ifm_active |= IFM_10_T | IFM_HDX;
+		ifp->if_baudrate = IF_Mbps(10UL);
+		break;
+	case BCE_LINK_STATUS_10FULL:
+		ifmr->ifm_active |= IFM_10_T | IFM_FDX;
+		ifp->if_baudrate = IF_Mbps(10UL);
+		break;
+	case BCE_LINK_STATUS_100HALF:
+		ifmr->ifm_active |= IFM_100_TX | IFM_HDX;
+		ifp->if_baudrate = IF_Mbps(100UL);
+		break;
+	case BCE_LINK_STATUS_100FULL:
+		ifmr->ifm_active |= IFM_100_TX | IFM_FDX;
+		ifp->if_baudrate = IF_Mbps(100UL);
+		break;
+	case BCE_LINK_STATUS_1000HALF:
+		if ((sc->bce_phy_flags & BCE_PHY_REMOTE_PORT_FIBER_FLAG) == 0)
+			ifmr->ifm_active |= IFM_1000_T | IFM_HDX;
+		else
+			ifmr->ifm_active |= IFM_1000_SX | IFM_HDX;
+		ifp->if_baudrate = IF_Mbps(1000UL);
+		break;
+	case BCE_LINK_STATUS_1000FULL:
+		if ((sc->bce_phy_flags & BCE_PHY_REMOTE_PORT_FIBER_FLAG) == 0)
+			ifmr->ifm_active |= IFM_1000_T | IFM_FDX;
+		else
+			ifmr->ifm_active |= IFM_1000_SX | IFM_FDX;
+		ifp->if_baudrate = IF_Mbps(1000UL);
+		break;
+	case BCE_LINK_STATUS_2500HALF:
+		if ((sc->bce_phy_flags & BCE_PHY_REMOTE_PORT_FIBER_FLAG) == 0) {
+			ifmr->ifm_active |= IFM_NONE;
+			return;
+		} else
+			ifmr->ifm_active |= IFM_2500_SX | IFM_HDX;
+		ifp->if_baudrate = IF_Mbps(2500UL);
+		break;
+	case BCE_LINK_STATUS_2500FULL:
+		if ((sc->bce_phy_flags & BCE_PHY_REMOTE_PORT_FIBER_FLAG) == 0) {
+			ifmr->ifm_active |= IFM_NONE;
+			return;
+		} else
+			ifmr->ifm_active |= IFM_2500_SX | IFM_FDX;
+		ifp->if_baudrate = IF_Mbps(2500UL);
+		break;
+	default:
+		ifmr->ifm_active |= IFM_NONE;
+		return;
+	}
+
+	if ((link & BCE_LINK_STATUS_RX_FC_ENABLED) != 0)
+		ifmr->ifm_active |= IFM_ETH_RXPAUSE;
+	if ((link & BCE_LINK_STATUS_TX_FC_ENABLED) != 0)
+		ifmr->ifm_active |= IFM_ETH_TXPAUSE;
+}
+
+
 /****************************************************************************/
 /* Reports current media status.                                            */
 /*                                                                          */
@@ -6158,11 +6449,15 @@ bce_ifmedia_sts(struct ifnet *ifp, struc
 		BCE_UNLOCK(sc);
 		return;
 	}
-	mii = device_get_softc(sc->bce_miibus);
 
-	mii_pollstat(mii);
-	ifmr->ifm_active = mii->mii_media_active;
-	ifmr->ifm_status = mii->mii_media_status;
+	if ((sc->bce_phy_flags & BCE_PHY_REMOTE_CAP_FLAG) != 0)
+		bce_ifmedia_sts_rphy(sc, ifmr);
+	else {
+		mii = device_get_softc(sc->bce_miibus);
+		mii_pollstat(mii);
+		ifmr->ifm_active = mii->mii_media_active;
+		ifmr->ifm_status = mii->mii_media_status;
+	}
 
 	BCE_UNLOCK(sc);
 
@@ -6199,14 +6494,26 @@ bce_phy_intr(struct bce_softc *sc)
 			    STATUS_ATTN_BITS_LINK_STATE);
 			DBPRINT(sc, BCE_INFO_PHY, "%s(): Link is now UP.\n",
 			    __FUNCTION__);
-		}
-		else {
+		} else {
 			REG_WR(sc, BCE_PCICFG_STATUS_BIT_CLEAR_CMD,
 			    STATUS_ATTN_BITS_LINK_STATE);
 			DBPRINT(sc, BCE_INFO_PHY, "%s(): Link is now DOWN.\n",
 			    __FUNCTION__);
 		}
 
+		if ((sc->bce_phy_flags & BCE_PHY_REMOTE_CAP_FLAG) != 0) {
+			if (new_link_state) {
+				if (bootverbose)
+					if_printf(sc->bce_ifp, "link UP\n");
+				if_link_state_change(sc->bce_ifp,
+				    LINK_STATE_UP);
+			} else {
+				if (bootverbose)
+					if_printf(sc->bce_ifp, "link DOWN\n");
+				if_link_state_change(sc->bce_ifp,
+				    LINK_STATE_DOWN);
+			}
+		}
 		/*
 		 * Assume link is down and allow
 		 * tick routine to update the state
@@ -7495,10 +7802,14 @@ bce_ioctl(struct ifnet *ifp, u_long comm
 	case SIOCGIFMEDIA:
 		DBPRINT(sc, BCE_VERBOSE_MISC,
 		    "Received SIOCSIFMEDIA/SIOCGIFMEDIA\n");
-
-		mii = device_get_softc(sc->bce_miibus);
-		error = ifmedia_ioctl(ifp, ifr,
-		    &mii->mii_media, command);
+		if ((sc->bce_phy_flags & BCE_PHY_REMOTE_CAP_FLAG) != 0)
+			error = ifmedia_ioctl(ifp, ifr, &sc->bce_ifmedia,
+			    command);
+		else {
+			mii = device_get_softc(sc->bce_miibus);
+			error = ifmedia_ioctl(ifp, ifr, &mii->mii_media,
+			    command);
+		}
 		break;
 
 	/* Set interface capability */
@@ -8163,6 +8474,7 @@ bce_tick(void *xsc)
 	struct bce_softc *sc = xsc;
 	struct mii_data *mii;
 	struct ifnet *ifp;
+	struct ifmediareq ifmr;
 
 	ifp = sc->bce_ifp;
 
@@ -8193,21 +8505,32 @@ bce_tick(void *xsc)
 		goto bce_tick_exit;
 
 	/* Link is down.  Check what the PHY's doing. */
-	mii = device_get_softc(sc->bce_miibus);
-	mii_tick(mii);
-
-	/* Check if the link has come up. */
-	if ((mii->mii_media_status & IFM_ACTIVE) &&
-	    (IFM_SUBTYPE(mii->mii_media_active) != IFM_NONE)) {
-		DBPRINT(sc, BCE_VERBOSE_MISC,
-		    "%s(): Link up!\n", __FUNCTION__);
-		sc->bce_link_up = TRUE;
-		if ((IFM_SUBTYPE(mii->mii_media_active) == IFM_1000_T ||
-		    IFM_SUBTYPE(mii->mii_media_active) == IFM_1000_SX ||
-		    IFM_SUBTYPE(mii->mii_media_active) == IFM_2500_SX) &&
-		    (bce_verbose || bootverbose))
-			BCE_PRINTF("Gigabit link up!\n");
+	if ((sc->bce_phy_flags & BCE_PHY_REMOTE_CAP_FLAG) != 0) {
+		bzero(&ifmr, sizeof(ifmr));
+		bce_ifmedia_sts_rphy(sc, &ifmr);
+		if ((ifmr.ifm_status & (IFM_ACTIVE | IFM_AVALID)) ==
+		    (IFM_ACTIVE | IFM_AVALID)) {
+			sc->bce_link_up = TRUE;
+			bce_miibus_statchg(sc->bce_dev);
+		}
+	} else {
+		mii = device_get_softc(sc->bce_miibus);
+		mii_tick(mii);
+		/* Check if the link has come up. */
+		if ((mii->mii_media_status & IFM_ACTIVE) &&
+		    (IFM_SUBTYPE(mii->mii_media_active) != IFM_NONE)) {
+			DBPRINT(sc, BCE_VERBOSE_MISC, "%s(): Link up!\n",
+			    __FUNCTION__);
+			sc->bce_link_up = TRUE;
+			if ((IFM_SUBTYPE(mii->mii_media_active) == IFM_1000_T ||
+			    IFM_SUBTYPE(mii->mii_media_active) == IFM_1000_SX ||
+			    IFM_SUBTYPE(mii->mii_media_active) == IFM_2500_SX) &&
+			    (bce_verbose || bootverbose))
+				BCE_PRINTF("Gigabit link up!\n");
+		}
 
+	}
+	if (sc->bce_link_up == TRUE) {
 		/* Now that link is up, handle any outstanding TX traffic. */
 		if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) {
 			DBPRINT(sc, BCE_VERBOSE_MISC, "%s(): Found "
@@ -8221,6 +8544,36 @@ bce_tick_exit:
 	return;
 }
 
+static void
+bce_fw_cap_init(struct bce_softc *sc)
+{
+	u32 ack, cap, link;
+
+	ack = 0;
+	cap = bce_shmem_rd(sc, BCE_FW_CAP_MB);
+	if ((cap & BCE_FW_CAP_SIGNATURE_MAGIC_MASK) !=
+	    BCE_FW_CAP_SIGNATURE_MAGIC)
+		return;
+	if ((cap & (BCE_FW_CAP_MFW_KEEP_VLAN | BCE_FW_CAP_BC_KEEP_VLAN)) ==
+	    (BCE_FW_CAP_MFW_KEEP_VLAN | BCE_FW_CAP_BC_KEEP_VLAN))
+		ack |= BCE_DRV_ACK_CAP_SIGNATURE_MAGIC |
+		    BCE_FW_CAP_MFW_KEEP_VLAN | BCE_FW_CAP_BC_KEEP_VLAN;
+	if ((sc->bce_phy_flags & BCE_PHY_SERDES_FLAG) != 0 &&
+	    (cap & BCE_FW_CAP_REMOTE_PHY_CAP) != 0) {
+		sc->bce_phy_flags &= ~BCE_PHY_REMOTE_PORT_FIBER_FLAG;
+		sc->bce_phy_flags |= BCE_PHY_REMOTE_CAP_FLAG;
+		link = bce_shmem_rd(sc, BCE_LINK_STATUS);
+		if ((link & BCE_LINK_STATUS_SERDES_LINK) != 0)
+			sc->bce_phy_flags |= BCE_PHY_REMOTE_PORT_FIBER_FLAG;
+		ack |= BCE_DRV_ACK_CAP_SIGNATURE_MAGIC |
+		    BCE_FW_CAP_REMOTE_PHY_CAP;
+	}
+
+	if (ack != 0)
+		bce_shmem_wr(sc, BCE_DRV_ACK_CAP_MB, ack);
+}
+
+
 #ifdef BCE_DEBUG
 /****************************************************************************/
 /* Allows the driver state to be dumped through the sysctl interface.       */

Modified: stable/9/sys/dev/bce/if_bcereg.h
==============================================================================
--- stable/9/sys/dev/bce/if_bcereg.h	Wed May 23 01:49:50 2012	(r235817)
+++ stable/9/sys/dev/bce/if_bcereg.h	Wed May 23 02:02:29 2012	(r235818)
@@ -814,6 +814,23 @@ struct flash_spec {
 #define BCE_DRV_PULSE_SEQ_MASK			 0x00007fff
 
 #define BCE_MB_ARGS_0				0x00000014
+#define	BCE_NETLINK_SPEED_10HALF		 (1<<0)
+#define	BCE_NETLINK_SPEED_10FULL		 (1<<1)
+#define	BCE_NETLINK_SPEED_100HALF		 (1<<2)
+#define	BCE_NETLINK_SPEED_100FULL		 (1<<3)
+#define	BCE_NETLINK_SPEED_1000HALF		 (1<<4)
+#define	BCE_NETLINK_SPEED_1000FULL		 (1<<5)
+#define	BCE_NETLINK_SPEED_2500HALF		 (1<<6)
+#define	BCE_NETLINK_SPEED_2500FULL		 (1<<7)
+#define	BCE_NETLINK_SPEED_10GHALF		 (1<<8)
+#define	BCE_NETLINK_SPEED_10GFULL		 (1<<9)
+#define	BCE_NETLINK_ANEG_ENB		 	 (1<<10)
+#define	BCE_NETLINK_PHY_APP_REMOTE	 	 (1<<11)
+#define	BCE_NETLINK_FC_PAUSE_SYM	 	 (1<<12)
+#define	BCE_NETLINK_FC_PAUSE_ASYM	 	 (1<<13)
+#define	BCE_NETLINK_ETH_AT_WIRESPEED	 	 (1<<14)
+#define	BCE_NETLINK_PHY_RESET	 	 	 (1<<15)
+
 #define BCE_MB_ARGS_1				0x00000018
 
 /* Indicate to the firmware not to go into the
@@ -1079,6 +1096,26 @@ struct flash_spec {
 #define BCE_BC_STATE_BC_DBG_CMD_LOOP_CNT_MASK	0xffff
 #define BCE_BC_STATE_BC_DBG_CMD_LOOP_INFINITE	0xffff
 
+#define	BCE_FW_EVT_CODE_MB			0x00000354
+#define	BCE_FW_EVT_CODE_SW_TIMER_EXPIRE_EVENT	0x00000000
+#define	BCE_FW_EVT_CODE_LINK_EVENT		0x00000001
+
+#define	BCE_DRV_ACK_CAP_MB			0x00000364
+#define	BCE_DRV_ACK_CAP_SIGNATURE_MAGIC		0x35450000
+
+#define	BCE_FW_CAP_MB				0x00000368
+#define	BCE_FW_CAP_SIGNATURE_MAGIC		0xaa550000
+#define	BCE_FW_ACK_SIGNATURE_MAGIC		0x52500000
+#define	BCE_FW_CAP_SIGNATURE_MAGIC_MASK		0xffff0000
+#define	BCE_FW_CAP_REMOTE_PHY_CAP		0x00000001
+#define	BCE_FW_CAP_REMOTE_PHY_PRESENT		0x00000002
+#define	BCE_FW_CAP_MFW_KEEP_VLAN		0x00000008
+#define	BCE_FW_CAP_BC_KEEP_VLAN			0x00000010
+
+#define	BCE_RPHY_SERDES_LINK			0x00000374
+
+#define	BCE_RPHY_COPPER_LINK			0x00000378
+
 #define HOST_VIEW_SHMEM_BASE			0x167c00
 
 /*
@@ -6454,6 +6491,8 @@ struct bce_softc
 #define BCE_PHY_INT_MODE_AUTO_POLLING_FLAG	0x00000100
 #define BCE_PHY_INT_MODE_LINK_READY_FLAG	0x00000200
 #define BCE_PHY_IEEE_CLAUSE_45_FLAG		0x00000400
+#define	BCE_PHY_REMOTE_CAP_FLAG			0x00000800
+#define	BCE_PHY_REMOTE_PORT_FIBER_FLAG		0x00001000
 
 	/* Values that need to be shared with the PHY driver. */
 	u32			bce_shared_hw_cfg;

From owner-svn-src-stable-9@FreeBSD.ORG  Wed May 23 02:43:29 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 0634410657F5;
	Wed, 23 May 2012 02:43:29 +0000 (UTC) (envelope-from pfg@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id DA4068FC19;
	Wed, 23 May 2012 02:43: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 q4N2hS0R043641;
	Wed, 23 May 2012 02:43:28 GMT (envelope-from pfg@svn.freebsd.org)
Received: (from pfg@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4N2hSnb043638;
	Wed, 23 May 2012 02:43:28 GMT (envelope-from pfg@svn.freebsd.org)
Message-Id: <201205230243.q4N2hSnb043638@svn.freebsd.org>
From: "Pedro F. Giffuni" <pfg@FreeBSD.org>
Date: Wed, 23 May 2012 02:43:28 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r235820 - stable/9/sys/fs/ext2fs
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Wed, 23 May 2012 02:43:29 -0000

Author: pfg
Date: Wed May 23 02:43:28 2012
New Revision: 235820
URL: http://svn.freebsd.org/changeset/base/235820

Log:
  MFC:	r235508
  
  Fix a couple of issues that appear to be inherited from the old
  8.x code:
  - If the lock cannot be acquired immediately unlocks 'bar' vnode
  and then locks both vnodes in order.
  - wrong vnode type panics from cache_enter_time after calls by
  ext2_lookup.
  
  The fix merges changes from ufs/ufs_lookup.c.
  
  Submitted by:	Mateusz Guzik
  Approved by:	jhb (mentor)

Modified:
  stable/9/sys/fs/ext2fs/ext2_lookup.c
  stable/9/sys/fs/ext2fs/ext2_vnops.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/fs/   (props changed)

Modified: stable/9/sys/fs/ext2fs/ext2_lookup.c
==============================================================================
--- stable/9/sys/fs/ext2fs/ext2_lookup.c	Wed May 23 02:12:00 2012	(r235819)
+++ stable/9/sys/fs/ext2fs/ext2_lookup.c	Wed May 23 02:43:28 2012	(r235820)
@@ -115,6 +115,8 @@ static u_char dt_to_ext2_ft[] = {
 
 static int	ext2_dirbadentry(struct vnode *dp, struct ext2fs_direct_2 *de,
 		    int entryoffsetinblock);
+static int	ext2_lookup_ino(struct vnode *vdp, struct vnode **vpp,
+		    struct componentname *cnp, ino_t *dd_ino);
 
 /*
  * Vnode op for reading directories.
@@ -285,7 +287,14 @@ ext2_lookup(ap)
 		struct componentname *a_cnp;
 	} */ *ap;
 {
-	struct vnode *vdp;		/* vnode for directory being searched */
+
+	return (ext2_lookup_ino(ap->a_dvp, ap->a_vpp, ap->a_cnp, NULL));
+}
+
+static int
+ext2_lookup_ino(struct vnode *vdp, struct vnode **vpp, struct componentname *cnp,
+    ino_t *dd_ino)
+{
 	struct inode *dp;		/* inode for directory being searched */
 	struct buf *bp;			/* a buffer of directory entries */
 	struct ext2fs_direct_2 *ep;	/* the current directory entry */
@@ -305,22 +314,22 @@ ext2_lookup(ap)
 	doff_t enduseful;		/* pointer past last used dir slot */
 	u_long bmask;			/* block offset mask */
 	int namlen, error;
-	struct vnode **vpp = ap->a_vpp;
-	struct componentname *cnp = ap->a_cnp;
 	struct ucred *cred = cnp->cn_cred;
 	int flags = cnp->cn_flags;
 	int nameiop = cnp->cn_nameiop;
-	ino_t ino;
+	ino_t ino, ino1;
 	int ltype;
 
-	int	DIRBLKSIZ = VTOI(ap->a_dvp)->i_e2fs->e2fs_bsize;
+	int	DIRBLKSIZ = VTOI(vdp)->i_e2fs->e2fs_bsize;
+
+	if (vpp != NULL)
+		*vpp = NULL;
 
-	bp = NULL;
-	slotoffset = -1;
-	*vpp = NULL;
-	vdp = ap->a_dvp;
 	dp = VTOI(vdp);
 	bmask = VFSTOEXT2(vdp->v_mount)->um_mountp->mnt_stat.f_iosize - 1;
+restart:
+	bp = NULL;
+	slotoffset = -1;
 
 	/*
 	 * We now have a segment name to search for, and a directory to search.
@@ -536,10 +545,12 @@ searchloop:
 	 * Insert name into cache (as non-existent) if appropriate.
 	 */
 	if ((cnp->cn_flags & MAKEENTRY) && nameiop != CREATE)
-		cache_enter(vdp, *vpp, cnp);
+		cache_enter(vdp, NULL, cnp);
 	return (ENOENT);
 
 found:
+	if (dd_ino != NULL)
+		*dd_ino = ino;
 	if (numdirpasses == 2)
 		nchstats.ncs_pass2++;
 	/*
@@ -582,6 +593,8 @@ found:
 			dp->i_count = 0;
 		else
 			dp->i_count = dp->i_offset - prevoff;
+		if (dd_ino != NULL)
+			return (0);
 		if (dp->i_number == ino) {
 			VREF(vdp);
 			*vpp = vdp;
@@ -622,6 +635,8 @@ found:
 		 */
 		if (dp->i_number == ino)
 			return (EISDIR);
+		if (dd_ino != NULL)
+			return (0);
 		if ((error = VFS_VGET(vdp->v_mount, ino, LK_EXCLUSIVE,
 		    &tdp)) != 0)
 			return (error);
@@ -629,6 +644,8 @@ found:
 		cnp->cn_flags |= SAVENAME;
 		return (0);
 	}
+	if (dd_ino != NULL)
+		return (0);
 
 	/*
 	 * Step through the translation in the name.  We do not `vput' the
@@ -655,8 +672,27 @@ found:
 		VOP_UNLOCK(pdp, 0);	/* race to get the inode */
 		error = VFS_VGET(vdp->v_mount, ino, cnp->cn_lkflags, &tdp);
 		vn_lock(pdp, ltype | LK_RETRY);
-		if (error != 0)
+		if (pdp->v_iflag & VI_DOOMED) {
+			if (error == 0)
+				vput(tdp);
+			error = ENOENT;
+		}
+		if (error)
 			return (error);
+		/*
+		 * Recheck that ".." entry in the vdp directory points
+		 * to the inode we looked up before vdp lock was
+		 * dropped.
+		 */
+		error = ext2_lookup_ino(pdp, NULL, cnp, &ino1);
+		if (error) {
+			vput(tdp);
+			return (error);
+		}
+		if (ino1 != ino) {
+			vput(tdp);
+			goto restart;
+		}
 		*vpp = tdp;
 	} else if (dp->i_number == ino) {
 		VREF(vdp);	/* we want ourself, ie "." */

Modified: stable/9/sys/fs/ext2fs/ext2_vnops.c
==============================================================================
--- stable/9/sys/fs/ext2fs/ext2_vnops.c	Wed May 23 02:12:00 2012	(r235819)
+++ stable/9/sys/fs/ext2fs/ext2_vnops.c	Wed May 23 02:43:28 2012	(r235820)
@@ -1342,7 +1342,11 @@ ext2_rmdir(ap)
 	error = ext2_truncate(vp, (off_t)0, IO_SYNC, cnp->cn_cred,
 	    cnp->cn_thread);
 	cache_purge(ITOV(ip));
-	vn_lock(dvp, LK_EXCLUSIVE | LK_RETRY);
+	if (vn_lock(dvp, LK_EXCLUSIVE | LK_NOWAIT) != 0) {
+		VOP_UNLOCK(vp, 0);
+		vn_lock(dvp, LK_EXCLUSIVE | LK_RETRY);
+		vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
+	}
 out:
 	return (error);
 }

From owner-svn-src-stable-9@FreeBSD.ORG  Wed May 23 09:10:47 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 3CF9A106564A;
	Wed, 23 May 2012 09:10:47 +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 261E28FC15;
	Wed, 23 May 2012 09:10: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 q4N9AlUJ059668;
	Wed, 23 May 2012 09:10:47 GMT
	(envelope-from theraven@svn.freebsd.org)
Received: (from theraven@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4N9Ak62059664;
	Wed, 23 May 2012 09:10:46 GMT
	(envelope-from theraven@svn.freebsd.org)
Message-Id: <201205230910.q4N9Ak62059664@svn.freebsd.org>
From: David Chisnall <theraven@FreeBSD.org>
Date: Wed, 23 May 2012 09:10:46 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r235825 - in stable/9/gnu/lib: libstdc++ libsupc++
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Wed, 23 May 2012 09:10:47 -0000

Author: theraven
Date: Wed May 23 09:10:46 2012
New Revision: 235825
URL: http://svn.freebsd.org/changeset/base/235825

Log:
  Merge r233749, building libsupc++ as a shared library and making libstdc++ a
  filter library.
  
  It should now be possible to build applications on 9-STABLE that link against
  both libc++ and libstdc++ and to test libcxxrt with libstdc++.
  
  If you wish to test libcxxrt, please add this to your /etc/libmap.conf:
  
  libsupc++.so.1  libcxxrt.so.1
  
  If you wish to test libc++, add -std=libc++ to your compile and link flags for
  your favourite C++ applications and / or libraries.

Added:
  stable/9/gnu/lib/libsupc++/Version.map
     - copied unchanged from r233749, head/gnu/lib/libsupc++/Version.map
Modified:
  stable/9/gnu/lib/libstdc++/Makefile
  stable/9/gnu/lib/libsupc++/Makefile
Directory Properties:
  stable/9/gnu/lib/libstdc++/   (props changed)
  stable/9/gnu/lib/libsupc++/   (props changed)

Modified: stable/9/gnu/lib/libstdc++/Makefile
==============================================================================
--- stable/9/gnu/lib/libstdc++/Makefile	Wed May 23 07:50:23 2012	(r235824)
+++ stable/9/gnu/lib/libstdc++/Makefile	Wed May 23 09:10:46 2012	(r235825)
@@ -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: stable/9/gnu/lib/libsupc++/Makefile
==============================================================================
--- stable/9/gnu/lib/libsupc++/Makefile	Wed May 23 07:50:23 2012	(r235824)
+++ stable/9/gnu/lib/libsupc++/Makefile	Wed May 23 09:10:46 2012	(r235825)
@@ -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 <bsd.lib.mk>

Copied: stable/9/gnu/lib/libsupc++/Version.map (from r233749, head/gnu/lib/libsupc++/Version.map)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ stable/9/gnu/lib/libsupc++/Version.map	Wed May 23 09:10:46 2012	(r235825, copy of r233749, head/gnu/lib/libsupc++/Version.map)
@@ -0,0 +1,137 @@
+## Linker script for GNU versioning (GNU ld 2.13.91+ only.)
+##
+## Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007
+## Free Software Foundation, Inc.
+##
+## This file is part of the GNU ISO C++ Library.  This library is free
+## software; you can redistribute it and/or modify it under the
+## terms of the GNU General Public License as published by the
+## Free Software Foundation; either version 2, or (at your option)
+## any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License along
+## with this library; see the file COPYING.  If not, write to the Free
+## Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+## USA.
+
+## $FreeBSD$
+
+
+# Symbols in the support library (libsupc++) have their own tag.
+CXXABI_1.3 {
+
+  global:
+    __cxa_allocate_exception;
+    __cxa_bad_cast;
+    __cxa_bad_typeid;
+    __cxa_begin_catch;
+    __cxa_begin_cleanup;
+    __cxa_call_unexpected;
+    __cxa_current_exception_type;
+    __cxa_demangle;
+    __cxa_end_catch;
+    __cxa_end_cleanup;
+    __cxa_free_exception;
+    __cxa_get_globals;
+    __cxa_get_globals_fast;
+    __cxa_guard_abort;
+    __cxa_guard_acquire;
+    __cxa_guard_release;
+    __cxa_pure_virtual;
+    __cxa_rethrow;
+    __cxa_throw;
+    __cxa_type_match;
+    __cxa_vec_cctor;
+    __cxa_vec_cleanup;
+    __cxa_vec_ctor;
+    __cxa_vec_delete2;
+    __cxa_vec_delete3;
+    __cxa_vec_delete;
+    __cxa_vec_dtor;
+    __cxa_vec_new2;
+    __cxa_vec_new3;
+    __cxa_vec_new;
+    __gxx_personality_v0;
+    __gxx_personality_sj0;
+    __dynamic_cast;
+
+    # *_type_info classes, ctor and dtor
+    _ZN10__cxxabiv117__array_type_info*;
+    _ZN10__cxxabiv117__class_type_info*;
+    _ZN10__cxxabiv116__enum_type_info*;
+    _ZN10__cxxabiv120__function_type_info*;
+    _ZN10__cxxabiv123__fundamental_type_info*;
+    _ZN10__cxxabiv117__pbase_type_info*;
+    _ZN10__cxxabiv129__pointer_to_member_type_info*;
+    _ZN10__cxxabiv119__pointer_type_info*;
+    _ZN10__cxxabiv120__si_class_type_info*;
+    _ZN10__cxxabiv121__vmi_class_type_info*;
+
+    # *_type_info classes, member functions
+    _ZNK10__cxxabiv117__class_type_info*;
+    _ZNK10__cxxabiv120__function_type_info*;
+    _ZNK10__cxxabiv117__pbase_type_info*;
+    _ZNK10__cxxabiv129__pointer_to_member_type_info*;
+    _ZNK10__cxxabiv119__pointer_type_info*;
+    _ZNK10__cxxabiv120__si_class_type_info*;
+    _ZNK10__cxxabiv121__vmi_class_type_info*;
+
+    # virtual table
+    _ZTVN10__cxxabiv117__array_type_infoE;
+    _ZTVN10__cxxabiv117__class_type_infoE;
+    _ZTVN10__cxxabiv116__enum_type_infoE;
+    _ZTVN10__cxxabiv120__function_type_infoE;
+    _ZTVN10__cxxabiv123__fundamental_type_infoE;
+    _ZTVN10__cxxabiv117__pbase_type_infoE;
+    _ZTVN10__cxxabiv129__pointer_to_member_type_infoE;
+    _ZTVN10__cxxabiv119__pointer_type_infoE;
+    _ZTVN10__cxxabiv120__si_class_type_infoE;
+    _ZTVN10__cxxabiv121__vmi_class_type_infoE;
+
+    # typeinfo structure (and some names)
+    _ZTI[a-fh-z];
+    _ZTIP[a-fh-z];
+    _ZTIPK[a-fh-z];
+    _ZTIN10__cxxabiv117__array_type_infoE;
+    _ZTIN10__cxxabiv117__class_type_infoE;
+    _ZTIN10__cxxabiv116__enum_type_infoE;
+    _ZTIN10__cxxabiv120__function_type_infoE;
+    _ZTIN10__cxxabiv123__fundamental_type_infoE;
+    _ZTIN10__cxxabiv117__pbase_type_infoE;
+    _ZTIN10__cxxabiv129__pointer_to_member_type_infoE;
+    _ZTIN10__cxxabiv119__pointer_type_infoE;
+    _ZTIN10__cxxabiv120__si_class_type_infoE;
+    _ZTIN10__cxxabiv121__vmi_class_type_infoE;
+
+    # typeinfo name
+    _ZTS[a-fh-z];
+    _ZTSP[a-fh-z];
+    _ZTSPK[a-fh-z];
+    _ZTSN10__cxxabiv117__array_type_infoE;
+    _ZTSN10__cxxabiv117__class_type_infoE;
+    _ZTSN10__cxxabiv116__enum_type_infoE;
+    _ZTSN10__cxxabiv120__function_type_infoE;
+    _ZTSN10__cxxabiv123__fundamental_type_infoE;
+    _ZTSN10__cxxabiv117__pbase_type_infoE;
+    _ZTSN10__cxxabiv129__pointer_to_member_type_infoE;
+    _ZTSN10__cxxabiv119__pointer_type_infoE;
+    _ZTSN10__cxxabiv120__si_class_type_infoE;
+    _ZTSN10__cxxabiv121__vmi_class_type_infoE;
+
+    # __gnu_cxx::_verbose_terminate_handler()
+    _ZN9__gnu_cxx27__verbose_terminate_handlerEv;
+
+  local:
+    *;
+};
+
+CXXABI_1.3.1 {
+
+    __cxa_get_exception_ptr;
+
+} CXXABI_1.3;

From owner-svn-src-stable-9@FreeBSD.ORG  Wed May 23 14:44:58 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 55579106566B;
	Wed, 23 May 2012 14:44:58 +0000 (UTC)
	(envelope-from iwasaki@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 3FA138FC14;
	Wed, 23 May 2012 14:44: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 q4NEiwai078387;
	Wed, 23 May 2012 14:44:58 GMT (envelope-from iwasaki@svn.freebsd.org)
Received: (from iwasaki@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4NEiwbx078385;
	Wed, 23 May 2012 14:44:58 GMT (envelope-from iwasaki@svn.freebsd.org)
Message-Id: <201205231444.q4NEiwbx078385@svn.freebsd.org>
From: Mitsuru IWASAKI <iwasaki@FreeBSD.org>
Date: Wed, 23 May 2012 14:44:57 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r235835 - stable/9/sys/dev/acpica
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Wed, 23 May 2012 14:44:58 -0000

Author: iwasaki
Date: Wed May 23 14:44:57 2012
New Revision: 235835
URL: http://svn.freebsd.org/changeset/base/235835

Log:
  MFC 235692,235772:
  - Don't start the sleep state transition procedure while sleep is
    disabled or the system is in shutdown procedure.
  - Ignore the power button press event for resuming rather than starting
    shutdown.

Modified:
  stable/9/sys/dev/acpica/acpi.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/dev/   (props changed)

Modified: stable/9/sys/dev/acpica/acpi.c
==============================================================================
--- stable/9/sys/dev/acpica/acpi.c	Wed May 23 13:45:52 2012	(r235834)
+++ stable/9/sys/dev/acpica/acpi.c	Wed May 23 14:44:57 2012	(r235835)
@@ -2468,14 +2468,20 @@ acpi_ReqSleepState(struct acpi_softc *sc
     if (!acpi_sleep_states[state])
 	return (EOPNOTSUPP);
 
-    ACPI_LOCK(acpi);
-
     /* If a suspend request is already in progress, just return. */
     if (sc->acpi_next_sstate != 0) {
-    	ACPI_UNLOCK(acpi);
 	return (0);
     }
 
+    /* Wait until sleep is enabled. */
+    while (sc->acpi_sleep_disabled) {
+	AcpiOsSleep(1000);
+    }
+
+    ACPI_LOCK(acpi);
+
+    sc->acpi_next_sstate = state;
+
     /* S5 (soft-off) should be entered directly with no waiting. */
     if (state == ACPI_STATE_S5) {
     	ACPI_UNLOCK(acpi);
@@ -2484,7 +2490,6 @@ acpi_ReqSleepState(struct acpi_softc *sc
     }
 
     /* Record the pending state and notify all apm devices. */
-    sc->acpi_next_sstate = state;
     STAILQ_FOREACH(clone, &sc->apm_cdevs, entries) {
 	clone->notify_status = APM_EV_NONE;
 	if ((clone->flags & ACPI_EVF_DEVD) == 0) {

From owner-svn-src-stable-9@FreeBSD.ORG  Wed May 23 14:48:15 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 21567106564A;
	Wed, 23 May 2012 14:48:15 +0000 (UTC)
	(envelope-from jamie@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 0B4918FC0A;
	Wed, 23 May 2012 14:48: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 q4NEmEeC078645;
	Wed, 23 May 2012 14:48:14 GMT (envelope-from jamie@svn.freebsd.org)
Received: (from jamie@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4NEmEVg078643;
	Wed, 23 May 2012 14:48:14 GMT (envelope-from jamie@svn.freebsd.org)
Message-Id: <201205231448.q4NEmEVg078643@svn.freebsd.org>
From: Jamie Gritton <jamie@FreeBSD.org>
Date: Wed, 23 May 2012 14:48:14 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r235836 - stable/9/lib/libjail
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Wed, 23 May 2012 14:48:15 -0000

Author: jamie
Date: Wed May 23 14:48:14 2012
New Revision: 235836
URL: http://svn.freebsd.org/changeset/base/235836

Log:
  MFC r235799:
  
   The fix in r235291 (r235624) re-broke the "allow.nomount" case.
   Re-fix it by testing for the right parameter name.
  
  PR: bin/168250

Modified:
  stable/9/lib/libjail/jail.c
Directory Properties:
  stable/9/lib/libjail/   (props changed)

Modified: stable/9/lib/libjail/jail.c
==============================================================================
--- stable/9/lib/libjail/jail.c	Wed May 23 14:44:57 2012	(r235835)
+++ stable/9/lib/libjail/jail.c	Wed May 23 14:48:14 2012	(r235836)
@@ -853,7 +853,7 @@ jailparam_free(struct jailparam *jp, uns
 static int
 jailparam_type(struct jailparam *jp)
 {
-	char *p, *nname;
+	char *p, *name, *nname;
 	size_t miblen, desclen;
 	int i, isarray;
 	struct {
@@ -863,7 +863,8 @@ jailparam_type(struct jailparam *jp)
 	int mib[CTL_MAXNAME];
 
 	/* The "lastjid" parameter isn't real. */
-	if (!strcmp(jp->jp_name, "lastjid")) {
+	name = jp->jp_name;
+	if (!strcmp(name, "lastjid")) {
 		jp->jp_valuelen = sizeof(int);
 		jp->jp_ctltype = CTLTYPE_INT | CTLFLAG_WR;
 		return (0);
@@ -872,19 +873,19 @@ jailparam_type(struct jailparam *jp)
 	/* Find the sysctl that describes the parameter. */
 	mib[0] = 0;
 	mib[1] = 3;
-	snprintf(desc.s, sizeof(desc.s), SJPARAM ".%s", jp->jp_name);
+	snprintf(desc.s, sizeof(desc.s), SJPARAM ".%s", name);
 	miblen = sizeof(mib) - 2 * sizeof(int);
 	if (sysctl(mib, 2, mib + 2, &miblen, desc.s, strlen(desc.s)) < 0) {
 		if (errno != ENOENT) {
 			snprintf(jail_errmsg, JAIL_ERRMSGLEN,
-			    "sysctl(0.3.%s): %s", jp->jp_name, strerror(errno));
+			    "sysctl(0.3.%s): %s", name, strerror(errno));
 			return (-1);
 		}
 		/*
 		 * The parameter probably doesn't exist.  But it might be
 		 * the "no" counterpart to a boolean.
 		 */
-		nname = nononame(jp->jp_name);
+		nname = nononame(name);
 		if (nname == NULL) {
 		unknown_parameter:
 			snprintf(jail_errmsg, JAIL_ERRMSGLEN,
@@ -892,8 +893,10 @@ jailparam_type(struct jailparam *jp)
 			errno = ENOENT;
 			return (-1);
 		}
-		snprintf(desc.s, sizeof(desc.s), SJPARAM ".%s", nname);
+		name = alloca(strlen(nname) + 1);
+		strcpy(name, nname);
 		free(nname);
+		snprintf(desc.s, sizeof(desc.s), SJPARAM ".%s", name);
 		miblen = sizeof(mib) - 2 * sizeof(int);
 		if (sysctl(mib, 2, mib + 2, &miblen, desc.s,
 		    strlen(desc.s)) < 0)
@@ -906,7 +909,7 @@ jailparam_type(struct jailparam *jp)
 	if (sysctl(mib, (miblen / sizeof(int)) + 2, &desc, &desclen,
 	    NULL, 0) < 0) {
 		snprintf(jail_errmsg, JAIL_ERRMSGLEN,
-		    "sysctl(0.4.%s): %s", jp->jp_name, strerror(errno));
+		    "sysctl(0.4.%s): %s", name, strerror(errno));
 		return (-1);
 	}
 	jp->jp_ctltype = desc.i;
@@ -952,7 +955,7 @@ jailparam_type(struct jailparam *jp)
 		if (sysctl(mib + 2, miblen / sizeof(int), desc.s, &desclen,
 		    NULL, 0) < 0) {
 			snprintf(jail_errmsg, JAIL_ERRMSGLEN,
-			    "sysctl(" SJPARAM ".%s): %s", jp->jp_name,
+			    "sysctl(" SJPARAM ".%s): %s", name,
 			    strerror(errno));
 			return (-1);
 		}
@@ -970,7 +973,7 @@ jailparam_type(struct jailparam *jp)
 			if (sysctl(mib + 2, miblen / sizeof(int),
 			    NULL, &jp->jp_valuelen, NULL, 0) < 0) {
 				snprintf(jail_errmsg, JAIL_ERRMSGLEN,
-				    "sysctl(" SJPARAM ".%s): %s", jp->jp_name,
+				    "sysctl(" SJPARAM ".%s): %s", name,
 				    strerror(errno));
 				return (-1);
 			}
@@ -995,10 +998,9 @@ jailparam_type(struct jailparam *jp)
 				    "sysctl(0.1): %s", strerror(errno));
 				return (-1);
 			}
-			if (desclen ==
-			    sizeof(SJPARAM) + strlen(jp->jp_name) + 2 &&
+			if (desclen == sizeof(SJPARAM) + strlen(name) + 2 &&
 			    memcmp(SJPARAM ".", desc.s, sizeof(SJPARAM)) == 0 &&
-			    memcmp(jp->jp_name, desc.s + sizeof(SJPARAM),
+			    memcmp(name, desc.s + sizeof(SJPARAM),
 			    desclen - sizeof(SJPARAM) - 2) == 0 &&
 			    desc.s[desclen - 2] == '.')
 				goto mib_desc;

From owner-svn-src-stable-9@FreeBSD.ORG  Wed May 23 15:29:34 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id F1498106567B;
	Wed, 23 May 2012 15:29:34 +0000 (UTC)
	(envelope-from jamie@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id D95BD8FC08;
	Wed, 23 May 2012 15:29: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 q4NFTYrk080720;
	Wed, 23 May 2012 15:29:34 GMT (envelope-from jamie@svn.freebsd.org)
Received: (from jamie@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4NFTYZc080713;
	Wed, 23 May 2012 15:29:34 GMT (envelope-from jamie@svn.freebsd.org)
Message-Id: <201205231529.q4NFTYZc080713@svn.freebsd.org>
From: Jamie Gritton <jamie@FreeBSD.org>
Date: Wed, 23 May 2012 15:29:34 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r235839 - in stable/9: lib/libc/sys usr.sbin/jail
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Wed, 23 May 2012 15:29:35 -0000

Author: jamie
Date: Wed May 23 15:29:34 2012
New Revision: 235839
URL: http://svn.freebsd.org/changeset/base/235839

Log:
  MFC r234712, r234744, r234934, r234988, r235294, r235335,
  and bits of r235337 and r235355:
  
   A new jail(8) with a configuration file, ultimately to replace the work
   currently done by /etc/rc.d/jail.

Added:
  stable/9/usr.sbin/jail/command.c
     - copied, changed from r234712, head/usr.sbin/jail/command.c
  stable/9/usr.sbin/jail/config.c
     - copied, changed from r234712, head/usr.sbin/jail/config.c
  stable/9/usr.sbin/jail/jail.conf.5
     - copied, changed from r234712, head/usr.sbin/jail/jail.conf.5
  stable/9/usr.sbin/jail/jaillex.l
     - copied, changed from r234712, head/usr.sbin/jail/jaillex.l
  stable/9/usr.sbin/jail/jailp.h
     - copied, changed from r234712, head/usr.sbin/jail/jailp.h
  stable/9/usr.sbin/jail/jailparse.y
     - copied unchanged from r234712, head/usr.sbin/jail/jailparse.y
  stable/9/usr.sbin/jail/state.c
     - copied unchanged from r234712, head/usr.sbin/jail/state.c
Modified:
  stable/9/lib/libc/sys/jail.2
  stable/9/usr.sbin/jail/Makefile
  stable/9/usr.sbin/jail/jail.8
  stable/9/usr.sbin/jail/jail.c
Directory Properties:
  stable/9/lib/libc/   (props changed)
  stable/9/lib/libc/sys/   (props changed)
  stable/9/usr.sbin/jail/   (props changed)

Modified: stable/9/lib/libc/sys/jail.2
==============================================================================
--- stable/9/lib/libc/sys/jail.2	Wed May 23 15:10:41 2012	(r235838)
+++ stable/9/lib/libc/sys/jail.2	Wed May 23 15:29:34 2012	(r235839)
@@ -59,7 +59,7 @@ system call sets up a jail and locks the
 The argument is a pointer to a structure describing the prison:
 .Bd -literal -offset indent
 struct jail {
-	u_int32_t	version;
+	uint32_t	version;
 	char		*path;
 	char		*hostname;
 	char		*jailname;
@@ -247,44 +247,6 @@ They return \-1 on failure, and set
 to indicate the error.
 .Pp
 .Rv -std jail_attach jail_remove
-.Sh PRISON?
-Once a process has been put in a prison, it and its descendants cannot escape
-the prison.
-.Pp
-Inside the prison, the concept of
-.Dq superuser
-is very diluted.
-In general,
-it can be assumed that nothing can be mangled from inside a prison which
-does not exist entirely inside that prison.
-For instance the directory
-tree below
-.Dq Li path
-can be manipulated all the ways a root can normally do it, including
-.Dq Li "rm -rf /*"
-but new device special nodes cannot be created because they reference
-shared resources (the device drivers in the kernel).
-The effective
-.Dq securelevel
-for a process is the greater of the global
-.Dq securelevel
-or, if present, the per-jail
-.Dq securelevel .
-.Pp
-All IP activity will be forced to happen to/from the IP number specified,
-which should be an alias on one of the network interfaces.
-All connections to/from the loopback address
-.Pf ( Li 127.0.0.1
-for IPv4,
-.Li ::1
-for IPv6) will be changed to be to/from the primary address
-of the jail for the given address family.
-.Pp
-It is possible to identify a process as jailed by examining
-.Dq Li /proc/<pid>/status :
-it will show a field near the end of the line, either as
-a single hyphen for a process at large, or the name currently
-set for the prison for jailed processes.
 .Sh ERRORS
 The
 .Fn jail
@@ -334,7 +296,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 +344,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
@@ -415,7 +377,7 @@ and
 .Fn jail_attach
 call
 .Xr chroot 2
-internally, so it can fail for all the same reasons.
+internally, so they can fail for all the same reasons.
 Please consult the
 .Xr chroot 2
 manual page for details.

Modified: stable/9/usr.sbin/jail/Makefile
==============================================================================
--- stable/9/usr.sbin/jail/Makefile	Wed May 23 15:10:41 2012	(r235838)
+++ stable/9/usr.sbin/jail/Makefile	Wed May 23 15:29:34 2012	(r235839)
@@ -3,9 +3,14 @@
 .include <bsd.own.mk>
 
 PROG=	jail
-MAN=	jail.8
-DPADD=	${LIBJAIL} ${LIBUTIL}
-LDADD=	-ljail -lutil
+MAN=	jail.8 jail.conf.5
+SRCS=	jail.c command.c config.c state.c jailp.h jaillex.l jailparse.y y.tab.h
+
+DPADD=	${LIBJAIL} ${LIBKVM} ${LIBUTIL} ${LIBL}
+LDADD=	-ljail -lkvm -lutil -ll
+
+YFLAGS+=-v
+CFLAGS+=-I. -I${.CURDIR}
 
 .if ${MK_INET6_SUPPORT} != "no"
 CFLAGS+= -DINET6
@@ -14,4 +19,6 @@ CFLAGS+= -DINET6
 CFLAGS+= -DINET
 .endif
 
+CLEANFILES= y.output
+
 .include <bsd.prog.mk>

Copied and modified: stable/9/usr.sbin/jail/command.c (from r234712, head/usr.sbin/jail/command.c)
==============================================================================
--- head/usr.sbin/jail/command.c	Thu Apr 26 17:36:05 2012	(r234712, copy source)
+++ stable/9/usr.sbin/jail/command.c	Wed May 23 15:29:34 2012	(r235839)
@@ -100,7 +100,7 @@ next_command(struct cfjail *j)
 		if (j->comstring == NULL) {
 			j->comparam += create_failed ? -1 : 1;
 			switch ((comparam = *j->comparam)) {
-			case 0:
+			case IP__NULL:
 				return 0;
 			case IP_MOUNT_DEVFS:
 				if (!bool_param(j->intparams[IP_MOUNT_DEVFS]))

Copied and modified: stable/9/usr.sbin/jail/config.c (from r234712, head/usr.sbin/jail/config.c)
==============================================================================
--- head/usr.sbin/jail/config.c	Thu Apr 26 17:36:05 2012	(r234712, copy source)
+++ stable/9/usr.sbin/jail/config.c	Wed May 23 15:29:34 2012	(r235839)
@@ -328,7 +328,7 @@ add_param(struct cfjail *j, const struct
 		}
 	} else {
 		flags = PF_APPEND;
-		if (ipnum != 0) {
+		if (ipnum != IP__NULL) {
 			name = intparams[ipnum].name;
 			flags |= intparams[ipnum].flags;
 		} else if ((cs = strchr(value, '='))) {
@@ -350,7 +350,7 @@ add_param(struct cfjail *j, const struct
 	}
 
 	/* See if this parameter has already been added. */
-	if (ipnum != 0)
+	if (ipnum != IP__NULL)
 		dp = j->intparams[ipnum];
 	else
 		TAILQ_FOREACH(dp, &j->params, tq)
@@ -375,10 +375,10 @@ add_param(struct cfjail *j, const struct
 		np->flags = flags;
 		np->gen = 0;
 		TAILQ_INSERT_TAIL(&j->params, np, tq);
-		if (ipnum != 0)
+		if (ipnum != IP__NULL)
 			j->intparams[ipnum] = np;
 		else
-			for (ipnum = 1; ipnum < IP_NPARAM; ipnum++)
+			for (ipnum = IP__NULL + 1; ipnum < IP_NPARAM; ipnum++)
 				if (!(intparams[ipnum].flags & PF_CONV) &&
 				    equalopts(name, intparams[ipnum].name)) {
 					j->intparams[ipnum] = np;

Modified: stable/9/usr.sbin/jail/jail.8
==============================================================================
--- stable/9/usr.sbin/jail/jail.8	Wed May 23 15:10:41 2012	(r235838)
+++ stable/9/usr.sbin/jail/jail.8	Wed May 23 15:29:34 2012	(r235839)
@@ -1,6 +1,5 @@
-.\"
 .\" Copyright (c) 2000, 2003 Robert N. M. Watson
-.\" Copyright (c) 2008 James Gritton
+.\" Copyright (c) 2008-2012 James Gritton
 .\" All rights reserved.
 .\"
 .\" Redistribution and use in source and binary forms, with or without
@@ -24,186 +23,263 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\"
-.\" ----------------------------------------------------------------------------
-.\" "THE BEER-WARE LICENSE" (Revision 42):
-.\" <phk@FreeBSD.org> wrote this file.  As long as you retain this notice you
-.\" can do whatever you want with this stuff. If we meet some day, and you think
-.\" this stuff is worth it, you can buy me a beer in return.   Poul-Henning Kamp
-.\" ----------------------------------------------------------------------------
-.\"
 .\" $FreeBSD$
 .\"
-.Dd February 29, 2012
+.Dd May 23, 2012
 .Dt JAIL 8
 .Os
 .Sh NAME
 .Nm jail
-.Nd "create or modify a system jail"
+.Nd "manage system jails"
 .Sh SYNOPSIS
 .Nm
-.Op Fl dhi
+.Op Fl dhilqv
 .Op Fl J Ar jid_file
-.Op Fl l u Ar username | Fl U Ar username
-.Op Fl c | m
-.Op Ar parameter=value ...
+.Op Fl u Ar username
+.Op Fl U Ar username
+.Op Fl cmr
+.Ar param Ns = Ns Ar value ...
+.Op Cm command Ns = Ns Ar command ...
 .Nm
-.Op Fl hi
-.Op Fl n Ar jailname
+.Op Fl dqv
+.Op Fl f Ar conf_file
+.Op Fl p Ar limit
+.Op Fl cmr
+.Op Ar jail
+.Nm
+.Op Fl qv
+.Op Fl f Ar conf_file
+.Op Fl rR
+.Op Cm * | Ar jail ...
+.Nm
+.Op Fl dhilqv
 .Op Fl J Ar jid_file
+.Op Fl u Ar username
+.Op Fl U Ar username
+.Op Fl n Ar jailname
 .Op Fl s Ar securelevel
-.Op Fl l u Ar username | Fl U Ar username
-.Op Ar path hostname [ip[,..]] command ...
-.Nm
-.Op Fl r Ar jail
+.Op Ar path hostname [ Ar ip Ns [ Ns Ar ,... Ns ]] Ar command ...
 .Sh DESCRIPTION
 The
 .Nm
-utility creates a new jail or modifies an existing jail, optionally
-imprisoning the current process (and future descendants) inside it.
+utility creates new jails, or modifies or removes existing jails.
+A jail is specified via parameters on the command line, or in the
+.Xr jail.conf 5
+file.
+.Pp
+At least one of the options
+.Fl c ,
+.Fl m
+or
+.Fl r
+must be specified.
+These options are used alone or in combination describe the operation to
+perform:
+.Bl -tag -width indent
+.It Fl c
+Create a new jail.
+The jail
+.Va jid
+and
+.Va name
+parameters (if specified) on the command line,
+or any jails
+must not refer to an existing jail.
+.It Fl m
+Modify an existing jail.
+One of the
+.Va jid
+or
+.Va name
+parameters must exist and refer to an existing jail.
+Some parameters may not be changed on a running jail.
+.It Fl r
+Remove the
+.Ar jail
+specified by jid or name.
+All jailed processes are killed, and all children of this jail are also
+removed.
+.It Fl rc
+Restart an existing jail.
+The jail is first removed and then re-created, as if
+.Dq Nm Fl c
+and
+.Dq Nm Fl r
+were run in succession.
+.It Fl cm
+Create a jail if it does not exist, or modify the jail if it does exist.
+.It Fl mr
+Modify an existing jail.
+The jail may be restarted if necessary to modify parameters than could
+not otherwise be changed.
+.It Fl cmr
+Create a jail if it doesn't exist, or modify (and possibly restart) the
+jail if it does exist.
+.El
 .Pp
-The options are as follows:
+Other available options are:
 .Bl -tag -width indent
 .It Fl d
-Allow making changes to a dying jail.
+Allow making changes to a dying jail, equivalent to the
+.Va allow.dying
+parameter.
+.It Fl f Ar conf_file
+Use configuration file
+.Ar conf_file
+instead of the default
+.Pa /etc/jail.conf .
 .It Fl h
 Resolve the
 .Va host.hostname
 parameter (or
 .Va hostname )
 and add all IP addresses returned by the resolver
-to the list of
-.Va ip
-addresses for this prison.
-This may affect default address selection for outgoing IPv4 connections
-of prisons.
-The address first returned by the resolver for each address family
-will be used as primary address.
-See the
-.Va ip4.addr
-and
-.Va ip6.addr
-parameters further down for details.
-.It Fl i
-Output the jail identifier of the newly created jail.
-.It Fl n Ar jailname
-Set the jail's name.
-This is deprecated and is equivalent to setting the
-.Va name
+to the list of addresses for this prison.
+This is equivalent to the
+.Va ip_hostname
 parameter.
+.It Fl i
+Output (only) the jail identifier of the newly created jail(s).
+This implies the
+.Fl q
+option.
 .It Fl J Ar jid_file
 Write a
 .Ar jid_file
-file, containing jail identifier, path, hostname, IP and
-command used to start the jail.
+file, containing parameters used to start the jail.
 .It Fl l
-Run program in the clean environment.
-The environment is discarded except for
-.Ev HOME , SHELL , TERM
-and
-.Ev USER .
-.Ev HOME
-and
-.Ev SHELL
-are set to the target login's default values.
-.Ev USER
-is set to the target login.
-.Ev TERM
-is imported from the current environment.
-The environment variables from the login class capability database for the
-target login are also set.
+Run commands in a clean environment.
+This is deprecated and is equivalent to the exec.clean parameter.
+.It Fl n Ar jailname
+Set the jail's name.
+This is deprecated and is equivalent to the
+.Va name
+parameter.
+.It Fl p Ar limit
+Limit the number of commands from
+.Va  exec.*
+that can run simultaneously.
+.It Fl q
+Suppress the message printed whenever a jail is created, modified or removed.
+Only error messages will be printed.
+.It Fl R
+A variation of the
+.Fl r
+option that removes an existing jail without using the configuration file.
+No removal-related parameters for this jail will be used - the jail will
+simply be removed.
 .It Fl s Ar securelevel
 Set the
 .Va kern.securelevel
 MIB entry to the specified value inside the newly created jail.
-This is deprecated and is equivalent to setting the
+This is deprecated and is equivalent to the
 .Va securelevel
 parameter.
 .It Fl u Ar username
-The user name from host environment as whom the
-.Ar command
-should run.
-.It Fl U Ar username
-The user name from jailed environment as whom the
-.Ar command
-should run.
-.It Fl c
-Create a new jail.
-The
-.Va jid
+The user name from host environment as whom jailed commands should run.
+This is deprecated and is equivalent to the
+.Va exec.jail_user
 and
-.Va name
-parameters (if specified) must not refer to an existing jail.
-.It Fl m
-Modify an existing jail.
-One of the
-.Va jid
-or
-.Va name
-parameters must exist and refer to an existing jail.
-.It Fl cm
-Create a jail if it does not exist, or modify a jail if it does exist.
-.It Fl r
-Remove the
-.Ar jail
-specified by jid or name.
-All jailed processes are killed, and all children of this jail are also
-removed.
+.Va exec.system_jail_user
+parameters.
+.It Fl U Ar username
+The user name from jailed environment as whom jailed commands should run.
+This is deprecated and is equivalent to the
+.Va exec.jail_user
+parameter.
+.It Fl v
+Print a message on every operation, such as running commands and
+mounting filesystems.
 .El
 .Pp
-At least one of the
-.Fl c ,
-.Fl m
-or
+If no arguments are given after the options, the operation (except
+remove) will be performed on all jails specified in the
+.Xr jail.conf 5
+file.
+A single argument of a jail name will operate only on the specified jail.
+The
 .Fl r
-options must be specified.
-.Pp
-.Ar Parameters
-are listed in
-.Dq name=value
-form, following the options.
-Some parameters are boolean, and do not have a value but are set by the
-name alone with or without a
-.Dq no
-prefix, e.g.
-.Va persist
-or
-.Va nopersist .
-Any parameters not set will be given default values, often based on the
-current environment.
+and
+.Fl R
+options can also remove running jails that aren't in the
+.Xr jail.conf 5
+file, specified by name or jid.
+.Pp
+An argument of
+.Dq *
+is a wildcard that will operate on all jails, regardless of whether
+they appear in
+.Xr jail.conf 5 ;
+this is the surest way for
+.Fl r
+to remove all jails.
+If hierarchical jails exist, a partial-matching wildcard definition may
+be specified.
+For example, an argument of
+.Dq foo.*
+would apply to jails with names like
+.Dq foo.bar
+and
+.Dq foo.bar.baz .
 .Pp
-The pseudo-parameter
-.Va command
-specifies that the current process should enter the new (or modified) jail,
-and run the specified command.
-It must be the last parameter specified, because it includes not only
-the value following the
-.Sq =
-sign, but also passes the rest of the arguments to the command.
-.Pp
-Instead of supplying named
-.Ar parameters ,
-four fixed parameters may be supplied in order on the command line:
+A jail may be specified with parameters directly on the command line.
+In this case, the
+.Xr jail.conf 5
+file will not be used.
+For backward compatibility, the command line may also have four fixed
+parameters, without names:
 .Ar path ,
 .Ar hostname ,
 .Ar ip ,
 and
 .Ar command .
-As the
-.Va jid
-and
-.Va name
-parameters aren't in this list, this mode will always create a new jail, and
-the
+This mode will always create a new jail, and the
 .Fl c
 and
 .Fl m
 options don't apply (and must not exist).
+.Ss Jail Parameters
+Parameters in the
+.Xr jail.conf 5
+file, or on the command line, are generally in
+.Dq name=value
+form.
+Some parameters are boolean, and do not have a value but are set by the
+name alone with or without a
+.Dq no
+prefix, e.g.
+.Va persist
+or
+.Va nopersist .
+They can also be given the values
+.Dq true
+and
+.Dq false .
+Other partameters may have more than one value, specified as a
+comma-separated list or with
+.Dq +=
+in the configuration file (see
+.Xr jail.conf 5
+for details).
 .Pp
-Jails have a set a core parameters, and modules can add their own jail
-parameters.
+The
+.Nm
+utility recognizes two classes of parameters.  There are the true jail
+parameters that are passed to the kernel when the jail is created,
+can be seen with
+.Xr jls 8 ,
+and can (usually) be changed with
+.Dq Nm Fl m.
+Then there are pseudo-parameters that are only used by
+.Nm
+itself.
+.Pp
+Jails have a set a core parameters, and kernel modules can add their own
+jail parameters.
 The current set of available parameters can be retrieved via
 .Dq Nm sysctl Fl d Va security.jail.param .
+Any parameters not set will be given default values, often based on the
+current environment.
 The core parameters are:
 .Bl -tag -width indent
 .It Va jid
@@ -231,14 +307,21 @@ If no
 .Va name
 is supplied, a default is assumed that is the same as the
 .Va jid .
-.It Va path
-Directory which is to be the root of the prison.
 The
-.Va command
-(if any) is run from this directory, as are commands from
-.Xr jexec 8 .
+.Va name
+parameter is implied by the
+.Xr jail.conf 5
+file format, and need not be explicitly set when using the configuration
+file.
+.It Va path
+The directory which is to be the root of the prison.
+Any commands run inside the prison, either by
+.Nm
+or from
+.Xr jexec 8 ,
+are run from this directory.
 .It Va ip4.addr
-A comma-separated list of IPv4 addresses assigned to the prison.
+A list of IPv4 addresses assigned to the prison.
 If this is set, the jail is restricted to using only these addresses.
 Any attempts to use other addresses fail, and attempts to use wildcard
 addresses silently use the jailed address instead.
@@ -252,7 +335,7 @@ assigned to itself.
 A boolean option to change the formerly mentioned behaviour and disable
 IPv4 source address selection for the prison in favour of the primary
 IPv4 address of the jail.
-Source address selection is enabled by default for all jails and a
+Source address selection is enabled by default for all jails and the
 .Va ip4.nosaddrsel
 setting of a parent jail is not inherited for any child jails.
 .It Va ip4
@@ -277,8 +360,20 @@ A set of IPv6 options for the prison, th
 and
 .Va ip4
 above.
+.It vnet
+Create the prison with its own virtual network stack,
+with its own network interfaces, addresses, routing table, etc.
+The kernel must have been compiled with the
+.Sy VIMAGE option
+for this to be available.
+Possible values are
+.Dq inherit
+to use the system network stack, possibly with restricted IP addresses,
+and
+.Dq new
+to create a new network stack.
 .It Va host.hostname
-Hostname of the prison.
+The hostname of the prison.
 Other similar parameters are
 .Va host.domainname ,
 .Va host.hostuuid
@@ -314,13 +409,24 @@ permissions are effective and
 .Va enforce_statfs
 is set to a value lower than 2.
 Devfs rules and rulesets cannot be viewed or modified from inside a jail.
+.Pp
+NOTE: It is important that only appropriate device nodes in devfs be
+exposed to a jail; access to disk devices in the jail may permit processes
+in the jail to bypass the jail sandboxing by modifying files outside of
+the jail.
+See
+.Xr devfs 8
+for information on how to use devfs rules to limit access to entries
+in the per-jail devfs.
+A simple devfs ruleset for jails is available as ruleset #4 in
+.Pa /etc/defaults/devfs.rules .
 .It Va children.max
 The number of child jails allowed to be created by this jail (or by
 other jails under this jail).
 This limit is zero by default, indicating the jail is not allowed to
 create child jails.
 See the
-.Va "Hierarchical Jails"
+.Sx "Hierarchical Jails"
 section for more information.
 .It Va children.cur
 The number of descendents of this jail, including its own child jails
@@ -345,10 +451,13 @@ where the jail's chroot directory is loc
 .It Va persist
 Setting this boolean parameter allows a jail to exist without any
 processes.
-Normally, a jail is destroyed as its last process exits.
+Normally, a command is run as part of jail creation, and then the jail
+is destroyed as its last process exits.
 A new jail must have either the
 .Va persist
 parameter or
+.Va exec.start
+or
 .Va command
 pseudo-parameter set.
 .It Va cpuset.id
@@ -459,6 +568,171 @@ have not had jail functionality added to
 .El
 .El
 .Pp
+There are pseudo-parameters that aren't passed to the kernel, but are
+used by
+.Nm
+to set up the prison environment, often by running specified commands
+when jails are created or removed.
+The
+.Va exec.*
+command parameters are
+.Xr sh 1
+command lines that are run in either the system or prison environment.
+They may be given multiple values, which run would the specified
+commands in sequence.
+All commands must succed (return a zero exit status), or the jail will
+not be created or removed.
+.Pp
+The pseudo-parameters are:
+.Bl -tag -width indent
+.It Va exec.prestart
+Command(s) to run in the system environment before a prison is created.
+.It Va exec.start
+Command(s) to run in the prison environment when a jail is created.
+A typical command to run is
+.Dq sh /etc/rc .
+.It Va command
+A synonym for
+.Va exec.start
+for use when specifying a prison directly on the command line.
+Unlike other parameters whose value is a single string,
+.Va command
+uses the remainder of the
+.Nm
+command line as its own arguments.
+.It Va exec.poststart
+Command(s) to run in the system environment after a jail is created,
+and after any
+.Va exec.start
+commands have completed.
+.It Va exec.prestop
+Command(s) to run in the system environment before a jail is removed.
+.It Va exec.stop
+Command(s) to run in the prison environment before a jail is removed,
+and after any
+.Va exec.prestop
+commands have completed.
+A typical command to run is
+.Dq sh /etc/rc.shutdown .
+.It Va exec.poststop
+Command(s) to run in the system environment after a jail is removed.
+.It Va exec.clean
+Run commands in a clean environment.
+The environment is discarded except for
+.Ev HOME , SHELL , TERM
+and
+.Ev USER .
+.Ev HOME
+and
+.Ev SHELL
+are set to the target login's default values.
+.Ev USER
+is set to the target login.
+.Ev TERM
+is imported from the current environment.
+The environment variables from the login class capability database for the
+target login are also set.
+.It Va exec.jail_user
+The user to run commands as, when running in the prison environment.
+The default is to run the commands as the current user.
+.It Va exec.system_jail_user
+This boolean option looks for the
+.Va exec.jail_user
+in the system
+.Xr passwd 5
+file, instead of in the prison's file.
+.It Va exec.system_user
+The user to run commands as, when running in the system environment.
+The default is to run the commands as the current user.
+.It Va exec.timeout
+The maximum amount of time to wait for a command to complete.
+If a command is still running after this many seconds have passed,
+the jail not be created or removed.
+.It Va exec.consolelog
+A file to direct command output (stdout and stderr) to.
+.It Va exec.fib
+The FIB (routing table) to set when running commands inside the prison.
+.It Va stop.timeout
+The maximum amount of time to wait for a prison's processes to exit
+after sending them a
+.Dv SIGTERM
+signal (which happens after the
+.Va exec.stop commands have completed).
+After this many seconds have passed, the prison will be removed, which
+will kill any remaining processes.
+If this is set to zero, no
+.Dv SIGTERM
+is sent and the prison is immediately removed.
+The default is 10 seconds.
+.It Va interface
+A network interface to add the prison's IP addresses
+.Va ( ip4.addr
+and
+.Va ip6.addr )
+to.
+An alias for each address will be added to the interface before the
+prison is created, and will be removed from the interface after the
+prison is removed.
+.It Op Va ip4.addr
+In addition to the IP addresses that are passed to the kernel, and
+interface and/or a netmask may also be specified, in the form
+.Dq Ar interface Ns | Ns Ar ip-address Ns / Ns Ar netmask .
+If an interface is given before the IP address, an alias for the address
+will be added to that interface, as it is with the
+.Va interface
+parameter.  If a netmask in either dotted-quad or CIDR form is given
+after IP address, it will be used when adding the IP alias.
+.It Op Va ip6.addr
+In addition to the IP addresses that are passed to the kernel,
+and interface and/or a prefix may also be specified, in the form
+.Dq Ar interface Ns | Ns Ar ip-address Ns / Ns Ar prefix .
+.It Va vnet.interface
+A network interface to give to a vnet-enabled jail after is it created.
+The interface will automatically be returned when the jail is removed.
+.It Va ip_hostname
+Resolve the
+.Va host.hostname
+parameter and add all IP addresses returned by the resolver
+to the list of addresses
+.Va ( ip4.addr
+or
+.Va ip6.addr )
+for this prison.
+This may affect default address selection for outgoing IPv4 connections
+of prisons.
+The address first returned by the resolver for each address family
+will be used as primary address.
+.It Va mount
+A filesystem to mount before creating the jail (and to unmount after
+removing it), given as a single
+.Xr fstab 5
+line.
+.It Va mount.fstab
+An
+.Xr fstab 5
+format file containing filesystems to mount before creating a jail.
+.It Va mount.devfs
+Mount a
+.Xr devfs
+filesystem on the chrooted /dev directory, and apply the ruleset in the
+.Va devfs_ruleset
+parameter (or a default of ruleset 4: devfsrules_jail)
+to restrict the devices visible inside the prison.
+.It Va allow.dying
+Allow making changes to a
+.Va dying
+jail.
+.It Va depend
+Specify a jail (or jails) that this jail depends on.
+Any such jails must be fully created, up to the last
+.Va exec.poststart
+command, before any action will taken to create this jail.
+When jails are removed the opposite is true:
+this jail must be fully removed, up to the last
+.Va exec.poststop
+command, before the jail(s) it depends on are stopped.
+.El
+.Sh EXAMPLES
 Jails are typically set up using one of two philosophies: either to
 constrain a specific application (possibly running with privilege), or
 to create a
@@ -476,7 +750,6 @@ process.
 This manual page documents the configuration steps necessary to support
 either of these steps, although the configuration steps may be
 refined based on local requirements.
-.Sh EXAMPLES
 .Ss "Setting up a Jail Directory Tree"
 To set up a jail directory tree containing an entire
 .Fx
@@ -489,20 +762,8 @@ cd /usr/src
 mkdir -p $D
 make world DESTDIR=$D
 make distribution DESTDIR=$D
-mount -t devfs devfs $D/dev
 .Ed
 .Pp
-NOTE: It is important that only appropriate device nodes in devfs be
-exposed to a jail; access to disk devices in the jail may permit processes
-in the jail to bypass the jail sandboxing by modifying files outside of
-the jail.
-See
-.Xr devfs 8
-for information on how to use devfs rules to limit access to entries
-in the per-jail devfs.
-A simple devfs ruleset for jails is available as ruleset #4 in
-.Pa /etc/defaults/devfs.rules .
-.Pp
 In many cases this example would put far more in the jail than needed.
 In the other extreme case a jail might contain only one file:
 the executable to be run in the jail.
@@ -520,8 +781,9 @@ Do what was described in
 to build the jail directory tree.
 For the sake of this example, we will
 assume you built it in
-.Pa /data/jail/192.0.2.100 ,
-named for the jailed IP address.
+.Pa /data/jail/testjail ,
+for a jail named
+.Dq testjail .
 Substitute below as needed with your
 own directory, IP address, and hostname.
 .Ss "Setting up the Host Environment"
@@ -619,7 +881,7 @@ or for running a virtual server.
 .Pp
 Start a shell in the jail:
 .Bd -literal -offset indent
-jail -c path=/data/jail/192.0.2.100 host.hostname=testhostname \\
+jail -c path=/data/jail/testjail mount.devfs host.hostname=testhostname \\
 	ip4.addr=192.0.2.100 command=/bin/sh
 .Ed
 .Pp
@@ -633,15 +895,6 @@ etc.
 .Pp
 .Bl -bullet -offset indent -compact
 .It
-Create an empty
-.Pa /etc/fstab
-to quell startup warnings about missing fstab (virtual server only)
-.It
-Disable the port mapper
-.Pa ( /etc/rc.conf :
-.Li rpcbind_enable="NO" )
-(virtual server only)
-.It
 Configure
 .Pa /etc/resolv.conf
 so that name resolution within the jail will work correctly
@@ -652,11 +905,6 @@ to quell
 .Xr sendmail 8
 warnings.
 .It
-Disable interface configuration to quell startup warnings about
-.Xr ifconfig 8
-.Pq Li network_interfaces=""
-(virtual server only)
-.It
 Set a root password, probably different from the real host system
 .It
 Set the timezone
@@ -674,36 +922,47 @@ If you are not using a virtual server, y
 .Xr syslogd 8
 in the host environment to listen on the syslog socket in the jail
 environment; in this example, the syslog socket would be stored in
-.Pa /data/jail/192.0.2.100/var/run/log .
+.Pa /data/jail/testjail/var/run/log .
 .Pp
 Exit from the shell, and the jail will be shut down.
 .Ss "Starting the Jail"
 You are now ready to restart the jail and bring up the environment with
 all of its daemons and other programs.
-If you are running a single application in the jail, substitute the
-command used to start the application for
-.Pa /etc/rc
-in the examples below.
+Create an entry for the jail in
+.Pa /etc/jail.conf :
+.Bd -literal -offset indent
+testjail {
+	path = /tmp/jail/testjail;
+	mount.devfs;
+	host.hostname = testhostname;
+	ip4.addr = 192.0.2.100;
+	interface = ed0;
+	exec.start = "/bin/sh /etc/rc";
+	exec.stop = "/bin/sh /etc/rc.shutdown";
+}
+.Ed
+.Pp
 To start a virtual server environment,
 .Pa /etc/rc
-is run to launch various daemons and services.
-To do this, first bring up the
-virtual host interface, and then start the jail's
-.Pa /etc/rc
-script from within the jail.
+is run to launch various daemons and services, and
+.Pa /etc/rc.shutdown
+is run to shut them down when the jail is removed.
+If you are running a single application in the jail,
+substitute the command used to start the application for
+.Dq /bin/sh /etc/rc ;
+there may be some script available to cleanly shut down the application,
+or it may be sufficient to go without a stop command, and have
+.Nm
+send
+.Dv SIGTERM
+to the application.
+.Pp
+Start the jail by running:
 .Bd -literal -offset indent
-ifconfig ed0 inet alias 192.0.2.100/32
-mount -t procfs proc /data/jail/192.0.2.100/proc
-jail -c path=/data/jail/192.0.2.100 host.hostname=testhostname \\
-	ip4.addr=192.0.2.100 command=/bin/sh /etc/rc
+jail -c testjail
 .Ed
 .Pp
-A few warnings will be produced, because most
-.Xr sysctl 8
-configuration variables cannot be set from within the jail, as they are
-global across all jails and the host environment.
-However, it should all
-work properly.
+A few warnings may be produced; however, it should all work properly.
 You should be able to see
 .Xr inetd 8 ,
 .Xr syslogd 8 ,
@@ -726,15 +985,6 @@ Please refer to the
 variables in
 .Xr rc.conf 5
 for more information.
-The
-.Xr rc 8
-jail script provides a flexible system to start/stop jails:
-.Bd -literal
-/etc/rc.d/jail start
-/etc/rc.d/jail stop
-/etc/rc.d/jail start myjail
-/etc/rc.d/jail stop myjail
-.Ed
 .Ss "Managing the Jail"
 Normal machine shutdown commands, such as
 .Xr halt 8 ,
@@ -742,9 +992,8 @@ Normal machine shutdown commands, such a
 and
 .Xr shutdown 8 ,
 cannot be used successfully within the jail.
-To kill all processes in a
-jail, you may log into the jail and, as root, use one of the following
-commands, depending on what you want to accomplish:
+To kill all processes from within a jail, you may use one of the
+following commands, depending on what you want to accomplish:
 .Bd -literal -offset indent
 kill -TERM -1

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

From owner-svn-src-stable-9@FreeBSD.ORG  Wed May 23 16:43:17 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 4D391106564A;
	Wed, 23 May 2012 16:43:17 +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 3798E8FC08;
	Wed, 23 May 2012 16:43: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 q4NGhHQ0084057;
	Wed, 23 May 2012 16:43:17 GMT
	(envelope-from bschmidt@svn.freebsd.org)
Received: (from bschmidt@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4NGhHbt084055;
	Wed, 23 May 2012 16:43:17 GMT
	(envelope-from bschmidt@svn.freebsd.org)
Message-Id: <201205231643.q4NGhHbt084055@svn.freebsd.org>
From: Bernhard Schmidt <bschmidt@FreeBSD.org>
Date: Wed, 23 May 2012 16:43:16 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r235843 - stable/9/sys/dev/iwn
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Wed, 23 May 2012 16:43:17 -0000

Author: bschmidt
Date: Wed May 23 16:43:16 2012
New Revision: 235843
URL: http://svn.freebsd.org/changeset/base/235843

Log:
  MFC r235684:
  Add some more 100/130 series device IDs.

Modified:
  stable/9/sys/dev/iwn/if_iwn.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/dev/   (props changed)

Modified: stable/9/sys/dev/iwn/if_iwn.c
==============================================================================
--- stable/9/sys/dev/iwn/if_iwn.c	Wed May 23 16:19:19 2012	(r235842)
+++ stable/9/sys/dev/iwn/if_iwn.c	Wed May 23 16:43:16 2012	(r235843)
@@ -92,6 +92,9 @@ static const struct iwn_ident iwn_ident_
 	{ 0x8086, 0x0885, "Intel Centrino Wireless-N + WiMAX 6150"	},
 	{ 0x8086, 0x0886, "Intel Centrino Wireless-N + WiMAX 6150"	},
 	{ 0x8086, 0x0896, "Intel Centrino Wireless-N 130"		},
+	{ 0x8086, 0x0887, "Intel Centrino Wireless-N 130"		},
+	{ 0x8086, 0x08ae, "Intel Centrino Wireless-N 100"		},
+	{ 0x8086, 0x08af, "Intel Centrino Wireless-N 100"		},
 	{ 0x8086, 0x4229, "Intel Wireless WiFi Link 4965"		},
 	{ 0x8086, 0x422b, "Intel Centrino Ultimate-N 6300"		},
 	{ 0x8086, 0x422c, "Intel Centrino Advanced-N 6200"		},

From owner-svn-src-stable-9@FreeBSD.ORG  Wed May 23 17:55:20 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 2FD86106567A;
	Wed, 23 May 2012 17:55:20 +0000 (UTC)
	(envelope-from adrian.chadd@gmail.com)
Received: from mail-pz0-f54.google.com (mail-pz0-f54.google.com
	[209.85.210.54])
	by mx1.freebsd.org (Postfix) with ESMTP id D44CE8FC19;
	Wed, 23 May 2012 17:55:19 +0000 (UTC)
Received: by dadv36 with SMTP id v36so10899805dad.13
	for <multiple recipients>; Wed, 23 May 2012 10:55:19 -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=VmcX7iZBofhhHNkp/Mzn0SqOG0OKiNKRpNV3tCiJHj4=;
	b=WvA7XofhxuZ0iy2UiogwaYus7tVMAnkKzEHgAuf/CarIR6P/V1ok838ChVm3ntPScR
	m5NdgJRABRnMPaNgFzsLlCJM79Z7r9LTRGY5GbjG71CKc8i0J1+CGDGiFNkXde3NY/yk
	CysP6fXzM/ZfmMaSheZyfL3ksRGIqmilQi4PaHaZs+lV8xSb56CasXgDX6iWNTxlqoAU
	DS8OkHTxHEx6FZbtUaP/W5nlj9nwIL+a6AyEBQrzwIHAc/xfctHcW5Azj+5DOZmpLFKw
	emygrDy+aBk3Dh9GQx/zH+91OOvAzE4k69UbeYiQipvMiNGqTFucT/ZcVdBNdV311DxT
	QLxA==
MIME-Version: 1.0
Received: by 10.68.223.167 with SMTP id qv7mr12183516pbc.127.1337795719333;
	Wed, 23 May 2012 10:55:19 -0700 (PDT)
Sender: adrian.chadd@gmail.com
Received: by 10.142.203.2 with HTTP; Wed, 23 May 2012 10:55:18 -0700 (PDT)
In-Reply-To: <201205230202.q4N22UDA041838@svn.freebsd.org>
References: <201205230202.q4N22UDA041838@svn.freebsd.org>
Date: Wed, 23 May 2012 10:55:18 -0700
X-Google-Sender-Auth: mSfHb8FA7O53PGTsbzcsqHzLWA8
Message-ID: <CAJ-Vmoku9ACBGYxEkja41G=-vPuDqN34c0esLbGLnX8NM5Jspg@mail.gmail.com>
From: Adrian Chadd <adrian@freebsd.org>
To: Pyun YongHyeon <yongari@freebsd.org>
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org, svn-src-stable-9@freebsd.org
Subject: Re: svn commit: r235818 - stable/9/sys/dev/bce
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Wed, 23 May 2012 17:55:20 -0000

Hi,

Have you looked at the MDIO bus support that I brought in from Stefan?

This almost feels like a poster child for that - you'd write an MDIO
bus driver for this particular mailbox hardware interface and modify
the driver to use that, then the MDIO bus will automatically probe
whatever PHYs exist there

That way it could be reused for other MDIO bus consumers too, such as
switch PHYs and other MDIO-but-not-quite-PHY devices.

Adrian

On 22 May 2012 19:02, Pyun YongHyeon <yongari@freebsd.org> wrote:
> Author: yongari
> Date: Wed May 23 02:02:29 2012
> New Revision: 235818
> URL: http://svn.freebsd.org/changeset/base/235818
>
> Log:
> =A0MFC r235151:
> =A0 =A0Implement basic remote PHY support. Remote PHY allows the
> =A0 =A0controller to perform MDIO type accesses to a remote transceiver
> =A0 =A0using message pages defined through MRBE(multirate backplane
> =A0 =A0ethernet). =A0It's used in blade systems(e.g Dell Blade m610) whic=
h
> =A0 =A0are connected to pass-through blades rather than traditional
> =A0 =A0switches.
> =A0 =A0This change directly manipulates firmware's mailboxes to control
> =A0 =A0remote PHY such that it does not use mii(4). =A0Alternatively, as
> =A0 =A0David said, it could be implemented in brgphy(4) by creating a fak=
e
> =A0 =A0PHY and let brgphy(4) do necessary mii accesses and bce(4) can
> =A0 =A0implement mailbox accesses based on the type of brgphy(4)'s mii
> =A0 =A0accesses. Personally, I think it would make brgphy(4) hard to
> =A0 =A0maintain since it would have to access many bce(4) registers in
> =A0 =A0brgphy(4). Given that there are users who are suffering from lack
> =A0 =A0of remote PHY support, it would be better to get working system
> =A0 =A0rather than waiting for complete/perfect implementation.
>
> Modified:
> =A0stable/9/sys/dev/bce/if_bce.c
> =A0stable/9/sys/dev/bce/if_bcereg.h
> Directory Properties:
> =A0stable/9/sys/ =A0 (props changed)
> =A0stable/9/sys/amd64/include/xen/ =A0 (props changed)
> =A0stable/9/sys/boot/ =A0 (props changed)
> =A0stable/9/sys/boot/i386/efi/ =A0 (props changed)
> =A0stable/9/sys/boot/ia64/efi/ =A0 (props changed)
> =A0stable/9/sys/boot/ia64/ski/ =A0 (props changed)
> =A0stable/9/sys/boot/powerpc/boot1.chrp/ =A0 (props changed)
> =A0stable/9/sys/boot/powerpc/ofw/ =A0 (props changed)
> =A0stable/9/sys/cddl/contrib/opensolaris/ =A0 (props changed)
> =A0stable/9/sys/conf/ =A0 (props changed)
> =A0stable/9/sys/contrib/dev/acpica/ =A0 (props changed)
> =A0stable/9/sys/contrib/octeon-sdk/ =A0 (props changed)
> =A0stable/9/sys/contrib/pf/ =A0 (props changed)
> =A0stable/9/sys/contrib/x86emu/ =A0 (props changed)
> =A0stable/9/sys/dev/ =A0 (props changed)
> =A0stable/9/sys/dev/e1000/ =A0 (props changed)
> =A0stable/9/sys/dev/ixgbe/ =A0 (props changed)
> =A0stable/9/sys/fs/ =A0 (props changed)
> =A0stable/9/sys/fs/ntfs/ =A0 (props changed)
> =A0stable/9/sys/modules/ =A0 (props changed)
>
> Modified: stable/9/sys/dev/bce/if_bce.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
> --- stable/9/sys/dev/bce/if_bce.c =A0 =A0 =A0 Wed May 23 01:49:50 2012 =
=A0 =A0 =A0 =A0(r235817)
> +++ stable/9/sys/dev/bce/if_bce.c =A0 =A0 =A0 Wed May 23 02:02:29 2012 =
=A0 =A0 =A0 =A0(r235818)
> @@ -364,6 +364,7 @@ static int =A0bce_nvram_write =A0 =A0 =A0 =A0 (struct=
 bce
> =A0static void bce_get_rx_buffer_sizes(struct bce_softc *, int);
> =A0static void bce_get_media =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(=
struct bce_softc *);
> =A0static void bce_init_media =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (st=
ruct bce_softc *);
> +static u32 bce_get_rphy_link =A0 =A0 =A0 =A0 =A0 (struct bce_softc *);
> =A0static void bce_dma_map_addr =A0 =A0 =A0 =A0 =A0 (void *, bus_dma_segm=
ent_t *, int, int);
> =A0static int =A0bce_dma_alloc =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
=A0(device_t);
> =A0static void bce_dma_free =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (=
struct bce_softc *);
> @@ -372,6 +373,7 @@ static void bce_release_resources =A0 (struc
> =A0/*********************************************************************=
*******/
> =A0/* BCE Firmware Synchronization and Load =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0*/
> =A0/*********************************************************************=
*******/
> +static void bce_fw_cap_init =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(stru=
ct bce_softc *);
> =A0static int =A0bce_fw_sync =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
=A0(struct bce_softc *, u32);
> =A0static void bce_load_rv2p_fw =A0 =A0 =A0 =A0 =A0 (struct bce_softc *, =
u32 *, u32, u32);
> =A0static void bce_load_cpu_fw =A0 =A0 =A0 =A0 =A0 =A0(struct bce_softc *=
,
> @@ -418,6 +420,7 @@ static void bce_watchdog =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
=A0 =A0 =A0(struct bce_s
> =A0static int =A0bce_ifmedia_upd =A0 =A0 =A0 =A0 =A0 =A0(struct ifnet *);
> =A0static int =A0bce_ifmedia_upd_locked =A0 =A0 (struct ifnet *);
> =A0static void bce_ifmedia_sts =A0 =A0 =A0 =A0 =A0 =A0(struct ifnet *, st=
ruct ifmediareq *);
> +static void bce_ifmedia_sts_rphy =A0 =A0 =A0 (struct bce_softc *, struct=
 ifmediareq *);
> =A0static void bce_init_locked =A0 =A0 =A0 =A0 =A0 =A0(struct bce_softc *=
);
> =A0static void bce_init =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
=A0 (void *);
> =A0static void bce_mgmt_init_locked =A0 =A0 =A0 (struct bce_softc *sc);
> @@ -757,6 +760,13 @@ bce_print_adapter_info(struct bce_softc
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0printf("2.5G"); i++;
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0}
>
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (sc->bce_phy_flags & BCE_PHY_REMOTE_CAP_=
FLAG) {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (i > 0) printf("|");
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 printf("Remote PHY(%s)",
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 sc->bce_phy_flags &=
 BCE_PHY_REMOTE_PORT_FIBER_FLAG ?
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 "FIBER" : "TP"); i+=
+;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 }
> +
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0if (sc->bce_flags & BCE_MFW_ENABLE_FLAG) {
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0if (i > 0) printf("|");
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0printf("MFW); MFW (%s)\n",=
 sc->bce_mfw_ver);
> @@ -1297,6 +1307,9 @@ bce_attach(device_t dev)
> =A0 =A0 =A0 =A0if (val & BCE_PCICFG_MISC_STATUS_32BIT_DET)
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0sc->bce_flags |=3D BCE_PCI_32BIT_FLAG;
>
> + =A0 =A0 =A0 /* Find the media type for the adapter. */
> + =A0 =A0 =A0 bce_get_media(sc);
> +
> =A0 =A0 =A0 =A0/* Reset controller and announce to bootcode that driver i=
s present. */
> =A0 =A0 =A0 =A0if (bce_reset(sc, BCE_DRV_MSG_CODE_RESET)) {
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0BCE_PRINTF("%s(%d): Controller reset faile=
d!\n",
> @@ -1344,9 +1357,6 @@ bce_attach(device_t dev)
> =A0 =A0 =A0 =A0/* Update statistics once every second. */
> =A0 =A0 =A0 =A0sc->bce_stats_ticks =3D 1000000 & 0xffff00;
>
> - =A0 =A0 =A0 /* Find the media type for the adapter. */
> - =A0 =A0 =A0 bce_get_media(sc);
> -
> =A0 =A0 =A0 =A0/* Store data needed by PHY driver for backplane applicati=
ons */
> =A0 =A0 =A0 =A0sc->bce_shared_hw_cfg =3D bce_shmem_rd(sc, BCE_SHARED_HW_C=
FG_CONFIG);
> =A0 =A0 =A0 =A0sc->bce_port_hw_cfg =A0 =3D bce_shmem_rd(sc, BCE_PORT_HW_C=
FG_CONFIG);
> @@ -1386,6 +1396,15 @@ bce_attach(device_t dev)
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0ifp->if_capabilities =3D BCE_IF_CAPABILITI=
ES;
> =A0 =A0 =A0 =A0}
>
> +#if __FreeBSD_version >=3D 800505
> + =A0 =A0 =A0 /*
> + =A0 =A0 =A0 =A0* Introducing IFCAP_LINKSTATE didn't bump __FreeBSD_vers=
ion
> + =A0 =A0 =A0 =A0* so it's approximate value.
> + =A0 =A0 =A0 =A0*/
> + =A0 =A0 =A0 if ((sc->bce_phy_flags & BCE_PHY_REMOTE_CAP_FLAG) !=3D 0)
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 ifp->if_capabilities |=3D IFCAP_LINKSTATE;
> +#endif
> +
> =A0 =A0 =A0 =A0ifp->if_capenable =3D ifp->if_capabilities;
>
> =A0 =A0 =A0 =A0/*
> @@ -1409,14 +1428,52 @@ bce_attach(device_t dev)
> =A0 =A0 =A0 =A0/* Handle any special PHY initialization for SerDes PHYs. =
*/
> =A0 =A0 =A0 =A0bce_init_media(sc);
>
> - =A0 =A0 =A0 /* MII child bus by attaching the PHY. */
> - =A0 =A0 =A0 rc =3D mii_attach(dev, &sc->bce_miibus, ifp, bce_ifmedia_up=
d,
> - =A0 =A0 =A0 =A0 =A0 bce_ifmedia_sts, BMSR_DEFCAPMASK, sc->bce_phy_addr,
> - =A0 =A0 =A0 =A0 =A0 MII_OFFSET_ANY, MIIF_DOPAUSE);
> - =A0 =A0 =A0 if (rc !=3D 0) {
> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 BCE_PRINTF("%s(%d): attaching PHYs failed\n=
", __FILE__,
> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 __LINE__);
> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 goto bce_attach_fail;
> + =A0 =A0 =A0 if ((sc->bce_phy_flags & BCE_PHY_REMOTE_CAP_FLAG) !=3D 0) {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 ifmedia_init(&sc->bce_ifmedia, IFM_IMASK, b=
ce_ifmedia_upd,
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 bce_ifmedia_sts);
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 /*
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0* We can't manually override remote PHY'=
s link and assume
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0* PHY port configuration(Fiber or TP) is=
 not changed after
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0* device attach. =A0This may not be corr=
ect though.
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0*/
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if ((sc->bce_phy_flags & BCE_PHY_REMOTE_POR=
T_FIBER_FLAG) !=3D 0) {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (sc->bce_phy_flags & BCE=
_PHY_2_5G_CAPABLE_FLAG) {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ifmedia_add=
(&sc->bce_ifmedia,
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 IFM=
_ETHER | IFM_2500_SX, 0, NULL);
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ifmedia_add=
(&sc->bce_ifmedia,
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 IFM=
_ETHER | IFM_2500_SX | IFM_FDX, 0, NULL);
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 }
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ifmedia_add(&sc->bce_ifmedi=
a,
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 IFM_ETHER | IFM_100=
0_SX, 0, NULL);
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ifmedia_add(&sc->bce_ifmedi=
a,
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 IFM_ETHER | IFM_100=
0_SX | IFM_FDX, 0, NULL);
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } else {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ifmedia_add(&sc->bce_ifmedi=
a,
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 IFM_ETHER | IFM_10_=
T, 0, NULL);
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ifmedia_add(&sc->bce_ifmedi=
a,
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 IFM_ETHER | IFM_10_=
T | IFM_FDX, 0, NULL);
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ifmedia_add(&sc->bce_ifmedi=
a,
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 IFM_ETHER | IFM_100=
_TX, 0, NULL);
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ifmedia_add(&sc->bce_ifmedi=
a,
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 IFM_ETHER | IFM_100=
_TX | IFM_FDX, 0, NULL);
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ifmedia_add(&sc->bce_ifmedi=
a,
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 IFM_ETHER | IFM_100=
0_T, 0, NULL);
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ifmedia_add(&sc->bce_ifmedi=
a,
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 IFM_ETHER | IFM_100=
0_T | IFM_FDX, 0, NULL);
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 }
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 ifmedia_add(&sc->bce_ifmedia, IFM_ETHER | I=
FM_AUTO, 0, NULL);
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 ifmedia_set(&sc->bce_ifmedia, IFM_ETHER | I=
FM_AUTO);
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 sc->bce_ifmedia.ifm_media =3D sc->bce_ifmed=
ia.ifm_cur->ifm_media;
> + =A0 =A0 =A0 } else {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 /* MII child bus by attaching the PHY. */
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 rc =3D mii_attach(dev, &sc->bce_miibus, ifp=
, bce_ifmedia_upd,
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 bce_ifmedia_sts, BMSR_DEFCAPMASK, s=
c->bce_phy_addr,
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 MII_OFFSET_ANY, MIIF_DOPAUSE);
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (rc !=3D 0) {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 BCE_PRINTF("%s(%d): attachi=
ng PHYs failed\n", __FILE__,
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 __LINE__);
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 goto bce_attach_fail;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 }
> =A0 =A0 =A0 =A0}
>
> =A0 =A0 =A0 =A0/* Attach to the Ethernet interface list. */
> @@ -1521,8 +1578,12 @@ bce_detach(device_t dev)
> =A0 =A0 =A0 =A0ether_ifdetach(ifp);
>
> =A0 =A0 =A0 =A0/* If we have a child device on the MII bus remove it too.=
 */
> - =A0 =A0 =A0 bus_generic_detach(dev);
> - =A0 =A0 =A0 device_delete_child(dev, sc->bce_miibus);
> + =A0 =A0 =A0 if ((sc->bce_phy_flags & BCE_PHY_REMOTE_CAP_FLAG) !=3D 0)
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 ifmedia_removeall(&sc->bce_ifmedia);
> + =A0 =A0 =A0 else {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 bus_generic_detach(dev);
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 device_delete_child(dev, sc->bce_miibus);
> + =A0 =A0 =A0 }
>
> =A0 =A0 =A0 =A0/* Release all remaining resources. */
> =A0 =A0 =A0 =A0bce_release_resources(sc);
> @@ -1983,13 +2044,23 @@ bce_miibus_statchg(device_t dev)
> =A0{
> =A0 =A0 =A0 =A0struct bce_softc *sc;
> =A0 =A0 =A0 =A0struct mii_data *mii;
> - =A0 =A0 =A0 int val;
> + =A0 =A0 =A0 struct ifmediareq ifmr;
> + =A0 =A0 =A0 int media_active, media_status, val;
>
> =A0 =A0 =A0 =A0sc =3D device_get_softc(dev);
>
> =A0 =A0 =A0 =A0DBENTER(BCE_VERBOSE_PHY);
>
> - =A0 =A0 =A0 mii =3D device_get_softc(sc->bce_miibus);
> + =A0 =A0 =A0 if ((sc->bce_phy_flags & BCE_PHY_REMOTE_CAP_FLAG) !=3D 0) {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 bzero(&ifmr, sizeof(ifmr));
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 bce_ifmedia_sts_rphy(sc, &ifmr);
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 media_active =3D ifmr.ifm_active;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 media_status =3D ifmr.ifm_status;
> + =A0 =A0 =A0 } else {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 mii =3D device_get_softc(sc->bce_miibus);
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 media_active =3D mii->mii_media_active;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 media_status =3D mii->mii_media_status;
> + =A0 =A0 =A0 }
>
> =A0 =A0 =A0 =A0val =3D REG_RD(sc, BCE_EMAC_MODE);
> =A0 =A0 =A0 =A0val &=3D ~(BCE_EMAC_MODE_PORT | BCE_EMAC_MODE_HALF_DUPLEX =
|
> @@ -1997,7 +2068,7 @@ bce_miibus_statchg(device_t dev)
> =A0 =A0 =A0 =A0 =A0 =A0BCE_EMAC_MODE_25G);
>
> =A0 =A0 =A0 =A0/* Set MII or GMII interface based on the PHY speed. */
> - =A0 =A0 =A0 switch (IFM_SUBTYPE(mii->mii_media_active)) {
> + =A0 =A0 =A0 switch (IFM_SUBTYPE(media_active)) {
> =A0 =A0 =A0 =A0case IFM_10_T:
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0if (BCE_CHIP_NUM(sc) !=3D BCE_CHIP_NUM_570=
6) {
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0DBPRINT(sc, BCE_INFO_PHY,
> @@ -2026,7 +2097,7 @@ bce_miibus_statchg(device_t dev)
> =A0 =A0 =A0 =A0}
>
> =A0 =A0 =A0 =A0/* Set half or full duplex based on PHY settings. */
> - =A0 =A0 =A0 if ((mii->mii_media_active & IFM_GMASK) =3D=3D IFM_HDX) {
> + =A0 =A0 =A0 if ((IFM_OPTIONS(media_active) & IFM_FDX) =3D=3D 0) {
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0DBPRINT(sc, BCE_INFO_PHY,
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0"Setting Half-Duplex interface.\n"=
);
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0val |=3D BCE_EMAC_MODE_HALF_DUPLEX;
> @@ -2036,7 +2107,7 @@ bce_miibus_statchg(device_t dev)
>
> =A0 =A0 =A0 =A0REG_WR(sc, BCE_EMAC_MODE, val);
>
> - =A0 =A0 =A0 if ((mii->mii_media_active & IFM_ETH_RXPAUSE) !=3D 0) {
> + =A0 =A0 =A0 if ((IFM_OPTIONS(media_active) & IFM_ETH_RXPAUSE) !=3D 0) {
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0DBPRINT(sc, BCE_INFO_PHY,
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0"%s(): Enabling RX flow control.\n=
", __FUNCTION__);
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0BCE_SETBIT(sc, BCE_EMAC_RX_MODE, BCE_EMAC_=
RX_MODE_FLOW_EN);
> @@ -2046,7 +2117,7 @@ bce_miibus_statchg(device_t dev)
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0BCE_CLRBIT(sc, BCE_EMAC_RX_MODE, BCE_EMAC_=
RX_MODE_FLOW_EN);
> =A0 =A0 =A0 =A0}
>
> - =A0 =A0 =A0 if ((mii->mii_media_active & IFM_ETH_TXPAUSE) !=3D 0) {
> + =A0 =A0 =A0 if ((IFM_OPTIONS(media_active) & IFM_ETH_TXPAUSE) !=3D 0) {
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0DBPRINT(sc, BCE_INFO_PHY,
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0"%s(): Enabling TX flow control.\n=
", __FUNCTION__);
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0BCE_SETBIT(sc, BCE_EMAC_TX_MODE, BCE_EMAC_=
TX_MODE_FLOW_EN);
> @@ -3130,7 +3201,8 @@ bce_get_media_exit:
> =A0static void
> =A0bce_init_media(struct bce_softc *sc)
> =A0{
> - =A0 =A0 =A0 if ((sc->bce_phy_flags & BCE_PHY_IEEE_CLAUSE_45_FLAG) !=3D =
0) {
> + =A0 =A0 =A0 if ((sc->bce_phy_flags & (BCE_PHY_IEEE_CLAUSE_45_FLAG |
> + =A0 =A0 =A0 =A0 =A0 BCE_PHY_REMOTE_CAP_FLAG)) =3D=3D BCE_PHY_IEEE_CLAUS=
E_45_FLAG) {
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0/*
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 * Configure 5709S/5716S PHYs to use tradi=
tional IEEE
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 * Clause 22 method. Otherwise we have no =
way to attach
> @@ -5018,6 +5090,8 @@ bce_reset(struct bce_softc *sc, u32 rese
> =A0 =A0 =A0 =A0if (rc)
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0BCE_PRINTF("%s(%d): Firmware did not compl=
ete "
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0"initialization!\n", __FILE__, __L=
INE__);
> + =A0 =A0 =A0 /* Get firmware capabilities. */
> + =A0 =A0 =A0 bce_fw_cap_init(sc);
>
> =A0bce_reset_exit:
> =A0 =A0 =A0 =A0DBEXIT(BCE_VERBOSE_RESET);
> @@ -6081,6 +6155,55 @@ bce_free_pg_chain(struct bce_softc *sc)
> =A0}
>
>
> +static u32
> +bce_get_rphy_link(struct bce_softc *sc)
> +{
> + =A0 =A0 =A0 u32 advertise, link;
> + =A0 =A0 =A0 int fdpx;
> +
> + =A0 =A0 =A0 advertise =3D 0;
> + =A0 =A0 =A0 fdpx =3D 0;
> + =A0 =A0 =A0 if ((sc->bce_phy_flags & BCE_PHY_REMOTE_PORT_FIBER_FLAG) !=
=3D 0)
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 link =3D bce_shmem_rd(sc, BCE_RPHY_SERDES_L=
INK);
> + =A0 =A0 =A0 else
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 link =3D bce_shmem_rd(sc, BCE_RPHY_COPPER_L=
INK);
> + =A0 =A0 =A0 if (link & BCE_NETLINK_ANEG_ENB)
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 advertise |=3D BCE_NETLINK_ANEG_ENB;
> + =A0 =A0 =A0 if (link & BCE_NETLINK_SPEED_10HALF)
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 advertise |=3D BCE_NETLINK_SPEED_10HALF;
> + =A0 =A0 =A0 if (link & BCE_NETLINK_SPEED_10FULL) {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 advertise |=3D BCE_NETLINK_SPEED_10FULL;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 fdpx++;
> + =A0 =A0 =A0 }
> + =A0 =A0 =A0 if (link & BCE_NETLINK_SPEED_100HALF)
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 advertise |=3D BCE_NETLINK_SPEED_100HALF;
> + =A0 =A0 =A0 if (link & BCE_NETLINK_SPEED_100FULL) {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 advertise |=3D BCE_NETLINK_SPEED_100FULL;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 fdpx++;
> + =A0 =A0 =A0 }
> + =A0 =A0 =A0 if (link & BCE_NETLINK_SPEED_1000HALF)
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 advertise |=3D BCE_NETLINK_SPEED_1000HALF;
> + =A0 =A0 =A0 if (link & BCE_NETLINK_SPEED_1000FULL) {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 advertise |=3D BCE_NETLINK_SPEED_1000FULL;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 fdpx++;
> + =A0 =A0 =A0 }
> + =A0 =A0 =A0 if (link & BCE_NETLINK_SPEED_2500HALF)
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 advertise |=3D BCE_NETLINK_SPEED_2500HALF;
> + =A0 =A0 =A0 if (link & BCE_NETLINK_SPEED_2500FULL) {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 advertise |=3D BCE_NETLINK_SPEED_2500FULL;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 fdpx++;
> + =A0 =A0 =A0 }
> + =A0 =A0 =A0 if (fdpx)
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 advertise |=3D BCE_NETLINK_FC_PAUSE_SYM |
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 BCE_NETLINK_FC_PAUSE_ASYM;
> + =A0 =A0 =A0 if ((sc->bce_phy_flags & BCE_PHY_REMOTE_PORT_FIBER_FLAG) =
=3D=3D 0)
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 advertise |=3D BCE_NETLINK_PHY_APP_REMOTE |
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 BCE_NETLINK_ETH_AT_WIRESPEED;
> +
> + =A0 =A0 =A0 return (advertise);
> +}
> +
> +
> =A0/*********************************************************************=
*******/
> =A0/* Set media options. =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 */
> =A0/* =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0=
 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
=A0 =A0*/
> @@ -6116,21 +6239,110 @@ bce_ifmedia_upd_locked(struct ifnet *ifp
> =A0 =A0 =A0 =A0struct bce_softc *sc =3D ifp->if_softc;
> =A0 =A0 =A0 =A0struct mii_data *mii;
> =A0 =A0 =A0 =A0struct mii_softc *miisc;
> - =A0 =A0 =A0 int error;
> + =A0 =A0 =A0 struct ifmedia *ifm;
> + =A0 =A0 =A0 u32 link;
> + =A0 =A0 =A0 int error, fdx;
>
> =A0 =A0 =A0 =A0DBENTER(BCE_VERBOSE_PHY);
>
> =A0 =A0 =A0 =A0error =3D 0;
> =A0 =A0 =A0 =A0BCE_LOCK_ASSERT(sc);
>
> - =A0 =A0 =A0 mii =3D device_get_softc(sc->bce_miibus);
> + =A0 =A0 =A0 sc->bce_link_up =3D FALSE;
> + =A0 =A0 =A0 if ((sc->bce_phy_flags & BCE_PHY_REMOTE_CAP_FLAG) !=3D 0) {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 ifm =3D &sc->bce_ifmedia;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (IFM_TYPE(ifm->ifm_media) !=3D IFM_ETHER=
)
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (EINVAL);
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 link =3D 0;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 fdx =3D IFM_OPTIONS(ifm->ifm_media) & IFM_F=
DX;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 switch(IFM_SUBTYPE(ifm->ifm_media)) {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 case IFM_AUTO:
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 /*
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0* Check advertised link =
of remote PHY by reading
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0* BCE_RPHY_SERDES_LINK o=
r BCE_RPHY_COPPER_LINK.
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0* Always use the same li=
nk type of remote PHY.
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0*/
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 link =3D bce_get_rphy_link(=
sc);
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 break;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 case IFM_2500_SX:
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if ((sc->bce_phy_flags &
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (BCE_PHY_REMOTE_POR=
T_FIBER_FLAG |
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 BCE_PHY_2_5G_CAPABL=
E_FLAG)) =3D=3D 0)
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (EIN=
VAL);
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 /*
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0* XXX
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0* Have to enable forced =
2.5Gbps configuration.
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0*/
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (fdx !=3D 0)
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 link |=3D B=
CE_NETLINK_SPEED_2500FULL;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 else
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 link |=3D B=
CE_NETLINK_SPEED_2500HALF;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 break;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 case IFM_1000_SX:
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if ((sc->bce_phy_flags &
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 BCE_PHY_REMOTE_PORT=
_FIBER_FLAG) =3D=3D 0)
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (EIN=
VAL);
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 /*
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0* XXX
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0* Have to disable 2.5Gbp=
s configuration.
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0*/
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (fdx !=3D 0)
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 link =3D BC=
E_NETLINK_SPEED_1000FULL;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 else
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 link =3D BC=
E_NETLINK_SPEED_1000HALF;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 break;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 case IFM_1000_T:
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (sc->bce_phy_flags & BCE=
_PHY_REMOTE_PORT_FIBER_FLAG)
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (EIN=
VAL);
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (fdx !=3D 0)
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 link =3D BC=
E_NETLINK_SPEED_1000FULL;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 else
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 link =3D BC=
E_NETLINK_SPEED_1000HALF;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 break;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 case IFM_100_TX:
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (sc->bce_phy_flags & BCE=
_PHY_REMOTE_PORT_FIBER_FLAG)
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (EIN=
VAL);
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (fdx !=3D 0)
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 link =3D BC=
E_NETLINK_SPEED_100FULL;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 else
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 link =3D BC=
E_NETLINK_SPEED_100HALF;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 break;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 case IFM_10_T:
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (sc->bce_phy_flags & BCE=
_PHY_REMOTE_PORT_FIBER_FLAG)
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (EIN=
VAL);
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (fdx !=3D 0)
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 link =3D BC=
E_NETLINK_SPEED_10FULL;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 else
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 link =3D BC=
E_NETLINK_SPEED_10HALF;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 break;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 default:
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (EINVAL);
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 }
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (IFM_SUBTYPE(ifm->ifm_media) !=3D IFM_AU=
TO) {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 /*
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0* XXX
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0* Advertise pause capabi=
lity for full-duplex media.
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0*/
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (fdx !=3D 0)
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 link |=3D B=
CE_NETLINK_FC_PAUSE_SYM |
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 BCE=
_NETLINK_FC_PAUSE_ASYM;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if ((sc->bce_phy_flags &
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 BCE_PHY_REMOTE_PORT=
_FIBER_FLAG) =3D=3D 0)
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 link |=3D B=
CE_NETLINK_PHY_APP_REMOTE |
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 BCE=
_NETLINK_ETH_AT_WIRESPEED;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 }
>
> - =A0 =A0 =A0 /* Make sure the MII bus has been enumerated. */
> - =A0 =A0 =A0 if (mii) {
> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 sc->bce_link_up =3D FALSE;
> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 LIST_FOREACH(miisc, &mii->mii_phys, mii_lis=
t)
> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 PHY_RESET(miisc);
> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 error =3D mii_mediachg(mii);
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 bce_shmem_wr(sc, BCE_MB_ARGS_0, link);
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 error =3D bce_fw_sync(sc, BCE_DRV_MSG_CODE_=
CMD_SET_LINK);
> + =A0 =A0 =A0 } else {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 mii =3D device_get_softc(sc->bce_miibus);
> +
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 /* Make sure the MII bus has been enumerate=
d. */
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (mii) {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 LIST_FOREACH(miisc, &mii->m=
ii_phys, mii_list)
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 PHY_RESET(m=
iisc);
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 error =3D mii_mediachg(mii)=
;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 }
> =A0 =A0 =A0 =A0}
>
> =A0 =A0 =A0 =A0DBEXIT(BCE_VERBOSE_PHY);
> @@ -6138,6 +6350,85 @@ bce_ifmedia_upd_locked(struct ifnet *ifp
> =A0}
>
>
> +static void
> +bce_ifmedia_sts_rphy(struct bce_softc *sc, struct ifmediareq *ifmr)
> +{
> + =A0 =A0 =A0 struct ifnet *ifp;
> + =A0 =A0 =A0 u32 link;
> +
> + =A0 =A0 =A0 ifp =3D sc->bce_ifp;
> + =A0 =A0 =A0 BCE_LOCK_ASSERT(sc);
> +
> + =A0 =A0 =A0 ifmr->ifm_status =3D IFM_AVALID;
> + =A0 =A0 =A0 ifmr->ifm_active =3D IFM_ETHER;
> + =A0 =A0 =A0 link =3D bce_shmem_rd(sc, BCE_LINK_STATUS);
> + =A0 =A0 =A0 /* XXX Handle heart beat status? */
> + =A0 =A0 =A0 if ((link & BCE_LINK_STATUS_LINK_UP) !=3D 0)
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 ifmr->ifm_status |=3D IFM_ACTIVE;
> + =A0 =A0 =A0 else {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 ifmr->ifm_active |=3D IFM_NONE;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 ifp->if_baudrate =3D 0;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return;
> + =A0 =A0 =A0 }
> + =A0 =A0 =A0 switch (link & BCE_LINK_STATUS_SPEED_MASK) {
> + =A0 =A0 =A0 case BCE_LINK_STATUS_10HALF:
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 ifmr->ifm_active |=3D IFM_10_T | IFM_HDX;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 ifp->if_baudrate =3D IF_Mbps(10UL);
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 break;
> + =A0 =A0 =A0 case BCE_LINK_STATUS_10FULL:
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 ifmr->ifm_active |=3D IFM_10_T | IFM_FDX;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 ifp->if_baudrate =3D IF_Mbps(10UL);
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 break;
> + =A0 =A0 =A0 case BCE_LINK_STATUS_100HALF:
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 ifmr->ifm_active |=3D IFM_100_TX | IFM_HDX;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 ifp->if_baudrate =3D IF_Mbps(100UL);
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 break;
> + =A0 =A0 =A0 case BCE_LINK_STATUS_100FULL:
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 ifmr->ifm_active |=3D IFM_100_TX | IFM_FDX;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 ifp->if_baudrate =3D IF_Mbps(100UL);
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 break;
> + =A0 =A0 =A0 case BCE_LINK_STATUS_1000HALF:
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if ((sc->bce_phy_flags & BCE_PHY_REMOTE_POR=
T_FIBER_FLAG) =3D=3D 0)
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ifmr->ifm_active |=3D IFM_1=
000_T | IFM_HDX;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 else
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ifmr->ifm_active |=3D IFM_1=
000_SX | IFM_HDX;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 ifp->if_baudrate =3D IF_Mbps(1000UL);
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 break;
> + =A0 =A0 =A0 case BCE_LINK_STATUS_1000FULL:
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if ((sc->bce_phy_flags & BCE_PHY_REMOTE_POR=
T_FIBER_FLAG) =3D=3D 0)
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ifmr->ifm_active |=3D IFM_1=
000_T | IFM_FDX;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 else
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ifmr->ifm_active |=3D IFM_1=
000_SX | IFM_FDX;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 ifp->if_baudrate =3D IF_Mbps(1000UL);
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 break;
> + =A0 =A0 =A0 case BCE_LINK_STATUS_2500HALF:
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if ((sc->bce_phy_flags & BCE_PHY_REMOTE_POR=
T_FIBER_FLAG) =3D=3D 0) {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ifmr->ifm_active |=3D IFM_N=
ONE;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } else
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ifmr->ifm_active |=3D IFM_2=
500_SX | IFM_HDX;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 ifp->if_baudrate =3D IF_Mbps(2500UL);
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 break;
> + =A0 =A0 =A0 case BCE_LINK_STATUS_2500FULL:
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if ((sc->bce_phy_flags & BCE_PHY_REMOTE_POR=
T_FIBER_FLAG) =3D=3D 0) {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ifmr->ifm_active |=3D IFM_N=
ONE;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } else
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ifmr->ifm_active |=3D IFM_2=
500_SX | IFM_FDX;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 ifp->if_baudrate =3D IF_Mbps(2500UL);
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 break;
> + =A0 =A0 =A0 default:
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 ifmr->ifm_active |=3D IFM_NONE;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return;
> + =A0 =A0 =A0 }
> +
> + =A0 =A0 =A0 if ((link & BCE_LINK_STATUS_RX_FC_ENABLED) !=3D 0)
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 ifmr->ifm_active |=3D IFM_ETH_RXPAUSE;
> + =A0 =A0 =A0 if ((link & BCE_LINK_STATUS_TX_FC_ENABLED) !=3D 0)
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 ifmr->ifm_active |=3D IFM_ETH_TXPAUSE;
> +}
> +
> +
> =A0/*********************************************************************=
*******/
> =A0/* Reports current media status. =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0*/
> =A0/* =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0=
 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
=A0 =A0*/
> @@ -6158,11 +6449,15 @@ bce_ifmedia_sts(struct ifnet *ifp, struc
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0BCE_UNLOCK(sc);
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0return;
> =A0 =A0 =A0 =A0}
> - =A0 =A0 =A0 mii =3D device_get_softc(sc->bce_miibus);
>
> - =A0 =A0 =A0 mii_pollstat(mii);
> - =A0 =A0 =A0 ifmr->ifm_active =3D mii->mii_media_active;
> - =A0 =A0 =A0 ifmr->ifm_status =3D mii->mii_media_status;
> + =A0 =A0 =A0 if ((sc->bce_phy_flags & BCE_PHY_REMOTE_CAP_FLAG) !=3D 0)
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 bce_ifmedia_sts_rphy(sc, ifmr);
> + =A0 =A0 =A0 else {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 mii =3D device_get_softc(sc->bce_miibus);
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 mii_pollstat(mii);
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 ifmr->ifm_active =3D mii->mii_media_active;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 ifmr->ifm_status =3D mii->mii_media_status;
> + =A0 =A0 =A0 }
>
> =A0 =A0 =A0 =A0BCE_UNLOCK(sc);
>
> @@ -6199,14 +6494,26 @@ bce_phy_intr(struct bce_softc *sc)
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0STATUS_ATTN_BITS_L=
INK_STATE);
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0DBPRINT(sc, BCE_INFO_PHY, =
"%s(): Link is now UP.\n",
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0__FUNCTION__);
> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 }
> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 else {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } else {
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0REG_WR(sc, BCE_PCICFG_STAT=
US_BIT_CLEAR_CMD,
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0STATUS_ATTN_BITS_L=
INK_STATE);
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0DBPRINT(sc, BCE_INFO_PHY, =
"%s(): Link is now DOWN.\n",
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0__FUNCTION__);
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0}
>
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if ((sc->bce_phy_flags & BCE_PHY_REMOTE_CAP=
_FLAG) !=3D 0) {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (new_link_state) {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (bootver=
bose)
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0=
 =A0 if_printf(sc->bce_ifp, "link UP\n");
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if_link_sta=
te_change(sc->bce_ifp,
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 LIN=
K_STATE_UP);
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 } else {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (bootver=
bose)
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0=
 =A0 if_printf(sc->bce_ifp, "link DOWN\n");
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if_link_sta=
te_change(sc->bce_ifp,
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 LIN=
K_STATE_DOWN);
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 }
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 }
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0/*
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 * Assume link is down and allow
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 * tick routine to update the state
> @@ -7495,10 +7802,14 @@ bce_ioctl(struct ifnet *ifp, u_long comm
> =A0 =A0 =A0 =A0case SIOCGIFMEDIA:
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0DBPRINT(sc, BCE_VERBOSE_MISC,
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0"Received SIOCSIFMEDIA/SIOCGIFMEDI=
A\n");
> -
> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 mii =3D device_get_softc(sc->bce_miibus);
> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 error =3D ifmedia_ioctl(ifp, ifr,
> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 &mii->mii_media, command);
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if ((sc->bce_phy_flags & BCE_PHY_REMOTE_CAP=
_FLAG) !=3D 0)
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 error =3D ifmedia_ioctl(ifp=
, ifr, &sc->bce_ifmedia,
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 command);
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 else {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 mii =3D device_get_softc(sc=
->bce_miibus);
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 error =3D ifmedia_ioctl(ifp=
, ifr, &mii->mii_media,
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 command);
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 }
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0break;
>
> =A0 =A0 =A0 =A0/* Set interface capability */
> @@ -8163,6 +8474,7 @@ bce_tick(void *xsc)
> =A0 =A0 =A0 =A0struct bce_softc *sc =3D xsc;
> =A0 =A0 =A0 =A0struct mii_data *mii;
> =A0 =A0 =A0 =A0struct ifnet *ifp;
> + =A0 =A0 =A0 struct ifmediareq ifmr;
>
> =A0 =A0 =A0 =A0ifp =3D sc->bce_ifp;
>
> @@ -8193,21 +8505,32 @@ bce_tick(void *xsc)
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0goto bce_tick_exit;
>
> =A0 =A0 =A0 =A0/* Link is down. =A0Check what the PHY's doing. */
> - =A0 =A0 =A0 mii =3D device_get_softc(sc->bce_miibus);
> - =A0 =A0 =A0 mii_tick(mii);
> -
> - =A0 =A0 =A0 /* Check if the link has come up. */
> - =A0 =A0 =A0 if ((mii->mii_media_status & IFM_ACTIVE) &&
> - =A0 =A0 =A0 =A0 =A0 (IFM_SUBTYPE(mii->mii_media_active) !=3D IFM_NONE))=
 {
> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 DBPRINT(sc, BCE_VERBOSE_MISC,
> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 "%s(): Link up!\n", __FUNCTION__);
> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 sc->bce_link_up =3D TRUE;
> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 if ((IFM_SUBTYPE(mii->mii_media_active) =3D=
=3D IFM_1000_T ||
> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 IFM_SUBTYPE(mii->mii_media_active) =
=3D=3D IFM_1000_SX ||
> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 IFM_SUBTYPE(mii->mii_media_active) =
=3D=3D IFM_2500_SX) &&
> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (bce_verbose || bootverbose))
> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 BCE_PRINTF("Gigabit link up=
!\n");
> + =A0 =A0 =A0 if ((sc->bce_phy_flags & BCE_PHY_REMOTE_CAP_FLAG) !=3D 0) {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 bzero(&ifmr, sizeof(ifmr));
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 bce_ifmedia_sts_rphy(sc, &ifmr);
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if ((ifmr.ifm_status & (IFM_ACTIVE | IFM_AV=
ALID)) =3D=3D
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (IFM_ACTIVE | IFM_AVALID)) {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 sc->bce_link_up =3D TRUE;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 bce_miibus_statchg(sc->bce_=
dev);
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 }
> + =A0 =A0 =A0 } else {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 mii =3D device_get_softc(sc->bce_miibus);
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 mii_tick(mii);
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 /* Check if the link has come up. */
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if ((mii->mii_media_status & IFM_ACTIVE) &&
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (IFM_SUBTYPE(mii->mii_media_active)=
 !=3D IFM_NONE)) {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 DBPRINT(sc, BCE_VERBOSE_MIS=
C, "%s(): Link up!\n",
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 __FUNCTION__);
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 sc->bce_link_up =3D TRUE;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if ((IFM_SUBTYPE(mii->mii_m=
edia_active) =3D=3D IFM_1000_T ||
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 IFM_SUBTYPE(mii->mi=
i_media_active) =3D=3D IFM_1000_SX ||
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 IFM_SUBTYPE(mii->mi=
i_media_active) =3D=3D IFM_2500_SX) &&
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (bce_verbose || boo=
tverbose))
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 BCE_PRINTF(=
"Gigabit link up!\n");
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 }
>
> + =A0 =A0 =A0 }
> + =A0 =A0 =A0 if (sc->bce_link_up =3D=3D TRUE) {
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0/* Now that link is up, handle any outstan=
ding TX traffic. */
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) {
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0DBPRINT(sc, BCE_VERBOSE_MI=
SC, "%s(): Found "
> @@ -8221,6 +8544,36 @@ bce_tick_exit:
> =A0 =A0 =A0 =A0return;
> =A0}
>
> +static void
> +bce_fw_cap_init(struct bce_softc *sc)
> +{
> + =A0 =A0 =A0 u32 ack, cap, link;
> +
> + =A0 =A0 =A0 ack =3D 0;
> + =A0 =A0 =A0 cap =3D bce_shmem_rd(sc, BCE_FW_CAP_MB);
> + =A0 =A0 =A0 if ((cap & BCE_FW_CAP_SIGNATURE_MAGIC_MASK) !=3D
> + =A0 =A0 =A0 =A0 =A0 BCE_FW_CAP_SIGNATURE_MAGIC)
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return;
> + =A0 =A0 =A0 if ((cap & (BCE_FW_CAP_MFW_KEEP_VLAN | BCE_FW_CAP_BC_KEEP_V=
LAN)) =3D=3D
> + =A0 =A0 =A0 =A0 =A0 (BCE_FW_CAP_MFW_KEEP_VLAN | BCE_FW_CAP_BC_KEEP_VLAN=
))
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 ack |=3D BCE_DRV_ACK_CAP_SIGNATURE_MAGIC |
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 BCE_FW_CAP_MFW_KEEP_VLAN | BCE_FW_C=
AP_BC_KEEP_VLAN;
> + =A0 =A0 =A0 if ((sc->bce_phy_flags & BCE_PHY_SERDES_FLAG) !=3D 0 &&
> + =A0 =A0 =A0 =A0 =A0 (cap & BCE_FW_CAP_REMOTE_PHY_CAP) !=3D 0) {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 sc->bce_phy_flags &=3D ~BCE_PHY_REMOTE_PORT=
_FIBER_FLAG;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 sc->bce_phy_flags |=3D BCE_PHY_REMOTE_CAP_F=
LAG;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 link =3D bce_shmem_rd(sc, BCE_LINK_STATUS);
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if ((link & BCE_LINK_STATUS_SERDES_LINK) !=
=3D 0)
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 sc->bce_phy_flags |=3D BCE_=
PHY_REMOTE_PORT_FIBER_FLAG;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 ack |=3D BCE_DRV_ACK_CAP_SIGNATURE_MAGIC |
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 BCE_FW_CAP_REMOTE_PHY_CAP;
> + =A0 =A0 =A0 }
> +
> + =A0 =A0 =A0 if (ack !=3D 0)
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 bce_shmem_wr(sc, BCE_DRV_ACK_CAP_MB, ack);
> +}
> +
> +
> =A0#ifdef BCE_DEBUG
> =A0/*********************************************************************=
*******/
> =A0/* Allows the driver state to be dumped through the sysctl interface. =
=A0 =A0 =A0 */
>
> Modified: stable/9/sys/dev/bce/if_bcereg.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
> --- stable/9/sys/dev/bce/if_bcereg.h =A0 =A0Wed May 23 01:49:50 2012 =A0 =
=A0 =A0 =A0(r235817)
> +++ stable/9/sys/dev/bce/if_bcereg.h =A0 =A0Wed May 23 02:02:29 2012 =A0 =
=A0 =A0 =A0(r235818)
> @@ -814,6 +814,23 @@ struct flash_spec {
> =A0#define BCE_DRV_PULSE_SEQ_MASK =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A00x00=
007fff
>
> =A0#define BCE_MB_ARGS_0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
=A00x00000014
> +#define =A0 =A0 =A0 =A0BCE_NETLINK_SPEED_10HALF =A0 =A0 =A0 =A0 =A0 =A0 =
=A0 =A0 (1<<0)
> +#define =A0 =A0 =A0 =A0BCE_NETLINK_SPEED_10FULL =A0 =A0 =A0 =A0 =A0 =A0 =
=A0 =A0 (1<<1)
> +#define =A0 =A0 =A0 =A0BCE_NETLINK_SPEED_100HALF =A0 =A0 =A0 =A0 =A0 =A0=
 =A0 =A0(1<<2)
> +#define =A0 =A0 =A0 =A0BCE_NETLINK_SPEED_100FULL =A0 =A0 =A0 =A0 =A0 =A0=
 =A0 =A0(1<<3)
> +#define =A0 =A0 =A0 =A0BCE_NETLINK_SPEED_1000HALF =A0 =A0 =A0 =A0 =A0 =
=A0 =A0 (1<<4)
> +#define =A0 =A0 =A0 =A0BCE_NETLINK_SPEED_1000FULL =A0 =A0 =A0 =A0 =A0 =
=A0 =A0 (1<<5)
> +#define =A0 =A0 =A0 =A0BCE_NETLINK_SPEED_2500HALF =A0 =A0 =A0 =A0 =A0 =
=A0 =A0 (1<<6)
> +#define =A0 =A0 =A0 =A0BCE_NETLINK_SPEED_2500FULL =A0 =A0 =A0 =A0 =A0 =
=A0 =A0 (1<<7)
> +#define =A0 =A0 =A0 =A0BCE_NETLINK_SPEED_10GHALF =A0 =A0 =A0 =A0 =A0 =A0=
 =A0 =A0(1<<8)
> +#define =A0 =A0 =A0 =A0BCE_NETLINK_SPEED_10GFULL =A0 =A0 =A0 =A0 =A0 =A0=
 =A0 =A0(1<<9)
> +#define =A0 =A0 =A0 =A0BCE_NETLINK_ANEG_ENB =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
=A0 =A0 =A0 (1<<10)
> +#define =A0 =A0 =A0 =A0BCE_NETLINK_PHY_APP_REMOTE =A0 =A0 =A0 =A0 =A0 =
=A0 =A0 (1<<11)
> +#define =A0 =A0 =A0 =A0BCE_NETLINK_FC_PAUSE_SYM =A0 =A0 =A0 =A0 =A0 =A0 =
=A0 =A0 (1<<12)
> +#define =A0 =A0 =A0 =A0BCE_NETLINK_FC_PAUSE_ASYM =A0 =A0 =A0 =A0 =A0 =A0=
 =A0 =A0(1<<13)
> +#define =A0 =A0 =A0 =A0BCE_NETLINK_ETH_AT_WIRESPEED =A0 =A0 =A0 =A0 =A0 =
=A0 (1<<14)
> +#define =A0 =A0 =A0 =A0BCE_NETLINK_PHY_RESET =A0 =A0 =A0 =A0 =A0 =A0 =A0=
 =A0 =A0 =A0(1<<15)
> +
> =A0#define BCE_MB_ARGS_1 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
=A00x00000018
>
> =A0/* Indicate to the firmware not to go into the
> @@ -1079,6 +1096,26 @@ struct flash_spec {
> =A0#define BCE_BC_STATE_BC_DBG_CMD_LOOP_CNT_MASK =A00xffff
> =A0#define BCE_BC_STATE_BC_DBG_CMD_LOOP_INFINITE =A00xffff
>
> +#define =A0 =A0 =A0 =A0BCE_FW_EVT_CODE_MB =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
=A0 =A0 =A0 =A00x00000354
> +#define =A0 =A0 =A0 =A0BCE_FW_EVT_CODE_SW_TIMER_EXPIRE_EVENT =A0 0x00000=
000
> +#define =A0 =A0 =A0 =A0BCE_FW_EVT_CODE_LINK_EVENT =A0 =A0 =A0 =A0 =A0 =
=A0 =A00x00000001
> +
> +#define =A0 =A0 =A0 =A0BCE_DRV_ACK_CAP_MB =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
=A0 =A0 =A0 =A00x00000364
> +#define =A0 =A0 =A0 =A0BCE_DRV_ACK_CAP_SIGNATURE_MAGIC =A0 =A0 =A0 =A0 0=
x35450000
> +
> +#define =A0 =A0 =A0 =A0BCE_FW_CAP_MB =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0=
 =A0 =A0 =A0 =A0 0x00000368
> +#define =A0 =A0 =A0 =A0BCE_FW_CAP_SIGNATURE_MAGIC =A0 =A0 =A0 =A0 =A0 =
=A0 =A00xaa550000
> +#define =A0 =A0 =A0 =A0BCE_FW_ACK_SIGNATURE_MAGIC =A0 =A0 =A0 =A0 =A0 =
=A0 =A00x52500000
> +#define =A0 =A0 =A0 =A0BCE_FW_CAP_SIGNATURE_MAGIC_MASK =A0 =A0 =A0 =A0 0=
xffff0000
> +#define =A0 =A0 =A0 =A0BCE_FW_CAP_REMOTE_PHY_CAP =A0 =A0 =A0 =A0 =A0 =A0=
 =A0 0x00000001
> +#define =A0 =A0 =A0 =A0BCE_FW_CAP_REMOTE_PHY_PRESENT =A0 =A0 =A0 =A0 =A0=
 0x00000002
> +#define =A0 =A0 =A0 =A0BCE_FW_CAP_MFW_KEEP_VLAN =A0 =A0 =A0 =A0 =A0 =A0 =
=A0 =A00x00000008
> +#define =A0 =A0 =A0 =A0BCE_FW_CAP_BC_KEEP_VLAN =A0 =A0 =A0 =A0 =A0 =A0 =
=A0 =A0 0x00000010
> +
> +#define =A0 =A0 =A0 =A0BCE_RPHY_SERDES_LINK =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
=A0 =A0 =A00x00000374
> +
> +#define =A0 =A0 =A0 =A0BCE_RPHY_COPPER_LINK =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
=A0 =A0 =A00x00000378
> +
> =A0#define HOST_VIEW_SHMEM_BASE =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 0x167=
c00
>
> =A0/*
> @@ -6454,6 +6491,8 @@ struct bce_softc
> =A0#define BCE_PHY_INT_MODE_AUTO_POLLING_FLAG =A0 =A0 0x00000100
> =A0#define BCE_PHY_INT_MODE_LINK_READY_FLAG =A0 =A0 =A0 0x00000200
> =A0#define BCE_PHY_IEEE_CLAUSE_45_FLAG =A0 =A0 =A0 =A0 =A0 =A00x00000400
> +#define =A0 =A0 =A0 =A0BCE_PHY_REMOTE_CAP_FLAG =A0 =A0 =A0 =A0 =A0 =A0 =
=A0 =A0 0x00000800
> +#define =A0 =A0 =A0 =A0BCE_PHY_REMOTE_PORT_FIBER_FLAG =A0 =A0 =A0 =A0 =
=A00x00001000
>
> =A0 =A0 =A0 =A0/* Values that need to be shared with the PHY driver. */
> =A0 =A0 =A0 =A0u32 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 bce_shared_hw_=
cfg;

From owner-svn-src-stable-9@FreeBSD.ORG  Thu May 24 01:23:30 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id B121D1065672;
	Thu, 24 May 2012 01:23:30 +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 9C1CF8FC0A;
	Thu, 24 May 2012 01:23: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 q4O1NU88006420;
	Thu, 24 May 2012 01:23:30 GMT (envelope-from mav@svn.freebsd.org)
Received: (from mav@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4O1NUsG006417;
	Thu, 24 May 2012 01:23:30 GMT (envelope-from mav@svn.freebsd.org)
Message-Id: <201205240123.q4O1NUsG006417@svn.freebsd.org>
From: Alexander Motin <mav@FreeBSD.org>
Date: Thu, 24 May 2012 01:23:30 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r235866 - in stable/9: lib/libusbhid sys/dev/usb
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 24 May 2012 01:23:30 -0000

Author: mav
Date: Thu May 24 01:23:30 2012
New Revision: 235866
URL: http://svn.freebsd.org/changeset/base/235866

Log:
  MFC r235510:
  HID Report ID is unsigned value, so clear the rest of bits from possible
  sign expansion.

Modified:
  stable/9/lib/libusbhid/parse.c
  stable/9/sys/dev/usb/usb_hid.c
Directory Properties:
  stable/9/lib/libusbhid/   (props changed)
  stable/9/sys/   (props changed)
  stable/9/sys/dev/   (props changed)

Modified: stable/9/lib/libusbhid/parse.c
==============================================================================
--- stable/9/lib/libusbhid/parse.c	Wed May 23 23:43:55 2012	(r235865)
+++ stable/9/lib/libusbhid/parse.c	Thu May 24 01:23:30 2012	(r235866)
@@ -392,7 +392,7 @@ hid_get_item(hid_data_t s, hid_item_t *h
 				s->loc_size = dval & mask;
 				break;
 			case 8:
-				hid_switch_rid(s, c, dval);
+				hid_switch_rid(s, c, dval & mask);
 				break;
 			case 9:
 				/* mask because value is unsigned */

Modified: stable/9/sys/dev/usb/usb_hid.c
==============================================================================
--- stable/9/sys/dev/usb/usb_hid.c	Wed May 23 23:43:55 2012	(r235865)
+++ stable/9/sys/dev/usb/usb_hid.c	Thu May 24 01:23:30 2012	(r235866)
@@ -425,7 +425,7 @@ hid_get_item(struct hid_data *s, struct 
 				s->loc_size = dval & mask;
 				break;
 			case 8:
-				hid_switch_rid(s, c, dval);
+				hid_switch_rid(s, c, dval & mask);
 				break;
 			case 9:
 				/* mask because value is unsigned */

From owner-svn-src-stable-9@FreeBSD.ORG  Thu May 24 01:28:59 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 9EE50106566B;
	Thu, 24 May 2012 01:28:59 +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 89FFA8FC0A;
	Thu, 24 May 2012 01:28: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 q4O1Sx36006748;
	Thu, 24 May 2012 01:28:59 GMT (envelope-from mav@svn.freebsd.org)
Received: (from mav@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4O1Sxag006746;
	Thu, 24 May 2012 01:28:59 GMT (envelope-from mav@svn.freebsd.org)
Message-Id: <201205240128.q4O1Sxag006746@svn.freebsd.org>
From: Alexander Motin <mav@FreeBSD.org>
Date: Thu, 24 May 2012 01:28:59 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r235868 - stable/9/sys/dev/usb/input
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 24 May 2012 01:28:59 -0000

Author: mav
Date: Thu May 24 01:28:58 2012
New Revision: 235868
URL: http://svn.freebsd.org/changeset/base/235868

Log:
  MFC r235558, r235569:
  Add support for writing to HID devices through the interrupt output pipe.
  Supermicro LCD screen modules seem to not support accessing reports through
  the control pipes, but working fine with the interrupt pipes.

Modified:
  stable/9/sys/dev/usb/input/uhid.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/dev/   (props changed)

Modified: stable/9/sys/dev/usb/input/uhid.c
==============================================================================
--- stable/9/sys/dev/usb/input/uhid.c	Thu May 24 01:24:49 2012	(r235867)
+++ stable/9/sys/dev/usb/input/uhid.c	Thu May 24 01:28:58 2012	(r235868)
@@ -87,6 +87,7 @@ SYSCTL_INT(_hw_usb_uhid, OID_AUTO, debug
 #define	UHID_FRAME_NUM 	  50		/* bytes, frame number */
 
 enum {
+	UHID_INTR_DT_WR,
 	UHID_INTR_DT_RD,
 	UHID_CTRL_DT_WR,
 	UHID_CTRL_DT_RD,
@@ -128,7 +129,8 @@ static device_probe_t uhid_probe;
 static device_attach_t uhid_attach;
 static device_detach_t uhid_detach;
 
-static usb_callback_t uhid_intr_callback;
+static usb_callback_t uhid_intr_write_callback;
+static usb_callback_t uhid_intr_read_callback;
 static usb_callback_t uhid_write_callback;
 static usb_callback_t uhid_read_callback;
 
@@ -152,7 +154,36 @@ static struct usb_fifo_methods uhid_fifo
 };
 
 static void
-uhid_intr_callback(struct usb_xfer *xfer, usb_error_t error)
+uhid_intr_write_callback(struct usb_xfer *xfer, usb_error_t error)
+{
+	struct uhid_softc *sc = usbd_xfer_softc(xfer);
+	struct usb_page_cache *pc;
+	int actlen;
+
+	switch (USB_GET_STATE(xfer)) {
+	case USB_ST_TRANSFERRED:
+	case USB_ST_SETUP:
+tr_setup:
+		pc = usbd_xfer_get_frame(xfer, 0);
+		if (usb_fifo_get_data(sc->sc_fifo.fp[USB_FIFO_TX], pc,
+		    0, usbd_xfer_max_len(xfer), &actlen, 0)) {
+			usbd_xfer_set_frame_len(xfer, 0, actlen);
+			usbd_transfer_submit(xfer);
+		}
+		return;
+
+	default:			/* Error */
+		if (error != USB_ERR_CANCELLED) {
+			/* try to clear stall first */
+			usbd_xfer_set_stall(xfer);
+			goto tr_setup;
+		}
+		return;
+	}
+}
+
+static void
+uhid_intr_read_callback(struct usb_xfer *xfer, usb_error_t error)
 {
 	struct uhid_softc *sc = usbd_xfer_softc(xfer);
 	struct usb_page_cache *pc;
@@ -327,13 +358,22 @@ uhid_read_callback(struct usb_xfer *xfer
 
 static const struct usb_config uhid_config[UHID_N_TRANSFER] = {
 
+	[UHID_INTR_DT_WR] = {
+		.type = UE_INTERRUPT,
+		.endpoint = UE_ADDR_ANY,
+		.direction = UE_DIR_OUT,
+		.flags = {.pipe_bof = 1,.no_pipe_ok = 1, },
+		.bufsize = UHID_BSIZE,
+		.callback = &uhid_intr_write_callback,
+	},
+
 	[UHID_INTR_DT_RD] = {
 		.type = UE_INTERRUPT,
 		.endpoint = UE_ADDR_ANY,
 		.direction = UE_DIR_IN,
 		.flags = {.pipe_bof = 1,.short_xfer_ok = 1,},
 		.bufsize = UHID_BSIZE,
-		.callback = &uhid_intr_callback,
+		.callback = &uhid_intr_read_callback,
 	},
 
 	[UHID_CTRL_DT_WR] = {
@@ -381,7 +421,12 @@ uhid_start_write(struct usb_fifo *fifo)
 {
 	struct uhid_softc *sc = usb_fifo_softc(fifo);
 
-	usbd_transfer_start(sc->sc_xfer[UHID_CTRL_DT_WR]);
+	if ((sc->sc_flags & UHID_FLAG_IMMED) ||
+	    sc->sc_xfer[UHID_INTR_DT_WR] == NULL) {
+		usbd_transfer_start(sc->sc_xfer[UHID_CTRL_DT_WR]);
+	} else {
+		usbd_transfer_start(sc->sc_xfer[UHID_INTR_DT_WR]);
+	}
 }
 
 static void
@@ -390,6 +435,7 @@ uhid_stop_write(struct usb_fifo *fifo)
 	struct uhid_softc *sc = usb_fifo_softc(fifo);
 
 	usbd_transfer_stop(sc->sc_xfer[UHID_CTRL_DT_WR]);
+	usbd_transfer_stop(sc->sc_xfer[UHID_INTR_DT_WR]);
 }
 
 static int

From owner-svn-src-stable-9@FreeBSD.ORG  Thu May 24 01:41:55 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id E64681065672;
	Thu, 24 May 2012 01:41:54 +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 C7F3D8FC0A;
	Thu, 24 May 2012 01:41: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 q4O1fsqj007528;
	Thu, 24 May 2012 01:41:54 GMT (envelope-from mav@svn.freebsd.org)
Received: (from mav@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4O1fsaK007525;
	Thu, 24 May 2012 01:41:54 GMT (envelope-from mav@svn.freebsd.org)
Message-Id: <201205240141.q4O1fsaK007525@svn.freebsd.org>
From: Alexander Motin <mav@FreeBSD.org>
Date: Thu, 24 May 2012 01:41:54 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r235871 - stable/9/sys/geom/raid
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 24 May 2012 01:41:55 -0000

Author: mav
Date: Thu May 24 01:41:54 2012
New Revision: 235871
URL: http://svn.freebsd.org/changeset/base/235871

Log:
  MFC r235270:
  - Prevent error status leak if write to some of the RAID1/1E volume disks
  failed while write to some other succeeded. Instead mark disk as failed.
  - Make RAID1E less aggressive in failing disks to avoid volume breakage.

Modified:
  stable/9/sys/geom/raid/tr_raid1.c
  stable/9/sys/geom/raid/tr_raid1e.c
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/geom/raid/tr_raid1.c
==============================================================================
--- stable/9/sys/geom/raid/tr_raid1.c	Thu May 24 01:31:10 2012	(r235870)
+++ stable/9/sys/geom/raid/tr_raid1.c	Thu May 24 01:41:54 2012	(r235871)
@@ -893,7 +893,16 @@ rebuild_round_done:
 		g_raid_unlock_range(sd->sd_volume, bp->bio_offset,
 		    bp->bio_length);
 	}
-	error = bp->bio_error;
+	if (pbp->bio_cmd != BIO_READ) {
+		if (pbp->bio_inbed == 1 || pbp->bio_error != 0)
+			pbp->bio_error = bp->bio_error;
+		if (bp->bio_error != 0) {
+			G_RAID_LOGREQ(0, bp, "Write failed: failing subdisk.");
+			g_raid_tr_raid1_fail_disk(sd->sd_softc, sd, sd->sd_disk);
+		}
+		error = pbp->bio_error;
+	} else
+		error = bp->bio_error;
 	g_destroy_bio(bp);
 	if (pbp->bio_children == pbp->bio_inbed) {
 		pbp->bio_completed = pbp->bio_length;

Modified: stable/9/sys/geom/raid/tr_raid1e.c
==============================================================================
--- stable/9/sys/geom/raid/tr_raid1e.c	Thu May 24 01:31:10 2012	(r235870)
+++ stable/9/sys/geom/raid/tr_raid1e.c	Thu May 24 01:41:54 2012	(r235871)
@@ -338,6 +338,9 @@ static void
 g_raid_tr_raid1e_fail_disk(struct g_raid_softc *sc, struct g_raid_subdisk *sd,
     struct g_raid_disk *disk)
 {
+	struct g_raid_volume *vol;
+
+	vol = sd->sd_volume;
 	/*
 	 * We don't fail the last disk in the pack, since it still has decent
 	 * data on it and that's better than failing the disk if it is the root
@@ -347,8 +350,12 @@ g_raid_tr_raid1e_fail_disk(struct g_raid
 	 * the volume that has / on it.  I can't think of a case where we'd
 	 * want the volume to go away on this kind of event.
 	 */
-	if (g_raid_nsubdisks(sd->sd_volume, G_RAID_SUBDISK_S_ACTIVE) == 1 &&
-	    g_raid_get_subdisk(sd->sd_volume, G_RAID_SUBDISK_S_ACTIVE) == sd)
+	if ((g_raid_nsubdisks(vol, G_RAID_SUBDISK_S_ACTIVE) +
+	     g_raid_nsubdisks(vol, G_RAID_SUBDISK_S_RESYNC) +
+	     g_raid_nsubdisks(vol, G_RAID_SUBDISK_S_STALE) +
+	     g_raid_nsubdisks(vol, G_RAID_SUBDISK_S_UNINITIALIZED) <
+	     vol->v_disks_count) &&
+	    (sd->sd_state >= G_RAID_SUBDISK_S_UNINITIALIZED))
 		return;
 	g_raid_fail_disk(sc, sd, disk);
 }
@@ -1113,7 +1120,16 @@ rebuild_round_done:
 		G_RAID_LOGREQ(2, bp, "REMAP done %d.", bp->bio_error);
 		g_raid_unlock_range(sd->sd_volume, virtual, bp->bio_length);
 	}
-	error = bp->bio_error;
+	if (pbp->bio_cmd != BIO_READ) {
+		if (pbp->bio_inbed == 1 || pbp->bio_error != 0)
+			pbp->bio_error = bp->bio_error;
+		if (bp->bio_error != 0) {
+			G_RAID_LOGREQ(0, bp, "Write failed: failing subdisk.");
+			g_raid_tr_raid1e_fail_disk(sd->sd_softc, sd, sd->sd_disk);
+		}
+		error = pbp->bio_error;
+	} else
+		error = bp->bio_error;
 	g_destroy_bio(bp);
 	if (pbp->bio_children == pbp->bio_inbed) {
 		pbp->bio_completed = pbp->bio_length;

From owner-svn-src-stable-9@FreeBSD.ORG  Thu May 24 02:34:04 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 488F81065673;
	Thu, 24 May 2012 02:34:04 +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 2DE708FC12;
	Thu, 24 May 2012 02:34: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 q4O2Y4Ij010083;
	Thu, 24 May 2012 02:34:04 GMT (envelope-from mav@svn.freebsd.org)
Received: (from mav@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4O2Y3lq010073;
	Thu, 24 May 2012 02:34:03 GMT (envelope-from mav@svn.freebsd.org)
Message-Id: <201205240234.q4O2Y3lq010073@svn.freebsd.org>
From: Alexander Motin <mav@FreeBSD.org>
Date: Thu, 24 May 2012 02:34:03 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r235874 - in stable/9: sbin/geom/class/raid sys/conf
	sys/geom/raid sys/modules/geom/geom_raid
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 24 May 2012 02:34:04 -0000

Author: mav
Date: Thu May 24 02:34:03 2012
New Revision: 235874
URL: http://svn.freebsd.org/changeset/base/235874

Log:
  MFC r234458, r234603, r234610, r234727, r234816, r234848, r234868,
  r234869, r234899, r234940, r234993, r234994, r235071 -c r235076, r235080,
  r235096:
   - Add support for the DDF metadata format, as defined by the SNIA Common
  RAID Disk Data Format Specification v2.0;
   - Add support for reading non-degraded RAID4/5/5E/5EE/5R/6/MDF volumes.
  
  Sponsored by:	iXsystems, Inc.

Added:
  stable/9/sys/geom/raid/md_ddf.c
     - copied, changed from r234848, head/sys/geom/raid/md_ddf.c
  stable/9/sys/geom/raid/md_ddf.h
     - copied unchanged from r234848, head/sys/geom/raid/md_ddf.h
  stable/9/sys/geom/raid/tr_raid5.c
     - copied, changed from r234458, head/sys/geom/raid/tr_raid5.c
Modified:
  stable/9/sbin/geom/class/raid/geom_raid.c
  stable/9/sbin/geom/class/raid/graid.8
  stable/9/sys/conf/files
  stable/9/sys/geom/raid/g_raid.c
  stable/9/sys/geom/raid/g_raid.h
  stable/9/sys/geom/raid/g_raid_ctl.c
  stable/9/sys/geom/raid/g_raid_md_if.m
  stable/9/sys/geom/raid/md_intel.c
  stable/9/sys/geom/raid/md_jmicron.c
  stable/9/sys/geom/raid/md_nvidia.c
  stable/9/sys/geom/raid/md_promise.c
  stable/9/sys/geom/raid/md_sii.c
  stable/9/sys/geom/raid/tr_raid1.c
  stable/9/sys/geom/raid/tr_raid1e.c
  stable/9/sys/modules/geom/geom_raid/Makefile
Directory Properties:
  stable/9/sbin/geom/   (props changed)
  stable/9/sys/   (props changed)
  stable/9/sys/conf/   (props changed)
  stable/9/sys/modules/   (props changed)

Modified: stable/9/sbin/geom/class/raid/geom_raid.c
==============================================================================
--- stable/9/sbin/geom/class/raid/geom_raid.c	Thu May 24 02:24:03 2012	(r235873)
+++ stable/9/sbin/geom/class/raid/geom_raid.c	Thu May 24 02:34:03 2012	(r235874)
@@ -48,11 +48,12 @@ struct g_command class_commands[] = {
 	{ "label", G_FLAG_VERBOSE, NULL,
 	    {
 		{ 'f', "force", NULL, G_TYPE_BOOL },
+		{ 'o', "fmtopt", G_VAL_OPTIONAL, G_TYPE_STRING },
 		{ 'S', "size", G_VAL_OPTIONAL, G_TYPE_NUMBER },
 		{ 's', "strip", G_VAL_OPTIONAL, G_TYPE_NUMBER },
 		G_OPT_SENTINEL
 	    },
-	    "[-fv] [-S size] [-s stripsize] format label level prov ..."
+	    "[-fv] [-o fmtopt] [-S size] [-s stripsize] format label level prov ..."
 	},
 	{ "add", G_FLAG_VERBOSE, NULL,
 	    {

Modified: stable/9/sbin/geom/class/raid/graid.8
==============================================================================
--- stable/9/sbin/geom/class/raid/graid.8	Thu May 24 02:24:03 2012	(r235873)
+++ stable/9/sbin/geom/class/raid/graid.8	Thu May 24 02:34:03 2012	(r235874)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd October 26, 2011
+.Dd May 6, 2012
 .Dt GRAID 8
 .Os
 .Sh NAME
@@ -34,6 +34,7 @@
 .Nm
 .Cm label
 .Op Fl f
+.Op Fl o Ar fmtopt
 .Op Fl S Ar size
 .Op Fl s Ar strip
 .Ar format
@@ -119,6 +120,8 @@ Additional options include:
 .It Fl f
 Enforce specified configuration creation if it is officially unsupported,
 but technically can be created.
+.It Fl o Ar fmtopt
+Specifies metadata format options.
 .It Fl S Ar size
 Use
 .Ar size
@@ -200,6 +203,23 @@ The GEOM RAID class follows a modular de
 formats to be used.
 Support is currently implemented for the following formats:
 .Bl -tag -width "Intel"
+.It DDF
+The format defined by the SNIA Common RAID Disk Data Format v2.0 specification.
+Used by some Adaptec RAID BIOSes and some hardware RAID controllers.
+Because of high format flexibility different implementations support
+different set of features and have different on-disk metadata layouts.
+To provide compatibility, the GEOM RAID class mimics capabilities
+of the first detected DDF array.
+Respecting that, it may support different number of disks per volume,
+volumes per array, partitions per disk, etc.
+The following configurations are supported: RAID0 (2+ disks), RAID1 (2+ disks),
+RAID1E (3+ disks), RAID3 (3+ disks), RAID4 (3+ disks), RAID5 (3+ disks),
+RAID5E (4+ disks), RAID5EE (4+ disks), RAID5R (3+ disks), RAID6 (4+ disks),
+RAIDMDF (4+ disks), RAID10 (4+ disks), SINGLE (1 disk), CONCAT (2+ disks).
+.Pp
+Format supports two options "BE" and "LE", that mean big-endian byte order
+defined by specification (default) and little-endian used by some Adaptec
+controllers.
 .It Intel
 The format used by Intel RAID BIOS.
 Supports up to two volumes per array.
@@ -241,8 +261,11 @@ own risk: RAID1 (3+ disks), RAID10 (6+ d
 .Sh SUPPORTED RAID LEVELS
 The GEOM RAID class follows a modular design, allowing different RAID levels
 to be used.
-Support for the following RAID levels is currently implemented: RAID0, RAID1,
-RAID1E, RAID10, SINGLE, CONCAT.
+Full support for the following RAID levels is currently implemented:
+RAID0, RAID1, RAID1E, RAID10, SINGLE, CONCAT.
+The following RAID levels supported as read-only for volumes in optimal
+state (without using redundancy): RAID4, RAID5, RAID5E, RAID5EE, RAID5R,
+RAID6, RAIDMDF.
 .Sh RAID LEVEL MIGRATION
 The GEOM RAID class has no support for RAID level migration, allowed by some
 metadata formats.
@@ -253,6 +276,33 @@ corruption!
 .Sh 2TiB BARRIERS
 Promise metadata format does not support disks above 2TiB.
 NVIDIA metadata format does not support volumes above 2TiB.
+.Sh SYSCTL VARIABLES
+The following
+.Xr sysctl 8
+variable can be used to control the behavior of the
+.Nm RAID
+GEOM class.
+.Bl -tag -width indent
+.It Va kern.geom.raid.aggressive_spare : No 0
+Use any disks without metadata connected to controllers of the vendor
+matching to volume metadata format as spare.
+Use it with much care to not lose data if connecting unrelated disk!
+.It Va kern.geom.raid.clean_time : No 5
+Mark volume as clean when idle for the specified number of seconds.
+.It Va kern.geom.raid.debug : No 0
+Debug level of the
+.Nm RAID
+GEOM class.
+.It Va kern.geom.raid.idle_threshold : No 1000000
+Time in microseconds to consider a volume idle for rebuild puroses.
+.It Va kern.geom.raid.name_format : No 0
+Providers name format: 0 -- raid/r{num}, 1 -- raid/{label}.
+.It Va kern.geom.raid.read_err_thresh : No 10
+Number of read errors equated to disk failure.
+Write errors are always considered as disk failures.
+.It Va kern.geom.raid.start_timeout : No 30
+Time to wait for missing array components on startup.
+.El
 .Sh EXIT STATUS
 Exit status is 0 on success, and non-zero if the command fails.
 .Sh SEE ALSO

Modified: stable/9/sys/conf/files
==============================================================================
--- stable/9/sys/conf/files	Thu May 24 02:24:03 2012	(r235873)
+++ stable/9/sys/conf/files	Thu May 24 02:34:03 2012	(r235874)
@@ -2253,6 +2253,7 @@ geom/raid/g_raid.c		optional geom_raid
 geom/raid/g_raid_ctl.c		optional geom_raid
 geom/raid/g_raid_md_if.m	optional geom_raid
 geom/raid/g_raid_tr_if.m	optional geom_raid
+geom/raid/md_ddf.c		optional geom_raid
 geom/raid/md_intel.c		optional geom_raid
 geom/raid/md_jmicron.c		optional geom_raid
 geom/raid/md_nvidia.c		optional geom_raid
@@ -2262,6 +2263,7 @@ geom/raid/tr_concat.c		optional geom_rai
 geom/raid/tr_raid0.c		optional geom_raid
 geom/raid/tr_raid1.c		optional geom_raid
 geom/raid/tr_raid1e.c		optional geom_raid
+geom/raid/tr_raid5.c		optional geom_raid
 geom/raid3/g_raid3.c		optional geom_raid3
 geom/raid3/g_raid3_ctl.c	optional geom_raid3
 geom/shsec/g_shsec.c		optional geom_shsec

Modified: stable/9/sys/geom/raid/g_raid.c
==============================================================================
--- stable/9/sys/geom/raid/g_raid.c	Thu May 24 02:24:03 2012	(r235873)
+++ stable/9/sys/geom/raid/g_raid.c	Thu May 24 02:34:03 2012	(r235874)
@@ -277,23 +277,87 @@ g_raid_volume_level2str(int level, int q
 	case G_RAID_VOLUME_RL_RAID1:
 		return ("RAID1");
 	case G_RAID_VOLUME_RL_RAID3:
+		if (qual == G_RAID_VOLUME_RLQ_R3P0)
+			return ("RAID3-P0");
+		if (qual == G_RAID_VOLUME_RLQ_R3PN)
+			return ("RAID3-PN");
 		return ("RAID3");
 	case G_RAID_VOLUME_RL_RAID4:
+		if (qual == G_RAID_VOLUME_RLQ_R4P0)
+			return ("RAID4-P0");
+		if (qual == G_RAID_VOLUME_RLQ_R4PN)
+			return ("RAID4-PN");
 		return ("RAID4");
 	case G_RAID_VOLUME_RL_RAID5:
+		if (qual == G_RAID_VOLUME_RLQ_R5RA)
+			return ("RAID5-RA");
+		if (qual == G_RAID_VOLUME_RLQ_R5RS)
+			return ("RAID5-RS");
+		if (qual == G_RAID_VOLUME_RLQ_R5LA)
+			return ("RAID5-LA");
+		if (qual == G_RAID_VOLUME_RLQ_R5LS)
+			return ("RAID5-LS");
 		return ("RAID5");
 	case G_RAID_VOLUME_RL_RAID6:
+		if (qual == G_RAID_VOLUME_RLQ_R6RA)
+			return ("RAID6-RA");
+		if (qual == G_RAID_VOLUME_RLQ_R6RS)
+			return ("RAID6-RS");
+		if (qual == G_RAID_VOLUME_RLQ_R6LA)
+			return ("RAID6-LA");
+		if (qual == G_RAID_VOLUME_RLQ_R6LS)
+			return ("RAID6-LS");
 		return ("RAID6");
+	case G_RAID_VOLUME_RL_RAIDMDF:
+		if (qual == G_RAID_VOLUME_RLQ_RMDFRA)
+			return ("RAIDMDF-RA");
+		if (qual == G_RAID_VOLUME_RLQ_RMDFRS)
+			return ("RAIDMDF-RS");
+		if (qual == G_RAID_VOLUME_RLQ_RMDFLA)
+			return ("RAIDMDF-LA");
+		if (qual == G_RAID_VOLUME_RLQ_RMDFLS)
+			return ("RAIDMDF-LS");
+		return ("RAIDMDF");
 	case G_RAID_VOLUME_RL_RAID1E:
+		if (qual == G_RAID_VOLUME_RLQ_R1EA)
+			return ("RAID1E-A");
+		if (qual == G_RAID_VOLUME_RLQ_R1EO)
+			return ("RAID1E-O");
 		return ("RAID1E");
 	case G_RAID_VOLUME_RL_SINGLE:
 		return ("SINGLE");
 	case G_RAID_VOLUME_RL_CONCAT:
 		return ("CONCAT");
 	case G_RAID_VOLUME_RL_RAID5E:
+		if (qual == G_RAID_VOLUME_RLQ_R5ERA)
+			return ("RAID5E-RA");
+		if (qual == G_RAID_VOLUME_RLQ_R5ERS)
+			return ("RAID5E-RS");
+		if (qual == G_RAID_VOLUME_RLQ_R5ELA)
+			return ("RAID5E-LA");
+		if (qual == G_RAID_VOLUME_RLQ_R5ELS)
+			return ("RAID5E-LS");
 		return ("RAID5E");
 	case G_RAID_VOLUME_RL_RAID5EE:
+		if (qual == G_RAID_VOLUME_RLQ_R5EERA)
+			return ("RAID5EE-RA");
+		if (qual == G_RAID_VOLUME_RLQ_R5EERS)
+			return ("RAID5EE-RS");
+		if (qual == G_RAID_VOLUME_RLQ_R5EELA)
+			return ("RAID5EE-LA");
+		if (qual == G_RAID_VOLUME_RLQ_R5EELS)
+			return ("RAID5EE-LS");
 		return ("RAID5EE");
+	case G_RAID_VOLUME_RL_RAID5R:
+		if (qual == G_RAID_VOLUME_RLQ_R5RRA)
+			return ("RAID5R-RA");
+		if (qual == G_RAID_VOLUME_RLQ_R5RRS)
+			return ("RAID5R-RS");
+		if (qual == G_RAID_VOLUME_RLQ_R5RLA)
+			return ("RAID5R-LA");
+		if (qual == G_RAID_VOLUME_RLQ_R5RLS)
+			return ("RAID5R-LS");
+		return ("RAID5E");
 	default:
 		return ("UNKNOWN");
 	}
@@ -309,26 +373,111 @@ g_raid_volume_str2level(const char *str,
 		*level = G_RAID_VOLUME_RL_RAID0;
 	else if (strcasecmp(str, "RAID1") == 0)
 		*level = G_RAID_VOLUME_RL_RAID1;
-	else if (strcasecmp(str, "RAID3") == 0)
+	else if (strcasecmp(str, "RAID3-P0") == 0) {
+		*level = G_RAID_VOLUME_RL_RAID3;
+		*qual = G_RAID_VOLUME_RLQ_R3P0;
+	} else if (strcasecmp(str, "RAID3-PN") == 0 ||
+		   strcasecmp(str, "RAID3") == 0) {
 		*level = G_RAID_VOLUME_RL_RAID3;
-	else if (strcasecmp(str, "RAID4") == 0)
+		*qual = G_RAID_VOLUME_RLQ_R3PN;
+	} else if (strcasecmp(str, "RAID4-P0") == 0) {
+		*level = G_RAID_VOLUME_RL_RAID4;
+		*qual = G_RAID_VOLUME_RLQ_R4P0;
+	} else if (strcasecmp(str, "RAID4-PN") == 0 ||
+		   strcasecmp(str, "RAID4") == 0) {
 		*level = G_RAID_VOLUME_RL_RAID4;
-	else if (strcasecmp(str, "RAID5") == 0)
+		*qual = G_RAID_VOLUME_RLQ_R4PN;
+	} else if (strcasecmp(str, "RAID5-RA") == 0) {
+		*level = G_RAID_VOLUME_RL_RAID5;
+		*qual = G_RAID_VOLUME_RLQ_R5RA;
+	} else if (strcasecmp(str, "RAID5-RS") == 0) {
+		*level = G_RAID_VOLUME_RL_RAID5;
+		*qual = G_RAID_VOLUME_RLQ_R5RS;
+	} else if (strcasecmp(str, "RAID5") == 0 ||
+		   strcasecmp(str, "RAID5-LA") == 0) {
 		*level = G_RAID_VOLUME_RL_RAID5;
-	else if (strcasecmp(str, "RAID6") == 0)
+		*qual = G_RAID_VOLUME_RLQ_R5LA;
+	} else if (strcasecmp(str, "RAID5-LS") == 0) {
+		*level = G_RAID_VOLUME_RL_RAID5;
+		*qual = G_RAID_VOLUME_RLQ_R5LS;
+	} else if (strcasecmp(str, "RAID6-RA") == 0) {
+		*level = G_RAID_VOLUME_RL_RAID6;
+		*qual = G_RAID_VOLUME_RLQ_R6RA;
+	} else if (strcasecmp(str, "RAID6-RS") == 0) {
+		*level = G_RAID_VOLUME_RL_RAID6;
+		*qual = G_RAID_VOLUME_RLQ_R6RS;
+	} else if (strcasecmp(str, "RAID6") == 0 ||
+		   strcasecmp(str, "RAID6-LA") == 0) {
+		*level = G_RAID_VOLUME_RL_RAID6;
+		*qual = G_RAID_VOLUME_RLQ_R6LA;
+	} else if (strcasecmp(str, "RAID6-LS") == 0) {
 		*level = G_RAID_VOLUME_RL_RAID6;
-	else if (strcasecmp(str, "RAID10") == 0 ||
-		 strcasecmp(str, "RAID1E") == 0)
+		*qual = G_RAID_VOLUME_RLQ_R6LS;
+	} else if (strcasecmp(str, "RAIDMDF-RA") == 0) {
+		*level = G_RAID_VOLUME_RL_RAIDMDF;
+		*qual = G_RAID_VOLUME_RLQ_RMDFRA;
+	} else if (strcasecmp(str, "RAIDMDF-RS") == 0) {
+		*level = G_RAID_VOLUME_RL_RAIDMDF;
+		*qual = G_RAID_VOLUME_RLQ_RMDFRS;
+	} else if (strcasecmp(str, "RAIDMDF") == 0 ||
+		   strcasecmp(str, "RAIDMDF-LA") == 0) {
+		*level = G_RAID_VOLUME_RL_RAIDMDF;
+		*qual = G_RAID_VOLUME_RLQ_RMDFLA;
+	} else if (strcasecmp(str, "RAIDMDF-LS") == 0) {
+		*level = G_RAID_VOLUME_RL_RAIDMDF;
+		*qual = G_RAID_VOLUME_RLQ_RMDFLS;
+	} else if (strcasecmp(str, "RAID10") == 0 ||
+		   strcasecmp(str, "RAID1E") == 0 ||
+		   strcasecmp(str, "RAID1E-A") == 0) {
 		*level = G_RAID_VOLUME_RL_RAID1E;
-	else if (strcasecmp(str, "SINGLE") == 0)
+		*qual = G_RAID_VOLUME_RLQ_R1EA;
+	} else if (strcasecmp(str, "RAID1E-O") == 0) {
+		*level = G_RAID_VOLUME_RL_RAID1E;
+		*qual = G_RAID_VOLUME_RLQ_R1EO;
+	} else if (strcasecmp(str, "SINGLE") == 0)
 		*level = G_RAID_VOLUME_RL_SINGLE;
 	else if (strcasecmp(str, "CONCAT") == 0)
 		*level = G_RAID_VOLUME_RL_CONCAT;
-	else if (strcasecmp(str, "RAID5E") == 0)
+	else if (strcasecmp(str, "RAID5E-RA") == 0) {
+		*level = G_RAID_VOLUME_RL_RAID5E;
+		*qual = G_RAID_VOLUME_RLQ_R5ERA;
+	} else if (strcasecmp(str, "RAID5E-RS") == 0) {
+		*level = G_RAID_VOLUME_RL_RAID5E;
+		*qual = G_RAID_VOLUME_RLQ_R5ERS;
+	} else if (strcasecmp(str, "RAID5E") == 0 ||
+		   strcasecmp(str, "RAID5E-LA") == 0) {
 		*level = G_RAID_VOLUME_RL_RAID5E;
-	else if (strcasecmp(str, "RAID5EE") == 0)
+		*qual = G_RAID_VOLUME_RLQ_R5ELA;
+	} else if (strcasecmp(str, "RAID5E-LS") == 0) {
+		*level = G_RAID_VOLUME_RL_RAID5E;
+		*qual = G_RAID_VOLUME_RLQ_R5ELS;
+	} else if (strcasecmp(str, "RAID5EE-RA") == 0) {
 		*level = G_RAID_VOLUME_RL_RAID5EE;
-	else
+		*qual = G_RAID_VOLUME_RLQ_R5EERA;
+	} else if (strcasecmp(str, "RAID5EE-RS") == 0) {
+		*level = G_RAID_VOLUME_RL_RAID5EE;
+		*qual = G_RAID_VOLUME_RLQ_R5EERS;
+	} else if (strcasecmp(str, "RAID5EE") == 0 ||
+		   strcasecmp(str, "RAID5EE-LA") == 0) {
+		*level = G_RAID_VOLUME_RL_RAID5EE;
+		*qual = G_RAID_VOLUME_RLQ_R5EELA;
+	} else if (strcasecmp(str, "RAID5EE-LS") == 0) {
+		*level = G_RAID_VOLUME_RL_RAID5EE;
+		*qual = G_RAID_VOLUME_RLQ_R5EELS;
+	} else if (strcasecmp(str, "RAID5R-RA") == 0) {
+		*level = G_RAID_VOLUME_RL_RAID5R;
+		*qual = G_RAID_VOLUME_RLQ_R5RRA;
+	} else if (strcasecmp(str, "RAID5R-RS") == 0) {
+		*level = G_RAID_VOLUME_RL_RAID5R;
+		*qual = G_RAID_VOLUME_RLQ_R5RRS;
+	} else if (strcasecmp(str, "RAID5R") == 0 ||
+		   strcasecmp(str, "RAID5R-LA") == 0) {
+		*level = G_RAID_VOLUME_RL_RAID5R;
+		*qual = G_RAID_VOLUME_RLQ_R5RLA;
+	} else if (strcasecmp(str, "RAID5R-LS") == 0) {
+		*level = G_RAID_VOLUME_RL_RAID5R;
+		*qual = G_RAID_VOLUME_RLQ_R5RLS;
+	} else
 		return (-1);
 	return (0);
 }
@@ -1674,8 +1823,8 @@ g_raid_create_node(struct g_class *mp,
 	sc->sc_flags = 0;
 	TAILQ_INIT(&sc->sc_volumes);
 	TAILQ_INIT(&sc->sc_disks);
-	sx_init(&sc->sc_lock, "gmirror:lock");
-	mtx_init(&sc->sc_queue_mtx, "gmirror:queue", NULL, MTX_DEF);
+	sx_init(&sc->sc_lock, "graid:lock");
+	mtx_init(&sc->sc_queue_mtx, "graid:queue", NULL, MTX_DEF);
 	TAILQ_INIT(&sc->sc_events);
 	bioq_init(&sc->sc_queue);
 	gp->softc = sc;
@@ -1707,6 +1856,7 @@ g_raid_create_volume(struct g_raid_softc
 	vol->v_state = G_RAID_VOLUME_S_STARTING;
 	vol->v_raid_level = G_RAID_VOLUME_RL_UNKNOWN;
 	vol->v_raid_level_qualifier = G_RAID_VOLUME_RLQ_UNKNOWN;
+	vol->v_rotate_parity = 1;
 	bioq_init(&vol->v_inflight);
 	bioq_init(&vol->v_locked);
 	LIST_INIT(&vol->v_locks);
@@ -1994,7 +2144,7 @@ g_raid_taste(struct g_class *mp, struct 
 	g_trace(G_T_TOPOLOGY, "%s(%s, %s)", __func__, mp->name, pp->name);
 	G_RAID_DEBUG(2, "Tasting provider %s.", pp->name);
 
-	gp = g_new_geomf(mp, "mirror:taste");
+	gp = g_new_geomf(mp, "raid:taste");
 	/*
 	 * This orphan function should be never called.
 	 */
@@ -2024,7 +2174,8 @@ g_raid_taste(struct g_class *mp, struct 
 }
 
 int
-g_raid_create_node_format(const char *format, struct g_geom **gp)
+g_raid_create_node_format(const char *format, struct gctl_req *req,
+    struct g_geom **gp)
 {
 	struct g_raid_md_class *class;
 	struct g_raid_md_object *obj;
@@ -2042,7 +2193,7 @@ g_raid_create_node_format(const char *fo
 	obj = (void *)kobj_create((kobj_class_t)class, M_RAID,
 	    M_WAITOK);
 	obj->mdo_class = class;
-	status = G_RAID_MD_CREATE(obj, &g_raid_class, gp);
+	status = G_RAID_MD_CREATE_REQ(obj, &g_raid_class, req, gp);
 	if (status != G_RAID_MD_TASTE_NEW)
 		kobj_delete((kobj_t)obj, M_RAID);
 	return (status);

Modified: stable/9/sys/geom/raid/g_raid.h
==============================================================================
--- stable/9/sys/geom/raid/g_raid.h	Thu May 24 02:24:03 2012	(r235873)
+++ stable/9/sys/geom/raid/g_raid.h	Thu May 24 02:34:03 2012	(r235874)
@@ -219,14 +219,48 @@ struct g_raid_subdisk {
 #define G_RAID_VOLUME_RL_RAID4		0x04
 #define G_RAID_VOLUME_RL_RAID5		0x05
 #define G_RAID_VOLUME_RL_RAID6		0x06
+#define G_RAID_VOLUME_RL_RAIDMDF	0x07
 #define G_RAID_VOLUME_RL_RAID1E		0x11
 #define G_RAID_VOLUME_RL_SINGLE		0x0f
 #define G_RAID_VOLUME_RL_CONCAT		0x1f
 #define G_RAID_VOLUME_RL_RAID5E		0x15
 #define G_RAID_VOLUME_RL_RAID5EE	0x25
+#define G_RAID_VOLUME_RL_RAID5R		0x35
 #define G_RAID_VOLUME_RL_UNKNOWN	0xff
 
 #define G_RAID_VOLUME_RLQ_NONE		0x00
+#define G_RAID_VOLUME_RLQ_R1SM		0x00
+#define G_RAID_VOLUME_RLQ_R1MM		0x01
+#define G_RAID_VOLUME_RLQ_R3P0		0x00
+#define G_RAID_VOLUME_RLQ_R3PN		0x01
+#define G_RAID_VOLUME_RLQ_R4P0		0x00
+#define G_RAID_VOLUME_RLQ_R4PN		0x01
+#define G_RAID_VOLUME_RLQ_R5RA		0x00
+#define G_RAID_VOLUME_RLQ_R5RS		0x01
+#define G_RAID_VOLUME_RLQ_R5LA		0x02
+#define G_RAID_VOLUME_RLQ_R5LS		0x03
+#define G_RAID_VOLUME_RLQ_R6RA		0x00
+#define G_RAID_VOLUME_RLQ_R6RS		0x01
+#define G_RAID_VOLUME_RLQ_R6LA		0x02
+#define G_RAID_VOLUME_RLQ_R6LS		0x03
+#define G_RAID_VOLUME_RLQ_RMDFRA	0x00
+#define G_RAID_VOLUME_RLQ_RMDFRS	0x01
+#define G_RAID_VOLUME_RLQ_RMDFLA	0x02
+#define G_RAID_VOLUME_RLQ_RMDFLS	0x03
+#define G_RAID_VOLUME_RLQ_R1EA		0x00
+#define G_RAID_VOLUME_RLQ_R1EO		0x01
+#define G_RAID_VOLUME_RLQ_R5ERA		0x00
+#define G_RAID_VOLUME_RLQ_R5ERS		0x01
+#define G_RAID_VOLUME_RLQ_R5ELA		0x02
+#define G_RAID_VOLUME_RLQ_R5ELS		0x03
+#define G_RAID_VOLUME_RLQ_R5EERA	0x00
+#define G_RAID_VOLUME_RLQ_R5EERS	0x01
+#define G_RAID_VOLUME_RLQ_R5EELA	0x02
+#define G_RAID_VOLUME_RLQ_R5EELS	0x03
+#define G_RAID_VOLUME_RLQ_R5RRA		0x00
+#define G_RAID_VOLUME_RLQ_R5RRS		0x01
+#define G_RAID_VOLUME_RLQ_R5RLA		0x02
+#define G_RAID_VOLUME_RLQ_R5RLS		0x03
 #define G_RAID_VOLUME_RLQ_UNKNOWN	0xff
 
 struct g_raid_volume;
@@ -244,7 +278,13 @@ struct g_raid_volume {
 	u_int			 v_raid_level;	/* Array RAID level. */
 	u_int			 v_raid_level_qualifier; /* RAID level det. */
 	u_int			 v_disks_count;	/* Number of disks in array. */
+	u_int			 v_mdf_pdisks;	/* Number of parity disks
+						   in RAIDMDF array. */
+	uint16_t		 v_mdf_polynomial; /* Polynomial for RAIDMDF. */
+	uint8_t			 v_mdf_method;	/* Generation method for RAIDMDF. */
 	u_int			 v_strip_size;	/* Array strip size. */
+	u_int			 v_rotate_parity; /* Rotate RAID5R parity
+						   after numer of stripes. */
 	u_int			 v_sectorsize;	/* Volume sector size. */
 	off_t			 v_mediasize;	/* Volume media size.  */
 	struct bio_queue_head	 v_inflight;	/* In-flight write requests. */
@@ -348,7 +388,8 @@ const char * g_raid_disk_state2str(int s
 
 struct g_raid_softc * g_raid_create_node(struct g_class *mp,
     const char *name, struct g_raid_md_object *md);
-int g_raid_create_node_format(const char *format, struct g_geom **gp);
+int g_raid_create_node_format(const char *format, struct gctl_req *req,
+    struct g_geom **gp);
 struct g_raid_volume * g_raid_create_volume(struct g_raid_softc *sc,
     const char *name, int id);
 struct g_raid_disk * g_raid_create_disk(struct g_raid_softc *sc);

Modified: stable/9/sys/geom/raid/g_raid_ctl.c
==============================================================================
--- stable/9/sys/geom/raid/g_raid_ctl.c	Thu May 24 02:24:03 2012	(r235873)
+++ stable/9/sys/geom/raid/g_raid_ctl.c	Thu May 24 02:34:03 2012	(r235874)
@@ -88,7 +88,7 @@ g_raid_ctl_label(struct gctl_req *req, s
 		gctl_error(req, "No format recieved.");
 		return;
 	}
-	crstatus = g_raid_create_node_format(format, &geom);
+	crstatus = g_raid_create_node_format(format, req, &geom);
 	if (crstatus == G_RAID_MD_TASTE_FAIL) {
 		gctl_error(req, "Failed to create array with format '%s'.",
 		    format);

Modified: stable/9/sys/geom/raid/g_raid_md_if.m
==============================================================================
--- stable/9/sys/geom/raid/g_raid_md_if.m	Thu May 24 02:24:03 2012	(r235873)
+++ stable/9/sys/geom/raid/g_raid_md_if.m	Thu May 24 02:34:03 2012	(r235874)
@@ -49,13 +49,22 @@ HEADER {
 # Default implementations of methods.
 CODE {
 	static int
-	g_raid_md_create_default(struct g_raid_md_object *md)
+	g_raid_md_create_default(struct g_raid_md_object *md,
+	    struct g_class *mp, struct g_geom **gp)
 	{
 
 		return (G_RAID_MD_TASTE_FAIL);
 	}
 
 	static int
+	g_raid_md_create_req_default(struct g_raid_md_object *md,
+	    struct g_class *mp, struct gctl_req *req, struct g_geom **gp)
+	{
+
+		return (G_RAID_MD_CREATE(md, mp, gp));
+	}
+
+	static int
 	g_raid_md_ctl_default(struct g_raid_md_object *md,
 	    struct gctl_req *req)
 	{
@@ -95,6 +104,14 @@ METHOD int create {
 	struct g_geom **gp;
 } DEFAULT g_raid_md_create_default;
 
+# create_req() - create new node from scratch, with request argument.
+METHOD int create_req {
+	struct g_raid_md_object *md;
+	struct g_class *mp;
+	struct gctl_req *req;
+	struct g_geom **gp;
+} DEFAULT g_raid_md_create_req_default;
+
 # taste() - taste disk and, if needed, create new node.
 METHOD int taste {
 	struct g_raid_md_object *md;

Copied and modified: stable/9/sys/geom/raid/md_ddf.c (from r234848, head/sys/geom/raid/md_ddf.c)
==============================================================================
--- head/sys/geom/raid/md_ddf.c	Mon Apr 30 17:53:02 2012	(r234848, copy source)
+++ stable/9/sys/geom/raid/md_ddf.c	Thu May 24 02:34:03 2012	(r235874)
@@ -88,14 +88,15 @@ struct g_raid_md_ddf_pervolume {
 
 struct g_raid_md_ddf_object {
 	struct g_raid_md_object	 mdio_base;
+	u_int			 mdio_bigendian;
 	struct ddf_meta		 mdio_meta;
+	int			 mdio_starting;
 	struct callout		 mdio_start_co;	/* STARTING state timer. */
 	int			 mdio_started;
-	int			 mdio_incomplete;
 	struct root_hold_token	*mdio_rootmount; /* Root mount delay token. */
 };
 
-static g_raid_md_create_t g_raid_md_create_ddf;
+static g_raid_md_create_req_t g_raid_md_create_req_ddf;
 static g_raid_md_taste_t g_raid_md_taste_ddf;
 static g_raid_md_event_t g_raid_md_event_ddf;
 static g_raid_md_volume_event_t g_raid_md_volume_event_ddf;
@@ -107,7 +108,7 @@ static g_raid_md_free_volume_t g_raid_md
 static g_raid_md_free_t g_raid_md_free_ddf;
 
 static kobj_method_t g_raid_md_ddf_methods[] = {
-	KOBJMETHOD(g_raid_md_create,	g_raid_md_create_ddf),
+	KOBJMETHOD(g_raid_md_create_req,	g_raid_md_create_req_ddf),
 	KOBJMETHOD(g_raid_md_taste,	g_raid_md_taste_ddf),
 	KOBJMETHOD(g_raid_md_event,	g_raid_md_event_ddf),
 	KOBJMETHOD(g_raid_md_volume_event,	g_raid_md_volume_event_ddf),
@@ -172,6 +173,17 @@ static struct g_raid_md_class g_raid_md_
 #define SET32D(m, f, v)	SET32P((m), &(f), (v))
 #define SET64D(m, f, v)	SET64P((m), &(f), (v))
 
+#define GETCRNUM(m)	(GET32((m), hdr->cr_length) /			\
+	GET16((m), hdr->Configuration_Record_Length))
+
+#define GETVDCPTR(m, n)	((struct ddf_vdc_record *)((uint8_t *)(m)->cr +	\
+	(n) * GET16((m), hdr->Configuration_Record_Length) *		\
+	(m)->sectorsize))
+
+#define GETSAPTR(m, n)	((struct ddf_sa_record *)((uint8_t *)(m)->cr +	\
+	(n) * GET16((m), hdr->Configuration_Record_Length) *		\
+	(m)->sectorsize))
+
 static int
 isff(uint8_t *buf, int size)
 {
@@ -254,7 +266,7 @@ g_raid_md_ddf_print(struct ddf_meta *met
 	    GET16(meta, cdr->Controller_Type.SubVendor_ID),
 	    GET16(meta, cdr->Controller_Type.SubDevice_ID));
 	printf("Product_ID           '%.16s'\n", (char *)&meta->cdr->Product_ID[0]);
-	printf("**** Physical Disk Data ****\n");
+	printf("**** Physical Disk Records ****\n");
 	printf("Populated_PDEs       %u\n", GET16(meta, pdr->Populated_PDEs));
 	printf("Max_PDE_Supported    %u\n", GET16(meta, pdr->Max_PDE_Supported));
 	for (j = 0; j < GET16(meta, pdr->Populated_PDEs); j++) {
@@ -276,7 +288,7 @@ g_raid_md_ddf_print(struct ddf_meta *met
 		printf("Block_Size           %u\n",
 		    GET16(meta, pdr->entry[j].Block_Size));
 	}
-	printf("**** Virtual Disk Data ****\n");
+	printf("**** Virtual Disk Records ****\n");
 	printf("Populated_VDEs       %u\n", GET16(meta, vdr->Populated_VDEs));
 	printf("Max_VDE_Supported    %u\n", GET16(meta, vdr->Max_VDE_Supported));
 	for (j = 0; j < GET16(meta, vdr->Populated_VDEs); j++) {
@@ -287,8 +299,8 @@ g_raid_md_ddf_print(struct ddf_meta *met
 		printf("\n");
 		printf("VD_Number            0x%04x\n",
 		    GET16(meta, vdr->entry[j].VD_Number));
-		printf("VD_Type              0x%02x\n",
-		    GET8(meta, vdr->entry[j].VD_Type));
+		printf("VD_Type              0x%04x\n",
+		    GET16(meta, vdr->entry[j].VD_Type));
 		printf("VD_State             0x%02x\n",
 		    GET8(meta, vdr->entry[j].VD_State));
 		printf("Init_State           0x%02x\n",
@@ -299,11 +311,9 @@ g_raid_md_ddf_print(struct ddf_meta *met
 		    (char *)&meta->vdr->entry[j].VD_Name);
 	}
 	printf("**** Configuration Records ****\n");
-	num = GET32(meta, hdr->cr_length) / GET16(meta, hdr->Configuration_Record_Length);
+	num = GETCRNUM(meta);
 	for (j = 0; j < num; j++) {
-		vdc = (struct ddf_vdc_record *)((uint8_t *)meta->cr +
-		    j * GET16(meta, hdr->Configuration_Record_Length) *
-		    meta->sectorsize);
+		vdc = GETVDCPTR(meta, j);
 		val = GET32D(meta, vdc->Signature);
 		switch (val) {
 		case DDF_VDCR_SIGNATURE:
@@ -391,6 +401,7 @@ g_raid_md_ddf_print(struct ddf_meta *met
 				    GET16D(meta, sa->entry[i].Secondary_Element));
 			}
 			break;
+		case 0x00000000:
 		case 0xFFFFFFFF:
 			break;
 		default:
@@ -463,17 +474,16 @@ ddf_meta_find_vdc(struct ddf_meta *meta,
 	struct ddf_vdc_record *vdc;
 	int i, num;
 
-	num = GET32(meta, hdr->cr_length) / GET16(meta, hdr->Configuration_Record_Length);
+	num = GETCRNUM(meta);
 	for (i = 0; i < num; i++) {
-		vdc = (struct ddf_vdc_record *)((uint8_t *)meta->cr +
-		    i * GET16(meta, hdr->Configuration_Record_Length) *
-		    meta->sectorsize);
+		vdc = GETVDCPTR(meta, i);
 		if (GUID != NULL) {
 			if (GET32D(meta, vdc->Signature) == DDF_VDCR_SIGNATURE &&
 			    memcmp(vdc->VD_GUID, GUID, 24) == 0)
 				return (vdc);
 		} else
-			if (GET32D(meta, vdc->Signature) == 0xffffffff)
+			if (GET32D(meta, vdc->Signature) == 0xffffffff ||
+			    GET32D(meta, vdc->Signature) == 0)
 				return (vdc);
 	}
 	return (NULL);
@@ -486,11 +496,9 @@ ddf_meta_count_vdc(struct ddf_meta *meta
 	int i, num, cnt;
 
 	cnt = 0;
-	num = GET32(meta, hdr->cr_length) / GET16(meta, hdr->Configuration_Record_Length);
+	num = GETCRNUM(meta);
 	for (i = 0; i < num; i++) {
-		vdc = (struct ddf_vdc_record *)((uint8_t *)meta->cr +
-		    i * GET16(meta, hdr->Configuration_Record_Length) *
-		    meta->sectorsize);
+		vdc = GETVDCPTR(meta, i);
 		if (GET32D(meta, vdc->Signature) != DDF_VDCR_SIGNATURE)
 			continue;
 		if (GUID == NULL || memcmp(vdc->VD_GUID, GUID, 24) == 0)
@@ -526,12 +534,36 @@ ddf_meta_find_disk(struct ddf_vol_meta *
 	return (-1);
 }
 
+static struct ddf_sa_record *
+ddf_meta_find_sa(struct ddf_meta *meta, int create)
+{
+	struct ddf_sa_record *sa;
+	int i, num;
+
+	num = GETCRNUM(meta);
+	for (i = 0; i < num; i++) {
+		sa = GETSAPTR(meta, i);
+		if (GET32D(meta, sa->Signature) == DDF_SA_SIGNATURE)
+			return (sa);
+	}
+	if (create) {
+		for (i = 0; i < num; i++) {
+			sa = GETSAPTR(meta, i);
+			if (GET32D(meta, sa->Signature) == 0xffffffff ||
+			    GET32D(meta, sa->Signature) == 0)
+				return (sa);
+		}
+	}
+	return (NULL);
+}
+
 static void
 ddf_meta_create(struct g_raid_disk *disk, struct ddf_meta *sample)
 {
 	struct timespec ts;
 	struct clocktime ct;
 	struct g_raid_md_ddf_perdisk *pd;
+	struct g_raid_md_ddf_object *mdi;
 	struct ddf_meta *meta;
 	struct ddf_pd_entry *pde;
 	off_t anchorlba;
@@ -542,13 +574,14 @@ ddf_meta_create(struct g_raid_disk *disk
 	if (sample->hdr == NULL)
 		sample = NULL;
 
+	mdi = (struct g_raid_md_ddf_object *)disk->d_softc->sc_md;
 	pd = (struct g_raid_md_ddf_perdisk *)disk->d_md_data;
 	meta = &pd->pd_meta;
 	ss = disk->d_consumer->provider->sectorsize;
 	anchorlba = disk->d_consumer->provider->mediasize / ss - 1;
 
 	meta->sectorsize = ss;
-	meta->bigendian = sample ? sample->bigendian : 0;
+	meta->bigendian = sample ? sample->bigendian : mdi->mdio_bigendian;
 	getnanotime(&ts);
 	clock_ts_to_ct(&ts, &ct);
 
@@ -642,9 +675,9 @@ ddf_meta_create(struct g_raid_disk *disk
 	pos += GET32(meta, hdr->Diagnostic_Space_Length);
 	SET32(meta, hdr->Vendor_Specific_Logs,
 	    GET32(meta, hdr->Vendor_Specific_Logs_Length) != 0 ? pos : 0xffffffff);
-	pos += GET32(meta, hdr->Vendor_Specific_Logs_Length);
+	pos += min(GET32(meta, hdr->Vendor_Specific_Logs_Length), 1);
 	SET64(meta, hdr->Primary_Header_LBA,
-	    anchorlba - pos - 16);
+	    anchorlba - pos);
 	SET64(meta, hdr->Secondary_Header_LBA,
 	    0xffffffffffffffffULL);
 	SET64(meta, hdr->WorkSpace_LBA,
@@ -756,7 +789,7 @@ ddf_meta_update(struct ddf_meta *meta, s
 		if (isff(spde->PD_GUID, 24))
 			continue;
 		j = ddf_meta_find_pd(meta, NULL,
-		    src->pdr->entry[i].PD_Reference);
+		    GET32(src, pdr->entry[i].PD_Reference));
 		if (j < 0) {
 			j = ddf_meta_find_pd(meta, NULL, 0xffffffff);
 			pde = &meta->pdr->entry[j];
@@ -835,7 +868,8 @@ ddf_vol_meta_create(struct ddf_vol_meta 
 }
 
 static void
-ddf_vol_meta_update(struct ddf_vol_meta *dst, struct ddf_meta *src, uint8_t *GUID)
+ddf_vol_meta_update(struct ddf_vol_meta *dst, struct ddf_meta *src,
+    uint8_t *GUID, int started)
 {
 	struct ddf_header *hdr;
 	struct ddf_vd_entry *vde;
@@ -850,15 +884,15 @@ ddf_vol_meta_update(struct ddf_vol_meta 
 	size = GET16(src, hdr->Configuration_Record_Length) * src->sectorsize;
 
 	if (dst->vdc == NULL ||
-	    ((int32_t)(GET32D(src, vdc->Sequence_Number) -
-	    GET32(dst, vdc->Sequence_Number))) > 0)
+	    (!started && ((int32_t)(GET32D(src, vdc->Sequence_Number) -
+	    GET32(dst, vdc->Sequence_Number))) > 0))
 		vnew = 1;
 	else
 		vnew = 0;
 
 	if (dst->bvdc[bvd] == NULL ||
-	    ((int32_t)(GET32D(src, vdc->Sequence_Number) -
-	    GET32(dst, bvdc[bvd]->Sequence_Number))) > 0)
+	    (!started && ((int32_t)(GET32D(src, vdc->Sequence_Number) -
+	    GET32(dst, bvdc[bvd]->Sequence_Number))) > 0))
 		bvnew = 1;
 	else
 		bvnew = 0;
@@ -936,12 +970,9 @@ ddf_meta_unused_range(struct ddf_meta *m
 	beg[0] = 0;
 	end[0] = GET64(meta, pdr->entry[pos].Configured_Size);
 	n = 1;
-	num = GET32(meta, hdr->cr_length) /
-	    GET16(meta, hdr->Configuration_Record_Length);
+	num = GETCRNUM(meta);
 	for (i = 0; i < num; i++) {
-		vdc = (struct ddf_vdc_record *)((uint8_t *)meta->cr +
-		    i * GET16(meta, hdr->Configuration_Record_Length) *
-		    meta->sectorsize);
+		vdc = GETVDCPTR(meta, i);
 		if (GET32D(meta, vdc->Signature) != DDF_VDCR_SIGNATURE)
 			continue;
 		for (pos = 0; pos < GET16D(meta, vdc->Primary_Element_Count); pos++)
@@ -1197,7 +1228,7 @@ hdrerror:
 	}
 
 done:
-	free(abuf, M_MD_DDF);
+	g_free(abuf);
 	if (error != 0)
 		ddf_meta_free(meta);
 	return (error);
@@ -1260,11 +1291,10 @@ err:
 	if (error != 0)
 		goto err;
 
-	size = GET16(meta, hdr->Configuration_Record_Length);
-	num = GET32(meta, hdr->cr_length) / size;
-	size *= ss;
+	size = GET16(meta, hdr->Configuration_Record_Length) * ss;
+	num = GETCRNUM(meta);
 	for (i = 0; i < num; i++) {
-		vdc = (struct ddf_vdc_record *)((uint8_t *)meta->cr + i * size);
+		vdc = GETVDCPTR(meta, i);
 		SET32D(meta, vdc->CRC, 0xffffffff);
 		SET32D(meta, vdc->CRC, crc32(vdc, size));
 	}
@@ -1320,29 +1350,6 @@ ddf_meta_erase(struct g_consumer *cp)
 	return (error);
 }
 
-#if 0
-static int
-ddf_meta_write_spare(struct g_consumer *cp)
-{
-	struct ddf_header *meta;
-	int error;
-
-	meta = malloc(sizeof(*meta), M_MD_DDF, M_WAITOK | M_ZERO);
-	memcpy(&meta->ddf_id[0], DDF_MAGIC, sizeof(DDF_MAGIC) - 1);
-	meta->dummy_0 = 0x00020000;
-	meta->integrity = DDF_I_VALID;
-	meta->disk.flags = DDF_F_SPARE | DDF_F_ONLINE | DDF_F_VALID;
-	meta->disk.number = 0xff;
-	arc4rand(&meta->disk.id, sizeof(meta->disk.id), 0);
-	meta->disk_sectors = cp->provider->mediasize / cp->provider->sectorsize;
-	meta->disk_sectors -= 131072;
-	meta->rebuild_lba = UINT32_MAX;
-	error = ddf_meta_write(cp, &meta, 1);
-	free(meta, M_MD_DDF);
-	return (error);
-}
-#endif
-
 static struct g_raid_volume *
 g_raid_md_ddf_get_volume(struct g_raid_softc *sc, uint8_t *GUID)
 {
@@ -1510,16 +1517,14 @@ g_raid_md_ddf_supported(int level, int q
 		    qual != G_RAID_VOLUME_RLQ_RMDFLA &&
 		    qual != G_RAID_VOLUME_RLQ_RMDFLS)
 			return (0);
-		if (disks < 5)
+		if (disks < 4)
 			return (0);
 		break;
 	case G_RAID_VOLUME_RL_RAID1E:
 		if (qual != G_RAID_VOLUME_RLQ_R1EA &&
 		    qual != G_RAID_VOLUME_RLQ_R1EO)
 			return (0);
-		if (disks < 2)
-			return (0);
-		if (disks % 2 != 0)
+		if (disks < 3)
 			return (0);
 		break;
 	case G_RAID_VOLUME_RL_SINGLE:
@@ -1578,6 +1583,7 @@ g_raid_md_ddf_start_disk(struct g_raid_d
 	struct ddf_vol_meta *vmeta;
 	struct ddf_meta *pdmeta, *gmeta;
 	struct ddf_vdc_record *vdc1;
+	struct ddf_sa_record *sa;
 	off_t size, eoff = 0, esize = 0;
 	uint64_t *val2;
 	int disk_pos, md_disk_bvd = -1, md_disk_pos = -1, md_pde_pos;
@@ -1600,7 +1606,8 @@ g_raid_md_ddf_start_disk(struct g_raid_d
 	md_pde_pos = ddf_meta_find_pd(gmeta, NULL, reference);
 
 	if (disk_pos < 0) {
-		G_RAID_DEBUG1(1, sc, "Disk %s is not part of the volume %s",
+		G_RAID_DEBUG1(1, sc,
+		    "Disk %s is not a present part of the volume %s",
 		    g_raid_get_diskname(disk), vol->v_name);
 
 		/* Failed stale disk is useless for us. */
@@ -1610,10 +1617,8 @@ g_raid_md_ddf_start_disk(struct g_raid_d
 		}
 
 		/* If disk has some metadata for this volume - erase. */
-		if (pdmeta->cr != NULL &&
-		    (vdc1 = ddf_meta_find_vdc(pdmeta, vmeta->vdc->VD_GUID)) != NULL) {
+		if ((vdc1 = ddf_meta_find_vdc(pdmeta, vmeta->vdc->VD_GUID)) != NULL)
 			SET32D(pdmeta, vdc1->Signature, 0xffffffff);
-		}
 
 		/* If we are in the start process, that's all for now. */
 		if (!pv->pv_started)
@@ -1634,6 +1639,8 @@ g_raid_md_ddf_start_disk(struct g_raid_d
 			    g_raid_get_diskname(disk));
 			goto nofit;
 		}
+		eoff *= pd->pd_meta.sectorsize;
+		esize *= pd->pd_meta.sectorsize;
 		size = INT64_MAX;
 		for (i = 0; i < vol->v_disks_count; i++) {
 			sd = &vol->v_subdisks[i];
@@ -1646,26 +1653,41 @@ g_raid_md_ddf_start_disk(struct g_raid_d
 		}
 		if (disk_pos >= 0 &&
 		    vol->v_raid_level != G_RAID_VOLUME_RL_CONCAT &&
-		    (off_t)esize * 512 < size) {
+		    esize < size) {
 			G_RAID_DEBUG1(1, sc, "Disk %s free space "
 			    "is too small (%ju < %ju)",
-			    g_raid_get_diskname(disk),
-			    (off_t)esize * 512, size);
+			    g_raid_get_diskname(disk), esize, size);
 			disk_pos = -1;
 		}
 		if (disk_pos >= 0) {
 			if (vol->v_raid_level != G_RAID_VOLUME_RL_CONCAT)
-				esize = size / 512;
+				esize = size;
 			md_disk_bvd = disk_pos / GET16(vmeta, vdc->Primary_Element_Count); // XXX
 			md_disk_pos = disk_pos % GET16(vmeta, vdc->Primary_Element_Count); // XXX
 		} else {
 nofit:
-			if (ddf_meta_count_vdc(&pd->pd_meta, NULL) == 0) {
+			if (disk->d_state == G_RAID_DISK_S_NONE)
 				g_raid_change_disk_state(disk,
-				    G_RAID_DISK_S_SPARE);
-			}
+				    G_RAID_DISK_S_STALE);
 			return (0);
 		}
+
+		/*
+		 * If spare is committable, delete spare record.
+		 * Othersize, mark it active and leave there.
+		 */
+		sa = ddf_meta_find_sa(&pd->pd_meta, 0);
+		if (sa != NULL) {
+			if ((GET8D(&pd->pd_meta, sa->Spare_Type) &
+			    DDF_SAR_TYPE_REVERTIBLE) == 0) {
+				SET32D(&pd->pd_meta, sa->Signature, 0xffffffff);
+			} else {
+				SET8D(&pd->pd_meta, sa->Spare_Type,
+				    GET8D(&pd->pd_meta, sa->Spare_Type) |
+				    DDF_SAR_TYPE_ACTIVE);
+			}
+		}
+
 		G_RAID_DEBUG1(1, sc, "Disk %s takes pos %d in the volume %s",
 		    g_raid_get_diskname(disk), disk_pos, vol->v_name);
 		resurrection = 1;
@@ -1691,8 +1713,8 @@ nofit:
 		g_raid_change_disk_state(disk, G_RAID_DISK_S_ACTIVE);
 
 	if (resurrection) {
-		sd->sd_offset = (off_t)eoff * 512;
-		sd->sd_size = (off_t)esize * 512;
+		sd->sd_offset = eoff;
+		sd->sd_size = esize;
 	} else if (pdmeta->cr != NULL &&
 	    (vdc1 = ddf_meta_find_vdc(pdmeta, vmeta->vdc->VD_GUID)) != NULL) {
 		val2 = (uint64_t *)&(vdc1->Physical_Disk_Sequence[GET16(vmeta, hdr->Max_Primary_Element_Entries)]);
@@ -1802,7 +1824,9 @@ g_raid_md_ddf_start(struct g_raid_volume
 	struct g_raid_subdisk *sd;
 	struct g_raid_disk *disk;
 	struct g_raid_md_object *md;
+	struct g_raid_md_ddf_perdisk *pd;
 	struct g_raid_md_ddf_pervolume *pv;
+	struct g_raid_md_ddf_object *mdi;
 	struct ddf_vol_meta *vmeta;
 	struct ddf_vdc_record *vdc;
 	uint64_t *val2;
@@ -1810,6 +1834,7 @@ g_raid_md_ddf_start(struct g_raid_volume
 
 	sc = vol->v_softc;
 	md = sc->sc_md;
+	mdi = (struct g_raid_md_ddf_object *)md;
 	pv = vol->v_md_data;
 	vmeta = &pv->pv_meta;
 	vdc = vmeta->vdc;
@@ -1826,6 +1851,13 @@ g_raid_md_ddf_start(struct g_raid_volume
 	vol->v_strip_size = vol->v_sectorsize << GET8(vmeta, vdc->Stripe_Size);
 	vol->v_disks_count = GET16(vmeta, vdc->Primary_Element_Count) *
 	    GET8(vmeta, vdc->Secondary_Element_Count);
+	vol->v_mdf_pdisks = GET8(vmeta, vdc->MDF_Parity_Disks);
+	vol->v_mdf_polynomial = GET16(vmeta, vdc->MDF_Parity_Generator_Polynomial);
+	vol->v_mdf_method = GET8(vmeta, vdc->MDF_Constant_Generation_Method);
+	if (GET8(vmeta, vdc->Rotate_Parity_count) > 31)
+		vol->v_rotate_parity = 1;
+	else
+		vol->v_rotate_parity = 1 << GET8(vmeta, vdc->Rotate_Parity_count);
 	vol->v_mediasize = GET64(vmeta, vdc->VD_Size) * vol->v_sectorsize;
 	for (i = 0, j = 0, bvd = 0; i < vol->v_disks_count; i++, j++) {
 		if (j == GET16(vmeta, vdc->Primary_Element_Count)) {
@@ -1848,20 +1880,14 @@ g_raid_md_ddf_start(struct g_raid_volume
 	g_raid_start_volume(vol);
 
 	/* Make all disks found till the moment take their places. */
-	for (i = 0, j = 0, bvd = 0; i < vol->v_disks_count; i++, j++) {
-		if (j == GET16(vmeta, vdc->Primary_Element_Count)) {
-			j = 0;
-			bvd++;
-		}
-		if (vmeta->bvdc[bvd] == NULL)
-			continue;
-		disk = g_raid_md_ddf_get_disk(sc, NULL,
-		    GET32(vmeta, bvdc[bvd]->Physical_Disk_Sequence[j]));
-		if (disk != NULL)
+	TAILQ_FOREACH(disk, &sc->sc_disks, d_next) {
+		pd = (struct g_raid_md_ddf_perdisk *)disk->d_md_data;
+		if (ddf_meta_find_vdc(&pd->pd_meta, vmeta->vdc->VD_GUID) != NULL)
 			g_raid_md_ddf_start_disk(disk, vol);
 	}
 
 	pv->pv_started = 1;
+	mdi->mdio_starting--;
 	callout_stop(&pv->pv_start_co);

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

From owner-svn-src-stable-9@FreeBSD.ORG  Thu May 24 02:36:59 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 35C7B106566B;
	Thu, 24 May 2012 02:36:59 +0000 (UTC)
	(envelope-from pyunyh@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 D689A8FC08;
	Thu, 24 May 2012 02:36:58 +0000 (UTC)
Received: by pbbro2 with SMTP id ro2so11586620pbb.13
	for <multiple recipients>; Wed, 23 May 2012 19:36:58 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
	h=from:date:to:cc:subject:message-id:reply-to:references:mime-version
	:content-type:content-disposition:in-reply-to:user-agent;
	bh=w5+P739jRAHdRWQSBhAA8yA+LnM7KAFplmgnJxjnLc4=;
	b=T/mYDfiZ2+BigqLTDr66ejuvKkXl5SIRvs4uJG4+UVq8Ep7d7GLjU+FA0e+269be37
	zD5DUx4Iwn31ItE0Xt1iWy9+lyoT4Op5h11z2W1ctaIfsC9nY68awsJ7mXpvNnHkqGJU
	W8yuUWGk5O25kk3OzDBjLVtaQTjEubLRTgdaM/ldDlQdk/W1hEtHxaLIdQ5UaDKFJkVl
	ZkA6fOY37BPZgdaIwd9QiUSqPoT8d6vZfEOWJNwo+0gfUH+kRXLSzLnYlveBTIA3FoVQ
	8/2778mUj5ZKlPrah0m+dbkoUcl9JJ20GegtfrkDeYFPycTJoeelkVhDc8G/rfKOPB80
	+Oyg==
Received: by 10.68.132.166 with SMTP id ov6mr16943603pbb.24.1337827018396;
	Wed, 23 May 2012 19:36:58 -0700 (PDT)
Received: from pyunyh@gmail.com ([114.111.62.249])
	by mx.google.com with ESMTPS id ku7sm3811505pbc.31.2012.05.23.19.36.54
	(version=TLSv1/SSLv3 cipher=OTHER);
	Wed, 23 May 2012 19:36:57 -0700 (PDT)
Received: by pyunyh@gmail.com (sSMTP sendmail emulation);
	Thu, 24 May 2012 11:36:49 -0700
From: YongHyeon PYUN <pyunyh@gmail.com>
Date: Thu, 24 May 2012 11:36:49 -0700
To: Adrian Chadd <adrian@freebsd.org>
Message-ID: <20120524183649.GA14593@michelle.cdnetworks.com>
References: <201205230202.q4N22UDA041838@svn.freebsd.org>
	<CAJ-Vmoku9ACBGYxEkja41G=-vPuDqN34c0esLbGLnX8NM5Jspg@mail.gmail.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <CAJ-Vmoku9ACBGYxEkja41G=-vPuDqN34c0esLbGLnX8NM5Jspg@mail.gmail.com>
User-Agent: Mutt/1.4.2.3i
Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org, svn-src-stable-9@freebsd.org,
	Pyun YongHyeon <yongari@freebsd.org>
Subject: Re: svn commit: r235818 - stable/9/sys/dev/bce
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: pyunyh@gmail.com
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 24 May 2012 02:36:59 -0000

On Wed, May 23, 2012 at 10:55:18AM -0700, Adrian Chadd wrote:
> Hi,
> 
> Have you looked at the MDIO bus support that I brought in from Stefan?
> 
> This almost feels like a poster child for that - you'd write an MDIO
> bus driver for this particular mailbox hardware interface and modify
> the driver to use that, then the MDIO bus will automatically probe
> whatever PHYs exist there
> 

I'm not familiar with that code but I don't want to write another
driver just to access a couple of mailbox registers.

> That way it could be reused for other MDIO bus consumers too, such as
> switch PHYs and other MDIO-but-not-quite-PHY devices.

Not sure how well it fits to brgphy(4).

> 
> Adrian
> 
> On 22 May 2012 19:02, Pyun YongHyeon <yongari@freebsd.org> wrote:
> > Author: yongari
> > Date: Wed May 23 02:02:29 2012
> > New Revision: 235818
> > URL: http://svn.freebsd.org/changeset/base/235818
> >
> > Log:
> > ?MFC r235151:
> > ? ?Implement basic remote PHY support. Remote PHY allows the
> > ? ?controller to perform MDIO type accesses to a remote transceiver
> > ? ?using message pages defined through MRBE(multirate backplane
> > ? ?ethernet). ?It's used in blade systems(e.g Dell Blade m610) which
> > ? ?are connected to pass-through blades rather than traditional
> > ? ?switches.
> > ? ?This change directly manipulates firmware's mailboxes to control
> > ? ?remote PHY such that it does not use mii(4). ?Alternatively, as
> > ? ?David said, it could be implemented in brgphy(4) by creating a fake
> > ? ?PHY and let brgphy(4) do necessary mii accesses and bce(4) can
> > ? ?implement mailbox accesses based on the type of brgphy(4)'s mii
> > ? ?accesses. Personally, I think it would make brgphy(4) hard to
> > ? ?maintain since it would have to access many bce(4) registers in
> > ? ?brgphy(4). Given that there are users who are suffering from lack
> > ? ?of remote PHY support, it would be better to get working system
> > ? ?rather than waiting for complete/perfect implementation.
> >
> > Modified:
> > ?stable/9/sys/dev/bce/if_bce.c
> > ?stable/9/sys/dev/bce/if_bcereg.h
> > Directory Properties:
> > ?stable/9/sys/ ? (props changed)
> > ?stable/9/sys/amd64/include/xen/ ? (props changed)
> > ?stable/9/sys/boot/ ? (props changed)
> > ?stable/9/sys/boot/i386/efi/ ? (props changed)
> > ?stable/9/sys/boot/ia64/efi/ ? (props changed)
> > ?stable/9/sys/boot/ia64/ski/ ? (props changed)
> > ?stable/9/sys/boot/powerpc/boot1.chrp/ ? (props changed)
> > ?stable/9/sys/boot/powerpc/ofw/ ? (props changed)
> > ?stable/9/sys/cddl/contrib/opensolaris/ ? (props changed)
> > ?stable/9/sys/conf/ ? (props changed)
> > ?stable/9/sys/contrib/dev/acpica/ ? (props changed)
> > ?stable/9/sys/contrib/octeon-sdk/ ? (props changed)
> > ?stable/9/sys/contrib/pf/ ? (props changed)
> > ?stable/9/sys/contrib/x86emu/ ? (props changed)
> > ?stable/9/sys/dev/ ? (props changed)
> > ?stable/9/sys/dev/e1000/ ? (props changed)
> > ?stable/9/sys/dev/ixgbe/ ? (props changed)
> > ?stable/9/sys/fs/ ? (props changed)
> > ?stable/9/sys/fs/ntfs/ ? (props changed)
> > ?stable/9/sys/modules/ ? (props changed)
> >
> > Modified: stable/9/sys/dev/bce/if_bce.c
> > ==============================================================================
> > --- stable/9/sys/dev/bce/if_bce.c ? ? ? Wed May 23 01:49:50 2012 ? ? ? ?(r235817)
> > +++ stable/9/sys/dev/bce/if_bce.c ? ? ? Wed May 23 02:02:29 2012 ? ? ? ?(r235818)
> > @@ -364,6 +364,7 @@ static int ?bce_nvram_write ? ? ? ? (struct bce
> > ?static void bce_get_rx_buffer_sizes(struct bce_softc *, int);
> > ?static void bce_get_media ? ? ? ? ? ? ? ? ? ? ?(struct bce_softc *);
> > ?static void bce_init_media ? ? ? ? ? ? ? ? ? ? (struct bce_softc *);
> > +static u32 bce_get_rphy_link ? ? ? ? ? (struct bce_softc *);
> > ?static void bce_dma_map_addr ? ? ? ? ? (void *, bus_dma_segment_t *, int, int);
> > ?static int ?bce_dma_alloc ? ? ? ? ? ? ? ? ? ? ?(device_t);
> > ?static void bce_dma_free ? ? ? ? ? ? ? ? ? ? ? (struct bce_softc *);
> > @@ -372,6 +373,7 @@ static void bce_release_resources ? (struc
> > ?/****************************************************************************/
> > ?/* BCE Firmware Synchronization and Load ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?*/
> > ?/****************************************************************************/
> > +static void bce_fw_cap_init ? ? ? ? ? ? ? ? ? ?(struct bce_softc *);
> > ?static int ?bce_fw_sync ? ? ? ? ? ? ? ? ? ? ? ?(struct bce_softc *, u32);
> > ?static void bce_load_rv2p_fw ? ? ? ? ? (struct bce_softc *, u32 *, u32, u32);
> > ?static void bce_load_cpu_fw ? ? ? ? ? ?(struct bce_softc *,
> > @@ -418,6 +420,7 @@ static void bce_watchdog ? ? ? ? ? ? ? ? ? ?(struct bce_s
> > ?static int ?bce_ifmedia_upd ? ? ? ? ? ?(struct ifnet *);
> > ?static int ?bce_ifmedia_upd_locked ? ? (struct ifnet *);
> > ?static void bce_ifmedia_sts ? ? ? ? ? ?(struct ifnet *, struct ifmediareq *);
> > +static void bce_ifmedia_sts_rphy ? ? ? (struct bce_softc *, struct ifmediareq *);
> > ?static void bce_init_locked ? ? ? ? ? ?(struct bce_softc *);
> > ?static void bce_init ? ? ? ? ? ? ? ? ? ? ? ? ? (void *);
> > ?static void bce_mgmt_init_locked ? ? ? (struct bce_softc *sc);
> > @@ -757,6 +760,13 @@ bce_print_adapter_info(struct bce_softc
> > ? ? ? ? ? ? ? ? ? ? ? ?printf("2.5G"); i++;
> > ? ? ? ? ? ? ? ?}
> >
> > + ? ? ? ? ? ? ? if (sc->bce_phy_flags & BCE_PHY_REMOTE_CAP_FLAG) {
> > + ? ? ? ? ? ? ? ? ? ? ? if (i > 0) printf("|");
> > + ? ? ? ? ? ? ? ? ? ? ? printf("Remote PHY(%s)",
> > + ? ? ? ? ? ? ? ? ? ? ? ? ? sc->bce_phy_flags & BCE_PHY_REMOTE_PORT_FIBER_FLAG ?
> > + ? ? ? ? ? ? ? ? ? ? ? ? ? "FIBER" : "TP"); i++;
> > + ? ? ? ? ? ? ? }
> > +
> > ? ? ? ? ? ? ? ?if (sc->bce_flags & BCE_MFW_ENABLE_FLAG) {
> > ? ? ? ? ? ? ? ? ? ? ? ?if (i > 0) printf("|");
> > ? ? ? ? ? ? ? ? ? ? ? ?printf("MFW); MFW (%s)\n", sc->bce_mfw_ver);
> > @@ -1297,6 +1307,9 @@ bce_attach(device_t dev)
> > ? ? ? ?if (val & BCE_PCICFG_MISC_STATUS_32BIT_DET)
> > ? ? ? ? ? ? ? ?sc->bce_flags |= BCE_PCI_32BIT_FLAG;
> >
> > + ? ? ? /* Find the media type for the adapter. */
> > + ? ? ? bce_get_media(sc);
> > +
> > ? ? ? ?/* Reset controller and announce to bootcode that driver is present. */
> > ? ? ? ?if (bce_reset(sc, BCE_DRV_MSG_CODE_RESET)) {
> > ? ? ? ? ? ? ? ?BCE_PRINTF("%s(%d): Controller reset failed!\n",
> > @@ -1344,9 +1357,6 @@ bce_attach(device_t dev)
> > ? ? ? ?/* Update statistics once every second. */
> > ? ? ? ?sc->bce_stats_ticks = 1000000 & 0xffff00;
> >
> > - ? ? ? /* Find the media type for the adapter. */
> > - ? ? ? bce_get_media(sc);
> > -
> > ? ? ? ?/* Store data needed by PHY driver for backplane applications */
> > ? ? ? ?sc->bce_shared_hw_cfg = bce_shmem_rd(sc, BCE_SHARED_HW_CFG_CONFIG);
> > ? ? ? ?sc->bce_port_hw_cfg ? = bce_shmem_rd(sc, BCE_PORT_HW_CFG_CONFIG);
> > @@ -1386,6 +1396,15 @@ bce_attach(device_t dev)
> > ? ? ? ? ? ? ? ?ifp->if_capabilities = BCE_IF_CAPABILITIES;
> > ? ? ? ?}
> >
> > +#if __FreeBSD_version >= 800505
> > + ? ? ? /*
> > + ? ? ? ?* Introducing IFCAP_LINKSTATE didn't bump __FreeBSD_version
> > + ? ? ? ?* so it's approximate value.
> > + ? ? ? ?*/
> > + ? ? ? if ((sc->bce_phy_flags & BCE_PHY_REMOTE_CAP_FLAG) != 0)
> > + ? ? ? ? ? ? ? ifp->if_capabilities |= IFCAP_LINKSTATE;
> > +#endif
> > +
> > ? ? ? ?ifp->if_capenable = ifp->if_capabilities;
> >
> > ? ? ? ?/*
> > @@ -1409,14 +1428,52 @@ bce_attach(device_t dev)
> > ? ? ? ?/* Handle any special PHY initialization for SerDes PHYs. */
> > ? ? ? ?bce_init_media(sc);
> >
> > - ? ? ? /* MII child bus by attaching the PHY. */
> > - ? ? ? rc = mii_attach(dev, &sc->bce_miibus, ifp, bce_ifmedia_upd,
> > - ? ? ? ? ? bce_ifmedia_sts, BMSR_DEFCAPMASK, sc->bce_phy_addr,
> > - ? ? ? ? ? MII_OFFSET_ANY, MIIF_DOPAUSE);
> > - ? ? ? if (rc != 0) {
> > - ? ? ? ? ? ? ? BCE_PRINTF("%s(%d): attaching PHYs failed\n", __FILE__,
> > - ? ? ? ? ? ? ? ? ? __LINE__);
> > - ? ? ? ? ? ? ? goto bce_attach_fail;
> > + ? ? ? if ((sc->bce_phy_flags & BCE_PHY_REMOTE_CAP_FLAG) != 0) {
> > + ? ? ? ? ? ? ? ifmedia_init(&sc->bce_ifmedia, IFM_IMASK, bce_ifmedia_upd,
> > + ? ? ? ? ? ? ? ? ? bce_ifmedia_sts);
> > + ? ? ? ? ? ? ? /*
> > + ? ? ? ? ? ? ? ?* We can't manually override remote PHY's link and assume
> > + ? ? ? ? ? ? ? ?* PHY port configuration(Fiber or TP) is not changed after
> > + ? ? ? ? ? ? ? ?* device attach. ?This may not be correct though.
> > + ? ? ? ? ? ? ? ?*/
> > + ? ? ? ? ? ? ? if ((sc->bce_phy_flags & BCE_PHY_REMOTE_PORT_FIBER_FLAG) != 0) {
> > + ? ? ? ? ? ? ? ? ? ? ? if (sc->bce_phy_flags & BCE_PHY_2_5G_CAPABLE_FLAG) {
> > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ifmedia_add(&sc->bce_ifmedia,
> > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? IFM_ETHER | IFM_2500_SX, 0, NULL);
> > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ifmedia_add(&sc->bce_ifmedia,
> > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? IFM_ETHER | IFM_2500_SX | IFM_FDX, 0, NULL);
> > + ? ? ? ? ? ? ? ? ? ? ? }
> > + ? ? ? ? ? ? ? ? ? ? ? ifmedia_add(&sc->bce_ifmedia,
> > + ? ? ? ? ? ? ? ? ? ? ? ? ? IFM_ETHER | IFM_1000_SX, 0, NULL);
> > + ? ? ? ? ? ? ? ? ? ? ? ifmedia_add(&sc->bce_ifmedia,
> > + ? ? ? ? ? ? ? ? ? ? ? ? ? IFM_ETHER | IFM_1000_SX | IFM_FDX, 0, NULL);
> > + ? ? ? ? ? ? ? } else {
> > + ? ? ? ? ? ? ? ? ? ? ? ifmedia_add(&sc->bce_ifmedia,
> > + ? ? ? ? ? ? ? ? ? ? ? ? ? IFM_ETHER | IFM_10_T, 0, NULL);
> > + ? ? ? ? ? ? ? ? ? ? ? ifmedia_add(&sc->bce_ifmedia,
> > + ? ? ? ? ? ? ? ? ? ? ? ? ? IFM_ETHER | IFM_10_T | IFM_FDX, 0, NULL);
> > + ? ? ? ? ? ? ? ? ? ? ? ifmedia_add(&sc->bce_ifmedia,
> > + ? ? ? ? ? ? ? ? ? ? ? ? ? IFM_ETHER | IFM_100_TX, 0, NULL);
> > + ? ? ? ? ? ? ? ? ? ? ? ifmedia_add(&sc->bce_ifmedia,
> > + ? ? ? ? ? ? ? ? ? ? ? ? ? IFM_ETHER | IFM_100_TX | IFM_FDX, 0, NULL);
> > + ? ? ? ? ? ? ? ? ? ? ? ifmedia_add(&sc->bce_ifmedia,
> > + ? ? ? ? ? ? ? ? ? ? ? ? ? IFM_ETHER | IFM_1000_T, 0, NULL);
> > + ? ? ? ? ? ? ? ? ? ? ? ifmedia_add(&sc->bce_ifmedia,
> > + ? ? ? ? ? ? ? ? ? ? ? ? ? IFM_ETHER | IFM_1000_T | IFM_FDX, 0, NULL);
> > + ? ? ? ? ? ? ? }
> > + ? ? ? ? ? ? ? ifmedia_add(&sc->bce_ifmedia, IFM_ETHER | IFM_AUTO, 0, NULL);
> > + ? ? ? ? ? ? ? ifmedia_set(&sc->bce_ifmedia, IFM_ETHER | IFM_AUTO);
> > + ? ? ? ? ? ? ? sc->bce_ifmedia.ifm_media = sc->bce_ifmedia.ifm_cur->ifm_media;
> > + ? ? ? } else {
> > + ? ? ? ? ? ? ? /* MII child bus by attaching the PHY. */
> > + ? ? ? ? ? ? ? rc = mii_attach(dev, &sc->bce_miibus, ifp, bce_ifmedia_upd,
> > + ? ? ? ? ? ? ? ? ? bce_ifmedia_sts, BMSR_DEFCAPMASK, sc->bce_phy_addr,
> > + ? ? ? ? ? ? ? ? ? MII_OFFSET_ANY, MIIF_DOPAUSE);
> > + ? ? ? ? ? ? ? if (rc != 0) {
> > + ? ? ? ? ? ? ? ? ? ? ? BCE_PRINTF("%s(%d): attaching PHYs failed\n", __FILE__,
> > + ? ? ? ? ? ? ? ? ? ? ? ? ? __LINE__);
> > + ? ? ? ? ? ? ? ? ? ? ? goto bce_attach_fail;
> > + ? ? ? ? ? ? ? }
> > ? ? ? ?}
> >
> > ? ? ? ?/* Attach to the Ethernet interface list. */
> > @@ -1521,8 +1578,12 @@ bce_detach(device_t dev)
> > ? ? ? ?ether_ifdetach(ifp);
> >
> > ? ? ? ?/* If we have a child device on the MII bus remove it too. */
> > - ? ? ? bus_generic_detach(dev);
> > - ? ? ? device_delete_child(dev, sc->bce_miibus);
> > + ? ? ? if ((sc->bce_phy_flags & BCE_PHY_REMOTE_CAP_FLAG) != 0)
> > + ? ? ? ? ? ? ? ifmedia_removeall(&sc->bce_ifmedia);
> > + ? ? ? else {
> > + ? ? ? ? ? ? ? bus_generic_detach(dev);
> > + ? ? ? ? ? ? ? device_delete_child(dev, sc->bce_miibus);
> > + ? ? ? }
> >
> > ? ? ? ?/* Release all remaining resources. */
> > ? ? ? ?bce_release_resources(sc);
> > @@ -1983,13 +2044,23 @@ bce_miibus_statchg(device_t dev)
> > ?{
> > ? ? ? ?struct bce_softc *sc;
> > ? ? ? ?struct mii_data *mii;
> > - ? ? ? int val;
> > + ? ? ? struct ifmediareq ifmr;
> > + ? ? ? int media_active, media_status, val;
> >
> > ? ? ? ?sc = device_get_softc(dev);
> >
> > ? ? ? ?DBENTER(BCE_VERBOSE_PHY);
> >
> > - ? ? ? mii = device_get_softc(sc->bce_miibus);
> > + ? ? ? if ((sc->bce_phy_flags & BCE_PHY_REMOTE_CAP_FLAG) != 0) {
> > + ? ? ? ? ? ? ? bzero(&ifmr, sizeof(ifmr));
> > + ? ? ? ? ? ? ? bce_ifmedia_sts_rphy(sc, &ifmr);
> > + ? ? ? ? ? ? ? media_active = ifmr.ifm_active;
> > + ? ? ? ? ? ? ? media_status = ifmr.ifm_status;
> > + ? ? ? } else {
> > + ? ? ? ? ? ? ? mii = device_get_softc(sc->bce_miibus);
> > + ? ? ? ? ? ? ? media_active = mii->mii_media_active;
> > + ? ? ? ? ? ? ? media_status = mii->mii_media_status;
> > + ? ? ? }
> >
> > ? ? ? ?val = REG_RD(sc, BCE_EMAC_MODE);
> > ? ? ? ?val &= ~(BCE_EMAC_MODE_PORT | BCE_EMAC_MODE_HALF_DUPLEX |
> > @@ -1997,7 +2068,7 @@ bce_miibus_statchg(device_t dev)
> > ? ? ? ? ? ?BCE_EMAC_MODE_25G);
> >
> > ? ? ? ?/* Set MII or GMII interface based on the PHY speed. */
> > - ? ? ? switch (IFM_SUBTYPE(mii->mii_media_active)) {
> > + ? ? ? switch (IFM_SUBTYPE(media_active)) {
> > ? ? ? ?case IFM_10_T:
> > ? ? ? ? ? ? ? ?if (BCE_CHIP_NUM(sc) != BCE_CHIP_NUM_5706) {
> > ? ? ? ? ? ? ? ? ? ? ? ?DBPRINT(sc, BCE_INFO_PHY,
> > @@ -2026,7 +2097,7 @@ bce_miibus_statchg(device_t dev)
> > ? ? ? ?}
> >
> > ? ? ? ?/* Set half or full duplex based on PHY settings. */
> > - ? ? ? if ((mii->mii_media_active & IFM_GMASK) == IFM_HDX) {
> > + ? ? ? if ((IFM_OPTIONS(media_active) & IFM_FDX) == 0) {
> > ? ? ? ? ? ? ? ?DBPRINT(sc, BCE_INFO_PHY,
> > ? ? ? ? ? ? ? ? ? ?"Setting Half-Duplex interface.\n");
> > ? ? ? ? ? ? ? ?val |= BCE_EMAC_MODE_HALF_DUPLEX;
> > @@ -2036,7 +2107,7 @@ bce_miibus_statchg(device_t dev)
> >
> > ? ? ? ?REG_WR(sc, BCE_EMAC_MODE, val);
> >
> > - ? ? ? if ((mii->mii_media_active & IFM_ETH_RXPAUSE) != 0) {
> > + ? ? ? if ((IFM_OPTIONS(media_active) & IFM_ETH_RXPAUSE) != 0) {
> > ? ? ? ? ? ? ? ?DBPRINT(sc, BCE_INFO_PHY,
> > ? ? ? ? ? ? ? ? ? ?"%s(): Enabling RX flow control.\n", __FUNCTION__);
> > ? ? ? ? ? ? ? ?BCE_SETBIT(sc, BCE_EMAC_RX_MODE, BCE_EMAC_RX_MODE_FLOW_EN);
> > @@ -2046,7 +2117,7 @@ bce_miibus_statchg(device_t dev)
> > ? ? ? ? ? ? ? ?BCE_CLRBIT(sc, BCE_EMAC_RX_MODE, BCE_EMAC_RX_MODE_FLOW_EN);
> > ? ? ? ?}
> >
> > - ? ? ? if ((mii->mii_media_active & IFM_ETH_TXPAUSE) != 0) {
> > + ? ? ? if ((IFM_OPTIONS(media_active) & IFM_ETH_TXPAUSE) != 0) {
> > ? ? ? ? ? ? ? ?DBPRINT(sc, BCE_INFO_PHY,
> > ? ? ? ? ? ? ? ? ? ?"%s(): Enabling TX flow control.\n", __FUNCTION__);
> > ? ? ? ? ? ? ? ?BCE_SETBIT(sc, BCE_EMAC_TX_MODE, BCE_EMAC_TX_MODE_FLOW_EN);
> > @@ -3130,7 +3201,8 @@ bce_get_media_exit:
> > ?static void
> > ?bce_init_media(struct bce_softc *sc)
> > ?{
> > - ? ? ? if ((sc->bce_phy_flags & BCE_PHY_IEEE_CLAUSE_45_FLAG) != 0) {
> > + ? ? ? if ((sc->bce_phy_flags & (BCE_PHY_IEEE_CLAUSE_45_FLAG |
> > + ? ? ? ? ? BCE_PHY_REMOTE_CAP_FLAG)) == BCE_PHY_IEEE_CLAUSE_45_FLAG) {
> > ? ? ? ? ? ? ? ?/*
> > ? ? ? ? ? ? ? ? * Configure 5709S/5716S PHYs to use traditional IEEE
> > ? ? ? ? ? ? ? ? * Clause 22 method. Otherwise we have no way to attach
> > @@ -5018,6 +5090,8 @@ bce_reset(struct bce_softc *sc, u32 rese
> > ? ? ? ?if (rc)
> > ? ? ? ? ? ? ? ?BCE_PRINTF("%s(%d): Firmware did not complete "
> > ? ? ? ? ? ? ? ? ? ?"initialization!\n", __FILE__, __LINE__);
> > + ? ? ? /* Get firmware capabilities. */
> > + ? ? ? bce_fw_cap_init(sc);
> >
> > ?bce_reset_exit:
> > ? ? ? ?DBEXIT(BCE_VERBOSE_RESET);
> > @@ -6081,6 +6155,55 @@ bce_free_pg_chain(struct bce_softc *sc)
> > ?}
> >
> >
> > +static u32
> > +bce_get_rphy_link(struct bce_softc *sc)
> > +{
> > + ? ? ? u32 advertise, link;
> > + ? ? ? int fdpx;
> > +
> > + ? ? ? advertise = 0;
> > + ? ? ? fdpx = 0;
> > + ? ? ? if ((sc->bce_phy_flags & BCE_PHY_REMOTE_PORT_FIBER_FLAG) != 0)
> > + ? ? ? ? ? ? ? link = bce_shmem_rd(sc, BCE_RPHY_SERDES_LINK);
> > + ? ? ? else
> > + ? ? ? ? ? ? ? link = bce_shmem_rd(sc, BCE_RPHY_COPPER_LINK);
> > + ? ? ? if (link & BCE_NETLINK_ANEG_ENB)
> > + ? ? ? ? ? ? ? advertise |= BCE_NETLINK_ANEG_ENB;
> > + ? ? ? if (link & BCE_NETLINK_SPEED_10HALF)
> > + ? ? ? ? ? ? ? advertise |= BCE_NETLINK_SPEED_10HALF;
> > + ? ? ? if (link & BCE_NETLINK_SPEED_10FULL) {
> > + ? ? ? ? ? ? ? advertise |= BCE_NETLINK_SPEED_10FULL;
> > + ? ? ? ? ? ? ? fdpx++;
> > + ? ? ? }
> > + ? ? ? if (link & BCE_NETLINK_SPEED_100HALF)
> > + ? ? ? ? ? ? ? advertise |= BCE_NETLINK_SPEED_100HALF;
> > + ? ? ? if (link & BCE_NETLINK_SPEED_100FULL) {
> > + ? ? ? ? ? ? ? advertise |= BCE_NETLINK_SPEED_100FULL;
> > + ? ? ? ? ? ? ? fdpx++;
> > + ? ? ? }
> > + ? ? ? if (link & BCE_NETLINK_SPEED_1000HALF)
> > + ? ? ? ? ? ? ? advertise |= BCE_NETLINK_SPEED_1000HALF;
> > + ? ? ? if (link & BCE_NETLINK_SPEED_1000FULL) {
> > + ? ? ? ? ? ? ? advertise |= BCE_NETLINK_SPEED_1000FULL;
> > + ? ? ? ? ? ? ? fdpx++;
> > + ? ? ? }
> > + ? ? ? if (link & BCE_NETLINK_SPEED_2500HALF)
> > + ? ? ? ? ? ? ? advertise |= BCE_NETLINK_SPEED_2500HALF;
> > + ? ? ? if (link & BCE_NETLINK_SPEED_2500FULL) {
> > + ? ? ? ? ? ? ? advertise |= BCE_NETLINK_SPEED_2500FULL;
> > + ? ? ? ? ? ? ? fdpx++;
> > + ? ? ? }
> > + ? ? ? if (fdpx)
> > + ? ? ? ? ? ? ? advertise |= BCE_NETLINK_FC_PAUSE_SYM |
> > + ? ? ? ? ? ? ? ? ? BCE_NETLINK_FC_PAUSE_ASYM;
> > + ? ? ? if ((sc->bce_phy_flags & BCE_PHY_REMOTE_PORT_FIBER_FLAG) == 0)
> > + ? ? ? ? ? ? ? advertise |= BCE_NETLINK_PHY_APP_REMOTE |
> > + ? ? ? ? ? ? ? ? ? BCE_NETLINK_ETH_AT_WIRESPEED;
> > +
> > + ? ? ? return (advertise);
> > +}
> > +
> > +
> > ?/****************************************************************************/
> > ?/* Set media options. ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? */
> > ?/* ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?*/
> > @@ -6116,21 +6239,110 @@ bce_ifmedia_upd_locked(struct ifnet *ifp
> > ? ? ? ?struct bce_softc *sc = ifp->if_softc;
> > ? ? ? ?struct mii_data *mii;
> > ? ? ? ?struct mii_softc *miisc;
> > - ? ? ? int error;
> > + ? ? ? struct ifmedia *ifm;
> > + ? ? ? u32 link;
> > + ? ? ? int error, fdx;
> >
> > ? ? ? ?DBENTER(BCE_VERBOSE_PHY);
> >
> > ? ? ? ?error = 0;
> > ? ? ? ?BCE_LOCK_ASSERT(sc);
> >
> > - ? ? ? mii = device_get_softc(sc->bce_miibus);
> > + ? ? ? sc->bce_link_up = FALSE;
> > + ? ? ? if ((sc->bce_phy_flags & BCE_PHY_REMOTE_CAP_FLAG) != 0) {
> > + ? ? ? ? ? ? ? ifm = &sc->bce_ifmedia;
> > + ? ? ? ? ? ? ? if (IFM_TYPE(ifm->ifm_media) != IFM_ETHER)
> > + ? ? ? ? ? ? ? ? ? ? ? return (EINVAL);
> > + ? ? ? ? ? ? ? link = 0;
> > + ? ? ? ? ? ? ? fdx = IFM_OPTIONS(ifm->ifm_media) & IFM_FDX;
> > + ? ? ? ? ? ? ? switch(IFM_SUBTYPE(ifm->ifm_media)) {
> > + ? ? ? ? ? ? ? case IFM_AUTO:
> > + ? ? ? ? ? ? ? ? ? ? ? /*
> > + ? ? ? ? ? ? ? ? ? ? ? ?* Check advertised link of remote PHY by reading
> > + ? ? ? ? ? ? ? ? ? ? ? ?* BCE_RPHY_SERDES_LINK or BCE_RPHY_COPPER_LINK.
> > + ? ? ? ? ? ? ? ? ? ? ? ?* Always use the same link type of remote PHY.
> > + ? ? ? ? ? ? ? ? ? ? ? ?*/
> > + ? ? ? ? ? ? ? ? ? ? ? link = bce_get_rphy_link(sc);
> > + ? ? ? ? ? ? ? ? ? ? ? break;
> > + ? ? ? ? ? ? ? case IFM_2500_SX:
> > + ? ? ? ? ? ? ? ? ? ? ? if ((sc->bce_phy_flags &
> > + ? ? ? ? ? ? ? ? ? ? ? ? ? (BCE_PHY_REMOTE_PORT_FIBER_FLAG |
> > + ? ? ? ? ? ? ? ? ? ? ? ? ? BCE_PHY_2_5G_CAPABLE_FLAG)) == 0)
> > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? return (EINVAL);
> > + ? ? ? ? ? ? ? ? ? ? ? /*
> > + ? ? ? ? ? ? ? ? ? ? ? ?* XXX
> > + ? ? ? ? ? ? ? ? ? ? ? ?* Have to enable forced 2.5Gbps configuration.
> > + ? ? ? ? ? ? ? ? ? ? ? ?*/
> > + ? ? ? ? ? ? ? ? ? ? ? if (fdx != 0)
> > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? link |= BCE_NETLINK_SPEED_2500FULL;
> > + ? ? ? ? ? ? ? ? ? ? ? else
> > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? link |= BCE_NETLINK_SPEED_2500HALF;
> > + ? ? ? ? ? ? ? ? ? ? ? break;
> > + ? ? ? ? ? ? ? case IFM_1000_SX:
> > + ? ? ? ? ? ? ? ? ? ? ? if ((sc->bce_phy_flags &
> > + ? ? ? ? ? ? ? ? ? ? ? ? ? BCE_PHY_REMOTE_PORT_FIBER_FLAG) == 0)
> > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? return (EINVAL);
> > + ? ? ? ? ? ? ? ? ? ? ? /*
> > + ? ? ? ? ? ? ? ? ? ? ? ?* XXX
> > + ? ? ? ? ? ? ? ? ? ? ? ?* Have to disable 2.5Gbps configuration.
> > + ? ? ? ? ? ? ? ? ? ? ? ?*/
> > + ? ? ? ? ? ? ? ? ? ? ? if (fdx != 0)
> > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? link = BCE_NETLINK_SPEED_1000FULL;
> > + ? ? ? ? ? ? ? ? ? ? ? else
> > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? link = BCE_NETLINK_SPEED_1000HALF;
> > + ? ? ? ? ? ? ? ? ? ? ? break;
> > + ? ? ? ? ? ? ? case IFM_1000_T:
> > + ? ? ? ? ? ? ? ? ? ? ? if (sc->bce_phy_flags & BCE_PHY_REMOTE_PORT_FIBER_FLAG)
> > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? return (EINVAL);
> > + ? ? ? ? ? ? ? ? ? ? ? if (fdx != 0)
> > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? link = BCE_NETLINK_SPEED_1000FULL;
> > + ? ? ? ? ? ? ? ? ? ? ? else
> > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? link = BCE_NETLINK_SPEED_1000HALF;
> > + ? ? ? ? ? ? ? ? ? ? ? break;
> > + ? ? ? ? ? ? ? case IFM_100_TX:
> > + ? ? ? ? ? ? ? ? ? ? ? if (sc->bce_phy_flags & BCE_PHY_REMOTE_PORT_FIBER_FLAG)
> > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? return (EINVAL);
> > + ? ? ? ? ? ? ? ? ? ? ? if (fdx != 0)
> > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? link = BCE_NETLINK_SPEED_100FULL;
> > + ? ? ? ? ? ? ? ? ? ? ? else
> > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? link = BCE_NETLINK_SPEED_100HALF;
> > + ? ? ? ? ? ? ? ? ? ? ? break;
> > + ? ? ? ? ? ? ? case IFM_10_T:
> > + ? ? ? ? ? ? ? ? ? ? ? if (sc->bce_phy_flags & BCE_PHY_REMOTE_PORT_FIBER_FLAG)
> > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? return (EINVAL);
> > + ? ? ? ? ? ? ? ? ? ? ? if (fdx != 0)
> > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? link = BCE_NETLINK_SPEED_10FULL;
> > + ? ? ? ? ? ? ? ? ? ? ? else
> > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? link = BCE_NETLINK_SPEED_10HALF;
> > + ? ? ? ? ? ? ? ? ? ? ? break;
> > + ? ? ? ? ? ? ? default:
> > + ? ? ? ? ? ? ? ? ? ? ? return (EINVAL);
> > + ? ? ? ? ? ? ? }
> > + ? ? ? ? ? ? ? if (IFM_SUBTYPE(ifm->ifm_media) != IFM_AUTO) {
> > + ? ? ? ? ? ? ? ? ? ? ? /*
> > + ? ? ? ? ? ? ? ? ? ? ? ?* XXX
> > + ? ? ? ? ? ? ? ? ? ? ? ?* Advertise pause capability for full-duplex media.
> > + ? ? ? ? ? ? ? ? ? ? ? ?*/
> > + ? ? ? ? ? ? ? ? ? ? ? if (fdx != 0)
> > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? link |= BCE_NETLINK_FC_PAUSE_SYM |
> > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? BCE_NETLINK_FC_PAUSE_ASYM;
> > + ? ? ? ? ? ? ? ? ? ? ? if ((sc->bce_phy_flags &
> > + ? ? ? ? ? ? ? ? ? ? ? ? ? BCE_PHY_REMOTE_PORT_FIBER_FLAG) == 0)
> > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? link |= BCE_NETLINK_PHY_APP_REMOTE |
> > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? BCE_NETLINK_ETH_AT_WIRESPEED;
> > + ? ? ? ? ? ? ? }
> >
> > - ? ? ? /* Make sure the MII bus has been enumerated. */
> > - ? ? ? if (mii) {
> > - ? ? ? ? ? ? ? sc->bce_link_up = FALSE;
> > - ? ? ? ? ? ? ? LIST_FOREACH(miisc, &mii->mii_phys, mii_list)
> > - ? ? ? ? ? ? ? ? ? PHY_RESET(miisc);
> > - ? ? ? ? ? ? ? error = mii_mediachg(mii);
> > + ? ? ? ? ? ? ? bce_shmem_wr(sc, BCE_MB_ARGS_0, link);
> > + ? ? ? ? ? ? ? error = bce_fw_sync(sc, BCE_DRV_MSG_CODE_CMD_SET_LINK);
> > + ? ? ? } else {
> > + ? ? ? ? ? ? ? mii = device_get_softc(sc->bce_miibus);
> > +
> > + ? ? ? ? ? ? ? /* Make sure the MII bus has been enumerated. */
> > + ? ? ? ? ? ? ? if (mii) {
> > + ? ? ? ? ? ? ? ? ? ? ? LIST_FOREACH(miisc, &mii->mii_phys, mii_list)
> > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? PHY_RESET(miisc);
> > + ? ? ? ? ? ? ? ? ? ? ? error = mii_mediachg(mii);
> > + ? ? ? ? ? ? ? }
> > ? ? ? ?}
> >
> > ? ? ? ?DBEXIT(BCE_VERBOSE_PHY);
> > @@ -6138,6 +6350,85 @@ bce_ifmedia_upd_locked(struct ifnet *ifp
> > ?}
> >
> >
> > +static void
> > +bce_ifmedia_sts_rphy(struct bce_softc *sc, struct ifmediareq *ifmr)
> > +{
> > + ? ? ? struct ifnet *ifp;
> > + ? ? ? u32 link;
> > +
> > + ? ? ? ifp = sc->bce_ifp;
> > + ? ? ? BCE_LOCK_ASSERT(sc);
> > +
> > + ? ? ? ifmr->ifm_status = IFM_AVALID;
> > + ? ? ? ifmr->ifm_active = IFM_ETHER;
> > + ? ? ? link = bce_shmem_rd(sc, BCE_LINK_STATUS);
> > + ? ? ? /* XXX Handle heart beat status? */
> > + ? ? ? if ((link & BCE_LINK_STATUS_LINK_UP) != 0)
> > + ? ? ? ? ? ? ? ifmr->ifm_status |= IFM_ACTIVE;
> > + ? ? ? else {
> > + ? ? ? ? ? ? ? ifmr->ifm_active |= IFM_NONE;
> > + ? ? ? ? ? ? ? ifp->if_baudrate = 0;
> > + ? ? ? ? ? ? ? return;
> > + ? ? ? }
> > + ? ? ? switch (link & BCE_LINK_STATUS_SPEED_MASK) {
> > + ? ? ? case BCE_LINK_STATUS_10HALF:
> > + ? ? ? ? ? ? ? ifmr->ifm_active |= IFM_10_T | IFM_HDX;
> > + ? ? ? ? ? ? ? ifp->if_baudrate = IF_Mbps(10UL);
> > + ? ? ? ? ? ? ? break;
> > + ? ? ? case BCE_LINK_STATUS_10FULL:
> > + ? ? ? ? ? ? ? ifmr->ifm_active |= IFM_10_T | IFM_FDX;
> > + ? ? ? ? ? ? ? ifp->if_baudrate = IF_Mbps(10UL);
> > + ? ? ? ? ? ? ? break;
> > + ? ? ? case BCE_LINK_STATUS_100HALF:
> > + ? ? ? ? ? ? ? ifmr->ifm_active |= IFM_100_TX | IFM_HDX;
> > + ? ? ? ? ? ? ? ifp->if_baudrate = IF_Mbps(100UL);
> > + ? ? ? ? ? ? ? break;
> > + ? ? ? case BCE_LINK_STATUS_100FULL:
> > + ? ? ? ? ? ? ? ifmr->ifm_active |= IFM_100_TX | IFM_FDX;
> > + ? ? ? ? ? ? ? ifp->if_baudrate = IF_Mbps(100UL);
> > + ? ? ? ? ? ? ? break;
> > + ? ? ? case BCE_LINK_STATUS_1000HALF:
> > + ? ? ? ? ? ? ? if ((sc->bce_phy_flags & BCE_PHY_REMOTE_PORT_FIBER_FLAG) == 0)
> > + ? ? ? ? ? ? ? ? ? ? ? ifmr->ifm_active |= IFM_1000_T | IFM_HDX;
> > + ? ? ? ? ? ? ? else
> > + ? ? ? ? ? ? ? ? ? ? ? ifmr->ifm_active |= IFM_1000_SX | IFM_HDX;
> > + ? ? ? ? ? ? ? ifp->if_baudrate = IF_Mbps(1000UL);
> > + ? ? ? ? ? ? ? break;
> > + ? ? ? case BCE_LINK_STATUS_1000FULL:
> > + ? ? ? ? ? ? ? if ((sc->bce_phy_flags & BCE_PHY_REMOTE_PORT_FIBER_FLAG) == 0)
> > + ? ? ? ? ? ? ? ? ? ? ? ifmr->ifm_active |= IFM_1000_T | IFM_FDX;
> > + ? ? ? ? ? ? ? else
> > + ? ? ? ? ? ? ? ? ? ? ? ifmr->ifm_active |= IFM_1000_SX | IFM_FDX;
> > + ? ? ? ? ? ? ? ifp->if_baudrate = IF_Mbps(1000UL);
> > + ? ? ? ? ? ? ? break;
> > + ? ? ? case BCE_LINK_STATUS_2500HALF:
> > + ? ? ? ? ? ? ? if ((sc->bce_phy_flags & BCE_PHY_REMOTE_PORT_FIBER_FLAG) == 0) {
> > + ? ? ? ? ? ? ? ? ? ? ? ifmr->ifm_active |= IFM_NONE;
> > + ? ? ? ? ? ? ? ? ? ? ? return;
> > + ? ? ? ? ? ? ? } else
> > + ? ? ? ? ? ? ? ? ? ? ? ifmr->ifm_active |= IFM_2500_SX | IFM_HDX;
> > + ? ? ? ? ? ? ? ifp->if_baudrate = IF_Mbps(2500UL);
> > + ? ? ? ? ? ? ? break;
> > + ? ? ? case BCE_LINK_STATUS_2500FULL:
> > + ? ? ? ? ? ? ? if ((sc->bce_phy_flags & BCE_PHY_REMOTE_PORT_FIBER_FLAG) == 0) {
> > + ? ? ? ? ? ? ? ? ? ? ? ifmr->ifm_active |= IFM_NONE;
> > + ? ? ? ? ? ? ? ? ? ? ? return;
> > + ? ? ? ? ? ? ? } else
> > + ? ? ? ? ? ? ? ? ? ? ? ifmr->ifm_active |= IFM_2500_SX | IFM_FDX;
> > + ? ? ? ? ? ? ? ifp->if_baudrate = IF_Mbps(2500UL);
> > + ? ? ? ? ? ? ? break;
> > + ? ? ? default:
> > + ? ? ? ? ? ? ? ifmr->ifm_active |= IFM_NONE;
> > + ? ? ? ? ? ? ? return;
> > + ? ? ? }
> > +
> > + ? ? ? if ((link & BCE_LINK_STATUS_RX_FC_ENABLED) != 0)
> > + ? ? ? ? ? ? ? ifmr->ifm_active |= IFM_ETH_RXPAUSE;
> > + ? ? ? if ((link & BCE_LINK_STATUS_TX_FC_ENABLED) != 0)
> > + ? ? ? ? ? ? ? ifmr->ifm_active |= IFM_ETH_TXPAUSE;
> > +}
> > +
> > +
> > ?/****************************************************************************/
> > ?/* Reports current media status. ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?*/
> > ?/* ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?*/
> > @@ -6158,11 +6449,15 @@ bce_ifmedia_sts(struct ifnet *ifp, struc
> > ? ? ? ? ? ? ? ?BCE_UNLOCK(sc);
> > ? ? ? ? ? ? ? ?return;
> > ? ? ? ?}
> > - ? ? ? mii = device_get_softc(sc->bce_miibus);
> >
> > - ? ? ? mii_pollstat(mii);
> > - ? ? ? ifmr->ifm_active = mii->mii_media_active;
> > - ? ? ? ifmr->ifm_status = mii->mii_media_status;
> > + ? ? ? if ((sc->bce_phy_flags & BCE_PHY_REMOTE_CAP_FLAG) != 0)
> > + ? ? ? ? ? ? ? bce_ifmedia_sts_rphy(sc, ifmr);
> > + ? ? ? else {
> > + ? ? ? ? ? ? ? mii = device_get_softc(sc->bce_miibus);
> > + ? ? ? ? ? ? ? mii_pollstat(mii);
> > + ? ? ? ? ? ? ? ifmr->ifm_active = mii->mii_media_active;
> > + ? ? ? ? ? ? ? ifmr->ifm_status = mii->mii_media_status;
> > + ? ? ? }
> >
> > ? ? ? ?BCE_UNLOCK(sc);
> >
> > @@ -6199,14 +6494,26 @@ bce_phy_intr(struct bce_softc *sc)
> > ? ? ? ? ? ? ? ? ? ? ? ? ? ?STATUS_ATTN_BITS_LINK_STATE);
> > ? ? ? ? ? ? ? ? ? ? ? ?DBPRINT(sc, BCE_INFO_PHY, "%s(): Link is now UP.\n",
> > ? ? ? ? ? ? ? ? ? ? ? ? ? ?__FUNCTION__);
> > - ? ? ? ? ? ? ? }
> > - ? ? ? ? ? ? ? else {
> > + ? ? ? ? ? ? ? } else {
> > ? ? ? ? ? ? ? ? ? ? ? ?REG_WR(sc, BCE_PCICFG_STATUS_BIT_CLEAR_CMD,
> > ? ? ? ? ? ? ? ? ? ? ? ? ? ?STATUS_ATTN_BITS_LINK_STATE);
> > ? ? ? ? ? ? ? ? ? ? ? ?DBPRINT(sc, BCE_INFO_PHY, "%s(): Link is now DOWN.\n",
> > ? ? ? ? ? ? ? ? ? ? ? ? ? ?__FUNCTION__);
> > ? ? ? ? ? ? ? ?}
> >
> > + ? ? ? ? ? ? ? if ((sc->bce_phy_flags & BCE_PHY_REMOTE_CAP_FLAG) != 0) {
> > + ? ? ? ? ? ? ? ? ? ? ? if (new_link_state) {
> > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? if (bootverbose)
> > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? if_printf(sc->bce_ifp, "link UP\n");
> > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? if_link_state_change(sc->bce_ifp,
> > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? LINK_STATE_UP);
> > + ? ? ? ? ? ? ? ? ? ? ? } else {
> > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? if (bootverbose)
> > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? if_printf(sc->bce_ifp, "link DOWN\n");
> > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? if_link_state_change(sc->bce_ifp,
> > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? LINK_STATE_DOWN);
> > + ? ? ? ? ? ? ? ? ? ? ? }
> > + ? ? ? ? ? ? ? }
> > ? ? ? ? ? ? ? ?/*
> > ? ? ? ? ? ? ? ? * Assume link is down and allow
> > ? ? ? ? ? ? ? ? * tick routine to update the state
> > @@ -7495,10 +7802,14 @@ bce_ioctl(struct ifnet *ifp, u_long comm
> > ? ? ? ?case SIOCGIFMEDIA:
> > ? ? ? ? ? ? ? ?DBPRINT(sc, BCE_VERBOSE_MISC,
> > ? ? ? ? ? ? ? ? ? ?"Received SIOCSIFMEDIA/SIOCGIFMEDIA\n");
> > -
> > - ? ? ? ? ? ? ? mii = device_get_softc(sc->bce_miibus);
> > - ? ? ? ? ? ? ? error = ifmedia_ioctl(ifp, ifr,
> > - ? ? ? ? ? ? ? ? ? &mii->mii_media, command);
> > + ? ? ? ? ? ? ? if ((sc->bce_phy_flags & BCE_PHY_REMOTE_CAP_FLAG) != 0)
> > + ? ? ? ? ? ? ? ? ? ? ? error = ifmedia_ioctl(ifp, ifr, &sc->bce_ifmedia,
> > + ? ? ? ? ? ? ? ? ? ? ? ? ? command);
> > + ? ? ? ? ? ? ? else {
> > + ? ? ? ? ? ? ? ? ? ? ? mii = device_get_softc(sc->bce_miibus);
> > + ? ? ? ? ? ? ? ? ? ? ? error = ifmedia_ioctl(ifp, ifr, &mii->mii_media,
> > + ? ? ? ? ? ? ? ? ? ? ? ? ? command);
> > + ? ? ? ? ? ? ? }
> > ? ? ? ? ? ? ? ?break;
> >
> > ? ? ? ?/* Set interface capability */
> > @@ -8163,6 +8474,7 @@ bce_tick(void *xsc)
> > ? ? ? ?struct bce_softc *sc = xsc;
> > ? ? ? ?struct mii_data *mii;
> > ? ? ? ?struct ifnet *ifp;
> > + ? ? ? struct ifmediareq ifmr;
> >
> > ? ? ? ?ifp = sc->bce_ifp;
> >
> > @@ -8193,21 +8505,32 @@ bce_tick(void *xsc)
> > ? ? ? ? ? ? ? ?goto bce_tick_exit;
> >
> > ? ? ? ?/* Link is down. ?Check what the PHY's doing. */
> > - ? ? ? mii = device_get_softc(sc->bce_miibus);
> > - ? ? ? mii_tick(mii);
> > -
> > - ? ? ? /* Check if the link has come up. */
> > - ? ? ? if ((mii->mii_media_status & IFM_ACTIVE) &&
> > - ? ? ? ? ? (IFM_SUBTYPE(mii->mii_media_active) != IFM_NONE)) {
> > - ? ? ? ? ? ? ? DBPRINT(sc, BCE_VERBOSE_MISC,
> > - ? ? ? ? ? ? ? ? ? "%s(): Link up!\n", __FUNCTION__);
> > - ? ? ? ? ? ? ? sc->bce_link_up = TRUE;
> > - ? ? ? ? ? ? ? if ((IFM_SUBTYPE(mii->mii_media_active) == IFM_1000_T ||
> > - ? ? ? ? ? ? ? ? ? IFM_SUBTYPE(mii->mii_media_active) == IFM_1000_SX ||
> > - ? ? ? ? ? ? ? ? ? IFM_SUBTYPE(mii->mii_media_active) == IFM_2500_SX) &&
> > - ? ? ? ? ? ? ? ? ? (bce_verbose || bootverbose))
> > - ? ? ? ? ? ? ? ? ? ? ? BCE_PRINTF("Gigabit link up!\n");
> > + ? ? ? if ((sc->bce_phy_flags & BCE_PHY_REMOTE_CAP_FLAG) != 0) {
> > + ? ? ? ? ? ? ? bzero(&ifmr, sizeof(ifmr));
> > + ? ? ? ? ? ? ? bce_ifmedia_sts_rphy(sc, &ifmr);
> > + ? ? ? ? ? ? ? if ((ifmr.ifm_status & (IFM_ACTIVE | IFM_AVALID)) ==
> > + ? ? ? ? ? ? ? ? ? (IFM_ACTIVE | IFM_AVALID)) {
> > + ? ? ? ? ? ? ? ? ? ? ? sc->bce_link_up = TRUE;
> > + ? ? ? ? ? ? ? ? ? ? ? bce_miibus_statchg(sc->bce_dev);
> > + ? ? ? ? ? ? ? }
> > + ? ? ? } else {
> > + ? ? ? ? ? ? ? mii = device_get_softc(sc->bce_miibus);
> > + ? ? ? ? ? ? ? mii_tick(mii);
> > + ? ? ? ? ? ? ? /* Check if the link has come up. */
> > + ? ? ? ? ? ? ? if ((mii->mii_media_status & IFM_ACTIVE) &&
> > + ? ? ? ? ? ? ? ? ? (IFM_SUBTYPE(mii->mii_media_active) != IFM_NONE)) {
> > + ? ? ? ? ? ? ? ? ? ? ? DBPRINT(sc, BCE_VERBOSE_MISC, "%s(): Link up!\n",
> > + ? ? ? ? ? ? ? ? ? ? ? ? ? __FUNCTION__);
> > + ? ? ? ? ? ? ? ? ? ? ? sc->bce_link_up = TRUE;
> > + ? ? ? ? ? ? ? ? ? ? ? if ((IFM_SUBTYPE(mii->mii_media_active) == IFM_1000_T ||
> > + ? ? ? ? ? ? ? ? ? ? ? ? ? IFM_SUBTYPE(mii->mii_media_active) == IFM_1000_SX ||
> > + ? ? ? ? ? ? ? ? ? ? ? ? ? IFM_SUBTYPE(mii->mii_media_active) == IFM_2500_SX) &&
> > + ? ? ? ? ? ? ? ? ? ? ? ? ? (bce_verbose || bootverbose))
> > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? BCE_PRINTF("Gigabit link up!\n");
> > + ? ? ? ? ? ? ? }
> >
> > + ? ? ? }
> > + ? ? ? if (sc->bce_link_up == TRUE) {
> > ? ? ? ? ? ? ? ?/* Now that link is up, handle any outstanding TX traffic. */
> > ? ? ? ? ? ? ? ?if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) {
> > ? ? ? ? ? ? ? ? ? ? ? ?DBPRINT(sc, BCE_VERBOSE_MISC, "%s(): Found "
> > @@ -8221,6 +8544,36 @@ bce_tick_exit:
> > ? ? ? ?return;
> > ?}
> >
> > +static void
> > +bce_fw_cap_init(struct bce_softc *sc)
> > +{
> > + ? ? ? u32 ack, cap, link;
> > +
> > + ? ? ? ack = 0;
> > + ? ? ? cap = bce_shmem_rd(sc, BCE_FW_CAP_MB);
> > + ? ? ? if ((cap & BCE_FW_CAP_SIGNATURE_MAGIC_MASK) !=
> > + ? ? ? ? ? BCE_FW_CAP_SIGNATURE_MAGIC)
> > + ? ? ? ? ? ? ? return;
> > + ? ? ? if ((cap & (BCE_FW_CAP_MFW_KEEP_VLAN | BCE_FW_CAP_BC_KEEP_VLAN)) ==
> > + ? ? ? ? ? (BCE_FW_CAP_MFW_KEEP_VLAN | BCE_FW_CAP_BC_KEEP_VLAN))
> > + ? ? ? ? ? ? ? ack |= BCE_DRV_ACK_CAP_SIGNATURE_MAGIC |
> > + ? ? ? ? ? ? ? ? ? BCE_FW_CAP_MFW_KEEP_VLAN | BCE_FW_CAP_BC_KEEP_VLAN;
> > + ? ? ? if ((sc->bce_phy_flags & BCE_PHY_SERDES_FLAG) != 0 &&
> > + ? ? ? ? ? (cap & BCE_FW_CAP_REMOTE_PHY_CAP) != 0) {
> > + ? ? ? ? ? ? ? sc->bce_phy_flags &= ~BCE_PHY_REMOTE_PORT_FIBER_FLAG;
> > + ? ? ? ? ? ? ? sc->bce_phy_flags |= BCE_PHY_REMOTE_CAP_FLAG;
> > + ? ? ? ? ? ? ? link = bce_shmem_rd(sc, BCE_LINK_STATUS);
> > + ? ? ? ? ? ? ? if ((link & BCE_LINK_STATUS_SERDES_LINK) != 0)
> > + ? ? ? ? ? ? ? ? ? ? ? sc->bce_phy_flags |= BCE_PHY_REMOTE_PORT_FIBER_FLAG;
> > + ? ? ? ? ? ? ? ack |= BCE_DRV_ACK_CAP_SIGNATURE_MAGIC |
> > + ? ? ? ? ? ? ? ? ? BCE_FW_CAP_REMOTE_PHY_CAP;
> > + ? ? ? }
> > +
> > + ? ? ? if (ack != 0)
> > + ? ? ? ? ? ? ? bce_shmem_wr(sc, BCE_DRV_ACK_CAP_MB, ack);
> > +}
> > +
> > +
> > ?#ifdef BCE_DEBUG
> > ?/****************************************************************************/
> > ?/* Allows the driver state to be dumped through the sysctl interface. ? ? ? */
> >
> > Modified: stable/9/sys/dev/bce/if_bcereg.h
> > ==============================================================================
> > --- stable/9/sys/dev/bce/if_bcereg.h ? ?Wed May 23 01:49:50 2012 ? ? ? ?(r235817)
> > +++ stable/9/sys/dev/bce/if_bcereg.h ? ?Wed May 23 02:02:29 2012 ? ? ? ?(r235818)
> > @@ -814,6 +814,23 @@ struct flash_spec {
> > ?#define BCE_DRV_PULSE_SEQ_MASK ? ? ? ? ? ? ? ? ?0x00007fff
> >
> > ?#define BCE_MB_ARGS_0 ? ? ? ? ? ? ? ? ? ? ? ? ?0x00000014
> > +#define ? ? ? ?BCE_NETLINK_SPEED_10HALF ? ? ? ? ? ? ? ? (1<<0)
> > +#define ? ? ? ?BCE_NETLINK_SPEED_10FULL ? ? ? ? ? ? ? ? (1<<1)
> > +#define ? ? ? ?BCE_NETLINK_SPEED_100HALF ? ? ? ? ? ? ? ?(1<<2)
> > +#define ? ? ? ?BCE_NETLINK_SPEED_100FULL ? ? ? ? ? ? ? ?(1<<3)
> > +#define ? ? ? ?BCE_NETLINK_SPEED_1000HALF ? ? ? ? ? ? ? (1<<4)
> > +#define ? ? ? ?BCE_NETLINK_SPEED_1000FULL ? ? ? ? ? ? ? (1<<5)
> > +#define ? ? ? ?BCE_NETLINK_SPEED_2500HALF ? ? ? ? ? ? ? (1<<6)
> > +#define ? ? ? ?BCE_NETLINK_SPEED_2500FULL ? ? ? ? ? ? ? (1<<7)
> > +#define ? ? ? ?BCE_NETLINK_SPEED_10GHALF ? ? ? ? ? ? ? ?(1<<8)
> > +#define ? ? ? ?BCE_NETLINK_SPEED_10GFULL ? ? ? ? ? ? ? ?(1<<9)
> > +#define ? ? ? ?BCE_NETLINK_ANEG_ENB ? ? ? ? ? ? ? ? ? ? (1<<10)
> > +#define ? ? ? ?BCE_NETLINK_PHY_APP_REMOTE ? ? ? ? ? ? ? (1<<11)
> > +#define ? ? ? ?BCE_NETLINK_FC_PAUSE_SYM ? ? ? ? ? ? ? ? (1<<12)
> > +#define ? ? ? ?BCE_NETLINK_FC_PAUSE_ASYM ? ? ? ? ? ? ? ?(1<<13)
> > +#define ? ? ? ?BCE_NETLINK_ETH_AT_WIRESPEED ? ? ? ? ? ? (1<<14)
> > +#define ? ? ? ?BCE_NETLINK_PHY_RESET ? ? ? ? ? ? ? ? ? ?(1<<15)
> > +
> > ?#define BCE_MB_ARGS_1 ? ? ? ? ? ? ? ? ? ? ? ? ?0x00000018
> >
> > ?/* Indicate to the firmware not to go into the
> > @@ -1079,6 +1096,26 @@ struct flash_spec {
> > ?#define BCE_BC_STATE_BC_DBG_CMD_LOOP_CNT_MASK ?0xffff
> > ?#define BCE_BC_STATE_BC_DBG_CMD_LOOP_INFINITE ?0xffff
> >
> > +#define ? ? ? ?BCE_FW_EVT_CODE_MB ? ? ? ? ? ? ? ? ? ? ?0x00000354
> > +#define ? ? ? ?BCE_FW_EVT_CODE_SW_TIMER_EXPIRE_EVENT ? 0x00000000
> > +#define ? ? ? ?BCE_FW_EVT_CODE_LINK_EVENT ? ? ? ? ? ? ?0x00000001
> > +
> > +#define ? ? ? ?BCE_DRV_ACK_CAP_MB ? ? ? ? ? ? ? ? ? ? ?0x00000364
> > +#define ? ? ? ?BCE_DRV_ACK_CAP_SIGNATURE_MAGIC ? ? ? ? 0x35450000
> > +
> > +#define ? ? ? ?BCE_FW_CAP_MB ? ? ? ? ? ? ? ? ? ? ? ? ? 0x00000368
> > +#define ? ? ? ?BCE_FW_CAP_SIGNATURE_MAGIC ? ? ? ? ? ? ?0xaa550000
> > +#define ? ? ? ?BCE_FW_ACK_SIGNATURE_MAGIC ? ? ? ? ? ? ?0x52500000
> > +#define ? ? ? ?BCE_FW_CAP_SIGNATURE_MAGIC_MASK ? ? ? ? 0xffff0000
> > +#define ? ? ? ?BCE_FW_CAP_REMOTE_PHY_CAP ? ? ? ? ? ? ? 0x00000001
> > +#define ? ? ? ?BCE_FW_CAP_REMOTE_PHY_PRESENT ? ? ? ? ? 0x00000002
> > +#define ? ? ? ?BCE_FW_CAP_MFW_KEEP_VLAN ? ? ? ? ? ? ? ?0x00000008
> > +#define ? ? ? ?BCE_FW_CAP_BC_KEEP_VLAN ? ? ? ? ? ? ? ? 0x00000010
> > +
> > +#define ? ? ? ?BCE_RPHY_SERDES_LINK ? ? ? ? ? ? ? ? ? ?0x00000374
> > +
> > +#define ? ? ? ?BCE_RPHY_COPPER_LINK ? ? ? ? ? ? ? ? ? ?0x00000378
> > +
> > ?#define HOST_VIEW_SHMEM_BASE ? ? ? ? ? ? ? ? ? 0x167c00
> >
> > ?/*
> > @@ -6454,6 +6491,8 @@ struct bce_softc
> > ?#define BCE_PHY_INT_MODE_AUTO_POLLING_FLAG ? ? 0x00000100
> > ?#define BCE_PHY_INT_MODE_LINK_READY_FLAG ? ? ? 0x00000200
> > ?#define BCE_PHY_IEEE_CLAUSE_45_FLAG ? ? ? ? ? ?0x00000400
> > +#define ? ? ? ?BCE_PHY_REMOTE_CAP_FLAG ? ? ? ? ? ? ? ? 0x00000800
> > +#define ? ? ? ?BCE_PHY_REMOTE_PORT_FIBER_FLAG ? ? ? ? ?0x00001000
> >
> > ? ? ? ?/* Values that need to be shared with the PHY driver. */
> > ? ? ? ?u32 ? ? ? ? ? ? ? ? ? ? bce_shared_hw_cfg;
> 

From owner-svn-src-stable-9@FreeBSD.ORG  Thu May 24 03:38:48 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id EA4661065676;
	Thu, 24 May 2012 03:38:47 +0000 (UTC) (envelope-from alc@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id CA6138FC12;
	Thu, 24 May 2012 03:38: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 q4O3clCE012992;
	Thu, 24 May 2012 03:38:47 GMT (envelope-from alc@svn.freebsd.org)
Received: (from alc@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4O3cl6x012988;
	Thu, 24 May 2012 03:38:47 GMT (envelope-from alc@svn.freebsd.org)
Message-Id: <201205240338.q4O3cl6x012988@svn.freebsd.org>
From: Alan Cox <alc@FreeBSD.org>
Date: Thu, 24 May 2012 03:38:47 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r235876 - stable/9/sys/vm
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 24 May 2012 03:38:48 -0000

Author: alc
Date: Thu May 24 03:38:47 2012
New Revision: 235876
URL: http://svn.freebsd.org/changeset/base/235876

Log:
  MFC r235230
    Give vm_fault()'s sequential access optimization a makeover.
  
    There are two aspects to the sequential access optimization: (1) read ahead
    of pages that are expected to be accessed in the near future and (2) unmap
    and cache behind of pages that are not expected to be accessed again.  This
    revision changes both aspects.
  
    The read ahead optimization is now more effective.  It starts with the same
    initial read window as before, but arithmetically grows the window on
    sequential page faults.  This can yield increased read bandwidth.  For
    example, on one of my machines, a program using mmap() to read a file that
    is several times larger than the machine's physical memory takes about 17%
    less time to complete.
  
    The unmap and cache behind optimization is now more selectively applied.
    The read ahead window must grow to its maximum size before unmap and cache
    behind is performed.  This significantly reduces the number of times that
    pages are unmapped and cached only to be reactivated a short time later.
  
    The unmap and cache behind optimization now clears each page's referenced
    flag.  Previously, in the case of dirty pages, if the containing file was
    still mapped at the time that the page daemon examined the dirty pages,
    they would be reactivated.
  
    From a stylistic standpoint, this revision also cleanly separates the
    implementation of the read ahead and unmap/cache behind optimizations.

Modified:
  stable/9/sys/vm/vm_fault.c
  stable/9/sys/vm/vm_map.c
  stable/9/sys/vm/vm_map.h
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/vm/vm_fault.c
==============================================================================
--- stable/9/sys/vm/vm_fault.c	Thu May 24 02:46:35 2012	(r235875)
+++ stable/9/sys/vm/vm_fault.c	Thu May 24 03:38:47 2012	(r235876)
@@ -114,9 +114,11 @@ static int prefault_pageorder[] = {
 static int vm_fault_additional_pages(vm_page_t, int, int, vm_page_t *, int *);
 static void vm_fault_prefault(pmap_t, vm_offset_t, vm_map_entry_t);
 
-#define VM_FAULT_READ_AHEAD 8
-#define VM_FAULT_READ_BEHIND 7
-#define VM_FAULT_READ (VM_FAULT_READ_AHEAD+VM_FAULT_READ_BEHIND+1)
+#define	VM_FAULT_READ_BEHIND	8
+#define	VM_FAULT_READ_MAX	(1 + VM_FAULT_READ_AHEAD_MAX)
+#define	VM_FAULT_NINCR		(VM_FAULT_READ_MAX / VM_FAULT_READ_BEHIND)
+#define	VM_FAULT_SUM		(VM_FAULT_NINCR * (VM_FAULT_NINCR + 1) / 2)
+#define	VM_FAULT_CACHE_BEHIND	(VM_FAULT_READ_BEHIND * VM_FAULT_SUM)
 
 struct faultstate {
 	vm_page_t m;
@@ -132,6 +134,8 @@ struct faultstate {
 	int vfslocked;
 };
 
+static void vm_fault_cache_behind(const struct faultstate *fs, int distance);
+
 static inline void
 release_page(struct faultstate *fs)
 {
@@ -219,13 +223,13 @@ vm_fault_hold(vm_map_t map, vm_offset_t 
     int fault_flags, vm_page_t *m_hold)
 {
 	vm_prot_t prot;
-	int is_first_object_locked, result;
-	boolean_t growstack, wired;
+	long ahead, behind;
+	int alloc_req, era, faultcount, nera, reqpage, result;
+	boolean_t growstack, is_first_object_locked, wired;
 	int map_generation;
 	vm_object_t next_object;
-	vm_page_t marray[VM_FAULT_READ], mt, mt_prev;
+	vm_page_t marray[VM_FAULT_READ_MAX];
 	int hardfault;
-	int faultcount, ahead, behind, alloc_req;
 	struct faultstate fs;
 	struct vnode *vp;
 	int locked, error;
@@ -235,7 +239,7 @@ vm_fault_hold(vm_map_t map, vm_offset_t 
 	PCPU_INC(cnt.v_vm_faults);
 	fs.vp = NULL;
 	fs.vfslocked = 0;
-	faultcount = behind = 0;
+	faultcount = reqpage = 0;
 
 RetryFault:;
 
@@ -443,75 +447,47 @@ readrest:
 		 */
 		if (TRYPAGER) {
 			int rv;
-			int reqpage = 0;
 			u_char behavior = vm_map_entry_behavior(fs.entry);
 
 			if (behavior == MAP_ENTRY_BEHAV_RANDOM ||
 			    P_KILLED(curproc)) {
+				behind = 0;
 				ahead = 0;
+			} else if (behavior == MAP_ENTRY_BEHAV_SEQUENTIAL) {
 				behind = 0;
+				ahead = atop(fs.entry->end - vaddr) - 1;
+				if (ahead > VM_FAULT_READ_AHEAD_MAX)
+					ahead = VM_FAULT_READ_AHEAD_MAX;
+				if (fs.pindex == fs.entry->next_read)
+					vm_fault_cache_behind(&fs,
+					    VM_FAULT_READ_MAX);
 			} else {
-				behind = (vaddr - fs.entry->start) >> PAGE_SHIFT;
-				if (behind > VM_FAULT_READ_BEHIND)
-					behind = VM_FAULT_READ_BEHIND;
-
-				ahead = ((fs.entry->end - vaddr) >> PAGE_SHIFT) - 1;
-				if (ahead > VM_FAULT_READ_AHEAD)
-					ahead = VM_FAULT_READ_AHEAD;
-			}
-			is_first_object_locked = FALSE;
-			if ((behavior == MAP_ENTRY_BEHAV_SEQUENTIAL ||
-			     (behavior != MAP_ENTRY_BEHAV_RANDOM &&
-			      fs.pindex >= fs.entry->lastr &&
-			      fs.pindex < fs.entry->lastr + VM_FAULT_READ)) &&
-			    (fs.first_object == fs.object ||
-			     (is_first_object_locked = VM_OBJECT_TRYLOCK(fs.first_object))) &&
-			    fs.first_object->type != OBJT_DEVICE &&
-			    fs.first_object->type != OBJT_PHYS &&
-			    fs.first_object->type != OBJT_SG) {
-				vm_pindex_t firstpindex;
-
-				if (fs.first_pindex < 2 * VM_FAULT_READ)
-					firstpindex = 0;
-				else
-					firstpindex = fs.first_pindex - 2 * VM_FAULT_READ;
-				mt = fs.first_object != fs.object ?
-				    fs.first_m : fs.m;
-				KASSERT(mt != NULL, ("vm_fault: missing mt"));
-				KASSERT((mt->oflags & VPO_BUSY) != 0,
-				    ("vm_fault: mt %p not busy", mt));
-				mt_prev = vm_page_prev(mt);
-
 				/*
-				 * note: partially valid pages cannot be 
-				 * included in the lookahead - NFS piecemeal
-				 * writes will barf on it badly.
+				 * If this is a sequential page fault, then
+				 * arithmetically increase the number of pages
+				 * in the read-ahead window.  Otherwise, reset
+				 * the read-ahead window to its smallest size.
 				 */
-				while ((mt = mt_prev) != NULL &&
-				    mt->pindex >= firstpindex &&
-				    mt->valid == VM_PAGE_BITS_ALL) {
-					mt_prev = vm_page_prev(mt);
-					if (mt->busy ||
-					    (mt->oflags & VPO_BUSY))
-						continue;
-					vm_page_lock(mt);
-					if (mt->hold_count ||
-					    mt->wire_count) {
-						vm_page_unlock(mt);
-						continue;
-					}
-					pmap_remove_all(mt);
-					if (mt->dirty != 0)
-						vm_page_deactivate(mt);
-					else
-						vm_page_cache(mt);
-					vm_page_unlock(mt);
-				}
-				ahead += behind;
-				behind = 0;
+				behind = atop(vaddr - fs.entry->start);
+				if (behind > VM_FAULT_READ_BEHIND)
+					behind = VM_FAULT_READ_BEHIND;
+				ahead = atop(fs.entry->end - vaddr) - 1;
+				era = fs.entry->read_ahead;
+				if (fs.pindex == fs.entry->next_read) {
+					nera = era + behind;
+					if (nera > VM_FAULT_READ_AHEAD_MAX)
+						nera = VM_FAULT_READ_AHEAD_MAX;
+					behind = 0;
+					if (ahead > nera)
+						ahead = nera;
+					if (era == VM_FAULT_READ_AHEAD_MAX)
+						vm_fault_cache_behind(&fs,
+						    VM_FAULT_CACHE_BEHIND);
+				} else if (ahead > VM_FAULT_READ_AHEAD_MIN)
+					ahead = VM_FAULT_READ_AHEAD_MIN;
+				if (era != ahead)
+					fs.entry->read_ahead = ahead;
 			}
-			if (is_first_object_locked)
-				VM_OBJECT_UNLOCK(fs.first_object);
 
 			/*
 			 * Call the pager to retrieve the data, if any, after
@@ -882,7 +858,7 @@ vnode_locked:
 	 * without holding a write lock on it.
 	 */
 	if (hardfault)
-		fs.entry->lastr = fs.pindex + faultcount - behind;
+		fs.entry->next_read = fs.pindex + faultcount - reqpage;
 
 	if ((prot & VM_PROT_WRITE) != 0 ||
 	    (fault_flags & VM_FAULT_DIRTY) != 0) {
@@ -975,6 +951,60 @@ vnode_locked:
 }
 
 /*
+ * Speed up the reclamation of up to "distance" pages that precede the
+ * faulting pindex within the first object of the shadow chain.
+ */
+static void
+vm_fault_cache_behind(const struct faultstate *fs, int distance)
+{
+	vm_object_t first_object, object;
+	vm_page_t m, m_prev;
+	vm_pindex_t pindex;
+
+	object = fs->object;
+	VM_OBJECT_LOCK_ASSERT(object, MA_OWNED);
+	first_object = fs->first_object;
+	if (first_object != object) {
+		if (!VM_OBJECT_TRYLOCK(first_object)) {
+			VM_OBJECT_UNLOCK(object);
+			VM_OBJECT_LOCK(first_object);
+			VM_OBJECT_LOCK(object);
+		}
+	}
+	if (first_object->type != OBJT_DEVICE &&
+	    first_object->type != OBJT_PHYS && first_object->type != OBJT_SG) {
+		if (fs->first_pindex < distance)
+			pindex = 0;
+		else
+			pindex = fs->first_pindex - distance;
+		if (pindex < OFF_TO_IDX(fs->entry->offset))
+			pindex = OFF_TO_IDX(fs->entry->offset);
+		m = first_object != object ? fs->first_m : fs->m;
+		KASSERT((m->oflags & VPO_BUSY) != 0,
+		    ("vm_fault_cache_behind: page %p is not busy", m));
+		m_prev = vm_page_prev(m);
+		while ((m = m_prev) != NULL && m->pindex >= pindex &&
+		    m->valid == VM_PAGE_BITS_ALL) {
+			m_prev = vm_page_prev(m);
+			if (m->busy != 0 || (m->oflags & VPO_BUSY) != 0)
+				continue;
+			vm_page_lock(m);
+			if (m->hold_count == 0 && m->wire_count == 0) {
+				pmap_remove_all(m);
+				vm_page_aflag_clear(m, PGA_REFERENCED);
+				if (m->dirty != 0)
+					vm_page_deactivate(m);
+				else
+					vm_page_cache(m);
+			}
+			vm_page_unlock(m);
+		}
+	}
+	if (first_object != object)
+		VM_OBJECT_UNLOCK(first_object);
+}
+
+/*
  * vm_fault_prefault provides a quick way of clustering
  * pagefaults into a processes address space.  It is a "cousin"
  * of vm_map_pmap_enter, except it runs at page fault time instead

Modified: stable/9/sys/vm/vm_map.c
==============================================================================
--- stable/9/sys/vm/vm_map.c	Thu May 24 02:46:35 2012	(r235875)
+++ stable/9/sys/vm/vm_map.c	Thu May 24 03:38:47 2012	(r235876)
@@ -1300,6 +1300,8 @@ charged:
 	new_entry->protection = prot;
 	new_entry->max_protection = max;
 	new_entry->wired_count = 0;
+	new_entry->read_ahead = VM_FAULT_READ_AHEAD_INIT;
+	new_entry->next_read = OFF_TO_IDX(offset);
 
 	KASSERT(cred == NULL || !ENTRY_CHARGED(new_entry),
 	    ("OVERCOMMIT: vm_map_insert leaks vm_map %p", new_entry));

Modified: stable/9/sys/vm/vm_map.h
==============================================================================
--- stable/9/sys/vm/vm_map.h	Thu May 24 02:46:35 2012	(r235875)
+++ stable/9/sys/vm/vm_map.h	Thu May 24 03:38:47 2012	(r235876)
@@ -112,8 +112,9 @@ struct vm_map_entry {
 	vm_prot_t protection;		/* protection code */
 	vm_prot_t max_protection;	/* maximum protection */
 	vm_inherit_t inheritance;	/* inheritance */
+	uint8_t read_ahead;		/* pages in the read-ahead window */
 	int wired_count;		/* can be paged if = 0 */
-	vm_pindex_t lastr;		/* last read */
+	vm_pindex_t next_read;		/* index of the next sequential read */
 	struct ucred *cred;		/* tmp storage for creator ref */
 };
 
@@ -330,6 +331,14 @@ long vmspace_wired_count(struct vmspace 
 #define	VM_FAULT_DIRTY 2		/* Dirty the page; use w/VM_PROT_COPY */
 
 /*
+ * Initially, mappings are slightly sequential.  The maximum window size must
+ * account for the map entry's "read_ahead" field being defined as an uint8_t.
+ */
+#define	VM_FAULT_READ_AHEAD_MIN		7
+#define	VM_FAULT_READ_AHEAD_INIT	15
+#define	VM_FAULT_READ_AHEAD_MAX		min(atop(MAXPHYS) - 1, UINT8_MAX)
+
+/*
  * The following "find_space" options are supported by vm_map_find()
  */
 #define	VMFS_NO_SPACE		0	/* don't find; use the given range */

From owner-svn-src-stable-9@FreeBSD.ORG  Thu May 24 03:45:14 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 8D353106566C;
	Thu, 24 May 2012 03:45:14 +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 77DBE8FC0C;
	Thu, 24 May 2012 03:45: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 q4O3jEfl013315;
	Thu, 24 May 2012 03:45:14 GMT (envelope-from mav@svn.freebsd.org)
Received: (from mav@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4O3jEbH013312;
	Thu, 24 May 2012 03:45:14 GMT (envelope-from mav@svn.freebsd.org)
Message-Id: <201205240345.q4O3jEbH013312@svn.freebsd.org>
From: Alexander Motin <mav@FreeBSD.org>
Date: Thu, 24 May 2012 03:45:14 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r235877 - in stable/9/sys: amd64/conf i386/conf
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 24 May 2012 03:45:14 -0000

Author: mav
Date: Thu May 24 03:45:13 2012
New Revision: 235877
URL: http://svn.freebsd.org/changeset/base/235877

Log:
  MFC r235226:
  Add `options GEOM_RAID` into i386 and amd64 GENERIC kernels.
  
  ataraid(4) previously was present there and having GEOM RAID is convinient.
  Unlike other classes GEOM RAID can be set up from BIOS before install and
  users are expecting it to be detected automatically.

Modified:
  stable/9/sys/amd64/conf/GENERIC
  stable/9/sys/i386/conf/GENERIC
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/amd64/conf/GENERIC
==============================================================================
--- stable/9/sys/amd64/conf/GENERIC	Thu May 24 03:38:47 2012	(r235876)
+++ stable/9/sys/amd64/conf/GENERIC	Thu May 24 03:45:13 2012	(r235877)
@@ -43,6 +43,7 @@ options 	CD9660			# ISO 9660 Filesystem
 options 	PROCFS			# Process filesystem (requires PSEUDOFS)
 options 	PSEUDOFS		# Pseudo-filesystem framework
 options 	GEOM_PART_GPT		# GUID Partition Tables.
+options 	GEOM_RAID		# Soft RAID functionality.
 options 	GEOM_LABEL		# Provides labelization
 options 	COMPAT_FREEBSD32	# Compatible with i386 binaries
 options 	COMPAT_FREEBSD4		# Compatible with FreeBSD4

Modified: stable/9/sys/i386/conf/GENERIC
==============================================================================
--- stable/9/sys/i386/conf/GENERIC	Thu May 24 03:38:47 2012	(r235876)
+++ stable/9/sys/i386/conf/GENERIC	Thu May 24 03:45:13 2012	(r235877)
@@ -45,6 +45,7 @@ options 	CD9660			# ISO 9660 Filesystem
 options 	PROCFS			# Process filesystem (requires PSEUDOFS)
 options 	PSEUDOFS		# Pseudo-filesystem framework
 options 	GEOM_PART_GPT		# GUID Partition Tables.
+options 	GEOM_RAID		# Soft RAID functionality.
 options 	GEOM_LABEL		# Provides labelization
 options 	COMPAT_FREEBSD4		# Compatible with FreeBSD4
 options 	COMPAT_FREEBSD5		# Compatible with FreeBSD5

From owner-svn-src-stable-9@FreeBSD.ORG  Thu May 24 04:09:48 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 71427106564A;
	Thu, 24 May 2012 04:09:48 +0000 (UTC) (envelope-from alc@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 427DA8FC08;
	Thu, 24 May 2012 04:09: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 q4O49maq014341;
	Thu, 24 May 2012 04:09:48 GMT (envelope-from alc@svn.freebsd.org)
Received: (from alc@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4O49mDA014338;
	Thu, 24 May 2012 04:09:48 GMT (envelope-from alc@svn.freebsd.org)
Message-Id: <201205240409.q4O49mDA014338@svn.freebsd.org>
From: Alan Cox <alc@FreeBSD.org>
Date: Thu, 24 May 2012 04:09:48 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r235878 - stable/9/sys/vm
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 24 May 2012 04:09:48 -0000

Author: alc
Date: Thu May 24 04:09:47 2012
New Revision: 235878
URL: http://svn.freebsd.org/changeset/base/235878

Log:
  MFC r232160
    Simplify vmspace_fork()'s control flow by copying immutable data before
    the vm map locks are acquired.  Also, eliminate redundant initialization
    of the new vm map's timestamp.

Modified:
  stable/9/sys/vm/vm_map.c
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/vm/vm_map.c
==============================================================================
--- stable/9/sys/vm/vm_map.c	Thu May 24 03:45:13 2012	(r235877)
+++ stable/9/sys/vm/vm_map.c	Thu May 24 04:09:47 2012	(r235878)
@@ -3087,27 +3087,25 @@ struct vmspace *
 vmspace_fork(struct vmspace *vm1, vm_ooffset_t *fork_charge)
 {
 	struct vmspace *vm2;
-	vm_map_t old_map = &vm1->vm_map;
-	vm_map_t new_map;
-	vm_map_entry_t old_entry;
-	vm_map_entry_t new_entry;
+	vm_map_t new_map, old_map;
+	vm_map_entry_t new_entry, old_entry;
 	vm_object_t object;
 	int locked;
 
-	vm_map_lock(old_map);
-	if (old_map->busy)
-		vm_map_wait_busy(old_map);
-	new_map = NULL; /* silence gcc */
+	old_map = &vm1->vm_map;
+	/* Copy immutable fields of vm1 to vm2. */
 	vm2 = vmspace_alloc(old_map->min_offset, old_map->max_offset);
 	if (vm2 == NULL)
-		goto unlock_and_return;
+		return (NULL);
 	vm2->vm_taddr = vm1->vm_taddr;
 	vm2->vm_daddr = vm1->vm_daddr;
 	vm2->vm_maxsaddr = vm1->vm_maxsaddr;
-	new_map = &vm2->vm_map;	/* XXX */
+	vm_map_lock(old_map);
+	if (old_map->busy)
+		vm_map_wait_busy(old_map);
+	new_map = &vm2->vm_map;
 	locked = vm_map_trylock(new_map); /* trylock to silence WITNESS */
 	KASSERT(locked, ("vmspace_fork: lock failed"));
-	new_map->timestamp = 1;
 
 	old_entry = old_map->header.next;
 
@@ -3228,15 +3226,13 @@ vmspace_fork(struct vmspace *vm1, vm_oof
 		}
 		old_entry = old_entry->next;
 	}
-unlock_and_return:
 	/*
 	 * Use inlined vm_map_unlock() to postpone handling the deferred
 	 * map entries, which cannot be done until both old_map and
 	 * new_map locks are released.
 	 */
 	sx_xunlock(&old_map->lock);
-	if (vm2 != NULL)
-		sx_xunlock(&new_map->lock);
+	sx_xunlock(&new_map->lock);
 	vm_map_process_deferred();
 
 	return (vm2);

From owner-svn-src-stable-9@FreeBSD.ORG  Thu May 24 04:23:07 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 07444106566B;
	Thu, 24 May 2012 04:23:07 +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 CB5808FC0C;
	Thu, 24 May 2012 04:23: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 q4O4N6Rx014993;
	Thu, 24 May 2012 04:23:06 GMT (envelope-from mav@svn.freebsd.org)
Received: (from mav@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4O4N6Bk014989;
	Thu, 24 May 2012 04:23:06 GMT (envelope-from mav@svn.freebsd.org)
Message-Id: <201205240423.q4O4N6Bk014989@svn.freebsd.org>
From: Alexander Motin <mav@FreeBSD.org>
Date: Thu, 24 May 2012 04:23:06 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r235880 - stable/9/usr.bin/usbhidctl
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 24 May 2012 04:23:07 -0000

Author: mav
Date: Thu May 24 04:23:06 2012
New Revision: 235880
URL: http://svn.freebsd.org/changeset/base/235880

Log:
  MFC r235519:
  Add support for -z option for reading operations. It allows to not request
  current values from device, but only receive changes.
  
  Sponsored by:	iXsystems, Inc.

Modified:
  stable/9/usr.bin/usbhidctl/usbhid.c
  stable/9/usr.bin/usbhidctl/usbhidctl.1
Directory Properties:
  stable/9/usr.bin/usbhidctl/   (props changed)

Modified: stable/9/usr.bin/usbhidctl/usbhid.c
==============================================================================
--- stable/9/usr.bin/usbhidctl/usbhid.c	Thu May 24 04:10:34 2012	(r235879)
+++ stable/9/usr.bin/usbhidctl/usbhid.c	Thu May 24 04:23:06 2012	(r235880)
@@ -182,11 +182,11 @@ usage(void)
 
 	fprintf(stderr,
                 "usage: %s -f device "
-                "[-l] [-n] [-r] [-t tablefile] [-v] [-x] name ...\n",
+                "[-l] [-n] [-r] [-t tablefile] [-v] [-x] [-z] name ...\n",
                 getprogname());
 	fprintf(stderr,
                 "       %s -f device "
-                "[-l] [-n] [-r] [-t tablefile] [-v] [-x] -a\n",
+                "[-l] [-n] [-r] [-t tablefile] [-v] [-x] [-z] -a\n",
                 getprogname());
 	fprintf(stderr,
                 "       %s -f device "
@@ -304,7 +304,7 @@ dumpdata(int f, report_desc_t rd, int lo
 	u_char *dbuf;
 	enum hid_kind kind;
 
-	kind = 0;
+	kind = zflag ? 3 : 0;
 	rid = -1;
 	use_rid = !!hid_get_report_id(f);
 	do {

Modified: stable/9/usr.bin/usbhidctl/usbhidctl.1
==============================================================================
--- stable/9/usr.bin/usbhidctl/usbhidctl.1	Thu May 24 04:10:34 2012	(r235879)
+++ stable/9/usr.bin/usbhidctl/usbhidctl.1	Thu May 24 04:23:06 2012	(r235880)
@@ -47,6 +47,7 @@
 .Op Fl l
 .Op Fl v
 .Op Fl x
+.Op Fl z
 .Fl a
 .Nm
 .Fl f Ar device
@@ -55,6 +56,7 @@
 .Op Fl n
 .Op Fl v
 .Op Fl x
+.Op Fl z
 .Ar item ...
 .Nm
 .Fl f Ar device
@@ -99,9 +101,8 @@ Only 'output' and 'feature' kinds can be
 .It Fl x
 Dump data in hexadecimal as well as decimal.
 .It Fl z
-Reset reports to zero before processing
-.Fl w
-arguments. If not specified, current values will be requested from device.
+Reset reports to zero before processing other arguments.
+If not specified, current values will be requested from device.
 .El
 .Sh SYNTAX
 .Nm

From owner-svn-src-stable-9@FreeBSD.ORG  Thu May 24 04:33:32 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id D13BC106566B;
	Thu, 24 May 2012 04:33:32 +0000 (UTC) (envelope-from alc@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id A269A8FC0C;
	Thu, 24 May 2012 04:33: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 q4O4XWU0015498;
	Thu, 24 May 2012 04:33:32 GMT (envelope-from alc@svn.freebsd.org)
Received: (from alc@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4O4XWKT015496;
	Thu, 24 May 2012 04:33:32 GMT (envelope-from alc@svn.freebsd.org)
Message-Id: <201205240433.q4O4XWKT015496@svn.freebsd.org>
From: Alan Cox <alc@FreeBSD.org>
Date: Thu, 24 May 2012 04:33:32 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r235882 - stable/9/sys/vm
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 24 May 2012 04:33:32 -0000

Author: alc
Date: Thu May 24 04:33:32 2012
New Revision: 235882
URL: http://svn.freebsd.org/changeset/base/235882

Log:
  MFC r232288
    Simplify kmem_alloc() by eliminating code that existed on account of
    external pagers in Mach.

Modified:
  stable/9/sys/vm/vm_kern.c
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/vm/vm_kern.c
==============================================================================
--- stable/9/sys/vm/vm_kern.c	Thu May 24 04:24:17 2012	(r235881)
+++ stable/9/sys/vm/vm_kern.c	Thu May 24 04:33:32 2012	(r235882)
@@ -161,7 +161,6 @@ kmem_alloc(map, size)
 {
 	vm_offset_t addr;
 	vm_offset_t offset;
-	vm_offset_t i;
 
 	size = round_page(size);
 
@@ -187,35 +186,6 @@ kmem_alloc(map, size)
 	vm_map_unlock(map);
 
 	/*
-	 * Guarantee that there are pages already in this object before
-	 * calling vm_map_wire.  This is to prevent the following
-	 * scenario:
-	 *
-	 * 1) Threads have swapped out, so that there is a pager for the
-	 * kernel_object. 2) The kmsg zone is empty, and so we are
-	 * kmem_allocing a new page for it. 3) vm_map_wire calls vm_fault;
-	 * there is no page, but there is a pager, so we call
-	 * pager_data_request.  But the kmsg zone is empty, so we must
-	 * kmem_alloc. 4) goto 1 5) Even if the kmsg zone is not empty: when
-	 * we get the data back from the pager, it will be (very stale)
-	 * non-zero data.  kmem_alloc is defined to return zero-filled memory.
-	 *
-	 * We're intentionally not activating the pages we allocate to prevent a
-	 * race with page-out.  vm_map_wire will wire the pages.
-	 */
-	VM_OBJECT_LOCK(kernel_object);
-	for (i = 0; i < size; i += PAGE_SIZE) {
-		vm_page_t mem;
-
-		mem = vm_page_grab(kernel_object, OFF_TO_IDX(offset + i),
-		    VM_ALLOC_NOBUSY | VM_ALLOC_ZERO | VM_ALLOC_RETRY);
-		mem->valid = VM_PAGE_BITS_ALL;
-		KASSERT((mem->oflags & VPO_UNMANAGED) != 0,
-		    ("kmem_alloc: page %p is managed", mem));
-	}
-	VM_OBJECT_UNLOCK(kernel_object);
-
-	/*
 	 * And finally, mark the data as non-pageable.
 	 */
 	(void) vm_map_wire(map, addr, addr + size,

From owner-svn-src-stable-9@FreeBSD.ORG  Thu May 24 04:46:40 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id EFBE8106566C;
	Thu, 24 May 2012 04:46:40 +0000 (UTC) (envelope-from alc@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id DA52F8FC0C;
	Thu, 24 May 2012 04:46: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 q4O4keIw016159;
	Thu, 24 May 2012 04:46:40 GMT (envelope-from alc@svn.freebsd.org)
Received: (from alc@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4O4ke7C016157;
	Thu, 24 May 2012 04:46:40 GMT (envelope-from alc@svn.freebsd.org)
Message-Id: <201205240446.q4O4ke7C016157@svn.freebsd.org>
From: Alan Cox <alc@FreeBSD.org>
Date: Thu, 24 May 2012 04:46:40 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r235883 - stable/9/sys/kern
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 24 May 2012 04:46:41 -0000

Author: alc
Date: Thu May 24 04:46:40 2012
New Revision: 235883
URL: http://svn.freebsd.org/changeset/base/235883

Log:
  MFC r232192
    Fix typo.

Modified:
  stable/9/sys/kern/vfs_bio.c
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/kern/vfs_bio.c
==============================================================================
--- stable/9/sys/kern/vfs_bio.c	Thu May 24 04:33:32 2012	(r235882)
+++ stable/9/sys/kern/vfs_bio.c	Thu May 24 04:46:40 2012	(r235883)
@@ -3081,7 +3081,7 @@ allocbuf(struct buf *bp, int size)
 
 				/*
 				 * We must allocate system pages since blocking
-				 * here could intefere with paging I/O, no
+				 * here could interfere with paging I/O, no
 				 * matter which process we are.
 				 *
 				 * We can only test VPO_BUSY here.  Blocking on

From owner-svn-src-stable-9@FreeBSD.ORG  Thu May 24 05:11:22 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 941D8106564A;
	Thu, 24 May 2012 05:11:22 +0000 (UTC) (envelope-from alc@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 7DDB68FC0A;
	Thu, 24 May 2012 05:11: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 q4O5BMP3017191;
	Thu, 24 May 2012 05:11:22 GMT (envelope-from alc@svn.freebsd.org)
Received: (from alc@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4O5BMLC017184;
	Thu, 24 May 2012 05:11:22 GMT (envelope-from alc@svn.freebsd.org)
Message-Id: <201205240511.q4O5BMLC017184@svn.freebsd.org>
From: Alan Cox <alc@FreeBSD.org>
Date: Thu, 24 May 2012 05:11:22 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r235884 - in stable/9/sys: amd64/amd64 amd64/conf conf
	i386/conf i386/i386
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 24 May 2012 05:11:22 -0000

Author: alc
Date: Thu May 24 05:11:21 2012
New Revision: 235884
URL: http://svn.freebsd.org/changeset/base/235884

Log:
  MFC r233433
    Disable detailed PV entry accounting by default.  Add a config option
    to enable it.

Modified:
  stable/9/sys/amd64/amd64/pmap.c
  stable/9/sys/amd64/conf/NOTES
  stable/9/sys/conf/options.amd64
  stable/9/sys/conf/options.i386
  stable/9/sys/i386/conf/NOTES
  stable/9/sys/i386/i386/pmap.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/conf/   (props changed)

Modified: stable/9/sys/amd64/amd64/pmap.c
==============================================================================
--- stable/9/sys/amd64/amd64/pmap.c	Thu May 24 04:46:40 2012	(r235883)
+++ stable/9/sys/amd64/amd64/pmap.c	Thu May 24 05:11:21 2012	(r235884)
@@ -158,7 +158,6 @@ __FBSDID("$FreeBSD$");
 #define PMAP_INLINE
 #endif
 
-#define PV_STATS
 #ifdef PV_STATS
 #define PV_STAT(x)	do { x ; } while (0)
 #else

Modified: stable/9/sys/amd64/conf/NOTES
==============================================================================
--- stable/9/sys/amd64/conf/NOTES	Thu May 24 04:46:40 2012	(r235883)
+++ stable/9/sys/amd64/conf/NOTES	Thu May 24 05:11:21 2012	(r235884)
@@ -556,6 +556,10 @@ options 	LINSYSFS
 
 options 	KSTACK_PAGES=5
 
+# Enable detailed accounting by the PV entry allocator.
+
+options 	PV_STATS
+
 #####################################################################
 
 # More undocumented options for linting.

Modified: stable/9/sys/conf/options.amd64
==============================================================================
--- stable/9/sys/conf/options.amd64	Thu May 24 04:46:40 2012	(r235883)
+++ stable/9/sys/conf/options.amd64	Thu May 24 05:11:21 2012	(r235884)
@@ -10,6 +10,7 @@ PERFMON
 MPTABLE_FORCE_HTT
 MP_WATCHDOG
 NKPT			opt_pmap.h
+PV_STATS		opt_pmap.h
 
 # Options for emulators.  These should only be used at config time, so
 # they are handled like options for static filesystems

Modified: stable/9/sys/conf/options.i386
==============================================================================
--- stable/9/sys/conf/options.i386	Thu May 24 04:46:40 2012	(r235883)
+++ stable/9/sys/conf/options.i386	Thu May 24 05:11:21 2012	(r235884)
@@ -16,6 +16,7 @@ NKPT			opt_pmap.h
 PERFMON
 PMAP_SHPGPERPROC	opt_pmap.h
 POWERFAIL_NMI		opt_trap.h
+PV_STATS		opt_pmap.h
 
 # Options for emulators.  These should only be used at config time, so
 # they are handled like options for static filesystems

Modified: stable/9/sys/i386/conf/NOTES
==============================================================================
--- stable/9/sys/i386/conf/NOTES	Thu May 24 04:46:40 2012	(r235883)
+++ stable/9/sys/i386/conf/NOTES	Thu May 24 05:11:21 2012	(r235884)
@@ -973,6 +973,10 @@ device		lindev
 
 options 	KSTACK_PAGES=3
 
+# Enable detailed accounting by the PV entry allocator.
+
+options 	PV_STATS
+
 #####################################################################
 
 # More undocumented options for linting.

Modified: stable/9/sys/i386/i386/pmap.c
==============================================================================
--- stable/9/sys/i386/i386/pmap.c	Thu May 24 04:46:40 2012	(r235883)
+++ stable/9/sys/i386/i386/pmap.c	Thu May 24 05:11:21 2012	(r235884)
@@ -172,7 +172,6 @@ __FBSDID("$FreeBSD$");
 #define PMAP_INLINE
 #endif
 
-#define PV_STATS
 #ifdef PV_STATS
 #define PV_STAT(x)	do { x ; } while (0)
 #else

From owner-svn-src-stable-9@FreeBSD.ORG  Thu May 24 08:43:11 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 649731065670;
	Thu, 24 May 2012 08:43:11 +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 4E8408FC1B;
	Thu, 24 May 2012 08:43: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 q4O8hBfh025775;
	Thu, 24 May 2012 08:43:11 GMT (envelope-from kib@svn.freebsd.org)
Received: (from kib@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4O8hBc2025772;
	Thu, 24 May 2012 08:43:11 GMT (envelope-from kib@svn.freebsd.org)
Message-Id: <201205240843.q4O8hBc2025772@svn.freebsd.org>
From: Konstantin Belousov <kib@FreeBSD.org>
Date: Thu, 24 May 2012 08:43:11 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r235887 - stable/9/usr.bin/lastcomm
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 24 May 2012 08:43:11 -0000

Author: kib
Date: Thu May 24 08:43:10 2012
New Revision: 235887
URL: http://svn.freebsd.org/changeset/base/235887

Log:
  MFC r235541:
  Allow to specify strftime(3) format for process start end exit times.

Modified:
  stable/9/usr.bin/lastcomm/lastcomm.1
  stable/9/usr.bin/lastcomm/lastcomm.c
Directory Properties:
  stable/9/usr.bin/lastcomm/   (props changed)

Modified: stable/9/usr.bin/lastcomm/lastcomm.1
==============================================================================
--- stable/9/usr.bin/lastcomm/lastcomm.1	Thu May 24 08:00:26 2012	(r235886)
+++ stable/9/usr.bin/lastcomm/lastcomm.1	Thu May 24 08:43:10 2012	(r235887)
@@ -28,7 +28,7 @@
 .\"	From: @(#)lastcomm.1	8.1 (Berkeley) 6/6/93
 .\" $FreeBSD$
 .\"
-.Dd May 14, 2007
+.Dd May 17, 2012
 .Dt LASTCOMM 1
 .Os
 .Sh NAME
@@ -38,6 +38,7 @@
 .Nm
 .Op Fl EScesu
 .Op Fl f Ar file
+.Op Cm + Ns Ar format
 .Op Ar command ...\&
 .Op Ar user ...\&
 .Op Ar terminal ...\&
@@ -77,6 +78,15 @@ is a single dash
 reads accounting entries from the standard input.
 .El
 .Pp
+An operand with a leading plus sign
+.Pq Sq +
+is followed a user-defined format string which specifies the format
+in which to display the process's start or exit date and time.
+The format string may contain any of the conversion specifications
+described in the
+.Xr strftime 3
+manual page, as well as arbitrary text.
+.Pp
 If no options are specified,
 .Fl cS
 is assumed.
@@ -165,6 +175,7 @@ will print details of each terminating c
 .Sh SEE ALSO
 .Xr last 1 ,
 .Xr sigaction 2 ,
+.Xr strftime 3 ,
 .Xr acct 5 ,
 .Xr core 5
 .Sh HISTORY

Modified: stable/9/usr.bin/lastcomm/lastcomm.c
==============================================================================
--- stable/9/usr.bin/lastcomm/lastcomm.c	Thu May 24 08:00:26 2012	(r235886)
+++ stable/9/usr.bin/lastcomm/lastcomm.c	Thu May 24 08:43:10 2012	(r235887)
@@ -52,6 +52,7 @@ __FBSDID("$FreeBSD$");
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <time.h>
 #include <unistd.h>
 #include "pathnames.h"
 
@@ -82,10 +83,12 @@ main(int argc, char *argv[])
 	int (*readrec)(FILE *f, struct acctv2 *av2);
 	time_t t;
 	int ch, rv;
-	const char *acctfile;
+	const char *acctfile, *format;
+	char buf[1024];
 	int flags = 0;
 
 	acctfile = _PATH_ACCT;
+	format = NULL;
 	while ((ch = getopt(argc, argv, "f:usecSE")) != -1)
 		switch((char)ch) {
 		case 'f':
@@ -126,6 +129,12 @@ main(int argc, char *argv[])
 	argc -= optind;
 	argv += optind;
 
+	if (argc > 0 && **argv == '+') {
+		format = *argv + 1; /* skip + */
+		argc--;
+		argv++;
+	}
+
 	if (strcmp(acctfile, "-") == 0) {
 		fp = stdin;
 		readrec = readrec_forward;
@@ -177,14 +186,24 @@ main(int argc, char *argv[])
 		
 		/* starting time */
 		if (flags & AC_BTIME) {
-			(void)printf(" %.16s", ctime(&ab.ac_btime));
+			if (format != NULL) {
+				(void)strftime(buf, sizeof(buf), format,
+				    localtime(&ab.ac_btime));
+				(void)printf(" %s", buf);
+			} else
+				(void)printf(" %.16s", ctime(&ab.ac_btime));
 		}
 		
 		/* exit time (starting time + elapsed time )*/
 		if (flags & AC_FTIME) {
 			t = ab.ac_btime;
 			t += (time_t)(ab.ac_etime / 1000000);
-			(void)printf(" %.16s", ctime(&t));
+			if (format != NULL) {
+				(void)strftime(buf, sizeof(buf), format,
+				    localtime(&t));
+				(void)printf(" %s", buf);
+			} else
+				(void)printf(" %.16s", ctime(&t));
 		}
 		printf("\n");
  	}
@@ -250,6 +269,7 @@ static void
 usage(void)
 {
 	(void)fprintf(stderr,
-"usage: lastcomm [-EScesu] [-f file] [command ...] [user ...] [terminal ...]\n");
+	    "usage: lastcomm [-EScesu] [-f file] [+format] [command ...] "
+	    "[user ...] [terminal ...]\n");
 	exit(1);
 }

From owner-svn-src-stable-9@FreeBSD.ORG  Thu May 24 09:59:59 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 52E6A106564A;
	Thu, 24 May 2012 09:59:59 +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 2379E8FC18;
	Thu, 24 May 2012 09:59: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 q4O9xwiN028974;
	Thu, 24 May 2012 09:59:58 GMT (envelope-from trasz@svn.freebsd.org)
Received: (from trasz@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4O9xwcd028972;
	Thu, 24 May 2012 09:59:58 GMT (envelope-from trasz@svn.freebsd.org)
Message-Id: <201205240959.q4O9xwcd028972@svn.freebsd.org>
From: Edward Tomasz Napierala <trasz@FreeBSD.org>
Date: Thu, 24 May 2012 09:59:58 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r235889 - stable/9/sys/kern
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 24 May 2012 09:59:59 -0000

Author: trasz
Date: Thu May 24 09:59:58 2012
New Revision: 235889
URL: http://svn.freebsd.org/changeset/base/235889

Log:
  MFC r226043:
  
  Remove assertion against empty NFSv4 ACLs.  An empty ACL is not exactly
  valid - we don't allow for setting it on a file, for example - but it's
  not something we should assert on.
  
  For STABLE kernel, it changes nothing, because it's not compiled with
  INVARIANTS.  If it was, it would fix crashes.  It also fixes an assert
  in libc encountered with NFSv4 without nfsuserd(8) running.

Modified:
  stable/9/sys/kern/subr_acl_nfs4.c
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/kern/subr_acl_nfs4.c
==============================================================================
--- stable/9/sys/kern/subr_acl_nfs4.c	Thu May 24 09:11:38 2012	(r235888)
+++ stable/9/sys/kern/subr_acl_nfs4.c	Thu May 24 09:59:58 2012	(r235889)
@@ -114,7 +114,6 @@ _acl_denies(const struct acl *aclp, int 
 	if (denied_explicitly != NULL)
 		*denied_explicitly = 0;
 
-	KASSERT(aclp->acl_cnt > 0, ("aclp->acl_cnt > 0"));
 	KASSERT(aclp->acl_cnt <= ACL_MAX_ENTRIES,
 	    ("aclp->acl_cnt <= ACL_MAX_ENTRIES"));
 
@@ -723,7 +722,6 @@ acl_nfs4_sync_mode_from_acl(mode_t *_mod
 	mode_t old_mode = *_mode, mode = 0, seen = 0;
 	const struct acl_entry *entry;
 
-	KASSERT(aclp->acl_cnt > 0, ("aclp->acl_cnt > 0"));
 	KASSERT(aclp->acl_cnt <= ACL_MAX_ENTRIES,
 	    ("aclp->acl_cnt <= ACL_MAX_ENTRIES"));
 
@@ -854,7 +852,6 @@ acl_nfs4_compute_inherited_acl_draft(con
 	struct acl_entry *entry, *copy;
 
 	KASSERT(child_aclp->acl_cnt == 0, ("child_aclp->acl_cnt == 0"));
-	KASSERT(parent_aclp->acl_cnt > 0, ("parent_aclp->acl_cnt > 0"));
 	KASSERT(parent_aclp->acl_cnt <= ACL_MAX_ENTRIES,
 	    ("parent_aclp->acl_cnt <= ACL_MAX_ENTRIES"));
 
@@ -1017,7 +1014,6 @@ acl_nfs4_inherit_entries(const struct ac
 	const struct acl_entry *parent_entry;
 	struct acl_entry *entry;
 
-	KASSERT(parent_aclp->acl_cnt > 0, ("parent_aclp->acl_cnt > 0"));
 	KASSERT(parent_aclp->acl_cnt <= ACL_MAX_ENTRIES,
 	    ("parent_aclp->acl_cnt <= ACL_MAX_ENTRIES"));
 

From owner-svn-src-stable-9@FreeBSD.ORG  Thu May 24 10:02:43 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 1B23B106566B;
	Thu, 24 May 2012 10:02:43 +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 056F58FC12;
	Thu, 24 May 2012 10:02: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 q4OA2gKu029182;
	Thu, 24 May 2012 10:02:42 GMT (envelope-from trasz@svn.freebsd.org)
Received: (from trasz@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4OA2gOf029180;
	Thu, 24 May 2012 10:02:42 GMT (envelope-from trasz@svn.freebsd.org)
Message-Id: <201205241002.q4OA2gOf029180@svn.freebsd.org>
From: Edward Tomasz Napierala <trasz@FreeBSD.org>
Date: Thu, 24 May 2012 10:02:42 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r235890 - stable/9/sys/kern
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 24 May 2012 10:02:43 -0000

Author: trasz
Date: Thu May 24 10:02:42 2012
New Revision: 235890
URL: http://svn.freebsd.org/changeset/base/235890

Log:
  MFC r234385:
  
  Fix bug where NFSv4 ACL enforcement code wouldn't unconditionally
  allow the owner to read and write ACL and file attributes when there
  was no entry with subject matching the owner.  In other words,
  'getfacl meh' shouldn't fail for the owner if the ACL looks like this:
  
  # file: meh
  # owner: trasz
  # group: wheel
           user:root:------a-------:------:allow

Modified:
  stable/9/sys/kern/subr_acl_nfs4.c
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/kern/subr_acl_nfs4.c
==============================================================================
--- stable/9/sys/kern/subr_acl_nfs4.c	Thu May 24 09:59:58 2012	(r235889)
+++ stable/9/sys/kern/subr_acl_nfs4.c	Thu May 24 10:02:42 2012	(r235890)
@@ -160,6 +160,9 @@ _acl_denies(const struct acl *aclp, int 
 			return (0);
 	}
 
+	if (access_mask == 0)
+		return (0);
+
 	return (1);
 }
 

From owner-svn-src-stable-9@FreeBSD.ORG  Thu May 24 10:20:23 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id AC95B106564A;
	Thu, 24 May 2012 10:20:23 +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 936368FC0A;
	Thu, 24 May 2012 10:20: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 q4OAKNRN029948;
	Thu, 24 May 2012 10:20:23 GMT (envelope-from trasz@svn.freebsd.org)
Received: (from trasz@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4OAKNVt029943;
	Thu, 24 May 2012 10:20:23 GMT (envelope-from trasz@svn.freebsd.org)
Message-Id: <201205241020.q4OAKNVt029943@svn.freebsd.org>
From: Edward Tomasz Napierala <trasz@FreeBSD.org>
Date: Thu, 24 May 2012 10:20:23 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r235891 - stable/9/bin/ps
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 24 May 2012 10:20:23 -0000

Author: trasz
Date: Thu May 24 10:20:23 2012
New Revision: 235891
URL: http://svn.freebsd.org/changeset/base/235891

Log:
  MFC r225868:
  
  Make ps(1) automatically size its column widths.

Modified:
  stable/9/bin/ps/extern.h
  stable/9/bin/ps/keyword.c
  stable/9/bin/ps/print.c
  stable/9/bin/ps/ps.c
  stable/9/bin/ps/ps.h
Directory Properties:
  stable/9/bin/ps/   (props changed)

Modified: stable/9/bin/ps/extern.h
==============================================================================
--- stable/9/bin/ps/extern.h	Thu May 24 10:02:42 2012	(r235890)
+++ stable/9/bin/ps/extern.h	Thu May 24 10:20:23 2012	(r235891)
@@ -39,63 +39,52 @@ extern fixpt_t ccpu;
 extern int cflag, eval, fscale, nlistread, rawcpu;
 extern unsigned long mempages;
 extern time_t now;
-extern int showthreads, sumrusage, termwidth, totwidth;
+extern int showthreads, sumrusage, termwidth;
 extern STAILQ_HEAD(velisthead, varent) varlist;
 
 __BEGIN_DECLS
-void	 arguments(KINFO *, VARENT *);
-void	 command(KINFO *, VARENT *);
-void	 cputime(KINFO *, VARENT *);
+char	 *arguments(KINFO *, VARENT *);
+char	 *command(KINFO *, VARENT *);
+char	 *cputime(KINFO *, VARENT *);
 int	 donlist(void);
-void	 elapsed(KINFO *, VARENT *);
-void	 elapseds(KINFO *, VARENT *);
-void	 emulname(KINFO *, VARENT *);
+char	 *elapsed(KINFO *, VARENT *);
+char	 *elapseds(KINFO *, VARENT *);
+char	 *emulname(KINFO *, VARENT *);
 VARENT	*find_varentry(VAR *);
 const	 char *fmt_argv(char **, char *, size_t);
 double	 getpcpu(const KINFO *);
-void	 kvar(KINFO *, VARENT *);
-void	 label(KINFO *, VARENT *);
-void	 loginclass(KINFO *, VARENT *);
-void	 logname(KINFO *, VARENT *);
-void	 longtname(KINFO *, VARENT *);
-void	 lstarted(KINFO *, VARENT *);
-void	 maxrss(KINFO *, VARENT *);
-void	 lockname(KINFO *, VARENT *);
-void	 mwchan(KINFO *, VARENT *);
-void	 nwchan(KINFO *, VARENT *);
-void	 pagein(KINFO *, VARENT *);
+char	 *kvar(KINFO *, VARENT *);
+char	 *label(KINFO *, VARENT *);
+char	 *loginclass(KINFO *, VARENT *);
+char	 *logname(KINFO *, VARENT *);
+char	 *longtname(KINFO *, VARENT *);
+char	 *lstarted(KINFO *, VARENT *);
+char	 *maxrss(KINFO *, VARENT *);
+char	 *lockname(KINFO *, VARENT *);
+char	 *mwchan(KINFO *, VARENT *);
+char	 *nwchan(KINFO *, VARENT *);
+char	 *pagein(KINFO *, VARENT *);
 void	 parsefmt(const char *, int);
-void	 pcpu(KINFO *, VARENT *);
-void	 pmem(KINFO *, VARENT *);
-void	 pri(KINFO *, VARENT *);
+char	 *pcpu(KINFO *, VARENT *);
+char	 *pmem(KINFO *, VARENT *);
+char	 *pri(KINFO *, VARENT *);
 void	 printheader(void);
-void	 priorityr(KINFO *, VARENT *);
-void	 egroupname(KINFO *, VARENT *);
-void	 rgroupname(KINFO *, VARENT *);
-void	 runame(KINFO *, VARENT *);
-void	 rvar(KINFO *, VARENT *);
-int	 s_comm(KINFO *);
-int	 s_cputime(KINFO *);
-int	 s_label(KINFO *);
-int	 s_loginclass(KINFO *);
-int	 s_logname(KINFO *);
-int	 s_egroupname(KINFO *);
-int	 s_rgroupname(KINFO *);
-int	 s_runame(KINFO *);
-int	 s_systime(KINFO *);
-int	 s_uname(KINFO *);
-int	 s_usertime(KINFO *);
+char	 *priorityr(KINFO *, VARENT *);
+char	 *egroupname(KINFO *, VARENT *);
+char	 *rgroupname(KINFO *, VARENT *);
+char	 *runame(KINFO *, VARENT *);
+char	 *rvar(KINFO *, VARENT *);
 void	 showkey(void);
-void	 started(KINFO *, VARENT *);
-void	 state(KINFO *, VARENT *);
-void	 systime(KINFO *, VARENT *);
-void	 tdev(KINFO *, VARENT *);
-void	 tdnam(KINFO *, VARENT *);
-void	 tname(KINFO *, VARENT *);
-void	 ucomm(KINFO *, VARENT *);
-void	 uname(KINFO *, VARENT *);
-void	 upr(KINFO *, VARENT *);
-void	 usertime(KINFO *, VARENT *);
-void	 vsize(KINFO *, VARENT *);
-void	 wchan(KINFO *, VARENT *);
+char	 *started(KINFO *, VARENT *);
+char	 *state(KINFO *, VARENT *);
+char	 *systime(KINFO *, VARENT *);
+char	 *tdev(KINFO *, VARENT *);
+char	 *tdnam(KINFO *, VARENT *);
+char	 *tname(KINFO *, VARENT *);
+char	 *ucomm(KINFO *, VARENT *);
+char	 *uname(KINFO *, VARENT *);
+char	 *upr(KINFO *, VARENT *);
+char	 *usertime(KINFO *, VARENT *);
+char	 *vsize(KINFO *, VARENT *);
+char	 *wchan(KINFO *, VARENT *);
 __END_DECLS

Modified: stable/9/bin/ps/keyword.c
==============================================================================
--- stable/9/bin/ps/keyword.c	Thu May 24 10:02:42 2012	(r235890)
+++ stable/9/bin/ps/keyword.c	Thu May 24 10:20:23 2012	(r235891)
@@ -57,178 +57,116 @@ static int  vcmp(const void *, const voi
 #define	KOFF(x)	offsetof(struct kinfo_proc, x)
 #define	ROFF(x)	offsetof(struct rusage, x)
 
-#define	EMULLEN	13		/* enough for "FreeBSD ELF32" */
 #define	LWPFMT	"d"
-#define	LWPLEN	6
 #define	NLWPFMT	"d"
-#define	NLWPLEN	4
 #define	UIDFMT	"u"
-#define	UIDLEN	5
 #define	PIDFMT	"d"
-#define	PIDLEN	5
-#define USERLEN (MAXLOGNAME - 1)
 
 /* PLEASE KEEP THE TABLE BELOW SORTED ALPHABETICALLY!!! */
 static VAR var[] = {
-	{"%cpu", "%CPU", NULL, 0, pcpu, NULL, 5, 0, CHAR, NULL, 0},
-	{"%mem", "%MEM", NULL, 0, pmem, NULL, 4, 0, CHAR, NULL, 0},
-	{"acflag", "ACFLG", NULL, 0, kvar, NULL, 3, KOFF(ki_acflag), USHORT,
-		"x", 0},
-	{"acflg", "", "acflag", 0, NULL, NULL, 0, 0, CHAR, NULL, 0},
-	{"args", "COMMAND", NULL, COMM|LJUST|USER, arguments, NULL, 16, 0,
+	{"%cpu", "%CPU", NULL, 0, pcpu, 0, CHAR, NULL, 0},
+	{"%mem", "%MEM", NULL, 0, pmem, 0, CHAR, NULL, 0},
+	{"acflag", "ACFLG", NULL, 0, kvar, KOFF(ki_acflag), USHORT, "x", 0},
+	{"acflg", "", "acflag", 0, NULL, 0, CHAR, NULL, 0},
+	{"args", "COMMAND", NULL, COMM|LJUST|USER, arguments, 0,
 		CHAR, NULL, 0},
-	{"blocked", "", "sigmask", 0, NULL, NULL, 0, 0, CHAR, NULL, 0},
-	{"caught", "", "sigcatch", 0, NULL, NULL, 0, 0, CHAR, NULL, 0},
-	{"class", "CLASS", NULL, LJUST, loginclass, s_loginclass,
-		MAXLOGNAME-1, 0, CHAR, NULL, 0},
-	{"comm", "COMMAND", NULL, LJUST, ucomm, s_comm,
-		COMMLEN + TDNAMLEN + 1, 0, CHAR, NULL, 0},
-	{"command", "COMMAND", NULL, COMM|LJUST|USER, command, NULL, 16, 0,
+	{"blocked", "", "sigmask", 0, NULL, 0, CHAR, NULL, 0},
+	{"caught", "", "sigcatch", 0, NULL, 0, CHAR, NULL, 0},
+	{"class", "CLASS", NULL, LJUST, loginclass, 0, CHAR, NULL, 0},
+	{"comm", "COMMAND", NULL, LJUST, ucomm, 0, CHAR, NULL, 0},
+	{"command", "COMMAND", NULL, COMM|LJUST|USER, command, 0,
 		CHAR, NULL, 0},
-	{"cpu", "CPU", NULL, 0, kvar, NULL, 3, KOFF(ki_estcpu), UINT, "d",
-		0},
-	{"cputime", "", "time", 0, NULL, NULL, 0, 0, CHAR, NULL, 0},
-	{"egid", "", "gid", 0, NULL, NULL, 0, 0, CHAR, NULL, 0},
-	{"egroup", "", "group", 0, NULL, NULL, 0, 0, CHAR, NULL, 0},
-	{"emul", "EMUL", NULL, LJUST, emulname, NULL, EMULLEN, 0, CHAR,
-		NULL, 0},
-	{"etime", "ELAPSED", NULL, USER, elapsed, NULL, 12, 0, CHAR, NULL, 0},
-	{"etimes", "ELAPSED", NULL, USER, elapseds, NULL, 12, 0, CHAR, NULL, 0},
-	{"euid", "", "uid", 0, NULL, NULL, 0, 0, CHAR, NULL, 0},
-	{"f", "F", NULL, 0, kvar, NULL, 8, KOFF(ki_flag), INT, "x", 0},
-	{"flags", "", "f", 0, NULL, NULL, 0, 0, CHAR, NULL, 0},
-	{"gid", "GID", NULL, 0, kvar, NULL, UIDLEN, KOFF(ki_groups),
-		UINT, UIDFMT, 0},
-	{"group", "GROUP", NULL, LJUST, egroupname, s_egroupname,
-	    USERLEN, 0, CHAR, NULL, 0},
-	{"ignored", "", "sigignore", 0, NULL, NULL, 0, 0, CHAR, NULL, 0},
-	{"inblk", "INBLK", NULL, USER, rvar, NULL, 4, ROFF(ru_inblock), LONG,
-		"ld", 0},
-	{"inblock", "", "inblk", 0, NULL, NULL, 0, 0, CHAR, NULL, 0},
-	{"jid", "JID", NULL, 0, kvar, NULL, 6, KOFF(ki_jid), INT, "d", 0},
-	{"jobc", "JOBC", NULL, 0, kvar, NULL, 4, KOFF(ki_jobc), SHORT, "d",
-		0},
-	{"ktrace", "KTRACE", NULL, 0, kvar, NULL, 8, KOFF(ki_traceflag), INT,
-		"x", 0},
-	{"label", "LABEL", NULL, LJUST, label, s_label, SHRT_MAX, 0, CHAR,
-	    NULL, 0},
-	{"lim", "LIM", NULL, 0, maxrss, NULL, 5, 0, CHAR, NULL, 0},
-	{"lockname", "LOCK", NULL, LJUST, lockname, NULL, 6, 0, CHAR, NULL,
-		0},
-	{"login", "LOGIN", NULL, LJUST, logname, s_logname, MAXLOGNAME-1,
-		0, CHAR, NULL, 0},
-	{"logname", "", "login", 0, NULL, NULL, 0, 0, CHAR, NULL, 0},
-	{"lstart", "STARTED", NULL, LJUST|USER, lstarted, NULL, 28, 0, CHAR,
-		NULL, 0},
-	{"lwp", "LWP", NULL, 0, kvar, NULL, LWPLEN, KOFF(ki_tid), UINT,
-		LWPFMT, 0},
-	{"majflt", "MAJFLT", NULL, USER, rvar, NULL, 4, ROFF(ru_majflt),
-		LONG, "ld", 0},
-	{"minflt", "MINFLT", NULL, USER, rvar, NULL, 4, ROFF(ru_minflt),
-		LONG, "ld", 0},
-	{"msgrcv", "MSGRCV", NULL, USER, rvar, NULL, 4, ROFF(ru_msgrcv),
-		LONG, "ld", 0},
-	{"msgsnd", "MSGSND", NULL, USER, rvar, NULL, 4, ROFF(ru_msgsnd),
-		LONG, "ld", 0},
-	{"mwchan", "MWCHAN", NULL, LJUST, mwchan, NULL, 6, 0, CHAR, NULL, 0},
-	{"ni", "", "nice", 0, NULL, NULL, 0, 0, CHAR, NULL, 0},
-	{"nice", "NI", NULL, 0, kvar, NULL, 2, KOFF(ki_nice), CHAR, "d",
-		0},
-	{"nivcsw", "NIVCSW", NULL, USER, rvar, NULL, 5, ROFF(ru_nivcsw),
-		LONG, "ld", 0},
-	{"nlwp", "NLWP", NULL, 0, kvar, NULL, NLWPLEN, KOFF(ki_numthreads),
-		UINT, NLWPFMT, 0},
-	{"nsignals", "", "nsigs", 0, NULL, NULL, 0, 0, CHAR, NULL, 0},
-	{"nsigs", "NSIGS", NULL, USER, rvar, NULL, 4, ROFF(ru_nsignals),
-		LONG, "ld", 0},
-	{"nswap", "NSWAP", NULL, USER, rvar, NULL, 4, ROFF(ru_nswap),
-		LONG, "ld", 0},
-	{"nvcsw", "NVCSW", NULL, USER, rvar, NULL, 5, ROFF(ru_nvcsw),
-		LONG, "ld", 0},
-	{"nwchan", "NWCHAN", NULL, LJUST, nwchan, NULL, sizeof(void *) * 2, 0,
-		CHAR, NULL, 0},
-	{"oublk", "OUBLK", NULL, USER, rvar, NULL, 4, ROFF(ru_oublock),
-		LONG, "ld", 0},
-	{"oublock", "", "oublk", 0, NULL, NULL, 0, 0, CHAR, NULL, 0},
-	{"paddr", "PADDR", NULL, 0, kvar, NULL, sizeof(void *) * 2,
-		KOFF(ki_paddr), KPTR, "lx", 0},
-	{"pagein", "PAGEIN", NULL, USER, pagein, NULL, 6, 0, CHAR, NULL, 0},
-	{"pcpu", "", "%cpu", 0, NULL, NULL, 0, 0, CHAR, NULL, 0},
-	{"pending", "", "sig", 0, NULL, NULL, 0, 0, CHAR, NULL, 0},
-	{"pgid", "PGID", NULL, 0, kvar, NULL, PIDLEN, KOFF(ki_pgid), UINT,
-		PIDFMT, 0},
-	{"pid", "PID", NULL, 0, kvar, NULL, PIDLEN, KOFF(ki_pid), UINT,
-		PIDFMT, 0},
-	{"pmem", "", "%mem", 0, NULL, NULL, 0, 0, CHAR, NULL, 0},
-	{"ppid", "PPID", NULL, 0, kvar, NULL, PIDLEN, KOFF(ki_ppid), UINT,
-		PIDFMT, 0},
-	{"pri", "PRI", NULL, 0, pri, NULL, 3, 0, CHAR, NULL, 0},
-	{"re", "RE", NULL, INF127, kvar, NULL, 3, KOFF(ki_swtime), UINT, "d",
-		0},
-	{"rgid", "RGID", NULL, 0, kvar, NULL, UIDLEN, KOFF(ki_rgid),
-		UINT, UIDFMT, 0},
-	{"rgroup", "RGROUP", NULL, LJUST, rgroupname, s_rgroupname,
-		USERLEN, 0, CHAR, NULL, 0},
-	{"rss", "RSS", NULL, 0, kvar, NULL, 6, KOFF(ki_rssize), PGTOK, "ld", 0},
-	{"rtprio", "RTPRIO", NULL, 0, priorityr, NULL, 7, KOFF(ki_pri), CHAR,
-		NULL, 0},
-	{"ruid", "RUID", NULL, 0, kvar, NULL, UIDLEN, KOFF(ki_ruid),
-		UINT, UIDFMT, 0},
-	{"ruser", "RUSER", NULL, LJUST, runame, s_runame, USERLEN,
-		0, CHAR, NULL, 0},
-	{"sid", "SID", NULL, 0, kvar, NULL, PIDLEN, KOFF(ki_sid), UINT,
-		PIDFMT, 0},
-	{"sig", "PENDING", NULL, 0, kvar, NULL, 8, KOFF(ki_siglist), INT,
-		"x", 0},
-	{"sigcatch", "CAUGHT", NULL, 0, kvar, NULL, 8, KOFF(ki_sigcatch),
-		UINT, "x", 0},
-	{"sigignore", "IGNORED", NULL, 0, kvar, NULL, 8, KOFF(ki_sigignore),
+	{"cpu", "CPU", NULL, 0, kvar, KOFF(ki_estcpu), UINT, "d", 0},
+	{"cputime", "", "time", 0, NULL, 0, CHAR, NULL, 0},
+	{"egid", "", "gid", 0, NULL, 0, CHAR, NULL, 0},
+	{"egroup", "", "group", 0, NULL, 0, CHAR, NULL, 0},
+	{"emul", "EMUL", NULL, LJUST, emulname, 0, CHAR, NULL, 0},
+	{"etime", "ELAPSED", NULL, USER, elapsed, 0, CHAR, NULL, 0},
+	{"etimes", "ELAPSED", NULL, USER, elapseds, 0, CHAR, NULL, 0},
+	{"euid", "", "uid", 0, NULL, 0, CHAR, NULL, 0},
+	{"f", "F", NULL, 0, kvar, KOFF(ki_flag), INT, "x", 0},
+	{"flags", "", "f", 0, NULL, 0, CHAR, NULL, 0},
+	{"gid", "GID", NULL, 0, kvar, KOFF(ki_groups), UINT, UIDFMT, 0},
+	{"group", "GROUP", NULL, LJUST, egroupname, 0, CHAR, NULL, 0},
+	{"ignored", "", "sigignore", 0, NULL, 0, CHAR, NULL, 0},
+	{"inblk", "INBLK", NULL, USER, rvar, ROFF(ru_inblock), LONG, "ld", 0},
+	{"inblock", "", "inblk", 0, NULL, 0, CHAR, NULL, 0},
+	{"jid", "JID", NULL, 0, kvar, KOFF(ki_jid), INT, "d", 0},
+	{"jobc", "JOBC", NULL, 0, kvar, KOFF(ki_jobc), SHORT, "d", 0},
+	{"ktrace", "KTRACE", NULL, 0, kvar, KOFF(ki_traceflag), INT, "x", 0},
+	{"label", "LABEL", NULL, LJUST, label, 0, CHAR, NULL, 0},
+	{"lim", "LIM", NULL, 0, maxrss, 0, CHAR, NULL, 0},
+	{"lockname", "LOCK", NULL, LJUST, lockname, 0, CHAR, NULL, 0},
+	{"login", "LOGIN", NULL, LJUST, logname, 0, CHAR, NULL, 0},
+	{"logname", "", "login", 0, NULL, 0, CHAR, NULL, 0},
+	{"lstart", "STARTED", NULL, LJUST|USER, lstarted, 0, CHAR, NULL, 0},
+	{"lwp", "LWP", NULL, 0, kvar, KOFF(ki_tid), UINT, LWPFMT, 0},
+	{"majflt", "MAJFLT", NULL, USER, rvar, ROFF(ru_majflt), LONG, "ld", 0},
+	{"minflt", "MINFLT", NULL, USER, rvar, ROFF(ru_minflt), LONG, "ld", 0},
+	{"msgrcv", "MSGRCV", NULL, USER, rvar, ROFF(ru_msgrcv), LONG, "ld", 0},
+	{"msgsnd", "MSGSND", NULL, USER, rvar, ROFF(ru_msgsnd), LONG, "ld", 0},
+	{"mwchan", "MWCHAN", NULL, LJUST, mwchan, 0, CHAR, NULL, 0},
+	{"ni", "", "nice", 0, NULL, 0, CHAR, NULL, 0},
+	{"nice", "NI", NULL, 0, kvar, KOFF(ki_nice), CHAR, "d", 0},
+	{"nivcsw", "NIVCSW", NULL, USER, rvar, ROFF(ru_nivcsw), LONG, "ld", 0},
+	{"nlwp", "NLWP", NULL, 0, kvar, KOFF(ki_numthreads), UINT, NLWPFMT, 0},
+	{"nsignals", "", "nsigs", 0, NULL, 0, CHAR, NULL, 0},
+	{"nsigs", "NSIGS", NULL, USER, rvar, ROFF(ru_nsignals), LONG, "ld", 0},
+	{"nswap", "NSWAP", NULL, USER, rvar, ROFF(ru_nswap), LONG, "ld", 0},
+	{"nvcsw", "NVCSW", NULL, USER, rvar, ROFF(ru_nvcsw), LONG, "ld", 0},
+	{"nwchan", "NWCHAN", NULL, LJUST, nwchan, 0, CHAR, NULL, 0},
+	{"oublk", "OUBLK", NULL, USER, rvar, ROFF(ru_oublock), LONG, "ld", 0},
+	{"oublock", "", "oublk", 0, NULL, 0, CHAR, NULL, 0},
+	{"paddr", "PADDR", NULL, 0, kvar, KOFF(ki_paddr), KPTR, "lx", 0},
+	{"pagein", "PAGEIN", NULL, USER, pagein, 0, CHAR, NULL, 0},
+	{"pcpu", "", "%cpu", 0, NULL, 0, CHAR, NULL, 0},
+	{"pending", "", "sig", 0, NULL, 0, CHAR, NULL, 0},
+	{"pgid", "PGID", NULL, 0, kvar, KOFF(ki_pgid), UINT, PIDFMT, 0},
+	{"pid", "PID", NULL, 0, kvar, KOFF(ki_pid), UINT, PIDFMT, 0},
+	{"pmem", "", "%mem", 0, NULL, 0, CHAR, NULL, 0},
+	{"ppid", "PPID", NULL, 0, kvar, KOFF(ki_ppid), UINT, PIDFMT, 0},
+	{"pri", "PRI", NULL, 0, pri, 0, CHAR, NULL, 0},
+	{"re", "RE", NULL, INF127, kvar, KOFF(ki_swtime), UINT, "d", 0},
+	{"rgid", "RGID", NULL, 0, kvar, KOFF(ki_rgid), UINT, UIDFMT, 0},
+	{"rgroup", "RGROUP", NULL, LJUST, rgroupname, 0, CHAR, NULL, 0},
+	{"rss", "RSS", NULL, 0, kvar, KOFF(ki_rssize), PGTOK, "ld", 0},
+	{"rtprio", "RTPRIO", NULL, 0, priorityr, KOFF(ki_pri), CHAR, NULL, 0},
+	{"ruid", "RUID", NULL, 0, kvar, KOFF(ki_ruid), UINT, UIDFMT, 0},
+	{"ruser", "RUSER", NULL, LJUST, runame, 0, CHAR, NULL, 0},
+	{"sid", "SID", NULL, 0, kvar, KOFF(ki_sid), UINT, PIDFMT, 0},
+	{"sig", "PENDING", NULL, 0, kvar, KOFF(ki_siglist), INT, "x", 0},
+	{"sigcatch", "CAUGHT", NULL, 0, kvar, KOFF(ki_sigcatch), UINT, "x", 0},
+	{"sigignore", "IGNORED", NULL, 0, kvar, KOFF(ki_sigignore),
 		UINT, "x", 0},
-	{"sigmask", "BLOCKED", NULL, 0, kvar, NULL, 8, KOFF(ki_sigmask),
-		UINT, "x", 0},
-	{"sl", "SL", NULL, INF127, kvar, NULL, 3, KOFF(ki_slptime), UINT, "d",
-		0},
-	{"start", "STARTED", NULL, LJUST|USER, started, NULL, 7, 0, CHAR, NULL,
-		0},
-	{"stat", "", "state", 0, NULL, NULL, 0, 0, CHAR, NULL, 0},
-	{"state", "STAT", NULL, 0, state, NULL, 4, 0, CHAR, NULL, 0},
-	{"svgid", "SVGID", NULL, 0, kvar, NULL, UIDLEN, KOFF(ki_svgid),
-		UINT, UIDFMT, 0},
-	{"svuid", "SVUID", NULL, 0, kvar, NULL, UIDLEN, KOFF(ki_svuid),
-		UINT, UIDFMT, 0},
-	{"systime", "SYSTIME", NULL, USER, systime, s_systime, 15, 0, CHAR,
-		NULL, 0},
-	{"tdaddr", "TDADDR", NULL, 0, kvar, NULL, sizeof(void *) * 2,
-		KOFF(ki_tdaddr), KPTR, "lx", 0},
-	{"tdev", "TDEV", NULL, 0, tdev, NULL, 5, 0, CHAR, NULL, 0},
-	{"tdnam", "TDNAM", NULL, LJUST, tdnam, NULL, COMMLEN, 0, CHAR, NULL, 0},
-	{"time", "TIME", NULL, USER, cputime, s_cputime, 15, 0, CHAR,
-		NULL, 0},
-	{"tpgid", "TPGID", NULL, 0, kvar, NULL, 4, KOFF(ki_tpgid), UINT,
-		PIDFMT, 0},
-	{"tsid", "TSID", NULL, 0, kvar, NULL, PIDLEN, KOFF(ki_tsid), UINT,
-		PIDFMT, 0},
-	{"tsiz", "TSIZ", NULL, 0, kvar, NULL, 4, KOFF(ki_tsize), PGTOK, "ld", 0},
-	{"tt", "TT ", NULL, 0, tname, NULL, 4, 0, CHAR, NULL, 0},
-	{"tty", "TTY", NULL, LJUST, longtname, NULL, 8, 0, CHAR, NULL, 0},
-	{"ucomm", "UCOMM", NULL, LJUST, ucomm, s_comm,
-		COMMLEN + TDNAMLEN + 1, 0, CHAR, NULL, 0},
-	{"uid", "UID", NULL, 0, kvar, NULL, UIDLEN, KOFF(ki_uid), UINT,
-		UIDFMT, 0},
-	{"upr", "UPR", NULL, 0, upr, NULL, 3, 0, CHAR, NULL, 0},
-	{"uprocp", "UPROCP", NULL, 0, kvar, NULL, sizeof(void *) * 2,
-		KOFF(ki_paddr), KPTR, "lx", 0},
-	{"user", "USER", NULL, LJUST, uname, s_uname, USERLEN, 0, CHAR,
-		NULL, 0},
-	{"usertime", "USERTIME", NULL, USER, usertime, s_usertime, 15, 0,
-		CHAR, NULL, 0},
-	{"usrpri", "", "upr", 0, NULL, NULL, 0, 0, CHAR, NULL, 0},
-	{"vsize", "", "vsz", 0, NULL, NULL, 0, 0, CHAR, NULL, 0},
-	{"vsz", "VSZ", NULL, 0, vsize, NULL, 6, 0, CHAR, NULL, 0},
-	{"wchan", "WCHAN", NULL, LJUST, wchan, NULL, 6, 0, CHAR, NULL, 0},
-	{"xstat", "XSTAT", NULL, 0, kvar, NULL, 4, KOFF(ki_xstat), USHORT,
-		"x", 0},
-	{"", NULL, NULL, 0, NULL, NULL, 0, 0, CHAR, NULL, 0},
+	{"sigmask", "BLOCKED", NULL, 0, kvar, KOFF(ki_sigmask), UINT, "x", 0},
+	{"sl", "SL", NULL, INF127, kvar, KOFF(ki_slptime), UINT, "d", 0},
+	{"start", "STARTED", NULL, LJUST|USER, started, 0, CHAR, NULL, 0},
+	{"stat", "", "state", 0, NULL, 0, CHAR, NULL, 0},
+	{"state", "STAT", NULL, LJUST, state, 0, CHAR, NULL, 0},
+	{"svgid", "SVGID", NULL, 0, kvar, KOFF(ki_svgid), UINT, UIDFMT, 0},
+	{"svuid", "SVUID", NULL, 0, kvar, KOFF(ki_svuid), UINT, UIDFMT, 0},
+	{"systime", "SYSTIME", NULL, USER, systime, 0, CHAR, NULL, 0},
+	{"tdaddr", "TDADDR", NULL, 0, kvar, KOFF(ki_tdaddr), KPTR, "lx", 0},
+	{"tdev", "TDEV", NULL, 0, tdev, 0, CHAR, NULL, 0},
+	{"tdnam", "TDNAM", NULL, LJUST, tdnam, 0, CHAR, NULL, 0},
+	{"time", "TIME", NULL, USER, cputime, 0, CHAR, NULL, 0},
+	{"tpgid", "TPGID", NULL, 0, kvar, KOFF(ki_tpgid), UINT, PIDFMT, 0},
+	{"tsid", "TSID", NULL, 0, kvar, KOFF(ki_tsid), UINT, PIDFMT, 0},
+	{"tsiz", "TSIZ", NULL, 0, kvar, KOFF(ki_tsize), PGTOK, "ld", 0},
+	{"tt", "TT ", NULL, 0, tname, 0, CHAR, NULL, 0},
+	{"tty", "TTY", NULL, LJUST, longtname, 0, CHAR, NULL, 0},
+	{"ucomm", "UCOMM", NULL, LJUST, ucomm, 0, CHAR, NULL, 0},
+	{"uid", "UID", NULL, 0, kvar, KOFF(ki_uid), UINT, UIDFMT, 0},
+	{"upr", "UPR", NULL, 0, upr, 0, CHAR, NULL, 0},
+	{"uprocp", "UPROCP", NULL, 0, kvar, KOFF(ki_paddr), KPTR, "lx", 0},
+	{"user", "USER", NULL, LJUST, uname, 0, CHAR, NULL, 0},
+	{"usertime", "USERTIME", NULL, USER, usertime, 0, CHAR, NULL, 0},
+	{"usrpri", "", "upr", 0, NULL, 0, CHAR, NULL, 0},
+	{"vsize", "", "vsz", 0, NULL, 0, CHAR, NULL, 0},
+	{"vsz", "VSZ", NULL, 0, vsize, 0, CHAR, NULL, 0},
+	{"wchan", "WCHAN", NULL, LJUST, wchan, 0, CHAR, NULL, 0},
+	{"xstat", "XSTAT", NULL, 0, kvar, KOFF(ki_xstat), USHORT, "x", 0},
+	{"", NULL, NULL, 0, NULL, 0, CHAR, NULL, 0},
 };
 
 void

Modified: stable/9/bin/ps/print.c
==============================================================================
--- stable/9/bin/ps/print.c	Thu May 24 10:02:42 2012	(r235890)
+++ stable/9/bin/ps/print.c	Thu May 24 10:20:23 2012	(r235891)
@@ -64,6 +64,9 @@ __FBSDID("$FreeBSD$");
 
 #include "ps.h"
 
+#define	COMMAND_WIDTH	16
+#define	ARGUMENTS_WIDTH	16
+
 #define	ps_pgtok(a)	(((a) * getpagesize()) / 1024)
 
 void
@@ -93,53 +96,42 @@ printheader(void)
 	(void)putchar('\n');
 }
 
-void
+char *
 arguments(KINFO *k, VARENT *ve)
 {
 	VAR *v;
-	int left;
-	char *cp, *vis_args;
+	char *vis_args;
 
 	v = ve->var;
 	if ((vis_args = malloc(strlen(k->ki_args) * 4 + 1)) == NULL)
 		errx(1, "malloc failed");
 	strvis(vis_args, k->ki_args, VIS_TAB | VIS_NL | VIS_NOSLASH);
-	if (STAILQ_NEXT(ve, next_ve) == NULL) {
-		/* last field */
-		if (termwidth == UNLIMITED) {
-			(void)printf("%s", vis_args);
-		} else {
-			left = termwidth - (totwidth - v->width);
-			if (left < 1) /* already wrapped, just use std width */
-				left = v->width;
-			for (cp = vis_args; --left >= 0 && *cp != '\0';)
-				(void)putchar(*cp++);
-		}
-	} else {
-		(void)printf("%-*.*s", v->width, v->width, vis_args);
-	}
-	free(vis_args);
+
+	if (STAILQ_NEXT(ve, next_ve) != NULL && strlen(vis_args) > ARGUMENTS_WIDTH)
+		vis_args[ARGUMENTS_WIDTH] = '\0';
+
+	return (vis_args);
 }
 
-void
+char *
 command(KINFO *k, VARENT *ve)
 {
 	VAR *v;
-	int left;
-	char *cp, *vis_env, *vis_args;
+	char *vis_args, *vis_env, *str;
 
 	v = ve->var;
 	if (cflag) {
 		/* If it is the last field, then don't pad */
 		if (STAILQ_NEXT(ve, next_ve) == NULL) {
-			if (k->ki_d.prefix)
-				(void)printf("%s", k->ki_d.prefix);
-			(void)printf("%s", k->ki_p->ki_comm);
-			if (showthreads && k->ki_p->ki_numthreads > 1)
-				(void)printf("/%s", k->ki_p->ki_tdname);
+			asprintf(&str, "%s%s%s%s",
+			    k->ki_d.prefix ? k->ki_d.prefix : "",
+			    k->ki_p->ki_comm,
+			    (showthreads && k->ki_p->ki_numthreads > 1) ? "/" : "",
+			    (showthreads && k->ki_p->ki_numthreads > 1) ? k->ki_p->ki_tdname : "");
 		} else
-			(void)printf("%-*s", v->width, k->ki_p->ki_comm);
-		return;
+			str = strdup(k->ki_p->ki_comm);
+
+		return (str);
 	}
 	if ((vis_args = malloc(strlen(k->ki_args) * 4 + 1)) == NULL)
 		errx(1, "malloc failed");
@@ -157,89 +149,84 @@ command(KINFO *k, VARENT *ve)
 		} else
 			vis_env = NULL;
 
-		if (termwidth == UNLIMITED) {
-			if (k->ki_d.prefix)
-				(void)printf("%s", k->ki_d.prefix);
-			if (vis_env)
-				(void)printf("%s ", vis_env);
-			(void)printf("%s", vis_args);
-		} else {
-			left = termwidth - (totwidth - v->width);
-			if (left < 1) /* already wrapped, just use std width */
-				left = v->width;
-			if ((cp = k->ki_d.prefix) != NULL)
-				while (--left >= 0 && *cp)
-					(void)putchar(*cp++);
-			if ((cp = vis_env) != NULL) {
-				while (--left >= 0 && *cp)
-					(void)putchar(*cp++);
-				if (--left >= 0)
-					putchar(' ');
-			}
-			for (cp = vis_args; --left >= 0 && *cp != '\0';)
-				(void)putchar(*cp++);
-		}
+		asprintf(&str, "%s%s%s%s",
+		    k->ki_d.prefix ? k->ki_d.prefix : "",
+		    vis_env ? vis_env : "",
+		    vis_env ? " " : "",
+		    vis_args);
+
 		if (vis_env != NULL)
 			free(vis_env);
-	} else
+		free(vis_args);
+	} else {
 		/* ki_d.prefix & ki_env aren't shown for interim fields */
-		(void)printf("%-*.*s", v->width, v->width, vis_args);
-	free(vis_args);
+		str = vis_args;
+
+		if (strlen(str) > COMMAND_WIDTH)
+			str[COMMAND_WIDTH] = '\0';
+	}
+
+	return (str);
 }
 
-void
+char *
 ucomm(KINFO *k, VARENT *ve)
 {
-	char tmpbuff[COMMLEN + TDNAMLEN + 2];
 	VAR *v;
+	char *str;
 
 	v = ve->var;
 	if (STAILQ_NEXT(ve, next_ve) == NULL) {	/* last field, don't pad */
-		if (k->ki_d.prefix)
-			(void)printf("%s", k->ki_d.prefix);
-		(void)printf("%s", k->ki_p->ki_comm);
-		if (showthreads && k->ki_p->ki_numthreads > 1)
-			printf("/%s", k->ki_p->ki_tdname);
+		asprintf(&str, "%s%s%s%s",
+		    k->ki_d.prefix ? k->ki_d.prefix : "",
+		    k->ki_p->ki_comm,
+		    (showthreads && k->ki_p->ki_numthreads > 1) ? "/" : "",
+		    (showthreads && k->ki_p->ki_numthreads > 1) ? k->ki_p->ki_tdname : "");
 	} else {
-		bzero(tmpbuff, sizeof(tmpbuff));
 		if (showthreads && k->ki_p->ki_numthreads > 1)
-			sprintf(tmpbuff, "%s/%s", k->ki_p->ki_comm,
-			    k->ki_p->ki_tdname);
+			asprintf(&str, "%s/%s", k->ki_p->ki_comm, k->ki_p->ki_tdname);
 		else
-			sprintf(tmpbuff, "%s", k->ki_p->ki_comm);
-		(void)printf("%-*s", v->width, tmpbuff);
+			str = strdup(k->ki_p->ki_comm);
 	}
+	return (str);
 }
 
-void
+char *
 tdnam(KINFO *k, VARENT *ve)
 {
 	VAR *v;
+	char *str;
 
 	v = ve->var;
 	if (showthreads && k->ki_p->ki_numthreads > 1)
-		(void)printf("%-*s", v->width, k->ki_p->ki_tdname);
+		str = strdup(k->ki_p->ki_tdname);
 	else
-		(void)printf("%-*s", v->width, "      ");
+		str = strdup("      ");
+
+	return (str);
 }
 
-void
+char *
 logname(KINFO *k, VARENT *ve)
 {
 	VAR *v;
-	char *s;
 
 	v = ve->var;
-	(void)printf("%-*s", v->width, (s = k->ki_p->ki_login, *s) ? s : "-");
+	if (*k->ki_p->ki_login == '\0')
+		return (NULL);
+	return (strdup(k->ki_p->ki_login));
 }
 
-void
+char *
 state(KINFO *k, VARENT *ve)
 {
 	int flag, tdflags;
-	char *cp;
+	char *cp, *buf;
 	VAR *v;
-	char buf[16];
+
+	buf = malloc(16);
+	if (buf == NULL)
+		errx(1, "malloc failed");
 
 	v = ve->var;
 	flag = k->ki_p->ki_flag;
@@ -301,278 +288,270 @@ state(KINFO *k, VARENT *ve)
 	if (flag & P_JAILED)
 		*cp++ = 'J';
 	*cp = '\0';
-	(void)printf("%-*s", v->width, buf);
+	return (buf);
 }
 
 #define	scalepri(x)	((x) - PZERO)
 
-void
+char *
 pri(KINFO *k, VARENT *ve)
 {
 	VAR *v;
+	char *str;
 
 	v = ve->var;
-	(void)printf("%*d", v->width, scalepri(k->ki_p->ki_pri.pri_level));
+	asprintf(&str, "%d", scalepri(k->ki_p->ki_pri.pri_level));
+	return (str);
 }
 
-void
+char *
 upr(KINFO *k, VARENT *ve)
 {
 	VAR *v;
+	char *str;
 
 	v = ve->var;
-	(void)printf("%*d", v->width, scalepri(k->ki_p->ki_pri.pri_user));
+	asprintf(&str, "%d", scalepri(k->ki_p->ki_pri.pri_user));
+	return (str);
 }
 #undef scalepri
 
-void
+char *
 uname(KINFO *k, VARENT *ve)
 {
 	VAR *v;
 
 	v = ve->var;
-	(void)printf("%-*s", v->width, user_from_uid(k->ki_p->ki_uid, 0));
-}
-
-int
-s_uname(KINFO *k)
-{
-	return (strlen(user_from_uid(k->ki_p->ki_uid, 0)));
+	return (strdup(user_from_uid(k->ki_p->ki_uid, 0)));
 }
 
-void
+char *
 egroupname(KINFO *k, VARENT *ve)
 {
 	VAR *v;
 
 	v = ve->var;
-	(void)printf("%-*s", v->width,
-	    group_from_gid(k->ki_p->ki_groups[0], 0));
-}
-
-int
-s_egroupname(KINFO *k)
-{
-	return (strlen(group_from_gid(k->ki_p->ki_groups[0], 0)));
+	return (strdup(group_from_gid(k->ki_p->ki_groups[0], 0)));
 }
 
-void
+char *
 rgroupname(KINFO *k, VARENT *ve)
 {
 	VAR *v;
 
 	v = ve->var;
-	(void)printf("%-*s", v->width, group_from_gid(k->ki_p->ki_rgid, 0));
-}
-
-int
-s_rgroupname(KINFO *k)
-{
-	return (strlen(group_from_gid(k->ki_p->ki_rgid, 0)));
+	return (strdup(group_from_gid(k->ki_p->ki_rgid, 0)));
 }
 
-void
+char *
 runame(KINFO *k, VARENT *ve)
 {
 	VAR *v;
 
 	v = ve->var;
-	(void)printf("%-*s", v->width, user_from_uid(k->ki_p->ki_ruid, 0));
+	return (strdup(user_from_uid(k->ki_p->ki_ruid, 0)));
 }
 
-int
-s_runame(KINFO *k)
-{
-	return (strlen(user_from_uid(k->ki_p->ki_ruid, 0)));
-}
-
-
-void
+char *
 tdev(KINFO *k, VARENT *ve)
 {
 	VAR *v;
 	dev_t dev;
-	char buff[16];
+	char *str;
 
 	v = ve->var;
 	dev = k->ki_p->ki_tdev;
 	if (dev == NODEV)
-		(void)printf("%*s", v->width, "??");
-	else {
-		(void)snprintf(buff, sizeof(buff),
-		    "%d/%d", major(dev), minor(dev));
-		(void)printf("%*s", v->width, buff);
-	}
+		str = strdup("??");
+	else
+		asprintf(&str, "%d/%d", major(dev), minor(dev));
+
+	return (str);
 }
 
-void
+char *
 tname(KINFO *k, VARENT *ve)
 {
 	VAR *v;
 	dev_t dev;
-	char *ttname;
+	char *ttname, *str;
 
 	v = ve->var;
 	dev = k->ki_p->ki_tdev;
 	if (dev == NODEV || (ttname = devname(dev, S_IFCHR)) == NULL)
-		(void)printf("%*s ", v->width - 1, "??");
+		str = strdup("?? ");
 	else {
 		if (strncmp(ttname, "tty", 3) == 0 ||
 		    strncmp(ttname, "cua", 3) == 0)
 			ttname += 3;
 		if (strncmp(ttname, "pts/", 4) == 0)
 			ttname += 4;
-		(void)printf("%*.*s%c", v->width - 1, v->width - 1, ttname,
+		asprintf(&str, "%s%c", ttname,
 		    k->ki_p->ki_kiflag & KI_CTTY ? ' ' : '-');
 	}
+
+	return (str);
 }
 
-void
+char *
 longtname(KINFO *k, VARENT *ve)
 {
 	VAR *v;
 	dev_t dev;
-	char *ttname;
+	const char *ttname;
 
 	v = ve->var;
 	dev = k->ki_p->ki_tdev;
 	if (dev == NODEV || (ttname = devname(dev, S_IFCHR)) == NULL)
-		(void)printf("%-*s", v->width, "??");
-	else
-		(void)printf("%-*s", v->width, ttname);
+		ttname = "??";
+
+	return (strdup(ttname));
 }
 
-void
+char *
 started(KINFO *k, VARENT *ve)
 {
 	VAR *v;
 	time_t then;
 	struct tm *tp;
 	static int use_ampm = -1;
-	char buf[100];
+	size_t buflen = 100;
+	char *buf;
+
+	buf = malloc(buflen);
+	if (buf == NULL)
+		errx(1, "malloc failed");
 
 	v = ve->var;
-	if (!k->ki_valid) {
-		(void)printf("%-*s", v->width, "-");
-		return;
-	}
+	if (!k->ki_valid)
+		return (NULL);
 	if (use_ampm < 0)
 		use_ampm = (*nl_langinfo(T_FMT_AMPM) != '\0');
 	then = k->ki_p->ki_start.tv_sec;
 	tp = localtime(&then);
 	if (now - k->ki_p->ki_start.tv_sec < 24 * 3600) {
-		(void)strftime(buf, sizeof(buf),
+		(void)strftime(buf, buflen,
 		    use_ampm ? "%l:%M%p" : "%k:%M  ", tp);
 	} else if (now - k->ki_p->ki_start.tv_sec < 7 * 86400) {
-		(void)strftime(buf, sizeof(buf),
+		(void)strftime(buf, buflen,
 		    use_ampm ? "%a%I%p" : "%a%H  ", tp);
 	} else
-		(void)strftime(buf, sizeof(buf), "%e%b%y", tp);
-	(void)printf("%-*s", v->width, buf);
+		(void)strftime(buf, buflen, "%e%b%y", tp);
+	return (buf);
 }
 
-void
+char *
 lstarted(KINFO *k, VARENT *ve)
 {
 	VAR *v;
 	time_t then;
-	char buf[100];
+	char *buf;
+	size_t buflen = 100;
+
+	buf = malloc(buflen);
+	if (buf == NULL)
+		errx(1, "malloc failed");
 
 	v = ve->var;
-	if (!k->ki_valid) {
-		(void)printf("%-*s", v->width, "-");
-		return;
-	}
+	if (!k->ki_valid)
+		return (NULL);
 	then = k->ki_p->ki_start.tv_sec;
-	(void)strftime(buf, sizeof(buf), "%c", localtime(&then));
-	(void)printf("%-*s", v->width, buf);
+	(void)strftime(buf, buflen, "%c", localtime(&then));
+	return (buf);
 }
 
-void
+char *
 lockname(KINFO *k, VARENT *ve)
 {
 	VAR *v;
+	char *str;
 
 	v = ve->var;
 	if (k->ki_p->ki_kiflag & KI_LOCKBLOCK) {
 		if (k->ki_p->ki_lockname[0] != 0)
-			(void)printf("%-*.*s", v->width, v->width,
-			    k->ki_p->ki_lockname);
+			str = strdup(k->ki_p->ki_lockname);
 		else
-			(void)printf("%-*s", v->width, "???");
+			str = strdup("???");
 	} else
-		(void)printf("%-*s", v->width, "-");
+		str = NULL;
+
+	return (str);
 }
 
-void
+char *
 wchan(KINFO *k, VARENT *ve)
 {
 	VAR *v;
+	char *str;
 
 	v = ve->var;
 	if (k->ki_p->ki_wchan) {
 		if (k->ki_p->ki_wmesg[0] != 0)
-			(void)printf("%-*.*s", v->width, v->width,
-			    k->ki_p->ki_wmesg);
+			str = strdup(k->ki_p->ki_wmesg);
 		else
-			(void)printf("%-*lx", v->width,
-			    (long)k->ki_p->ki_wchan);
+			asprintf(&str, "%lx", (long)k->ki_p->ki_wchan);
 	} else
-		(void)printf("%-*s", v->width, "-");
+		str = NULL;
+
+	return (str);
 }
 
-void
+char *
 nwchan(KINFO *k, VARENT *ve)
 {
 	VAR *v;
+	char *str;
 
 	v = ve->var;
-	if (k->ki_p->ki_wchan) {
-		(void)printf("%0*lx", v->width,
-		    (long)k->ki_p->ki_wchan);
-	} else
-		(void)printf("%-*s", v->width, "-");
+	if (k->ki_p->ki_wchan)
+		asprintf(&str, "%0lx", (long)k->ki_p->ki_wchan);
+	else
+		str = NULL;
+
+	return (str);
 }
 
-void
+char *
 mwchan(KINFO *k, VARENT *ve)
 {
 	VAR *v;
+	char *str;
 
 	v = ve->var;
 	if (k->ki_p->ki_wchan) {
 		if (k->ki_p->ki_wmesg[0] != 0)
-			(void)printf("%-*.*s", v->width, v->width,
-			    k->ki_p->ki_wmesg);
+			str = strdup(k->ki_p->ki_wmesg);
 		else
-			(void)printf("%-*lx", v->width,
-			    (long)k->ki_p->ki_wchan);
+                        asprintf(&str, "%lx", (long)k->ki_p->ki_wchan);
 	} else if (k->ki_p->ki_kiflag & KI_LOCKBLOCK) {
 		if (k->ki_p->ki_lockname[0]) {
-			(void)printf("%-*.*s", v->width, v->width,
-			    k->ki_p->ki_lockname);
+			str = strdup(k->ki_p->ki_lockname);
 		} else
-			(void)printf("%-*s", v->width, "???");
+			str = strdup("???");
 	} else
-		(void)printf("%-*s", v->width, "-");
+		str = NULL;
+
+	return (str);
 }
 
-void
+char *
 vsize(KINFO *k, VARENT *ve)
 {
 	VAR *v;
+	char *str;
 
 	v = ve->var;
-	(void)printf("%*lu", v->width, (u_long)(k->ki_p->ki_size / 1024));
+	asprintf(&str, "%lu", (u_long)(k->ki_p->ki_size / 1024));
+	return (str);
 }
 
-static void
+static char *
 printtime(KINFO *k, VARENT *ve, long secs, long psecs)
 /* psecs is "parts" of a second. first micro, then centi */
 {
 	VAR *v;
-	char obuff[128];
 	static char decimal_point;
+	char *str;
 
 	if (decimal_point == '\0')
 		decimal_point = localeconv()->decimal_point[0];
@@ -586,21 +565,12 @@ printtime(KINFO *k, VARENT *ve, long sec
 		secs += psecs / 100;
 		psecs = psecs % 100;
 	}
-	(void)snprintf(obuff, sizeof(obuff), "%ld:%02ld%c%02ld",
+	asprintf(&str, "%ld:%02ld%c%02ld",
 	    secs / 60, secs % 60, decimal_point, psecs);
-	(void)printf("%*s", v->width, obuff);
+	return (str);
 }
 
-static int
-sizetime(long secs)
-{
-
-	if (secs < 60)
-		return (7);
-	return (log10(secs / 60) + 7);
-}
-
-void
+char *
 cputime(KINFO *k, VARENT *ve)
 {
 	long secs, psecs;
@@ -616,10 +586,10 @@ cputime(KINFO *k, VARENT *ve)

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

From owner-svn-src-stable-9@FreeBSD.ORG  Thu May 24 10:31:18 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id F3DAC1065670;
	Thu, 24 May 2012 10:31:17 +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 DD8248FC12;
	Thu, 24 May 2012 10:31: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 q4OAVHwZ032440;
	Thu, 24 May 2012 10:31:17 GMT (envelope-from trasz@svn.freebsd.org)
Received: (from trasz@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4OAVHA3032438;
	Thu, 24 May 2012 10:31:17 GMT (envelope-from trasz@svn.freebsd.org)
Message-Id: <201205241031.q4OAVHA3032438@svn.freebsd.org>
From: Edward Tomasz Napierala <trasz@FreeBSD.org>
Date: Thu, 24 May 2012 10:31:17 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r235893 - stable/9/sys/kern
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 24 May 2012 10:31:18 -0000

Author: trasz
Date: Thu May 24 10:31:17 2012
New Revision: 235893
URL: http://svn.freebsd.org/changeset/base/235893

Log:
  MFC r232782:
  
  Remove useless thread_{lock,unlock}() in raccd.

Modified:
  stable/9/sys/kern/kern_racct.c
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/kern/kern_racct.c
==============================================================================
--- stable/9/sys/kern/kern_racct.c	Thu May 24 10:30:13 2012	(r235892)
+++ stable/9/sys/kern/kern_racct.c	Thu May 24 10:31:17 2012	(r235893)
@@ -718,11 +718,8 @@ racctd(void)
 			timevalsub(&wallclock, &p->p_stats->p_start);
 			PROC_LOCK(p);
 			PROC_SLOCK(p);
-			FOREACH_THREAD_IN_PROC(p, td) {
+			FOREACH_THREAD_IN_PROC(p, td)
 				ruxagg(p, td);
-				thread_lock(td);
-				thread_unlock(td);
-			}
 			runtime = cputick2usec(p->p_rux.rux_runtime);
 			PROC_SUNLOCK(p);
 #ifdef notyet

From owner-svn-src-stable-9@FreeBSD.ORG  Thu May 24 11:43:34 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 0DA88106566B;
	Thu, 24 May 2012 11:43:34 +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 EC4008FC14;
	Thu, 24 May 2012 11: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 q4OBhXZk035903;
	Thu, 24 May 2012 11:43:33 GMT (envelope-from trasz@svn.freebsd.org)
Received: (from trasz@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4OBhXih035901;
	Thu, 24 May 2012 11:43:33 GMT (envelope-from trasz@svn.freebsd.org)
Message-Id: <201205241143.q4OBhXih035901@svn.freebsd.org>
From: Edward Tomasz Napierala <trasz@FreeBSD.org>
Date: Thu, 24 May 2012 11:43:33 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r235900 - stable/9/sys/kern
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 24 May 2012 11:43:34 -0000

Author: trasz
Date: Thu May 24 11:43:33 2012
New Revision: 235900
URL: http://svn.freebsd.org/changeset/base/235900

Log:
  MFC r234381:
  
  Fix panic, triggered like this: "int main() { thr_exit(); }"

Modified:
  stable/9/sys/kern/kern_thr.c
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/kern/kern_thr.c
==============================================================================
--- stable/9/sys/kern/kern_thr.c	Thu May 24 11:24:44 2012	(r235899)
+++ stable/9/sys/kern/kern_thr.c	Thu May 24 11:43:33 2012	(r235900)
@@ -316,13 +316,13 @@ sys_thr_exit(struct thread *td, struct t
 	rw_wlock(&tidhash_lock);
 
 	PROC_LOCK(p);
-	racct_sub(p, RACCT_NTHR, 1);
 
 	/*
 	 * Shutting down last thread in the proc.  This will actually
 	 * call exit() in the trampoline when it returns.
 	 */
 	if (p->p_numthreads != 1) {
+		racct_sub(p, RACCT_NTHR, 1);
 		LIST_REMOVE(td, td_hash);
 		rw_wunlock(&tidhash_lock);
 		tdsigcleanup(td);

From owner-svn-src-stable-9@FreeBSD.ORG  Thu May 24 11:46:40 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 0E4E31065675;
	Thu, 24 May 2012 11:46:40 +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 E9F0D8FC20;
	Thu, 24 May 2012 11: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 q4OBkdjP036103;
	Thu, 24 May 2012 11:46:39 GMT (envelope-from trasz@svn.freebsd.org)
Received: (from trasz@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4OBkdBS036101;
	Thu, 24 May 2012 11:46:39 GMT (envelope-from trasz@svn.freebsd.org)
Message-Id: <201205241146.q4OBkdBS036101@svn.freebsd.org>
From: Edward Tomasz Napierala <trasz@FreeBSD.org>
Date: Thu, 24 May 2012 11:46:39 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r235901 - stable/9/sys/kern
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 24 May 2012 11:46:40 -0000

Author: trasz
Date: Thu May 24 11:46:39 2012
New Revision: 235901
URL: http://svn.freebsd.org/changeset/base/235901

Log:
  MFC r234380:
  
  Enforce upper bound on the input buffer length.

Modified:
  stable/9/sys/kern/kern_rctl.c
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/kern/kern_rctl.c
==============================================================================
--- stable/9/sys/kern/kern_rctl.c	Thu May 24 11:43:33 2012	(r235900)
+++ stable/9/sys/kern/kern_rctl.c	Thu May 24 11:46:39 2012	(r235901)
@@ -73,6 +73,7 @@ FEATURE(rctl, "Resource Limits");
 
 /* Default buffer size for rctl_get_rules(2). */
 #define	RCTL_DEFAULT_BUFSIZE	4096
+#define	RCTL_MAX_INBUFLEN	4096
 #define	RCTL_LOG_BUFSIZE	128
 
 /*
@@ -1191,6 +1192,8 @@ rctl_read_inbuf(char **inputstr, const c
 
 	if (inbuflen <= 0)
 		return (EINVAL);
+	if (inbuflen > RCTL_MAX_INBUFLEN)
+		return (E2BIG);
 
 	str = malloc(inbuflen + 1, M_RCTL, M_WAITOK);
 	error = copyinstr(inbufp, str, inbuflen, NULL);

From owner-svn-src-stable-9@FreeBSD.ORG  Thu May 24 11:50:15 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 1AC471065670;
	Thu, 24 May 2012 11:50:15 +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 03B018FC1E;
	Thu, 24 May 2012 11:50: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 q4OBoEit036298;
	Thu, 24 May 2012 11:50:14 GMT (envelope-from trasz@svn.freebsd.org)
Received: (from trasz@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4OBoELP036296;
	Thu, 24 May 2012 11:50:14 GMT (envelope-from trasz@svn.freebsd.org)
Message-Id: <201205241150.q4OBoELP036296@svn.freebsd.org>
From: Edward Tomasz Napierala <trasz@FreeBSD.org>
Date: Thu, 24 May 2012 11:50:14 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r235902 - stable/9/sys/fs/unionfs
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 24 May 2012 11:50:15 -0000

Author: trasz
Date: Thu May 24 11:50:14 2012
New Revision: 235902
URL: http://svn.freebsd.org/changeset/base/235902

Log:
  MFC r226234:
  
  Make unionfs also clear VAPPEND when clearing VWRITE, since VAPPEND
  is just a modifier for VWRITE.

Modified:
  stable/9/sys/fs/unionfs/union_vnops.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/fs/   (props changed)

Modified: stable/9/sys/fs/unionfs/union_vnops.c
==============================================================================
--- stable/9/sys/fs/unionfs/union_vnops.c	Thu May 24 11:46:39 2012	(r235901)
+++ stable/9/sys/fs/unionfs/union_vnops.c	Thu May 24 11:50:14 2012	(r235902)
@@ -736,7 +736,7 @@ unionfs_access(struct vop_access_args *a
 						return (error);
 				}
 			}
-			accmode &= ~VWRITE;
+			accmode &= ~(VWRITE | VAPPEND);
 			accmode |= VREAD; /* will copy to upper */
 		}
 		error = VOP_ACCESS(lvp, accmode, ap->a_cred, td);

From owner-svn-src-stable-9@FreeBSD.ORG  Thu May 24 12:28:12 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 8C8E71065673;
	Thu, 24 May 2012 12:28:12 +0000 (UTC)
	(envelope-from rmacklem@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 5CCFC8FC19;
	Thu, 24 May 2012 12:28: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 q4OCSCrC038068;
	Thu, 24 May 2012 12:28:12 GMT
	(envelope-from rmacklem@svn.freebsd.org)
Received: (from rmacklem@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4OCSCZP038066;
	Thu, 24 May 2012 12:28:12 GMT
	(envelope-from rmacklem@svn.freebsd.org)
Message-Id: <201205241228.q4OCSCZP038066@svn.freebsd.org>
From: Rick Macklem <rmacklem@FreeBSD.org>
Date: Thu, 24 May 2012 12:28:12 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r235906 - stable/9/sys/fs/nfs
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 24 May 2012 12:28:12 -0000

Author: rmacklem
Date: Thu May 24 12:28:11 2012
New Revision: 235906
URL: http://svn.freebsd.org/changeset/base/235906

Log:
  MFC: r235568
  A problem with the NFSv4 server was reported by Andrew Leonard
  to freebsd-fs@, where the setfacl of an NFSv4 acl would fail.
  This was caused by the VOP_ACLCHECK() call for ZFS replying
  EOPNOTSUPP. After discussion with rwatson@, it was determined
  that a call to VOP_ACLCHECK() before doing VOP_SETACL() is not
  required. This patch fixes the problem by deleting the
  VOP_ACLCHECK() call.

Modified:
  stable/9/sys/fs/nfs/nfs_commonacl.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/amd64/include/xen/   (props changed)
  stable/9/sys/boot/   (props changed)
  stable/9/sys/boot/i386/efi/   (props changed)
  stable/9/sys/boot/ia64/efi/   (props changed)
  stable/9/sys/boot/ia64/ski/   (props changed)
  stable/9/sys/boot/powerpc/boot1.chrp/   (props changed)
  stable/9/sys/boot/powerpc/ofw/   (props changed)
  stable/9/sys/cddl/contrib/opensolaris/   (props changed)
  stable/9/sys/conf/   (props changed)
  stable/9/sys/contrib/dev/acpica/   (props changed)
  stable/9/sys/contrib/octeon-sdk/   (props changed)
  stable/9/sys/contrib/pf/   (props changed)
  stable/9/sys/contrib/x86emu/   (props changed)
  stable/9/sys/dev/   (props changed)
  stable/9/sys/dev/e1000/   (props changed)
  stable/9/sys/dev/ixgbe/   (props changed)
  stable/9/sys/fs/   (props changed)
  stable/9/sys/fs/ntfs/   (props changed)
  stable/9/sys/modules/   (props changed)

Modified: stable/9/sys/fs/nfs/nfs_commonacl.c
==============================================================================
--- stable/9/sys/fs/nfs/nfs_commonacl.c	Thu May 24 12:27:27 2012	(r235905)
+++ stable/9/sys/fs/nfs/nfs_commonacl.c	Thu May 24 12:28:11 2012	(r235906)
@@ -468,9 +468,7 @@ nfsrv_setacl(vnode_t vp, NFSACL_T *aclp,
 		error = NFSERR_ATTRNOTSUPP;
 		goto out;
 	}
-	error = VOP_ACLCHECK(vp, ACL_TYPE_NFS4, aclp, cred, p);
-	if (!error)
-		error = VOP_SETACL(vp, ACL_TYPE_NFS4, aclp, cred, p);
+	error = VOP_SETACL(vp, ACL_TYPE_NFS4, aclp, cred, p);
 
 out:
 	NFSEXITCODE(error);

From owner-svn-src-stable-9@FreeBSD.ORG  Thu May 24 15:55:42 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id DE4B91065673;
	Thu, 24 May 2012 15:55:42 +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 C3E1F8FC1B;
	Thu, 24 May 2012 15:55: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 q4OFtgWO046812;
	Thu, 24 May 2012 15:55:42 GMT (envelope-from trasz@svn.freebsd.org)
Received: (from trasz@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4OFtgTb046809;
	Thu, 24 May 2012 15:55:42 GMT (envelope-from trasz@svn.freebsd.org)
Message-Id: <201205241555.q4OFtgTb046809@svn.freebsd.org>
From: Edward Tomasz Napierala <trasz@FreeBSD.org>
Date: Thu, 24 May 2012 15:55:42 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r235913 - stable/9/sys/kern
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 24 May 2012 15:55:43 -0000

Author: trasz
Date: Thu May 24 15:55:41 2012
New Revision: 235913
URL: http://svn.freebsd.org/changeset/base/235913

Log:
  MFC r234383:
  
  Stop treating system processes as special.  This fixes panics
  like the one triggered by this:
  
  # kldload geom_vinum
  # pwait `pgrep -S gv_worker` &
  # kldunload geom_vinum
  
  or this:
  
  GEOM_JOURNAL: Shutting down geom gjournal 3464572051.
  panic: destroying non-empty racct: 1 allocated for resource 6
  
  which were tracked by jh@ to be caused by checking p->p_flag,
  while it wasn't initialised yet.  Basically, during fork, the code
  checked p_flag, concluded the process isn't marked as P_SYSTEM,
  incremented the counter, and later on, when exiting, checked that
  the process was marked as P_SYSTEM, and thus didn't decrement it.
  
  Also, I believe there wasn't any good reason for checking P_SYSTEM
  in the first place.

Modified:
  stable/9/sys/kern/kern_racct.c
  stable/9/sys/kern/kern_rctl.c
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/kern/kern_racct.c
==============================================================================
--- stable/9/sys/kern/kern_racct.c	Thu May 24 15:25:35 2012	(r235912)
+++ stable/9/sys/kern/kern_racct.c	Thu May 24 15:55:41 2012	(r235913)
@@ -267,9 +267,6 @@ racct_add_locked(struct proc *p, int res
 	int error;
 #endif
 
-	if (p->p_flag & P_SYSTEM)
-		return (0);
-
 	SDT_PROBE(racct, kernel, rusage, add, p, resource, amount, 0, 0);
 
 	/*
@@ -344,9 +341,6 @@ void
 racct_add_force(struct proc *p, int resource, uint64_t amount)
 {
 
-	if (p->p_flag & P_SYSTEM)
-		return;
-
 	SDT_PROBE(racct, kernel, rusage, add_force, p, resource, amount, 0, 0);
 
 	/*
@@ -368,9 +362,6 @@ racct_set_locked(struct proc *p, int res
 	int error;
 #endif
 
-	if (p->p_flag & P_SYSTEM)
-		return (0);
-
 	SDT_PROBE(racct, kernel, rusage, set, p, resource, amount, 0, 0);
 
 	/*
@@ -426,9 +417,6 @@ racct_set_force(struct proc *p, int reso
 {
 	int64_t diff;
 
-	if (p->p_flag & P_SYSTEM)
-		return;
-
 	SDT_PROBE(racct, kernel, rusage, set, p, resource, amount, 0, 0);
 
 	/*
@@ -487,9 +475,6 @@ void
 racct_sub(struct proc *p, int resource, uint64_t amount)
 {
 
-	if (p->p_flag & P_SYSTEM)
-		return;
-
 	SDT_PROBE(racct, kernel, rusage, sub, p, resource, amount, 0, 0);
 
 	/*
@@ -556,12 +541,6 @@ racct_proc_fork(struct proc *parent, str
 	 */
 	racct_create(&child->p_racct);
 
-	/*
-	 * No resource accounting for kernel processes.
-	 */
-	if (child->p_flag & P_SYSTEM)
-		return (0);
-
 	PROC_LOCK(parent);
 	PROC_LOCK(child);
 	mtx_lock(&racct_lock);
@@ -711,8 +690,6 @@ racctd(void)
 		FOREACH_PROC_IN_SYSTEM(p) {
 			if (p->p_state != PRS_NORMAL)
 				continue;
-			if (p->p_flag & P_SYSTEM)
-				continue;
 
 			microuptime(&wallclock);
 			timevalsub(&wallclock, &p->p_stats->p_start);

Modified: stable/9/sys/kern/kern_rctl.c
==============================================================================
--- stable/9/sys/kern/kern_rctl.c	Thu May 24 15:25:35 2012	(r235912)
+++ stable/9/sys/kern/kern_rctl.c	Thu May 24 15:55:41 2012	(r235913)
@@ -994,11 +994,6 @@ rctl_rule_add(struct rctl_rule *rule)
 	case RCTL_SUBJECT_TYPE_PROCESS:
 		p = rule->rr_subject.rs_proc;
 		KASSERT(p != NULL, ("rctl_rule_add: NULL proc"));
-		/*
-		 * No resource limits for system processes.
-		 */
-		if (p->p_flag & P_SYSTEM)
-			return (EPERM);
 
 		rctl_racct_add_rule(p->p_racct, rule);
 		/*
@@ -1036,8 +1031,6 @@ rctl_rule_add(struct rctl_rule *rule)
 	 */
 	sx_assert(&allproc_lock, SA_LOCKED);
 	FOREACH_PROC_IN_SYSTEM(p) {
-		if (p->p_flag & P_SYSTEM)
-			continue;
 		cred = p->p_ucred;
 		switch (rule->rr_subject_type) {
 		case RCTL_SUBJECT_TYPE_USER:
@@ -1284,10 +1277,6 @@ sys_rctl_get_racct(struct thread *td, st
 			error = EINVAL;
 			goto out;
 		}
-		if (p->p_flag & P_SYSTEM) {
-			error = EINVAL;
-			goto out;
-		}
 		outputsbuf = rctl_racct_to_sbuf(p->p_racct, 0);
 		break;
 	case RCTL_SUBJECT_TYPE_USER:
@@ -1719,20 +1708,7 @@ rctl_proc_fork(struct proc *parent, stru
 
 	LIST_INIT(&child->p_racct->r_rule_links);
 
-	/*
-	 * No limits for kernel processes.
-	 */
-	if (child->p_flag & P_SYSTEM)
-		return (0);
-
-	/*
-	 * Nothing to inherit from P_SYSTEM parents.
-	 */
-	if (parent->p_racct == NULL) {
-		KASSERT(parent->p_flag & P_SYSTEM,
-		    ("non-system process without racct; p = %p", parent));
-		return (0);
-	}
+	KASSERT(parent->p_racct != NULL, ("process without racct; p = %p", parent));
 
 	rw_wlock(&rctl_lock);
 

From owner-svn-src-stable-9@FreeBSD.ORG  Thu May 24 16:11:14 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 5142D106566B;
	Thu, 24 May 2012 16:11:14 +0000 (UTC)
	(envelope-from sbruno@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 3ADF38FC16;
	Thu, 24 May 2012 16:11: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 q4OGBE6q047493;
	Thu, 24 May 2012 16:11:14 GMT (envelope-from sbruno@svn.freebsd.org)
Received: (from sbruno@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4OGBEiW047491;
	Thu, 24 May 2012 16:11:14 GMT (envelope-from sbruno@svn.freebsd.org)
Message-Id: <201205241611.q4OGBEiW047491@svn.freebsd.org>
From: Sean Bruno <sbruno@FreeBSD.org>
Date: Thu, 24 May 2012 16:11:14 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r235914 - stable/9/usr.sbin/mfiutil
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 24 May 2012 16:11:14 -0000

Author: sbruno
Date: Thu May 24 16:11:13 2012
New Revision: 235914
URL: http://svn.freebsd.org/changeset/base/235914

Log:
  MFC r235634
  
  Decode new battery status indications.

Modified:
  stable/9/usr.sbin/mfiutil/mfi_show.c
Directory Properties:
  stable/9/usr.sbin/mfiutil/   (props changed)

Modified: stable/9/usr.sbin/mfiutil/mfi_show.c
==============================================================================
--- stable/9/usr.sbin/mfiutil/mfi_show.c	Thu May 24 15:55:41 2012	(r235913)
+++ stable/9/usr.sbin/mfiutil/mfi_show.c	Thu May 24 16:11:13 2012	(r235914)
@@ -224,7 +224,29 @@ show_battery(int ac, char **av)
 	}
 	if (stat.fw_status & MFI_BBU_STATE_DISCHARGE_ACTIVE) {
 		printf("%s DISCHARGING", comma ? "," : "");
+		comma = 1;
 	}
+	if (stat.fw_status & MFI_BBU_STATE_LEARN_CYC_REQ) {
+		printf("%s LEARN_CYCLE_REQUESTED", comma ? "," : "");
+		comma = 1;
+	}
+	if (stat.fw_status & MFI_BBU_STATE_LEARN_CYC_ACTIVE) {
+		printf("%s LEARN_CYCLE_ACTIVE", comma ? "," : "");
+		comma = 1;
+	}
+	if (stat.fw_status & MFI_BBU_STATE_LEARN_CYC_FAIL) {
+		printf("%s LEARN_CYCLE_FAIL", comma ? "," : "");
+		comma = 1;
+	}
+	if (stat.fw_status & MFI_BBU_STATE_LEARN_CYC_TIMEOUT) {
+		printf("%s LEARN_CYCLE_TIMEOUT", comma ? "," : "");
+		comma = 1;
+	}
+	if (stat.fw_status & MFI_BBU_STATE_I2C_ERR_DETECT) {
+		printf("%s I2C_ERROR_DETECT", comma ? "," : "");
+		comma = 1;
+	}
+
 	if (!comma)
 		printf(" normal");
 	printf("\n");

From owner-svn-src-stable-9@FreeBSD.ORG  Thu May 24 17:10:55 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 353C71065672;
	Thu, 24 May 2012 17:10:55 +0000 (UTC)
	(envelope-from bapt@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 1F0248FC0A;
	Thu, 24 May 2012 17:10: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 q4OHAs74050160;
	Thu, 24 May 2012 17:10:54 GMT (envelope-from bapt@svn.freebsd.org)
Received: (from bapt@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4OHAsRb050158;
	Thu, 24 May 2012 17:10:54 GMT (envelope-from bapt@svn.freebsd.org)
Message-Id: <201205241710.q4OHAsRb050158@svn.freebsd.org>
From: Baptiste Daroussin <bapt@FreeBSD.org>
Date: Thu, 24 May 2012 17:10:54 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r235919 - stable/9/usr.sbin/pkg
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 24 May 2012 17:10:55 -0000

Author: bapt
Date: Thu May 24 17:10:54 2012
New Revision: 235919
URL: http://svn.freebsd.org/changeset/base/235919

Log:
  Add missing \n when generating pkg.conf
  
  Reported by:	beat
  Approved by:	des (mentor)

Modified:
  stable/9/usr.sbin/pkg/pkg.c
Directory Properties:
  stable/9/usr.sbin/   (props changed)

Modified: stable/9/usr.sbin/pkg/pkg.c
==============================================================================
--- stable/9/usr.sbin/pkg/pkg.c	Thu May 24 16:48:33 2012	(r235918)
+++ stable/9/usr.sbin/pkg/pkg.c	Thu May 24 17:10:54 2012	(r235919)
@@ -371,7 +371,7 @@ bootstrap_pkg(void)
 		config = fopen(conf, "w+");
 		if (config == NULL)
 			goto cleanup;
-		fprintf(config, "packagesite: %s", url);
+		fprintf(config, "packagesite: %s\n", url);
 		fclose(config);
 	}
 

From owner-svn-src-stable-9@FreeBSD.ORG  Thu May 24 19:24:33 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 6A362106566B;
	Thu, 24 May 2012 19:24:33 +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 51B6F8FC12;
	Thu, 24 May 2012 19:24: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 q4OJOX5h055905;
	Thu, 24 May 2012 19:24:33 GMT (envelope-from bz@svn.freebsd.org)
Received: (from bz@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4OJOWRl055896;
	Thu, 24 May 2012 19:24:32 GMT (envelope-from bz@svn.freebsd.org)
Message-Id: <201205241924.q4OJOWRl055896@svn.freebsd.org>
From: "Bjoern A. Zeeb" <bz@FreeBSD.org>
Date: Thu, 24 May 2012 19:24:32 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r235926 - in stable/9: share/man/man4 sys/amd64/conf
	sys/boot/forth sys/conf sys/dev/wbwd sys/i386/conf
	sys/modules sys/modules/wbwd
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 24 May 2012 19:24:33 -0000

Author: bz
Date: Thu May 24 19:24:31 2012
New Revision: 235926
URL: http://svn.freebsd.org/changeset/base/235926

Log:
  MFC r232614:
  
   Provide wbwd(4), a driver for the watchdog timer found on various
   Winbond Super I/O chips.

Added:
  stable/9/share/man/man4/wbwd.4
     - copied unchanged from r232614, head/share/man/man4/wbwd.4
  stable/9/sys/dev/wbwd/
     - copied from r232614, head/sys/dev/wbwd/
  stable/9/sys/modules/wbwd/
     - copied from r232614, head/sys/modules/wbwd/
Modified:
  stable/9/sys/amd64/conf/GENERIC.hints
  stable/9/sys/amd64/conf/NOTES
  stable/9/sys/boot/forth/loader.conf
  stable/9/sys/conf/files.amd64
  stable/9/sys/conf/files.i386
  stable/9/sys/i386/conf/GENERIC.hints
  stable/9/sys/i386/conf/NOTES
  stable/9/sys/modules/Makefile
Directory Properties:
  stable/9/share/man/man4/   (props changed)
  stable/9/sys/   (props changed)
  stable/9/sys/boot/   (props changed)
  stable/9/sys/conf/   (props changed)
  stable/9/sys/dev/   (props changed)
  stable/9/sys/modules/   (props changed)

Copied: stable/9/share/man/man4/wbwd.4 (from r232614, head/share/man/man4/wbwd.4)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ stable/9/share/man/man4/wbwd.4	Thu May 24 19:24:31 2012	(r235926, copy of r232614, head/share/man/man4/wbwd.4)
@@ -0,0 +1,117 @@
+.\"-
+.\" Copyright (c) 2012 Bjoern A. Zeeb <bz@FreeBSD.org>
+.\" 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 6, 2012
+.Dt wbwd 4
+.Os
+.Sh NAME
+.Nm wbwd
+.Nd device driver for watchdog timer found on Winbond Super I/O chips
+.Sh SYNOPSIS
+To compile this driver into the kernel, place the following line in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device wbwd"
+.Ed
+.Pp
+Alternatively, to load the driver as a module at boot time, place the following
+line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+wbwd_load="YES"
+.Ed
+.Pp
+In
+.Pa /boot/device.hints :
+.Cd hint.wbwd.0.at="isa"
+.Sh DESCRIPTION
+The
+.Nm
+driver provides
+.Xr watchdog 4
+support for the watchdog interrupt timer present on at least the following
+Winbond Super I/O chips:
+.Pp
+.Bl -bullet -compact
+.It
+83627HF/F/HG/G Rev. G
+.It
+83627HF/F/HG/G Rev. J
+.It
+83627HF/F/HG/G Rev. UD-A
+.It
+83627DHG IC ver. 5
+.El
+.Sh SYSCTL VARIABLES
+The
+.Nm
+driver provides the following options as
+.Xr sysctl 8
+variables.
+.Bl -tag -width "xxxxxx"  
+.It Va dev.wbwd.0.timeout_override
+This variable allows to program the timer to a value independent on the one
+provided by the
+.Xr watchdog 4
+framework while still relying on the regular updates from e.g.
+.Xr watchdogd 8 .
+This is particularly useful if your system provides multiple watchdogs and
+you want them to fire in a special sequence to trigger an NMI after a shorter
+period than the reset timeout for example.
+The value set must not be lower than the sleep time of
+.Xr watchdogd 8 .
+A value of 0 disables this feature and the timeout value provided by
+.Xr watchdog 4
+will be used.
+.It Va dev.wbwd.0.debug_verbose
+If set this sysctl will tell the driver to log its current state before and
+after the timer reset on each invocation from
+.Xr watchdog 9
+to the kernel message buffer for debugging.
+.It Va dev.wbwd.0.debug
+This read-only value gives the state of some registers on last update.
+.El
+.Pp
+The
+.Nm
+driver also provides further sysctl options that are hidden by default.
+See the source code for more information.
+.Sh SEE ALSO
+.Xr watchdog 4 ,
+.Xr device.hints 5 ,
+.Xr watchdog 8 ,
+.Xr watchdogd 8 ,
+.Xr watchdog 9
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Fx 10.0 .
+.Sh AUTHORS
+.An -nosplit
+This manual page was written by
+.An Bjoern A. Zeeb Aq bz@FreeBSD.org .

Modified: stable/9/sys/amd64/conf/GENERIC.hints
==============================================================================
--- stable/9/sys/amd64/conf/GENERIC.hints	Thu May 24 19:13:54 2012	(r235925)
+++ stable/9/sys/amd64/conf/GENERIC.hints	Thu May 24 19:24:31 2012	(r235926)
@@ -30,3 +30,4 @@ hint.atrtc.0.irq="8"
 hint.attimer.0.at="isa"
 hint.attimer.0.port="0x40"
 hint.attimer.0.irq="0"
+hint.wbwd.0.at="isa"

Modified: stable/9/sys/amd64/conf/NOTES
==============================================================================
--- stable/9/sys/amd64/conf/NOTES	Thu May 24 19:13:54 2012	(r235925)
+++ stable/9/sys/amd64/conf/NOTES	Thu May 24 19:24:31 2012	(r235926)
@@ -464,10 +464,12 @@ device		tpm
 #
 # ichwd: Intel ICH watchdog timer
 # amdsbwd: AMD SB7xx watchdog timer
+# wbwd: Winbond watchdog timer
 #
 device		ichwd
 device		amdsbwd
 device		viawd
+device		wbwd
 
 #
 # Temperature sensors:

Modified: stable/9/sys/boot/forth/loader.conf
==============================================================================
--- stable/9/sys/boot/forth/loader.conf	Thu May 24 19:13:54 2012	(r235925)
+++ stable/9/sys/boot/forth/loader.conf	Thu May 24 19:24:31 2012	(r235926)
@@ -488,6 +488,7 @@ vpd_load="NO"			# Vital Product Data ker
 vpo_load="NO"			# Parallel to SCSI interface driver
 amdtemp_load="NO"		# AMD K8/K10/K11 temperature monitor
 tpm_load="NO"			# Trusted Platform Module
+wbwd_load="NO"			# Winbond watchdog
 
 ##############################################################
 ###  ACPI settings  ##########################################

Modified: stable/9/sys/conf/files.amd64
==============================================================================
--- stable/9/sys/conf/files.amd64	Thu May 24 19:13:54 2012	(r235925)
+++ stable/9/sys/conf/files.amd64	Thu May 24 19:24:31 2012	(r235926)
@@ -269,6 +269,7 @@ dev/tpm/tpm_acpi.c		optional	tpm acpi
 dev/tpm/tpm_isa.c		optional	tpm isa
 dev/uart/uart_cpu_amd64.c	optional	uart
 dev/viawd/viawd.c		optional	viawd
+dev/wbwd/wbwd.c			optional	wbwd
 dev/wpi/if_wpi.c		optional	wpi
 dev/isci/isci.c							optional isci
 dev/isci/isci_controller.c					optional isci

Modified: stable/9/sys/conf/files.i386
==============================================================================
--- stable/9/sys/conf/files.i386	Thu May 24 19:13:54 2012	(r235925)
+++ stable/9/sys/conf/files.i386	Thu May 24 19:24:31 2012	(r235926)
@@ -247,6 +247,7 @@ dev/uart/uart_cpu_i386.c	optional uart
 dev/viawd/viawd.c		optional viawd
 dev/acpica/acpi_if.m		standard
 dev/acpi_support/acpi_wmi_if.m	standard
+dev/wbwd/wbwd.c			optional wbwd
 dev/wpi/if_wpi.c		optional wpi
 dev/isci/isci.c							optional isci
 dev/isci/isci_controller.c					optional isci

Modified: stable/9/sys/i386/conf/GENERIC.hints
==============================================================================
--- stable/9/sys/i386/conf/GENERIC.hints	Thu May 24 19:13:54 2012	(r235925)
+++ stable/9/sys/i386/conf/GENERIC.hints	Thu May 24 19:24:31 2012	(r235926)
@@ -38,3 +38,4 @@ hint.atrtc.0.irq="8"
 hint.attimer.0.at="isa"
 hint.attimer.0.port="0x40"
 hint.attimer.0.irq="0"
+hint.wbwd.0.at="isa"

Modified: stable/9/sys/i386/conf/NOTES
==============================================================================
--- stable/9/sys/i386/conf/NOTES	Thu May 24 19:13:54 2012	(r235925)
+++ stable/9/sys/i386/conf/NOTES	Thu May 24 19:24:31 2012	(r235926)
@@ -837,10 +837,12 @@ hint.pcf.0.irq="5"
 #
 # ichwd: Intel ICH watchdog timer
 # amdsbwd: AMD SB7xx watchdog timer
+# wbwd: Winbond watchdog timer
 #
 device		ichwd
 device		amdsbwd
 device		viawd
+device		wbwd
 
 #
 # Temperature sensors:

Modified: stable/9/sys/modules/Makefile
==============================================================================
--- stable/9/sys/modules/Makefile	Thu May 24 19:13:54 2012	(r235925)
+++ stable/9/sys/modules/Makefile	Thu May 24 19:24:31 2012	(r235926)
@@ -332,6 +332,7 @@ SUBDIR=	${_3dfx} \
 	vx \
 	${_vxge} \
 	wb \
+	${_wbwd} \
 	${_wi} \
 	wlan \
 	wlan_acl \
@@ -509,6 +510,7 @@ _stg=		stg
 _streams=	streams
 _svr4=		svr4
 _vxge=  	vxge
+_wbwd=		wbwd
 _wi=		wi
 _xe=		xe
 .if ${MK_ZFS} != "no" || defined(ALL_MODULES)
@@ -700,6 +702,7 @@ _vesa=		vesa
 _viawd=		viawd
 _vxge=  	vxge
 _x86bios=	x86bios
+_wbwd=		wbwd
 _wi=		wi
 _wpi=		wpi
 .if ${MK_SOURCELESS_UCODE} != "no"

From owner-svn-src-stable-9@FreeBSD.ORG  Fri May 25 01:19:29 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 33255106566C;
	Fri, 25 May 2012 01:19:29 +0000 (UTC) (envelope-from mm@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 184A88FC19;
	Fri, 25 May 2012 01:19: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 q4P1JTfZ071490;
	Fri, 25 May 2012 01:19:29 GMT (envelope-from mm@svn.freebsd.org)
Received: (from mm@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4P1JSP5071477;
	Fri, 25 May 2012 01:19:28 GMT (envelope-from mm@svn.freebsd.org)
Message-Id: <201205250119.q4P1JSP5071477@svn.freebsd.org>
From: Martin Matuska <mm@FreeBSD.org>
Date: Fri, 25 May 2012 01:19:28 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r235951 - in stable/9: cddl/contrib/opensolaris/cmd/zfs
	cddl/contrib/opensolaris/lib/libzfs/common
	cddl/contrib/opensolaris/lib/libzpool/common/sys
	sys/cddl/contrib/opensolaris/uts/comm...
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 25 May 2012 01:19:29 -0000

Author: mm
Date: Fri May 25 01:19:28 2012
New Revision: 235951
URL: http://svn.freebsd.org/changeset/base/235951

Log:
  MFC r235222:
  Import illumos changeset 13686:4bc0783f6064
  2703 add mechanism to report ZFS send progress
  
  If the zfs send command is used with the -v flag, the amount of bytes
  transmitted is reported in per second updates.
  
  References:
  https://www.illumos.org/issues/2703
  
  Obtained from:	illumos (issue #2703)

Modified:
  stable/9/cddl/contrib/opensolaris/cmd/zfs/zfs.8
  stable/9/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c
  stable/9/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h
  stable/9/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c
  stable/9/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h
  stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c
  stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c
  stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h
  stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_impl.h
  stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dataset.h
  stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
  stable/9/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h
Directory Properties:
  stable/9/cddl/contrib/opensolaris/   (props changed)
  stable/9/sys/   (props changed)
  stable/9/sys/cddl/contrib/opensolaris/   (props changed)

Modified: stable/9/cddl/contrib/opensolaris/cmd/zfs/zfs.8
==============================================================================
--- stable/9/cddl/contrib/opensolaris/cmd/zfs/zfs.8	Fri May 25 01:13:39 2012	(r235950)
+++ stable/9/cddl/contrib/opensolaris/cmd/zfs/zfs.8	Fri May 25 01:19:28 2012	(r235951)
@@ -20,6 +20,7 @@
 .\" Copyright (c) 2010, Sun Microsystems, Inc. All Rights Reserved.
 .\" Copyright (c) 2012 by Delphix. All rights reserved.
 .\" Copyright (c) 2012 Nexenta Systems, Inc. All Rights Reserved.
+.\" Copyright (c) 2012, Joyent, Inc. All rights reserved.
 .\" Copyright (c) 2011, Pawel Jakub Dawidek <pjd@FreeBSD.org>
 .\"
 .\" $FreeBSD$
@@ -2272,6 +2273,7 @@ flags to determine what data will be sen
 Print machine-parsable verbose information about the stream package generated.
 .It Fl v
 Print verbose information about the stream package generated.
+This information includes a per-second report of how much data has been sent.
 .El
 .Pp
 The format of the stream is committed. You will be able to receive your streams

Modified: stable/9/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c
==============================================================================
--- stable/9/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c	Fri May 25 01:13:39 2012	(r235950)
+++ stable/9/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c	Fri May 25 01:19:28 2012	(r235951)
@@ -24,6 +24,7 @@
  * Copyright 2012 Nexenta Systems, Inc. All rights reserved.
  * Copyright (c) 2012 by Delphix. All rights reserved.
  * Copyright 2012 Milan Jurik. All rights reserved.
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
  * Copyright (c) 2011-2012 Pawel Jakub Dawidek <pawel@dawidek.net>.
  * All rights reserved.
  * Copyright (c) 2012 Martin Matuska <mm@FreeBSD.org>. All rights reserved.
@@ -3579,6 +3580,7 @@ zfs_do_send(int argc, char **argv)
 			if (flags.verbose)
 				extraverbose = B_TRUE;
 			flags.verbose = B_TRUE;
+			flags.progress = B_TRUE;
 			break;
 		case 'D':
 			flags.dedup = B_TRUE;

Modified: stable/9/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h
==============================================================================
--- stable/9/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h	Fri May 25 01:13:39 2012	(r235950)
+++ stable/9/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h	Fri May 25 01:19:28 2012	(r235951)
@@ -25,7 +25,7 @@
  * Copyright (c) 2011 Pawel Jakub Dawidek <pawel@dawidek.net>.
  * All rights reserved.
  * Copyright (c) 2011 by Delphix. All rights reserved.
- * All rights reserved.
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
  * Copyright (c) 2012 Martin Matuska <mm@FreeBSD.org>. All rights reserved.
  */
 
@@ -573,6 +573,9 @@ typedef struct sendflags {
 
 	/* parsable verbose output (ie. -P) */
 	boolean_t parsable;
+
+	/* show progress (ie. -v) */
+	boolean_t progress;
 } sendflags_t;
 
 typedef boolean_t (snapfilter_cb_t)(zfs_handle_t *, void *);

Modified: stable/9/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c
==============================================================================
--- stable/9/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c	Fri May 25 01:13:39 2012	(r235950)
+++ stable/9/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c	Fri May 25 01:19:28 2012	(r235951)
@@ -22,6 +22,7 @@
 /*
  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
  * Copyright (c) 2011 by Delphix. All rights reserved.
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
  * Copyright (c) 2012 Pawel Jakub Dawidek <pawel@dawidek.net>.
  * All rights reserved.
  */
@@ -40,6 +41,7 @@
 #include <sys/mount.h>
 #include <pthread.h>
 #include <umem.h>
+#include <time.h>
 
 #include <libzfs.h>
 
@@ -67,6 +69,12 @@ typedef struct dedup_arg {
 	libzfs_handle_t  *dedup_hdl;
 } dedup_arg_t;
 
+typedef struct progress_arg {
+	zfs_handle_t *pa_zhp;
+	int pa_fd;
+	boolean_t pa_parsable;
+} progress_arg_t;
+
 typedef struct dataref {
 	uint64_t ref_guid;
 	uint64_t ref_object;
@@ -786,7 +794,7 @@ typedef struct send_dump_data {
 	char prevsnap[ZFS_MAXNAMELEN];
 	uint64_t prevsnap_obj;
 	boolean_t seenfrom, seento, replicate, doall, fromorigin;
-	boolean_t verbose, dryrun, parsable;
+	boolean_t verbose, dryrun, parsable, progress;
 	int outfd;
 	boolean_t err;
 	nvlist_t *fss;
@@ -979,10 +987,60 @@ hold_for_send(zfs_handle_t *zhp, send_du
 	return (error);
 }
 
+static void *
+send_progress_thread(void *arg)
+{
+	progress_arg_t *pa = arg;
+
+	zfs_cmd_t zc = { 0 };
+	zfs_handle_t *zhp = pa->pa_zhp;
+	libzfs_handle_t *hdl = zhp->zfs_hdl;
+	unsigned long long bytes;
+	char buf[16];
+
+	time_t t;
+	struct tm *tm;
+
+	assert(zhp->zfs_type == ZFS_TYPE_SNAPSHOT);
+	(void) strlcpy(zc.zc_name, zhp->zfs_name, sizeof (zc.zc_name));
+
+	if (!pa->pa_parsable)
+		(void) fprintf(stderr, "TIME        SENT   SNAPSHOT\n");
+
+	/*
+	 * Print the progress from ZFS_IOC_SEND_PROGRESS every second.
+	 */
+	for (;;) {
+		(void) sleep(1);
+
+		zc.zc_cookie = pa->pa_fd;
+		if (zfs_ioctl(hdl, ZFS_IOC_SEND_PROGRESS, &zc) != 0)
+			return ((void *)-1);
+
+		(void) time(&t);
+		tm = localtime(&t);
+		bytes = zc.zc_cookie;
+
+		if (pa->pa_parsable) {
+			(void) fprintf(stderr, "%02d:%02d:%02d\t%llu\t%s\n",
+			    tm->tm_hour, tm->tm_min, tm->tm_sec,
+			    bytes, zhp->zfs_name);
+		} else {
+			zfs_nicenum(bytes, buf, sizeof (buf));
+			(void) fprintf(stderr, "%02d:%02d:%02d   %5s   %s\n",
+			    tm->tm_hour, tm->tm_min, tm->tm_sec,
+			    buf, zhp->zfs_name);
+		}
+	}
+}
+
 static int
 dump_snapshot(zfs_handle_t *zhp, void *arg)
 {
 	send_dump_data_t *sdd = arg;
+	progress_arg_t pa = { 0 };
+	pthread_t tid;
+
 	char *thissnap;
 	int err;
 	boolean_t isfromsnap, istosnap, fromorigin;
@@ -1100,8 +1158,29 @@ dump_snapshot(zfs_handle_t *zhp, void *a
 	}
 
 	if (!sdd->dryrun) {
+		/*
+		 * If progress reporting is requested, spawn a new thread to
+		 * poll ZFS_IOC_SEND_PROGRESS at a regular interval.
+		 */
+		if (sdd->progress) {
+			pa.pa_zhp = zhp;
+			pa.pa_fd = sdd->outfd;
+			pa.pa_parsable = sdd->parsable;
+
+			if (err = pthread_create(&tid, NULL,
+			    send_progress_thread, &pa)) {
+				zfs_close(zhp);
+				return (err);
+			}
+		}
+
 		err = dump_ioctl(zhp, sdd->prevsnap, sdd->prevsnap_obj,
 		    fromorigin, sdd->outfd, sdd->debugnv);
+
+		if (sdd->progress) {
+			(void) pthread_cancel(tid);
+			(void) pthread_join(tid, NULL);
+		}
 	}
 
 	(void) strcpy(sdd->prevsnap, thissnap);
@@ -1451,12 +1530,13 @@ zfs_send(zfs_handle_t *zhp, const char *
 	sdd.fsavl = fsavl;
 	sdd.verbose = flags->verbose;
 	sdd.parsable = flags->parsable;
+	sdd.progress = flags->progress;
 	sdd.dryrun = flags->dryrun;
 	sdd.filter_cb = filter_func;
 	sdd.filter_cb_arg = cb_arg;
 	if (debugnvp)
 		sdd.debugnv = *debugnvp;
-	if (holdsnaps) {
+	if (holdsnaps || flags->progress) {
 		++holdseq;
 		(void) snprintf(sdd.holdtag, sizeof (sdd.holdtag),
 		    ".send-%d-%llu", getpid(), (u_longlong_t)holdseq);

Modified: stable/9/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h
==============================================================================
--- stable/9/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h	Fri May 25 01:13:39 2012	(r235950)
+++ stable/9/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h	Fri May 25 01:19:28 2012	(r235951)
@@ -20,6 +20,7 @@
  */
 /*
  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
  */
 
 #ifndef _SYS_ZFS_CONTEXT_H
@@ -228,6 +229,7 @@ struct proc {
 };
 
 extern struct proc p0;
+#define	curproc		(&p0)
 
 #define	PS_NONE		-1
 

Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c
==============================================================================
--- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c	Fri May 25 01:13:39 2012	(r235950)
+++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c	Fri May 25 01:19:28 2012	(r235951)
@@ -25,6 +25,8 @@
 /*
  * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
  * Copyright (c) 2011 by Delphix. All rights reserved.
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
+ * Copyright (c) 2012, Martin Matuska <mm@FreeBSD.org>. All rights reserved.
  */
 
 #include <sys/dmu.h>
@@ -54,38 +56,15 @@ int zfs_send_corrupt_data = B_FALSE;
 
 static char *dmu_recv_tag = "dmu_recv_tag";
 
-/*
- * The list of data whose inclusion in a send stream can be pending from
- * one call to backup_cb to another.  Multiple calls to dump_free() and
- * dump_freeobjects() can be aggregated into a single DRR_FREE or
- * DRR_FREEOBJECTS replay record.
- */
-typedef enum {
-	PENDING_NONE,
-	PENDING_FREE,
-	PENDING_FREEOBJECTS
-} pendop_t;
-
-struct backuparg {
-	dmu_replay_record_t *drr;
-	kthread_t *td;
-	struct file *fp;
-	offset_t *off;
-	objset_t *os;
-	zio_cksum_t zc;
-	uint64_t toguid;
-	int err;
-	pendop_t pending_op;
-};
-
 static int
-dump_bytes(struct backuparg *ba, void *buf, int len)
+dump_bytes(dmu_sendarg_t *dsp, void *buf, int len)
 {
+	dsl_dataset_t *ds = dsp->dsa_os->os_dsl_dataset;
 	struct uio auio;
 	struct iovec aiov;
 	ASSERT3U(len % 8, ==, 0);
 
-	fletcher_4_incremental_native(buf, len, &ba->zc);
+	fletcher_4_incremental_native(buf, len, &dsp->dsa_zc);
 	aiov.iov_base = buf;
 	aiov.iov_len = len;
 	auio.uio_iov = &aiov;
@@ -94,24 +73,28 @@ dump_bytes(struct backuparg *ba, void *b
 	auio.uio_segflg = UIO_SYSSPACE;
 	auio.uio_rw = UIO_WRITE;
 	auio.uio_offset = (off_t)-1;
-	auio.uio_td = ba->td;
+	auio.uio_td = dsp->dsa_td;
 #ifdef _KERNEL
-	if (ba->fp->f_type == DTYPE_VNODE)
+	if (dsp->dsa_fp->f_type == DTYPE_VNODE)
 		bwillwrite();
-	ba->err = fo_write(ba->fp, &auio, ba->td->td_ucred, 0, ba->td);
+	dsp->dsa_err = fo_write(dsp->dsa_fp, &auio, dsp->dsa_td->td_ucred, 0,
+	    dsp->dsa_td);
 #else
 	fprintf(stderr, "%s: returning EOPNOTSUPP\n", __func__);
-	ba->err = EOPNOTSUPP;
+	dsp->dsa_err = EOPNOTSUPP;
 #endif
-	*ba->off += len;
-	return (ba->err);
+	mutex_enter(&ds->ds_sendstream_lock);
+	*dsp->dsa_off += len;
+	mutex_exit(&ds->ds_sendstream_lock);
+
+	return (dsp->dsa_err);
 }
 
 static int
-dump_free(struct backuparg *ba, uint64_t object, uint64_t offset,
+dump_free(dmu_sendarg_t *dsp, uint64_t object, uint64_t offset,
     uint64_t length)
 {
-	struct drr_free *drrf = &(ba->drr->drr_u.drr_free);
+	struct drr_free *drrf = &(dsp->dsa_drr->drr_u.drr_free);
 
 	/*
 	 * If there is a pending op, but it's not PENDING_FREE, push it out,
@@ -120,13 +103,15 @@ dump_free(struct backuparg *ba, uint64_t
 	 * other DRR_FREE records.  DRR_FREEOBJECTS records can only be
 	 * aggregated with other DRR_FREEOBJECTS records.
 	 */
-	if (ba->pending_op != PENDING_NONE && ba->pending_op != PENDING_FREE) {
-		if (dump_bytes(ba, ba->drr, sizeof (dmu_replay_record_t)) != 0)
+	if (dsp->dsa_pending_op != PENDING_NONE &&
+	    dsp->dsa_pending_op != PENDING_FREE) {
+		if (dump_bytes(dsp, dsp->dsa_drr,
+		    sizeof (dmu_replay_record_t)) != 0)
 			return (EINTR);
-		ba->pending_op = PENDING_NONE;
+		dsp->dsa_pending_op = PENDING_NONE;
 	}
 
-	if (ba->pending_op == PENDING_FREE) {
+	if (dsp->dsa_pending_op == PENDING_FREE) {
 		/*
 		 * There should never be a PENDING_FREE if length is -1
 		 * (because dump_dnode is the only place where this
@@ -144,34 +129,35 @@ dump_free(struct backuparg *ba, uint64_t
 			return (0);
 		} else {
 			/* not a continuation.  Push out pending record */
-			if (dump_bytes(ba, ba->drr,
+			if (dump_bytes(dsp, dsp->dsa_drr,
 			    sizeof (dmu_replay_record_t)) != 0)
 				return (EINTR);
-			ba->pending_op = PENDING_NONE;
+			dsp->dsa_pending_op = PENDING_NONE;
 		}
 	}
 	/* create a FREE record and make it pending */
-	bzero(ba->drr, sizeof (dmu_replay_record_t));
-	ba->drr->drr_type = DRR_FREE;
+	bzero(dsp->dsa_drr, sizeof (dmu_replay_record_t));
+	dsp->dsa_drr->drr_type = DRR_FREE;
 	drrf->drr_object = object;
 	drrf->drr_offset = offset;
 	drrf->drr_length = length;
-	drrf->drr_toguid = ba->toguid;
+	drrf->drr_toguid = dsp->dsa_toguid;
 	if (length == -1ULL) {
-		if (dump_bytes(ba, ba->drr, sizeof (dmu_replay_record_t)) != 0)
+		if (dump_bytes(dsp, dsp->dsa_drr,
+		    sizeof (dmu_replay_record_t)) != 0)
 			return (EINTR);
 	} else {
-		ba->pending_op = PENDING_FREE;
+		dsp->dsa_pending_op = PENDING_FREE;
 	}
 
 	return (0);
 }
 
 static int
-dump_data(struct backuparg *ba, dmu_object_type_t type,
+dump_data(dmu_sendarg_t *dsp, dmu_object_type_t type,
     uint64_t object, uint64_t offset, int blksz, const blkptr_t *bp, void *data)
 {
-	struct drr_write *drrw = &(ba->drr->drr_u.drr_write);
+	struct drr_write *drrw = &(dsp->dsa_drr->drr_u.drr_write);
 
 
 	/*
@@ -180,19 +166,20 @@ dump_data(struct backuparg *ba, dmu_obje
 	 * the stream, since aggregation can't be done across operations
 	 * of different types.
 	 */
-	if (ba->pending_op != PENDING_NONE) {
-		if (dump_bytes(ba, ba->drr, sizeof (dmu_replay_record_t)) != 0)
+	if (dsp->dsa_pending_op != PENDING_NONE) {
+		if (dump_bytes(dsp, dsp->dsa_drr,
+		    sizeof (dmu_replay_record_t)) != 0)
 			return (EINTR);
-		ba->pending_op = PENDING_NONE;
+		dsp->dsa_pending_op = PENDING_NONE;
 	}
 	/* write a DATA record */
-	bzero(ba->drr, sizeof (dmu_replay_record_t));
-	ba->drr->drr_type = DRR_WRITE;
+	bzero(dsp->dsa_drr, sizeof (dmu_replay_record_t));
+	dsp->dsa_drr->drr_type = DRR_WRITE;
 	drrw->drr_object = object;
 	drrw->drr_type = type;
 	drrw->drr_offset = offset;
 	drrw->drr_length = blksz;
-	drrw->drr_toguid = ba->toguid;
+	drrw->drr_toguid = dsp->dsa_toguid;
 	drrw->drr_checksumtype = BP_GET_CHECKSUM(bp);
 	if (zio_checksum_table[drrw->drr_checksumtype].ci_dedup)
 		drrw->drr_checksumflags |= DRR_CHECKSUM_DEDUP;
@@ -201,42 +188,43 @@ dump_data(struct backuparg *ba, dmu_obje
 	DDK_SET_COMPRESS(&drrw->drr_key, BP_GET_COMPRESS(bp));
 	drrw->drr_key.ddk_cksum = bp->blk_cksum;
 
-	if (dump_bytes(ba, ba->drr, sizeof (dmu_replay_record_t)) != 0)
+	if (dump_bytes(dsp, dsp->dsa_drr, sizeof (dmu_replay_record_t)) != 0)
 		return (EINTR);
-	if (dump_bytes(ba, data, blksz) != 0)
+	if (dump_bytes(dsp, data, blksz) != 0)
 		return (EINTR);
 	return (0);
 }
 
 static int
-dump_spill(struct backuparg *ba, uint64_t object, int blksz, void *data)
+dump_spill(dmu_sendarg_t *dsp, uint64_t object, int blksz, void *data)
 {
-	struct drr_spill *drrs = &(ba->drr->drr_u.drr_spill);
+	struct drr_spill *drrs = &(dsp->dsa_drr->drr_u.drr_spill);
 
-	if (ba->pending_op != PENDING_NONE) {
-		if (dump_bytes(ba, ba->drr, sizeof (dmu_replay_record_t)) != 0)
+	if (dsp->dsa_pending_op != PENDING_NONE) {
+		if (dump_bytes(dsp, dsp->dsa_drr,
+		    sizeof (dmu_replay_record_t)) != 0)
 			return (EINTR);
-		ba->pending_op = PENDING_NONE;
+		dsp->dsa_pending_op = PENDING_NONE;
 	}
 
 	/* write a SPILL record */
-	bzero(ba->drr, sizeof (dmu_replay_record_t));
-	ba->drr->drr_type = DRR_SPILL;
+	bzero(dsp->dsa_drr, sizeof (dmu_replay_record_t));
+	dsp->dsa_drr->drr_type = DRR_SPILL;
 	drrs->drr_object = object;
 	drrs->drr_length = blksz;
-	drrs->drr_toguid = ba->toguid;
+	drrs->drr_toguid = dsp->dsa_toguid;
 
-	if (dump_bytes(ba, ba->drr, sizeof (dmu_replay_record_t)))
+	if (dump_bytes(dsp, dsp->dsa_drr, sizeof (dmu_replay_record_t)))
 		return (EINTR);
-	if (dump_bytes(ba, data, blksz))
+	if (dump_bytes(dsp, data, blksz))
 		return (EINTR);
 	return (0);
 }
 
 static int
-dump_freeobjects(struct backuparg *ba, uint64_t firstobj, uint64_t numobjs)
+dump_freeobjects(dmu_sendarg_t *dsp, uint64_t firstobj, uint64_t numobjs)
 {
-	struct drr_freeobjects *drrfo = &(ba->drr->drr_u.drr_freeobjects);
+	struct drr_freeobjects *drrfo = &(dsp->dsa_drr->drr_u.drr_freeobjects);
 
 	/*
 	 * If there is a pending op, but it's not PENDING_FREEOBJECTS,
@@ -245,13 +233,14 @@ dump_freeobjects(struct backuparg *ba, u
 	 * aggregated with other DRR_FREE records.  DRR_FREEOBJECTS records
 	 * can only be aggregated with other DRR_FREEOBJECTS records.
 	 */
-	if (ba->pending_op != PENDING_NONE &&
-	    ba->pending_op != PENDING_FREEOBJECTS) {
-		if (dump_bytes(ba, ba->drr, sizeof (dmu_replay_record_t)) != 0)
+	if (dsp->dsa_pending_op != PENDING_NONE &&
+	    dsp->dsa_pending_op != PENDING_FREEOBJECTS) {
+		if (dump_bytes(dsp, dsp->dsa_drr,
+		    sizeof (dmu_replay_record_t)) != 0)
 			return (EINTR);
-		ba->pending_op = PENDING_NONE;
+		dsp->dsa_pending_op = PENDING_NONE;
 	}
-	if (ba->pending_op == PENDING_FREEOBJECTS) {
+	if (dsp->dsa_pending_op == PENDING_FREEOBJECTS) {
 		/*
 		 * See whether this free object array can be aggregated
 		 * with pending one
@@ -261,42 +250,43 @@ dump_freeobjects(struct backuparg *ba, u
 			return (0);
 		} else {
 			/* can't be aggregated.  Push out pending record */
-			if (dump_bytes(ba, ba->drr,
+			if (dump_bytes(dsp, dsp->dsa_drr,
 			    sizeof (dmu_replay_record_t)) != 0)
 				return (EINTR);
-			ba->pending_op = PENDING_NONE;
+			dsp->dsa_pending_op = PENDING_NONE;
 		}
 	}
 
 	/* write a FREEOBJECTS record */
-	bzero(ba->drr, sizeof (dmu_replay_record_t));
-	ba->drr->drr_type = DRR_FREEOBJECTS;
+	bzero(dsp->dsa_drr, sizeof (dmu_replay_record_t));
+	dsp->dsa_drr->drr_type = DRR_FREEOBJECTS;
 	drrfo->drr_firstobj = firstobj;
 	drrfo->drr_numobjs = numobjs;
-	drrfo->drr_toguid = ba->toguid;
+	drrfo->drr_toguid = dsp->dsa_toguid;
 
-	ba->pending_op = PENDING_FREEOBJECTS;
+	dsp->dsa_pending_op = PENDING_FREEOBJECTS;
 
 	return (0);
 }
 
 static int
-dump_dnode(struct backuparg *ba, uint64_t object, dnode_phys_t *dnp)
+dump_dnode(dmu_sendarg_t *dsp, uint64_t object, dnode_phys_t *dnp)
 {
-	struct drr_object *drro = &(ba->drr->drr_u.drr_object);
+	struct drr_object *drro = &(dsp->dsa_drr->drr_u.drr_object);
 
 	if (dnp == NULL || dnp->dn_type == DMU_OT_NONE)
-		return (dump_freeobjects(ba, object, 1));
+		return (dump_freeobjects(dsp, object, 1));
 
-	if (ba->pending_op != PENDING_NONE) {
-		if (dump_bytes(ba, ba->drr, sizeof (dmu_replay_record_t)) != 0)
+	if (dsp->dsa_pending_op != PENDING_NONE) {
+		if (dump_bytes(dsp, dsp->dsa_drr,
+		    sizeof (dmu_replay_record_t)) != 0)
 			return (EINTR);
-		ba->pending_op = PENDING_NONE;
+		dsp->dsa_pending_op = PENDING_NONE;
 	}
 
 	/* write an OBJECT record */
-	bzero(ba->drr, sizeof (dmu_replay_record_t));
-	ba->drr->drr_type = DRR_OBJECT;
+	bzero(dsp->dsa_drr, sizeof (dmu_replay_record_t));
+	dsp->dsa_drr->drr_type = DRR_OBJECT;
 	drro->drr_object = object;
 	drro->drr_type = dnp->dn_type;
 	drro->drr_bonustype = dnp->dn_bonustype;
@@ -304,19 +294,19 @@ dump_dnode(struct backuparg *ba, uint64_
 	drro->drr_bonuslen = dnp->dn_bonuslen;
 	drro->drr_checksumtype = dnp->dn_checksum;
 	drro->drr_compress = dnp->dn_compress;
-	drro->drr_toguid = ba->toguid;
+	drro->drr_toguid = dsp->dsa_toguid;
 
-	if (dump_bytes(ba, ba->drr, sizeof (dmu_replay_record_t)) != 0)
+	if (dump_bytes(dsp, dsp->dsa_drr, sizeof (dmu_replay_record_t)) != 0)
 		return (EINTR);
 
-	if (dump_bytes(ba, DN_BONUS(dnp), P2ROUNDUP(dnp->dn_bonuslen, 8)) != 0)
+	if (dump_bytes(dsp, DN_BONUS(dnp), P2ROUNDUP(dnp->dn_bonuslen, 8)) != 0)
 		return (EINTR);
 
 	/* free anything past the end of the file */
-	if (dump_free(ba, object, (dnp->dn_maxblkid + 1) *
+	if (dump_free(dsp, object, (dnp->dn_maxblkid + 1) *
 	    (dnp->dn_datablkszsec << SPA_MINBLOCKSHIFT), -1ULL))
 		return (EINTR);
-	if (ba->err)
+	if (dsp->dsa_err)
 		return (EINTR);
 	return (0);
 }
@@ -330,7 +320,7 @@ static int
 backup_cb(spa_t *spa, zilog_t *zilog, const blkptr_t *bp, arc_buf_t *pbuf,
     const zbookmark_t *zb, const dnode_phys_t *dnp, void *arg)
 {
-	struct backuparg *ba = arg;
+	dmu_sendarg_t *dsp = arg;
 	dmu_object_type_t type = bp ? BP_GET_TYPE(bp) : DMU_OT_NONE;
 	int err = 0;
 
@@ -343,10 +333,10 @@ backup_cb(spa_t *spa, zilog_t *zilog, co
 	} else if (bp == NULL && zb->zb_object == DMU_META_DNODE_OBJECT) {
 		uint64_t span = BP_SPAN(dnp, zb->zb_level);
 		uint64_t dnobj = (zb->zb_blkid * span) >> DNODE_SHIFT;
-		err = dump_freeobjects(ba, dnobj, span >> DNODE_SHIFT);
+		err = dump_freeobjects(dsp, dnobj, span >> DNODE_SHIFT);
 	} else if (bp == NULL) {
 		uint64_t span = BP_SPAN(dnp, zb->zb_level);
-		err = dump_free(ba, zb->zb_object, zb->zb_blkid * span, span);
+		err = dump_free(dsp, zb->zb_object, zb->zb_blkid * span, span);
 	} else if (zb->zb_level > 0 || type == DMU_OT_OBJSET) {
 		return (0);
 	} else if (type == DMU_OT_DNODE) {
@@ -365,7 +355,7 @@ backup_cb(spa_t *spa, zilog_t *zilog, co
 		for (i = 0; i < blksz >> DNODE_SHIFT; i++) {
 			uint64_t dnobj = (zb->zb_blkid <<
 			    (DNODE_BLOCK_SHIFT - DNODE_SHIFT)) + i;
-			err = dump_dnode(ba, dnobj, blk+i);
+			err = dump_dnode(dsp, dnobj, blk+i);
 			if (err)
 				break;
 		}
@@ -380,7 +370,7 @@ backup_cb(spa_t *spa, zilog_t *zilog, co
 		    ZIO_FLAG_CANFAIL, &aflags, zb) != 0)
 			return (EIO);
 
-		err = dump_spill(ba, zb->zb_object, blksz, abuf->b_data);
+		err = dump_spill(dsp, zb->zb_object, blksz, abuf->b_data);
 		(void) arc_buf_remove_ref(abuf, &abuf);
 	} else { /* it's a level-0 block of a regular object */
 		uint32_t aflags = ARC_WAIT;
@@ -404,7 +394,7 @@ backup_cb(spa_t *spa, zilog_t *zilog, co
 			}
 		}
 
-		err = dump_data(ba, type, zb->zb_object, zb->zb_blkid * blksz,
+		err = dump_data(dsp, type, zb->zb_object, zb->zb_blkid * blksz,
 		    blksz, bp, abuf->b_data);
 		(void) arc_buf_remove_ref(abuf, &abuf);
 	}
@@ -414,13 +404,13 @@ backup_cb(spa_t *spa, zilog_t *zilog, co
 }
 
 int
-dmu_sendbackup(objset_t *tosnap, objset_t *fromsnap, boolean_t fromorigin,
-    struct file *fp, offset_t *off)
+dmu_send(objset_t *tosnap, objset_t *fromsnap, boolean_t fromorigin,
+    int outfd, struct file *fp, offset_t *off)
 {
 	dsl_dataset_t *ds = tosnap->os_dsl_dataset;
 	dsl_dataset_t *fromds = fromsnap ? fromsnap->os_dsl_dataset : NULL;
 	dmu_replay_record_t *drr;
-	struct backuparg ba;
+	dmu_sendarg_t *dsp;
 	int err;
 	uint64_t fromtxg = 0;
 
@@ -461,8 +451,10 @@ dmu_sendbackup(objset_t *tosnap, objset_
 #ifdef _KERNEL
 	if (dmu_objset_type(tosnap) == DMU_OST_ZFS) {
 		uint64_t version;
-		if (zfs_get_zplprop(tosnap, ZFS_PROP_VERSION, &version) != 0)
+		if (zfs_get_zplprop(tosnap, ZFS_PROP_VERSION, &version) != 0) {
+			kmem_free(drr, sizeof (dmu_replay_record_t));
 			return (EINVAL);
+		}
 		if (version == ZPL_VERSION_SA) {
 			DMU_SET_FEATUREFLAGS(
 			    drr->drr_u.drr_begin.drr_versioninfo,
@@ -489,47 +481,60 @@ dmu_sendbackup(objset_t *tosnap, objset_
 	if (fromorigin)
 		dsl_dataset_rele(fromds, FTAG);
 
-	ba.drr = drr;
-	ba.td = curthread;
-	ba.fp = fp;
-	ba.os = tosnap;
-	ba.off = off;
-	ba.toguid = ds->ds_phys->ds_guid;
-	ZIO_SET_CHECKSUM(&ba.zc, 0, 0, 0, 0);
-	ba.pending_op = PENDING_NONE;
+	dsp = kmem_zalloc(sizeof (dmu_sendarg_t), KM_SLEEP);
 
-	if (dump_bytes(&ba, drr, sizeof (dmu_replay_record_t)) != 0) {
-		kmem_free(drr, sizeof (dmu_replay_record_t));
-		return (ba.err);
+	dsp->dsa_drr = drr;
+	dsp->dsa_outfd = outfd;
+	dsp->dsa_proc = curproc;
+	dsp->dsa_td = curthread;
+	dsp->dsa_fp = fp;
+	dsp->dsa_os = tosnap;
+	dsp->dsa_off = off;
+	dsp->dsa_toguid = ds->ds_phys->ds_guid;
+	ZIO_SET_CHECKSUM(&dsp->dsa_zc, 0, 0, 0, 0);
+	dsp->dsa_pending_op = PENDING_NONE;
+
+	mutex_enter(&ds->ds_sendstream_lock);
+	list_insert_head(&ds->ds_sendstreams, dsp);
+	mutex_exit(&ds->ds_sendstream_lock);
+
+	if (dump_bytes(dsp, drr, sizeof (dmu_replay_record_t)) != 0) {
+		err = dsp->dsa_err;
+		goto out;
 	}
 
 	err = traverse_dataset(ds, fromtxg, TRAVERSE_PRE | TRAVERSE_PREFETCH,
-	    backup_cb, &ba);
+	    backup_cb, dsp);
 
-	if (ba.pending_op != PENDING_NONE)
-		if (dump_bytes(&ba, drr, sizeof (dmu_replay_record_t)) != 0)
+	if (dsp->dsa_pending_op != PENDING_NONE)
+		if (dump_bytes(dsp, drr, sizeof (dmu_replay_record_t)) != 0)
 			err = EINTR;
 
 	if (err) {
-		if (err == EINTR && ba.err)
-			err = ba.err;
-		kmem_free(drr, sizeof (dmu_replay_record_t));
-		return (err);
+		if (err == EINTR && dsp->dsa_err)
+			err = dsp->dsa_err;
+		goto out;
 	}
 
 	bzero(drr, sizeof (dmu_replay_record_t));
 	drr->drr_type = DRR_END;
-	drr->drr_u.drr_end.drr_checksum = ba.zc;
-	drr->drr_u.drr_end.drr_toguid = ba.toguid;
+	drr->drr_u.drr_end.drr_checksum = dsp->dsa_zc;
+	drr->drr_u.drr_end.drr_toguid = dsp->dsa_toguid;
 
-	if (dump_bytes(&ba, drr, sizeof (dmu_replay_record_t)) != 0) {
-		kmem_free(drr, sizeof (dmu_replay_record_t));
-		return (ba.err);
+	if (dump_bytes(dsp, drr, sizeof (dmu_replay_record_t)) != 0) {
+		err = dsp->dsa_err;
+		goto out;
 	}
 
+out:
+	mutex_enter(&ds->ds_sendstream_lock);
+	list_remove(&ds->ds_sendstreams, dsp);
+	mutex_exit(&ds->ds_sendstream_lock);
+
 	kmem_free(drr, sizeof (dmu_replay_record_t));
+	kmem_free(dsp, sizeof (dmu_sendarg_t));
 
-	return (0);
+	return (err);
 }
 
 int

Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c
==============================================================================
--- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c	Fri May 25 01:13:39 2012	(r235950)
+++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c	Fri May 25 01:19:28 2012	(r235951)
@@ -21,6 +21,7 @@
 /*
  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
  * Copyright (c) 2011 by Delphix. All rights reserved.
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
  * Copyright (c) 2011 Pawel Jakub Dawidek <pawel@dawidek.net>.
  * All rights reserved.
  * Portions Copyright (c) 2011 Martin Matuska <mm@FreeBSD.org>
@@ -32,6 +33,7 @@
 #include <sys/dsl_prop.h>
 #include <sys/dsl_synctask.h>
 #include <sys/dmu_traverse.h>
+#include <sys/dmu_impl.h>
 #include <sys/dmu_tx.h>
 #include <sys/arc.h>
 #include <sys/zio.h>
@@ -401,6 +403,8 @@ dsl_dataset_get_ref(dsl_pool_t *dp, uint
 		mutex_init(&ds->ds_lock, NULL, MUTEX_DEFAULT, NULL);
 		mutex_init(&ds->ds_recvlock, NULL, MUTEX_DEFAULT, NULL);
 		mutex_init(&ds->ds_opening_lock, NULL, MUTEX_DEFAULT, NULL);
+		mutex_init(&ds->ds_sendstream_lock, NULL, MUTEX_DEFAULT, NULL);
+
 		rw_init(&ds->ds_rwlock, 0, 0, 0);
 		cv_init(&ds->ds_exclusive_cv, NULL, CV_DEFAULT, NULL);
 
@@ -408,6 +412,9 @@ dsl_dataset_get_ref(dsl_pool_t *dp, uint
 		dsl_deadlist_open(&ds->ds_deadlist,
 		    mos, ds->ds_phys->ds_deadlist_obj);
 
+		list_create(&ds->ds_sendstreams, sizeof (dmu_sendarg_t),
+		    offsetof(dmu_sendarg_t, dsa_link));
+
 		if (err == 0) {
 			err = dsl_dir_open_obj(dp,
 			    ds->ds_phys->ds_dir_obj, NULL, ds, &ds->ds_dir);

Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h
==============================================================================
--- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h	Fri May 25 01:13:39 2012	(r235950)
+++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h	Fri May 25 01:19:28 2012	(r235951)
@@ -24,6 +24,7 @@
  */
 /*
  * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
  */
 
 /* Portions Copyright 2010 Robert Milkowski */
@@ -706,8 +707,8 @@ typedef void (*dmu_traverse_cb_t)(objset
 void dmu_traverse_objset(objset_t *os, uint64_t txg_start,
     dmu_traverse_cb_t cb, void *arg);
 
-int dmu_sendbackup(objset_t *tosnap, objset_t *fromsnap, boolean_t fromorigin,
-    struct file *fp, offset_t *off);
+int dmu_send(objset_t *tosnap, objset_t *fromsnap, boolean_t fromorigin,
+    int outfd, struct file *fp, offset_t *off);
 int dmu_send_estimate(objset_t *tosnap, objset_t *fromsnap,
     boolean_t fromorigin, uint64_t *sizep);
 

Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_impl.h
==============================================================================
--- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_impl.h	Fri May 25 01:13:39 2012	(r235950)
+++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_impl.h	Fri May 25 01:19:28 2012	(r235951)
@@ -21,6 +21,8 @@
 /*
  * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
+ * Copyright (c) 2012, Martin Matuska <mm@FreeBSD.org>. All rights reserved.
  */
 
 #ifndef _SYS_DMU_IMPL_H
@@ -31,6 +33,7 @@
 #include <sys/dnode.h>
 #include <sys/kstat.h>
 #include <sys/zfs_context.h>
+#include <sys/zfs_ioctl.h>
 
 #ifdef	__cplusplus
 extern "C" {
@@ -265,6 +268,33 @@ static xuio_stats_t xuio_stats = {
 	atomic_add_64(&xuio_stats.stat.value.ui64, (val))
 #define	XUIOSTAT_BUMP(stat)	XUIOSTAT_INCR(stat, 1)
 
+/*
+ * The list of data whose inclusion in a send stream can be pending from
+ * one call to backup_cb to another.  Multiple calls to dump_free() and
+ * dump_freeobjects() can be aggregated into a single DRR_FREE or
+ * DRR_FREEOBJECTS replay record.
+ */
+typedef enum {
+	PENDING_NONE,
+	PENDING_FREE,
+	PENDING_FREEOBJECTS
+} dmu_pendop_t;
+
+typedef struct dmu_sendarg {
+	list_node_t dsa_link;
+	dmu_replay_record_t *dsa_drr;
+	kthread_t *dsa_td;
+	struct file *dsa_fp;
+	int dsa_outfd;
+	struct proc *dsa_proc;
+	offset_t *dsa_off;
+	objset_t *dsa_os;
+	zio_cksum_t dsa_zc;
+	uint64_t dsa_toguid;
+	int dsa_err;
+	dmu_pendop_t dsa_pending_op;
+} dmu_sendarg_t;
+
 
 #ifdef	__cplusplus
 }

Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dataset.h
==============================================================================
--- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dataset.h	Fri May 25 01:13:39 2012	(r235950)
+++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dataset.h	Fri May 25 01:19:28 2012	(r235951)
@@ -23,6 +23,7 @@
  * Copyright (c) 2011 Pawel Jakub Dawidek <pawel@dawidek.net>.
  * All rights reserved.
  * Copyright (c) 2011 by Delphix. All rights reserved.
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
  */
 
 #ifndef	_SYS_DSL_DATASET_H
@@ -152,6 +153,9 @@ typedef struct dsl_dataset {
 	uint64_t ds_reserved;	/* cached refreservation */
 	uint64_t ds_quota;	/* cached refquota */
 
+	kmutex_t ds_sendstream_lock;
+	list_t ds_sendstreams;
+
 	/* Protected by ds_lock; keep at end of struct for better locality */
 	char ds_snapname[MAXNAMELEN];
 } dsl_dataset_t;

Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
==============================================================================
--- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c	Fri May 25 01:13:39 2012	(r235950)
+++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c	Fri May 25 01:19:28 2012	(r235951)
@@ -25,6 +25,7 @@
  * Portions Copyright 2011 Martin Matuska <mm@FreeBSD.org>
  * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
  * Copyright (c) 2011 by Delphix. All rights reserved.
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
  */
 
 #include <sys/types.h>
@@ -57,6 +58,7 @@
 #include <sys/dsl_prop.h>
 #include <sys/dsl_deleg.h>
 #include <sys/dmu_objset.h>
+#include <sys/dmu_impl.h>
 #include <sys/sunddi.h>
 #include <sys/policy.h>
 #include <sys/zone.h>
@@ -3933,7 +3935,8 @@ zfs_ioc_send(zfs_cmd_t *zc)
 		}
 
 		off = fp->f_offset;
-		error = dmu_sendbackup(tosnap, fromsnap, zc->zc_obj, fp, &off);
+		error = dmu_send(tosnap, fromsnap, zc->zc_obj,
+		    zc->zc_cookie, fp, &off);
 
 		if (off >= 0 && off <= MAXOFFSET_T)
 			fp->f_offset = off;
@@ -3945,6 +3948,49 @@ zfs_ioc_send(zfs_cmd_t *zc)
 	return (error);
 }
 
+/*
+ * inputs:
+ * zc_name	name of snapshot on which to report progress
+ * zc_cookie	file descriptor of send stream
+ *
+ * outputs:
+ * zc_cookie	number of bytes written in send stream thus far
+ */
+static int
+zfs_ioc_send_progress(zfs_cmd_t *zc)
+{
+	dsl_dataset_t *ds;
+	dmu_sendarg_t *dsp = NULL;
+	int error;
+
+	if ((error = dsl_dataset_hold(zc->zc_name, FTAG, &ds)) != 0)
+		return (error);
+
+	mutex_enter(&ds->ds_sendstream_lock);
+
+	/*
+	 * Iterate over all the send streams currently active on this dataset.
+	 * If there's one which matches the specified file descriptor _and_ the
+	 * stream was started by the current process, return the progress of
+	 * that stream.
+	 */
+	for (dsp = list_head(&ds->ds_sendstreams); dsp != NULL;
+	    dsp = list_next(&ds->ds_sendstreams, dsp)) {
+		if (dsp->dsa_outfd == zc->zc_cookie &&
+		    dsp->dsa_proc == curproc)
+			break;
+	}
+
+	if (dsp != NULL)
+		zc->zc_cookie = *(dsp->dsa_off);
+	else
+		error = ENOENT;
+
+	mutex_exit(&ds->ds_sendstream_lock);
+	dsl_dataset_rele(ds, FTAG);
+	return (error);
+}
+
 static int
 zfs_ioc_inject_fault(zfs_cmd_t *zc)
 {
@@ -4946,7 +4992,9 @@ static zfs_ioc_vec_t zfs_ioc_vec[] = {
 	{ zfs_ioc_space_written, zfs_secpolicy_read, DATASET_NAME, B_FALSE,
 	    B_TRUE },
 	{ zfs_ioc_space_snaps, zfs_secpolicy_read, DATASET_NAME, B_FALSE,
-	    B_TRUE }
+	    B_TRUE },
+	{ zfs_ioc_send_progress, zfs_secpolicy_read, DATASET_NAME, B_FALSE,
+	    B_FALSE }
 };
 
 int

Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h
==============================================================================
--- stable/9/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h	Fri May 25 01:13:39 2012	(r235950)
+++ stable/9/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h	Fri May 25 01:19:28 2012	(r235951)
@@ -23,6 +23,8 @@
  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
  * Copyright (c) 2011 by Delphix. All rights reserved.
  * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
+ * Copyright (c) 2012, Martin Matuska <mm@FreeBSD.org>. All rights reserved.
  */
 
 /* Portions Copyright 2010 Robert Milkowski */
@@ -794,6 +796,7 @@ typedef	unsigned long	zfs_ioc_t;
 #define	ZFS_IOC_POOL_REGUID		_IOWR('Z', 60, struct zfs_cmd)
 #define	ZFS_IOC_SPACE_WRITTEN		_IOWR('Z', 61, struct zfs_cmd)
 #define	ZFS_IOC_SPACE_SNAPS		_IOWR('Z', 62, struct zfs_cmd)
+#define	ZFS_IOC_SEND_PROGRESS		_IOWR('Z', 63, struct zfs_cmd)
 
 /*
  * Internal SPA load state.  Used by FMA diagnosis engine.

From owner-svn-src-stable-9@FreeBSD.ORG  Fri May 25 03:07:21 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id C5319106564A;
	Fri, 25 May 2012 03:07:21 +0000 (UTC) (envelope-from pfg@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id AD23E8FC08;
	Fri, 25 May 2012 03:07: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 q4P37LvL076590;
	Fri, 25 May 2012 03:07:21 GMT (envelope-from pfg@svn.freebsd.org)
Received: (from pfg@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4P37LZr076579;
	Fri, 25 May 2012 03:07:21 GMT (envelope-from pfg@svn.freebsd.org)
Message-Id: <201205250307.q4P37LZr076579@svn.freebsd.org>
From: "Pedro F. Giffuni" <pfg@FreeBSD.org>
Date: Fri, 25 May 2012 03:07:21 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r235965 - in stable/9/contrib/gcc: . config/rs6000
	config/sparc
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 25 May 2012 03:07:21 -0000

Author: pfg
Date: Fri May 25 03:07:20 2012
New Revision: 235965
URL: http://svn.freebsd.org/changeset/base/235965

Log:
  MFC:	r235623
  
  Bring in a subset of gcc fixes that were back ported to
  the GCC 4.1 branch and are available under GPLv2.
  
  Reviewed by:	mm
  Approved by:	jhb (mentor)

Modified:
  stable/9/contrib/gcc/config/rs6000/rs6000.md
  stable/9/contrib/gcc/config/sparc/sparc.md
  stable/9/contrib/gcc/cse.c
  stable/9/contrib/gcc/expr.c
  stable/9/contrib/gcc/fold-const.c
  stable/9/contrib/gcc/ipa-pure-const.c
  stable/9/contrib/gcc/ipa-utils.c
  stable/9/contrib/gcc/rtl.h
  stable/9/contrib/gcc/var-tracking.c
  stable/9/contrib/gcc/varasm.c
Directory Properties:
  stable/9/contrib/gcc/   (props changed)

Modified: stable/9/contrib/gcc/config/rs6000/rs6000.md
==============================================================================
--- stable/9/contrib/gcc/config/rs6000/rs6000.md	Fri May 25 03:02:56 2012	(r235964)
+++ stable/9/contrib/gcc/config/rs6000/rs6000.md	Fri May 25 03:07:20 2012	(r235965)
@@ -10075,6 +10075,7 @@
   ""
   "
 {
+  operands[1] = force_reg (Pmode, operands[1]);
   operands[2] = gen_reg_rtx (Pmode);
   operands[3] = gen_frame_mem (Pmode, operands[0]);
   operands[4] = gen_frame_mem (Pmode, operands[1]);

Modified: stable/9/contrib/gcc/config/sparc/sparc.md
==============================================================================
--- stable/9/contrib/gcc/config/sparc/sparc.md	Fri May 25 03:02:56 2012	(r235964)
+++ stable/9/contrib/gcc/config/sparc/sparc.md	Fri May 25 03:07:20 2012	(r235965)
@@ -5071,14 +5071,11 @@
   [(set_attr "type" "multi")
    (set_attr "length" "2")])
 
-;; The V8 architecture specifies that there must be 3 instructions between
-;; a Y register write and a use of it for correct results.
-
 (define_expand "divsi3"
-  [(parallel [(set (match_operand:SI 0 "register_operand" "=r,r")
-		   (div:SI (match_operand:SI 1 "register_operand" "r,r")
-			   (match_operand:SI 2 "input_operand" "rI,m")))
-	      (clobber (match_scratch:SI 3 "=&r,&r"))])]
+  [(parallel [(set (match_operand:SI 0 "register_operand" "")
+		   (div:SI (match_operand:SI 1 "register_operand" "")
+			   (match_operand:SI 2 "input_operand" "")))
+	      (clobber (match_scratch:SI 3 ""))])]
   "TARGET_V8 || TARGET_DEPRECATED_V8_INSNS"
 {
   if (TARGET_ARCH64)
@@ -5091,24 +5088,40 @@
     }
 })
 
+;; The V8 architecture specifies that there must be at least 3 instructions
+;; between a write to the Y register and a use of it for correct results.
+;; We try to fill one of them with a simple constant or a memory load.
+
 (define_insn "divsi3_sp32"
-  [(set (match_operand:SI 0 "register_operand" "=r,r")
-	(div:SI (match_operand:SI 1 "register_operand" "r,r")
-		(match_operand:SI 2 "input_operand" "rI,m")))
-   (clobber (match_scratch:SI 3 "=&r,&r"))]
-  "(TARGET_V8 || TARGET_DEPRECATED_V8_INSNS)
-   && TARGET_ARCH32"
-{
-  if (which_alternative == 0)
-    if (TARGET_V9)
-      return "sra\t%1, 31, %3\n\twr\t%3, 0, %%y\n\tsdiv\t%1, %2, %0";
-    else
-      return "sra\t%1, 31, %3\n\twr\t%3, 0, %%y\n\tnop\n\tnop\n\tnop\n\tsdiv\t%1, %2, %0";
-  else
-    if (TARGET_V9)
-      return "sra\t%1, 31, %3\n\twr\t%3, 0, %%y\n\tld\t%2, %3\n\tsdiv\t%1, %3, %0";
-    else
-      return "sra\t%1, 31, %3\n\twr\t%3, 0, %%y\n\tld\t%2, %3\n\tnop\n\tnop\n\tsdiv\t%1, %3, %0";
+  [(set (match_operand:SI 0 "register_operand" "=r,r,r")
+	(div:SI (match_operand:SI 1 "register_operand" "r,r,r")
+		(match_operand:SI 2 "input_operand" "rI,K,m")))
+   (clobber (match_scratch:SI 3 "=&r,&r,&r"))]
+  "(TARGET_V8 || TARGET_DEPRECATED_V8_INSNS) && TARGET_ARCH32"
+{
+  output_asm_insn ("sra\t%1, 31, %3", operands);
+  output_asm_insn ("wr\t%3, 0, %%y", operands);
+
+  switch (which_alternative)
+    {
+    case 0:
+      if (TARGET_V9)
+	return "sdiv\t%1, %2, %0";
+      else
+	return "nop\n\tnop\n\tnop\n\tsdiv\t%1, %2, %0";
+    case 1:
+      if (TARGET_V9)
+	return "sethi\t%%hi(%a2), %3\n\tsdiv\t%1, %3, %0";
+      else
+	return "sethi\t%%hi(%a2), %3\n\tnop\n\tnop\n\tsdiv\t%1, %3, %0";
+    case 2:
+      if (TARGET_V9)
+	return "ld\t%2, %3\n\tsdiv\t%1, %3, %0";
+      else
+	return "ld\t%2, %3\n\tnop\n\tnop\n\tsdiv\t%1, %3, %0";
+    default:
+      gcc_unreachable ();
+    }
 }
   [(set_attr "type" "multi")
    (set (attr "length")
@@ -5143,10 +5156,13 @@
    (clobber (match_scratch:SI 3 "=&r"))]
   "TARGET_V8 || TARGET_DEPRECATED_V8_INSNS"
 {
+  output_asm_insn ("sra\t%1, 31, %3", operands);
+  output_asm_insn ("wr\t%3, 0, %%y", operands);
+
   if (TARGET_V9)
-    return "sra\t%1, 31, %3\n\twr\t%3, 0, %%y\n\tsdivcc\t%1, %2, %0";
+    return "sdivcc\t%1, %2, %0";
   else
-    return "sra\t%1, 31, %3\n\twr\t%3, 0, %%y\n\tnop\n\tnop\n\tnop\n\tsdivcc\t%1, %2, %0";
+    return "nop\n\tnop\n\tnop\n\tsdivcc\t%1, %2, %0";
 }
   [(set_attr "type" "multi")
    (set (attr "length")
@@ -5161,29 +5177,48 @@
   "TARGET_V8 || TARGET_DEPRECATED_V8_INSNS"
   "")
 
-;; The V8 architecture specifies that there must be 3 instructions between
-;; a Y register write and a use of it for correct results.
+;; The V8 architecture specifies that there must be at least 3 instructions
+;; between a write to the Y register and a use of it for correct results.
+;; We try to fill one of them with a simple constant or a memory load.
 
 (define_insn "udivsi3_sp32"
-  [(set (match_operand:SI 0 "register_operand" "=r,&r,&r")
-	(udiv:SI (match_operand:SI 1 "nonimmediate_operand" "r,r,m")
-		 (match_operand:SI 2 "input_operand" "rI,m,r")))]
-  "(TARGET_V8 || TARGET_DEPRECATED_V8_INSNS)
-   && TARGET_ARCH32"
+  [(set (match_operand:SI 0 "register_operand" "=r,&r,&r,&r")
+	(udiv:SI (match_operand:SI 1 "nonimmediate_operand" "r,r,r,m")
+		 (match_operand:SI 2 "input_operand" "rI,K,m,r")))]
+  "(TARGET_V8 || TARGET_DEPRECATED_V8_INSNS) && TARGET_ARCH32"
 {
-  output_asm_insn ("wr\t%%g0, %%g0, %%y", operands);
+  output_asm_insn ("wr\t%%g0, 0, %%y", operands);
+
   switch (which_alternative)
     {
-    default:
-      return "nop\n\tnop\n\tnop\n\tudiv\t%1, %2, %0";
+    case 0:
+      if (TARGET_V9)
+	return "udiv\t%1, %2, %0";
+      else
+	return "nop\n\tnop\n\tnop\n\tudiv\t%1, %2, %0";
     case 1:
-      return "ld\t%2, %0\n\tnop\n\tnop\n\tudiv\t%1, %0, %0";
+      if (TARGET_V9)
+	return "sethi\t%%hi(%a2), %0\n\tudiv\t%1, %0, %0";
+      else
+	return "sethi\t%%hi(%a2), %0\n\tnop\n\tnop\n\tudiv\t%1, %0, %0";
     case 2:
-      return "ld\t%1, %0\n\tnop\n\tnop\n\tudiv\t%0, %2, %0";
+      if (TARGET_V9)
+	return "ld\t%2, %0\n\tudiv\t%1, %0, %0";
+      else
+	return "ld\t%2, %0\n\tnop\n\tnop\n\tudiv\t%1, %0, %0";
+    case 3:
+      if (TARGET_V9)
+	return "ld\t%1, %0\n\tudiv\t%0, %2, %0";
+      else
+	return "ld\t%1, %0\n\tnop\n\tnop\n\tudiv\t%0, %2, %0";
+    default:
+      gcc_unreachable ();
     }
 }
   [(set_attr "type" "multi")
-   (set_attr "length" "5")])
+   (set (attr "length")
+	(if_then_else (eq_attr "isa" "v9")
+		      (const_int 3) (const_int 5)))])
 
 (define_insn "udivsi3_sp64"
   [(set (match_operand:SI 0 "register_operand" "=r")
@@ -5209,13 +5244,14 @@
 		    (const_int 0)))
    (set (match_operand:SI 0 "register_operand" "=r")
 	(udiv:SI (match_dup 1) (match_dup 2)))]
-  "TARGET_V8
-   || TARGET_DEPRECATED_V8_INSNS"
+  "TARGET_V8 || TARGET_DEPRECATED_V8_INSNS"
 {
+  output_asm_insn ("wr\t%%g0, 0, %%y", operands);
+
   if (TARGET_V9)
-    return "wr\t%%g0, %%g0, %%y\n\tudivcc\t%1, %2, %0";
+    return "udivcc\t%1, %2, %0";
   else
-    return "wr\t%%g0, %%g0, %%y\n\tnop\n\tnop\n\tnop\n\tudivcc\t%1, %2, %0";
+    return "nop\n\tnop\n\tnop\n\tudivcc\t%1, %2, %0";
 }
   [(set_attr "type" "multi")
    (set (attr "length")

Modified: stable/9/contrib/gcc/cse.c
==============================================================================
--- stable/9/contrib/gcc/cse.c	Fri May 25 03:02:56 2012	(r235964)
+++ stable/9/contrib/gcc/cse.c	Fri May 25 03:07:20 2012	(r235965)
@@ -583,7 +583,8 @@ static void delete_reg_equiv (unsigned i
 static int mention_regs (rtx);
 static int insert_regs (rtx, struct table_elt *, int);
 static void remove_from_table (struct table_elt *, unsigned);
-static struct table_elt *lookup	(rtx, unsigned, enum machine_mode);
+static void remove_pseudo_from_table (rtx, unsigned);
+static struct table_elt *lookup (rtx, unsigned, enum machine_mode);
 static struct table_elt *lookup_for_remove (rtx, unsigned, enum machine_mode);
 static rtx lookup_as_function (rtx, enum rtx_code);
 static struct table_elt *insert (rtx, struct table_elt *, unsigned,
@@ -1381,6 +1382,19 @@ remove_from_table (struct table_elt *elt
   table_size--;
 }
 
+/* Same as above, but X is a pseudo-register.  */
+
+static void
+remove_pseudo_from_table (rtx x, unsigned int hash)
+{
+  struct table_elt *elt;
+
+  /* Because a pseudo-register can be referenced in more than one
+     mode, we might have to remove more than one table entry.  */
+  while ((elt = lookup_for_remove (x, hash, VOIDmode)))
+    remove_from_table (elt, hash);
+}
+
 /* Look up X in the hash table and return its table element,
    or 0 if X is not in the table.
 
@@ -1707,7 +1721,10 @@ merge_equiv_classes (struct table_elt *c
 	      delete_reg_equiv (REGNO (exp));
 	    }
 
-	  remove_from_table (elt, hash);
+	  if (REG_P (exp) && REGNO (exp) >= FIRST_PSEUDO_REGISTER)
+	    remove_pseudo_from_table (exp, hash);
+	  else
+	    remove_from_table (elt, hash);
 
 	  if (insert_regs (exp, class1, 0) || need_rehash)
 	    {
@@ -1803,14 +1820,7 @@ invalidate (rtx x, enum machine_mode ful
 	SUBREG_TICKED (regno) = -1;
 
 	if (regno >= FIRST_PSEUDO_REGISTER)
-	  {
-	    /* Because a register can be referenced in more than one mode,
-	       we might have to remove more than one table entry.  */
-	    struct table_elt *elt;
-
-	    while ((elt = lookup_for_remove (x, hash, GET_MODE (x))))
-	      remove_from_table (elt, hash);
-	  }
+	  remove_pseudo_from_table (x, hash);
 	else
 	  {
 	    HOST_WIDE_INT in_table

Modified: stable/9/contrib/gcc/expr.c
==============================================================================
--- stable/9/contrib/gcc/expr.c	Fri May 25 03:02:56 2012	(r235964)
+++ stable/9/contrib/gcc/expr.c	Fri May 25 03:07:20 2012	(r235965)
@@ -4750,14 +4750,7 @@ count_type_elements (tree type, bool all
 
     case UNION_TYPE:
     case QUAL_UNION_TYPE:
-      {
-	/* Ho hum.  How in the world do we guess here?  Clearly it isn't
-	   right to count the fields.  Guess based on the number of words.  */
-        HOST_WIDE_INT n = int_size_in_bytes (type);
-	if (n < 0)
-	  return -1;
-	return n / UNITS_PER_WORD;
-      }
+      return -1;
 
     case COMPLEX_TYPE:
       return 2;

Modified: stable/9/contrib/gcc/fold-const.c
==============================================================================
--- stable/9/contrib/gcc/fold-const.c	Fri May 25 03:02:56 2012	(r235964)
+++ stable/9/contrib/gcc/fold-const.c	Fri May 25 03:07:20 2012	(r235965)
@@ -6657,12 +6657,14 @@ fold_widened_comparison (enum tree_code 
   if (TYPE_PRECISION (TREE_TYPE (arg0)) <= TYPE_PRECISION (shorter_type))
     return NULL_TREE;
 
-  arg1_unw = get_unwidened (arg1, shorter_type);
+  arg1_unw = get_unwidened (arg1, NULL_TREE);
 
   /* If possible, express the comparison in the shorter mode.  */
   if ((code == EQ_EXPR || code == NE_EXPR
        || TYPE_UNSIGNED (TREE_TYPE (arg0)) == TYPE_UNSIGNED (shorter_type))
       && (TREE_TYPE (arg1_unw) == shorter_type
+	  || (TYPE_PRECISION (shorter_type)
+	      >= TYPE_PRECISION (TREE_TYPE (arg1_unw)))
 	  || (TREE_CODE (arg1_unw) == INTEGER_CST
 	      && (TREE_CODE (shorter_type) == INTEGER_TYPE
 		  || TREE_CODE (shorter_type) == BOOLEAN_TYPE)
@@ -10647,24 +10649,24 @@ fold_binary (enum tree_code code, tree t
 	  tree arg01 = TREE_OPERAND (arg0, 1);
 	  if (TREE_CODE (arg00) == LSHIFT_EXPR
 	      && integer_onep (TREE_OPERAND (arg00, 0)))
-	    return
-	      fold_build2 (code, type,
-			   build2 (BIT_AND_EXPR, TREE_TYPE (arg0),
-				   build2 (RSHIFT_EXPR, TREE_TYPE (arg00),
-					   arg01, TREE_OPERAND (arg00, 1)),
-				   fold_convert (TREE_TYPE (arg0),
-						 integer_one_node)),
-			   arg1);
-	  else if (TREE_CODE (TREE_OPERAND (arg0, 1)) == LSHIFT_EXPR
-		   && integer_onep (TREE_OPERAND (TREE_OPERAND (arg0, 1), 0)))
-	    return
-	      fold_build2 (code, type,
-			   build2 (BIT_AND_EXPR, TREE_TYPE (arg0),
-				   build2 (RSHIFT_EXPR, TREE_TYPE (arg01),
-					   arg00, TREE_OPERAND (arg01, 1)),
-				   fold_convert (TREE_TYPE (arg0),
-						 integer_one_node)),
-			   arg1);
+	    {
+	      tree tem = fold_build2 (RSHIFT_EXPR, TREE_TYPE (arg00),
+				      arg01, TREE_OPERAND (arg00, 1));
+	      tem = fold_build2 (BIT_AND_EXPR, TREE_TYPE (arg0), tem,
+				 build_int_cst (TREE_TYPE (arg0), 1));
+	      return fold_build2 (code, type,
+				  fold_convert (TREE_TYPE (arg1), tem), arg1);
+	    }
+	  else if (TREE_CODE (arg01) == LSHIFT_EXPR
+		   && integer_onep (TREE_OPERAND (arg01, 0)))
+	    {
+	      tree tem = fold_build2 (RSHIFT_EXPR, TREE_TYPE (arg01),
+				      arg00, TREE_OPERAND (arg01, 1));
+	      tem = fold_build2 (BIT_AND_EXPR, TREE_TYPE (arg0), tem,
+				 build_int_cst (TREE_TYPE (arg0), 1));
+	      return fold_build2 (code, type,
+				  fold_convert (TREE_TYPE (arg1), tem), arg1);
+	    }
 	}
 
       /* If this is an NE or EQ comparison of zero against the result of a

Modified: stable/9/contrib/gcc/ipa-pure-const.c
==============================================================================
--- stable/9/contrib/gcc/ipa-pure-const.c	Fri May 25 03:02:56 2012	(r235964)
+++ stable/9/contrib/gcc/ipa-pure-const.c	Fri May 25 03:07:20 2012	(r235965)
@@ -639,6 +639,7 @@ static_execute (void)
   for (i = 0; i < order_pos; i++ )
     {
       enum pure_const_state_e pure_const_state = IPA_CONST;
+      int count = 0;
       node = order[i];
 
       /* Find the worst state for any node in the cycle.  */
@@ -655,11 +656,40 @@ static_execute (void)
 	  if (!w_l->state_set_in_source)
 	    {
 	      struct cgraph_edge *e;
+	      count++;
+
+	      /* FIXME!!!  Because of pr33826, we cannot have either
+		 immediate or transitive recursive functions marked as
+		 pure or const because dce can delete a function that
+		 is in reality an infinite loop.  A better solution
+		 than just outlawing them is to add another bit the
+		 functions to distinguish recursive from non recursive
+		 pure and const function.  This would allow the
+		 recursive ones to be cse'd but not dce'd.  In this
+		 same vein, we could allow functions with loops to
+		 also be cse'd but not dce'd.
+
+		 Unfortunately we are late in stage 3, and the fix
+		 described above is is not appropriate.  */
+	      if (count > 1)
+		{
+		  pure_const_state = IPA_NEITHER;
+		  break;
+		}
+		    
 	      for (e = w->callees; e; e = e->next_callee) 
 		{
 		  struct cgraph_node *y = e->callee;
 		  /* Only look at the master nodes and skip external nodes.  */
 		  y = cgraph_master_clone (y);
+
+		  /* Check for immediate recursive functions.  See the
+		     FIXME above.  */
+		  if (w == y)
+		    {
+		      pure_const_state = IPA_NEITHER;
+		      break;
+		    }
 		  if (y)
 		    {
 		      funct_state y_l = get_function_state (y);

Modified: stable/9/contrib/gcc/ipa-utils.c
==============================================================================
--- stable/9/contrib/gcc/ipa-utils.c	Fri May 25 03:02:56 2012	(r235964)
+++ stable/9/contrib/gcc/ipa-utils.c	Fri May 25 03:07:20 2012	(r235965)
@@ -78,7 +78,7 @@ struct searchc_env {
    has been customized for cgraph_nodes.  The env parameter is because
    it is recursive and there are no nested functions here.  This
    function should only be called from itself or
-   cgraph_reduced_inorder.  ENV is a stack env and would be
+   ipa_utils_reduced_inorder.  ENV is a stack env and would be
    unnecessary if C had nested functions.  V is the node to start
    searching from.  */
 

Modified: stable/9/contrib/gcc/rtl.h
==============================================================================
--- stable/9/contrib/gcc/rtl.h	Fri May 25 03:02:56 2012	(r235964)
+++ stable/9/contrib/gcc/rtl.h	Fri May 25 03:07:20 2012	(r235965)
@@ -1189,8 +1189,8 @@ do {						\
    refer to part of a DECL.  */
 #define REG_EXPR(RTX) (REG_ATTRS (RTX) == 0 ? 0 : REG_ATTRS (RTX)->decl)
 
-/* For a MEM rtx, the offset from the start of MEM_DECL, if known, as a
-   RTX that is always a CONST_INT.  */
+/* For a REG rtx, the offset from the start of REG_EXPR, if known, as an
+   HOST_WIDE_INT.  */
 #define REG_OFFSET(RTX) (REG_ATTRS (RTX) == 0 ? 0 : REG_ATTRS (RTX)->offset)
 
 /* Copy the attributes that apply to memory locations from RHS to LHS.  */

Modified: stable/9/contrib/gcc/var-tracking.c
==============================================================================
--- stable/9/contrib/gcc/var-tracking.c	Fri May 25 03:02:56 2012	(r235964)
+++ stable/9/contrib/gcc/var-tracking.c	Fri May 25 03:07:20 2012	(r235965)
@@ -259,6 +259,9 @@ typedef struct variable_def
 /* Pointer to the BB's information specific to variable tracking pass.  */
 #define VTI(BB) ((variable_tracking_info) (BB)->aux)
 
+/* Macro to access MEM_OFFSET as an HOST_WIDE_INT.  Evaluates MEM twice.  */
+#define INT_MEM_OFFSET(mem) (MEM_OFFSET (mem) ? INTVAL (MEM_OFFSET (mem)) : 0)
+
 /* Alloc pool for struct attrs_def.  */
 static alloc_pool attrs_pool;
 
@@ -927,7 +930,7 @@ static void
 var_mem_set (dataflow_set *set, rtx loc)
 {
   tree decl = MEM_EXPR (loc);
-  HOST_WIDE_INT offset = MEM_OFFSET (loc) ? INTVAL (MEM_OFFSET (loc)) : 0;
+  HOST_WIDE_INT offset = INT_MEM_OFFSET (loc);
 
   decl = var_debug_decl (decl);
 
@@ -945,7 +948,7 @@ static void
 var_mem_delete_and_set (dataflow_set *set, rtx loc, bool modify)
 {
   tree decl = MEM_EXPR (loc);
-  HOST_WIDE_INT offset = MEM_OFFSET (loc) ? INTVAL (MEM_OFFSET (loc)) : 0;
+  HOST_WIDE_INT offset = INT_MEM_OFFSET (loc);
 
   decl = var_debug_decl (decl);
 
@@ -962,7 +965,7 @@ static void
 var_mem_delete (dataflow_set *set, rtx loc, bool clobber)
 {
   tree decl = MEM_EXPR (loc);
-  HOST_WIDE_INT offset = MEM_OFFSET (loc) ? INTVAL (MEM_OFFSET (loc)) : 0;
+  HOST_WIDE_INT offset = INT_MEM_OFFSET (loc);
 
   decl = var_debug_decl (decl);
   if (clobber)
@@ -1540,6 +1543,18 @@ track_expr_p (tree expr)
   return 1;
 }
 
+/* Return true if OFFSET is a valid offset for a register or memory
+   access we want to track.  This is used to reject out-of-bounds
+   accesses that can cause assertions to fail later.  Note that we
+   don't reject negative offsets because they can be generated for
+   paradoxical subregs on big-endian architectures.  */
+
+static inline bool
+offset_valid_for_tracked_p (HOST_WIDE_INT offset)
+{
+  return (-MAX_VAR_PARTS < offset) && (offset < MAX_VAR_PARTS);
+}
+
 /* Determine whether a given LOC refers to the same variable part as
    EXPR+OFFSET.  */
 
@@ -1560,7 +1575,7 @@ same_variable_part_p (rtx loc, tree expr
   else if (MEM_P (loc))
     {
       expr2 = MEM_EXPR (loc);
-      offset2 = MEM_OFFSET (loc) ? INTVAL (MEM_OFFSET (loc)) : 0;
+      offset2 = INT_MEM_OFFSET (loc);
     }
   else
     return false;
@@ -1590,7 +1605,8 @@ count_uses (rtx *loc, void *insn)
     }
   else if (MEM_P (*loc)
 	   && MEM_EXPR (*loc)
-	   && track_expr_p (MEM_EXPR (*loc)))
+	   && track_expr_p (MEM_EXPR (*loc))
+	   && offset_valid_for_tracked_p (INT_MEM_OFFSET (*loc)))
     {
       VTI (bb)->n_mos++;
     }
@@ -1626,14 +1642,19 @@ add_uses (rtx *loc, void *insn)
       basic_block bb = BLOCK_FOR_INSN ((rtx) insn);
       micro_operation *mo = VTI (bb)->mos + VTI (bb)->n_mos++;
 
-      mo->type = ((REG_EXPR (*loc) && track_expr_p (REG_EXPR (*loc)))
-		  ? MO_USE : MO_USE_NO_VAR);
+      if (REG_EXPR (*loc)
+	  && track_expr_p (REG_EXPR (*loc))
+	  && offset_valid_for_tracked_p (REG_OFFSET (*loc)))
+	mo->type = MO_USE;
+      else
+	mo->type = MO_USE_NO_VAR;
       mo->u.loc = *loc;
       mo->insn = (rtx) insn;
     }
   else if (MEM_P (*loc)
 	   && MEM_EXPR (*loc)
-	   && track_expr_p (MEM_EXPR (*loc)))
+	   && track_expr_p (MEM_EXPR (*loc))
+	   && offset_valid_for_tracked_p (INT_MEM_OFFSET (*loc)))
     {
       basic_block bb = BLOCK_FOR_INSN ((rtx) insn);
       micro_operation *mo = VTI (bb)->mos + VTI (bb)->n_mos++;
@@ -1667,8 +1688,9 @@ add_stores (rtx loc, rtx expr, void *ins
       micro_operation *mo = VTI (bb)->mos + VTI (bb)->n_mos++;
 
       if (GET_CODE (expr) == CLOBBER
-	  || ! REG_EXPR (loc)
-	  || ! track_expr_p (REG_EXPR (loc)))
+	  || !(REG_EXPR (loc)
+	       && track_expr_p (REG_EXPR (loc))
+	       && offset_valid_for_tracked_p (REG_OFFSET (loc))))
 	mo->type = MO_CLOBBER;
       else if (GET_CODE (expr) == SET
 	       && SET_DEST (expr) == loc
@@ -1683,7 +1705,8 @@ add_stores (rtx loc, rtx expr, void *ins
     }
   else if (MEM_P (loc)
 	   && MEM_EXPR (loc)
-	   && track_expr_p (MEM_EXPR (loc)))
+	   && track_expr_p (MEM_EXPR (loc))
+	   && offset_valid_for_tracked_p (INT_MEM_OFFSET (loc)))
     {
       basic_block bb = BLOCK_FOR_INSN ((rtx) insn);
       micro_operation *mo = VTI (bb)->mos + VTI (bb)->n_mos++;
@@ -1694,8 +1717,7 @@ add_stores (rtx loc, rtx expr, void *ins
 	       && SET_DEST (expr) == loc
 	       && same_variable_part_p (SET_SRC (expr),
 					MEM_EXPR (loc),
-					MEM_OFFSET (loc)
-					? INTVAL (MEM_OFFSET (loc)) : 0))
+					INT_MEM_OFFSET (loc)))
 	mo->type = MO_COPY;
       else
 	mo->type = MO_SET;
@@ -2726,7 +2748,7 @@ vt_get_decl_and_offset (rtx rtl, tree *d
       if (MEM_ATTRS (rtl))
 	{
 	  *declp = MEM_EXPR (rtl);
-	  *offsetp = MEM_OFFSET (rtl) ? INTVAL (MEM_OFFSET (rtl)) : 0;
+	  *offsetp = INT_MEM_OFFSET (rtl);
 	  return true;
 	}
     }

Modified: stable/9/contrib/gcc/varasm.c
==============================================================================
--- stable/9/contrib/gcc/varasm.c	Fri May 25 03:02:56 2012	(r235964)
+++ stable/9/contrib/gcc/varasm.c	Fri May 25 03:07:20 2012	(r235965)
@@ -5876,9 +5876,10 @@ default_binds_local_p_1 (tree exp, int s
   else if (DECL_WEAK (exp))
     local_p = false;
   /* If PIC, then assume that any global name can be overridden by
-     symbols resolved from other modules.  */
+     symbols resolved from other modules, unless we are compiling with
+     -fwhole-program, which assumes that names are local.  */
   else if (shlib)
-    local_p = false;
+    local_p = flag_whole_program;
   /* Uninitialized COMMON variable may be unified with symbols
      resolved from other modules.  */
   else if (DECL_COMMON (exp)

From owner-svn-src-stable-9@FreeBSD.ORG  Fri May 25 04:26:14 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id C92F6106564A;
	Fri, 25 May 2012 04:26:14 +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 B3B748FC0A;
	Fri, 25 May 2012 04:26: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 q4P4QEZ6080057;
	Fri, 25 May 2012 04:26:14 GMT (envelope-from ae@svn.freebsd.org)
Received: (from ae@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4P4QE97080053;
	Fri, 25 May 2012 04:26:14 GMT (envelope-from ae@svn.freebsd.org)
Message-Id: <201205250426.q4P4QE97080053@svn.freebsd.org>
From: "Andrey V. Elsukov" <ae@FreeBSD.org>
Date: Fri, 25 May 2012 04:26:14 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r235968 - stable/9/sys/geom/mirror
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 25 May 2012 04:26:15 -0000

Author: ae
Date: Fri May 25 04:26:14 2012
New Revision: 235968
URL: http://svn.freebsd.org/changeset/base/235968

Log:
  MFC r235599:
    Introduce new device flag G_MIRROR_DEVICE_FLAG_TASTING. It should
    protect geom from destroying while it is tasting.
  
  MFC r235600:
    Prevent removing of the last active component from a mirror.
  
  PR:		kern/154860
  Reviewed by:	pjd
  Tested by:	Eugene Grosbein

Modified:
  stable/9/sys/geom/mirror/g_mirror.c
  stable/9/sys/geom/mirror/g_mirror.h
  stable/9/sys/geom/mirror/g_mirror_ctl.c
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/geom/mirror/g_mirror.c
==============================================================================
--- stable/9/sys/geom/mirror/g_mirror.c	Fri May 25 03:46:56 2012	(r235967)
+++ stable/9/sys/geom/mirror/g_mirror.c	Fri May 25 04:26:14 2012	(r235968)
@@ -1692,6 +1692,8 @@ g_mirror_can_destroy(struct g_mirror_sof
 	gp = sc->sc_geom;
 	if (gp->softc == NULL)
 		return (1);
+	if ((sc->sc_flags & G_MIRROR_DEVICE_FLAG_TASTING) != 0)
+		return (0);
 	LIST_FOREACH(cp, &gp->consumer, consumer) {
 		if (g_mirror_is_busy(sc, cp))
 			return (0);
@@ -3053,6 +3055,7 @@ g_mirror_taste(struct g_class *mp, struc
 	G_MIRROR_DEBUG(1, "Adding disk %s to %s.", pp->name, gp->name);
 	g_topology_unlock();
 	sx_xlock(&sc->sc_lock);
+	sc->sc_flags |= G_MIRROR_DEVICE_FLAG_TASTING;
 	error = g_mirror_add_disk(sc, pp, &md);
 	if (error != 0) {
 		G_MIRROR_DEBUG(0, "Cannot add disk %s to %s (error=%d).",
@@ -3065,6 +3068,12 @@ g_mirror_taste(struct g_class *mp, struc
 		}
 		gp = NULL;
 	}
+	sc->sc_flags &= ~G_MIRROR_DEVICE_FLAG_TASTING;
+	if ((sc->sc_flags & G_MIRROR_DEVICE_FLAG_DESTROY) != 0) {
+		g_mirror_destroy(sc, G_MIRROR_DESTROY_HARD);
+		g_topology_lock();
+		return (NULL);
+	}
 	sx_xunlock(&sc->sc_lock);
 	g_topology_lock();
 	return (gp);

Modified: stable/9/sys/geom/mirror/g_mirror.h
==============================================================================
--- stable/9/sys/geom/mirror/g_mirror.h	Fri May 25 03:46:56 2012	(r235967)
+++ stable/9/sys/geom/mirror/g_mirror.h	Fri May 25 04:26:14 2012	(r235968)
@@ -157,6 +157,7 @@ struct g_mirror_event {
 #define	G_MIRROR_DEVICE_FLAG_DESTROY	0x0100000000000000ULL
 #define	G_MIRROR_DEVICE_FLAG_WAIT	0x0200000000000000ULL
 #define	G_MIRROR_DEVICE_FLAG_DESTROYING	0x0400000000000000ULL
+#define	G_MIRROR_DEVICE_FLAG_TASTING	0x0800000000000000ULL
 
 #define	G_MIRROR_DEVICE_STATE_STARTING		0
 #define	G_MIRROR_DEVICE_STATE_RUNNING		1

Modified: stable/9/sys/geom/mirror/g_mirror_ctl.c
==============================================================================
--- stable/9/sys/geom/mirror/g_mirror_ctl.c	Fri May 25 03:46:56 2012	(r235967)
+++ stable/9/sys/geom/mirror/g_mirror_ctl.c	Fri May 25 04:26:14 2012	(r235968)
@@ -560,7 +560,7 @@ g_mirror_ctl_remove(struct gctl_req *req
 	const char *name;
 	char param[16];
 	int *nargs;
-	u_int i;
+	u_int i, active;
 
 	nargs = gctl_get_paraml(req, "nargs", sizeof(*nargs));
 	if (nargs == NULL) {
@@ -587,6 +587,7 @@ g_mirror_ctl_remove(struct gctl_req *req
 		    "first.");
 		return;
 	}
+	active = g_mirror_ndisks(sc, G_MIRROR_DISK_STATE_ACTIVE);
 	for (i = 1; i < (u_int)*nargs; i++) {
 		snprintf(param, sizeof(param), "arg%u", i);
 		name = gctl_get_asciiparam(req, param);
@@ -599,6 +600,16 @@ g_mirror_ctl_remove(struct gctl_req *req
 			gctl_error(req, "No such provider: %s.", name);
 			continue;
 		}
+		if (disk->d_state == G_MIRROR_DISK_STATE_ACTIVE) {
+			if (active > 1)
+				active--;
+			else {
+				gctl_error(req, "%s: Can't remove the last "
+				    "ACTIVE component %s.", sc->sc_geom->name,
+				    name);
+				continue;
+			}
+		}
 		g_mirror_event_send(disk, G_MIRROR_DISK_STATE_DESTROY,
 		    G_MIRROR_EVENT_DONTWAIT);
 	}

From owner-svn-src-stable-9@FreeBSD.ORG  Fri May 25 04:42:19 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 80FE6106566B;
	Fri, 25 May 2012 04:42:19 +0000 (UTC)
	(envelope-from delphij@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 6A0A58FC15;
	Fri, 25 May 2012 04:42: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 q4P4gJvh080847;
	Fri, 25 May 2012 04:42:19 GMT (envelope-from delphij@svn.freebsd.org)
Received: (from delphij@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4P4gJuM080843;
	Fri, 25 May 2012 04:42:19 GMT (envelope-from delphij@svn.freebsd.org)
Message-Id: <201205250442.q4P4gJuM080843@svn.freebsd.org>
From: Xin LI <delphij@FreeBSD.org>
Date: Fri, 25 May 2012 04:42:19 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r235971 - stable/9/contrib/netcat
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 25 May 2012 04:42:19 -0000

Author: delphij
Date: Fri May 25 04:42:18 2012
New Revision: 235971
URL: http://svn.freebsd.org/changeset/base/235971

Log:
  MFC: netcat from OpenBSD 5.1.

Modified:
  stable/9/contrib/netcat/FREEBSD-vendor
  stable/9/contrib/netcat/nc.1
  stable/9/contrib/netcat/netcat.c
Directory Properties:
  stable/9/contrib/netcat/   (props changed)

Modified: stable/9/contrib/netcat/FREEBSD-vendor
==============================================================================
--- stable/9/contrib/netcat/FREEBSD-vendor	Fri May 25 04:27:08 2012	(r235970)
+++ stable/9/contrib/netcat/FREEBSD-vendor	Fri May 25 04:42:18 2012	(r235971)
@@ -1,5 +1,5 @@
 # $FreeBSD$
 Project:	netcat (aka src/usr.bin/nc in OpenBSD)
 ProjectURL:	http://www.openbsd.org/
-Version:	4.7
+Version:	5.1
 License:	BSD

Modified: stable/9/contrib/netcat/nc.1
==============================================================================
--- stable/9/contrib/netcat/nc.1	Fri May 25 04:27:08 2012	(r235970)
+++ stable/9/contrib/netcat/nc.1	Fri May 25 04:42:18 2012	(r235971)
@@ -1,4 +1,4 @@
-.\"     $OpenBSD: nc.1,v 1.57 2011/01/09 22:16:46 jeremy Exp $
+.\"     $OpenBSD: nc.1,v 1.60 2012/02/07 12:11:43 lum Exp $
 .\"
 .\" Copyright (c) 1996 David Sacerdote
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd January 8, 2011
+.Dd October 4, 2011
 .Dt NC 1
 .Os
 .Sh NAME
@@ -45,7 +45,7 @@
 .Op Fl P Ar proxy_username
 .Op Fl p Ar source_port
 .Op Fl s Ar source
-.Op Fl T Ar ToS
+.Op Fl T Ar toskeyword
 .Op Fl V Ar rtable
 .Op Fl w Ar timeout
 .Op Fl X Ar proxy_protocol
@@ -186,14 +186,21 @@ to create and use so that datagrams can 
 It is an error to use this option in conjunction with the
 .Fl l
 option.
-.It Fl T Ar ToS
-Specifies IP Type of Service (ToS) for the connection.
-Valid values are the tokens
-.Dq lowdelay ,
-.Dq throughput ,
-.Dq reliability ,
-or an 8-bit hexadecimal value preceded by
-.Dq 0x .
+.It Fl T Ar toskeyword
+Change IPv4 TOS value.
+.Ar toskeyword
+may be one of
+.Ar critical ,
+.Ar inetcontrol ,
+.Ar lowdelay ,
+.Ar netcontrol ,
+.Ar throughput ,
+.Ar reliability ,
+or one of the DiffServ Code Points:
+.Ar ef ,
+.Ar af11 ... af43 ,
+.Ar cs0 ... cs7 ;
+or a number in either hex or decimal.
 .It Fl t
 Causes
 .Nm
@@ -227,9 +234,9 @@ Have
 .Nm
 give more verbose output.
 .It Fl w Ar timeout
-If a connection and stdin are idle for more than
+Connections which cannot be established or are idle timeout after
 .Ar timeout
-seconds, then the connection is silently closed.
+seconds.
 The
 .Fl w
 flag has no effect on the
@@ -480,8 +487,15 @@ Original implementation by *Hobbit*
 Rewritten with IPv6 support by
 .An Eric Jackson Aq ericj@monkey.org .
 .Sh CAVEATS
-UDP port scans will always succeed
-(i.e. report the port as open),
-rendering the
+UDP port scans using the
 .Fl uz
-combination of flags relatively useless.
+combination of flags will always report success irrespective of
+the target machine's state.
+However,
+in conjunction with a traffic sniffer either on the target machine
+or an intermediary device,
+the
+.Fl uz
+combination could be useful for communications diagnostics.
+Note that the amount of UDP traffic generated may be limited either
+due to hardware resources and/or configuration settings.

Modified: stable/9/contrib/netcat/netcat.c
==============================================================================
--- stable/9/contrib/netcat/netcat.c	Fri May 25 04:27:08 2012	(r235970)
+++ stable/9/contrib/netcat/netcat.c	Fri May 25 04:42:18 2012	(r235971)
@@ -1,4 +1,4 @@
-/* $OpenBSD: netcat.c,v 1.100 2011/01/09 22:16:46 jeremy Exp $ */
+/* $OpenBSD: netcat.c,v 1.105 2012/02/09 06:25:35 lum Exp $ */
 /*
  * Copyright (c) 2001 Eric Jackson <ericj@monkey.org>
  *
@@ -107,6 +107,7 @@ void	help(void);
 int	local_listen(char *, char *, struct addrinfo);
 void	readwrite(int);
 int	remote_connect(const char *, const char *, struct addrinfo);
+int	timeout_connect(int, const struct sockaddr *, socklen_t);
 int	socks_connect(const char *, const char *, struct addrinfo,
 	    const char *, const char *, struct addrinfo, int, const char *);
 int	udptest(int);
@@ -114,7 +115,7 @@ int	unix_bind(char *);
 int	unix_connect(char *);
 int	unix_listen(char *);
 void	set_common_sockopts(int);
-int	parse_iptos(char *);
+int	map_tos(char *, int *);
 void	usage(int);
 
 #ifdef IPSEC
@@ -281,7 +282,18 @@ main(int argc, char *argv[])
 			Sflag = 1;
 			break;
 		case 'T':
-			Tflag = parse_iptos(optarg);
+			errstr = NULL;
+			errno = 0;
+			if (map_tos(optarg, &Tflag))
+				break;
+			if (strlen(optarg) > 1 && optarg[0] == '0' &&
+			    optarg[1] == 'x')
+				Tflag = (int)strtol(optarg, NULL, 16);
+			else
+				Tflag = (int)strtonum(optarg, 0, 255,
+				    &errstr);
+			if (Tflag < 0 || Tflag > 255 || errstr || errno)
+				errx(1, "illegal tos value %s", optarg);
 			break;
 		default:
 			usage(1);
@@ -633,7 +645,7 @@ remote_connect(const char *host, const c
 
 		set_common_sockopts(s);
 
-		if (connect(s, res0->ai_addr, res0->ai_addrlen) == 0)
+		if (timeout_connect(s, res0->ai_addr, res0->ai_addrlen) == 0)
 			break;
 		else if (vflag)
 			warn("connect to %s port %s (%s) failed", host, port,
@@ -648,6 +660,43 @@ remote_connect(const char *host, const c
 	return (s);
 }
 
+int
+timeout_connect(int s, const struct sockaddr *name, socklen_t namelen)
+{
+	struct pollfd pfd;
+	socklen_t optlen;
+	int flags, optval;
+	int ret;
+
+	if (timeout != -1) {
+		flags = fcntl(s, F_GETFL, 0);
+		if (fcntl(s, F_SETFL, flags | O_NONBLOCK) == -1)
+			err(1, "set non-blocking mode");
+	}
+
+	if ((ret = connect(s, name, namelen)) != 0 && errno == EINPROGRESS) {
+		pfd.fd = s;
+		pfd.events = POLLOUT;
+		if ((ret = poll(&pfd, 1, timeout)) == 1) {
+			optlen = sizeof(optval);
+			if ((ret = getsockopt(s, SOL_SOCKET, SO_ERROR,
+			    &optval, &optlen)) == 0) {
+				errno = optval;
+				ret = optval == 0 ? 0 : -1;
+			}
+		} else if (ret == 0) {
+			errno = ETIMEDOUT;
+			ret = -1;
+		} else
+			err(1, "poll failed");
+	}
+
+	if (timeout != -1 && fcntl(s, F_SETFL, flags) == -1)
+		err(1, "restoring flags");
+
+	return (ret);
+}
+
 /*
  * local_listen()
  * Returns a socket listening on a local port, binds to specified source
@@ -818,7 +867,7 @@ atelnet(int nfd, unsigned char *buf, uns
 
 /*
  * build_ports()
- * Build an array or ports in portlist[], listing each port
+ * Build an array of ports in portlist[], listing each port
  * that we should try to connect to.
  */
 void
@@ -830,9 +879,6 @@ build_ports(char *p)
 	int x = 0;
 
 	if ((n = strchr(p, '-')) != NULL) {
-		if (lflag)
-			errx(1, "Cannot use -l with multiple ports!");
-
 		*n = '\0';
 		n++;
 
@@ -884,8 +930,7 @@ build_ports(char *p)
 /*
  * udptest()
  * Do a few writes to see if the UDP port is there.
- * XXX - Better way of doing this? Doesn't work for IPv6.
- * Also fails after around 100 ports checked.
+ * Fails once PF state table is full.
  */
 int
 udptest(int s)
@@ -946,20 +991,51 @@ set_common_sockopts(int s)
 }
 
 int
-parse_iptos(char *s)
+map_tos(char *s, int *val)
 {
-	int tos = -1;
+	/* DiffServ Codepoints and other TOS mappings */
+	const struct toskeywords {
+		const char	*keyword;
+		int		 val;
+	} *t, toskeywords[] = {
+		{ "af11",		IPTOS_DSCP_AF11 },
+		{ "af12",		IPTOS_DSCP_AF12 },
+		{ "af13",		IPTOS_DSCP_AF13 },
+		{ "af21",		IPTOS_DSCP_AF21 },
+		{ "af22",		IPTOS_DSCP_AF22 },
+		{ "af23",		IPTOS_DSCP_AF23 },
+		{ "af31",		IPTOS_DSCP_AF31 },
+		{ "af32",		IPTOS_DSCP_AF32 },
+		{ "af33",		IPTOS_DSCP_AF33 },
+		{ "af41",		IPTOS_DSCP_AF41 },
+		{ "af42",		IPTOS_DSCP_AF42 },
+		{ "af43",		IPTOS_DSCP_AF43 },
+		{ "critical",		IPTOS_PREC_CRITIC_ECP },
+		{ "cs0",		IPTOS_DSCP_CS0 },
+		{ "cs1",		IPTOS_DSCP_CS1 },
+		{ "cs2",		IPTOS_DSCP_CS2 },
+		{ "cs3",		IPTOS_DSCP_CS3 },
+		{ "cs4",		IPTOS_DSCP_CS4 },
+		{ "cs5",		IPTOS_DSCP_CS5 },
+		{ "cs6",		IPTOS_DSCP_CS6 },
+		{ "cs7",		IPTOS_DSCP_CS7 },
+		{ "ef",			IPTOS_DSCP_EF },
+		{ "inetcontrol",	IPTOS_PREC_INTERNETCONTROL },
+		{ "lowdelay",		IPTOS_LOWDELAY },
+		{ "netcontrol",		IPTOS_PREC_NETCONTROL },
+		{ "reliability",	IPTOS_RELIABILITY },
+		{ "throughput",		IPTOS_THROUGHPUT },
+		{ NULL, 		-1 },
+	};
+
+	for (t = toskeywords; t->keyword != NULL; t++) {
+		if (strcmp(s, t->keyword) == 0) {
+			*val = t->val;
+			return (1);
+		}
+	}
 
-	if (strcmp(s, "lowdelay") == 0)
-		return (IPTOS_LOWDELAY);
-	if (strcmp(s, "throughput") == 0)
-		return (IPTOS_THROUGHPUT);
-	if (strcmp(s, "reliability") == 0)
-		return (IPTOS_RELIABILITY);
-
-	if (sscanf(s, "0x%x", &tos) != 1 || tos < 0 || tos > 0xff)
-		errx(1, "invalid IP Type of Service");
-	return (tos);
+	return (0);
 }
 
 void
@@ -990,7 +1066,7 @@ help(void)
 	\t-r		Randomize remote ports\n\
 	\t-S		Enable the TCP MD5 signature option\n\
 	\t-s addr\t	Local source address\n\
-	\t-T ToS\t	Set IP Type of Service\n\
+	\t-T toskeyword\tSet IP Type of Service\n\
 	\t-t		Answer TELNET negotiation\n\
 	\t-U		Use UNIX domain socket\n\
 	\t-u		UDP mode\n\

From owner-svn-src-stable-9@FreeBSD.ORG  Fri May 25 06:41:08 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id E930E106566C;
	Fri, 25 May 2012 06:41:08 +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 D3D948FC0C;
	Fri, 25 May 2012 06:41: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 q4P6f8JO085663;
	Fri, 25 May 2012 06:41:08 GMT (envelope-from dim@svn.freebsd.org)
Received: (from dim@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4P6f8xm085661;
	Fri, 25 May 2012 06:41:08 GMT (envelope-from dim@svn.freebsd.org)
Message-Id: <201205250641.q4P6f8xm085661@svn.freebsd.org>
From: Dimitry Andric <dim@FreeBSD.org>
Date: Fri, 25 May 2012 06:41:08 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r235974 - stable/9/contrib/ncurses/man
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 25 May 2012 06:41:09 -0000

Author: dim
Date: Fri May 25 06:41:08 2012
New Revision: 235974
URL: http://svn.freebsd.org/changeset/base/235974

Log:
  MFC r235773:
  
  Correct use_screen() and use_window() prototypes in curs_threads(3x).
  
  Submitted by:	Yanhui Shen <shen.elf@gmail.com>

Modified:
  stable/9/contrib/ncurses/man/curs_threads.3x
Directory Properties:
  stable/9/contrib/ncurses/   (props changed)

Modified: stable/9/contrib/ncurses/man/curs_threads.3x
==============================================================================
--- stable/9/contrib/ncurses/man/curs_threads.3x	Fri May 25 05:28:14 2012	(r235973)
+++ stable/9/contrib/ncurses/man/curs_threads.3x	Fri May 25 06:41:08 2012	(r235974)
@@ -45,9 +45,9 @@
 .br
 \fBint set_tabsize(int size);\fR
 .br
-\fBint use_screen(SCREEN *scr, NCURSES_WINDOW_CB func, void *data);\fR
+\fBint use_screen(SCREEN *scr, NCURSES_SCREEN_CB func, void *data);\fR
 .br
-\fBint use_window(WINDOW *win, NCURSES_SCREEN_CB func, void *data);\fR
+\fBint use_window(WINDOW *win, NCURSES_WINDOW_CB func, void *data);\fR
 .br
 .SH DESCRIPTION
 This implementation can be configured to provide rudimentary support

From owner-svn-src-stable-9@FreeBSD.ORG  Fri May 25 07:25:31 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 41A711065676;
	Fri, 25 May 2012 07:25:31 +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 2B48C8FC0C;
	Fri, 25 May 2012 07:25: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 q4P7PVAR087693;
	Fri, 25 May 2012 07:25:31 GMT (envelope-from fabient@svn.freebsd.org)
Received: (from fabient@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4P7PVGh087690;
	Fri, 25 May 2012 07:25:31 GMT (envelope-from fabient@svn.freebsd.org)
Message-Id: <201205250725.q4P7PVGh087690@svn.freebsd.org>
From: Fabien Thomas <fabient@FreeBSD.org>
Date: Fri, 25 May 2012 07:25:31 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r235977 - stable/9/usr.sbin/pmcstat
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 25 May 2012 07:25:31 -0000

Author: fabient
Date: Fri May 25 07:25:30 2012
New Revision: 235977
URL: http://svn.freebsd.org/changeset/base/235977

Log:
  MFC r233611:
  - 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:
  stable/9/usr.sbin/pmcstat/pmcpl_calltree.c
  stable/9/usr.sbin/pmcstat/pmcstat_log.c
Directory Properties:
  stable/9/usr.sbin/pmcstat/   (props changed)

Modified: stable/9/usr.sbin/pmcstat/pmcpl_calltree.c
==============================================================================
--- stable/9/usr.sbin/pmcstat/pmcpl_calltree.c	Fri May 25 07:23:24 2012	(r235976)
+++ stable/9/usr.sbin/pmcstat/pmcpl_calltree.c	Fri May 25 07:25:30 2012	(r235977)
@@ -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");
@@ -588,81 +600,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);
 		}
 	}
 
@@ -670,23 +693,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);
 }
 
@@ -698,10 +720,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;
 
@@ -740,30 +766,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=<fn> / call <ncall> addr(<fn>) / addr(call <fn>) <arccost>
+	 */
+	for (i=0 ; i<ct->pct_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; j<pmcstat_npmcs; j++)
+			fprintf(args.pa_graphfile, " %u",
+			    PMCPL_CT_SAMPLE(j, &ct->pct_arc[i].pcta_samples));
+		fprintf(args.pa_graphfile, "\n");
 	}
 }
 
@@ -774,40 +884,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));
 	}
 
@@ -815,15 +922,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; j<pmcstat_npmcs; j++)
 				fprintf(args.pa_graphfile, " %u",
 				    PMCPL_CT_SAMPLE(j,
@@ -831,94 +941,158 @@ pmcpl_ct_node_printself(struct pmcpl_ct_
 			fprintf(args.pa_graphfile, "\n");
 		}
 	} else {
-		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, "fl=%s\n", sourcefile);
-		fprintf(args.pa_graphfile, "* *");
+		/* Global cost function cost. */
+		fprintf(args.pa_graphfile, "%p %u", (void *)faddr, fline);
 		for (i = 0; i<pmcstat_npmcs ; i++)
 			fprintf(args.pa_graphfile, " %u",
 			    PMCPL_CT_SAMPLE(i, &ct->pct_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; i<pmcstat_npmcs ; i++)
+			fprintf(args.pa_graphfile, " 0");
+		fprintf(args.pa_graphfile, "\n");
+		pmcpl_ct_node_printchild(ct, 0, 0);
+	} else
+		pmcpl_ct_node_printself(ct);
 }
 
 /*
- * Print node child cost.
+ * Breadth first traversal.
  */
 
 static void
-pmcpl_ct_node_printchild(struct pmcpl_ct_node *ct)
+pmcpl_ct_bfs(struct pmcpl_ct_node *ct)
 {
-	int i, j, line;
-	uintptr_t addr;
-	struct pmcstat_symbol *sym;
+	int i;
+	struct pmcpl_ct_node_hash *pch, *pchc;
 	struct pmcpl_ct_node *child;
+	STAILQ_HEAD(,pmcpl_ct_node_hash) q;
+
+	STAILQ_INIT(&q);
+	if ((pch = malloc(sizeof(*pch))) == NULL)
+		err(EX_OSERR, "ERROR: Cannot allocate queue");
+	pch->pch_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; i<pch->pch_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 funtion.
 	 * TODO: cfn=<fn> / call <ncall> addr(<fn>) / addr(call <fn>) <arccost>
+	 * Resolve parent and compare to each instr location.
 	 */
-	for (i=0 ; i<ct->pct_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; j<pmcstat_npmcs; j++) {
+			v = PMCPL_CT_SAMPLE(j,
+			    &ct->pct_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; j<pmcstat_npmcs; j++)
-			fprintf(args.pa_graphfile, " %u",
-			    PMCPL_CT_SAMPLE(j, &ct->pct_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
  */
@@ -940,13 +1114,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"
@@ -963,25 +1136,8 @@ pmcpl_ct_print(void)
 	for (i=0; i<pmcstat_npmcs ; i++)
 		fprintf(args.pa_graphfile, " %u",
 		    PMCPL_CT_SAMPLE(i, &rsamples));
-	fprintf(args.pa_graphfile, "\n\n");
-
-	/*
-	 * Fake root node
-	 */
-	fprintf(args.pa_graphfile, "ob=FreeBSD\n");
-	fprintf(args.pa_graphfile, "fn=ROOT\n");
-	fprintf(args.pa_graphfile, "* *");
-	for (i = 0; i<pmcstat_npmcs ; i++)
-		fprintf(args.pa_graphfile, " 0");
 	fprintf(args.pa_graphfile, "\n");
-	pmcpl_ct_node_printchild(pmcpl_ct_root);
-
-	for (n = 0; n < PMCSTAT_NHASH; n++)
-		LIST_FOREACH(pch, &pmcpl_ct_node_hash[n], pch_next) {
-			pmcpl_ct_node_printself(pch->pch_ctnode);
-			pmcpl_ct_node_printchild(pch->pch_ctnode);
-	}
-
+	pmcpl_ct_bfs(pmcpl_ct_root);
 	pmcpl_ct_samples_free(&rsamples);
 }
 
@@ -1002,11 +1158,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);
 
@@ -1029,7 +1184,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: stable/9/usr.sbin/pmcstat/pmcstat_log.c
==============================================================================
--- stable/9/usr.sbin/pmcstat/pmcstat_log.c	Fri May 25 07:23:24 2012	(r235976)
+++ stable/9/usr.sbin/pmcstat/pmcstat_log.c	Fri May 25 07:25:30 2012	(r235977)
@@ -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;
 	}
 
@@ -943,6 +946,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;
@@ -958,6 +962,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+");
@@ -998,10 +1007,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-stable-9@FreeBSD.ORG  Fri May 25 08:56:00 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 2759B106564A;
	Fri, 25 May 2012 08:56:00 +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 112148FC17;
	Fri, 25 May 2012 08:56: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 q4P8txBv091946;
	Fri, 25 May 2012 08:55:59 GMT (envelope-from kib@svn.freebsd.org)
Received: (from kib@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4P8txLe091944;
	Fri, 25 May 2012 08:55:59 GMT (envelope-from kib@svn.freebsd.org)
Message-Id: <201205250855.q4P8txLe091944@svn.freebsd.org>
From: Konstantin Belousov <kib@FreeBSD.org>
Date: Fri, 25 May 2012 08:55:59 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r235983 - stable/9/sys/vm
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 25 May 2012 08:56:00 -0000

Author: kib
Date: Fri May 25 08:55:59 2012
New Revision: 235983
URL: http://svn.freebsd.org/changeset/base/235983

Log:
  MFC r235603:
  Do not double-reference the found vm object in cdev_pager_lookup().
  vm_pager_object_lookup() already referenced the object.

Modified:
  stable/9/sys/vm/device_pager.c
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/vm/device_pager.c
==============================================================================
--- stable/9/sys/vm/device_pager.c	Fri May 25 08:30:09 2012	(r235982)
+++ stable/9/sys/vm/device_pager.c	Fri May 25 08:55:59 2012	(r235983)
@@ -102,7 +102,6 @@ cdev_pager_lookup(void *handle)
 
 	mtx_lock(&dev_pager_mtx);
 	object = vm_pager_object_lookup(&dev_pager_object_list, handle);
-	vm_object_reference(object);
 	mtx_unlock(&dev_pager_mtx);
 	return (object);
 }

From owner-svn-src-stable-9@FreeBSD.ORG  Fri May 25 14:40:57 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 304FE1065670;
	Fri, 25 May 2012 14:40:57 +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 0313F8FC1C;
	Fri, 25 May 2012 14:40: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 q4PEeuOa015726;
	Fri, 25 May 2012 14:40:56 GMT (envelope-from marius@svn.freebsd.org)
Received: (from marius@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4PEeuq8015717;
	Fri, 25 May 2012 14:40:56 GMT (envelope-from marius@svn.freebsd.org)
Message-Id: <201205251440.q4PEeuq8015717@svn.freebsd.org>
From: Marius Strobl <marius@FreeBSD.org>
Date: Fri, 25 May 2012 14:40:56 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r235992 - stable/9/sys/sparc64/conf
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 25 May 2012 14:40:57 -0000

Author: marius
Date: Fri May 25 14:40:56 2012
New Revision: 235992
URL: http://svn.freebsd.org/changeset/base/235992

Log:
  MFC: r234348
  
  Turn on PREEMPTION by default. After fixing several bugs over time, the
  last show-stopper keeping PREEMPTION from being usable on sparc64 should
  have been dealt with in r230662 (MFC'ed to stable/9 in r230662).
  At least on 2-way systems, PREEMPTION causes a little bit of a degradation
  in worldstone performance. However, FreeBSD seems to have started building
  up regressions in !PREEMPTION cases so sparc64 better should not be an
  oddball in this regard.

Modified:
  stable/9/sys/sparc64/conf/GENERIC
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/amd64/include/xen/   (props changed)
  stable/9/sys/boot/   (props changed)
  stable/9/sys/boot/i386/efi/   (props changed)
  stable/9/sys/boot/ia64/efi/   (props changed)
  stable/9/sys/boot/ia64/ski/   (props changed)
  stable/9/sys/boot/powerpc/boot1.chrp/   (props changed)
  stable/9/sys/boot/powerpc/ofw/   (props changed)
  stable/9/sys/cddl/contrib/opensolaris/   (props changed)
  stable/9/sys/conf/   (props changed)
  stable/9/sys/contrib/dev/acpica/   (props changed)
  stable/9/sys/contrib/octeon-sdk/   (props changed)
  stable/9/sys/contrib/pf/   (props changed)
  stable/9/sys/contrib/x86emu/   (props changed)
  stable/9/sys/dev/   (props changed)
  stable/9/sys/dev/e1000/   (props changed)
  stable/9/sys/dev/ixgbe/   (props changed)
  stable/9/sys/fs/   (props changed)
  stable/9/sys/fs/ntfs/   (props changed)
  stable/9/sys/modules/   (props changed)

Modified: stable/9/sys/sparc64/conf/GENERIC
==============================================================================
--- stable/9/sys/sparc64/conf/GENERIC	Fri May 25 14:11:02 2012	(r235991)
+++ stable/9/sys/sparc64/conf/GENERIC	Fri May 25 14:40:56 2012	(r235992)
@@ -27,7 +27,7 @@ makeoptions	DEBUG=-g		# Build kernel wit
 #	At this time all platforms are supported, as-is.
 
 options 	SCHED_ULE		# ULE scheduler
-#options 	PREEMPTION		# Enable kernel thread preemption
+options 	PREEMPTION		# Enable kernel thread preemption
 options 	INET			# InterNETworking
 options 	INET6			# IPv6 communications protocols
 options 	SCTP			# Stream Control Transmission Protocol

From owner-svn-src-stable-9@FreeBSD.ORG  Fri May 25 14:54:13 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 6B057106566B;
	Fri, 25 May 2012 14:54:13 +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 5564C8FC0C;
	Fri, 25 May 2012 14:54: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 q4PEsDhs016401;
	Fri, 25 May 2012 14:54:13 GMT (envelope-from marius@svn.freebsd.org)
Received: (from marius@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4PEsDm7016399;
	Fri, 25 May 2012 14:54:13 GMT (envelope-from marius@svn.freebsd.org)
Message-Id: <201205251454.q4PEsDm7016399@svn.freebsd.org>
From: Marius Strobl <marius@FreeBSD.org>
Date: Fri, 25 May 2012 14:54:13 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r235995 - stable/9/sys/boot/common
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 25 May 2012 14:54:13 -0000

Author: marius
Date: Fri May 25 14:54:12 2012
New Revision: 235995
URL: http://svn.freebsd.org/changeset/base/235995

Log:
  MFC: r234789
  
  Add multiple inclusion protection.
  
  PR:		165025
  Submitted by:	Gavin Mu

Modified:
  stable/9/sys/boot/common/bootstrap.h
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/amd64/include/xen/   (props changed)
  stable/9/sys/boot/   (props changed)
  stable/9/sys/boot/i386/efi/   (props changed)
  stable/9/sys/boot/ia64/efi/   (props changed)
  stable/9/sys/boot/ia64/ski/   (props changed)
  stable/9/sys/boot/powerpc/boot1.chrp/   (props changed)
  stable/9/sys/boot/powerpc/ofw/   (props changed)
  stable/9/sys/cddl/contrib/opensolaris/   (props changed)
  stable/9/sys/conf/   (props changed)
  stable/9/sys/contrib/dev/acpica/   (props changed)
  stable/9/sys/contrib/octeon-sdk/   (props changed)
  stable/9/sys/contrib/pf/   (props changed)
  stable/9/sys/contrib/x86emu/   (props changed)
  stable/9/sys/dev/   (props changed)
  stable/9/sys/dev/e1000/   (props changed)
  stable/9/sys/dev/ixgbe/   (props changed)
  stable/9/sys/fs/   (props changed)
  stable/9/sys/fs/ntfs/   (props changed)
  stable/9/sys/modules/   (props changed)

Modified: stable/9/sys/boot/common/bootstrap.h
==============================================================================
--- stable/9/sys/boot/common/bootstrap.h	Fri May 25 14:52:05 2012	(r235994)
+++ stable/9/sys/boot/common/bootstrap.h	Fri May 25 14:54:12 2012	(r235995)
@@ -26,6 +26,9 @@
  * $FreeBSD$
  */
 
+#ifndef _BOOTSTRAP_H_
+#define	_BOOTSTRAP_H_
+
 #include <sys/types.h>
 #include <sys/queue.h>
 #include <sys/linker_set.h>
@@ -323,3 +326,5 @@ void	delay(int delay);
 void	dev_cleanup(void);
 
 time_t	time(time_t *tloc);
+
+#endif /* !_BOOTSTRAP_H_ */

From owner-svn-src-stable-9@FreeBSD.ORG  Fri May 25 14:57:02 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 5E8CC1065672;
	Fri, 25 May 2012 14:57:02 +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 487508FC0A;
	Fri, 25 May 2012 14:57: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 q4PEv2p4016646;
	Fri, 25 May 2012 14:57:02 GMT (envelope-from marius@svn.freebsd.org)
Received: (from marius@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4PEv2qe016644;
	Fri, 25 May 2012 14:57:02 GMT (envelope-from marius@svn.freebsd.org)
Message-Id: <201205251457.q4PEv2qe016644@svn.freebsd.org>
From: Marius Strobl <marius@FreeBSD.org>
Date: Fri, 25 May 2012 14:57:02 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r235997 - stable/9/sys/boot/sparc64/loader
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 25 May 2012 14:57:02 -0000

Author: marius
Date: Fri May 25 14:57:01 2012
New Revision: 235997
URL: http://svn.freebsd.org/changeset/base/235997

Log:
  MFC: r234897
  
  Add a command for showing the heap usage.
  
  PR:		165025
  Submitted by:	Gavin Mu

Modified:
  stable/9/sys/boot/sparc64/loader/main.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/amd64/include/xen/   (props changed)
  stable/9/sys/boot/   (props changed)
  stable/9/sys/boot/i386/efi/   (props changed)
  stable/9/sys/boot/ia64/efi/   (props changed)
  stable/9/sys/boot/ia64/ski/   (props changed)
  stable/9/sys/boot/powerpc/boot1.chrp/   (props changed)
  stable/9/sys/boot/powerpc/ofw/   (props changed)
  stable/9/sys/cddl/contrib/opensolaris/   (props changed)
  stable/9/sys/conf/   (props changed)
  stable/9/sys/contrib/dev/acpica/   (props changed)
  stable/9/sys/contrib/octeon-sdk/   (props changed)
  stable/9/sys/contrib/pf/   (props changed)
  stable/9/sys/contrib/x86emu/   (props changed)
  stable/9/sys/dev/   (props changed)
  stable/9/sys/dev/e1000/   (props changed)
  stable/9/sys/dev/ixgbe/   (props changed)
  stable/9/sys/fs/   (props changed)
  stable/9/sys/fs/ntfs/   (props changed)
  stable/9/sys/modules/   (props changed)

Modified: stable/9/sys/boot/sparc64/loader/main.c
==============================================================================
--- stable/9/sys/boot/sparc64/loader/main.c	Fri May 25 14:54:18 2012	(r235996)
+++ stable/9/sys/boot/sparc64/loader/main.c	Fri May 25 14:57:01 2012	(r235997)
@@ -800,6 +800,18 @@ main(int (*openfirm)(void *))
 	return (1);
 }
 
+COMMAND_SET(heap, "heap", "show heap usage", command_heap);
+
+static int
+command_heap(int argc, char *argv[])
+{
+
+	mallocstats();
+	printf("heap base at %p, top at %p, upper limit at %p\n", heapva,
+	    sbrk(0), heapva + HEAPSZ);
+	return(CMD_OK);
+}
+
 COMMAND_SET(reboot, "reboot", "reboot the system", command_reboot);
 
 static int

From owner-svn-src-stable-9@FreeBSD.ORG  Fri May 25 15:14:23 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 3A8C21065680;
	Fri, 25 May 2012 15:14:23 +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 242098FC12;
	Fri, 25 May 2012 15:14: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 q4PFEMks017517;
	Fri, 25 May 2012 15:14:22 GMT (envelope-from marius@svn.freebsd.org)
Received: (from marius@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4PFEMG0017516;
	Fri, 25 May 2012 15:14:22 GMT (envelope-from marius@svn.freebsd.org)
Message-Id: <201205251514.q4PFEMG0017516@svn.freebsd.org>
From: Marius Strobl <marius@FreeBSD.org>
Date: Fri, 25 May 2012 15:14:22 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r236001 - stable/9/contrib/compiler-rt/lib/sparc64
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 25 May 2012 15:14:23 -0000

Author: marius
Date: Fri May 25 15:14:22 2012
New Revision: 236001
URL: http://svn.freebsd.org/changeset/base/236001

Log:
  MFC: r230025
  
  Add SPARC64 version of div/mod written in assembly.
  
  This version is similar to the code shipped with libgcc. It is based on
  the code from the SPARC64 architecture manual, provided without any
  restrictions.
  
  Tested by:	flo@

Added:
  stable/9/contrib/compiler-rt/lib/sparc64/
     - copied from r230025, head/contrib/compiler-rt/lib/sparc64/
Modified:
Directory Properties:
  stable/9/contrib/compiler-rt/   (props changed)

From owner-svn-src-stable-9@FreeBSD.ORG  Fri May 25 15:15:26 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 6FA9C106566C;
	Fri, 25 May 2012 15:15:26 +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 4F8A38FC14;
	Fri, 25 May 2012 15:15: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 q4PFFQSC017612;
	Fri, 25 May 2012 15:15:26 GMT (envelope-from marius@svn.freebsd.org)
Received: (from marius@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4PFFQDN017610;
	Fri, 25 May 2012 15:15:26 GMT (envelope-from marius@svn.freebsd.org)
Message-Id: <201205251515.q4PFFQDN017610@svn.freebsd.org>
From: Marius Strobl <marius@FreeBSD.org>
Date: Fri, 25 May 2012 15:15:26 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r236002 - stable/9/contrib/compiler-rt/lib/sparc64
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 25 May 2012 15:15:26 -0000

Author: marius
Date: Fri May 25 15:15:25 2012
New Revision: 236002
URL: http://svn.freebsd.org/changeset/base/236002

Log:
  MFC: r235388
  
  - Get rid of debugging support in order to get rid of the V8-specific C
    compiler frame size used there so this whole thing is V8/V9-agnostic.
  - Use 32-bit function alignment as GCC does when using UltraSPARC I or
    higher optimizations.
  - Don't waste delay slots when possible.

Modified:
  stable/9/contrib/compiler-rt/lib/sparc64/divmod.m4
Directory Properties:
  stable/9/contrib/compiler-rt/   (props changed)

Modified: stable/9/contrib/compiler-rt/lib/sparc64/divmod.m4
==============================================================================
--- stable/9/contrib/compiler-rt/lib/sparc64/divmod.m4	Fri May 25 15:14:22 2012	(r236001)
+++ stable/9/contrib/compiler-rt/lib/sparc64/divmod.m4	Fri May 25 15:15:25 2012	(r236002)
@@ -59,9 +59,6 @@ define(SC,`%g2')
 
 #include "../assembly.h"
 
-.text
-	.align 4
-
 define(DEVELOP_QUOTIENT_BITS,
 `	!depth $1, accumulated bits $2
 	bl	L.$1.eval(TWOSUPN+$2)
@@ -84,12 +81,14 @@ L.$1.eval(TWOSUPN+$2):
 	ifelse( $1, 1, `9:')
 ')
 ifelse( ANSWER, `quotient', `
+.text
+	.align 32
 DEFINE_COMPILERRT_FUNCTION(__udivsi3)
-	save	%sp,-64,%sp		! do this for debugging
 	b	divide
 	mov	0,SIGN			! result always nonnegative
+.text
+	.align 32
 DEFINE_COMPILERRT_FUNCTION(__divsi3)
-	save	%sp,-64,%sp		! do this for debugging
 	orcc	divisor,dividend,%g0	! are either dividend or divisor negative
 	bge	divide			! if not, skip this junk
 	xor	divisor,dividend,SIGN	! record sign of result in sign of SIGN
@@ -104,12 +103,14 @@ DEFINE_COMPILERRT_FUNCTION(__divsi3)
 	neg	dividend
 	! FALL THROUGH
 ',`
+.text
+	.align 32
 DEFINE_COMPILERRT_FUNCTION(__umodsi3)
-	save	%sp,-64,%sp		! do this for debugging
 	b	divide
 	mov	0,SIGN			! result always nonnegative
+.text
+	.align 32
 DEFINE_COMPILERRT_FUNCTION(__modsi3)
-	save	%sp,-64,%sp		! do this for debugging
 	orcc	divisor,dividend,%g0	! are either dividend or divisor negative
 	bge	divide			! if not, skip this junk
 	mov	dividend,SIGN		! record sign of result in sign of SIGN
@@ -184,8 +185,8 @@ do_single_div:
 	nop
 	sub	R,V,R
 	mov	1,Q
-	b	end_single_divloop
-	nop
+	b,a	end_single_divloop
+	! EMPTY
 single_divloop:
 	sll	Q,1,Q
 	bl	1f
@@ -202,8 +203,8 @@ single_divloop:
 		deccc	SC
 		bge	single_divloop
 		tst	R
-		b	end_regular_divide
-		nop
+		b,a	end_regular_divide
+		! EMPTY
 
 not_really_big:
 1:
@@ -224,9 +225,8 @@ end_regular_divide:
 	deccc	ITER
 	bge	divloop
 	tst	R
-	bge	got_result
-	nop
-	! non-restoring fixup here
+	bl,a	got_result
+	! non-restoring fixup if remainder < 0, otherwise annulled
 ifelse( ANSWER, `quotient',
 `	dec	Q
 ',`	add	R,divisor,R
@@ -234,13 +234,11 @@ ifelse( ANSWER, `quotient',
 
 got_result:
 	tst	SIGN
-	bge	1f
-	restore
-	! answer < 0
-	retl				! leaf-routine return
+	bl,a	1f
+	! negate for answer < 0, otherwise annulled
 ifelse( ANSWER, `quotient',
-`	neg	%o2,%o0			! quotient <- -Q
-',`	neg	%o3,%o0 		! remainder <- -R
+`	neg	%o2,%o2			! Q <- -Q
+',`	neg	%o3,%o3 		! R <- -R
 ')
 1:
 	retl				! leaf-routine return

From owner-svn-src-stable-9@FreeBSD.ORG  Fri May 25 15:16:41 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 48050106566C;
	Fri, 25 May 2012 15:16:41 +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 32D438FC0C;
	Fri, 25 May 2012 15:16: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 q4PFGfMN017713;
	Fri, 25 May 2012 15:16:41 GMT (envelope-from marius@svn.freebsd.org)
Received: (from marius@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4PFGf6P017710;
	Fri, 25 May 2012 15:16:41 GMT (envelope-from marius@svn.freebsd.org)
Message-Id: <201205251516.q4PFGf6P017710@svn.freebsd.org>
From: Marius Strobl <marius@FreeBSD.org>
Date: Fri, 25 May 2012 15:16:40 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r236003 - stable/9/contrib/compiler-rt/lib/sparc64
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 25 May 2012 15:16:41 -0000

Author: marius
Date: Fri May 25 15:16:40 2012
New Revision: 236003
URL: http://svn.freebsd.org/changeset/base/236003

Log:
  MFC: r235389
  
  Regenerate after r235388 (MFC'ed to stable/9 in r236002).

Modified:
  stable/9/contrib/compiler-rt/lib/sparc64/divsi3.S
  stable/9/contrib/compiler-rt/lib/sparc64/modsi3.S
Directory Properties:
  stable/9/contrib/compiler-rt/   (props changed)

Modified: stable/9/contrib/compiler-rt/lib/sparc64/divsi3.S
==============================================================================
--- stable/9/contrib/compiler-rt/lib/sparc64/divsi3.S	Fri May 25 15:15:25 2012	(r236002)
+++ stable/9/contrib/compiler-rt/lib/sparc64/divsi3.S	Fri May 25 15:16:40 2012	(r236003)
@@ -47,13 +47,13 @@
  */
 #include "../assembly.h"
 .text
-	.align 4
+	.align 32
 DEFINE_COMPILERRT_FUNCTION(__udivsi3)
-	save	%sp,-64,%sp		! do this for debugging
 	b	divide
 	mov	0,%g3			! result always nonnegative
+.text
+	.align 32
 DEFINE_COMPILERRT_FUNCTION(__divsi3)
-	save	%sp,-64,%sp		! do this for debugging
 	orcc	%o1,%o0,%g0	! are either %o0 or %o1 negative
 	bge	divide			! if not, skip this junk
 	xor	%o1,%o0,%g3	! record sign of result in sign of %g3
@@ -126,8 +126,8 @@ do_single_div:
 	nop
 	sub	%o3,%o5,%o3
 	mov	1,%o2
-	b	end_single_divloop
-	nop
+	b,a	end_single_divloop
+	! EMPTY
 single_divloop:
 	sll	%o2,1,%o2
 	bl	1f
@@ -144,8 +144,8 @@ single_divloop:
 		deccc	%g2
 		bge	single_divloop
 		tst	%o3
-		b	end_regular_divide
-		nop
+		b,a	end_regular_divide
+		! EMPTY
 not_really_big:
 1:
 	sll	%o5,4,%o5
@@ -317,17 +317,14 @@ end_regular_divide:
 	deccc	%o4
 	bge	divloop
 	tst	%o3
-	bge	got_result
-	nop
-	! non-restoring fixup here
+	bl,a	got_result
+	! non-restoring fixup if remainder < 0, otherwise annulled
 	dec	%o2
 got_result:
 	tst	%g3
-	bge	1f
-	restore
-	! answer < 0
-	retl				! leaf-routine return
-	neg	%o2,%o0			! quotient <- -%o2
+	bl,a	1f
+	! negate for answer < 0, otherwise annulled
+	neg	%o2,%o2			! %o2 <- -%o2
 1:
 	retl				! leaf-routine return
 	mov	%o2,%o0			! quotient <- %o2

Modified: stable/9/contrib/compiler-rt/lib/sparc64/modsi3.S
==============================================================================
--- stable/9/contrib/compiler-rt/lib/sparc64/modsi3.S	Fri May 25 15:15:25 2012	(r236002)
+++ stable/9/contrib/compiler-rt/lib/sparc64/modsi3.S	Fri May 25 15:16:40 2012	(r236003)
@@ -47,13 +47,13 @@
  */
 #include "../assembly.h"
 .text
-	.align 4
+	.align 32
 DEFINE_COMPILERRT_FUNCTION(__umodsi3)
-	save	%sp,-64,%sp		! do this for debugging
 	b	divide
 	mov	0,%g3			! result always nonnegative
+.text
+	.align 32
 DEFINE_COMPILERRT_FUNCTION(__modsi3)
-	save	%sp,-64,%sp		! do this for debugging
 	orcc	%o1,%o0,%g0	! are either %o0 or %o1 negative
 	bge	divide			! if not, skip this junk
 	mov	%o0,%g3		! record sign of result in sign of %g3
@@ -126,8 +126,8 @@ do_single_div:
 	nop
 	sub	%o3,%o5,%o3
 	mov	1,%o2
-	b	end_single_divloop
-	nop
+	b,a	end_single_divloop
+	! EMPTY
 single_divloop:
 	sll	%o2,1,%o2
 	bl	1f
@@ -144,8 +144,8 @@ single_divloop:
 		deccc	%g2
 		bge	single_divloop
 		tst	%o3
-		b	end_regular_divide
-		nop
+		b,a	end_regular_divide
+		! EMPTY
 not_really_big:
 1:
 	sll	%o5,4,%o5
@@ -317,17 +317,14 @@ end_regular_divide:
 	deccc	%o4
 	bge	divloop
 	tst	%o3
-	bge	got_result
-	nop
-	! non-restoring fixup here
+	bl,a	got_result
+	! non-restoring fixup if remainder < 0, otherwise annulled
 	add	%o3,%o1,%o3
 got_result:
 	tst	%g3
-	bge	1f
-	restore
-	! answer < 0
-	retl				! leaf-routine return
-	neg	%o3,%o0 		! remainder <- -%o3
+	bl,a	1f
+	! negate for answer < 0, otherwise annulled
+	neg	%o3,%o3 		! %o3 <- -%o3
 1:
 	retl				! leaf-routine return
 	mov	%o3,%o0			! remainder <- %o3

From owner-svn-src-stable-9@FreeBSD.ORG  Fri May 25 16:07:39 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id ACC15106566B;
	Fri, 25 May 2012 16:07:39 +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 92E328FC12;
	Fri, 25 May 2012 16:07: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 q4PG7dvL019850;
	Fri, 25 May 2012 16:07:39 GMT
	(envelope-from bschmidt@svn.freebsd.org)
Received: (from bschmidt@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4PG7dVR019846;
	Fri, 25 May 2012 16:07:39 GMT
	(envelope-from bschmidt@svn.freebsd.org)
Message-Id: <201205251607.q4PG7dVR019846@svn.freebsd.org>
From: Bernhard Schmidt <bschmidt@FreeBSD.org>
Date: Fri, 25 May 2012 16:07:39 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r236004 - in stable/9/sys: conf contrib/dev/ral dev/ral
	modules/ral modules/ralfw modules/ralfw/rt2860
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 25 May 2012 16:07:39 -0000

Author: bschmidt
Date: Fri May 25 16:07:39 2012
New Revision: 236004
URL: http://svn.freebsd.org/changeset/base/236004

Log:
  MFC r232946,232958,235233:
  
  r232946:
  Update the rt2860's firmware and add a Makefile for the module. While
  here remove the ucode header file which was used to generate the fw files
  but by now is outdated.
  
  r232958:
  Import the latest microcode.h which was used to generate the current
  firmware files and adjust the Makefile.
  
  r235233:
  Add support for Ralink RT2800/RT3000 chipsets.

Added:
  stable/9/sys/contrib/dev/ral/microcode.h
     - copied unchanged from r232958, head/sys/contrib/dev/ral/microcode.h
  stable/9/sys/dev/ral/rt2860.c
     - copied unchanged from r235233, head/sys/dev/ral/rt2860.c
  stable/9/sys/dev/ral/rt2860reg.h
     - copied unchanged from r235233, head/sys/dev/ral/rt2860reg.h
  stable/9/sys/dev/ral/rt2860var.h
     - copied unchanged from r235233, head/sys/dev/ral/rt2860var.h
  stable/9/sys/modules/ralfw/rt2860/
     - copied from r232946, head/sys/modules/ralfw/rt2860/
Deleted:
  stable/9/sys/contrib/dev/ral/rt2661_ucode.h
Modified:
  stable/9/sys/conf/files
  stable/9/sys/contrib/dev/ral/Makefile
  stable/9/sys/contrib/dev/ral/rt2860.fw.uu
  stable/9/sys/dev/ral/if_ral_pci.c
  stable/9/sys/modules/ral/Makefile
  stable/9/sys/modules/ralfw/Makefile
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/conf/   (props changed)
  stable/9/sys/dev/   (props changed)
  stable/9/sys/modules/   (props changed)

Modified: stable/9/sys/conf/files
==============================================================================
--- stable/9/sys/conf/files	Fri May 25 15:16:40 2012	(r236003)
+++ stable/9/sys/conf/files	Fri May 25 16:07:39 2012	(r236004)
@@ -1616,6 +1616,7 @@ dev/puc/pucdata.c		optional puc pci
 dev/quicc/quicc_core.c		optional quicc
 dev/ral/rt2560.c		optional ral
 dev/ral/rt2661.c		optional ral
+dev/ral/rt2860.c		optional ral
 dev/ral/if_ral_pci.c		optional ral pci
 rt2561fw.c			optional rt2561fw | ralfw		\
 	compile-with	"${AWK} -f $S/tools/fw_stub.awk rt2561.fw:rt2561fw -mrt2561 -c${.TARGET}" \

Modified: stable/9/sys/contrib/dev/ral/Makefile
==============================================================================
--- stable/9/sys/contrib/dev/ral/Makefile	Fri May 25 15:16:40 2012	(r236003)
+++ stable/9/sys/contrib/dev/ral/Makefile	Fri May 25 16:07:39 2012	(r236004)
@@ -2,31 +2,35 @@
 
 FILES=	rt2561s.fw.uu rt2561.fw.uu rt2661.fw.uu rt2860.fw.uu
 
-rt2561s.fw.uu: rt2661_ucode.h LICENSE
-	(cat rt2661_ucode.h; \
+rt2561s.fw.uu: microcode.h LICENSE
+	(echo '#include <stdint.h>'; \
+	 cat microcode.h; \
 	 echo 'int main(void) { \
-	     write(1, rt2561s_ucode, sizeof(rt2561s_ucode)); return 0; \
+	     write(1, rt2561s, sizeof(rt2561s)); return 0; \
 	 }') | ${CC} -o build -x c -
 	(sed 's/^/# /' LICENSE; ./build | uuencode rt2561s.fw) > ${.TARGET}
 
-rt2561.fw.uu: rt2661_ucode.h LICENSE
-	(cat rt2661_ucode.h; \
+rt2561.fw.uu: microcode.h LICENSE
+	(echo '#include <stdint.h>'; \
+	 cat microcode.h; \
 	 echo 'int main(void) { \
-	     write(1, rt2561_ucode, sizeof(rt2561_ucode)); return 0; \
+	     write(1, rt2561, sizeof(rt2561)); return 0; \
 	 }') | ${CC} -o build -x c -
 	(sed 's/^/# /' LICENSE; ./build | uuencode rt2561.fw) > ${.TARGET}
 
-rt2661.fw.uu: rt2661_ucode.h LICENSE
-	(cat rt2661_ucode.h; \
+rt2661.fw.uu: microcode.h LICENSE
+	(echo '#include <stdint.h>'; \
+	 cat microcode.h; \
 	 echo 'int main(void) { \
-	     write(1, rt2661_ucode, sizeof(rt2661_ucode)); return 0; \
+	     write(1, rt2661, sizeof(rt2661)); return 0; \
 	 }') | ${CC} -o build -x c -
 	(sed 's/^/# /' LICENSE; ./build | uuencode rt2661.fw) > ${.TARGET}
 
-rt2860.fw.uu: rt2661_ucode.h LICENSE
-	(cat rt2661_ucode.h; \
+rt2860.fw.uu: microcode.h LICENSE
+	(echo '#include <stdint.h>'; \
+	 cat microcode.h; \
 	 echo 'int main(void) { \
-	     write(1, rt2860_ucode, sizeof(rt2860_ucode)); return 0; \
+	     write(1, rt2860, sizeof(rt2860)); return 0; \
 	 }') | ${CC} -o build -x c -
 	(sed 's/^/# /' LICENSE; ./build | uuencode rt2860.fw) > ${.TARGET}
 

Copied: stable/9/sys/contrib/dev/ral/microcode.h (from r232958, head/sys/contrib/dev/ral/microcode.h)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ stable/9/sys/contrib/dev/ral/microcode.h	Fri May 25 16:07:39 2012	(r236004, copy of r232958, head/sys/contrib/dev/ral/microcode.h)
@@ -0,0 +1,3016 @@
+/*	$FreeBSD$	*/
+/*	$OpenBSD: microcode.h,v 1.7 2010/04/05 14:14:02 damien Exp $	*/
+
+/*-
+ * Copyright (c) 2005-2010, Ralink Technology, Corp.
+ *	Paul Lin <paul_lin@ralinktech.com.tw>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * This file contains the loadable 8051 microcodes for the Ralink RT2561,
+ * RT2561S, RT2661 and RT2860 chipsets.
+ */
+
+static const uint8_t rt2561[] = {
+	0x02, 0x1c, 0x12, 0x02, 0x13, 0xcb, 0xc2, 0x8c, 0x22, 0x22, 0x00,
+	0x02, 0x16, 0x0f, 0xc2, 0xaf, 0xc2, 0x8d, 0x75, 0x8c, 0x94, 0x75,
+	0x8a, 0x93, 0xd2, 0xaf, 0x22, 0x02, 0x18, 0xda, 0x12, 0x1b, 0xe8,
+	0x40, 0x03, 0x02, 0x02, 0x1e, 0x90, 0x21, 0x02, 0xe0, 0xf5, 0x2d,
+	0x90, 0x00, 0x03, 0xe0, 0x12, 0x08, 0x25, 0x00, 0xb0, 0x00, 0x00,
+	0xce, 0x01, 0x00, 0x5e, 0x10, 0x00, 0x6f, 0x11, 0x00, 0xf2, 0x20,
+	0x01, 0x4d, 0x21, 0x01, 0x70, 0x22, 0x01, 0x84, 0x30, 0x01, 0x8f,
+	0x31, 0x01, 0xd5, 0x50, 0x01, 0x9f, 0x51, 0x01, 0xf2, 0x52, 0x02,
+	0x06, 0x60, 0x00, 0x00, 0x02, 0x14, 0x90, 0x00, 0x0a, 0xe0, 0x20,
+	0xe5, 0x03, 0x30, 0x07, 0x03, 0xd2, 0x08, 0x22, 0x12, 0x17, 0xa5,
+	0x22, 0x90, 0x21, 0x00, 0xe0, 0xf5, 0x11, 0xe5, 0x11, 0xc4, 0x33,
+	0x54, 0xe0, 0x24, 0x21, 0xf5, 0x82, 0xe4, 0x34, 0x21, 0xf5, 0x83,
+	0xe0, 0x44, 0x80, 0xf0, 0xe5, 0x11, 0xc4, 0x33, 0x54, 0xe0, 0x24,
+	0x2c, 0xf5, 0x82, 0xe4, 0x34, 0x21, 0xf5, 0x83, 0xe5, 0x11, 0xf0,
+	0xc4, 0x33, 0x54, 0xe0, 0x24, 0x2d, 0xf5, 0x82, 0xe4, 0x34, 0x21,
+	0xf5, 0x83, 0xe5, 0x2d, 0xf0, 0xe4, 0x90, 0x21, 0x03, 0xf0, 0x22,
+	0x12, 0x11, 0x31, 0x90, 0x21, 0x00, 0xe0, 0xf5, 0x31, 0x60, 0x05,
+	0x12, 0x1b, 0x8a, 0x80, 0x03, 0x12, 0x1b, 0x3d, 0xe4, 0x90, 0x21,
+	0x03, 0xf0, 0xaf, 0x2d, 0x12, 0x1c, 0x62, 0x22, 0x75, 0x31, 0xff,
+	0x90, 0x01, 0x00, 0xe0, 0x54, 0xf7, 0xf0, 0x90, 0x01, 0x01, 0xe0,
+	0x54, 0xfe, 0xf0, 0x54, 0x3e, 0xf0, 0xe4, 0x90, 0x00, 0x0b, 0xf0,
+	0xf0, 0x90, 0x21, 0x03, 0xf0, 0xaf, 0x2d, 0x12, 0x1c, 0x62, 0x22,
+	0x7e, 0x2b, 0x7f, 0x80, 0x7d, 0x03, 0x12, 0x04, 0x0e, 0x90, 0x34,
+	0xcd, 0xe0, 0x20, 0xe3, 0xf9, 0x90, 0x21, 0x14, 0x12, 0x08, 0x01,
+	0x90, 0x34, 0xc0, 0x12, 0x08, 0x0d, 0x90, 0x21, 0x18, 0x12, 0x08,
+	0x01, 0x90, 0x34, 0xc8, 0x12, 0x08, 0x0d, 0x90, 0x21, 0x1c, 0x12,
+	0x08, 0x01, 0x90, 0x34, 0xc4, 0x12, 0x08, 0x0d, 0x90, 0x34, 0xcc,
+	0x74, 0x01, 0xf0, 0xa3, 0xe0, 0x44, 0x04, 0xf0, 0x90, 0x01, 0x01,
+	0xe0, 0x44, 0x01, 0xf0, 0x44, 0x40, 0xf0, 0x90, 0x00, 0x0b, 0xe0,
+	0x44, 0x10, 0xf0, 0xe4, 0x90, 0x21, 0x03, 0xf0, 0xaf, 0x2d, 0x12,
+	0x1c, 0x62, 0x22, 0x90, 0x01, 0x00, 0xe0, 0x54, 0xf7, 0xf0, 0x90,
+	0x01, 0x01, 0xe0, 0x54, 0xfe, 0xf0, 0x54, 0xbf, 0xf0, 0x90, 0x00,
+	0x0b, 0xe0, 0x54, 0xef, 0xf0, 0xe4, 0x90, 0x21, 0x03, 0xf0, 0xaf,
+	0x2d, 0x12, 0x1c, 0x62, 0x22, 0x7e, 0x2b, 0x7f, 0x80, 0x7d, 0x03,
+	0x12, 0x04, 0x0e, 0xe4, 0x90, 0x21, 0x03, 0xf0, 0xaf, 0x2d, 0x12,
+	0x1c, 0x62, 0x22, 0xd2, 0x05, 0x85, 0x2d, 0x23, 0xe4, 0x90, 0x21,
+	0x03, 0xf0, 0x22, 0x12, 0x1a, 0x74, 0xc2, 0x00, 0xe4, 0x90, 0x21,
+	0x03, 0xf0, 0xaf, 0x2d, 0x12, 0x1c, 0x62, 0x22, 0x85, 0x2d, 0x25,
+	0x90, 0x00, 0x0b, 0xe0, 0x54, 0xfb, 0xff, 0xf0, 0xe4, 0x90, 0x00,
+	0x07, 0xf0, 0x90, 0x00, 0x0a, 0x74, 0x04, 0xf0, 0xe4, 0x90, 0x00,
+	0x08, 0xf0, 0x90, 0x21, 0x00, 0xe0, 0x90, 0x00, 0x09, 0xf0, 0x90,
+	0x00, 0x07, 0x74, 0x71, 0xf0, 0xef, 0x44, 0x04, 0x90, 0x00, 0x0b,
+	0xf0, 0xe4, 0x90, 0x21, 0x03, 0xf0, 0x22, 0x90, 0x21, 0x00, 0xe0,
+	0xff, 0x54, 0x1f, 0xf5, 0x30, 0xa3, 0xe0, 0xf5, 0x27, 0x8f, 0x26,
+	0x12, 0x08, 0x90, 0xe4, 0x90, 0x21, 0x03, 0xf0, 0xaf, 0x2d, 0x12,
+	0x1c, 0x62, 0x22, 0x90, 0x21, 0x00, 0xe0, 0xf5, 0x2c, 0x12, 0x18,
+	0x13, 0xe4, 0x90, 0x21, 0x03, 0xf0, 0xaf, 0x2d, 0x12, 0x1c, 0x62,
+	0x22, 0x12, 0x19, 0x53, 0xe4, 0x90, 0x21, 0x03, 0xf0, 0xaf, 0x2d,
+	0x12, 0x1c, 0x62, 0x22, 0xe4, 0x90, 0x21, 0x03, 0xf0, 0xaf, 0x2d,
+	0x12, 0x1c, 0x62, 0x22, 0x8e, 0x15, 0x8f, 0x16, 0xca, 0xed, 0xca,
+	0xc9, 0xeb, 0xc9, 0x30, 0x0a, 0x04, 0x7f, 0x4a, 0x80, 0x02, 0x7f,
+	0x42, 0xcb, 0xef, 0xcb, 0xea, 0xc3, 0x94, 0x04, 0x50, 0x02, 0x80,
+	0x01, 0xc3, 0x40, 0x04, 0xcb, 0x44, 0x20, 0xcb, 0x85, 0x16, 0x82,
+	0x85, 0x15, 0x83, 0xeb, 0xf0, 0xa3, 0xe4, 0xf0, 0x85, 0x16, 0x82,
+	0x85, 0x15, 0x83, 0xa3, 0xa3, 0xe5, 0x1a, 0xf0, 0xe5, 0x19, 0x85,
+	0x16, 0x82, 0x85, 0x15, 0x83, 0xa3, 0xa3, 0xa3, 0xf0, 0xe5, 0x16,
+	0x24, 0x04, 0xf5, 0x82, 0xe4, 0x35, 0x15, 0xf5, 0x83, 0x74, 0x0f,
+	0xf0, 0xe5, 0x16, 0x24, 0x05, 0xf5, 0x82, 0xe4, 0x35, 0x15, 0xf5,
+	0x83, 0xe4, 0xf0, 0xe5, 0x16, 0x24, 0x06, 0xf5, 0x82, 0xe4, 0x35,
+	0x15, 0xf5, 0x83, 0xe4, 0xf0, 0xe5, 0x16, 0x24, 0x07, 0xf5, 0x82,
+	0xe4, 0x35, 0x15, 0xf5, 0x83, 0x74, 0x10, 0xf0, 0xea, 0x90, 0x1a,
+	0x9c, 0x93, 0xfb, 0xea, 0x64, 0x01, 0x60, 0x08, 0xea, 0x64, 0x02,
+	0x60, 0x03, 0xba, 0x03, 0x04, 0xcb, 0x44, 0x08, 0xcb, 0xe5, 0x16,
+	0x24, 0x08, 0xf5, 0x82, 0xe4, 0x35, 0x15, 0xf5, 0x83, 0xeb, 0xf0,
+	0xe5, 0x16, 0x24, 0x15, 0xf5, 0x82, 0xe4, 0x35, 0x15, 0xf5, 0x83,
+	0x74, 0xff, 0xf0, 0xe5, 0x16, 0x24, 0x16, 0xf5, 0x82, 0xe4, 0x35,
+	0x15, 0xf5, 0x83, 0xe9, 0xf0, 0xe5, 0x16, 0x24, 0x09, 0xf5, 0x82,
+	0xe4, 0x35, 0x15, 0xf5, 0x83, 0x74, 0x04, 0xf0, 0x25, 0x1a, 0xf5,
+	0x1a, 0xe4, 0x35, 0x19, 0xf5, 0x19, 0xea, 0xc3, 0x94, 0x04, 0x40,
+	0x03, 0x02, 0x03, 0xd6, 0xea, 0x60, 0x03, 0xba, 0x01, 0x1f, 0xea,
+	0x24, 0x01, 0xfd, 0xe4, 0x33, 0xfc, 0xe5, 0x1a, 0xae, 0x19, 0x78,
+	0x03, 0xc3, 0x33, 0xce, 0x33, 0xce, 0xd8, 0xf9, 0xff, 0x12, 0x07,
+	0x96, 0x8e, 0x19, 0x8f, 0x1a, 0x02, 0x03, 0xb6, 0xea, 0x24, 0xff,
+	0xfd, 0xe4, 0x34, 0xff, 0xfc, 0x7e, 0x00, 0x7f, 0x0b, 0x12, 0x07,
+	0x84, 0xcc, 0xee, 0xcc, 0xcd, 0xef, 0xcd, 0xe5, 0x1a, 0xc4, 0xf8,
+	0x54, 0x0f, 0xc8, 0x68, 0xff, 0xe5, 0x19, 0xc4, 0x54, 0xf0, 0x48,
+	0xfe, 0x12, 0x07, 0x96, 0x8c, 0x1b, 0x8d, 0x1c, 0xea, 0x24, 0xff,
+	0xfd, 0xe4, 0x34, 0xff, 0xfc, 0x7e, 0x00, 0x7f, 0x0b, 0x12, 0x07,
+	0x84, 0xcc, 0xee, 0xcc, 0xcd, 0xef, 0xcd, 0xe5, 0x1a, 0xc4, 0xf8,
+	0x54, 0x0f, 0xc8, 0x68, 0xff, 0xe5, 0x19, 0xc4, 0x54, 0xf0, 0x48,
+	0xfe, 0x12, 0x07, 0x96, 0x8e, 0x19, 0x8f, 0x1a, 0xe5, 0x1c, 0x45,
+	0x1b, 0x60, 0x08, 0x05, 0x1a, 0xe5, 0x1a, 0x70, 0x02, 0x05, 0x19,
+	0xea, 0x24, 0xff, 0xfd, 0xe4, 0x34, 0xff, 0xfc, 0x7e, 0x00, 0x7f,
+	0x03, 0x12, 0x07, 0x84, 0xd3, 0xe5, 0x1c, 0x9f, 0xe5, 0x1b, 0x9e,
+	0x50, 0x18, 0xe5, 0x1c, 0x45, 0x1b, 0x60, 0x12, 0xba, 0x03, 0x0f,
+	0xe5, 0x16, 0x24, 0x09, 0xf5, 0x82, 0xe4, 0x35, 0x15, 0xf5, 0x83,
+	0xe0, 0x44, 0x80, 0xf0, 0xe5, 0x16, 0x24, 0x0a, 0xf5, 0x82, 0xe4,
+	0x35, 0x15, 0xf5, 0x83, 0xe5, 0x1a, 0xf0, 0xe5, 0x19, 0xff, 0xe5,
+	0x16, 0x24, 0x0b, 0xf5, 0x82, 0xe4, 0x35, 0x15, 0xf5, 0x83, 0xef,
+	0xf0, 0x80, 0x2d, 0xe5, 0x1a, 0x54, 0x3f, 0xff, 0xe5, 0x16, 0x24,
+	0x0a, 0xf5, 0x82, 0xe4, 0x35, 0x15, 0xf5, 0x83, 0xef, 0xf0, 0xe5,
+	0x1a, 0xae, 0x19, 0x78, 0x06, 0xce, 0xc3, 0x13, 0xce, 0x13, 0xd8,
+	0xf9, 0xff, 0xe5, 0x16, 0x24, 0x0b, 0xf5, 0x82, 0xe4, 0x35, 0x15,
+	0xf5, 0x83, 0xef, 0xf0, 0x85, 0x16, 0x82, 0x85, 0x15, 0x83, 0xe0,
+	0x44, 0x01, 0xf0, 0x22, 0x8e, 0x12, 0x8f, 0x13, 0x8d, 0x14, 0xe5,
+	0x14, 0xa2, 0xe1, 0x92, 0x09, 0xe5, 0x34, 0x24, 0x19, 0xf5, 0x82,
+	0xe4, 0x35, 0x33, 0xf5, 0x83, 0xe0, 0xfd, 0xe5, 0x34, 0x24, 0x1a,
+	0xf5, 0x82, 0xe4, 0x35, 0x33, 0xf5, 0x83, 0xe0, 0xfb, 0xa2, 0x09,
+	0x92, 0x0a, 0x75, 0x19, 0x00, 0x75, 0x1a, 0x1a, 0x12, 0x02, 0x1f,
+	0x30, 0x09, 0x04, 0x7f, 0xc8, 0x80, 0x02, 0x7f, 0xe8, 0xe5, 0x13,
+	0x24, 0x18, 0xf5, 0x82, 0xe4, 0x35, 0x12, 0xf5, 0x83, 0xef, 0xf0,
+	0xe5, 0x31, 0x60, 0x04, 0x7f, 0x02, 0x80, 0x02, 0x7f, 0x01, 0xe5,
+	0x13, 0x24, 0x19, 0xf5, 0x82, 0xe4, 0x35, 0x12, 0xf5, 0x83, 0xef,
+	0xf0, 0xe5, 0x34, 0x24, 0x19, 0xf5, 0x82, 0xe4, 0x35, 0x33, 0xf5,
+	0x83, 0xe0, 0xff, 0x7d, 0x1a, 0x7c, 0x00, 0x12, 0x0e, 0x64, 0xe5,
+	0x13, 0x24, 0x1a, 0xf5, 0x82, 0xe4, 0x35, 0x12, 0xf5, 0x83, 0xef,
+	0xf0, 0xe5, 0x13, 0x24, 0x1b, 0xf5, 0x82, 0xe4, 0x35, 0x12, 0xf5,
+	0x83, 0xee, 0xf0, 0xe5, 0x31, 0x60, 0x60, 0xe5, 0x13, 0x24, 0x1c,
+	0xff, 0xe4, 0x35, 0x12, 0xfe, 0xe5, 0x34, 0x24, 0x12, 0xfd, 0xe4,
+	0x35, 0x33, 0xfc, 0x75, 0x1b, 0x11, 0x7b, 0x06, 0x12, 0x14, 0xab,
+	0xe5, 0x13, 0x24, 0x22, 0xff, 0xe4, 0x35, 0x12, 0xfe, 0x7c, 0x30,
+	0x7d, 0x10, 0x75, 0x1b, 0x11, 0x7b, 0x06, 0x12, 0x14, 0xab, 0xe5,
+	0x13, 0x24, 0x28, 0xff, 0xe4, 0x35, 0x12, 0xfe, 0x7c, 0x30, 0x7d,
+	0x08, 0x75, 0x1b, 0x11, 0x7b, 0x06, 0x12, 0x14, 0xab, 0xe5, 0x34,
+	0x24, 0x18, 0xf5, 0x82, 0xe4, 0x35, 0x33, 0xf5, 0x83, 0xe0, 0xff,
+	0xe5, 0x13, 0x24, 0x2d, 0xf5, 0x82, 0xe4, 0x35, 0x12, 0xf5, 0x83,
+	0xef, 0xf0, 0x80, 0x3f, 0xe5, 0x13, 0x24, 0x1c, 0xff, 0xe4, 0x35,
+	0x12, 0xfe, 0x7c, 0x30, 0x7d, 0x10, 0x75, 0x1b, 0x11, 0x7b, 0x06,
+	0x12, 0x14, 0xab, 0xe5, 0x13, 0x24, 0x22, 0xff, 0xe4, 0x35, 0x12,
+	0xfe, 0x7c, 0x30, 0x7d, 0x08, 0x75, 0x1b, 0x11, 0x7b, 0x06, 0x12,
+	0x14, 0xab, 0xe5, 0x13, 0x24, 0x28, 0xff, 0xe4, 0x35, 0x12, 0xfe,
+	0x7c, 0x30, 0x7d, 0x10, 0x75, 0x1b, 0x11, 0x7b, 0x06, 0x12, 0x14,
+	0xab, 0xe5, 0x13, 0x24, 0x2e, 0xf5, 0x82, 0xe4, 0x35, 0x12, 0xf5,
+	0x83, 0xe4, 0xf0, 0xe5, 0x13, 0x24, 0x2f, 0xf5, 0x82, 0xe4, 0x35,
+	0x12, 0xf5, 0x83, 0xe4, 0xf0, 0xe5, 0x34, 0x24, 0x11, 0xf5, 0x82,
+	0xe4, 0x35, 0x33, 0xf5, 0x83, 0xe0, 0xff, 0xc3, 0x13, 0xff, 0xe5,
+	0x13, 0x24, 0x30, 0xf5, 0x82, 0xe4, 0x35, 0x12, 0xf5, 0x83, 0xef,
+	0xf0, 0x30, 0x09, 0x41, 0xe5, 0x13, 0x24, 0x30, 0xf5, 0x82, 0xe4,
+	0x35, 0x12, 0xf5, 0x83, 0xe0, 0xff, 0xe5, 0x31, 0x60, 0x04, 0x7e,
+	0x00, 0x80, 0x02, 0x7e, 0x10, 0xef, 0x4e, 0xf0, 0xe5, 0x31, 0x60,
+	0x06, 0x7e, 0x00, 0x7f, 0x00, 0x80, 0x0f, 0xe5, 0x14, 0x30, 0xe0,
+	0x06, 0x7e, 0x00, 0x7f, 0xff, 0x80, 0x04, 0x7e, 0x00, 0x7f, 0x00,
+	0xe5, 0x13, 0x24, 0x31, 0xf5, 0x82, 0xe4, 0x35, 0x12, 0xf5, 0x83,
+	0xef, 0xf0, 0x22, 0xe5, 0x13, 0x24, 0x30, 0xf5, 0x82, 0xe4, 0x35,
+	0x12, 0xf5, 0x83, 0xe0, 0x44, 0x40, 0xf0, 0xe5, 0x14, 0x30, 0xe0,
+	0x0f, 0xe5, 0x34, 0x24, 0x10, 0xf5, 0x82, 0xe4, 0x35, 0x33, 0xf5,
+	0x83, 0xe0, 0xff, 0x80, 0x02, 0x7f, 0x00, 0xe5, 0x13, 0x24, 0x31,
+	0xf5, 0x82, 0xe4, 0x35, 0x12, 0xf5, 0x83, 0xef, 0xf0, 0x22, 0xe5,
+	0x34, 0x24, 0x11, 0xf5, 0x82, 0xe4, 0x35, 0x33, 0xf5, 0x83, 0xe0,
+	0x30, 0xe7, 0x3b, 0xe5, 0x34, 0x24, 0x1c, 0xf5, 0x82, 0xe4, 0x35,
+	0x33, 0xf5, 0x83, 0xe0, 0x65, 0x2b, 0x70, 0x03, 0x75, 0x2b, 0xff,
+	0xe5, 0x34, 0x24, 0x1d, 0xf5, 0x82, 0xe4, 0x35, 0x33, 0xf5, 0x83,
+	0xe0, 0xff, 0x12, 0x1c, 0x62, 0x7e, 0x22, 0x7f, 0x10, 0x12, 0x18,
+	0x7c, 0x8e, 0x33, 0x8f, 0x34, 0x90, 0x22, 0x2e, 0xe0, 0xfe, 0xa3,
+	0xe0, 0x8e, 0x33, 0xf5, 0x34, 0xc3, 0x22, 0xd2, 0x0a, 0xe5, 0x34,
+	0x24, 0x1b, 0xf5, 0x82, 0xe4, 0x35, 0x33, 0xf5, 0x83, 0xe0, 0x70,
+	0x3a, 0x85, 0x34, 0x82, 0x85, 0x33, 0x83, 0xc0, 0x83, 0xc0, 0x82,
+	0xe0, 0xfe, 0xa3, 0xe0, 0xff, 0x85, 0x34, 0x82, 0x85, 0x33, 0x83,
+	0xa3, 0xa3, 0xe0, 0xfc, 0xa3, 0xe0, 0xfd, 0xc3, 0xef, 0x9d, 0xff,
+	0xee, 0x9c, 0xfe, 0xd0, 0x82, 0xd0, 0x83, 0xf0, 0xa3, 0xef, 0xf0,
+	0xd3, 0x94, 0x00, 0xee, 0x64, 0x80, 0x94, 0x80, 0x50, 0x03, 0x02,
+	0x07, 0x27, 0x80, 0xc6, 0x85, 0x34, 0x82, 0x85, 0x33, 0x83, 0xe0,
+	0xfe, 0xa3, 0xe0, 0xc3, 0xee, 0x64, 0x80, 0x94, 0x80, 0x50, 0x03,
+	0x02, 0x07, 0x27, 0x12, 0x1c, 0x41, 0x85, 0x34, 0x82, 0x85, 0x33,
+	0x83, 0xe0, 0xfc, 0xa3, 0xe0, 0xfd, 0xc3, 0x9f, 0xee, 0x64, 0x80,
+	0xf8, 0xec, 0x64, 0x80, 0x98, 0x40, 0x20, 0x85, 0x34, 0x82, 0x85,
+	0x33, 0x83, 0xc0, 0x83, 0xc0, 0x82, 0xa3, 0xa3, 0xe0, 0xfe, 0xa3,
+	0xe0, 0xff, 0xed, 0x9f, 0xff, 0xec, 0x9e, 0xd0, 0x82, 0xd0, 0x83,
+	0xf0, 0xa3, 0xef, 0xf0, 0xc2, 0x0a, 0x85, 0x34, 0x82, 0x85, 0x33,
+	0x83, 0xe0, 0xfe, 0xa3, 0xe0, 0xff, 0xe5, 0x34, 0x24, 0x10, 0xf5,
+	0x82, 0xe4, 0x35, 0x33, 0xf5, 0x83, 0xe0, 0xfd, 0xc3, 0xef, 0x9d,
+	0xfd, 0xee, 0x94, 0x00, 0xfc, 0x12, 0x16, 0x5a, 0x50, 0x2c, 0x85,
+	0x34, 0x82, 0x85, 0x33, 0x83, 0xc0, 0x83, 0xc0, 0x82, 0xe0, 0xfe,
+	0xa3, 0xe0, 0xff, 0x85, 0x34, 0x82, 0x85, 0x33, 0x83, 0xa3, 0xa3,
+	0xe0, 0xfc, 0xa3, 0xe0, 0xfd, 0xc3, 0xef, 0x9d, 0xff, 0xee, 0x9c,
+	0xd0, 0x82, 0xd0, 0x83, 0xf0, 0xa3, 0xef, 0xf0, 0xc2, 0x0a, 0x20,
+	0x0a, 0x03, 0x02, 0x06, 0x37, 0x7e, 0x22, 0x7f, 0x10, 0x12, 0x18,
+	0x7c, 0x8e, 0x33, 0x8f, 0x34, 0x8f, 0x82, 0x8e, 0x83, 0xe0, 0xfe,
+	0xa3, 0xe0, 0xd3, 0x94, 0x00, 0xee, 0x64, 0x80, 0x94, 0x80, 0x40,
+	0x0d, 0x7e, 0x22, 0x7f, 0x10, 0xad, 0x34, 0xac, 0x33, 0x12, 0x15,
+	0x0e, 0x80, 0x1a, 0x12, 0x1b, 0xab, 0x85, 0x34, 0x82, 0x85, 0x33,
+	0x83, 0xee, 0x8f, 0xf0, 0x12, 0x07, 0xeb, 0x7e, 0x22, 0x7f, 0x30,
+	0xad, 0x34, 0xac, 0x33, 0x12, 0x15, 0x0e, 0x90, 0x22, 0x2e, 0xe0,
+	0xfe, 0xa3, 0xe0, 0xff, 0x65, 0x34, 0x70, 0x03, 0xee, 0x65, 0x33,
+	0x70, 0x02, 0xd3, 0x22, 0x8e, 0x33, 0x8f, 0x34, 0xc3, 0x22, 0xef,
+	0x8d, 0xf0, 0xa4, 0xa8, 0xf0, 0xcf, 0x8c, 0xf0, 0xa4, 0x28, 0xce,
+	0x8d, 0xf0, 0xa4, 0x2e, 0xfe, 0x22, 0xbc, 0x00, 0x0b, 0xbe, 0x00,
+	0x29, 0xef, 0x8d, 0xf0, 0x84, 0xff, 0xad, 0xf0, 0x22, 0xe4, 0xcc,
+	0xf8, 0x75, 0xf0, 0x08, 0xef, 0x2f, 0xff, 0xee, 0x33, 0xfe, 0xec,
+	0x33, 0xfc, 0xee, 0x9d, 0xec, 0x98, 0x40, 0x05, 0xfc, 0xee, 0x9d,
+	0xfe, 0x0f, 0xd5, 0xf0, 0xe9, 0xe4, 0xce, 0xfd, 0x22, 0xed, 0xf8,
+	0xf5, 0xf0, 0xee, 0x84, 0x20, 0xd2, 0x1c, 0xfe, 0xad, 0xf0, 0x75,
+	0xf0, 0x08, 0xef, 0x2f, 0xff, 0xed, 0x33, 0xfd, 0x40, 0x07, 0x98,
+	0x50, 0x06, 0xd5, 0xf0, 0xf2, 0x22, 0xc3, 0x98, 0xfd, 0x0f, 0xd5,
+	0xf0, 0xea, 0x22, 0xc5, 0xf0, 0xf8, 0xa3, 0xe0, 0x28, 0xf0, 0xc5,
+	0xf0, 0xf8, 0xe5, 0x82, 0x15, 0x82, 0x70, 0x02, 0x15, 0x83, 0xe0,
+	0x38, 0xf0, 0x22, 0xe0, 0xfc, 0xa3, 0xe0, 0xfd, 0xa3, 0xe0, 0xfe,
+	0xa3, 0xe0, 0xff, 0x22, 0xec, 0xf0, 0xa3, 0xed, 0xf0, 0xa3, 0xee,
+	0xf0, 0xa3, 0xef, 0xf0, 0x22, 0xa4, 0x25, 0x82, 0xf5, 0x82, 0xe5,
+	0xf0, 0x35, 0x83, 0xf5, 0x83, 0x22, 0xd0, 0x83, 0xd0, 0x82, 0xf8,
+	0xe4, 0x93, 0x70, 0x12, 0x74, 0x01, 0x93, 0x70, 0x0d, 0xa3, 0xa3,
+	0x93, 0xf8, 0x74, 0x01, 0x93, 0xf5, 0x82, 0x88, 0x83, 0xe4, 0x73,
+	0x74, 0x02, 0x93, 0x68, 0x60, 0xef, 0xa3, 0xa3, 0xa3, 0x80, 0xdf,
+	0x8a, 0x83, 0x89, 0x82, 0xe4, 0x73, 0xe4, 0xff, 0x90, 0x30, 0x8c,
+	0xe4, 0xf0, 0xef, 0x90, 0x1b, 0x51, 0x93, 0x44, 0x80, 0x90, 0x30,
+	0x8d, 0xf0, 0xa3, 0x74, 0x01, 0xf0, 0xa3, 0xe4, 0xf0, 0x90, 0x30,
+	0x8c, 0xe0, 0xfe, 0x74, 0x36, 0x2f, 0xf8, 0xc6, 0xee, 0xc6, 0xa3,
+	0xe0, 0xfe, 0xef, 0x90, 0x1b, 0x51, 0x93, 0x44, 0x80, 0x6e, 0x60,
+	0x01, 0x1f, 0x0f, 0xef, 0xc3, 0x94, 0x09, 0x40, 0xc8, 0x22, 0x00,
+	0x00, 0x00, 0x00, 0xe5, 0x30, 0x12, 0x08, 0x25, 0x08, 0xb1, 0x00,
+	0x09, 0x1f, 0x01, 0x09, 0x87, 0x02, 0x0a, 0x1b, 0x03, 0x0a, 0x6f,
+	0x04, 0x0a, 0xb6, 0x05, 0x0b, 0x29, 0x06, 0x0b, 0x98, 0x07, 0x00,
+	0x00, 0x0b, 0xd0, 0xc2, 0x01, 0x12, 0x00, 0x06, 0x90, 0x30, 0x3a,
+	0xe0, 0xf5, 0x12, 0xe5, 0x26, 0x20, 0xe5, 0x08, 0x90, 0x34, 0x98,
+	0xe0, 0x54, 0xfe, 0xf0, 0x22, 0x90, 0x34, 0x98, 0xe0, 0x44, 0x01,
+	0xf0, 0xe5, 0x26, 0x30, 0xe6, 0x0f, 0xe5, 0x27, 0x30, 0xe6, 0x05,
+	0x53, 0x12, 0xfd, 0x80, 0x12, 0x43, 0x12, 0x02, 0x80, 0x0d, 0xe5,
+	0x27, 0x30, 0xe6, 0x05, 0x43, 0x12, 0x02, 0x80, 0x03, 0x53, 0x12,
+	0xfd, 0xe5, 0x26, 0x30, 0xe7, 0x0f, 0xe5, 0x27, 0x30, 0xe7, 0x05,
+	0x53, 0x12, 0xf7, 0x80, 0x12, 0x43, 0x12, 0x08, 0x80, 0x0d, 0xe5,
+	0x27, 0x30, 0xe7, 0x05, 0x43, 0x12, 0x08, 0x80, 0x03, 0x53, 0x12,
+	0xf7, 0x43, 0x12, 0x01, 0x43, 0x12, 0x04, 0x90, 0x30, 0x3a, 0xe5,
+	0x12, 0xf0, 0x22, 0xc2, 0x01, 0x12, 0x00, 0x06, 0x90, 0x30, 0x3a,
+	0xe0, 0xf5, 0x12, 0xe5, 0x26, 0x20, 0xe5, 0x08, 0x90, 0x34, 0x98,
+	0xe0, 0x54, 0xfe, 0xf0, 0x22, 0x90, 0x34, 0x98, 0xe0, 0x44, 0x01,
+	0xf0, 0xe5, 0x26, 0x54, 0xc0, 0x60, 0x1c, 0xe5, 0x27, 0x30, 0xe6,
+	0x05, 0x53, 0x12, 0xfd, 0x80, 0x03, 0x43, 0x12, 0x02, 0xe5, 0x27,
+	0x30, 0xe7, 0x05, 0x53, 0x12, 0xf7, 0x80, 0x1f, 0x43, 0x12, 0x08,
+	0x80, 0x1a, 0xe5, 0x27, 0x30, 0xe6, 0x05, 0x43, 0x12, 0x02, 0x80,
+	0x03, 0x53, 0x12, 0xfd, 0xe5, 0x27, 0x30, 0xe7, 0x05, 0x43, 0x12,
+	0x08, 0x80, 0x03, 0x53, 0x12, 0xf7, 0x43, 0x12, 0x01, 0x43, 0x12,
+	0x04, 0x90, 0x30, 0x3a, 0xe5, 0x12, 0xf0, 0x22, 0xc2, 0x01, 0x12,
+	0x00, 0x06, 0x90, 0x30, 0x3a, 0xe0, 0xf5, 0x12, 0x43, 0x12, 0x01,
+	0x43, 0x12, 0x04, 0xe5, 0x26, 0x30, 0xe5, 0x5c, 0x90, 0x34, 0x98,
+	0xe0, 0x44, 0x01, 0xf0, 0xe5, 0x26, 0x54, 0xc0, 0x60, 0x1c, 0xe5,
+	0x27, 0x30, 0xe6, 0x05, 0x53, 0x12, 0xfd, 0x80, 0x03, 0x43, 0x12,
+	0x02, 0xe5, 0x27, 0x30, 0xe7, 0x05, 0x53, 0x12, 0xf7, 0x80, 0x30,
+	0x43, 0x12, 0x08, 0x80, 0x2b, 0xe5, 0x27, 0x30, 0xe6, 0x05, 0x43,
+	0x12, 0x02, 0x80, 0x03, 0x53, 0x12, 0xfd, 0xe5, 0x27, 0x30, 0xe7,
+	0x05, 0x43, 0x12, 0x08, 0x80, 0x03, 0x53, 0x12, 0xf7, 0xe5, 0x27,
+	0xf4, 0x54, 0x1f, 0xff, 0x90, 0x30, 0x34, 0xe0, 0x54, 0xe0, 0x4f,
+	0xf0, 0xe4, 0xf5, 0x2c, 0x90, 0x30, 0x3a, 0xe5, 0x12, 0xf0, 0x80,
+	0x15, 0x90, 0x34, 0x98, 0xe0, 0x54, 0xfe, 0xf0, 0xe5, 0x27, 0xf4,
+	0x54, 0x1f, 0xff, 0x90, 0x30, 0x34, 0xe0, 0x54, 0xe0, 0x4f, 0xf0,
+	0x90, 0x30, 0x35, 0xe0, 0xf5, 0x12, 0x53, 0x12, 0xe0, 0xe5, 0x12,
+	0xf0, 0x22, 0xc2, 0x01, 0x12, 0x00, 0x06, 0x90, 0x30, 0x3a, 0xe0,
+	0xf5, 0x12, 0xe5, 0x26, 0x30, 0xe5, 0x3c, 0x90, 0x34, 0x98, 0xe0,
+	0x44, 0x01, 0xf0, 0xe5, 0x27, 0x30, 0xe6, 0x05, 0x53, 0x12, 0xfd,
+	0x80, 0x03, 0x43, 0x12, 0x02, 0xe5, 0x27, 0x30, 0xe7, 0x05, 0x53,
+	0x12, 0xf7, 0x80, 0x03, 0x43, 0x12, 0x08, 0xe5, 0x26, 0x54, 0xc0,
+	0x60, 0x08, 0x43, 0x12, 0x01, 0x43, 0x12, 0x04, 0x80, 0x06, 0x53,
+	0x12, 0xfe, 0x43, 0x12, 0x04, 0x90, 0x30, 0x3a, 0xe5, 0x12, 0xf0,
+	0x22, 0x90, 0x34, 0x98, 0xe0, 0x54, 0xfe, 0xf0, 0x22, 0xc2, 0x01,
+	0x12, 0x00, 0x06, 0x90, 0x30, 0x3a, 0xe0, 0xf5, 0x12, 0xe5, 0x27,
+	0x30, 0xe6, 0x05, 0x43, 0x12, 0x02, 0x80, 0x03, 0x53, 0x12, 0xfd,
+	0xe5, 0x27, 0x30, 0xe7, 0x05, 0x43, 0x12, 0x08, 0x80, 0x03, 0x53,
+	0x12, 0xf7, 0xe5, 0x26, 0x54, 0xc0, 0x60, 0x08, 0x53, 0x12, 0xfe,
+	0x53, 0x12, 0xfb, 0x80, 0x06, 0x43, 0x12, 0x01, 0x43, 0x12, 0x04,
+	0x90, 0x34, 0x98, 0xe0, 0x44, 0x01, 0xf0, 0x90, 0x30, 0x3a, 0xe5,
+	0x12, 0xf0, 0x22, 0x20, 0x02, 0x13, 0x12, 0x1c, 0x1e, 0xaf, 0x29,
+	0x7e, 0x00, 0x12, 0x1c, 0x74, 0xaf, 0x35, 0x7e, 0x00, 0x12, 0x1c,
+	0x7b, 0xd2, 0x02, 0x90, 0x30, 0x3a, 0xe0, 0xf5, 0x12, 0xe5, 0x26,
+	0x20, 0xe5, 0x0d, 0xc2, 0x01, 0x12, 0x00, 0x06, 0x90, 0x34, 0x98,
+	0xe0, 0x54, 0xfe, 0xf0, 0x22, 0x90, 0x34, 0x98, 0xe0, 0x44, 0x01,
+	0xf0, 0xe5, 0x26, 0x54, 0xc0, 0x60, 0x2c, 0xc2, 0x01, 0x12, 0x00,
+	0x06, 0xe5, 0x27, 0x30, 0xe6, 0x05, 0x53, 0x12, 0xfd, 0x80, 0x03,
+	0x43, 0x12, 0x02, 0xe5, 0x27, 0x30, 0xe7, 0x05, 0x53, 0x12, 0xf7,
+	0x80, 0x03, 0x43, 0x12, 0x08, 0x43, 0x12, 0x01, 0x43, 0x12, 0x04,
+	0x90, 0x30, 0x3a, 0xe5, 0x12, 0xf0, 0x22, 0x30, 0x01, 0x03, 0x02,
+	0x0b, 0xd0, 0x12, 0x15, 0xc0, 0xd2, 0x01, 0x22, 0xc2, 0x01, 0x12,
+	0x00, 0x06, 0xe5, 0x26, 0x20, 0xe5, 0x09, 0x90, 0x34, 0x98, 0xe0,
+	0x54, 0xfe, 0xf0, 0x80, 0x55, 0x90, 0x34, 0x98, 0xe0, 0x44, 0x01,
+	0xf0, 0xe5, 0x26, 0x30, 0xe6, 0x0f, 0xe5, 0x27, 0x30, 0xe6, 0x05,
+	0x53, 0x12, 0xfd, 0x80, 0x12, 0x43, 0x12, 0x02, 0x80, 0x0d, 0xe5,
+	0x27, 0x30, 0xe6, 0x05, 0x43, 0x12, 0x02, 0x80, 0x03, 0x53, 0x12,
+	0xfd, 0xe5, 0x26, 0x30, 0xe7, 0x0f, 0xe5, 0x27, 0x30, 0xe7, 0x05,
+	0x53, 0x12, 0xf7, 0x80, 0x12, 0x43, 0x12, 0x08, 0x80, 0x0d, 0xe5,
+	0x27, 0x30, 0xe7, 0x05, 0x43, 0x12, 0x08, 0x80, 0x03, 0x53, 0x12,
+	0xf7, 0x43, 0x12, 0x01, 0x53, 0x12, 0xfb, 0x90, 0x30, 0x3a, 0xe5,
+	0x12, 0xf0, 0x90, 0x30, 0x3a, 0xe0, 0xf5, 0x12, 0x22, 0xe5, 0x26,
+	0x30, 0xe5, 0x2c, 0x20, 0x03, 0x21, 0xd2, 0x03, 0x12, 0x1c, 0x1e,
+	0x75, 0x35, 0x06, 0x75, 0x29, 0x09, 0xaf, 0x29, 0x7e, 0x00, 0x12,
+	0x1c, 0x74, 0x90, 0x30, 0x3a, 0xe0, 0xf5, 0x12, 0x53, 0x12, 0xfe,
+	0x43, 0x12, 0x04, 0xe5, 0x12, 0xf0, 0x90, 0x34, 0x98, 0xe0, 0x44,
+	0x01, 0xf0, 0x22, 0x90, 0x34, 0x98, 0xe0, 0x54, 0xfe, 0xf0, 0x22,
+	0xe5, 0x31, 0x64, 0x01, 0x70, 0x41, 0x12, 0x1a, 0xd4, 0x40, 0x03,
+	0x02, 0x0d, 0x4f, 0x12, 0x1b, 0x65, 0x50, 0x20, 0x7e, 0x2b, 0x7f,
+	0x80, 0x7d, 0x03, 0x12, 0x04, 0x0e, 0x7f, 0x01, 0x12, 0x19, 0x78,
+	0x40, 0x09, 0xd2, 0x09, 0x12, 0x0f, 0xee, 0xe4, 0xf5, 0x2f, 0x22,
+	0x12, 0x0d, 0x50, 0x75, 0x2f, 0x01, 0x22, 0x7f, 0x01, 0x12, 0x19,
+	0x78, 0x50, 0x04, 0x75, 0x2f, 0x02, 0x22, 0xd2, 0x09, 0x12, 0x0f,
+	0xee, 0xe4, 0xf5, 0x2f, 0x22, 0x12, 0x1a, 0x1d, 0x50, 0x51, 0x12,
+	0x1b, 0xcb, 0x90, 0x30, 0xf4, 0xe0, 0xf5, 0x2a, 0x7e, 0x30, 0x7f,
+	0xec, 0xa3, 0xe0, 0xfd, 0xe4, 0xfb, 0x12, 0x19, 0x2b, 0xe4, 0xff,
+	0xfe, 0x12, 0x1c, 0x36, 0x90, 0x00, 0x0a, 0x74, 0x02, 0xf0, 0x90,
+	0x00, 0x0b, 0xe0, 0x44, 0x02, 0xff, 0xf0, 0xfd, 0x90, 0x01, 0x05,
+	0x74, 0x20, 0xf0, 0x90, 0x01, 0x06, 0xe0, 0x44, 0x20, 0xf0, 0xed,
+	0x54, 0xbf, 0x90, 0x00, 0x0b, 0xf0, 0x90, 0x34, 0xcc, 0xe0, 0x44,
+	0x01, 0xf0, 0xa3, 0xe0, 0x44, 0x01, 0xf0, 0xa3, 0xe0, 0x44, 0x01,
+	0xf0, 0xd2, 0x04, 0x12, 0x1a, 0x3a, 0x50, 0x43, 0x12, 0x1a, 0x57,
+	0x7e, 0x30, 0x7f, 0xe0, 0x7c, 0x30, 0x7d, 0xec, 0x75, 0x1b, 0x11,
+	0x7b, 0x06, 0x12, 0x14, 0xab, 0x90, 0x30, 0xf5, 0xe0, 0x75, 0xf0,
+	0x20, 0xa4, 0xff, 0xae, 0xf0, 0x12, 0x1c, 0x36, 0x90, 0x00, 0x0b,
+	0xe0, 0x54, 0xfd, 0xff, 0xf0, 0xfd, 0xe4, 0x90, 0x00, 0x04, 0xf0,
+	0x90, 0x01, 0x06, 0xe0, 0x54, 0xdf, 0xf0, 0x90, 0x00, 0x0a, 0x74,
+	0x40, 0xf0, 0x4d, 0x90, 0x00, 0x0b, 0xf0, 0xc2, 0x04, 0x12, 0x1a,
+	0xfe, 0x50, 0x38, 0x12, 0x1a, 0x57, 0x7e, 0x30, 0x7f, 0xe0, 0x7c,
+	0x1c, 0x7d, 0x82, 0x75, 0x1b, 0x12, 0x7b, 0x06, 0x12, 0x14, 0xab,
+	0x90, 0x00, 0x04, 0x74, 0x02, 0xf0, 0x90, 0x00, 0x0a, 0xf0, 0xe4,
+	0xff, 0xfe, 0x12, 0x1c, 0x36, 0x90, 0x00, 0x0b, 0xe0, 0x54, 0xfd,
+	0xf0, 0xe4, 0x90, 0x00, 0x04, 0xf0, 0x90, 0x01, 0x06, 0xe0, 0x54,
+	0xdf, 0xf0, 0xc2, 0x04, 0x12, 0x1b, 0x28, 0x50, 0x25, 0x12, 0x1a,
+	0x57, 0x7f, 0x02, 0x12, 0x19, 0x78, 0x90, 0x01, 0x04, 0xe0, 0x54,
+	0x7f, 0xf0, 0x90, 0x00, 0x0b, 0xe0, 0x54, 0xfd, 0xff, 0xf0, 0xe4,
+	0x90, 0x00, 0x04, 0xf0, 0xef, 0x54, 0xbf, 0x90, 0x00, 0x0b, 0xf0,
+	0xc2, 0x04, 0x12, 0x1a, 0xd4, 0x50, 0x2d, 0x12, 0x1a, 0x57, 0x7e,
+	0x30, 0x7f, 0xe0, 0x7c, 0x1c, 0x7d, 0x82, 0x75, 0x1b, 0x12, 0x7b,
+	0x06, 0x12, 0x14, 0xab, 0x90, 0x00, 0x04, 0x74, 0x02, 0xf0, 0x90,
+	0x00, 0x0a, 0xf0, 0x90, 0x01, 0x06, 0xe0, 0x54, 0xdf, 0xf0, 0x90,
+	0x00, 0x0b, 0xe0, 0x54, 0xbf, 0xf0, 0xc2, 0x04, 0x22, 0x90, 0x34,
+	0xcd, 0xe0, 0xf9, 0x20, 0xe3, 0xf8, 0xe5, 0x2b, 0xf4, 0x60, 0x66,
+	0x90, 0x34, 0xc0, 0x12, 0x08, 0x01, 0x85, 0x34, 0x82, 0x85, 0x33,
+	0x83, 0x75, 0xf0, 0x20, 0xe5, 0x2b, 0x12, 0x08, 0x19, 0xe5, 0x82,
+	0x24, 0x04, 0xf5, 0x82, 0xe4, 0x35, 0x83, 0xf5, 0x83, 0x12, 0x08,
+	0x0d, 0x90, 0x34, 0xc8, 0x12, 0x08, 0x01, 0x85, 0x34, 0x82, 0x85,
+	0x33, 0x83, 0x75, 0xf0, 0x20, 0xe5, 0x2b, 0x12, 0x08, 0x19, 0xe5,
+	0x82, 0x24, 0x08, 0xf5, 0x82, 0xe4, 0x35, 0x83, 0xf5, 0x83, 0x12,
+	0x08, 0x0d, 0x90, 0x34, 0xd0, 0x12, 0x08, 0x01, 0x85, 0x34, 0x82,
+	0x85, 0x33, 0x83, 0x75, 0xf0, 0x20, 0xe5, 0x2b, 0x12, 0x08, 0x19,
+	0xe5, 0x82, 0x24, 0x0c, 0xf5, 0x82, 0xe4, 0x35, 0x83, 0xf5, 0x83,
+	0x12, 0x08, 0x0d, 0xe5, 0x34, 0x24, 0xf0, 0xff, 0xe5, 0x33, 0x34,
+	0xde, 0xfe, 0xef, 0x78, 0x05, 0xce, 0xc3, 0x13, 0xce, 0x13, 0xd8,
+	0xf9, 0xf5, 0x2b, 0x85, 0x34, 0x82, 0x85, 0x33, 0x83, 0x75, 0xf0,
+	0x20, 0x12, 0x08, 0x19, 0xe5, 0x82, 0x24, 0x04, 0xf5, 0x82, 0xe4,
+	0x35, 0x83, 0xf5, 0x83, 0x12, 0x08, 0x01, 0x90, 0x34, 0xc0, 0x12,
+	0x08, 0x0d, 0x85, 0x34, 0x82, 0x85, 0x33, 0x83, 0x75, 0xf0, 0x20,
+	0xe5, 0x2b, 0x12, 0x08, 0x19, 0xe5, 0x82, 0x24, 0x08, 0xf5, 0x82,
+	0xe4, 0x35, 0x83, 0xf5, 0x83, 0x12, 0x08, 0x01, 0x90, 0x34, 0xc8,
+	0x12, 0x08, 0x0d, 0x85, 0x34, 0x82, 0x85, 0x33, 0x83, 0x75, 0xf0,
+	0x20, 0xe5, 0x2b, 0x12, 0x08, 0x19, 0xe5, 0x82, 0x24, 0x0c, 0xf5,
+	0x82, 0xe4, 0x35, 0x83, 0xf5, 0x83, 0x12, 0x08, 0x01, 0x90, 0x34,
+	0xc4, 0x12, 0x08, 0x0d, 0x90, 0x01, 0x01, 0xe0, 0x44, 0x40, 0xf0,
+	0x90, 0x01, 0x00, 0xe0, 0x44, 0x08, 0xf0, 0xe9, 0x44, 0x04, 0x90,
+	0x34, 0xcd, 0xf0, 0x90, 0x34, 0xcc, 0xe0, 0x44, 0x01, 0xf0, 0xa3,
+	0xe0, 0x44, 0x01, 0xf0, 0xa3, 0xe0, 0x44, 0x01, 0xf0, 0x22, 0x8f,
+	0x15, 0x8c, 0x16, 0x8d, 0x17, 0xe5, 0x15, 0xc3, 0x94, 0x04, 0x50,
+	0x56, 0xe5, 0x15, 0x94, 0x00, 0x40, 0x06, 0x7a, 0x00, 0x7b, 0x60,
+	0x80, 0x04, 0x7a, 0x00, 0x7b, 0xc0, 0xe5, 0x17, 0xc4, 0xf8, 0x54,
+	0x0f, 0xc8, 0x68, 0xff, 0xe5, 0x16, 0xc4, 0x54, 0xf0, 0x48, 0xfe,
+	0xe5, 0x15, 0x90, 0x1a, 0x8e, 0x93, 0xfd, 0x7c, 0x00, 0x12, 0x07,
+	0x96, 0xef, 0x2b, 0xfb, 0xee, 0x3a, 0xfa, 0xe5, 0x17, 0xc4, 0xf8,
+	0x54, 0x0f, 0xc8, 0x68, 0xff, 0xe5, 0x16, 0xc4, 0x54, 0xf0, 0x48,
+	0xfe, 0xe5, 0x15, 0x93, 0xfd, 0x7c, 0x00, 0x12, 0x07, 0x96, 0xed,
+	0x4c, 0x60, 0x63, 0x0b, 0xbb, 0x00, 0x01, 0x0a, 0x80, 0x5c, 0x7a,
+	0x00, 0x7b, 0x1a, 0xe5, 0x17, 0xae, 0x16, 0x78, 0x02, 0xc3, 0x33,
+	0xce, 0x33, 0xce, 0xd8, 0xf9, 0x24, 0x0b, 0xff, 0xe4, 0x3e, 0xfe,
+	0xe5, 0x15, 0x90, 0x1a, 0x8e, 0x93, 0xfd, 0x7c, 0x00, 0x12, 0x07,
+	0x96, 0xef, 0x78, 0x02, 0xc3, 0x33, 0xce, 0x33, 0xce, 0xd8, 0xf9,
+	0x2b, 0xfb, 0xee, 0x3a, 0xfa, 0xe5, 0x17, 0xae, 0x16, 0x78, 0x02,
+	0xc3, 0x33, 0xce, 0x33, 0xce, 0xd8, 0xf9, 0x24, 0x0b, 0xff, 0xe4,
+	0x3e, 0xfe, 0xe5, 0x15, 0x90, 0x1a, 0x8e, 0x93, 0xfd, 0x7c, 0x00,
+	0x12, 0x07, 0x96, 0xed, 0x4c, 0x60, 0x07, 0x74, 0x04, 0x2b, 0xfb,
+	0xe4, 0x3a, 0xfa, 0xcf, 0xeb, 0xcf, 0xce, 0xea, 0xce, 0x22, 0xe5,
+	0x2e, 0x14, 0x60, 0x1d, 0x14, 0x60, 0x3d, 0x14, 0x60, 0x5d, 0x14,
+	0x70, 0x03, 0x02, 0x0f, 0xd7, 0x24, 0x04, 0x60, 0x03, 0x02, 0x0f,
+	0xed, 0x20, 0x0d, 0x03, 0x02, 0x0f, 0xed, 0x75, 0x2e, 0x01, 0x22,
+	0x90, 0x00, 0x0a, 0xe0, 0xff, 0x30, 0xe5, 0x03, 0x44, 0x20, 0xf0,
+	0xe5, 0x40, 0x45, 0x3f, 0x60, 0x03, 0x02, 0x0f, 0xed, 0x75, 0x2e,
+	0x02, 0x12, 0x19, 0x9b, 0x12, 0x1b, 0x78, 0xaf, 0x28, 0x12, 0x1a,
+	0xa8, 0x22, 0x90, 0x01, 0x03, 0xe0, 0xff, 0x30, 0xe7, 0x76, 0xef,
+	0x44, 0x80, 0x90, 0x01, 0x03, 0xf0, 0x12, 0x08, 0x51, 0x12, 0x19,
+	0xde, 0x12, 0x1b, 0xbb, 0x75, 0x2e, 0x03, 0xaf, 0x22, 0x7e, 0x00,
+	0x12, 0x1c, 0x2a, 0x22, 0xe5, 0x40, 0x45, 0x3f, 0x70, 0x21, 0x12,
+	0x14, 0x41, 0x12, 0x1b, 0x78, 0x12, 0x19, 0xbe, 0x12, 0x1b, 0xbb,
+	0x12, 0x1c, 0x04, 0x30, 0x0d, 0x0b, 0x75, 0x2e, 0x01, 0xaf, 0x32,
+	0x7e, 0x00, 0x12, 0x1c, 0x2a, 0x22, 0xe4, 0xf5, 0x2e, 0x22, 0x90,
+	0x00, 0x0a, 0xe0, 0xff, 0x30, 0xe5, 0x2c, 0x44, 0x20, 0xf0, 0x12,
+	0x14, 0x41, 0x12, 0x1b, 0x78, 0x12, 0x19, 0xbe, 0x12, 0x1b, 0xbb,
+	0x12, 0x1c, 0x04, 0x75, 0x2e, 0x04, 0x22, 0xe5, 0x40, 0x45, 0x3f,
+	0x70, 0x10, 0x30, 0x0d, 0x0a, 0x75, 0x2e, 0x01, 0xaf, 0x32, 0xfe,
+	0x12, 0x1c, 0x2a, 0x22, 0xe4, 0xf5, 0x2e, 0x22, 0x90, 0x00, 0x04,
+	0x74, 0x02, 0xf0, 0x90, 0x00, 0x0a, 0xf0, 0x30, 0x09, 0x32, 0xe5,
+	0x34, 0x45, 0x33, 0x70, 0x02, 0xc3, 0x22, 0x85, 0x34, 0x82, 0x85,
+	0x33, 0x83, 0xc0, 0x83, 0xc0, 0x82, 0xe0, 0xfe, 0xa3, 0xe0, 0xff,
+	0x85, 0x34, 0x82, 0x85, 0x33, 0x83, 0xa3, 0xa3, 0xe0, 0xfc, 0xa3,
+	0xe0, 0xfd, 0xc3, 0xef, 0x9d, 0xff, 0xee, 0x9c, 0xd0, 0x82, 0xd0,
+	0x83, 0xf0, 0xa3, 0xef, 0xf0, 0xe5, 0x34, 0x45, 0x33, 0x70, 0x02,
+	0xc3, 0x22, 0x12, 0x05, 0xed, 0x50, 0xf3, 0x90, 0x00, 0x0a, 0xe0,
+	0x20, 0xe5, 0x03, 0x30, 0x07, 0x41, 0xe5, 0x34, 0x45, 0x33, 0x70,
+	0x02, 0xc3, 0x22, 0x85, 0x34, 0x82, 0x85, 0x33, 0x83, 0xc0, 0x83,
+	0xc0, 0x82, 0xe0, 0xfe, 0xa3, 0xe0, 0xff, 0x85, 0x34, 0x82, 0x85,
+	0x33, 0x83, 0xa3, 0xa3, 0xe0, 0xfc, 0xa3, 0xe0, 0xfd, 0xc3, 0xef,
+	0x9d, 0xff, 0xee, 0x9c, 0xd0, 0x82, 0xd0, 0x83, 0xf0, 0xa3, 0xef,
+	0xf0, 0xe5, 0x34, 0x45, 0x33, 0x70, 0x02, 0xc3, 0x22, 0x12, 0x05,
+	0xed, 0x50, 0xf3, 0x80, 0xb5, 0x85, 0x34, 0x82, 0x85, 0x33, 0x83,
+	0xe0, 0xfe, 0xa3, 0xe0, 0xff, 0x12, 0x16, 0xea, 0xd3, 0x22, 0x12,
+	0x1a, 0xfe, 0x40, 0x05, 0x12, 0x1a, 0xd4, 0x50, 0x44, 0x7e, 0x30,
+	0x7f, 0xe0, 0x7c, 0x1c, 0x7d, 0x82, 0x75, 0x1b, 0x12, 0x7b, 0x06,
+	0x12, 0x14, 0xab, 0x90, 0x00, 0x04, 0x74, 0x02, 0xf0, 0x90, 0x00,
+	0x0a, 0xf0, 0xe4, 0xff, 0xfe, 0x12, 0x1c, 0x36, 0x90, 0x00, 0x0b,
+	0xe0, 0x54, 0xbf, 0xf0, 0x54, 0x7f, 0xff, 0xf0, 0xe4, 0x90, 0x30,
+	0xe9, 0xf0, 0xef, 0x54, 0xfd, 0x90, 0x00, 0x0b, 0xf0, 0xe4, 0x90,
+	0x00, 0x04, 0xf0, 0xd2, 0x09, 0x12, 0x0f, 0xee, 0xe4, 0xf5, 0x2f,
+	0x12, 0x1b, 0x13, 0x50, 0x48, 0x7e, 0x30, 0x7f, 0xe0, 0x7c, 0x1c,
+	0x7d, 0x82, 0x75, 0x1b, 0x12, 0x7b, 0x06, 0x12, 0x14, 0xab, 0x90,
+	0x00, 0x04, 0x74, 0x02, 0xf0, 0x90, 0x00, 0x0a, 0xf0, 0xe4, 0xff,
+	0xfe, 0x12, 0x1c, 0x36, 0x90, 0x00, 0x0b, 0xe0, 0x54, 0xbf, 0xf0,
+	0x54, 0xfd, 0xf0, 0xe4, 0x90, 0x00, 0x04, 0xf0, 0xff, 0x12, 0x19,
+	0x78, 0x50, 0x04, 0x75, 0x2f, 0x07, 0x22, 0x90, 0x01, 0x04, 0xe0,
+	0x54, 0x7f, 0xf0, 0xd2, 0x09, 0x12, 0x0f, 0xee, 0xe4, 0xf5, 0x2f,
+	0x22, 0xc2, 0xaf, 0xe4, 0xf5, 0x2f, 0xf5, 0x88, 0x75, 0xa8, 0x0f,
+	0x75, 0x89, 0x11, 0xf5, 0xb8, 0xf5, 0xe8, 0x75, 0x90, 0x0f, 0x75,
+	0x31, 0xff, 0x75, 0x2b, 0xff, 0x90, 0x22, 0x2e, 0xf0, 0xa3, 0xf0,
+	0x90, 0x22, 0x4e, 0xf0, 0xa3, 0xf0, 0xc2, 0x05, 0xc2, 0x08, 0xc2,
+	0x00, 0xc2, 0x07, 0xc2, 0x04, 0x90, 0x00, 0x0a, 0x74, 0xff, 0xf0,
+	0x90, 0x00, 0x0b, 0x74, 0x01, 0xf0, 0x90, 0x01, 0x03, 0x74, 0xff,
+	0xf0, 0xe4, 0x90, 0x01, 0x04, 0xf0, 0x90, 0x01, 0x05, 0x74, 0xff,
+	0xf0, 0xe4, 0x90, 0x01, 0x06, 0xf0, 0x90, 0x00, 0x04, 0xf0, 0x90,
+	0x30, 0xe8, 0x74, 0x10, 0xf0, 0x90, 0x01, 0x07, 0xf0, 0x90, 0x01,
+	0x08, 0x04, 0xf0, 0x90, 0x01, 0x09, 0x74, 0x48, 0xf0, 0x90, 0x01,
+	0x0a, 0x74, 0x7f, 0xf0, 0x90, 0x01, 0x02, 0x74, 0x1f, 0xf0, 0x90,
+	0x01, 0x00, 0x74, 0x14, 0xf0, 0x90, 0x01, 0x01, 0x74, 0x20, 0xf0,
+	0x90, 0x00, 0x00, 0xe0, 0x44, 0x80, 0xf0, 0x75, 0x49, 0x00, 0x75,
+	0x4a, 0x01, 0xc2, 0x01, 0xd2, 0xaf, 0x22, 0x12, 0x1a, 0xd4, 0x50,
+	0x2d, 0x12, 0x18, 0x48, 0x90, 0x01, 0x06, 0xe0, 0x54, 0xdf, 0xf0,
+	0x7e, 0x30, 0x7f, 0xe0, 0x7c, 0x1c, 0x7d, 0x82, 0x75, 0x1b, 0x12,
+	0x7b, 0x06, 0x12, 0x14, 0xab, 0x90, 0x00, 0x04, 0x74, 0x02, 0xf0,
+	0x90, 0x00, 0x0a, 0xf0, 0xd2, 0x09, 0x12, 0x0f, 0xee, 0xe4, 0xf5,
+	0x2f, 0x22, 0x12, 0x1b, 0x28, 0x50, 0x50, 0x12, 0x18, 0x48, 0x90,
+	0x00, 0x0b, 0xe0, 0x54, 0xfd, 0xf0, 0xe4, 0x90, 0x00, 0x04, 0xf0,
+	0x90, 0x01, 0x03, 0x74, 0x80, 0xf0, 0x90, 0x01, 0x04, 0xe0, 0x44,
+	0x80, 0xf0, 0x7f, 0x02, 0x12, 0x19, 0x78, 0x50, 0x04, 0x75, 0x2f,
+	0x05, 0x22, 0x7e, 0x30, 0x7f, 0xe0, 0x7c, 0x1c, 0x7d, 0x82, 0x75,
+	0x1b, 0x12, 0x7b, 0x06, 0x12, 0x14, 0xab, 0x90, 0x00, 0x04, 0x74,
+	0x02, 0xf0, 0x90, 0x00, 0x0a, 0xf0, 0xd2, 0x09, 0x12, 0x0f, 0xee,
+	0x90, 0x01, 0x04, 0xe0, 0x54, 0x7f, 0xf0, 0xe4, 0xf5, 0x2f, 0x22,
+	0x90, 0x30, 0x30, 0x74, 0x02, 0xf0, 0x75, 0x11, 0x07, 0x75, 0x12,
+	0xd0, 0x90, 0x30, 0x30, 0xe0, 0x30, 0xe0, 0x0e, 0xe5, 0x12, 0x15,
+	0x12, 0x70, 0x02, 0x15, 0x11, 0xe5, 0x12, 0x45, 0x11, 0x70, 0xeb,
+	0xe5, 0x12, 0x45, 0x11, 0x70, 0x12, 0x12, 0x1a, 0x74, 0x90, 0x21,
+	0x00, 0xe0, 0x60, 0x07, 0x90, 0x34, 0x98, 0xe0, 0x44, 0x04, 0xf0,
+	0xc3, 0x22, 0xe4, 0x90, 0x34, 0x58, 0xf0, 0x90, 0x34, 0x32, 0x74,
+	0x1f, 0xf0, 0x75, 0x11, 0x07, 0x75, 0x12, 0xd0, 0x90, 0x34, 0x81,
+	0xe0, 0x64, 0x03, 0x60, 0x0e, 0xe5, 0x12, 0x15, 0x12, 0x70, 0x02,
+	0x15, 0x11, 0xe5, 0x12, 0x45, 0x11, 0x70, 0xea, 0xe5, 0x12, 0x45,
+	0x11, 0x70, 0x12, 0x12, 0x1a, 0x74, 0x90, 0x21, 0x00, 0xe0, 0x60,
+	0x07, 0x90, 0x34, 0x98, 0xe0, 0x44, 0x04, 0xf0, 0xc3, 0x22, 0x90,
+	0x34, 0x98, 0xe0, 0x44, 0x04, 0xf0, 0xe4, 0x90, 0x00, 0x01, 0xf0,
+	0xd3, 0x22, 0x90, 0x30, 0x3a, 0xe0, 0xf5, 0x10, 0x12, 0x1c, 0x57,
+	0x50, 0x26, 0xe5, 0x27, 0x30, 0xe6, 0x05, 0x53, 0x10, 0xfd, 0x80,
+	0x03, 0x43, 0x10, 0x02, 0xe5, 0x27, 0x30, 0xe7, 0x05, 0x53, 0x10,
+	0xf7, 0x80, 0x03, 0x43, 0x10, 0x08, 0x53, 0x10, 0xfe, 0x43, 0x10,
+	0x04, 0x90, 0x30, 0x3a, 0xe5, 0x10, 0xf0, 0x12, 0x1c, 0x4c, 0x50,
+	0x48, 0x90, 0x01, 0x03, 0xe0, 0xf5, 0x10, 0x54, 0x1c, 0x60, 0x3e,
+	0xe5, 0x10, 0x54, 0xe3, 0xf0, 0xa3, 0xe0, 0xf5, 0x10, 0xf0, 0xe5,
+	0x27, 0x30, 0xe6, 0x05, 0x43, 0x10, 0x02, 0x80, 0x03, 0x53, 0x10,
+	0xfd, 0xe5, 0x27, 0x30, 0xe7, 0x05, 0x43, 0x10, 0x08, 0x80, 0x03,
+	0x53, 0x10, 0xf7, 0x53, 0x10, 0xfe, 0x43, 0x10, 0x04, 0x90, 0x30,
+	0x3a, 0xe5, 0x10, 0xf0, 0xaf, 0x29, 0x7e, 0x00, 0x12, 0x1c, 0x74,
+	0xaf, 0x35, 0x7e, 0x00, 0x12, 0x1c, 0x7b, 0x22, 0x12, 0x1a, 0xbf,
+	0x50, 0x72, 0x12, 0x1c, 0x41, 0x85, 0x34, 0x82, 0x85, 0x33, 0x83,
+	0xe0, 0xfc, 0xa3, 0xe0, 0xc3, 0x9f, 0xf5, 0x12, 0xec, 0x9e, 0xf5,
+	0x11, 0xd3, 0xe5, 0x12, 0x94, 0x00, 0xe5, 0x11, 0x64, 0x80, 0x94,
+	0x80, 0x40, 0x06, 0xae, 0x11, 0xaf, 0x12, 0x80, 0x04, 0x7e, 0x00,
+	0x7f, 0x00, 0x8e, 0x11, 0x8f, 0x12, 0xe5, 0x34, 0x24, 0x10, 0xf5,
+	0x82, 0xe4, 0x35, 0x33, 0xf5, 0x83, 0xe0, 0xc3, 0x95, 0x12, 0xf5,
+	0x12, 0xe4, 0x95, 0x11, 0xf5, 0x11, 0xc3, 0x64, 0x80, 0x94, 0x80,
+	0x50, 0x05, 0xe4, 0xf5, 0x11, 0xf5, 0x12, 0xe5, 0x34, 0x24, 0x12,
+	0xff, 0xe4, 0x35, 0x33, 0xfe, 0xad, 0x12, 0x7b, 0x01, 0x12, 0x19,
+	0x2b, 0x90, 0x01, 0x05, 0x74, 0x20, 0xf0, 0x90, 0x01, 0x06, 0xe0,
+	0x44, 0x20, 0xf0, 0x75, 0x2f, 0x03, 0x22, 0xc0, 0xe0, 0xc0, 0xf0,
+	0xc0, 0x83, 0xc0, 0x82, 0xc0, 0xd0, 0x75, 0xd0, 0x08, 0xc2, 0xaf,
+	0x90, 0x22, 0x2e, 0xe0, 0xfe, 0xa3, 0xe0, 0x8e, 0x33, 0xf5, 0x34,
+	0xe5, 0x2f, 0x25, 0xe0, 0x24, 0x9b, 0xf5, 0x82, 0xe4, 0x34, 0x1b,
+	0xf5, 0x83, 0xe4, 0x93, 0xfe, 0x74, 0x01, 0x93, 0xca, 0xee, 0xca,
+	0xf9, 0x12, 0x08, 0x4b, 0x12, 0x1b, 0xf6, 0x50, 0x02, 0xd2, 0x07,
+	0x12, 0x17, 0x2c, 0x12, 0x00, 0x1e, 0x12, 0x1a, 0xe9, 0x50, 0x05,
+	0xaf, 0x25, 0x12, 0x1c, 0x62, 0x30, 0x05, 0x1b, 0xe5, 0x2f, 0x70,
+	0x17, 0x20, 0x04, 0x14, 0x12, 0x12, 0x4e, 0x92, 0x00, 0xc2, 0x05,
+	0xd2, 0x0b, 0xa2, 0x00, 0xe4, 0x33, 0xf5, 0x14, 0xaf, 0x23, 0x12,
+	0x16, 0xa2, 0xd2, 0xaf, 0xd0, 0xd0, 0xd0, 0x82, 0xd0, 0x83, 0xd0,
+	0xf0, 0xd0, 0xe0, 0x32, 0x90, 0x29, 0xa0, 0xe0, 0x70, 0x63, 0x90,
+	0x30, 0x8c, 0xe4, 0xf0, 0xa3, 0x74, 0xc2, 0xf0, 0xa3, 0x74, 0x01,
+	0xf0, 0xa3, 0xe4, 0xf0, 0x90, 0x30, 0x8c, 0xe0, 0xff, 0x90, 0x29,
+	0xa0, 0xf0, 0x90, 0x30, 0x8c, 0xe4, 0xf0, 0xa3, 0x74, 0xc5, 0xf0,
+	0xa3, 0x74, 0x01, 0xf0, 0xa3, 0xe4, 0xf0, 0x90, 0x30, 0x8c, 0xe0,
+	0xff, 0x90, 0x29, 0xa1, 0xf0, 0x90, 0x30, 0x8c, 0xe4, 0xf0, 0xa3,
+	0x74, 0xc4, 0xf0, 0xa3, 0x74, 0x01, 0xf0, 0xa3, 0xe4, 0xf0, 0x90,
+	0x30, 0x8c, 0xe0, 0xff, 0x90, 0x29, 0xa2, 0xf0, 0x90, 0x30, 0x8c,
+	0xe4, 0xf0, 0xa3, 0x74, 0xc3, 0xf0, 0xa3, 0x74, 0x01, 0xf0, 0xa3,
+	0xe4, 0xf0, 0x90, 0x30, 0x8c, 0xe0, 0x90, 0x29, 0xa3, 0xf0, 0x22,
+	0x8e, 0x16, 0x8f, 0x17, 0x8c, 0x18, 0x8d, 0x19, 0xe4, 0xff, 0xef,
+	0xc3, 0x9b, 0x50, 0x53, 0xe5, 0x1b, 0x30, 0xe0, 0x12, 0xef, 0x7c,
+	0x00, 0x25, 0x19, 0xfd, 0xec, 0x35, 0x18, 0x8d, 0x82, 0xf5, 0x83,
+	0xe0, 0xf5, 0x1c, 0x80, 0x1f, 0xe5, 0x1b, 0x30, 0xe1, 0x13, 0xef,
+	0x7c, 0x00, 0x25, 0x19, 0xfd, 0xec, 0x35, 0x18, 0x8d, 0x82, 0xf5,
+	0x83, 0xe4, 0x93, 0xf5, 0x1c, 0x80, 0x07, 0xe5, 0x19, 0x2f, 0xf8,
+	0xe6, 0xf5, 0x1c, 0xe5, 0x1b, 0x30, 0xe4, 0x0f, 0xe5, 0x17, 0x2f,
+	0xf5, 0x82, 0xe4, 0x35, 0x16, 0xf5, 0x83, 0xe5, 0x1c, 0xf0, 0x80,
+	0x06, 0xe5, 0x17, 0x2f, 0xf8, 0xa6, 0x1c, 0x0f, 0x80, 0xa8, 0x22,
+	0x8c, 0x13, 0x8d, 0x14, 0xef, 0x24, 0x1e, 0xf5, 0x82, 0xe4, 0x3e,
+	0xf5, 0x83, 0xe0, 0xfc, 0xa3, 0xe0, 0x4c, 0x60, 0x41, 0xef, 0x24,
+	0x1e, 0xf5, 0x82, 0xe4, 0x3e, 0xf5, 0x83, 0xe0, 0xfc, 0xa3, 0xe0,
+	0xf5, 0x82, 0x8c, 0x83, 0xe0, 0xfc, 0xa3, 0xe0, 0xfd, 0x85, 0x14,
+	0x82, 0x85, 0x13, 0x83, 0xe0, 0xfa, 0xa3, 0xe0, 0xfb, 0xd3, 0xed,
+	0x9b, 0xea, 0x64, 0x80, 0xf8, 0xec, 0x64, 0x80, 0x98, 0x40, 0x13,
+	0xef, 0x24, 0x1e, 0xf5, 0x82, 0xe4, 0x3e, 0xf5, 0x83, 0xe0, 0xfc,
+	0xa3, 0xe0, 0xce, 0xec, 0xce, 0xff, 0x80, 0xaf, 0xad, 0x14, 0xac,
+	0x13, 0x12, 0x18, 0xaf, 0x22, 0x12, 0x1a, 0xbf, 0x50, 0x4f, 0xe5,
+	0x34, 0x24, 0x12, 0xff, 0xe4, 0x35, 0x33, 0xfe, 0xe5, 0x34, 0x24,
+	0x10, 0xf5, 0x82, 0xe4, 0x35, 0x33, 0xf5, 0x83, 0xe0, 0xfd, 0xe4,
+	0xfb, 0x12, 0x19, 0x2b, 0xe5, 0x34, 0x24, 0x10, 0xf5, 0x82, 0xe4,
+	0x35, 0x33, 0xf5, 0x83, 0xe0, 0xff, 0x7e, 0x00, 0x12, 0x1c, 0x36,
+	0x90, 0x00, 0x0a, 0x74, 0x40, 0xf0, 0x90, 0x00, 0x0b, 0xe0, 0x44,
+	0x40, 0xff, 0xf0, 0x90, 0x00, 0x0a, 0x74, 0x80, 0xf0, 0x4f, 0x90,
+	0x00, 0x0b, 0xf0, 0x90, 0x30, 0xe9, 0x74, 0x01, 0xf0, 0x75, 0x2f,
+	0x06, 0x22, 0x90, 0x30, 0x3a, 0xe0, 0xff, 0xe5, 0x27, 0x30, 0xe6,
+	0x12, 0x30, 0x0c, 0x06, 0xef, 0x54, 0xf5, 0xfe, 0x80, 0x04, 0xef,
+	0x44, 0x0a, 0xfe, 0xcf, 0xee, 0xcf, 0x80, 0x10, 0x30, 0x0c, 0x06,
+	0xef, 0x44, 0x0a, 0xfe, 0x80, 0x04, 0xef, 0x54, 0xf5, 0xfe, 0xcf,
+	0xee, 0xcf, 0xcf, 0x54, 0xfe, 0xcf, 0xcf, 0x44, 0x04, 0xcf, 0x90,
+	0x30, 0x3a, 0xef, 0xf0, 0x30, 0x0c, 0x09, 0x7f, 0x08, 0x7e, 0x00,
+	0x12, 0x1c, 0x74, 0x80, 0x07, 0x7f, 0x22, 0x7e, 0x01, 0x12, 0x1c,
+	0x74, 0xb2, 0x0c, 0x22, 0xc0, 0xe0, 0xc0, 0xf0, 0xc0, 0x83, 0xc0,
+	0x82, 0xc0, 0xd0, 0x75, 0xd0, 0x08, 0xc2, 0xaf, 0xc2, 0x8c, 0xc2,
+	0x8d, 0xd3, 0xe5, 0x4a, 0x94, 0x00, 0xe5, 0x49, 0x94, 0x00, 0x40,
+	0x08, 0xe5, 0x4a, 0x15, 0x4a, 0x70, 0x02, 0x15, 0x49, 0xd3, 0xe5,
+	0x4c, 0x94, 0x00, 0xe5, 0x4b, 0x94, 0x00, 0x40, 0x08, 0xe5, 0x4c,
+	0x15, 0x4c, 0x70, 0x02, 0x15, 0x4b, 0x12, 0x00, 0x0e, 0xd2, 0x8c,
+	0xd2, 0xaf, 0xd0, 0xd0, 0xd0, 0x82, 0xd0, 0x83, 0xd0, 0xf0, 0xd0,
+	0xe0, 0x32, 0xc3, 0xef, 0x94, 0x04, 0xee, 0x64, 0x80, 0x94, 0x80,
+	0x40, 0x0c, 0xd3, 0xed, 0x94, 0x04, 0xec, 0x64, 0x80, 0x94, 0x80,
+	0x50, 0x01, 0x22, 0xc3, 0xef, 0x94, 0xfc, 0xee, 0x64, 0x80, 0x94,
+	0x7f, 0x40, 0x0c, 0xd3, 0xed, 0x94, 0xfc, 0xec, 0x64, 0x80, 0x94,
+	0x7f, 0x50, 0x01, 0x22, 0xd3, 0xef, 0x94, 0x04, 0xee, 0x64, 0x80,
+	0x94, 0x80, 0x50, 0x0d, 0xc3, 0xed, 0x94, 0xfc, 0xec, 0x64, 0x80,
+	0x94, 0x7f, 0x40, 0x02, 0xd3, 0x22, 0xc3, 0x22, 0xe4, 0xfe, 0xef,
+	0xf4, 0x60, 0x41, 0x74, 0x04, 0x2e, 0xf5, 0x82, 0xe4, 0x34, 0x21,
+	0xf5, 0x83, 0xe0, 0xb4, 0xff, 0x23, 0x74, 0x04, 0x2e, 0xf5, 0x82,
+	0xe4, 0x34, 0x21, 0xf5, 0x83, 0xef, 0xf0, 0x30, 0x0b, 0x0d, 0x74,
+	0x08, 0x2e, 0xf5, 0x82, 0xe4, 0x34, 0x21, 0xf5, 0x83, 0xe5, 0x14,
+	0xf0, 0x90, 0x00, 0x02, 0x74, 0x01, 0xf0, 0x22, 0xbe, 0x03, 0x0a,
+	0x90, 0x00, 0x02, 0x74, 0x01, 0xf0, 0xe4, 0xfe, 0x80, 0xc2, 0x0e,
+	0x80, 0xbf, 0x22, 0x8e, 0x13, 0x8f, 0x14, 0x12, 0x1c, 0x41, 0xc3,
+	0xef, 0x95, 0x14, 0xff, 0xee, 0x95, 0x13, 0xcd, 0xef, 0xcd, 0xfc,
+	0xd3, 0xed, 0x94, 0x00, 0xec, 0x64, 0x80, 0x94, 0x80, 0x40, 0x05,
+	0xce, 0xec, 0xce, 0x80, 0x04, 0x7e, 0x00, 0x7f, 0x01, 0xcc, 0xee,
+	0xcc, 0xec, 0x90, 0x00, 0x05, 0xf0, 0x90, 0x00, 0x06, 0xef, 0xf0,
+	0x90, 0x00, 0x04, 0x74, 0x51, 0xf0, 0x90, 0x00, 0x0b, 0xe0, 0x44,
+	0x02, 0xf0, 0x22, 0x30, 0x07, 0x3c, 0xe5, 0x2f, 0x70, 0x38, 0xc2,
+	0x07, 0x90, 0x22, 0x2e, 0xe0, 0xfe, 0xa3, 0xe0, 0x8e, 0x11, 0xf5,
+	0x12, 0x90, 0x22, 0x4e, 0xe0, 0xfe, 0xa3, 0xe0, 0xff, 0x90, 0x22,
+	0x2e, 0xee, 0xf0, 0xa3, 0xef, 0xf0, 0x90, 0x22, 0x4e, 0xe5, 0x11,
+	0xf0, 0xa3, 0xe5, 0x12, 0xf0, 0x8e, 0x33, 0x8f, 0x34, 0x30, 0x08,
+	0x05, 0x12, 0x17, 0xa5, 0xc2, 0x08, 0xc2, 0x09, 0x12, 0x0f, 0xee,
+	0x22, 0x7f, 0x80, 0x7e, 0x29, 0xe4, 0xfd, 0xfc, 0x8f, 0x82, 0x8e,
+	0x83, 0xe0, 0xfb, 0x74, 0x45, 0x2d, 0xf8, 0xc6, 0xeb, 0xc6, 0x74,
+	0x04, 0x2f, 0xf5, 0x82, 0xe4, 0x3e, 0xf5, 0x83, 0xe0, 0xfb, 0x74,
+	0x41, 0x2d, 0xf8, 0xc6, 0xeb, 0xc6, 0x74, 0x08, 0x2f, 0xff, 0xe4,
+	0x3e, 0xfe, 0x0d, 0xbd, 0x00, 0x01, 0x0c, 0xed, 0x64, 0x04, 0x4c,
+	0x70, 0xcf, 0x22, 0x90, 0x21, 0x00, 0xe0, 0xc4, 0x33, 0x54, 0xe0,
+	0x24, 0x10, 0xf5, 0x82, 0xe4, 0x34, 0x21, 0xab, 0x82, 0xfa, 0x12,
+	0x1b, 0xab, 0x8b, 0x82, 0x8a, 0x83, 0xee, 0x8f, 0xf0, 0x12, 0x07,
+	0xeb, 0x7e, 0x22, 0x7f, 0x30, 0xcd, 0xeb, 0xcd, 0xcc, 0xea, 0xcc,
+	0x12, 0x15, 0x0e, 0xe4, 0x90, 0x21, 0x03, 0xf0, 0xaf, 0x2d, 0x12,
+	0x1c, 0x62, 0x22, 0x90, 0x00, 0x00, 0x74, 0x0e, 0xf0, 0x00, 0x00,
+	0x00, 0xe4, 0xf0, 0x12, 0x11, 0x31, 0x12, 0x1c, 0x88, 0x90, 0x34,
+	0x98, 0xe0, 0x44, 0x01, 0xf0, 0xe5, 0x30, 0xb4, 0x05, 0x0a, 0x12,
+	0x1c, 0x4c, 0x50, 0x0d, 0x12, 0x15, 0xc0, 0x80, 0x08, 0xe5, 0x30,
+	0xb4, 0x07, 0x03, 0x12, 0x12, 0xd4, 0x12, 0x0f, 0x2a, 0x80, 0xe4,
+	0x80, 0xfe, 0x22, 0xe4, 0xff, 0xe5, 0x30, 0x24, 0xfe, 0x70, 0x2c,
+	0xe4, 0xfe, 0xee, 0xc3, 0x95, 0x2c, 0x50, 0x12, 0x74, 0x01, 0xc8,
+	0xee, 0xc8, 0x08, 0x80, 0x02, 0xc3, 0x33, 0xd8, 0xfc, 0xcf, 0x4f,
+	0xcf, 0x0e, 0x80, 0xe8, 0x90, 0x30, 0x34, 0xe0, 0x54, 0xe0, 0xfe,
+	0xe5, 0x27, 0x54, 0x1f, 0x6f, 0xf4, 0xce, 0x4e, 0xce, 0xee, 0xf0,
+	0x22, 0x90, 0x34, 0xce, 0xe0, 0x44, 0x02, 0xf0, 0x90, 0x34, 0xcd,
+	0xe0, 0x54, 0xfe, 0xf0, 0x90, 0x34, 0xcd, 0xe0, 0x20, 0xe3, 0xf9,
+	0x90, 0x01, 0x11, 0xe0, 0x54, 0x22, 0xff, 0xbf, 0x22, 0x03, 0xd3,
+	0x80, 0x01, 0xc3, 0x50, 0xf0, 0x90, 0x01, 0x00, 0xe0, 0x54, 0xf7,
+	0xf0, 0x90, 0x01, 0x01, 0xe0, 0x54, 0xbf, 0xf0, 0x22, 0xef, 0x24,
+	0x1e, 0xf5, 0x82, 0xe4, 0x3e, 0xf5, 0x83, 0xe0, 0xfc, 0xa3, 0xe0,
+	0xfb, 0xca, 0xec, 0xca, 0x24, 0x1e, 0xf5, 0x82, 0xe4, 0x3c, 0xf5,
+	0x83, 0xe0, 0xfc, 0xa3, 0xe0, 0xfd, 0xef, 0x24, 0x1e, 0xf5, 0x82,
+	0xe4, 0x3e, 0xf5, 0x83, 0xec, 0xf0, 0xa3, 0xed, 0xf0, 0xce, 0xea,
+	0xce, 0xcf, 0xeb, 0xcf, 0x22, 0xef, 0x24, 0x1e, 0xf5, 0x82, 0xe4,
+	0x3e, 0xf5, 0x83, 0xe0, 0xfa, 0xa3, 0xe0, 0xfb, 0xed, 0x24, 0x1e,
+	0xf5, 0x82, 0xe4, 0x3c, 0xf5, 0x83, 0xea, 0xf0, 0xa3, 0xeb, 0xf0,
+	0xef, 0x24, 0x1e, 0xf5, 0x82, 0xe4, 0x3e, 0xf5, 0x83, 0xec, 0xf0,
+	0xa3, 0xed, 0xf0, 0x22, 0xc0, 0xe0, 0xc0, 0xd0, 0xc2, 0xaf, 0xc2,
+	0x8e, 0xc2, 0x8f, 0xd3, 0xe5, 0x40, 0x94, 0x00, 0xe5, 0x3f, 0x94,
+	0x00, 0x40, 0x0d, 0xe5, 0x40, 0x15, 0x40, 0x70, 0x02, 0x15, 0x3f,
+	0x12, 0x1c, 0x6b, 0xd2, 0x8e, 0xd2, 0xaf, 0xd0, 0xd0, 0xd0, 0xe0,
+	0x32, 0x12, 0x1a, 0xbf, 0x50, 0x22, 0x7e, 0x30, 0x7f, 0xe0, 0x7c,
+	0x1c, 0x7d, 0x82, 0x75, 0x1b, 0x12, 0x7b, 0x06, 0x12, 0x14, 0xab,
+	0x90, 0x00, 0x04, 0x74, 0x02, 0xf0, 0x90, 0x00, 0x0a, 0xf0, 0xd2,
+	0x09, 0x12, 0x0f, 0xee, 0xe4, 0xf5, 0x2f, 0x22, 0x8e, 0x13, 0x8f,
+	0x14, 0x8d, 0x15, 0xeb, 0x60, 0x09, 0x14, 0x70, 0x1b, 0xaf, 0x15,
+	0x12, 0x19, 0xfe, 0x22, 0x7e, 0x30, 0x7f, 0xe0, 0xac, 0x13, 0xad,
+	0x14, 0x75, 0x1b, 0x11, 0x7b, 0x06, 0x12, 0x14, 0xab, 0xaf, 0x15,
+	0x12, 0x19, 0xfe, 0x22, 0x12, 0x17, 0x6c, 0x90, 0x21, 0x01, 0xe0,
+	0xf5, 0x28, 0x74, 0x41, 0x25, 0x28, 0xf8, 0xe6, 0xf5, 0x32, 0x74,
+	0x45, 0x25, 0x28, 0xf8, 0xe6, 0xf5, 0x22, 0x90, 0x21, 0x00, 0xe0,
+	0x60, 0x03, 0xd2, 0x0d, 0x22, 0xc2, 0x0d, 0x22, 0xcd, 0xef, 0xcd,
+	0x90, 0x01, 0x02, 0xe0, 0x30, 0xe7, 0x02, 0xc3, 0x22, 0x7e, 0x2a,
+	0x7f, 0x00, 0x12, 0x04, 0x0e, 0x90, 0x01, 0x04, 0xe0, 0x44, 0x80,
+	0xf0, 0x90, 0x01, 0x02, 0xe0, 0x44, 0x80, 0xf0, 0xd3, 0x22, 0x90,
+	0x34, 0x30, 0xe4, 0xf0, 0xa3, 0xf0, 0xa3, 0x74, 0x1f, 0xf0, 0xa3,
+	0xe4, 0xf0, 0x90, 0x01, 0x10, 0xe0, 0x20, 0xe1, 0x03, 0x00, 0x80,
+	0xf6, 0x90, 0x01, 0x12, 0xe0, 0x20, 0xe1, 0x03, 0x00, 0x80, 0xf6,
+	0x22, 0xe4, 0xff, 0x74, 0x36, 0x2f, 0xf8, 0xe6, 0x90, 0x30, 0x8c,
+	0xf0, 0xef, 0x90, 0x1b, 0x51, 0x93, 0x90, 0x30, 0x8d, 0xf0, 0xa3,
+	0x74, 0x01, 0xf0, 0xa3, 0xe4, 0xf0, 0x0f, 0xbf, 0x09, 0xe3, 0x22,
+	0xe4, 0xff, 0xef, 0x90, 0x1b, 0x5b, 0x93, 0x90, 0x30, 0x8c, 0xf0,
+	0xef, 0x90, 0x1b, 0x51, 0x93, 0x90, 0x30, 0x8d, 0xf0, 0xa3, 0x74,
+	0x01, 0xf0, 0xa3, 0xe4, 0xf0, 0x0f, 0xbf, 0x09, 0xe3, 0x22, 0xe4,
+	0x90, 0x00, 0x05, 0xf0, 0xef, 0x60, 0x02, 0x80, 0x02, 0x7f, 0x01,
+	0x90, 0x00, 0x06, 0xef, 0xf0, 0x90, 0x00, 0x04, 0x74, 0x51, 0xf0,
+	0x90, 0x00, 0x0b, 0xe0, 0x44, 0x02, 0xf0, 0x22, 0x90, 0x30, 0xf0,
+	0xe0, 0xf5, 0x2a, 0x90, 0x00, 0x0a, 0xe0, 0x30, 0xe4, 0x0e, 0x90,
+	0x30, 0xf2, 0xe0, 0x60, 0x08, 0x90, 0x00, 0x0a, 0x74, 0x10, 0xf0,
+	0xd3, 0x22, 0xc3, 0x22, 0x90, 0x30, 0xf0, 0xe0, 0xf5, 0x2a, 0x90,
+	0x00, 0x0a, 0xe0, 0x30, 0xe4, 0x0e, 0x90, 0x30, 0xf2, 0xe0, 0x70,
+	0x08, 0x90, 0x00, 0x0a, 0x74, 0x10, 0xf0, 0xd3, 0x22, 0xc3, 0x22,
+	0x90, 0x34, 0xce, 0xe0, 0x44, 0x02, 0xf0, 0x90, 0x34, 0xcd, 0xe0,
+	0x54, 0xfe, 0xf0, 0x90, 0x01, 0x00, 0xe0, 0x54, 0xf7, 0xf0, 0x90,
+	0x01, 0x01, 0xe0, 0x54, 0xbf, 0xf0, 0x22, 0x90, 0x00, 0x01, 0x74,
+	0x0e, 0xf0, 0x90, 0x34, 0x98, 0xe0, 0x54, 0xfb, 0xf0, 0x90, 0x34,
+	0x58, 0x74, 0x01, 0xf0, 0x90, 0x30, 0x30, 0x74, 0x04, 0xf0, 0x22,
+	0x02, 0x04, 0x0b, 0x16, 0x0c, 0x12, 0x18, 0x24, 0x30, 0x48, 0x60,
+	0x6c, 0x90, 0xc8, 0x00, 0x01, 0x02, 0x03, 0x0b, 0x0f, 0x0a, 0x0e,
+	0x09, 0x0d, 0x08, 0x0c, 0xef, 0xc4, 0x33, 0x33, 0x54, 0xc0, 0xff,
+	0x90, 0x01, 0x00, 0xe0, 0x54, 0x3f, 0x4f, 0xf0, 0x90, 0x01, 0x02,
+	0xe0, 0x44, 0x80, 0xf0, 0x22, 0x90, 0x01, 0x03, 0xe0, 0x30, 0xe7,
+	0x0c, 0x74, 0x80, 0xf0, 0x90, 0x01, 0x04, 0xe0, 0x54, 0x7f, 0xf0,
+	0xd3, 0x22, 0xc3, 0x22, 0x90, 0x00, 0x0a, 0xe0, 0x30, 0xe1, 0x0c,
+	0x74, 0x02, 0xf0, 0x90, 0x00, 0x0b, 0xe0, 0x54, 0xfd, 0xf0, 0xd3,
+	0x22, 0xc3, 0x22, 0x90, 0x00, 0x0a, 0xe0, 0x30, 0xe2, 0x0c, 0x74,
+	0x04, 0xf0, 0x90, 0x00, 0x0b, 0xe0, 0x54, 0xfb, 0xf0, 0xd3, 0x22,
+	0xc3, 0x22, 0x90, 0x00, 0x0a, 0xe0, 0x30, 0xe6, 0x0c, 0x74, 0x40,
+	0xf0, 0x90, 0x00, 0x0b, 0xe0, 0x54, 0xbf, 0xf0, 0xd3, 0x22, 0xc3,
+	0x22, 0x90, 0x00, 0x0a, 0xe0, 0x30, 0xe7, 0x0c, 0x74, 0x80, 0xf0,
+	0x90, 0x00, 0x0b, 0xe0, 0x54, 0x7f, 0xf0, 0xd3, 0x22, 0xc3, 0x22,
+	0x90, 0x01, 0x05, 0xe0, 0x30, 0xe5, 0x0c, 0x74, 0x20, 0xf0, 0x90,
+	0x01, 0x06, 0xe0, 0x54, 0xdf, 0xf0, 0xd3, 0x22, 0xc3, 0x22, 0xe4,
+	0xf5, 0x31, 0x90, 0x00, 0x0a, 0x74, 0xff, 0xf0, 0x90, 0x22, 0x2e,
+	0x74, 0x21, 0xf0, 0xa3, 0x74, 0x10, 0xf0, 0x22, 0x52, 0x53, 0x54,
+	0x12, 0x15, 0x16, 0x10, 0x11, 0x40, 0x00, 0x20, 0x00, 0x40, 0xff,
+	0x3f, 0x3f, 0xbd, 0x28, 0x21, 0x00, 0xe5, 0x34, 0x24, 0x11, 0xf5,
+	0x82, 0xe4, 0x35, 0x33, 0xf5, 0x83, 0xe0, 0x30, 0xe6, 0x02, 0xd3,
+	0x22, 0xc3, 0x22, 0x90, 0x30, 0x40, 0x74, 0x32, 0xf0, 0xa3, 0x74,
+	0xb0, 0xf0, 0xa3, 0x74, 0x01, 0xf0, 0xa3, 0xe4, 0xf0, 0x22, 0x75,
+	0x31, 0x01, 0x90, 0x00, 0x0a, 0x74, 0xff, 0xf0, 0x90, 0x00, 0x0b,
+	0xe0, 0x44, 0x20, 0xf0, 0x22, 0x0b, 0xd1, 0x13, 0x53, 0x15, 0x6b,
+	0x11, 0xc6, 0x00, 0x09, 0x19, 0x03, 0x10, 0x95, 0x1b, 0xda, 0x90,
+	0x30, 0x64, 0xe0, 0xfd, 0xa3, 0xe0, 0xfe, 0xed, 0x25, 0xe0, 0xff,
+	0xee, 0x33, 0xfe, 0x22, 0x90, 0x30, 0x40, 0x74, 0x32, 0xf0, 0xa3,
+	0x74, 0xb0, 0xf0, 0xa3, 0xe4, 0xf0, 0xa3, 0xf0, 0x22, 0x90, 0x01,
+	0x00, 0xe0, 0x44, 0x08, 0xf0, 0x90, 0x01, 0x01, 0xe0, 0x44, 0x40,
+	0xf0, 0x22, 0x12, 0x1a, 0xbf, 0x50, 0x08, 0xd2, 0x09, 0x12, 0x0f,
+	0xee, 0xe4, 0xf5, 0x2f, 0x22, 0x90, 0x00, 0x0a, 0xe0, 0x30, 0xe0,
+	0x05, 0x74, 0x01, 0xf0, 0xd3, 0x22, 0xc3, 0x22, 0x90, 0x00, 0x0a,
+	0xe0, 0x30, 0xe5, 0x05, 0x74, 0x20, 0xf0, 0xd3, 0x22, 0xc3, 0x22,
+	0x90, 0x34, 0x30, 0x74, 0x1f, 0xf0, 0xa3, 0xe4, 0xf0, 0xa3, 0xf0,
+	0xa3, 0xf0, 0x22, 0x78, 0x7f, 0xe4, 0xf6, 0xd8, 0xfd, 0x75, 0x81,
+	0x4c, 0x02, 0x17, 0xdc, 0xc2, 0xaf, 0xc2, 0x8c, 0xc2, 0x8d, 0x12,
+	0x00, 0x0e, 0xd2, 0xaf, 0x22, 0xc2, 0x8e, 0x8e, 0x3f, 0x8f, 0x40,
+	0x12, 0x1c, 0x6b, 0xd2, 0x8e, 0x22, 0x90, 0x30, 0x3c, 0xef, 0xf0,
+	0xee, 0x44, 0x80, 0xa3, 0xf0, 0x22, 0x90, 0x30, 0x78, 0xe0, 0xfd,
+	0xa3, 0xe0, 0xfe, 0xed, 0xff, 0x22, 0xe5, 0x4a, 0x45, 0x49, 0x70,
+	0x03, 0xd3, 0x80, 0x01, 0xc3, 0x22, 0xe5, 0x4c, 0x45, 0x4b, 0x70,
+	0x03, 0xd3, 0x80, 0x01, 0xc3, 0x22, 0xc2, 0x0b, 0xe4, 0xf5, 0x14,
+	0x12, 0x16, 0xa2, 0x22, 0xc2, 0x8f, 0x75, 0x8d, 0xf5, 0x75, 0x8b,
+	0x41, 0x22, 0x8e, 0x49, 0x8f, 0x4a, 0xd2, 0x8c, 0x22, 0x8e, 0x4b,
+	0x8f, 0x4c, 0xd2, 0x8c, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0xc2, 0x0d, 0xe4, 0xf5, 0x2e, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0xac, 0x30
+};
+
+static const uint8_t rt2561s[] = {
+	0x02, 0x1c, 0x2d, 0x02, 0x07, 0xdf, 0xc2, 0x8c, 0x22, 0x22, 0x00,
+	0x02, 0x19, 0x43, 0xc2, 0xaf, 0xc2, 0x8d, 0x75, 0x8c, 0x94, 0x75,
+	0x8a, 0x93, 0xd2, 0xaf, 0x22, 0x02, 0x1a, 0x9c, 0x12, 0x08, 0xdf,
+	0x40, 0x03, 0x02, 0x02, 0x1e, 0x90, 0x21, 0x02, 0xe0, 0xf5, 0x2d,
+	0x90, 0x00, 0x03, 0xe0, 0x12, 0x04, 0x3f, 0x00, 0xb0, 0x00, 0x00,
+	0xce, 0x01, 0x00, 0x5e, 0x10, 0x00, 0x6f, 0x11, 0x00, 0xf2, 0x20,
+	0x01, 0x4d, 0x21, 0x01, 0x70, 0x22, 0x01, 0x84, 0x30, 0x01, 0x8f,
+	0x31, 0x01, 0xd5, 0x50, 0x01, 0x9f, 0x51, 0x01, 0xf2, 0x52, 0x02,
+	0x06, 0x60, 0x00, 0x00, 0x02, 0x14, 0x90, 0x00, 0x0a, 0xe0, 0x20,
+	0xe5, 0x03, 0x30, 0x07, 0x03, 0xd2, 0x08, 0x22, 0x12, 0x14, 0x2b,
+	0x22, 0x90, 0x21, 0x00, 0xe0, 0xf5, 0x11, 0xe5, 0x11, 0xc4, 0x33,
+	0x54, 0xe0, 0x24, 0x21, 0xf5, 0x82, 0xe4, 0x34, 0x21, 0xf5, 0x83,
+	0xe0, 0x44, 0x80, 0xf0, 0xe5, 0x11, 0xc4, 0x33, 0x54, 0xe0, 0x24,
+	0x2c, 0xf5, 0x82, 0xe4, 0x34, 0x21, 0xf5, 0x83, 0xe5, 0x11, 0xf0,
+	0xc4, 0x33, 0x54, 0xe0, 0x24, 0x2d, 0xf5, 0x82, 0xe4, 0x34, 0x21,
+	0xf5, 0x83, 0xe5, 0x2d, 0xf0, 0xe4, 0x90, 0x21, 0x03, 0xf0, 0x22,
+	0x12, 0x05, 0xcb, 0x90, 0x21, 0x00, 0xe0, 0xf5, 0x31, 0x60, 0x05,
+	0x12, 0x1b, 0xe0, 0x80, 0x03, 0x12, 0x1b, 0xa6, 0xe4, 0x90, 0x21,
+	0x03, 0xf0, 0xaf, 0x2d, 0x12, 0x10, 0xe8, 0x22, 0x75, 0x31, 0xff,
+	0x90, 0x01, 0x00, 0xe0, 0x54, 0xf7, 0xf0, 0x90, 0x01, 0x01, 0xe0,
+	0x54, 0xfe, 0xf0, 0x54, 0x3e, 0xf0, 0xe4, 0x90, 0x00, 0x0b, 0xf0,
+	0xf0, 0x90, 0x21, 0x03, 0xf0, 0xaf, 0x2d, 0x12, 0x10, 0xe8, 0x22,
+	0x7e, 0x2b, 0x7f, 0x80, 0x7d, 0x03, 0x12, 0x0a, 0xfb, 0x90, 0x34,
+	0xcd, 0xe0, 0x20, 0xe3, 0xf9, 0x90, 0x21, 0x14, 0x12, 0x04, 0x1b,
+	0x90, 0x34, 0xc0, 0x12, 0x04, 0x27, 0x90, 0x21, 0x18, 0x12, 0x04,
+	0x1b, 0x90, 0x34, 0xc8, 0x12, 0x04, 0x27, 0x90, 0x21, 0x1c, 0x12,
+	0x04, 0x1b, 0x90, 0x34, 0xc4, 0x12, 0x04, 0x27, 0x90, 0x34, 0xcc,
+	0x74, 0x01, 0xf0, 0xa3, 0xe0, 0x44, 0x04, 0xf0, 0x90, 0x01, 0x01,
+	0xe0, 0x44, 0x01, 0xf0, 0x44, 0x40, 0xf0, 0x90, 0x00, 0x0b, 0xe0,
+	0x44, 0x10, 0xf0, 0xe4, 0x90, 0x21, 0x03, 0xf0, 0xaf, 0x2d, 0x12,
+	0x10, 0xe8, 0x22, 0x90, 0x01, 0x00, 0xe0, 0x54, 0xf7, 0xf0, 0x90,
+	0x01, 0x01, 0xe0, 0x54, 0xfe, 0xf0, 0x54, 0xbf, 0xf0, 0x90, 0x00,
+	0x0b, 0xe0, 0x54, 0xef, 0xf0, 0xe4, 0x90, 0x21, 0x03, 0xf0, 0xaf,
+	0x2d, 0x12, 0x10, 0xe8, 0x22, 0x7e, 0x2b, 0x7f, 0x80, 0x7d, 0x03,
+	0x12, 0x0a, 0xfb, 0xe4, 0x90, 0x21, 0x03, 0xf0, 0xaf, 0x2d, 0x12,
+	0x10, 0xe8, 0x22, 0xd2, 0x05, 0x85, 0x2d, 0x23, 0xe4, 0x90, 0x21,
+	0x03, 0xf0, 0x22, 0x12, 0x13, 0xae, 0xc2, 0x00, 0xe4, 0x90, 0x21,
+	0x03, 0xf0, 0xaf, 0x2d, 0x12, 0x10, 0xe8, 0x22, 0x85, 0x2d, 0x25,
+	0x90, 0x00, 0x0b, 0xe0, 0x54, 0xfb, 0xff, 0xf0, 0xe4, 0x90, 0x00,
+	0x07, 0xf0, 0x90, 0x00, 0x0a, 0x74, 0x04, 0xf0, 0xe4, 0x90, 0x00,
+	0x08, 0xf0, 0x90, 0x21, 0x00, 0xe0, 0x90, 0x00, 0x09, 0xf0, 0x90,
+	0x00, 0x07, 0x74, 0x71, 0xf0, 0xef, 0x44, 0x04, 0x90, 0x00, 0x0b,
+	0xf0, 0xe4, 0x90, 0x21, 0x03, 0xf0, 0x22, 0x90, 0x21, 0x00, 0xe0,
+	0xff, 0x54, 0x1f, 0xf5, 0x30, 0xa3, 0xe0, 0xf5, 0x27, 0x8f, 0x26,
+	0x12, 0x14, 0x62, 0xe4, 0x90, 0x21, 0x03, 0xf0, 0xaf, 0x2d, 0x12,
+	0x10, 0xe8, 0x22, 0x90, 0x21, 0x00, 0xe0, 0xf5, 0x2c, 0x12, 0x17,
+	0xa3, 0xe4, 0x90, 0x21, 0x03, 0xf0, 0xaf, 0x2d, 0x12, 0x10, 0xe8,
+	0x22, 0x12, 0x1a, 0xed, 0xe4, 0x90, 0x21, 0x03, 0xf0, 0xaf, 0x2d,
+	0x12, 0x10, 0xe8, 0x22, 0xe4, 0x90, 0x21, 0x03, 0xf0, 0xaf, 0x2d,
+	0x12, 0x10, 0xe8, 0x22, 0xe5, 0x31, 0x64, 0x01, 0x70, 0x41, 0x12,
+	0x08, 0xed, 0x40, 0x03, 0x02, 0x03, 0x9d, 0x12, 0x0e, 0x34, 0x50,
+	0x20, 0x7e, 0x2b, 0x7f, 0x80, 0x7d, 0x03, 0x12, 0x0a, 0xfb, 0x7f,
+	0x01, 0x12, 0x0a, 0xd8, 0x40, 0x09, 0xd2, 0x09, 0x12, 0x0e, 0x47,
+	0xe4, 0xf5, 0x2f, 0x22, 0x12, 0x09, 0x64, 0x75, 0x2f, 0x01, 0x22,
+	0x7f, 0x01, 0x12, 0x0a, 0xd8, 0x50, 0x04, 0x75, 0x2f, 0x02, 0x22,
+	0xd2, 0x09, 0x12, 0x0e, 0x47, 0xe4, 0xf5, 0x2f, 0x22, 0x12, 0x08,
+	0x90, 0x50, 0x51, 0x12, 0x0a, 0xac, 0x90, 0x30, 0xf4, 0xe0, 0xf5,
+	0x2a, 0x7e, 0x30, 0x7f, 0xec, 0xa3, 0xe0, 0xfd, 0xe4, 0xfb, 0x12,
+	0x0d, 0xa0, 0xe4, 0xff, 0xfe, 0x12, 0x0e, 0x29, 0x90, 0x00, 0x0a,
+	0x74, 0x02, 0xf0, 0x90, 0x00, 0x0b, 0xe0, 0x44, 0x02, 0xff, 0xf0,
+	0xfd, 0x90, 0x01, 0x05, 0x74, 0x20, 0xf0, 0x90, 0x01, 0x06, 0xe0,
+	0x44, 0x20, 0xf0, 0xed, 0x54, 0xbf, 0x90, 0x00, 0x0b, 0xf0, 0x90,
+	0x34, 0xcc, 0xe0, 0x44, 0x01, 0xf0, 0xa3, 0xe0, 0x44, 0x01, 0xf0,
+	0xa3, 0xe0, 0x44, 0x01, 0xf0, 0xd2, 0x04, 0x12, 0x08, 0xad, 0x50,
+	0x43, 0x12, 0x0a, 0xbb, 0x7e, 0x30, 0x7f, 0xe0, 0x7c, 0x30, 0x7d,
+	0xec, 0x75, 0x1b, 0x11, 0x7b, 0x06, 0x12, 0x13, 0xc8, 0x90, 0x30,
+	0xf5, 0xe0, 0x75, 0xf0, 0x20, 0xa4, 0xff, 0xae, 0xf0, 0x12, 0x0e,
+	0x29, 0x90, 0x00, 0x0b, 0xe0, 0x54, 0xfd, 0xff, 0xf0, 0xfd, 0xe4,
+	0x90, 0x00, 0x04, 0xf0, 0x90, 0x01, 0x06, 0xe0, 0x54, 0xdf, 0xf0,
+	0x90, 0x00, 0x0a, 0x74, 0x40, 0xf0, 0x4d, 0x90, 0x00, 0x0b, 0xf0,
+	0xc2, 0x04, 0x12, 0x09, 0x25, 0x50, 0x38, 0x12, 0x0a, 0xbb, 0x7e,
+	0x30, 0x7f, 0xe0, 0x7c, 0x1c, 0x7d, 0x7e, 0x75, 0x1b, 0x12, 0x7b,
+	0x06, 0x12, 0x13, 0xc8, 0x90, 0x00, 0x04, 0x74, 0x02, 0xf0, 0x90,
+	0x00, 0x0a, 0xf0, 0xe4, 0xff, 0xfe, 0x12, 0x0e, 0x29, 0x90, 0x00,
+	0x0b, 0xe0, 0x54, 0xfd, 0xf0, 0xe4, 0x90, 0x00, 0x04, 0xf0, 0x90,
+	0x01, 0x06, 0xe0, 0x54, 0xdf, 0xf0, 0xc2, 0x04, 0x12, 0x09, 0x4f,
+	0x50, 0x25, 0x12, 0x0a, 0xbb, 0x7f, 0x02, 0x12, 0x0a, 0xd8, 0x90,
+	0x01, 0x04, 0xe0, 0x54, 0x7f, 0xf0, 0x90, 0x00, 0x0b, 0xe0, 0x54,
+	0xfd, 0xff, 0xf0, 0xe4, 0x90, 0x00, 0x04, 0xf0, 0xef, 0x54, 0xbf,
+	0x90, 0x00, 0x0b, 0xf0, 0xc2, 0x04, 0x12, 0x08, 0xed, 0x50, 0x2d,
+	0x12, 0x0a, 0xbb, 0x7e, 0x30, 0x7f, 0xe0, 0x7c, 0x1c, 0x7d, 0x7e,
+	0x75, 0x1b, 0x12, 0x7b, 0x06, 0x12, 0x13, 0xc8, 0x90, 0x00, 0x04,
+	0x74, 0x02, 0xf0, 0x90, 0x00, 0x0a, 0xf0, 0x90, 0x01, 0x06, 0xe0,
+	0x54, 0xdf, 0xf0, 0x90, 0x00, 0x0b, 0xe0, 0x54, 0xbf, 0xf0, 0xc2,
+	0x04, 0x22, 0xef, 0x8d, 0xf0, 0xa4, 0xa8, 0xf0, 0xcf, 0x8c, 0xf0,
+	0xa4, 0x28, 0xce, 0x8d, 0xf0, 0xa4, 0x2e, 0xfe, 0x22, 0xbc, 0x00,
+	0x0b, 0xbe, 0x00, 0x29, 0xef, 0x8d, 0xf0, 0x84, 0xff, 0xad, 0xf0,
+	0x22, 0xe4, 0xcc, 0xf8, 0x75, 0xf0, 0x08, 0xef, 0x2f, 0xff, 0xee,
+	0x33, 0xfe, 0xec, 0x33, 0xfc, 0xee, 0x9d, 0xec, 0x98, 0x40, 0x05,
+	0xfc, 0xee, 0x9d, 0xfe, 0x0f, 0xd5, 0xf0, 0xe9, 0xe4, 0xce, 0xfd,
+	0x22, 0xed, 0xf8, 0xf5, 0xf0, 0xee, 0x84, 0x20, 0xd2, 0x1c, 0xfe,
+	0xad, 0xf0, 0x75, 0xf0, 0x08, 0xef, 0x2f, 0xff, 0xed, 0x33, 0xfd,
+	0x40, 0x07, 0x98, 0x50, 0x06, 0xd5, 0xf0, 0xf2, 0x22, 0xc3, 0x98,
+	0xfd, 0x0f, 0xd5, 0xf0, 0xea, 0x22, 0xc5, 0xf0, 0xf8, 0xa3, 0xe0,
+	0x28, 0xf0, 0xc5, 0xf0, 0xf8, 0xe5, 0x82, 0x15, 0x82, 0x70, 0x02,
+	0x15, 0x83, 0xe0, 0x38, 0xf0, 0x22, 0xe0, 0xfc, 0xa3, 0xe0, 0xfd,
+	0xa3, 0xe0, 0xfe, 0xa3, 0xe0, 0xff, 0x22, 0xec, 0xf0, 0xa3, 0xed,
+	0xf0, 0xa3, 0xee, 0xf0, 0xa3, 0xef, 0xf0, 0x22, 0xa4, 0x25, 0x82,
+	0xf5, 0x82, 0xe5, 0xf0, 0x35, 0x83, 0xf5, 0x83, 0x22, 0xd0, 0x83,
+	0xd0, 0x82, 0xf8, 0xe4, 0x93, 0x70, 0x12, 0x74, 0x01, 0x93, 0x70,
+	0x0d, 0xa3, 0xa3, 0x93, 0xf8, 0x74, 0x01, 0x93, 0xf5, 0x82, 0x88,
+	0x83, 0xe4, 0x73, 0x74, 0x02, 0x93, 0x68, 0x60, 0xef, 0xa3, 0xa3,
+	0xa3, 0x80, 0xdf, 0x8a, 0x83, 0x89, 0x82, 0xe4, 0x73, 0xe5, 0x2e,
+	0x14, 0x60, 0x1d, 0x14, 0x60, 0x3d, 0x14, 0x60, 0x5d, 0x14, 0x70,
+	0x03, 0x02, 0x05, 0x18, 0x24, 0x04, 0x60, 0x03, 0x02, 0x05, 0x2e,
+	0x20, 0x0d, 0x03, 0x02, 0x05, 0x2e, 0x75, 0x2e, 0x01, 0x22, 0x90,
+	0x00, 0x0a, 0xe0, 0xff, 0x30, 0xe5, 0x03, 0x44, 0x20, 0xf0, 0xe5,
+	0x40, 0x45, 0x3f, 0x60, 0x03, 0x02, 0x05, 0x2e, 0x75, 0x2e, 0x02,
+	0x12, 0x1b, 0x12, 0x12, 0x1b, 0xce, 0xaf, 0x28, 0x12, 0x1b, 0x8f,
+	0x22, 0x90, 0x01, 0x03, 0xe0, 0xff, 0x30, 0xe7, 0x76, 0xef, 0x44,
+	0x80, 0x90, 0x01, 0x03, 0xf0, 0x12, 0x08, 0x55, 0x12, 0x1b, 0x55,
+	0x12, 0x1c, 0x01, 0x75, 0x2e, 0x03, 0xaf, 0x22, 0x7e, 0x00, 0x12,
+	0x1c, 0x45, 0x22, 0xe5, 0x40, 0x45, 0x3f, 0x70, 0x21, 0x12, 0x17,
+	0xd8, 0x12, 0x1b, 0xce, 0x12, 0x1b, 0x35, 0x12, 0x1c, 0x01, 0x12,
+	0x1c, 0x1f, 0x30, 0x0d, 0x0b, 0x75, 0x2e, 0x01, 0xaf, 0x32, 0x7e,
+	0x00, 0x12, 0x1c, 0x45, 0x22, 0xe4, 0xf5, 0x2e, 0x22, 0x90, 0x00,
+	0x0a, 0xe0, 0xff, 0x30, 0xe5, 0x2c, 0x44, 0x20, 0xf0, 0x12, 0x17,
+	0xd8, 0x12, 0x1b, 0xce, 0x12, 0x1b, 0x35, 0x12, 0x1c, 0x01, 0x12,
+	0x1c, 0x1f, 0x75, 0x2e, 0x04, 0x22, 0xe5, 0x40, 0x45, 0x3f, 0x70,
+	0x10, 0x30, 0x0d, 0x0a, 0x75, 0x2e, 0x01, 0xaf, 0x32, 0xfe, 0x12,
+	0x1c, 0x45, 0x22, 0xe4, 0xf5, 0x2e, 0x22, 0x12, 0x09, 0x25, 0x40,
+	0x05, 0x12, 0x08, 0xed, 0x50, 0x44, 0x7e, 0x30, 0x7f, 0xe0, 0x7c,
+	0x1c, 0x7d, 0x7e, 0x75, 0x1b, 0x12, 0x7b, 0x06, 0x12, 0x13, 0xc8,
+	0x90, 0x00, 0x04, 0x74, 0x02, 0xf0, 0x90, 0x00, 0x0a, 0xf0, 0xe4,
+	0xff, 0xfe, 0x12, 0x0e, 0x29, 0x90, 0x00, 0x0b, 0xe0, 0x54, 0xbf,
+	0xf0, 0x54, 0x7f, 0xff, 0xf0, 0xe4, 0x90, 0x30, 0xe9, 0xf0, 0xef,
+	0x54, 0xfd, 0x90, 0x00, 0x0b, 0xf0, 0xe4, 0x90, 0x00, 0x04, 0xf0,
+	0xd2, 0x09, 0x12, 0x0e, 0x47, 0xe4, 0xf5, 0x2f, 0x12, 0x09, 0x3a,
+	0x50, 0x48, 0x7e, 0x30, 0x7f, 0xe0, 0x7c, 0x1c, 0x7d, 0x7e, 0x75,
+	0x1b, 0x12, 0x7b, 0x06, 0x12, 0x13, 0xc8, 0x90, 0x00, 0x04, 0x74,
+	0x02, 0xf0, 0x90, 0x00, 0x0a, 0xf0, 0xe4, 0xff, 0xfe, 0x12, 0x0e,
+	0x29, 0x90, 0x00, 0x0b, 0xe0, 0x54, 0xbf, 0xf0, 0x54, 0xfd, 0xf0,
+	0xe4, 0x90, 0x00, 0x04, 0xf0, 0xff, 0x12, 0x0a, 0xd8, 0x50, 0x04,
+	0x75, 0x2f, 0x07, 0x22, 0x90, 0x01, 0x04, 0xe0, 0x54, 0x7f, 0xf0,
+	0xd2, 0x09, 0x12, 0x0e, 0x47, 0xe4, 0xf5, 0x2f, 0x22, 0xc2, 0xaf,
+	0xe4, 0xf5, 0x2f, 0xf5, 0x88, 0x75, 0xa8, 0x0f, 0x75, 0x89, 0x11,
+	0xf5, 0xb8, 0xf5, 0xe8, 0x75, 0x90, 0x0f, 0x75, 0x31, 0xff, 0x75,
+	0x2b, 0xff, 0x90, 0x22, 0x2e, 0xf0, 0xa3, 0xf0, 0x90, 0x22, 0x4e,
+	0xf0, 0xa3, 0xf0, 0xc2, 0x05, 0xc2, 0x08, 0xc2, 0x00, 0xc2, 0x07,
+	0xc2, 0x04, 0x90, 0x00, 0x0a, 0x74, 0xff, 0xf0, 0x90, 0x00, 0x0b,
+	0x74, 0x01, 0xf0, 0x90, 0x01, 0x03, 0x74, 0xff, 0xf0, 0xe4, 0x90,
+	0x01, 0x04, 0xf0, 0x90, 0x01, 0x05, 0x74, 0xff, 0xf0, 0xe4, 0x90,
+	0x01, 0x06, 0xf0, 0x90, 0x00, 0x04, 0xf0, 0x90, 0x30, 0xe8, 0x74,
+	0x10, 0xf0, 0x90, 0x01, 0x07, 0xf0, 0x90, 0x01, 0x08, 0x04, 0xf0,
+	0x90, 0x01, 0x09, 0x74, 0x48, 0xf0, 0x90, 0x01, 0x0a, 0x74, 0x7f,
+	0xf0, 0x90, 0x01, 0x02, 0x74, 0x1f, 0xf0, 0x90, 0x01, 0x00, 0x74,
+	0x14, 0xf0, 0x90, 0x01, 0x01, 0x74, 0x20, 0xf0, 0x90, 0x00, 0x00,
+	0xe0, 0x44, 0x80, 0xf0, 0x75, 0x49, 0x00, 0x75, 0x4a, 0x01, 0xc2,
+	0x01, 0xd2, 0xaf, 0x22, 0x12, 0x08, 0xed, 0x50, 0x2d, 0x12, 0x0a,
+	0x78, 0x90, 0x01, 0x06, 0xe0, 0x54, 0xdf, 0xf0, 0x7e, 0x30, 0x7f,
+	0xe0, 0x7c, 0x1c, 0x7d, 0x7e, 0x75, 0x1b, 0x12, 0x7b, 0x06, 0x12,
+	0x13, 0xc8, 0x90, 0x00, 0x04, 0x74, 0x02, 0xf0, 0x90, 0x00, 0x0a,
+	0xf0, 0xd2, 0x09, 0x12, 0x0e, 0x47, 0xe4, 0xf5, 0x2f, 0x22, 0x12,
+	0x09, 0x4f, 0x50, 0x50, 0x12, 0x0a, 0x78, 0x90, 0x00, 0x0b, 0xe0,
+	0x54, 0xfd, 0xf0, 0xe4, 0x90, 0x00, 0x04, 0xf0, 0x90, 0x01, 0x03,
+	0x74, 0x80, 0xf0, 0x90, 0x01, 0x04, 0xe0, 0x44, 0x80, 0xf0, 0x7f,
+	0x02, 0x12, 0x0a, 0xd8, 0x50, 0x04, 0x75, 0x2f, 0x05, 0x22, 0x7e,
+	0x30, 0x7f, 0xe0, 0x7c, 0x1c, 0x7d, 0x7e, 0x75, 0x1b, 0x12, 0x7b,
+	0x06, 0x12, 0x13, 0xc8, 0x90, 0x00, 0x04, 0x74, 0x02, 0xf0, 0x90,
+	0x00, 0x0a, 0xf0, 0xd2, 0x09, 0x12, 0x0e, 0x47, 0x90, 0x01, 0x04,
+	0xe0, 0x54, 0x7f, 0xf0, 0xe4, 0xf5, 0x2f, 0x22, 0x90, 0x30, 0x3a,
+	0xe0, 0xf5, 0x10, 0x12, 0x1c, 0x5c, 0x50, 0x26, 0xe5, 0x27, 0x30,
+	0xe6, 0x05, 0x53, 0x10, 0xfd, 0x80, 0x03, 0x43, 0x10, 0x02, 0xe5,

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

From owner-svn-src-stable-9@FreeBSD.ORG  Fri May 25 16:09:07 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 1D3C71065672;
	Fri, 25 May 2012 16:09:07 +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 0742A8FC18;
	Fri, 25 May 2012 16:09: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 q4PG96He019943;
	Fri, 25 May 2012 16:09:06 GMT
	(envelope-from bschmidt@svn.freebsd.org)
Received: (from bschmidt@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4PG96Sk019941;
	Fri, 25 May 2012 16:09:06 GMT
	(envelope-from bschmidt@svn.freebsd.org)
Message-Id: <201205251609.q4PG96Sk019941@svn.freebsd.org>
From: Bernhard Schmidt <bschmidt@FreeBSD.org>
Date: Fri, 25 May 2012 16:09:06 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r236005 - stable/9/share/man/man4
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 25 May 2012 16:09:07 -0000

Author: bschmidt
Date: Fri May 25 16:09:06 2012
New Revision: 236005
URL: http://svn.freebsd.org/changeset/base/236005

Log:
  MFC r235235-235237:
  Update man page due to import of RT2800/RT3000 support.

Modified:
  stable/9/share/man/man4/ral.4
Directory Properties:
  stable/9/share/man/man4/   (props changed)

Modified: stable/9/share/man/man4/ral.4
==============================================================================
--- stable/9/share/man/man4/ral.4	Fri May 25 16:07:39 2012	(r236004)
+++ stable/9/share/man/man4/ral.4	Fri May 25 16:09:06 2012	(r236005)
@@ -1,5 +1,4 @@
-.\" Copyright (c) 2005, 2006
-.\"     Damien Bergamini <damien.bergamini@free.fr>
+.\" Copyright (c) 2005-2010 Damien Bergamini <damien.bergamini@free.fr>
 .\"
 .\" Permission to use, copy, modify, and distribute this software for any
 .\" purpose with or without fee is hereby granted, provided that the above
@@ -15,12 +14,12 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd July 8, 2009
+.Dd May 10, 2012
 .Dt RAL 4
 .Os
 .Sh NAME
 .Nm ral
-.Nd "Ralink Technology IEEE 802.11 wireless network driver"
+.Nd "Ralink Technology IEEE 802.11a/g/n wireless network device"
 .Sh SYNOPSIS
 To compile this driver into the kernel,
 place the following lines in your
@@ -42,31 +41,43 @@ if_ral_load="YES"
 .Sh DESCRIPTION
 The
 .Nm
-driver supports PCI/CardBus wireless adapters based on the Ralink Technology
-RT2500, RT2501, and RT2600 chipsets.
+driver supports PCI/PCIe/CardBus wireless adapters based on the Ralink RT2500,
+RT2501, RT2600, RT2700, RT2800 and RT3090 chipsets.
 .Pp
 The RT2500 chipset is the first generation of 802.11b/g adapters from Ralink.
-It consists of two integrated chips, a RT2560 MAC/BBP and a RT2525 radio
+It consists of two integrated chips, an RT2560 MAC/BBP and an RT2525 radio
 transceiver.
 .Pp
-The RT2501 chipset is the second generation of 802.11b/g adapters from Ralink.
-It consists of two integrated chips, a RT2561 MAC/BBP and a RT2527 radio
+The RT2501 chipset is the second generation of 802.11a/b/g adapters from
+Ralink.
+It consists of two integrated chips, an RT2561 MAC/BBP and an RT2527 radio
 transceiver.
 This chipset provides support for the IEEE 802.11e standard with multiple
 hardware transmission queues and allows scatter/gather for efficient DMA
 operations.
 .Pp
-The RT2600 chipset consists of two integrated chips, a RT2661 MAC/BBP and a
+The RT2600 chipset consists of two integrated chips, an RT2661 MAC/BBP and an
 RT2529 radio transceiver.
 This chipset uses the MIMO (multiple-input multiple-output) technology with
-multiple antennas to extend the operating range of the adapter and to achieve
-higher throughput.
-MIMO is the basis of the forthcoming IEEE 802.11n standard.
-.Pp
-The transmit speed is user-selectable or can be adapted automatically by the
-driver depending on the received signal strength and on the number of hardware
-transmission retries.
+multiple radio transceivers to extend the operating range of the adapter and
+to achieve higher throughput.
+However, the RT2600 chipset does not support any of the 802.11n features.
+.Pp
+The RT2700 chipset is a low-cost version of the RT2800 chipset.
+It supports a single transmit path and two receiver paths (1T2R).
+It consists of two integrated chips, an RT2760 or RT2790 (PCIe) MAC/BBP and
+an RT2720 (2.4GHz) or RT2750 (2.4GHz/5GHz) radio transceiver.
+.Pp
+The RT2800 chipset is the first generation of 802.11n adapters from Ralink.
+It consists of two integrated chips, an RT2860 or RT2890 (PCIe) MAC/BBP and
+an RT2820 (2.4GHz) or RT2850 (2.4GHz/5GHz) radio transceiver.
+The RT2800 chipset supports two transmit paths and up to three receiver
+paths (2T2R/2T3R).
+It can achieve speeds up to 144Mbps (20MHz bandwidth) and 300Mbps (40MHz
+bandwidth.)
 .Pp
+The RT3090 chipset is the first generation of single-chip 802.11n adapters
+from Ralink.
 .Nm
 supports
 .Cm station ,
@@ -92,13 +103,16 @@ Multiple
 interfaces may be operated together with a
 .Cm hostap
 interface to construct a wireless repeater device.
+.Pp
+The transmit speed is user-selectable or can be adapted automatically by the
+driver depending on the number of hardware transmission retries.
 For more information on configuring this device, see
 .Xr ifconfig 8 .
 .Sh HARDWARE
 The
 .Nm
-driver supports PCI/CardBus wireless adapters based on the Ralink Technology
-RT2500, RT2501, and RT2600 chipsets, including:
+driver supports PCI/PCIe/CardBus wireless adapters based on Ralink Technology
+chipsets, including:
 .Pp
 .Bl -column -compact ".Li Atlantis Land A02-PCM-W54" "RT2561S" "CardBus"
 .It Em Card Ta Em MAC/BBP Ta Em Bus
@@ -188,9 +202,6 @@ RT2500, RT2501, and RT2600 chipsets, inc
 .It "Zonet ZEW1500" Ta RT2560 Ta CardBus
 .It "Zonet ZEW1600" Ta RT2560 Ta PCI
 .El
-.Pp
-An up to date list can be found at
-.Pa http://damien.bergamini.free.fr/ral/list.html .
 .Sh EXAMPLES
 Join an existing BSS network (i.e., connect to an access point):
 .Pp
@@ -238,7 +249,7 @@ This should not happen.
 .Xr wlan_xauth 4 ,
 .Xr hostapd 8 ,
 .Xr ifconfig 8 ,
-.Xr wpa_supplicant 8 .
+.Xr wpa_supplicant 8
 .Rs
 .%T "Ralink Technology"
 .%U http://www.ralinktech.com/
@@ -248,12 +259,37 @@ The
 .Nm
 driver first appeared in
 .Ox 3.7 .
+Support for the RT2501 and RT2600 chipsets was added in
+.Ox 3.9 .
+Support for the RT2800 chipset was added in
+.Ox 4.3 .
+Support for the RT2700 chipset was added in
+.Ox 4.4 .
+Support for the RT3090 chipset was added in
+.Ox 4.9 .
 .Sh AUTHORS
 The original
 .Nm
 driver was written by
-.An Damien Bergamini Aq damien@FreeBSD.org .
-.Sh BUGS
-Host AP mode doesn't support client power save.
-Clients using power save mode will experience
+.An Damien Bergamini Aq damien@openbsd.org .
+.Sh CAVEATS
+The
+.Nm
+driver does not make use of the hardware cryptographic engine.
+.Pp
+The
+.Nm
+driver does not support any of the 802.11n capabilities offered by
+the RT2700 and RT2800 chipsets.
+Additional work is required in before those features can be supported.
+.Pp
+Host AP mode doesn't support power saving.
+Clients attempting to use power saving mode may experience significant
 packet loss (disabling power saving on the client will fix this).
+.Pp
+Some PCI
+.Nm
+adapters seem to strictly require a system supporting PCI 2.2 or greater and
+will likely not work in systems based on older revisions of the PCI
+specification.
+Check the board's PCI version before purchasing the card.

From owner-svn-src-stable-9@FreeBSD.ORG  Fri May 25 17:14:49 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 141181065676;
	Fri, 25 May 2012 17:14:49 +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 EAEBE8FC25;
	Fri, 25 May 2012 17:14: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 q4PHEmvP023129;
	Fri, 25 May 2012 17:14:48 GMT (envelope-from marius@svn.freebsd.org)
Received: (from marius@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4PHEmgO023068;
	Fri, 25 May 2012 17:14:48 GMT (envelope-from marius@svn.freebsd.org)
Message-Id: <201205251714.q4PHEmgO023068@svn.freebsd.org>
From: Marius Strobl <marius@FreeBSD.org>
Date: Fri, 25 May 2012 17:14:48 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r236011 - in stable/9/contrib/compiler-rt: . lib
	lib/arm lib/ppc lib/x86_64
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 25 May 2012 17:14:49 -0000

Author: marius
Date: Fri May 25 17:14:47 2012
New Revision: 236011
URL: http://svn.freebsd.org/changeset/base/236011

Log:
  MFC: r222656
  
  Upgrade libcompiler_rt from revision 117047 to 132478.
  
  It seems there have only been a small amount to the compiler-rt source
  code in the mean time. I'd rather have the code in sync as much as
  possible by the time we release 9.0. Changes:
  
  - The libcompiler_rt library is now dual licensed under both the
    University of Illinois "BSD-Like" license and the MIT license.
  
  - Our local modifications for using .hidden instead of .private_extern
    have been upstreamed, meaning our changes to lib/assembly.h can now be
    reverted.
  
  - A possible endless recursion in __modsi3() has been fixed.
  
  - Support for ARM EABI has been added, but it has no effect on FreeBSD
    (yet).
  
  - The functions __udivmodsi4 and __divmodsi4 have been added.
  
  Requested by:	many, including bf@ and Pedro Giffuni

Added:
  stable/9/contrib/compiler-rt/lib/int_endianness.h
     - copied unchanged from r229135, head/contrib/compiler-rt/lib/int_endianness.h
  stable/9/contrib/compiler-rt/lib/int_math.h
     - copied unchanged from r229135, head/contrib/compiler-rt/lib/int_math.h
  stable/9/contrib/compiler-rt/lib/int_types.h
     - copied unchanged from r229135, head/contrib/compiler-rt/lib/int_types.h
  stable/9/contrib/compiler-rt/lib/int_util.c
     - copied unchanged from r229135, head/contrib/compiler-rt/lib/int_util.c
  stable/9/contrib/compiler-rt/lib/int_util.h
     - copied unchanged from r229135, head/contrib/compiler-rt/lib/int_util.h
  stable/9/contrib/compiler-rt/lib/mulodi4.c
     - copied unchanged from r229135, head/contrib/compiler-rt/lib/mulodi4.c
  stable/9/contrib/compiler-rt/lib/mulosi4.c
     - copied unchanged from r229135, head/contrib/compiler-rt/lib/mulosi4.c
  stable/9/contrib/compiler-rt/lib/muloti4.c
     - copied unchanged from r229135, head/contrib/compiler-rt/lib/muloti4.c
Deleted:
  stable/9/contrib/compiler-rt/lib/abi.h
  stable/9/contrib/compiler-rt/lib/apple_versioning.c
  stable/9/contrib/compiler-rt/lib/endianness.h
Modified:
  stable/9/contrib/compiler-rt/LICENSE.TXT
  stable/9/contrib/compiler-rt/README.txt
  stable/9/contrib/compiler-rt/lib/absvdi2.c
  stable/9/contrib/compiler-rt/lib/absvsi2.c
  stable/9/contrib/compiler-rt/lib/absvti2.c
  stable/9/contrib/compiler-rt/lib/adddf3.c
  stable/9/contrib/compiler-rt/lib/addsf3.c
  stable/9/contrib/compiler-rt/lib/addvdi3.c
  stable/9/contrib/compiler-rt/lib/addvsi3.c
  stable/9/contrib/compiler-rt/lib/addvti3.c
  stable/9/contrib/compiler-rt/lib/arm/adddf3vfp.S
  stable/9/contrib/compiler-rt/lib/arm/addsf3vfp.S
  stable/9/contrib/compiler-rt/lib/arm/divdf3vfp.S
  stable/9/contrib/compiler-rt/lib/arm/divsf3vfp.S
  stable/9/contrib/compiler-rt/lib/arm/eqdf2vfp.S
  stable/9/contrib/compiler-rt/lib/arm/eqsf2vfp.S
  stable/9/contrib/compiler-rt/lib/arm/extendsfdf2vfp.S
  stable/9/contrib/compiler-rt/lib/arm/fixdfsivfp.S
  stable/9/contrib/compiler-rt/lib/arm/fixsfsivfp.S
  stable/9/contrib/compiler-rt/lib/arm/fixunsdfsivfp.S
  stable/9/contrib/compiler-rt/lib/arm/fixunssfsivfp.S
  stable/9/contrib/compiler-rt/lib/arm/floatsidfvfp.S
  stable/9/contrib/compiler-rt/lib/arm/floatsisfvfp.S
  stable/9/contrib/compiler-rt/lib/arm/floatunssidfvfp.S
  stable/9/contrib/compiler-rt/lib/arm/floatunssisfvfp.S
  stable/9/contrib/compiler-rt/lib/arm/gedf2vfp.S
  stable/9/contrib/compiler-rt/lib/arm/gesf2vfp.S
  stable/9/contrib/compiler-rt/lib/arm/gtdf2vfp.S
  stable/9/contrib/compiler-rt/lib/arm/gtsf2vfp.S
  stable/9/contrib/compiler-rt/lib/arm/ledf2vfp.S
  stable/9/contrib/compiler-rt/lib/arm/lesf2vfp.S
  stable/9/contrib/compiler-rt/lib/arm/ltdf2vfp.S
  stable/9/contrib/compiler-rt/lib/arm/ltsf2vfp.S
  stable/9/contrib/compiler-rt/lib/arm/muldf3vfp.S
  stable/9/contrib/compiler-rt/lib/arm/mulsf3vfp.S
  stable/9/contrib/compiler-rt/lib/arm/nedf2vfp.S
  stable/9/contrib/compiler-rt/lib/arm/negdf2vfp.S
  stable/9/contrib/compiler-rt/lib/arm/negsf2vfp.S
  stable/9/contrib/compiler-rt/lib/arm/nesf2vfp.S
  stable/9/contrib/compiler-rt/lib/arm/subdf3vfp.S
  stable/9/contrib/compiler-rt/lib/arm/subsf3vfp.S
  stable/9/contrib/compiler-rt/lib/arm/truncdfsf2vfp.S
  stable/9/contrib/compiler-rt/lib/arm/unorddf2vfp.S
  stable/9/contrib/compiler-rt/lib/arm/unordsf2vfp.S
  stable/9/contrib/compiler-rt/lib/ashldi3.c
  stable/9/contrib/compiler-rt/lib/ashrdi3.c
  stable/9/contrib/compiler-rt/lib/assembly.h
  stable/9/contrib/compiler-rt/lib/clear_cache.c
  stable/9/contrib/compiler-rt/lib/clzdi2.c
  stable/9/contrib/compiler-rt/lib/clzsi2.c
  stable/9/contrib/compiler-rt/lib/cmpdi2.c
  stable/9/contrib/compiler-rt/lib/ctzdi2.c
  stable/9/contrib/compiler-rt/lib/ctzsi2.c
  stable/9/contrib/compiler-rt/lib/divdc3.c
  stable/9/contrib/compiler-rt/lib/divdf3.c
  stable/9/contrib/compiler-rt/lib/divdi3.c
  stable/9/contrib/compiler-rt/lib/divmoddi4.c
  stable/9/contrib/compiler-rt/lib/divmodsi4.c
  stable/9/contrib/compiler-rt/lib/divsc3.c
  stable/9/contrib/compiler-rt/lib/divsf3.c
  stable/9/contrib/compiler-rt/lib/divsi3.c
  stable/9/contrib/compiler-rt/lib/divxc3.c
  stable/9/contrib/compiler-rt/lib/enable_execute_stack.c
  stable/9/contrib/compiler-rt/lib/eprintf.c
  stable/9/contrib/compiler-rt/lib/extendsfdf2.c
  stable/9/contrib/compiler-rt/lib/ffsdi2.c
  stable/9/contrib/compiler-rt/lib/fixdfdi.c
  stable/9/contrib/compiler-rt/lib/fixdfsi.c
  stable/9/contrib/compiler-rt/lib/fixsfdi.c
  stable/9/contrib/compiler-rt/lib/fixsfsi.c
  stable/9/contrib/compiler-rt/lib/fixunsdfdi.c
  stable/9/contrib/compiler-rt/lib/fixunsdfsi.c
  stable/9/contrib/compiler-rt/lib/fixunssfdi.c
  stable/9/contrib/compiler-rt/lib/fixunssfsi.c
  stable/9/contrib/compiler-rt/lib/floatdidf.c
  stable/9/contrib/compiler-rt/lib/floatdisf.c
  stable/9/contrib/compiler-rt/lib/floatsidf.c
  stable/9/contrib/compiler-rt/lib/floatsisf.c
  stable/9/contrib/compiler-rt/lib/floattidf.c
  stable/9/contrib/compiler-rt/lib/floattisf.c
  stable/9/contrib/compiler-rt/lib/floattixf.c
  stable/9/contrib/compiler-rt/lib/floatundidf.c
  stable/9/contrib/compiler-rt/lib/floatundisf.c
  stable/9/contrib/compiler-rt/lib/floatunsidf.c
  stable/9/contrib/compiler-rt/lib/floatunsisf.c
  stable/9/contrib/compiler-rt/lib/floatuntidf.c
  stable/9/contrib/compiler-rt/lib/floatuntisf.c
  stable/9/contrib/compiler-rt/lib/floatuntixf.c
  stable/9/contrib/compiler-rt/lib/fp_lib.h
  stable/9/contrib/compiler-rt/lib/gcc_personality_v0.c
  stable/9/contrib/compiler-rt/lib/int_lib.h
  stable/9/contrib/compiler-rt/lib/lshrdi3.c
  stable/9/contrib/compiler-rt/lib/moddi3.c
  stable/9/contrib/compiler-rt/lib/modsi3.c
  stable/9/contrib/compiler-rt/lib/muldc3.c
  stable/9/contrib/compiler-rt/lib/muldf3.c
  stable/9/contrib/compiler-rt/lib/muldi3.c
  stable/9/contrib/compiler-rt/lib/mulsc3.c
  stable/9/contrib/compiler-rt/lib/mulsf3.c
  stable/9/contrib/compiler-rt/lib/mulvdi3.c
  stable/9/contrib/compiler-rt/lib/mulvsi3.c
  stable/9/contrib/compiler-rt/lib/mulvti3.c
  stable/9/contrib/compiler-rt/lib/mulxc3.c
  stable/9/contrib/compiler-rt/lib/negdf2.c
  stable/9/contrib/compiler-rt/lib/negsf2.c
  stable/9/contrib/compiler-rt/lib/negvdi2.c
  stable/9/contrib/compiler-rt/lib/negvsi2.c
  stable/9/contrib/compiler-rt/lib/negvti2.c
  stable/9/contrib/compiler-rt/lib/paritydi2.c
  stable/9/contrib/compiler-rt/lib/paritysi2.c
  stable/9/contrib/compiler-rt/lib/popcountdi2.c
  stable/9/contrib/compiler-rt/lib/popcountsi2.c
  stable/9/contrib/compiler-rt/lib/powidf2.c
  stable/9/contrib/compiler-rt/lib/powisf2.c
  stable/9/contrib/compiler-rt/lib/ppc/DD.h
  stable/9/contrib/compiler-rt/lib/ppc/divtc3.c
  stable/9/contrib/compiler-rt/lib/ppc/fixtfdi.c
  stable/9/contrib/compiler-rt/lib/ppc/fixunstfdi.c
  stable/9/contrib/compiler-rt/lib/ppc/floatditf.c
  stable/9/contrib/compiler-rt/lib/ppc/floatunditf.c
  stable/9/contrib/compiler-rt/lib/ppc/multc3.c
  stable/9/contrib/compiler-rt/lib/subdf3.c
  stable/9/contrib/compiler-rt/lib/subsf3.c
  stable/9/contrib/compiler-rt/lib/subvdi3.c
  stable/9/contrib/compiler-rt/lib/subvsi3.c
  stable/9/contrib/compiler-rt/lib/subvti3.c
  stable/9/contrib/compiler-rt/lib/trampoline_setup.c
  stable/9/contrib/compiler-rt/lib/truncdfsf2.c
  stable/9/contrib/compiler-rt/lib/ucmpdi2.c
  stable/9/contrib/compiler-rt/lib/udivdi3.c
  stable/9/contrib/compiler-rt/lib/udivmoddi4.c
  stable/9/contrib/compiler-rt/lib/udivmodsi4.c
  stable/9/contrib/compiler-rt/lib/udivmodti4.c
  stable/9/contrib/compiler-rt/lib/udivsi3.c
  stable/9/contrib/compiler-rt/lib/umoddi3.c
  stable/9/contrib/compiler-rt/lib/umodsi3.c
  stable/9/contrib/compiler-rt/lib/x86_64/floatdidf.c
  stable/9/contrib/compiler-rt/lib/x86_64/floatdisf.c
  stable/9/contrib/compiler-rt/lib/x86_64/floatdixf.c
Directory Properties:
  stable/9/contrib/compiler-rt/   (props changed)

Modified: stable/9/contrib/compiler-rt/LICENSE.TXT
==============================================================================
--- stable/9/contrib/compiler-rt/LICENSE.TXT	Fri May 25 16:52:00 2012	(r236010)
+++ stable/9/contrib/compiler-rt/LICENSE.TXT	Fri May 25 17:14:47 2012	(r236011)
@@ -74,3 +74,25 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE F
 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 THE SOFTWARE.
+
+==============================================================================
+Copyrights and Licenses for Third Party Software Distributed with LLVM:
+==============================================================================
+The LLVM software contains code written by third parties.  Such software will
+have its own individual LICENSE.TXT file in the directory in which it appears.
+This file will describe the copyrights, license, and restrictions which apply
+to that code.
+
+The disclaimer of warranty in the University of Illinois Open Source License
+applies to all code in the LLVM Distribution, and nothing in any of the
+other licenses gives permission to use the names of the LLVM Team or the
+University of Illinois to endorse or promote products derived from this
+Software.
+
+The following pieces of software have additional or alternate copyrights,
+licenses, and/or restrictions:
+
+Program             Directory
+-------             ---------
+sysinfo             lib/asan/sysinfo
+mach_override       lib/asan/mach_override

Modified: stable/9/contrib/compiler-rt/README.txt
==============================================================================
--- stable/9/contrib/compiler-rt/README.txt	Fri May 25 16:52:00 2012	(r236010)
+++ stable/9/contrib/compiler-rt/README.txt	Fri May 25 17:14:47 2012	(r236011)
@@ -106,6 +106,15 @@ si_int __mulvsi3(si_int a, si_int b);  /
 di_int __mulvdi3(di_int a, di_int b);  // a * b
 ti_int __mulvti3(ti_int a, ti_int b);  // a * b
 
+
+// Integral arithmetic which returns if overflow
+
+si_int __mulosi4(si_int a, si_int b, int* overflow);  // a * b, overflow set to one if result not in signed range
+di_int __mulodi4(di_int a, di_int b, int* overflow);  // a * b, overflow set to one if result not in signed range
+ti_int __muloti4(ti_int a, ti_int b, int* overflow);  // a * b, overflow set to
+ one if result not in signed range
+
+
 //  Integral comparison: a  < b -> 0
 //                       a == b -> 1
 //                       a  > b -> 2

Modified: stable/9/contrib/compiler-rt/lib/absvdi2.c
==============================================================================
--- stable/9/contrib/compiler-rt/lib/absvdi2.c	Fri May 25 16:52:00 2012	(r236010)
+++ stable/9/contrib/compiler-rt/lib/absvdi2.c	Fri May 25 17:14:47 2012	(r236011)
@@ -11,10 +11,8 @@
  *
  *===----------------------------------------------------------------------===
  */
-#include "abi.h"
 
 #include "int_lib.h"
-#include <stdlib.h>
 
 /* Returns: absolute value */
 

Modified: stable/9/contrib/compiler-rt/lib/absvsi2.c
==============================================================================
--- stable/9/contrib/compiler-rt/lib/absvsi2.c	Fri May 25 16:52:00 2012	(r236010)
+++ stable/9/contrib/compiler-rt/lib/absvsi2.c	Fri May 25 17:14:47 2012	(r236011)
@@ -11,10 +11,8 @@
  *
  * ===----------------------------------------------------------------------===
  */
-#include "abi.h"
 
 #include "int_lib.h"
-#include <stdlib.h>
 
 /* Returns: absolute value */
 

Modified: stable/9/contrib/compiler-rt/lib/absvti2.c
==============================================================================
--- stable/9/contrib/compiler-rt/lib/absvti2.c	Fri May 25 16:52:00 2012	(r236010)
+++ stable/9/contrib/compiler-rt/lib/absvti2.c	Fri May 25 17:14:47 2012	(r236011)
@@ -15,7 +15,6 @@
 #if __x86_64
 
 #include "int_lib.h"
-#include <stdlib.h>
 
 /* Returns: absolute value */
 

Modified: stable/9/contrib/compiler-rt/lib/adddf3.c
==============================================================================
--- stable/9/contrib/compiler-rt/lib/adddf3.c	Fri May 25 16:52:00 2012	(r236010)
+++ stable/9/contrib/compiler-rt/lib/adddf3.c	Fri May 25 17:14:47 2012	(r236011)
@@ -12,8 +12,6 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "abi.h"
-
 #define DOUBLE_PRECISION
 #include "fp_lib.h"
 

Modified: stable/9/contrib/compiler-rt/lib/addsf3.c
==============================================================================
--- stable/9/contrib/compiler-rt/lib/addsf3.c	Fri May 25 16:52:00 2012	(r236010)
+++ stable/9/contrib/compiler-rt/lib/addsf3.c	Fri May 25 17:14:47 2012	(r236011)
@@ -12,8 +12,6 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "abi.h"
-
 #define SINGLE_PRECISION
 #include "fp_lib.h"
 

Modified: stable/9/contrib/compiler-rt/lib/addvdi3.c
==============================================================================
--- stable/9/contrib/compiler-rt/lib/addvdi3.c	Fri May 25 16:52:00 2012	(r236010)
+++ stable/9/contrib/compiler-rt/lib/addvdi3.c	Fri May 25 17:14:47 2012	(r236011)
@@ -11,10 +11,8 @@
  *
  * ===----------------------------------------------------------------------===
  */
-#include "abi.h"
 
 #include "int_lib.h"
-#include <stdlib.h>
 
 /* Returns: a + b */
 

Modified: stable/9/contrib/compiler-rt/lib/addvsi3.c
==============================================================================
--- stable/9/contrib/compiler-rt/lib/addvsi3.c	Fri May 25 16:52:00 2012	(r236010)
+++ stable/9/contrib/compiler-rt/lib/addvsi3.c	Fri May 25 17:14:47 2012	(r236011)
@@ -11,10 +11,8 @@
  *
  * ===----------------------------------------------------------------------===
  */
-#include "abi.h"
 
 #include "int_lib.h"
-#include <stdlib.h>
 
 /* Returns: a + b */
 

Modified: stable/9/contrib/compiler-rt/lib/addvti3.c
==============================================================================
--- stable/9/contrib/compiler-rt/lib/addvti3.c	Fri May 25 16:52:00 2012	(r236010)
+++ stable/9/contrib/compiler-rt/lib/addvti3.c	Fri May 25 17:14:47 2012	(r236011)
@@ -15,7 +15,6 @@
 #if __x86_64
 
 #include "int_lib.h"
-#include <stdlib.h>
 
 /* Returns: a + b */
 

Modified: stable/9/contrib/compiler-rt/lib/arm/adddf3vfp.S
==============================================================================
--- stable/9/contrib/compiler-rt/lib/arm/adddf3vfp.S	Fri May 25 16:52:00 2012	(r236010)
+++ stable/9/contrib/compiler-rt/lib/arm/adddf3vfp.S	Fri May 25 17:14:47 2012	(r236011)
@@ -15,10 +15,11 @@
 // Adds two double precision floating point numbers using the Darwin
 // calling convention where double arguments are passsed in GPR pairs
 //
+	.syntax unified
 	.align 2
 DEFINE_COMPILERRT_FUNCTION(__adddf3vfp)
-	fmdrr	d6, r0, r1		// move first param from r0/r1 pair into d6
-	fmdrr	d7, r2, r3		// move second param from r2/r3 pair into d7
-	faddd	d6, d6, d7		
-	fmrrd	r0, r1, d6		// move result back to r0/r1 pair
+	vmov	d6, r0, r1		// move first param from r0/r1 pair into d6
+	vmov	d7, r2, r3		// move second param from r2/r3 pair into d7
+	vadd.f64 d6, d6, d7		
+	vmov	r0, r1, d6		// move result back to r0/r1 pair
 	bx	lr

Modified: stable/9/contrib/compiler-rt/lib/arm/addsf3vfp.S
==============================================================================
--- stable/9/contrib/compiler-rt/lib/arm/addsf3vfp.S	Fri May 25 16:52:00 2012	(r236010)
+++ stable/9/contrib/compiler-rt/lib/arm/addsf3vfp.S	Fri May 25 17:14:47 2012	(r236011)
@@ -15,10 +15,11 @@
 // Adds two single precision floating point numbers using the Darwin
 // calling convention where single arguments are passsed in GPRs
 //
+	.syntax unified
 	.align 2
 DEFINE_COMPILERRT_FUNCTION(__addsf3vfp)
-	fmsr	s14, r0		// move first param from r0 into float register
-	fmsr	s15, r1		// move second param from r1 into float register
-	fadds	s14, s14, s15
-	fmrs	r0, s14		// move result back to r0
+	vmov	s14, r0		// move first param from r0 into float register
+	vmov	s15, r1		// move second param from r1 into float register
+	vadd.f32 s14, s14, s15
+	vmov	r0, s14		// move result back to r0
 	bx	lr

Modified: stable/9/contrib/compiler-rt/lib/arm/divdf3vfp.S
==============================================================================
--- stable/9/contrib/compiler-rt/lib/arm/divdf3vfp.S	Fri May 25 16:52:00 2012	(r236010)
+++ stable/9/contrib/compiler-rt/lib/arm/divdf3vfp.S	Fri May 25 17:14:47 2012	(r236011)
@@ -15,10 +15,11 @@
 // Divides two double precision floating point numbers using the Darwin
 // calling convention where double arguments are passsed in GPR pairs
 //
+	.syntax unified
 	.align 2
 DEFINE_COMPILERRT_FUNCTION(__divdf3vfp)
-	fmdrr	d6, r0, r1		// move first param from r0/r1 pair into d6
-	fmdrr	d7, r2, r3		// move second param from r2/r3 pair into d7
-	fdivd	d5, d6, d7		
-	fmrrd	r0, r1, d5		// move result back to r0/r1 pair
+	vmov	d6, r0, r1		// move first param from r0/r1 pair into d6
+	vmov	d7, r2, r3		// move second param from r2/r3 pair into d7
+	vdiv.f64 d5, d6, d7		
+	vmov	r0, r1, d5		// move result back to r0/r1 pair
 	bx	lr

Modified: stable/9/contrib/compiler-rt/lib/arm/divsf3vfp.S
==============================================================================
--- stable/9/contrib/compiler-rt/lib/arm/divsf3vfp.S	Fri May 25 16:52:00 2012	(r236010)
+++ stable/9/contrib/compiler-rt/lib/arm/divsf3vfp.S	Fri May 25 17:14:47 2012	(r236011)
@@ -15,10 +15,11 @@
 // Divides two single precision floating point numbers using the Darwin
 // calling convention where single arguments are passsed like 32-bit ints.
 //
+	.syntax unified
 	.align 2
 DEFINE_COMPILERRT_FUNCTION(__divsf3vfp)
-	fmsr	s14, r0		// move first param from r0 into float register
-	fmsr	s15, r1		// move second param from r1 into float register
-	fdivs	s13, s14, s15
-	fmrs	r0, s13		// move result back to r0
+	vmov	s14, r0		// move first param from r0 into float register
+	vmov	s15, r1		// move second param from r1 into float register
+	vdiv.f32 s13, s14, s15
+	vmov	r0, s13		// move result back to r0
 	bx	lr

Modified: stable/9/contrib/compiler-rt/lib/arm/eqdf2vfp.S
==============================================================================
--- stable/9/contrib/compiler-rt/lib/arm/eqdf2vfp.S	Fri May 25 16:52:00 2012	(r236010)
+++ stable/9/contrib/compiler-rt/lib/arm/eqdf2vfp.S	Fri May 25 17:14:47 2012	(r236011)
@@ -16,12 +16,13 @@
 // Uses Darwin calling convention where double precision arguments are passsed 
 // like in GPR pairs.
 //
+	.syntax unified
 	.align 2
 DEFINE_COMPILERRT_FUNCTION(__eqdf2vfp)
-	fmdrr	d6, r0, r1	// load r0/r1 pair in double register
-	fmdrr	d7, r2, r3	// load r2/r3 pair in double register
-	fcmpd	d6, d7		
-	fmstat
+	vmov	d6, r0, r1	// load r0/r1 pair in double register
+	vmov	d7, r2, r3	// load r2/r3 pair in double register
+	vcmp.f64 d6, d7		
+	vmrs	apsr_nzcv, fpscr
 	moveq	r0, #1		// set result register to 1 if equal
 	movne	r0, #0
 	bx	lr

Modified: stable/9/contrib/compiler-rt/lib/arm/eqsf2vfp.S
==============================================================================
--- stable/9/contrib/compiler-rt/lib/arm/eqsf2vfp.S	Fri May 25 16:52:00 2012	(r236010)
+++ stable/9/contrib/compiler-rt/lib/arm/eqsf2vfp.S	Fri May 25 17:14:47 2012	(r236011)
@@ -16,12 +16,13 @@
 // Uses Darwin calling convention where single precision arguments are passsed 
 // like 32-bit ints
 //
+	.syntax unified
 	.align 2
 DEFINE_COMPILERRT_FUNCTION(__eqsf2vfp)
-	fmsr	s14, r0     // move from GPR 0 to float register
-	fmsr	s15, r1	    // move from GPR 1 to float register
-	fcmps	s14, s15
-	fmstat
+	vmov	s14, r0     // move from GPR 0 to float register
+	vmov	s15, r1	    // move from GPR 1 to float register
+	vcmp.f32 s14, s15
+	vmrs	apsr_nzcv, fpscr
 	moveq	r0, #1      // set result register to 1 if equal
 	movne	r0, #0
 	bx	lr

Modified: stable/9/contrib/compiler-rt/lib/arm/extendsfdf2vfp.S
==============================================================================
--- stable/9/contrib/compiler-rt/lib/arm/extendsfdf2vfp.S	Fri May 25 16:52:00 2012	(r236010)
+++ stable/9/contrib/compiler-rt/lib/arm/extendsfdf2vfp.S	Fri May 25 17:14:47 2012	(r236011)
@@ -16,9 +16,10 @@
 // Uses Darwin calling convention where a single precision parameter is 
 // passed in a GPR and a double precision result is returned in R0/R1 pair.
 //
+	.syntax unified
 	.align 2
 DEFINE_COMPILERRT_FUNCTION(__extendsfdf2vfp)
-	fmsr	s15, r0      // load float register from R0
-	fcvtds	d7, s15      // convert single to double
-	fmrrd	r0, r1, d7   // return result in r0/r1 pair
+	vmov	s15, r0      // load float register from R0
+	vcvt.f64.f32 d7, s15 // convert single to double
+	vmov	r0, r1, d7   // return result in r0/r1 pair
 	bx	lr

Modified: stable/9/contrib/compiler-rt/lib/arm/fixdfsivfp.S
==============================================================================
--- stable/9/contrib/compiler-rt/lib/arm/fixdfsivfp.S	Fri May 25 16:52:00 2012	(r236010)
+++ stable/9/contrib/compiler-rt/lib/arm/fixdfsivfp.S	Fri May 25 17:14:47 2012	(r236011)
@@ -16,9 +16,10 @@
 // Uses Darwin calling convention where a double precision parameter is 
 // passed in GPR register pair.
 //
+	.syntax unified
 	.align 2
 DEFINE_COMPILERRT_FUNCTION(__fixdfsivfp)
-	fmdrr	d7, r0, r1    // load double register from R0/R1
-	ftosizd	s15, d7       // convert double to 32-bit int into s15
-	fmrs	r0, s15	      // move s15 to result register
+	vmov	d7, r0, r1    // load double register from R0/R1
+	vcvt.s32.f64 s15, d7  // convert double to 32-bit int into s15
+	vmov	r0, s15	      // move s15 to result register
 	bx	lr

Modified: stable/9/contrib/compiler-rt/lib/arm/fixsfsivfp.S
==============================================================================
--- stable/9/contrib/compiler-rt/lib/arm/fixsfsivfp.S	Fri May 25 16:52:00 2012	(r236010)
+++ stable/9/contrib/compiler-rt/lib/arm/fixsfsivfp.S	Fri May 25 17:14:47 2012	(r236011)
@@ -16,9 +16,10 @@
 // Uses Darwin calling convention where a single precision parameter is 
 // passed in a GPR..
 //
+	.syntax unified
 	.align 2
 DEFINE_COMPILERRT_FUNCTION(__fixsfsivfp)
-	fmsr	s15, r0      // load float register from R0
-	ftosizs	s15, s15     // convert single to 32-bit int into s15
-	fmrs	r0, s15	     // move s15 to result register
+	vmov	s15, r0        // load float register from R0
+	vcvt.s32.f32 s15, s15  // convert single to 32-bit int into s15
+	vmov	r0, s15	       // move s15 to result register
 	bx	lr

Modified: stable/9/contrib/compiler-rt/lib/arm/fixunsdfsivfp.S
==============================================================================
--- stable/9/contrib/compiler-rt/lib/arm/fixunsdfsivfp.S	Fri May 25 16:52:00 2012	(r236010)
+++ stable/9/contrib/compiler-rt/lib/arm/fixunsdfsivfp.S	Fri May 25 17:14:47 2012	(r236011)
@@ -17,9 +17,10 @@
 // Uses Darwin calling convention where a double precision parameter is 
 // passed in GPR register pair.
 //
+	.syntax unified
 	.align 2
 DEFINE_COMPILERRT_FUNCTION(__fixunsdfsivfp)
-	fmdrr	d7, r0, r1    // load double register from R0/R1
-	ftouizd	s15, d7       // convert double to 32-bit int into s15
-	fmrs	r0, s15	      // move s15 to result register
+	vmov	d7, r0, r1    // load double register from R0/R1
+	vcvt.u32.f64 s15, d7  // convert double to 32-bit int into s15
+	vmov	r0, s15	      // move s15 to result register
 	bx	lr

Modified: stable/9/contrib/compiler-rt/lib/arm/fixunssfsivfp.S
==============================================================================
--- stable/9/contrib/compiler-rt/lib/arm/fixunssfsivfp.S	Fri May 25 16:52:00 2012	(r236010)
+++ stable/9/contrib/compiler-rt/lib/arm/fixunssfsivfp.S	Fri May 25 17:14:47 2012	(r236011)
@@ -17,9 +17,10 @@
 // Uses Darwin calling convention where a single precision parameter is 
 // passed in a GPR..
 //
+	.syntax unified
 	.align 2
 DEFINE_COMPILERRT_FUNCTION(__fixunssfsivfp)
-	fmsr	s15, r0      // load float register from R0
-	ftouizs	s15, s15     // convert single to 32-bit unsigned into s15
-	fmrs	r0, s15	     // move s15 to result register
+	vmov	s15, r0        // load float register from R0
+	vcvt.u32.f32 s15, s15  // convert single to 32-bit unsigned into s15
+	vmov	r0, s15	       // move s15 to result register
 	bx	lr

Modified: stable/9/contrib/compiler-rt/lib/arm/floatsidfvfp.S
==============================================================================
--- stable/9/contrib/compiler-rt/lib/arm/floatsidfvfp.S	Fri May 25 16:52:00 2012	(r236010)
+++ stable/9/contrib/compiler-rt/lib/arm/floatsidfvfp.S	Fri May 25 17:14:47 2012	(r236011)
@@ -16,9 +16,10 @@
 // Uses Darwin calling convention where a double precision result is 
 // return in GPR register pair.
 //
+	.syntax unified
 	.align 2
 DEFINE_COMPILERRT_FUNCTION(__floatsidfvfp)
-	fmsr	s15, r0		   // move int to float register s15
-	fsitod	d7, s15        // convert 32-bit int in s15 to double in d7
-	fmrrd	r0, r1, d7     // move d7 to result register pair r0/r1
+	vmov	s15, r0        // move int to float register s15
+	vcvt.f64.s32 d7, s15   // convert 32-bit int in s15 to double in d7
+	vmov	r0, r1, d7     // move d7 to result register pair r0/r1
 	bx	lr

Modified: stable/9/contrib/compiler-rt/lib/arm/floatsisfvfp.S
==============================================================================
--- stable/9/contrib/compiler-rt/lib/arm/floatsisfvfp.S	Fri May 25 16:52:00 2012	(r236010)
+++ stable/9/contrib/compiler-rt/lib/arm/floatsisfvfp.S	Fri May 25 17:14:47 2012	(r236011)
@@ -16,9 +16,10 @@
 // Uses Darwin calling convention where a single precision result is 
 // return in a GPR..
 //
+	.syntax unified
 	.align 2
 DEFINE_COMPILERRT_FUNCTION(__floatsisfvfp)
-	fmsr	s15, r0	     // move int to float register s15
-	fsitos	s15, s15     // convert 32-bit int in s15 to float in s15
-	fmrs	r0, s15      // move s15 to result register
+	vmov	s15, r0	       // move int to float register s15
+	vcvt.f32.s32 s15, s15  // convert 32-bit int in s15 to float in s15
+	vmov	r0, s15        // move s15 to result register
 	bx	lr

Modified: stable/9/contrib/compiler-rt/lib/arm/floatunssidfvfp.S
==============================================================================
--- stable/9/contrib/compiler-rt/lib/arm/floatunssidfvfp.S	Fri May 25 16:52:00 2012	(r236010)
+++ stable/9/contrib/compiler-rt/lib/arm/floatunssidfvfp.S	Fri May 25 17:14:47 2012	(r236011)
@@ -16,9 +16,10 @@
 // Uses Darwin calling convention where a double precision result is 
 // return in GPR register pair.
 //
+	.syntax unified
 	.align 2
 DEFINE_COMPILERRT_FUNCTION(__floatunssidfvfp)
-	fmsr	s15, r0		   // move int to float register s15
-	fuitod	d7, s15        // convert 32-bit int in s15 to double in d7
-	fmrrd	r0, r1, d7     // move d7 to result register pair r0/r1
+	vmov	s15, r0        // move int to float register s15
+	vcvt.f64.u32 d7, s15   // convert 32-bit int in s15 to double in d7
+	vmov	r0, r1, d7     // move d7 to result register pair r0/r1
 	bx	lr

Modified: stable/9/contrib/compiler-rt/lib/arm/floatunssisfvfp.S
==============================================================================
--- stable/9/contrib/compiler-rt/lib/arm/floatunssisfvfp.S	Fri May 25 16:52:00 2012	(r236010)
+++ stable/9/contrib/compiler-rt/lib/arm/floatunssisfvfp.S	Fri May 25 17:14:47 2012	(r236011)
@@ -16,9 +16,10 @@
 // Uses Darwin calling convention where a single precision result is 
 // return in a GPR..
 //
+	.syntax unified
 	.align 2
 DEFINE_COMPILERRT_FUNCTION(__floatunssisfvfp)
-	fmsr	s15, r0	     // move int to float register s15
-	fuitos 	s15, s15     // convert 32-bit int in s15 to float in s15
-	fmrs	r0, s15      // move s15 to result register
+	vmov	s15, r0	       // move int to float register s15
+	vcvt.f32.u32 s15, s15  // convert 32-bit int in s15 to float in s15
+	vmov	r0, s15        // move s15 to result register
 	bx	lr

Modified: stable/9/contrib/compiler-rt/lib/arm/gedf2vfp.S
==============================================================================
--- stable/9/contrib/compiler-rt/lib/arm/gedf2vfp.S	Fri May 25 16:52:00 2012	(r236010)
+++ stable/9/contrib/compiler-rt/lib/arm/gedf2vfp.S	Fri May 25 17:14:47 2012	(r236011)
@@ -16,12 +16,13 @@
 // Uses Darwin calling convention where double precision arguments are passsed 
 // like in GPR pairs.
 //
+	.syntax unified
 	.align 2
 DEFINE_COMPILERRT_FUNCTION(__gedf2vfp)
-	fmdrr	d6, r0, r1	// load r0/r1 pair in double register
-	fmdrr	d7, r2, r3	// load r2/r3 pair in double register
-	fcmpd	d6, d7		
-	fmstat
+	vmov 	d6, r0, r1	// load r0/r1 pair in double register
+	vmov 	d7, r2, r3	// load r2/r3 pair in double register
+	vcmp.f64 d6, d7
+	vmrs	apsr_nzcv, fpscr
 	movge	r0, #1      // set result register to 1 if greater than or equal
 	movlt	r0, #0
 	bx	lr

Modified: stable/9/contrib/compiler-rt/lib/arm/gesf2vfp.S
==============================================================================
--- stable/9/contrib/compiler-rt/lib/arm/gesf2vfp.S	Fri May 25 16:52:00 2012	(r236010)
+++ stable/9/contrib/compiler-rt/lib/arm/gesf2vfp.S	Fri May 25 17:14:47 2012	(r236011)
@@ -16,12 +16,13 @@
 // Uses Darwin calling convention where single precision arguments are passsed 
 // like 32-bit ints
 //
+	.syntax unified
 	.align 2
 DEFINE_COMPILERRT_FUNCTION(__gesf2vfp)
-	fmsr	s14, r0	    // move from GPR 0 to float register
-	fmsr	s15, r1	    // move from GPR 1 to float register
-	fcmps	s14, s15
-	fmstat
+	vmov	s14, r0	    // move from GPR 0 to float register
+	vmov	s15, r1	    // move from GPR 1 to float register
+	vcmp.f32 s14, s15
+	vmrs	apsr_nzcv, fpscr
 	movge	r0, #1      // set result register to 1 if greater than or equal
 	movlt	r0, #0
 	bx	lr

Modified: stable/9/contrib/compiler-rt/lib/arm/gtdf2vfp.S
==============================================================================
--- stable/9/contrib/compiler-rt/lib/arm/gtdf2vfp.S	Fri May 25 16:52:00 2012	(r236010)
+++ stable/9/contrib/compiler-rt/lib/arm/gtdf2vfp.S	Fri May 25 17:14:47 2012	(r236011)
@@ -16,12 +16,13 @@
 // Uses Darwin calling convention where double precision arguments are passsed 
 // like in GPR pairs.
 //
+	.syntax unified
 	.align 2
 DEFINE_COMPILERRT_FUNCTION(__gtdf2vfp)
-	fmdrr	d6, r0, r1	// load r0/r1 pair in double register
-	fmdrr	d7, r2, r3	// load r2/r3 pair in double register
-	fcmpd	d6, d7		
-	fmstat
+	vmov 	d6, r0, r1	// load r0/r1 pair in double register
+	vmov 	d7, r2, r3	// load r2/r3 pair in double register
+	vcmp.f64 d6, d7
+	vmrs	apsr_nzcv, fpscr
 	movgt	r0, #1		// set result register to 1 if equal
 	movle	r0, #0
 	bx	lr

Modified: stable/9/contrib/compiler-rt/lib/arm/gtsf2vfp.S
==============================================================================
--- stable/9/contrib/compiler-rt/lib/arm/gtsf2vfp.S	Fri May 25 16:52:00 2012	(r236010)
+++ stable/9/contrib/compiler-rt/lib/arm/gtsf2vfp.S	Fri May 25 17:14:47 2012	(r236011)
@@ -16,12 +16,13 @@
 // Uses Darwin calling convention where single precision arguments are passsed 
 // like 32-bit ints
 //
+	.syntax unified
 	.align 2
 DEFINE_COMPILERRT_FUNCTION(__gtsf2vfp)
-	fmsr	s14, r0		// move from GPR 0 to float register
-	fmsr	s15, r1		// move from GPR 1 to float register
-	fcmps	s14, s15
-	fmstat
+	vmov	s14, r0		// move from GPR 0 to float register
+	vmov	s15, r1		// move from GPR 1 to float register
+	vcmp.f32 s14, s15
+	vmrs	apsr_nzcv, fpscr
 	movgt	r0, #1		// set result register to 1 if equal
 	movle	r0, #0
 	bx	lr

Modified: stable/9/contrib/compiler-rt/lib/arm/ledf2vfp.S
==============================================================================
--- stable/9/contrib/compiler-rt/lib/arm/ledf2vfp.S	Fri May 25 16:52:00 2012	(r236010)
+++ stable/9/contrib/compiler-rt/lib/arm/ledf2vfp.S	Fri May 25 17:14:47 2012	(r236011)
@@ -16,12 +16,13 @@
 // Uses Darwin calling convention where double precision arguments are passsed 
 // like in GPR pairs.
 //
+	.syntax unified
 	.align 2
 DEFINE_COMPILERRT_FUNCTION(__ledf2vfp)
-	fmdrr	d6, r0, r1	// load r0/r1 pair in double register
-	fmdrr	d7, r2, r3	// load r2/r3 pair in double register
-	fcmpd	d6, d7		
-	fmstat
+	vmov 	d6, r0, r1	// load r0/r1 pair in double register
+	vmov 	d7, r2, r3	// load r2/r3 pair in double register
+	vcmp.f64 d6, d7
+	vmrs	apsr_nzcv, fpscr
 	movls	r0, #1		// set result register to 1 if equal
 	movhi	r0, #0
 	bx	lr

Modified: stable/9/contrib/compiler-rt/lib/arm/lesf2vfp.S
==============================================================================
--- stable/9/contrib/compiler-rt/lib/arm/lesf2vfp.S	Fri May 25 16:52:00 2012	(r236010)
+++ stable/9/contrib/compiler-rt/lib/arm/lesf2vfp.S	Fri May 25 17:14:47 2012	(r236011)
@@ -16,12 +16,13 @@
 // Uses Darwin calling convention where single precision arguments are passsed 
 // like 32-bit ints
 //
+	.syntax unified
 	.align 2
 DEFINE_COMPILERRT_FUNCTION(__lesf2vfp)
-	fmsr	s14, r0     // move from GPR 0 to float register
-	fmsr	s15, r1     // move from GPR 1 to float register
-	fcmps	s14, s15
-	fmstat
+	vmov	s14, r0     // move from GPR 0 to float register
+	vmov	s15, r1     // move from GPR 1 to float register
+	vcmp.f32 s14, s15
+	vmrs	apsr_nzcv, fpscr
 	movls	r0, #1      // set result register to 1 if equal
 	movhi	r0, #0
 	bx	lr

Modified: stable/9/contrib/compiler-rt/lib/arm/ltdf2vfp.S
==============================================================================
--- stable/9/contrib/compiler-rt/lib/arm/ltdf2vfp.S	Fri May 25 16:52:00 2012	(r236010)
+++ stable/9/contrib/compiler-rt/lib/arm/ltdf2vfp.S	Fri May 25 17:14:47 2012	(r236011)
@@ -16,12 +16,13 @@
 // Uses Darwin calling convention where double precision arguments are passsed 
 // like in GPR pairs.
 //
+	.syntax unified
 	.align 2
 DEFINE_COMPILERRT_FUNCTION(__ltdf2vfp)
-	fmdrr	d6, r0, r1	// load r0/r1 pair in double register
-	fmdrr	d7, r2, r3	// load r2/r3 pair in double register
-	fcmpd	d6, d7		
-	fmstat
+	vmov 	d6, r0, r1	// load r0/r1 pair in double register
+	vmov 	d7, r2, r3	// load r2/r3 pair in double register
+	vcmp.f64 d6, d7
+	vmrs	apsr_nzcv, fpscr
 	movmi	r0, #1		// set result register to 1 if equal
 	movpl	r0, #0
 	bx	lr

Modified: stable/9/contrib/compiler-rt/lib/arm/ltsf2vfp.S
==============================================================================
--- stable/9/contrib/compiler-rt/lib/arm/ltsf2vfp.S	Fri May 25 16:52:00 2012	(r236010)
+++ stable/9/contrib/compiler-rt/lib/arm/ltsf2vfp.S	Fri May 25 17:14:47 2012	(r236011)
@@ -16,12 +16,13 @@
 // Uses Darwin calling convention where single precision arguments are passsed 
 // like 32-bit ints
 //
+	.syntax unified
 	.align 2
 DEFINE_COMPILERRT_FUNCTION(__ltsf2vfp)
-	fmsr	s14, r0     // move from GPR 0 to float register
-	fmsr	s15, r1     // move from GPR 1 to float register
-	fcmps	s14, s15
-	fmstat
+	vmov	s14, r0     // move from GPR 0 to float register
+	vmov	s15, r1     // move from GPR 1 to float register
+	vcmp.f32 s14, s15
+	vmrs	apsr_nzcv, fpscr
 	movmi	r0, #1      // set result register to 1 if equal
 	movpl	r0, #0
 	bx	lr

Modified: stable/9/contrib/compiler-rt/lib/arm/muldf3vfp.S
==============================================================================
--- stable/9/contrib/compiler-rt/lib/arm/muldf3vfp.S	Fri May 25 16:52:00 2012	(r236010)
+++ stable/9/contrib/compiler-rt/lib/arm/muldf3vfp.S	Fri May 25 17:14:47 2012	(r236011)
@@ -15,10 +15,11 @@
 // Multiplies two double precision floating point numbers using the Darwin
 // calling convention where double arguments are passsed in GPR pairs
 //
+	.syntax unified
 	.align 2
 DEFINE_COMPILERRT_FUNCTION(__muldf3vfp)
-	fmdrr	d6, r0, r1		// move first param from r0/r1 pair into d6
-	fmdrr	d7, r2, r3		// move second param from r2/r3 pair into d7
-	fmuld	d6, d6, d7		
-	fmrrd	r0, r1, d6		// move result back to r0/r1 pair
+	vmov 	d6, r0, r1         // move first param from r0/r1 pair into d6
+	vmov 	d7, r2, r3         // move second param from r2/r3 pair into d7
+	vmul.f64 d6, d6, d7		
+	vmov 	r0, r1, d6         // move result back to r0/r1 pair
 	bx	lr

Modified: stable/9/contrib/compiler-rt/lib/arm/mulsf3vfp.S
==============================================================================
--- stable/9/contrib/compiler-rt/lib/arm/mulsf3vfp.S	Fri May 25 16:52:00 2012	(r236010)
+++ stable/9/contrib/compiler-rt/lib/arm/mulsf3vfp.S	Fri May 25 17:14:47 2012	(r236011)
@@ -15,10 +15,11 @@
 // Multiplies two single precision floating point numbers using the Darwin
 // calling convention where single arguments are passsed like 32-bit ints.
 //
+	.syntax unified
 	.align 2
 DEFINE_COMPILERRT_FUNCTION(__mulsf3vfp)
-	fmsr	s14, r0		// move first param from r0 into float register
-	fmsr	s15, r1		// move second param from r1 into float register
-	fmuls	s13, s14, s15
-	fmrs	r0, s13		// move result back to r0
+	vmov	s14, r0		// move first param from r0 into float register
+	vmov	s15, r1		// move second param from r1 into float register
+	vmul.f32 s13, s14, s15
+	vmov	r0, s13		// move result back to r0
 	bx	lr

Modified: stable/9/contrib/compiler-rt/lib/arm/nedf2vfp.S
==============================================================================
--- stable/9/contrib/compiler-rt/lib/arm/nedf2vfp.S	Fri May 25 16:52:00 2012	(r236010)
+++ stable/9/contrib/compiler-rt/lib/arm/nedf2vfp.S	Fri May 25 17:14:47 2012	(r236011)
@@ -16,12 +16,13 @@
 // Uses Darwin calling convention where double precision arguments are passsed 
 // like in GPR pairs.
 //
+	.syntax unified
 	.align 2
 DEFINE_COMPILERRT_FUNCTION(__nedf2vfp)
-	fmdrr	d6, r0, r1	// load r0/r1 pair in double register
-	fmdrr	d7, r2, r3	// load r2/r3 pair in double register
-	fcmpd	d6, d7		
-	fmstat
+	vmov 	d6, r0, r1	// load r0/r1 pair in double register
+	vmov 	d7, r2, r3	// load r2/r3 pair in double register
+	vcmp.f64 d6, d7		
+	vmrs	apsr_nzcv, fpscr
 	movne	r0, #1		// set result register to 0 if unequal
 	moveq	r0, #0
 	bx	lr

Modified: stable/9/contrib/compiler-rt/lib/arm/negdf2vfp.S
==============================================================================
--- stable/9/contrib/compiler-rt/lib/arm/negdf2vfp.S	Fri May 25 16:52:00 2012	(r236010)
+++ stable/9/contrib/compiler-rt/lib/arm/negdf2vfp.S	Fri May 25 17:14:47 2012	(r236011)
@@ -15,6 +15,7 @@
 // Returns the negation a double precision floating point numbers using the 
 // Darwin calling convention where double arguments are passsed in GPR pairs.
 //
+	.syntax unified
 	.align 2
 DEFINE_COMPILERRT_FUNCTION(__negdf2vfp)
 	eor	r1, r1, #-2147483648	// flip sign bit on double in r0/r1 pair

Modified: stable/9/contrib/compiler-rt/lib/arm/negsf2vfp.S
==============================================================================
--- stable/9/contrib/compiler-rt/lib/arm/negsf2vfp.S	Fri May 25 16:52:00 2012	(r236010)
+++ stable/9/contrib/compiler-rt/lib/arm/negsf2vfp.S	Fri May 25 17:14:47 2012	(r236011)
@@ -15,6 +15,7 @@
 // Returns the negation of a single precision floating point numbers using the 
 // Darwin calling convention where single arguments are passsed like 32-bit ints
 //
+	.syntax unified
 	.align 2
 DEFINE_COMPILERRT_FUNCTION(__negsf2vfp)
 	eor	r0, r0, #-2147483648	// flip sign bit on float in r0

Modified: stable/9/contrib/compiler-rt/lib/arm/nesf2vfp.S
==============================================================================
--- stable/9/contrib/compiler-rt/lib/arm/nesf2vfp.S	Fri May 25 16:52:00 2012	(r236010)
+++ stable/9/contrib/compiler-rt/lib/arm/nesf2vfp.S	Fri May 25 17:14:47 2012	(r236011)
@@ -16,12 +16,13 @@
 // Uses Darwin calling convention where single precision arguments are passsed 
 // like 32-bit ints
 //
+	.syntax unified
 	.align 2
 DEFINE_COMPILERRT_FUNCTION(__nesf2vfp)
-	fmsr	s14, r0	    // move from GPR 0 to float register
-	fmsr	s15, r1	    // move from GPR 1 to float register
-	fcmps	s14, s15
-	fmstat
+	vmov	s14, r0	    // move from GPR 0 to float register
+	vmov	s15, r1	    // move from GPR 1 to float register
+	vcmp.f32 s14, s15
+	vmrs	apsr_nzcv, fpscr
 	movne	r0, #1      // set result register to 1 if unequal
 	moveq	r0, #0
 	bx	lr

Modified: stable/9/contrib/compiler-rt/lib/arm/subdf3vfp.S
==============================================================================
--- stable/9/contrib/compiler-rt/lib/arm/subdf3vfp.S	Fri May 25 16:52:00 2012	(r236010)
+++ stable/9/contrib/compiler-rt/lib/arm/subdf3vfp.S	Fri May 25 17:14:47 2012	(r236011)
@@ -15,10 +15,11 @@
 // Returns difference between two double precision floating point numbers using 
 // the Darwin calling convention where double arguments are passsed in GPR pairs
 //
+	.syntax unified
 	.align 2
 DEFINE_COMPILERRT_FUNCTION(__subdf3vfp)
-	fmdrr	d6, r0, r1		// move first param from r0/r1 pair into d6
-	fmdrr	d7, r2, r3		// move second param from r2/r3 pair into d7
-	fsubd	d6, d6, d7		
-	fmrrd	r0, r1, d6		// move result back to r0/r1 pair
+	vmov 	d6, r0, r1         // move first param from r0/r1 pair into d6
+	vmov 	d7, r2, r3         // move second param from r2/r3 pair into d7
+	vsub.f64 d6, d6, d7		
+	vmov 	r0, r1, d6         // move result back to r0/r1 pair
 	bx	lr

Modified: stable/9/contrib/compiler-rt/lib/arm/subsf3vfp.S
==============================================================================
--- stable/9/contrib/compiler-rt/lib/arm/subsf3vfp.S	Fri May 25 16:52:00 2012	(r236010)
+++ stable/9/contrib/compiler-rt/lib/arm/subsf3vfp.S	Fri May 25 17:14:47 2012	(r236011)
@@ -16,10 +16,11 @@
 // using the Darwin calling convention where single arguments are passsed
 // like 32-bit ints.
 //
+	.syntax unified
 	.align 2
 DEFINE_COMPILERRT_FUNCTION(__subsf3vfp)
-	fmsr	s14, r0		// move first param from r0 into float register
-	fmsr	s15, r1		// move second param from r1 into float register
-	fsubs	s14, s14, s15
-	fmrs	r0, s14		// move result back to r0
+	vmov	s14, r0		// move first param from r0 into float register
+	vmov	s15, r1		// move second param from r1 into float register
+	vsub.f32 s14, s14, s15
+	vmov	r0, s14		// move result back to r0
 	bx	lr

Modified: stable/9/contrib/compiler-rt/lib/arm/truncdfsf2vfp.S
==============================================================================
--- stable/9/contrib/compiler-rt/lib/arm/truncdfsf2vfp.S	Fri May 25 16:52:00 2012	(r236010)
+++ stable/9/contrib/compiler-rt/lib/arm/truncdfsf2vfp.S	Fri May 25 17:14:47 2012	(r236011)
@@ -16,9 +16,10 @@
 // Uses Darwin calling convention where a double precision parameter is 
 // passed in a R0/R1 pair and a signle precision result is returned in R0.
 //
+	.syntax unified
 	.align 2
 DEFINE_COMPILERRT_FUNCTION(__truncdfsf2vfp)
-	fmdrr	d7, r0, r1   // load double from r0/r1 pair
-	fcvtsd	s15, d7      // convert double to single (trucate precision)
-	fmrs	r0, s15      // return result in r0
+	vmov 	d7, r0, r1   // load double from r0/r1 pair
+	vcvt.f32.f64 s15, d7 // convert double to single (trucate precision)
+	vmov 	r0, s15      // return result in r0
 	bx	lr

Modified: stable/9/contrib/compiler-rt/lib/arm/unorddf2vfp.S
==============================================================================
--- stable/9/contrib/compiler-rt/lib/arm/unorddf2vfp.S	Fri May 25 16:52:00 2012	(r236010)
+++ stable/9/contrib/compiler-rt/lib/arm/unorddf2vfp.S	Fri May 25 17:14:47 2012	(r236011)
@@ -16,12 +16,13 @@
 // Uses Darwin calling convention where double precision arguments are passsed 
 // like in GPR pairs.
 //
+	.syntax unified
 	.align 2
 DEFINE_COMPILERRT_FUNCTION(__unorddf2vfp)
-	fmdrr	d6, r0, r1	// load r0/r1 pair in double register
-	fmdrr	d7, r2, r3	// load r2/r3 pair in double register
-	fcmpd	d6, d7		
-	fmstat
+	vmov 	d6, r0, r1	// load r0/r1 pair in double register
+	vmov 	d7, r2, r3	// load r2/r3 pair in double register
+	vcmp.f64 d6, d7		
+	vmrs	apsr_nzcv, fpscr
 	movvs	r0, #1      // set result register to 1 if "overflow" (any NaNs)
 	movvc	r0, #0
 	bx	lr

Modified: stable/9/contrib/compiler-rt/lib/arm/unordsf2vfp.S
==============================================================================
--- stable/9/contrib/compiler-rt/lib/arm/unordsf2vfp.S	Fri May 25 16:52:00 2012	(r236010)
+++ stable/9/contrib/compiler-rt/lib/arm/unordsf2vfp.S	Fri May 25 17:14:47 2012	(r236011)
@@ -16,12 +16,13 @@
 // Uses Darwin calling convention where single precision arguments are passsed 
 // like 32-bit ints
 //
+	.syntax unified
 	.align 2
 DEFINE_COMPILERRT_FUNCTION(__unordsf2vfp)
-	fmsr	s14, r0     // move from GPR 0 to float register
-	fmsr	s15, r1	    // move from GPR 1 to float register
-	fcmps	s14, s15
-	fmstat
+	vmov	s14, r0     // move from GPR 0 to float register
+	vmov	s15, r1	    // move from GPR 1 to float register
+	vcmp.f32 s14, s15
+	vmrs	apsr_nzcv, fpscr
 	movvs	r0, #1      // set result register to 1 if "overflow" (any NaNs)
 	movvc	r0, #0
 	bx	lr

Modified: stable/9/contrib/compiler-rt/lib/ashldi3.c
==============================================================================
--- stable/9/contrib/compiler-rt/lib/ashldi3.c	Fri May 25 16:52:00 2012	(r236010)
+++ stable/9/contrib/compiler-rt/lib/ashldi3.c	Fri May 25 17:14:47 2012	(r236011)
@@ -11,7 +11,6 @@
  *
  * ===----------------------------------------------------------------------===
  */
-#include "abi.h"
 
 #include "int_lib.h"
 

Modified: stable/9/contrib/compiler-rt/lib/ashrdi3.c
==============================================================================
--- stable/9/contrib/compiler-rt/lib/ashrdi3.c	Fri May 25 16:52:00 2012	(r236010)
+++ stable/9/contrib/compiler-rt/lib/ashrdi3.c	Fri May 25 17:14:47 2012	(r236011)
@@ -11,7 +11,6 @@
  *
  * ===----------------------------------------------------------------------===
  */
-#include "abi.h"
 
 #include "int_lib.h"
 

Modified: stable/9/contrib/compiler-rt/lib/assembly.h
==============================================================================
--- stable/9/contrib/compiler-rt/lib/assembly.h	Fri May 25 16:52:00 2012	(r236010)
+++ stable/9/contrib/compiler-rt/lib/assembly.h	Fri May 25 17:14:47 2012	(r236011)
@@ -35,15 +35,16 @@
 #define SYMBOL_NAME(name) GLUE(__USER_LABEL_PREFIX__, name)
 
 #ifdef VISIBILITY_HIDDEN
-#define DEFINE_COMPILERRT_FUNCTION(name)                   \
-  .globl SYMBOL_NAME(name) SEPARATOR                       \
-  HIDDEN_DIRECTIVE SYMBOL_NAME(name) SEPARATOR             \
-  SYMBOL_NAME(name):
+#define DECLARE_SYMBOL_VISIBILITY(name)                    \
+  HIDDEN_DIRECTIVE SYMBOL_NAME(name) SEPARATOR
 #else
+#define DECLARE_SYMBOL_VISIBILITY(name)
+#endif
+
 #define DEFINE_COMPILERRT_FUNCTION(name)                   \
   .globl SYMBOL_NAME(name) SEPARATOR                       \
+  DECLARE_SYMBOL_VISIBILITY(name)                          \
   SYMBOL_NAME(name):
-#endif
 
 #define DEFINE_COMPILERRT_PRIVATE_FUNCTION(name)           \
   .globl SYMBOL_NAME(name) SEPARATOR                       \

Modified: stable/9/contrib/compiler-rt/lib/clear_cache.c
==============================================================================
--- stable/9/contrib/compiler-rt/lib/clear_cache.c	Fri May 25 16:52:00 2012	(r236010)
+++ stable/9/contrib/compiler-rt/lib/clear_cache.c	Fri May 25 17:14:47 2012	(r236011)
@@ -9,7 +9,6 @@
  */
 
 #include "int_lib.h"
-#include <stdlib.h>
 
 #if __APPLE__
   #include <libkern/OSCacheControl.h>

Modified: stable/9/contrib/compiler-rt/lib/clzdi2.c
==============================================================================
--- stable/9/contrib/compiler-rt/lib/clzdi2.c	Fri May 25 16:52:00 2012	(r236010)
+++ stable/9/contrib/compiler-rt/lib/clzdi2.c	Fri May 25 17:14:47 2012	(r236011)
@@ -11,7 +11,6 @@
  *
  * ===----------------------------------------------------------------------===
  */
-#include "abi.h"
 
 #include "int_lib.h"
 

Modified: stable/9/contrib/compiler-rt/lib/clzsi2.c
==============================================================================
--- stable/9/contrib/compiler-rt/lib/clzsi2.c	Fri May 25 16:52:00 2012	(r236010)
+++ stable/9/contrib/compiler-rt/lib/clzsi2.c	Fri May 25 17:14:47 2012	(r236011)
@@ -11,7 +11,6 @@
  *
  * ===----------------------------------------------------------------------===
  */
-#include "abi.h"
 
 #include "int_lib.h"
 

Modified: stable/9/contrib/compiler-rt/lib/cmpdi2.c
==============================================================================
--- stable/9/contrib/compiler-rt/lib/cmpdi2.c	Fri May 25 16:52:00 2012	(r236010)
+++ stable/9/contrib/compiler-rt/lib/cmpdi2.c	Fri May 25 17:14:47 2012	(r236011)
@@ -11,7 +11,6 @@
  *
  * ===----------------------------------------------------------------------===
  */
-#include "abi.h"
 
 #include "int_lib.h"
 

Modified: stable/9/contrib/compiler-rt/lib/ctzdi2.c
==============================================================================
--- stable/9/contrib/compiler-rt/lib/ctzdi2.c	Fri May 25 16:52:00 2012	(r236010)
+++ stable/9/contrib/compiler-rt/lib/ctzdi2.c	Fri May 25 17:14:47 2012	(r236011)
@@ -11,7 +11,6 @@
  *
  * ===----------------------------------------------------------------------===
  */
-#include "abi.h"
 
 #include "int_lib.h"
 

Modified: stable/9/contrib/compiler-rt/lib/ctzsi2.c
==============================================================================
--- stable/9/contrib/compiler-rt/lib/ctzsi2.c	Fri May 25 16:52:00 2012	(r236010)
+++ stable/9/contrib/compiler-rt/lib/ctzsi2.c	Fri May 25 17:14:47 2012	(r236011)
@@ -11,7 +11,6 @@
  *
  * ===----------------------------------------------------------------------===
  */
-#include "abi.h"
 
 #include "int_lib.h"
 

Modified: stable/9/contrib/compiler-rt/lib/divdc3.c
==============================================================================
--- stable/9/contrib/compiler-rt/lib/divdc3.c	Fri May 25 16:52:00 2012	(r236010)
+++ stable/9/contrib/compiler-rt/lib/divdc3.c	Fri May 25 17:14:47 2012	(r236011)
@@ -13,8 +13,7 @@
  */
 
 #include "int_lib.h"
-#include <math.h>
-#include <complex.h>
+#include "int_math.h"
 
 /* Returns: the quotient of (a + ib) / (c + id) */
 
@@ -22,35 +21,37 @@ double _Complex
 __divdc3(double __a, double __b, double __c, double __d)
 {
     int __ilogbw = 0;
-    double __logbw = logb(fmax(fabs(__c), fabs(__d)));
-    if (isfinite(__logbw))
+    double __logbw = crt_logb(crt_fmax(crt_fabs(__c), crt_fabs(__d)));
+    if (crt_isfinite(__logbw))
     {
         __ilogbw = (int)__logbw;
-        __c = scalbn(__c, -__ilogbw);
-        __d = scalbn(__d, -__ilogbw);
+        __c = crt_scalbn(__c, -__ilogbw);
+        __d = crt_scalbn(__d, -__ilogbw);
     }
     double __denom = __c * __c + __d * __d;
     double _Complex z;
-    __real__ z = scalbn((__a * __c + __b * __d) / __denom, -__ilogbw);
-    __imag__ z = scalbn((__b * __c - __a * __d) / __denom, -__ilogbw);
-    if (isnan(__real__ z) && isnan(__imag__ z))
+    __real__ z = crt_scalbn((__a * __c + __b * __d) / __denom, -__ilogbw);
+    __imag__ z = crt_scalbn((__b * __c - __a * __d) / __denom, -__ilogbw);
+    if (crt_isnan(__real__ z) && crt_isnan(__imag__ z))
     {
-        if ((__denom == 0.0) && (!isnan(__a) || !isnan(__b)))
+        if ((__denom == 0.0) && (!crt_isnan(__a) || !crt_isnan(__b)))
         {
-            __real__ z = copysign(INFINITY, __c) * __a;
-            __imag__ z = copysign(INFINITY, __c) * __b;
+            __real__ z = crt_copysign(CRT_INFINITY, __c) * __a;
+            __imag__ z = crt_copysign(CRT_INFINITY, __c) * __b;
         }
-        else if ((isinf(__a) || isinf(__b)) && isfinite(__c) && isfinite(__d))
+        else if ((crt_isinf(__a) || crt_isinf(__b)) &&
+                 crt_isfinite(__c) && crt_isfinite(__d))
         {
-            __a = copysign(isinf(__a) ? 1.0 : 0.0, __a);
-            __b = copysign(isinf(__b) ? 1.0 : 0.0, __b);
-            __real__ z = INFINITY * (__a * __c + __b * __d);
-            __imag__ z = INFINITY * (__b * __c - __a * __d);
+            __a = crt_copysign(crt_isinf(__a) ? 1.0 : 0.0, __a);
+            __b = crt_copysign(crt_isinf(__b) ? 1.0 : 0.0, __b);
+            __real__ z = CRT_INFINITY * (__a * __c + __b * __d);
+            __imag__ z = CRT_INFINITY * (__b * __c - __a * __d);
         }
-        else if (isinf(__logbw) && __logbw > 0.0 && isfinite(__a) && isfinite(__b))
+        else if (crt_isinf(__logbw) && __logbw > 0.0 &&
+                 crt_isfinite(__a) && crt_isfinite(__b))
         {
-            __c = copysign(isinf(__c) ? 1.0 : 0.0, __c);
-            __d = copysign(isinf(__d) ? 1.0 : 0.0, __d);
+            __c = crt_copysign(crt_isinf(__c) ? 1.0 : 0.0, __c);
+            __d = crt_copysign(crt_isinf(__d) ? 1.0 : 0.0, __d);
             __real__ z = 0.0 * (__a * __c + __b * __d);
             __imag__ z = 0.0 * (__b * __c - __a * __d);
         }

Modified: stable/9/contrib/compiler-rt/lib/divdf3.c
==============================================================================
--- stable/9/contrib/compiler-rt/lib/divdf3.c	Fri May 25 16:52:00 2012	(r236010)
+++ stable/9/contrib/compiler-rt/lib/divdf3.c	Fri May 25 17:14:47 2012	(r236011)
@@ -15,7 +15,6 @@
 // underflow with correct rounding.
 //
 //===----------------------------------------------------------------------===//
-#include "abi.h"
 
 #define DOUBLE_PRECISION
 #include "fp_lib.h"

Modified: stable/9/contrib/compiler-rt/lib/divdi3.c
==============================================================================
--- stable/9/contrib/compiler-rt/lib/divdi3.c	Fri May 25 16:52:00 2012	(r236010)
+++ stable/9/contrib/compiler-rt/lib/divdi3.c	Fri May 25 17:14:47 2012	(r236011)
@@ -11,7 +11,6 @@
  *
  * ===----------------------------------------------------------------------===
  */
-#include "abi.h"
 
 #include "int_lib.h"
 

Modified: stable/9/contrib/compiler-rt/lib/divmoddi4.c
==============================================================================
--- stable/9/contrib/compiler-rt/lib/divmoddi4.c	Fri May 25 16:52:00 2012	(r236010)
+++ stable/9/contrib/compiler-rt/lib/divmoddi4.c	Fri May 25 17:14:47 2012	(r236011)
@@ -11,7 +11,6 @@
  *
  * ===----------------------------------------------------------------------===
  */
-#include "abi.h"
 
 #include "int_lib.h"
 

Modified: stable/9/contrib/compiler-rt/lib/divmodsi4.c
==============================================================================
--- stable/9/contrib/compiler-rt/lib/divmodsi4.c	Fri May 25 16:52:00 2012	(r236010)
+++ stable/9/contrib/compiler-rt/lib/divmodsi4.c	Fri May 25 17:14:47 2012	(r236011)
@@ -11,7 +11,6 @@
  *
  * ===----------------------------------------------------------------------===
  */
-#include "abi.h"
 
 #include "int_lib.h"
 

Modified: stable/9/contrib/compiler-rt/lib/divsc3.c
==============================================================================
--- stable/9/contrib/compiler-rt/lib/divsc3.c	Fri May 25 16:52:00 2012	(r236010)
+++ stable/9/contrib/compiler-rt/lib/divsc3.c	Fri May 25 17:14:47 2012	(r236011)
@@ -13,8 +13,7 @@
  */
 
 #include "int_lib.h"
-#include <math.h>
-#include <complex.h>
+#include "int_math.h"
 
 /* Returns: the quotient of (a + ib) / (c + id) */
 
@@ -22,35 +21,37 @@ float _Complex
 __divsc3(float __a, float __b, float __c, float __d)
 {
     int __ilogbw = 0;
-    float __logbw = logbf(fmaxf(fabsf(__c), fabsf(__d)));
-    if (isfinite(__logbw))
+    float __logbw = crt_logbf(crt_fmaxf(crt_fabsf(__c), crt_fabsf(__d)));
+    if (crt_isfinite(__logbw))
     {
         __ilogbw = (int)__logbw;
-        __c = scalbnf(__c, -__ilogbw);
-        __d = scalbnf(__d, -__ilogbw);
+        __c = crt_scalbnf(__c, -__ilogbw);
+        __d = crt_scalbnf(__d, -__ilogbw);
     }
     float __denom = __c * __c + __d * __d;
     float _Complex z;
-    __real__ z = scalbnf((__a * __c + __b * __d) / __denom, -__ilogbw);
-    __imag__ z = scalbnf((__b * __c - __a * __d) / __denom, -__ilogbw);
-    if (isnan(__real__ z) && isnan(__imag__ z))
+    __real__ z = crt_scalbnf((__a * __c + __b * __d) / __denom, -__ilogbw);
+    __imag__ z = crt_scalbnf((__b * __c - __a * __d) / __denom, -__ilogbw);
+    if (crt_isnan(__real__ z) && crt_isnan(__imag__ z))
     {
-        if ((__denom == 0) && (!isnan(__a) || !isnan(__b)))
+        if ((__denom == 0) && (!crt_isnan(__a) || !crt_isnan(__b)))
         {
-            __real__ z = copysignf(INFINITY, __c) * __a;
-            __imag__ z = copysignf(INFINITY, __c) * __b;
+            __real__ z = crt_copysignf(CRT_INFINITY, __c) * __a;
+            __imag__ z = crt_copysignf(CRT_INFINITY, __c) * __b;
         }

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

From owner-svn-src-stable-9@FreeBSD.ORG  Fri May 25 17:15:53 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id BECED1065674;
	Fri, 25 May 2012 17:15:53 +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 8FA348FC21;
	Fri, 25 May 2012 17:15: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 q4PHFrmg023225;
	Fri, 25 May 2012 17:15:53 GMT (envelope-from marius@svn.freebsd.org)
Received: (from marius@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4PHFrlo023223;
	Fri, 25 May 2012 17:15:53 GMT (envelope-from marius@svn.freebsd.org)
Message-Id: <201205251715.q4PHFrlo023223@svn.freebsd.org>
From: Marius Strobl <marius@FreeBSD.org>
Date: Fri, 25 May 2012 17:15:53 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r236012 - stable/9/contrib/compiler-rt/lib
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 25 May 2012 17:15:53 -0000

Author: marius
Date: Fri May 25 17:15:53 2012
New Revision: 236012
URL: http://svn.freebsd.org/changeset/base/236012

Log:
  MFC: r230021
  
  Add a workaround to prevent endless recursion in compiler-rt.
  
  SPARC and MIPS CPUs don't have special instructions to count
  leading/trailing zeroes. The compiler-rt library provides fallback
  rountines for these. The 64-bit routines, __clzdi2 and __ctzdi2, are
  implemented as simple wrappers around the compiler built-in
  __builtin_clz(), assuming these will expand to either 32-bit
  CPU instructions or calls to __clzsi2 and __ctzsi2.
  
  Unfortunately, our GCC 4.2 probably thinks that because the operand is
  stored in a 64-bit register, it might just be a better idea to invoke
  its 64-bit equivalent, simply resulting into endless recursion. Fix this
  by defining __builtin_clz and __builtin_ctz to __clzsi2 and __ctzsi2
  explicitly.

Modified:
  stable/9/contrib/compiler-rt/lib/int_lib.h
Directory Properties:
  stable/9/contrib/compiler-rt/   (props changed)

Modified: stable/9/contrib/compiler-rt/lib/int_lib.h
==============================================================================
--- stable/9/contrib/compiler-rt/lib/int_lib.h	Fri May 25 17:14:47 2012	(r236011)
+++ stable/9/contrib/compiler-rt/lib/int_lib.h	Fri May 25 17:15:53 2012	(r236012)
@@ -43,4 +43,24 @@
 /* Include internal utility function declarations. */
 #include "int_util.h"
 
+/*
+ * Workaround for LLVM bug 11663.  Prevent endless recursion in
+ * __c?zdi2(), where calls to __builtin_c?z() are expanded to
+ * __c?zdi2() instead of __c?zsi2().
+ *
+ * Instead of placing this workaround in c?zdi2.c, put it in this
+ * global header to prevent other C files from making the detour
+ * through __c?zdi2() as well.
+ *
+ * This problem has only been observed on FreeBSD for sparc64 and
+ * mips64 with GCC 4.2.1.
+ */
+#if defined(__FreeBSD__) && (defined(__sparc64__) || \
+    defined(__mips_n64) || defined(__mips_o64))
+si_int __clzsi2(si_int);
+si_int __ctzsi2(si_int);
+#define	__builtin_clz	__clzsi2
+#define	__builtin_ctz	__ctzsi2
+#endif
+
 #endif /* INT_LIB_H */

From owner-svn-src-stable-9@FreeBSD.ORG  Fri May 25 17:20:01 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 9CC9C1065672;
	Fri, 25 May 2012 17:20:01 +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 869168FC12;
	Fri, 25 May 2012 17:20: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 q4PHK1oH023505;
	Fri, 25 May 2012 17:20:01 GMT (envelope-from marius@svn.freebsd.org)
Received: (from marius@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4PHK1AG023503;
	Fri, 25 May 2012 17:20:01 GMT (envelope-from marius@svn.freebsd.org)
Message-Id: <201205251720.q4PHK1AG023503@svn.freebsd.org>
From: Marius Strobl <marius@FreeBSD.org>
Date: Fri, 25 May 2012 17:20:01 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r236014 - in stable/9: gnu/lib/libgcc lib/libcompiler_rt
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 25 May 2012 17:20:01 -0000

Author: marius
Date: Fri May 25 17:20:00 2012
New Revision: 236014
URL: http://svn.freebsd.org/changeset/base/236014

Log:
  MFC: r235487
  
  Switch sparc64 to using libcompiler_rt; since r230021 (MFC'ed to stable/9 in
  r236012) we have a workaround in place allowing it to be used there and since
  r235388 (MFC'ed to stable/9 in r236002) we also have usable div/mod
  optimizations like libgcc has.

Modified:
  stable/9/gnu/lib/libgcc/Makefile
  stable/9/lib/libcompiler_rt/Makefile
Directory Properties:
  stable/9/gnu/lib/libgcc/   (props changed)
  stable/9/lib/libcompiler_rt/   (props changed)

Modified: stable/9/gnu/lib/libgcc/Makefile
==============================================================================
--- stable/9/gnu/lib/libgcc/Makefile	Fri May 25 17:19:30 2012	(r236013)
+++ stable/9/gnu/lib/libgcc/Makefile	Fri May 25 17:20:00 2012	(r236014)
@@ -15,7 +15,7 @@ MK_SSP=	no
 
 .include "${.CURDIR}/../../usr.bin/cc/Makefile.tgt"
 
-.if ${TARGET_CPUARCH} == "sparc64" || ${TARGET_CPUARCH} == "mips"
+.if ${TARGET_CPUARCH} == "mips"
 LIB=		gcc
 .endif
 

Modified: stable/9/lib/libcompiler_rt/Makefile
==============================================================================
--- stable/9/lib/libcompiler_rt/Makefile	Fri May 25 17:19:30 2012	(r236013)
+++ stable/9/lib/libcompiler_rt/Makefile	Fri May 25 17:20:00 2012	(r236014)
@@ -152,7 +152,7 @@ SRCS+=	${file}.c
 . endif
 .endfor
 
-.if ${MACHINE_CPUARCH} != "sparc64" && ${MACHINE_CPUARCH} != "mips"
+.if ${MACHINE_CPUARCH} != "mips"
 . if ${MK_INSTALLLIB} != "no"
 SYMLINKS+=libcompiler_rt.a ${LIBDIR}/libgcc.a
 . endif

From owner-svn-src-stable-9@FreeBSD.ORG  Fri May 25 17:47:17 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 39AA9106566B;
	Fri, 25 May 2012 17:47:17 +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 BFA1E8FC15;
	Fri, 25 May 2012 17:47:16 +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
	q4PHlFtq030300; Fri, 25 May 2012 19:47:15 +0200 (CEST)
	(envelope-from marius@alchemy.franken.de)
Received: (from marius@localhost)
	by alchemy.franken.de (8.14.4/8.14.4/Submit) id q4PHlFHF030299;
	Fri, 25 May 2012 19:47:15 +0200 (CEST) (envelope-from marius)
Date: Fri, 25 May 2012 19:47:15 +0200
From: Marius Strobl <marius@alchemy.franken.de>
To: Marius Strobl <marius@freebsd.org>
Message-ID: <20120525174715.GB12138@alchemy.franken.de>
References: <201205251714.q4PHEmgO023068@svn.freebsd.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <201205251714.q4PHEmgO023068@svn.freebsd.org>
User-Agent: Mutt/1.4.2.3i
Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org, svn-src-stable-9@freebsd.org
Subject: Re: svn commit: r236011 - in stable/9/contrib/compiler-rt: . lib
	lib/arm lib/ppc lib/x86_64
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 25 May 2012 17:47:17 -0000

On Fri, May 25, 2012 at 05:14:48PM +0000, Marius Strobl wrote:
> Author: marius
> Date: Fri May 25 17:14:47 2012
> New Revision: 236011
> URL: http://svn.freebsd.org/changeset/base/236011
> 
> Log:
>   MFC: r222656
>   
>   Upgrade libcompiler_rt from revision 117047 to 132478.
>   
>   It seems there have only been a small amount to the compiler-rt source
>   code in the mean time. I'd rather have the code in sync as much as
>   possible by the time we release 9.0. Changes:
>   
>   - The libcompiler_rt library is now dual licensed under both the
>     University of Illinois "BSD-Like" license and the MIT license.
>   
>   - Our local modifications for using .hidden instead of .private_extern
>     have been upstreamed, meaning our changes to lib/assembly.h can now be
>     reverted.
>   
>   - A possible endless recursion in __modsi3() has been fixed.
>   
>   - Support for ARM EABI has been added, but it has no effect on FreeBSD
>     (yet).
>   
>   - The functions __udivmodsi4 and __divmodsi4 have been added.
>   
>   Requested by:	many, including bf@ and Pedro Giffuni
> 

Oops, this should have read:

MFC: r229135

Upgrade libcompiler_rt to upstream revision 147390.

This version of libcompiler_rt adds support for __mulo[sdt]i4(), which
computes a multiply and its overflow flag. There are also a lot of
cleanup fixes to headers that don't really affect us.

Updating to this revision should make it a bit easier to contribute
changes back to the LLVM developers.

Marius


From owner-svn-src-stable-9@FreeBSD.ORG  Fri May 25 17:48:46 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 815431065674;
	Fri, 25 May 2012 17:48:46 +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 6B9D58FC18;
	Fri, 25 May 2012 17:48: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 q4PHmk3L024768;
	Fri, 25 May 2012 17:48:46 GMT (envelope-from marius@svn.freebsd.org)
Received: (from marius@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4PHmk2P024766;
	Fri, 25 May 2012 17:48:46 GMT (envelope-from marius@svn.freebsd.org)
Message-Id: <201205251748.q4PHmk2P024766@svn.freebsd.org>
From: Marius Strobl <marius@FreeBSD.org>
Date: Fri, 25 May 2012 17:48:46 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r236015 - stable/9/lib/libcompiler_rt
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 25 May 2012 17:48:46 -0000

Author: marius
Date: Fri May 25 17:48:45 2012
New Revision: 236015
URL: http://svn.freebsd.org/changeset/base/236015

Log:
  MFC: r229135
  
  Upgrade libcompiler_rt to upstream revision 147390.
  
  This version of libcompiler_rt adds support for __mulo[sdt]i4(), which
  computes a multiply and its overflow flag. There are also a lot of
  cleanup fixes to headers that don't really affect us.
  
  Updating to this revision should make it a bit easier to contribute
  changes back to the LLVM developers.

Modified:
  stable/9/lib/libcompiler_rt/Makefile
Directory Properties:
  stable/9/lib/libcompiler_rt/   (props changed)

Modified: stable/9/lib/libcompiler_rt/Makefile
==============================================================================
--- stable/9/lib/libcompiler_rt/Makefile	Fri May 25 17:20:00 2012	(r236014)
+++ stable/9/lib/libcompiler_rt/Makefile	Fri May 25 17:48:45 2012	(r236015)
@@ -79,12 +79,16 @@ SRCF=	absvdi2 \
 	floatuntidf \
 	floatuntisf \
 	floatuntixf \
+	int_util \
 	lshrdi3 \
 	lshrti3 \
 	moddi3 \
 	modti3 \
 	muldc3 \
 	muldi3 \
+	mulodi4 \
+	mulosi4 \
+	muloti4 \
 	mulsc3 \
 	multi3 \
 	mulvdi3 \

From owner-svn-src-stable-9@FreeBSD.ORG  Fri May 25 17:50:51 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 7F665106566C;
	Fri, 25 May 2012 17:50:51 +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 657FB8FC0C;
	Fri, 25 May 2012 17:50:51 +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 q4PHopFx024910;
	Fri, 25 May 2012 17:50:51 GMT (envelope-from marius@svn.freebsd.org)
Received: (from marius@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4PHop6g024892;
	Fri, 25 May 2012 17:50:51 GMT (envelope-from marius@svn.freebsd.org)
Message-Id: <201205251750.q4PHop6g024892@svn.freebsd.org>
From: Marius Strobl <marius@FreeBSD.org>
Date: Fri, 25 May 2012 17:50:51 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r236016 - stable/9/lib/libcompiler_rt
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 25 May 2012 17:50:51 -0000

Author: marius
Date: Fri May 25 17:50:50 2012
New Revision: 236016
URL: http://svn.freebsd.org/changeset/base/236016

Log:
  MFC: r228919
  
  Add locally implemented atomic intrinsics to libcompiler_rt.
  
  The built-in atomic operations are not implemented in our version of GCC
  4.2 for the ARM and MIPS architectures. Instead of emitting locked
  instructions, they generate calls to functions that can be implemented
  in the C runtime.
  
  Only implement the atomic operations that are used by <stdatomic.h> for
  datatype sizes that are supported by atomic(9). This means that on these
  architectures, we can only use atomic operations on 32-bits and 64-bits
  variables, which is typically sufficient.
  
  This makes <stdatomic.h> work on all architectures except MIPS, since
  MIPS still uses libgcc.

Added:
  stable/9/lib/libcompiler_rt/__sync_fetch_and_add_4.c
     - copied unchanged from r228919, head/lib/libcompiler_rt/__sync_fetch_and_add_4.c
  stable/9/lib/libcompiler_rt/__sync_fetch_and_add_8.c
     - copied unchanged from r228919, head/lib/libcompiler_rt/__sync_fetch_and_add_8.c
  stable/9/lib/libcompiler_rt/__sync_fetch_and_and_4.c
     - copied unchanged from r228919, head/lib/libcompiler_rt/__sync_fetch_and_and_4.c
  stable/9/lib/libcompiler_rt/__sync_fetch_and_and_8.c
     - copied unchanged from r228919, head/lib/libcompiler_rt/__sync_fetch_and_and_8.c
  stable/9/lib/libcompiler_rt/__sync_fetch_and_op_n.h
     - copied unchanged from r228919, head/lib/libcompiler_rt/__sync_fetch_and_op_n.h
  stable/9/lib/libcompiler_rt/__sync_fetch_and_or_4.c
     - copied unchanged from r228919, head/lib/libcompiler_rt/__sync_fetch_and_or_4.c
  stable/9/lib/libcompiler_rt/__sync_fetch_and_or_8.c
     - copied unchanged from r228919, head/lib/libcompiler_rt/__sync_fetch_and_or_8.c
  stable/9/lib/libcompiler_rt/__sync_fetch_and_sub_4.c
     - copied unchanged from r228919, head/lib/libcompiler_rt/__sync_fetch_and_sub_4.c
  stable/9/lib/libcompiler_rt/__sync_fetch_and_sub_8.c
     - copied unchanged from r228919, head/lib/libcompiler_rt/__sync_fetch_and_sub_8.c
  stable/9/lib/libcompiler_rt/__sync_fetch_and_xor_4.c
     - copied unchanged from r228919, head/lib/libcompiler_rt/__sync_fetch_and_xor_4.c
  stable/9/lib/libcompiler_rt/__sync_fetch_and_xor_8.c
     - copied unchanged from r228919, head/lib/libcompiler_rt/__sync_fetch_and_xor_8.c
  stable/9/lib/libcompiler_rt/__sync_lock_test_and_set_4.c
     - copied unchanged from r228919, head/lib/libcompiler_rt/__sync_lock_test_and_set_4.c
  stable/9/lib/libcompiler_rt/__sync_lock_test_and_set_8.c
     - copied unchanged from r228919, head/lib/libcompiler_rt/__sync_lock_test_and_set_8.c
  stable/9/lib/libcompiler_rt/__sync_val_compare_and_swap_4.c
     - copied unchanged from r228919, head/lib/libcompiler_rt/__sync_val_compare_and_swap_4.c
  stable/9/lib/libcompiler_rt/__sync_val_compare_and_swap_8.c
     - copied unchanged from r228919, head/lib/libcompiler_rt/__sync_val_compare_and_swap_8.c
  stable/9/lib/libcompiler_rt/__sync_val_compare_and_swap_n.h
     - copied unchanged from r228919, head/lib/libcompiler_rt/__sync_val_compare_and_swap_n.h
Modified:
  stable/9/lib/libcompiler_rt/Makefile
Directory Properties:
  stable/9/lib/libcompiler_rt/   (props changed)

Modified: stable/9/lib/libcompiler_rt/Makefile
==============================================================================
--- stable/9/lib/libcompiler_rt/Makefile	Fri May 25 17:48:45 2012	(r236015)
+++ stable/9/lib/libcompiler_rt/Makefile	Fri May 25 17:50:50 2012	(r236016)
@@ -148,6 +148,26 @@ SRCF+=	adddf3 \
 	umodsi3
 .endif
 
+# FreeBSD-specific atomic intrinsics.
+.if ${MACHINE_CPUARCH} == "arm" || ${MACHINE_CPUARCH} == "mips"
+SRCF+=	__sync_fetch_and_add_4 \
+	__sync_fetch_and_and_4 \
+	__sync_fetch_and_or_4 \
+	__sync_fetch_and_sub_4 \
+	__sync_fetch_and_xor_4 \
+	__sync_lock_test_and_set_4 \
+	__sync_val_compare_and_swap_4
+.endif
+.if ${MACHINE_ARCH:Mmips64*} != ""
+SRCF+=	__sync_fetch_and_add_8 \
+	__sync_fetch_and_and_8 \
+	__sync_fetch_and_or_8 \
+	__sync_fetch_and_sub_8 \
+	__sync_fetch_and_xor_8 \
+	__sync_lock_test_and_set_8 \
+	__sync_val_compare_and_swap_8
+.endif
+
 .for file in ${SRCF}
 . if ${MACHINE_CPUARCH} != "arm" && exists(${CRTSRC}/${CRTARCH}/${file}.S)
 SRCS+=	${file}.S

Copied: stable/9/lib/libcompiler_rt/__sync_fetch_and_add_4.c (from r228919, head/lib/libcompiler_rt/__sync_fetch_and_add_4.c)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ stable/9/lib/libcompiler_rt/__sync_fetch_and_add_4.c	Fri May 25 17:50:50 2012	(r236016, copy of r228919, head/lib/libcompiler_rt/__sync_fetch_and_add_4.c)
@@ -0,0 +1,6 @@
+/* $FreeBSD$ */
+#define	NAME		__sync_fetch_and_add_4
+#define	TYPE		uint32_t
+#define	FETCHADD(x, y)	atomic_fetchadd_32(x, y)
+
+#include "__sync_fetch_and_op_n.h"

Copied: stable/9/lib/libcompiler_rt/__sync_fetch_and_add_8.c (from r228919, head/lib/libcompiler_rt/__sync_fetch_and_add_8.c)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ stable/9/lib/libcompiler_rt/__sync_fetch_and_add_8.c	Fri May 25 17:50:50 2012	(r236016, copy of r228919, head/lib/libcompiler_rt/__sync_fetch_and_add_8.c)
@@ -0,0 +1,6 @@
+/* $FreeBSD$ */
+#define	NAME		__sync_fetch_and_add_8
+#define	TYPE		uint64_t
+#define	FETCHADD(x, y)	atomic_fetchadd_64(x, y)
+
+#include "__sync_fetch_and_op_n.h"

Copied: stable/9/lib/libcompiler_rt/__sync_fetch_and_and_4.c (from r228919, head/lib/libcompiler_rt/__sync_fetch_and_and_4.c)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ stable/9/lib/libcompiler_rt/__sync_fetch_and_and_4.c	Fri May 25 17:50:50 2012	(r236016, copy of r228919, head/lib/libcompiler_rt/__sync_fetch_and_and_4.c)
@@ -0,0 +1,7 @@
+/* $FreeBSD$ */
+#define	NAME		__sync_fetch_and_and_4
+#define	TYPE		uint32_t
+#define	CMPSET		atomic_cmpset_32
+#define	EXPRESSION	t & value
+
+#include "__sync_fetch_and_op_n.h"

Copied: stable/9/lib/libcompiler_rt/__sync_fetch_and_and_8.c (from r228919, head/lib/libcompiler_rt/__sync_fetch_and_and_8.c)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ stable/9/lib/libcompiler_rt/__sync_fetch_and_and_8.c	Fri May 25 17:50:50 2012	(r236016, copy of r228919, head/lib/libcompiler_rt/__sync_fetch_and_and_8.c)
@@ -0,0 +1,7 @@
+/* $FreeBSD$ */
+#define	NAME		__sync_fetch_and_and_8
+#define	TYPE		uint64_t
+#define	CMPSET		atomic_cmpset_64
+#define	EXPRESSION	t & value
+
+#include "__sync_fetch_and_op_n.h"

Copied: stable/9/lib/libcompiler_rt/__sync_fetch_and_op_n.h (from r228919, head/lib/libcompiler_rt/__sync_fetch_and_op_n.h)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ stable/9/lib/libcompiler_rt/__sync_fetch_and_op_n.h	Fri May 25 17:50:50 2012	(r236016, copy of r228919, head/lib/libcompiler_rt/__sync_fetch_and_op_n.h)
@@ -0,0 +1,47 @@
+/*-
+ * Copyright (c) 2011 Ed Schouten <ed@FreeBSD.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/types.h>
+#include <machine/atomic.h>
+
+TYPE
+NAME(volatile TYPE *ptr, TYPE value)
+{
+	TYPE t;
+
+#ifdef FETCHADD
+	t = FETCHADD(ptr, value);
+#else
+	do {
+		t = *ptr;
+	} while (!CMPSET(ptr, t, EXPRESSION));
+#endif
+
+	return (t);
+}

Copied: stable/9/lib/libcompiler_rt/__sync_fetch_and_or_4.c (from r228919, head/lib/libcompiler_rt/__sync_fetch_and_or_4.c)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ stable/9/lib/libcompiler_rt/__sync_fetch_and_or_4.c	Fri May 25 17:50:50 2012	(r236016, copy of r228919, head/lib/libcompiler_rt/__sync_fetch_and_or_4.c)
@@ -0,0 +1,7 @@
+/* $FreeBSD$ */
+#define	NAME		__sync_fetch_and_or_4
+#define	TYPE		uint32_t
+#define	CMPSET		atomic_cmpset_32
+#define	EXPRESSION	t | value
+
+#include "__sync_fetch_and_op_n.h"

Copied: stable/9/lib/libcompiler_rt/__sync_fetch_and_or_8.c (from r228919, head/lib/libcompiler_rt/__sync_fetch_and_or_8.c)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ stable/9/lib/libcompiler_rt/__sync_fetch_and_or_8.c	Fri May 25 17:50:50 2012	(r236016, copy of r228919, head/lib/libcompiler_rt/__sync_fetch_and_or_8.c)
@@ -0,0 +1,7 @@
+/* $FreeBSD$ */
+#define	NAME		__sync_fetch_and_or_8
+#define	TYPE		uint64_t
+#define	CMPSET		atomic_cmpset_64
+#define	EXPRESSION	t | value
+
+#include "__sync_fetch_and_op_n.h"

Copied: stable/9/lib/libcompiler_rt/__sync_fetch_and_sub_4.c (from r228919, head/lib/libcompiler_rt/__sync_fetch_and_sub_4.c)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ stable/9/lib/libcompiler_rt/__sync_fetch_and_sub_4.c	Fri May 25 17:50:50 2012	(r236016, copy of r228919, head/lib/libcompiler_rt/__sync_fetch_and_sub_4.c)
@@ -0,0 +1,6 @@
+/* $FreeBSD$ */
+#define	NAME		__sync_fetch_and_sub_4
+#define	TYPE		uint32_t
+#define	FETCHADD(x, y)	atomic_fetchadd_32(x, -(y))
+
+#include "__sync_fetch_and_op_n.h"

Copied: stable/9/lib/libcompiler_rt/__sync_fetch_and_sub_8.c (from r228919, head/lib/libcompiler_rt/__sync_fetch_and_sub_8.c)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ stable/9/lib/libcompiler_rt/__sync_fetch_and_sub_8.c	Fri May 25 17:50:50 2012	(r236016, copy of r228919, head/lib/libcompiler_rt/__sync_fetch_and_sub_8.c)
@@ -0,0 +1,6 @@
+/* $FreeBSD$ */
+#define	NAME		__sync_fetch_and_sub_8
+#define	TYPE		uint64_t
+#define	FETCHADD(x, y)	atomic_fetchadd_64(x, -(y))
+
+#include "__sync_fetch_and_op_n.h"

Copied: stable/9/lib/libcompiler_rt/__sync_fetch_and_xor_4.c (from r228919, head/lib/libcompiler_rt/__sync_fetch_and_xor_4.c)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ stable/9/lib/libcompiler_rt/__sync_fetch_and_xor_4.c	Fri May 25 17:50:50 2012	(r236016, copy of r228919, head/lib/libcompiler_rt/__sync_fetch_and_xor_4.c)
@@ -0,0 +1,7 @@
+/* $FreeBSD$ */
+#define	NAME		__sync_fetch_and_xor_4
+#define	TYPE		uint32_t
+#define	CMPSET		atomic_cmpset_32
+#define	EXPRESSION	t ^ value
+
+#include "__sync_fetch_and_op_n.h"

Copied: stable/9/lib/libcompiler_rt/__sync_fetch_and_xor_8.c (from r228919, head/lib/libcompiler_rt/__sync_fetch_and_xor_8.c)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ stable/9/lib/libcompiler_rt/__sync_fetch_and_xor_8.c	Fri May 25 17:50:50 2012	(r236016, copy of r228919, head/lib/libcompiler_rt/__sync_fetch_and_xor_8.c)
@@ -0,0 +1,7 @@
+/* $FreeBSD$ */
+#define	NAME		__sync_fetch_and_xor_8
+#define	TYPE		uint64_t
+#define	CMPSET		atomic_cmpset_64
+#define	EXPRESSION	t ^ value
+
+#include "__sync_fetch_and_op_n.h"

Copied: stable/9/lib/libcompiler_rt/__sync_lock_test_and_set_4.c (from r228919, head/lib/libcompiler_rt/__sync_lock_test_and_set_4.c)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ stable/9/lib/libcompiler_rt/__sync_lock_test_and_set_4.c	Fri May 25 17:50:50 2012	(r236016, copy of r228919, head/lib/libcompiler_rt/__sync_lock_test_and_set_4.c)
@@ -0,0 +1,7 @@
+/* $FreeBSD$ */
+#define	NAME		__sync_lock_test_and_set_4
+#define	TYPE		uint32_t
+#define	CMPSET		atomic_cmpset_32
+#define	EXPRESSION	value
+
+#include "__sync_fetch_and_op_n.h"

Copied: stable/9/lib/libcompiler_rt/__sync_lock_test_and_set_8.c (from r228919, head/lib/libcompiler_rt/__sync_lock_test_and_set_8.c)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ stable/9/lib/libcompiler_rt/__sync_lock_test_and_set_8.c	Fri May 25 17:50:50 2012	(r236016, copy of r228919, head/lib/libcompiler_rt/__sync_lock_test_and_set_8.c)
@@ -0,0 +1,7 @@
+/* $FreeBSD$ */
+#define	NAME		__sync_lock_test_and_set_8
+#define	TYPE		uint64_t
+#define	CMPSET		atomic_cmpset_64
+#define	EXPRESSION	value
+
+#include "__sync_fetch_and_op_n.h"

Copied: stable/9/lib/libcompiler_rt/__sync_val_compare_and_swap_4.c (from r228919, head/lib/libcompiler_rt/__sync_val_compare_and_swap_4.c)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ stable/9/lib/libcompiler_rt/__sync_val_compare_and_swap_4.c	Fri May 25 17:50:50 2012	(r236016, copy of r228919, head/lib/libcompiler_rt/__sync_val_compare_and_swap_4.c)
@@ -0,0 +1,6 @@
+/* $FreeBSD$ */
+#define	NAME		__sync_val_compare_and_swap_4
+#define	TYPE		uint32_t
+#define	CMPSET		atomic_cmpset_32
+
+#include "__sync_val_compare_and_swap_n.h"

Copied: stable/9/lib/libcompiler_rt/__sync_val_compare_and_swap_8.c (from r228919, head/lib/libcompiler_rt/__sync_val_compare_and_swap_8.c)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ stable/9/lib/libcompiler_rt/__sync_val_compare_and_swap_8.c	Fri May 25 17:50:50 2012	(r236016, copy of r228919, head/lib/libcompiler_rt/__sync_val_compare_and_swap_8.c)
@@ -0,0 +1,6 @@
+/* $FreeBSD$ */
+#define	NAME		__sync_val_compare_and_swap_8
+#define	TYPE		uint64_t
+#define	CMPSET		atomic_cmpset_64
+
+#include "__sync_val_compare_and_swap_n.h"

Copied: stable/9/lib/libcompiler_rt/__sync_val_compare_and_swap_n.h (from r228919, head/lib/libcompiler_rt/__sync_val_compare_and_swap_n.h)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ stable/9/lib/libcompiler_rt/__sync_val_compare_and_swap_n.h	Fri May 25 17:50:50 2012	(r236016, copy of r228919, head/lib/libcompiler_rt/__sync_val_compare_and_swap_n.h)
@@ -0,0 +1,45 @@
+/*-
+ * Copyright (c) 2011 Ed Schouten <ed@FreeBSD.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/types.h>
+#include <machine/atomic.h>
+
+TYPE
+NAME(volatile TYPE *ptr, TYPE oldval, TYPE newval)
+{
+	TYPE t;
+
+	while (!CMPSET(ptr, oldval, newval)) {
+		t = *ptr;
+		if (t != oldval)
+			return (t);
+	}
+
+	return (oldval);
+}

From owner-svn-src-stable-9@FreeBSD.ORG  Fri May 25 17:56:27 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id D7F31106566B;
	Fri, 25 May 2012 17:56:27 +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 C236E8FC0C;
	Fri, 25 May 2012 17:56: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 q4PHuRp5025225;
	Fri, 25 May 2012 17:56:27 GMT (envelope-from marius@svn.freebsd.org)
Received: (from marius@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4PHuRYX025222;
	Fri, 25 May 2012 17:56:27 GMT (envelope-from marius@svn.freebsd.org)
Message-Id: <201205251756.q4PHuRYX025222@svn.freebsd.org>
From: Marius Strobl <marius@FreeBSD.org>
Date: Fri, 25 May 2012 17:56:27 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r236018 - in stable/9/contrib/compiler-rt: . lib
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 25 May 2012 17:56:28 -0000

Author: marius
Date: Fri May 25 17:56:27 2012
New Revision: 236018
URL: http://svn.freebsd.org/changeset/base/236018

Log:
  MFC: r229413
  
  Import compiler-rt r147467.

Modified:
  stable/9/contrib/compiler-rt/LICENSE.TXT
  stable/9/contrib/compiler-rt/lib/trampoline_setup.c
Directory Properties:
  stable/9/contrib/compiler-rt/   (props changed)

Modified: stable/9/contrib/compiler-rt/LICENSE.TXT
==============================================================================
--- stable/9/contrib/compiler-rt/LICENSE.TXT	Fri May 25 17:53:57 2012	(r236017)
+++ stable/9/contrib/compiler-rt/LICENSE.TXT	Fri May 25 17:56:27 2012	(r236018)
@@ -14,7 +14,7 @@ Full text of the relevant licenses is in
 University of Illinois/NCSA
 Open Source License
 
-Copyright (c) 2009-2010 by the contributors listed in CREDITS.TXT
+Copyright (c) 2009-2012 by the contributors listed in CREDITS.TXT
 
 All rights reserved.
 
@@ -55,7 +55,7 @@ SOFTWARE.
 
 ==============================================================================
 
-Copyright (c) 2009-2010 by the contributors listed in CREDITS.TXT
+Copyright (c) 2009-2012 by the contributors listed in CREDITS.TXT
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated documentation files (the "Software"), to deal

Modified: stable/9/contrib/compiler-rt/lib/trampoline_setup.c
==============================================================================
--- stable/9/contrib/compiler-rt/lib/trampoline_setup.c	Fri May 25 17:53:57 2012	(r236017)
+++ stable/9/contrib/compiler-rt/lib/trampoline_setup.c	Fri May 25 17:56:27 2012	(r236018)
@@ -44,4 +44,4 @@ void __trampoline_setup(uint32_t* trampO
     /* clear instruction cache */
     __clear_cache(trampOnStack, &trampOnStack[10]);
 }
-#endif /* __ppc__ */
+#endif /* __ppc__ && !defined(__powerpc64__) */

From owner-svn-src-stable-9@FreeBSD.ORG  Fri May 25 19:56:40 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id F1918106566B;
	Fri, 25 May 2012 19:56:40 +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 DBCDE8FC0C;
	Fri, 25 May 2012 19:56: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 q4PJueq5030166;
	Fri, 25 May 2012 19:56:40 GMT (envelope-from marius@svn.freebsd.org)
Received: (from marius@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4PJue87030164;
	Fri, 25 May 2012 19:56:40 GMT (envelope-from marius@svn.freebsd.org)
Message-Id: <201205251956.q4PJue87030164@svn.freebsd.org>
From: Marius Strobl <marius@FreeBSD.org>
Date: Fri, 25 May 2012 19:56:40 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r236021 - stable/9/sys/netinet6
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 25 May 2012 19:56:41 -0000

Author: marius
Date: Fri May 25 19:56:40 2012
New Revision: 236021
URL: http://svn.freebsd.org/changeset/base/236021

Log:
  MFC: r235681
  
  Rewrite nd6_sysctl_{d,p}rlist() to avoid misaligned accesses to char arrays
  casted to structs by getting rid of these buffers entirely. In r169832, it
  was tried to paper over this issue by 32-bit aligning the buffers. Depending
  on compiler optimizations that still was insufficient for 64-bit architectures
  with strong alignment requirements though.
  While at it, add comments regarding the total lack of locking in this area.
  
  Tested by:	bz
  Reviewed by:	bz (slightly earlier version), yongari (earlier version)

Modified:
  stable/9/sys/netinet6/nd6.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/amd64/include/xen/   (props changed)
  stable/9/sys/boot/   (props changed)
  stable/9/sys/boot/i386/efi/   (props changed)
  stable/9/sys/boot/ia64/efi/   (props changed)
  stable/9/sys/boot/ia64/ski/   (props changed)
  stable/9/sys/boot/powerpc/boot1.chrp/   (props changed)
  stable/9/sys/boot/powerpc/ofw/   (props changed)
  stable/9/sys/cddl/contrib/opensolaris/   (props changed)
  stable/9/sys/conf/   (props changed)
  stable/9/sys/contrib/dev/acpica/   (props changed)
  stable/9/sys/contrib/octeon-sdk/   (props changed)
  stable/9/sys/contrib/pf/   (props changed)
  stable/9/sys/contrib/x86emu/   (props changed)
  stable/9/sys/dev/   (props changed)
  stable/9/sys/dev/e1000/   (props changed)
  stable/9/sys/dev/ixgbe/   (props changed)
  stable/9/sys/fs/   (props changed)
  stable/9/sys/fs/ntfs/   (props changed)
  stable/9/sys/modules/   (props changed)

Modified: stable/9/sys/netinet6/nd6.c
==============================================================================
--- stable/9/sys/netinet6/nd6.c	Fri May 25 19:45:01 2012	(r236020)
+++ stable/9/sys/netinet6/nd6.c	Fri May 25 19:56:40 2012	(r236021)
@@ -2275,128 +2275,101 @@ SYSCTL_VNET_INT(_net_inet6_icmp6, ICMPV6
 static int
 nd6_sysctl_drlist(SYSCTL_HANDLER_ARGS)
 {
-	int error;
-	char buf[1024] __aligned(4);
-	struct in6_defrouter *d, *de;
+	struct in6_defrouter d;
 	struct nd_defrouter *dr;
+	int error;
 
 	if (req->newptr)
-		return EPERM;
-	error = 0;
+		return (EPERM);
 
+	bzero(&d, sizeof(d));
+	d.rtaddr.sin6_family = AF_INET6;
+	d.rtaddr.sin6_len = sizeof(d.rtaddr);
+
+	/*
+	 * XXX locking
+	 */
 	TAILQ_FOREACH(dr, &V_nd_defrouter, dr_entry) {
-		d = (struct in6_defrouter *)buf;
-		de = (struct in6_defrouter *)(buf + sizeof(buf));
-
-		if (d + 1 <= de) {
-			bzero(d, sizeof(*d));
-			d->rtaddr.sin6_family = AF_INET6;
-			d->rtaddr.sin6_len = sizeof(d->rtaddr);
-			d->rtaddr.sin6_addr = dr->rtaddr;
-			error = sa6_recoverscope(&d->rtaddr);
-			if (error != 0)
-				return (error);
-			d->flags = dr->flags;
-			d->rtlifetime = dr->rtlifetime;
-			d->expire = dr->expire;
-			d->if_index = dr->ifp->if_index;
-		} else
-			panic("buffer too short");
-
-		error = SYSCTL_OUT(req, buf, sizeof(*d));
-		if (error)
-			break;
+		d.rtaddr.sin6_addr = dr->rtaddr;
+		error = sa6_recoverscope(&d.rtaddr);
+		if (error != 0)
+			return (error);
+		d.flags = dr->flags;
+		d.rtlifetime = dr->rtlifetime;
+		d.expire = dr->expire;
+		d.if_index = dr->ifp->if_index;
+		error = SYSCTL_OUT(req, &d, sizeof(d));
+		if (error != 0)
+			return (error);
 	}
-
-	return (error);
+	return (0);
 }
 
 static int
 nd6_sysctl_prlist(SYSCTL_HANDLER_ARGS)
 {
-	int error;
-	char buf[1024] __aligned(4);
-	struct in6_prefix *p, *pe;
+	struct in6_prefix p;
+	struct sockaddr_in6 s6;
 	struct nd_prefix *pr;
+	struct nd_pfxrouter *pfr;
+	time_t maxexpire;
+	int error;
 	char ip6buf[INET6_ADDRSTRLEN];
 
 	if (req->newptr)
-		return EPERM;
-	error = 0;
+		return (EPERM);
 
+	bzero(&p, sizeof(p));
+	p.origin = PR_ORIG_RA;
+	bzero(&s6, sizeof(s6));
+	s6.sin6_family = AF_INET6;
+	s6.sin6_len = sizeof(s6);
+
+	/*
+	 * XXX locking
+	 */
 	LIST_FOREACH(pr, &V_nd_prefix, ndpr_entry) {
-		u_short advrtrs;
-		size_t advance;
-		struct sockaddr_in6 *sin6, *s6;
-		struct nd_pfxrouter *pfr;
-
-		p = (struct in6_prefix *)buf;
-		pe = (struct in6_prefix *)(buf + sizeof(buf));
-
-		if (p + 1 <= pe) {
-			bzero(p, sizeof(*p));
-			sin6 = (struct sockaddr_in6 *)(p + 1);
-
-			p->prefix = pr->ndpr_prefix;
-			if (sa6_recoverscope(&p->prefix)) {
+		p.prefix = pr->ndpr_prefix;
+		if (sa6_recoverscope(&p.prefix)) {
+			log(LOG_ERR, "scope error in prefix list (%s)\n",
+			    ip6_sprintf(ip6buf, &p.prefix.sin6_addr));
+			/* XXX: press on... */
+		}
+		p.raflags = pr->ndpr_raf;
+		p.prefixlen = pr->ndpr_plen;
+		p.vltime = pr->ndpr_vltime;
+		p.pltime = pr->ndpr_pltime;
+		p.if_index = pr->ndpr_ifp->if_index;
+		if (pr->ndpr_vltime == ND6_INFINITE_LIFETIME)
+			p.expire = 0;
+		else {
+			/* XXX: we assume time_t is signed. */
+			maxexpire = (-1) &
+			    ~((time_t)1 << ((sizeof(maxexpire) * 8) - 1));
+			if (pr->ndpr_vltime < maxexpire - pr->ndpr_lastupdate)
+				p.expire = pr->ndpr_lastupdate +
+				    pr->ndpr_vltime;
+			else
+				p.expire = maxexpire;
+		}
+		p.refcnt = pr->ndpr_refcnt;
+		p.flags = pr->ndpr_stateflags;
+		p.advrtrs = 0;
+		LIST_FOREACH(pfr, &pr->ndpr_advrtrs, pfr_entry)
+			p.advrtrs++;
+		error = SYSCTL_OUT(req, &p, sizeof(p));
+		if (error != 0)
+			return (error);
+		LIST_FOREACH(pfr, &pr->ndpr_advrtrs, pfr_entry) {
+			s6.sin6_addr = pfr->router->rtaddr;
+			if (sa6_recoverscope(&s6))
 				log(LOG_ERR,
 				    "scope error in prefix list (%s)\n",
-				    ip6_sprintf(ip6buf, &p->prefix.sin6_addr));
-				/* XXX: press on... */
-			}
-			p->raflags = pr->ndpr_raf;
-			p->prefixlen = pr->ndpr_plen;
-			p->vltime = pr->ndpr_vltime;
-			p->pltime = pr->ndpr_pltime;
-			p->if_index = pr->ndpr_ifp->if_index;
-			if (pr->ndpr_vltime == ND6_INFINITE_LIFETIME)
-				p->expire = 0;
-			else {
-				time_t maxexpire;
-
-				/* XXX: we assume time_t is signed. */
-				maxexpire = (-1) &
-				    ~((time_t)1 <<
-				    ((sizeof(maxexpire) * 8) - 1));
-				if (pr->ndpr_vltime <
-				    maxexpire - pr->ndpr_lastupdate) {
-				    p->expire = pr->ndpr_lastupdate +
-				        pr->ndpr_vltime;
-				} else
-					p->expire = maxexpire;
-			}
-			p->refcnt = pr->ndpr_refcnt;
-			p->flags = pr->ndpr_stateflags;
-			p->origin = PR_ORIG_RA;
-			advrtrs = 0;
-			LIST_FOREACH(pfr, &pr->ndpr_advrtrs, pfr_entry) {
-				if ((void *)&sin6[advrtrs + 1] > (void *)pe) {
-					advrtrs++;
-					continue;
-				}
-				s6 = &sin6[advrtrs];
-				bzero(s6, sizeof(*s6));
-				s6->sin6_family = AF_INET6;
-				s6->sin6_len = sizeof(*sin6);
-				s6->sin6_addr = pfr->router->rtaddr;
-				if (sa6_recoverscope(s6)) {
-					log(LOG_ERR,
-					    "scope error in "
-					    "prefix list (%s)\n",
-					    ip6_sprintf(ip6buf,
-						    &pfr->router->rtaddr));
-				}
-				advrtrs++;
-			}
-			p->advrtrs = advrtrs;
-		} else
-			panic("buffer too short");
-
-		advance = sizeof(*p) + sizeof(*sin6) * advrtrs;
-		error = SYSCTL_OUT(req, buf, advance);
-		if (error)
-			break;
+				    ip6_sprintf(ip6buf, &pfr->router->rtaddr));
+			error = SYSCTL_OUT(req, &s6, sizeof(s6));
+			if (error != 0)
+				return (error);
+		}
 	}
-
-	return (error);
+	return (0);
 }

From owner-svn-src-stable-9@FreeBSD.ORG  Sat May 26 07:34:46 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id B66E9106566C;
	Sat, 26 May 2012 07:34:46 +0000 (UTC)
	(envelope-from thompsa@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 969538FC12;
	Sat, 26 May 2012 07:34: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 q4Q7YkF5059577;
	Sat, 26 May 2012 07:34:46 GMT (envelope-from thompsa@svn.freebsd.org)
Received: (from thompsa@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4Q7YkAU059573;
	Sat, 26 May 2012 07:34:46 GMT (envelope-from thompsa@svn.freebsd.org)
Message-Id: <201205260734.q4Q7YkAU059573@svn.freebsd.org>
From: Andrew Thompson <thompsa@FreeBSD.org>
Date: Sat, 26 May 2012 07:34:46 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r236047 - stable/9/sys/net
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sat, 26 May 2012 07:34:46 -0000

Author: thompsa
Date: Sat May 26 07:34:46 2012
New Revision: 236047
URL: http://svn.freebsd.org/changeset/base/236047

Log:
  MFC r232014,r232030,r232070
  
  - bstp_input() always consumes the packet so remove the mbuf handling dance
    around it.
  - Now that network interfaces advertise if they support linkstate notifications
    we do not need to perform a media ioctl every 15 seconds.
  - Indicate this function decrements the timer as well as testing for expiry.

Modified:
  stable/9/sys/net/bridgestp.c
  stable/9/sys/net/bridgestp.h
  stable/9/sys/net/if_bridge.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/amd64/include/xen/   (props changed)
  stable/9/sys/boot/   (props changed)
  stable/9/sys/boot/i386/efi/   (props changed)
  stable/9/sys/boot/ia64/efi/   (props changed)
  stable/9/sys/boot/ia64/ski/   (props changed)
  stable/9/sys/boot/powerpc/boot1.chrp/   (props changed)
  stable/9/sys/boot/powerpc/ofw/   (props changed)
  stable/9/sys/cddl/contrib/opensolaris/   (props changed)
  stable/9/sys/conf/   (props changed)
  stable/9/sys/contrib/dev/acpica/   (props changed)
  stable/9/sys/contrib/octeon-sdk/   (props changed)
  stable/9/sys/contrib/pf/   (props changed)
  stable/9/sys/contrib/x86emu/   (props changed)
  stable/9/sys/dev/   (props changed)
  stable/9/sys/dev/e1000/   (props changed)
  stable/9/sys/dev/ixgbe/   (props changed)
  stable/9/sys/fs/   (props changed)
  stable/9/sys/fs/ntfs/   (props changed)
  stable/9/sys/modules/   (props changed)

Modified: stable/9/sys/net/bridgestp.c
==============================================================================
--- stable/9/sys/net/bridgestp.c	Sat May 26 06:31:54 2012	(r236046)
+++ stable/9/sys/net/bridgestp.c	Sat May 26 07:34:46 2012	(r236047)
@@ -134,7 +134,7 @@ static void	bstp_tick(void *);
 static void	bstp_timer_start(struct bstp_timer *, uint16_t);
 static void	bstp_timer_stop(struct bstp_timer *);
 static void	bstp_timer_latch(struct bstp_timer *);
-static int	bstp_timer_expired(struct bstp_timer *);
+static int	bstp_timer_dectest(struct bstp_timer *);
 static void	bstp_hello_timer_expiry(struct bstp_state *,
 		    struct bstp_port *);
 static void	bstp_message_age_expiry(struct bstp_state *,
@@ -446,7 +446,7 @@ bstp_pdu_flags(struct bstp_port *bp)
 	return (flags);
 }
 
-struct mbuf *
+void
 bstp_input(struct bstp_port *bp, struct ifnet *ifp, struct mbuf *m)
 {
 	struct bstp_state *bs = bp->bp_bs;
@@ -456,7 +456,7 @@ bstp_input(struct bstp_port *bp, struct 
 
 	if (bp->bp_active == 0) {
 		m_freem(m);
-		return (NULL);
+		return;
 	}
 
 	BSTP_LOCK(bs);
@@ -521,7 +521,6 @@ out:
 	BSTP_UNLOCK(bs);
 	if (m)
 		m_freem(m);
-	return (NULL);
 }
 
 static void
@@ -1862,30 +1861,32 @@ bstp_tick(void *arg)
 
 	CURVNET_SET(bs->bs_vnet);
 
-	/* slow timer to catch missed link events */
-	if (bstp_timer_expired(&bs->bs_link_timer)) {
-		LIST_FOREACH(bp, &bs->bs_bplist, bp_next)
-			bstp_ifupdstatus(bs, bp);
+	/* poll link events on interfaces that do not support linkstate */
+	if (bstp_timer_dectest(&bs->bs_link_timer)) {
+		LIST_FOREACH(bp, &bs->bs_bplist, bp_next) {
+			if (!(bp->bp_ifp->if_capabilities & IFCAP_LINKSTATE))
+				bstp_ifupdstatus(bs, bp);
+		}
 		bstp_timer_start(&bs->bs_link_timer, BSTP_LINK_TIMER);
 	}
 
 	LIST_FOREACH(bp, &bs->bs_bplist, bp_next) {
 		/* no events need to happen for these */
-		bstp_timer_expired(&bp->bp_tc_timer);
-		bstp_timer_expired(&bp->bp_recent_root_timer);
-		bstp_timer_expired(&bp->bp_forward_delay_timer);
-		bstp_timer_expired(&bp->bp_recent_backup_timer);
+		bstp_timer_dectest(&bp->bp_tc_timer);
+		bstp_timer_dectest(&bp->bp_recent_root_timer);
+		bstp_timer_dectest(&bp->bp_forward_delay_timer);
+		bstp_timer_dectest(&bp->bp_recent_backup_timer);
 
-		if (bstp_timer_expired(&bp->bp_hello_timer))
+		if (bstp_timer_dectest(&bp->bp_hello_timer))
 			bstp_hello_timer_expiry(bs, bp);
 
-		if (bstp_timer_expired(&bp->bp_message_age_timer))
+		if (bstp_timer_dectest(&bp->bp_message_age_timer))
 			bstp_message_age_expiry(bs, bp);
 
-		if (bstp_timer_expired(&bp->bp_migrate_delay_timer))
+		if (bstp_timer_dectest(&bp->bp_migrate_delay_timer))
 			bstp_migrate_delay_expiry(bs, bp);
 
-		if (bstp_timer_expired(&bp->bp_edge_delay_timer))
+		if (bstp_timer_dectest(&bp->bp_edge_delay_timer))
 			bstp_edge_delay_expiry(bs, bp);
 
 		/* update the various state machines for the port */
@@ -1924,7 +1925,7 @@ bstp_timer_latch(struct bstp_timer *t)
 }
 
 static int
-bstp_timer_expired(struct bstp_timer *t)
+bstp_timer_dectest(struct bstp_timer *t)
 {
 	if (t->active == 0 || t->latched)
 		return (0);

Modified: stable/9/sys/net/bridgestp.h
==============================================================================
--- stable/9/sys/net/bridgestp.h	Sat May 26 06:31:54 2012	(r236046)
+++ stable/9/sys/net/bridgestp.h	Sat May 26 07:34:46 2012	(r236047)
@@ -392,6 +392,6 @@ int	bstp_set_edge(struct bstp_port *, in
 int	bstp_set_autoedge(struct bstp_port *, int);
 int	bstp_set_ptp(struct bstp_port *, int);
 int	bstp_set_autoptp(struct bstp_port *, int);
-struct mbuf *bstp_input(struct bstp_port *, struct ifnet *, struct mbuf *);
+void	bstp_input(struct bstp_port *, struct ifnet *, struct mbuf *);
 
 #endif /* _KERNEL */

Modified: stable/9/sys/net/if_bridge.c
==============================================================================
--- stable/9/sys/net/if_bridge.c	Sat May 26 06:31:54 2012	(r236046)
+++ stable/9/sys/net/if_bridge.c	Sat May 26 07:34:46 2012	(r236047)
@@ -2208,11 +2208,9 @@ bridge_input(struct ifnet *ifp, struct m
 		/* Tap off 802.1D packets; they do not get forwarded. */
 		if (memcmp(eh->ether_dhost, bstp_etheraddr,
 		    ETHER_ADDR_LEN) == 0) {
-			m = bstp_input(&bif->bif_stp, ifp, m);
-			if (m == NULL) {
-				BRIDGE_UNLOCK(sc);
-				return (NULL);
-			}
+			bstp_input(&bif->bif_stp, ifp, m); /* consumes mbuf */
+			BRIDGE_UNLOCK(sc);
+			return (NULL);
 		}
 
 		if ((bif->bif_flags & IFBIF_STP) &&

From owner-svn-src-stable-9@FreeBSD.ORG  Sat May 26 07:35:45 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 51881106564A;
	Sat, 26 May 2012 07:35:45 +0000 (UTC)
	(envelope-from thompsa@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 3BCEC8FC17;
	Sat, 26 May 2012 07:35: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 q4Q7ZjJR059652;
	Sat, 26 May 2012 07:35:45 GMT (envelope-from thompsa@svn.freebsd.org)
Received: (from thompsa@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4Q7ZjtV059650;
	Sat, 26 May 2012 07:35:45 GMT (envelope-from thompsa@svn.freebsd.org)
Message-Id: <201205260735.q4Q7ZjtV059650@svn.freebsd.org>
From: Andrew Thompson <thompsa@FreeBSD.org>
Date: Sat, 26 May 2012 07:35:45 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r236048 - stable/9/sys/net
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sat, 26 May 2012 07:35:45 -0000

Author: thompsa
Date: Sat May 26 07:35:44 2012
New Revision: 236048
URL: http://svn.freebsd.org/changeset/base/236048

Log:
  MFC r232118
  
   Only look for a usable MAC address for the bridge ID from ports within our
   bridge, this allows us to have more than one independent bridge in the same
   STP domain.
  
  PR:		kern/164369
  Submitted by:	Nikos Vassiliadis (earlier version)

Modified:
  stable/9/sys/net/bridgestp.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/amd64/include/xen/   (props changed)
  stable/9/sys/boot/   (props changed)
  stable/9/sys/boot/i386/efi/   (props changed)
  stable/9/sys/boot/ia64/efi/   (props changed)
  stable/9/sys/boot/ia64/ski/   (props changed)
  stable/9/sys/boot/powerpc/boot1.chrp/   (props changed)
  stable/9/sys/boot/powerpc/ofw/   (props changed)
  stable/9/sys/cddl/contrib/opensolaris/   (props changed)
  stable/9/sys/conf/   (props changed)
  stable/9/sys/contrib/dev/acpica/   (props changed)
  stable/9/sys/contrib/octeon-sdk/   (props changed)
  stable/9/sys/contrib/pf/   (props changed)
  stable/9/sys/contrib/x86emu/   (props changed)
  stable/9/sys/dev/   (props changed)
  stable/9/sys/dev/e1000/   (props changed)
  stable/9/sys/dev/ixgbe/   (props changed)
  stable/9/sys/fs/   (props changed)
  stable/9/sys/fs/ntfs/   (props changed)
  stable/9/sys/modules/   (props changed)

Modified: stable/9/sys/net/bridgestp.c
==============================================================================
--- stable/9/sys/net/bridgestp.c	Sat May 26 07:34:46 2012	(r236047)
+++ stable/9/sys/net/bridgestp.c	Sat May 26 07:35:44 2012	(r236048)
@@ -2013,24 +2013,33 @@ bstp_reinit(struct bstp_state *bs)
 	struct bstp_port *bp;
 	struct ifnet *ifp, *mif;
 	u_char *e_addr;
+	void *bridgeptr;
 	static const u_char llzero[ETHER_ADDR_LEN];	/* 00:00:00:00:00:00 */
 
 	BSTP_LOCK_ASSERT(bs);
 
+	if (LIST_EMPTY(&bs->bs_bplist))
+		goto disablestp;
+
 	mif = NULL;
+	bridgeptr = LIST_FIRST(&bs->bs_bplist)->bp_ifp->if_bridge;
+	KASSERT(bridgeptr != NULL, ("Invalid bridge pointer"));
 	/*
 	 * Search through the Ethernet adapters and find the one with the
-	 * lowest value. The adapter which we take the MAC address from does
-	 * not need to be part of the bridge, it just needs to be a unique
-	 * value.
+	 * lowest value. Make sure the adapter which we take the MAC address
+	 * from is part of this bridge, so we can have more than one independent
+	 * bridges in the same STP domain.
 	 */
 	IFNET_RLOCK_NOSLEEP();
 	TAILQ_FOREACH(ifp, &V_ifnet, if_link) {
 		if (ifp->if_type != IFT_ETHER)
-			continue;
+			continue;	/* Not Ethernet */
+
+		if (ifp->if_bridge != bridgeptr)
+			continue;	/* Not part of our bridge */
 
 		if (bstp_addr_cmp(IF_LLADDR(ifp), llzero) == 0)
-			continue;
+			continue;	/* No mac address set */
 
 		if (mif == NULL) {
 			mif = ifp;
@@ -2042,21 +2051,8 @@ bstp_reinit(struct bstp_state *bs)
 		}
 	}
 	IFNET_RUNLOCK_NOSLEEP();
-
-	if (LIST_EMPTY(&bs->bs_bplist) || mif == NULL) {
-		/* Set the bridge and root id (lower bits) to zero */
-		bs->bs_bridge_pv.pv_dbridge_id =
-		    ((uint64_t)bs->bs_bridge_priority) << 48;
-		bs->bs_bridge_pv.pv_root_id = bs->bs_bridge_pv.pv_dbridge_id;
-		bs->bs_root_pv = bs->bs_bridge_pv;
-		/* Disable any remaining ports, they will have no MAC address */
-		LIST_FOREACH(bp, &bs->bs_bplist, bp_next) {
-			bp->bp_infois = BSTP_INFO_DISABLED;
-			bstp_set_port_role(bp, BSTP_ROLE_DISABLED);
-		}
-		callout_stop(&bs->bs_bstpcallout);
-		return;
-	}
+	if (mif == NULL)
+		goto disablestp;
 
 	e_addr = IF_LLADDR(mif);
 	bs->bs_bridge_pv.pv_dbridge_id =
@@ -2084,6 +2080,20 @@ bstp_reinit(struct bstp_state *bs)
 
 	bstp_assign_roles(bs);
 	bstp_timer_start(&bs->bs_link_timer, BSTP_LINK_TIMER);
+	return;
+
+disablestp:
+	/* Set the bridge and root id (lower bits) to zero */
+	bs->bs_bridge_pv.pv_dbridge_id =
+	    ((uint64_t)bs->bs_bridge_priority) << 48;
+	bs->bs_bridge_pv.pv_root_id = bs->bs_bridge_pv.pv_dbridge_id;
+	bs->bs_root_pv = bs->bs_bridge_pv;
+	/* Disable any remaining ports, they will have no MAC address */
+	LIST_FOREACH(bp, &bs->bs_bplist, bp_next) {
+		bp->bp_infois = BSTP_INFO_DISABLED;
+		bstp_set_port_role(bp, BSTP_ROLE_DISABLED);
+	}
+	callout_stop(&bs->bs_bstpcallout);
 }
 
 static int

From owner-svn-src-stable-9@FreeBSD.ORG  Sat May 26 07:39:53 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 8F5F7106564A;
	Sat, 26 May 2012 07:39:53 +0000 (UTC)
	(envelope-from thompsa@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 7899A8FC08;
	Sat, 26 May 2012 07:39: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 q4Q7drrJ059856;
	Sat, 26 May 2012 07:39:53 GMT (envelope-from thompsa@svn.freebsd.org)
Received: (from thompsa@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4Q7drYM059850;
	Sat, 26 May 2012 07:39:53 GMT (envelope-from thompsa@svn.freebsd.org)
Message-Id: <201205260739.q4Q7drYM059850@svn.freebsd.org>
From: Andrew Thompson <thompsa@FreeBSD.org>
Date: Sat, 26 May 2012 07:39:53 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r236049 - in stable/9: sbin/ifconfig sys/net
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sat, 26 May 2012 07:39:53 -0000

Author: thompsa
Date: Sat May 26 07:39:52 2012
New Revision: 236049
URL: http://svn.freebsd.org/changeset/base/236049

Log:
  MFC r232629,r232640
  
   Add the ability to set which packet layers are used for the load balance hash
   calculation.

Modified:
  stable/9/sbin/ifconfig/ifconfig.8
  stable/9/sbin/ifconfig/iflagg.c
  stable/9/sys/net/ieee8023ad_lacp.c
  stable/9/sys/net/if_lagg.c
  stable/9/sys/net/if_lagg.h
Directory Properties:
  stable/9/sbin/ifconfig/   (props changed)
  stable/9/sys/   (props changed)
  stable/9/sys/amd64/include/xen/   (props changed)
  stable/9/sys/boot/   (props changed)
  stable/9/sys/boot/i386/efi/   (props changed)
  stable/9/sys/boot/ia64/efi/   (props changed)
  stable/9/sys/boot/ia64/ski/   (props changed)
  stable/9/sys/boot/powerpc/boot1.chrp/   (props changed)
  stable/9/sys/boot/powerpc/ofw/   (props changed)
  stable/9/sys/cddl/contrib/opensolaris/   (props changed)
  stable/9/sys/conf/   (props changed)
  stable/9/sys/contrib/dev/acpica/   (props changed)
  stable/9/sys/contrib/octeon-sdk/   (props changed)
  stable/9/sys/contrib/pf/   (props changed)
  stable/9/sys/contrib/x86emu/   (props changed)
  stable/9/sys/dev/   (props changed)
  stable/9/sys/dev/e1000/   (props changed)
  stable/9/sys/dev/ixgbe/   (props changed)
  stable/9/sys/fs/   (props changed)
  stable/9/sys/fs/ntfs/   (props changed)
  stable/9/sys/modules/   (props changed)

Modified: stable/9/sbin/ifconfig/ifconfig.8
==============================================================================
--- stable/9/sbin/ifconfig/ifconfig.8	Sat May 26 07:35:44 2012	(r236048)
+++ stable/9/sbin/ifconfig/ifconfig.8	Sat May 26 07:39:52 2012	(r236049)
@@ -2277,6 +2277,21 @@ Set the aggregation protocol.
 The default is failover.
 The available options are failover, fec, lacp, loadbalance, roundrobin and
 none.
+.It Cm lagghash Ar option Ns Oo , Ns Ar option Oc
+Set the packet layers to hash for aggregation protocols which load balance.
+The default is
+.Dq l2,l3,l4 .
+The options can be combined using commas.
+.Pp
+.Bl -tag -width ".Cm l2" -compact
+.It Cm l2
+src/dst mac address and optional vlan number.
+.It Cm l3
+src/dst address for IPv4 or IPv6.
+.It Cm l4
+src/dst port for TCP/UCP/SCTP.
+.El
+.Pp
 .El
 .Pp
 The following parameters are specific to IP tunnel interfaces,

Modified: stable/9/sbin/ifconfig/iflagg.c
==============================================================================
--- stable/9/sbin/ifconfig/iflagg.c	Sat May 26 07:35:44 2012	(r236048)
+++ stable/9/sbin/ifconfig/iflagg.c	Sat May 26 07:39:52 2012	(r236049)
@@ -81,6 +81,36 @@ setlaggproto(const char *val, int d, int
 		err(1, "SIOCSLAGG");
 }
 
+static void
+setlagghash(const char *val, int d, int s, const struct afswtch *afp)
+{
+	struct lagg_reqflags rf;
+	char *str, *tmp, *tok;
+
+
+	rf.rf_flags = 0;
+	str = tmp = strdup(val);
+	while ((tok = strsep(&tmp, ",")) != NULL) {
+		if (strcmp(tok, "l2") == 0)
+			rf.rf_flags |= LAGG_F_HASHL2;
+		else if (strcmp(tok, "l3") == 0)
+			rf.rf_flags |= LAGG_F_HASHL3;
+		else if (strcmp(tok, "l4") == 0)
+			rf.rf_flags |= LAGG_F_HASHL4;
+		else  {
+			free(str);
+			errx(1, "Invalid lagghash option: %s", tok);
+		}
+	}
+	free(str);
+	if (rf.rf_flags == 0)
+		errx(1, "No lagghash options supplied");
+
+	strlcpy(rf.rf_ifname, name, sizeof(rf.rf_ifname));
+	if (ioctl(s, SIOCSLAGGHASH, &rf))
+		err(1, "SIOCSLAGGHASH");
+}
+
 static char *
 lacp_format_mac(const uint8_t *mac, char *buf, size_t buflen)
 {
@@ -115,6 +145,7 @@ lagg_status(int s)
 	struct lagg_protos lpr[] = LAGG_PROTOS;
 	struct lagg_reqport rp, rpbuf[LAGG_MAX_PORTS];
 	struct lagg_reqall ra;
+	struct lagg_reqflags rf;
 	struct lacp_opreq *lp;
 	const char *proto = "<unknown>";
 	int i, isport = 0;
@@ -132,6 +163,10 @@ lagg_status(int s)
 	ra.ra_size = sizeof(rpbuf);
 	ra.ra_port = rpbuf;
 
+	strlcpy(rf.rf_ifname, name, sizeof(rf.rf_ifname));
+	if (ioctl(s, SIOCGLAGGFLAGS, &rf) != 0)
+		rf.rf_flags = 0;
+
 	if (ioctl(s, SIOCGLAGG, &ra) == 0) {
 		lp = (struct lacp_opreq *)&ra.ra_lacpreq;
 
@@ -143,6 +178,23 @@ lagg_status(int s)
 		}
 
 		printf("\tlaggproto %s", proto);
+		if (rf.rf_flags & LAGG_F_HASHMASK) {
+			const char *sep = "";
+
+			printf(" lagghash ");
+			if (rf.rf_flags & LAGG_F_HASHL2) {
+				printf("%sl2", sep);
+				sep = ",";
+			}
+			if (rf.rf_flags & LAGG_F_HASHL3) {
+				printf("%sl3", sep);
+				sep = ",";
+			}
+			if (rf.rf_flags & LAGG_F_HASHL4) {
+				printf("%sl4", sep);
+				sep = ",";
+			}
+		}
 		if (isport)
 			printf(" laggdev %s", rp.rp_ifname);
 		putchar('\n');
@@ -174,6 +226,7 @@ static struct cmd lagg_cmds[] = {
 	DEF_CMD_ARG("laggport",		setlaggport),
 	DEF_CMD_ARG("-laggport",	unsetlaggport),
 	DEF_CMD_ARG("laggproto",	setlaggproto),
+	DEF_CMD_ARG("lagghash",		setlagghash),
 };
 static struct afswtch af_lagg = {
 	.af_name	= "af_lagg",

Modified: stable/9/sys/net/ieee8023ad_lacp.c
==============================================================================
--- stable/9/sys/net/ieee8023ad_lacp.c	Sat May 26 07:35:44 2012	(r236048)
+++ stable/9/sys/net/ieee8023ad_lacp.c	Sat May 26 07:39:52 2012	(r236049)
@@ -815,7 +815,7 @@ lacp_select_tx_port(struct lagg_softc *s
 	if (sc->use_flowid && (m->m_flags & M_FLOWID))
 		hash = m->m_pkthdr.flowid;
 	else
-		hash = lagg_hashmbuf(m, lsc->lsc_hashkey);
+		hash = lagg_hashmbuf(sc, m, lsc->lsc_hashkey);
 	hash %= pm->pm_count;
 	lp = pm->pm_map[hash];
 

Modified: stable/9/sys/net/if_lagg.c
==============================================================================
--- stable/9/sys/net/if_lagg.c	Sat May 26 07:35:44 2012	(r236048)
+++ stable/9/sys/net/if_lagg.c	Sat May 26 07:39:52 2012	(r236049)
@@ -284,6 +284,8 @@ lagg_clone_create(struct if_clone *ifc, 
 	SYSCTL_ADD_INT(&sc->ctx, SYSCTL_CHILDREN(oid), OID_AUTO,
 		"use_flowid", CTLTYPE_INT|CTLFLAG_RW, &sc->use_flowid, sc->use_flowid,
 		"Use flow id for load sharing");
+	/* Hash all layers by default */
+	sc->sc_flags = LAGG_F_HASHL2|LAGG_F_HASHL3|LAGG_F_HASHL4;
 
 	sc->sc_proto = LAGG_PROTO_NONE;
 	for (i = 0; lagg_protos[i].ti_proto != LAGG_PROTO_NONE; i++) {
@@ -895,6 +897,7 @@ lagg_ioctl(struct ifnet *ifp, u_long cmd
 	struct lagg_softc *sc = (struct lagg_softc *)ifp->if_softc;
 	struct lagg_reqall *ra = (struct lagg_reqall *)data;
 	struct lagg_reqport *rp = (struct lagg_reqport *)data, rpbuf;
+	struct lagg_reqflags *rf = (struct lagg_reqflags *)data;
 	struct ifreq *ifr = (struct ifreq *)data;
 	struct lagg_port *lp;
 	struct ifnet *tpif;
@@ -984,6 +987,22 @@ lagg_ioctl(struct ifnet *ifp, u_long cmd
 		}
 		error = EPROTONOSUPPORT;
 		break;
+	case SIOCGLAGGFLAGS:
+		rf->rf_flags = sc->sc_flags;
+		break;
+	case SIOCSLAGGHASH:
+		error = priv_check(td, PRIV_NET_LAGG);
+		if (error)
+			break;
+		if ((rf->rf_flags & LAGG_F_HASHMASK) == 0) {
+			error = EINVAL;
+			break;
+		}
+		LAGG_WLOCK(sc);
+		sc->sc_flags &= ~LAGG_F_HASHMASK;
+		sc->sc_flags |= rf->rf_flags & LAGG_F_HASHMASK;
+		LAGG_WUNLOCK(sc);
+		break;
 	case SIOCGLAGGPORT:
 		if (rp->rp_portname[0] == '\0' ||
 		    (tpif = ifunit(rp->rp_portname)) == NULL) {
@@ -1413,42 +1432,55 @@ lagg_gethdr(struct mbuf *m, u_int off, u
 }
 
 uint32_t
-lagg_hashmbuf(struct mbuf *m, uint32_t key)
+lagg_hashmbuf(struct lagg_softc *sc, struct mbuf *m, uint32_t key)
 {
 	uint16_t etype;
-	uint32_t p = 0;
+	uint32_t p = key;
 	int off;
 	struct ether_header *eh;
-	struct ether_vlan_header vlanbuf;
 	const struct ether_vlan_header *vlan;
 #ifdef INET
 	const struct ip *ip;
-	struct ip ipbuf;
+	const uint32_t *ports;
+	int iphlen;
 #endif
 #ifdef INET6
 	const struct ip6_hdr *ip6;
-	struct ip6_hdr ip6buf;
 	uint32_t flow;
 #endif
+	union {
+#ifdef INET
+		struct ip ip;
+#endif
+#ifdef INET6
+		struct ip6_hdr ip6;
+#endif
+		struct ether_vlan_header vlan;
+		uint32_t port;
+	} buf;
+
 
 	off = sizeof(*eh);
 	if (m->m_len < off)
 		goto out;
 	eh = mtod(m, struct ether_header *);
 	etype = ntohs(eh->ether_type);
-	p = hash32_buf(&eh->ether_shost, ETHER_ADDR_LEN, key);
-	p = hash32_buf(&eh->ether_dhost, ETHER_ADDR_LEN, p);
+	if (sc->sc_flags & LAGG_F_HASHL2) {
+		p = hash32_buf(&eh->ether_shost, ETHER_ADDR_LEN, p);
+		p = hash32_buf(&eh->ether_dhost, ETHER_ADDR_LEN, p);
+	}
 
 	/* Special handling for encapsulating VLAN frames */
-	if (m->m_flags & M_VLANTAG) {
+	if ((m->m_flags & M_VLANTAG) && (sc->sc_flags & LAGG_F_HASHL2)) {
 		p = hash32_buf(&m->m_pkthdr.ether_vtag,
 		    sizeof(m->m_pkthdr.ether_vtag), p);
 	} else if (etype == ETHERTYPE_VLAN) {
-		vlan = lagg_gethdr(m, off,  sizeof(*vlan), &vlanbuf);
+		vlan = lagg_gethdr(m, off,  sizeof(*vlan), &buf);
 		if (vlan == NULL)
 			goto out;
 
-		p = hash32_buf(&vlan->evl_tag, sizeof(vlan->evl_tag), p);
+		if (sc->sc_flags & LAGG_F_HASHL2)
+			p = hash32_buf(&vlan->evl_tag, sizeof(vlan->evl_tag), p);
 		etype = ntohs(vlan->evl_proto);
 		off += sizeof(*vlan) - sizeof(*eh);
 	}
@@ -1456,17 +1488,37 @@ lagg_hashmbuf(struct mbuf *m, uint32_t k
 	switch (etype) {
 #ifdef INET
 	case ETHERTYPE_IP:
-		ip = lagg_gethdr(m, off, sizeof(*ip), &ipbuf);
+		ip = lagg_gethdr(m, off, sizeof(*ip), &buf);
 		if (ip == NULL)
 			goto out;
 
-		p = hash32_buf(&ip->ip_src, sizeof(struct in_addr), p);
-		p = hash32_buf(&ip->ip_dst, sizeof(struct in_addr), p);
+		if (sc->sc_flags & LAGG_F_HASHL3) {
+			p = hash32_buf(&ip->ip_src, sizeof(struct in_addr), p);
+			p = hash32_buf(&ip->ip_dst, sizeof(struct in_addr), p);
+		}
+		if (!(sc->sc_flags & LAGG_F_HASHL4))
+			break;
+		switch (ip->ip_p) {
+			case IPPROTO_TCP:
+			case IPPROTO_UDP:
+			case IPPROTO_SCTP:
+				iphlen = ip->ip_hl << 2;
+				if (iphlen < sizeof(*ip))
+					break;
+				off += iphlen;
+				ports = lagg_gethdr(m, off, sizeof(*ports), &buf);
+				if (ports == NULL)
+					break;
+				p = hash32_buf(ports, sizeof(*ports), p);
+				break;
+		}
 		break;
 #endif
 #ifdef INET6
 	case ETHERTYPE_IPV6:
-		ip6 = lagg_gethdr(m, off, sizeof(*ip6), &ip6buf);
+		if (!(sc->sc_flags & LAGG_F_HASHL3))
+			break;
+		ip6 = lagg_gethdr(m, off, sizeof(*ip6), &buf);
 		if (ip6 == NULL)
 			goto out;
 
@@ -1696,7 +1748,7 @@ lagg_lb_start(struct lagg_softc *sc, str
 	if (sc->use_flowid && (m->m_flags & M_FLOWID))
 		p = m->m_pkthdr.flowid;
 	else
-		p = lagg_hashmbuf(m, lb->lb_key);
+		p = lagg_hashmbuf(sc, m, lb->lb_key);
 	p %= sc->sc_count;
 	lp = lb->lb_ports[p];
 

Modified: stable/9/sys/net/if_lagg.h
==============================================================================
--- stable/9/sys/net/if_lagg.h	Sat May 26 07:35:44 2012	(r236048)
+++ stable/9/sys/net/if_lagg.h	Sat May 26 07:39:52 2012	(r236049)
@@ -31,6 +31,12 @@
 #define	LAGG_MAX_NAMESIZE	32	/* name of a protocol */
 #define	LAGG_MAX_STACKING	4	/* maximum number of stacked laggs */
 
+/* Lagg flags */
+#define	LAGG_F_HASHL2		0x00000001	/* hash layer 2 */
+#define	LAGG_F_HASHL3		0x00000002	/* hash layer 3 */
+#define	LAGG_F_HASHL4		0x00000004	/* hash layer 4 */
+#define	LAGG_F_HASHMASK		0x00000007
+
 /* Port flags */
 #define	LAGG_PORT_SLAVE		0x00000000	/* normal enslaved port */
 #define	LAGG_PORT_MASTER	0x00000001	/* primary port */
@@ -122,6 +128,14 @@ struct lagg_reqall {
 #define	SIOCGLAGG		_IOWR('i', 143, struct lagg_reqall)
 #define	SIOCSLAGG		 _IOW('i', 144, struct lagg_reqall)
 
+struct lagg_reqflags {
+	char			rf_ifname[IFNAMSIZ];	/* name of the lagg */
+	uint32_t		rf_flags;		/* lagg protocol */
+};
+
+#define	SIOCGLAGGFLAGS		_IOWR('i', 145, struct lagg_reqflags)
+#define	SIOCSLAGGHASH		 _IOW('i', 146, struct lagg_reqflags)
+
 #ifdef _KERNEL
 /*
  * Internal kernel part
@@ -179,6 +193,7 @@ struct lagg_softc {
 	struct ifmedia			sc_media;	/* media config */
 	caddr_t				sc_psc;		/* protocol data */
 	uint32_t			sc_seq;		/* sequence counter */
+	uint32_t			sc_flags;
 
 	SLIST_HEAD(__tplhd, lagg_port)	sc_ports;	/* list of interfaces */
 	SLIST_ENTRY(lagg_softc)	sc_entries;
@@ -244,7 +259,7 @@ extern struct mbuf *(*lagg_input_p)(stru
 extern void	(*lagg_linkstate_p)(struct ifnet *, int );
 
 int		lagg_enqueue(struct ifnet *, struct mbuf *);
-uint32_t	lagg_hashmbuf(struct mbuf *, uint32_t);
+uint32_t	lagg_hashmbuf(struct lagg_softc *, struct mbuf *, uint32_t);
 
 #endif /* _KERNEL */
 

From owner-svn-src-stable-9@FreeBSD.ORG  Sat May 26 07:41:06 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 7D62C106564A;
	Sat, 26 May 2012 07:41:06 +0000 (UTC)
	(envelope-from thompsa@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 5DABA8FC1A;
	Sat, 26 May 2012 07:41: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 q4Q7f61v059946;
	Sat, 26 May 2012 07:41:06 GMT (envelope-from thompsa@svn.freebsd.org)
Received: (from thompsa@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4Q7f6JP059944;
	Sat, 26 May 2012 07:41:06 GMT (envelope-from thompsa@svn.freebsd.org)
Message-Id: <201205260741.q4Q7f6JP059944@svn.freebsd.org>
From: Andrew Thompson <thompsa@FreeBSD.org>
Date: Sat, 26 May 2012 07:41:06 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r236050 - stable/9/sys/net
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sat, 26 May 2012 07:41:06 -0000

Author: thompsa
Date: Sat May 26 07:41:05 2012
New Revision: 236050
URL: http://svn.freebsd.org/changeset/base/236050

Log:
  MFC r234163
  
   Set the proto to LAGG_PROTO_NONE before calling the detach routine so packets
   are discarded, this is an issue because lacp drops the lock which may allow
   network threads to access freed memory. Expand the lock coverage so the
   detach/attach happen atomically.
  
  Submitted by:	Andrew Boyer (earlier version)

Modified:
  stable/9/sys/net/if_lagg.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/amd64/include/xen/   (props changed)
  stable/9/sys/boot/   (props changed)
  stable/9/sys/boot/i386/efi/   (props changed)
  stable/9/sys/boot/ia64/efi/   (props changed)
  stable/9/sys/boot/ia64/ski/   (props changed)
  stable/9/sys/boot/powerpc/boot1.chrp/   (props changed)
  stable/9/sys/boot/powerpc/ofw/   (props changed)
  stable/9/sys/cddl/contrib/opensolaris/   (props changed)
  stable/9/sys/conf/   (props changed)
  stable/9/sys/contrib/dev/acpica/   (props changed)
  stable/9/sys/contrib/octeon-sdk/   (props changed)
  stable/9/sys/contrib/pf/   (props changed)
  stable/9/sys/contrib/x86emu/   (props changed)
  stable/9/sys/dev/   (props changed)
  stable/9/sys/dev/e1000/   (props changed)
  stable/9/sys/dev/ixgbe/   (props changed)
  stable/9/sys/fs/   (props changed)
  stable/9/sys/fs/ntfs/   (props changed)
  stable/9/sys/modules/   (props changed)

Modified: stable/9/sys/net/if_lagg.c
==============================================================================
--- stable/9/sys/net/if_lagg.c	Sat May 26 07:39:52 2012	(r236049)
+++ stable/9/sys/net/if_lagg.c	Sat May 26 07:41:05 2012	(r236050)
@@ -950,11 +950,11 @@ lagg_ioctl(struct ifnet *ifp, u_long cmd
 			error = EPROTONOSUPPORT;
 			break;
 		}
+		LAGG_WLOCK(sc);
 		if (sc->sc_proto != LAGG_PROTO_NONE) {
-			LAGG_WLOCK(sc);
-			error = sc->sc_detach(sc);
-			/* Reset protocol and pointers */
+			/* Reset protocol first in case detach unlocks */
 			sc->sc_proto = LAGG_PROTO_NONE;
+			error = sc->sc_detach(sc);
 			sc->sc_detach = NULL;
 			sc->sc_start = NULL;
 			sc->sc_input = NULL;
@@ -966,10 +966,14 @@ lagg_ioctl(struct ifnet *ifp, u_long cmd
 			sc->sc_lladdr = NULL;
 			sc->sc_req = NULL;
 			sc->sc_portreq = NULL;
-			LAGG_WUNLOCK(sc);
+		} else if (sc->sc_input != NULL) {
+			/* Still detaching */
+			error = EBUSY;
 		}
-		if (error != 0)
+		if (error != 0) {
+			LAGG_WUNLOCK(sc);
 			break;
+		}
 		for (int i = 0; i < (sizeof(lagg_protos) /
 		    sizeof(lagg_protos[0])); i++) {
 			if (lagg_protos[i].ti_proto == ra->ra_proto) {
@@ -977,7 +981,6 @@ lagg_ioctl(struct ifnet *ifp, u_long cmd
 					printf("%s: using proto %u\n",
 					    sc->sc_ifname,
 					    lagg_protos[i].ti_proto);
-				LAGG_WLOCK(sc);
 				sc->sc_proto = lagg_protos[i].ti_proto;
 				if (sc->sc_proto != LAGG_PROTO_NONE)
 					error = lagg_protos[i].ti_attach(sc);
@@ -985,6 +988,7 @@ lagg_ioctl(struct ifnet *ifp, u_long cmd
 				return (error);
 			}
 		}
+		LAGG_WUNLOCK(sc);
 		error = EPROTONOSUPPORT;
 		break;
 	case SIOCGLAGGFLAGS:

From owner-svn-src-stable-9@FreeBSD.ORG  Sat May 26 07:42:33 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 582F9106566C;
	Sat, 26 May 2012 07:42:33 +0000 (UTC)
	(envelope-from thompsa@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 427438FC0A;
	Sat, 26 May 2012 07:42: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 q4Q7gXCY060047;
	Sat, 26 May 2012 07:42:33 GMT (envelope-from thompsa@svn.freebsd.org)
Received: (from thompsa@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4Q7gXCr060042;
	Sat, 26 May 2012 07:42:33 GMT (envelope-from thompsa@svn.freebsd.org)
Message-Id: <201205260742.q4Q7gXCr060042@svn.freebsd.org>
From: Andrew Thompson <thompsa@FreeBSD.org>
Date: Sat, 26 May 2012 07:42:32 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r236051 - stable/9/sys/net
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sat, 26 May 2012 07:42:33 -0000

Author: thompsa
Date: Sat May 26 07:42:32 2012
New Revision: 236051
URL: http://svn.freebsd.org/changeset/base/236051

Log:
  MFC r234487
  
   Add linkstate to bridge(4), set the link to up when at least one underlying
   interface is up, otherwise the link is down.
  
   This, among other things, allows carp to work on a bridge.

Modified:
  stable/9/sys/net/bridgestp.c
  stable/9/sys/net/bridgestp.h
  stable/9/sys/net/if.c
  stable/9/sys/net/if_bridge.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/amd64/include/xen/   (props changed)
  stable/9/sys/boot/   (props changed)
  stable/9/sys/boot/i386/efi/   (props changed)
  stable/9/sys/boot/ia64/efi/   (props changed)
  stable/9/sys/boot/ia64/ski/   (props changed)
  stable/9/sys/boot/powerpc/boot1.chrp/   (props changed)
  stable/9/sys/boot/powerpc/ofw/   (props changed)
  stable/9/sys/cddl/contrib/opensolaris/   (props changed)
  stable/9/sys/conf/   (props changed)
  stable/9/sys/contrib/dev/acpica/   (props changed)
  stable/9/sys/contrib/octeon-sdk/   (props changed)
  stable/9/sys/contrib/pf/   (props changed)
  stable/9/sys/contrib/x86emu/   (props changed)
  stable/9/sys/dev/   (props changed)
  stable/9/sys/dev/e1000/   (props changed)
  stable/9/sys/dev/ixgbe/   (props changed)
  stable/9/sys/fs/   (props changed)
  stable/9/sys/fs/ntfs/   (props changed)
  stable/9/sys/modules/   (props changed)

Modified: stable/9/sys/net/bridgestp.c
==============================================================================
--- stable/9/sys/net/bridgestp.c	Sat May 26 07:41:05 2012	(r236050)
+++ stable/9/sys/net/bridgestp.c	Sat May 26 07:42:32 2012	(r236051)
@@ -1767,28 +1767,16 @@ bstp_notify_rtage(void *arg, int pending
 }
 
 void
-bstp_linkstate(struct ifnet *ifp, int state)
+bstp_linkstate(struct bstp_port *bp)
 {
-	struct bstp_state *bs;
-	struct bstp_port *bp;
+	struct bstp_state *bs = bp->bp_bs;
 
-	/* search for the stp port */
-	mtx_lock(&bstp_list_mtx);
-	LIST_FOREACH(bs, &bstp_list, bs_list) {
-		BSTP_LOCK(bs);
-		LIST_FOREACH(bp, &bs->bs_bplist, bp_next) {
-			if (bp->bp_ifp == ifp) {
-				bstp_ifupdstatus(bs, bp);
-				bstp_update_state(bs, bp);
-				/* it only exists once so return */
-				BSTP_UNLOCK(bs);
-				mtx_unlock(&bstp_list_mtx);
-				return;
-			}
-		}
-		BSTP_UNLOCK(bs);
+	BSTP_LOCK(bs);
+	if (bp->bp_active) {
+		bstp_ifupdstatus(bs, bp);
+		bstp_update_state(bs, bp);
 	}
-	mtx_unlock(&bstp_list_mtx);
+	BSTP_UNLOCK(bs);
 }
 
 static void
@@ -2103,10 +2091,8 @@ bstp_modevent(module_t mod, int type, vo
 	case MOD_LOAD:
 		mtx_init(&bstp_list_mtx, "bridgestp list", NULL, MTX_DEF);
 		LIST_INIT(&bstp_list);
-		bstp_linkstate_p = bstp_linkstate;
 		break;
 	case MOD_UNLOAD:
-		bstp_linkstate_p = NULL;
 		mtx_destroy(&bstp_list_mtx);
 		break;
 	default:

Modified: stable/9/sys/net/bridgestp.h
==============================================================================
--- stable/9/sys/net/bridgestp.h	Sat May 26 07:41:05 2012	(r236050)
+++ stable/9/sys/net/bridgestp.h	Sat May 26 07:42:32 2012	(r236051)
@@ -369,8 +369,6 @@ struct bstp_state {
 
 extern const uint8_t bstp_etheraddr[];
 
-extern	void (*bstp_linkstate_p)(struct ifnet *ifp, int state);
-
 void	bstp_attach(struct bstp_state *, struct bstp_cb_ops *);
 void	bstp_detach(struct bstp_state *);
 void	bstp_init(struct bstp_state *);
@@ -379,7 +377,7 @@ int	bstp_create(struct bstp_state *, str
 int	bstp_enable(struct bstp_port *);
 void	bstp_disable(struct bstp_port *);
 void	bstp_destroy(struct bstp_port *);
-void	bstp_linkstate(struct ifnet *, int);
+void	bstp_linkstate(struct bstp_port *);
 int	bstp_set_htime(struct bstp_state *, int);
 int	bstp_set_fdelay(struct bstp_state *, int);
 int	bstp_set_maxage(struct bstp_state *, int);

Modified: stable/9/sys/net/if.c
==============================================================================
--- stable/9/sys/net/if.c	Sat May 26 07:41:05 2012	(r236050)
+++ stable/9/sys/net/if.c	Sat May 26 07:42:32 2012	(r236051)
@@ -124,7 +124,7 @@ MALLOC_DEFINE(M_IFDESCR, "ifdescr", "ifn
 static struct sx ifdescr_sx;
 SX_SYSINIT(ifdescr_sx, &ifdescr_sx, "ifnet descr");
 
-void	(*bstp_linkstate_p)(struct ifnet *ifp, int state);
+void	(*bridge_linkstate_p)(struct ifnet *ifp);
 void	(*ng_ether_link_state_p)(struct ifnet *ifp, int state);
 void	(*lagg_linkstate_p)(struct ifnet *ifp, int state);
 /* These are external hooks for CARP. */
@@ -1925,14 +1925,10 @@ do_link_state_change(void *arg, int pend
 		(*ng_ether_link_state_p)(ifp, link_state);
 	if (ifp->if_carp)
 		(*carp_linkstate_p)(ifp);
-	if (ifp->if_bridge) {
-		KASSERT(bstp_linkstate_p != NULL,("if_bridge bstp not loaded!"));
-		(*bstp_linkstate_p)(ifp, link_state);
-	}
-	if (ifp->if_lagg) {
-		KASSERT(lagg_linkstate_p != NULL,("if_lagg not loaded!"));
+	if (ifp->if_bridge)
+		(*bridge_linkstate_p)(ifp);
+	if (ifp->if_lagg)
 		(*lagg_linkstate_p)(ifp, link_state);
-	}
 
 	if (IS_DEFAULT_VNET(curvnet))
 		devctl_notify("IFNET", ifp->if_xname,

Modified: stable/9/sys/net/if_bridge.c
==============================================================================
--- stable/9/sys/net/if_bridge.c	Sat May 26 07:41:05 2012	(r236050)
+++ stable/9/sys/net/if_bridge.c	Sat May 26 07:42:32 2012	(r236051)
@@ -333,6 +333,9 @@ static int	bridge_ip6_checkbasic(struct 
 #endif /* INET6 */
 static int	bridge_fragment(struct ifnet *, struct mbuf *,
 		    struct ether_header *, int, struct llc *);
+static void	bridge_linkstate(struct ifnet *ifp);
+
+extern void (*bridge_linkstate_p)(struct ifnet *ifp);
 
 /* The default bridge vlan is 1 (IEEE 802.1Q-2003 Table 9-2) */
 #define	VLANTAGOF(_m)	\
@@ -489,6 +492,7 @@ bridge_modevent(module_t mod, int type, 
 		bridge_input_p = bridge_input;
 		bridge_output_p = bridge_output;
 		bridge_dn_p = bridge_dummynet;
+		bridge_linkstate_p = bridge_linkstate;
 		bridge_detach_cookie = EVENTHANDLER_REGISTER(
 		    ifnet_departure_event, bridge_ifdetach, NULL,
 		    EVENTHANDLER_PRI_ANY);
@@ -501,6 +505,7 @@ bridge_modevent(module_t mod, int type, 
 		bridge_input_p = NULL;
 		bridge_output_p = NULL;
 		bridge_dn_p = NULL;
+		bridge_linkstate_p = NULL;
 		mtx_destroy(&bridge_list_mtx);
 		break;
 	default:
@@ -981,6 +986,7 @@ bridge_delete_member(struct bridge_softc
 		bridge_set_ifcap(sc, bif, bif->bif_savedcaps);
 	}
 	bstp_destroy(&bif->bif_stp);	/* prepare to free */
+	bridge_linkstate(ifs);
 	BRIDGE_LOCK(sc);
 	free(bif, M_DEVBUF);
 }
@@ -1080,17 +1086,17 @@ bridge_ioctl_add(struct bridge_softc *sc
 	/* Set interface capabilities to the intersection set of all members */
 	bridge_mutecaps(sc);
 
+	BRIDGE_UNLOCK(sc);
+	/* Update the linkstate for the bridge */
+	bridge_linkstate(ifs);
+	/* Place the interface into promiscuous mode */
 	switch (ifs->if_type) {
-	case IFT_ETHER:
-	case IFT_L2VLAN:
-		/*
-		 * Place the interface into promiscuous mode.
-		 */
-		BRIDGE_UNLOCK(sc);
-		error = ifpromisc(ifs, 1);
-		BRIDGE_LOCK(sc);
-		break;
+		case IFT_ETHER:
+		case IFT_L2VLAN:
+			error = ifpromisc(ifs, 1);
+			break;
 	}
+	BRIDGE_LOCK(sc);
 	if (error)
 		bridge_delete_member(sc, bif, 0);
 out:
@@ -3468,3 +3474,38 @@ out:
 		m_freem(m);
 	return (error);
 }
+
+static void
+bridge_linkstate(struct ifnet *ifp)
+{
+	struct bridge_softc *sc = ifp->if_bridge;
+	struct bridge_iflist *bif, *bif2;
+	int new_link, hasls;
+
+	BRIDGE_LOCK(sc);
+	bif = bridge_lookup_member_if(sc, ifp);
+	if (bif == NULL) {
+		BRIDGE_UNLOCK(sc);
+		return;
+	}
+	new_link = LINK_STATE_DOWN;
+	hasls = 0;
+	/* Our link is considered up if at least one of our ports is active */
+	LIST_FOREACH(bif2, &sc->sc_iflist, bif_next) {
+		if (bif2->bif_ifp->if_capabilities & IFCAP_LINKSTATE)
+			hasls++;
+		if (bif2->bif_ifp->if_link_state == LINK_STATE_UP) {
+			new_link = LINK_STATE_UP;
+			break;
+		}
+	}
+	if (!LIST_EMPTY(&sc->sc_iflist) && !hasls) {
+		/* If no interfaces support link-state then we default to up */
+		new_link = LINK_STATE_UP;
+	}
+	if_link_state_change(sc->sc_ifp, new_link);
+	BRIDGE_UNLOCK(sc);
+
+	bstp_linkstate(&bif->bif_stp);
+}
+

From owner-svn-src-stable-9@FreeBSD.ORG  Sat May 26 07:43:17 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id B275F1065670;
	Sat, 26 May 2012 07:43:17 +0000 (UTC)
	(envelope-from thompsa@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 9D5568FC1F;
	Sat, 26 May 2012 07:43: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 q4Q7hHsA060112;
	Sat, 26 May 2012 07:43:17 GMT (envelope-from thompsa@svn.freebsd.org)
Received: (from thompsa@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4Q7hHqn060109;
	Sat, 26 May 2012 07:43:17 GMT (envelope-from thompsa@svn.freebsd.org)
Message-Id: <201205260743.q4Q7hHqn060109@svn.freebsd.org>
From: Andrew Thompson <thompsa@FreeBSD.org>
Date: Sat, 26 May 2012 07:43:17 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r236052 - stable/9/sys/net
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sat, 26 May 2012 07:43:17 -0000

Author: thompsa
Date: Sat May 26 07:43:17 2012
New Revision: 236052
URL: http://svn.freebsd.org/changeset/base/236052

Log:
  MFC r234488
  
   Move the interface media check to a taskqueue, some interfaces (usb) sleep
   during SIOCGIFMEDIA and we were holding locks.

Modified:
  stable/9/sys/net/bridgestp.c
  stable/9/sys/net/bridgestp.h
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/amd64/include/xen/   (props changed)
  stable/9/sys/boot/   (props changed)
  stable/9/sys/boot/i386/efi/   (props changed)
  stable/9/sys/boot/ia64/efi/   (props changed)
  stable/9/sys/boot/ia64/ski/   (props changed)
  stable/9/sys/boot/powerpc/boot1.chrp/   (props changed)
  stable/9/sys/boot/powerpc/ofw/   (props changed)
  stable/9/sys/cddl/contrib/opensolaris/   (props changed)
  stable/9/sys/conf/   (props changed)
  stable/9/sys/contrib/dev/acpica/   (props changed)
  stable/9/sys/contrib/octeon-sdk/   (props changed)
  stable/9/sys/contrib/pf/   (props changed)
  stable/9/sys/contrib/x86emu/   (props changed)
  stable/9/sys/dev/   (props changed)
  stable/9/sys/dev/e1000/   (props changed)
  stable/9/sys/dev/ixgbe/   (props changed)
  stable/9/sys/fs/   (props changed)
  stable/9/sys/fs/ntfs/   (props changed)
  stable/9/sys/modules/   (props changed)

Modified: stable/9/sys/net/bridgestp.c
==============================================================================
--- stable/9/sys/net/bridgestp.c	Sat May 26 07:42:32 2012	(r236051)
+++ stable/9/sys/net/bridgestp.c	Sat May 26 07:43:17 2012	(r236052)
@@ -127,7 +127,7 @@ static int	bstp_rerooted(struct bstp_sta
 static uint32_t	bstp_calc_path_cost(struct bstp_port *);
 static void	bstp_notify_state(void *, int);
 static void	bstp_notify_rtage(void *, int);
-static void	bstp_ifupdstatus(struct bstp_state *, struct bstp_port *);
+static void	bstp_ifupdstatus(void *, int);
 static void	bstp_enable_port(struct bstp_state *, struct bstp_port *);
 static void	bstp_disable_port(struct bstp_state *, struct bstp_port *);
 static void	bstp_tick(void *);
@@ -1677,7 +1677,7 @@ bstp_set_autoptp(struct bstp_port *bp, i
 	if (set) {
 		bp->bp_flags |= BSTP_PORT_AUTOPTP;
 		if (bp->bp_role != BSTP_ROLE_DISABLED)
-			bstp_ifupdstatus(bs, bp);
+			taskqueue_enqueue(taskqueue_swi, &bp->bp_mediatask);
 	} else
 		bp->bp_flags &= ~BSTP_PORT_AUTOPTP;
 	BSTP_UNLOCK(bs);
@@ -1771,69 +1771,89 @@ bstp_linkstate(struct bstp_port *bp)
 {
 	struct bstp_state *bs = bp->bp_bs;
 
+	if (!bp->bp_active)
+		return;
+
+	bstp_ifupdstatus(bp, 0);
 	BSTP_LOCK(bs);
-	if (bp->bp_active) {
-		bstp_ifupdstatus(bs, bp);
-		bstp_update_state(bs, bp);
-	}
+	bstp_update_state(bs, bp);
 	BSTP_UNLOCK(bs);
 }
 
 static void
-bstp_ifupdstatus(struct bstp_state *bs, struct bstp_port *bp)
+bstp_ifupdstatus(void *arg, int pending)
 {
+	struct bstp_port *bp = (struct bstp_port *)arg;
+	struct bstp_state *bs = bp->bp_bs;
 	struct ifnet *ifp = bp->bp_ifp;
 	struct ifmediareq ifmr;
-	int error = 0;
+	int error, changed;
 
-	BSTP_LOCK_ASSERT(bs);
+	if (!bp->bp_active)
+		return;
 
 	bzero((char *)&ifmr, sizeof(ifmr));
 	error = (*ifp->if_ioctl)(ifp, SIOCGIFMEDIA, (caddr_t)&ifmr);
 
+	BSTP_LOCK(bs);
+	changed = 0;
 	if ((error == 0) && (ifp->if_flags & IFF_UP)) {
 		if (ifmr.ifm_status & IFM_ACTIVE) {
 			/* A full-duplex link is assumed to be point to point */
 			if (bp->bp_flags & BSTP_PORT_AUTOPTP) {
-				bp->bp_ptp_link =
-				    ifmr.ifm_active & IFM_FDX ? 1 : 0;
+				int fdx;
+
+				fdx = ifmr.ifm_active & IFM_FDX ? 1 : 0;
+				if (bp->bp_ptp_link ^ fdx) {
+					bp->bp_ptp_link = fdx;
+					changed = 1;
+				}
 			}
 
 			/* Calc the cost if the link was down previously */
 			if (bp->bp_flags & BSTP_PORT_PNDCOST) {
-				bp->bp_path_cost = bstp_calc_path_cost(bp);
+				uint32_t cost;
+
+				cost = bstp_calc_path_cost(bp);
+				if (bp->bp_path_cost != cost) {
+					bp->bp_path_cost = cost;
+					changed = 1;
+				}
 				bp->bp_flags &= ~BSTP_PORT_PNDCOST;
 			}
 
-			if (bp->bp_role == BSTP_ROLE_DISABLED)
+			if (bp->bp_role == BSTP_ROLE_DISABLED) {
 				bstp_enable_port(bs, bp);
+				changed = 1;
+			}
 		} else {
 			if (bp->bp_role != BSTP_ROLE_DISABLED) {
 				bstp_disable_port(bs, bp);
+				changed = 1;
 				if ((bp->bp_flags & BSTP_PORT_ADMEDGE) &&
 				    bp->bp_protover == BSTP_PROTO_RSTP)
 					bp->bp_operedge = 1;
 			}
 		}
-		return;
-	}
-
-	if (bp->bp_infois != BSTP_INFO_DISABLED)
+	} else if (bp->bp_infois != BSTP_INFO_DISABLED) {
 		bstp_disable_port(bs, bp);
+		changed = 1;
+	}
+	if (changed)
+		bstp_assign_roles(bs);
+	BSTP_UNLOCK(bs);
 }
 
 static void
 bstp_enable_port(struct bstp_state *bs, struct bstp_port *bp)
 {
 	bp->bp_infois = BSTP_INFO_AGED;
-	bstp_assign_roles(bs);
 }
 
 static void
 bstp_disable_port(struct bstp_state *bs, struct bstp_port *bp)
 {
 	bp->bp_infois = BSTP_INFO_DISABLED;
-	bstp_assign_roles(bs);
 }
 
 static void
@@ -1853,7 +1873,7 @@ bstp_tick(void *arg)
 	if (bstp_timer_dectest(&bs->bs_link_timer)) {
 		LIST_FOREACH(bp, &bs->bs_bplist, bp_next) {
 			if (!(bp->bp_ifp->if_capabilities & IFCAP_LINKSTATE))
-				bstp_ifupdstatus(bs, bp);
+				taskqueue_enqueue(taskqueue_swi, &bp->bp_mediatask);
 		}
 		bstp_timer_start(&bs->bs_link_timer, BSTP_LINK_TIMER);
 	}
@@ -2063,7 +2083,7 @@ bstp_reinit(struct bstp_state *bs)
 	LIST_FOREACH(bp, &bs->bs_bplist, bp_next) {
 		bp->bp_port_id = (bp->bp_priority << 8) |
 		    (bp->bp_ifp->if_index  & 0xfff);
-		bstp_ifupdstatus(bs, bp);
+		taskqueue_enqueue(taskqueue_swi, &bp->bp_mediatask);
 	}
 
 	bstp_assign_roles(bs);
@@ -2184,6 +2204,7 @@ bstp_create(struct bstp_state *bs, struc
 	bp->bp_priority = BSTP_DEFAULT_PORT_PRIORITY;
 	TASK_INIT(&bp->bp_statetask, 0, bstp_notify_state, bp);
 	TASK_INIT(&bp->bp_rtagetask, 0, bstp_notify_rtage, bp);
+	TASK_INIT(&bp->bp_mediatask, 0, bstp_ifupdstatus, bp);
 
 	/* Init state */
 	bp->bp_infois = BSTP_INFO_DISABLED;
@@ -2247,4 +2268,5 @@ bstp_destroy(struct bstp_port *bp)
 	KASSERT(bp->bp_active == 0, ("port is still attached"));
 	taskqueue_drain(taskqueue_swi, &bp->bp_statetask);
 	taskqueue_drain(taskqueue_swi, &bp->bp_rtagetask);
+	taskqueue_drain(taskqueue_swi, &bp->bp_mediatask);
 }

Modified: stable/9/sys/net/bridgestp.h
==============================================================================
--- stable/9/sys/net/bridgestp.h	Sat May 26 07:42:32 2012	(r236051)
+++ stable/9/sys/net/bridgestp.h	Sat May 26 07:43:17 2012	(r236052)
@@ -326,6 +326,7 @@ struct bstp_port {
 	uint8_t			bp_txcount;
 	struct task		bp_statetask;
 	struct task		bp_rtagetask;
+	struct task		bp_mediatask;
 };
 
 /*

From owner-svn-src-stable-9@FreeBSD.ORG  Sat May 26 07:44:00 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id CB83B1065678;
	Sat, 26 May 2012 07:44:00 +0000 (UTC)
	(envelope-from thompsa@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 998E08FC12;
	Sat, 26 May 2012 07:44: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 q4Q7i099060176;
	Sat, 26 May 2012 07:44:00 GMT (envelope-from thompsa@svn.freebsd.org)
Received: (from thompsa@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4Q7i0FT060174;
	Sat, 26 May 2012 07:44:00 GMT (envelope-from thompsa@svn.freebsd.org)
Message-Id: <201205260744.q4Q7i0FT060174@svn.freebsd.org>
From: Andrew Thompson <thompsa@FreeBSD.org>
Date: Sat, 26 May 2012 07:44:00 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r236053 - stable/9/sys/dev/tsec
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sat, 26 May 2012 07:44:01 -0000

Author: thompsa
Date: Sat May 26 07:44:00 2012
New Revision: 236053
URL: http://svn.freebsd.org/changeset/base/236053

Log:
  MFC r235144
  
   The DEVICE_POLLING dereference of sc->tsec_ifp needs to be checked for null
   first or this will panic. Condense three blocks that check sc->tsec_ifp into
   one while I am here.

Modified:
  stable/9/sys/dev/tsec/if_tsec.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/amd64/include/xen/   (props changed)
  stable/9/sys/boot/   (props changed)
  stable/9/sys/boot/i386/efi/   (props changed)
  stable/9/sys/boot/ia64/efi/   (props changed)
  stable/9/sys/boot/ia64/ski/   (props changed)
  stable/9/sys/boot/powerpc/boot1.chrp/   (props changed)
  stable/9/sys/boot/powerpc/ofw/   (props changed)
  stable/9/sys/cddl/contrib/opensolaris/   (props changed)
  stable/9/sys/conf/   (props changed)
  stable/9/sys/contrib/dev/acpica/   (props changed)
  stable/9/sys/contrib/octeon-sdk/   (props changed)
  stable/9/sys/contrib/pf/   (props changed)
  stable/9/sys/contrib/x86emu/   (props changed)
  stable/9/sys/dev/   (props changed)
  stable/9/sys/dev/e1000/   (props changed)
  stable/9/sys/dev/ixgbe/   (props changed)
  stable/9/sys/fs/   (props changed)
  stable/9/sys/fs/ntfs/   (props changed)
  stable/9/sys/modules/   (props changed)

Modified: stable/9/sys/dev/tsec/if_tsec.c
==============================================================================
--- stable/9/sys/dev/tsec/if_tsec.c	Sat May 26 07:43:17 2012	(r236052)
+++ stable/9/sys/dev/tsec/if_tsec.c	Sat May 26 07:44:00 2012	(r236053)
@@ -290,17 +290,17 @@ int
 tsec_detach(struct tsec_softc *sc)
 {
 
+	if (sc->tsec_ifp != NULL) {
 #ifdef DEVICE_POLLING
-	if (sc->tsec_ifp->if_capenable & IFCAP_POLLING)
-		ether_poll_deregister(sc->tsec_ifp);
+		if (sc->tsec_ifp->if_capenable & IFCAP_POLLING)
+			ether_poll_deregister(sc->tsec_ifp);
 #endif
 
-	/* Stop TSEC controller and free TX queue */
-	if (sc->sc_rres && sc->tsec_ifp)
-		tsec_shutdown(sc->dev);
+		/* Stop TSEC controller and free TX queue */
+		if (sc->sc_rres)
+			tsec_shutdown(sc->dev);
 
-	/* Detach network interface */
-	if (sc->tsec_ifp) {
+		/* Detach network interface */
 		ether_ifdetach(sc->tsec_ifp);
 		if_free(sc->tsec_ifp);
 		sc->tsec_ifp = NULL;

From owner-svn-src-stable-9@FreeBSD.ORG  Sat May 26 07:44:36 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 83A861065675;
	Sat, 26 May 2012 07:44:36 +0000 (UTC)
	(envelope-from thompsa@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 24D768FC1D;
	Sat, 26 May 2012 07:44: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 q4Q7iZXh060247;
	Sat, 26 May 2012 07:44:35 GMT (envelope-from thompsa@svn.freebsd.org)
Received: (from thompsa@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4Q7iZF4060245;
	Sat, 26 May 2012 07:44:35 GMT (envelope-from thompsa@svn.freebsd.org)
Message-Id: <201205260744.q4Q7iZF4060245@svn.freebsd.org>
From: Andrew Thompson <thompsa@FreeBSD.org>
Date: Sat, 26 May 2012 07:44:35 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r236054 - stable/9/sys/dev/tsec
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sat, 26 May 2012 07:44:36 -0000

Author: thompsa
Date: Sat May 26 07:44:35 2012
New Revision: 236054
URL: http://svn.freebsd.org/changeset/base/236054

Log:
  MFC r235147
  
   Do not reinitialise the interface if it is already running, this prevents the
   bootp+nfs code from working as it calls init on each dhcp send and rx fails to
   start in time.

Modified:
  stable/9/sys/dev/tsec/if_tsec.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/amd64/include/xen/   (props changed)
  stable/9/sys/boot/   (props changed)
  stable/9/sys/boot/i386/efi/   (props changed)
  stable/9/sys/boot/ia64/efi/   (props changed)
  stable/9/sys/boot/ia64/ski/   (props changed)
  stable/9/sys/boot/powerpc/boot1.chrp/   (props changed)
  stable/9/sys/boot/powerpc/ofw/   (props changed)
  stable/9/sys/cddl/contrib/opensolaris/   (props changed)
  stable/9/sys/conf/   (props changed)
  stable/9/sys/contrib/dev/acpica/   (props changed)
  stable/9/sys/contrib/octeon-sdk/   (props changed)
  stable/9/sys/contrib/pf/   (props changed)
  stable/9/sys/contrib/x86emu/   (props changed)
  stable/9/sys/dev/   (props changed)
  stable/9/sys/dev/e1000/   (props changed)
  stable/9/sys/dev/ixgbe/   (props changed)
  stable/9/sys/fs/   (props changed)
  stable/9/sys/fs/ntfs/   (props changed)
  stable/9/sys/modules/   (props changed)

Modified: stable/9/sys/dev/tsec/if_tsec.c
==============================================================================
--- stable/9/sys/dev/tsec/if_tsec.c	Sat May 26 07:44:00 2012	(r236053)
+++ stable/9/sys/dev/tsec/if_tsec.c	Sat May 26 07:44:35 2012	(r236054)
@@ -359,6 +359,9 @@ tsec_init_locked(struct tsec_softc *sc)
 	struct ifnet *ifp = sc->tsec_ifp;
 	uint32_t timeout, val, i;
 
+	if (ifp->if_drv_flags & IFF_DRV_RUNNING)
+		return;
+
 	TSEC_GLOBAL_LOCK_ASSERT(sc);
 	tsec_stop(sc);
 

From owner-svn-src-stable-9@FreeBSD.ORG  Sat May 26 08:18:47 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id F30CD106566B;
	Sat, 26 May 2012 08:18:46 +0000 (UTC)
	(envelope-from thompsa@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id DE5498FC1C;
	Sat, 26 May 2012 08:18: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 q4Q8IkWh061995;
	Sat, 26 May 2012 08:18:46 GMT (envelope-from thompsa@svn.freebsd.org)
Received: (from thompsa@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4Q8Ikvp061993;
	Sat, 26 May 2012 08:18:46 GMT (envelope-from thompsa@svn.freebsd.org)
Message-Id: <201205260818.q4Q8Ikvp061993@svn.freebsd.org>
From: Andrew Thompson <thompsa@FreeBSD.org>
Date: Sat, 26 May 2012 08:18:46 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r236064 - stable/9/sbin/ifconfig
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sat, 26 May 2012 08:18:47 -0000

Author: thompsa
Date: Sat May 26 08:18:46 2012
New Revision: 236064
URL: http://svn.freebsd.org/changeset/base/236064

Log:
  MFC r232638
  
   Fix typo in lagg options.

Modified:
  stable/9/sbin/ifconfig/ifconfig.8
Directory Properties:
  stable/9/sbin/ifconfig/   (props changed)

Modified: stable/9/sbin/ifconfig/ifconfig.8
==============================================================================
--- stable/9/sbin/ifconfig/ifconfig.8	Sat May 26 08:17:30 2012	(r236063)
+++ stable/9/sbin/ifconfig/ifconfig.8	Sat May 26 08:18:46 2012	(r236064)
@@ -28,7 +28,7 @@
 .\"     From: @(#)ifconfig.8	8.3 (Berkeley) 1/5/94
 .\" $FreeBSD$
 .\"
-.Dd March 4, 2012
+.Dd March 7, 2012
 .Dt IFCONFIG 8
 .Os
 .Sh NAME
@@ -2289,7 +2289,7 @@ src/dst mac address and optional vlan nu
 .It Cm l3
 src/dst address for IPv4 or IPv6.
 .It Cm l4
-src/dst port for TCP/UCP/SCTP.
+src/dst port for TCP/UDP/SCTP.
 .El
 .Pp
 .El

From owner-svn-src-stable-9@FreeBSD.ORG  Sat May 26 08:21:11 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id F09E7106566C;
	Sat, 26 May 2012 08:21:11 +0000 (UTC)
	(envelope-from thompsa@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id DBAC78FC0C;
	Sat, 26 May 2012 08:21: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 q4Q8LBSw062120;
	Sat, 26 May 2012 08:21:11 GMT (envelope-from thompsa@svn.freebsd.org)
Received: (from thompsa@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4Q8LBe8062118;
	Sat, 26 May 2012 08:21:11 GMT (envelope-from thompsa@svn.freebsd.org)
Message-Id: <201205260821.q4Q8LBe8062118@svn.freebsd.org>
From: Andrew Thompson <thompsa@FreeBSD.org>
Date: Sat, 26 May 2012 08:21:11 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r236065 - stable/9/share/man/man4
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sat, 26 May 2012 08:21:12 -0000

Author: thompsa
Date: Sat May 26 08:21:11 2012
New Revision: 236065
URL: http://svn.freebsd.org/changeset/base/236065

Log:
  MFC r232009
  
   Make it clear that fec is just an alias

Modified:
  stable/9/share/man/man4/lagg.4
Directory Properties:
  stable/9/share/man/man4/   (props changed)

Modified: stable/9/share/man/man4/lagg.4
==============================================================================
--- stable/9/share/man/man4/lagg.4	Sat May 26 08:18:46 2012	(r236064)
+++ stable/9/share/man/man4/lagg.4	Sat May 26 08:21:11 2012	(r236065)
@@ -88,8 +88,9 @@ variable to a nonzero value,
 which is useful for certain bridged network setups.
 .It Ic fec
 Supports Cisco EtherChannel.
-This is a static setup and does not negotiate aggregation with the peer or
-exchange frames to monitor the link.
+This is an alias for
+.Ic loadbalance
+mode.
 .It Ic lacp
 Supports the IEEE 802.3ad Link Aggregation Control Protocol (LACP) and the
 Marker Protocol.

From owner-svn-src-stable-9@FreeBSD.ORG  Sat May 26 08:25:25 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id EEBE11065674;
	Sat, 26 May 2012 08:25:25 +0000 (UTC)
	(envelope-from thompsa@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id D9C838FC08;
	Sat, 26 May 2012 08:25: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 q4Q8PPje062362;
	Sat, 26 May 2012 08:25:25 GMT (envelope-from thompsa@svn.freebsd.org)
Received: (from thompsa@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4Q8PPTL062360;
	Sat, 26 May 2012 08:25:25 GMT (envelope-from thompsa@svn.freebsd.org)
Message-Id: <201205260825.q4Q8PPTL062360@svn.freebsd.org>
From: Andrew Thompson <thompsa@FreeBSD.org>
Date: Sat, 26 May 2012 08:25:25 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r236067 - stable/9/share/man/man9
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sat, 26 May 2012 08:25:26 -0000

Author: thompsa
Date: Sat May 26 08:25:25 2012
New Revision: 236067
URL: http://svn.freebsd.org/changeset/base/236067

Log:
  MFC r232321
  
   Correct the description for CTLFLAG_TUN and CTLFLAG_RDTUN, the declaring of a
   system tunable has never been implemented. This flag is only used by sysctl(8)
   to provide a helpful error message.

Modified:
  stable/9/share/man/man9/sysctl.9
Directory Properties:
  stable/9/share/man/man9/   (props changed)

Modified: stable/9/share/man/man9/sysctl.9
==============================================================================
--- stable/9/share/man/man9/sysctl.9	Sat May 26 08:23:26 2012	(r236066)
+++ stable/9/share/man/man9/sysctl.9	Sat May 26 08:25:25 2012	(r236067)
@@ -138,9 +138,9 @@ This sysctl can be written to by process
 .It Dv CTLFLAG_SKIP
 When iterating the sysctl name space, do not list this sysctl.
 .It Dv CTLFLAG_TUN
-Also declare a system tunable with the same name to initialize this variable.
+Advisory flag that a system tunable also exists for this variable.
 .It Dv CTLFLAG_RDTUN
-Also declare a system tunable with the same name to initialize this variable;
+Advisory flag that a system tunable also exists for this variable;
 however, the run-time variable is read-only.
 .El
 .Pp

From owner-svn-src-stable-9@FreeBSD.ORG  Sat May 26 08:41:18 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id A208B106564A;
	Sat, 26 May 2012 08:41:18 +0000 (UTC)
	(envelope-from thompsa@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 83F9F8FC12;
	Sat, 26 May 2012 08:41: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 q4Q8fIqn063135;
	Sat, 26 May 2012 08:41:18 GMT (envelope-from thompsa@svn.freebsd.org)
Received: (from thompsa@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4Q8fHul063133;
	Sat, 26 May 2012 08:41:17 GMT (envelope-from thompsa@svn.freebsd.org)
Message-Id: <201205260841.q4Q8fHul063133@svn.freebsd.org>
From: Andrew Thompson <thompsa@FreeBSD.org>
Date: Sat, 26 May 2012 08:41:17 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r236071 - stable/9/sys/net
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sat, 26 May 2012 08:41:18 -0000

Author: thompsa
Date: Sat May 26 08:41:17 2012
New Revision: 236071
URL: http://svn.freebsd.org/changeset/base/236071

Log:
  MFC r231130 (pjd)
  
   Allow to set if_bridge(4) sysctls from /boot/loader.conf.

Modified:
  stable/9/sys/net/if_bridge.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/amd64/include/xen/   (props changed)
  stable/9/sys/boot/   (props changed)
  stable/9/sys/boot/i386/efi/   (props changed)
  stable/9/sys/boot/ia64/efi/   (props changed)
  stable/9/sys/boot/ia64/ski/   (props changed)
  stable/9/sys/boot/powerpc/boot1.chrp/   (props changed)
  stable/9/sys/boot/powerpc/ofw/   (props changed)
  stable/9/sys/cddl/contrib/opensolaris/   (props changed)
  stable/9/sys/conf/   (props changed)
  stable/9/sys/contrib/dev/acpica/   (props changed)
  stable/9/sys/contrib/octeon-sdk/   (props changed)
  stable/9/sys/contrib/pf/   (props changed)
  stable/9/sys/contrib/x86emu/   (props changed)
  stable/9/sys/dev/   (props changed)
  stable/9/sys/dev/e1000/   (props changed)
  stable/9/sys/dev/ixgbe/   (props changed)
  stable/9/sys/fs/   (props changed)
  stable/9/sys/fs/ntfs/   (props changed)
  stable/9/sys/modules/   (props changed)

Modified: stable/9/sys/net/if_bridge.c
==============================================================================
--- stable/9/sys/net/if_bridge.c	Sat May 26 08:33:53 2012	(r236070)
+++ stable/9/sys/net/if_bridge.c	Sat May 26 08:41:17 2012	(r236071)
@@ -358,19 +358,26 @@ static int pfil_local_phys = 0; /* run p
                                    locally destined packets */
 static int log_stp   = 0;   /* log STP state changes */
 static int bridge_inherit_mac = 0;   /* share MAC with first bridge member */
+TUNABLE_INT("net.link.bridge.pfil_onlyip", &pfil_onlyip);
 SYSCTL_INT(_net_link_bridge, OID_AUTO, pfil_onlyip, CTLFLAG_RW,
     &pfil_onlyip, 0, "Only pass IP packets when pfil is enabled");
+TUNABLE_INT("net.link.bridge.ipfw_arp", &pfil_ipfw_arp);
 SYSCTL_INT(_net_link_bridge, OID_AUTO, ipfw_arp, CTLFLAG_RW,
     &pfil_ipfw_arp, 0, "Filter ARP packets through IPFW layer2");
+TUNABLE_INT("net.link.bridge.pfil_bridge", &pfil_bridge);
 SYSCTL_INT(_net_link_bridge, OID_AUTO, pfil_bridge, CTLFLAG_RW,
     &pfil_bridge, 0, "Packet filter on the bridge interface");
+TUNABLE_INT("net.link.bridge.pfil_member", &pfil_member);
 SYSCTL_INT(_net_link_bridge, OID_AUTO, pfil_member, CTLFLAG_RW,
     &pfil_member, 0, "Packet filter on the member interface");
+TUNABLE_INT("net.link.bridge.pfil_local_phys", &pfil_local_phys);
 SYSCTL_INT(_net_link_bridge, OID_AUTO, pfil_local_phys, CTLFLAG_RW,
     &pfil_local_phys, 0,
     "Packet filter on the physical interface for locally destined packets");
+TUNABLE_INT("net.link.bridge.log_stp", &log_stp);
 SYSCTL_INT(_net_link_bridge, OID_AUTO, log_stp, CTLFLAG_RW,
     &log_stp, 0, "Log STP state changes");
+TUNABLE_INT("net.link.bridge.inherit_mac", &bridge_inherit_mac);
 SYSCTL_INT(_net_link_bridge, OID_AUTO, inherit_mac, CTLFLAG_RW,
     &bridge_inherit_mac, 0,
     "Inherit MAC address from the first bridge member");

From owner-svn-src-stable-9@FreeBSD.ORG  Sat May 26 08:44:27 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 2E2C5106564A;
	Sat, 26 May 2012 08:44:27 +0000 (UTC)
	(envelope-from thompsa@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id F38A98FC08;
	Sat, 26 May 2012 08:44: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 q4Q8iQNM063380;
	Sat, 26 May 2012 08:44:26 GMT (envelope-from thompsa@svn.freebsd.org)
Received: (from thompsa@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4Q8iQqY063378;
	Sat, 26 May 2012 08:44:26 GMT (envelope-from thompsa@svn.freebsd.org)
Message-Id: <201205260844.q4Q8iQqY063378@svn.freebsd.org>
From: Andrew Thompson <thompsa@FreeBSD.org>
Date: Sat, 26 May 2012 08:44:26 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r236074 - stable/9/sys/net
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sat, 26 May 2012 08:44:27 -0000

Author: thompsa
Date: Sat May 26 08:44:26 2012
New Revision: 236074
URL: http://svn.freebsd.org/changeset/base/236074

Log:
  MFC r234936 (emaste)
  
   Relax restriction on direct tx to child ports
  
   Lagg(4) restricts the type of packet that may be sent directly to a child
   port, to avoid undesired output from accidental misconfiguration.
   Previously only ETHERTYPE_PAE was permitted.
  
   BPF writes to a lagg(4) child port are presumably intentional, so just
   allow them, while still blocking other packets that should take the
   aggregation path.
  
  PR:		kern/138620

Modified:
  stable/9/sys/net/if_lagg.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/amd64/include/xen/   (props changed)
  stable/9/sys/boot/   (props changed)
  stable/9/sys/boot/i386/efi/   (props changed)
  stable/9/sys/boot/ia64/efi/   (props changed)
  stable/9/sys/boot/ia64/ski/   (props changed)
  stable/9/sys/boot/powerpc/boot1.chrp/   (props changed)
  stable/9/sys/boot/powerpc/ofw/   (props changed)
  stable/9/sys/cddl/contrib/opensolaris/   (props changed)
  stable/9/sys/conf/   (props changed)
  stable/9/sys/contrib/dev/acpica/   (props changed)
  stable/9/sys/contrib/octeon-sdk/   (props changed)
  stable/9/sys/contrib/pf/   (props changed)
  stable/9/sys/contrib/x86emu/   (props changed)
  stable/9/sys/dev/   (props changed)
  stable/9/sys/dev/e1000/   (props changed)
  stable/9/sys/dev/ixgbe/   (props changed)
  stable/9/sys/fs/   (props changed)
  stable/9/sys/fs/ntfs/   (props changed)
  stable/9/sys/modules/   (props changed)

Modified: stable/9/sys/net/if_lagg.c
==============================================================================
--- stable/9/sys/net/if_lagg.c	Sat May 26 08:43:51 2012	(r236073)
+++ stable/9/sys/net/if_lagg.c	Sat May 26 08:44:26 2012	(r236074)
@@ -764,28 +764,18 @@ fallback:
 	return (EINVAL);
 }
 
+/*
+ * For direct output to child ports.
+ */
 static int
 lagg_port_output(struct ifnet *ifp, struct mbuf *m,
 	struct sockaddr *dst, struct route *ro)
 {
 	struct lagg_port *lp = ifp->if_lagg;
-	struct ether_header *eh;
-	short type = 0;
 
 	switch (dst->sa_family) {
 		case pseudo_AF_HDRCMPLT:
 		case AF_UNSPEC:
-			eh = (struct ether_header *)dst->sa_data;
-			type = eh->ether_type;
-			break;
-	}
-
-	/*
-	 * Only allow ethernet types required to initiate or maintain the link,
-	 * aggregated frames take a different path.
-	 */
-	switch (ntohs(type)) {
-		case ETHERTYPE_PAE:	/* EAPOL PAE/802.1x */
 			return ((*lp->lp_output)(ifp, m, dst, ro));
 	}
 

From owner-svn-src-stable-9@FreeBSD.ORG  Sat May 26 08:54:27 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 19F97106564A;
	Sat, 26 May 2012 08:54:27 +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 01AE88FC15;
	Sat, 26 May 2012 08:54: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 q4Q8sQvH063914;
	Sat, 26 May 2012 08:54:26 GMT (envelope-from marius@svn.freebsd.org)
Received: (from marius@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4Q8sQjW063905;
	Sat, 26 May 2012 08:54:26 GMT (envelope-from marius@svn.freebsd.org)
Message-Id: <201205260854.q4Q8sQjW063905@svn.freebsd.org>
From: Marius Strobl <marius@FreeBSD.org>
Date: Sat, 26 May 2012 08:54:26 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r236076 - in stable/9/sys/boot: ofw/libofw sparc64
	sparc64/boot1 sparc64/loader sparc64/zfsboot sparc64/zfsloader zfs
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sat, 26 May 2012 08:54:27 -0000

Author: marius
Date: Sat May 26 08:54:26 2012
New Revision: 236076
URL: http://svn.freebsd.org/changeset/base/236076

Log:
  MFC: r234898, r235207
  
  Add initial support for booting from ZFS on sparc64. At least on Sun Fire
  V100, the firmware is known to be broken and not allowing to simultaneously
  open disk devices, causing attempts to boot from a mirror or RAIDZ to cause
  a crash. This will be worked around later. The firmwares of newer sun4u models
  don't seem to exhibit this problem though.
  
  PR:             165025
  Submitted by:   Gavin Mu

Added:
  stable/9/sys/boot/sparc64/zfsboot/
     - copied from r234898, head/sys/boot/sparc64/zfsboot/
  stable/9/sys/boot/sparc64/zfsloader/
     - copied from r234898, head/sys/boot/sparc64/zfsloader/
Modified:
  stable/9/sys/boot/ofw/libofw/devicename.c
  stable/9/sys/boot/sparc64/Makefile
  stable/9/sys/boot/sparc64/boot1/Makefile
  stable/9/sys/boot/sparc64/boot1/boot1.c
  stable/9/sys/boot/sparc64/loader/Makefile
  stable/9/sys/boot/sparc64/loader/main.c
  stable/9/sys/boot/sparc64/zfsboot/Makefile
  stable/9/sys/boot/zfs/zfs.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/amd64/include/xen/   (props changed)
  stable/9/sys/boot/   (props changed)
  stable/9/sys/boot/i386/efi/   (props changed)
  stable/9/sys/boot/ia64/efi/   (props changed)
  stable/9/sys/boot/ia64/ski/   (props changed)
  stable/9/sys/boot/powerpc/boot1.chrp/   (props changed)
  stable/9/sys/boot/powerpc/ofw/   (props changed)
  stable/9/sys/cddl/contrib/opensolaris/   (props changed)
  stable/9/sys/conf/   (props changed)
  stable/9/sys/contrib/dev/acpica/   (props changed)
  stable/9/sys/contrib/octeon-sdk/   (props changed)
  stable/9/sys/contrib/pf/   (props changed)
  stable/9/sys/contrib/x86emu/   (props changed)
  stable/9/sys/dev/   (props changed)
  stable/9/sys/dev/e1000/   (props changed)
  stable/9/sys/dev/ixgbe/   (props changed)
  stable/9/sys/fs/   (props changed)
  stable/9/sys/fs/ntfs/   (props changed)
  stable/9/sys/modules/   (props changed)

Modified: stable/9/sys/boot/ofw/libofw/devicename.c
==============================================================================
--- stable/9/sys/boot/ofw/libofw/devicename.c	Sat May 26 08:44:50 2012	(r236075)
+++ stable/9/sys/boot/ofw/libofw/devicename.c	Sat May 26 08:54:26 2012	(r236076)
@@ -28,6 +28,8 @@
 __FBSDID("$FreeBSD$");
 
 #include <stand.h>
+
+#include "bootstrap.h"
 #include "libofw.h"
 
 static int ofw_parsedev(struct ofw_devdesc **, const char *, const char **);
@@ -76,6 +78,7 @@ ofw_parsedev(struct ofw_devdesc **dev, c
     phandle_t		handle;
     const char		*p;
     const char		*s;
+    char		*ep;
     char		name[256];
     char		type[64];
     int			len;
@@ -87,9 +90,10 @@ ofw_parsedev(struct ofw_devdesc **dev, c
 	len = s - devspec;
 	bcopy(devspec, name, len);
 	name[len] = '\0';
-	if ((handle = OF_finddevice(name)) == -1)
-	    break;
-	if (OF_getprop(handle, "device_type", type, sizeof(type)) == -1)
+	if ((handle = OF_finddevice(name)) == -1) {
+	    bcopy(name, type, len);
+	    type[len] = '\0';
+	} else if (OF_getprop(handle, "device_type", type, sizeof(type)) == -1)
 	    continue;
 	for (i = 0; (dv = devsw[i]) != NULL; i++) {
 	    if (strncmp(dv->dv_name, type, strlen(dv->dv_name)) == 0)
@@ -109,6 +113,18 @@ found:
     strcpy(idev->d_path, name);
     idev->d_dev = dv;
     idev->d_type = dv->dv_type;
+    if (idev->d_type == DEVT_ZFS) {
+	idev->d_unit = 0;
+	p = name + strlen(dv->dv_name);
+	if (*p && (*p != ':')) {
+	    idev->d_unit = strtol(p, &ep, 0);
+	    if (ep == p) {
+		free(idev);
+		return (EUNIT);
+	    }
+	}
+    }
+
     if (dev == NULL) {
 	free(idev);
     } else {

Modified: stable/9/sys/boot/sparc64/Makefile
==============================================================================
--- stable/9/sys/boot/sparc64/Makefile	Sat May 26 08:44:50 2012	(r236075)
+++ stable/9/sys/boot/sparc64/Makefile	Sat May 26 08:54:26 2012	(r236076)
@@ -1,5 +1,5 @@
 # $FreeBSD$
 
-SUBDIR=	boot1 loader
+SUBDIR=	boot1 loader zfsboot zfsloader
 
 .include <bsd.subdir.mk>

Modified: stable/9/sys/boot/sparc64/boot1/Makefile
==============================================================================
--- stable/9/sys/boot/sparc64/boot1/Makefile	Sat May 26 08:44:50 2012	(r236075)
+++ stable/9/sys/boot/sparc64/boot1/Makefile	Sat May 26 08:54:26 2012	(r236076)
@@ -3,22 +3,23 @@
 PROG=	boot1.elf
 INTERNALPROG=
 NO_MAN=
-FILES=	boot1
+FILES?=	boot1
 SRCS=	_start.s boot1.c
+CLEANFILES=${FILES} boot1.aout
 
 BOOTBLOCKBASE= 0x4000
 
-CFLAGS=	-mcmodel=medlow -Os -I${.CURDIR}/../../common
+CFLAGS+=-mcmodel=medlow -Os -I${.CURDIR}/../../common
 LDFLAGS=-Ttext ${BOOTBLOCKBASE} -Wl,-N
 
 # Construct boot1. sunlabel expects it to contain zeroed-out space for the
 # label, and to be of the correct size.
-boot1: boot1.aout
+${FILES}: boot1.aout
+	@set -- `ls -l boot1.aout`; x=$$((7680-$$5)); \
+	    echo "$$x bytes available"; test $$x -ge 0
 	dd if=/dev/zero of=${.TARGET} bs=512 count=16
 	dd if=boot1.aout of=${.TARGET} bs=512 oseek=1 conv=notrunc
 
-CLEANFILES= boot1.aout
-
 boot1.aout: boot1.elf
 	elf2aout -o ${.TARGET} ${.ALLSRC}
 

Modified: stable/9/sys/boot/sparc64/boot1/boot1.c
==============================================================================
--- stable/9/sys/boot/sparc64/boot1/boot1.c	Sat May 26 08:44:50 2012	(r236075)
+++ stable/9/sys/boot/sparc64/boot1/boot1.c	Sat May 26 08:54:26 2012	(r236076)
@@ -20,11 +20,13 @@ __FBSDID("$FreeBSD$");
 
 #include <sys/param.h>
 #include <sys/dirent.h>
+
 #include <machine/elf.h>
 #include <machine/stdarg.h>
 
-#define _PATH_LOADER	"/boot/loader"
-#define _PATH_KERNEL	"/boot/kernel/kernel"
+#define	_PATH_LOADER	"/boot/loader"
+#define	_PATH_KERNEL	"/boot/kernel/kernel"
+#define	READ_BUF_SIZE	8192
 
 typedef int putc_func_t(char c, void *arg);
 typedef int32_t ofwh_t;
@@ -45,17 +47,21 @@ static ofwh_t bootdev;
 static uint32_t fs_off;
 
 int main(int ac, char **av);
-
 static void exit(int) __dead2;
-static void load(const char *);
-static int dskread(void *, u_int64_t, int);
-
 static void usage(void);
 
+#ifdef ZFSBOOT
+static void loadzfs(void);
+static int zbread(char *buf, off_t off, size_t bytes);
+#else
+static void load(const char *);
+#endif
+
 static void bcopy(const void *src, void *dst, size_t len);
 static void bzero(void *b, size_t len);
 
 static int mount(const char *device);
+static int dskread(void *buf, u_int64_t lba, int nblk);
 
 static void panic(const char *fmt, ...) __dead2;
 static int printf(const char *fmt, ...);
@@ -312,8 +318,6 @@ strcmp(const char *s1, const char *s2)
 	return ((u_char)*s1 - (u_char)*s2);
 }
 
-#include "ufsread.c"
-
 int
 main(int ac, char **av)
 {
@@ -335,14 +339,22 @@ main(int ac, char **av)
 		}
 	}
 
-	printf(" \n>> FreeBSD/sparc64 boot block\n"
-	"   Boot path:   %s\n"
-	"   Boot loader: %s\n", bootpath, path);
+#ifdef ZFSBOOT
+	printf(" \n>> FreeBSD/sparc64 ZFS boot block\n    Boot path:   %s\n",
+	    bootpath);
+#else
+	printf(" \n>> FreeBSD/sparc64 boot block\n    Boot path:   %s\n"
+	    "   Boot loader: %s\n", "", bootpath, path);
+#endif
 
 	if (mount(bootpath) == -1)
 		panic("mount");
 
+#ifdef ZFSBOOT
+	loadzfs();
+#else
 	load(path);
+#endif
 	return (1);
 }
 
@@ -361,24 +373,86 @@ exit(int code)
 	ofw_exit();
 }
 
-static struct dmadat __dmadat;
+#ifdef ZFSBOOT
+
+#define	VDEV_BOOT_OFFSET	(2 * 256 * 1024)
+static char zbuf[READ_BUF_SIZE];
 
 static int
-mount(const char *device)
+zbread(char *buf, off_t off, size_t bytes)
 {
+	size_t len;
+	off_t poff;
+	off_t soff;
+	char *p;
+	unsigned int nb;
+	unsigned int lb;
 
-	dmadat = &__dmadat;
-	if ((bootdev = ofw_open(device)) == -1) {
-		printf("mount: can't open device\n");
-		return (-1);
+	p = buf;
+	soff = VDEV_BOOT_OFFSET + off;
+	lb = (soff + bytes + DEV_BSIZE - 1) / DEV_BSIZE;
+	poff = soff;
+	while (poff < soff + bytes) {
+		nb = lb - poff / DEV_BSIZE;
+		if (nb > READ_BUF_SIZE / DEV_BSIZE)
+			nb = READ_BUF_SIZE / DEV_BSIZE;
+		if (dskread(zbuf, poff / DEV_BSIZE, nb))
+			break;
+		if ((poff / DEV_BSIZE + nb) * DEV_BSIZE > soff + bytes)
+			len = soff + bytes - poff;
+		else
+			len = (poff / DEV_BSIZE + nb) * DEV_BSIZE - poff;
+		memcpy(p, zbuf + poff % DEV_BSIZE, len);
+		p += len;
+		poff += len;
 	}
-	if (fsread(0, NULL, 0)) {
-		printf("mount: can't read superblock\n");
-		return (-1);
+	return (poff - soff);
+}
+
+static void
+loadzfs(void)
+{
+	Elf64_Ehdr eh;
+	Elf64_Phdr ph;
+	caddr_t p;
+	ino_t ino;
+	int i;
+
+	if (zbread((char *)&eh, 0, sizeof(eh)) != sizeof(eh)) {
+		printf("Can't read elf header\n");
+		return;
 	}
-	return (0);
+	if (!IS_ELF(eh)) {
+		printf("Not an ELF file\n");
+		return;
+	}
+	for (i = 0; i < eh.e_phnum; i++) {
+		fs_off = eh.e_phoff + i * eh.e_phentsize;
+		if (zbread((char *)&ph, fs_off, sizeof(ph)) != sizeof(ph)) {
+			printf("Can't read program header %d\n", i);
+			return;
+		}
+		if (ph.p_type != PT_LOAD)
+			continue;
+		fs_off = ph.p_offset;
+		p = (caddr_t)ph.p_vaddr;
+		if (zbread(p, fs_off, ph.p_filesz) != ph.p_filesz) {
+			printf("Can't read content of section %d\n", i);
+			return;
+		}
+		if (ph.p_filesz != ph.p_memsz)
+			bzero(p + ph.p_filesz, ph.p_memsz - ph.p_filesz);
+	}
+	ofw_close(bootdev);
+	(*(void (*)(int, int, int, int, ofwfp_t))eh.e_entry)(0, 0, 0, 0, ofw);
 }
 
+#else
+
+#include "ufsread.c"
+
+static struct dmadat __dmadat;
+
 static void
 load(const char *fname)
 {
@@ -421,6 +495,26 @@ load(const char *fname)
 	(*(void (*)(int, int, int, int, ofwfp_t))eh.e_entry)(0, 0, 0, 0, ofw);
 }
 
+#endif /* ZFSBOOT */
+
+static int
+mount(const char *device)
+{
+
+	if ((bootdev = ofw_open(device)) == -1) {
+		printf("mount: can't open device\n");
+		return (-1);
+	}
+#ifndef ZFSBOOT
+	dmadat = &__dmadat;
+	if (fsread(0, NULL, 0)) {
+		printf("mount: can't read superblock\n");
+		return (-1);
+	}
+#endif
+	return (0);
+}
+
 static int
 dskread(void *buf, u_int64_t lba, int nblk)
 {

Modified: stable/9/sys/boot/sparc64/loader/Makefile
==============================================================================
--- stable/9/sys/boot/sparc64/loader/Makefile	Sat May 26 08:44:50 2012	(r236075)
+++ stable/9/sys/boot/sparc64/loader/Makefile	Sat May 26 08:54:26 2012	(r236076)
@@ -3,8 +3,8 @@
 .include <bsd.own.mk>
 MK_SSP=		no
 
-PROG=		loader
-NEWVERSWHAT=	"bootstrap loader" sparc64
+PROG?=		loader
+NEWVERSWHAT?=	"bootstrap loader" sparc64
 INSTALLFLAGS=	-b
 
 # Architecture-specific loader code
@@ -13,12 +13,17 @@ SRCS=		locore.S main.c metadata.c vers.c
 LOADER_DISK_SUPPORT?=	yes
 LOADER_UFS_SUPPORT?=	yes
 LOADER_CD9660_SUPPORT?=	yes
+LOADER_ZFS_SUPPORT?=	no
 LOADER_NET_SUPPORT?=	yes
 LOADER_NFS_SUPPORT?=	yes
 LOADER_TFTP_SUPPORT?=	yes
 LOADER_GZIP_SUPPORT?=	yes
 LOADER_BZIP2_SUPPORT?=	no
+LOADER_DEBUG?=		no
 
+.if ${LOADER_DEBUG} == "yes"
+CFLAGS+=	-DLOADER_DEBUG
+.endif
 .if ${LOADER_DISK_SUPPORT} == "yes"
 CFLAGS+=	-DLOADER_DISK_SUPPORT
 .endif
@@ -28,6 +33,11 @@ CFLAGS+=	-DLOADER_UFS_SUPPORT
 .if ${LOADER_CD9660_SUPPORT} == "yes"
 CFLAGS+=	-DLOADER_CD9660_SUPPORT
 .endif
+.if ${LOADER_ZFS_SUPPORT} == "yes"
+CFLAGS+=	-DLOADER_ZFS_SUPPORT
+CFLAGS+=	-I${.CURDIR}/../../zfs
+CFLAGS+=	-I${.CURDIR}/../../../cddl/boot/zfs
+.endif
 .if ${LOADER_GZIP_SUPPORT} == "yes"
 CFLAGS+=	-DLOADER_GZIP_SUPPORT
 .endif
@@ -47,7 +57,8 @@ CFLAGS+=	-DLOADER_TFTP_SUPPORT
 .if ${MK_FORTH} != "no"
 # Enable BootForth
 BOOT_FORTH=	yes
-CFLAGS+=	-DBOOT_FORTH -I${.CURDIR}/../../ficl -I${.CURDIR}/../../ficl/sparc64
+CFLAGS+=	-DBOOT_FORTH -I${.CURDIR}/../../ficl
+CFLAGS+=	-I${.CURDIR}/../../ficl/sparc64
 LIBFICL=	${.OBJDIR}/../../ficl/libficl.a
 .endif
 
@@ -75,8 +86,9 @@ CFLAGS+=	-I${.CURDIR}/../../../../lib/li
 DPADD=		${LIBFICL} ${LIBOFW} ${LIBSTAND}
 LDADD=		${LIBFICL} ${LIBOFW} -lstand
 
-vers.c:	${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version
-	sh ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version ${NEWVERSWHAT}
+vers.c:	${.CURDIR}/../../common/newvers.sh ${.CURDIR}/../loader/version
+	sh ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/../loader/version \
+	    ${NEWVERSWHAT}
 
 loader.help: help.common help.sparc64
 	cat ${.ALLSRC} | \

Modified: stable/9/sys/boot/sparc64/loader/main.c
==============================================================================
--- stable/9/sys/boot/sparc64/loader/main.c	Sat May 26 08:44:50 2012	(r236075)
+++ stable/9/sys/boot/sparc64/loader/main.c	Sat May 26 08:54:26 2012	(r236076)
@@ -51,6 +51,9 @@ __FBSDID("$FreeBSD$");
 #include <sys/linker.h>
 #include <sys/queue.h>
 #include <sys/types.h>
+#ifdef LOADER_ZFS_SUPPORT
+#include <sys/vtoc.h>
+#endif
 
 #include <vm/vm.h>
 #include <machine/asi.h>
@@ -143,6 +146,11 @@ static vm_offset_t heapva;
 
 static phandle_t root;
 
+#ifdef LOADER_ZFS_SUPPORT
+static int zfs_dev_init(void);
+#include "zfs.c"
+#endif
+
 /*
  * Machine dependent structures that the machine independent
  * loader part uses.
@@ -154,6 +162,9 @@ struct devsw *devsw[] = {
 #ifdef LOADER_NET_SUPPORT
 	&netdev,
 #endif
+#ifdef LOADER_ZFS_SUPPORT
+	&zfs_dev,
+#endif
 	0
 };
 struct arch_switch archsw;
@@ -166,6 +177,7 @@ struct file_format *file_formats[] = {
 	&sparc64_elf,
 	0
 };
+
 struct fs_ops *file_system[] = {
 #ifdef LOADER_UFS_SUPPORT
 	&ufs_fsops,
@@ -173,6 +185,9 @@ struct fs_ops *file_system[] = {
 #ifdef LOADER_CD9660_SUPPORT
 	&cd9660_fsops,
 #endif
+#ifdef LOADER_ZFS_SUPPORT
+	&zfs_fsops,
+#endif
 #ifdef LOADER_ZIP_SUPPORT
 	&zipfs_fsops,
 #endif
@@ -721,6 +736,82 @@ tlb_init_sun4u(void)
 		panic("%s: can't allocate TLB store", __func__);
 }
 
+#ifdef LOADER_ZFS_SUPPORT
+
+static int
+zfs_dev_init(void)
+{
+	struct vtoc8 vtoc;
+	char devname[512];
+	spa_t *spa;
+	vdev_t *vdev;
+	uint64_t guid;
+	int fd, part, unit;
+
+	zfs_init();
+
+	guid = 0;
+	/* Get the GUID of the ZFS pool on the boot device. */
+	fd = open(getenv("currdev"), O_RDONLY);
+	if (fd != -1) {
+		if (vdev_probe(vdev_read, (void *)(uintptr_t) fd, &spa) == 0)
+			guid = spa->spa_guid;
+		close(fd);
+	}
+
+	/* Clean up the environment to let ZFS work. */
+	while ((vdev = STAILQ_FIRST(&zfs_vdevs)) != NULL) {
+		STAILQ_REMOVE_HEAD(&zfs_vdevs, v_alllink);
+		free(vdev);
+	}
+	while ((spa = STAILQ_FIRST(&zfs_pools)) != NULL) {
+		STAILQ_REMOVE_HEAD(&zfs_pools, spa_link);
+		free(spa);
+	}
+
+	for (unit = 0; unit < MAXBDDEV; unit++) {
+		/* Find freebsd-zfs slices in the VTOC. */
+		sprintf(devname, "disk%d:", unit);
+		fd = open(devname, O_RDONLY);
+		if (fd == -1)
+			continue;
+		lseek(fd, 0, SEEK_SET);
+		if (read(fd, &vtoc, sizeof(vtoc)) != sizeof(vtoc)) {
+			close(fd);
+			continue;
+		}
+		close(fd);
+
+		for (part = 0; part < 8; part++) {
+			if (part == 2 || vtoc.part[part].tag !=
+			     VTOC_TAG_FREEBSD_ZFS)
+				continue;
+			sprintf(devname, "disk%d:%c", unit, part + 'a');
+			fd = open(devname, O_RDONLY);
+			if (fd == -1)
+				break;
+
+			if (vdev_probe(vdev_read, (void*)(uintptr_t) fd, 0))
+				close(fd);
+		}
+	}
+
+	if (guid != 0) {
+		unit = zfs_guid_to_unit(guid);
+		if (unit >= 0) {
+			/* Update the environment for ZFS. */
+			sprintf(devname, "zfs%d", unit);
+			env_setenv("currdev", EV_VOLATILE, devname,
+			   ofw_setcurrdev, env_nounset);
+			env_setenv("loaddev", EV_VOLATILE, devname,
+			   env_noset, env_nounset);
+		}
+	}
+	return (0);
+}
+
+#endif /* LOADER_ZFS_SUPPORT */
+
 int
 main(int (*openfirm)(void *))
 {
@@ -756,14 +847,6 @@ main(int (*openfirm)(void *))
 	mmu_ops->tlb_init();
 
 	/*
-	 * Initialize devices.
-	 */
-	for (dp = devsw; *dp != 0; dp++) {
-		if ((*dp)->dv_init != 0)
-			(*dp)->dv_init();
-	}
-
-	/*
 	 * Set up the current device.
 	 */
 	OF_getprop(chosen, "bootpath", bootpath, sizeof(bootpath));
@@ -780,7 +863,8 @@ main(int (*openfirm)(void *))
 	 * needs to be altered.
 	 */
 	if (bootpath[strlen(bootpath) - 2] == ':' &&
-	    bootpath[strlen(bootpath) - 1] == 'f') {
+	    bootpath[strlen(bootpath) - 1] == 'f' &&
+	    strstr(bootpath, "cdrom")) {
 		bootpath[strlen(bootpath) - 1] = 'a';
 		printf("Boot path set to %s\n", bootpath);
 	}
@@ -790,6 +874,13 @@ main(int (*openfirm)(void *))
 	env_setenv("loaddev", EV_VOLATILE, bootpath,
 	    env_noset, env_nounset);
 
+	/*
+	 * Initialize devices.
+	 */
+	for (dp = devsw; *dp != 0; dp++)
+		if ((*dp)->dv_init != 0)
+			(*dp)->dv_init();
+
 	printf("\n");
 	printf("%s, Revision %s\n", bootprog_name, bootprog_rev);
 	printf("(%s, %s)\n", bootprog_maker, bootprog_date);

Modified: stable/9/sys/boot/sparc64/zfsboot/Makefile
==============================================================================
--- head/sys/boot/sparc64/zfsboot/Makefile	Tue May  1 17:16:01 2012	(r234898)
+++ stable/9/sys/boot/sparc64/zfsboot/Makefile	Sat May 26 08:54:26 2012	(r236076)
@@ -5,9 +5,5 @@
 PROGNAME=	zfsboot
 CFLAGS+=	-DZFSBOOT
 FILES=		zfsboot
-CLEANFILES+=	zfsboot
-
-zfsboot: boot1
-	ln -s ${.ALLSRC} ${.TARGET}
 
 .include "${.CURDIR}/../boot1/Makefile"

Modified: stable/9/sys/boot/zfs/zfs.c
==============================================================================
--- stable/9/sys/boot/zfs/zfs.c	Sat May 26 08:44:50 2012	(r236075)
+++ stable/9/sys/boot/zfs/zfs.c	Sat May 26 08:54:26 2012	(r236076)
@@ -399,6 +399,7 @@ zfs_guid_to_unit(uint64_t guid)
 	return (-1);
 }
 
+#if defined(__amd64__) || defined(__i386__)
 static int
 zfs_dev_init(void) 
 {
@@ -441,6 +442,7 @@ zfs_dev_init(void) 
 
 	return (0);
 }
+#endif
 
 /*
  * Print information about ZFS pools

From owner-svn-src-stable-9@FreeBSD.ORG  Sat May 26 08:58:28 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 21AFC106564A;
	Sat, 26 May 2012 08:58:28 +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 0ABC28FC0C;
	Sat, 26 May 2012 08:58: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 q4Q8wReb064191;
	Sat, 26 May 2012 08:58:27 GMT (envelope-from marius@svn.freebsd.org)
Received: (from marius@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4Q8wRNS064187;
	Sat, 26 May 2012 08:58:27 GMT (envelope-from marius@svn.freebsd.org)
Message-Id: <201205260858.q4Q8wRNS064187@svn.freebsd.org>
From: Marius Strobl <marius@FreeBSD.org>
Date: Sat, 26 May 2012 08:58:27 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r236078 - in stable/9/sys: conf dev/iicbus
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sat, 26 May 2012 08:58:28 -0000

Author: marius
Date: Sat May 26 08:58:27 2012
New Revision: 236078
URL: http://svn.freebsd.org/changeset/base/236078

Log:
  MFC: r234248
  
  Add a driver for the NXP (Philips) PCF8563 RTC.
  
  Obtained from:	NetBSD (pcf8563reg.h)

Added:
  stable/9/sys/dev/iicbus/pcf8563.c
     - copied unchanged from r234248, head/sys/dev/iicbus/pcf8563.c
  stable/9/sys/dev/iicbus/pcf8563reg.h
     - copied unchanged from r234248, head/sys/dev/iicbus/pcf8563reg.h
Modified:
  stable/9/sys/conf/files
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/amd64/include/xen/   (props changed)
  stable/9/sys/boot/   (props changed)
  stable/9/sys/boot/i386/efi/   (props changed)
  stable/9/sys/boot/ia64/efi/   (props changed)
  stable/9/sys/boot/ia64/ski/   (props changed)
  stable/9/sys/boot/powerpc/boot1.chrp/   (props changed)
  stable/9/sys/boot/powerpc/ofw/   (props changed)
  stable/9/sys/cddl/contrib/opensolaris/   (props changed)
  stable/9/sys/conf/   (props changed)
  stable/9/sys/contrib/dev/acpica/   (props changed)
  stable/9/sys/contrib/octeon-sdk/   (props changed)
  stable/9/sys/contrib/pf/   (props changed)
  stable/9/sys/contrib/x86emu/   (props changed)
  stable/9/sys/dev/   (props changed)
  stable/9/sys/dev/e1000/   (props changed)
  stable/9/sys/dev/ixgbe/   (props changed)
  stable/9/sys/fs/   (props changed)
  stable/9/sys/fs/ntfs/   (props changed)
  stable/9/sys/modules/   (props changed)

Modified: stable/9/sys/conf/files
==============================================================================
--- stable/9/sys/conf/files	Sat May 26 08:54:44 2012	(r236077)
+++ stable/9/sys/conf/files	Sat May 26 08:58:27 2012	(r236078)
@@ -1146,6 +1146,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/pcf8563.c		optional pcf8563
 dev/iir/iir.c			optional iir
 dev/iir/iir_ctrl.c		optional iir
 dev/iir/iir_pci.c		optional iir pci

Copied: stable/9/sys/dev/iicbus/pcf8563.c (from r234248, head/sys/dev/iicbus/pcf8563.c)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ stable/9/sys/dev/iicbus/pcf8563.c	Sat May 26 08:58:27 2012	(r236078, copy of r234248, head/sys/dev/iicbus/pcf8563.c)
@@ -0,0 +1,202 @@
+/*-
+ * Copyright (c) 2012 Marius Strobl <marius@FreeBSD.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+/*
+ * Driver for NXP PCF8563 real-time clock/calendar
+ */
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/bus.h>
+#include <sys/clock.h>
+#include <sys/kernel.h>
+#include <sys/module.h>
+
+#include <dev/iicbus/iicbus.h>
+#include <dev/iicbus/iiconf.h>
+#include <dev/iicbus/pcf8563reg.h>
+
+#include "clock_if.h"
+#include "iicbus_if.h"
+
+#define	PCF8563_NCLOCKREGS	(PCF8563_R_YEAR - PCF8563_R_CS1 + 1)
+
+struct pcf8563_softc {
+	uint32_t	sc_flags;
+#define	PCF8563_CPOL	(1 << 0)	/* PCF8563_R_MONTH_C means 19xx */
+	uint16_t	sc_addr;	/* PCF8563 slave address */
+	uint16_t	sc_year0;	/* TOD clock year 0 */
+};
+
+static device_attach_t pcf8563_attach;
+static device_probe_t pcf8563_probe;
+static clock_gettime_t pcf8563_gettime;
+static clock_settime_t pcf8563_settime;
+
+static int
+pcf8563_probe(device_t dev)
+{
+
+	device_set_desc(dev, "NXP PCF8563 RTC");
+	return (BUS_PROBE_NOWILDCARD);
+}
+
+static int
+pcf8563_attach(device_t dev)
+{
+	uint8_t reg = PCF8563_R_SECOND, val;
+	struct iic_msg msgs[] = {
+		{ 0, IIC_M_WR, sizeof(reg), &reg },
+		{ 0, IIC_M_RD, sizeof(val), &val }
+	};
+	struct pcf8563_softc *sc;
+	int error;
+
+	sc = device_get_softc(dev);
+	sc->sc_addr = iicbus_get_addr(dev);
+	if (sc->sc_addr == 0)
+		sc->sc_addr = PCF8563_ADDR;
+
+	msgs[0].slave = msgs[1].slave = sc->sc_addr;
+	error = iicbus_transfer(device_get_parent(dev), msgs, sizeof(msgs) /
+	    sizeof(*msgs));
+	if (error != 0) {
+		device_printf(dev, "%s: cannot read RTC\n", __func__);
+		return (error);
+	}
+	if ((val & PCF8563_R_SECOND_VL) != 0) {
+		device_printf(dev, "%s: battery low\n", __func__);
+		return (ENXIO);
+	}
+
+	sc->sc_year0 = 1900;
+	clock_register(dev, 1000000);   /* 1 second resolution */
+	return (0);
+}
+
+static int
+pcf8563_gettime(device_t dev, struct timespec *ts)
+{
+	struct clocktime ct;
+	uint8_t reg = PCF8563_R_SECOND, val[PCF8563_NCLOCKREGS];
+	struct iic_msg msgs[] = {
+		{ 0, IIC_M_WR, sizeof(reg), &reg },
+		{ 0, IIC_M_RD, PCF8563_NCLOCKREGS, &val[PCF8563_R_SECOND] }
+	};
+	struct pcf8563_softc *sc;
+	int error;
+
+	sc = device_get_softc(dev);
+	msgs[0].slave = msgs[1].slave = sc->sc_addr;
+	error = iicbus_transfer(device_get_parent(dev), msgs, sizeof(msgs) /
+	    sizeof(*msgs));
+	if (error != 0) {
+		device_printf(dev, "%s: cannot read RTC\n", __func__);
+		return (error);
+	}
+
+	ct.nsec = 0;
+	ct.sec = FROMBCD(val[PCF8563_R_SECOND] & PCF8563_M_SECOND);
+	ct.min = FROMBCD(val[PCF8563_R_MINUTE] & PCF8563_M_MINUTE);
+	ct.hour = FROMBCD(val[PCF8563_R_HOUR] & PCF8563_M_HOUR);
+	ct.day = FROMBCD(val[PCF8563_R_DAY] & PCF8563_M_DAY);
+	ct.dow = val[PCF8563_R_WEEKDAY] & PCF8563_M_WEEKDAY;
+	ct.mon = FROMBCD(val[PCF8563_R_MONTH] & PCF8563_M_MONTH);
+	ct.year = FROMBCD(val[PCF8563_R_YEAR] & PCF8563_M_YEAR);
+	ct.year += sc->sc_year0;
+	if (ct.year < POSIX_BASE_YEAR)
+		ct.year += 100;	/* assume [1970, 2069] */
+	if ((val[PCF8563_R_MONTH] & PCF8563_R_MONTH_C) != 0) {
+		if (ct.year >= 100 + sc->sc_year0)
+			sc->sc_flags |= PCF8563_CPOL;
+	} else if (ct.year < 100 + sc->sc_year0)
+			sc->sc_flags |= PCF8563_CPOL;
+	return (clock_ct_to_ts(&ct, ts));
+}
+
+static int
+pcf8563_settime(device_t dev, struct timespec *ts)
+{
+	struct clocktime ct;
+	uint8_t val[PCF8563_NCLOCKREGS];
+	struct iic_msg msgs[] = {
+		{ 0, IIC_M_WR, PCF8563_NCLOCKREGS - 1, &val[PCF8563_R_CS2] }
+	};
+	struct pcf8563_softc *sc;
+	int error;
+
+	sc = device_get_softc(dev);
+	val[PCF8563_R_CS2] = PCF8563_R_SECOND;	/* abuse */
+	/* Accuracy is only one second. */
+	if (ts->tv_nsec >= 500000000)
+		ts->tv_sec++;
+	ts->tv_nsec = 0;
+	clock_ts_to_ct(ts, &ct);
+	val[PCF8563_R_SECOND] = TOBCD(ct.sec);
+	val[PCF8563_R_MINUTE] = TOBCD(ct.min);
+	val[PCF8563_R_HOUR] = TOBCD(ct.hour);
+	val[PCF8563_R_DAY] = TOBCD(ct.day);
+	val[PCF8563_R_WEEKDAY] = ct.dow;
+	val[PCF8563_R_MONTH] = TOBCD(ct.mon);
+	val[PCF8563_R_YEAR] = TOBCD(ct.year % 100);
+	if ((sc->sc_flags & PCF8563_CPOL) != 0) {
+		if (ct.year >= 100 + sc->sc_year0)
+			val[PCF8563_R_MONTH] |= PCF8563_R_MONTH_C;
+	} else if (ct.year < 100 + sc->sc_year0)
+			val[PCF8563_R_MONTH] |= PCF8563_R_MONTH_C;
+
+	msgs[0].slave = sc->sc_addr;
+	error = iicbus_transfer(device_get_parent(dev), msgs, sizeof(msgs) /
+	    sizeof(*msgs));
+	if (error != 0)
+		device_printf(dev, "%s: cannot write RTC\n", __func__);
+	return (error);
+}
+
+static device_method_t pcf8563_methods[] = {
+	DEVMETHOD(device_probe,		pcf8563_probe),
+	DEVMETHOD(device_attach,	pcf8563_attach),
+
+	DEVMETHOD(clock_gettime,	pcf8563_gettime),
+	DEVMETHOD(clock_settime,	pcf8563_settime),
+
+	DEVMETHOD_END
+};
+
+static driver_t pcf8563_driver = {
+	"pcf8563_rtc",
+	pcf8563_methods,
+	sizeof(struct pcf8563_softc),
+};
+
+static devclass_t pcf8563_devclass;
+
+DRIVER_MODULE(pcf8563, iicbus, pcf8563_driver, pcf8563_devclass, NULL, NULL);
+MODULE_VERSION(pcf8563, 1);
+MODULE_DEPEND(pcf8563, iicbus, 1, 1, 1);

Copied: stable/9/sys/dev/iicbus/pcf8563reg.h (from r234248, head/sys/dev/iicbus/pcf8563reg.h)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ stable/9/sys/dev/iicbus/pcf8563reg.h	Sat May 26 08:58:27 2012	(r236078, copy of r234248, head/sys/dev/iicbus/pcf8563reg.h)
@@ -0,0 +1,58 @@
+/*	$NetBSD: pcf8563reg.h,v 1.1 2011/01/21 19:11:47 jakllsch Exp $	*/
+
+/*-
+ * Jonathan Kollasch, 2011
+ *
+ * This file is in the public domain.
+ *
+ * $FreeBSD$
+ */
+
+/*
+ * NXP (Philips) PCF8563 RTC registers
+ */
+
+/* We only have clock mode registers here. */
+
+#ifndef _PCF8563REG_H_
+#define _PCF8563REG_H_
+
+/*
+ * PCF8563 RTC I2C address:
+ *
+ *	101 0001
+ */
+#define PCF8563_ADDR		0xa2
+
+#define PCF8563_R_CS1		0x00
+#define PCF8563_R_CS2		0x01
+#define PCF8563_R_SECOND	0x02
+#define PCF8563_R_MINUTE	0x03
+#define PCF8563_R_HOUR		0x04
+#define PCF8563_R_DAY		0x05
+#define PCF8563_R_WEEKDAY	0x06
+#define PCF8563_R_MONTH		0x07
+#define PCF8563_R_YEAR		0x08
+#define PCF8563_R_MINUTE_ALARM	0x09
+#define PCF8563_R_HOUR_ALARM	0x0a
+#define PCF8563_R_DAY_ALARM	0x0b
+#define PCF8563_R_WEEKDAY_ALARM	0x0c
+#define PCF8563_R_CLKOUT_CNTRL	0x0d
+#define PCF8563_R_TIMER_CNTRL	0x0e
+#define PCF8563_R_TIMER		0x0f
+
+#define PCF8563_R_SECOND_VL	0x80
+#define	PCF8563_R_MONTH_C	0x80
+
+#define PCF8563_NREGS		0x10
+
+#define PCF8563_M_SECOND	0x7f
+#define PCF8563_M_MINUTE	0x7f
+#define PCF8563_M_HOUR		0x3f
+#define PCF8563_M_DAY		0x3f
+#define PCF8563_M_WEEKDAY	0x07
+#define PCF8563_M_MONTH		0x1f
+#define PCF8563_M_CENTURY	0x80
+#define PCF8563_M_YEAR		0xff
+
+#endif	/* _PCF8563REG_H_ */

From owner-svn-src-stable-9@FreeBSD.ORG  Sat May 26 09:03:14 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id CC3451065686;
	Sat, 26 May 2012 09:03:14 +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 B4FD98FC18;
	Sat, 26 May 2012 09:03: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 q4Q93Eom064495;
	Sat, 26 May 2012 09:03:14 GMT (envelope-from marius@svn.freebsd.org)
Received: (from marius@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4Q93Enb064481;
	Sat, 26 May 2012 09:03:14 GMT (envelope-from marius@svn.freebsd.org)
Message-Id: <201205260903.q4Q93Enb064481@svn.freebsd.org>
From: Marius Strobl <marius@FreeBSD.org>
Date: Sat, 26 May 2012 09:03:14 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r236080 - stable/9/sys/arm/at91
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sat, 26 May 2012 09:03:14 -0000

Author: marius
Date: Sat May 26 09:03:14 2012
New Revision: 236080
URL: http://svn.freebsd.org/changeset/base/236080

Log:
  MFC: r234281
  
  - Try to bring these files closer to style(9).
  - Use DEVMETHOD_END.
  - Use NULL instead of 0 for pointers.

Modified:
  stable/9/sys/arm/at91/at91_pio.c
  stable/9/sys/arm/at91/at91_piovar.h
  stable/9/sys/arm/at91/at91_pit.c
  stable/9/sys/arm/at91/at91_pmc.c
  stable/9/sys/arm/at91/at91_rst.c
  stable/9/sys/arm/at91/at91_twi.c
  stable/9/sys/arm/at91/at91_twireg.h
  stable/9/sys/arm/at91/at91_wdt.c
  stable/9/sys/arm/at91/at91reg.h
  stable/9/sys/arm/at91/at91sam9260.c
  stable/9/sys/arm/at91/at91var.h
  stable/9/sys/arm/at91/if_ate.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/amd64/include/xen/   (props changed)
  stable/9/sys/boot/   (props changed)
  stable/9/sys/boot/i386/efi/   (props changed)
  stable/9/sys/boot/ia64/efi/   (props changed)
  stable/9/sys/boot/ia64/ski/   (props changed)
  stable/9/sys/boot/powerpc/boot1.chrp/   (props changed)
  stable/9/sys/boot/powerpc/ofw/   (props changed)
  stable/9/sys/cddl/contrib/opensolaris/   (props changed)
  stable/9/sys/conf/   (props changed)
  stable/9/sys/contrib/dev/acpica/   (props changed)
  stable/9/sys/contrib/octeon-sdk/   (props changed)
  stable/9/sys/contrib/pf/   (props changed)
  stable/9/sys/contrib/x86emu/   (props changed)
  stable/9/sys/dev/   (props changed)
  stable/9/sys/dev/e1000/   (props changed)
  stable/9/sys/dev/ixgbe/   (props changed)
  stable/9/sys/fs/   (props changed)
  stable/9/sys/fs/ntfs/   (props changed)
  stable/9/sys/modules/   (props changed)

Modified: stable/9/sys/arm/at91/at91_pio.c
==============================================================================
--- stable/9/sys/arm/at91/at91_pio.c	Sat May 26 08:58:29 2012	(r236079)
+++ stable/9/sys/arm/at91/at91_pio.c	Sat May 26 09:03:14 2012	(r236080)
@@ -52,30 +52,32 @@ struct at91_pio_softc
 	struct mtx sc_mtx;		/* basically a perimeter lock */
 	struct cdev *cdev;
 	int flags;
-#define OPENED 1
+#define	OPENED 1
 };
 
 static inline uint32_t
 RD4(struct at91_pio_softc *sc, bus_size_t off)
 {
+
 	return (bus_read_4(sc->mem_res, off));
 }
 
 static inline void
 WR4(struct at91_pio_softc *sc, bus_size_t off, uint32_t val)
 {
+
 	bus_write_4(sc->mem_res, off, val);
 }
 
-#define AT91_PIO_LOCK(_sc)		mtx_lock_spin(&(_sc)->sc_mtx)
+#define	AT91_PIO_LOCK(_sc)		mtx_lock_spin(&(_sc)->sc_mtx)
 #define	AT91_PIO_UNLOCK(_sc)		mtx_unlock_spin(&(_sc)->sc_mtx)
-#define AT91_PIO_LOCK_INIT(_sc) \
+#define	AT91_PIO_LOCK_INIT(_sc) \
 	mtx_init(&_sc->sc_mtx, device_get_nameunit(_sc->dev), \
 	    "pio", MTX_SPIN)
-#define AT91_PIO_LOCK_DESTROY(_sc)	mtx_destroy(&_sc->sc_mtx);
-#define AT91_PIO_ASSERT_LOCKED(_sc)	mtx_assert(&_sc->sc_mtx, MA_OWNED);
-#define AT91_PIO_ASSERT_UNLOCKED(_sc) mtx_assert(&_sc->sc_mtx, MA_NOTOWNED);
-#define CDEV2SOFTC(dev)		((dev)->si_drv1)
+#define	AT91_PIO_LOCK_DESTROY(_sc)	mtx_destroy(&_sc->sc_mtx);
+#define	AT91_PIO_ASSERT_LOCKED(_sc)	mtx_assert(&_sc->sc_mtx, MA_OWNED);
+#define	AT91_PIO_ASSERT_UNLOCKED(_sc)	mtx_assert(&_sc->sc_mtx, MA_NOTOWNED);
+#define	CDEV2SOFTC(dev)			((dev)->si_drv1)
 
 static devclass_t at91_pio_devclass;
 
@@ -132,9 +134,10 @@ at91_pio_probe(device_t dev)
 static int
 at91_pio_attach(device_t dev)
 {
-	struct at91_pio_softc *sc = device_get_softc(dev);
+	struct at91_pio_softc *sc;
 	int err;
 
+	sc = device_get_softc(dev);
 	sc->dev = dev;
 	err = at91_pio_activate(dev);
 	if (err)
@@ -146,7 +149,7 @@ at91_pio_attach(device_t dev)
 	AT91_PIO_LOCK_INIT(sc);
 
 	/*
-	 * Activate the interrupt, but disable all interrupts in the hardware
+	 * Activate the interrupt, but disable all interrupts in the hardware.
 	 */
 	WR4(sc, PIO_IDR, 0xffffffff);
 	err = bus_setup_intr(dev, sc->irq_res, INTR_TYPE_MISC,
@@ -171,6 +174,7 @@ out:;
 static int
 at91_pio_detach(device_t dev)
 {
+
 	return (EBUSY);	/* XXX */
 }
 
@@ -215,7 +219,6 @@ at91_pio_deactivate(device_t dev)
 		bus_release_resource(dev, SYS_RES_IRQ,
 		    rman_get_rid(sc->irq_res), sc->irq_res);
 	sc->irq_res = 0;
-	return;
 }
 
 static int
@@ -225,7 +228,7 @@ at91_pio_intr(void *xsc)
 #if 0
 	uint32_t status;
 
-	/* Reading the status also clears the interrupt */
+	/* Reading the status also clears the interrupt. */
 	status = RD4(sc, PIO_SR);
 	if (status == 0)
 		return;
@@ -236,7 +239,7 @@ at91_pio_intr(void *xsc)
 	return (FILTER_HANDLED);
 }
 
-static int 
+static int
 at91_pio_open(struct cdev *dev, int oflags, int devtype, struct thread *td)
 {
 	struct at91_pio_softc *sc;
@@ -246,11 +249,11 @@ at91_pio_open(struct cdev *dev, int ofla
 	if (!(sc->flags & OPENED)) {
 		sc->flags |= OPENED;
 #if 0
-	// Enable interrupts
+	/* Enable interrupts. */
 #endif
 	}
 	AT91_PIO_UNLOCK(sc);
-    	return (0);
+	return (0);
 }
 
 static int
@@ -262,7 +265,7 @@ at91_pio_close(struct cdev *dev, int ffl
 	AT91_PIO_LOCK(sc);
 	sc->flags &= ~OPENED;
 #if 0
-	// Disable interrupts
+	/* Disable interrupts. */
 #endif
 	AT91_PIO_UNLOCK(sc);
 	return (0);
@@ -272,6 +275,7 @@ static int
 at91_pio_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int fflag,
     struct thread *td)
 {
+
 	return (ENXIO);
 }
 
@@ -280,6 +284,7 @@ at91_pio_ioctl(struct cdev *dev, u_long 
  * don't use bus_space, as that isn't yet available when we need to use
  * them.
  */
+
 void
 at91_pio_use_periph_a(uint32_t pio, uint32_t periph_a_mask, int use_pullup)
 {
@@ -369,11 +374,10 @@ at91_pio_gpio_set_deglitch(uint32_t pio,
 		PIO[PIO_IFER / 4] = data_mask;
 	else
 		PIO[PIO_IFDR / 4] = data_mask;
-	return;
 }
 
 void
-at91_pio_gpio_set_interrupt(uint32_t pio, uint32_t data_mask, 
+at91_pio_gpio_set_interrupt(uint32_t pio, uint32_t data_mask,
 	int enable_interrupt)
 {
 	uint32_t *PIO = (uint32_t *)(AT91_BASE + pio);
@@ -382,14 +386,14 @@ at91_pio_gpio_set_interrupt(uint32_t pio
 		PIO[PIO_IER / 4] = data_mask;
 	else
 		PIO[PIO_IDR / 4] = data_mask;
-	return;
 }
 
 uint32_t
 at91_pio_gpio_clear_interrupt(uint32_t pio)
 {
 	uint32_t *PIO = (uint32_t *)(AT91_BASE + pio);
-	/* reading this register will clear the interrupts */
+
+	/* Reading this register will clear the interrupts. */
 	return (PIO[PIO_ISR / 4]);
 }
 
@@ -399,7 +403,7 @@ static device_method_t at91_pio_methods[
 	DEVMETHOD(device_attach,	at91_pio_attach),
 	DEVMETHOD(device_detach,	at91_pio_detach),
 
-	{ 0, 0 }
+	DEVMETHOD_END
 };
 
 static driver_t at91_pio_driver = {
@@ -408,4 +412,5 @@ static driver_t at91_pio_driver = {
 	sizeof(struct at91_pio_softc),
 };
 
-DRIVER_MODULE(at91_pio, atmelarm, at91_pio_driver, at91_pio_devclass, 0, 0);
+DRIVER_MODULE(at91_pio, atmelarm, at91_pio_driver, at91_pio_devclass, NULL,
+    NULL);

Modified: stable/9/sys/arm/at91/at91_piovar.h
==============================================================================
--- stable/9/sys/arm/at91/at91_piovar.h	Sat May 26 08:58:29 2012	(r236079)
+++ stable/9/sys/arm/at91/at91_piovar.h	Sat May 26 09:03:14 2012	(r236080)
@@ -26,19 +26,23 @@
 /* $FreeBSD$ */
 
 #ifndef ARM_AT91_AT91_PIOVAR_H
-#define ARM_AT91_AT91_PIOVAR_H
+#define	ARM_AT91_AT91_PIOVAR_H
 
-void at91_pio_use_periph_a(uint32_t pio, uint32_t periph_a_mask, int use_pullup);
-void at91_pio_use_periph_b(uint32_t pio, uint32_t periph_b_mask, int use_pullup);
+void at91_pio_use_periph_a(uint32_t pio, uint32_t periph_a_mask,
+    int use_pullup);
+void at91_pio_use_periph_b(uint32_t pio, uint32_t periph_b_mask,
+    int use_pullup);
 void at91_pio_use_gpio(uint32_t pio, uint32_t gpio_mask);
 void at91_pio_gpio_input(uint32_t pio, uint32_t input_enable_mask);
 void at91_pio_gpio_output(uint32_t pio, uint32_t output_enable_mask,
-	int use_pullup);
+    int use_pullup);
 void at91_pio_gpio_set(uint32_t pio, uint32_t data_mask);
 void at91_pio_gpio_clear(uint32_t pio, uint32_t data_mask);
 uint8_t at91_pio_gpio_get(uint32_t pio, uint32_t data_mask);
-void at91_pio_gpio_set_deglitch(uint32_t pio, uint32_t data_mask, int use_deglitch);
-void at91_pio_gpio_set_interrupt(uint32_t pio, uint32_t data_mask, int enable_interrupt);
+void at91_pio_gpio_set_deglitch(uint32_t pio, uint32_t data_mask,
+    int use_deglitch);
+void at91_pio_gpio_set_interrupt(uint32_t pio, uint32_t data_mask,
+    int enable_interrupt);
 uint32_t at91_pio_gpio_clear_interrupt(uint32_t pio);
 
 #endif /* ARM_AT91_AT91_PIOVAR_H */

Modified: stable/9/sys/arm/at91/at91_pit.c
==============================================================================
--- stable/9/sys/arm/at91/at91_pit.c	Sat May 26 08:58:29 2012	(r236079)
+++ stable/9/sys/arm/at91/at91_pit.c	Sat May 26 09:03:14 2012	(r236080)
@@ -59,12 +59,14 @@ static uint32_t timecount = 0;
 static inline uint32_t
 RD4(struct pit_softc *sc, bus_size_t off)
 {
+
 	return (bus_read_4(sc->mem_res, off));
 }
 
 static inline void
 WR4(struct pit_softc *sc, bus_size_t off, uint32_t val)
 {
+
 	bus_write_4(sc->mem_res, off, val);
 }
 
@@ -112,11 +114,11 @@ at91pit_attach(device_t dev)
 	    RF_ACTIVE);
 
 	if (sc->mem_res == NULL)
-	       panic("couldn't allocate register resources");
+		panic("couldn't allocate register resources");
 
 	rid = 0;
 	irq = bus_alloc_resource(dev, SYS_RES_IRQ, &rid, 1, 1, 1,
-	  RF_ACTIVE | RF_SHAREABLE);
+	    RF_ACTIVE | RF_SHAREABLE);
 	if (!irq) {
 		device_printf(dev, "could not allocate interrupt resources.\n");
 		err = ENOMEM;
@@ -124,16 +126,15 @@ at91pit_attach(device_t dev)
 	}
 
 	/* Activate the interrupt. */
-	err = bus_setup_intr(dev, irq, INTR_TYPE_CLK, pit_intr,
-		NULL, NULL, &ih);
-	
+	err = bus_setup_intr(dev, irq, INTR_TYPE_CLK, pit_intr, NULL, NULL,
+	    &ih);
+
 	at91pit_timecounter.tc_frequency =  at91_master_clock / PIT_PRESCALE;
 	tc_init(&at91pit_timecounter);
 
-	//Enable the PIT here.
-	WR4(sc, PIT_MR,
-		PIT_PIV(at91_master_clock / PIT_PRESCALE / hz) |
-		PIT_EN | PIT_IEN);
+	/* Enable the PIT here. */
+	WR4(sc, PIT_MR, PIT_PIV(at91_master_clock / PIT_PRESCALE / hz) |
+	    PIT_EN | PIT_IEN);
 out:
 	return (err);
 }
@@ -141,7 +142,7 @@ out:
 static device_method_t at91pit_methods[] = {
 	DEVMETHOD(device_probe, at91pit_probe),
 	DEVMETHOD(device_attach, at91pit_attach),
-	{0,0},
+	DEVMETHOD_END
 };
 
 static driver_t at91pit_driver = {
@@ -152,7 +153,8 @@ static driver_t at91pit_driver = {
 
 static devclass_t at91pit_devclass;
 
-DRIVER_MODULE(at91_pit, atmelarm, at91pit_driver, at91pit_devclass, 0, 0);
+DRIVER_MODULE(at91_pit, atmelarm, at91pit_driver, at91pit_devclass, NULL,
+    NULL);
 
 static int
 pit_intr(void *arg)
@@ -175,7 +177,7 @@ pit_intr(void *arg)
 static unsigned
 at91pit_get_timecount(struct timecounter *tc)
 {
-	uint32_t piir, icnt;	
+	uint32_t piir, icnt;
 
 	piir = RD4(sc, PIT_PIIR); /* Current  count | over flows */
 	icnt = piir >> 20;	/* Overflows */
@@ -192,7 +194,7 @@ DELAY(int us)
 	last = PIT_PIV(RD4(sc, PIT_PIIR));
 
 	/* Max delay ~= 260s. @ 133Mhz */
-        pit_freq = at91_master_clock / PIT_PRESCALE;
+	pit_freq = at91_master_clock / PIT_PRESCALE;
 	cnt  = ((pit_freq * us) + (mhz -1)) / mhz;
 	cnt  = (cnt <= 0) ? 1 : cnt;
 
@@ -211,14 +213,17 @@ DELAY(int us)
 void
 cpu_startprofclock(void)
 {
+
 }
 
 void
 cpu_stopprofclock(void)
 {
+
 }
 
 void
 cpu_initclocks(void)
 {
+
 }

Modified: stable/9/sys/arm/at91/at91_pmc.c
==============================================================================
--- stable/9/sys/arm/at91/at91_pmc.c	Sat May 26 08:58:29 2012	(r236079)
+++ stable/9/sys/arm/at91/at91_pmc.c	Sat May 26 09:03:14 2012	(r236080)
@@ -180,9 +180,8 @@ at91_pmc_set_pllb_mode(struct at91_pmc_c
 	if (on) {
 		on = PMC_IER_LOCKB;
 		value = sc->pllb_init;
-	} else {
+	} else
 		value = 0;
-	}
 
 	/* Workaround RM9200 Errata #26 */
 	if (at91_is_rm92() &&
@@ -232,12 +231,12 @@ at91_pmc_clock_add(const char *name, uin
 	int i, buflen;
 
 	clk = malloc(sizeof(*clk), M_PMC, M_NOWAIT | M_ZERO);
-	if (clk == NULL) 
+	if (clk == NULL)
 		goto err;
 
 	buflen = strlen(name) + 1;
 	clk->name = malloc(buflen, M_PMC, M_NOWAIT);
-	if (clk->name == NULL) 
+	if (clk->name == NULL)
 		goto err;
 
 	strlcpy(clk->name, name, buflen);
@@ -256,7 +255,7 @@ at91_pmc_clock_add(const char *name, uin
 	}
 err:
 	if (clk != NULL) {
-		if (clk->name != NULL) 
+		if (clk->name != NULL)
 			free(clk->name, M_PMC);
 		free(clk, M_PMC);
 	}
@@ -331,15 +330,16 @@ at91_pmc_pll_rate(struct at91_pmc_clock 
 	div = (reg >> clk->pll_div_shift) & clk->pll_div_mask;
 	mul = (reg >> clk->pll_mul_shift) & clk->pll_mul_mask;
 
-//	printf("pll = (%d /  %d) * %d = %d\n",
-//	    freq, div ,mul + 1, (freq/div) * (mul+1));
+#if 0
+	printf("pll = (%d /  %d) * %d = %d\n",
+	    freq, div, mul + 1, (freq/div) * (mul+1));
+#endif
 
 	if (div != 0 && mul != 0) {
 		freq /= div;
 		freq *= mul + 1;
-	} else {
+	} else
 		freq = 0;
-	}
 	clk->hz = freq;
 
 
@@ -431,9 +431,8 @@ at91_pmc_init_clock(struct at91_pmc_soft
 	if (at91_is_rm92()) {
 		WR4(sc, PMC_SCDR, PMC_SCER_UHP | PMC_SCER_UDP);
 		WR4(sc, PMC_SCER, PMC_SCER_MCKUDP);
-	} else {
+	} else
 		WR4(sc, PMC_SCDR, PMC_SCER_UHP_SAM9 | PMC_SCER_UDP_SAM9);
-	}
 	WR4(sc, CKGR_PLLBR, 0);
 
 	/*
@@ -443,15 +442,14 @@ at91_pmc_init_clock(struct at91_pmc_soft
 	mck.parent = clock_list[mckr & 0x3];
 	mck.parent->refcnt++;
 
-	cpu.hz = 
-	mck.hz = mck.parent->hz /
-  	     (1 << ((mckr & PMC_MCKR_PRES_MASK) >> 2));
+	cpu.hz = mck.hz = mck.parent->hz /
+	    (1 << ((mckr & PMC_MCKR_PRES_MASK) >> 2));
 
 	mdiv = (mckr & PMC_MCKR_MDIV_MASK) >> 8;
 	if (at91_is_sam9()) {
 		if (mdiv > 0)
 			mck.hz /= mdiv * 2;
-	} else 
+	} else
 		mck.hz /= (1 + mdiv);
 
 	/* Only found on SAM9G20 */
@@ -574,7 +572,7 @@ at91_pmc_attach(device_t dev)
 static device_method_t at91_pmc_methods[] = {
 	DEVMETHOD(device_probe, at91_pmc_probe),
 	DEVMETHOD(device_attach, at91_pmc_attach),
-	{0, 0},
+	DEVMETHOD_END
 };
 
 static driver_t at91_pmc_driver = {
@@ -584,4 +582,5 @@ static driver_t at91_pmc_driver = {
 };
 static devclass_t at91_pmc_devclass;
 
-DRIVER_MODULE(at91_pmc, atmelarm, at91_pmc_driver, at91_pmc_devclass, 0, 0);
+DRIVER_MODULE(at91_pmc, atmelarm, at91_pmc_driver, at91_pmc_devclass, NULL,
+    NULL);

Modified: stable/9/sys/arm/at91/at91_rst.c
==============================================================================
--- stable/9/sys/arm/at91/at91_rst.c	Sat May 26 08:58:29 2012	(r236079)
+++ stable/9/sys/arm/at91/at91_rst.c	Sat May 26 09:03:14 2012	(r236080)
@@ -40,7 +40,7 @@ __FBSDID("$FreeBSD$");
 #include <arm/at91/at91board.h>
 
 #define RST_TIMEOUT (5)	/* Seconds to hold NRST for hard reset */
-#define RST_TICK (20) 	/* sample NRST at hz/RST_TICK intervals */
+#define RST_TICK (20)	/* sample NRST at hz/RST_TICK intervals */
 
 static int rst_intr(void *arg);
 
@@ -122,7 +122,7 @@ at91_rst_attach(device_t dev)
 		case	RST_SR_RST_WAKE:
 			cause = "Wake Up";
 			break;
-		case	RST_SR_RST_WDT:	
+		case	RST_SR_RST_WDT:
 			cause = "Watchdog";
 			break;
 		case	RST_SR_RST_SOFT:
@@ -153,7 +153,7 @@ rst_tick(void *argp)
 		cpu_reset();
 	} else if ((RD4(sc, RST_SR) & RST_SR_NRSTL)) {
 		/* User released the button in less than RST_TIMEOUT */
-		sc->shutdown = 0; 
+		sc->shutdown = 0;
 		device_printf(sc->sc_dev, "shutting down...\n");
 		shutdown_nice(0);
 	} else {
@@ -167,7 +167,7 @@ rst_intr(void *argp)
 	struct rst_softc *sc = argp;
 
 	if (RD4(sc, RST_SR) & RST_SR_URSTS) {
-		if (sc->shutdown == 0) 
+		if (sc->shutdown == 0)
 			callout_reset(&sc->tick_ch, hz/RST_TICK, rst_tick, sc);
 		return (FILTER_HANDLED);
 	}
@@ -177,7 +177,7 @@ rst_intr(void *argp)
 static device_method_t at91_rst_methods[] = {
 	DEVMETHOD(device_probe, at91_rst_probe),
 	DEVMETHOD(device_attach, at91_rst_attach),
-	{0,0},
+	DEVMETHOD_END
 };
 
 static driver_t at91_rst_driver = {
@@ -188,7 +188,8 @@ static driver_t at91_rst_driver = {
 
 static devclass_t at91_rst_devclass;
 
-DRIVER_MODULE(at91_rst, atmelarm, at91_rst_driver, at91_rst_devclass, 0, 0);
+DRIVER_MODULE(at91_rst, atmelarm, at91_rst_driver, at91_rst_devclass, NULL,
+    NULL);
 
 void cpu_reset_sam9g20(void) __attribute__((weak));
 void cpu_reset_sam9g20(void) {}
@@ -198,7 +199,6 @@ cpu_reset(void)
 {
 
 	if (rst_sc) {
-
 		cpu_reset_sam9g20(); /* May be null */
 
 		WR4(rst_sc, RST_MR,
@@ -211,5 +211,6 @@ cpu_reset(void)
 		    RST_CR_KEY);
 	}
 
-	for(;;) ;
+	for(;;)
+		;
 }

Modified: stable/9/sys/arm/at91/at91_twi.c
==============================================================================
--- stable/9/sys/arm/at91/at91_twi.c	Sat May 26 08:58:29 2012	(r236079)
+++ stable/9/sys/arm/at91/at91_twi.c	Sat May 26 09:03:14 2012	(r236080)
@@ -46,9 +46,9 @@ __FBSDID("$FreeBSD$");
 #include <dev/iicbus/iicbus.h>
 #include "iicbus_if.h"
 
-#define TWI_SLOW_CLOCK		 1500
-#define TWI_FAST_CLOCK 		45000
-#define TWI_FASTEST_CLOCK	90000
+#define	TWI_SLOW_CLOCK		 1500
+#define	TWI_FAST_CLOCK		45000
+#define	TWI_FASTEST_CLOCK	90000
 
 struct at91_twi_softc
 {
@@ -67,24 +67,26 @@ struct at91_twi_softc
 static inline uint32_t
 RD4(struct at91_twi_softc *sc, bus_size_t off)
 {
+
 	return bus_read_4(sc->mem_res, off);
 }
 
 static inline void
 WR4(struct at91_twi_softc *sc, bus_size_t off, uint32_t val)
 {
+
 	bus_write_4(sc->mem_res, off, val);
 }
 
-#define AT91_TWI_LOCK(_sc)		mtx_lock(&(_sc)->sc_mtx)
+#define	AT91_TWI_LOCK(_sc)		mtx_lock(&(_sc)->sc_mtx)
 #define	AT91_TWI_UNLOCK(_sc)		mtx_unlock(&(_sc)->sc_mtx)
-#define AT91_TWI_LOCK_INIT(_sc) \
+#define	AT91_TWI_LOCK_INIT(_sc) \
 	mtx_init(&_sc->sc_mtx, device_get_nameunit(_sc->dev), \
 	    "twi", MTX_DEF)
-#define AT91_TWI_LOCK_DESTROY(_sc)	mtx_destroy(&_sc->sc_mtx);
-#define AT91_TWI_ASSERT_LOCKED(_sc)	mtx_assert(&_sc->sc_mtx, MA_OWNED);
-#define AT91_TWI_ASSERT_UNLOCKED(_sc) mtx_assert(&_sc->sc_mtx, MA_NOTOWNED);
-#define TWI_DEF_CLK	100000
+#define	AT91_TWI_LOCK_DESTROY(_sc)	mtx_destroy(&_sc->sc_mtx);
+#define	AT91_TWI_ASSERT_LOCKED(_sc)	mtx_assert(&_sc->sc_mtx, MA_OWNED);
+#define	AT91_TWI_ASSERT_UNLOCKED(_sc)	mtx_assert(&_sc->sc_mtx, MA_NOTOWNED);
+#define	TWI_DEF_CLK	100000
 
 static devclass_t at91_twi_devclass;
 
@@ -102,6 +104,7 @@ static void at91_twi_deactivate(device_t
 static int
 at91_twi_probe(device_t dev)
 {
+
 	device_set_desc(dev, "TWI");
 	return (0);
 }
@@ -385,7 +388,7 @@ static device_method_t at91_twi_methods[
 	DEVMETHOD(iicbus_callback,	at91_twi_callback),
 	DEVMETHOD(iicbus_reset,		at91_twi_rst_card),
 	DEVMETHOD(iicbus_transfer,	at91_twi_transfer),
-	{ 0, 0 }
+	DEVMETHOD_END
 };
 
 static driver_t at91_twi_driver = {
@@ -394,6 +397,7 @@ static driver_t at91_twi_driver = {
 	sizeof(struct at91_twi_softc),
 };
 
-DRIVER_MODULE(at91_twi, atmelarm, at91_twi_driver, at91_twi_devclass, 0, 0);
-DRIVER_MODULE(iicbus, at91_twi, iicbus_driver, iicbus_devclass, 0, 0);
+DRIVER_MODULE(at91_twi, atmelarm, at91_twi_driver, at91_twi_devclass, NULL,
+    NULL);
+DRIVER_MODULE(iicbus, at91_twi, iicbus_driver, iicbus_devclass, NULL, NULL);
 MODULE_DEPEND(at91_twi, iicbus, 1, 1, 1);

Modified: stable/9/sys/arm/at91/at91_twireg.h
==============================================================================
--- stable/9/sys/arm/at91/at91_twireg.h	Sat May 26 08:58:29 2012	(r236079)
+++ stable/9/sys/arm/at91/at91_twireg.h	Sat May 26 09:03:14 2012	(r236080)
@@ -26,61 +26,61 @@
 /* $FreeBSD$ */
 
 #ifndef ARM_AT91_AT91_TWIREG_H
-#define ARM_AT91_AT91_TWIREG_H
+#define	ARM_AT91_AT91_TWIREG_H
 
-#define TWI_CR		0x00		/* TWI Control Register */
-#define TWI_MMR		0x04		/* TWI Master Mode Register */
-#define TWI_SMR		0x08		/* TWI Master Mode Register */
-#define TWI_IADR	0x0c		/* TWI Internal Address Register */
-#define TWI_CWGR	0x10		/* TWI Clock Waveform Generator Reg */
+#define	TWI_CR		0x00		/* TWI Control Register */
+#define	TWI_MMR		0x04		/* TWI Master Mode Register */
+#define	TWI_SMR		0x08		/* TWI Master Mode Register */
+#define	TWI_IADR	0x0c		/* TWI Internal Address Register */
+#define	TWI_CWGR	0x10		/* TWI Clock Waveform Generator Reg */
 		/*	0x14		   reserved */
 		/*	0x18		   reserved */
 		/*	0x1c		   reserved */
-#define TWI_SR		0x20		/* TWI Status Register */
-#define TWI_IER		0x24		/* TWI Interrupt Enable Register */
-#define TWI_IDR		0x28		/* TWI Interrupt Disable Register */
-#define TWI_IMR		0x2c		/* TWI Interrupt Mask Register */
-#define TWI_RHR		0x30		/* TWI Receiver Holding Register */
-#define TWI_THR		0x34		/* TWI Transmit Holding Register */
+#define	TWI_SR		0x20		/* TWI Status Register */
+#define	TWI_IER		0x24		/* TWI Interrupt Enable Register */
+#define	TWI_IDR		0x28		/* TWI Interrupt Disable Register */
+#define	TWI_IMR		0x2c		/* TWI Interrupt Mask Register */
+#define	TWI_RHR		0x30		/* TWI Receiver Holding Register */
+#define	TWI_THR		0x34		/* TWI Transmit Holding Register */
 
 /* TWI_CR */
-#define TWI_CR_START	(1U << 0)	/* Send a start */
-#define TWI_CR_STOP	(1U << 1)	/* Send a stop */
-#define TWI_CR_MSEN	(1U << 2)	/* Master Transfer Enable */
-#define TWI_CR_MSDIS	(1U << 3)	/* Master Transfer Disable */
-#define TWI_CR_SVEN	(1U << 4)	/* Slave Transfer Enable */
-#define TWI_CR_SVDIS	(1U << 5)	/* Slave Transfer Disable */
-#define TWI_CR_SWRST	(1U << 7)	/* Software Reset */
+#define	TWI_CR_START	(1U << 0)	/* Send a start */
+#define	TWI_CR_STOP	(1U << 1)	/* Send a stop */
+#define	TWI_CR_MSEN	(1U << 2)	/* Master Transfer Enable */
+#define	TWI_CR_MSDIS	(1U << 3)	/* Master Transfer Disable */
+#define	TWI_CR_SVEN	(1U << 4)	/* Slave Transfer Enable */
+#define	TWI_CR_SVDIS	(1U << 5)	/* Slave Transfer Disable */
+#define	TWI_CR_SWRST	(1U << 7)	/* Software Reset */
 
 /* TWI_MMR */
 /* TWI_SMR */
-#define TWI_MMR_IADRSZ(n) ((n) << 8)	/* Set size of transfer */
-#define TWI_MMR_MWRITE	0U		/* Master Read Direction */
-#define TWI_MMR_MREAD	(1U << 12)	/* Master Read Direction */
-#define TWI_MMR_DADR(n)	((n) << 15)	/* Device Address */
+#define	TWI_MMR_IADRSZ(n) ((n) << 8)	/* Set size of transfer */
+#define	TWI_MMR_MWRITE	0U		/* Master Read Direction */
+#define	TWI_MMR_MREAD	(1U << 12)	/* Master Read Direction */
+#define	TWI_MMR_DADR(n)	((n) << 15)	/* Device Address */
 
 /* TWI_CWGR */
-#define TWI_CWGR_CKDIV(x) ((x) << 16)	/* Clock Divider */
-#define TWI_CWGR_CHDIV(x) ((x) << 8)	/* Clock High Divider */
-#define TWI_CWGR_CLDIV(x) ((x) << 0)	/* Clock Low Divider */
-#define TWI_CWGR_DIV(rate) 		 		\
-	(at91_is_sam9() ? 				\
-	    ((at91_master_clock /(4*(rate))) - 3) :	\
-	    ((at91_master_clock /(4*(rate))) - 2))
+#define	TWI_CWGR_CKDIV(x) ((x) << 16)	/* Clock Divider */
+#define	TWI_CWGR_CHDIV(x) ((x) << 8)	/* Clock High Divider */
+#define	TWI_CWGR_CLDIV(x) ((x) << 0)	/* Clock Low Divider */
+#define	TWI_CWGR_DIV(rate) 		 		\
+	(at91_is_sam9() ?				\
+	    ((at91_master_clock / (4 * (rate))) - 3) :	\
+	    ((at91_master_clock / (4 * (rate))) - 2))
 
 /* TWI_SR */
 /* TWI_IER */
 /* TWI_IDR */
 /* TWI_IMR */
-#define TWI_SR_TXCOMP	(1U << 0)	/* Transmission Completed */
-#define TWI_SR_RXRDY	(1U << 1)	/* Receive Holding Register Ready */
-#define TWI_SR_TXRDY	(1U << 2)	/* Transmit Holding Register Ready */
-#define TWI_SR_SVREAD	(1U << 3)	/* Slave Read */
-#define TWI_SR_SVACC	(1U << 4)	/* Slave Access */
-#define TWI_SR_GCACC	(1U << 5)	/* General Call Access */
-#define TWI_SR_OVRE	(1U << 6)	/* Overrun error */
-#define TWI_SR_UNRE	(1U << 7)	/* Underrun Error */
-#define TWI_SR_NACK	(1U << 8)	/* Not Acknowledged */
-#define TWI_SR_ARBLST	(1U << 9)	/* Arbitration Lost */
+#define	TWI_SR_TXCOMP	(1U << 0)	/* Transmission Completed */
+#define	TWI_SR_RXRDY	(1U << 1)	/* Receive Holding Register Ready */
+#define	TWI_SR_TXRDY	(1U << 2)	/* Transmit Holding Register Ready */
+#define	TWI_SR_SVREAD	(1U << 3)	/* Slave Read */
+#define	TWI_SR_SVACC	(1U << 4)	/* Slave Access */
+#define	TWI_SR_GCACC	(1U << 5)	/* General Call Access */
+#define	TWI_SR_OVRE	(1U << 6)	/* Overrun error */
+#define	TWI_SR_UNRE	(1U << 7)	/* Underrun Error */
+#define	TWI_SR_NACK	(1U << 8)	/* Not Acknowledged */
+#define	TWI_SR_ARBLST	(1U << 9)	/* Arbitration Lost */
 
 #endif /* ARM_AT91_AT91_TWIREG_H */

Modified: stable/9/sys/arm/at91/at91_wdt.c
==============================================================================
--- stable/9/sys/arm/at91/at91_wdt.c	Sat May 26 08:58:29 2012	(r236079)
+++ stable/9/sys/arm/at91/at91_wdt.c	Sat May 26 09:03:14 2012	(r236080)
@@ -24,9 +24,9 @@
  */
 
 /*
- * The sam9 watchdog hardware can be programed only once. So we set the hardware
- * watchdog to 16s in wdt_attach and only reset it in the wdt_tick
- * handler. The watchdog is halted in processor debug mode.
+ * The SAM9 watchdog hardware can be programed only once. So we set the
+ * hardware watchdog to 16 s in wdt_attach and only reset it in the wdt_tick
+ * handler.  The watchdog is halted in processor debug mode.
  */
 
 #include <sys/cdefs.h>
@@ -52,19 +52,21 @@ struct wdt_softc {
 	struct callout	tick_ch;
 	eventhandler_tag sc_wet;
 	void		*intrhand;
-	u_int 		cmd;
-	u_int 		interval;
+	u_int		cmd;
+	u_int		interval;
 };
 
 static inline uint32_t
 RD4(struct wdt_softc *sc, bus_size_t off)
 {
+
 	return (bus_read_4(sc->mem_res, off));
 }
 
 static inline void
 WR4(struct wdt_softc *sc, bus_size_t off, uint32_t val)
 {
+
 	bus_write_4(sc->mem_res, off, val);
 }
 
@@ -157,7 +159,7 @@ wdt_attach(device_t dev)
 	    RF_ACTIVE);
 
 	if (sc->mem_res == NULL)
-	       panic("couldn't allocate wdt register resources");
+		panic("couldn't allocate wdt register resources");
 
 	wdt_mr = RD4(sc, WDT_MR);
 	if ((wdt_mr & WDT_WDRSTEN) == 0)
@@ -172,9 +174,11 @@ wdt_attach(device_t dev)
 		WR4(sc, WDT_MR, WDT_WDDBGHLT | WDT_WDD(0xC00)|
 		    WDT_WDFIEN| WDT_WDV(0xFFF));
 #endif
-		/* This may have been set by Boot ROM so register value
-		 * may not be  what we just requested since this is a
-		 * write once register. */
+		/*
+		 * This may have been set by Boot ROM so register value may
+		 * not be what we just requested since this is a write once
+		 * register.
+		 */
 		wdt_mr = RD4(sc, WDT_MR);
 		if (wdt_mr & WDT_WDFIEN) {
 			rid = 0;
@@ -184,15 +188,15 @@ wdt_attach(device_t dev)
 				panic("could not allocate interrupt.\n");
 
 			err = bus_setup_intr(dev, irq, INTR_TYPE_CLK, wdt_intr,
-				NULL, sc, &sc->intrhand);
+			    NULL, sc, &sc->intrhand);
 		}
 
 		/* interval * hz */
 		sc->interval = (((wdt_mr & WDT_WDV(~0)) + 1) * WDT_DIV) /
-			(WDT_CLOCK/hz);
+		    (WDT_CLOCK/hz);
 
 		device_printf(dev, "watchdog timeout: %d seconds\n",
-		     sc->interval/hz);
+		    sc->interval / hz);
 
 		/* Slightly less than 1/2 of watchdog hardware timeout */
 		sc->interval = (sc->interval/2) - (sc->interval/20);
@@ -208,7 +212,7 @@ wdt_attach(device_t dev)
 static device_method_t wdt_methods[] = {
 	DEVMETHOD(device_probe, wdt_probe),
 	DEVMETHOD(device_attach, wdt_attach),
-	{0,0},
+	DEVMETHOD_END
 };
 
 static driver_t wdt_driver = {
@@ -219,4 +223,4 @@ static driver_t wdt_driver = {
 
 static devclass_t wdt_devclass;
 
-DRIVER_MODULE(at91_wdt, atmelarm, wdt_driver, wdt_devclass, 0, 0);
+DRIVER_MODULE(at91_wdt, atmelarm, wdt_driver, wdt_devclass, NULL, NULL);

Modified: stable/9/sys/arm/at91/at91reg.h
==============================================================================
--- stable/9/sys/arm/at91/at91reg.h	Sat May 26 08:58:29 2012	(r236079)
+++ stable/9/sys/arm/at91/at91reg.h	Sat May 26 09:03:14 2012	(r236080)
@@ -28,43 +28,44 @@
  */
 
 #ifndef _AT91REG_H_
-#define _AT91REG_H_
+#define	_AT91REG_H_
 
 #include "opt_at91.h"
 
 /* Where builtin peripherals start in KVM */
-#define AT91_BASE		0xd0000000
+#define	AT91_BASE		0xd0000000
 
 /* A few things that we count on being the same
  * throught the whole family of SOCs */
 
 /* SYSC System Controler */
 /* System Registers */
-#define AT91_SYS_BASE	0xffff000
-#define AT91_SYS_SIZE	0x1000
+#define	AT91_SYS_BASE	0xffff000
+#define	AT91_SYS_SIZE	0x1000
 
 #if defined(AT91SAM9G45) || defined(AT91SAM9263)
-#define AT91_DBGU_BASE	0xfffee00
+#define	AT91_DBGU_BASE	0xfffee00
 #else
-#define AT91_DBGU_BASE	0xffff200
+#define	AT91_DBGU_BASE	0xffff200
 #endif
-#define AT91_DBGU_SIZE	0x200
-#define DBGU_C1R		(64) /* Chip ID1 Register */
-#define DBGU_C2R		(68) /* Chip ID2 Register */
-#define DBGU_FNTR		(72) /* Force NTRST Register */
-
-#define AT91_CPU_VERSION_MASK 0x0000001f
-#define AT91_CPU_RM9200   0x09290780
-#define AT91_CPU_SAM9260  0x019803a0
-#define AT91_CPU_SAM9261  0x019703a0
-#define AT91_CPU_SAM9263  0x019607a0
-#define AT91_CPU_SAM9G10  0x819903a0
-#define AT91_CPU_SAM9G20  0x019905a0
-#define AT91_CPU_SAM9G45  0x819b05a0
-
-#define AT91_ARCH(chipid)  ((chipid >> 20) & 0xff)
-#define AT91_CPU(chipid)   (chipid & ~AT91_CPU_VERSION_MASK)
-#define AT91_ARCH_SAM9  (0x19)
-#define AT91_ARCH_RM92  (0x92)
+#define	AT91_DBGU_SIZE	0x200
+#define	DBGU_C1R		(64) /* Chip ID1 Register */
+#define	DBGU_C2R		(68) /* Chip ID2 Register */
+#define	DBGU_FNTR		(72) /* Force NTRST Register */
+
+#define	AT91_CPU_VERSION_MASK	0x0000001f
+#define	AT91_CPU_RM9200   	0x09290780
+#define	AT91_CPU_SAM9260  	0x019803a0
+#define	AT91_CPU_SAM9261  	0x019703a0
+#define	AT91_CPU_SAM9263  	0x019607a0
+#define	AT91_CPU_SAM9G10  	0x819903a0
+#define	AT91_CPU_SAM9G20  	0x019905a0
+#define	AT91_CPU_SAM9G45  	0x819b05a0
+
+#define	AT91_ARCH(chipid)	((chipid >> 20) & 0xff)
+#define	AT91_CPU(chipid)	(chipid & ~AT91_CPU_VERSION_MASK)
+#define	AT91_ARCH_SAM9		(0x19)
+#define	AT91_ARCH_SAM9XE	(0x29)
+#define	AT91_ARCH_RM92		(0x92)
 
 #endif /* _AT91REG_H_ */

Modified: stable/9/sys/arm/at91/at91sam9260.c
==============================================================================
--- stable/9/sys/arm/at91/at91sam9260.c	Sat May 26 08:58:29 2012	(r236079)
+++ stable/9/sys/arm/at91/at91sam9260.c	Sat May 26 09:03:14 2012	(r236080)
@@ -93,7 +93,7 @@ static const int at91_irq_prio[32] =
 	0,	/* Advanced Interrupt Controller IRQ2 */
 };
 
-#define DEVICE(_name, _id, _unit)		\
+#define	DEVICE(_name, _id, _unit)		\
 	{					\
 		_name, _unit,			\
 		AT91SAM9260_ ## _id ##_BASE,	\
@@ -157,7 +157,7 @@ at91_add_child(device_t dev, int prio, c
 		bus_set_resource(kid, SYS_RES_IRQ, 1, irq1, 1);
 	if (irq2 != 0)
 		bus_set_resource(kid, SYS_RES_IRQ, 2, irq2, 1);
-	if (addr != 0 && addr < AT91SAM9260_BASE) 
+	if (addr != 0 && addr < AT91SAM9260_BASE)
 		addr += AT91SAM9260_BASE;
 	if (addr != 0)
 		bus_set_resource(kid, SYS_RES_MEMORY, 0, addr, size);
@@ -182,13 +182,14 @@ at91_pll_outa(int freq)
 
 	if (freq > 195000000)
 		return (0x20000000);
-	else 
+	else
 		return (0x20008000);
 }
 
 static uint32_t
 at91_pll_outb(int freq)
 {
+
 	return (0x4000);
 }
 
@@ -226,7 +227,7 @@ at91_attach(device_t dev)
 	sc->sc_sh = at91sc->sc_sh;
 	sc->dev = dev;
 
-	/* 
+	/*
 	 * XXX These values work for the RM9200, SAM926[01], and SAM9260
 	 * will have to fix this when we want to support anything else. XXX
 	 */
@@ -247,7 +248,7 @@ at91_attach(device_t dev)
 	at91sc->sc_irq_system = AT91SAM9260_IRQ_SYSTEM;
 
 	for (i = 0; i < 32; i++) {
-		bus_space_write_4(sc->sc_st, sc->sc_aic_sh, IC_SVR + 
+		bus_space_write_4(sc->sc_st, sc->sc_aic_sh, IC_SVR +
 		    i * 4, i);
 		/* Priority. */
 		bus_space_write_4(sc->sc_st, sc->sc_aic_sh, IC_SMR + i * 4,
@@ -276,10 +277,9 @@ at91_attach(device_t dev)
 	i = bus_space_read_4(sc->sc_st, sc->sc_matrix_sh,
 	    AT91SAM9260_EBICSA);
 	bus_space_write_4(sc->sc_st, sc->sc_matrix_sh,
-	    AT91SAM9260_EBICSA, 
+	    AT91SAM9260_EBICSA,
 	    i | AT91_MATRIX_EBI_CS3A_SMC_SMARTMEDIA);
 
-
 	/* Update USB device port clock info */
 	clk = at91_pmc_clock_ref("udpck");
 	clk->pmc_mask  = PMC_SCER_UDP_SAM9;
@@ -304,11 +304,12 @@ at91_attach(device_t dev)
 	at91_pmc_clock_deref(clk);
 
 	/*
-	 * Fudge MAX pll in frequence down below 3.0 Mhz to ensure 
-	 * PMC alogrithm choose the divisor that causes the input clock 
-	 * to be near the optimal 2 Mhz per datasheet. We know
-	 * we are going to be using this for the USB clock at 96 Mhz.
-	 * Causes no extra frequency deviation for all recomended crystal values.
+	 * Fudge MAX pll in frequence down below 3.0 MHz to ensure
+	 * PMC alogrithm choose the divisor that causes the input clock
+	 * to be near the optimal 2 MHz per datasheet.  We know
+	 * we are going to be using this for the USB clock at 96 MHz.
+	 * Causes no extra frequency deviation for all recomended crystal
+	 * values.
 	 */
 	clk = at91_pmc_clock_ref("pllb");
 	clk->pll_min_in    = SAM9260_PLL_B_MIN_IN_FREQ;		/*   1 MHz */
@@ -329,7 +330,7 @@ static device_method_t at91sam9260_metho
 	DEVMETHOD(device_probe, at91_probe),
 	DEVMETHOD(device_attach, at91_attach),
 	DEVMETHOD(device_identify, at91_identify),
-	{0, 0},
+	DEVMETHOD_END
 };
 
 static driver_t at91sam9260_driver = {
@@ -340,4 +341,5 @@ static driver_t at91sam9260_driver = {
 
 static devclass_t at91sam9260_devclass;
 
-DRIVER_MODULE(at91sam9260, atmelarm, at91sam9260_driver, at91sam9260_devclass, 0, 0);
+DRIVER_MODULE(at91sam9260, atmelarm, at91sam9260_driver, at91sam9260_devclass,
+    NULL, NULL);

Modified: stable/9/sys/arm/at91/at91var.h
==============================================================================
--- stable/9/sys/arm/at91/at91var.h	Sat May 26 08:58:29 2012	(r236079)
+++ stable/9/sys/arm/at91/at91var.h	Sat May 26 09:03:14 2012	(r236080)
@@ -62,24 +62,27 @@ struct cpu_devs
 extern uint32_t at91_chip_id;
 
 static inline int at91_is_rm92(void);
-static inline int at91_is_sam9(void) ;
+static inline int at91_is_sam9(void);
 static inline int at91_cpu_is(u_int cpu);
 
-static inline int 
-at91_is_rm92(void) 
+static inline int
+at91_is_rm92(void)
 {
+
 	return (AT91_ARCH(at91_chip_id) == AT91_ARCH_RM92);
 }
 
-static inline int 
-at91_is_sam9(void) 
+static inline int
+at91_is_sam9(void)
 {
+
 	return (AT91_ARCH(at91_chip_id) == AT91_ARCH_SAM9);
 }
 
-static inline int 
+static inline int
 at91_cpu_is(u_int cpu)
 {
+
 	return (AT91_CPU(at91_chip_id) == cpu);
 }
 

Modified: stable/9/sys/arm/at91/if_ate.c
==============================================================================
--- stable/9/sys/arm/at91/if_ate.c	Sat May 26 08:58:29 2012	(r236079)
+++ stable/9/sys/arm/at91/if_ate.c	Sat May 26 09:03:14 2012	(r236080)
@@ -120,38 +120,38 @@ __FBSDID("$FreeBSD$");
 
 struct ate_softc
 {
-	struct ifnet    *ifp;           /* ifnet pointer */
-	struct mtx      sc_mtx;         /* Basically a perimeter lock */
-	device_t        dev;            /* Myself */
-	device_t        miibus;         /* My child miibus */
-	struct resource *irq_res;       /* IRQ resource */
-	struct resource	*mem_res;       /* Memory resource */
-	struct callout  tick_ch;        /* Tick callout */
+	struct ifnet	*ifp;		/* ifnet pointer */
+	struct mtx	sc_mtx;		/* Basically a perimeter lock */
+	device_t	dev;		/* Myself */
+	device_t	miibus;		/* My child miibus */

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

From owner-svn-src-stable-9@FreeBSD.ORG  Sat May 26 09:05:46 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 30E8A1065672;
	Sat, 26 May 2012 09:05:46 +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 1B00B8FC0C;
	Sat, 26 May 2012 09:05: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 q4Q95jgY064663;
	Sat, 26 May 2012 09:05:45 GMT (envelope-from marius@svn.freebsd.org)
Received: (from marius@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4Q95jBJ064653;
	Sat, 26 May 2012 09:05:45 GMT (envelope-from marius@svn.freebsd.org)
Message-Id: <201205260905.q4Q95jBJ064653@svn.freebsd.org>
From: Marius Strobl <marius@FreeBSD.org>
Date: Sat, 26 May 2012 09:05:45 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r236081 - stable/9/sys/arm/at91
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sat, 26 May 2012 09:05:46 -0000

Author: marius
Date: Sat May 26 09:05:45 2012
New Revision: 236081
URL: http://svn.freebsd.org/changeset/base/236081

Log:
  MFC: r234291, r234292
  
  Add support for the Atmel SAM9XE family of microcontrollers, which
  consist of a ARM926EJ-S processor core with up to 512 Kbytes of on-chip
  flash. Tested with SAM9XE512.

Modified:
  stable/9/sys/arm/at91/at91_pit.c
  stable/9/sys/arm/at91/at91_pmc.c
  stable/9/sys/arm/at91/at91_rst.c
  stable/9/sys/arm/at91/at91_twireg.h
  stable/9/sys/arm/at91/at91_wdt.c
  stable/9/sys/arm/at91/at91reg.h
  stable/9/sys/arm/at91/at91sam9260.c
  stable/9/sys/arm/at91/at91var.h
  stable/9/sys/arm/at91/if_ate.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/amd64/include/xen/   (props changed)
  stable/9/sys/boot/   (props changed)
  stable/9/sys/boot/i386/efi/   (props changed)
  stable/9/sys/boot/ia64/efi/   (props changed)
  stable/9/sys/boot/ia64/ski/   (props changed)
  stable/9/sys/boot/powerpc/boot1.chrp/   (props changed)
  stable/9/sys/boot/powerpc/ofw/   (props changed)
  stable/9/sys/cddl/contrib/opensolaris/   (props changed)
  stable/9/sys/conf/   (props changed)
  stable/9/sys/contrib/dev/acpica/   (props changed)
  stable/9/sys/contrib/octeon-sdk/   (props changed)
  stable/9/sys/contrib/pf/   (props changed)
  stable/9/sys/contrib/x86emu/   (props changed)
  stable/9/sys/dev/   (props changed)
  stable/9/sys/dev/e1000/   (props changed)
  stable/9/sys/dev/ixgbe/   (props changed)
  stable/9/sys/fs/   (props changed)
  stable/9/sys/fs/ntfs/   (props changed)
  stable/9/sys/modules/   (props changed)

Modified: stable/9/sys/arm/at91/at91_pit.c
==============================================================================
--- stable/9/sys/arm/at91/at91_pit.c	Sat May 26 09:03:14 2012	(r236080)
+++ stable/9/sys/arm/at91/at91_pit.c	Sat May 26 09:05:45 2012	(r236081)
@@ -90,7 +90,7 @@ static int
 at91pit_probe(device_t dev)
 {
 
-	if (at91_is_sam9()) {
+	if (at91_is_sam9() || at91_is_sam9xe()) {
 		device_set_desc(dev, "AT91SAM9 PIT");
 		return (0);
 	}

Modified: stable/9/sys/arm/at91/at91_pmc.c
==============================================================================
--- stable/9/sys/arm/at91/at91_pmc.c	Sat May 26 09:03:14 2012	(r236080)
+++ stable/9/sys/arm/at91/at91_pmc.c	Sat May 26 09:05:45 2012	(r236081)
@@ -162,12 +162,14 @@ static const unsigned int at91_mainf_tbl
 static inline uint32_t
 RD4(struct at91_pmc_softc *sc, bus_size_t off)
 {
+
 	return (bus_read_4(sc->mem_res, off));
 }
 
 static inline void
 WR4(struct at91_pmc_softc *sc, bus_size_t off, uint32_t val)
 {
+
 	bus_write_4(sc->mem_res, off, val);
 }
 
@@ -225,7 +227,8 @@ at91_pmc_set_periph_mode(struct at91_pmc
 }
 
 struct at91_pmc_clock *
-at91_pmc_clock_add(const char *name, uint32_t irq, struct at91_pmc_clock *parent)
+at91_pmc_clock_add(const char *name, uint32_t irq,
+    struct at91_pmc_clock *parent)
 {
 	struct at91_pmc_clock *clk;
 	int i, buflen;
@@ -299,11 +302,13 @@ at91_pmc_clock_ref(const char *name)
 void
 at91_pmc_clock_deref(struct at91_pmc_clock *clk)
 {
+
 }
 
 void
 at91_pmc_clock_enable(struct at91_pmc_clock *clk)
 {
+
 	/* XXX LOCKING? XXX */
 	if (clk->parent)
 		at91_pmc_clock_enable(clk->parent);
@@ -314,6 +319,7 @@ at91_pmc_clock_enable(struct at91_pmc_cl
 void
 at91_pmc_clock_disable(struct at91_pmc_clock *clk)
 {
+
 	/* XXX LOCKING? XXX */
 	if (--clk->refcnt == 0 && clk->set_mode)
 		clk->set_mode(clk, 0);
@@ -342,7 +348,6 @@ at91_pmc_pll_rate(struct at91_pmc_clock 
 		freq = 0;
 	clk->hz = freq;
 
-
 	return (freq);
 }
 
@@ -402,7 +407,7 @@ at91_pmc_init_clock(struct at91_pmc_soft
 	uint32_t mckr;
 	uint32_t mdiv;
 
-	if (at91_is_sam9()) {
+	if (at91_is_sam9() || at91_is_sam9xe()) {
 		uhpck.pmc_mask = PMC_SCER_UHP_SAM9;
 		udpck.pmc_mask = PMC_SCER_UDP_SAM9;
 	}
@@ -446,7 +451,7 @@ at91_pmc_init_clock(struct at91_pmc_soft
 	    (1 << ((mckr & PMC_MCKR_PRES_MASK) >> 2));
 
 	mdiv = (mckr & PMC_MCKR_MDIV_MASK) >> 8;
-	if (at91_is_sam9()) {
+	if (at91_is_sam9() || at91_is_sam9xe()) {
 		if (mdiv > 0)
 			mck.hz /= mdiv * 2;
 	} else
@@ -486,7 +491,6 @@ at91_pmc_deactivate(device_t dev)
 		bus_release_resource(dev, SYS_RES_IOPORT,
 		    rman_get_rid(sc->mem_res), sc->mem_res);
 	sc->mem_res = 0;
-	return;
 }
 
 static int

Modified: stable/9/sys/arm/at91/at91_rst.c
==============================================================================
--- stable/9/sys/arm/at91/at91_rst.c	Sat May 26 09:03:14 2012	(r236080)
+++ stable/9/sys/arm/at91/at91_rst.c	Sat May 26 09:05:45 2012	(r236081)
@@ -71,7 +71,7 @@ static int
 at91_rst_probe(device_t dev)
 {
 
-	if (at91_is_sam9()) {
+	if (at91_is_sam9() || at91_is_sam9xe()) {
 		device_set_desc(dev, "AT91SAM9 Reset Controller");
 		return (0);
 	}

Modified: stable/9/sys/arm/at91/at91_twireg.h
==============================================================================
--- stable/9/sys/arm/at91/at91_twireg.h	Sat May 26 09:03:14 2012	(r236080)
+++ stable/9/sys/arm/at91/at91_twireg.h	Sat May 26 09:05:45 2012	(r236081)
@@ -64,7 +64,7 @@
 #define	TWI_CWGR_CHDIV(x) ((x) << 8)	/* Clock High Divider */
 #define	TWI_CWGR_CLDIV(x) ((x) << 0)	/* Clock Low Divider */
 #define	TWI_CWGR_DIV(rate) 		 		\
-	(at91_is_sam9() ?				\
+	(at91_is_sam9() || at91_is_sam9xe() ?		\
 	    ((at91_master_clock / (4 * (rate))) - 3) :	\
 	    ((at91_master_clock / (4 * (rate))) - 2))
 

Modified: stable/9/sys/arm/at91/at91_wdt.c
==============================================================================
--- stable/9/sys/arm/at91/at91_wdt.c	Sat May 26 09:03:14 2012	(r236080)
+++ stable/9/sys/arm/at91/at91_wdt.c	Sat May 26 09:05:45 2012	(r236081)
@@ -132,7 +132,7 @@ static int
 wdt_probe(device_t dev)
 {
 
-	if (at91_is_sam9()) {
+	if (at91_is_sam9() || at91_is_sam9xe()) {
 		device_set_desc(dev, "WDT");
 		return (0);
 	}

Modified: stable/9/sys/arm/at91/at91reg.h
==============================================================================
--- stable/9/sys/arm/at91/at91reg.h	Sat May 26 09:03:14 2012	(r236080)
+++ stable/9/sys/arm/at91/at91reg.h	Sat May 26 09:05:45 2012	(r236081)
@@ -61,6 +61,9 @@
 #define	AT91_CPU_SAM9G10  	0x819903a0
 #define	AT91_CPU_SAM9G20  	0x019905a0
 #define	AT91_CPU_SAM9G45  	0x819b05a0
+#define	AT91_CPU_SAM9XE128	0x329973a0
+#define	AT91_CPU_SAM9XE256	0x329a93a0
+#define	AT91_CPU_SAM9XE512	0x329aa3a0
 
 #define	AT91_ARCH(chipid)	((chipid >> 20) & 0xff)
 #define	AT91_CPU(chipid)	(chipid & ~AT91_CPU_VERSION_MASK)

Modified: stable/9/sys/arm/at91/at91sam9260.c
==============================================================================
--- stable/9/sys/arm/at91/at91sam9260.c	Sat May 26 09:03:14 2012	(r236080)
+++ stable/9/sys/arm/at91/at91sam9260.c	Sat May 26 09:05:45 2012	(r236081)
@@ -197,21 +197,40 @@ static void
 at91_identify(driver_t *drv, device_t parent)
 {
 
-	if (at91_cpu_is(AT91_CPU_SAM9260)) {
+	switch (AT91_CPU(at91_chip_id)) {
+	case AT91_CPU_SAM9260:
+	case AT91_CPU_SAM9XE128:
+	case AT91_CPU_SAM9XE256:
+	case AT91_CPU_SAM9XE512:
 		at91_add_child(parent, 0, "at91sam9260", 0, 0, 0, -1, 0, 0);
 		at91_cpu_add_builtin_children(parent);
+		break;
 	}
 }
 
 static int
 at91_probe(device_t dev)
 {
+	const char *desc;
 
-	if (at91_cpu_is(AT91_CPU_SAM9260)) {
-		device_set_desc(dev, "AT91SAM9260");
-		return (0);
+	switch (AT91_CPU(at91_chip_id)) {
+	case AT91_CPU_SAM9260:
+		desc = "AT91SAM9260";
+		break;
+	case AT91_CPU_SAM9XE128:
+		desc = "AT91SAM9XE128";
+		break;
+	case AT91_CPU_SAM9XE256:
+		desc = "AT91SAM9XE256";
+		break;
+	case AT91_CPU_SAM9XE512:
+		desc = "AT91SAM9XE512";
+		break;
+	default:
+		return (ENXIO);
 	}
-	return (ENXIO);
+	device_set_desc(dev, desc);
+	return (0);
 }
 
 static int
@@ -227,10 +246,6 @@ at91_attach(device_t dev)
 	sc->sc_sh = at91sc->sc_sh;
 	sc->dev = dev;
 
-	/*
-	 * XXX These values work for the RM9200, SAM926[01], and SAM9260
-	 * will have to fix this when we want to support anything else. XXX
-	 */
 	if (bus_space_subregion(sc->sc_st, sc->sc_sh, AT91SAM9260_SYS_BASE,
 	    AT91SAM9260_SYS_SIZE, &sc->sc_sys_sh) != 0)
 		panic("Enable to map system registers");

Modified: stable/9/sys/arm/at91/at91var.h
==============================================================================
--- stable/9/sys/arm/at91/at91var.h	Sat May 26 09:03:14 2012	(r236080)
+++ stable/9/sys/arm/at91/at91var.h	Sat May 26 09:05:45 2012	(r236081)
@@ -63,6 +63,7 @@ extern uint32_t at91_chip_id;
 
 static inline int at91_is_rm92(void);
 static inline int at91_is_sam9(void);
+static inline int at91_is_sam9xe(void);
 static inline int at91_cpu_is(u_int cpu);
 
 static inline int
@@ -80,6 +81,13 @@ at91_is_sam9(void)
 }
 
 static inline int
+at91_is_sam9xe(void)
+{
+
+	return (AT91_ARCH(at91_chip_id) == AT91_ARCH_SAM9XE);
+}
+
+static inline int
 at91_cpu_is(u_int cpu)
 {
 

Modified: stable/9/sys/arm/at91/if_ate.c
==============================================================================
--- stable/9/sys/arm/at91/if_ate.c	Sat May 26 09:03:14 2012	(r236080)
+++ stable/9/sys/arm/at91/if_ate.c	Sat May 26 09:05:45 2012	(r236081)
@@ -266,7 +266,7 @@ ate_attach(device_t dev)
 	}
 
 	/* New or old version, chooses buffer size. */
-	sc->is_emacb    = at91_is_sam9();
+	sc->is_emacb = at91_is_sam9() || at91_is_sam9xe();
 	sc->rx_buf_size = RX_BUF_SIZE(sc);
 
 	err = ate_activate(dev);

From owner-svn-src-stable-9@FreeBSD.ORG  Sat May 26 09:08:31 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 536A8106564A;
	Sat, 26 May 2012 09:08:31 +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 3D6DE8FC0A;
	Sat, 26 May 2012 09:08: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 q4Q98VFA064856;
	Sat, 26 May 2012 09:08:31 GMT (envelope-from marius@svn.freebsd.org)
Received: (from marius@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4Q98VYx064854;
	Sat, 26 May 2012 09:08:31 GMT (envelope-from marius@svn.freebsd.org)
Message-Id: <201205260908.q4Q98VYx064854@svn.freebsd.org>
From: Marius Strobl <marius@FreeBSD.org>
Date: Sat, 26 May 2012 09:08:31 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r236082 - stable/9/sys/arm/at91
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sat, 26 May 2012 09:08:31 -0000

Author: marius
Date: Sat May 26 09:08:30 2012
New Revision: 236082
URL: http://svn.freebsd.org/changeset/base/236082

Log:
  MFC: r234293
  
  Generate an obviously missing STOP when having finished transmitting data.
  This fixes communication with PCF8563.

Modified:
  stable/9/sys/arm/at91/at91_twi.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/amd64/include/xen/   (props changed)
  stable/9/sys/boot/   (props changed)
  stable/9/sys/boot/i386/efi/   (props changed)
  stable/9/sys/boot/ia64/efi/   (props changed)
  stable/9/sys/boot/ia64/ski/   (props changed)
  stable/9/sys/boot/powerpc/boot1.chrp/   (props changed)
  stable/9/sys/boot/powerpc/ofw/   (props changed)
  stable/9/sys/cddl/contrib/opensolaris/   (props changed)
  stable/9/sys/conf/   (props changed)
  stable/9/sys/contrib/dev/acpica/   (props changed)
  stable/9/sys/contrib/octeon-sdk/   (props changed)
  stable/9/sys/contrib/pf/   (props changed)
  stable/9/sys/contrib/x86emu/   (props changed)
  stable/9/sys/dev/   (props changed)
  stable/9/sys/dev/e1000/   (props changed)
  stable/9/sys/dev/ixgbe/   (props changed)
  stable/9/sys/fs/   (props changed)
  stable/9/sys/fs/ntfs/   (props changed)
  stable/9/sys/modules/   (props changed)

Modified: stable/9/sys/arm/at91/at91_twi.c
==============================================================================
--- stable/9/sys/arm/at91/at91_twi.c	Sat May 26 09:05:45 2012	(r236081)
+++ stable/9/sys/arm/at91/at91_twi.c	Sat May 26 09:08:30 2012	(r236082)
@@ -364,6 +364,7 @@ at91_twi_transfer(device_t dev, struct i
 					goto out;
 				WR4(sc, TWI_THR, *buf++);
 			}
+			WR4(sc, TWI_CR, TWI_CR_STOP);
 		}
 		if ((err = at91_twi_wait(sc, TWI_SR_TXCOMP)))
 			break;

From owner-svn-src-stable-9@FreeBSD.ORG  Sat May 26 09:11:46 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 7019F106566B;
	Sat, 26 May 2012 09:11:46 +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 5AFD38FC18;
	Sat, 26 May 2012 09:11: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 q4Q9BkbZ065094;
	Sat, 26 May 2012 09:11:46 GMT (envelope-from marius@svn.freebsd.org)
Received: (from marius@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4Q9BkaZ065091;
	Sat, 26 May 2012 09:11:46 GMT (envelope-from marius@svn.freebsd.org)
Message-Id: <201205260911.q4Q9BkaZ065091@svn.freebsd.org>
From: Marius Strobl <marius@FreeBSD.org>
Date: Sat, 26 May 2012 09:11:46 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r236084 - stable/9/sys/arm/at91
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sat, 26 May 2012 09:11:46 -0000

Author: marius
Date: Sat May 26 09:11:45 2012
New Revision: 236084
URL: http://svn.freebsd.org/changeset/base/236084

Log:
  MFC: r234560
  
  - Add support for MCI1 revision 2xx controllers and a work-around for their
    "Data Write Operation and number of bytes" erratum.
  - Use DEVMETHOD_END.
  - Use NULL instead of 0 for pointers.

Modified:
  stable/9/sys/arm/at91/at91_mci.c
  stable/9/sys/arm/at91/at91_mcireg.h
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/amd64/include/xen/   (props changed)
  stable/9/sys/boot/   (props changed)
  stable/9/sys/boot/i386/efi/   (props changed)
  stable/9/sys/boot/ia64/efi/   (props changed)
  stable/9/sys/boot/ia64/ski/   (props changed)
  stable/9/sys/boot/powerpc/boot1.chrp/   (props changed)
  stable/9/sys/boot/powerpc/ofw/   (props changed)
  stable/9/sys/cddl/contrib/opensolaris/   (props changed)
  stable/9/sys/conf/   (props changed)
  stable/9/sys/contrib/dev/acpica/   (props changed)
  stable/9/sys/contrib/octeon-sdk/   (props changed)
  stable/9/sys/contrib/pf/   (props changed)
  stable/9/sys/contrib/x86emu/   (props changed)
  stable/9/sys/dev/   (props changed)
  stable/9/sys/dev/e1000/   (props changed)
  stable/9/sys/dev/ixgbe/   (props changed)
  stable/9/sys/fs/   (props changed)
  stable/9/sys/fs/ntfs/   (props changed)
  stable/9/sys/modules/   (props changed)

Modified: stable/9/sys/arm/at91/at91_mci.c
==============================================================================
--- stable/9/sys/arm/at91/at91_mci.c	Sat May 26 09:08:33 2012	(r236083)
+++ stable/9/sys/arm/at91/at91_mci.c	Sat May 26 09:11:45 2012	(r236084)
@@ -113,6 +113,7 @@ static void at91_mci_intr(void *);
 /* helper routines */
 static int at91_mci_activate(device_t dev);
 static void at91_mci_deactivate(device_t dev);
+static int at91_mci_is_mci1rev2xx(void);
 
 #define AT91_MCI_LOCK(_sc)		mtx_lock(&(_sc)->sc_mtx)
 #define	AT91_MCI_UNLOCK(_sc)		mtx_unlock(&(_sc)->sc_mtx)
@@ -141,11 +142,16 @@ static void
 at91_mci_init(device_t dev)
 {
 	struct at91_mci_softc *sc = device_get_softc(dev);
+	uint32_t val;
 
 	WR4(sc, MCI_CR, MCI_CR_MCIEN);		/* Enable controller */
 	WR4(sc, MCI_IDR, 0xffffffff);		/* Turn off interrupts */
 	WR4(sc, MCI_DTOR, MCI_DTOR_DTOMUL_1M | 1);
-	WR4(sc, MCI_MR, 0x834a);	// XXX GROSS HACK FROM LINUX
+	val = MCI_MR_PDCMODE;
+	val |= 0x34a;				/* PWSDIV = 3; CLKDIV = 74 */
+	if (at91_mci_is_mci1rev2xx())
+		val |= MCI_MR_RDPROOF | MCI_MR_WRPROOF;
+	WR4(sc, MCI_MR, val);
 #ifndef  AT91_MCI_SLOT_B
 	WR4(sc, MCI_SDCR, 0);			/* SLOT A, 1 bit bus */
 #else
@@ -303,6 +309,29 @@ at91_mci_deactivate(device_t dev)
 	return;
 }
 
+static int
+at91_mci_is_mci1rev2xx(void)
+{
+
+	switch (AT91_CPU(at91_chip_id)) {
+	case AT91_CPU_SAM9260:
+	case AT91_CPU_SAM9263:
+#ifdef notyet
+	case AT91_CPU_CAP9:
+#endif
+	case AT91_CPU_SAM9G10:
+	case AT91_CPU_SAM9G20:
+#ifdef notyet
+	case AT91_CPU_SAM9RL:
+#endif
+	case AT91_CPU_SAM9XE128:
+	case AT91_CPU_SAM9XE256:
+	case AT91_CPU_SAM9XE512:
+		return(1);
+	}
+	return (0);
+}
+
 static void
 at91_mci_getaddr(void *arg, bus_dma_segment_t *segs, int nsegs, int error)
 {
@@ -346,6 +375,7 @@ at91_mci_update_ios(device_t brdev, devi
 static void
 at91_mci_start_cmd(struct at91_mci_softc *sc, struct mmc_command *cmd)
 {
+	size_t len;
 	uint32_t cmdr, ier = 0, mr;
 	uint32_t *src, *dst;
 	int i;
@@ -397,6 +427,7 @@ at91_mci_start_cmd(struct at91_mci_softc
 	WR4(sc, MCI_MR, mr | (data->len << 16) | MCI_MR_PDCMODE);
 	WR4(sc, PDC_PTCR, PDC_PTCR_RXTDIS | PDC_PTCR_TXTDIS);
 	if (cmdr & MCI_CMDR_TRCMD_START) {
+		len = data->len;
 		if (cmdr & MCI_CMDR_TRDIR)
 			vaddr = cmd->data->data;
 		else {
@@ -411,6 +442,15 @@ at91_mci_start_cmd(struct at91_mci_softc
 			vaddr = sc->bounce_buffer;
 			src = (uint32_t *)cmd->data->data;
 			dst = (uint32_t *)vaddr;
+			/*
+			 * If this is MCI1 revision 2xx controller, apply
+			 * a work-around for the "Data Write Operation and
+			 * number of bytes" erratum.
+			 */
+			if (at91_mci_is_mci1rev2xx() && data->len < 12) {
+				len = 12;
+				memset(dst, 0, 12);
+			}
 			if (sc->sc_cap & CAP_NEEDS_BYTESWAP) {
 				for (i = 0; i < data->len / 4; i++)
 					dst[i] = bswap32(src[i]);
@@ -418,7 +458,7 @@ at91_mci_start_cmd(struct at91_mci_softc
 				memcpy(dst, src, data->len);
 		}
 		data->xfer_len = 0;
-		if (bus_dmamap_load(sc->dmatag, sc->map, vaddr, data->len,
+		if (bus_dmamap_load(sc->dmatag, sc->map, vaddr, len,
 		    at91_mci_getaddr, &paddr, 0) != 0) {
 			cmd->error = MMC_ERR_NO_MEMORY;
 			sc->req = NULL;
@@ -430,12 +470,12 @@ at91_mci_start_cmd(struct at91_mci_softc
 		if (cmdr & MCI_CMDR_TRDIR) {
 			bus_dmamap_sync(sc->dmatag, sc->map, BUS_DMASYNC_PREREAD);
 			WR4(sc, PDC_RPR, paddr);
-			WR4(sc, PDC_RCR, data->len / 4);
+			WR4(sc, PDC_RCR, len / 4);
 			ier = MCI_SR_ENDRX;
 		} else {
 			bus_dmamap_sync(sc->dmatag, sc->map, BUS_DMASYNC_PREWRITE);
 			WR4(sc, PDC_TPR, paddr);
-			WR4(sc, PDC_TCR, data->len / 4);
+			WR4(sc, PDC_TCR, len / 4);
 			ier = MCI_SR_TXBUFE;
 		}
 	}
@@ -769,7 +809,7 @@ static device_method_t at91_mci_methods[
 	DEVMETHOD(mmcbr_acquire_host, at91_mci_acquire_host),
 	DEVMETHOD(mmcbr_release_host, at91_mci_release_host),
 
-	{0, 0},
+	DEVMETHOD_END
 };
 
 static driver_t at91_mci_driver = {
@@ -777,7 +817,8 @@ static driver_t at91_mci_driver = {
 	at91_mci_methods,
 	sizeof(struct at91_mci_softc),
 };
-static devclass_t at91_mci_devclass;
 
+static devclass_t at91_mci_devclass;
 
-DRIVER_MODULE(at91_mci, atmelarm, at91_mci_driver, at91_mci_devclass, 0, 0);
+DRIVER_MODULE(at91_mci, atmelarm, at91_mci_driver, at91_mci_devclass, NULL,
+    NULL);

Modified: stable/9/sys/arm/at91/at91_mcireg.h
==============================================================================
--- stable/9/sys/arm/at91/at91_mcireg.h	Sat May 26 09:08:33 2012	(r236083)
+++ stable/9/sys/arm/at91/at91_mcireg.h	Sat May 26 09:11:45 2012	(r236084)
@@ -54,6 +54,9 @@
 /* -------- MCI_MR : (MCI Offset: 0x4) MCI Mode Register --------  */
 #define	MCI_MR_CLKDIV      (0xffu <<  0) /* (MCI) Clock Divider */
 #define	MCI_MR_PWSDIV      (0x3fu <<  8) /* (MCI) Power Saving Divider */
+#define	MCI_MR_RDPROOF	(0x1u << 11)	/* (MCI) Read Proof Enable */
+#define	MCI_MR_WRPROOF	(0x1u << 12)	/* (MCI) Write Proof Enable */
+#define	MCI_MR_PDCFBYTE	(0x1u << 13)	/* (MCI) PDC Force Byte Transfer */
 #define	MCI_MR_PDCPADV     (0x1u << 14) /* (MCI) PDC Padding Value */
 #define	MCI_MR_PDCMODE     (0x1u << 15) /* (MCI) PDC Oriented Mode */
 #define	MCI_MR_BLKLEN      0x3fff0000ul /* (MCI) Data Block Length */

From owner-svn-src-stable-9@FreeBSD.ORG  Sat May 26 09:13:25 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id C8D1E1065673;
	Sat, 26 May 2012 09:13:25 +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 B2E728FC08;
	Sat, 26 May 2012 09: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 q4Q9DPYj065220;
	Sat, 26 May 2012 09:13:25 GMT (envelope-from marius@svn.freebsd.org)
Received: (from marius@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4Q9DPXL065217;
	Sat, 26 May 2012 09:13:25 GMT (envelope-from marius@svn.freebsd.org)
Message-Id: <201205260913.q4Q9DPXL065217@svn.freebsd.org>
From: Marius Strobl <marius@FreeBSD.org>
Date: Sat, 26 May 2012 09:13:25 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r236085 - stable/9/sys/arm/arm
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sat, 26 May 2012 09:13:26 -0000

Author: marius
Date: Sat May 26 09:13:24 2012
New Revision: 236085
URL: http://svn.freebsd.org/changeset/base/236085

Log:
  MFC: r234561
  
  Interrupts must be disabled while handling a partial cache line flush,
  as otherwise the interrupt handling code may modify data in the non-DMA
  part of the cache line while we have it stashed away in the temporary
  stack buffer, then we end up restoring a stale value.
  
  PR:		160431
  Submitted by:	Ian Lepore

Modified:
  stable/9/sys/arm/arm/busdma_machdep.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/amd64/include/xen/   (props changed)
  stable/9/sys/boot/   (props changed)
  stable/9/sys/boot/i386/efi/   (props changed)
  stable/9/sys/boot/ia64/efi/   (props changed)
  stable/9/sys/boot/ia64/ski/   (props changed)
  stable/9/sys/boot/powerpc/boot1.chrp/   (props changed)
  stable/9/sys/boot/powerpc/ofw/   (props changed)
  stable/9/sys/cddl/contrib/opensolaris/   (props changed)
  stable/9/sys/conf/   (props changed)
  stable/9/sys/contrib/dev/acpica/   (props changed)
  stable/9/sys/contrib/octeon-sdk/   (props changed)
  stable/9/sys/contrib/pf/   (props changed)
  stable/9/sys/contrib/x86emu/   (props changed)
  stable/9/sys/dev/   (props changed)
  stable/9/sys/dev/e1000/   (props changed)
  stable/9/sys/dev/ixgbe/   (props changed)
  stable/9/sys/fs/   (props changed)
  stable/9/sys/fs/ntfs/   (props changed)
  stable/9/sys/modules/   (props changed)

Modified: stable/9/sys/arm/arm/busdma_machdep.c
==============================================================================
--- stable/9/sys/arm/arm/busdma_machdep.c	Sat May 26 09:11:45 2012	(r236084)
+++ stable/9/sys/arm/arm/busdma_machdep.c	Sat May 26 09:13:24 2012	(r236085)
@@ -1091,14 +1091,16 @@ static void
 bus_dmamap_sync_buf(void *buf, int len, bus_dmasync_op_t op)
 {
 	char _tmp_cl[arm_dcache_align], _tmp_clend[arm_dcache_align];
+	register_t s;
+	int partial; 
 
 	if ((op & BUS_DMASYNC_PREWRITE) && !(op & BUS_DMASYNC_PREREAD)) {
 		cpu_dcache_wb_range((vm_offset_t)buf, len);
 		cpu_l2cache_wb_range((vm_offset_t)buf, len);
 	}
+	partial = (((vm_offset_t)buf) | len) & arm_dcache_align_mask;
 	if (op & BUS_DMASYNC_PREREAD) {
-		if (!(op & BUS_DMASYNC_PREWRITE) &&
-		    ((((vm_offset_t)(buf) | len) & arm_dcache_align_mask) == 0)) {
+		if (!(op & BUS_DMASYNC_PREWRITE) && !partial) {
 			cpu_dcache_inv_range((vm_offset_t)buf, len);
 			cpu_l2cache_inv_range((vm_offset_t)buf, len);
 		} else {
@@ -1107,27 +1109,32 @@ bus_dmamap_sync_buf(void *buf, int len, 
 		}
 	}
 	if (op & BUS_DMASYNC_POSTREAD) {
-		if ((vm_offset_t)buf & arm_dcache_align_mask) {
-			memcpy(_tmp_cl, (void *)((vm_offset_t)buf & ~
-			    arm_dcache_align_mask),
-			    (vm_offset_t)buf & arm_dcache_align_mask);
-		}
-		if (((vm_offset_t)buf + len) & arm_dcache_align_mask) {
-			memcpy(_tmp_clend, (void *)((vm_offset_t)buf + len),
-			    arm_dcache_align - (((vm_offset_t)(buf) + len) &
-			   arm_dcache_align_mask));
+		if (partial) {
+			s = intr_disable();
+			if ((vm_offset_t)buf & arm_dcache_align_mask)
+				memcpy(_tmp_cl, (void *)((vm_offset_t)buf &
+				    ~arm_dcache_align_mask),
+				    (vm_offset_t)buf & arm_dcache_align_mask);
+			if (((vm_offset_t)buf + len) & arm_dcache_align_mask)
+				memcpy(_tmp_clend, 
+				    (void *)((vm_offset_t)buf + len),
+				    arm_dcache_align - (((vm_offset_t)(buf) +
+				    len) & arm_dcache_align_mask));
 		}
 		cpu_dcache_inv_range((vm_offset_t)buf, len);
 		cpu_l2cache_inv_range((vm_offset_t)buf, len);
-
-		if ((vm_offset_t)buf & arm_dcache_align_mask)
-			memcpy((void *)((vm_offset_t)buf &
-			    ~arm_dcache_align_mask), _tmp_cl, 
-			    (vm_offset_t)buf & arm_dcache_align_mask);
-		if (((vm_offset_t)buf + len) & arm_dcache_align_mask)
-			memcpy((void *)((vm_offset_t)buf + len), _tmp_clend,
-			    arm_dcache_align - (((vm_offset_t)(buf) + len) &
-			   arm_dcache_align_mask));
+		if (partial) {
+			if ((vm_offset_t)buf & arm_dcache_align_mask)
+				memcpy((void *)((vm_offset_t)buf &
+				    ~arm_dcache_align_mask), _tmp_cl, 
+				    (vm_offset_t)buf & arm_dcache_align_mask);
+			if (((vm_offset_t)buf + len) & arm_dcache_align_mask)
+				memcpy((void *)((vm_offset_t)buf + len), 
+				    _tmp_clend, arm_dcache_align - 
+				    (((vm_offset_t)(buf) + len) &
+				    arm_dcache_align_mask));
+			intr_restore(s);
+		}
 	}
 }
 

From owner-svn-src-stable-9@FreeBSD.ORG  Sat May 26 09:16:38 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 02B64106566B;
	Sat, 26 May 2012 09:16:38 +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 E05638FC1F;
	Sat, 26 May 2012 09:16: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 q4Q9Gbq0065489;
	Sat, 26 May 2012 09:16:37 GMT (envelope-from marius@svn.freebsd.org)
Received: (from marius@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4Q9GbwX065487;
	Sat, 26 May 2012 09:16:37 GMT (envelope-from marius@svn.freebsd.org)
Message-Id: <201205260916.q4Q9GbwX065487@svn.freebsd.org>
From: Marius Strobl <marius@FreeBSD.org>
Date: Sat, 26 May 2012 09:16:37 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r236088 - stable/9/sys/arm/at91
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sat, 26 May 2012 09:16:38 -0000

Author: marius
Date: Sat May 26 09:16:37 2012
New Revision: 236088
URL: http://svn.freebsd.org/changeset/base/236088

Log:
  MFC: r234901
  
  - Add missing locking in at91_usart_getc().
  - Align the RX buffers on the cache line size, otherwise the requirement
    of partial cache line flushes on every are pretty much guaranteed. [1]
  - Make the code setting the RX timeout match its comment (apparently,
    start and stop bits were missed in the previous calculation). [1]
  - Cover the busdma operations in at91_usart_bus_{ipend,transmit}() with
    the hardware mutex, too, so these don't race against each other.
  - In at91_usart_bus_ipend(), reduce duplication in the code dealing with
    TX interrupts.
  - In at91_usart_bus_ipend(), turn the code dealing with RX interrupts
    into an else-if cascade in order reduce its complexity and to improve
    its run-time behavior.
  - In at91_usart_bus_ipend(), add missing BUS_DMASYNC_PREREAD calls on
    the RX buffer map before handing things over to the hardware again. [1]
  - In at91_usart_bus_getsig(), used a variable of sufficient width for
    storing the contents of USART_CSR.
  - Use KOBJMETHOD_END.
  - Remove an unused header.
  
  Submitted by:	Ian Lepore [1]
  Reviewed by:	Ian Lepore

Modified:
  stable/9/sys/arm/at91/uart_dev_at91usart.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/amd64/include/xen/   (props changed)
  stable/9/sys/boot/   (props changed)
  stable/9/sys/boot/i386/efi/   (props changed)
  stable/9/sys/boot/ia64/efi/   (props changed)
  stable/9/sys/boot/ia64/ski/   (props changed)
  stable/9/sys/boot/powerpc/boot1.chrp/   (props changed)
  stable/9/sys/boot/powerpc/ofw/   (props changed)
  stable/9/sys/cddl/contrib/opensolaris/   (props changed)
  stable/9/sys/conf/   (props changed)
  stable/9/sys/contrib/dev/acpica/   (props changed)
  stable/9/sys/contrib/octeon-sdk/   (props changed)
  stable/9/sys/contrib/pf/   (props changed)
  stable/9/sys/contrib/x86emu/   (props changed)
  stable/9/sys/dev/   (props changed)
  stable/9/sys/dev/e1000/   (props changed)
  stable/9/sys/dev/ixgbe/   (props changed)
  stable/9/sys/fs/   (props changed)
  stable/9/sys/fs/ntfs/   (props changed)
  stable/9/sys/modules/   (props changed)

Modified: stable/9/sys/arm/at91/uart_dev_at91usart.c
==============================================================================
--- stable/9/sys/arm/at91/uart_dev_at91usart.c	Sat May 26 09:16:33 2012	(r236087)
+++ stable/9/sys/arm/at91/uart_dev_at91usart.c	Sat May 26 09:16:37 2012	(r236088)
@@ -40,7 +40,6 @@ __FBSDID("$FreeBSD$");
 #include <dev/uart/uart.h>
 #include <dev/uart/uart_cpu.h>
 #include <dev/uart/uart_bus.h>
-#include <arm/at91/at91rm92reg.h>
 #include <arm/at91/at91_usartreg.h>
 #include <arm/at91/at91_pdcreg.h>
 #include <arm/at91/at91var.h>
@@ -55,16 +54,17 @@ __FBSDID("$FreeBSD$");
  */
 struct at91_usart_rx {
 	bus_addr_t	pa;
-	uint8_t		buffer[USART_BUFFER_SIZE];
+	uint8_t		*buffer;
 	bus_dmamap_t	map;
 };
 
 struct at91_usart_softc {
 	struct uart_softc base;
-	bus_dma_tag_t dmatag;		/* bus dma tag for mbufs */
+	bus_dma_tag_t tx_tag;
 	bus_dmamap_t tx_map;
 	uint32_t flags;
-#define HAS_TIMEOUT	1	
+#define	HAS_TIMEOUT	1
+	bus_dma_tag_t rx_tag;
 	struct at91_usart_rx ping_pong[2];
 	struct at91_usart_rx *ping;
 	struct at91_usart_rx *pong;
@@ -95,7 +95,7 @@ static void at91_usart_init(struct uart_
 static void at91_usart_term(struct uart_bas *bas);
 static void at91_usart_putc(struct uart_bas *bas, int);
 static int at91_usart_rxready(struct uart_bas *bas);
-static int at91_usart_getc(struct uart_bas *bas, struct mtx *mtx);
+static int at91_usart_getc(struct uart_bas *bas, struct mtx *hwmtx);
 
 extern SLIST_HEAD(uart_devinfo_list, uart_devinfo) uart_sysdevs;
 
@@ -106,7 +106,7 @@ at91_usart_param(struct uart_bas *bas, i
 	uint32_t mr;
 
 	/*
-	 * Assume 3-write RS-232 configuration.
+	 * Assume 3-wire RS-232 configuration.
 	 * XXX Not sure how uart will present the other modes to us, so
 	 * XXX they are unimplemented.  maybe ioctl?
 	 */
@@ -209,6 +209,7 @@ static struct uart_ops at91_usart_ops = 
 static int
 at91_usart_probe(struct uart_bas *bas)
 {
+
 	/* We know that this is always here */
 	return (0);
 }
@@ -236,6 +237,7 @@ at91_usart_init(struct uart_bas *bas, in
 static void
 at91_usart_term(struct uart_bas *bas)
 {
+
 	/* XXX */
 }
 
@@ -247,7 +249,7 @@ static void
 at91_usart_putc(struct uart_bas *bas, int c)
 {
 
-    while (!(RD4(bas, USART_CSR) & USART_CSR_TXRDY))
+	while (!(RD4(bas, USART_CSR) & USART_CSR_TXRDY))
 		continue;
 	WR4(bas, USART_THR, c);
 }
@@ -266,14 +268,18 @@ at91_usart_rxready(struct uart_bas *bas)
  * Block waiting for a character.
  */
 static int
-at91_usart_getc(struct uart_bas *bas, struct mtx *mtx)
+at91_usart_getc(struct uart_bas *bas, struct mtx *hwmtx)
 {
 	int c;
 
-	while (!(RD4(bas, USART_CSR) & USART_CSR_RXRDY))
-		continue;
-	c = RD4(bas, USART_RHR);
-	c &= 0xff;
+	uart_lock(hwmtx);
+	while (!(RD4(bas, USART_CSR) & USART_CSR_RXRDY)) {
+		uart_unlock(hwmtx);
+		DELAY(4);
+		uart_lock(hwmtx);
+	}
+	c = RD4(bas, USART_RHR) & 0xff;
+	uart_unlock(hwmtx);
 	return (c);
 }
 
@@ -290,7 +296,7 @@ static int at91_usart_bus_transmit(struc
 
 static kobj_method_t at91_usart_methods[] = {
 	KOBJMETHOD(uart_probe,		at91_usart_bus_probe),
-	KOBJMETHOD(uart_attach, 	at91_usart_bus_attach),
+	KOBJMETHOD(uart_attach,		at91_usart_bus_attach),
 	KOBJMETHOD(uart_flush,		at91_usart_bus_flush),
 	KOBJMETHOD(uart_getsig,		at91_usart_bus_getsig),
 	KOBJMETHOD(uart_ioctl,		at91_usart_bus_ioctl),
@@ -299,8 +305,8 @@ static kobj_method_t at91_usart_methods[
 	KOBJMETHOD(uart_receive,	at91_usart_bus_receive),
 	KOBJMETHOD(uart_setsig,		at91_usart_bus_setsig),
 	KOBJMETHOD(uart_transmit,	at91_usart_bus_transmit),
-	
-	{ 0, 0 }
+
+	KOBJMETHOD_END
 };
 
 int
@@ -316,6 +322,7 @@ at91_usart_bus_probe(struct uart_softc *
 static void
 at91_getaddr(void *arg, bus_dma_segment_t *segs, int nsegs, int error)
 {
+
 	if (error != 0)
 		return;
 	*(bus_addr_t *)arg = segs[0].ds_addr;
@@ -344,41 +351,53 @@ at91_usart_bus_attach(struct uart_softc 
 	WR4(&sc->sc_bas, USART_IDR, 0xffffffff);
 
 	/*
-	 * Allocate DMA tags and maps
+	 * Allocate transmit DMA tag and map.  We allow a transmit buffer
+	 * to be any size, but it must map to a single contiguous physical
+	 * extent.
 	 */
 	err = bus_dma_tag_create(bus_get_dma_tag(sc->sc_dev), 1, 0,
 	    BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL,
-	    USART_BUFFER_SIZE, 1, USART_BUFFER_SIZE, BUS_DMA_ALLOCNOW, NULL,
-	    NULL, &atsc->dmatag);
+	    BUS_SPACE_MAXSIZE_32BIT, 1, BUS_SPACE_MAXSIZE_32BIT, 0, NULL,
+	    NULL, &atsc->tx_tag);
 	if (err != 0)
 		goto errout;
-	err = bus_dmamap_create(atsc->dmatag, 0, &atsc->tx_map);
+	err = bus_dmamap_create(atsc->tx_tag, 0, &atsc->tx_map);
 	if (err != 0)
 		goto errout;
+
 	if (atsc->flags & HAS_TIMEOUT) {
+		/*
+		 * Allocate receive DMA tags, maps, and buffers.
+		 * The receive buffers should be aligned to arm_dcache_align,
+		 * otherwise partial cache line flushes on every receive
+		 * interrupt are pretty much guaranteed.
+		 */
+		err = bus_dma_tag_create(bus_get_dma_tag(sc->sc_dev),
+		    arm_dcache_align, 0, BUS_SPACE_MAXADDR_32BIT,
+		    BUS_SPACE_MAXADDR, NULL, NULL, sc->sc_rxfifosz, 1,
+		    sc->sc_rxfifosz, BUS_DMA_ALLOCNOW, NULL, NULL,
+		    &atsc->rx_tag);
+		if (err != 0)
+			goto errout;
 		for (i = 0; i < 2; i++) {
-			err = bus_dmamap_create(atsc->dmatag, 0,
-			    &atsc->ping_pong[i].map);
+			err = bus_dmamem_alloc(atsc->rx_tag,
+			    (void **)&atsc->ping_pong[i].buffer,
+			    BUS_DMA_NOWAIT, &atsc->ping_pong[i].map);
 			if (err != 0)
 				goto errout;
-			err = bus_dmamap_load(atsc->dmatag,
+			err = bus_dmamap_load(atsc->rx_tag,
 			    atsc->ping_pong[i].map,
 			    atsc->ping_pong[i].buffer, sc->sc_rxfifosz,
 			    at91_getaddr, &atsc->ping_pong[i].pa, 0);
 			if (err != 0)
 				goto errout;
-			bus_dmamap_sync(atsc->dmatag, atsc->ping_pong[i].map,
+			bus_dmamap_sync(atsc->rx_tag, atsc->ping_pong[i].map,
 			    BUS_DMASYNC_PREREAD);
 		}
 		atsc->ping = &atsc->ping_pong[0];
 		atsc->pong = &atsc->ping_pong[1];
 	}
 
-	/*
-	 * Prime the pump with the RX buffer.  We use two 64 byte bounce
-	 * buffers here to avoid data overflow.
-	 */
-
 	/* Turn on rx and tx */
 	cr = USART_CR_RSTSTA | USART_CR_RSTRX | USART_CR_RSTTX;
 	WR4(&sc->sc_bas, USART_CR, cr);
@@ -397,8 +416,11 @@ at91_usart_bus_attach(struct uart_softc 
 		WR4(&sc->sc_bas, PDC_RNCR, sc->sc_rxfifosz);
 		WR4(&sc->sc_bas, PDC_PTCR, PDC_PTCR_RXTEN);
 
-		/* Set the receive timeout to be 1.5 character times. */
-		WR4(&sc->sc_bas, USART_RTOR, 12);
+		/*
+		 * Set the receive timeout to be 1.5 character times
+		 * assuming 8N1.
+		 */
+		WR4(&sc->sc_bas, USART_RTOR, 15);
 		WR4(&sc->sc_bas, USART_CR, USART_CR_STTTO);
 		WR4(&sc->sc_bas, USART_IER, USART_CSR_TIMEOUT |
 		    USART_CSR_RXBUFF | USART_CSR_ENDRX);
@@ -407,7 +429,6 @@ at91_usart_bus_attach(struct uart_softc 
 	}
 	WR4(&sc->sc_bas, USART_IER, USART_CSR_RXBRK);
 errout:;
-	// XXX bad
 	return (err);
 }
 
@@ -416,14 +437,17 @@ at91_usart_bus_transmit(struct uart_soft
 {
 	bus_addr_t addr;
 	struct at91_usart_softc *atsc;
+	int err;
 
+	err = 0;
 	atsc = (struct at91_usart_softc *)sc;
-	if (bus_dmamap_load(atsc->dmatag, atsc->tx_map, sc->sc_txbuf,
-	    sc->sc_txdatasz, at91_getaddr, &addr, 0) != 0)
-		return (EAGAIN);
-	bus_dmamap_sync(atsc->dmatag, atsc->tx_map, BUS_DMASYNC_PREWRITE);
-
 	uart_lock(sc->sc_hwmtx);
+	if (bus_dmamap_load(atsc->tx_tag, atsc->tx_map, sc->sc_txbuf,
+	    sc->sc_txdatasz, at91_getaddr, &addr, 0) != 0) {
+		err = EAGAIN;
+		goto errout;
+	}
+	bus_dmamap_sync(atsc->tx_tag, atsc->tx_map, BUS_DMASYNC_PREWRITE);
 	sc->sc_txbusy = 1;
 	/*
 	 * Setup the PDC to transfer the data and interrupt us when it
@@ -433,9 +457,11 @@ at91_usart_bus_transmit(struct uart_soft
 	WR4(&sc->sc_bas, PDC_TCR, sc->sc_txdatasz);
 	WR4(&sc->sc_bas, PDC_PTCR, PDC_PTCR_TXTEN);
 	WR4(&sc->sc_bas, USART_IER, USART_CSR_ENDTX);
+errout:
 	uart_unlock(sc->sc_hwmtx);
-	return (0);
+	return (err);
 }
+
 static int
 at91_usart_bus_setsig(struct uart_softc *sc, int sig)
 {
@@ -465,12 +491,14 @@ at91_usart_bus_setsig(struct uart_softc 
 	uart_unlock(sc->sc_hwmtx);
 	return (0);
 }
+
 static int
 at91_usart_bus_receive(struct uart_softc *sc)
 {
 
 	return (0);
 }
+
 static int
 at91_usart_bus_param(struct uart_softc *sc, int baudrate, int databits,
     int stopbits, int parity)
@@ -488,33 +516,31 @@ at91_rx_put(struct uart_softc *sc, int k
 	if (sc->sc_sysdev != NULL && sc->sc_sysdev->type == UART_DEV_CONSOLE)
 		kdb_alt_break(key, &sc->sc_altbrk);
 #endif
-	uart_rx_put(sc, key);	
+	uart_rx_put(sc, key);
 }
 
 static int
 at91_usart_bus_ipend(struct uart_softc *sc)
 {
-	int csr = RD4(&sc->sc_bas, USART_CSR);
-	int ipend = 0, i, len;
 	struct at91_usart_softc *atsc;
 	struct at91_usart_rx *p;
+	int i, ipend, len;
+	uint32_t csr;
 
-	atsc = (struct at91_usart_softc *)sc;	   
+	ipend = 0;
+	atsc = (struct at91_usart_softc *)sc;
+	uart_lock(sc->sc_hwmtx);
+	csr = RD4(&sc->sc_bas, USART_CSR);
 	if (csr & USART_CSR_ENDTX) {
-		bus_dmamap_sync(atsc->dmatag, atsc->tx_map,
+		bus_dmamap_sync(atsc->tx_tag, atsc->tx_map,
 		    BUS_DMASYNC_POSTWRITE);
-		bus_dmamap_unload(atsc->dmatag, atsc->tx_map);
-	}
-	uart_lock(sc->sc_hwmtx);
-	if (csr & USART_CSR_TXRDY) {
-		if (sc->sc_txbusy)
-			ipend |= SER_INT_TXIDLE;
-		WR4(&sc->sc_bas, USART_IDR, USART_CSR_TXRDY);
+		bus_dmamap_unload(atsc->tx_tag, atsc->tx_map);
 	}
-	if (csr & USART_CSR_ENDTX) {
+	if (csr & (USART_CSR_TXRDY | USART_CSR_ENDTX)) {
 		if (sc->sc_txbusy)
 			ipend |= SER_INT_TXIDLE;
-		WR4(&sc->sc_bas, USART_IDR, USART_CSR_ENDTX);
+		WR4(&sc->sc_bas, USART_IDR, csr & (USART_CSR_TXRDY |
+		    USART_CSR_ENDTX));
 	}
 
 	/*
@@ -523,90 +549,103 @@ at91_usart_bus_ipend(struct uart_softc *
 	 * and do all the work elsewhere.  I need to look at the CSR
 	 * bits right now and do things based on them to avoid races.
 	 */
-	if ((atsc->flags & HAS_TIMEOUT) && (csr & USART_CSR_RXBUFF)) {
-		// Have a buffer overflow.  Copy all data from both
-		// ping and pong.  Insert overflow character.  Reset
-		// ping and pong and re-enable the PDC to receive
-		// characters again.
-		bus_dmamap_sync(atsc->dmatag, atsc->ping->map,
-		    BUS_DMASYNC_POSTREAD);
-		bus_dmamap_sync(atsc->dmatag, atsc->pong->map,
-		    BUS_DMASYNC_POSTREAD);
-		for (i = 0; i < sc->sc_rxfifosz; i++)
-			at91_rx_put(sc, atsc->ping->buffer[i]);
-		for (i = 0; i < sc->sc_rxfifosz; i++)
-			at91_rx_put(sc, atsc->pong->buffer[i]);
-		uart_rx_put(sc, UART_STAT_OVERRUN);
-		csr &= ~(USART_CSR_ENDRX | USART_CSR_TIMEOUT);
-		WR4(&sc->sc_bas, PDC_RPR, atsc->ping->pa);
-		WR4(&sc->sc_bas, PDC_RCR, sc->sc_rxfifosz);
-		WR4(&sc->sc_bas, PDC_RNPR, atsc->pong->pa);
-		WR4(&sc->sc_bas, PDC_RNCR, sc->sc_rxfifosz);
-		WR4(&sc->sc_bas, PDC_PTCR, PDC_PTCR_RXTEN);
-		ipend |= SER_INT_RXREADY;
-	}
-	if ((atsc->flags & HAS_TIMEOUT) && (csr & USART_CSR_ENDRX)) {
-		// Shuffle data from 'ping' of ping pong buffer, but
-		// leave current 'pong' in place, as it has become the
-		// new 'ping'.  We need to copy data and setup the old
-		// 'ping' as the new 'pong' when we're done.
-		bus_dmamap_sync(atsc->dmatag, atsc->ping->map,
-		    BUS_DMASYNC_POSTREAD);
-		for (i = 0; i < sc->sc_rxfifosz; i++)
-			at91_rx_put(sc, atsc->ping->buffer[i]);
-		p = atsc->ping;
-		atsc->ping = atsc->pong;
-		atsc->pong = p;
-		WR4(&sc->sc_bas, PDC_RNPR, atsc->pong->pa);
-		WR4(&sc->sc_bas, PDC_RNCR, sc->sc_rxfifosz);
-		ipend |= SER_INT_RXREADY;
-	}
-	if ((atsc->flags & HAS_TIMEOUT) && (csr & USART_CSR_TIMEOUT)) {
-		// We have one partial buffer.  We need to stop the
-		// PDC, get the number of characters left and from
-		// that compute number of valid characters.  We then
-		// need to reset ping and pong and reenable the PDC.
-		// Not sure if there's a race here at fast baud rates
-		// we need to worry about.
-		WR4(&sc->sc_bas, PDC_PTCR, PDC_PTCR_RXTDIS);
-		bus_dmamap_sync(atsc->dmatag, atsc->ping->map,
-		    BUS_DMASYNC_POSTREAD);
-		len = sc->sc_rxfifosz - RD4(&sc->sc_bas, PDC_RCR);
-		for (i = 0; i < len; i++)
-			at91_rx_put(sc, atsc->ping->buffer[i]);
-		WR4(&sc->sc_bas, PDC_RPR, atsc->ping->pa);
-		WR4(&sc->sc_bas, PDC_RCR, sc->sc_rxfifosz);
-		WR4(&sc->sc_bas, USART_CR, USART_CR_STTTO);
-		WR4(&sc->sc_bas, PDC_PTCR, PDC_PTCR_RXTEN);
-		ipend |= SER_INT_RXREADY;
-	}
-	if (!(atsc->flags & HAS_TIMEOUT) && (csr & USART_CSR_RXRDY)) {
-		// We have another charater in a device that doesn't support
-		// timeouts, so we do it one character at a time.
+	if (atsc->flags & HAS_TIMEOUT) {
+		if (csr & USART_CSR_RXBUFF) {
+			/*
+			 * We have a buffer overflow.  Copy all data from both
+			 * ping and pong.  Insert overflow character.  Reset
+			 * ping and pong and re-enable the PDC to receive
+			 * characters again.
+			 */
+			bus_dmamap_sync(atsc->rx_tag, atsc->ping->map,
+			    BUS_DMASYNC_POSTREAD);
+			bus_dmamap_sync(atsc->rx_tag, atsc->pong->map,
+			    BUS_DMASYNC_POSTREAD);
+			for (i = 0; i < sc->sc_rxfifosz; i++)
+				at91_rx_put(sc, atsc->ping->buffer[i]);
+			for (i = 0; i < sc->sc_rxfifosz; i++)
+				at91_rx_put(sc, atsc->pong->buffer[i]);
+			uart_rx_put(sc, UART_STAT_OVERRUN);
+			bus_dmamap_sync(atsc->rx_tag, atsc->ping->map,
+			    BUS_DMASYNC_PREREAD);
+			bus_dmamap_sync(atsc->rx_tag, atsc->pong->map,
+			    BUS_DMASYNC_PREREAD);
+			WR4(&sc->sc_bas, PDC_RPR, atsc->ping->pa);
+			WR4(&sc->sc_bas, PDC_RCR, sc->sc_rxfifosz);
+			WR4(&sc->sc_bas, PDC_RNPR, atsc->pong->pa);
+			WR4(&sc->sc_bas, PDC_RNCR, sc->sc_rxfifosz);
+			WR4(&sc->sc_bas, PDC_PTCR, PDC_PTCR_RXTEN);
+			ipend |= SER_INT_RXREADY;
+		} else if (csr & USART_CSR_ENDRX) {
+			/*
+			 * Shuffle data from ping of ping pong buffer, but
+			 * leave current pong in place, as it has become the
+			 * new ping.  We need to copy data and setup the old
+			 * ping as the new pong when we're done.
+			 */
+			bus_dmamap_sync(atsc->rx_tag, atsc->ping->map,
+			    BUS_DMASYNC_POSTREAD);
+			for (i = 0; i < sc->sc_rxfifosz; i++)
+				at91_rx_put(sc, atsc->ping->buffer[i]);
+			p = atsc->ping;
+			atsc->ping = atsc->pong;
+			atsc->pong = p;
+			bus_dmamap_sync(atsc->rx_tag, atsc->pong->map,
+			    BUS_DMASYNC_PREREAD);
+			WR4(&sc->sc_bas, PDC_RNPR, atsc->pong->pa);
+			WR4(&sc->sc_bas, PDC_RNCR, sc->sc_rxfifosz);
+			ipend |= SER_INT_RXREADY;
+		} else if (csr & USART_CSR_TIMEOUT) {
+			/*
+			 * We have one partial buffer.  We need to stop the
+			 * PDC, get the number of characters left and from
+			 * that compute number of valid characters.  We then
+			 * need to reset ping and pong and reenable the PDC.
+			 * Not sure if there's a race here at fast baud rates
+			 * we need to worry about.
+			 */
+			WR4(&sc->sc_bas, PDC_PTCR, PDC_PTCR_RXTDIS);
+			bus_dmamap_sync(atsc->rx_tag, atsc->ping->map,
+			    BUS_DMASYNC_POSTREAD);
+			len = sc->sc_rxfifosz - RD4(&sc->sc_bas, PDC_RCR);
+			for (i = 0; i < len; i++)
+				at91_rx_put(sc, atsc->ping->buffer[i]);
+			bus_dmamap_sync(atsc->rx_tag, atsc->ping->map,
+			    BUS_DMASYNC_PREREAD);
+			WR4(&sc->sc_bas, PDC_RPR, atsc->ping->pa);
+			WR4(&sc->sc_bas, PDC_RCR, sc->sc_rxfifosz);
+			WR4(&sc->sc_bas, USART_CR, USART_CR_STTTO);
+			WR4(&sc->sc_bas, PDC_PTCR, PDC_PTCR_RXTEN);
+			ipend |= SER_INT_RXREADY;
+		}
+	} else if (csr & USART_CSR_RXRDY) {
+		/*
+		 * We have another charater in a device that doesn't support
+		 * timeouts, so we do it one character at a time.
+		 */
 		at91_rx_put(sc, RD4(&sc->sc_bas, USART_RHR) & 0xff);
 		ipend |= SER_INT_RXREADY;
 	}
 
 	if (csr & USART_CSR_RXBRK) {
-		unsigned int cr = USART_CR_RSTSTA;
-
 		ipend |= SER_INT_BREAK;
-		WR4(&sc->sc_bas, USART_CR, cr);
+		WR4(&sc->sc_bas, USART_CR, USART_CR_RSTSTA);
 	}
 	uart_unlock(sc->sc_hwmtx);
 	return (ipend);
 }
+
 static int
 at91_usart_bus_flush(struct uart_softc *sc, int what)
 {
+
 	return (0);
 }
 
 static int
 at91_usart_bus_getsig(struct uart_softc *sc)
 {
-	uint32_t new, sig;
-	uint8_t csr;
+	uint32_t csr, new, sig;
 
 	uart_lock(sc->sc_hwmtx);
 	csr = RD4(&sc->sc_bas, USART_CSR);
@@ -628,6 +667,7 @@ at91_usart_bus_getsig(struct uart_softc 
 static int
 at91_usart_bus_ioctl(struct uart_softc *sc, int request, intptr_t data)
 {
+
 	switch (request) {
 	case UART_IOCTL_BREAK:
 	case UART_IOCTL_IFLOW:
@@ -637,7 +677,7 @@ at91_usart_bus_ioctl(struct uart_softc *
 		/* only if we know our master clock rate */
 		if (DEFAULT_RCLK != 0)
 			WR4(&sc->sc_bas, USART_BRGR,
-				BAUD2DIVISOR(*(int *)data));
+			    BAUD2DIVISOR(*(int *)data));
 		return (0);
 	}
 	return (EINVAL);

From owner-svn-src-stable-9@FreeBSD.ORG  Sat May 26 09:31:24 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 4F2791065676;
	Sat, 26 May 2012 09:31:23 +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 D1F508FC0A;
	Sat, 26 May 2012 09:31: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 q4Q9VNhD066139;
	Sat, 26 May 2012 09:31:23 GMT (envelope-from marius@svn.freebsd.org)
Received: (from marius@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4Q9VNLt066132;
	Sat, 26 May 2012 09:31:23 GMT (envelope-from marius@svn.freebsd.org)
Message-Id: <201205260931.q4Q9VNLt066132@svn.freebsd.org>
From: Marius Strobl <marius@FreeBSD.org>
Date: Sat, 26 May 2012 09:31:23 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r236089 - in stable/9/sys: dev/mmc modules/mmcsd
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sat, 26 May 2012 09:31:25 -0000

Author: marius
Date: Sat May 26 09:31:23 2012
New Revision: 236089
URL: http://svn.freebsd.org/changeset/base/236089

Log:
  MFC: r234524
  
  o Fixes:
    - When switching to 4-bit operation, send a SET_CLR_CARD_DETECT command
      to disconnect the card-detect pull-up resistor from the DAT3 line before
      sending the SET_BUS_WIDTH command.
    - Add the missing "reserved" zero entry to the mantissa table used to
      decode various CSD fields. This was causing SD cards to report that they
      could run at 30 MHz instead of the maximum 25 MHz mandated in the spec.
  o Enhancements:
    - At the MMC layer, format various info from the CID into a string that
      uniquely identifies the card instance (manufacturer number, serial
      number, product name and revision, etc). Export it as an instance
      variable.
    - At the MMCSD layer, display the formatted card ID string, and also
      report the clock speed of the hardware (not the card's max speed), and
      the number of bits and number of blocks per transfer. It comes out like
      this now:
      mmcsd0: 968MB <SD SD01G 8.0 SN 276886905 MFG 08/2008 by 3 SD> at mmc0
      22.5MHz/4bit/128-block
  o Use DEVMETHOD_END.
  o Use NULL instead of 0 for pointers.
  
  PR:		156496
  Submitted by:	Ian Lepore

Modified:
  stable/9/sys/dev/mmc/mmc.c
  stable/9/sys/dev/mmc/mmcbrvar.h
  stable/9/sys/dev/mmc/mmcreg.h
  stable/9/sys/dev/mmc/mmcsd.c
  stable/9/sys/dev/mmc/mmcvar.h
  stable/9/sys/modules/mmcsd/Makefile
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/amd64/include/xen/   (props changed)
  stable/9/sys/boot/   (props changed)
  stable/9/sys/boot/i386/efi/   (props changed)
  stable/9/sys/boot/ia64/efi/   (props changed)
  stable/9/sys/boot/ia64/ski/   (props changed)
  stable/9/sys/boot/powerpc/boot1.chrp/   (props changed)
  stable/9/sys/boot/powerpc/ofw/   (props changed)
  stable/9/sys/cddl/contrib/opensolaris/   (props changed)
  stable/9/sys/conf/   (props changed)
  stable/9/sys/contrib/dev/acpica/   (props changed)
  stable/9/sys/contrib/octeon-sdk/   (props changed)
  stable/9/sys/contrib/pf/   (props changed)
  stable/9/sys/contrib/x86emu/   (props changed)
  stable/9/sys/dev/   (props changed)
  stable/9/sys/dev/e1000/   (props changed)
  stable/9/sys/dev/ixgbe/   (props changed)
  stable/9/sys/fs/   (props changed)
  stable/9/sys/fs/ntfs/   (props changed)
  stable/9/sys/modules/   (props changed)

Modified: stable/9/sys/dev/mmc/mmc.c
==============================================================================
--- stable/9/sys/dev/mmc/mmc.c	Sat May 26 09:16:37 2012	(r236088)
+++ stable/9/sys/dev/mmc/mmc.c	Sat May 26 09:31:23 2012	(r236089)
@@ -101,6 +101,7 @@ struct mmc_ivars {
 	uint32_t tran_speed;	/* Max speed in normal mode */
 	uint32_t hs_tran_speed;	/* Max speed in high speed mode */
 	uint32_t erase_sector;	/* Card native erase sector size */
+	char card_id_string[64];/* Formatted CID info (serial, MFG, etc) */
 };
 
 #define CMD_RETRIES	3
@@ -140,6 +141,7 @@ static void mmc_app_decode_scr(uint32_t 
 static int mmc_send_ext_csd(struct mmc_softc *sc, uint8_t *rawextcsd);
 static void mmc_scan(struct mmc_softc *sc);
 static int mmc_delete_cards(struct mmc_softc *sc);
+static void mmc_format_card_id_string(struct mmc_ivars *ivar);
 
 static void
 mmc_ms_delay(int ms)
@@ -606,6 +608,13 @@ mmc_set_card_bus_width(struct mmc_softc 
 
 	if (mmcbr_get_mode(sc->dev) == mode_sd) {
 		memset(&cmd, 0, sizeof(struct mmc_command));
+		cmd.opcode = ACMD_SET_CLR_CARD_DETECT;
+		cmd.flags = MMC_RSP_R1 | MMC_CMD_AC;
+		cmd.arg = SD_CLR_CARD_DETECT;
+		err = mmc_wait_for_app_cmd(sc, rca, &cmd, CMD_RETRIES);
+		if (err != 0)
+			return (err);
+		memset(&cmd, 0, sizeof(struct mmc_command));
 		cmd.opcode = ACMD_SET_BUS_WIDTH;
 		cmd.flags = MMC_RSP_R1 | MMC_CMD_AC;
 		switch (width) {
@@ -788,15 +797,52 @@ mmc_decode_cid_mmc(uint32_t *raw_cid, st
 	cid->mdt_year = mmc_get_bits(raw_cid, 128, 8, 4) + 1997;
 }
 
+static void
+mmc_format_card_id_string(struct mmc_ivars *ivar)
+{
+	char oidstr[8];
+	uint8_t c1;
+	uint8_t c2;
+
+	/*
+	 * Format a card ID string for use by the mmcsd driver, it's what
+	 * appears between the <> in the following:
+	 * mmcsd0: 968MB <SD SD01G 8.0 SN 2686905 Mfg 08/2008 by 3 TN> at mmc0
+	 * 22.5MHz/4bit/128-block
+	 *
+	 * The card_id_string in mmc_ivars is currently allocated as 64 bytes,
+	 * and our max formatted length is currently 55 bytes if every field
+	 * contains the largest value.
+	 *
+	 * Sometimes the oid is two printable ascii chars; when it's not,
+	 * format it as 0xnnnn instead.
+	 */
+	c1 = (ivar->cid.oid >> 8) & 0x0ff;
+	c2 = ivar->cid.oid & 0x0ff;
+	if (c1 > 0x1f && c1 < 0x7f && c2 > 0x1f && c2 < 0x7f)
+		snprintf(oidstr, sizeof(oidstr), "%c%c", c1, c2);
+	else
+		snprintf(oidstr, sizeof(oidstr), "0x%04x", ivar->cid.oid);
+	snprintf(ivar->card_id_string, sizeof(ivar->card_id_string),
+	    "%s%s %s %d.%d SN %d MFG %02d/%04d by %d %s",
+	    ivar->mode == mode_sd ? "SD" : "MMC", ivar->high_cap ? "HC" : "",
+	    ivar->cid.pnm, ivar->cid.prv >> 4, ivar->cid.prv & 0x0f,
+	    ivar->cid.psn, ivar->cid.mdt_month, ivar->cid.mdt_year,
+	    ivar->cid.mid, oidstr);
+}
+
 static const int exp[8] = {
 	1, 10, 100, 1000, 10000, 100000, 1000000, 10000000
 };
+
 static const int mant[16] = {
-	10, 12, 13, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 70, 80
+	0, 10, 12, 13, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 70, 80
 };
+
 static const int cur_min[8] = {
 	500, 1000, 5000, 10000, 25000, 35000, 60000, 100000
 };
+
 static const int cur_max[8] = {
 	1000, 5000, 10000, 25000, 35000, 45000, 800000, 200000
 };
@@ -1080,13 +1126,7 @@ mmc_log_card(device_t dev, struct mmc_iv
 {
 	device_printf(dev, "Card at relative address %d%s:\n",
 	    ivar->rca, newcard ? " added" : "");
-	device_printf(dev, " card: %s%s (0x%x/0x%x/\"%s\" rev %d.%d "
-	    "m/d %02d.%04d s/n %08x)\n",
-	    ivar->mode == mode_sd ? "SD" : "MMC",
-	    ivar->high_cap ? " High Capacity" : "", 
-	    ivar->cid.mid, ivar->cid.oid,
-	    ivar->cid.pnm, ivar->cid.prv >> 4, ivar->cid.prv & 0x0f,
-	    ivar->cid.mdt_month, ivar->cid.mdt_year, ivar->cid.psn);
+	device_printf(dev, " card: %s\n", ivar->card_id_string);
 	device_printf(dev, " bus: %ubit, %uMHz%s\n",
 	    (ivar->bus_width == bus_width_1 ? 1 :
 	    (ivar->bus_width == bus_width_4 ? 4 : 8)),
@@ -1188,6 +1228,7 @@ mmc_discover_cards(struct mmc_softc *sc)
 			if ((mmcbr_get_caps(sc->dev) & MMC_CAP_4_BIT_DATA) &&
 			    (ivar->scr.bus_widths & SD_SCR_BUS_WIDTH_4))
 				ivar->bus_width = bus_width_4;
+			mmc_format_card_id_string(ivar);
 			if (bootverbose || mmc_debug)
 				mmc_log_card(sc->dev, ivar, newcard);
 			if (newcard) {
@@ -1245,6 +1286,7 @@ mmc_discover_cards(struct mmc_softc *sc)
 			ivar->bus_width = bus_width_1;
 			ivar->timing = bus_timing_normal;
 		}
+		mmc_format_card_id_string(ivar);
 		if (bootverbose || mmc_debug)
 			mmc_log_card(sc->dev, ivar, newcard);
 		if (newcard) {
@@ -1477,6 +1519,9 @@ mmc_read_ivar(device_t bus, device_t chi
 	case MMC_IVAR_MAX_DATA:
 		*result = mmcbr_get_max_data(bus);
 		break;
+	case MMC_IVAR_CARD_ID_STRING:
+		*(char **)result = ivar->card_id_string;
+		break;
 	}
 	return (0);
 }
@@ -1527,7 +1572,7 @@ static device_method_t mmc_methods[] = {
 	DEVMETHOD(mmcbus_acquire_bus, mmc_acquire_bus),
 	DEVMETHOD(mmcbus_release_bus, mmc_release_bus),
 
-	{0, 0},
+	DEVMETHOD_END
 };
 
 static driver_t mmc_driver = {
@@ -1537,6 +1582,5 @@ static driver_t mmc_driver = {
 };
 static devclass_t mmc_devclass;
 
-
 DRIVER_MODULE(mmc, at91_mci, mmc_driver, mmc_devclass, NULL, NULL);
 DRIVER_MODULE(mmc, sdhci, mmc_driver, mmc_devclass, NULL, NULL);

Modified: stable/9/sys/dev/mmc/mmcbrvar.h
==============================================================================
--- stable/9/sys/dev/mmc/mmcbrvar.h	Sat May 26 09:16:37 2012	(r236088)
+++ stable/9/sys/dev/mmc/mmcbrvar.h	Sat May 26 09:31:23 2012	(r236089)
@@ -56,6 +56,7 @@
 #define DEV_MMC_MMCBRVAR_H
 
 #include <dev/mmc/bridge.h>
+#include <dev/mmc/mmcreg.h>
 #include "mmcbr_if.h"
 
 enum mmcbr_device_ivars {
@@ -72,8 +73,7 @@ enum mmcbr_device_ivars {
     MMCBR_IVAR_VDD,
     MMCBR_IVAR_CAPS,
     MMCBR_IVAR_TIMING,
-    MMCBR_IVAR_MAX_DATA,
-//    MMCBR_IVAR_,
+    MMCBR_IVAR_MAX_DATA
 };
 
 /*

Modified: stable/9/sys/dev/mmc/mmcreg.h
==============================================================================
--- stable/9/sys/dev/mmc/mmcreg.h	Sat May 26 09:16:37 2012	(r236088)
+++ stable/9/sys/dev/mmc/mmcreg.h	Sat May 26 09:31:23 2012	(r236089)
@@ -139,8 +139,8 @@ struct mmc_command {
 #define	R1_READY_FOR_DATA (1u << 8)		/* sx, a */
 #define	R1_APP_CMD (1u << 5)			/* sr, c */
 #define	R1_AKE_SEQ_ERROR (1u << 3)		/* er, c */
-#define	R1_STATUS(x)            (x & 0xFFFFE000
-#define	R1_CURRENT_STATE(x) ((x) & R1_CURRENT_STATE_MASK) >> 9
+#define	R1_STATUS(x)		((x) & 0xFFFFE000)
+#define	R1_CURRENT_STATE(x)	(((x) & R1_CURRENT_STATE_MASK) >> 9)
 #define	R1_STATE_IDLE	0
 #define	R1_STATE_READY	1
 #define	R1_STATE_IDENT	2
@@ -330,6 +330,9 @@ struct mmc_request {
 #define SD_SWITCH_HS_MODE	1
 #define SD_SWITCH_NOCHANGE	0xF
 
+#define	SD_CLR_CARD_DETECT	0
+#define	SD_SET_CARD_DETECT	1
+
 #define	SD_MAX_HS		50000000
 
 /* OCR bits */
@@ -380,7 +383,7 @@ struct mmc_cid {
 	uint8_t fwrev;
 };
 
-struct mmc_csd 
+struct mmc_csd
 {
 	uint8_t csd_structure;
 	uint8_t spec_vers;

Modified: stable/9/sys/dev/mmc/mmcsd.c
==============================================================================
--- stable/9/sys/dev/mmc/mmcsd.c	Sat May 26 09:16:37 2012	(r236088)
+++ stable/9/sys/dev/mmc/mmcsd.c	Sat May 26 09:31:23 2012	(r236089)
@@ -66,11 +66,17 @@ __FBSDID("$FreeBSD$");
 #include <sys/mutex.h>
 #include <geom/geom_disk.h>
 
-#include <dev/mmc/mmcvar.h>
+#include <dev/mmc/mmcbrvar.h>
 #include <dev/mmc/mmcreg.h>
+#include <dev/mmc/mmcvar.h>
 
 #include "mmcbus_if.h"
 
+#if __FreeBSD_version < 800002
+#define	kproc_create	kthread_create
+#define	kproc_exit	kthread_exit
+#endif
+
 struct mmcsd_softc {
 	device_t dev;
 	struct mtx sc_mtx;
@@ -95,7 +101,6 @@ static int mmcsd_dump(void *arg, void *v
 	off_t offset, size_t length);
 static void mmcsd_task(void *arg);
 
-static const char *mmcsd_card_name(device_t dev);
 static int mmcsd_bus_bit_width(device_t dev);
 
 #define MMCSD_LOCK(_sc)		mtx_lock(&(_sc)->sc_mtx)
@@ -122,6 +127,8 @@ mmcsd_attach(device_t dev)
 	struct mmcsd_softc *sc;
 	struct disk *d;
 	intmax_t mb;
+	uint32_t speed;
+	uint32_t maxblocks;
 	char unit;
 
 	sc = device_get_softc(dev);
@@ -157,11 +164,22 @@ mmcsd_attach(device_t dev)
 		unit = 'G';
 		mb /= 1024;
 	}
-	device_printf(dev, "%ju%cB <%s Memory Card>%s at %s %dMHz/%dbit\n",
-	    mb, unit, mmcsd_card_name(dev),
+	/*
+	 * Report the clock speed of the underlying hardware, which might be
+	 * different than what the card reports due to hardware limitations.
+	 * Report how many blocks the hardware transfers at once, but clip the
+	 * number to MAXPHYS since the system won't initiate larger transfers.
+	 */
+	speed = mmcbr_get_clock(device_get_parent(dev));
+	maxblocks = mmc_get_max_data(dev);
+	if (maxblocks > MAXPHYS)
+		maxblocks = MAXPHYS;
+	device_printf(dev, "%ju%cB <%s>%s at %s %d.%01dMHz/%dbit/%d-block\n",
+	    mb, unit, mmc_get_card_id_string(dev),
 	    mmc_get_read_only(dev) ? " (read-only)" : "",
 	    device_get_nameunit(device_get_parent(dev)),
-	    mmc_get_tran_speed(dev) / 1000000, mmcsd_bus_bit_width(dev));
+	    speed / 1000000, (speed / 100000) % 10,
+	    mmcsd_bus_bit_width(dev), maxblocks);
 	disk_create(d, DISK_VERSION);
 	bioq_init(&sc->bio_queue);
 
@@ -500,16 +518,6 @@ out:
 	kproc_exit(0);
 }
 
-static const char *
-mmcsd_card_name(device_t dev)
-{
-	if (mmc_get_card_type(dev) == mode_mmc)
-		return ("MMC");
-	if (mmc_get_high_cap(dev))
-		return ("SDHC");
-	return ("SD");
-}
-
 static int
 mmcsd_bus_bit_width(device_t dev)
 {
@@ -526,7 +534,7 @@ static device_method_t mmcsd_methods[] =
 	DEVMETHOD(device_detach, mmcsd_detach),
 	DEVMETHOD(device_suspend, mmcsd_suspend),
 	DEVMETHOD(device_resume, mmcsd_resume),
-	{0, 0},
+	DEVMETHOD_END
 };
 
 static driver_t mmcsd_driver = {
@@ -536,4 +544,4 @@ static driver_t mmcsd_driver = {
 };
 static devclass_t mmcsd_devclass;
 
-DRIVER_MODULE(mmcsd, mmc, mmcsd_driver, mmcsd_devclass, 0, 0);
+DRIVER_MODULE(mmcsd, mmc, mmcsd_driver, mmcsd_devclass, NULL, NULL);

Modified: stable/9/sys/dev/mmc/mmcvar.h
==============================================================================
--- stable/9/sys/dev/mmc/mmcvar.h	Sat May 26 09:16:37 2012	(r236088)
+++ stable/9/sys/dev/mmc/mmcvar.h	Sat May 26 09:31:23 2012	(r236089)
@@ -69,7 +69,7 @@ enum mmc_device_ivars {
     MMC_IVAR_BUS_WIDTH,
     MMC_IVAR_ERASE_SECTOR,
     MMC_IVAR_MAX_DATA,
-//    MMC_IVAR_,
+    MMC_IVAR_CARD_ID_STRING
 };
 
 /*
@@ -89,5 +89,6 @@ MMC_ACCESSOR(card_type, CARD_TYPE, int)
 MMC_ACCESSOR(bus_width, BUS_WIDTH, int)
 MMC_ACCESSOR(erase_sector, ERASE_SECTOR, int)
 MMC_ACCESSOR(max_data, MAX_DATA, int)
+MMC_ACCESSOR(card_id_string, CARD_ID_STRING, const char *)
 
 #endif /* DEV_MMC_MMCVAR_H */

Modified: stable/9/sys/modules/mmcsd/Makefile
==============================================================================
--- stable/9/sys/modules/mmcsd/Makefile	Sat May 26 09:16:37 2012	(r236088)
+++ stable/9/sys/modules/mmcsd/Makefile	Sat May 26 09:31:23 2012	(r236089)
@@ -3,6 +3,6 @@
 .PATH: ${.CURDIR}/../../dev/mmc
 
 KMOD=	mmcsd
-SRCS=	mmcsd.c mmcbus_if.h device_if.h bus_if.h
+SRCS=	bus_if.h device_if.h mmcbr_if.h mmcbus_if.h mmcsd.c
 
 .include <bsd.kmod.mk>

From owner-svn-src-stable-9@FreeBSD.ORG  Sat May 26 10:24:31 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 54A261065670;
	Sat, 26 May 2012 10:24:31 +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 3DDB98FC16;
	Sat, 26 May 2012 10:24: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 q4QAOVkH072138;
	Sat, 26 May 2012 10:24:31 GMT (envelope-from bz@svn.freebsd.org)
Received: (from bz@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4QAOVGK072135;
	Sat, 26 May 2012 10:24:31 GMT (envelope-from bz@svn.freebsd.org)
Message-Id: <201205261024.q4QAOVGK072135@svn.freebsd.org>
From: "Bjoern A. Zeeb" <bz@FreeBSD.org>
Date: Sat, 26 May 2012 10:24:31 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r236091 - stable/9/sys/netinet
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sat, 26 May 2012 10:24:31 -0000

Author: bz
Date: Sat May 26 10:24:30 2012
New Revision: 236091
URL: http://svn.freebsd.org/changeset/base/236091

Log:
  MFC r235474:
  
   Switch to a standard 2 clause BSD license (from bsd-style-copyright).
  
   Approved by:	Myricom Inc. (gallatin)
   Approved by:	Intel Corporation (jfv)

Modified:
  stable/9/sys/netinet/tcp_lro.c
  stable/9/sys/netinet/tcp_lro.h
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/netinet/tcp_lro.c
==============================================================================
--- stable/9/sys/netinet/tcp_lro.c	Sat May 26 09:31:25 2012	(r236090)
+++ stable/9/sys/netinet/tcp_lro.c	Sat May 26 10:24:30 2012	(r236091)
@@ -1,37 +1,31 @@
-/******************************************************************************
-
-Copyright (c) 2007, Myricom Inc.
-Copyright (c) 2008, Intel 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. Neither the name of the Myricom Inc, nor the names of its
-    contributors may be used to endorse or promote products derived from
-    this software without specific prior written permission.
-
- 3. Neither the name of the Intel 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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$ 
-***************************************************************************/
+/*-
+ * Copyright (c) 2007, Myricom Inc.
+ * Copyright (c) 2008, Intel Corporation.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$ 
+ */
 
 #include <sys/param.h>
 #include <sys/systm.h>

Modified: stable/9/sys/netinet/tcp_lro.h
==============================================================================
--- stable/9/sys/netinet/tcp_lro.h	Sat May 26 09:31:25 2012	(r236090)
+++ stable/9/sys/netinet/tcp_lro.h	Sat May 26 10:24:30 2012	(r236091)
@@ -1,39 +1,32 @@
-/*******************************************************************************
+/*-
+ * Copyright (c) 2006, Myricom Inc.
+ * Copyright (c) 2008, Intel Corporation.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
 
-Copyright (c) 2006, Myricom Inc.
-Copyright (c) 2008, Intel 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. Neither the name of the Myricom Inc, nor the names of its
-    contributors may be used to endorse or promote products derived from
-    this software without specific prior written permission.
-
- 2. Neither the name of the Intel 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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 _TCP_LRO_H_
 #define _TCP_LRO_H_
 

From owner-svn-src-stable-9@FreeBSD.ORG  Sat May 26 13:12:14 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id D25B51065674;
	Sat, 26 May 2012 13:12:14 +0000 (UTC)
	(envelope-from rmacklem@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id BABA08FC17;
	Sat, 26 May 2012 13:12: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 q4QDCERD079129;
	Sat, 26 May 2012 13:12:14 GMT
	(envelope-from rmacklem@svn.freebsd.org)
Received: (from rmacklem@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4QDCELs079120;
	Sat, 26 May 2012 13:12:14 GMT
	(envelope-from rmacklem@svn.freebsd.org)
Message-Id: <201205261312.q4QDCELs079120@svn.freebsd.org>
From: Rick Macklem <rmacklem@FreeBSD.org>
Date: Sat, 26 May 2012 13:12:14 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r236096 - in stable/9/sys: fs/nfsclient nfsclient
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sat, 26 May 2012 13:12:14 -0000

Author: rmacklem
Date: Sat May 26 13:12:14 2012
New Revision: 236096
URL: http://svn.freebsd.org/changeset/base/236096

Log:
  MFC: r235332
  PR# 165923 reported intermittent write failures for dirty
  memory mapped pages being written back on an NFS mount.
  Since any thread can call VOP_PUTPAGES() to write back a
  dirty page, the credentials of that thread may not have
  write access to the file on an NFS server. (Often the uid
  is 0, which may be mapped to "nobody" in the NFS server.)
  Although there is no completely correct fix for this
  (NFS servers check access on every write RPC instead of at
  open/mmap time), this patch avoids the common cases by
  holding onto a credential that recently opened the file
  for writing and uses that credential for the write RPCs
  being done by VOP_PUTPAGES() for both NFS clients.

Modified:
  stable/9/sys/fs/nfsclient/nfs_clbio.c
  stable/9/sys/fs/nfsclient/nfs_clnode.c
  stable/9/sys/fs/nfsclient/nfs_clvnops.c
  stable/9/sys/fs/nfsclient/nfsnode.h
  stable/9/sys/nfsclient/nfs_bio.c
  stable/9/sys/nfsclient/nfs_node.c
  stable/9/sys/nfsclient/nfs_vnops.c
  stable/9/sys/nfsclient/nfsnode.h
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/amd64/include/xen/   (props changed)
  stable/9/sys/boot/   (props changed)
  stable/9/sys/boot/i386/efi/   (props changed)
  stable/9/sys/boot/ia64/efi/   (props changed)
  stable/9/sys/boot/ia64/ski/   (props changed)
  stable/9/sys/boot/powerpc/boot1.chrp/   (props changed)
  stable/9/sys/boot/powerpc/ofw/   (props changed)
  stable/9/sys/cddl/contrib/opensolaris/   (props changed)
  stable/9/sys/conf/   (props changed)
  stable/9/sys/contrib/dev/acpica/   (props changed)
  stable/9/sys/contrib/octeon-sdk/   (props changed)
  stable/9/sys/contrib/pf/   (props changed)
  stable/9/sys/contrib/x86emu/   (props changed)
  stable/9/sys/dev/   (props changed)
  stable/9/sys/dev/e1000/   (props changed)
  stable/9/sys/dev/ixgbe/   (props changed)
  stable/9/sys/fs/   (props changed)
  stable/9/sys/fs/ntfs/   (props changed)
  stable/9/sys/modules/   (props changed)

Modified: stable/9/sys/fs/nfsclient/nfs_clbio.c
==============================================================================
--- stable/9/sys/fs/nfsclient/nfs_clbio.c	Sat May 26 12:39:23 2012	(r236095)
+++ stable/9/sys/fs/nfsclient/nfs_clbio.c	Sat May 26 13:12:14 2012	(r236096)
@@ -281,7 +281,11 @@ ncl_putpages(struct vop_putpages_args *a
 	vp = ap->a_vp;
 	np = VTONFS(vp);
 	td = curthread;				/* XXX */
-	cred = curthread->td_ucred;		/* XXX */
+	/* Set the cred to n_writecred for the write rpcs. */
+	if (np->n_writecred != NULL)
+		cred = crhold(np->n_writecred);
+	else
+		cred = crhold(curthread->td_ucred);	/* XXX */
 	nmp = VFSTONFS(vp->v_mount);
 	pages = ap->a_m;
 	count = ap->a_count;
@@ -345,6 +349,7 @@ ncl_putpages(struct vop_putpages_args *a
 	    iomode = NFSWRITE_FILESYNC;
 
 	error = ncl_writerpc(vp, &uio, cred, &iomode, &must_commit, 0);
+	crfree(cred);
 
 	pmap_qremove(kva, npages);
 	relpbuf(bp, &ncl_pbuf_freecnt);

Modified: stable/9/sys/fs/nfsclient/nfs_clnode.c
==============================================================================
--- stable/9/sys/fs/nfsclient/nfs_clnode.c	Sat May 26 12:39:23 2012	(r236095)
+++ stable/9/sys/fs/nfsclient/nfs_clnode.c	Sat May 26 13:12:14 2012	(r236096)
@@ -300,6 +300,8 @@ ncl_reclaim(struct vop_reclaim_args *ap)
 			FREE((caddr_t)dp2, M_NFSDIROFF);
 		}
 	}
+	if (np->n_writecred != NULL)
+		crfree(np->n_writecred);
 	FREE((caddr_t)np->n_fhp, M_NFSFH);
 	if (np->n_v4 != NULL)
 		FREE((caddr_t)np->n_v4, M_NFSV4NODE);

Modified: stable/9/sys/fs/nfsclient/nfs_clvnops.c
==============================================================================
--- stable/9/sys/fs/nfsclient/nfs_clvnops.c	Sat May 26 12:39:23 2012	(r236095)
+++ stable/9/sys/fs/nfsclient/nfs_clvnops.c	Sat May 26 13:12:14 2012	(r236096)
@@ -513,6 +513,7 @@ nfs_open(struct vop_open_args *ap)
 	struct vattr vattr;
 	int error;
 	int fmode = ap->a_mode;
+	struct ucred *cred;
 
 	if (vp->v_type != VREG && vp->v_type != VDIR && vp->v_type != VLNK)
 		return (EOPNOTSUPP);
@@ -604,7 +605,22 @@ nfs_open(struct vop_open_args *ap)
 		}
 		np->n_directio_opens++;
 	}
+
+	/*
+	 * If this is an open for writing, capture a reference to the
+	 * credentials, so they can be used by ncl_putpages(). Using
+	 * these write credentials is preferable to the credentials of
+	 * whatever thread happens to be doing the VOP_PUTPAGES() since
+	 * the write RPCs are less likely to fail with EACCES.
+	 */
+	if ((fmode & FWRITE) != 0) {
+		cred = np->n_writecred;
+		np->n_writecred = crhold(ap->a_cred);
+	} else
+		cred = NULL;
 	mtx_unlock(&np->n_mtx);
+	if (cred != NULL)
+		crfree(cred);
 	vnode_create_vobject(vp, vattr.va_size, ap->a_td);
 	return (0);
 }

Modified: stable/9/sys/fs/nfsclient/nfsnode.h
==============================================================================
--- stable/9/sys/fs/nfsclient/nfsnode.h	Sat May 26 12:39:23 2012	(r236095)
+++ stable/9/sys/fs/nfsclient/nfsnode.h	Sat May 26 13:12:14 2012	(r236096)
@@ -126,6 +126,7 @@ struct nfsnode {
 	int                     n_directio_asyncwr;
 	u_int64_t		 n_change;	/* old Change attribute */
 	struct nfsv4node	*n_v4;		/* extra V4 stuff */
+	struct ucred		*n_writecred;	/* Cred. for putpages */
 };
 
 #define	n_atim		n_un1.nf_atim

Modified: stable/9/sys/nfsclient/nfs_bio.c
==============================================================================
--- stable/9/sys/nfsclient/nfs_bio.c	Sat May 26 12:39:23 2012	(r236095)
+++ stable/9/sys/nfsclient/nfs_bio.c	Sat May 26 13:12:14 2012	(r236096)
@@ -275,7 +275,11 @@ nfs_putpages(struct vop_putpages_args *a
 	vp = ap->a_vp;
 	np = VTONFS(vp);
 	td = curthread;				/* XXX */
-	cred = curthread->td_ucred;		/* XXX */
+	/* Set the cred to n_writecred for the write rpcs. */
+	if (np->n_writecred != NULL)
+		cred = crhold(np->n_writecred);
+	else
+		cred = crhold(curthread->td_ucred);	/* XXX */
 	nmp = VFSTONFS(vp->v_mount);
 	pages = ap->a_m;
 	count = ap->a_count;
@@ -339,6 +343,7 @@ nfs_putpages(struct vop_putpages_args *a
 	    iomode = NFSV3WRITE_FILESYNC;
 
 	error = (nmp->nm_rpcops->nr_writerpc)(vp, &uio, cred, &iomode, &must_commit);
+	crfree(cred);
 
 	pmap_qremove(kva, npages);
 	relpbuf(bp, &nfs_pbuf_freecnt);

Modified: stable/9/sys/nfsclient/nfs_node.c
==============================================================================
--- stable/9/sys/nfsclient/nfs_node.c	Sat May 26 12:39:23 2012	(r236095)
+++ stable/9/sys/nfsclient/nfs_node.c	Sat May 26 13:12:14 2012	(r236096)
@@ -270,6 +270,8 @@ nfs_reclaim(struct vop_reclaim_args *ap)
 			free((caddr_t)dp2, M_NFSDIROFF);
 		}
 	}
+	if (np->n_writecred != NULL)
+		crfree(np->n_writecred);
 	if (np->n_fhsize > NFS_SMALLFH) {
 		free((caddr_t)np->n_fhp, M_NFSBIGFH);
 	}

Modified: stable/9/sys/nfsclient/nfs_vnops.c
==============================================================================
--- stable/9/sys/nfsclient/nfs_vnops.c	Sat May 26 12:39:23 2012	(r236095)
+++ stable/9/sys/nfsclient/nfs_vnops.c	Sat May 26 13:12:14 2012	(r236096)
@@ -509,6 +509,7 @@ nfs_open(struct vop_open_args *ap)
 	struct vattr vattr;
 	int error;
 	int fmode = ap->a_mode;
+	struct ucred *cred;
 
 	if (vp->v_type != VREG && vp->v_type != VDIR && vp->v_type != VLNK)
 		return (EOPNOTSUPP);
@@ -565,7 +566,22 @@ nfs_open(struct vop_open_args *ap)
 		}
 		np->n_directio_opens++;
 	}
+
+	/*
+	 * If this is an open for writing, capture a reference to the
+	 * credentials, so they can be used by nfs_putpages(). Using
+	 * these write credentials is preferable to the credentials of
+	 * whatever thread happens to be doing the VOP_PUTPAGES() since
+	 * the write RPCs are less likely to fail with EACCES.
+	 */
+	if ((fmode & FWRITE) != 0) {
+		cred = np->n_writecred;
+		np->n_writecred = crhold(ap->a_cred);
+	} else
+		cred = NULL;
 	mtx_unlock(&np->n_mtx);
+	if (cred != NULL)
+		crfree(cred);
 	vnode_create_vobject(vp, vattr.va_size, ap->a_td);
 	return (0);
 }

Modified: stable/9/sys/nfsclient/nfsnode.h
==============================================================================
--- stable/9/sys/nfsclient/nfsnode.h	Sat May 26 12:39:23 2012	(r236095)
+++ stable/9/sys/nfsclient/nfsnode.h	Sat May 26 13:12:14 2012	(r236096)
@@ -131,6 +131,7 @@ struct nfsnode {
 	uint32_t		n_namelen;
 	int			n_directio_opens;
 	int                     n_directio_asyncwr;
+	struct ucred		*n_writecred;	/* Cred. for putpages */
 };
 
 #define n_atim		n_un1.nf_atim

From owner-svn-src-stable-9@FreeBSD.ORG  Sat May 26 16:34:39 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id B26431065670;
	Sat, 26 May 2012 16:34:39 +0000 (UTC) (envelope-from des@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 9D74E8FC19;
	Sat, 26 May 2012 16:34: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 q4QGYdbo088610;
	Sat, 26 May 2012 16:34:39 GMT (envelope-from des@svn.freebsd.org)
Received: (from des@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4QGYdAo088601;
	Sat, 26 May 2012 16:34:39 GMT (envelope-from des@svn.freebsd.org)
Message-Id: <201205261634.q4QGYdAo088601@svn.freebsd.org>
From: Dag-Erling Smorgrav <des@FreeBSD.org>
Date: Sat, 26 May 2012 16:34:39 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r236103 - stable/9/lib/libfetch
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sat, 26 May 2012 16:34:39 -0000

Author: des
Date: Sat May 26 16:34:39 2012
New Revision: 236103
URL: http://svn.freebsd.org/changeset/base/236103

Log:
  MFH r225813,r225814,r226537: cosmetic

Modified:
  stable/9/lib/libfetch/common.c
  stable/9/lib/libfetch/common.h
  stable/9/lib/libfetch/fetch.3
  stable/9/lib/libfetch/fetch.c
  stable/9/lib/libfetch/fetch.h
  stable/9/lib/libfetch/file.c
  stable/9/lib/libfetch/ftp.c
  stable/9/lib/libfetch/http.c
Directory Properties:
  stable/9/lib/libfetch/   (props changed)

Modified: stable/9/lib/libfetch/common.c
==============================================================================
--- stable/9/lib/libfetch/common.c	Sat May 26 16:26:23 2012	(r236102)
+++ stable/9/lib/libfetch/common.c	Sat May 26 16:34:39 2012	(r236103)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 1998-2004 Dag-Erling Coïdan Smørgrav
+ * Copyright (c) 1998-2011 Dag-Erling Smørgrav
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without

Modified: stable/9/lib/libfetch/common.h
==============================================================================
--- stable/9/lib/libfetch/common.h	Sat May 26 16:26:23 2012	(r236102)
+++ stable/9/lib/libfetch/common.h	Sat May 26 16:34:39 2012	(r236103)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 1998-2004 Dag-Erling Coïdan Smørgrav
+ * Copyright (c) 1998-2011 Dag-Erling Smørgrav
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without

Modified: stable/9/lib/libfetch/fetch.3
==============================================================================
--- stable/9/lib/libfetch/fetch.3	Sat May 26 16:26:23 2012	(r236102)
+++ stable/9/lib/libfetch/fetch.3	Sat May 26 16:34:39 2012	(r236103)
@@ -1,5 +1,5 @@
 .\"-
-.\" Copyright (c) 1998-2004 Dag-Erling Coïdan Smørgrav
+.\" Copyright (c) 1998-2011 Dag-Erling Smørgrav
 .\" All rights reserved.
 .\"
 .\" Redistribution and use in source and binary forms, with or without
@@ -25,7 +25,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd January 26, 2010
+.Dd September 27, 2011
 .Dt FETCH 3
 .Os
 .Sh NAME

Modified: stable/9/lib/libfetch/fetch.c
==============================================================================
--- stable/9/lib/libfetch/fetch.c	Sat May 26 16:26:23 2012	(r236102)
+++ stable/9/lib/libfetch/fetch.c	Sat May 26 16:34:39 2012	(r236103)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 1998-2004 Dag-Erling Coïdan Smørgrav
+ * Copyright (c) 1998-2004 Dag-Erling Smørgrav
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without

Modified: stable/9/lib/libfetch/fetch.h
==============================================================================
--- stable/9/lib/libfetch/fetch.h	Sat May 26 16:26:23 2012	(r236102)
+++ stable/9/lib/libfetch/fetch.h	Sat May 26 16:34:39 2012	(r236103)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 1998-2004 Dag-Erling Coïdan Smørgrav
+ * Copyright (c) 1998-2004 Dag-Erling Smørgrav
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without

Modified: stable/9/lib/libfetch/file.c
==============================================================================
--- stable/9/lib/libfetch/file.c	Sat May 26 16:26:23 2012	(r236102)
+++ stable/9/lib/libfetch/file.c	Sat May 26 16:34:39 2012	(r236103)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 1998-2004 Dag-Erling Coïdan Smørgrav
+ * Copyright (c) 1998-2011 Dag-Erling Smørgrav
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without

Modified: stable/9/lib/libfetch/ftp.c
==============================================================================
--- stable/9/lib/libfetch/ftp.c	Sat May 26 16:26:23 2012	(r236102)
+++ stable/9/lib/libfetch/ftp.c	Sat May 26 16:34:39 2012	(r236103)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 1998-2004 Dag-Erling Coïdan Smørgrav
+ * Copyright (c) 1998-2011 Dag-Erling Smørgrav
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -41,7 +41,7 @@ __FBSDID("$FreeBSD$");
  *
  * Major Changelog:
  *
- * Dag-Erling Coïdan Smørgrav
+ * Dag-Erling Smørgrav
  * 9 Jun 1998
  *
  * Incorporated into libfetch

Modified: stable/9/lib/libfetch/http.c
==============================================================================
--- stable/9/lib/libfetch/http.c	Sat May 26 16:26:23 2012	(r236102)
+++ stable/9/lib/libfetch/http.c	Sat May 26 16:34:39 2012	(r236103)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2000-2004 Dag-Erling Coïdan Smørgrav
+ * Copyright (c) 2000-2011 Dag-Erling Smørgrav
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without

From owner-svn-src-stable-9@FreeBSD.ORG  Sat May 26 16:37:43 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 96CAA1065676;
	Sat, 26 May 2012 16:37:43 +0000 (UTC) (envelope-from des@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 8244D8FC17;
	Sat, 26 May 2012 16:37: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 q4QGbhPt088790;
	Sat, 26 May 2012 16:37:43 GMT (envelope-from des@svn.freebsd.org)
Received: (from des@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4QGbhCV088788;
	Sat, 26 May 2012 16:37:43 GMT (envelope-from des@svn.freebsd.org)
Message-Id: <201205261637.q4QGbhCV088788@svn.freebsd.org>
From: Dag-Erling Smorgrav <des@FreeBSD.org>
Date: Sat, 26 May 2012 16:37:43 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r236104 - stable/9/lib/libfetch
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sat, 26 May 2012 16:37:43 -0000

Author: des
Date: Sat May 26 16:37:43 2012
New Revision: 236104
URL: http://svn.freebsd.org/changeset/base/236104

Log:
  MFH r230478: fix nits in already-merged r230307.

Modified:
  stable/9/lib/libfetch/common.c
Directory Properties:
  stable/9/lib/libfetch/   (props changed)

Modified: stable/9/lib/libfetch/common.c
==============================================================================
--- stable/9/lib/libfetch/common.c	Sat May 26 16:34:39 2012	(r236103)
+++ stable/9/lib/libfetch/common.c	Sat May 26 16:37:43 2012	(r236104)
@@ -416,7 +416,6 @@ fetch_cache_data(conn_t *conn, char *src
 	if (conn->cache.size < nbytes) {
 		tmp = realloc(conn->cache.buf, nbytes);
 		if (tmp == NULL) {
-			errno = ENOMEM;
 			fetch_syserr();
 			return (-1);
 		}
@@ -481,7 +480,7 @@ fetch_read(conn_t *conn, char *buf, size
 		conn->cache.len -= total;
 		conn->cache.pos += total;
 		len -= total;
-		buf+= total;
+		buf += total;
 	}
 
 	while (len > 0) {

From owner-svn-src-stable-9@FreeBSD.ORG  Sat May 26 16:42:48 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 73529106566B;
	Sat, 26 May 2012 16:42:48 +0000 (UTC) (envelope-from des@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 5ED518FC12;
	Sat, 26 May 2012 16:42: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 q4QGgmeo089031;
	Sat, 26 May 2012 16:42:48 GMT (envelope-from des@svn.freebsd.org)
Received: (from des@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4QGgmcJ089029;
	Sat, 26 May 2012 16:42:48 GMT (envelope-from des@svn.freebsd.org)
Message-Id: <201205261642.q4QGgmcJ089029@svn.freebsd.org>
From: Dag-Erling Smorgrav <des@FreeBSD.org>
Date: Sat, 26 May 2012 16:42:48 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r236105 - stable/9/lib/libfetch
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sat, 26 May 2012 16:42:48 -0000

Author: des
Date: Sat May 26 16:42:47 2012
New Revision: 236105
URL: http://svn.freebsd.org/changeset/base/236105

Log:
  MFH r233648: cosmetic

Modified:
  stable/9/lib/libfetch/fetch.3
Directory Properties:
  stable/9/lib/libfetch/   (props changed)

Modified: stable/9/lib/libfetch/fetch.3
==============================================================================
--- stable/9/lib/libfetch/fetch.3	Sat May 26 16:37:43 2012	(r236104)
+++ stable/9/lib/libfetch/fetch.3	Sat May 26 16:42:47 2012	(r236105)
@@ -375,7 +375,7 @@ If the
 (if-modified-since) flag is specified, and
 the
 .Va ims_time
-field is set in 
+field is set in
 .Vt "struct url" ,
 then
 .Fn fetchXGetHTTP

From owner-svn-src-stable-9@FreeBSD.ORG  Sat May 26 17:08:01 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id AAEE31065670;
	Sat, 26 May 2012 17:08:01 +0000 (UTC) (envelope-from des@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 7D0128FC12;
	Sat, 26 May 2012 17:08: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 q4QH81mo093825;
	Sat, 26 May 2012 17:08:01 GMT (envelope-from des@svn.freebsd.org)
Received: (from des@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4QH818j093822;
	Sat, 26 May 2012 17:08:01 GMT (envelope-from des@svn.freebsd.org)
Message-Id: <201205261708.q4QH818j093822@svn.freebsd.org>
From: Dag-Erling Smorgrav <des@FreeBSD.org>
Date: Sat, 26 May 2012 17:08:01 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r236108 - stable/9/lib/libfetch
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sat, 26 May 2012 17:08:01 -0000

Author: des
Date: Sat May 26 17:08:01 2012
New Revision: 236108
URL: http://svn.freebsd.org/changeset/base/236108

Log:
  MFH r234837: avoid busy-loop on slow connections when no timeout is set.
  MFH r234838: don't reuse credentials when redirected to a different host.

Modified:
  stable/9/lib/libfetch/common.c
  stable/9/lib/libfetch/http.c
Directory Properties:
  stable/9/lib/libfetch/   (props changed)

Modified: stable/9/lib/libfetch/common.c
==============================================================================
--- stable/9/lib/libfetch/common.c	Sat May 26 17:07:34 2012	(r236107)
+++ stable/9/lib/libfetch/common.c	Sat May 26 17:08:01 2012	(r236108)
@@ -455,11 +455,9 @@ fetch_read(conn_t *conn, char *buf, size
 	struct timeval now, timeout, delta;
 	fd_set readfds;
 	ssize_t rlen, total;
-	int r;
 	char *start;
 
-	if (fetchTimeout) {
-		FD_ZERO(&readfds);
+	if (fetchTimeout > 0) {
 		gettimeofday(&timeout, NULL);
 		timeout.tv_sec += fetchTimeout;
 	}
@@ -523,23 +521,21 @@ fetch_read(conn_t *conn, char *buf, size
 			return (-1);
 		}
 		// assert(rlen == FETCH_READ_WAIT);
-		while (fetchTimeout && !FD_ISSET(conn->sd, &readfds)) {
+		FD_ZERO(&readfds);
+		while (!FD_ISSET(conn->sd, &readfds)) {
 			FD_SET(conn->sd, &readfds);
-			gettimeofday(&now, NULL);
-			delta.tv_sec = timeout.tv_sec - now.tv_sec;
-			delta.tv_usec = timeout.tv_usec - now.tv_usec;
-			if (delta.tv_usec < 0) {
-				delta.tv_usec += 1000000;
-				delta.tv_sec--;
-			}
-			if (delta.tv_sec < 0) {
-				errno = ETIMEDOUT;
-				fetch_syserr();
-				return (-1);
+			if (fetchTimeout > 0) {
+				gettimeofday(&now, NULL);
+				if (!timercmp(&timeout, &now, >)) {
+					errno = ETIMEDOUT;
+					fetch_syserr();
+					return (-1);
+				}
+				timersub(&timeout, &now, &delta);
 			}
 			errno = 0;
-			r = select(conn->sd + 1, &readfds, NULL, NULL, &delta);
-			if (r == -1) {
+			if (select(conn->sd + 1, &readfds, NULL, NULL,
+				fetchTimeout > 0 ? &delta : NULL) < 0) {
 				if (errno == EINTR) {
 					if (fetchRestartCalls)
 						continue;

Modified: stable/9/lib/libfetch/http.c
==============================================================================
--- stable/9/lib/libfetch/http.c	Sat May 26 17:07:34 2012	(r236107)
+++ stable/9/lib/libfetch/http.c	Sat May 26 17:08:01 2012	(r236108)
@@ -1779,7 +1779,9 @@ http_request(struct url *URL, const char
 					DEBUG(fprintf(stderr, "failed to parse new URL\n"));
 					goto ouch;
 				}
-				if (!*new->user && !*new->pwd) {
+
+				/* Only copy credentials if the host matches */
+				if (!strcmp(new->host, url->host) && !*new->user && !*new->pwd) {
 					strcpy(new->user, url->user);
 					strcpy(new->pwd, url->pwd);
 				}

From owner-svn-src-stable-9@FreeBSD.ORG  Sat May 26 17:28:58 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 363EC106567C;
	Sat, 26 May 2012 17:28:58 +0000 (UTC) (envelope-from des@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 21BEA8FC21;
	Sat, 26 May 2012 17:28: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 q4QHSv6D096894;
	Sat, 26 May 2012 17:28:57 GMT (envelope-from des@svn.freebsd.org)
Received: (from des@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4QHSvki096892;
	Sat, 26 May 2012 17:28:57 GMT (envelope-from des@svn.freebsd.org)
Message-Id: <201205261728.q4QHSvki096892@svn.freebsd.org>
From: Dag-Erling Smorgrav <des@FreeBSD.org>
Date: Sat, 26 May 2012 17:28:57 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r236111 - stable/9/lib/msun/src
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sat, 26 May 2012 17:28:58 -0000

Author: des
Date: Sat May 26 17:28:57 2012
New Revision: 236111
URL: http://svn.freebsd.org/changeset/base/236111

Log:
  MFH r234685: utf8 and drop middle name

Modified:
  stable/9/lib/msun/src/s_fabsl.c
Directory Properties:
  stable/9/lib/msun/   (props changed)

Modified: stable/9/lib/msun/src/s_fabsl.c
==============================================================================
--- stable/9/lib/msun/src/s_fabsl.c	Sat May 26 17:19:41 2012	(r236110)
+++ stable/9/lib/msun/src/s_fabsl.c	Sat May 26 17:28:57 2012	(r236111)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2003 Dag-Erling Coïdan Smørgrav
+ * Copyright (c) 2003 Dag-Erling Smørgrav
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without

From owner-svn-src-stable-9@FreeBSD.ORG  Sat May 26 17:37:08 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 15A06106566B;
	Sat, 26 May 2012 17:37:08 +0000 (UTC) (envelope-from des@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 019FF8FC19;
	Sat, 26 May 2012 17:37: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 q4QHb7IY097300;
	Sat, 26 May 2012 17:37:07 GMT (envelope-from des@svn.freebsd.org)
Received: (from des@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4QHb7PL097297;
	Sat, 26 May 2012 17:37:07 GMT (envelope-from des@svn.freebsd.org)
Message-Id: <201205261737.q4QHb7PL097297@svn.freebsd.org>
From: Dag-Erling Smorgrav <des@FreeBSD.org>
Date: Sat, 26 May 2012 17:37:07 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r236112 - stable/9/usr.bin/unzip
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sat, 26 May 2012 17:37:08 -0000

Author: des
Date: Sat May 26 17:37:07 2012
New Revision: 236112
URL: http://svn.freebsd.org/changeset/base/236112

Log:
  MFH r234311: utf8 and drop middle name

Modified:
  stable/9/usr.bin/unzip/unzip.1
  stable/9/usr.bin/unzip/unzip.c
Directory Properties:
  stable/9/usr.bin/unzip/   (props changed)

Modified: stable/9/usr.bin/unzip/unzip.1
==============================================================================
--- stable/9/usr.bin/unzip/unzip.1	Sat May 26 17:28:57 2012	(r236111)
+++ stable/9/usr.bin/unzip/unzip.1	Sat May 26 17:37:07 2012	(r236112)
@@ -1,5 +1,5 @@
 .\"-
-.\" Copyright (c) 2007-2008 Dag-Erling Coïdan Smørgrav
+.\" Copyright (c) 2007-2008 Dag-Erling Smørgrav
 .\" All rights reserved.
 .\"
 .\" Redistribution and use in source and binary forms, with or without

Modified: stable/9/usr.bin/unzip/unzip.c
==============================================================================
--- stable/9/usr.bin/unzip/unzip.c	Sat May 26 17:28:57 2012	(r236111)
+++ stable/9/usr.bin/unzip/unzip.c	Sat May 26 17:37:07 2012	(r236112)
@@ -1,6 +1,6 @@
 /*-
  * Copyright (c) 2009 Joerg Sonnenberger <joerg@NetBSD.org>
- * Copyright (c) 2007-2008 Dag-Erling Coïdan Smørgrav
+ * Copyright (c) 2007-2008 Dag-Erling Smørgrav
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without

From owner-svn-src-stable-9@FreeBSD.ORG  Sat May 26 17:38:56 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 33F83106566B;
	Sat, 26 May 2012 17:38:56 +0000 (UTC) (envelope-from des@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 1E94E8FC0A;
	Sat, 26 May 2012 17:38: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 q4QHctdt097420;
	Sat, 26 May 2012 17:38:55 GMT (envelope-from des@svn.freebsd.org)
Received: (from des@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4QHctNw097418;
	Sat, 26 May 2012 17:38:55 GMT (envelope-from des@svn.freebsd.org)
Message-Id: <201205261738.q4QHctNw097418@svn.freebsd.org>
From: Dag-Erling Smorgrav <des@FreeBSD.org>
Date: Sat, 26 May 2012 17:38:55 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r236113 - stable/9/sbin/geom/class/part
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sat, 26 May 2012 17:38:56 -0000

Author: des
Date: Sat May 26 17:38:55 2012
New Revision: 236113
URL: http://svn.freebsd.org/changeset/base/236113

Log:
  MFH r230059: improve examples

Modified:
  stable/9/sbin/geom/class/part/gpart.8
Directory Properties:
  stable/9/sbin/geom/class/part/   (props changed)

Modified: stable/9/sbin/geom/class/part/gpart.8
==============================================================================
--- stable/9/sbin/geom/class/part/gpart.8	Sat May 26 17:37:07 2012	(r236112)
+++ stable/9/sbin/geom/class/part/gpart.8	Sat May 26 17:38:55 2012	(r236113)
@@ -996,17 +996,21 @@ partition that can boot
 from a
 .Cm freebsd-ufs
 partition, and install bootstrap code into it.
-This partition must be larger than
-.Pa /boot/gptboot ,
-or the GPT boot you are planning to write, but smaller than 545 KB.
-A size of 15 blocks (7680 bytes) would be sufficient for
-booting from UFS but 128 blocks (64 KB) is used in
-this example to reserve some space for potential
-future need (e.g.\& a larger
+This partition must be larger than the bootstrap code
+.Po
+usually either
+.Pa /boot/gptboot
+or
 .Pa /boot/gptzfsboot
-for booting from a ZFS partition).
+.Pc ,
+but smaller than 545 kB since the first-stage loader will load the
+entire partition into memory during boot, regardless of how much data
+it actually contains.
+This example uses 94 blocks (47 kB) so the next partition will be
+aligned on a 64 kB boundary without the need to specify an explicit
+offset or alignment.
 .Bd -literal -offset indent
-/sbin/gpart add -b 34 -s 128 -t freebsd-boot ad0
+/sbin/gpart add -b 34 -s 94 -t freebsd-boot ad0
 /sbin/gpart bootcode -p /boot/gptboot -i 1 ad0
 .Ed
 .Pp
@@ -1014,7 +1018,7 @@ Create a 512MB-sized
 .Cm freebsd-ufs
 partition to contain a UFS filesystem from which the system can boot.
 .Bd -literal -offset indent
-/sbin/gpart add -b 162 -s 1048576 -t freebsd-ufs ad0
+/sbin/gpart add -s 512M -t freebsd-ufs ad0
 .Ed
 .Pp
 Create an MBR scheme on

From owner-svn-src-stable-9@FreeBSD.ORG  Sat May 26 17:53:35 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id CAD911065678;
	Sat, 26 May 2012 17:53:35 +0000 (UTC) (envelope-from des@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id B62C28FC0A;
	Sat, 26 May 2012 17:53: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 q4QHrZ7L098077;
	Sat, 26 May 2012 17:53:35 GMT (envelope-from des@svn.freebsd.org)
Received: (from des@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4QHrZoC098075;
	Sat, 26 May 2012 17:53:35 GMT (envelope-from des@svn.freebsd.org)
Message-Id: <201205261753.q4QHrZoC098075@svn.freebsd.org>
From: Dag-Erling Smorgrav <des@FreeBSD.org>
Date: Sat, 26 May 2012 17:53:35 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r236114 - stable/9/share/mk
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sat, 26 May 2012 17:53:35 -0000

Author: des
Date: Sat May 26 17:53:35 2012
New Revision: 236114
URL: http://svn.freebsd.org/changeset/base/236114

Log:
  MFH r227797, 227932: add {STATIC,SHARED}_{C,CXX}FLAGS

Modified:
  stable/9/share/mk/bsd.lib.mk
Directory Properties:
  stable/9/share/mk/   (props changed)

Modified: stable/9/share/mk/bsd.lib.mk
==============================================================================
--- stable/9/share/mk/bsd.lib.mk	Sat May 26 17:38:55 2012	(r236113)
+++ stable/9/share/mk/bsd.lib.mk	Sat May 26 17:53:35 2012	(r236114)
@@ -67,23 +67,32 @@ PICFLAG=-fpic
 
 PO_FLAG=-pg
 
+.c.o:
+	${CC} ${STATIC_CFLAGS} ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET}
+	@[ -z "${CTFCONVERT}" -o -n "${NO_CTF}" ] || \
+		(${ECHO} ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} && \
+		${CTFCONVERT} ${CTFFLAGS} ${.TARGET})
+
 .c.po:
-	${CC} ${PO_FLAG} ${PO_CFLAGS} -c ${.IMPSRC} -o ${.TARGET}
+	${CC} ${PO_FLAG} ${STATIC_CFLAGS} ${PO_CFLAGS} -c ${.IMPSRC} -o ${.TARGET}
 	@[ -z "${CTFCONVERT}" -o -n "${NO_CTF}" ] || \
 		(${ECHO} ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} && \
 		${CTFCONVERT} ${CTFFLAGS} ${.TARGET})
 
 .c.So:
-	${CC} ${PICFLAG} -DPIC ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET}
+	${CC} ${PICFLAG} -DPIC ${SHARED_CFLAGS} ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET}
 	@[ -z "${CTFCONVERT}" -o -n "${NO_CTF}" ] || \
 		(${ECHO} ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} && \
 		${CTFCONVERT} ${CTFFLAGS} ${.TARGET})
 
+.cc.o:
+	${CXX} ${STATIC_CXXFLAGS} ${CXXFLAGS} -c ${.IMPSRC} -o ${.TARGET}
+
 .cc.po .C.po .cpp.po .cxx.po:
-	${CXX} ${PO_FLAG} ${PO_CXXFLAGS} -c ${.IMPSRC} -o ${.TARGET}
+	${CXX} ${PO_FLAG} ${STATIC_CXXFLAGS} ${PO_CXXFLAGS} -c ${.IMPSRC} -o ${.TARGET}
 
 .cc.So .C.So .cpp.So .cxx.So:
-	${CXX} ${PICFLAG} -DPIC ${CXXFLAGS} -c ${.IMPSRC} -o ${.TARGET}
+	${CXX} ${PICFLAG} -DPIC ${SHARED_CXXFLAGS} ${CXXFLAGS} -c ${.IMPSRC} -o ${.TARGET}
 
 .f.po:
 	${FC} -pg ${FFLAGS} -o ${.TARGET} -c ${.IMPSRC}

From owner-svn-src-stable-9@FreeBSD.ORG  Sat May 26 17:56:55 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 2B69E1065673;
	Sat, 26 May 2012 17:56:55 +0000 (UTC) (envelope-from des@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 1703E8FC08;
	Sat, 26 May 2012 17:56: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 q4QHusTX098322;
	Sat, 26 May 2012 17:56:54 GMT (envelope-from des@svn.freebsd.org)
Received: (from des@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4QHusUV098319;
	Sat, 26 May 2012 17:56:54 GMT (envelope-from des@svn.freebsd.org)
Message-Id: <201205261756.q4QHusUV098319@svn.freebsd.org>
From: Dag-Erling Smorgrav <des@FreeBSD.org>
Date: Sat, 26 May 2012 17:56:54 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r236115 - in stable/9/lib/libpam: . modules
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sat, 26 May 2012 17:56:55 -0000

Author: des
Date: Sat May 26 17:56:54 2012
New Revision: 236115
URL: http://svn.freebsd.org/changeset/base/236115

Log:
  MFH r227798, r227933: simplify build by using STATIC_CFLAGS

Modified:
  stable/9/lib/libpam/Makefile.inc
  stable/9/lib/libpam/modules/Makefile.inc
Directory Properties:
  stable/9/lib/libpam/   (props changed)

Modified: stable/9/lib/libpam/Makefile.inc
==============================================================================
--- stable/9/lib/libpam/Makefile.inc	Sat May 26 17:53:35 2012	(r236114)
+++ stable/9/lib/libpam/Makefile.inc	Sat May 26 17:56:54 2012	(r236115)
@@ -31,4 +31,6 @@ DEBUG_FLAGS+=	-DDEBUG
 SHLIB_MAJOR=	5
 PAM_MOD_DIR=	${LIBDIR}
 
+STATIC_CFLAGS+=	-DOPENPAM_STATIC_MODULES
+
 .include "../Makefile.inc"

Modified: stable/9/lib/libpam/modules/Makefile.inc
==============================================================================
--- stable/9/lib/libpam/modules/Makefile.inc	Sat May 26 17:53:35 2012	(r236114)
+++ stable/9/lib/libpam/modules/Makefile.inc	Sat May 26 17:56:54 2012	(r236115)
@@ -18,7 +18,4 @@ DPADD+=		${LIBPAM}
 LDADD+=		-lpam
 .endif
 
-.c.o:
-	${CC} ${CFLAGS} -DOPENPAM_STATIC_MODULES -c ${.IMPSRC}
-
 .include "../Makefile.inc"

From owner-svn-src-stable-9@FreeBSD.ORG  Sat May 26 18:20:31 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 59C96106566B;
	Sat, 26 May 2012 18:20:31 +0000 (UTC) (envelope-from des@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 44A6C8FC0C;
	Sat, 26 May 2012 18:20: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 q4QIKVim099340;
	Sat, 26 May 2012 18:20:31 GMT (envelope-from des@svn.freebsd.org)
Received: (from des@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4QIKVUZ099338;
	Sat, 26 May 2012 18:20:31 GMT (envelope-from des@svn.freebsd.org)
Message-Id: <201205261820.q4QIKVUZ099338@svn.freebsd.org>
From: Dag-Erling Smorgrav <des@FreeBSD.org>
Date: Sat, 26 May 2012 18:20:31 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r236116 - stable/9/lib/libpam/libpam
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sat, 26 May 2012 18:20:31 -0000

Author: des
Date: Sat May 26 18:20:30 2012
New Revision: 236116
URL: http://svn.freebsd.org/changeset/base/236116

Log:
  MFH r226625, 226632: document what openpam_static.c is for

Modified:
  stable/9/lib/libpam/libpam/Makefile
Directory Properties:
  stable/9/lib/libpam/   (props changed)

Modified: stable/9/lib/libpam/libpam/Makefile
==============================================================================
--- stable/9/lib/libpam/libpam/Makefile	Sat May 26 17:56:54 2012	(r236115)
+++ stable/9/lib/libpam/libpam/Makefile	Sat May 26 18:20:30 2012	(r236116)
@@ -148,7 +148,15 @@ HEADERS=	security/openpam.h \
 
 ADD_HEADERS=	security/pam_mod_misc.h
 
+#
 # Static modules
+#
+# We build static versions of all modules and of openpam_static.o,
+# then link them all together into openpam_static_modules.o.  None of
+# the modules export any symbols, but they store structures with
+# pointers to their service functions in a linker set which the code
+# in openpam_static.c traverses to locate the individual modules.
+#
 MODULE_DIR=	../modules
 .include "${.CURDIR}/${MODULE_DIR}/modules.inc"
 STATIC_MODULES=	${MODULES:C/.*/${MODULE_DIR}\/&\/lib&.a/}
@@ -159,7 +167,8 @@ CLEANFILES+=	openpam_static.o \
 openpam_static_modules.o: openpam_static.o ${STATIC_MODULES}
 	${LD} -o ${.TARGET} -r --whole-archive ${.ALLSRC}
 
-# Can't put openpam_static.c in SRCS but want .o in .depend.
+# We can't put openpam_static.c in SRCS, but we still want to scan it
+# for dependencies.
 DPSRCS=		openpam_static.c
 
 # Headers

From owner-svn-src-stable-9@FreeBSD.ORG  Sat May 26 20:13:25 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 18889106564A;
	Sat, 26 May 2012 20:13:25 +0000 (UTC) (envelope-from mdf@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 035A58FC0C;
	Sat, 26 May 2012 20: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 q4QKDOgc004087;
	Sat, 26 May 2012 20:13:24 GMT (envelope-from mdf@svn.freebsd.org)
Received: (from mdf@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4QKDODI004084;
	Sat, 26 May 2012 20:13:24 GMT (envelope-from mdf@svn.freebsd.org)
Message-Id: <201205262013.q4QKDODI004084@svn.freebsd.org>
From: Matthew D Fleming <mdf@FreeBSD.org>
Date: Sat, 26 May 2012 20:13:24 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r236118 - stable/9/bin/kenv
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sat, 26 May 2012 20:13:25 -0000

Author: mdf
Date: Sat May 26 20:13:24 2012
New Revision: 236118
URL: http://svn.freebsd.org/changeset/base/236118

Log:
  MFC r235297, r235316:
  
  Add a -v and -N option to kenv(1), so it can be more easily used in
  scripts the way sysctl(8) is.  The -N option, like in sysctl(8),
  displays only the kenv names, not their values.  The -v option prints an
  individual kenv variable name with its value as name="value".  This is
  the inverse of sysctl(8)'s -n flag, since the default behaviour of
  kenv(1) is already like sysctl(8) -n.

Modified:
  stable/9/bin/kenv/kenv.1
  stable/9/bin/kenv/kenv.c
Directory Properties:
  stable/9/bin/   (props changed)
  stable/9/bin/csh/   (props changed)
  stable/9/bin/df/   (props changed)
  stable/9/bin/ed/   (props changed)
  stable/9/bin/expr/   (props changed)
  stable/9/bin/ps/   (props changed)
  stable/9/bin/sh/   (props changed)

Modified: stable/9/bin/kenv/kenv.1
==============================================================================
--- stable/9/bin/kenv/kenv.1	Sat May 26 20:03:47 2012	(r236117)
+++ stable/9/bin/kenv/kenv.1	Sat May 26 20:13:24 2012	(r236118)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd January 13, 2009
+.Dd May 11, 2012
 .Dt KENV 1
 .Os
 .Sh NAME
@@ -32,9 +32,9 @@
 .Nd dump or modify the kernel environment
 .Sh SYNOPSIS
 .Nm
-.Op Fl hq
+.Op Fl hNq
 .Nm
-.Op Fl q
+.Op Fl qv
 .Ar variable Ns Op = Ns Ar value
 .Nm
 .Op Fl q
@@ -54,6 +54,11 @@ name is specified,
 .Nm
 will only report that value.
 If the
+.Fl N
+option is specified,
+.Nm
+will only display variable names and not their values.
+If the
 .Fl u
 option is specified,
 .Nm
@@ -68,6 +73,13 @@ If the
 option is set, warnings normally printed as a result of being unable to
 perform the requested operation will be suppressed.
 .Pp
+If the
+.Fl v
+option is set, the variable name will be printed out for the
+environment variable in addition to the value when
+.Nm
+is executed with a variable name.
+.Pp
 Variables can be added to the kernel environment using the
 .Pa /boot/loader.conf
 file, or also statically compiled into the kernel using the statement

Modified: stable/9/bin/kenv/kenv.c
==============================================================================
--- stable/9/bin/kenv/kenv.c	Sat May 26 20:03:47 2012	(r236117)
+++ stable/9/bin/kenv/kenv.c	Sat May 26 20:13:24 2012	(r236118)
@@ -42,15 +42,17 @@ static int	ksetenv(char *, char *);
 static int	kunsetenv(char *);
 
 static int hflag = 0;
+static int Nflag = 0;
 static int qflag = 0;
 static int uflag = 0;
+static int vflag = 0;
 
 static void
 usage(void)
 {
 	(void)fprintf(stderr, "%s\n%s\n%s\n",
-	    "usage: kenv [-hq]",
-	    "       kenv [-q] variable[=value]",
+	    "usage: kenv [-hNq]",
+	    "       kenv [-qv] variable[=value]",
 	    "       kenv [-q] -u variable");
 	exit(1);
 }
@@ -64,17 +66,23 @@ main(int argc, char **argv)
 	error = 0;
 	val = NULL;
 	env = NULL;
-	while ((ch = getopt(argc, argv, "hqu")) != -1) {
+	while ((ch = getopt(argc, argv, "hNquv")) != -1) {
 		switch (ch) {
 		case 'h':
 			hflag++;
 			break;
+		case 'N':
+			Nflag++;
+			break;
 		case 'q':
 			qflag++;
 			break;
 		case 'u':
 			uflag++;
 			break;
+		case 'v':
+			vflag++;
+			break;
 		default:
 			usage();
 		}
@@ -91,9 +99,9 @@ main(int argc, char **argv)
 		argv++;
 		argc--;
 	}
-	if (hflag && (env != NULL))
+	if ((hflag || Nflag) && env != NULL)
 		usage();
-	if ((argc > 0) || (uflag && (env == NULL)))
+	if (argc > 0 || ((uflag || vflag) && env == NULL))
 		usage();
 	if (env == NULL) {
 		error = kdumpenv();
@@ -152,7 +160,10 @@ kdumpenv(void)
 		if (cp == NULL)
 			continue;
 		*cp++ = '\0';
-		printf("%s=\"%s\"\n", buf, cp);
+		if (Nflag)
+			printf("%s\n", buf);
+		else
+			printf("%s=\"%s\"\n", buf, cp);
 		buf = cp;
 	}
 	return (0);
@@ -167,7 +178,10 @@ kgetenv(char *env)
 	ret = kenv(KENV_GET, env, buf, sizeof(buf));
 	if (ret == -1)
 		return (ret);
-	printf("%s\n", buf);
+	if (vflag)
+		printf("%s=\"%s\"\n", env, buf);
+	else
+		printf("%s\n", buf);
 	return (0);
 }
 

From owner-svn-src-stable-9@FreeBSD.ORG  Sat May 26 22:47:57 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 4F3F41065674;
	Sat, 26 May 2012 22:47:57 +0000 (UTC) (envelope-from alc@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 39A0B8FC15;
	Sat, 26 May 2012 22:47: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 q4QMlvPc011246;
	Sat, 26 May 2012 22:47:57 GMT (envelope-from alc@svn.freebsd.org)
Received: (from alc@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4QMlvTX011244;
	Sat, 26 May 2012 22:47:57 GMT (envelope-from alc@svn.freebsd.org)
Message-Id: <201205262247.q4QMlvTX011244@svn.freebsd.org>
From: Alan Cox <alc@FreeBSD.org>
Date: Sat, 26 May 2012 22:47:57 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r236123 - stable/9/sys/i386/i386
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sat, 26 May 2012 22:47:57 -0000

Author: alc
Date: Sat May 26 22:47:56 2012
New Revision: 236123
URL: http://svn.freebsd.org/changeset/base/236123

Log:
  MFC r228513
    Create large page mappings in pmap_map().

Modified:
  stable/9/sys/i386/i386/pmap.c
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/i386/i386/pmap.c
==============================================================================
--- stable/9/sys/i386/i386/pmap.c	Sat May 26 21:30:18 2012	(r236122)
+++ stable/9/sys/i386/i386/pmap.c	Sat May 26 22:47:56 2012	(r236123)
@@ -1452,12 +1452,40 @@ vm_offset_t
 pmap_map(vm_offset_t *virt, vm_paddr_t start, vm_paddr_t end, int prot)
 {
 	vm_offset_t va, sva;
+	vm_paddr_t superpage_offset;
+	pd_entry_t newpde;
 
-	va = sva = *virt;
+	va = *virt;
+	/*
+	 * Does the physical address range's size and alignment permit at
+	 * least one superpage mapping to be created?
+	 */ 
+	superpage_offset = start & PDRMASK;
+	if ((end - start) - ((NBPDR - superpage_offset) & PDRMASK) >= NBPDR) {
+		/*
+		 * Increase the starting virtual address so that its alignment
+		 * does not preclude the use of superpage mappings.
+		 */
+		if ((va & PDRMASK) < superpage_offset)
+			va = (va & ~PDRMASK) + superpage_offset;
+		else if ((va & PDRMASK) > superpage_offset)
+			va = ((va + PDRMASK) & ~PDRMASK) + superpage_offset;
+	}
+	sva = va;
 	while (start < end) {
-		pmap_kenter(va, start);
-		va += PAGE_SIZE;
-		start += PAGE_SIZE;
+		if ((start & PDRMASK) == 0 && end - start >= NBPDR &&
+		    pseflag) {
+			KASSERT((va & PDRMASK) == 0,
+			    ("pmap_map: misaligned va %#x", va));
+			newpde = start | PG_PS | pgeflag | PG_RW | PG_V;
+			pmap_kenter_pde(va, newpde);
+			va += NBPDR;
+			start += NBPDR;
+		} else {
+			pmap_kenter(va, start);
+			va += PAGE_SIZE;
+			start += PAGE_SIZE;
+		}
 	}
 	pmap_invalidate_range(kernel_pmap, sva, va);
 	*virt = va;

From owner-svn-src-stable-9@FreeBSD.ORG  Sat May 26 23:42:53 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 0717B106566B;
	Sat, 26 May 2012 23:42:53 +0000 (UTC) (envelope-from des@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id E51CD8FC08;
	Sat, 26 May 2012 23:42: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 q4QNgqvc013650;
	Sat, 26 May 2012 23:42:52 GMT (envelope-from des@svn.freebsd.org)
Received: (from des@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4QNgqAg013648;
	Sat, 26 May 2012 23:42:52 GMT (envelope-from des@svn.freebsd.org)
Message-Id: <201205262342.q4QNgqAg013648@svn.freebsd.org>
From: Dag-Erling Smorgrav <des@FreeBSD.org>
Date: Sat, 26 May 2012 23:42:52 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r236128 - stable/9
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sat, 26 May 2012 23:42:53 -0000

Author: des
Date: Sat May 26 23:42:52 2012
New Revision: 236128
URL: http://svn.freebsd.org/changeset/base/236128

Log:
  Make yacc a bootstrap tool if building on head, since the new yacc is
  not 100% backward compatible.  Also, build yacc before lex, because lex
  requires yacc but not vice versa.

Modified:
  stable/9/Makefile.inc1

Modified: stable/9/Makefile.inc1
==============================================================================
--- stable/9/Makefile.inc1	Sat May 26 23:10:36 2012	(r236127)
+++ stable/9/Makefile.inc1	Sat May 26 23:42:52 2012	(r236128)
@@ -1026,6 +1026,9 @@ _sed=		usr.bin/sed
 
 .if ${BOOTSTRAPPING} < 900006
 _lex=		usr.bin/lex
+.endif
+
+.if ${BOOTSTRAPPING} < 900006 || ${BOOTSTRAPPING} > 1000012
 _yacc=		usr.bin/yacc
 .endif
 
@@ -1080,8 +1083,8 @@ bootstrap-tools:
     ${_mklocale} \
     usr.bin/rpcgen \
     ${_sed} \
-    ${_lex} \
     ${_yacc} \
+    ${_lex} \
     usr.bin/xinstall \
     ${_gensnmptree} \
     usr.sbin/config \

From owner-svn-src-stable-9@FreeBSD.ORG  Sat May 26 23:48:57 2012
Return-Path: <owner-svn-src-stable-9@FreeBSD.ORG>
Delivered-To: svn-src-stable-9@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 302BC1065673;
	Sat, 26 May 2012 23:48:57 +0000 (UTC) (envelope-from des@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 1AC7E8FC12;
	Sat, 26 May 2012 23:48: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 q4QNmuoo013949;
	Sat, 26 May 2012 23:48:56 GMT (envelope-from des@svn.freebsd.org)
Received: (from des@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4QNmudG013947;
	Sat, 26 May 2012 23:48:56 GMT (envelope-from des@svn.freebsd.org)
Message-Id: <201205262348.q4QNmudG013947@svn.freebsd.org>
From: Dag-Erling Smorgrav <des@FreeBSD.org>
Date: Sat, 26 May 2012 23:48:56 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r236129 - stable/9
X-BeenThere: svn-src-stable-9@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 9-stable src tree
	<svn-src-stable-9.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-9>
List-Post: <mailto:svn-src-stable-9@freebsd.org>
List-Help: <mailto:svn-src-stable-9-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9>, 
	<mailto:svn-src-stable-9-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sat, 26 May 2012 23:48:57 -0000

Author: des
Date: Sat May 26 23:48:56 2012
New Revision: 236129
URL: http://svn.freebsd.org/changeset/base/236129

Log:
  nit: use >= 1000013 instead of > 1000012

Modified:
  stable/9/Makefile.inc1

Modified: stable/9/Makefile.inc1
==============================================================================
--- stable/9/Makefile.inc1	Sat May 26 23:42:52 2012	(r236128)
+++ stable/9/Makefile.inc1	Sat May 26 23:48:56 2012	(r236129)
@@ -1028,7 +1028,7 @@ _sed=		usr.bin/sed
 _lex=		usr.bin/lex
 .endif
 
-.if ${BOOTSTRAPPING} < 900006 || ${BOOTSTRAPPING} > 1000012
+.if ${BOOTSTRAPPING} < 900006 || ${BOOTSTRAPPING} >= 1000013
 _yacc=		usr.bin/yacc
 .endif