svn commit: r213195 - stable/8/sys/kern

2010-09-27 Thread Andriy Gapon
Author: avg
Date: Mon Sep 27 06:02:12 2010
New Revision: 213195
URL: http://svn.freebsd.org/changeset/base/213195

Log:
  MFC r212544: bus_add_child: add specialized default implementation that
  calls panic

Modified:
  stable/8/sys/kern/bus_if.m
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (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/xen/xenpci/   (props changed)

Modified: stable/8/sys/kern/bus_if.m
==
--- stable/8/sys/kern/bus_if.m  Mon Sep 27 05:46:20 2010(r213194)
+++ stable/8/sys/kern/bus_if.m  Mon Sep 27 06:02:12 2010(r213195)
@@ -26,6 +26,8 @@
 # $FreeBSD$
 #
 
+#include sys/types.h
+#include sys/systm.h
 #include sys/bus.h
 
 /**
@@ -47,6 +49,14 @@ CODE {
{
return (0);
}
+
+   static device_t
+   null_add_child(device_t bus, int order, const char *name,
+   int unit)
+   {
+
+   panic(bus_add_child is not implemented);
+   }
 };
 
 /**
@@ -194,7 +204,7 @@ METHOD device_t add_child {
u_int _order;
const char *_name;
int _unit;
-};
+} DEFAULT null_add_child;
 
 /**
  * @brief Allocate a system resource
___
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: r213196 - stable/7/sys/kern

2010-09-27 Thread Andriy Gapon
Author: avg
Date: Mon Sep 27 06:04:17 2010
New Revision: 213196
URL: http://svn.freebsd.org/changeset/base/213196

Log:
  MFC r212544: bus_add_child: add specialized default implementation that
  calls panic

Modified:
  stable/7/sys/kern/bus_if.m
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/kern/bus_if.m
==
--- stable/7/sys/kern/bus_if.m  Mon Sep 27 06:02:12 2010(r213195)
+++ stable/7/sys/kern/bus_if.m  Mon Sep 27 06:04:17 2010(r213196)
@@ -26,6 +26,8 @@
 # $FreeBSD$
 #
 
+#include sys/types.h
+#include sys/systm.h
 #include sys/bus.h
 
 /**
@@ -47,6 +49,14 @@ CODE {
{
return (0);
}
+
+   static device_t
+   null_add_child(device_t bus, int order, const char *name,
+   int unit)
+   {
+
+   panic(bus_add_child is not implemented);
+   }
 };
 
 /**
@@ -194,7 +204,7 @@ METHOD device_t add_child {
u_int _order;
const char *_name;
int _unit;
-};
+} DEFAULT null_add_child;
 
 /**
  * @brief Allocate a system resource
___
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: r213197 - in head: cddl/contrib/opensolaris/cmd/zpool cddl/contrib/opensolaris/lib/libzfs/common sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/contrib/opensolaris/uts/common/f...

2010-09-27 Thread Martin Matuska
Author: mm
Date: Mon Sep 27 09:05:51 2010
New Revision: 213197
URL: http://svn.freebsd.org/changeset/base/213197

Log:
  Enable offlining of log devices.
  
  OpenSolaris revision and Bug IDs:
  
  9701:cc5b64682e64
  6803605   should be able to offline log devices
  6726045   vdev_deflate_ratio is not set when offlining a log device
  6599442   zpool import has faults in the display
  
  Approved by:  delphij (mentor)
  Obtained from:OpenSolaris (Bug ID 6803605, 6726045, 6599442)
  MFC after:3 weeks

Modified:
  head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c
  head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h
  head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c
  head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_util.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scrub.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_impl.h
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil.h
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c

Modified: head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c
==
--- head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.cMon Sep 27 
06:04:17 2010(r213196)
+++ head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.cMon Sep 27 
09:05:51 2010(r213197)
@@ -980,14 +980,189 @@ max_width(zpool_handle_t *zhp, nvlist_t 
return (max);
 }
 
+typedef struct spare_cbdata {
+   uint64_tcb_guid;
+   zpool_handle_t  *cb_zhp;
+} spare_cbdata_t;
+
+static boolean_t
+find_vdev(nvlist_t *nv, uint64_t search)
+{
+   uint64_t guid;
+   nvlist_t **child;
+   uint_t c, children;
+
+   if (nvlist_lookup_uint64(nv, ZPOOL_CONFIG_GUID, guid) == 0 
+   search == guid)
+   return (B_TRUE);
+
+   if (nvlist_lookup_nvlist_array(nv, ZPOOL_CONFIG_CHILDREN,
+   child, children) == 0) {
+   for (c = 0; c  children; c++)
+   if (find_vdev(child[c], search))
+   return (B_TRUE);
+   }
+
+   return (B_FALSE);
+}
+
+static int
+find_spare(zpool_handle_t *zhp, void *data)
+{
+   spare_cbdata_t *cbp = data;
+   nvlist_t *config, *nvroot;
+
+   config = zpool_get_config(zhp, NULL);
+   verify(nvlist_lookup_nvlist(config, ZPOOL_CONFIG_VDEV_TREE,
+   nvroot) == 0);
+
+   if (find_vdev(nvroot, cbp-cb_guid)) {
+   cbp-cb_zhp = zhp;
+   return (1);
+   }
+
+   zpool_close(zhp);
+   return (0);
+}
+
+/*
+ * Print out configuration state as requested by status_callback.
+ */
+void
+print_status_config(zpool_handle_t *zhp, const char *name, nvlist_t *nv,
+int namewidth, int depth, boolean_t isspare)
+{
+   nvlist_t **child;
+   uint_t c, children;
+   vdev_stat_t *vs;
+   char rbuf[6], wbuf[6], cbuf[6], repaired[7];
+   char *vname;
+   uint64_t notpresent;
+   spare_cbdata_t cb;
+   char *state;
+
+   verify(nvlist_lookup_uint64_array(nv, ZPOOL_CONFIG_STATS,
+   (uint64_t **)vs, c) == 0);
+
+   if (nvlist_lookup_nvlist_array(nv, ZPOOL_CONFIG_CHILDREN,
+   child, children) != 0)
+   children = 0;
+
+   state = zpool_state_to_name(vs-vs_state, vs-vs_aux);
+   if (isspare) {
+   /*
+* For hot spares, we use the terms 'INUSE' and 'AVAILABLE' for
+* online drives.
+*/
+   if (vs-vs_aux == VDEV_AUX_SPARED)
+   state = INUSE;
+   else if (vs-vs_state == VDEV_STATE_HEALTHY)
+   state = AVAIL;
+   }
+
+   (void) printf(\t%*s%-*s  %-8s, depth, , namewidth - depth,
+   name, state);
+
+   if (!isspare) {
+   zfs_nicenum(vs-vs_read_errors, rbuf, sizeof (rbuf));
+   zfs_nicenum(vs-vs_write_errors, wbuf, sizeof (wbuf));
+   zfs_nicenum(vs-vs_checksum_errors, cbuf, sizeof (cbuf));
+   (void) printf( %5s %5s %5s, rbuf, wbuf, cbuf);
+   }
+
+   if (nvlist_lookup_uint64(nv, ZPOOL_CONFIG_NOT_PRESENT,
+   notpresent) == 0) {
+   char *path;
+   verify(nvlist_lookup_string(nv, ZPOOL_CONFIG_PATH, path) == 0);
+   (void) printf(  was %s, path);
+   } else if (vs-vs_aux != 0) {
+   (void) printf(  );
+
+   switch (vs-vs_aux) {
+   case VDEV_AUX_OPEN_FAILED:
+   (void) printf(gettext(cannot open));
+   break;
+
+   case VDEV_AUX_BAD_GUID_SUM:
+   (void) printf(gettext(missing device));
+   break;
+
+   case VDEV_AUX_NO_REPLICAS:
+   (void) 

Re: svn commit: r213181 - head/usr.sbin/watchdogd

2010-09-27 Thread pluknet
On 26 September 2010 14:48, Mikolaj Golub to.my.troc...@gmail.com wrote:

 On Sun, 26 Sep 2010 01:45:33 + (UTC) Ed Maste wrote:

  EM Log:
  EM   Protect the watchdog daemon against swap OOM killer.  This is similar 
 to
  EM   SVN r199804 which added protection to sshd, cron, syslogd, and inetd.

 May be there is a sense to have some utility in the system so that an admin
 could protect any process he wanted? E.g. something like in the attach.


Hi.
You might want to look at is sysutils/scprotect in ports.
Not sure that's what you want though.

-- 
wbr,
pluknet
___
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: r213198 - in head: cddl/contrib/opensolaris/cmd/zinject sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys

2010-09-27 Thread Martin Matuska
Author: mm
Date: Mon Sep 27 09:42:31 2010
New Revision: 213198
URL: http://svn.freebsd.org/changeset/base/213198

Log:
  Properly handle IO with B_FAILFAST
  Retry IO once with ZIO_FLAG_TRYHARD before declaring a pool faulted
  
  OpenSolaris revision and Bug IDs:
  
  9725:0bf7402e8022
  6843014 ZFS B_FAILFAST handling is broken
  
  Approved by:  delphij (mentor)
  Obtained from:OpenSolaris (Bug ID 6843014)
  MFC after:3 weeks

Modified:
  head/cddl/contrib/opensolaris/cmd/zinject/zinject.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev.h
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_ioctl.h
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_disk.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_label.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_fm.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio_inject.c

Modified: head/cddl/contrib/opensolaris/cmd/zinject/zinject.c
==
--- head/cddl/contrib/opensolaris/cmd/zinject/zinject.c Mon Sep 27 09:05:51 
2010(r213197)
+++ head/cddl/contrib/opensolaris/cmd/zinject/zinject.c Mon Sep 27 09:42:31 
2010(r213198)
@@ -19,12 +19,10 @@
  * CDDL HEADER END
  */
 /*
- * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
-#pragma ident  %Z%%M% %I% %E% SMI
-
 /*
  * ZFS Fault Injector
  *
@@ -227,7 +225,7 @@ usage(void)
\t\tClear the particular record (if given a numeric ID), or\n
\t\tall records if 'all' is specificed.\n
\n
-   \tzinject -d device [-e errno] [-L nvlist|uber] pool\n
+   \tzinject -d device [-e errno] [-L nvlist|uber] [-F] pool\n
\t\tInject a fault into a particular device or the device's\n
\t\tlabel.  Label injection can either be 'nvlist' or 'uber'.\n
\t\t'errno' can either be 'nxio' (the default) or 'io'.\n
@@ -519,7 +517,7 @@ main(int argc, char **argv)
return (0);
}
 
-   while ((c = getopt(argc, argv, :ab:d:f:qhc:t:l:mr:e:uL:)) != -1) {
+   while ((c = getopt(argc, argv, :ab:d:f:Fqhc:t:l:mr:e:uL:)) != -1) {
switch (c) {
case 'a':
flags |= ZINJECT_FLUSH_ARC;
@@ -556,6 +554,9 @@ main(int argc, char **argv)
return (1);
}
break;
+   case 'F':
+   record.zi_failfast = B_TRUE;
+   break;
case 'h':
usage();
return (0);

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c   Mon Sep 27 
09:05:51 2010(r213197)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c   Mon Sep 27 
09:42:31 2010(r213198)
@@ -4252,10 +4252,16 @@ spa_sync(spa_t *spa, uint64_t txg)
if (svdcount == SPA_DVAS_PER_BP)
break;
}
-   error = vdev_config_sync(svd, svdcount, txg);
+   error = vdev_config_sync(svd, svdcount, txg, B_FALSE);
+   if (error != 0)
+   error = vdev_config_sync(svd, svdcount, txg,
+   B_TRUE);
} else {
error = vdev_config_sync(rvd-vdev_child,
-   rvd-vdev_children, txg);
+   rvd-vdev_children, txg, B_FALSE);
+   if (error != 0)
+   error = vdev_config_sync(rvd-vdev_child,
+   rvd-vdev_children, txg, B_TRUE);
}
 
spa_config_exit(spa, SCL_STATE, FTAG);

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev.h
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev.h  Mon Sep 
27 09:05:51 2010(r213197)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev.h  Mon Sep 
27 09:42:31 2010(r213198)
@@ -19,7 +19,7 @@
  * CDDL HEADER END
  */
 /*
- * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -113,7 +113,8 @@ extern void 

Re: svn commit: r213198 - in head: cddl/contrib/opensolaris/cmd/zinject sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys

2010-09-27 Thread Martin Matuska
As FreeBSD does not support B_FAILFAST handling and we don't use
vdev_disk.c, please treat this commit as a no-op with the purpose of
diff reduction against latest ZFS code to make future updates easier.
___
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: r213181 - head/usr.sbin/watchdogd

2010-09-27 Thread Mikolaj Golub

On Mon, 27 Sep 2010 13:40:56 +0400 pluknet wrote:

 p On 26 September 2010 14:48, Mikolaj Golub to.my.troc...@gmail.com wrote:
 
  On Sun, 26 Sep 2010 01:45:33 + (UTC) Ed Maste wrote:
 
   EM Log:
   EM   Protect the watchdog daemon against swap OOM killer.  This is 
  similar to
   EM   SVN r199804 which added protection to sshd, cron, syslogd, and inetd.
 
  May be there is a sense to have some utility in the system so that an admin
  could protect any process he wanted? E.g. something like in the attach.
 

 p Hi.
 p You might want to look at is sysutils/scprotect in ports.
 p Not sure that's what you want though.

Yes, it looks sysutils/scprotect allows to do this and even more :-)

-- 
Mikolaj Golub
___
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: r212964 - head/sys/kern

2010-09-27 Thread John Baldwin
On Friday, September 24, 2010 6:53:52 pm Peter Jeremy wrote:
 [Pruning CC list and re-adding freebsd-arch on the (forlorn) hope that
 this thread will move to where it belongs]
 
 On 2010-Sep-23 07:31:13 -0700, Matthew Jacob m...@feral.com wrote:
 It turns out that the big issue here was more the savecore time coming 
 back up rather than the time of dumping.
 
 In my experience, the problem isn't so much the savecore time as the
 time to run /usr/bin/crashinfo.  Whilst savecore needs to run early
 (before anything tramples on the crashdump in swap), the latter could
 run at any time.  It would seem reasonable to either run crashinfo in
 the background or as a batchjob triggered by /etc/rc.d/savecore.

That is probably true and would be fine, yes.

 On 2010-Sep-23 18:59:53 +0100, Gavin Atkinson ga...@freebsd.org wrote:
 I appreciate the issue about filling partitions is a valid one.  Would a 
 possible compromise be that on release media, crashinfo(8) or similar will 
 default to only keeping the most recent coredump or similar?  Given /var 
 now defaults to 4GB, Defaulting to keeping a single core is probably 
 acceptable.
 
 savecore already has support for a 'minfree' file to prevent
 crashdumps filling the crashdir.  Maybe the default install should
 include a minfree set to (say) 512MB.

The one problem this approach is it implements a FIFO instead of a LIFO.  I 
want the N most recent crashdumps to be saved, not the first N.

-- 
John Baldwin
___
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: r213201 - head/sys/arm/at91

2010-09-27 Thread Bernd Walter
Author: ticso
Date: Mon Sep 27 15:55:30 2010
New Revision: 213201
URL: http://svn.freebsd.org/changeset/base/213201

Log:
  fix off by one error for twi reads with len != 1.
  STOP must be requested before the last byte is received.

Modified:
  head/sys/arm/at91/at91_twi.c

Modified: head/sys/arm/at91/at91_twi.c
==
--- head/sys/arm/at91/at91_twi.cMon Sep 27 15:24:16 2010
(r213200)
+++ head/sys/arm/at91/at91_twi.cMon Sep 27 15:55:30 2010
(r213201)
@@ -348,7 +348,7 @@ at91_twi_transfer(device_t dev, struct i
if ((sr = RD4(sc, TWI_SR))  TWI_SR_RXRDY) {
len--;
*buf++ = RD4(sc, TWI_RHR)  0xff;
-   if (len == 0  msgs[i].len != 1)
+   if (len == 1)
WR4(sc, TWI_CR, TWI_CR_STOP);
}
}
___
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: r213202 - head/etc/rc.d

2010-09-27 Thread Warner Losh
Author: imp
Date: Mon Sep 27 15:55:39 2010
New Revision: 213202
URL: http://svn.freebsd.org/changeset/base/213202

Log:
  Prefer echo over printf

Modified:
  head/etc/rc.d/nsswitch

Modified: head/etc/rc.d/nsswitch
==
--- head/etc/rc.d/nsswitch  Mon Sep 27 15:55:30 2010(r213201)
+++ head/etc/rc.d/nsswitch  Mon Sep 27 15:55:39 2010(r213202)
@@ -80,7 +80,7 @@ generate_host_conf()
cache | *=*)
;;
*)
-   printf Warning: unrecognized source [%s]\n $_s 2
+   echo Warning: unrecognized source [$_s] 2
;;
esac
 done
___
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: r213203 - head/sys/arm/at91

2010-09-27 Thread Bernd Walter
Author: ticso
Date: Mon Sep 27 15:58:19 2010
New Revision: 213203
URL: http://svn.freebsd.org/changeset/base/213203

Log:
  The TWI controller automatically stops if we don't fill up with new data in
  time.

Modified:
  head/sys/arm/at91/at91_twi.c

Modified: head/sys/arm/at91/at91_twi.c
==
--- head/sys/arm/at91/at91_twi.cMon Sep 27 15:55:39 2010
(r213202)
+++ head/sys/arm/at91/at91_twi.cMon Sep 27 15:58:19 2010
(r213203)
@@ -338,7 +338,7 @@ at91_twi_transfer(device_t dev, struct i
err = EINVAL;
goto out;
}
-   if (len == 1)
+   if (len == 1  msgs[i].flags  IIC_M_RD)
WR4(sc, TWI_CR, TWI_CR_START | TWI_CR_STOP);
else
WR4(sc, TWI_CR, TWI_CR_START);
@@ -358,8 +358,6 @@ at91_twi_transfer(device_t dev, struct i
}
} else {
while (len--) {
-   if (len == 0  msgs[i].len != 1)
-   WR4(sc, TWI_CR, TWI_CR_STOP);
if ((err = at91_twi_wait(sc, TWI_SR_TXRDY)))
goto out;
WR4(sc, TWI_THR, *buf++);
___
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: r213205 - stable/8/sys/dev/e1000

2010-09-27 Thread John Baldwin
Author: jhb
Date: Mon Sep 27 16:29:25 2010
New Revision: 213205
URL: http://svn.freebsd.org/changeset/base/213205

Log:
  MFC 212902:
  Tweak the stats exported by the e1000 drivers:
  - Add a single sysctl procedure to all three drivers to read an arbitrary
register (the register is passed as arg2).  Use it to replace existing
routines in igb(4) that used a separate routine for each register, and
to add support for missing stats in em(4) and lem(4).
  - Move the 'rx_overruns' and 'watchdog_timeouts' stats out of the MAC stats
section as they are driver stats, not MAC counters.
  - Simplify the code that creates per-queue stats in igb(4) to use a single
loop and remove duplicated code.
  - Properly read all 64 bits of the 'good octets received/transmitted' in
em(4) and lem(4).
  - Actually read the interrupt count registers in em(4), and drop the
'host to card' sysctl stats from em(4) as they are not implemented in
any of the hardware this driver supports.
  - Restore several stats to em(4) that were lost in the earlier stats
conversion including per-queue stats.
  - Export several MAC stats in em(4) that were exported in igb(4) but not
in em(4).
  - Export stats in lem(4) using individual sysctls as in em(4) and igb(4).

Modified:
  stable/8/sys/dev/e1000/if_em.c
  stable/8/sys/dev/e1000/if_igb.c
  stable/8/sys/dev/e1000/if_lem.c
  stable/8/sys/dev/e1000/if_lem.h
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (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/xen/xenpci/   (props changed)

Modified: stable/8/sys/dev/e1000/if_em.c
==
--- stable/8/sys/dev/e1000/if_em.c  Mon Sep 27 16:26:35 2010
(r213204)
+++ stable/8/sys/dev/e1000/if_em.c  Mon Sep 27 16:29:25 2010
(r213205)
@@ -4814,8 +4814,10 @@ em_update_stats_counters(struct adapter 
/* For the 64-bit byte counters the low dword must be read first. */
/* Both registers clear on the read of the high dword */
 
-   adapter-stats.gorc += E1000_READ_REG(adapter-hw, E1000_GORCH);
-   adapter-stats.gotc += E1000_READ_REG(adapter-hw, E1000_GOTCH);
+   adapter-stats.gorc += E1000_READ_REG(adapter-hw, E1000_GORCL) +
+   ((u64)E1000_READ_REG(adapter-hw, E1000_GORCH)  32);
+   adapter-stats.gotc += E1000_READ_REG(adapter-hw, E1000_GOTCL) +
+   ((u64)E1000_READ_REG(adapter-hw, E1000_GOTCH)  32);
 
adapter-stats.rnbc += E1000_READ_REG(adapter-hw, E1000_RNBC);
adapter-stats.ruc += E1000_READ_REG(adapter-hw, E1000_RUC);
@@ -4837,6 +4839,18 @@ em_update_stats_counters(struct adapter 
adapter-stats.mptc += E1000_READ_REG(adapter-hw, E1000_MPTC);
adapter-stats.bptc += E1000_READ_REG(adapter-hw, E1000_BPTC);
 
+   /* Interrupt Counts */
+
+   adapter-stats.iac += E1000_READ_REG(adapter-hw, E1000_IAC);
+   adapter-stats.icrxptc += E1000_READ_REG(adapter-hw, E1000_ICRXPTC);
+   adapter-stats.icrxatc += E1000_READ_REG(adapter-hw, E1000_ICRXATC);
+   adapter-stats.ictxptc += E1000_READ_REG(adapter-hw, E1000_ICTXPTC);
+   adapter-stats.ictxatc += E1000_READ_REG(adapter-hw, E1000_ICTXATC);
+   adapter-stats.ictxqec += E1000_READ_REG(adapter-hw, E1000_ICTXQEC);
+   adapter-stats.ictxqmtc += E1000_READ_REG(adapter-hw, E1000_ICTXQMTC);
+   adapter-stats.icrxdmtc += E1000_READ_REG(adapter-hw, E1000_ICRXDMTC);
+   adapter-stats.icrxoc += E1000_READ_REG(adapter-hw, E1000_ICRXOC);
+
if (adapter-hw.mac.type = e1000_82543) {
adapter-stats.algnerrc += 
E1000_READ_REG(adapter-hw, E1000_ALGNERRC);
@@ -4866,6 +4880,17 @@ em_update_stats_counters(struct adapter 
adapter-stats.latecol + adapter-watchdog_events;
 }
 
+/* Export a single 32-bit register via a read-only sysctl. */
+static int
+em_sysctl_reg_handler(SYSCTL_HANDLER_ARGS)
+{
+   struct adapter *adapter;
+   u_int val;
+
+   adapter = oidp-oid_arg1;
+   val = E1000_READ_REG(adapter-hw, oidp-oid_arg2);
+   return (sysctl_handle_int(oidp, val, 0, req));
+}
 
 /*
  * Add sysctl variables, one per statistic, to the system.
@@ -4873,17 +4898,22 @@ em_update_stats_counters(struct adapter 
 static void
 em_add_hw_stats(struct adapter *adapter)
 {
-
device_t dev = adapter-dev;
 
+   struct tx_ring *txr = adapter-tx_rings;
+   struct rx_ring *rxr = adapter-rx_rings;
+
struct sysctl_ctx_list *ctx = device_get_sysctl_ctx(dev);
struct sysctl_oid *tree = device_get_sysctl_tree(dev);
struct sysctl_oid_list *child = SYSCTL_CHILDREN(tree);
struct e1000_hw_stats *stats = adapter-stats;
 
-   struct sysctl_oid *stat_node, *int_node, *host_node;
-   struct sysctl_oid_list *stat_list, 

svn commit: r213206 - stable/7/sys/dev/e1000

2010-09-27 Thread John Baldwin
Author: jhb
Date: Mon Sep 27 16:29:46 2010
New Revision: 213206
URL: http://svn.freebsd.org/changeset/base/213206

Log:
  MFC 212902:
  Tweak the stats exported by the e1000 drivers:
  - Add a single sysctl procedure to all three drivers to read an arbitrary
register (the register is passed as arg2).  Use it to replace existing
routines in igb(4) that used a separate routine for each register, and
to add support for missing stats in em(4) and lem(4).
  - Move the 'rx_overruns' and 'watchdog_timeouts' stats out of the MAC stats
section as they are driver stats, not MAC counters.
  - Simplify the code that creates per-queue stats in igb(4) to use a single
loop and remove duplicated code.
  - Properly read all 64 bits of the 'good octets received/transmitted' in
em(4) and lem(4).
  - Actually read the interrupt count registers in em(4), and drop the
'host to card' sysctl stats from em(4) as they are not implemented in
any of the hardware this driver supports.
  - Restore several stats to em(4) that were lost in the earlier stats
conversion including per-queue stats.
  - Export several MAC stats in em(4) that were exported in igb(4) but not
in em(4).
  - Export stats in lem(4) using individual sysctls as in em(4) and igb(4).

Modified:
  stable/7/sys/dev/e1000/if_em.c
  stable/7/sys/dev/e1000/if_igb.c
  stable/7/sys/dev/e1000/if_lem.c
  stable/7/sys/dev/e1000/if_lem.h
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/dev/e1000/if_em.c
==
--- stable/7/sys/dev/e1000/if_em.c  Mon Sep 27 16:29:25 2010
(r213205)
+++ stable/7/sys/dev/e1000/if_em.c  Mon Sep 27 16:29:46 2010
(r213206)
@@ -4812,8 +4812,10 @@ em_update_stats_counters(struct adapter 
/* For the 64-bit byte counters the low dword must be read first. */
/* Both registers clear on the read of the high dword */
 
-   adapter-stats.gorc += E1000_READ_REG(adapter-hw, E1000_GORCH);
-   adapter-stats.gotc += E1000_READ_REG(adapter-hw, E1000_GOTCH);
+   adapter-stats.gorc += E1000_READ_REG(adapter-hw, E1000_GORCL) +
+   ((u64)E1000_READ_REG(adapter-hw, E1000_GORCH)  32);
+   adapter-stats.gotc += E1000_READ_REG(adapter-hw, E1000_GOTCL) +
+   ((u64)E1000_READ_REG(adapter-hw, E1000_GOTCH)  32);
 
adapter-stats.rnbc += E1000_READ_REG(adapter-hw, E1000_RNBC);
adapter-stats.ruc += E1000_READ_REG(adapter-hw, E1000_RUC);
@@ -4835,6 +4837,18 @@ em_update_stats_counters(struct adapter 
adapter-stats.mptc += E1000_READ_REG(adapter-hw, E1000_MPTC);
adapter-stats.bptc += E1000_READ_REG(adapter-hw, E1000_BPTC);
 
+   /* Interrupt Counts */
+
+   adapter-stats.iac += E1000_READ_REG(adapter-hw, E1000_IAC);
+   adapter-stats.icrxptc += E1000_READ_REG(adapter-hw, E1000_ICRXPTC);
+   adapter-stats.icrxatc += E1000_READ_REG(adapter-hw, E1000_ICRXATC);
+   adapter-stats.ictxptc += E1000_READ_REG(adapter-hw, E1000_ICTXPTC);
+   adapter-stats.ictxatc += E1000_READ_REG(adapter-hw, E1000_ICTXATC);
+   adapter-stats.ictxqec += E1000_READ_REG(adapter-hw, E1000_ICTXQEC);
+   adapter-stats.ictxqmtc += E1000_READ_REG(adapter-hw, E1000_ICTXQMTC);
+   adapter-stats.icrxdmtc += E1000_READ_REG(adapter-hw, E1000_ICRXDMTC);
+   adapter-stats.icrxoc += E1000_READ_REG(adapter-hw, E1000_ICRXOC);
+
if (adapter-hw.mac.type = e1000_82543) {
adapter-stats.algnerrc += 
E1000_READ_REG(adapter-hw, E1000_ALGNERRC);
@@ -4864,6 +4878,17 @@ em_update_stats_counters(struct adapter 
adapter-stats.latecol + adapter-watchdog_events;
 }
 
+/* Export a single 32-bit register via a read-only sysctl. */
+static int
+em_sysctl_reg_handler(SYSCTL_HANDLER_ARGS)
+{
+   struct adapter *adapter;
+   u_int val;
+
+   adapter = oidp-oid_arg1;
+   val = E1000_READ_REG(adapter-hw, oidp-oid_arg2);
+   return (sysctl_handle_int(oidp, val, 0, req));
+}
 
 /*
  * Add sysctl variables, one per statistic, to the system.
@@ -4871,17 +4896,22 @@ em_update_stats_counters(struct adapter 
 static void
 em_add_hw_stats(struct adapter *adapter)
 {
-
device_t dev = adapter-dev;
 
+   struct tx_ring *txr = adapter-tx_rings;
+   struct rx_ring *rxr = adapter-rx_rings;
+
struct sysctl_ctx_list *ctx = device_get_sysctl_ctx(dev);
struct sysctl_oid *tree = device_get_sysctl_tree(dev);
struct sysctl_oid_list *child = SYSCTL_CHILDREN(tree);
struct e1000_hw_stats *stats = adapter-stats;
 
-   struct sysctl_oid *stat_node, *int_node, *host_node;
-   struct sysctl_oid_list *stat_list, *int_list, *host_list;
+   struct sysctl_oid *stat_node, *queue_node, *int_node;
+   struct 

svn commit: r213208 - stable/8/sys/dev/bge

2010-09-27 Thread Pyun YongHyeon
Author: yongari
Date: Mon Sep 27 17:10:22 2010
New Revision: 213208
URL: http://svn.freebsd.org/changeset/base/213208

Log:
  MFC r212755:
Fix incorrect RX BD producer updates. The producer index was
already updated after allocating mbuf so driver had to use the last
index instead of using next producer index. This should fix driver
hang which may happen under high network load.
  
Reported by:Igor Sysoev is  rambler-co dot ru, Vlad Galu dudu 
 dudu dot ro
Tested by:  Igor Sysoev is  rambler-co dot ru, Vlad Galu dudu  dudu 
dot ro

Modified:
  stable/8/sys/dev/bge/if_bge.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (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/xen/xenpci/   (props changed)

Modified: stable/8/sys/dev/bge/if_bge.c
==
--- stable/8/sys/dev/bge/if_bge.c   Mon Sep 27 16:48:56 2010
(r213207)
+++ stable/8/sys/dev/bge/if_bge.c   Mon Sep 27 17:10:22 2010
(r213208)
@@ -3470,9 +3470,11 @@ bge_rxeof(struct bge_softc *sc, uint16_t
sc-bge_rx_saved_considx = rx_cons;
bge_writembx(sc, BGE_MBX_RX_CONS0_LO, sc-bge_rx_saved_considx);
if (stdcnt)
-   bge_writembx(sc, BGE_MBX_RX_STD_PROD_LO, sc-bge_std);
+   bge_writembx(sc, BGE_MBX_RX_STD_PROD_LO, (sc-bge_std +
+   BGE_STD_RX_RING_CNT - 1) % BGE_STD_RX_RING_CNT);
if (jumbocnt)
-   bge_writembx(sc, BGE_MBX_RX_JUMBO_PROD_LO, sc-bge_jumbo);
+   bge_writembx(sc, BGE_MBX_RX_JUMBO_PROD_LO, (sc-bge_jumbo +
+   BGE_JUMBO_RX_RING_CNT - 1) % BGE_JUMBO_RX_RING_CNT);
 #ifdef notyet
/*
 * This register wraps very quickly under heavy packet drops.
___
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: r213209 - stable/7/sys/dev/bge

2010-09-27 Thread Pyun YongHyeon
Author: yongari
Date: Mon Sep 27 17:12:54 2010
New Revision: 213209
URL: http://svn.freebsd.org/changeset/base/213209

Log:
  MFC r212755:
Fix incorrect RX BD producer updates. The producer index was
already updated after allocating mbuf so driver had to use the last
index instead of using next producer index. This should fix driver
hang which may happen under high network load.
  
Reported by:Igor Sysoev is  rambler-co dot ru, Vlad Galu dudu 
 dudu dot ro
Tested by:  Igor Sysoev is  rambler-co dot ru, Vlad Galu dudu  dudu 
dot ro

Modified:
  stable/7/sys/dev/bge/if_bge.c
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/dev/bge/if_bge.c
==
--- stable/7/sys/dev/bge/if_bge.c   Mon Sep 27 17:10:22 2010
(r213208)
+++ stable/7/sys/dev/bge/if_bge.c   Mon Sep 27 17:12:54 2010
(r213209)
@@ -3469,9 +3469,11 @@ bge_rxeof(struct bge_softc *sc, uint16_t
sc-bge_rx_saved_considx = rx_cons;
bge_writembx(sc, BGE_MBX_RX_CONS0_LO, sc-bge_rx_saved_considx);
if (stdcnt)
-   bge_writembx(sc, BGE_MBX_RX_STD_PROD_LO, sc-bge_std);
+   bge_writembx(sc, BGE_MBX_RX_STD_PROD_LO, (sc-bge_std +
+   BGE_STD_RX_RING_CNT - 1) % BGE_STD_RX_RING_CNT);
if (jumbocnt)
-   bge_writembx(sc, BGE_MBX_RX_JUMBO_PROD_LO, sc-bge_jumbo);
+   bge_writembx(sc, BGE_MBX_RX_JUMBO_PROD_LO, (sc-bge_jumbo +
+   BGE_JUMBO_RX_RING_CNT - 1) % BGE_JUMBO_RX_RING_CNT);
 #ifdef notyet
/*
 * This register wraps very quickly under heavy packet drops.
___
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: r213211 - in stable/8/sys/modules: em igb ixgbe

2010-09-27 Thread Pyun YongHyeon
Author: yongari
Date: Mon Sep 27 17:37:25 2010
New Revision: 213211
URL: http://svn.freebsd.org/changeset/base/213211

Log:
  MFC r211400:
Remove unnecessary clean target in em(4), igb(4) and ixgbe(4).
While here also remove man target in igb(4).
  
Reviewed by:jfv

Modified:
  stable/8/sys/modules/em/Makefile
  stable/8/sys/modules/igb/Makefile
  stable/8/sys/modules/ixgbe/Makefile
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (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/xen/xenpci/   (props changed)

Modified: stable/8/sys/modules/em/Makefile
==
--- stable/8/sys/modules/em/MakefileMon Sep 27 17:30:56 2010
(r213210)
+++ stable/8/sys/modules/em/MakefileMon Sep 27 17:37:25 2010
(r213211)
@@ -18,10 +18,4 @@ CFLAGS += -I${.CURDIR}/../../dev/e1000
 # DEVICE_POLLING for a non-interrupt-driven method
 #CFLAGS  += -DDEVICE_POLLING
 
-clean:
-   rm -f device_if.h bus_if.h pci_if.h setdef*
-   rm -f *.o *.kld *.ko
-   rm -f @ machine
-   rm -f ${CLEANFILES}
-
 .include bsd.kmod.mk

Modified: stable/8/sys/modules/igb/Makefile
==
--- stable/8/sys/modules/igb/Makefile   Mon Sep 27 17:30:56 2010
(r213210)
+++ stable/8/sys/modules/igb/Makefile   Mon Sep 27 17:37:25 2010
(r213211)
@@ -14,14 +14,4 @@ CFLAGS += -I${.CURDIR}/../../dev/e1000 -
 # not advisable since MSIX gives better results
 #CFLAGS  += -DDEVICE_POLLING
 
-clean:
-   rm -f device_if.h bus_if.h pci_if.h setdef*
-   rm -f *.o *.kld *.ko
-   rm -f @ machine
-   rm -f ${CLEANFILES}
-
-man:
-   mv /usr/share/man/man4/igb.4.gz /usr/share/man/man4/igbSAVE.4.gz
-   cp igb.4 /usr/share/man/man4/
-
 .include bsd.kmod.mk

Modified: stable/8/sys/modules/ixgbe/Makefile
==
--- stable/8/sys/modules/ixgbe/Makefile Mon Sep 27 17:30:56 2010
(r213210)
+++ stable/8/sys/modules/ixgbe/Makefile Mon Sep 27 17:37:25 2010
(r213211)
@@ -8,9 +8,4 @@ SRCS+= ixgbe_common.c ixgbe_api.c ix
 SRCS+= ixgbe_82599.c ixgbe_82598.c
 CFLAGS+= -I${.CURDIR}/../../dev/ixgbe -DSMP -DIXGBE_FDIR
 
-clean:
-   rm -f device_if.h bus_if.h pci_if.h setdef* *_StripErr
-   rm -f *.o *.kld *.ko
-   rm -f @ machine
-
 .include bsd.kmod.mk
___
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: r213213 - in stable/7/sys/modules: em igb ixgbe

2010-09-27 Thread Pyun YongHyeon
Author: yongari
Date: Mon Sep 27 17:38:30 2010
New Revision: 213213
URL: http://svn.freebsd.org/changeset/base/213213

Log:
  MFC r211400:
Remove unnecessary clean target in em(4), igb(4) and ixgbe(4).
While here also remove man target in igb(4).
  
Reviewed by:jfv

Modified:
  stable/7/sys/modules/em/Makefile
  stable/7/sys/modules/igb/Makefile
  stable/7/sys/modules/ixgbe/Makefile
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/modules/em/Makefile
==
--- stable/7/sys/modules/em/MakefileMon Sep 27 17:38:19 2010
(r213212)
+++ stable/7/sys/modules/em/MakefileMon Sep 27 17:38:30 2010
(r213213)
@@ -17,10 +17,4 @@ CFLAGS += -I${.CURDIR}/../../dev/e1000
 # DEVICE_POLLING for a non-interrupt-driven method
 #CFLAGS  += -DDEVICE_POLLING
 
-clean:
-   rm -f device_if.h bus_if.h pci_if.h setdef*
-   rm -f *.o *.kld *.ko
-   rm -f @ machine
-   rm -f ${CLEANFILES}
-
 .include bsd.kmod.mk

Modified: stable/7/sys/modules/igb/Makefile
==
--- stable/7/sys/modules/igb/Makefile   Mon Sep 27 17:38:19 2010
(r213212)
+++ stable/7/sys/modules/igb/Makefile   Mon Sep 27 17:38:30 2010
(r213213)
@@ -14,14 +14,4 @@ CFLAGS += -I${.CURDIR}/../../dev/e1000 -
 # not advisable since MSIX gives better results
 #CFLAGS  += -DDEVICE_POLLING
 
-clean:
-   rm -f device_if.h bus_if.h pci_if.h setdef*
-   rm -f *.o *.kld *.ko
-   rm -f @ machine
-   rm -f ${CLEANFILES}
-
-man:
-   mv /usr/share/man/man4/igb.4.gz /usr/share/man/man4/igbSAVE.4.gz
-   cp igb.4 /usr/share/man/man4/
-
 .include bsd.kmod.mk

Modified: stable/7/sys/modules/ixgbe/Makefile
==
--- stable/7/sys/modules/ixgbe/Makefile Mon Sep 27 17:38:19 2010
(r213212)
+++ stable/7/sys/modules/ixgbe/Makefile Mon Sep 27 17:38:30 2010
(r213213)
@@ -9,9 +9,4 @@ SRCS+= ixgbe_82598.c ixgbe_82599.c
 
 CFLAGS+= -I${.CURDIR}/../../dev/ixgbe
 
-clean:
-   rm -f opt_bdg.h device_if.h bus_if.h pci_if.h setdef* *_StripErr
-   rm -f *.o *.kld *.ko
-   rm -f @ machine
-
 .include bsd.kmod.mk
___
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: r213214 - stable/8/sys/dev/e1000

2010-09-27 Thread Pyun YongHyeon
Author: yongari
Date: Mon Sep 27 17:46:11 2010
New Revision: 213214
URL: http://svn.freebsd.org/changeset/base/213214

Log:
  MFC r211906:
Make sure not to access unallocated stats memory.
  
Reviewed by:jfv

Modified:
  stable/8/sys/dev/e1000/if_igb.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (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/xen/xenpci/   (props changed)

Modified: stable/8/sys/dev/e1000/if_igb.c
==
--- stable/8/sys/dev/e1000/if_igb.c Mon Sep 27 17:38:30 2010
(r213213)
+++ stable/8/sys/dev/e1000/if_igb.c Mon Sep 27 17:46:11 2010
(r213214)
@@ -509,6 +509,11 @@ igb_attach(device_t dev)
adapter-stats =
(struct e1000_hw_stats *)malloc(sizeof \
(struct e1000_hw_stats), M_DEVBUF, M_NOWAIT | M_ZERO);
+   if (adapter-stats == NULL) {
+   device_printf(dev, Can not allocate stats memory\n);
+   error = ENOMEM;
+   goto err_late;
+   }
 
/*
** Start from a known state, this is
@@ -4893,7 +4898,8 @@ igb_vf_init_stats(struct adapter *adapte
struct e1000_vf_stats   *stats;
 
stats = (struct e1000_vf_stats  *)adapter-stats;
-
+   if (stats == NULL)
+   return;
 stats-last_gprc = E1000_READ_REG(hw, E1000_VFGPRC);
 stats-last_gorc = E1000_READ_REG(hw, E1000_VFGORC);
 stats-last_gptc = E1000_READ_REG(hw, E1000_VFGPTC);
___
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: r213215 - in head/sys: conf fs/devfs

2010-09-27 Thread Jaakko Heinonen
Author: jh
Date: Mon Sep 27 17:47:09 2010
New Revision: 213215
URL: http://svn.freebsd.org/changeset/base/213215

Log:
  Add reference counting for devfs paths containing user created symbolic
  links. The reference counting is needed to be able to determine if a
  specific devfs path exists. For true device file paths we can traverse
  the cdevp_list but a separate directory list is needed for user created
  symbolic links.
  
  Add a new directory entry flag DE_USER to mark entries which should
  unreference their parent directory on deletion.
  
  A new function to traverse cdevp_list and the directory list will be
  introduced in a separate commit.
  
  Idea from:kib
  Reviewed by:  kib

Added:
  head/sys/fs/devfs/devfs_dir.c   (contents, props changed)
Modified:
  head/sys/conf/files
  head/sys/fs/devfs/devfs.h
  head/sys/fs/devfs/devfs_devs.c
  head/sys/fs/devfs/devfs_int.h
  head/sys/fs/devfs/devfs_vnops.c

Modified: head/sys/conf/files
==
--- head/sys/conf/files Mon Sep 27 17:46:11 2010(r213214)
+++ head/sys/conf/files Mon Sep 27 17:47:09 2010(r213215)
@@ -1890,6 +1890,7 @@ fs/coda/coda_vfsops.c optional vcoda
 fs/coda/coda_vnops.c   optional vcoda
 fs/deadfs/dead_vnops.c standard
 fs/devfs/devfs_devs.c  standard
+fs/devfs/devfs_dir.c   standard
 fs/devfs/devfs_rule.c  standard
 fs/devfs/devfs_vfsops.cstandard
 fs/devfs/devfs_vnops.c standard

Modified: head/sys/fs/devfs/devfs.h
==
--- head/sys/fs/devfs/devfs.h   Mon Sep 27 17:46:11 2010(r213214)
+++ head/sys/fs/devfs/devfs.h   Mon Sep 27 17:47:09 2010(r213215)
@@ -124,6 +124,8 @@ MALLOC_DECLARE(M_DEVFS);
 
 struct componentname;
 
+TAILQ_HEAD(devfs_dlist_head, devfs_dirent);
+
 struct devfs_dirent {
struct cdev_priv*de_cdp;
int de_inode;
@@ -133,10 +135,11 @@ struct devfs_dirent {
 #defineDE_DOTDOT   0x04
 #defineDE_DOOMED   0x08
 #defineDE_COVERED  0x10
+#defineDE_USER 0x20
int de_holdcnt;
struct dirent   *de_dirent;
TAILQ_ENTRY(devfs_dirent) de_list;
-   TAILQ_HEAD(, devfs_dirent) de_dlist;
+   struct devfs_dlist_head de_dlist;
struct devfs_dirent *de_dir;
int de_links;
mode_t  de_mode;

Modified: head/sys/fs/devfs/devfs_devs.c
==
--- head/sys/fs/devfs/devfs_devs.c  Mon Sep 27 17:46:11 2010
(r213214)
+++ head/sys/fs/devfs/devfs_devs.c  Mon Sep 27 17:47:09 2010
(r213215)
@@ -338,6 +338,10 @@ devfs_delete(struct devfs_mount *dm, str
dd = devfs_parent_dirent(de);
if (dd != NULL)
DEVFS_DE_HOLD(dd);
+   if (de-de_flags  DE_USER) {
+   KASSERT(dd != NULL, (devfs_delete: NULL dd));
+   devfs_dir_unref_de(dm, dd);
+   }
} else
dd = NULL;
 
@@ -396,10 +400,17 @@ devfs_purge(struct devfs_mount *dm, stru
 
DEVFS_DE_HOLD(dd);
for (;;) {
-   de = TAILQ_FIRST(dd-de_dlist);
+   /*
+* Use TAILQ_LAST() to remove . and .. last.
+* We might need .. to resolve a path in
+* devfs_dir_unref_de().
+*/
+   de = TAILQ_LAST(dd-de_dlist, devfs_dlist_head);
if (de == NULL)
break;
TAILQ_REMOVE(dd-de_dlist, de, de_list);
+   if (de-de_flags  DE_USER)
+   devfs_dir_unref_de(dm, dd);
if (de-de_flags  (DE_DOT | DE_DOTDOT))
devfs_delete(dm, de, DEVFS_DEL_NORECURSE);
else if (de-de_dirent-d_type == DT_DIR)

Added: head/sys/fs/devfs/devfs_dir.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/fs/devfs/devfs_dir.c   Mon Sep 27 17:47:09 2010
(r213215)
@@ -0,0 +1,175 @@
+/*-
+ * Copyright (c) 2010 Jaakko Heinonen j...@freebsd.org
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS 

svn commit: r213216 - in stable/8/sys/dev: e1000 ixgb ixgbe

2010-09-27 Thread Pyun YongHyeon
Author: yongari
Date: Mon Sep 27 17:49:05 2010
New Revision: 213216
URL: http://svn.freebsd.org/changeset/base/213216

Log:
  MFC r211907:
Do not call voluntary panic(9) in case of if_alloc() failure.
  
Reviewed by:jfv

Modified:
  stable/8/sys/dev/e1000/if_em.c
  stable/8/sys/dev/e1000/if_igb.c
  stable/8/sys/dev/e1000/if_lem.c
  stable/8/sys/dev/ixgb/if_ixgb.c
  stable/8/sys/dev/ixgbe/ixgbe.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (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/xen/xenpci/   (props changed)

Modified: stable/8/sys/dev/e1000/if_em.c
==
--- stable/8/sys/dev/e1000/if_em.c  Mon Sep 27 17:47:09 2010
(r213215)
+++ stable/8/sys/dev/e1000/if_em.c  Mon Sep 27 17:49:05 2010
(r213216)
@@ -213,7 +213,7 @@ static int  em_setup_msix(struct adapter 
 static voidem_free_pci_resources(struct adapter *);
 static voidem_local_timer(void *);
 static voidem_reset(struct adapter *);
-static voidem_setup_interface(device_t, struct adapter *);
+static int em_setup_interface(device_t, struct adapter *);
 
 static voidem_setup_transmit_structures(struct adapter *);
 static voidem_initialize_transmit_unit(struct adapter *);
@@ -628,7 +628,8 @@ em_attach(device_t dev)
em_get_wakeup(dev);
 
/* Setup OS specific network interface */
-   em_setup_interface(dev, adapter);
+   if (em_setup_interface(dev, adapter) != 0)
+   goto err_late;
 
em_reset(adapter);
 
@@ -669,6 +670,8 @@ err_late:
em_free_transmit_structures(adapter);
em_free_receive_structures(adapter);
em_release_hw_control(adapter);
+   if (adapter-ifp != NULL)
+   if_free(adapter-ifp);
 err_pci:
em_free_pci_resources(adapter);
EM_CORE_LOCK_DESTROY(adapter);
@@ -2646,7 +2649,7 @@ em_reset(struct adapter *adapter)
  *  Setup networking device structure and register an interface.
  *
  **/
-static void
+static int
 em_setup_interface(device_t dev, struct adapter *adapter)
 {
struct ifnet   *ifp;
@@ -2654,8 +2657,10 @@ em_setup_interface(device_t dev, struct 
INIT_DEBUGOUT(em_setup_interface: begin);
 
ifp = adapter-ifp = if_alloc(IFT_ETHER);
-   if (ifp == NULL)
-   panic(%s: can not if_alloc(), device_get_nameunit(dev));
+   if (ifp == NULL) {
+   device_printf(dev, can not allocate ifnet structure\n);
+   return (-1);
+   }
if_initname(ifp, device_get_name(dev), device_get_unit(dev));
ifp-if_mtu = ETHERMTU;
ifp-if_init =  em_init;
@@ -2742,6 +2747,7 @@ em_setup_interface(device_t dev, struct 
}
ifmedia_add(adapter-media, IFM_ETHER | IFM_AUTO, 0, NULL);
ifmedia_set(adapter-media, IFM_ETHER | IFM_AUTO);
+   return (0);
 }
 
 

Modified: stable/8/sys/dev/e1000/if_igb.c
==
--- stable/8/sys/dev/e1000/if_igb.c Mon Sep 27 17:47:09 2010
(r213215)
+++ stable/8/sys/dev/e1000/if_igb.c Mon Sep 27 17:49:05 2010
(r213216)
@@ -178,7 +178,7 @@ static int  igb_setup_msix(struct adapter
 static voidigb_free_pci_resources(struct adapter *);
 static voidigb_local_timer(void *);
 static voidigb_reset(struct adapter *);
-static voidigb_setup_interface(device_t, struct adapter *);
+static int igb_setup_interface(device_t, struct adapter *);
 static int igb_allocate_queues(struct adapter *);
 static voidigb_configure_queues(struct adapter *);
 
@@ -564,7 +564,8 @@ igb_attach(device_t dev)
goto err_late;
 
/* Setup OS specific network interface */
-   igb_setup_interface(dev, adapter);
+   if (igb_setup_interface(dev, adapter) != 0)
+   goto err_late;
 
/* Now get a good starting state */
igb_reset(adapter);
@@ -613,6 +614,8 @@ err_late:
igb_free_transmit_structures(adapter);
igb_free_receive_structures(adapter);
igb_release_hw_control(adapter);
+   if (adapter-ifp != NULL)
+   if_free(adapter-ifp);
 err_pci:
igb_free_pci_resources(adapter);
IGB_CORE_LOCK_DESTROY(adapter);
@@ -2658,7 +2661,7 @@ igb_reset(struct adapter *adapter)
  *  Setup networking device structure and register an interface.
  *
  **/
-static void
+static int
 igb_setup_interface(device_t dev, struct adapter *adapter)
 {
struct ifnet   *ifp;
@@ -2666,8 +2669,10 @@ igb_setup_interface(device_t dev, struct
INIT_DEBUGOUT(igb_setup_interface: begin);
 
ifp = 

svn commit: r213217 - stable/8/sys/dev/e1000

2010-09-27 Thread Pyun YongHyeon
Author: yongari
Date: Mon Sep 27 17:50:56 2010
New Revision: 213217
URL: http://svn.freebsd.org/changeset/base/213217

Log:
  MFC r211909:
If em(4) failed to allocate RX buffers, do not call panic(9).
Just showing some buffer allocation error is more appropriate
action for drivers. This should fix occasional panic reported on
em(4) when driver encountered resource shortage.
  
Reviewed by:jfv

Modified:
  stable/8/sys/dev/e1000/if_em.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (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/xen/xenpci/   (props changed)

Modified: stable/8/sys/dev/e1000/if_em.c
==
--- stable/8/sys/dev/e1000/if_em.c  Mon Sep 27 17:49:05 2010
(r213216)
+++ stable/8/sys/dev/e1000/if_em.c  Mon Sep 27 17:50:56 2010
(r213217)
@@ -3843,7 +3843,7 @@ em_setup_receive_ring(struct rx_ring *rx
rxbuf = rxr-rx_buffers[j];
rxbuf-m_head = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR);
if (rxbuf-m_head == NULL)
-   panic(RX ring hdr initialization failed!\n);
+   return (ENOBUFS);
rxbuf-m_head-m_len = MCLBYTES;
rxbuf-m_head-m_flags = ~M_HASFCS; /* we strip it */
rxbuf-m_head-m_pkthdr.len = MCLBYTES;
@@ -3852,8 +3852,11 @@ em_setup_receive_ring(struct rx_ring *rx
error = bus_dmamap_load_mbuf_sg(rxr-rxtag,
rxbuf-map, rxbuf-m_head, seg,
nsegs, BUS_DMA_NOWAIT);
-   if (error != 0)
-   panic(RX ring dma initialization failed!\n);
+   if (error != 0) {
+   m_freem(rxbuf-m_head);
+   rxbuf-m_head = NULL;
+   return (error);
+   }
bus_dmamap_sync(rxr-rxtag,
rxbuf-map, BUS_DMASYNC_PREREAD);
 
___
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: r213218 - in stable/8/sys/dev: e1000 ixgb ixgbe

2010-09-27 Thread Pyun YongHyeon
Author: yongari
Date: Mon Sep 27 17:54:04 2010
New Revision: 213218
URL: http://svn.freebsd.org/changeset/base/213218

Log:
  MFC r211913:
Do not allocate multicast array memory in multicast filter
configuration function. For failed memory allocations, em(4)/lem(4)
called panic(9) which is not acceptable on production box.
igb(4)/ixgb(4)/ix(4) allocated the required memory in stack which
consumed 768 bytes of stack memory which looks too big.
  
To address these issues, allocate multicast array memory in device
attach time and make multicast configuration success under any
conditions. This change also removes the excessive use of memory in
stack.
  
Reviewed by:jfv

Modified:
  stable/8/sys/dev/e1000/if_em.c
  stable/8/sys/dev/e1000/if_em.h
  stable/8/sys/dev/e1000/if_igb.c
  stable/8/sys/dev/e1000/if_igb.h
  stable/8/sys/dev/e1000/if_lem.c
  stable/8/sys/dev/e1000/if_lem.h
  stable/8/sys/dev/ixgb/if_ixgb.c
  stable/8/sys/dev/ixgb/if_ixgb.h
  stable/8/sys/dev/ixgbe/ixgbe.c
  stable/8/sys/dev/ixgbe/ixgbe.h
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (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/xen/xenpci/   (props changed)

Modified: stable/8/sys/dev/e1000/if_em.c
==
--- stable/8/sys/dev/e1000/if_em.c  Mon Sep 27 17:50:56 2010
(r213217)
+++ stable/8/sys/dev/e1000/if_em.c  Mon Sep 27 17:54:04 2010
(r213218)
@@ -576,6 +576,15 @@ em_attach(device_t dev)
goto err_pci;
}
 
+   /* Allocate multicast array memory. */
+   adapter-mta = malloc(sizeof(u8) * ETH_ADDR_LEN *
+   MAX_NUM_MULTICAST_ADDRESSES, M_DEVBUF, M_NOWAIT);
+   if (adapter-mta == NULL) {
+   device_printf(dev, Can not allocate multicast setup array\n);
+   error = ENOMEM;
+   goto err_late;
+   }
+
/*
** Start from a known state, this is
** important in reading the nvm and
@@ -674,6 +683,7 @@ err_late:
if_free(adapter-ifp);
 err_pci:
em_free_pci_resources(adapter);
+   free(adapter-mta, M_DEVBUF);
EM_CORE_LOCK_DESTROY(adapter);
 
return (error);
@@ -739,6 +749,7 @@ em_detach(device_t dev)
em_free_receive_structures(adapter);
 
em_release_hw_control(adapter);
+   free(adapter-mta, M_DEVBUF);
 
return (0);
 }
@@ -1998,6 +2009,9 @@ em_set_multi(struct adapter *adapter)
 
IOCTL_DEBUGOUT(em_set_multi: begin);
 
+   mta = adapter-mta;
+   bzero(mta, sizeof(u8) * ETH_ADDR_LEN * MAX_NUM_MULTICAST_ADDRESSES);
+
if (adapter-hw.mac.type == e1000_82542  
adapter-hw.revision_id == E1000_REVISION_2) {
reg_rctl = E1000_READ_REG(adapter-hw, E1000_RCTL);
@@ -2008,13 +2022,6 @@ em_set_multi(struct adapter *adapter)
msec_delay(5);
}
 
-   /* Allocate temporary memory to setup array */
-   mta = malloc(sizeof(u8) *
-   (ETH_ADDR_LEN * MAX_NUM_MULTICAST_ADDRESSES),
-   M_DEVBUF, M_NOWAIT | M_ZERO);
-   if (mta == NULL)
-   panic(em_set_multi memory failure\n);
-
 #if __FreeBSD_version  80
IF_ADDR_LOCK(ifp);
 #else
@@ -2052,7 +2059,6 @@ em_set_multi(struct adapter *adapter)
if (adapter-hw.bus.pci_cmd_word  CMD_MEM_WRT_INVALIDATE)
e1000_pci_set_mwi(adapter-hw);
}
-   free(mta, M_DEVBUF);
 }
 
 

Modified: stable/8/sys/dev/e1000/if_em.h
==
--- stable/8/sys/dev/e1000/if_em.h  Mon Sep 27 17:50:56 2010
(r213217)
+++ stable/8/sys/dev/e1000/if_em.h  Mon Sep 27 17:54:04 2010
(r213218)
@@ -391,6 +391,8 @@ struct adapter {
boolhas_manage;
boolhas_amt;
 
+   /* Multicast array memory */
+   u8  *mta;
/* Info about the board itself */
uint8_t link_active;
uint16_tlink_speed;

Modified: stable/8/sys/dev/e1000/if_igb.c
==
--- stable/8/sys/dev/e1000/if_igb.c Mon Sep 27 17:50:56 2010
(r213217)
+++ stable/8/sys/dev/e1000/if_igb.c Mon Sep 27 17:54:04 2010
(r213218)
@@ -515,6 +515,15 @@ igb_attach(device_t dev)
goto err_late;
}
 
+   /* Allocate multicast array memory. */
+   adapter-mta = malloc(sizeof(u8) * ETH_ADDR_LEN *
+   MAX_NUM_MULTICAST_ADDRESSES, M_DEVBUF, M_NOWAIT);
+   if (adapter-mta == NULL) {
+   device_printf(dev, Can not allocate multicast setup array\n);
+   error = ENOMEM;
+   goto err_late;
+   }
+
 

svn commit: r213220 - in stable/7/sys/dev: e1000 ixgb ixgbe

2010-09-27 Thread Pyun YongHyeon
Author: yongari
Date: Mon Sep 27 18:20:04 2010
New Revision: 213220
URL: http://svn.freebsd.org/changeset/base/213220

Log:
  MFC r211907:
Do not call voluntary panic(9) in case of if_alloc() failure.
  
Reviewed by:jfv

Modified:
  stable/7/sys/dev/e1000/if_em.c
  stable/7/sys/dev/e1000/if_igb.c
  stable/7/sys/dev/e1000/if_lem.c
  stable/7/sys/dev/ixgb/if_ixgb.c
  stable/7/sys/dev/ixgbe/ixgbe.c
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/dev/e1000/if_em.c
==
--- stable/7/sys/dev/e1000/if_em.c  Mon Sep 27 18:16:28 2010
(r213219)
+++ stable/7/sys/dev/e1000/if_em.c  Mon Sep 27 18:20:04 2010
(r213220)
@@ -213,7 +213,7 @@ static int  em_setup_msix(struct adapter 
 static voidem_free_pci_resources(struct adapter *);
 static voidem_local_timer(void *);
 static voidem_reset(struct adapter *);
-static voidem_setup_interface(device_t, struct adapter *);
+static int em_setup_interface(device_t, struct adapter *);
 
 static voidem_setup_transmit_structures(struct adapter *);
 static voidem_initialize_transmit_unit(struct adapter *);
@@ -628,7 +628,8 @@ em_attach(device_t dev)
em_get_wakeup(dev);
 
/* Setup OS specific network interface */
-   em_setup_interface(dev, adapter);
+   if (em_setup_interface(dev, adapter) != 0)
+   goto err_late;
 
em_reset(adapter);
 
@@ -669,6 +670,8 @@ err_late:
em_free_transmit_structures(adapter);
em_free_receive_structures(adapter);
em_release_hw_control(adapter);
+   if (adapter-ifp != NULL)
+   if_free(adapter-ifp);
 err_pci:
em_free_pci_resources(adapter);
EM_CORE_LOCK_DESTROY(adapter);
@@ -2644,7 +2647,7 @@ em_reset(struct adapter *adapter)
  *  Setup networking device structure and register an interface.
  *
  **/
-static void
+static int
 em_setup_interface(device_t dev, struct adapter *adapter)
 {
struct ifnet   *ifp;
@@ -2652,8 +2655,10 @@ em_setup_interface(device_t dev, struct 
INIT_DEBUGOUT(em_setup_interface: begin);
 
ifp = adapter-ifp = if_alloc(IFT_ETHER);
-   if (ifp == NULL)
-   panic(%s: can not if_alloc(), device_get_nameunit(dev));
+   if (ifp == NULL) {
+   device_printf(dev, can not allocate ifnet structure\n);
+   return (-1);
+   }
if_initname(ifp, device_get_name(dev), device_get_unit(dev));
ifp-if_mtu = ETHERMTU;
ifp-if_init =  em_init;
@@ -2740,6 +2745,7 @@ em_setup_interface(device_t dev, struct 
}
ifmedia_add(adapter-media, IFM_ETHER | IFM_AUTO, 0, NULL);
ifmedia_set(adapter-media, IFM_ETHER | IFM_AUTO);
+   return (0);
 }
 
 

Modified: stable/7/sys/dev/e1000/if_igb.c
==
--- stable/7/sys/dev/e1000/if_igb.c Mon Sep 27 18:16:28 2010
(r213219)
+++ stable/7/sys/dev/e1000/if_igb.c Mon Sep 27 18:20:04 2010
(r213220)
@@ -177,7 +177,7 @@ static int  igb_setup_msix(struct adapter
 static voidigb_free_pci_resources(struct adapter *);
 static voidigb_local_timer(void *);
 static voidigb_reset(struct adapter *);
-static voidigb_setup_interface(device_t, struct adapter *);
+static int igb_setup_interface(device_t, struct adapter *);
 static int igb_allocate_queues(struct adapter *);
 static voidigb_configure_queues(struct adapter *);
 
@@ -543,7 +543,8 @@ igb_attach(device_t dev)
goto err_late;
 
/* Setup OS specific network interface */
-   igb_setup_interface(dev, adapter);
+   if (igb_setup_interface(dev, adapter) != 0)
+   goto err_late;
 
/* Now get a good starting state */
igb_reset(adapter);
@@ -592,6 +593,8 @@ err_late:
igb_free_transmit_structures(adapter);
igb_free_receive_structures(adapter);
igb_release_hw_control(adapter);
+   if (adapter-ifp != NULL)
+   if_free(adapter-ifp);
 err_pci:
igb_free_pci_resources(adapter);
IGB_CORE_LOCK_DESTROY(adapter);
@@ -2615,7 +2618,7 @@ igb_reset(struct adapter *adapter)
  *  Setup networking device structure and register an interface.
  *
  **/
-static void
+static int
 igb_setup_interface(device_t dev, struct adapter *adapter)
 {
struct ifnet   *ifp;
@@ -2623,8 +2626,10 @@ igb_setup_interface(device_t dev, struct
INIT_DEBUGOUT(igb_setup_interface: begin);
 
ifp = adapter-ifp = if_alloc(IFT_ETHER);
-   if (ifp == NULL)
-   panic(%s: can not if_alloc(), 

svn commit: r213221 - head/sys/fs/devfs

2010-09-27 Thread Jaakko Heinonen
Author: jh
Date: Mon Sep 27 18:20:56 2010
New Revision: 213221
URL: http://svn.freebsd.org/changeset/base/213221

Log:
  Add a new function devfs_dev_exists() to be able to find out if a
  specific devfs path already exists.
  
  The function will be used from kern_conf.c to detect duplicate device
  registrations. Callers must hold the devmtx mutex.
  
  Reviewed by:  kib

Modified:
  head/sys/fs/devfs/devfs_devs.c
  head/sys/fs/devfs/devfs_int.h

Modified: head/sys/fs/devfs/devfs_devs.c
==
--- head/sys/fs/devfs/devfs_devs.c  Mon Sep 27 18:20:04 2010
(r213220)
+++ head/sys/fs/devfs/devfs_devs.c  Mon Sep 27 18:20:56 2010
(r213221)
@@ -142,6 +142,27 @@ devfs_alloc(int flags)
return (cdev);
 }
 
+int
+devfs_dev_exists(const char *name)
+{
+   struct cdev_priv *cdp;
+
+   mtx_assert(devmtx, MA_OWNED);
+
+   TAILQ_FOREACH(cdp, cdevp_list, cdp_list) {
+   if ((cdp-cdp_flags  CDP_ACTIVE) == 0)
+   continue;
+   if (devfs_pathpath(cdp-cdp_c.si_name, name) != 0)
+   return (1);
+   if (devfs_pathpath(name, cdp-cdp_c.si_name) != 0)
+   return (1);
+   }
+   if (devfs_dir_find(name) != 0)
+   return (1);
+
+   return (0);
+}
+
 void
 devfs_free(struct cdev *cdev)
 {

Modified: head/sys/fs/devfs/devfs_int.h
==
--- head/sys/fs/devfs/devfs_int.h   Mon Sep 27 18:20:04 2010
(r213220)
+++ head/sys/fs/devfs/devfs_int.h   Mon Sep 27 18:20:56 2010
(r213221)
@@ -72,6 +72,7 @@ struct cdev_priv {
 #definecdev2priv(c)member2struct(cdev_priv, cdp_c, c)
 
 struct cdev *devfs_alloc(int);
+int devfs_dev_exists(const char *);
 void devfs_free(struct cdev *);
 void devfs_create(struct cdev *dev);
 void devfs_destroy(struct cdev *dev);
___
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: r213222 - stable/7/sys/dev/e1000

2010-09-27 Thread Pyun YongHyeon
Author: yongari
Date: Mon Sep 27 18:22:50 2010
New Revision: 213222
URL: http://svn.freebsd.org/changeset/base/213222

Log:
  MFC r211909:
If em(4) failed to allocate RX buffers, do not call panic(9).
Just showing some buffer allocation error is more appropriate
action for drivers. This should fix occasional panic reported on
em(4) when driver encountered resource shortage.
  
Reviewed by:jfv

Modified:
  stable/7/sys/dev/e1000/if_em.c
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/dev/e1000/if_em.c
==
--- stable/7/sys/dev/e1000/if_em.c  Mon Sep 27 18:20:56 2010
(r213221)
+++ stable/7/sys/dev/e1000/if_em.c  Mon Sep 27 18:22:50 2010
(r213222)
@@ -3841,7 +3841,7 @@ em_setup_receive_ring(struct rx_ring *rx
rxbuf = rxr-rx_buffers[j];
rxbuf-m_head = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR);
if (rxbuf-m_head == NULL)
-   panic(RX ring hdr initialization failed!\n);
+   return (ENOBUFS);
rxbuf-m_head-m_len = MCLBYTES;
rxbuf-m_head-m_flags = ~M_HASFCS; /* we strip it */
rxbuf-m_head-m_pkthdr.len = MCLBYTES;
@@ -3850,8 +3850,11 @@ em_setup_receive_ring(struct rx_ring *rx
error = bus_dmamap_load_mbuf_sg(rxr-rxtag,
rxbuf-map, rxbuf-m_head, seg,
nsegs, BUS_DMA_NOWAIT);
-   if (error != 0)
-   panic(RX ring dma initialization failed!\n);
+   if (error != 0) {
+   m_freem(rxbuf-m_head);
+   rxbuf-m_head = NULL;
+   return (error);
+   }
bus_dmamap_sync(rxr-rxtag,
rxbuf-map, BUS_DMASYNC_PREREAD);
 
___
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: r213223 - in stable/7/sys/dev: e1000 ixgb ixgbe

2010-09-27 Thread Pyun YongHyeon
Author: yongari
Date: Mon Sep 27 18:34:04 2010
New Revision: 213223
URL: http://svn.freebsd.org/changeset/base/213223

Log:
  MFC r211913:
Do not allocate multicast array memory in multicast filter
configuration function. For failed memory allocations, em(4)/lem(4)
called panic(9) which is not acceptable on production box.
igb(4)/ixgb(4)/ix(4) allocated the required memory in stack which
consumed 768 bytes of stack memory which looks too big.
  
To address these issues, allocate multicast array memory in device
attach time and make multicast configuration success under any
conditions. This change also removes the excessive use of memory in
stack.
  
Reviewed by:jfv

Modified:
  stable/7/sys/dev/e1000/if_em.c
  stable/7/sys/dev/e1000/if_em.h
  stable/7/sys/dev/e1000/if_igb.c
  stable/7/sys/dev/e1000/if_igb.h
  stable/7/sys/dev/e1000/if_lem.c
  stable/7/sys/dev/e1000/if_lem.h
  stable/7/sys/dev/ixgb/if_ixgb.c
  stable/7/sys/dev/ixgb/if_ixgb.h
  stable/7/sys/dev/ixgbe/ixgbe.c
  stable/7/sys/dev/ixgbe/ixgbe.h
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/dev/e1000/if_em.c
==
--- stable/7/sys/dev/e1000/if_em.c  Mon Sep 27 18:22:50 2010
(r213222)
+++ stable/7/sys/dev/e1000/if_em.c  Mon Sep 27 18:34:04 2010
(r213223)
@@ -576,6 +576,15 @@ em_attach(device_t dev)
goto err_pci;
}
 
+   /* Allocate multicast array memory. */
+   adapter-mta = malloc(sizeof(u8) * ETH_ADDR_LEN *
+   MAX_NUM_MULTICAST_ADDRESSES, M_DEVBUF, M_NOWAIT);
+   if (adapter-mta == NULL) {
+   device_printf(dev, Can not allocate multicast setup array\n);
+   error = ENOMEM;
+   goto err_late;
+   }
+
/*
** Start from a known state, this is
** important in reading the nvm and
@@ -674,6 +683,7 @@ err_late:
if_free(adapter-ifp);
 err_pci:
em_free_pci_resources(adapter);
+   free(adapter-mta, M_DEVBUF);
EM_CORE_LOCK_DESTROY(adapter);
 
return (error);
@@ -739,6 +749,7 @@ em_detach(device_t dev)
em_free_receive_structures(adapter);
 
em_release_hw_control(adapter);
+   free(adapter-mta, M_DEVBUF);
 
return (0);
 }
@@ -1996,6 +2007,9 @@ em_set_multi(struct adapter *adapter)
 
IOCTL_DEBUGOUT(em_set_multi: begin);
 
+   mta = adapter-mta;
+   bzero(mta, sizeof(u8) * ETH_ADDR_LEN * MAX_NUM_MULTICAST_ADDRESSES);
+
if (adapter-hw.mac.type == e1000_82542  
adapter-hw.revision_id == E1000_REVISION_2) {
reg_rctl = E1000_READ_REG(adapter-hw, E1000_RCTL);
@@ -2006,13 +2020,6 @@ em_set_multi(struct adapter *adapter)
msec_delay(5);
}
 
-   /* Allocate temporary memory to setup array */
-   mta = malloc(sizeof(u8) *
-   (ETH_ADDR_LEN * MAX_NUM_MULTICAST_ADDRESSES),
-   M_DEVBUF, M_NOWAIT | M_ZERO);
-   if (mta == NULL)
-   panic(em_set_multi memory failure\n);
-
 #if __FreeBSD_version  80
IF_ADDR_LOCK(ifp);
 #else
@@ -2050,7 +2057,6 @@ em_set_multi(struct adapter *adapter)
if (adapter-hw.bus.pci_cmd_word  CMD_MEM_WRT_INVALIDATE)
e1000_pci_set_mwi(adapter-hw);
}
-   free(mta, M_DEVBUF);
 }
 
 

Modified: stable/7/sys/dev/e1000/if_em.h
==
--- stable/7/sys/dev/e1000/if_em.h  Mon Sep 27 18:22:50 2010
(r213222)
+++ stable/7/sys/dev/e1000/if_em.h  Mon Sep 27 18:34:04 2010
(r213223)
@@ -391,6 +391,8 @@ struct adapter {
boolhas_manage;
boolhas_amt;
 
+   /* Multicast array memory */
+   u8  *mta;
/* Info about the board itself */
uint8_t link_active;
uint16_tlink_speed;

Modified: stable/7/sys/dev/e1000/if_igb.c
==
--- stable/7/sys/dev/e1000/if_igb.c Mon Sep 27 18:22:50 2010
(r213222)
+++ stable/7/sys/dev/e1000/if_igb.c Mon Sep 27 18:34:04 2010
(r213223)
@@ -494,6 +494,15 @@ igb_attach(device_t dev)
goto err_pci;
}
 
+   /* Allocate multicast array memory. */
+   adapter-mta = malloc(sizeof(u8) * ETH_ADDR_LEN *
+   MAX_NUM_MULTICAST_ADDRESSES, M_DEVBUF, M_NOWAIT);
+   if (adapter-mta == NULL) {
+   device_printf(dev, Can not allocate multicast setup array\n);
+   error = ENOMEM;
+   goto err_late;
+   }
+
/*
** Start from a known state, this is
** important in reading the nvm and
@@ 

svn commit: r213224 - in head/usr.bin/clang: clang tblgen

2010-09-27 Thread Dimitry Andric
Author: dim
Date: Mon Sep 27 19:03:18 2010
New Revision: 213224
URL: http://svn.freebsd.org/changeset/base/213224

Log:
  Add manpages for clang and tblgen.  These were generated from upstream's
  tools/clang/docs/tools/clang.pod and docs/CommandGuide/tblgen.pod,
  respectively.
  
  Approved-by:  rpaulo (mentor)

Added:
  head/usr.bin/clang/clang/clang.1   (contents, props changed)
  head/usr.bin/clang/tblgen/tblgen.1   (contents, props changed)
Modified:
  head/usr.bin/clang/clang/Makefile
  head/usr.bin/clang/tblgen/Makefile

Modified: head/usr.bin/clang/clang/Makefile
==
--- head/usr.bin/clang/clang/Makefile   Mon Sep 27 18:34:04 2010
(r213223)
+++ head/usr.bin/clang/clang/Makefile   Mon Sep 27 19:03:18 2010
(r213224)
@@ -8,7 +8,6 @@ SRCDIR= tools/clang/tools/driver
 SRCS=  cc1_main.cpp \
cc1as_main.cpp \
driver.cpp
-MAN=
 
 LINKS= ${BINDIR}/clang ${BINDIR}/clang++
 

Added: head/usr.bin/clang/clang/clang.1
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/usr.bin/clang/clang/clang.1Mon Sep 27 19:03:18 2010
(r213224)
@@ -0,0 +1,500 @@
+.\ $FreeBSD$
+.\ Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\
+.\ Standard preamble:
+.\ 
+.de Sp \ Vertical space (when we can't use .PP)
+.if t .sp .5v
+.if n .sp
+..
+.de Vb \ Begin verbatim text
+.ft CW
+.nf
+.ne \\$1
+..
+.de Ve \ End verbatim text
+.ft R
+.fi
+..
+.\ Set up some character translations and predefined strings.  \*(-- will
+.\ give an unbreakable dash, \*(PI will give pi, \*(L will give a left
+.\ double quote, and \*(R will give a right double quote.  \*(C+ will
+.\ give a nicer C++.  Capital omega is used to do unbreakable dashes and
+.\ therefore won't be available.  \*(C` and \*(C' expand to `' in nroff,
+.\ nothing in troff, for use with C.
+.tr \(*W-
+.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
+.ie n \{\
+.ds -- \(*W-
+.ds PI pi
+.if (\n(.H=4u)(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\ diablo 10 pitch
+.if (\n(.H=4u)(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\  diablo 12 pitch
+.ds L 
+.ds R 
+.ds C` 
+.ds C' 
+'br\}
+.el\{\
+.ds -- \|\(em\|
+.ds PI \(*p
+.ds L ``
+.ds R ''
+'br\}
+.\
+.\ Escape single quotes in literal strings from groff's Unicode transform.
+.ie \n(.g .ds Aq \(aq
+.el   .ds Aq '
+.\
+.\ If the F register is turned on, we'll generate index entries on stderr for
+.\ titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
+.\ entries marked with X in POD.  Of course, you'll have to process the
+.\ output yourself in some meaningful fashion.
+.ie \nF \{\
+.de IX
+.tm Index:\\$1\t\\n%\t\\$2
+..
+.nr % 0
+.rr F
+.\}
+.el \{\
+.de IX
+..
+.\}
+.\
+.\ Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
+.\ Fear.  Run.  Save yourself.  No user-serviceable parts.
+.\ fudge factors for nroff and troff
+.if n \{\
+.ds #H 0
+.ds #V .8m
+.ds #F .3m
+.ds #[ \f1
+.ds #] \fP
+.\}
+.if t \{\
+.ds #H ((1u-(n(.fu%2u))*.13m)
+.ds #V .6m
+.ds #F 0
+.ds #[ \
+.ds #] \
+.\}
+.\ simple accents for nroff and troff
+.if n \{\
+.ds ' \
+.ds ` \
+.ds ^ \
+.ds , \
+.ds ~ ~
+.ds /
+.\}
+.if t \{\
+.ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h|\\n:u
+.ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
+.ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
+.ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
+.ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
+.ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
+.\}
+.\ troff and (daisy-wheel) nroff accents
+.ds : 
\\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
+.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
+.ds o 
\\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
+.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
+.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
+.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
+.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
+.ds ae a\h'-(\w'a'u*4/10)'e
+.ds Ae A\h'-(\w'A'u*4/10)'E
+.\ corrections for vroff
+.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
+.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
+.\ for low resolution devices (crt and lpr)
+.if \n(.H23 .if \n(.V19 \
+\{\
+.ds : e
+.ds 8 ss
+.ds o a
+.ds d- d\h'-1'\(ga
+.ds D- D\h'-1'\(hy
+.ds th \o'bp'
+.ds Th \o'LP'
+.ds ae ae
+.ds Ae AE
+.\}
+.rm #[ #] #H #V #F C
+.\ 
+.\
+.IX Title CLANG 1
+.TH CLANG 1 2010-09-27 Clang 2.8 Clang Tools Documentation
+.\ For nroff, 

Re: svn commit: r213226 - head/sys/i386/i386

2010-09-27 Thread John Baldwin
On Monday, September 27, 2010 3:36:16 pm John Baldwin wrote:
 Author: jhb
 Date: Mon Sep 27 19:36:15 2010
 New Revision: 213226
 URL: http://svn.freebsd.org/changeset/base/213226
 
 Log:
   Rewrite the i386 memory probe:
   - Check for SMAP data from the loader first.  If it exists, don't bother
 doing any VM86 calls at all.  This will be more friendly for non-BIOS
 boot environments such as EFI, etc.
   - Move the base memory setup into a new basemem_setup() routine instead
 of duplicating it.
   - Simplify the XEN case by removing all of the VM86/SMAP parsing code rather
 than just jumping over it.
   - Adjust some comments to better explain the code flow.

This could maybe be cleaned up a bit further by splitting getmemsize() up
into two routines: one to populate physmap[], and one to do the rest.  Then
XEN could just have a separate routine for the first function for example.

-- 
John Baldwin
___
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: r213227 - head/sys/conf

2010-09-27 Thread Juli Mallett
Author: jmallett
Date: Mon Sep 27 19:45:34 2010
New Revision: 213227
URL: http://svn.freebsd.org/changeset/base/213227

Log:
  Use a single program header to fix loading 64-bit kernels on old versions of
  U-Boot.

Modified:
  head/sys/conf/ldscript.mips.octeon1.64

Modified: head/sys/conf/ldscript.mips.octeon1.64
==
--- head/sys/conf/ldscript.mips.octeon1.64  Mon Sep 27 19:36:15 2010
(r213226)
+++ head/sys/conf/ldscript.mips.octeon1.64  Mon Sep 27 19:45:34 2010
(r213227)
@@ -7,24 +7,29 @@ ENTRY(_start)
__DYNAMIC = 0;
 PROVIDE (_DYNAMIC = 0);
 
+PHDRS {
+   text PT_LOAD FLAGS(0x7);
+}
+
 SECTIONS {
. = KERNLOADADDR + SIZEOF_HEADERS;
 
-   .text . : {
+   .text : {
*(.text)
*(.dynamic)
etext = .;
_etext = .;
. = ALIGN(0x2000);
-   }
+   } : text
 
-   .rodata ALIGN(0x2000) : {
+   . = ALIGN(0x2000);
+   .rodata : {
_fdata = .;
*(.rodata)
. = ALIGN(32);
}

-   .data . : {
+   .data : {
 _rwdata = .;
*(.data)
. = ALIGN(32);
@@ -33,15 +38,15 @@ SECTIONS {
 
_gp = (. + 0x8000);
 
-   .sdata . : {
+   .sdata : {
 _small_start = .;
*(.sdata)
. = ALIGN(32);
edata = .;
_edata = .;
-   }
+   } : text
 
-   .sbss . : {
+   .sbss : {
__bss_start = .;
_fbss = .;
*(.sbss) *(.scommon)
@@ -49,7 +54,7 @@ SECTIONS {
. = ALIGN(32);
}
 
-   .bss . : {
+   .bss : {
*(.bss)
*(COMMON)
. = ALIGN(32);
___
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: r213228 - head/sys/mips/cavium

2010-09-27 Thread Juli Mallett
Author: jmallett
Date: Mon Sep 27 20:12:57 2010
New Revision: 213228
URL: http://svn.freebsd.org/changeset/base/213228

Log:
  o) Program the Lanner MR-320 for 32-bit mode, too.
  o) Give a virtual address for I/O ports on n64.
  o) On the Portwell CAM-0100, return the right IRQ for the on-board SATA.
  o) Except on bridges, only set PORTEN and MEMEN on devices that have I/O or
 memory BARs respectively.
  o) Disable PORTEN and MEMEN while reprogramming BARs.
  o) On the Lanner MR-955, set the Tx DMA power register for the on-board 
Promise
 SATA controller.

Modified:
  head/sys/mips/cavium/octopci.c

Modified: head/sys/mips/cavium/octopci.c
==
--- head/sys/mips/cavium/octopci.c  Mon Sep 27 19:45:34 2010
(r213227)
+++ head/sys/mips/cavium/octopci.c  Mon Sep 27 20:12:57 2010
(r213228)
@@ -92,7 +92,7 @@ static void   octopci_write_config(device_
 uint32_t, int);
 static int octopci_route_interrupt(device_t, device_t, int);
 
-static voidoctopci_init_bar(device_t, unsigned, unsigned, unsigned, 
unsigned);
+static voidoctopci_init_bar(device_t, unsigned, unsigned, unsigned, 
unsigned, uint8_t *);
 static unsignedoctopci_init_device(device_t, unsigned, unsigned, 
unsigned, unsigned);
 static unsignedoctopci_init_bus(device_t, unsigned);
 static uint64_toctopci_cs_addr(unsigned, unsigned, unsigned, unsigned);
@@ -148,6 +148,7 @@ octopci_attach(device_t dev)
 */
switch (cvmx_sysinfo_get()-board_type) {
 #if defined(OCTEON_VENDOR_LANNER)
+   case CVMX_BOARD_TYPE_CUST_LANNER_MR320:
case CVMX_BOARD_TYPE_CUST_LANNER_MR955:
/* 32-bit PCI-X */
cvmx_write_csr(CVMX_CIU_SOFT_PRST, 0x0);
@@ -422,14 +423,14 @@ octopci_alloc_resource(device_t bus, dev
break;
case SYS_RES_IOPORT:
rman_set_bushandle(res, 
CVMX_ADDR_DID(CVMX_FULL_DID(CVMX_OCT_DID_PCI, CVMX_OCT_SUBDID_PCI_IO)) + 
rman_get_start(res));
+#if __mips_n64
+   rman_set_virtual(res, (void *)rman_get_bushandle(res));
+#else
/*
 * XXX
-* We should just disallow use of io ports on !n64 since without
-* 64-bit PTEs we can't even do a 32-bit virtual address
-* mapped to them.
+* We can't access ports via a 32-bit pointer.
 */
-#if 0
-   rman_set_virtual(res, (void *)rman_get_bushandle(res));
+   rman_set_virtual(res, NULL);
 #endif
break;
}
@@ -549,8 +550,19 @@ octopci_route_interrupt(device_t dev, de
 slot = pci_get_slot(child);
 func = pci_get_function(child);
 
-#if defined(OCTEON_VENDOR_LANNER)
+   /*
+* Board types we have to know at compile-time.
+*/
+#if defined(OCTEON_BOARD_CAPK_0100ND)
+   if (bus == 0  slot == 12  func == 0)
+   return (CVMX_IRQ_PCI_INT2);
+#endif
+
+   /*
+* For board types we can determine at runtime.
+*/
switch (cvmx_sysinfo_get()-board_type) {
+#if defined(OCTEON_VENDOR_LANNER)
case CVMX_BOARD_TYPE_CUST_LANNER_MR955:
return (CVMX_IRQ_PCI_INT0 + pin - 1);
case CVMX_BOARD_TYPE_CUST_LANNER_MR320:
@@ -562,10 +574,10 @@ octopci_route_interrupt(device_t dev, de
return (CVMX_IRQ_PCI_INT0 + (irq  3));
}
break;
+#endif
default:
break;
}
-#endif
 
irq = slot + pin - 3;
 
@@ -573,7 +585,7 @@ octopci_route_interrupt(device_t dev, de
 }
 
 static void
-octopci_init_bar(device_t dev, unsigned b, unsigned s, unsigned f, unsigned 
barnum)
+octopci_init_bar(device_t dev, unsigned b, unsigned s, unsigned f, unsigned 
barnum, uint8_t *commandp)
 {
struct octopci_softc *sc;
uint32_t bar;
@@ -603,6 +615,11 @@ octopci_init_bar(device_t dev, unsigned 
octopci_write_config(dev, b, s, f, PCIR_BAR(barnum),
CVMX_OCT_PCI_IO_BASE + sc-sc_io_next, 4);
sc-sc_io_next += size;
+
+   /*
+* Enable I/O ports.
+*/
+   *commandp |= PCIM_CMD_PORTEN;
} else {
size = ~(bar  (uint32_t)PCIM_BAR_MEM_BASE) + 1;
 
@@ -615,6 +632,11 @@ octopci_init_bar(device_t dev, unsigned 
octopci_write_config(dev, b, s, f, PCIR_BAR(barnum),
CVMX_OCT_PCI_MEM1_BASE + sc-sc_mem1_next, 4);
sc-sc_mem1_next += size;
+
+   /*
+* Enable memory access.
+*/
+   *commandp |= PCIM_CMD_MEMEN;
}
 }
 
@@ -630,6 +652,13 @@ octopci_init_device(device_t dev, unsign
/* Read header type (again.)  */
hdrtype = octopci_read_config(dev, b, s, f, PCIR_HDRTYPE, 1);
 
+   /*
+* Disable memory 

svn commit: r213229 - in head/sys/dev: dc mii

2010-09-27 Thread Marius Strobl
Author: marius
Date: Mon Sep 27 20:31:03 2010
New Revision: 213229
URL: http://svn.freebsd.org/changeset/base/213229

Log:
  Use the mii_data provided via mii_attach_args and mii_pdata respectively
  instead of reaching out for the softc of the parent.

Modified:
  head/sys/dev/dc/dcphy.c
  head/sys/dev/dc/pnphy.c
  head/sys/dev/mii/acphy.c
  head/sys/dev/mii/amphy.c
  head/sys/dev/mii/atphy.c
  head/sys/dev/mii/axphy.c
  head/sys/dev/mii/bmtphy.c
  head/sys/dev/mii/brgphy.c
  head/sys/dev/mii/ciphy.c
  head/sys/dev/mii/e1000phy.c
  head/sys/dev/mii/exphy.c
  head/sys/dev/mii/gentbi.c
  head/sys/dev/mii/icsphy.c
  head/sys/dev/mii/inphy.c
  head/sys/dev/mii/ip1000phy.c
  head/sys/dev/mii/jmphy.c
  head/sys/dev/mii/lxtphy.c
  head/sys/dev/mii/mii_physubr.c
  head/sys/dev/mii/mlphy.c
  head/sys/dev/mii/nsgphy.c
  head/sys/dev/mii/nsphy.c
  head/sys/dev/mii/nsphyter.c
  head/sys/dev/mii/pnaphy.c
  head/sys/dev/mii/qsphy.c
  head/sys/dev/mii/rgephy.c
  head/sys/dev/mii/rlphy.c
  head/sys/dev/mii/rlswitch.c
  head/sys/dev/mii/ruephy.c
  head/sys/dev/mii/smcphy.c
  head/sys/dev/mii/tdkphy.c
  head/sys/dev/mii/truephy.c
  head/sys/dev/mii/ukphy.c
  head/sys/dev/mii/xmphy.c

Modified: head/sys/dev/dc/dcphy.c
==
--- head/sys/dev/dc/dcphy.c Mon Sep 27 20:12:57 2010(r213228)
+++ head/sys/dev/dc/dcphy.c Mon Sep 27 20:31:03 2010(r213229)
@@ -146,7 +146,7 @@ dcphy_attach(device_t dev)
sc = device_get_softc(dev);
ma = device_get_ivars(dev);
sc-mii_dev = device_get_parent(dev);
-   mii = device_get_softc(sc-mii_dev);
+   mii = ma-mii_data;
LIST_INSERT_HEAD(mii-mii_phys, sc, mii_list);
 
sc-mii_inst = mii-mii_instance;

Modified: head/sys/dev/dc/pnphy.c
==
--- head/sys/dev/dc/pnphy.c Mon Sep 27 20:12:57 2010(r213228)
+++ head/sys/dev/dc/pnphy.c Mon Sep 27 20:31:03 2010(r213229)
@@ -129,7 +129,7 @@ pnphy_attach(device_t dev)
sc = device_get_softc(dev);
ma = device_get_ivars(dev);
sc-mii_dev = device_get_parent(dev);
-   mii = device_get_softc(sc-mii_dev);
+   mii = ma-mii_data;
LIST_INSERT_HEAD(mii-mii_phys, sc, mii_list);
 
sc-mii_inst = mii-mii_instance;

Modified: head/sys/dev/mii/acphy.c
==
--- head/sys/dev/mii/acphy.cMon Sep 27 20:12:57 2010(r213228)
+++ head/sys/dev/mii/acphy.cMon Sep 27 20:31:03 2010(r213229)
@@ -129,7 +129,7 @@ acphy_attach(device_t dev)
sc = device_get_softc(dev);
ma = device_get_ivars(dev);
sc-mii_dev = device_get_parent(dev);
-   mii = device_get_softc(sc-mii_dev);
+   mii = ma-mii_data;
LIST_INSERT_HEAD(mii-mii_phys, sc, mii_list);
 
sc-mii_inst = mii-mii_instance;

Modified: head/sys/dev/mii/amphy.c
==
--- head/sys/dev/mii/amphy.cMon Sep 27 20:12:57 2010(r213228)
+++ head/sys/dev/mii/amphy.cMon Sep 27 20:31:03 2010(r213229)
@@ -106,7 +106,7 @@ amphy_attach(device_t dev)
sc = device_get_softc(dev);
ma = device_get_ivars(dev);
sc-mii_dev = device_get_parent(dev);
-   mii = device_get_softc(sc-mii_dev);
+   mii = ma-mii_data;
LIST_INSERT_HEAD(mii-mii_phys, sc, mii_list);
 
sc-mii_inst = mii-mii_instance;

Modified: head/sys/dev/mii/atphy.c
==
--- head/sys/dev/mii/atphy.cMon Sep 27 20:12:57 2010(r213228)
+++ head/sys/dev/mii/atphy.cMon Sep 27 20:31:03 2010(r213229)
@@ -110,7 +110,7 @@ atphy_attach(device_t dev)
sc = asc-mii_sc;
ma = device_get_ivars(dev);
sc-mii_dev = device_get_parent(dev);
-   mii = device_get_softc(sc-mii_dev);
+   mii = ma-mii_data;
LIST_INSERT_HEAD(mii-mii_phys, sc, mii_list);
 
sc-mii_inst = mii-mii_instance;

Modified: head/sys/dev/mii/axphy.c
==
--- head/sys/dev/mii/axphy.cMon Sep 27 20:12:57 2010(r213228)
+++ head/sys/dev/mii/axphy.cMon Sep 27 20:31:03 2010(r213229)
@@ -96,7 +96,7 @@ axphy_attach(device_t dev)
sc = device_get_softc(dev);
ma = device_get_ivars(dev);
sc-mii_dev = device_get_parent(dev);
-   mii = device_get_softc(sc-mii_dev);
+   mii = ma-mii_data;
LIST_INSERT_HEAD(mii-mii_phys, sc, mii_list);
 
sc-mii_inst = mii-mii_instance;

Modified: head/sys/dev/mii/bmtphy.c
==
--- head/sys/dev/mii/bmtphy.c   Mon Sep 27 20:12:57 2010(r213228)
+++ head/sys/dev/mii/bmtphy.c   Mon Sep 27 20:31:03 2010(r213229)

svn commit: r213230 - head/sys/mips/cavium

2010-09-27 Thread Juli Mallett
Author: jmallett
Date: Mon Sep 27 20:35:40 2010
New Revision: 213230
URL: http://svn.freebsd.org/changeset/base/213230

Log:
  Give devices lots of time to settle around programming BARs and command
  registers.  Without this, the settings do not seem to stick for Atheros NICs 
in
  the PCI slot of the Lanner MR-320.

Modified:
  head/sys/mips/cavium/octopci.c

Modified: head/sys/mips/cavium/octopci.c
==
--- head/sys/mips/cavium/octopci.c  Mon Sep 27 20:31:03 2010
(r213229)
+++ head/sys/mips/cavium/octopci.c  Mon Sep 27 20:35:40 2010
(r213230)
@@ -659,6 +659,8 @@ octopci_init_device(device_t dev, unsign
command = ~(PCIM_CMD_MEMEN | PCIM_CMD_PORTEN);
octopci_write_config(dev, b, s, f, PCIR_COMMAND, command, 1);
 
+   DELAY(1);
+
/* Program BARs.  */
switch (hdrtype  PCIM_HDRTYPE) {
case PCIM_HDRTYPE_NORMAL:
@@ -685,6 +687,8 @@ octopci_init_device(device_t dev, unsign
/* Enable whatever facilities the BARs require.  */
octopci_write_config(dev, b, s, f, PCIR_COMMAND, command, 1);
 
+   DELAY(1);
+
/* 
 * Set cache line size.  On Octeon it should be 128 bytes,
 * but according to Linux some Intel bridges have trouble
___
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: r213231 - head/tools/regression/geom_eli

2010-09-27 Thread Pawel Jakub Dawidek
Author: pjd
Date: Mon Sep 27 21:10:37 2010
New Revision: 213231
URL: http://svn.freebsd.org/changeset/base/213231

Log:
  Correct message.
  
  Pointed out by:   jhb
  MFC after:2 weeks

Modified:
  head/tools/regression/geom_eli/resize.t

Modified: head/tools/regression/geom_eli/resize.t
==
--- head/tools/regression/geom_eli/resize.t Mon Sep 27 20:35:40 2010
(r213230)
+++ head/tools/regression/geom_eli/resize.t Mon Sep 27 21:10:37 2010
(r213231)
@@ -125,7 +125,7 @@ geli detach ${md}a.eli
 # to geli init.
 
 gpart create -s GPT $md || echo -n not 
-echo ok $i - Installed an GPT on ${md}
+echo ok $i - Installed a GPT on ${md}
 i=$((i + 1))
 gpart add -s 20m -t freebsd-ufs -i 1 $md || echo -n not 
 echo ok $i - Added a 20m partition in slot 1
___
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: r213234 - head/sys/dev/e1000

2010-09-27 Thread Jack F Vogel
Author: jfv
Date: Tue Sep 28 00:13:15 2010
New Revision: 213234
URL: http://svn.freebsd.org/changeset/base/213234

Log:
  Update code from Intel:
- Sync shared code with Intel internal
- New client chipset support added
- em driver - fixes to 82574, limit queues to 1 but use MSIX
- em driver - large changes in TX checksum offload and tso
  code, thanks to yongari.
- some small changes for watchdog issues.
- igb driver - local timer watchdog code was missing locking
  this and a couple other watchdog related fixes.
- bug in rx discard found by Andrew Boyer, check for null pointer
  
  MFC: a week

Modified:
  head/sys/dev/e1000/e1000_82571.c
  head/sys/dev/e1000/e1000_82571.h
  head/sys/dev/e1000/e1000_82575.c
  head/sys/dev/e1000/e1000_82575.h
  head/sys/dev/e1000/e1000_api.c
  head/sys/dev/e1000/e1000_api.h
  head/sys/dev/e1000/e1000_defines.h
  head/sys/dev/e1000/e1000_hw.h
  head/sys/dev/e1000/e1000_ich8lan.c
  head/sys/dev/e1000/e1000_ich8lan.h
  head/sys/dev/e1000/e1000_mac.c
  head/sys/dev/e1000/e1000_nvm.c
  head/sys/dev/e1000/e1000_nvm.h
  head/sys/dev/e1000/e1000_phy.c
  head/sys/dev/e1000/e1000_phy.h
  head/sys/dev/e1000/e1000_regs.h
  head/sys/dev/e1000/if_em.c
  head/sys/dev/e1000/if_em.h
  head/sys/dev/e1000/if_igb.c
  head/sys/dev/e1000/if_igb.h
  head/sys/dev/e1000/if_lem.c

Modified: head/sys/dev/e1000/e1000_82571.c
==
--- head/sys/dev/e1000/e1000_82571.cMon Sep 27 23:00:02 2010
(r213233)
+++ head/sys/dev/e1000/e1000_82571.cTue Sep 28 00:13:15 2010
(r213234)
@@ -78,6 +78,10 @@ static s32  e1000_get_hw_semaphore_82571
 static s32  e1000_fix_nvm_checksum_82571(struct e1000_hw *hw);
 static s32  e1000_get_phy_id_82571(struct e1000_hw *hw);
 static void e1000_put_hw_semaphore_82571(struct e1000_hw *hw);
+static s32  e1000_get_hw_semaphore_82573(struct e1000_hw *hw);
+static void e1000_put_hw_semaphore_82573(struct e1000_hw *hw);
+static s32  e1000_get_hw_semaphore_82574(struct e1000_hw *hw);
+static void e1000_put_hw_semaphore_82574(struct e1000_hw *hw);
 static void e1000_initialize_hw_bits_82571(struct e1000_hw *hw);
 static s32  e1000_write_nvm_eewr_82571(struct e1000_hw *hw, u16 offset,
u16 words, u16 *data);
@@ -91,6 +95,7 @@ static void e1000_power_down_phy_copper_
 static s32 e1000_init_phy_params_82571(struct e1000_hw *hw)
 {
struct e1000_phy_info *phy = hw-phy;
+   struct e1000_dev_spec_82571 *dev_spec = hw-dev_spec._82571;
s32 ret_val = E1000_SUCCESS;
 
DEBUGFUNC(e1000_init_phy_params_82571);
@@ -104,9 +109,7 @@ static s32 e1000_init_phy_params_82571(s
phy-autoneg_mask= AUTONEG_ADVERTISE_SPEED_DEFAULT;
phy-reset_delay_us  = 100;
 
-   phy-ops.acquire = e1000_get_hw_semaphore_82571;
phy-ops.check_reset_block   = e1000_check_reset_block_generic;
-   phy-ops.release = e1000_put_hw_semaphore_82571;
phy-ops.reset   = e1000_phy_hw_reset_generic;
phy-ops.set_d0_lplu_state   = e1000_set_d0_lplu_state_82571;
phy-ops.set_d3_lplu_state   = e1000_set_d3_lplu_state_generic;
@@ -124,6 +127,8 @@ static s32 e1000_init_phy_params_82571(s
phy-ops.get_cable_length   = e1000_get_cable_length_igp_2;
phy-ops.read_reg   = e1000_read_phy_reg_igp;
phy-ops.write_reg  = e1000_write_phy_reg_igp;
+   phy-ops.acquire= e1000_get_hw_semaphore_82571;
+   phy-ops.release= e1000_put_hw_semaphore_82571;
 
/* This uses above function pointers */
ret_val = e1000_get_phy_id_82571(hw);
@@ -145,6 +150,8 @@ static s32 e1000_init_phy_params_82571(s
phy-ops.get_cable_length   = e1000_get_cable_length_m88;
phy-ops.read_reg   = e1000_read_phy_reg_m88;
phy-ops.write_reg  = e1000_write_phy_reg_m88;
+   phy-ops.acquire= e1000_get_hw_semaphore_82571;
+   phy-ops.release= e1000_put_hw_semaphore_82571;
 
/* This uses above function pointers */
ret_val = e1000_get_phy_id_82571(hw);
@@ -158,6 +165,8 @@ static s32 e1000_init_phy_params_82571(s
break;
case e1000_82574:
case e1000_82583:
+   E1000_MUTEX_INIT(dev_spec-swflag_mutex);
+
phy-type   = e1000_phy_bm;
phy-ops.get_cfg_done   = e1000_get_cfg_done_generic;
phy-ops.get_info   = e1000_get_phy_info_m88;
@@ -167,6 +176,8 @@ static s32 e1000_init_phy_params_82571(s
phy-ops.get_cable_length   = e1000_get_cable_length_m88;
phy-ops.read_reg   = e1000_read_phy_reg_bm2;

svn commit: r213235 - head/lib/libstand

2010-09-27 Thread Ed Maste
Author: emaste
Date: Tue Sep 28 01:30:49 2010
New Revision: 213235
URL: http://svn.freebsd.org/changeset/base/213235

Log:
  Increase maximum network timeout from 20s to 120s.  Given that an ETIMEDOUT
  return from sendrecv probably means a failure to boot we might as well be
  generous in the timeout period.

Modified:
  head/lib/libstand/net.h

Modified: head/lib/libstand/net.h
==
--- head/lib/libstand/net.h Tue Sep 28 00:13:15 2010(r213234)
+++ head/lib/libstand/net.h Tue Sep 28 01:30:49 2010(r213235)
@@ -50,7 +50,7 @@
 
 #define MACPY(s, d) bcopy((char *)s, (char *)d, 6)
 
-#define MAXTMO 20  /* seconds */
+#define MAXTMO 120 /* seconds */
 #define MINTMO 2   /* seconds */
 
 #define FNAME_SIZE 128
___
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: r213236 - head/sys/kern

2010-09-27 Thread Ed Maste
Author: emaste
Date: Tue Sep 28 01:36:01 2010
New Revision: 213236
URL: http://svn.freebsd.org/changeset/base/213236

Log:
  Remove extra braces for style(9) (found while cleaning up an old work tree).

Modified:
  head/sys/kern/subr_trap.c

Modified: head/sys/kern/subr_trap.c
==
--- head/sys/kern/subr_trap.c   Tue Sep 28 01:30:49 2010(r213235)
+++ head/sys/kern/subr_trap.c   Tue Sep 28 01:36:01 2010(r213236)
@@ -118,9 +118,8 @@ userret(struct thread *td, struct trapfr
/*
 * Charge system time if profiling.
 */
-   if (p-p_flag  P_PROFIL) {
+   if (p-p_flag  P_PROFIL)
addupc_task(td, TRAPF_PC(frame), td-td_pticks * psratio);
-   }
/*
 * Let the scheduler adjust our priority etc.
 */
___
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: r213237 - in head/sys: conf dev/gpio sys

2010-09-27 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Tue Sep 28 03:24:53 2010
New Revision: 213237
URL: http://svn.freebsd.org/changeset/base/213237

Log:
  Initial GPIO bus support. Includes:
- GPIO bus controller interface
- GPIO bus interface
- Implementation of GPIO led(4) compatible device
- Implementation of iic(4) bus over GPIO (author: Luiz Otavio O Souza)
  
  Tested by: Luiz Otavio O Souza, Alexandr Rybalko

Added:
  head/sys/dev/gpio/
  head/sys/dev/gpio/gpio_if.m   (contents, props changed)
  head/sys/dev/gpio/gpiobus.c   (contents, props changed)
  head/sys/dev/gpio/gpiobus_if.m   (contents, props changed)
  head/sys/dev/gpio/gpiobusvar.h   (contents, props changed)
  head/sys/dev/gpio/gpioc.c   (contents, props changed)
  head/sys/dev/gpio/gpioiic.c   (contents, props changed)
  head/sys/dev/gpio/gpioled.c   (contents, props changed)
  head/sys/sys/gpio.h   (contents, props changed)
Modified:
  head/sys/conf/files

Modified: head/sys/conf/files
==
--- head/sys/conf/files Tue Sep 28 01:36:01 2010(r213236)
+++ head/sys/conf/files Tue Sep 28 03:24:53 2010(r213237)
@@ -1010,6 +1010,14 @@ dev/fxp/if_fxp.c optional fxp inet
 dev/gem/if_gem.c   optional gem
 dev/gem/if_gem_pci.c   optional gem pci
 dev/gem/if_gem_sbus.c  optional gem sbus
+dev/gpio/gpiobus.c optional gpio   \
+   dependency  gpiobus_if.h
+dev/gpio/gpioc.c   optional gpio   \
+   dependency  gpio_if.h
+dev/gpio/gpioiic.c optional gpioiic
+dev/gpio/gpioled.c optional gpioled
+dev/gpio/gpio_if.m optional gpio
+dev/gpio/gpiobus_if.m  optional gpio
 dev/hatm/if_hatm.c optional hatm pci
 dev/hatm/if_hatm_intr.coptional hatm pci
 dev/hatm/if_hatm_ioctl.c   optional hatm pci

Added: head/sys/dev/gpio/gpio_if.m
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/dev/gpio/gpio_if.m Tue Sep 28 03:24:53 2010(r213237)
@@ -0,0 +1,102 @@
+#-
+# Copyright (c) 2009 Oleksandr Tymoshenko go...@freebsd.org
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#notice, this list of conditions and the following disclaimer in the
+#documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+#
+# $FreeBSD$
+#
+
+#include sys/bus.h
+#include sys/gpio.h
+
+INTERFACE gpio;
+
+#
+# Get total number of pins
+#
+METHOD int pin_max {
+   device_t dev;
+   int *npins;
+};
+
+#
+# Set value of pin specifed by pin_num 
+#
+METHOD int pin_set {
+   device_t dev;
+   uint32_t pin_num;
+   uint32_t pin_value;
+};
+
+#
+# Get value of pin specifed by pin_num 
+#
+METHOD int pin_get {
+   device_t dev;
+   uint32_t pin_num;
+   uint32_t *pin_value;
+};
+
+#
+# Toggle value of pin specifed by pin_num 
+#
+METHOD int pin_toggle {
+   device_t dev;
+   uint32_t pin_num;
+};
+
+#
+# Get pin capabilities
+#
+METHOD int pin_getcaps {
+   device_t dev;
+   uint32_t pin_num;
+   uint32_t *caps;
+};
+
+#
+# Get pin flags
+#
+METHOD int pin_getflags {
+   device_t dev;
+   uint32_t pin_num;
+   uint32_t *flags;
+};
+
+#
+# Get pin name
+#
+METHOD int pin_getname {
+   device_t dev;
+   uint32_t pin_num;
+   char *name;
+};
+
+#
+# Set current configuration and capabilities
+#
+METHOD int pin_setflags {
+   device_t dev;
+   uint32_t pin_num;
+   uint32_t flags;
+};

Added: head/sys/dev/gpio/gpiobus.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/dev/gpio/gpiobus.c Tue Sep 28 03:24:53 2010

svn commit: r213238 - in head/usr.sbin: . gpioctl

2010-09-27 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Tue Sep 28 03:28:20 2010
New Revision: 213238
URL: http://svn.freebsd.org/changeset/base/213238

Log:
  Add gpioctl(8). Utility for configuring/accessing GPIO pins

Added:
  head/usr.sbin/gpioctl/
  head/usr.sbin/gpioctl/Makefile   (contents, props changed)
  head/usr.sbin/gpioctl/gpioctl.8   (contents, props changed)
  head/usr.sbin/gpioctl/gpioctl.c   (contents, props changed)
Modified:
  head/usr.sbin/Makefile

Modified: head/usr.sbin/Makefile
==
--- head/usr.sbin/Makefile  Tue Sep 28 03:24:53 2010(r213237)
+++ head/usr.sbin/Makefile  Tue Sep 28 03:28:20 2010(r213238)
@@ -27,6 +27,7 @@ SUBDIR= adduser \
fwcontrol \
getfmac \
getpmac \
+   gpioctl \
gstat \
i2c \
ifmcstat \

Added: head/usr.sbin/gpioctl/Makefile
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/usr.sbin/gpioctl/Makefile  Tue Sep 28 03:28:20 2010
(r213238)
@@ -0,0 +1,6 @@
+# $FreeBSD$
+
+PROG=  gpioctl
+MAN=   gpioctl.8
+
+.include bsd.prog.mk

Added: head/usr.sbin/gpioctl/gpioctl.8
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/usr.sbin/gpioctl/gpioctl.8 Tue Sep 28 03:28:20 2010
(r213238)
@@ -0,0 +1,124 @@
+.\ Copyright (c) 1980, 1991, 1993
+.\The Regents of the University of California.  All rights reserved.
+.\
+.\ Redistribution and use in source and binary forms, with or without
+.\ modification, are permitted provided that the following conditions
+.\ are met:
+.\ 1. Redistributions of source code must retain the above copyright
+.\notice, this list of conditions and the following disclaimer.
+.\ 2. Redistributions in binary form must reproduce the above copyright
+.\notice, this list of conditions and the following disclaimer in the
+.\documentation and/or other materials provided with the distribution.
+.\ 3. All advertising materials mentioning features or use of this software
+.\must display the following acknowledgement:
+.\This product includes software developed by the University of
+.\California, Berkeley and its contributors.
+.\ 4. Neither the name of the University nor the names of its contributors
+.\may be used to endorse or promote products derived from this software
+.\without specific prior written permission.
+.\
+.\ THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\ ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\ SUCH DAMAGE.
+.\
+.\ $FreeBSD$
+.\
+.Dd September 27, 2010
+.Dt GPIOCTL 1
+.Os
+.Sh NAME
+.Nm gpioctl
+.Nd GPIO control utility
+.Sh SYNOPSIS
+.Nm
+.Cm -l 
+.Fl f Ar ctldev
+.Op Fl v
+.Nm
+.Cm -t 
+.Fl f Ar ctldev
+.Ar pin
+.Nm
+.Cm -c 
+.Fl f Ar ctldev
+.Ar pin
+.Ar flag 
+.Op flag ...
+.Nm
+.Cm -f Ar ctldev 
+.Ar pin
+.Ar [0|1]
+.Sh DESCRIPTION
+The
+.Nm
+utility could be used to manage GPIO pins from userland and list available 
pins.
+.Pp
+The options are as follows:
+.Bl -tag -width .Fl f Ar ctldev
+.It Fl c Ar pin Ar flag Op flag ...
+Configure pin by setting provided flags. The following flags are currently 
defined:
+.Bl -tag -offset indent -width .Cm PULSE
+.It Cm IN
+Input pin
+.It Cm OUT
+Output pin
+.It Cm OD
+Open drain pin
+.It Cm PP
+Push pull pin
+.It Cm TS
+Tristate pin
+.It Cm PU
+Pull-up pin
+.It Cm PD
+Pull-down pin
+.It Cm II
+Inverted input pin
+.It Cm IO
+Inverted output pin
+.El
+.It Fl f Ar ctldev
+GPIO controller device to use
+.It Fl l
+list available pins
+.It Fl t Ar pin
+toggle value of provided pin number
+.It Fl v
+be verbose: for each listed pin print current configuration
+.El
+.Sh EXAMPLES
+.Pp
+.Bl -bullet
+.It
+List pins available on GPIO controller defined by device /dev/gpioctl0
+.Pp
+gpioctl -f /dev/gpioctl0 -l
+.It
+Set the value of pin 12 to 1
+.Pp
+gpioctl -f /dev/gpioctl0 12 1
+.It
+Configure pin 12 to be input pin
+.Pp
+gpioctl -f /dev/gpioctl0 -c 12 IN
+.El
+.Sh HISTORY
+The
+.Nm
+utility appeared in
+.Fx 9.0 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+utility and this manual page were written by
+.An Oleksandr Tymoshenko
+.Aq go...@freebsd.org

Added: 

svn commit: r213239 - head/sys/mips/atheros

2010-09-27 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Tue Sep 28 03:31:34 2010
New Revision: 213239
URL: http://svn.freebsd.org/changeset/base/213239

Log:
  Add AR71XX GPIO bus driver.

Added:
  head/sys/mips/atheros/ar71xx_gpio.c   (contents, props changed)
  head/sys/mips/atheros/ar71xx_gpiovar.h   (contents, props changed)
Modified:
  head/sys/mips/atheros/ar71xxreg.h
  head/sys/mips/atheros/files.ar71xx

Added: head/sys/mips/atheros/ar71xx_gpio.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/mips/atheros/ar71xx_gpio.c Tue Sep 28 03:31:34 2010
(r213239)
@@ -0,0 +1,446 @@
+/*-
+ * Copyright (c) 2009, Oleksandr Tymoshenko go...@freebsd.org
+ * Copyright (c) 2009, Luiz Otavio O Souza. 
+ * 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 unmodified, 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.
+ */
+
+/*
+ * GPIO driver for AR71xx 
+ */
+
+#include sys/cdefs.h
+__FBSDID($FreeBSD$);
+
+#include sys/param.h
+#include sys/systm.h
+#include sys/bus.h
+
+#include sys/kernel.h
+#include sys/module.h
+#include sys/rman.h
+#include sys/lock.h
+#include sys/mutex.h
+#include sys/gpio.h
+
+#include machine/bus.h
+#include machine/resource.h
+#include mips/atheros/ar71xxreg.h
+#include mips/atheros/ar71xx_gpiovar.h
+
+#include gpio_if.h
+
+#defineDEFAULT_CAPS(GPIO_PIN_INPUT | GPIO_PIN_OUTPUT)
+
+struct ar71xx_gpio_pin {
+   const char *name;
+   int pin;
+   int flags;
+};
+
+static struct ar71xx_gpio_pin ar71xx_gpio_pins[] = {
+   { RFled, 2, GPIO_PIN_OUTPUT},
+   { SW4, 8,  GPIO_PIN_INPUT},
+   { NULL, 0, 0},
+};
+
+/*
+ * Helpers
+ */
+static void ar71xx_gpio_function_enable(struct ar71xx_gpio_softc *sc, 
+uint32_t mask);
+static void ar71xx_gpio_function_disable(struct ar71xx_gpio_softc *sc, 
+uint32_t mask);
+static void ar71xx_gpio_pin_configure(struct ar71xx_gpio_softc *sc, 
+struct gpio_pin *pin, uint32_t flags);
+
+/*
+ * Driver stuff
+ */
+static int ar71xx_gpio_probe(device_t dev);
+static int ar71xx_gpio_attach(device_t dev);
+static int ar71xx_gpio_detach(device_t dev);
+static int ar71xx_gpio_filter(void *arg);
+static void ar71xx_gpio_intr(void *arg);
+
+/*
+ * GPIO interface
+ */
+static int ar71xx_gpio_pin_max(device_t dev, int *maxpin);
+static int ar71xx_gpio_pin_getcaps(device_t dev, uint32_t pin, uint32_t *caps);
+static int ar71xx_gpio_pin_getflags(device_t dev, uint32_t pin, uint32_t
+*flags);
+static int ar71xx_gpio_pin_getname(device_t dev, uint32_t pin, char *name);
+static int ar71xx_gpio_pin_setflags(device_t dev, uint32_t pin, uint32_t 
flags);
+static int ar71xx_gpio_pin_set(device_t dev, uint32_t pin, unsigned int value);
+static int ar71xx_gpio_pin_get(device_t dev, uint32_t pin, unsigned int *val);
+static int ar71xx_gpio_pin_toggle(device_t dev, uint32_t pin);
+
+static void
+ar71xx_gpio_function_enable(struct ar71xx_gpio_softc *sc, uint32_t mask)
+{
+   GPIO_LOCK(sc);
+   GPIO_SET_BITS(sc, AR71XX_GPIO_FUNCTION, mask);
+   GPIO_UNLOCK(sc);
+}
+
+static void
+ar71xx_gpio_function_disable(struct ar71xx_gpio_softc *sc, uint32_t mask)
+{
+   GPIO_LOCK(sc);
+   GPIO_CLEAR_BITS(sc, AR71XX_GPIO_FUNCTION, mask);
+   GPIO_UNLOCK(sc);
+}
+
+static void
+ar71xx_gpio_pin_configure(struct ar71xx_gpio_softc *sc, struct gpio_pin *pin,
+unsigned int flags)
+{
+   uint32_t mask;
+
+   mask = 1  pin-gp_pin;
+   GPIO_LOCK(sc);
+
+   /*
+* Manage input/output
+*/
+   if (flags  (GPIO_PIN_INPUT|GPIO_PIN_OUTPUT)) {
+   pin-gp_flags = ~(GPIO_PIN_INPUT|GPIO_PIN_OUTPUT);
+   if (flags  GPIO_PIN_OUTPUT) {
+   pin-gp_flags |= GPIO_PIN_OUTPUT;
+   

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

2010-09-27 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Tue Sep 28 03:34:51 2010
New Revision: 213240
URL: http://svn.freebsd.org/changeset/base/213240

Log:
  Add GPIO bus to config and hints. Also add sample gpioled device.

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

Modified: head/sys/mips/conf/AR71XX
==
--- head/sys/mips/conf/AR71XX   Tue Sep 28 03:31:34 2010(r213239)
+++ head/sys/mips/conf/AR71XX   Tue Sep 28 03:34:51 2010(r213240)
@@ -74,6 +74,9 @@ options   USB_EHCI_BIG_ENDIAN_DESC   
 device ohci
 device ehci
 
+device gpio
+device gpioled
+
 device spibus
 device ar71xx_spi
 device mx25l

Modified: head/sys/mips/conf/AR71XX.hints
==
--- head/sys/mips/conf/AR71XX.hints Tue Sep 28 03:31:34 2010
(r213239)
+++ head/sys/mips/conf/AR71XX.hints Tue Sep 28 03:34:51 2010
(r213240)
@@ -47,6 +47,18 @@ hint.arge.1.fduplex=1
 # Uncomment this hint for RS (not PRO)
 # hint.arge.0.phymask=7
 
+# GPIO
+hint.gpio.0.at=apb0
+hint.gpio.0.maddr=0x1804
+hint.gpio.0.msize=0x1000
+hint.gpio.0.irq=2
+
+# RF led
+hint.gpioled.0.at=gpiobus0
+hint.gpioled.0.name=rf
+# pin 2
+hint.gpioled.0.pins=0x0004
+
 # SPI flash
 hint.spi.0.at=nexus0
 hint.spi.0.maddr=0x1f00
___
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: r213241 - in head: include lib/libthr/thread

2010-09-27 Thread David Xu
Author: davidxu
Date: Tue Sep 28 04:57:56 2010
New Revision: 213241
URL: http://svn.freebsd.org/changeset/base/213241

Log:
  In current code, statically initialized and destroyed object have
  same null value, the code can not distinguish between them, to
  fix the problem, now a destroyed object is assigned to a non-null
  value, and it will be rejected by some pthread functions.
  PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP is changed to number 1, so that
  adaptive mutex can be statically initialized correctly.

Modified:
  head/include/pthread.h
  head/lib/libthr/thread/thr_cond.c
  head/lib/libthr/thread/thr_init.c
  head/lib/libthr/thread/thr_mutex.c
  head/lib/libthr/thread/thr_private.h
  head/lib/libthr/thread/thr_rwlock.c

Modified: head/include/pthread.h
==
--- head/include/pthread.h  Tue Sep 28 03:34:51 2010(r213240)
+++ head/include/pthread.h  Tue Sep 28 04:57:56 2010(r213241)
@@ -98,7 +98,7 @@
  * Static initialization values. 
  */
 #define PTHREAD_MUTEX_INITIALIZER  NULL
-#define PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP  NULL
+#define PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP  ((pthread_mutex_t)1)
 #define PTHREAD_COND_INITIALIZER   NULL
 #define PTHREAD_RWLOCK_INITIALIZER NULL
 

Modified: head/lib/libthr/thread/thr_cond.c
==
--- head/lib/libthr/thread/thr_cond.c   Tue Sep 28 03:34:51 2010
(r213240)
+++ head/lib/libthr/thread/thr_cond.c   Tue Sep 28 04:57:56 2010
(r213241)
@@ -104,6 +104,19 @@ init_static(struct pthread *thread, pthr
return (ret);
 }
 
+#define CHECK_AND_INIT_COND
\
+   if (__predict_false((cv = (*cond)) = THR_COND_DESTROYED)) {
\
+   if (cv == THR_COND_INITIALIZER) {   
\
+   int ret;
\
+   ret = init_static(_get_curthread(), cond);  
\
+   if (ret)
\
+   return (ret);   
\
+   } else if (cv == THR_COND_DESTROYED) {  
\
+   return (EINVAL);
\
+   }   
\
+   cv = *cond; 
\
+   }
+
 int
 _pthread_cond_init(pthread_cond_t *cond, const pthread_condattr_t *cond_attr)
 {
@@ -119,16 +132,14 @@ _pthread_cond_destroy(pthread_cond_t *co
struct pthread_cond *cv;
int rval = 0;
 
-   if (*cond == NULL)
+   if ((cv = *cond) == THR_COND_INITIALIZER)
+   rval = 0;
+   else if (cv == THR_COND_DESTROYED)
rval = EINVAL;
else {
cv = *cond;
THR_UMUTEX_LOCK(curthread, cv-c_lock);
-   /*
-* NULL the caller's pointer now that the condition
-* variable has been destroyed:
-*/
-   *cond = NULL;
+   *cond = THR_COND_DESTROYED;
THR_UMUTEX_UNLOCK(curthread, cv-c_lock);
 
/*
@@ -137,7 +148,6 @@ _pthread_cond_destroy(pthread_cond_t *co
 */
free(cv);
}
-   /* Return the completion status: */
return (rval);
 }
 
@@ -178,22 +188,18 @@ cond_wait_common(pthread_cond_t *cond, p
struct timespec ts, ts2, *tsp;
struct cond_cancel_info info;
pthread_cond_t  cv;
-   int ret = 0;
+   int ret;
 
/*
 * If the condition variable is statically initialized,
 * perform the dynamic initialization:
 */
-   if (__predict_false(*cond == NULL 
-   (ret = init_static(curthread, cond)) != 0))
-   return (ret);
-
-   _thr_testcancel(curthread);
+   CHECK_AND_INIT_COND
 
cv = *cond;
THR_UMUTEX_LOCK(curthread, cv-c_lock);
ret = _mutex_cv_unlock(mutex, info.count);
-   if (ret) {
+   if (__predict_false(ret != 0)) {
THR_UMUTEX_UNLOCK(curthread, cv-c_lock);
return (ret);
}
@@ -273,11 +279,8 @@ cond_signal_common(pthread_cond_t *cond,
 * If the condition variable is statically initialized, perform dynamic
 * initialization.
 */
-   if (__predict_false(*cond == NULL 
-   (ret = init_static(curthread, cond)) != 0))
-   return (ret);
+   CHECK_AND_INIT_COND
 
-   cv = *cond;
THR_UMUTEX_LOCK(curthread, cv-c_lock);
if (!broadcast)
ret = _thr_ucond_signal(cv-c_kerncv);

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

svn commit: r213242 - stable/8/tools/tools/umastat

2010-09-27 Thread Andriy Gapon
Author: avg
Date: Tue Sep 28 05:53:35 2010
New Revision: 213242
URL: http://svn.freebsd.org/changeset/base/213242

Log:
  MFC r212932,212949: tools/umastat: fix build on amd64 and more
  
  PR:   misc/146119

Modified:
  stable/8/tools/tools/umastat/umastat.c
Directory Properties:
  stable/8/tools/tools/umastat/   (props changed)

Modified: stable/8/tools/tools/umastat/umastat.c
==
--- stable/8/tools/tools/umastat/umastat.c  Tue Sep 28 04:57:56 2010
(r213241)
+++ stable/8/tools/tools/umastat/umastat.c  Tue Sep 28 05:53:35 2010
(r213242)
@@ -37,6 +37,7 @@
 
 #include err.h
 #include kvm.h
+#include limits.h
 #include memstat.h
 #include stdio.h
 #include stdlib.h
@@ -196,7 +197,7 @@ uma_print_keg_align(struct uma_keg *ukp,
 LIST_HEAD(bucketlist, uma_bucket);
 
 static void
-uma_print_bucket(struct uma_bucket *ubp, const char *spaces)
+uma_print_bucket(struct uma_bucket *ubp, const char *spaces __unused)
 {
 
printf({ ub_cnt = %d, ub_entries = %d }, ubp-ub_cnt,
@@ -230,7 +231,7 @@ uma_print_bucketlist(kvm_t *kvm, struct 
}
 
printf(\n);
-   printf(%s};  // total cnt %llu, total entries %llu\n, spaces,
+   printf(%s};  // total cnt %ju, total entries %ju\n, spaces,
total_cnt, total_entries);
 }
 
@@ -242,8 +243,8 @@ uma_print_cache(kvm_t *kvm, struct uma_c
int ret;
 
printf(%s%s[%d] = {\n, spaces, name, cpu);
-   printf(%s  uc_frees = %llu;\n, spaces, cache-uc_frees);
-   printf(%s  uc_allocs = %llu;\n, spaces, cache-uc_allocs);
+   printf(%s  uc_frees = %ju;\n, spaces, cache-uc_frees);
+   printf(%s  uc_allocs = %ju;\n, spaces, cache-uc_allocs);
 
if (cache-uc_freebucket != NULL) {
ret = kread(kvm, cache-uc_freebucket, ub, sizeof(ub), 0);
@@ -286,6 +287,7 @@ main(int argc, char *argv[])
size_t uzp_userspace_len;
char *memf, *nlistf;
int ch;
+   char errbuf[_POSIX2_LINE_MAX];
 
memf = nlistf = NULL;
while ((ch = getopt(argc, argv, M:N:)) != -1) {
@@ -308,9 +310,9 @@ main(int argc, char *argv[])
if (nlistf != NULL  memf == NULL)
usage();
 
-   kvm = kvm_open(nlistf, memf, NULL, 0, umastat);
+   kvm = kvm_openfiles(nlistf, memf, NULL, 0, errbuf);
if (kvm == NULL)
-   err(-1, kvm_open);
+   errx(-1, kvm_openfiles: %s, errbuf);
 
if (kvm_nlist(kvm, namelist) != 0)
err(-1, kvm_nlist);
@@ -412,20 +414,20 @@ main(int argc, char *argv[])
}
printf(  Zone {\n);
printf(uz_name = \%s\;\n, name);
-   printf(uz_allocs = %llu;\n,
+   printf(uz_allocs = %ju;\n,
uzp_userspace-uz_allocs);
-   printf(uz_frees = %llu;\n,
+   printf(uz_frees = %ju;\n,
uzp_userspace-uz_frees);
-   printf(uz_fails = %llu;\n,
+   printf(uz_fails = %ju;\n,
uzp_userspace-uz_fails);
printf(uz_fills = %u;\n,
uzp_userspace-uz_fills);
printf(uz_count = %u;\n,
uzp_userspace-uz_count);
-   uma_print_bucketlist(kvm, (struct bucketlist *)
+   uma_print_bucketlist(kvm, (void *)
uzp_userspace-uz_full_bucket, uz_full_bucket,
);
-   uma_print_bucketlist(kvm, (struct bucketlist *)
+   uma_print_bucketlist(kvm, (void *)
uzp_userspace-uz_free_bucket, uz_free_bucket,
);
 
___
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: r213243 - stable/7/tools/tools/umastat

2010-09-27 Thread Andriy Gapon
Author: avg
Date: Tue Sep 28 05:57:50 2010
New Revision: 213243
URL: http://svn.freebsd.org/changeset/base/213243

Log:
  MFC r212932,212949: tools/umastat: fix build on amd64 and more
  
  PR:   misc/146119

Modified:
  stable/7/tools/tools/umastat/umastat.c
Directory Properties:
  stable/7/tools/tools/umastat/   (props changed)

Modified: stable/7/tools/tools/umastat/umastat.c
==
--- stable/7/tools/tools/umastat/umastat.c  Tue Sep 28 05:53:35 2010
(r213242)
+++ stable/7/tools/tools/umastat/umastat.c  Tue Sep 28 05:57:50 2010
(r213243)
@@ -37,6 +37,7 @@
 
 #include err.h
 #include kvm.h
+#include limits.h
 #include memstat.h
 #include stdio.h
 #include stdlib.h
@@ -196,7 +197,7 @@ uma_print_keg_align(struct uma_keg *ukp,
 LIST_HEAD(bucketlist, uma_bucket);
 
 static void
-uma_print_bucket(struct uma_bucket *ubp, const char *spaces)
+uma_print_bucket(struct uma_bucket *ubp, const char *spaces __unused)
 {
 
printf({ ub_cnt = %d, ub_entries = %d }, ubp-ub_cnt,
@@ -230,7 +231,7 @@ uma_print_bucketlist(kvm_t *kvm, struct 
}
 
printf(\n);
-   printf(%s};  // total cnt %llu, total entries %llu\n, spaces,
+   printf(%s};  // total cnt %ju, total entries %ju\n, spaces,
total_cnt, total_entries);
 }
 
@@ -242,8 +243,8 @@ uma_print_cache(kvm_t *kvm, struct uma_c
int ret;
 
printf(%s%s[%d] = {\n, spaces, name, cpu);
-   printf(%s  uc_frees = %llu;\n, spaces, cache-uc_frees);
-   printf(%s  uc_allocs = %llu;\n, spaces, cache-uc_allocs);
+   printf(%s  uc_frees = %ju;\n, spaces, cache-uc_frees);
+   printf(%s  uc_allocs = %ju;\n, spaces, cache-uc_allocs);
 
if (cache-uc_freebucket != NULL) {
ret = kread(kvm, cache-uc_freebucket, ub, sizeof(ub), 0);
@@ -286,6 +287,7 @@ main(int argc, char *argv[])
size_t uzp_userspace_len;
char *memf, *nlistf;
int ch;
+   char errbuf[_POSIX2_LINE_MAX];
 
memf = nlistf = NULL;
while ((ch = getopt(argc, argv, M:N:)) != -1) {
@@ -308,9 +310,9 @@ main(int argc, char *argv[])
if (nlistf != NULL  memf == NULL)
usage();
 
-   kvm = kvm_open(nlistf, memf, NULL, 0, umastat);
+   kvm = kvm_openfiles(nlistf, memf, NULL, 0, errbuf);
if (kvm == NULL)
-   err(-1, kvm_open);
+   errx(-1, kvm_openfiles: %s, errbuf);
 
if (kvm_nlist(kvm, namelist) != 0)
err(-1, kvm_nlist);
@@ -412,20 +414,20 @@ main(int argc, char *argv[])
}
printf(  Zone {\n);
printf(uz_name = \%s\;\n, name);
-   printf(uz_allocs = %llu;\n,
+   printf(uz_allocs = %ju;\n,
uzp_userspace-uz_allocs);
-   printf(uz_frees = %llu;\n,
+   printf(uz_frees = %ju;\n,
uzp_userspace-uz_frees);
-   printf(uz_fails = %llu;\n,
+   printf(uz_fails = %ju;\n,
uzp_userspace-uz_fails);
printf(uz_fills = %u;\n,
uzp_userspace-uz_fills);
printf(uz_count = %u;\n,
uzp_userspace-uz_count);
-   uma_print_bucketlist(kvm, (struct bucketlist *)
+   uma_print_bucketlist(kvm, (void *)
uzp_userspace-uz_full_bucket, uz_full_bucket,
);
-   uma_print_bucketlist(kvm, (struct bucketlist *)
+   uma_print_bucketlist(kvm, (void *)
uzp_userspace-uz_free_bucket, uz_free_bucket,
);
 
___
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