svn commit: r236047 - stable/9/sys/net

2012-05-26 Thread Andrew Thompson
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.cSat May 26 06:31:54 2012
(r236046)
+++ stable/9/sys/net/bridgestp.cSat May 26 07:34:46 2012
(r236047)
@@ -134,7 +134,7 @@ static void bstp_tick(void *);
 static voidbstp_timer_start(struct bstp_timer *, uint16_t);
 static voidbstp_timer_stop(struct bstp_timer *);
 static voidbstp_timer_latch(struct bstp_timer *);
-static int bstp_timer_expired(struct bstp_timer *);
+static int bstp_timer_dectest(struct bstp_timer *);
 static voidbstp_hello_timer_expiry(struct bstp_state *,
struct bstp_port *);
 static voidbstp_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 

svn commit: r236048 - stable/9/sys/net

2012-05-26 Thread Andrew Thompson
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.cSat May 26 07:34:46 2012
(r236047)
+++ stable/9/sys/net/bridgestp.cSat 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

svn commit: r236049 - in stable/9: sbin/ifconfig sys/net

2012-05-26 Thread Andrew Thompson
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 = "";
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);
+

svn commit: r236050 - stable/9/sys/net

2012-05-26 Thread Andrew Thompson
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:
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r236051 - stable/9/sys/net

2012-05-26 Thread Andrew Thompson
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.cSat May 26 07:41:05 2012
(r236050)
+++ stable/9/sys/net/bridgestp.cSat 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.hSat May 26 07:41:05 2012
(r236050)
+++ stable/9/sys/net/bridgestp.hSat 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
 intbstp_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 *);
 intbstp_set_htime(struct bstp_state *, int);
 intbstp_set_fdelay(struct bstp_state *, int);
 intbstp_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_l

svn commit: r236052 - stable/9/sys/net

2012-05-26 Thread Andrew Thompson
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.cSat May 26 07:42:32 2012
(r236051)
+++ stable/9/sys/net/bridgestp.cSat May 26 07:43:17 2012
(r236052)
@@ -127,7 +127,7 @@ static int  bstp_rerooted(struct bstp_sta
 static uint32_tbstp_calc_path_cost(struct bstp_port *);
 static voidbstp_notify_state(void *, int);
 static voidbstp_notify_rtage(void *, int);
-static voidbstp_ifupdstatus(struct bstp_state *, struct bstp_port *);
+static voidbstp_ifupdstatus(void *, int);
 static voidbstp_enable_port(struct bstp_state *, struct bstp_port *);
 static voidbstp_disable_port(struct bstp_state *, struct bstp_port *);
 static voidbstp_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_DISABLE

svn commit: r236053 - stable/9/sys/dev/tsec

2012-05-26 Thread Andrew Thompson
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;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r236054 - stable/9/sys/dev/tsec

2012-05-26 Thread Andrew Thompson
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);
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r236055 - stable/8/sys/net

2012-05-26 Thread Andrew Thompson
Author: thompsa
Date: Sat May 26 07:58:12 2012
New Revision: 236055
URL: http://svn.freebsd.org/changeset/base/236055

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/8/sys/net/bridgestp.c
  stable/8/sys/net/bridgestp.h
  stable/8/sys/net/if_bridge.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/boot/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/e1000/   (props changed)

Modified: stable/8/sys/net/bridgestp.c
==
--- stable/8/sys/net/bridgestp.cSat May 26 07:44:35 2012
(r236054)
+++ stable/8/sys/net/bridgestp.cSat May 26 07:58:12 2012
(r236055)
@@ -134,7 +134,7 @@ static void bstp_tick(void *);
 static voidbstp_timer_start(struct bstp_timer *, uint16_t);
 static voidbstp_timer_stop(struct bstp_timer *);
 static voidbstp_timer_latch(struct bstp_timer *);
-static int bstp_timer_expired(struct bstp_timer *);
+static int bstp_timer_dectest(struct bstp_timer *);
 static voidbstp_hello_timer_expiry(struct bstp_state *,
struct bstp_port *);
 static voidbstp_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/8/sys/net/bridgestp.h
==
--- stable/8/sys/net/bridgestp.hSat May 26 07:44:35 2012
(r236054)
+++ stable/8/sys/net/bridgestp.hSat May 26 07:58:12 2012
(r236055)
@@ -392,6 +392,6 @@ int bstp_set_e

svn commit: r236056 - stable/8/sys/net

2012-05-26 Thread Andrew Thompson
Author: thompsa
Date: Sat May 26 07:58:58 2012
New Revision: 236056
URL: http://svn.freebsd.org/changeset/base/236056

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/8/sys/net/bridgestp.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/boot/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/e1000/   (props changed)

Modified: stable/8/sys/net/bridgestp.c
==
--- stable/8/sys/net/bridgestp.cSat May 26 07:58:12 2012
(r236055)
+++ stable/8/sys/net/bridgestp.cSat May 26 07:58:58 2012
(r236056)
@@ -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
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r236057 - in stable/8: sbin/ifconfig sys/net

2012-05-26 Thread Andrew Thompson
Author: thompsa
Date: Sat May 26 07:59:56 2012
New Revision: 236057
URL: http://svn.freebsd.org/changeset/base/236057

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

Modified:
  stable/8/sbin/ifconfig/ifconfig.8
  stable/8/sbin/ifconfig/iflagg.c
  stable/8/sys/net/ieee8023ad_lacp.c
  stable/8/sys/net/if_lagg.c
  stable/8/sys/net/if_lagg.h
Directory Properties:
  stable/8/sbin/ifconfig/   (props changed)
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/boot/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/e1000/   (props changed)

Modified: stable/8/sbin/ifconfig/ifconfig.8
==
--- stable/8/sbin/ifconfig/ifconfig.8   Sat May 26 07:58:58 2012
(r236056)
+++ stable/8/sbin/ifconfig/ifconfig.8   Sat May 26 07:59:56 2012
(r236057)
@@ -2234,6 +2234,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/8/sbin/ifconfig/iflagg.c
==
--- stable/8/sbin/ifconfig/iflagg.c Sat May 26 07:58:58 2012
(r236056)
+++ stable/8/sbin/ifconfig/iflagg.c Sat May 26 07:59:56 2012
(r236057)
@@ -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 = "";
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),

svn commit: r236058 - stable/8/sys/net

2012-05-26 Thread Andrew Thompson
Author: thompsa
Date: Sat May 26 08:00:34 2012
New Revision: 236058
URL: http://svn.freebsd.org/changeset/base/236058

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/8/sys/net/if_lagg.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/boot/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/e1000/   (props changed)

Modified: stable/8/sys/net/if_lagg.c
==
--- stable/8/sys/net/if_lagg.c  Sat May 26 07:59:56 2012(r236057)
+++ stable/8/sys/net/if_lagg.c  Sat May 26 08:00:34 2012(r236058)
@@ -942,11 +942,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;
@@ -958,10 +958,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) {
@@ -969,7 +973,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);
@@ -977,6 +980,7 @@ lagg_ioctl(struct ifnet *ifp, u_long cmd
return (error);
}
}
+   LAGG_WUNLOCK(sc);
error = EPROTONOSUPPORT;
break;
case SIOCGLAGGFLAGS:
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r236059 - stable/8/sys/net

2012-05-26 Thread Andrew Thompson
Author: thompsa
Date: Sat May 26 08:02:13 2012
New Revision: 236059
URL: http://svn.freebsd.org/changeset/base/236059

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/8/sys/net/bridgestp.c
  stable/8/sys/net/bridgestp.h
  stable/8/sys/net/if.c
  stable/8/sys/net/if_bridge.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/boot/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/e1000/   (props changed)

Modified: stable/8/sys/net/bridgestp.c
==
--- stable/8/sys/net/bridgestp.cSat May 26 08:00:34 2012
(r236058)
+++ stable/8/sys/net/bridgestp.cSat May 26 08:02:13 2012
(r236059)
@@ -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/8/sys/net/bridgestp.h
==
--- stable/8/sys/net/bridgestp.hSat May 26 08:00:34 2012
(r236058)
+++ stable/8/sys/net/bridgestp.hSat May 26 08:02:13 2012
(r236059)
@@ -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
 intbstp_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 *);
 intbstp_set_htime(struct bstp_state *, int);
 intbstp_set_fdelay(struct bstp_state *, int);
 intbstp_set_maxage(struct bstp_state *, int);

Modified: stable/8/sys/net/if.c
==
--- stable/8/sys/net/if.c   Sat May 26 08:00:34 2012(r236058)
+++ stable/8/sys/net/if.c   Sat May 26 08:02:13 2012(r236059)
@@ -126,7 +126,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. */
@@ -1953,14 +1953,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);
-

svn commit: r236060 - stable/8/sys/net

2012-05-26 Thread Andrew Thompson
Author: thompsa
Date: Sat May 26 08:02:45 2012
New Revision: 236060
URL: http://svn.freebsd.org/changeset/base/236060

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

Modified:
  stable/8/sys/net/bridgestp.c
  stable/8/sys/net/bridgestp.h
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/boot/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/e1000/   (props changed)

Modified: stable/8/sys/net/bridgestp.c
==
--- stable/8/sys/net/bridgestp.cSat May 26 08:02:13 2012
(r236059)
+++ stable/8/sys/net/bridgestp.cSat May 26 08:02:45 2012
(r236060)
@@ -127,7 +127,7 @@ static int  bstp_rerooted(struct bstp_sta
 static uint32_tbstp_calc_path_cost(struct bstp_port *);
 static voidbstp_notify_state(void *, int);
 static voidbstp_notify_rtage(void *, int);
-static voidbstp_ifupdstatus(struct bstp_state *, struct bstp_port *);
+static voidbstp_ifupdstatus(void *, int);
 static voidbstp_enable_port(struct bstp_state *, struct bstp_port *);
 static voidbstp_disable_port(struct bstp_state *, struct bstp_port *);
 static voidbstp_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;
}
}
-   re

svn commit: r236061 - head/sys/dev/sym

2012-05-26 Thread Marius Strobl
Author: marius
Date: Sat May 26 08:03:42 2012
New Revision: 236061
URL: http://svn.freebsd.org/changeset/base/236061

Log:
  - When creating the DMA tag for user data, don't ask for more segments
than required for handling MAXPHYS and report the resulting maximum
I/O size to CAM instead of implicitly limiting it to DFLTPHYS.
  - Move the variables of sym_action2() out of nested scope as required
by style(9) and remove extraneous curly braces.
  - Replace a magic value for PCIR_COMMAND with the appropriate macro.
  - Use DEVMETHOD_END.
  - Use NULL instead of 0 for pointers.
  
  Tested with a HBA donated by wilko.
  
  MFC after:3 days

Modified:
  head/sys/dev/sym/sym_conf.h
  head/sys/dev/sym/sym_hipd.c

Modified: head/sys/dev/sym/sym_conf.h
==
--- head/sys/dev/sym/sym_conf.h Sat May 26 08:02:45 2012(r236060)
+++ head/sys/dev/sym/sym_conf.h Sat May 26 08:03:42 2012(r236061)
@@ -83,6 +83,13 @@
 #define SYM_CONF_MAX_TAG_ORDER (6)
 
 /*
+ *  DMA boundary
+ *  We need to ensure 16 MB boundaries not to be crossed during DMA of
+ *  each segment, due to some chips being flawed.
+ */
+#define SYM_CONF_DMA_BOUNDARY  (1UL << 24)
+
+/*
  *  Max number of scatter/gather entries for en IO.
  *  Each entry costs 8 bytes in the internal CCB data structure.
  *  For now 65 should suffice given the BSD O/Ses capabilities.

Modified: head/sys/dev/sym/sym_hipd.c
==
--- head/sys/dev/sym/sym_hipd.c Sat May 26 08:02:45 2012(r236060)
+++ head/sys/dev/sym/sym_hipd.c Sat May 26 08:03:42 2012(r236061)
@@ -1623,6 +1623,7 @@ struct sym_hcb {
u_int   features;   /* Chip features map*/
u_char  myaddr; /* SCSI id of the adapter   */
u_char  maxburst;   /* log base 2 of dwords burst   */
+   u_char  maxsegcnt;  /* Max DMA S/G segments */
u_char  maxwide;/* Maximum transfer width   */
u_char  minsync;/* Min sync period factor (ST)  */
u_char  maxsync;/* Max sync period factor (ST)  */
@@ -7988,10 +7989,7 @@ sym_fast_scatter_sg_physical(hcb_p np, c
 
 /*
  *  Scatter a SG list with physical addresses into bus addressable chunks.
- *  We need to ensure 16MB boundaries not to be crossed during DMA of
- *  each segment, due to some chips being flawed.
  */
-#define BOUND_MASK ((1UL<<24)-1)
 static int
 sym_scatter_sg_physical(hcb_p np, ccb_p cp, bus_dma_segment_t *psegs, int 
nsegs)
 {
@@ -8007,7 +8005,7 @@ sym_scatter_sg_physical(hcb_p np, ccb_p 
pe = ps + psegs[t].ds_len;
 
while (s >= 0) {
-   pn = (pe - 1) & ~BOUND_MASK;
+   pn = (pe - 1) & ~(SYM_CONF_DMA_BOUNDARY - 1);
if (pn <= ps)
pn = ps;
k = pe - pn;
@@ -8032,17 +8030,21 @@ sym_scatter_sg_physical(hcb_p np, ccb_p 
 
return t >= 0 ? -1 : 0;
 }
-#undef BOUND_MASK
 
 /*
  *  SIM action for non performance critical stuff.
  */
 static void sym_action2(struct cam_sim *sim, union ccb *ccb)
 {
+   union ccb *abort_ccb;
+   struct ccb_hdr *ccb_h;
+   struct ccb_pathinq *cpi;
+   struct ccb_trans_settings *cts;
+   struct sym_trans *tip;
hcb_p   np;
tcb_p   tp;
lcb_p   lp;
-   struct  ccb_hdr  *ccb_h;
+   u_char dflags;
 
/*
 *  Retrieve our controller data structure.
@@ -8055,9 +8057,6 @@ static void sym_action2(struct cam_sim *
 
switch (ccb_h->func_code) {
case XPT_SET_TRAN_SETTINGS:
-   {
-   struct ccb_trans_settings *cts;
-
cts  = &ccb->cts;
tp = &np->target[ccb_h->target_id];
 
@@ -8079,13 +8078,7 @@ static void sym_action2(struct cam_sim *
 
sym_xpt_done2(np, ccb, CAM_REQ_CMP);
break;
-   }
case XPT_GET_TRAN_SETTINGS:
-   {
-   struct ccb_trans_settings *cts;
-   struct sym_trans *tip;
-   u_char dflags;
-
cts = &ccb->cts;
tp = &np->target[ccb_h->target_id];
lp = sym_lp(np, tp, ccb_h->target_lun);
@@ -8129,16 +8122,12 @@ static void sym_action2(struct cam_sim *
 #undef cts__scsi
sym_xpt_done2(np, ccb, CAM_REQ_CMP);
break;
-   }
case XPT_CALC_GEOMETRY:
-   {
cam_calc_geometry(&ccb->ccg, /*extended*/1);
sym_xpt_done2(np, ccb, CAM_REQ_CMP);
break;
-   }
case XPT_PATH_INQ:
-   {
-   struct ccb_pathinq *cpi = &ccb->cpi;
+   cpi = &ccb->cpi;
cpi->version_num = 1;
cpi->hba_inquiry = PI_MDP_ABLE|PI_SDTR_ABLE|PI_TAG_ABLE;
if ((np->features & FE_WIDE) != 0)
@@ -8173,12 +8162,11 @@ static void sym_action2(struct cam_sim *
   

svn commit: r236062 - head/sys/net

2012-05-26 Thread Andrew Thompson
Author: thompsa
Date: Sat May 26 08:09:01 2012
New Revision: 236062
URL: http://svn.freebsd.org/changeset/base/236062

Log:
  Turn LACP debugging from a compile time option to a sysctl, it is very handy 
to
  be able to turn it on when negotiation to a switch misbehaves.
  
  Submitted by: Andrew Boyer
  MFC after:3 days

Modified:
  head/sys/net/ieee8023ad_lacp.c

Modified: head/sys/net/ieee8023ad_lacp.c
==
--- head/sys/net/ieee8023ad_lacp.c  Sat May 26 08:03:42 2012
(r236061)
+++ head/sys/net/ieee8023ad_lacp.c  Sat May 26 08:09:01 2012
(r236062)
@@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$");
 #include  /* hz */
 #include  /* for net/if.h */
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -168,7 +169,8 @@ static void lacp_enable_distributing(str
 static int lacp_xmit_lacpdu(struct lacp_port *);
 static int lacp_xmit_marker(struct lacp_port *);
 
-#if defined(LACP_DEBUG)
+/* Debugging */
+
 static voidlacp_dump_lacpdu(const struct lacpdu *);
 static const char *lacp_format_partner(const struct lacp_peerinfo *, char *,
size_t);
@@ -184,10 +186,14 @@ static const char *lacp_format_portid(co
size_t);
 static voidlacp_dprintf(const struct lacp_port *, const char *, ...)
__attribute__((__format__(__printf__, 2, 3)));
-#defineLACP_DPRINTF(a) lacp_dprintf a
-#else
-#define LACP_DPRINTF(a) /* nothing */
-#endif
+
+static int lacp_debug = 0;
+SYSCTL_INT(_net, OID_AUTO, lacp_debug, CTLFLAG_RW | CTLFLAG_TUN,
+&lacp_debug, 0, "Enable LACP debug logging (1=debug, 2=trace)");
+TUNABLE_INT("net.lacp_debug", &lacp_debug);
+
+#define LACP_DPRINTF(a) if (lacp_debug > 0) { lacp_dprintf a ; }
+#define LACP_TRACE(a) if (lacp_debug > 1) { lacp_dprintf(a,"%s\n",__func__); }
 
 /*
  * partner administration variables.
@@ -290,10 +296,10 @@ lacp_pdu_input(struct lacp_port *lp, str
goto bad;
}
 
-#if defined(LACP_DEBUG)
-   LACP_DPRINTF((lp, "lacpdu receive\n"));
-   lacp_dump_lacpdu(du);
-#endif /* defined(LACP_DEBUG) */
+if (lacp_debug > 0) {
+   lacp_dprintf(lp, "lacpdu receive\n");
+   lacp_dump_lacpdu(du);
+   }
 
LACP_LOCK(lsc);
lacp_sm_rx(lp, du);
@@ -370,10 +376,10 @@ lacp_xmit_lacpdu(struct lacp_port *lp)
sizeof(du->ldu_collector));
du->ldu_collector.lci_maxdelay = 0;
 
-#if defined(LACP_DEBUG)
-   LACP_DPRINTF((lp, "lacpdu transmit\n"));
-   lacp_dump_lacpdu(du);
-#endif /* defined(LACP_DEBUG) */
+   if (lacp_debug > 0) {
+   lacp_dprintf(lp, "lacpdu transmit\n");
+   lacp_dump_lacpdu(du);
+   }
 
m->m_flags |= M_MCAST;
 
@@ -647,9 +653,7 @@ lacp_disable_distributing(struct lacp_po
 {
struct lacp_aggregator *la = lp->lp_aggregator;
struct lacp_softc *lsc = lp->lp_lsc;
-#if defined(LACP_DEBUG)
char buf[LACP_LAGIDSTR_MAX+1];
-#endif /* defined(LACP_DEBUG) */
 
LACP_LOCK_ASSERT(lsc);
 
@@ -684,9 +688,7 @@ lacp_enable_distributing(struct lacp_por
 {
struct lacp_aggregator *la = lp->lp_aggregator;
struct lacp_softc *lsc = lp->lp_lsc;
-#if defined(LACP_DEBUG)
char buf[LACP_LAGIDSTR_MAX+1];
-#endif /* defined(LACP_DEBUG) */
 
LACP_LOCK_ASSERT(lsc);
 
@@ -720,7 +722,8 @@ lacp_transit_expire(void *vp)
 
LACP_LOCK_ASSERT(lsc);
 
-   LACP_DPRINTF((NULL, "%s\n", __func__));
+   LACP_TRACE(NULL);
+
lsc->lsc_suppress_distributing = FALSE;
 }
 
@@ -838,7 +841,8 @@ lacp_suppress_distributing(struct lacp_s
return;
}
 
-   LACP_DPRINTF((NULL, "%s\n", __func__));
+   LACP_TRACE(NULL);
+
lsc->lsc_suppress_distributing = TRUE;
 
/* send a marker frame down each port to verify the queues are empty */
@@ -908,11 +912,9 @@ lacp_select_active_aggregator(struct lac
struct lacp_aggregator *la;
struct lacp_aggregator *best_la = NULL;
uint64_t best_speed = 0;
-#if defined(LACP_DEBUG)
char buf[LACP_LAGIDSTR_MAX+1];
-#endif /* defined(LACP_DEBUG) */
 
-   LACP_DPRINTF((NULL, "%s:\n", __func__));
+   LACP_TRACE(NULL);
 
TAILQ_FOREACH(la, &lsc->lsc_aggregators, la_q) {
uint64_t speed;
@@ -946,7 +948,6 @@ lacp_select_active_aggregator(struct lac
KASSERT(best_la == NULL || !TAILQ_EMPTY(&best_la->la_ports),
("invalid aggregator list"));
 
-#if defined(LACP_DEBUG)
if (lsc->lsc_active_aggregator != best_la) {
LACP_DPRINTF((NULL, "active aggregator changed\n"));
LACP_DPRINTF((NULL, "old %s\n",
@@ -957,7 +958,6 @@ lacp_select_active_aggregator(struct lac
}
LACP_DPRINTF((NULL, "new %s\n",
lacp_format_lagid_aggregator(best_la, buf, sizeof(buf;
-#endif /* defined(LACP_DEBUG) */
 
if (lsc->lsc_active_aggregator != best_la) {

svn commit: r236063 - head/sys/dev/sym

2012-05-26 Thread Marius Strobl
Author: marius
Date: Sat May 26 08:17:30 2012
New Revision: 236063
URL: http://svn.freebsd.org/changeset/base/236063

Log:
  Remove extraneous empty lines.
  
  MFC after:3 day

Modified:
  head/sys/dev/sym/sym_hipd.c

Modified: head/sys/dev/sym/sym_hipd.c
==
--- head/sys/dev/sym/sym_hipd.c Sat May 26 08:09:01 2012(r236062)
+++ head/sys/dev/sym/sym_hipd.c Sat May 26 08:17:30 2012(r236063)
@@ -70,7 +70,6 @@ __FBSDID("$FreeBSD$");
 #include "opt_sym.h"
 #include 
 
-
 #include 
 #include 
 #include 
@@ -128,7 +127,6 @@ typedef u_int32_t u32;
  *  requires memory barriers (and also IO barriers when they
  *  make sense) to be used.
  */
-
 #ifdefined __i386__ || defined __amd64__
 #define MEMORY_BARRIER()   do { ; } while(0)
 #elif  defined __powerpc__
@@ -144,7 +142,6 @@ typedef u_int32_t u32;
 /*
  *  A la VMS/CAM-3 queue management.
  */
-
 typedef struct sym_quehead {
struct sym_quehead *flink;  /* Forward  pointer */
struct sym_quehead *blink;  /* Backward pointer */
@@ -206,7 +203,6 @@ static __inline void sym_que_splice(stru
 #define sym_que_entry(ptr, type, member) \
((type *)((char *)(ptr)-(size_t)(&((type *)0)->member)))
 
-
 #define sym_insque(new, pos)   __sym_que_add(new, pos, (pos)->flink)
 
 #define sym_remque(el) __sym_que_del((el)->blink, (el)->flink)
@@ -373,7 +369,6 @@ static void MDELAY(int ms) { while (ms--
  *  pages of memory that will be useful if we ever need to deal
  *  with IO MMUs for PCI.
  */
-
 #define MEMO_SHIFT 4   /* 16 bytes minimum memory chunk */
 #define MEMO_PAGE_ORDER0   /* 1 PAGE  maximum */
 #if 0
@@ -567,7 +562,6 @@ static m_pool_s mp0 = {0, 0, ___mp0_getp
 static m_pool_s mp0 = {0, 0, ___mp0_getp};
 #endif
 
-
 /*
  * Actual memory allocation routine for non-DMAed memory.
  */
@@ -768,7 +762,6 @@ static m_addr_t __vtobus(bus_dma_tag_t d
return vp ? vp->baddr + (((m_addr_t) m) - a) : 0;
 }
 
-
 /*
  * Verbs for DMAable memory handling.
  * The _uvptv_ macro avoids a nasty warning about pointer to volatile
@@ -783,7 +776,6 @@ static m_addr_t __vtobus(bus_dma_tag_t d
 #define _vtobus(np, p) __vtobus(np->bus_dmat, _uvptv_(p))
 #define vtobus(p)  _vtobus(np, p)
 
-
 /*
  *  Print a buffer in hexadecimal format.
  */
@@ -858,14 +850,12 @@ struct sym_nvram {
  *  Symbios chips (never seen, by the way).
  *  For now, this stuff does not deserve any comments. :)
  */
-
 #define sym_offb(o)(o)
 #define sym_offw(o)(o)
 
 /*
  *  Some provision for support for BIG ENDIAN CPU.
  */
-
 #define cpu_to_scr(dw) htole32(dw)
 #define scr_to_cpu(dw) le32toh(dw)
 
@@ -874,8 +864,6 @@ struct sym_nvram {
  *  We use the `bus space' interface under FreeBSD-4 and
  *  later kernel versions.
  */
-
-
 #if defined(SYM_CONF_IOMAPPED)
 
 #define INB_OFF(o) bus_read_1(np->io_res, (o))
@@ -901,7 +889,6 @@ struct sym_nvram {
 #define OUTRAM_OFF(o, a, l)\
bus_write_region_1(np->ram_res, (o), (a), (l))
 
-
 /*
  *  Common definitions for both bus space and legacy IO methods.
  */
@@ -1333,7 +1320,6 @@ struct sym_pmc {
  *  For SYMBIOS chips that support LOAD/STORE this copy is
  *  not needed and thus not performed.
  */
-
 struct sym_ccbh {
/*
 *  Start and restart SCRIPTS addresses (must be at 0).
@@ -1749,7 +1735,6 @@ static __inline const char *sym_name(hcb
 #definePADDR_A(label)  SYM_GEN_PADDR_A(struct SYM_FWA_SCR, 
label)
 #definePADDR_B(label)  SYM_GEN_PADDR_B(struct SYM_FWB_SCR, 
label)
 
-
 #ifdef SYM_CONF_GENERIC_SUPPORT
 /*
  *  Allocate firmware #1 script area.
@@ -2453,7 +2438,6 @@ static __inline void sym_init_burst(hcb_
}
 }
 
-
 /*
  * Print out the list of targets that have some flag disabled by user.
  */
@@ -2848,7 +2832,6 @@ static int sym_prepare_setting(hcb_p np,
  *  negotiation and the nego_status field of the CCB.
  *  Returns the size of the message in bytes.
  */
-
 static int sym_prepare_nego(hcb_p np, ccb_p cp, int nego, u_char *msgptr)
 {
tcb_p tp = &np->target[cp->target];
@@ -2966,7 +2949,6 @@ static void sym_put_start_queue(hcb_p np
OUTB (nc_istat, SIGP|np->istat_sem);
 }
 
-
 /*
  *  Soft reset the chip.
  *
@@ -3842,7 +3824,6 @@ static void sym_log_hard_error(hcb_p np,
  *  ask me for any guarantee that it will never fail. :-)
  *  Use at your own decision and risk.
  */
-
 static void sym_intr1 (hcb_p np)
 {
u_char  istat, istatc;
@@ -4004,7 +3985,6 @@ static void sym_poll(struct cam_sim *sim
sym_intr1(cam_sim_softc(sim));
 }
 
-
 /*
  *  generic recovery from scsi interrupt
  *
@@ -5292,7 +5272,6 @@ static void sym_sir_task_recovery(hcb_p 
  *  offset (basically from the MDP message) and returns
  *  the corresponding values of dp_sg and dp_ofs.
  */
-
 static int sym_evaluate_dp(hcb_p np, ccb_p cp, u32 scr, int *ofs)
 {
   

svn commit: r236064 - stable/9/sbin/ifconfig

2012-05-26 Thread Andrew Thompson
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
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r236065 - stable/9/share/man/man4

2012-05-26 Thread Andrew Thompson
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.
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r236066 - stable/8/sbin/ifconfig

2012-05-26 Thread Andrew Thompson
Author: thompsa
Date: Sat May 26 08:23:26 2012
New Revision: 236066
URL: http://svn.freebsd.org/changeset/base/236066

Log:
  MFC r232638
  
Fix typo in lagg options.

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

Modified: stable/8/sbin/ifconfig/ifconfig.8
==
--- stable/8/sbin/ifconfig/ifconfig.8   Sat May 26 08:21:11 2012
(r236065)
+++ stable/8/sbin/ifconfig/ifconfig.8   Sat May 26 08:23:26 2012
(r236066)
@@ -28,7 +28,7 @@
 .\" From: @(#)ifconfig.8   8.3 (Berkeley) 1/5/94
 .\" $FreeBSD$
 .\"
-.Dd February 29, 2012
+.Dd March 7, 2012
 .Dt IFCONFIG 8
 .Os
 .Sh NAME
@@ -2246,7 +2246,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
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r236067 - stable/9/share/man/man9

2012-05-26 Thread Andrew Thompson
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.9Sat May 26 08:23:26 2012
(r236066)
+++ stable/9/share/man/man9/sysctl.9Sat 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
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r236068 - stable/8/share/man/man9

2012-05-26 Thread Andrew Thompson
Author: thompsa
Date: Sat May 26 08:25:41 2012
New Revision: 236068
URL: http://svn.freebsd.org/changeset/base/236068

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/8/share/man/man9/sysctl.9
Directory Properties:
  stable/8/share/man/man9/   (props changed)

Modified: stable/8/share/man/man9/sysctl.9
==
--- stable/8/share/man/man9/sysctl.9Sat May 26 08:25:25 2012
(r236067)
+++ stable/8/share/man/man9/sysctl.9Sat May 26 08:25:41 2012
(r236068)
@@ -142,9 +142,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
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r236069 - head/sys/dev/usb/controller

2012-05-26 Thread Marius Strobl
Author: marius
Date: Sat May 26 08:31:12 2012
New Revision: 236069
URL: http://svn.freebsd.org/changeset/base/236069

Log:
  Make the VIA workaround actually do its intended job.
  
  MFC after:3 days

Modified:
  head/sys/dev/usb/controller/ehci_pci.c

Modified: head/sys/dev/usb/controller/ehci_pci.c
==
--- head/sys/dev/usb/controller/ehci_pci.c  Sat May 26 08:25:41 2012
(r236068)
+++ head/sys/dev/usb/controller/ehci_pci.c  Sat May 26 08:31:12 2012
(r236069)
@@ -243,7 +243,7 @@ ehci_pci_via_quirk(device_t self)
val = pci_read_config(self, 0x4b, 1);
if (val & 0x20)
return;
-   pci_write_config(self, 0x4b, val, 1);
+   pci_write_config(self, 0x4b, val | 0x20, 1);
device_printf(self, "VIA-quirk applied\n");
}
 }
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r236070 - head/sys/dev/usb

2012-05-26 Thread Marius Strobl
Author: marius
Date: Sat May 26 08:33:53 2012
New Revision: 236070
URL: http://svn.freebsd.org/changeset/base/236070

Log:
  Consistently use USB_PAGE_SIZE. Currently, this is cosmetic.
  
  MFC after:3 days

Modified:
  head/sys/dev/usb/usb_transfer.c

Modified: head/sys/dev/usb/usb_transfer.c
==
--- head/sys/dev/usb/usb_transfer.c Sat May 26 08:31:12 2012
(r236069)
+++ head/sys/dev/usb/usb_transfer.c Sat May 26 08:33:53 2012
(r236070)
@@ -217,12 +217,12 @@ usbd_transfer_setup_sub_malloc(struct us
 * Try multi-allocation chunks to reduce the number of DMA
 * allocations, hence DMA allocations are slow.
 */
-   if (size >= PAGE_SIZE) {
+   if (size >= USB_PAGE_SIZE) {
n_dma_pc = count;
n_obj = 1;
} else {
/* compute number of objects per page */
-   n_obj = (PAGE_SIZE / size);
+   n_obj = (USB_PAGE_SIZE / size);
/*
 * Compute number of DMA chunks, rounded up
 * to nearest one:
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r236071 - stable/9/sys/net

2012-05-26 Thread Andrew Thompson
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.cSat May 26 08:33:53 2012
(r236070)
+++ stable/9/sys/net/if_bridge.cSat 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");
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r236072 - stable/8/sys/net

2012-05-26 Thread Andrew Thompson
Author: thompsa
Date: Sat May 26 08:41:48 2012
New Revision: 236072
URL: http://svn.freebsd.org/changeset/base/236072

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

Modified:
  stable/8/sys/net/if_bridge.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/boot/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/e1000/   (props changed)

Modified: stable/8/sys/net/if_bridge.c
==
--- stable/8/sys/net/if_bridge.cSat May 26 08:41:17 2012
(r236071)
+++ stable/8/sys/net/if_bridge.cSat May 26 08:41:48 2012
(r236072)
@@ -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");
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r236073 - head/sys/dev/usb/controller

2012-05-26 Thread Marius Strobl
Author: marius
Date: Sat May 26 08:43:51 2012
New Revision: 236073
URL: http://svn.freebsd.org/changeset/base/236073

Log:
  Make the VIA workaround application somewhat more consistent with the
  ATI one.

Modified:
  head/sys/dev/usb/controller/ehci_pci.c

Modified: head/sys/dev/usb/controller/ehci_pci.c
==
--- head/sys/dev/usb/controller/ehci_pci.c  Sat May 26 08:41:48 2012
(r236072)
+++ head/sys/dev/usb/controller/ehci_pci.c  Sat May 26 08:43:51 2012
(r236073)
@@ -243,7 +243,8 @@ ehci_pci_via_quirk(device_t self)
val = pci_read_config(self, 0x4b, 1);
if (val & 0x20)
return;
-   pci_write_config(self, 0x4b, val | 0x20, 1);
+   val |= 0x20;
+   pci_write_config(self, 0x4b, val, 1);
device_printf(self, "VIA-quirk applied\n");
}
 }
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r236075 - stable/8/sys/net

2012-05-26 Thread Andrew Thompson
Author: thompsa
Date: Sat May 26 08:44:50 2012
New Revision: 236075
URL: http://svn.freebsd.org/changeset/base/236075

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/8/sys/net/if_lagg.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/boot/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/e1000/   (props changed)

Modified: stable/8/sys/net/if_lagg.c
==
--- stable/8/sys/net/if_lagg.c  Sat May 26 08:44:26 2012(r236074)
+++ stable/8/sys/net/if_lagg.c  Sat May 26 08:44:50 2012(r236075)
@@ -756,28 +756,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));
}
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r236074 - stable/9/sys/net

2012-05-26 Thread Andrew Thompson
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));
}
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r236076 - in stable/9/sys/boot: ofw/libofw sparc64 sparc64/boot1 sparc64/loader sparc64/zfsboot sparc64/zfsloader zfs

2012-05-26 Thread Marius Strobl
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 
+
+#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];
 intlen;
@@ -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 

Modified: stable/9/sys/boot/sparc64/boot1/Makefile
==
--- stable/9/sys/boot/sparc64/boot1/MakefileSat May 26 08:44:50 2012
(r236075)
+++ stable/9/sys/boot/sparc64/boot1/MakefileSat 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
 

svn commit: r236077 - in stable/8/sys/boot: ofw/libofw sparc64 sparc64/boot1 sparc64/loader sparc64/zfsboot sparc64/zfsloader zfs

2012-05-26 Thread Marius Strobl
Author: marius
Date: Sat May 26 08:54:44 2012
New Revision: 236077
URL: http://svn.freebsd.org/changeset/base/236077

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/8/sys/boot/sparc64/zfsboot/
 - copied from r234898, head/sys/boot/sparc64/zfsboot/
  stable/8/sys/boot/sparc64/zfsloader/
 - copied from r234898, head/sys/boot/sparc64/zfsloader/
Modified:
  stable/8/sys/boot/ofw/libofw/devicename.c
  stable/8/sys/boot/sparc64/Makefile
  stable/8/sys/boot/sparc64/boot1/Makefile
  stable/8/sys/boot/sparc64/boot1/boot1.c
  stable/8/sys/boot/sparc64/loader/Makefile
  stable/8/sys/boot/sparc64/loader/main.c
  stable/8/sys/boot/sparc64/zfsboot/Makefile
  stable/8/sys/boot/zfs/zfs.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/boot/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/e1000/   (props changed)

Modified: stable/8/sys/boot/ofw/libofw/devicename.c
==
--- stable/8/sys/boot/ofw/libofw/devicename.c   Sat May 26 08:54:26 2012
(r236076)
+++ stable/8/sys/boot/ofw/libofw/devicename.c   Sat May 26 08:54:44 2012
(r236077)
@@ -28,6 +28,8 @@
 __FBSDID("$FreeBSD$");
 
 #include 
+
+#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];
 intlen;
@@ -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/8/sys/boot/sparc64/Makefile
==
--- stable/8/sys/boot/sparc64/Makefile  Sat May 26 08:54:26 2012
(r236076)
+++ stable/8/sys/boot/sparc64/Makefile  Sat May 26 08:54:44 2012
(r236077)
@@ -1,5 +1,5 @@
 # $FreeBSD$
 
-SUBDIR=boot1 loader
+SUBDIR=boot1 loader zfsboot zfsloader
 
 .include 

Modified: stable/8/sys/boot/sparc64/boot1/Makefile
==
--- stable/8/sys/boot/sparc64/boot1/MakefileSat May 26 08:54:26 2012
(r236076)
+++ stable/8/sys/boot/sparc64/boot1/MakefileSat May 26 08:54:44 2012
(r236077)
@@ -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=-N -Ttext ${BOOTBLOCKBASE}
 
 # 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/8/sys/boot/sparc64/boot1/boot1.c
=

svn commit: r236078 - in stable/9/sys: conf dev/iicbus

2012-05-26 Thread Marius Strobl
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.moptional iicbus
 dev/iicbus/iiconf.coptional iicbus
 dev/iicbus/iicsmb.coptional 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 
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+/*
+ * Driver for NXP PCF8563 real-time clock/calendar
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#include "clock_if.h"
+#include "iicbus_if.h"
+
+#definePCF8563_NCLOCKREGS  (PCF8563_R_YEAR - PCF8563_R_CS1 + 1)
+
+struct pcf8563_softc {
+   uint32_tsc_flags;
+#definePCF8563_CPOL(1 << 0)/* PCF8563_R_MONTH_C means 19xx 
*/
+   uint16_tsc_addr;/* PCF8563 slave address */
+   uint16_tsc_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), ® },
+   { 0,

svn commit: r236079 - in stable/8/sys: conf dev/iicbus

2012-05-26 Thread Marius Strobl
Author: marius
Date: Sat May 26 08:58:29 2012
New Revision: 236079
URL: http://svn.freebsd.org/changeset/base/236079

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

Added:
  stable/8/sys/dev/iicbus/pcf8563.c
 - copied unchanged from r234248, head/sys/dev/iicbus/pcf8563.c
  stable/8/sys/dev/iicbus/pcf8563reg.h
 - copied unchanged from r234248, head/sys/dev/iicbus/pcf8563reg.h
Modified:
  stable/8/sys/conf/files
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/boot/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/e1000/   (props changed)

Modified: stable/8/sys/conf/files
==
--- stable/8/sys/conf/files Sat May 26 08:58:27 2012(r236078)
+++ stable/8/sys/conf/files Sat May 26 08:58:29 2012(r236079)
@@ -1007,6 +1007,7 @@ dev/iicbus/iicbus_if.moptional iicbus
 dev/iicbus/iiconf.coptional iicbus
 dev/iicbus/iicsmb.coptional 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/8/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/8/sys/dev/iicbus/pcf8563.c   Sat May 26 08:58:29 2012
(r236079, copy of r234248, head/sys/dev/iicbus/pcf8563.c)
@@ -0,0 +1,202 @@
+/*-
+ * Copyright (c) 2012 Marius Strobl 
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+/*
+ * Driver for NXP PCF8563 real-time clock/calendar
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#include "clock_if.h"
+#include "iicbus_if.h"
+
+#definePCF8563_NCLOCKREGS  (PCF8563_R_YEAR - PCF8563_R_CS1 + 1)
+
+struct pcf8563_softc {
+   uint32_tsc_flags;
+#definePCF8563_CPOL(1 << 0)/* PCF8563_R_MONTH_C means 19xx 
*/
+   uint16_tsc_addr;/* PCF8563 slave address */
+   uint16_tsc_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), ® },
+   { 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) {

svn commit: r236080 - stable/9/sys/arm/at91

2012-05-26 Thread Marius Strobl
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.cSat May 26 08:58:29 2012
(r236079)
+++ stable/9/sys/arm/at91/at91_pio.cSat 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
+#defineOPENED 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)
+#defineAT91_PIO_LOCK(_sc)  mtx_lock_spin(&(_sc)->sc_mtx)
 #defineAT91_PIO_UNLOCK(_sc)mtx_unlock_spin(&(_sc)->sc_mtx)
-#define AT91_PIO_LOCK_INIT(_sc) \
+#defineAT91_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)
+#defineAT91_PIO_LOCK_DESTROY(_sc)  mtx_destroy(&_sc->sc_mtx);
+#defineAT91_PIO_ASSERT_LOCKED(_sc) mtx_assert(&_sc->sc_mtx, 
MA_OWNED);
+#defineAT91_PIO_ASSERT_UNLOCKED(_sc)   mtx_assert(&_sc->sc_mtx, 
MA_NOTOWNED);
+#defineCDEV2SOFTC(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, 0x);
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(s

svn commit: r236081 - stable/9/sys/arm/at91

2012-05-26 Thread Marius Strobl
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.cSat May 26 09:03:14 2012
(r236080)
+++ stable/9/sys/arm/at91/at91_pit.cSat 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.cSat May 26 09:03:14 2012
(r236080)
+++ stable/9/sys/arm/at91/at91_pmc.cSat 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.cSat May 26 09:03:14 2012
(r236080)
+++ stable/9/sys/arm/at91/at91_rst.cSat May 26 09:05:45 2012
(r236081)
@@ -71,7 +71,7 @@ static int
 at91_rst_probe(device_t dev)
 {
 
-   if (at91_is_sam9()) {
+

svn commit: r236083 - stable/8/sys/arm/at91

2012-05-26 Thread Marius Strobl
Author: marius
Date: Sat May 26 09:08:33 2012
New Revision: 236083
URL: http://svn.freebsd.org/changeset/base/236083

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

Modified:
  stable/8/sys/arm/at91/at91_twi.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/boot/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/e1000/   (props changed)

Modified: stable/8/sys/arm/at91/at91_twi.c
==
--- stable/8/sys/arm/at91/at91_twi.cSat May 26 09:08:30 2012
(r236082)
+++ stable/8/sys/arm/at91/at91_twi.cSat May 26 09:08:33 2012
(r236083)
@@ -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;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r236082 - stable/9/sys/arm/at91

2012-05-26 Thread Marius Strobl
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.cSat May 26 09:05:45 2012
(r236081)
+++ stable/9/sys/arm/at91/at91_twi.cSat 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;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r236084 - stable/9/sys/arm/at91

2012-05-26 Thread Marius Strobl
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.cSat May 26 09:08:33 2012
(r236083)
+++ stable/9/sys/arm/at91/at91_mci.cSat 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)
 #defineAT91_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, 0x);   /* 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
   

svn commit: r236085 - stable/9/sys/arm/arm

2012-05-26 Thread Marius Strobl
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, 
+

svn commit: r236086 - stable/8/sys/arm/arm

2012-05-26 Thread Marius Strobl
Author: marius
Date: Sat May 26 09:13:38 2012
New Revision: 236086
URL: http://svn.freebsd.org/changeset/base/236086

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/8/sys/arm/arm/busdma_machdep.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/boot/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/e1000/   (props changed)

Modified: stable/8/sys/arm/arm/busdma_machdep.c
==
--- stable/8/sys/arm/arm/busdma_machdep.c   Sat May 26 09:13:24 2012
(r236085)
+++ stable/8/sys/arm/arm/busdma_machdep.c   Sat May 26 09:13:38 2012
(r236086)
@@ -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);
+   }
}
 }
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/

svn commit: r236087 - in head/sys: netinet netinet6

2012-05-26 Thread Michael Tuexen
Author: tuexen
Date: Sat May 26 09:16:33 2012
New Revision: 236087
URL: http://svn.freebsd.org/changeset/base/236087

Log:
  Get rid of SCTP specific code to avoid CRC32C computations on loopback.
  Just just offloading.
  MFC after: 3 days

Modified:
  head/sys/netinet/sctp_output.c
  head/sys/netinet/sctp_sysctl.c
  head/sys/netinet/sctp_sysctl.h
  head/sys/netinet6/sctp6_usrreq.c

Modified: head/sys/netinet/sctp_output.c
==
--- head/sys/netinet/sctp_output.c  Sat May 26 09:13:38 2012
(r236086)
+++ head/sys/netinet/sctp_output.c  Sat May 26 09:16:33 2012
(r236087)
@@ -4116,14 +4116,8 @@ sctp_lowlevel_chunk_output(struct sctp_i
 #if defined(SCTP_WITH_NO_CSUM)
SCTP_STAT_INCR(sctps_sendnocrc);
 #else
-   if 
(!(SCTP_BASE_SYSCTL(sctp_no_csum_on_loopback) &&
-   (stcb) &&
-   (stcb->asoc.loopback_scope))) {
-   sctphdr->checksum = 
sctp_calculate_cksum(m, sizeof(struct ip) + sizeof(struct udphdr));
-   SCTP_STAT_INCR(sctps_sendswcrc);
-   } else {
-   SCTP_STAT_INCR(sctps_sendnocrc);
-   }
+   sctphdr->checksum = sctp_calculate_cksum(m, 
sizeof(struct ip) + sizeof(struct udphdr));
+   SCTP_STAT_INCR(sctps_sendswcrc);
 #endif
if (V_udp_cksum) {
SCTP_ENABLE_UDP_CSUM(o_pak);
@@ -4474,14 +4468,8 @@ sctp_lowlevel_chunk_output(struct sctp_i
 #if defined(SCTP_WITH_NO_CSUM)
SCTP_STAT_INCR(sctps_sendnocrc);
 #else
-   if 
(!(SCTP_BASE_SYSCTL(sctp_no_csum_on_loopback) &&
-   (stcb) &&
-   (stcb->asoc.loopback_scope))) {
-   sctphdr->checksum = 
sctp_calculate_cksum(m, sizeof(struct ip6_hdr) + sizeof(struct udphdr));
-   SCTP_STAT_INCR(sctps_sendswcrc);
-   } else {
-   SCTP_STAT_INCR(sctps_sendnocrc);
-   }
+   sctphdr->checksum = sctp_calculate_cksum(m, 
sizeof(struct ip6_hdr) + sizeof(struct udphdr));
+   SCTP_STAT_INCR(sctps_sendswcrc);
 #endif
if ((udp->uh_sum = in6_cksum(o_pak, 
IPPROTO_UDP, sizeof(struct ip6_hdr), packet_length - sizeof(struct ip6_hdr))) 
== 0) {
udp->uh_sum = 0x;

Modified: head/sys/netinet/sctp_sysctl.c
==
--- head/sys/netinet/sctp_sysctl.c  Sat May 26 09:13:38 2012
(r236086)
+++ head/sys/netinet/sctp_sysctl.c  Sat May 26 09:16:33 2012
(r236087)
@@ -55,9 +55,6 @@ sctp_init_sysctls()
SCTP_BASE_SYSCTL(sctp_multiple_asconfs) = 
SCTPCTL_MULTIPLEASCONFS_DEFAULT;
SCTP_BASE_SYSCTL(sctp_ecn_enable) = SCTPCTL_ECN_ENABLE_DEFAULT;
SCTP_BASE_SYSCTL(sctp_strict_sacks) = SCTPCTL_STRICT_SACKS_DEFAULT;
-#if !defined(SCTP_WITH_NO_CSUM)
-   SCTP_BASE_SYSCTL(sctp_no_csum_on_loopback) = 
SCTPCTL_LOOPBACK_NOCSUM_DEFAULT;
-#endif
SCTP_BASE_SYSCTL(sctp_peer_chunk_oh) = SCTPCTL_PEER_CHKOH_DEFAULT;
SCTP_BASE_SYSCTL(sctp_max_burst_default) = SCTPCTL_MAXBURST_DEFAULT;
SCTP_BASE_SYSCTL(sctp_fr_max_burst_default) = 
SCTPCTL_FRMAXBURST_DEFAULT;
@@ -604,9 +601,6 @@ sysctl_sctp_check(SYSCTL_HANDLER_ARGS)
RANGECHK(SCTP_BASE_SYSCTL(sctp_auto_asconf), 
SCTPCTL_AUTOASCONF_MIN, SCTPCTL_AUTOASCONF_MAX);
RANGECHK(SCTP_BASE_SYSCTL(sctp_ecn_enable), 
SCTPCTL_ECN_ENABLE_MIN, SCTPCTL_ECN_ENABLE_MAX);
RANGECHK(SCTP_BASE_SYSCTL(sctp_strict_sacks), 
SCTPCTL_STRICT_SACKS_MIN, SCTPCTL_STRICT_SACKS_MAX);
-#if !defined(SCTP_WITH_NO_CSUM)
-   RANGECHK(SCTP_BASE_SYSCTL(sctp_no_csum_on_loopback), 
SCTPCTL_LOOPBACK_NOCSUM_MIN, SCTPCTL_LOOPBACK_NOCSUM_MAX);
-#endif
RANGECHK(SCTP_BASE_SYSCTL(sctp_peer_chunk_oh), 
SCTPCTL_PEER_CHKOH_MIN, SCTPCTL_PEER_CHKOH_MAX);
RANGECHK(SCTP_BASE_SYSCTL(sctp_max_burst_default), 
SCTPCTL_MAXBURST_MIN, SCTPCTL_MAXBURST_MAX);
RANGECHK(SCTP_BASE_SYSCTL(sctp_fr_max_burst_default), 
SCTPCTL_FRMAXBURST_MIN, SCTPCTL_FRMAXBURST_MAX);
@@ -870,11 +864,6 @@ SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUT
 &SCTP_BASE_SYSCTL(sctp_strict_sacks), 0, sysctl_sctp_check, "IU",
 SCTPCTL_STRICT_SACKS_DESC);
 
-#if !defined(SCTP_WITH_NO_CSUM)
-SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, loopback_nocsum, CTLTYPE_UINT | 
CTLFLAG_RW,
-&SCTP_BASE_SYSCTL(sctp_no_csu

svn commit: r236088 - stable/9/sys/arm/at91

2012-05-26 Thread Marius Strobl
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 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -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_tmap;
 };
 
 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_TIMEOUT1   
+#defineHAS_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))
-  

svn commit: r236089 - in stable/9/sys: dev/mmc modules/mmcsd

2012-05-26 Thread Marius Strobl
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  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_RETRIES3
@@ -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  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 0x instead.
+*/
+   c1 = (ivar->cid.oid >> 8) & 0x0ff;
+   c2 = ivar->cid.oid & 0x0ff;
+   if (c1 > 0x1f && c1 < 0x7f && c2 > 0x1f && c2 < 0x7f)
+   snprintf(oidstr, s

svn commit: r236090 - in stable/8/sys: dev/mmc modules/mmcsd

2012-05-26 Thread Marius Strobl
Author: marius
Date: Sat May 26 09:31:25 2012
New Revision: 236090
URL: http://svn.freebsd.org/changeset/base/236090

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  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/8/sys/dev/mmc/mmc.c
  stable/8/sys/dev/mmc/mmcbrvar.h
  stable/8/sys/dev/mmc/mmcreg.h
  stable/8/sys/dev/mmc/mmcsd.c
  stable/8/sys/dev/mmc/mmcvar.h
  stable/8/sys/modules/mmcsd/Makefile
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/boot/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/e1000/   (props changed)

Modified: stable/8/sys/dev/mmc/mmc.c
==
--- stable/8/sys/dev/mmc/mmc.c  Sat May 26 09:31:23 2012(r236089)
+++ stable/8/sys/dev/mmc/mmc.c  Sat May 26 09:31:25 2012(r236090)
@@ -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_RETRIES3
@@ -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  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 0x 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, 1, 10, 100, 1000
 };
+

svn commit: r236091 - stable/9/sys/netinet

2012-05-26 Thread Bjoern A. Zeeb
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 
 #include 

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 

svn commit: r236092 - stable/8/sys/netinet

2012-05-26 Thread Bjoern A. Zeeb
Author: bz
Date: Sat May 26 10:24:35 2012
New Revision: 236092
URL: http://svn.freebsd.org/changeset/base/236092

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/8/sys/netinet/tcp_lro.c
  stable/8/sys/netinet/tcp_lro.h
Directory Properties:
  stable/8/sys/   (props changed)

Modified: stable/8/sys/netinet/tcp_lro.c
==
--- stable/8/sys/netinet/tcp_lro.c  Sat May 26 10:24:30 2012
(r236091)
+++ stable/8/sys/netinet/tcp_lro.c  Sat May 26 10:24:35 2012
(r236092)
@@ -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 
 #include 

Modified: stable/8/sys/netinet/tcp_lro.h
==
--- stable/8/sys/netinet/tcp_lro.h  Sat May 26 10:24:30 2012
(r236091)
+++ stable/8/sys/netinet/tcp_lro.h  Sat May 26 10:24:35 2012
(r236092)
@@ -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 

svn commit: r236093 - head/sys/netinet

2012-05-26 Thread Bjoern A. Zeeb
Author: bz
Date: Sat May 26 10:28:11 2012
New Revision: 236093
URL: http://svn.freebsd.org/changeset/base/236093

Log:
  Trim the extra $FreeBSD$ from the comment below the license.  We use
  the __FBSDID() macro on the file now instead.
  
  MFC after:3 days

Modified:
  head/sys/netinet/tcp_lro.c

Modified: head/sys/netinet/tcp_lro.c
==
--- head/sys/netinet/tcp_lro.c  Sat May 26 10:24:35 2012(r236092)
+++ head/sys/netinet/tcp_lro.c  Sat May 26 10:28:11 2012(r236093)
@@ -27,8 +27,6 @@
  * 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 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r236094 - head/sys/powerpc/include

2012-05-26 Thread Rafal Jaworowski
Author: raj
Date: Sat May 26 12:15:13 2012
New Revision: 236094
URL: http://svn.freebsd.org/changeset/base/236094

Log:
  Unify SPR defines formatting, no funtional changes.

Modified:
  head/sys/powerpc/include/spr.h

Modified: head/sys/powerpc/include/spr.h
==
--- head/sys/powerpc/include/spr.h  Sat May 26 10:28:11 2012
(r236093)
+++ head/sys/powerpc/include/spr.h  Sat May 26 12:15:13 2012
(r236094)
@@ -115,9 +115,9 @@
 #define  SRR1_ISI_NOEXECUTE0x1000 /* Memory marked no-execute 
*/
 #define  SRR1_ISI_PP   0x0800 /* PP bits forbid access */
 #defineSPR_DECAR   0x036   /* ..8 Decrementer auto reload 
*/
-#define SPR_EIE0x050   /* ..8 Exception Interrupt ??? 
*/
-#define SPR_EID0x051   /* ..8 Exception Interrupt ??? 
*/
-#define SPR_NRI0x052   /* ..8 Exception Interrupt ??? 
*/
+#defineSPR_EIE 0x050   /* ..8 Exception Interrupt ??? 
*/
+#defineSPR_EID 0x051   /* ..8 Exception Interrupt ??? 
*/
+#defineSPR_NRI 0x052   /* ..8 Exception Interrupt ??? 
*/
 #defineSPR_USPRG0  0x100   /* 4.. User SPR General 0 */
 #defineSPR_VRSAVE  0x100   /* .6. AltiVec VRSAVE */
 #defineSPR_SPRG0   0x110   /* 468 SPR General 0 */
@@ -202,49 +202,49 @@
 #defineSPR_DBAT2L  0x21d   /* .6. Data BAT Reg 2 Lower */
 #defineSPR_DBAT3U  0x21e   /* .6. Data BAT Reg 3 Upper */
 #defineSPR_DBAT3L  0x21f   /* .6. Data BAT Reg 3 Lower */
-#define SPR_IC_CST 0x230   /* ..8 Instruction Cache CSR */
-#define  IC_CST_IEN0x8000 /* I cache is ENabled   (RO) */
-#define  IC_CST_CMD_INVALL 0x0c00 /* I cache invalidate all */
-#define  IC_CST_CMD_UNLOCKALL  0x0a00 /* I cache unlock all */
-#define  IC_CST_CMD_UNLOCK 0x0800 /* I cache unlock block */
-#define  IC_CST_CMD_LOADLOCK   0x0600 /* I cache load & lock block */
-#define  IC_CST_CMD_DISABLE0x0400 /* I cache disable */
-#define  IC_CST_CMD_ENABLE 0x0200 /* I cache enable */
-#define  IC_CST_CCER1  0x0020 /* I cache error type 1 (RO) */
-#define  IC_CST_CCER2  0x0010 /* I cache error type 2 (RO) */
-#define  IC_CST_CCER3  0x0008 /* I cache error type 3 (RO) */
+#defineSPR_IC_CST  0x230   /* ..8 Instruction Cache CSR */
+#define  IC_CST_IEN0x8000 /* I cache is ENabled   (RO) 
*/
+#define  IC_CST_CMD_INVALL 0x0c00 /* I cache invalidate all */
+#define  IC_CST_CMD_UNLOCKALL  0x0a00 /* I cache unlock all */
+#define  IC_CST_CMD_UNLOCK 0x0800 /* I cache unlock block */
+#define  IC_CST_CMD_LOADLOCK   0x0600 /* I cache load & lock block 
*/
+#define  IC_CST_CMD_DISABLE0x0400 /* I cache disable */
+#define  IC_CST_CMD_ENABLE 0x0200 /* I cache enable */
+#define  IC_CST_CCER1  0x0020 /* I cache error type 1 (RO) 
*/
+#define  IC_CST_CCER2  0x0010 /* I cache error type 2 (RO) 
*/
+#define  IC_CST_CCER3  0x0008 /* I cache error type 3 (RO) 
*/
 #defineSPR_IBAT4U  0x230   /* .6. Instruction BAT Reg 4 
Upper */
-#define SPR_IC_ADR 0x231   /* ..8 Instruction Cache Address */
+#defineSPR_IC_ADR  0x231   /* ..8 Instruction Cache 
Address */
 #defineSPR_IBAT4L  0x231   /* .6. Instruction BAT Reg 4 
Lower */
-#define SPR_IC_DAT 0x232   /* ..8 Instruction Cache Data */
+#defineSPR_IC_DAT  0x232   /* ..8 Instruction Cache Data */
 #defineSPR_IBAT5U  0x232   /* .6. Instruction BAT Reg 5 
Upper */
 #defineSPR_IBAT5L  0x233   /* .6. Instruction BAT Reg 5 
Lower */
 #defineSPR_IBAT6U  0x234   /* .6. Instruction BAT Reg 6 
Upper */
 #defineSPR_IBAT6L  0x235   /* .6. Instruction BAT Reg 6 
Lower */
 #defineSPR_IBAT7U  0x236   /* .6. Instruction BAT Reg 7 
Upper */
 #defineSPR_IBAT7L  0x237   /* .6. Instruction BAT Reg 7 
Lower */
-#define SPR_DC_CST 0x230   /* ..8 Data Cache CSR */
-#define  DC_CST_DEN0x8000 /* D cache ENabled (RO) */
-#define  DC_CST_DFWT   0x4000 /* D cache Force Write-Thru (RO) */
-#define  DC_CST_LES0x2000 /* D cache Little Endian Swap (RO) */
-#define  DC_CST_CMD_FLUSH  0x0e00 /* D cache invalidate all */
-#define  DC_CST_CMD_INVALL 0x0c00 /* D cache invalidate all */
-#define  DC_CST_CMD_UNLOCKALL  0x0a00 /* D cache unlock all */
-#define  DC_CST_CMD_UNLOCK 0x0800 /* D cache unlock block 

Re: svn commit: r236026 - in head/sys: amd64/linux32 compat/freebsd32 kern

2012-05-26 Thread Bruce Evans

On Fri, 25 May 2012, Ed Schouten wrote:


Log:
 Remove use of non-ISO-C integer types from system call tables.

 These files already use ISO-C-style integer types, so make them less
 inconsistent by preferring the standard types.


These should actually be Linux types l_foo_t.  ISO-C-style integer types
seem to have only been used for a couple of uintptr_t's, and these uses
are more than just style bugs on amd64 since uintptr_t is for the host
(64 bits on amd64) while the target uintptr_t is only 32 bits.  There
are also a few misuses of the abominable caddr_t instead of l_caddr_t,
so syscalls that don't even take a caddr_t.  Otherwise, Linux types
are used a lot to avoid size mismatches.


Modified: head/sys/amd64/linux32/syscalls.master
==
--- head/sys/amd64/linux32/syscalls.master  Fri May 25 21:12:24 2012
(r236025)
+++ head/sys/amd64/linux32/syscalls.master  Fri May 25 21:50:48 2012
(r236026)
@@ -54,8 +54,8 @@
l_int mode); }
9   AUE_LINKSTD { int linux_link(char *path, char *to); }
10  AUE_UNLINK  STD { int linux_unlink(char *path); }
-11 AUE_EXECVE  STD { int linux_execve(char *path, u_int32_t *argp, 
\
-   u_int32_t *envp); }
+11 AUE_EXECVE  STD { int linux_execve(char *path, uint32_t *argp, \
+   uint32_t *envp); }


argp and envp aren't uintany_t * in either Linux or FreeBSD.  They start as
"char * const *".  There is no Linux type for an indirect "char *", and one
was hacked up here by pretending that "char *" is u_int32_t (it is actually
just 32 bits).  Using l_caddr_t seems to be the best hack available (since
by abusing l_caddr_t, we know that it is actually char *).

The `const' in the type for argp and envp is further from being handled
correctly.  Most or all syscall.master's just type-pun it away.  Similarly
for "const char *path".

All the non-indirect "char *"s for pathnames and other things seem to be
completely wrong on amd64 too.  These pointers start as 32 bits, and it
takes more than a bad type pun to turn then into kernel 64-bit pointers.
The magic for this seems to be:
- all args are converted to 64 bits (by zero-extension?) at a low level
- the args struct for a pathname is
[left padding]; char *; [right padding];
  Since the char * is misdeclared, the explicit padding is null, but the
  layout of the args struct is correct because the wrong arg type in it
  supplies equivalent padding (extra 32 bits on the right).
- the "char *" in the args struct is not actually a char *, and is unusable
  directly in the kernel.  However, it is only used in copyin() and
  copyout(), where it becomes a user address and works correctly.  (An
  older bug in this that the user address for copy*() is declared as
  "void *".  "void *" means a kernel pointer.  The type of a user
  address should be more like vm_offset_t, but even that needs logical
  translation for linux32).

The same mechanism presumably avoids problems when raw caddr_t is used
instead of l_caddr_t, and when uintptr_t is used instead of l_uintptr_t.


12  AUE_CHDIR   STD { int linux_chdir(char *path); }
13  AUE_NULLSTD { int linux_time(l_time_t *tm); }


Example of a correct use of a linux type.  Again, the first-level pointer
is handled by the above magic, but for the second level we need an l_foo_t
to describe its size correctly.


14  AUE_MKNOD   STD { int linux_mknod(char *path, l_int mode, \


Broken except in the K&R case, but amd64 is too new to pretend to support
K&R.  Bug for bug compatible with mknod() and some other syscalls in
kern/syscalls.master.  mknod() takes an arg of type mode_t, not one of
type int.  l_mode_t exists so that the above can be declared correctly,
and is already used for linux_chmod() and linux_chmodat().  OTOH, int for
the mode arg is correct for open(), since open() is variadic at a level
before the syscall, so its mode_t arg gets promoted to int.  Similarly,
if mknod() is compiled by a K&R compiler, or by a STDC compiler with no
prototype in scope, then its mode_t arg gets promoted to int (but for
the STDC case, the behaviour is then undefined once mknod() is reached).
Normally this doesn't cause any problems, but it is easy to declare
things correctly.


Modified: head/sys/compat/freebsd32/syscalls.master
==
--- head/sys/compat/freebsd32/syscalls.master   Fri May 25 21:12:24 2012
(r236025)
+++ head/sys/compat/freebsd32/syscalls.master   Fri May 25 21:50:48 2012
(r236026)
@@ -104,9 +104,9 @@
int flags); }
28  AUE_SENDMSG STD { int freebsd32_sendmsg(int s, struct msghdr32 
*msg, \
int flags); }
-29 AUE_RECVFROMSTD { int fre

svn commit: r236095 - head/sys/powerpc/include

2012-05-26 Thread Rafal Jaworowski
Author: raj
Date: Sat May 26 12:39:23 2012
New Revision: 236095
URL: http://svn.freebsd.org/changeset/base/236095

Log:
  Provide SPR definitions for newer Book-E (E500mc, E5500, PPC465).
  
  Obtained from:Freescale, Semihalf.

Modified:
  head/sys/powerpc/include/spr.h

Modified: head/sys/powerpc/include/spr.h
==
--- head/sys/powerpc/include/spr.h  Sat May 26 12:15:13 2012
(r236094)
+++ head/sys/powerpc/include/spr.h  Sat May 26 12:39:23 2012
(r236095)
@@ -184,6 +184,8 @@
 #define  MPC8245 0x8081
 #define  FSL_E500v1  0x8020
 #define  FSL_E500v2  0x8021
+#define  FSL_E500mc  0x8023
+#define  FSL_E5500   0x8024
 
 #defineSPR_IBAT0U  0x210   /* .68 Instruction BAT Reg 0 
Upper */
 #defineSPR_IBAT0U  0x210   /* .6. Instruction BAT Reg 0 
Upper */
@@ -421,6 +423,7 @@
 #defineSPR_SRR30x3df   /* 4.. Save/Restore Register 3 
*/
 #defineSPR_HID00x3f0   /* ..8 Hardware Implementation 
Register 0 */
 #defineSPR_HID10x3f1   /* ..8 Hardware Implementation 
Register 1 */
+#defineSPR_HID20x3f3   /* ..8 Hardware Implementation 
Register 2 */
 #defineSPR_HID40x3f4   /* ..8 Hardware Implementation 
Register 4 */
 #defineSPR_HID50x3f6   /* ..8 Hardware Implementation 
Register 5 */
 #defineSPR_HID60x3f9   /* ..8 Hardware Implementation 
Register 6 */
@@ -627,6 +630,8 @@
 
 #elif defined(E500)
 
+#defineSPR_MCSR0x23c   /* ..8 Machine Check Syndrome 
register */
+
 #defineSPR_ESR 0x003e  /* ..8 Exception Syndrome 
Register */
 #define  ESR_PIL 0x0800 /* Program interrupt - 
illegal */
 #define  ESR_PPR 0x0400 /* Program interrupt - 
privileged */
@@ -637,11 +642,16 @@
 #define  ESR_BO  0x0002 /* Data/instruction 
storage, byte ordering */
 #define  ESR_SPE 0x0080 /* SPE exception bit */
 
+
 #defineSPR_CSRR0   0x03a   /* ..8 58 Critical SRR0 */
 #defineSPR_CSRR1   0x03b   /* ..8 59 Critical SRR1 */
 #defineSPR_MCSRR0  0x23a   /* ..8 570 Machine check SRR0 */
 #defineSPR_MCSRR1  0x23b   /* ..8 571 Machine check SRR1 */
 
+#defineSPR_MMUCSR0 0x3f4   /* ..8 1012 MMU Control and 
Status Register 0 */
+#define  MMUCSR0_L2TLB0_FI 0x04/*  TLB0 flash invalidate */
+#define  MMUCSR0_L2TLB1_FI 0x02/*  TLB1 flash invalidate */
+
 #defineSPR_SVR 0x3ff   /* ..8 1023 System Version 
Register */
 #define  SVR_MPC8533 0x8034
 #define  SVR_MPC8533E0x803c
@@ -661,10 +671,16 @@
 #define  SVR_P2010E  0x80eb
 #define  SVR_P2020   0x80e2
 #define  SVR_P2020E  0x80ea
+#define  SVR_P2041   0x8210
+#define  SVR_P2041E  0x8218
+#define  SVR_P3041   0x8211
+#define  SVR_P3041E  0x8219
 #define  SVR_P4040   0x8200
 #define  SVR_P4040E  0x8208
 #define  SVR_P4080   0x8201
 #define  SVR_P4080E  0x8209
+#define  SVR_P5020   0x8220
+#define  SVR_P5020E  0x8228
 #defineSVR_VER(svr)(((svr) >> 16) & 0x)
 
 #defineSPR_PID00x030   /* ..8 Process ID Register 0 */
@@ -707,6 +723,18 @@
 #defineSPR_MAS50x275   /* ..8 MMU Assist Register 5 
Book-E */
 #defineSPR_MAS60x276   /* ..8 MMU Assist Register 6 
Book-E/e500 */
 #defineSPR_MAS70x3B0   /* ..8 MMU Assist Register 7 
Book-E/e500 */
+#defineSPR_MAS80x155   /* ..8 MMU Assist Register 8 
Book-E/e500 */
+
+#defineSPR_L1CFG0  0x203   /* ..8 L1 cache configuration 
register 0 */
+#defineSPR_L1CFG1  0x204   /* ..8 L1 cache configuration 
register 1 */
+
+#defineSPR_CCR10x378
+#define  CCR1_L2COBE   0x0040
+
+#defineDCR_L2DCDCRAI   0x  /* L2 D-Cache DCR Address 
Pointer */
+#defineDCR_L2DCDCRDI   0x0001  /* L2 D-Cache DCR Data Indirect 
*/
+#defineDCR_L2CR0   0x00/* L2 Cache Configuration 
Register 0 */
+#define  L2CR0_AS  0x3000
 
 #defineSPR_L1CSR0  0x3F2   /* ..8 L1 Cache Control and 
Status Register 0 */
 #define  L1CSR0_DCPE   0x0001  /* Data Cache 

svn commit: r236096 - in stable/9/sys: fs/nfsclient nfsclient

2012-05-26 Thread Rick Macklem
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) !

svn commit: r236097 - in head/sys/powerpc: booke powerpc

2012-05-26 Thread Rafal Jaworowski
Author: raj
Date: Sat May 26 13:36:18 2012
New Revision: 236097
URL: http://svn.freebsd.org/changeset/base/236097

Log:
  Rename e500 prefix to match other Book-E CPU variations. CPU id tidbits for
  the new cores.
  
  Obtained from:Freescale, Semihalf.

Modified:
  head/sys/powerpc/booke/machdep.c
  head/sys/powerpc/booke/platform_bare.c
  head/sys/powerpc/powerpc/cpu.c

Modified: head/sys/powerpc/booke/machdep.c
==
--- head/sys/powerpc/booke/machdep.cSat May 26 13:12:14 2012
(r236096)
+++ head/sys/powerpc/booke/machdep.cSat May 26 13:36:18 2012
(r236097)
@@ -185,8 +185,8 @@ SYSCTL_INT(_machdep, CPU_CACHELINE, cach
 
 int hw_direct_map = 0;
 
-static void cpu_e500_startup(void *);
-SYSINIT(cpu, SI_SUB_CPU, SI_ORDER_FIRST, cpu_e500_startup, NULL);
+static void cpu_booke_startup(void *);
+SYSINIT(cpu, SI_SUB_CPU, SI_ORDER_FIRST, cpu_booke_startup, NULL);
 
 void print_kernel_section_addr(void);
 void print_kenv(void);
@@ -195,7 +195,7 @@ u_int booke_init(uint32_t, uint32_t);
 extern int elf32_nxstack;
 
 static void
-cpu_e500_startup(void *dummy)
+cpu_booke_startup(void *dummy)
 {
int indx, size;
 
@@ -538,7 +538,8 @@ cpu_halt(void)
 {
 
mtmsr(mfmsr() & ~(PSL_CE | PSL_EE | PSL_ME | PSL_DE));
-   while (1);
+   while (1)
+   ;
 }
 
 int

Modified: head/sys/powerpc/booke/platform_bare.c
==
--- head/sys/powerpc/booke/platform_bare.c  Sat May 26 13:12:14 2012
(r236096)
+++ head/sys/powerpc/booke/platform_bare.c  Sat May 26 13:36:18 2012
(r236097)
@@ -73,7 +73,7 @@ static int bare_smp_next_cpu(platform_t,
 static int bare_smp_get_bsp(platform_t, struct cpuref *cpuref);
 static int bare_smp_start_cpu(platform_t, struct pcpu *cpu);
 
-static void e500_reset(platform_t);
+static void booke_reset(platform_t);
 
 static platform_method_t bare_methods[] = {
PLATFORMMETHOD(platform_probe,  bare_probe),
@@ -85,7 +85,7 @@ static platform_method_t bare_methods[] 
PLATFORMMETHOD(platform_smp_get_bsp,bare_smp_get_bsp),
PLATFORMMETHOD(platform_smp_start_cpu,  bare_smp_start_cpu),
 
-   PLATFORMMETHOD(platform_reset,  e500_reset),
+   PLATFORMMETHOD(platform_reset,  booke_reset),
 
{ 0, 0 }
 };
@@ -307,7 +307,7 @@ bare_smp_start_cpu(platform_t plat, stru
 }
 
 static void
-e500_reset(platform_t plat)
+booke_reset(platform_t plat)
 {
 
/*
@@ -328,6 +328,7 @@ e500_reset(platform_t plat)
mtspr(SPR_DBCR0, mfspr(SPR_DBCR0) | DBCR0_IDM | DBCR0_RST_SYSTEM);
 
printf("Reset failed...\n");
-   while (1);
+   while (1)
+   ;
 }
 

Modified: head/sys/powerpc/powerpc/cpu.c
==
--- head/sys/powerpc/powerpc/cpu.c  Sat May 26 13:12:14 2012
(r236096)
+++ head/sys/powerpc/powerpc/cpu.c  Sat May 26 13:36:18 2012
(r236097)
@@ -75,13 +75,13 @@
 #include 
 
 static voidcpu_6xx_setup(int cpuid, uint16_t vers);
-static voidcpu_e500_setup(int cpuid, uint16_t vers);
 static voidcpu_970_setup(int cpuid, uint16_t vers);
+static voidcpu_booke_setup(int cpuid, uint16_t vers);
 
 int powerpc_pow_enabled;
 void (*cpu_idle_hook)(void) = NULL;
 static voidcpu_idle_60x(void);
-static voidcpu_idle_e500(void);
+static voidcpu_idle_booke(void);
 
 struct cputab {
const char  *name;
@@ -146,9 +146,13 @@ static const struct cputab models[] = {
 { "Motorola PowerPC 8245", MPC8245,REVFMT_MAJMIN,
   PPC_FEATURE_HAS_FPU, cpu_6xx_setup },
 { "Freescale e500v1 core", FSL_E500v1, REVFMT_MAJMIN,
-  0, cpu_e500_setup },
+  0, cpu_booke_setup },
 { "Freescale e500v2 core", FSL_E500v2, REVFMT_MAJMIN,
-  0, cpu_e500_setup },
+  0, cpu_booke_setup },
+   { "Freescale e500mc core",  FSL_E500mc, REVFMT_MAJMIN,
+  0, cpu_booke_setup },
+   { "Freescale e5500 core",   FSL_E5500,  REVFMT_MAJMIN,
+  0, cpu_booke_setup },
 { "IBM Cell Broadband Engine", IBMCELLBE,  REVFMT_MAJMIN,
   PPC_FEATURE_64 | PPC_FEATURE_HAS_ALTIVEC | PPC_FEATURE_HAS_FPU,
   NULL},
@@ -191,6 +195,8 @@ cpu_setup(u_int cpuid)
break;
case FSL_E500v1:
case FSL_E500v2:
+   case FSL_E500mc:
+   case FSL_E5500:
maj = (pvr >>  4) & 0xf;
min = (pvr >>  0) & 0xf;
break;
@@ -438,7 +444,7 @@ cpu_6xx_print_cacheinfo(u_int cpuid, uin
 }
 
 static void
-cpu_e500_setup(int cpuid, uint16_t vers)
+cpu_booke_setup(int cpuid, uint16_t vers)
 {
register_t hid0;
 
@@ -453,7 +459,7 @@ cpu_e500_setup(int cpuid, uint16_t vers)
   

svn commit: r236098 - head/sys/powerpc/booke

2012-05-26 Thread Rafal Jaworowski
Author: raj
Date: Sat May 26 13:42:55 2012
New Revision: 236098
URL: http://svn.freebsd.org/changeset/base/236098

Log:
  Retrieve CPU number info from the device tree.
  
  Obtained from:Freescale, Semihalf.

Modified:
  head/sys/powerpc/booke/platform_bare.c

Modified: head/sys/powerpc/booke/platform_bare.c
==
--- head/sys/powerpc/booke/platform_bare.c  Sat May 26 13:36:18 2012
(r236097)
+++ head/sys/powerpc/booke/platform_bare.c  Sat May 26 13:42:55 2012
(r236098)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2008-2009 Semihalf, Rafal Jaworowski
+ * Copyright (c) 2008-2012 Semihalf.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -101,26 +101,16 @@ PLATFORM_DEF(bare_platform);
 static int
 bare_probe(platform_t plat)
 {
-   uint32_t ver, sr;
+   phandle_t cpus, child;
+   uint32_t sr;
int i, law_max, tgt;
 
-   ver = SVR_VER(mfspr(SPR_SVR));
-   switch (ver & ~0x0008) {/* Mask Security Enabled bit */
-   case SVR_P4080:
-   maxcpu = 8;
-   break;
-   case SVR_P4040:
-   maxcpu = 4;
-   break;
-   case SVR_MPC8572:
-   case SVR_P1020:
-   case SVR_P2020:
-   maxcpu = 2;
-   break;
-   default:
+   if ((cpus = OF_finddevice("/cpus")) != 0) {
+   for (maxcpu = 0, child = OF_child(cpus); child != 0;
+   child = OF_peer(child), maxcpu++)
+   ;
+   } else
maxcpu = 1;
-   break;
-   }
 
/*
 * Clear local access windows. Skip DRAM entries, so we don't shoot
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r236099 - in vendor/openpam/dist: . bin bin/openpam_dump_policy bin/pamtest bin/su doc/man include/security lib misc t

2012-05-26 Thread Dag-Erling Smorgrav
Author: des
Date: Sat May 26 14:23:18 2012
New Revision: 236099
URL: http://svn.freebsd.org/changeset/base/236099

Log:
  Vendor import of OpenPAM Micrampelis.

Added:
  vendor/openpam/dist/TODO
  vendor/openpam/dist/bin/openpam_dump_policy/
  vendor/openpam/dist/bin/openpam_dump_policy/Makefile.am
  vendor/openpam/dist/bin/openpam_dump_policy/Makefile.in
  vendor/openpam/dist/bin/openpam_dump_policy/openpam_dump_policy.c
  vendor/openpam/dist/doc/man/openpam_get_feature.3
  vendor/openpam/dist/doc/man/openpam_readlinev.3
  vendor/openpam/dist/doc/man/openpam_readword.3
  vendor/openpam/dist/doc/man/openpam_set_feature.3
  vendor/openpam/dist/doc/man/openpam_straddch.3
  vendor/openpam/dist/lib/openpam_ctype.h
  vendor/openpam/dist/lib/openpam_features.c
  vendor/openpam/dist/lib/openpam_features.h
  vendor/openpam/dist/lib/openpam_get_feature.c
  vendor/openpam/dist/lib/openpam_readlinev.c
  vendor/openpam/dist/lib/openpam_readword.c
  vendor/openpam/dist/lib/openpam_set_feature.c
  vendor/openpam/dist/lib/openpam_straddch.c
  vendor/openpam/dist/lib/openpam_strlcat.h
  vendor/openpam/dist/pamgdb.in
  vendor/openpam/dist/t/
  vendor/openpam/dist/t/Makefile.am
  vendor/openpam/dist/t/Makefile.in
  vendor/openpam/dist/t/t.h
  vendor/openpam/dist/t/t_main.c
  vendor/openpam/dist/t/t_openpam_readlinev.c
  vendor/openpam/dist/t/t_openpam_readword.c
Modified:
  vendor/openpam/dist/CREDITS
  vendor/openpam/dist/HISTORY
  vendor/openpam/dist/LICENSE
  vendor/openpam/dist/Makefile.am
  vendor/openpam/dist/Makefile.in
  vendor/openpam/dist/RELNOTES
  vendor/openpam/dist/aclocal.m4
  vendor/openpam/dist/bin/Makefile.am
  vendor/openpam/dist/bin/Makefile.in
  vendor/openpam/dist/bin/pamtest/pamtest.1
  vendor/openpam/dist/bin/pamtest/pamtest.c
  vendor/openpam/dist/bin/su/su.1
  vendor/openpam/dist/config.h.in
  vendor/openpam/dist/configure
  vendor/openpam/dist/configure.ac
  vendor/openpam/dist/doc/man/Makefile.am
  vendor/openpam/dist/doc/man/Makefile.in
  vendor/openpam/dist/doc/man/openpam.3
  vendor/openpam/dist/doc/man/openpam_borrow_cred.3
  vendor/openpam/dist/doc/man/openpam_free_data.3
  vendor/openpam/dist/doc/man/openpam_free_envlist.3
  vendor/openpam/dist/doc/man/openpam_get_option.3
  vendor/openpam/dist/doc/man/openpam_log.3
  vendor/openpam/dist/doc/man/openpam_nullconv.3
  vendor/openpam/dist/doc/man/openpam_readline.3
  vendor/openpam/dist/doc/man/openpam_restore_cred.3
  vendor/openpam/dist/doc/man/openpam_set_option.3
  vendor/openpam/dist/doc/man/openpam_subst.3
  vendor/openpam/dist/doc/man/openpam_ttyconv.3
  vendor/openpam/dist/doc/man/pam.3
  vendor/openpam/dist/doc/man/pam.conf.5
  vendor/openpam/dist/doc/man/pam_acct_mgmt.3
  vendor/openpam/dist/doc/man/pam_authenticate.3
  vendor/openpam/dist/doc/man/pam_chauthtok.3
  vendor/openpam/dist/doc/man/pam_close_session.3
  vendor/openpam/dist/doc/man/pam_conv.3
  vendor/openpam/dist/doc/man/pam_end.3
  vendor/openpam/dist/doc/man/pam_error.3
  vendor/openpam/dist/doc/man/pam_get_authtok.3
  vendor/openpam/dist/doc/man/pam_get_data.3
  vendor/openpam/dist/doc/man/pam_get_item.3
  vendor/openpam/dist/doc/man/pam_get_user.3
  vendor/openpam/dist/doc/man/pam_getenv.3
  vendor/openpam/dist/doc/man/pam_getenvlist.3
  vendor/openpam/dist/doc/man/pam_info.3
  vendor/openpam/dist/doc/man/pam_open_session.3
  vendor/openpam/dist/doc/man/pam_prompt.3
  vendor/openpam/dist/doc/man/pam_putenv.3
  vendor/openpam/dist/doc/man/pam_set_data.3
  vendor/openpam/dist/doc/man/pam_set_item.3
  vendor/openpam/dist/doc/man/pam_setcred.3
  vendor/openpam/dist/doc/man/pam_setenv.3
  vendor/openpam/dist/doc/man/pam_sm_acct_mgmt.3
  vendor/openpam/dist/doc/man/pam_sm_authenticate.3
  vendor/openpam/dist/doc/man/pam_sm_chauthtok.3
  vendor/openpam/dist/doc/man/pam_sm_close_session.3
  vendor/openpam/dist/doc/man/pam_sm_open_session.3
  vendor/openpam/dist/doc/man/pam_sm_setcred.3
  vendor/openpam/dist/doc/man/pam_start.3
  vendor/openpam/dist/doc/man/pam_strerror.3
  vendor/openpam/dist/doc/man/pam_verror.3
  vendor/openpam/dist/doc/man/pam_vinfo.3
  vendor/openpam/dist/doc/man/pam_vprompt.3
  vendor/openpam/dist/include/security/openpam.h
  vendor/openpam/dist/include/security/openpam_version.h
  vendor/openpam/dist/lib/Makefile.am
  vendor/openpam/dist/lib/Makefile.in
  vendor/openpam/dist/lib/openpam_check_owner_perms.c
  vendor/openpam/dist/lib/openpam_configure.c
  vendor/openpam/dist/lib/openpam_constants.h
  vendor/openpam/dist/lib/openpam_debug.h
  vendor/openpam/dist/lib/openpam_dynamic.c
  vendor/openpam/dist/lib/openpam_get_option.c
  vendor/openpam/dist/lib/openpam_impl.h
  vendor/openpam/dist/lib/openpam_load.c
  vendor/openpam/dist/lib/openpam_log.c
  vendor/openpam/dist/lib/openpam_readline.c
  vendor/openpam/dist/lib/openpam_set_option.c
  vendor/openpam/dist/lib/openpam_strlcmp.h
  vendor/openpam/dist/lib/openpam_strlcpy.h
  vendor/openpam/dist/lib/openpam_subst.c
  vendor/openpam/dist/lib/openpam_ttyconv.c
  vendor/openpam/dist/lib/pam_get_authtok.c
  v

svn commit: r236100 - vendor/openpam/MICRAMPELIS

2012-05-26 Thread Dag-Erling Smorgrav
Author: des
Date: Sat May 26 14:24:14 2012
New Revision: 236100
URL: http://svn.freebsd.org/changeset/base/236100

Log:
  Tag OpenPAM Micrampelis.

Added:
  vendor/openpam/MICRAMPELIS/
 - copied from r236099, vendor/openpam/dist/
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r236101 - head/share/misc

2012-05-26 Thread Gavin Atkinson
Author: gavin
Date: Sat May 26 14:44:18 2012
New Revision: 236101
URL: http://svn.freebsd.org/changeset/base/236101

Log:
  Updates to reflect recent commit bits handed back, etc.
  
  MFC after:1 week

Modified:
  head/share/misc/committers-src.dot

Modified: head/share/misc/committers-src.dot
==
--- head/share/misc/committers-src.dot  Sat May 26 14:24:14 2012
(r236100)
+++ head/share/misc/committers-src.dot  Sat May 26 14:44:18 2012
(r236101)
@@ -39,6 +39,7 @@ billf [label="Bill Fumerola\nbillf@FreeB
 bmah [label="Bruce A. Mah\nb...@freebsd.org\n2002/01/29\n2009/09/13"]
 bmilekic [label="Bosko Milekic\nbmile...@freebsd.org\n2000/09/21\n2008/11/10"]
 bushman [label="Michael Bushkov\nbush...@freebsd.org\n2007/03/10\n2010/04/29"]
+ceri [label="Ceri Davies\nc...@freebsd.org\n2006/11/07\n2012/03/07"]
 cjc [label="Crist J. Clark\n...@freebsd.org\n2001/06/01\n2006/12/29"]
 dds [label="Diomidis Spinellis\n...@freebsd.org\n2003/06/20\n2010/09/22"]
 dhartmei [label="Daniel 
Hartmeier\ndhart...@freebsd.org\n2004/04/06\n2008/12/08"]
@@ -58,20 +59,21 @@ jtc [label="J.T. Conklin\n...@freebsd.or
 kbyanc [label="Kelly Yancey\nkby...@freebsd.org\n2000/07/11\n2006/07/25"]
 keichii [label="Michael Wu\nkeic...@freebsd.org\n2001/03/07\n2006/04/28"]
 linimon [label="Mark Linimon\nlini...@freebsd.org\n2006/09/30\n2008/05/04"]
+lulf [label="Ulf Lilleengen\nl...@freebsd.org\n2007/10/24\n2012/01/19"]
 mb [label="Maxim Bolotin\n...@freebsd.org\n2000/04/06\n2003/03/08"]
 marks [label="Mark Santcroos\nma...@freebsd.org\n2004/03/18\n2008/09/29"]
 mike [label="Mike Barcroft\nm...@freebsd.org\n2001/07/17\n2006/04/28"]
 msmith [label="Mike Smith\nmsm...@freebsd.org\n/??/??\n2003/12/15"]
 murray [label="Murray Stokely\nmur...@freebsd.org\n2000/04/05\n2010/07/25"]
+mux [label="Maxime Henrion\n...@freebsd.org\n2002/03/03\n2011/06/22"]
 nate [label="Nate Willams\nn...@freebsd.org\n1993/06/12\n2003/12/15"]
 njl [label="Nate Lawson\n...@freebsd.org\n2002/08/07\n2008/02/16"]
 non [label="Noriaki Mitsnaga\n...@freebsd.org\n2000/06/19\n2007/03/06"]
 onoe [label="Atsushi Onoe\no...@freebsd.org\n2000/07/21\n2008/11/10"]
+randi [label="Randi Harper\nra...@freebsd.org\n2010/04/20\n2012/05/10"]
 rgrimes [label="Rod Grimes\nrgri...@freebsd.org\n1993/06/12\n2003/03/08"]
 rink [label="Rink Springer\nr...@freebsd.org\n2006/01/16\n2010/11/04"]
 robert [label="Robert Drehmel\nrob...@freebsd.org\n2001/08/23\n2006/05/13"]
-rmh [label="Robert Millan\n...@freebsd.org\n2011/09/18"]
-rpaulo [label="Rui Paulo\nrpa...@freebsd.org\n2007/09/25\n2010/12/03"]
 sah [label="Sam Hopkins\n...@freebsd.org\n2004/12/15\n2008/11/10"]
 shafeeq [label="Shafeeq 
Sinnamohideen\nshaf...@freebsd.org\n2000/06/19\n2006/04/06"]
 sheldonh [label="Sheldon Hearn\nsheld...@freebsd.org\n1999/06/14\n2006/05/13"]
@@ -82,6 +84,7 @@ tmm [label="Thomas Moestl\ntmm@FreeBSD.o
 toshi [label="Toshihiko Arai\nto...@freebsd.org\n2000/07/06\n2003/03/08"]
 tshiozak [label="Takuya 
SHIOZAKI\ntshio...@freebsd.org\n2001/04/25\n2003/03/08"]
 uch [label="UCHIYAMA Yasushi\n...@freebsd.org\n2000/06/21\n2002/04/24"]
+yar [label="Yar Tikhiy\n...@freebsd.org\n2001/03/25\n2012/05/23"]
 
 
 node [color=lightblue2, style=filled, bgcolor=black];
@@ -112,7 +115,6 @@ brueffer [label="Christian Brueffer\nbru
 bruno [label="Bruno Ducrot\nbr...@freebsd.org\n2005/07/18"]
 bschmidt [label="Bernhard Schmidt\nbschm...@freebsd.org\n2010/02/06"]
 bz [label="Bjoern A. Zeeb\n...@freebsd.org\n2004/07/27"]
-ceri [label="Ceri Davies\nc...@freebsd.org\n2006/11/07"]
 cognet [label="Olivier Houchard\ncog...@freebsd.org\n2002/10/09"]
 cokane [label="Coleman Kane\ncok...@freebsd.org\n2000/06/19"]
 cperciva [label="Colin Percival\ncperc...@freebsd.org\n2004/01/20"]
@@ -187,7 +189,6 @@ kib [label="Konstantin Belousov\nkib@Fre
 kmacy [label="Kip Macy\nkm...@freebsd.org\n2005/06/01"]
 le [label="Lukas Ertl\n...@freebsd.org\n2004/02/02"]
 lstewart [label="Lawrence Stewart\nlstew...@freebsd.org\n2008/10/06"]
-lulf [label="Ulf Lilleengen\nl...@freebsd.org\n2007/10/24"]
 marcel [label="Marcel Moolenaar\nmar...@freebsd.org\n1999/07/03"]
 marius [label="Marius Strobl\nmar...@freebsd.org\n2004/04/17"]
 markm [label="Mark Murray\nma...@freebsd.org\n199?/??/??"]
@@ -202,7 +203,6 @@ mjacob [label="Matt Jacob\nmjacob@FreeBS
 mlaier [label="Max Laier\nmla...@freebsd.org\n2004/02/10"]
 monthadar [label="Monthadar Al Jaberi\nmontha...@freebsd.org\n2012/04/02"]
 mr [label="Michael Reifenberger\n...@freebsd.org\n2001/09/30"]
-mux [label="Maxime Henrion\n...@freebsd.org\n2002/03/03"]
 neel [label="Neel Natu\nn...@freebsd.org\n2009/09/20"]
 netchild [label="Alexander Leidinger\nnetch...@freebsd.org\n2005/03/31"]
 nork [label="Norikatsu Shigemura\nn...@freebsd.org\n2009/06/09"]
@@ -213,7 +213,7 @@ olli [label="Oliver Fromme\nolli@FreeBSD
 peadar [label="Peter Edwards\npea...@freebsd.org\n2004/03/08"]
 peter [label="Peter Wemm\npe...@freebsd.org\n/??/??"]
 p

svn commit: r236102 - head/share/misc

2012-05-26 Thread Gavin Atkinson
Author: gavin
Date: Sat May 26 16:26:23 2012
New Revision: 236102
URL: http://svn.freebsd.org/changeset/base/236102

Log:
  Update to reflect various doc commit bits taken into safekeeping.
  
  MFC after:1 week

Modified:
  head/share/misc/committers-doc.dot

Modified: head/share/misc/committers-doc.dot
==
--- head/share/misc/committers-doc.dot  Sat May 26 14:44:18 2012
(r236101)
+++ head/share/misc/committers-doc.dot  Sat May 26 16:26:23 2012
(r236102)
@@ -32,15 +32,19 @@ node [color=grey62, style=filled, bgcolo
 ache [label="Andrey Chernov\na...@freebsd.org\n1997/06/13\n2010/12/11"]
 bmah [label="Bruce A. Mah\nb...@freebsd.org\n2000/08/22\n2009/09/13"]
 bvs [label="Vitaly Bogdanov\n...@freebsd.org\n2005/10/03\n2010/12/11"]
+ceri [label="Ceri Davies\nc...@freebsd.org\n2002/03/17\n2012/02/29"]
 den [label="Denis Peplin\n...@freebsd.org\n2003/09/13\n2009/07/09"]
 garys [label="Gary W. Swearingen\nga...@freebsd.org\n2005/08/21\n2008/03/02"]
 jcamou [label="Jesus R. Camou\njca...@freebsd.org\n2005/03/02\n2008/12/20"]
 jesusr [label="Jesus Rodriguez 
Cuesta\njes...@freebsd.org\n1998/12/10\n2010/12/11"]
 jim [label="Jim Mock\n...@freebsd.org\n1999/08/11\n2003/12/15"]
 josef [label="Josef El-Rayes\njo...@freebsd.org\n2004/01/15\n2008/03/29"]
+marcel [label="Marcel Moolenaar\nmar...@freebsd.org\n1999/07/03\n2012/04/25"]
 mheinen [label="Martin Heinen\nmhei...@freebsd.org\n2002/10/04\n2006/04/26"]
+murray [label="Murray Stokely\nmur...@freebsd.org\n2000/04/05\n2012/04/25"]
 nik [label="Nik Clayton\n...@freebsd.org\n1998/02/26\n2008/12/20"]
 pgj [label="Gabor Pali\n...@freebsd.org\n2008/04/21\n2010/12/01"]
+roam [label="Peter Pentchev\nr...@freebsd.org\n2003/02/14\n2012/02/29"]
 
 node [color=lightblue2, style=filled, bgcolor=black];
 
@@ -51,7 +55,6 @@ bcr [label="Benedict Reuschling\nbcr@Fre
 blackend [label="Marc Fonvieille\nblack...@freebsd.org\n2002/06/16"]
 brd [label="Brad Davis\n...@freebsd.org\n2005/06/01"]
 brueffer [label="Christian Brueffer\nbruef...@freebsd.org\n2003/01/13"]
-ceri [label="Ceri Davies\nc...@freebsd.org\n2002/03/17"]
 chinsan [label="Chinsan Huang\nchin...@freebsd.org\n2006/09/20"]
 danger [label="Daniel Gerzo\ndan...@freebsd.org\n2006/08/20"]
 delphij [label="Xin Li\ndelp...@freebsd.org\n2004/09/14"]
@@ -67,16 +70,13 @@ keramida [label="Giorgos Keramidas\nkera
 linimon [label="Mark Linimon\nlini...@freebsd.org\n2004/03/31"]
 loader [label="Fukang Chen\nloa...@freebsd.org\n2007/07/30"]
 manolis [label="Manolis Kiagias\nmano...@freebsd.org\n2008/05/24"]
-marcel [label="Marcel Moolenaar\nmar...@freebsd.org\n1999/07/03"]
 marck [label="Dmitry Morozovsky\nma...@freebsd.org\n2004/08/10"]
 maxim [label="Maxim Konovalov\nma...@freebsd.org\n2002/02/07"]
 miwi [label="Martin Wilke\nm...@freebsd.org\n2007/10/26"]
-murray [label="Murray Stokely\nmur...@freebsd.org\n2000/04/05"]
 pav [label="Pav Lucistnik\n...@freebsd.org\n2005/08/12"]
 pluknet [label="Sergey Kandaurov\npluk...@freebsd.org\n2012/02/14"]
 remko [label="Remko Lodder\nre...@freebsd.org\n2004/10/16"]
 rene [label="Rene Ladan\nr...@freebsd.org\n2008/11/03"]
-roam [label="Peter Pentchev\nr...@freebsd.org\n2003/02/14"]
 ryusuke [label="Ryusuke Suzuki\nryus...@freebsd.org\n2009/12/21"]
 simon [label="Simon L. Nielsen\nsi...@freebsd.org\n2003/07/20"]
 taras [label="Taras Korenko\nta...@freebsd.org\n2010/06/25"]
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r236103 - stable/9/lib/libfetch

2012-05-26 Thread Dag-Erling Smorgrav
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.cSat May 26 16:26:23 2012
(r236102)
+++ stable/9/lib/libfetch/file.cSat 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.cSat May 26 16:26:23 2012
(r236102)
+++ stable/9/lib/libfetch/http.cSat 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
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscri

svn commit: r236104 - stable/9/lib/libfetch

2012-05-26 Thread Dag-Erling Smorgrav
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) {
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r236105 - stable/9/lib/libfetch

2012-05-26 Thread Dag-Erling Smorgrav
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
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r236106 - head/lib/libpam/modules/pam_ssh

2012-05-26 Thread Dag-Erling Smorgrav
Author: des
Date: Sat May 26 17:03:45 2012
New Revision: 236106
URL: http://svn.freebsd.org/changeset/base/236106

Log:
  Passing NULL as a key casues a segfault when loading SSH 1 keys.  Use
  an empty string instead.

Modified:
  head/lib/libpam/modules/pam_ssh/pam_ssh.c

Modified: head/lib/libpam/modules/pam_ssh/pam_ssh.c
==
--- head/lib/libpam/modules/pam_ssh/pam_ssh.c   Sat May 26 16:42:47 2012
(r236105)
+++ head/lib/libpam/modules/pam_ssh/pam_ssh.c   Sat May 26 17:03:45 2012
(r236106)
@@ -112,7 +112,7 @@ pam_ssh_load_key(const char *dir, const 
 * with an empty passphrase, and if the key is not encrypted,
 * accept only an empty passphrase.
 */
-   key = key_load_private(fn, NULL, &comment);
+   key = key_load_private(fn, "", &comment);
if (key != NULL && !(*passphrase == '\0' && nullok)) {
key_free(key);
return (NULL);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r236108 - stable/9/lib/libfetch

2012-05-26 Thread Dag-Erling Smorgrav
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 += 100;
-   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.cSat May 26 17:07:34 2012
(r236107)
+++ stable/9/lib/libfetch/http.cSat 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);
}
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r236109 - in head: contrib/openpam contrib/openpam/bin contrib/openpam/bin/openpam_dump_policy contrib/openpam/bin/pamtest contrib/openpam/bin/su contrib/openpam/doc/man contrib/openpam...

2012-05-26 Thread Dag-Erling Smorgrav
Author: des
Date: Sat May 26 17:10:16 2012
New Revision: 236109
URL: http://svn.freebsd.org/changeset/base/236109

Log:
  Update to OpenPAM Micrampelis.

Added:
  head/contrib/openpam/TODO
 - copied unchanged from r236101, vendor/openpam/dist/TODO
  head/contrib/openpam/bin/openpam_dump_policy/
 - copied from r236101, vendor/openpam/dist/bin/openpam_dump_policy/
  head/contrib/openpam/doc/man/openpam_get_feature.3
 - copied unchanged from r236101, 
vendor/openpam/dist/doc/man/openpam_get_feature.3
  head/contrib/openpam/doc/man/openpam_readlinev.3
 - copied unchanged from r236101, 
vendor/openpam/dist/doc/man/openpam_readlinev.3
  head/contrib/openpam/doc/man/openpam_readword.3
 - copied unchanged from r236101, 
vendor/openpam/dist/doc/man/openpam_readword.3
  head/contrib/openpam/doc/man/openpam_set_feature.3
 - copied unchanged from r236101, 
vendor/openpam/dist/doc/man/openpam_set_feature.3
  head/contrib/openpam/doc/man/openpam_straddch.3
 - copied unchanged from r236101, 
vendor/openpam/dist/doc/man/openpam_straddch.3
  head/contrib/openpam/lib/openpam_ctype.h
 - copied unchanged from r236101, vendor/openpam/dist/lib/openpam_ctype.h
  head/contrib/openpam/lib/openpam_features.c
 - copied unchanged from r236101, vendor/openpam/dist/lib/openpam_features.c
  head/contrib/openpam/lib/openpam_features.h
 - copied unchanged from r236101, vendor/openpam/dist/lib/openpam_features.h
  head/contrib/openpam/lib/openpam_get_feature.c
 - copied unchanged from r236101, 
vendor/openpam/dist/lib/openpam_get_feature.c
  head/contrib/openpam/lib/openpam_readlinev.c
 - copied unchanged from r236101, 
vendor/openpam/dist/lib/openpam_readlinev.c
  head/contrib/openpam/lib/openpam_readword.c
 - copied unchanged from r236101, vendor/openpam/dist/lib/openpam_readword.c
  head/contrib/openpam/lib/openpam_set_feature.c
 - copied unchanged from r236101, 
vendor/openpam/dist/lib/openpam_set_feature.c
  head/contrib/openpam/lib/openpam_straddch.c
 - copied unchanged from r236101, vendor/openpam/dist/lib/openpam_straddch.c
  head/contrib/openpam/lib/openpam_strlcat.h
 - copied unchanged from r236101, vendor/openpam/dist/lib/openpam_strlcat.h
  head/contrib/openpam/pamgdb.in
 - copied unchanged from r236101, vendor/openpam/dist/pamgdb.in
  head/contrib/openpam/t/
 - copied from r236101, vendor/openpam/dist/t/
  head/usr.bin/pamtest/
  head/usr.bin/pamtest/Makefile   (contents, props changed)
Modified:
  head/contrib/openpam/CREDITS
  head/contrib/openpam/HISTORY
  head/contrib/openpam/LICENSE
  head/contrib/openpam/Makefile.am
  head/contrib/openpam/Makefile.in
  head/contrib/openpam/RELNOTES
  head/contrib/openpam/aclocal.m4
  head/contrib/openpam/bin/Makefile.am
  head/contrib/openpam/bin/Makefile.in
  head/contrib/openpam/bin/pamtest/pamtest.1
  head/contrib/openpam/bin/pamtest/pamtest.c
  head/contrib/openpam/bin/su/su.1
  head/contrib/openpam/config.h.in
  head/contrib/openpam/configure
  head/contrib/openpam/configure.ac
  head/contrib/openpam/doc/man/Makefile.am
  head/contrib/openpam/doc/man/Makefile.in
  head/contrib/openpam/doc/man/openpam.3
  head/contrib/openpam/doc/man/openpam_borrow_cred.3
  head/contrib/openpam/doc/man/openpam_free_data.3
  head/contrib/openpam/doc/man/openpam_free_envlist.3
  head/contrib/openpam/doc/man/openpam_get_option.3
  head/contrib/openpam/doc/man/openpam_log.3
  head/contrib/openpam/doc/man/openpam_nullconv.3
  head/contrib/openpam/doc/man/openpam_readline.3
  head/contrib/openpam/doc/man/openpam_restore_cred.3
  head/contrib/openpam/doc/man/openpam_set_option.3
  head/contrib/openpam/doc/man/openpam_subst.3
  head/contrib/openpam/doc/man/openpam_ttyconv.3
  head/contrib/openpam/doc/man/pam.3
  head/contrib/openpam/doc/man/pam.conf.5
  head/contrib/openpam/doc/man/pam_acct_mgmt.3
  head/contrib/openpam/doc/man/pam_authenticate.3
  head/contrib/openpam/doc/man/pam_chauthtok.3
  head/contrib/openpam/doc/man/pam_close_session.3
  head/contrib/openpam/doc/man/pam_conv.3
  head/contrib/openpam/doc/man/pam_end.3
  head/contrib/openpam/doc/man/pam_error.3
  head/contrib/openpam/doc/man/pam_get_authtok.3
  head/contrib/openpam/doc/man/pam_get_data.3
  head/contrib/openpam/doc/man/pam_get_item.3
  head/contrib/openpam/doc/man/pam_get_user.3
  head/contrib/openpam/doc/man/pam_getenv.3
  head/contrib/openpam/doc/man/pam_getenvlist.3
  head/contrib/openpam/doc/man/pam_info.3
  head/contrib/openpam/doc/man/pam_open_session.3
  head/contrib/openpam/doc/man/pam_prompt.3
  head/contrib/openpam/doc/man/pam_putenv.3
  head/contrib/openpam/doc/man/pam_set_data.3
  head/contrib/openpam/doc/man/pam_set_item.3
  head/contrib/openpam/doc/man/pam_setcred.3
  head/contrib/openpam/doc/man/pam_setenv.3
  head/contrib/openpam/doc/man/pam_sm_acct_mgmt.3
  head/contrib/openpam/doc/man/pam_sm_authenticate.3
  head/contrib/openpam/doc/man/pam_sm_chauthtok.3
  head/contrib/openpam/doc/man/pam_sm_close_session.3
  head/contrib/openpam/doc/man/pam_sm_ope

Re: svn commit: r236026 - in head/sys: amd64/linux32 compat/freebsd32 kern

2012-05-26 Thread Konstantin Belousov
On Sat, May 26, 2012 at 10:21:25PM +1000, Bruce Evans wrote:
> On Fri, 25 May 2012, Ed Schouten wrote:
> 
> >Log:
> > Remove use of non-ISO-C integer types from system call tables.
> >
> > These files already use ISO-C-style integer types, so make them less
> > inconsistent by preferring the standard types.
> 
> These should actually be Linux types l_foo_t.  ISO-C-style integer types
> seem to have only been used for a couple of uintptr_t's, and these uses
> are more than just style bugs on amd64 since uintptr_t is for the host
> (64 bits on amd64) while the target uintptr_t is only 32 bits.  There
> are also a few misuses of the abominable caddr_t instead of l_caddr_t,
> so syscalls that don't even take a caddr_t.  Otherwise, Linux types
> are used a lot to avoid size mismatches.
> 
> >Modified: head/sys/amd64/linux32/syscalls.master
> >==
> >--- head/sys/amd64/linux32/syscalls.master   Fri May 25 21:12:24 2012 
> >(r236025)
> >+++ head/sys/amd64/linux32/syscalls.master   Fri May 25 21:50:48 2012 
> >(r236026)
> >@@ -54,8 +54,8 @@
> > l_int mode); }
> >9AUE_LINKSTD { int linux_link(char *path, char *to); }
> >10   AUE_UNLINK  STD { int linux_unlink(char *path); }
> >-11  AUE_EXECVE  STD { int linux_execve(char *path, u_int32_t 
> >*argp, \
> >-u_int32_t *envp); }
> >+11  AUE_EXECVE  STD { int linux_execve(char *path, uint32_t 
> >*argp, \
> >+uint32_t *envp); }
> 
> argp and envp aren't uintany_t * in either Linux or FreeBSD.  They start as
> "char * const *".  There is no Linux type for an indirect "char *", and one
> was hacked up here by pretending that "char *" is u_int32_t (it is actually
> just 32 bits).  Using l_caddr_t seems to be the best hack available (since
> by abusing l_caddr_t, we know that it is actually char *).
> 
> The `const' in the type for argp and envp is further from being handled
> correctly.  Most or all syscall.master's just type-pun it away.  Similarly
> for "const char *path".
> 
> All the non-indirect "char *"s for pathnames and other things seem to be
> completely wrong on amd64 too.  These pointers start as 32 bits, and it
> takes more than a bad type pun to turn then into kernel 64-bit pointers.
> The magic for this seems to be:
> - all args are converted to 64 bits (by zero-extension?) at a low level
The 'low level' AKA magic happens in several *_fetch_syscall_args()
functions. For both linux32 and freebsd32, the magic code automatically
zero-extends the arguments into 64bit entities. Linux passes args in
registers, while FreeBSD uses words on stack.

The types in the syscalls.master prototype should be in fact selected
to fit the in-kernel prototypes for the functions implementing the syscalls,
esp. for NOPROTO cases, and not to the low-level layout of the syscall
entry data.

> - the args struct for a pathname is
> [left padding]; char *; [right padding];
>   Since the char * is misdeclared, the explicit padding is null, but the
>   layout of the args struct is correct because the wrong arg type in it
>   supplies equivalent padding (extra 32 bits on the right).
The arg struct layout is irrelevant, since fetch_syscall_args() functions
perform the needed translation from process ABI to kernel ABI.

I think that the padding could be completely eliminated for translated
ABI, but since it is easier to reuse makesyscalls.sh instead of creating
ABI-specific script, and since there is quite non-trivial count of NOPROTO
declarations that just match the native-ABI syscall handlers, it is better
not to start that.
> - the "char *" in the args struct is not actually a char *, and is unusable
>   directly in the kernel.  However, it is only used in copyin() and
>   copyout(), where it becomes a user address and works correctly.  (An
>   older bug in this that the user address for copy*() is declared as
>   "void *".  "void *" means a kernel pointer.  The type of a user
>   address should be more like vm_offset_t, but even that needs logical
>   translation for linux32).
It is char *, but in different address space. Linux-style type qualifiers
like __usermode would be appropriate there (remember far/near ?), but
we do not have static checkers that do understand the difference.

> 
> The same mechanism presumably avoids problems when raw caddr_t is used
> instead of l_caddr_t, and when uintptr_t is used instead of l_uintptr_t.
> 
> >12   AUE_CHDIR   STD { int linux_chdir(char *path); }
> >13   AUE_NULLSTD { int linux_time(l_time_t *tm); }
> 
> Example of a correct use of a linux type.  Again, the first-level pointer
> is handled by the above magic, but for the second level we need an l_foo_t
> to describe its size correctly.
> 
> >14   AUE_MKNOD   STD { int linux_mknod(char *path, l_int mode, \
> 
> Broken except in the K&R case, but amd64 is t

svn commit: r236110 - head/usr.bin/fetch

2012-05-26 Thread Dag-Erling Smorgrav
Author: des
Date: Sat May 26 17:19:41 2012
New Revision: 236110
URL: http://svn.freebsd.org/changeset/base/236110

Log:
  Revert r232274 - unauthorized, unnecessary and incorrect.

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

Modified: head/usr.bin/fetch/fetch.1
==
--- head/usr.bin/fetch/fetch.1  Sat May 26 17:10:16 2012(r236109)
+++ head/usr.bin/fetch/fetch.1  Sat May 26 17:19:41 2012(r236110)
@@ -1,5 +1,5 @@
 .\"-
-.\" Copyright (c) 2000-2012 Dag-Erling Smørgrav
+.\" Copyright (c) 2000-2011 Dag-Erling Smørgrav
 .\" All rights reserved.
 .\" Portions Copyright (c) 1999 Massachusetts Institute of Technology; used
 .\" by permission.
@@ -29,7 +29,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd February 28, 2012
+.Dd September 27, 2011
 .Dt FETCH 1
 .Os
 .Sh NAME
@@ -214,11 +214,6 @@ When the
 flag is specified, wait this many seconds between successive retries.
 .El
 .Pp
-.Ar URL
-.Bd -literal
-:(//((:)?@)?(:)?)?/()?
-.Ed
-.Pp
 If
 .Nm
 receives a
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r236111 - stable/9/lib/msun/src

2012-05-26 Thread Dag-Erling Smorgrav
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
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r236112 - stable/9/usr.bin/unzip

2012-05-26 Thread Dag-Erling Smorgrav
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 
- * 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
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r236113 - stable/9/sbin/geom/class/part

2012-05-26 Thread Dag-Erling Smorgrav
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
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r236114 - stable/9/share/mk

2012-05-26 Thread Dag-Erling Smorgrav
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.mkSat May 26 17:38:55 2012
(r236113)
+++ stable/9/share/mk/bsd.lib.mkSat 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}
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r236115 - in stable/9/lib/libpam: . modules

2012-05-26 Thread Dag-Erling Smorgrav
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.incSat May 26 17:53:35 2012
(r236114)
+++ stable/9/lib/libpam/Makefile.incSat 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.incSat May 26 17:53:35 2012
(r236114)
+++ stable/9/lib/libpam/modules/Makefile.incSat 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"
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r236116 - stable/9/lib/libpam/libpam

2012-05-26 Thread Dag-Erling Smorgrav
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
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r236117 - in head/sys: kern sys

2012-05-26 Thread Konstantin Belousov
Author: kib
Date: Sat May 26 20:03:47 2012
New Revision: 236117
URL: http://svn.freebsd.org/changeset/base/236117

Log:
  Stop treating td_sigmask specially for the purposes of new thread
  creation. Move it into the copied region of the struct thread.
  
  Update some comments.
  
  Requested by: bde
  X-MFC after:  never

Modified:
  head/sys/kern/kern_fork.c
  head/sys/kern/kern_kthread.c
  head/sys/kern/kern_thr.c
  head/sys/sys/proc.h

Modified: head/sys/kern/kern_fork.c
==
--- head/sys/kern/kern_fork.c   Sat May 26 18:20:30 2012(r236116)
+++ head/sys/kern/kern_fork.c   Sat May 26 20:03:47 2012(r236117)
@@ -475,7 +475,6 @@ do_fork(struct thread *td, int flags, st
 
bcopy(&p2->p_comm, &td2->td_name, sizeof(td2->td_name));
td2->td_sigstk = td->td_sigstk;
-   td2->td_sigmask = td->td_sigmask;
td2->td_flags = TDF_INMEM;
td2->td_lend_user_pri = PRI_MAX;
 

Modified: head/sys/kern/kern_kthread.c
==
--- head/sys/kern/kern_kthread.cSat May 26 18:20:30 2012
(r236116)
+++ head/sys/kern/kern_kthread.cSat May 26 20:03:47 2012
(r236117)
@@ -271,7 +271,6 @@ kthread_add(void (*func)(void *), void *
 
bzero(&newtd->td_startzero,
__rangeof(struct thread, td_startzero, td_endzero));
-/* XXX check if we should zero. */
bcopy(&oldtd->td_startcopy, &newtd->td_startcopy,
__rangeof(struct thread, td_startcopy, td_endcopy));
 
@@ -295,7 +294,6 @@ kthread_add(void (*func)(void *), void *
/* this code almost the same as create_thread() in kern_thr.c */
PROC_LOCK(p);
p->p_flag |= P_HADTHREADS;
-   newtd->td_sigmask = oldtd->td_sigmask; /* XXX dubious */
thread_link(newtd, p);
thread_lock(oldtd);
/* let the scheduler know about these things. */

Modified: head/sys/kern/kern_thr.c
==
--- head/sys/kern/kern_thr.cSat May 26 18:20:30 2012(r236116)
+++ head/sys/kern/kern_thr.cSat May 26 20:03:47 2012(r236117)
@@ -252,7 +252,6 @@ create_thread(struct thread *td, mcontex
 
PROC_LOCK(td->td_proc);
td->td_proc->p_flag |= P_HADTHREADS;
-   newtd->td_sigmask = td->td_sigmask;
thread_link(newtd, p); 
bcopy(p->p_comm, newtd->td_name, sizeof(newtd->td_name));
thread_lock(td);

Modified: head/sys/sys/proc.h
==
--- head/sys/sys/proc.h Sat May 26 18:20:30 2012(r236116)
+++ head/sys/sys/proc.h Sat May 26 20:03:47 2012(r236117)
@@ -258,7 +258,6 @@ struct thread {
u_int   td_uticks;  /* (t) Statclock hits in user mode. */
int td_intrval; /* (t) Return value for sleepq. */
sigset_ttd_oldsigmask;  /* (k) Saved mask from pre sigpause. */
-   sigset_ttd_sigmask; /* (c) Current signal mask. */
volatile u_int  td_generation;  /* (k) For detection of preemption */
stack_t td_sigstk;  /* (k) Stack ptr and on-stack flag. */
int td_xsig;/* (c) Signal for ptrace */
@@ -272,10 +271,11 @@ struct thread {
struct osd  td_osd; /* (k) Object specific data. */
struct vm_map_entry *td_map_def_user; /* (k) Deferred entries. */
pid_t   td_dbg_forked;  /* (c) Child pid for debugger. */
-#definetd_endzero td_rqindex
+#definetd_endzero td_sigmask
 
-/* Copied during fork1() or thread_sched_upcall(). */
+/* Copied during fork1() or create_thread(). */
 #definetd_startcopy td_endzero
+   sigset_ttd_sigmask; /* (c) Current signal mask. */
u_char  td_rqindex; /* (t) Run queue index. */
u_char  td_base_pri;/* (t) Thread base kernel priority. */
u_char  td_priority;/* (t) Thread active priority. */
@@ -285,7 +285,7 @@ struct thread {
 #definetd_endcopy td_pcb
 
 /*
- * Fields that must be manually set in fork1() or thread_sched_upcall()
+ * Fields that must be manually set in fork1() or create_thread()
  * or already have been set in the allocator, constructor, etc.
  */
struct pcb  *td_pcb;/* (k) Kernel VA of pcb and kstack. */
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r236118 - stable/9/bin/kenv

2012-05-26 Thread Matthew D Fleming
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.1Sat May 26 20:03:47 2012(r236117)
+++ stable/9/bin/kenv/kenv.1Sat 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.cSat May 26 20:03:47 2012(r236117)
+++ stable/9/bin/kenv/kenv.cSat 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);
 }
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubsc

svn commit: r236119 - in head/sys: conf powerpc/mpc85xx powerpc/powerpc

2012-05-26 Thread Rafal Jaworowski
Author: raj
Date: Sat May 26 21:02:49 2012
New Revision: 236119
URL: http://svn.freebsd.org/changeset/base/236119

Log:
  Move OpenPIC FDT bus glue to a shared location, so that other PowerPC
  platforms can use it, not only MPC85XX.
  
  This is just reorg, no functional changes.

Added:
  head/sys/powerpc/powerpc/openpic_fdt.c
 - copied unchanged from r236094, head/sys/powerpc/mpc85xx/openpic_fdt.c
Deleted:
  head/sys/powerpc/mpc85xx/openpic_fdt.c
Modified:
  head/sys/conf/files.powerpc

Modified: head/sys/conf/files.powerpc
==
--- head/sys/conf/files.powerpc Sat May 26 20:13:24 2012(r236118)
+++ head/sys/conf/files.powerpc Sat May 26 21:02:49 2012(r236119)
@@ -132,7 +132,6 @@ powerpc/mpc85xx/isa.c   optionalmpc85xx 
 powerpc/mpc85xx/lbc.c  optionalmpc85xx
 powerpc/mpc85xx/mpc85xx.c  optionalmpc85xx
 powerpc/mpc85xx/nexus.coptionalmpc85xx
-powerpc/mpc85xx/openpic_fdt.c  optionalfdt
 powerpc/mpc85xx/pci_fdt.c  optionalpci mpc85xx
 powerpc/ofw/ofw_cpu.c  optionalaim
 powerpc/ofw/ofw_machdep.c  optionalaim
@@ -194,6 +193,7 @@ powerpc/powerpc/mem.c   optionalmem
 powerpc/powerpc/mmu_if.m   standard
 powerpc/powerpc/mp_machdep.c   optionalsmp
 powerpc/powerpc/openpic.c  standard
+powerpc/powerpc/openpic_fdt.c  optionalfdt
 powerpc/powerpc/pic_if.m   standard
 powerpc/powerpc/pmap_dispatch.cstandard
 powerpc/powerpc/platform.c standard

Copied: head/sys/powerpc/powerpc/openpic_fdt.c (from r236094, 
head/sys/powerpc/mpc85xx/openpic_fdt.c)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/powerpc/powerpc/openpic_fdt.c  Sat May 26 21:02:49 2012
(r236119, copy of r236094, head/sys/powerpc/mpc85xx/openpic_fdt.c)
@@ -0,0 +1,93 @@
+/*-
+ * Copyright (c) 2009-2010 The FreeBSD Foundation
+ * All rights reserved.
+ *
+ * This software was developed by Semihalf 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:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+
+#include "pic_if.h"
+
+static int openpic_fdt_probe(device_t);
+static int openpic_fdt_attach(device_t);
+
+static device_method_t openpic_fdt_methods[] = {
+   /* Device interface */
+   DEVMETHOD(device_probe, openpic_fdt_probe),
+   DEVMETHOD(device_attach,openpic_fdt_attach),
+
+   /* PIC interface */
+   DEVMETHOD(pic_bind, openpic_bind),
+   DEVMETHOD(pic_config,   openpic_config),
+   DEVMETHOD(pic_dispatch, openpic_dispatch),
+   DEVMETHOD(pic_enable,   openpic_enable),
+   DEVMETHOD(pic_eoi,  openpic_eoi),
+   DEVMETHOD(pic_ipi,  openpic_ipi),
+   DEVMETHOD(pic_mask, openpic_mask),
+   DEVMETHOD(pic_unmask,   openpic_unmask),
+
+   { 0, 0 },
+};
+
+static driver_t openpic_fdt_driver = {
+   "openpic",
+   openpic_fdt_methods,
+   sizeof(struct openpic_softc)
+};
+
+DRIVER_MODULE(openpic, simplebus, openpic_fdt_driver, openpic_devclass, 0, 0);
+
+static int
+openpic_fdt_probe(device_t dev)
+{
+
+   if (!ofw_bus_is_compatible(dev, "chrp,open-pic"))
+   return (ENXIO);
+   
+   device_set_desc(dev, OPENPIC_DEVSTR);
+   return (BUS_PROBE_DEFAULT);
+}
+
+static int
+openpic_fdt_attach(device_t de

svn commit: r236120 - head/sys/dev/usb/controller

2012-05-26 Thread Rafal Jaworowski
Author: raj
Date: Sat May 26 21:05:11 2012
New Revision: 236120
URL: http://svn.freebsd.org/changeset/base/236120

Log:
  Import EHCI attachment driver for Freescale integrated controller.
  
  Obtained from:Freescale, Semihalf.
  Written by:   Michal Dubiel

Added:
  head/sys/dev/usb/controller/ehci_fsl.c   (contents, props changed)

Added: head/sys/dev/usb/controller/ehci_fsl.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/dev/usb/controller/ehci_fsl.c  Sat May 26 21:05:11 2012
(r236120)
@@ -0,0 +1,423 @@
+/*-
+ * Copyright (c) 2010-2012 Semihalf
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include "opt_bus.h"
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#include 
+
+#include "opt_platform.h"
+
+/*
+ * Register the driver
+ */
+/* Forward declarations */
+static int fsl_ehci_attach(device_t self);
+static int fsl_ehci_detach(device_t self);
+static int fsl_ehci_probe(device_t self);
+
+static device_method_t ehci_methods[] = {
+   /* Device interface */
+   DEVMETHOD(device_probe, fsl_ehci_probe),
+   DEVMETHOD(device_attach, fsl_ehci_attach),
+   DEVMETHOD(device_detach, fsl_ehci_detach),
+   DEVMETHOD(device_suspend, bus_generic_suspend),
+   DEVMETHOD(device_resume, bus_generic_resume),
+   DEVMETHOD(device_shutdown, bus_generic_shutdown),
+
+   /* Bus interface */
+   DEVMETHOD(bus_print_child, bus_generic_print_child),
+
+   { 0, 0 }
+};
+
+/* kobj_class definition */
+static driver_t ehci_driver = {
+   "ehci",
+   ehci_methods,
+   sizeof(struct ehci_softc)
+};
+
+static devclass_t ehci_devclass;
+
+DRIVER_MODULE(ehci, simplebus, ehci_driver, ehci_devclass, 0, 0);
+MODULE_DEPEND(ehci, usb, 1, 1, 1);
+
+/*
+ * Private defines
+ */
+#define FSL_EHCI_REG_OFF   0x100
+#define FSL_EHCI_REG_SIZE  0x300
+
+/*
+ * Internal interface registers' offsets.
+ * Offsets from 0x000 ehci dev space, big-endian access.
+ */
+enum internal_reg {
+   SNOOP1  = 0x400,
+   SNOOP2  = 0x404,
+   AGE_CNT_THRESH  = 0x408,
+   SI_CTRL = 0x410,
+   CONTROL = 0x500
+};
+
+/* CONTROL register bit flags */
+enum control_flags {
+   USB_EN  = 0x0004,
+   UTMI_PHY_EN = 0x0200,
+   ULPI_INT_EN = 0x0001
+};
+
+/* SI_CTRL register bit flags */
+enum si_ctrl_flags {
+   FETCH_32= 1,
+   FETCH_64= 0
+};
+
+#define SNOOP_RANGE_2GB0x1E
+
+/*
+ * Operational registers' offsets.
+ * Offsets from USBCMD register, little-endian access.
+ */
+enum special_op_reg {
+   USBMODE = 0x0A8,
+   PORTSC  = 0x084,
+   ULPI_VIEWPORT   = 0x70
+};
+
+/* USBMODE register bit flags */
+enum usbmode_flags {
+   HOST_MODE   = 0x3,
+   DEVICE_MODE = 0x2
+};
+
+#definePORT_POWER_MASK 0x1000
+
+/*
+ * Private methods
+ */
+
+static void
+set_to_host_mode(ehci_softc_t *sc)
+{
+   int tmp;
+
+   tmp = bus_space_read_4(sc->sc_io_tag, sc->sc_io_hdl, USBMODE);
+   bus_space_write_4(sc->sc_io_tag, sc->sc_io_hdl, USBMODE, tmp | 
HOST_MODE);
+}
+
+static void
+enable_usb(device_t dev, bus_space_tag_t iot, bus_space_handle_t ioh)
+{
+   int tmp;
+   phandle_t node;
+   char *phy_type;
+
+   phy_type = NULL;
+   tm

svn commit: r236121 - head/sys/powerpc/mpc85xx

2012-05-26 Thread Rafal Jaworowski
Author: raj
Date: Sat May 26 21:07:15 2012
New Revision: 236121
URL: http://svn.freebsd.org/changeset/base/236121

Log:
  Import eSDHC driver for Freescale integrated controller.
  
  Obtained from:Freescale, Semihalf
  Written by:   Michal Dubiel

Added:
  head/sys/powerpc/mpc85xx/fsl_sdhc.c   (contents, props changed)
  head/sys/powerpc/mpc85xx/fsl_sdhc.h   (contents, props changed)

Added: head/sys/powerpc/mpc85xx/fsl_sdhc.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/powerpc/mpc85xx/fsl_sdhc.c Sat May 26 21:07:15 2012
(r236121)
@@ -0,0 +1,1306 @@
+/*-
+ * Copyright (c) 2011-2012 Semihalf
+ * 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.
+ */
+
+/*
+ * Driver for Freescale integrated eSDHC controller.
+ * Limitations:
+ * - No support for multi-block transfers.
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#include "opt_platform.h"
+
+#include "mmcbr_if.h"
+
+#include "fsl_sdhc.h"
+
+#define DEBUG
+#undef DEBUG
+#ifdef DEBUG
+#defineDPRINTF(fmt, arg...)printf("DEBUG %s(): " fmt, 
__FUNCTION__, ##arg)
+#else
+#defineDPRINTF(fmt, arg...)
+#endif
+
+
+/*
+ * Register the driver
+ */
+/* Forward declarations */
+static int fsl_sdhc_probe(device_t);
+static int fsl_sdhc_attach(device_t);
+static int fsl_sdhc_detach(device_t);
+
+static int fsl_sdhc_read_ivar(device_t, device_t, int, uintptr_t *);
+static int fsl_sdhc_write_ivar(device_t, device_t, int, uintptr_t);
+
+static int fsl_sdhc_update_ios(device_t, device_t);
+static int fsl_sdhc_request(device_t, device_t, struct mmc_request *);
+static int fsl_sdhc_get_ro(device_t, device_t);
+static int fsl_sdhc_acquire_host(device_t, device_t);
+static int fsl_sdhc_release_host(device_t, device_t);
+
+static device_method_t fsl_sdhc_methods[] = {
+   /* device_if */
+   DEVMETHOD(device_probe, fsl_sdhc_probe),
+   DEVMETHOD(device_attach, fsl_sdhc_attach),
+   DEVMETHOD(device_detach, fsl_sdhc_detach),
+
+   /* Bus interface */
+   DEVMETHOD(bus_read_ivar, fsl_sdhc_read_ivar),
+   DEVMETHOD(bus_write_ivar, fsl_sdhc_write_ivar),
+
+   /* OFW bus interface */
+   DEVMETHOD(ofw_bus_get_compat,   ofw_bus_gen_get_compat),
+   DEVMETHOD(ofw_bus_get_model,ofw_bus_gen_get_model),
+   DEVMETHOD(ofw_bus_get_name, ofw_bus_gen_get_name),
+   DEVMETHOD(ofw_bus_get_node, ofw_bus_gen_get_node),
+   DEVMETHOD(ofw_bus_get_type, ofw_bus_gen_get_type),
+
+   /* mmcbr_if */
+   DEVMETHOD(mmcbr_update_ios, fsl_sdhc_update_ios),
+   DEVMETHOD(mmcbr_request, fsl_sdhc_request),
+   DEVMETHOD(mmcbr_get_ro, fsl_sdhc_get_ro),
+   DEVMETHOD(mmcbr_acquire_host, fsl_sdhc_acquire_host),
+   DEVMETHOD(mmcbr_release_host, fsl_sdhc_release_host),
+
+   {0, 0},
+};
+
+/* kobj_class definition */
+static driver_t fsl_sdhc_driver = {
+   "sdhci",
+   fsl_sdhc_methods,
+   sizeof(struct fsl_sdhc_softc)
+};
+
+static devclass_t fsl_sdhc_devclass;
+
+DRIVER_MODULE(sdhci, simplebus, fsl_sdhc_driver, fsl_sdhc_devclass, 0, 0);
+
+
+/*
+ * Private methods
+ ***

svn commit: r236122 - head/share/man/man4

2012-05-26 Thread Warren Block
Author: wblock (doc committer)
Date: Sat May 26 21:30:18 2012
New Revision: 236122
URL: http://svn.freebsd.org/changeset/base/236122

Log:
  Wording corrections and simplifications.
  
  Approved by:  gjb (mentor)
  MFC after:3 days

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

Modified: head/share/man/man4/vlan.4
==
--- head/share/man/man4/vlan.4  Sat May 26 21:07:15 2012(r236121)
+++ head/share/man/man4/vlan.4  Sat May 26 21:30:18 2012(r236122)
@@ -79,16 +79,16 @@ to a properly configured switch port.
 The VLAN tag should match one of those set up in the switched
 network.
 .Pp
-Initially
 .Nm
-assumes the same minimum length for tagged and untagged frames.
-This mode is selected by the
+initially assumes the same minimum length for tagged and untagged frames.
+This mode is selected by setting the
 .Xr sysctl 8
 variable
 .Va net.link.vlan.soft_pad
-set to 0 (default).
-However, there are network devices that fail to adjust frame length,
-should it fall below the allowed minimum due to untagging.
+to 0
+.Pq default .
+However, there are network devices that fail to adjust frame length
+when it falls below the allowed minimum due to untagging.
 Such devices should be able to interoperate with
 .Nm
 after changing the value of
@@ -97,7 +97,7 @@ to 1.
 In the latter mode,
 .Nm
 will pad short frames before tagging them
-so that their length stays not less than the minimum value
+so that their length is not less than the minimum value
 after untagging by the non-compliant devices.
 .Sh HARDWARE
 The
@@ -111,7 +111,7 @@ receive and transmit long frames (up to 
 header and FCS).
 The capabilities may be user-controlled by the respective parameters to
 .Xr ifconfig 8 ,
-.Cm vlanhwtag
+.Cm vlanhwtag ,
 and
 .Cm vlanmtu .
 However, a physical interface is not obliged to react to them:
@@ -119,8 +119,8 @@ It may have either capability enabled pe
 a way to turn it off.
 The whole issue is very specific to a particular device and its driver.
 .Pp
-By now, the list of physical interfaces able of full VLAN processing
-in the hardware is limited to the following devices:
+At present, physical interfaces capable of full VLAN processing
+in the hardware is limited to these devices:
 .Xr ae 4 ,
 .Xr age 4 ,
 .Xr alc 4 ,
@@ -146,11 +146,10 @@ in the hardware is limited to the follow
 and
 .Xr vge 4 .
 .Pp
-The rest of the Ethernet interfaces can run
-VLANs using software emulation in the
+Other Ethernet interfaces can run VLANs using software emulation in the
 .Nm
 driver.
-However, some of them lack the capability
+However, some lack the capability
 of transmitting and receiving long frames.
 Assigning such an interface as the parent to
 .Nm
@@ -163,9 +162,8 @@ connectivity problems due to massive, in
 .Xr icmp 4
 filtering that breaks the Path MTU Discovery mechanism.
 .Pp
-The following interfaces support long frames for
-.Nm
-natively:
+These interfaces natively support long frames for
+.Nm :
 .Xr axe 4 ,
 .Xr bfe 4 ,
 .Xr cas 4 ,
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r236026 - in head/sys: amd64/linux32 compat/freebsd32 kern

2012-05-26 Thread Bruce Evans

On Sat, 26 May 2012, Konstantin Belousov wrote:


On Sat, May 26, 2012 at 10:21:25PM +1000, Bruce Evans wrote:


Please don't quote the whole thing.


On Fri, 25 May 2012, Ed Schouten wrote:


Log:
Remove use of non-ISO-C integer types from system call tables.

These files already use ISO-C-style integer types, so make them less
inconsistent by preferring the standard types.


These should actually be Linux types l_foo_t.  ISO-C-style integer types
[... but only in the low-level linux headers where this is possible]



Modified: head/sys/amd64/linux32/syscalls.master
==
--- head/sys/amd64/linux32/syscalls.master  Fri May 25 21:12:24 2012
(r236025)
+++ head/sys/amd64/linux32/syscalls.master  Fri May 25 21:50:48 2012
(r236026)
@@ -54,8 +54,8 @@
l_int mode); }
9   AUE_LINKSTD { int linux_link(char *path, char *to); }
10  AUE_UNLINK  STD { int linux_unlink(char *path); }
-11 AUE_EXECVE  STD { int linux_execve(char *path, u_int32_t
*argp, \
-   u_int32_t *envp); }
+11 AUE_EXECVE  STD { int linux_execve(char *path, uint32_t
*argp, \
+   uint32_t *envp); }


argp and envp aren't uintany_t * in either Linux or FreeBSD.  They start as
"char * const *".  There is no Linux type for an indirect "char *", and one
was hacked up here by pretending that "char *" is u_int32_t (it is actually
just 32 bits).  Using l_caddr_t seems to be the best hack available (since
by abusing l_caddr_t, we know that it is actually char *).

The `const' in the type for argp and envp is further from being handled
correctly.  Most or all syscall.master's just type-pun it away.  Similarly
for "const char *path".

All the non-indirect "char *"s for pathnames and other things seem to be
completely wrong on amd64 too.  These pointers start as 32 bits, and it
takes more than a bad type pun to turn then into kernel 64-bit pointers.
The magic for this seems to be:
- all args are converted to 64 bits (by zero-extension?) at a low level
...

The 'low level' AKA magic happens in several *_fetch_syscall_args()
functions. For both linux32 and freebsd32, the magic code automatically
zero-extends the arguments into 64bit entities. Linux passes args in
registers, while FreeBSD uses words on stack.


Actually, the amd64 linux_fetch32_fetch_syscall_args() just copies from
64-bit registers frame->tf_r* to 64-bit sa->args[*].  I can't see how
this gives anything except garbage in the top bits.  Is there magic in
the switch to 64-bit mode that sets the top bits?  Anyway, sign extension
would give garbage for unsigned args, and zero-extension would give
garbage for negative signed args.

The amd64 ia32_fetch_syscall_args() is quite different.  Now the args
stack as 32 bits on the stack, so normal C accesses naturally extend
them when assigning them to 64-bit memory sa->args[*].  The stack is
in user space, so normal C accesses are unavailable at first.  sa->code
is read using fuword32(), which gives zero-extension.  Then the stack
is copied in and normal C accesses become available.  Finally, all
args are copied from 32-bit args[i] to 64-bit sa->args[i].  args[i]
is u_int32_t, so this indeed gives zero-extension.  But args[i] is
signed (int64_t), since it is register_t which is bogusly signed.
So for negative args, overflow occurs when int32_t accessed as u_int32_t
via the type pun in the declaration of args[].  There is no further
overflow when the result is assigned to sa->args[i], but the result
is wrong (no longer negative).  It takes further magic to undo this.

BTW, struct syscall_args has bad names and formatting.  It is missing
indentation and sa_prefixes for all its members.  These bugs are missing
for the 64-bit register side of the copy (struct trapframe).


The types in the syscalls.master prototype should be in fact selected
to fit the in-kernel prototypes for the functions implementing the syscalls,


No, they have to match the types actually passed so as to ignore any
garbage bits created by previous magic steps.  The lower levels cannot
do a correct conversion since they don't have access to the type info
generated from syscalls.master, and they shouldn't do a correct conversion
since this is easier to do later -- only the functions implementing the
syscalls can do it easily.  The type info is mostly encoded in syscall
args structs for the individual functions, in a way that the conversions
only need to access fields in the structs to do the conversions (this
only works for simple conversions but handles ignoring any leading and
trailing bits up to reasonably boundaries, since this is needed for
endianness handling).


esp. for NOPROTO cases, and not to the low-level layout of the syscall
entry data.


Of course the layout must match the one actually used by the function
implementing the syscall.  For NOPROTO cases

svn commit: r236123 - stable/9/sys/i386/i386

2012-05-26 Thread Alan Cox
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;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r236124 - vendor/openpam/dist/lib

2012-05-26 Thread Dag-Erling Smorgrav
Author: des
Date: Sat May 26 23:07:45 2012
New Revision: 236124
URL: http://svn.freebsd.org/changeset/base/236124

Log:
  OpenPAM Micrampelis was re-rolled due to a showstopper bug.

Modified:
  vendor/openpam/dist/lib/openpam_configure.c

Modified: vendor/openpam/dist/lib/openpam_configure.c
==
--- vendor/openpam/dist/lib/openpam_configure.c Sat May 26 22:47:56 2012
(r236123)
+++ vendor/openpam/dist/lib/openpam_configure.c Sat May 26 23:07:45 2012
(r236124)
@@ -32,7 +32,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $Id: openpam_configure.c 601 2012-04-14 20:37:45Z des $
+ * $Id: openpam_configure.c 612 2012-05-26 23:02:55Z des $
  */
 
 #ifdef HAVE_CONFIG_H
@@ -261,6 +261,8 @@ openpam_parse_chain(pam_handle_t *pamh,
this->optc = wordc - i;
for (i = 0; i < wordc - this->optc; ++i) {
FREE(wordv[i]);
+   }
+   for (i = 0; i < this->optc; ++i) {
wordv[i] = wordv[wordc - this->optc + i];
wordv[wordc - this->optc + i] = NULL;
}
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r236125 - vendor/openpam/MICRAMPELIS/lib

2012-05-26 Thread Dag-Erling Smorgrav
Author: des
Date: Sat May 26 23:08:53 2012
New Revision: 236125
URL: http://svn.freebsd.org/changeset/base/236125

Log:
  OpenPAM Micrampelis was re-rolled due to a showstopper bug.

Modified:
  vendor/openpam/MICRAMPELIS/lib/openpam_configure.c
Directory Properties:
  vendor/openpam/MICRAMPELIS/   (props changed)

Modified: vendor/openpam/MICRAMPELIS/lib/openpam_configure.c
==
--- vendor/openpam/MICRAMPELIS/lib/openpam_configure.c  Sat May 26 23:07:45 
2012(r236124)
+++ vendor/openpam/MICRAMPELIS/lib/openpam_configure.c  Sat May 26 23:08:53 
2012(r236125)
@@ -32,7 +32,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $Id: openpam_configure.c 601 2012-04-14 20:37:45Z des $
+ * $Id: openpam_configure.c 612 2012-05-26 23:02:55Z des $
  */
 
 #ifdef HAVE_CONFIG_H
@@ -261,6 +261,8 @@ openpam_parse_chain(pam_handle_t *pamh,
this->optc = wordc - i;
for (i = 0; i < wordc - this->optc; ++i) {
FREE(wordv[i]);
+   }
+   for (i = 0; i < this->optc; ++i) {
wordv[i] = wordv[wordc - this->optc + i];
wordv[wordc - this->optc + i] = NULL;
}
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r236126 - head/contrib/openpam/lib

2012-05-26 Thread Dag-Erling Smorgrav
Author: des
Date: Sat May 26 23:10:21 2012
New Revision: 236126
URL: http://svn.freebsd.org/changeset/base/236126

Log:
  OpenPAM Micrampelis was re-rolled due to a showstopper bug.

Modified:
  head/contrib/openpam/lib/openpam_configure.c
Directory Properties:
  head/contrib/openpam/   (props changed)

Modified: head/contrib/openpam/lib/openpam_configure.c
==
--- head/contrib/openpam/lib/openpam_configure.cSat May 26 23:08:53 
2012(r236125)
+++ head/contrib/openpam/lib/openpam_configure.cSat May 26 23:10:21 
2012(r236126)
@@ -32,7 +32,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $Id: openpam_configure.c 601 2012-04-14 20:37:45Z des $
+ * $Id: openpam_configure.c 612 2012-05-26 23:02:55Z des $
  */
 
 #ifdef HAVE_CONFIG_H
@@ -261,6 +261,8 @@ openpam_parse_chain(pam_handle_t *pamh,
this->optc = wordc - i;
for (i = 0; i < wordc - this->optc; ++i) {
FREE(wordv[i]);
+   }
+   for (i = 0; i < this->optc; ++i) {
wordv[i] = wordv[wordc - this->optc + i];
wordv[wordc - this->optc + i] = NULL;
}
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r236127 - stable/8/sys/i386/i386

2012-05-26 Thread Alan Cox
Author: alc
Date: Sat May 26 23:10:36 2012
New Revision: 236127
URL: http://svn.freebsd.org/changeset/base/236127

Log:
  MFC r228513
Create large page mappings in pmap_map().

Modified:
  stable/8/sys/i386/i386/pmap.c
Directory Properties:
  stable/8/sys/   (props changed)

Modified: stable/8/sys/i386/i386/pmap.c
==
--- stable/8/sys/i386/i386/pmap.c   Sat May 26 23:10:21 2012
(r236126)
+++ stable/8/sys/i386/i386/pmap.c   Sat May 26 23:10:36 2012
(r236127)
@@ -1424,12 +1424,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;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r236128 - stable/9

2012-05-26 Thread Dag-Erling Smorgrav
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} < 96
 _lex=  usr.bin/lex
+.endif
+
+.if ${BOOTSTRAPPING} < 96 || ${BOOTSTRAPPING} > 112
 _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 \
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r236129 - stable/9

2012-05-26 Thread Dag-Erling Smorgrav
Author: des
Date: Sat May 26 23:48:56 2012
New Revision: 236129
URL: http://svn.freebsd.org/changeset/base/236129

Log:
  nit: use >= 113 instead of > 112

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} < 96 || ${BOOTSTRAPPING} > 112
+.if ${BOOTSTRAPPING} < 96 || ${BOOTSTRAPPING} >= 113
 _yacc= usr.bin/yacc
 .endif
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r236130 - head/sys/netinet6

2012-05-26 Thread Bjoern A. Zeeb
Author: bz
Date: Sat May 26 23:58:51 2012
New Revision: 236130
URL: http://svn.freebsd.org/changeset/base/236130

Log:
  Correctly get the payload length in host byte order.  While we
  already plan to support >64k payload here, the IPv6 header payload
  length obviously is only 16 bit and the calculations need to be right.
  
  Reported by:  dim
  Tested by:dim
  MFC after:1 day
  X-MFC:with r235958

Modified:
  head/sys/netinet6/ip6_output.c

Modified: head/sys/netinet6/ip6_output.c
==
--- head/sys/netinet6/ip6_output.c  Sat May 26 23:48:56 2012
(r236129)
+++ head/sys/netinet6/ip6_output.c  Sat May 26 23:58:51 2012
(r236130)
@@ -189,13 +189,13 @@ in6_delayed_cksum(struct mbuf *m, uint32
 {
u_short csum;
 
-   csum = in_cksum_skip(m, ntohl(plen), offset);
+   csum = in_cksum_skip(m, offset + plen, offset);
if (m->m_pkthdr.csum_flags & CSUM_UDP && csum == 0)
csum = 0x;
offset += m->m_pkthdr.csum_data;/* checksum offset */
 
if (offset + sizeof(u_short) > m->m_len) {
-   printf("%s: delayed m_pullup, m->len: %d  off: %d\n",
+   printf("%s: delayed m_pullup, m->len: %d off: %d\n",
__func__, m->m_len, offset);
/*
 * XXX this should not happen, but if it does, the correct
@@ -962,7 +962,7 @@ passout:
 */
if (sw_csum & CSUM_DELAY_DATA) {
sw_csum &= ~CSUM_DELAY_DATA;
-   in6_delayed_cksum(m, ip6->ip6_plen, sizeof(struct ip6_hdr));
+   in6_delayed_cksum(m, plen, sizeof(struct ip6_hdr));
}
 #ifdef SCTP
if (sw_csum & CSUM_SCTP) {
@@ -1077,7 +1077,7 @@ passout:
 * XXX-BZ handle the hw offloading case.  Need flags.
 */
if (m->m_pkthdr.csum_flags & CSUM_DELAY_DATA) {
-   in6_delayed_cksum(m, ip6->ip6_plen, sizeof(*ip6));
+   in6_delayed_cksum(m, plen, hlen);
m->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA;
}
 #ifdef SCTP
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r236131 - stable/8

2012-05-26 Thread Dag-Erling Smorgrav
Author: des
Date: Sun May 27 00:21:27 2012
New Revision: 236131
URL: http://svn.freebsd.org/changeset/base/236131

Log:
  Make yacc a bootstrap tool if building on head, since the new yacc is
  not 100% backward compatible.

Modified:
  stable/8/Makefile.inc1

Modified: stable/8/Makefile.inc1
==
--- stable/8/Makefile.inc1  Sat May 26 23:58:51 2012(r236130)
+++ stable/8/Makefile.inc1  Sun May 27 00:21:27 2012(r236131)
@@ -934,6 +934,10 @@ _ar=   usr.bin/ar
 _lex=  usr.bin/lex
 .endif
 
+.if ${BOOTSTRAPPING} >= 113
+_yacc= usr.bin/yacc
+.endif
+
 .if ${BOOTSTRAPPING} < 800013
 _mklocale= usr.bin/mklocale
 .endif
@@ -959,6 +963,7 @@ bootstrap-tools:
 ${_gperf} \
 ${_groff} \
 ${_ar} \
+${_yacc} \
 ${_lex} \
 usr.bin/lorder \
 usr.bin/makewhatis \
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r236132 - stable/8/usr.sbin/config

2012-05-26 Thread Ryan Stone
Author: rstone
Date: Sun May 27 00:34:56 2012
New Revision: 236132
URL: http://svn.freebsd.org/changeset/base/236132

Log:
  MFC 227429
  
   The generated Makefile for the kernel was not running ctfconvert on
   object files corresponding to source files that had the compile-with
   option set in conf/files.  This means that any fbt probes for functions
   in that object file would not have correct argument types.
  
   The fix is to run ctfconvert on any target file that does not have the
   no-obj option set in files.
  
  PR:   bin/160275
  Reported by:  Paul Ambrose (ambrosehua AT gmail DOT com)

Modified:
  stable/8/usr.sbin/config/mkmakefile.c
Directory Properties:
  stable/8/usr.sbin/config/   (props changed)

Modified: stable/8/usr.sbin/config/mkmakefile.c
==
--- stable/8/usr.sbin/config/mkmakefile.c   Sun May 27 00:21:27 2012
(r236131)
+++ stable/8/usr.sbin/config/mkmakefile.c   Sun May 27 00:34:56 2012
(r236132)
@@ -742,15 +742,20 @@ do_rules(FILE *f)
break;
}
snprintf(cmd, sizeof(cmd),
-   "${%s_%c%s}\n.if defined(NORMAL_CTFCONVERT) && "
-   "!empty(NORMAL_CTFCONVERT)\n"
-   "\t${NORMAL_CTFCONVERT}\n.endif", ftype,
+   "${%s_%c%s}\n", ftype,
toupper(och),
ftp->f_flags & NOWERROR ? "_NOWERROR" : "");
compilewith = cmd;
}
*cp = och;
-   fprintf(f, "\t%s\n\n", compilewith);
+   fprintf(f, "\t%s\n", compilewith);
+
+   if (!(ftp->f_flags & NO_OBJ))
+   fprintf(f, ".if defined(NORMAL_CTFCONVERT) && "
+   "!empty(NORMAL_CTFCONVERT)\n"
+   "\t${NORMAL_CTFCONVERT}\n.endif\n\n");
+   else
+   fprintf(f, "\n");
}
 }
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r236133 - stable/8/sys/cddl/dev/dtrace/i386

2012-05-26 Thread Ryan Stone
Author: rstone
Date: Sun May 27 00:38:36 2012
New Revision: 236133
URL: http://svn.freebsd.org/changeset/base/236133

Log:
  MFC 227430
  
   On i386, fbt probes are implemented by writing an invalid opcode over
   certain instructions in a function prologue or epilogue.  DTrace has a
   hook into the invalid opcode fault handler that checks whether the fault
   was due to an probe and if so, runs the DTrace magic.
  
   Upon returning from an invalid opcode fault caused by a probe, DTrace must
   emulate the instruction that was replaced with the invalid opcode and then
   return control to the instruction following the invalid opcode.
  
   There were a pair of related bugs in the emulation for the leave
   instruction.  The leave instruction is used to pop off a stack frame prior
   to returning from a function.  The emulation for this instruction must
   move the trap frame for the invalid opcode fault down the stack to the
   bottom of the stack frame that is being removed, and then execute an iret.
  
   At two points in this process, the emulation code was storing values above
   the current value of the stack pointer.  This opened up a window in which
   if we were two take an interrupt, the trap frame for the interrupt would
   overwrite the values stored on the stack, causing the system to panic
   later.
  
   The first bug was that at one point the emulation code saves the new value
   for $esp above the current stack pointer value.  The fix is to save this
   value instead inside of the original trap frame.  At this point we do
   not need the original trap frame so this is safe.
  
   The second bug is that when the emulate code loads $esp from the stack, it
   points part-way through the new trap frame instead of at its beginning.
   The emulation code adjusts the stack pointer to the correct value
   immediately afterwards, but this still leaves a one instruction window in
   which an interrupt would corrupt this trap frame.  Fix this by adjusting
   the stack frame value before loading it into $esp.
  
   This fixes panics in invop_leave on i386 when using fbt return probes.
  
   Reviewed by:  rpaulo, attilio

Modified:
  stable/8/sys/cddl/dev/dtrace/i386/dtrace_asm.S
Directory Properties:
  stable/8/sys/   (props changed)

Modified: stable/8/sys/cddl/dev/dtrace/i386/dtrace_asm.S
==
--- stable/8/sys/cddl/dev/dtrace/i386/dtrace_asm.S  Sun May 27 00:34:56 
2012(r236132)
+++ stable/8/sys/cddl/dev/dtrace/i386/dtrace_asm.S  Sun May 27 00:38:36 
2012(r236133)
@@ -125,11 +125,11 @@ invop_leave:
movl8(%esp), %eax   /* load calling EIP */
incl%eax/* increment over LOCK prefix */
movl%eax, -8(%ebx)  /* store calling EIP */
-   movl%ebx, -4(%esp)  /* temporarily store new %esp */
+   subl$8, %ebx/* adjust for three pushes, one pop */
+   movl%ebx, 8(%esp)   /* temporarily store new %esp */
popl%ebx/* pop off temp */
popl%eax/* pop off temp */
-   movl-12(%esp), %esp /* set stack pointer */
-   subl$8, %esp/* adjust for three pushes, one pop */
+   movl(%esp), %esp/* set stack pointer */
iret/* return from interrupt */
 invop_nop:
/*
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r236134 - stable/9/sys/fs/nfsserver

2012-05-26 Thread Rick Macklem
Author: rmacklem
Date: Sun May 27 01:24:08 2012
New Revision: 236134
URL: http://svn.freebsd.org/changeset/base/236134

Log:
  MFC: r234740
  Fix a leak of namei lookup path buffers that occurs when a
  ZFS volume is exported via the new NFS server. The leak occurred
  because the new NFS server code didn't handle the case where
  a file system sets the SAVENAME flag in its VOP_LOOKUP() and
  ZFS does this for the DELETE case.

Modified:
  stable/9/sys/fs/nfsserver/nfs_nfsdport.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/nfsserver/nfs_nfsdport.c
==
--- stable/9/sys/fs/nfsserver/nfs_nfsdport.cSun May 27 00:38:36 2012
(r236133)
+++ stable/9/sys/fs/nfsserver/nfs_nfsdport.cSun May 27 01:24:08 2012
(r236134)
@@ -1047,6 +1047,8 @@ nfsvno_removesub(struct nameidata *ndp, 
else
vput(ndp->ni_dvp);
vput(vp);
+   if ((ndp->ni_cnd.cn_flags & SAVENAME) != 0)
+   nfsvno_relpathbuf(ndp);
NFSEXITCODE(error);
return (error);
 }
@@ -1086,6 +1088,8 @@ out:
else
vput(ndp->ni_dvp);
vput(vp);
+   if ((ndp->ni_cnd.cn_flags & SAVENAME) != 0)
+   nfsvno_relpathbuf(ndp);
NFSEXITCODE(error);
return (error);
 }
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r236135 - head/lib/libthr/thread

2012-05-26 Thread David Xu
Author: davidxu
Date: Sun May 27 01:24:51 2012
New Revision: 236135
URL: http://svn.freebsd.org/changeset/base/236135

Log:
  Return EBUSY for PTHREAD_MUTEX_ADAPTIVE_NP too when the mutex could not
  be acquired.
  
  PR:   168317
  MFC after:3 days

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

Modified: head/lib/libthr/thread/thr_mutex.c
==
--- head/lib/libthr/thread/thr_mutex.c  Sun May 27 01:24:08 2012
(r236134)
+++ head/lib/libthr/thread/thr_mutex.c  Sun May 27 01:24:51 2012
(r236135)
@@ -538,6 +538,7 @@ mutex_self_trylock(struct pthread_mutex 
switch (PMUTEX_TYPE(m->m_flags)) {
case PTHREAD_MUTEX_ERRORCHECK:
case PTHREAD_MUTEX_NORMAL:
+   case PTHREAD_MUTEX_ADAPTIVE_NP:
ret = EBUSY; 
break;
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r236136 - in head/sys: compat/freebsd32 kern

2012-05-26 Thread Konstantin Belousov
Author: kib
Date: Sun May 27 05:24:53 2012
New Revision: 236136
URL: http://svn.freebsd.org/changeset/base/236136

Log:
  Fix ki_cow for compat32 binaries.
  
  MFC after:3 days

Modified:
  head/sys/compat/freebsd32/freebsd32.h
  head/sys/kern/kern_proc.c

Modified: head/sys/compat/freebsd32/freebsd32.h
==
--- head/sys/compat/freebsd32/freebsd32.h   Sun May 27 01:24:51 2012
(r236135)
+++ head/sys/compat/freebsd32/freebsd32.h   Sun May 27 05:24:53 2012
(r236136)
@@ -306,7 +306,7 @@ struct kinfo_proc32 {
u_int   ki_estcpu;
u_int   ki_slptime;
u_int   ki_swtime;
-   int ki_spareint1;
+   u_int   ki_cow;
u_int64_t ki_runtime;
struct  timeval32 ki_start;
struct  timeval32 ki_childtime;

Modified: head/sys/kern/kern_proc.c
==
--- head/sys/kern/kern_proc.c   Sun May 27 01:24:51 2012(r236135)
+++ head/sys/kern/kern_proc.c   Sun May 27 05:24:53 2012(r236136)
@@ -1136,6 +1136,7 @@ freebsd32_kinfo_proc_out(const struct ki
CP(*ki, *ki32, ki_estcpu);
CP(*ki, *ki32, ki_slptime);
CP(*ki, *ki32, ki_swtime);
+   CP(*ki, *ki32, ki_cow);
CP(*ki, *ki32, ki_runtime);
TV_CP(*ki, *ki32, ki_start);
TV_CP(*ki, *ki32, ki_childtime);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r236137 - head/contrib/gcc/config/i386

2012-05-26 Thread Konstantin Belousov
Author: kib
Date: Sun May 27 05:27:47 2012
New Revision: 236137
URL: http://svn.freebsd.org/changeset/base/236137

Log:
  Enable gnu hash generation for dynamic ELF binaries on x86.
  
  Reviewed by:  kan

Modified:
  head/contrib/gcc/config/i386/freebsd.h
  head/contrib/gcc/config/i386/freebsd64.h

Modified: head/contrib/gcc/config/i386/freebsd.h
==
--- head/contrib/gcc/config/i386/freebsd.h  Sun May 27 05:24:53 2012
(r236136)
+++ head/contrib/gcc/config/i386/freebsd.h  Sun May 27 05:27:47 2012
(r236137)
@@ -49,6 +49,7 @@ Boston, MA 02110-1301, USA.  */
%{rdynamic: -export-dynamic} \
%{!dynamic-linker:-dynamic-linker %(fbsd_dynamic_linker) }} \
   %{static:-Bstatic}} \
+%{!static:--hash-style=both} \
 %{symbolic:-Bsymbolic}"
 
 /* Reset our STARTFILE_SPEC which was properly set in config/freebsd.h

Modified: head/contrib/gcc/config/i386/freebsd64.h
==
--- head/contrib/gcc/config/i386/freebsd64.hSun May 27 05:24:53 2012
(r236136)
+++ head/contrib/gcc/config/i386/freebsd64.hSun May 27 05:27:47 2012
(r236137)
@@ -54,4 +54,5 @@ Boston, MA 02110-1301, USA.  */
 %{rdynamic:-export-dynamic} \
%{!dynamic-linker:-dynamic-linker %(fbsd_dynamic_linker) }} \
 %{static:-Bstatic}} \
+  %{!static:--hash-style=both} \
   %{symbolic:-Bsymbolic}"
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r236138 - head/sys/cam/scsi

2012-05-26 Thread Kenneth D. Merry
Author: ken
Date: Sun May 27 06:11:09 2012
New Revision: 236138
URL: http://svn.freebsd.org/changeset/base/236138

Log:
  Work around a race condition in devfs by changing the way closes
  are handled in most CAM peripheral drivers that are not handled by
  GEOM's disk class.
  
  The usual character driver open and close semantics are that the
  driver gets N open calls, but only one close, when the last caller
  closes the device.
  
  CAM peripheral drivers expect that behavior to be honored to the
  letter, and the CAM peripheral driver code (specifically
  cam_periph_release_locked_busses()) panics if it is done incorrectly.
  
  Since devfs has to drop its locks while it calls a driver's close
  routine, and it does not have a way to delay or prevent open calls
  while it is calling the close routine, there is a race.
  
  The sequence of events, simplified a bit, is:
  
  - devfs acquires a lock
  - devfs checks the reference count, and if it is 1, continues to close.
  - devfs releases the lock
  
  - 2nd process open call on the device happens here
  
  - devfs calls the driver's close routine
  
  - devfs acquires a lock
  - devfs decrements the reference count
  - devfs releases the lock
  
  - 2nd process close call on the device happens here
  
  At the second close, we get a panic in
  cam_periph_release_locked_busses(), complaining that peripheral
  has been released when the reference count is already 0.  This is
  because we have gotten two closes in a row, which should not
  happen.
  
  The fix is to add the D_TRACKCLOSE flag to the driver's cdevsw, so
  that we get a close() call for each open().  That does happen
  reliably, so we can make sure that our reference counts are
  correct.
  
  Note that the sa(4) and pt(4) drivers only allow one context
  through the open routine.  So these drivers aren't exposed to the
  same race condition.
  
  scsi_ch.c,
  scsi_enc.c,
  scsi_enc_internal.h,
  scsi_pass.c,
  scsi_sg.c:
For these drivers, change the open() routine to
increment the reference count for every open, and
just decrement the reference count in the close.
  
Call cam_periph_release_locked() in some scenarios
to avoid additional lock and unlock calls.
  
  scsi_pt.c:Call cam_periph_release_locked() in some scenarios
to avoid additional lock and unlock calls.
  
  MFC after:3 days

Modified:
  head/sys/cam/scsi/scsi_ch.c
  head/sys/cam/scsi/scsi_enc.c
  head/sys/cam/scsi/scsi_pass.c
  head/sys/cam/scsi/scsi_pt.c
  head/sys/cam/scsi/scsi_sg.c

Modified: head/sys/cam/scsi/scsi_ch.c
==
--- head/sys/cam/scsi/scsi_ch.c Sun May 27 05:27:47 2012(r236137)
+++ head/sys/cam/scsi/scsi_ch.c Sun May 27 06:11:09 2012(r236138)
@@ -107,8 +107,7 @@ static const u_int32_t  CH_TIMEOUT_SEND_V
 static const u_int32_t CH_TIMEOUT_INITIALIZE_ELEMENT_STATUS = 50;
 
 typedef enum {
-   CH_FLAG_INVALID = 0x001,
-   CH_FLAG_OPEN= 0x002
+   CH_FLAG_INVALID = 0x001
 } ch_flags;
 
 typedef enum {
@@ -211,7 +210,7 @@ PERIPHDRIVER_DECLARE(ch, chdriver);
 
 static struct cdevsw ch_cdevsw = {
.d_version =D_VERSION,
-   .d_flags =  0,
+   .d_flags =  D_TRACKCLOSE,
.d_open =   chopen,
.d_close =  chclose,
.d_ioctl =  chioctl,
@@ -404,16 +403,11 @@ chopen(struct cdev *dev, int flags, int 
cam_periph_lock(periph);

if (softc->flags & CH_FLAG_INVALID) {
+   cam_periph_release_locked(periph);
cam_periph_unlock(periph);
-   cam_periph_release(periph);
return(ENXIO);
}
 
-   if ((softc->flags & CH_FLAG_OPEN) == 0)
-   softc->flags |= CH_FLAG_OPEN;
-   else
-   cam_periph_release(periph);
-
if ((error = cam_periph_hold(periph, PRIBIO | PCATCH)) != 0) {
cam_periph_unlock(periph);
cam_periph_release(periph);
@@ -424,9 +418,8 @@ chopen(struct cdev *dev, int flags, int 
 * Load information about this changer device into the softc.
 */
if ((error = chgetparams(periph)) != 0) {
-   softc->flags &= ~CH_FLAG_OPEN;
+   cam_periph_release_locked(periph);
cam_periph_unlock(periph);
-   cam_periph_release(periph);
return(error);
}
 
@@ -451,11 +444,6 @@ chclose(struct cdev *dev, int flag, int 
 
softc = (struct ch_softc *)periph->softc;
 
-   cam_periph_lock(periph);
-
-   softc->flags &= ~CH_FLAG_OPEN;
-
-   cam_periph_unlock(periph);
cam_periph_release(periph);
 
return(0);

Modified: head/sys/cam/scsi/scsi_enc.c
==
--- head/sys/cam/scsi/scsi_enc.cSun May 27 

svn commit: r236139 - head/crypto/openssh

2012-05-26 Thread Eygene Ryabinkin
Author: rea (ports committer)
Date: Sun May 27 06:53:35 2012
New Revision: 236139
URL: http://svn.freebsd.org/changeset/base/236139

Log:
  OpenSSH: allow VersionAddendum to be used again
  
  Prior to this, setting VersionAddendum will be a no-op: one will
  always have BASE_VERSION + " " + VERSION_HPN for VersionAddendum
  set in the config and a bare BASE_VERSION + VERSION_HPN when there
  is no VersionAddendum is set.
  
  HPN patch requires both parties to have the "hpn" inside their
  advertized versions, so we add VERSION_HPN to the VERSION_BASE
  if HPN is enabled and omitting it if HPN is disabled.
  
  VersionAddendum now uses the following logics:
   * unset (default value): append " " and VERSION_ADDENDUM;
   * VersionAddendum is set and isn't empty: append " "
 and VersionAddendum;
   * VersionAddendum is set and empty: don't append anything.
  
  Approved by: des
  Reviewed by: bz
  MFC after: 3 days

Modified:
  head/crypto/openssh/ssh.c
  head/crypto/openssh/sshconnect.c
  head/crypto/openssh/sshd.c
  head/crypto/openssh/version.c
  head/crypto/openssh/version.h

Modified: head/crypto/openssh/ssh.c
==
--- head/crypto/openssh/ssh.c   Sun May 27 06:11:09 2012(r236138)
+++ head/crypto/openssh/ssh.c   Sun May 27 06:53:35 2012(r236139)
@@ -437,7 +437,8 @@ main(int ac, char **av)
/* FALLTHROUGH */
case 'V':
fprintf(stderr, "%s, %s\n",
-   SSH_RELEASE, SSLeay_version(SSLEAY_VERSION));
+   ssh_version_get(options.hpn_disabled),
+   SSLeay_version(SSLEAY_VERSION));
if (opt == 'V')
exit(0);
break;

Modified: head/crypto/openssh/sshconnect.c
==
--- head/crypto/openssh/sshconnect.cSun May 27 06:11:09 2012
(r236138)
+++ head/crypto/openssh/sshconnect.cSun May 27 06:53:35 2012
(r236139)
@@ -585,7 +585,7 @@ ssh_exchange_identification(int timeout_
snprintf(buf, sizeof buf, "SSH-%d.%d-%.100s%s",
compat20 ? PROTOCOL_MAJOR_2 : PROTOCOL_MAJOR_1,
compat20 ? PROTOCOL_MINOR_2 : minor1,
-   SSH_RELEASE, compat20 ? "\r\n" : "\n");
+   ssh_version_get(options.hpn_disabled), compat20 ? "\r\n" : "\n");
if (roaming_atomicio(vwrite, connection_out, buf, strlen(buf))
!= strlen(buf))
fatal("write: %.100s", strerror(errno));

Modified: head/crypto/openssh/sshd.c
==
--- head/crypto/openssh/sshd.c  Sun May 27 06:11:09 2012(r236138)
+++ head/crypto/openssh/sshd.c  Sun May 27 06:53:35 2012(r236139)
@@ -431,7 +431,7 @@ sshd_exchange_identification(int sock_in
minor = PROTOCOL_MINOR_1;
}
snprintf(buf, sizeof buf, "SSH-%d.%d-%.100s%s", major, minor,
-   SSH_RELEASE, newline);
+   ssh_version_get(options.hpn_disabled), newline);
server_version_string = xstrdup(buf);
 
/* Send our protocol version identification. */
@@ -894,7 +894,7 @@ static void
 usage(void)
 {
fprintf(stderr, "%s, %s\n",
-   SSH_RELEASE, SSLeay_version(SSLEAY_VERSION));
+   ssh_version_get(0), SSLeay_version(SSLEAY_VERSION));
fprintf(stderr,
 "usage: sshd [-46DdeiqTt] [-b bits] [-C connection_spec] [-c host_cert_file]\n"
 "[-f config_file] [-g login_grace_time] [-h host_key_file]\n"
@@ -1583,7 +1583,7 @@ main(int ac, char **av)
exit(1);
}
 
-   debug("sshd version %.100s", SSH_RELEASE);
+   debug("sshd version %.100s", ssh_version_get(options.hpn_disabled));
 
/* Store privilege separation user for later use if required. */
if ((privsep_pw = getpwnam(SSH_PRIVSEP_USER)) == NULL) {

Modified: head/crypto/openssh/version.c
==
--- head/crypto/openssh/version.c   Sun May 27 06:11:09 2012
(r236138)
+++ head/crypto/openssh/version.c   Sun May 27 06:53:35 2012
(r236139)
@@ -1,5 +1,6 @@
 /*-
  * Copyright (c) 2001 Brian Fundakowski Feldman
+ * Copyright (c) 2012 Eygene Ryabinkin 
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -35,30 +36,60 @@ __RCSID("$FreeBSD$");
 
 
 static char *version = NULL;
+/* NULL means "use default value", empty string means "unset" */
+static const char *addendum = NULL;
+static unsigned char update_version = 1;
 
+/*
+ * Constructs the version string if it is empty or needs updating.
+ *
+ * HPN patch we're running requires both parties
+ * to have the "hpn" string inside the advertized version
+ * (see compat.c::compat_datafellows), so we should
+ * include