svn commit: r234270 - in head/sys/dev/virtio: . balloon block network pci

2012-04-13 Thread Peter Grehan
Author: grehan
Date: Sat Apr 14 05:48:04 2012
New Revision: 234270
URL: http://svn.freebsd.org/changeset/base/234270

Log:
  Catch up with Bryan Venteicher's virtio git repo:
  
  a8af6270bd96be6ccd86f70b60fa6512b710e4f0
virtio_blk: Include function name in panic string
  
  cbdb03a694b76c5253d7ae3a59b9995b9afbb67a
virtio_balloon: Do the notify outside of the lock
  
By the time we return from virtqueue_notify(), the descriptor
will be in the used ring so we shouldn't have to sleep.
  
  10ba392e60692529a5cbc1e9987e4064e0128447
virtio: Use DEVMETHOD_END
  
  80cbcc4d6552cac758be67f0c99c36f23ce62110
virtqueue: Add support for VIRTIO_F_RING_EVENT_IDX
  
This can be used to reduce the number of guest/host and
host/guest interrupts by delaying the interrupt until a
certain index value is reached.
  
Actual use by the network driver will come along later.
  
  8fc465969acc0c58477153e4c3530390db436c02
virtqueue: Simplify virtqueue_nused()
  
Since the values just wrap naturally at UINT16_MAX, we
can just subtract the two values directly, rather than
doing 2's complement math.
  
  a8aa22f25959e2767d006cd621b69050e7ffb0ae
virtio_blk: Remove debugging crud from 75dd732a
  
There seems to be an issue with Qemu (or FreeBSD VirtIO) that sets
the PCI register space for the device config to bogus values. This
only seems to happen after unloading and reloading the module.
  
  d404800661cb2a9769c033f8a50b2133934501aa
virtio_blk: Use better variable name
  
  75dd732a97743d96e7c63f7ced3c2169696dadd3
virtio_blk: Partially revert 92ba40e65
  
Just use the virtqueue to determine if any requests are
still inflight.
  
  06661ed66b7a9efaea240f99f414c368f1bbcdc7
virtio_blk: error if allowed too few segments
  
Should never happen unless the host provides use with a
bogus seg_max value.
  
  4b33e5085bc87a818433d7e664a0a2c8f56a1a89
virtio_blk: Sort function declarations
  
  426b9f5cac892c9c64cc7631966461514f7e08c6
virtio_blk: Cleanup whitespace
  
  617c23e12c61e3c2233d942db713c6b8ff0bd112
virtio_blk: Call disk_err() on error'd completed requests
  
  081a5712d4b2e0abf273be4d26affcf3870263a9
virtio_blk: ASSERT the ready and inflight request queues are empty
  
  a9be2631a4f770a84145c18ee03a3f103bed4ca8
virtio_blk: Simplify check for too many segments
  
At the cost of a small style violation.
  
  e00ec09da014f2e60cc75542d0ab78898672d521
virtio_blk: Add beginnings of suspend/resume
  
Still not sure if we need to virtio_stop()/virtio_reinit()
the device before/after a suspend.
  
Don't start additional IO when marked as suspending.
  
  47c71dc6ce8c238aa59ce8afd4bda5aa294bc884
virtio_blk: Panic when dealt an unhandled BIO cmd
  
  1055544f90fb8c0cc6a2395f5b6104039606aafe
virtio_blk: Add VQ enqueue/dequeue wrappers
  
Wrapper functions managed the added/removing to the in-flight
list of requests.
  
Normally biodone() any completed IO when draining the virtqueue.
  
  92ba40e65b3bb5e4acb9300ece711f1ea8f3f7f4
virtio_blk: Add in-flight list of requests
  
  74f6d260e075443544522c0833dc2712dd93f49b
virtio_blk: Rename VTBLK_FLAG_DETACHING to VTBLK_FLAG_DETACH
  
  7aa549050f6fc6551c09c6362ed6b2a0728956ef
virtio_blk: Finish all BIOs through vtblk_finish_bio()
  
Also properly set bio_resid in the case of errors. Most geom_disk
providers seem to do the same.
  
  9eef6d0e6f7e5dd362f71ba097f2e2e4c3744882
Added function to translate VirtIO status to error code
  
  ef06adc337f31e1129d6d5f26de6d8d1be27bcd2
Reset dumping flag when given unexpected parameters
  
  393b3e390c644193a2e392220dcc6a6c50b212d9
Added missing VTBLK_LOCK() in dump handler
  
  Obtained from:Bryan Venteicher  bryanv at daemoninthecloset dot org

Modified:
  head/sys/dev/virtio/balloon/virtio_balloon.c
  head/sys/dev/virtio/block/virtio_blk.c
  head/sys/dev/virtio/network/if_vtnet.c
  head/sys/dev/virtio/pci/virtio_pci.c
  head/sys/dev/virtio/virtio_ring.h
  head/sys/dev/virtio/virtqueue.c
  head/sys/dev/virtio/virtqueue.h

Modified: head/sys/dev/virtio/balloon/virtio_balloon.c
==
--- head/sys/dev/virtio/balloon/virtio_balloon.cSat Apr 14 04:40:11 
2012(r234269)
+++ head/sys/dev/virtio/balloon/virtio_balloon.cSat Apr 14 05:48:04 
2012(r234270)
@@ -122,6 +122,9 @@ static void vtballoon_add_sysctl(struct 
  */
 #define VTBALLOON_PAGES_PER_REQUEST256
 
+/* Must be able to fix all pages frames in one page (segment). */
+CTASSERT(VTBALLOON_PAGES_PER_REQUEST * sizeof(uint32_t) <= PAGE_SIZE);
+
 #define VTBALLOON_MTX(_sc) &(_sc)->vtballoon_mtx
 #define VTBALLOON_LOCK

svn commit: r234269 - head/sys/dev/ath/ath_hal/ar5416

2012-04-13 Thread Adrian Chadd
Author: adrian
Date: Sat Apr 14 04:40:11 2012
New Revision: 234269
URL: http://svn.freebsd.org/changeset/base/234269

Log:
  Both linux ath9k and the reference driver initialises the PLL here
  during chip wakeup.
  
  Obtained from:Linux ath9k, Atheros

Modified:
  head/sys/dev/ath/ath_hal/ar5416/ar5416_power.c

Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_power.c
==
--- head/sys/dev/ath/ath_hal/ar5416/ar5416_power.c  Sat Apr 14 02:49:01 
2012(r234268)
+++ head/sys/dev/ath/ath_hal/ar5416/ar5416_power.c  Sat Apr 14 04:40:11 
2012(r234269)
@@ -50,6 +50,7 @@ ar5416SetPowerModeAwake(struct ath_hal *
& AR_RTC_PM_STATUS_M) == AR_RTC_STATUS_SHUTDOWN) {
if (!ar5416SetResetReg(ah, HAL_RESET_POWER_ON))
goto bad;   
+   AH5416(ah)->ah_initPLL(ah, AH_NULL);
}
 
if (AR_SREV_HOWL(ah))
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r234190 - in head/sys: kern sys

2012-04-13 Thread Oleksandr Tymoshenko

On 2012-04-12, at 10:43 AM, John Baldwin wrote:

> Author: jhb
> Date: Thu Apr 12 17:43:59 2012
> New Revision: 234190
> URL: http://svn.freebsd.org/changeset/base/234190
> 
> Log:
>  - Extend the KDB interface to add a per-debugger callback to print a
>backtrace for an arbitrary thread (rather than the calling thread).
>A kdb_backtrace_thread() wrapper function uses the configured debugger
>if possible, otherwise it falls back to using stack(9) if that is
>available.
>  - Replace a direct call to db_trace_thread() in propagate_priority()
>with a call to kdb_backtrace_thread() instead.
> 
> 
> Modified: head/sys/kern/subr_turnstile.c
> ==
> --- head/sys/kern/subr_turnstile.cThu Apr 12 16:55:48 2012
> (r234189)
> +++ head/sys/kern/subr_turnstile.cThu Apr 12 17:43:59 2012
> (r234190)
> @@ -217,9 +217,7 @@ propagate_priority(struct thread *td)
>   printf(
>   "Sleeping thread (tid %d, pid %d) owns a non-sleepable lock\n",
>   td->td_tid, td->td_proc->p_pid);
> -#ifdef DDB
> - db_trace_thread(td, -1);
> -#endif
> + kdb_backtrace_thread(td);
>   panic("sleeping thread");
>   }

It seems that missing "#ifdef DDB" break build for kernels without DDB enabled:
cc1: warnings being treated as errors
/src/FreeBSD/head/sys/kern/subr_turnstile.c: In function 'propagate_priority':
/src/FreeBSD/head/sys/kern/subr_turnstile.c:220: warning: implicit declaration 
of function 'kdb_backtrace_thread'
/src/FreeBSD/head/sys/kern/subr_turnstile.c:220: warning: nested extern 
declaration of 'kdb_backtrace_thread' [-Wnested-externs]

___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r234248 - in head/sys: conf dev/iicbus

2012-04-13 Thread Marius Strobl
Author: marius
Date: Fri Apr 13 23:07:32 2012
New Revision: 234248
URL: http://svn.freebsd.org/changeset/base/234248

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

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

Modified: head/sys/conf/files
==
--- head/sys/conf/files Fri Apr 13 22:58:23 2012(r234247)
+++ head/sys/conf/files Fri Apr 13 23:07:32 2012(r234248)
@@ -1288,6 +1288,7 @@ dev/iicbus/iiconf.c   optional iicbus
 dev/iicbus/iicsmb.coptional iicsmb \
dependency  "iicbus_if.h"
 dev/iicbus/iicoc.c optional iicoc
+dev/iicbus/pcf8563.c   optional pcf8563
 dev/iir/iir.c  optional iir
 dev/iir/iir_ctrl.c optional iir
 dev/iir/iir_pci.c  optional iir pci

Added: head/sys/dev/iicbus/pcf8563.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/dev/iicbus/pcf8563.c   Fri Apr 13 23:07:32 2012
(r234248)
@@ -0,0 +1,202 @@
+/*-
+ * Copyright (c) 2012 Marius Strobl 
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+/*
+ * Driver for NXP PCF8563 real-time clock/calendar
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#include "clock_if.h"
+#include "iicbus_if.h"
+
+#definePCF8563_NCLOCKREGS  (PCF8563_R_YEAR - PCF8563_R_CS1 + 1)
+
+struct pcf8563_softc {
+   uint32_tsc_flags;
+#definePCF8563_CPOL(1 << 0)/* PCF8563_R_MONTH_C means 19xx 
*/
+   uint16_tsc_addr;/* PCF8563 slave address */
+   uint16_tsc_year0;   /* TOD clock year 0 */
+};
+
+static device_attach_t pcf8563_attach;
+static device_probe_t pcf8563_probe;
+static clock_gettime_t pcf8563_gettime;
+static clock_settime_t pcf8563_settime;
+
+static int
+pcf8563_probe(device_t dev)
+{
+
+   device_set_desc(dev, "NXP PCF8563 RTC");
+   return (BUS_PROBE_NOWILDCARD);
+}
+
+static int
+pcf8563_attach(device_t dev)
+{
+   uint8_t reg = PCF8563_R_SECOND, val;
+   struct iic_msg msgs[] = {
+   { 0, IIC_M_WR, sizeof(reg), ® },
+   { 0, IIC_M_RD, sizeof(val), &val }
+   };
+   struct pcf8563_softc *sc;
+   int error;
+
+   sc = device_get_softc(dev);
+   sc->sc_addr = iicbus_get_addr(dev);
+   if (sc->sc_addr == 0)
+   sc->sc_addr = PCF8563_ADDR;
+
+   msgs[0].slave = msgs[1].slave = sc->sc_addr;
+   error = iicbus_transfer(device_get_parent(dev), msgs, sizeof(msgs) /
+   sizeof(*msgs));
+   if (error != 0) {
+   device_printf(dev, "%s: cannot read RTC\n", __func__);
+   return (error);
+   }
+   if ((val & PCF8563_R_SECOND_VL) != 0) {
+   device_printf(dev, "%s: battery low\n", __func__);
+   return (ENXIO);
+   }
+
+   sc->sc_year0 = 1900;
+   clock_register(dev, 100);   /* 1 second resolution */
+   return (0);
+}
+
+static int
+pcf8563_gettime(device_t dev, struct timespec *ts)
+{
+   struct clocktime ct;
+   uint8_t reg = PCF8563_R_SECOND, val[PCF8563_NCLOCKREGS];
+   struct iic_msg msgs[] = {
+   { 0, IIC_M_WR, sizeof(reg), ® },
+   { 0, IIC_M_RD, PCF8563_NCLOCKREGS, &val[PCF8563_R_SECOND] }
+   };
+   struct pcf8

svn commit: r234247 - head/sys/sparc64/sparc64

2012-04-13 Thread Marius Strobl
Author: marius
Date: Fri Apr 13 22:58:23 2012
New Revision: 234247
URL: http://svn.freebsd.org/changeset/base/234247

Log:
  Merge from x86:
  
  r233961:
  
  Fix interrupt load balancing regression, introduced in revision
  222813, that left all un-pinned interrupts assigned to CPU 0.
  In intr_shuffle_irqs(), remove CPU_SETOF() call that initialized
  the "intr_cpus" cpuset to only contain CPU0.
  
  This initialization is too late and nullifies the results of calls
  to the intr_add_cpu() that occur much earlier in the boot process.
  
  r234074 (partial):
  
  The BSP is not added to the mask of valid target CPUs for interrupts.
  Fix this by adding the BSP as an interrupt target directly in
  
  r234105:
  
  Fix !SMP build after r234074.
  
  MFC after: 3 days

Modified:
  head/sys/sparc64/sparc64/intr_machdep.c
  head/sys/sparc64/sparc64/machdep.c

Modified: head/sys/sparc64/sparc64/intr_machdep.c
==
--- head/sys/sparc64/sparc64/intr_machdep.c Fri Apr 13 22:47:23 2012
(r234246)
+++ head/sys/sparc64/sparc64/intr_machdep.c Fri Apr 13 22:58:23 2012
(r234247)
@@ -528,9 +528,6 @@ intr_shuffle_irqs(void *arg __unused)
struct intr_vector *iv;
int i;
 
-   /* The BSP is always a valid target. */
-   CPU_SETOF(0, &intr_cpus);
-
/* Don't bother on UP. */
if (mp_ncpus == 1)
return;

Modified: head/sys/sparc64/sparc64/machdep.c
==
--- head/sys/sparc64/sparc64/machdep.c  Fri Apr 13 22:47:23 2012
(r234246)
+++ head/sys/sparc64/sparc64/machdep.c  Fri Apr 13 22:58:23 2012
(r234247)
@@ -196,6 +196,13 @@ cpu_startup(void *arg)
printf("machine: %s\n", sparc64_model);
 
cpu_identify(rdpr(ver), PCPU_GET(clock), curcpu);
+
+#ifdef SMP
+   /*
+* Add BSP as an interrupt target.
+*/
+   intr_add_cpu(0);
+#endif
 }
 
 void
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r234245 - head/usr.bin/netstat

2012-04-13 Thread Xin LI
Author: delphij
Date: Fri Apr 13 22:35:53 2012
New Revision: 234245
URL: http://svn.freebsd.org/changeset/base/234245

Log:
  Eliminate an unused parameter of static method igmp_stats_live_old().
  
  MFC after:1 month

Modified:
  head/usr.bin/netstat/inet.c

Modified: head/usr.bin/netstat/inet.c
==
--- head/usr.bin/netstat/inet.c Fri Apr 13 22:34:01 2012(r234244)
+++ head/usr.bin/netstat/inet.c Fri Apr 13 22:35:53 2012(r234245)
@@ -1068,7 +1068,7 @@ icmp_stats(u_long off, const char *name,
  * Dump IGMP statistics structure (pre 8.x kernel).
  */
 static void
-igmp_stats_live_old(u_long off, const char *name)
+igmp_stats_live_old(const char *name)
 {
struct oigmpstat oigmpstat, zerostat;
size_t len = sizeof(oigmpstat);
@@ -1128,7 +1128,7 @@ igmp_stats(u_long off, const char *name,
return;
}
if (len < sizeof(igmpstat)) {
-   igmp_stats_live_old(off, name);
+   igmp_stats_live_old(name);
return;
}
}
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r234244 - head/usr.sbin/lpr/lpc

2012-04-13 Thread Xin LI
Author: delphij
Date: Fri Apr 13 22:34:01 2012
New Revision: 234244
URL: http://svn.freebsd.org/changeset/base/234244

Log:
  The scandir(3) function expects fourth parameter, compar, be in type of:
  
int (*compar)(const struct dirent **, const struct dirent **)
  
  The current code defines sortq() to accept two void *, then cast them
  to const struct dirent **.  Because the code does not really need this
  cast, we can eliminate the casts by changing the function prototype
  to match scandir(3) expectation.
  
  MFC after:1 month

Modified:
  head/usr.sbin/lpr/lpc/cmds.c

Modified: head/usr.sbin/lpr/lpc/cmds.c
==
--- head/usr.sbin/lpr/lpc/cmds.cFri Apr 13 22:31:49 2012
(r234243)
+++ head/usr.sbin/lpr/lpc/cmds.cFri Apr 13 22:34:01 2012
(r234244)
@@ -79,7 +79,7 @@ static char   *args2line(int argc, char **
 static int  doarg(char *_job);
 static int  doselect(const struct dirent *_d);
 static int  kill_qtask(const char *lf);
-static int  sortq(const void *_a, const void *_b);
+static int  sortq(const struct dirent **a, const struct dirent **b);
 static int  touch(struct jobqueue *_jq);
 static void unlinkf(char *_name);
 static void upstat(struct printer *_pp, const char *_msg, int _notify);
@@ -486,14 +486,14 @@ doselect(const struct dirent *d)
  *   filenames (they will have datafile names which start with `dfB*').
  */
 static int
-sortq(const void *a, const void *b)
+sortq(const struct dirent **a, const struct dirent **b)
 {
const int a_lt_b = -1, a_gt_b = 1, cat_other = 10;
const char *fname_a, *fname_b, *jnum_a, *jnum_b;
int cat_a, cat_b, ch, res, seq_a, seq_b;
 
-   fname_a = (*(const struct dirent * const *)a)->d_name;
-   fname_b = (*(const struct dirent * const *)b)->d_name;
+   fname_a = (*a)->d_name;
+   fname_b = (*b)->d_name;
 
/*
 * First separate filenames into categories.  Categories are
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r234242 - head/sys/dev/netmap

2012-04-13 Thread Luigi Rizzo
Author: luigi
Date: Fri Apr 13 22:24:57 2012
New Revision: 234242
URL: http://svn.freebsd.org/changeset/base/234242

Log:
  fix build with -Wformat -Wmissing-prototypes

Modified:
  head/sys/dev/netmap/netmap_mem2.c

Modified: head/sys/dev/netmap/netmap_mem2.c
==
--- head/sys/dev/netmap/netmap_mem2.c   Fri Apr 13 22:04:28 2012
(r234241)
+++ head/sys/dev/netmap/netmap_mem2.c   Fri Apr 13 22:24:57 2012
(r234242)
@@ -162,7 +162,7 @@ netmap_ofstophys(vm_offset_t offset)
offset % p[i]->_objsize;
}
D("invalid ofs 0x%x out of 0x%x 0x%x 0x%x", o,
-   p[0]->_memtotal, p[0]->_memtotal + p[1]->_memtotal,
+   (u_int)p[0]->_memtotal, p[0]->_memtotal + p[1]->_memtotal,
p[0]->_memtotal + p[1]->_memtotal + p[2]->_memtotal);
return 0;   // XXX bad address
 }
@@ -173,7 +173,7 @@ netmap_ofstophys(vm_offset_t offset)
  * Algorithm: scan until we find the cluster, then add the
  * actual offset in the cluster
  */
-ssize_t
+static ssize_t
 netmap_obj_offset(struct netmap_obj_pool *p, const void *vaddr)
 {
int i, k = p->clustentries, n = p->objtotal;
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r234236 - head/share/misc

2012-04-13 Thread Jason Evans
Author: jasone
Date: Fri Apr 13 20:58:01 2012
New Revision: 234236
URL: http://svn.freebsd.org/changeset/base/234236

Log:
  Added myself to committers-src.dot.

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

Modified: head/share/misc/committers-src.dot
==
--- head/share/misc/committers-src.dot  Fri Apr 13 20:23:32 2012
(r234235)
+++ head/share/misc/committers-src.dot  Fri Apr 13 20:58:01 2012
(r234236)
@@ -156,6 +156,7 @@ iedowse [label="Ian Dowse\niedowse@FreeB
 imp [label="Warner Losh\n...@freebsd.org\n1996/09/20"]
 ivoras [label="Ivan Voras\nivo...@freebsd.org\n2008/06/10"]
 jamie [label="Jamie Gritton\nja...@freebsd.org\n2009/01/28"]
+jasone [label="Jason Evans\njas...@freebsd.org\n1999/03/03"]
 jceel [label="Jakub Klama\njc...@freebsd.org\n2011/09/25"]
 jchandra [label="Jayachandran C.\njchan...@freebsd.org\n2010/05/19"]
 jeff [label="Jeff Roberson\nj...@freebsd.org\n2002/02/21"]
@@ -478,6 +479,7 @@ marcel -> arun
 marcel -> marius
 marcel -> nwhitehorn
 
+markm -> jasone
 markm -> sheldonh
 
 mav -> ae
@@ -494,6 +496,7 @@ mlaier -> thompsa
 mlaier -> eri
 
 msmith -> cokane
+msmith -> jasone
 msmith -> scottl
 
 murray -> delphij
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2012-04-13 Thread Adrian Chadd
Author: adrian
Date: Fri Apr 13 20:23:32 2012
New Revision: 234235
URL: http://svn.freebsd.org/changeset/base/234235

Log:
  Flesh out the rest of the AP96 board/config.

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

Modified: head/sys/mips/conf/AP96
==
--- head/sys/mips/conf/AP96 Fri Apr 13 20:22:08 2012(r234234)
+++ head/sys/mips/conf/AP96 Fri Apr 13 20:23:32 2012(r234235)
@@ -17,19 +17,26 @@ include "AR71XX_BASE"
 ident  "AP96"
 hints  "AP96.hints"
 
-# GEOM modules
-device geom_redboot# to get access to the SPI flash partitions
-device geom_uzip   # compressed in-memory filesystem hackery!
-optionsGEOM_UZIP
-
-optionsROOTDEVNAME=\"ufs:md0.uzip\"
 optionsAR71XX_REALMEM=64*1024*1024
 
 optionsAR71XX_ENV_UBOOT
 
-# options  MD_ROOT
-# options  MD_ROOT_SIZE="6144"
+# For DOS - enable if required
+optionsGEOM_PART_BSD
+optionsGEOM_PART_MBR
+optionsMSDOSFS
+
+# uncompress - to boot read-only lzma natively from flash
+device geom_uzip
+optionsGEOM_UZIP
+
+# Used for the static uboot partition map
+device  geom_map
+
+# Boot off of the rootfs, as defined in the geom_map setup.
+options ROOTDEVNAME=\"ufs:map/rootfs.uzip\"
 
+# Options needed for the EEPROM based calibration/PCI configuration data.
 optionsAR71XX_ATH_EEPROM   # Fetch EEPROM/PCI config from flash
 optionsATH_EEPROM_FIRMWARE # Use EEPROM from flash
 device firmware# Used by the above

Modified: head/sys/mips/conf/AP96.hints
==
--- head/sys/mips/conf/AP96.hints   Fri Apr 13 20:22:08 2012
(r234234)
+++ head/sys/mips/conf/AP96.hints   Fri Apr 13 20:23:32 2012
(r234235)
@@ -26,3 +26,52 @@ hint.pcib.0.bus.0.18.0.ath_fixup_size=40
 hint.ath.0.eeprom_firmware="pcib.0.bus.0.17.0.eeprom_firmware"
 hint.ath.1.eeprom_firmware="pcib.0.bus.0.18.0.eeprom_firmware"
 
+# The default flash layout:
+# uboot: 192k
+# env: 64k
+# rootfs: 6144k
+# uimage (kernel): 1728k
+# caldata: 64k
+#
+# bootargs=console=ttyS0,115200 root=31:02 rootfstype=jffs2 init=/sbin/init
+#
mtdparts=ar7100-nor0:192k(uboot),64k(env),6144k(rootfs),1728k(uImage),64k(caldata)
 mem=64M
+
+#
+# We steal 64k from the end of rootfs to store the local config.
+
+hint.map.0.at="flash/spi0"
+hint.map.0.start=0x
+hint.map.0.end=0x3
+hint.map.0.name="uboot"
+hint.map.0.readonly=1
+
+hint.map.1.at="flash/spi0"
+hint.map.1.start=0x0003
+hint.map.1.end=0x0004
+hint.map.1.name="uboot-env"
+hint.map.1.readonly=1
+
+hint.map.2.at="flash/spi0"
+hint.map.2.start=0x0004
+hint.map.2.end=0x0063
+hint.map.2.name="rootfs"
+hint.map.2.readonly=1
+
+hint.map.3.at="flash/spi0"
+hint.map.3.start=0x0063
+hint.map.3.end=0x0064
+hint.map.3.name="cfg"
+hint.map.3.readonly=0
+
+hint.map.4.at="flash/spi0"
+hint.map.4.start=0x0064
+hint.map.4.end=0x007f
+hint.map.4.name="kernel"
+hint.map.4.readonly=1
+
+hint.map.5.at="flash/spi0"
+hint.map.5.start=0x007f
+hint.map.5.end=0x0080
+hint.map.5.name="art"
+hint.map.5.readonly=1
+
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r234234 - head/cddl/contrib/opensolaris/lib/libdtrace/common

2012-04-13 Thread George V. Neville-Neil
Author: gnn
Date: Fri Apr 13 20:22:08 2012
New Revision: 234234
URL: http://svn.freebsd.org/changeset/base/234234

Log:
  Change SIGUSR1 to SIGTHR to properly wake up a process that is being
  traced.  The use of SIGUSR1 caused traced processes (those attached to
  with dtrace -p) to exit when dtrace exited.
  
  MFC in: 1 week

Modified:
  head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_proc.c

Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_proc.c
==
--- head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_proc.cFri Apr 
13 18:21:56 2012(r234233)
+++ head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_proc.cFri Apr 
13 20:22:08 2012(r234234)
@@ -811,7 +811,7 @@ dt_proc_destroy(dtrace_hdl_t *dtp, struc
 #if defined(sun)
(void) _lwp_kill(dpr->dpr_tid, SIGCANCEL);
 #else
-   pthread_kill(dpr->dpr_tid, SIGUSR1);
+   pthread_kill(dpr->dpr_tid, SIGTHR);
 #endif
 
/*
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r234233 - in head: sbin/iscontrol share/man/man4 sys/dev/iscsi/initiator sys/modules/iscsi/initiator

2012-04-13 Thread Konstantin Belousov
On Fri, Apr 13, 2012 at 06:21:56PM +, Josh Paetzel wrote:
> Author: jpaetzel
> Date: Fri Apr 13 18:21:56 2012
> New Revision: 234233
> URL: http://svn.freebsd.org/changeset/base/234233
> 
> Log:
>   Update to version 2.3.1.0
>   
>   Obtained from:  Daniel Braniss 
> 
> Modified:
>   head/sbin/iscontrol/Makefile
>   head/sbin/iscontrol/iscontrol.8
>   head/sbin/iscontrol/iscontrol.c
>   head/sbin/iscontrol/iscsi.conf.5
>   head/share/man/man4/iscsi_initiator.4
>   head/sys/dev/iscsi/initiator/isc_subr.c
>   head/sys/dev/iscsi/initiator/iscsi.c
>   head/sys/dev/iscsi/initiator/iscsi_subr.c
>   head/sys/dev/iscsi/initiator/iscsivar.h
>   head/sys/modules/iscsi/initiator/Makefile
> 
> Modified: head/sbin/iscontrol/Makefile
> ==
> --- head/sbin/iscontrol/Makefile  Fri Apr 13 18:01:53 2012
> (r234232)
> +++ head/sbin/iscontrol/Makefile  Fri Apr 13 18:21:56 2012
> (r234233)
> @@ -8,7 +8,7 @@ S= ${.CURDIR}/../../sys
>  
>  WARNS?=  3
>  CFLAGS += -I$S
> -#CFLAGS += -g -DDEBUG
> +CFLAGS += -g -DDEBUG
>  
Was this part intended ?
> -
> -# Debugging
> -# CFLAGS+= -DISCSI_INITIATOR_DEBUG=9
> -
> +#CFLAGS+= -DNO_USE_MBUF
> +CFLAGS+= -DISCSI_INITIATOR_DEBUG=2
And this ?

> +CFLAGS+= -I$S
> +CFLAGS+= -DINVARIANTS
>  .include 


pgpzyCajdruiO.pgp
Description: PGP signature


svn commit: r234233 - in head: sbin/iscontrol share/man/man4 sys/dev/iscsi/initiator sys/modules/iscsi/initiator

2012-04-13 Thread Josh Paetzel
Author: jpaetzel
Date: Fri Apr 13 18:21:56 2012
New Revision: 234233
URL: http://svn.freebsd.org/changeset/base/234233

Log:
  Update to version 2.3.1.0
  
  Obtained from:Daniel Braniss 

Modified:
  head/sbin/iscontrol/Makefile
  head/sbin/iscontrol/iscontrol.8
  head/sbin/iscontrol/iscontrol.c
  head/sbin/iscontrol/iscsi.conf.5
  head/share/man/man4/iscsi_initiator.4
  head/sys/dev/iscsi/initiator/isc_subr.c
  head/sys/dev/iscsi/initiator/iscsi.c
  head/sys/dev/iscsi/initiator/iscsi_subr.c
  head/sys/dev/iscsi/initiator/iscsivar.h
  head/sys/modules/iscsi/initiator/Makefile

Modified: head/sbin/iscontrol/Makefile
==
--- head/sbin/iscontrol/MakefileFri Apr 13 18:01:53 2012
(r234232)
+++ head/sbin/iscontrol/MakefileFri Apr 13 18:21:56 2012
(r234233)
@@ -8,7 +8,7 @@ S= ${.CURDIR}/../../sys
 
 WARNS?=3
 CFLAGS += -I$S
-#CFLAGS += -g -DDEBUG
+CFLAGS += -g -DDEBUG
 
 MAN= iscsi.conf.5 iscontrol.8
 

Modified: head/sbin/iscontrol/iscontrol.8
==
--- head/sbin/iscontrol/iscontrol.8 Fri Apr 13 18:01:53 2012
(r234232)
+++ head/sbin/iscontrol/iscontrol.8 Fri Apr 13 18:21:56 2012
(r234233)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd February 22, 2007
+.Dd August 9, 2010
 .Dt ISCONTROL 8
 .Os
 .Sh NAME

Modified: head/sbin/iscontrol/iscontrol.c
==
--- head/sbin/iscontrol/iscontrol.c Fri Apr 13 18:01:53 2012
(r234232)
+++ head/sbin/iscontrol/iscontrol.c Fri Apr 13 18:21:56 2012
(r234233)
@@ -56,6 +56,8 @@ __FBSDID("$FreeBSD$");
 #include 
 #include "iscontrol.h"
 
+static char version[] = "2.3.1"; // keep in sync with iscsi_initiator
+
 #define USAGE "[-v] [-d] [-c config] [-n name] [-t target] [-p pidfile]"
 #define OPTIONS"vdc:t:n:p:"
 
@@ -124,9 +126,10 @@ int
 main(int cc, char **vv)
 {
  int   ch, disco;
- char  *pname, *pidfile, *p, *q, *ta, *kw;
+ char  *pname, *pidfile, *p, *q, *ta, *kw, *v;
  isc_opt_t *op;
  FILE  *fd;
+ size_tn;
 
  op = &opvals;
  iscsidev = "/dev/"ISCSIDEV;
@@ -138,6 +141,21 @@ main(int cc, char **vv)
  kw = ta = 0;
  disco = 0;
  pidfile = NULL;
+ /*
+  | check for driver & controller version match
+  */
+ n = 0;
+ if(sysctlbyname("net.iscsi_initiator.driver_version", 0, &n, 0, 0) != 0)
+ perror("sysctlbyname");
+ v = malloc(n+1);
+ if(sysctlbyname("net.iscsi_initiator.driver_version", v, &n, 0, 0) != 0)
+ perror("sysctlbyname");
+
+ if(strncmp(version, v, 3)) {
+ fprintf(stderr, "versions missmatch\n");
+ exit(1);
+ }
+
 
  while((ch = getopt(cc, vv, OPTIONS)) != -1) {
  switch(ch) {

Modified: head/sbin/iscontrol/iscsi.conf.5
==
--- head/sbin/iscontrol/iscsi.conf.5Fri Apr 13 18:01:53 2012
(r234232)
+++ head/sbin/iscontrol/iscsi.conf.5Fri Apr 13 18:21:56 2012
(r234233)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd February 25, 2012
+.Dd June 5, 2007
 .Dt ISCSI.CONF 5
 .Os
 .Sh NAME

Modified: head/share/man/man4/iscsi_initiator.4
==
--- head/share/man/man4/iscsi_initiator.4   Fri Apr 13 18:01:53 2012
(r234232)
+++ head/share/man/man4/iscsi_initiator.4   Fri Apr 13 18:21:56 2012
(r234233)
@@ -1,4 +1,4 @@
-.\" Copyright (c) 2007 Daniel Braniss 
+.\" Copyright (c) 2007-2010 Daniel Braniss 
 .\" All rights reserved.
 .\"
 .\" Redistribution and use in source and binary forms, with or without
@@ -24,9 +24,9 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd May 9, 2010
-.Dt ISCSI_INITIATOR 4
+.Dd August 3, 2010
 .Os
+.Dt ISCSI_INITIATOR 4
 .Sh NAME
 .Nm iscsi_initiator
 .Nd kernel driver for the iSCSI protocol
@@ -48,38 +48,36 @@ iscsi_initiator_load="YES"
 The
 .Nm
 implements the kernel side of the Internet SCSI (iSCSI) network
-protocol standard.
-The userland companion is
+protocol standard, the user land companion is
 .Xr iscontrol 8 ,
 and permits access to remote
 .Em virtual
 SCSI devices via
 .Xr cam 4 .
 .Sh SYSCTL VARIABLES
-.Bl -tag -width "net.iscsi.n.targedaddress"
+.Bl -tag -width ".Va net.iscsi.n.targeaddress"
 .It Va debug.iscsi_initiator
 set the debug-level, 0 means no debugging, 9 for maximum.
 .It Va net.iscsi.isid
 the initiator part of the Session Identifier.
-.El
-.Pp
-The following are informative only:
-.Bl -tag -width "net.iscsi.n.targedaddress"
+.It Va "kern.cam.cam_srch_hi=1"
+allow search above LUN 7 for SCSI3 and greater devices.
+.It "the following are informative only:"
 .It Va net.iscsi.driver_version
 the current version of the driver.
 .It Va net.iscsi.sessions
 the number of current active sessions.
 .It

Re: svn commit: r234228 - head/sys/dev/netmap

2012-04-13 Thread Luigi Rizzo
On Fri, Apr 13, 2012 at 10:59:59AM -0700, Adrian Chadd wrote:
> On 13 April 2012 09:32, Luigi Rizzo  wrote:
> > Author: luigi
> > Date: Fri Apr 13 16:32:33 2012
> > New Revision: 234228
> > URL: http://svn.freebsd.org/changeset/base/234228
> >
> > Log:
> > ?add the new memory allocator for netmap, which allocates memory
> > ?in small clusters instead of one big contiguous chunk.
> > ?This was already enabled in the previous commit.
> 
> Hi,
> 
> is there any scope to make this more generic? I can imagine other
> parts of the system wanting to use this kind of ring buffer to
> userland.

well, it is already exported to userland through mmap.

Perhaps you want to (a) have the buffers allocated on demand,
and yes, this could also be done, either per-interface or globally.
For instance the NIOCREGIF ioctl could specify how many buffers you
want, and allocate them before you malloc.

I still need to make up my mind on what is a good model for
sharing buffers among different interfaces.

cheers
luigi
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2012-04-13 Thread Adrian Chadd
Author: adrian
Date: Fri Apr 13 18:01:53 2012
New Revision: 234232
URL: http://svn.freebsd.org/changeset/base/234232

Log:
  * Enable ATH_EEPROM_FIRMWARE, now that it's a compile time option
  * Tidy up things a bit.

Modified:
  head/sys/mips/conf/AP94
  head/sys/mips/conf/AP96

Modified: head/sys/mips/conf/AP94
==
--- head/sys/mips/conf/AP94 Fri Apr 13 18:00:48 2012(r234231)
+++ head/sys/mips/conf/AP94 Fri Apr 13 18:01:53 2012(r234232)
@@ -30,5 +30,6 @@ options   AR71XX_ENV_UBOOT
 # options  MD_ROOT
 # options  MD_ROOT_SIZE="6144"
 
-optionsAR71XX_ATH_EEPROM
-device firmware
+optionsAR71XX_ATH_EEPROM   # Fetch EEPROM/PCI config from 
flash
+optionsATH_EEPROM_FIRMWARE # Use EEPROM from flash
+device firmware# Used by the above

Modified: head/sys/mips/conf/AP96
==
--- head/sys/mips/conf/AP96 Fri Apr 13 18:00:48 2012(r234231)
+++ head/sys/mips/conf/AP96 Fri Apr 13 18:01:53 2012(r234232)
@@ -30,5 +30,6 @@ options   AR71XX_ENV_UBOOT
 # options  MD_ROOT
 # options  MD_ROOT_SIZE="6144"
 
-optionsAR71XX_ATH_EEPROM
-device firmware
+optionsAR71XX_ATH_EEPROM   # Fetch EEPROM/PCI config from flash
+optionsATH_EEPROM_FIRMWARE # Use EEPROM from flash
+device firmware# Used by the above
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r234231 - in head/sys: conf dev/ath

2012-04-13 Thread Adrian Chadd
Author: adrian
Date: Fri Apr 13 18:00:48 2012
New Revision: 234231
URL: http://svn.freebsd.org/changeset/base/234231

Log:
  Upgrade ATH_EEPROM_FIRMWARE to a configuration option.

Modified:
  head/sys/conf/options
  head/sys/dev/ath/if_ath_pci.c

Modified: head/sys/conf/options
==
--- head/sys/conf/options   Fri Apr 13 16:53:00 2012(r234230)
+++ head/sys/conf/options   Fri Apr 13 18:00:48 2012(r234231)
@@ -780,6 +780,7 @@ ATH_DIAGAPI opt_ath.h
 ATH_TX99_DIAG  opt_ath.h
 ATH_ENABLE_11N opt_ath.h
 ATH_ENABLE_DFS opt_ath.h
+ATH_EEPROM_FIRMWAREopt_ath.h
 
 # options for the Atheros hal
 AH_SUPPORT_AR5416  opt_ah.h

Modified: head/sys/dev/ath/if_ath_pci.c
==
--- head/sys/dev/ath/if_ath_pci.c   Fri Apr 13 16:53:00 2012
(r234230)
+++ head/sys/dev/ath/if_ath_pci.c   Fri Apr 13 18:00:48 2012
(r234231)
@@ -33,6 +33,7 @@ __FBSDID("$FreeBSD$");
 /*
  * PCI/Cardbus front-end for the Atheros Wireless LAN controller driver.
  */
+#include "opt_ath.h"
 
 #include 
 #include  
@@ -60,8 +61,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-/* #define ATH_EEPROM_FIRMWARE */
-
 /* For EEPROM firmware */
 #ifdef ATH_EEPROM_FIRMWARE
 #include 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r234228 - head/sys/dev/netmap

2012-04-13 Thread Adrian Chadd
On 13 April 2012 09:32, Luigi Rizzo  wrote:
> Author: luigi
> Date: Fri Apr 13 16:32:33 2012
> New Revision: 234228
> URL: http://svn.freebsd.org/changeset/base/234228
>
> Log:
>  add the new memory allocator for netmap, which allocates memory
>  in small clusters instead of one big contiguous chunk.
>  This was already enabled in the previous commit.

Hi,

is there any scope to make this more generic? I can imagine other
parts of the system wanting to use this kind of ring buffer to
userland.


adrian
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r234230 - head/share/misc

2012-04-13 Thread Monthadar Al Jaberi
Author: monthadar
Date: Fri Apr 13 16:53:00 2012
New Revision: 234230
URL: http://svn.freebsd.org/changeset/base/234230

Log:
  Add myself as a new committer and add adrian as my mentor.
  
  Approved by: adrian (mentor)

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

Modified: head/share/misc/committers-src.dot
==
--- head/share/misc/committers-src.dot  Fri Apr 13 16:42:54 2012
(r234229)
+++ head/share/misc/committers-src.dot  Fri Apr 13 16:53:00 2012
(r234230)
@@ -195,6 +195,7 @@ mdodd [label="Matthew N. Dodd\nmdodd@Fre
 melifaro [label="Alexander V. Chernikov\nmelif...@freebsd.org\n2011/10/04"]
 mjacob [label="Matt Jacob\nmja...@freebsd.org\n1997/08/13"]
 mlaier [label="Max Laier\nmla...@freebsd.org\n2004/02/10"]
+monthadar [label="Monthadar Al Jaberi\nmontha...@freebsd.org\n2012/04/02"]
 mr [label="Michael Reifenberger\n...@freebsd.org\n2001/09/30"]
 mux [label="Maxime Henrion\n...@freebsd.org\n2002/03/03"]
 neel [label="Neel Natu\nn...@freebsd.org\n2009/09/20"]
@@ -280,6 +281,7 @@ day1 -> rgrimes
 day1 -> alm
 day1 -> dg
 
+adrian -> monthadar
 adrian -> ray
 adrian -> rmh
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r234229 - in head/sys/dev: ixgbe netmap

2012-04-13 Thread Luigi Rizzo
Author: luigi
Date: Fri Apr 13 16:42:54 2012
New Revision: 234229
URL: http://svn.freebsd.org/changeset/base/234229

Log:
  Properly disable crc stripping when operating in netmap mode.
  
  Contrarily to what i wrote in my previous commit, the 82599
  does include the CRC in the length. The operating mode is
  reset in ixgbe_init_locked() and so we need to hook into
  the places where the two registers (HLREG0 and RDRXCTL) are
  modified.

Modified:
  head/sys/dev/ixgbe/ixgbe.c
  head/sys/dev/netmap/ixgbe_netmap.h

Modified: head/sys/dev/ixgbe/ixgbe.c
==
--- head/sys/dev/ixgbe/ixgbe.c  Fri Apr 13 16:32:33 2012(r234228)
+++ head/sys/dev/ixgbe/ixgbe.c  Fri Apr 13 16:42:54 2012(r234229)
@@ -3812,6 +3812,9 @@ ixgbe_setup_hw_rsc(struct rx_ring *rxr)
 
rdrxctl = IXGBE_READ_REG(hw, IXGBE_RDRXCTL);
rdrxctl &= ~IXGBE_RDRXCTL_RSCFRSTSIZE;
+#ifdef DEV_NETMAP /* crcstrip is optional in netmap */
+   if (adapter->ifp->if_capenable & IFCAP_NETMAP && !ix_crcstrip)
+#endif /* DEV_NETMAP */
rdrxctl |= IXGBE_RDRXCTL_CRCSTRIP;
rdrxctl |= IXGBE_RDRXCTL_RSCACKC;
IXGBE_WRITE_REG(hw, IXGBE_RDRXCTL, rdrxctl);
@@ -4104,6 +4107,13 @@ ixgbe_initialize_receive_units(struct ad
hlreg |= IXGBE_HLREG0_JUMBOEN;
else
hlreg &= ~IXGBE_HLREG0_JUMBOEN;
+#ifdef DEV_NETMAP
+   /* crcstrip is conditional in netmap (in RDRXCTL too ?) */
+   if (ifp->if_capenable & IFCAP_NETMAP && !ix_crcstrip)
+   hlreg &= ~IXGBE_HLREG0_RXCRCSTRP;
+   else
+   hlreg |= IXGBE_HLREG0_RXCRCSTRP;
+#endif /* DEV_NETMAP */
IXGBE_WRITE_REG(hw, IXGBE_HLREG0, hlreg);
 
bufsz = (adapter->rx_mbuf_sz +

Modified: head/sys/dev/netmap/ixgbe_netmap.h
==
--- head/sys/dev/netmap/ixgbe_netmap.h  Fri Apr 13 16:32:33 2012
(r234228)
+++ head/sys/dev/netmap/ixgbe_netmap.h  Fri Apr 13 16:42:54 2012
(r234229)
@@ -112,13 +112,12 @@ static void
 set_crcstrip(struct ixgbe_hw *hw, int onoff)
 {
/* crc stripping is set in two places:
-* IXGBE_HLREG0 (left alone by the original driver)
+* IXGBE_HLREG0 (modified on init_locked and hw reset)
 * IXGBE_RDRXCTL (set by the original driver in
 *  ixgbe_setup_hw_rsc() called in init_locked.
 *  We disable the setting when netmap is compiled in).
-* When netmap is compiled in we disabling IXGBE_RDRXCTL
-* modifications of the IXGBE_RDRXCTL_CRCSTRIP bit, and
-* instead update the state here.
+* We update the values here, but also in ixgbe.c because
+* init_locked sometimes is called outside our control.
 */
uint32_t hl, rxc;
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r234228 - head/sys/dev/netmap

2012-04-13 Thread Luigi Rizzo
Author: luigi
Date: Fri Apr 13 16:32:33 2012
New Revision: 234228
URL: http://svn.freebsd.org/changeset/base/234228

Log:
  add the new memory allocator for netmap, which allocates memory
  in small clusters instead of one big contiguous chunk.
  This was already enabled in the previous commit.

Added:
  head/sys/dev/netmap/netmap_mem2.c   (contents, props changed)

Added: head/sys/dev/netmap/netmap_mem2.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/dev/netmap/netmap_mem2.c   Fri Apr 13 16:32:33 2012
(r234228)
@@ -0,0 +1,720 @@
+/*
+ * Copyright (C) 2012 Matteo Landi, Luigi Rizzo. 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$
+ * $Id: netmap_mem2.c 10830 2012-03-22 18:06:01Z luigi $
+ *
+ * New memory allocator for netmap
+ */
+
+/*
+ * The new version allocates three regions:
+ * nm_if_pool  for the struct netmap_if
+ * nm_ring_poolfor the struct netmap_ring
+ * nm_buf_poolfor the packet buffers.
+ *
+ * All regions need to be page-sized as we export them to
+ * userspace through mmap. Only the latter need to be dma-able,
+ * but for convenience use the same type of allocator for all.
+ *
+ * Once mapped, the three regions are exported to userspace
+ * as a contiguous block, starting from nm_if_pool. Each
+ * cluster (and pool) is an integral number of pages.
+ *   [ . . . ][ . . . . . .][ . . . . . . . . . .]
+ *nm_if nm_ringnm_buf
+ *
+ * The userspace areas contain offsets of the objects in userspace.
+ * When (at init time) we write these offsets, we find out the index
+ * of the object, and from there locate the offset from the beginning
+ * of the region.
+ *
+ * Allocator for a pool of memory objects of the same size.
+ * The pool is split into smaller clusters, whose size is a
+ * multiple of the page size. The cluster size is chosen
+ * to minimize the waste for a given max cluster size
+ * (we do it by brute force, as we have relatively few object
+ * per cluster).
+ *
+ * To be polite with the cache, objects are aligned to
+ * the cache line, or 64 bytes. Sizes are rounded to multiple of 64.
+ * For each object we have
+ * one entry in the bitmap to signal the state. Allocation scans
+ * the bitmap, but since this is done only on attach, we are not
+ * too worried about performance
+ */
+
+/*
+ * MEMORY SIZES:
+ *
+ * (all the parameters below will become tunables)
+ *
+ * struct netmap_if is variable size but small.
+ * Assuming each NIC has 8+2 rings, (4+1 tx, 4+1 rx) the netmap_if
+ * uses 120 bytes on a 64-bit machine.
+ * We allocate NETMAP_IF_MAX_SIZE  (1024) which should work even for
+ * cards with 48 ring pairs.
+ * The total number of 'struct netmap_if' could be slightly larger
+ * that the total number of rings on all interfaces on the system.
+ */
+#define NETMAP_IF_MAX_SIZE  1024
+#define NETMAP_IF_MAX_NUM   512
+
+/*
+ * netmap rings are up to 2..4k descriptors, 8 bytes each,
+ * plus some glue at the beginning (32 bytes).
+ * We set the default ring size to 9 pages (36K) and enable
+ * a few hundreds of them.
+ */
+#define NETMAP_RING_MAX_SIZE(9*PAGE_SIZE)
+#define NETMAP_RING_MAX_NUM 200/* approx 8MB */
+
+/*
+ * Buffers: the more the better. Buffer size is NETMAP_BUF_SIZE,
+ * 2k or slightly less, aligned to 64 bytes.
+ * A large 10G interface can have 2k*18 = 36k buffers per interface,
+ * or about 72MB of memory. Up to us to use more.
+ */
+#ifndef CONSERVATIVE
+#define NETMAP_BUF_MAX_NUM  10  /* 200MB */
+#else /* CONSERVATIVE */
+#define NETMAP_BUF_MAX_NUM  2   /* 40MB */
+#endi

svn commit: r234227 - in head: sys/dev/netmap sys/net tools/tools/netmap

2012-04-13 Thread Luigi Rizzo
Author: luigi
Date: Fri Apr 13 16:03:07 2012
New Revision: 234227
URL: http://svn.freebsd.org/changeset/base/234227

Log:
  A bit of cleanup in the names of fields of netmap-related structures.
  Use the name 'ring' instead of 'queue' in all fields.
  Bump NETMAP_API.

Modified:
  head/sys/dev/netmap/ixgbe_netmap.h
  head/sys/dev/netmap/netmap.c
  head/sys/dev/netmap/netmap_kern.h
  head/sys/dev/netmap/netmap_mem1.c
  head/sys/net/netmap.h
  head/sys/net/netmap_user.h
  head/tools/tools/netmap/bridge.c

Modified: head/sys/dev/netmap/ixgbe_netmap.h
==
--- head/sys/dev/netmap/ixgbe_netmap.h  Fri Apr 13 15:43:42 2012
(r234226)
+++ head/sys/dev/netmap/ixgbe_netmap.h  Fri Apr 13 16:03:07 2012
(r234227)
@@ -63,6 +63,9 @@
  * This is tricky, much better to use TDH for now.
  */
 SYSCTL_DECL(_dev_netmap);
+static int ix_write_len;
+SYSCTL_INT(_dev_netmap, OID_AUTO, ix_write_len,
+CTLFLAG_RW, &ix_write_len, 0, "write rx len");
 static int ix_rx_miss, ix_rx_miss_bufs, ix_use_dd, ix_crcstrip;
 SYSCTL_INT(_dev_netmap, OID_AUTO, ix_crcstrip,
 CTLFLAG_RW, &ix_crcstrip, 0, "strip CRC on rx frames");
@@ -121,6 +124,9 @@ set_crcstrip(struct ixgbe_hw *hw, int on
 
hl = IXGBE_READ_REG(hw, IXGBE_HLREG0);
rxc = IXGBE_READ_REG(hw, IXGBE_RDRXCTL);
+   if (netmap_verbose)
+   D("%s read  HLREG 0x%x rxc 0x%x",
+   onoff ? "enter" : "exit", hl, rxc);
/* hw requirements ... */
rxc &= ~IXGBE_RDRXCTL_RSCFRSTSIZE;
rxc |= IXGBE_RDRXCTL_RSCACKC;
@@ -133,6 +139,9 @@ set_crcstrip(struct ixgbe_hw *hw, int on
hl |= IXGBE_HLREG0_RXCRCSTRP;
rxc |= IXGBE_RDRXCTL_CRCSTRIP;
}
+   if (netmap_verbose)
+   D("%s write HLREG 0x%x rxc 0x%x",
+   onoff ? "enter" : "exit", hl, rxc);
IXGBE_WRITE_REG(hw, IXGBE_HLREG0, hl);
IXGBE_WRITE_REG(hw, IXGBE_RDRXCTL, rxc);
 }
@@ -479,7 +488,7 @@ ixgbe_netmap_rxsync(struct ifnet *ifp, u
 * of CRCSTRIP. The data sheets say differently.
 * Very strange.
 */
-   int crclen = 0; // ix_crcstrip ? 0 : 4;
+   int crclen = ix_crcstrip ? 0 : 4;
l = rxr->next_to_check;
j = netmap_idx_n2k(kring, l);
 
@@ -490,6 +499,8 @@ ixgbe_netmap_rxsync(struct ifnet *ifp, u
if ((staterr & IXGBE_RXD_STAT_DD) == 0)
break;
ring->slot[j].len = le16toh(curr->wb.upper.length) - 
crclen;
+   if (ix_write_len)
+   D("rx[%d] len %d", j, ring->slot[j].len);
bus_dmamap_sync(rxr->ptag,
rxr->rx_buffers[l].pmap, BUS_DMASYNC_POSTREAD);
j = (j == lim) ? 0 : j + 1;

Modified: head/sys/dev/netmap/netmap.c
==
--- head/sys/dev/netmap/netmap.cFri Apr 13 15:43:42 2012
(r234226)
+++ head/sys/dev/netmap/netmap.cFri Apr 13 16:03:07 2012
(r234227)
@@ -173,21 +173,21 @@ netmap_dtor_locked(void *data)
/* Wake up any sleeping threads. netmap_poll will
 * then return POLLERR
 */
-   for (i = 0; i < na->num_tx_queues + 1; i++)
+   for (i = 0; i < na->num_tx_rings + 1; i++)
selwakeuppri(&na->tx_rings[i].si, PI_NET);
-   for (i = 0; i < na->num_rx_queues + 1; i++)
+   for (i = 0; i < na->num_rx_rings + 1; i++)
selwakeuppri(&na->rx_rings[i].si, PI_NET);
selwakeuppri(&na->tx_si, PI_NET);
selwakeuppri(&na->rx_si, PI_NET);
/* release all buffers */
NMA_LOCK();
-   for (i = 0; i < na->num_tx_queues + 1; i++) {
+   for (i = 0; i < na->num_tx_rings + 1; i++) {
struct netmap_ring *ring = na->tx_rings[i].ring;
lim = na->tx_rings[i].nkr_num_slots;
for (j = 0; j < lim; j++)
netmap_free_buf(nifp, ring->slot[j].buf_idx);
}
-   for (i = 0; i < na->num_rx_queues + 1; i++) {
+   for (i = 0; i < na->num_rx_rings + 1; i++) {
struct netmap_ring *ring = na->rx_rings[i].ring;
lim = na->rx_rings[i].nkr_num_slots;
for (j = 0; j < lim; j++)
@@ -260,7 +260,7 @@ netmap_mmap(__unused struct cdev *dev,
 static void
 netmap_sync_to_host(struct netmap_adapter *na)
 {
-   struct netmap_kring *kring = &na->tx_rings[na->num_tx_queues];
+   struct netmap_kring *kring = &na->tx_rings[na->num_tx_rings];
struct netmap_ring *ring = kring->ring;
struct mbuf *head = NULL, *

svn commit: r234225 - head/sys/dev/netmap

2012-04-13 Thread Luigi Rizzo
Author: luigi
Date: Fri Apr 13 15:33:12 2012
New Revision: 234225
URL: http://svn.freebsd.org/changeset/base/234225

Log:
  do not use a deprecated field in a structure.

Modified:
  head/sys/dev/netmap/if_re_netmap.h

Modified: head/sys/dev/netmap/if_re_netmap.h
==
--- head/sys/dev/netmap/if_re_netmap.h  Fri Apr 13 14:36:57 2012
(r234224)
+++ head/sys/dev/netmap/if_re_netmap.h  Fri Apr 13 15:33:12 2012
(r234225)
@@ -284,7 +284,7 @@ re_netmap_rxsync(struct ifnet *ifp, u_in
for (n = 0; j != k; n++) {
struct netmap_slot *slot = ring->slot + j;
struct rl_desc *desc = &sc->rl_ldata.rl_rx_list[l];
-   int cmd = na->buff_size | RL_RDESC_CMD_OWN;
+   int cmd = NETMAP_BUF_SIZE | RL_RDESC_CMD_OWN;
uint64_t paddr;
void *addr = PNMB(slot, &paddr);
 
@@ -391,7 +391,7 @@ re_netmap_rx_init(struct rl_softc *sc)
sc->rl_ldata.rl_rx_desc[i].rx_dmamap, BUS_DMASYNC_PREREAD);
desc[i].rl_bufaddr_lo = htole32(RL_ADDR_LO(paddr));
desc[i].rl_bufaddr_hi = htole32(RL_ADDR_HI(paddr));
-   cmdstat = na->buff_size;
+   cmdstat = NETMAP_BUF_SIZE;
if (i == n - 1) /* mark the end of ring */
cmdstat |= RL_RDESC_CMD_EOR;
if (i < max_avail)
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r234221 - head/usr.bin/calendar/calendars

2012-04-13 Thread Glen Barber
Author: gjb (doc committer)
Date: Fri Apr 13 09:54:36 2012
New Revision: 234221
URL: http://svn.freebsd.org/changeset/base/234221

Log:
  Belatedly add my entry to the calendar file, now that 30 is here and gone.

Modified:
  head/usr.bin/calendar/calendars/calendar.freebsd

Modified: head/usr.bin/calendar/calendars/calendar.freebsd
==
--- head/usr.bin/calendar/calendars/calendar.freebsdFri Apr 13 08:56:23 
2012(r234220)
+++ head/usr.bin/calendar/calendars/calendar.freebsdFri Apr 13 09:54:36 
2012(r234221)
@@ -126,6 +126,7 @@
 04/12  Ed Schouten  born in Oss, the Netherlands, 1986
 04/13  Oliver Braun  born in Nuremberg, Bavaria, Germany, 
1972
 04/14  Crist J. Clark  born in Milwaukee, Wisconsin, United 
States, 1970
+04/14  Glen J. Barber  born in Wilkes-Barre, Pennsylvania, 
United States, 1981
 04/15  David Malone  born in Dublin, Ireland, 1973
 04/17  Dryice Liu  born in Jinan, Shandong, China, 1975
 04/22  Joerg Wunsch  born in Dresden, Sachsen, Germany, 1962
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2012-04-13 Thread Adrian Chadd
Author: adrian
Date: Fri Apr 13 08:56:23 2012
New Revision: 234220
URL: http://svn.freebsd.org/changeset/base/234220

Log:
  These are uboot, so mark them as such or booting from flash will not work.

Modified:
  head/sys/mips/conf/AP94
  head/sys/mips/conf/AP96

Modified: head/sys/mips/conf/AP94
==
--- head/sys/mips/conf/AP94 Fri Apr 13 08:52:25 2012(r234219)
+++ head/sys/mips/conf/AP94 Fri Apr 13 08:56:23 2012(r234220)
@@ -25,6 +25,8 @@ options   GEOM_UZIP
 optionsROOTDEVNAME=\"ufs:md0.uzip\"
 optionsAR71XX_REALMEM=32*1024*1024
 
+optionsAR71XX_ENV_UBOOT
+
 # options  MD_ROOT
 # options  MD_ROOT_SIZE="6144"
 

Modified: head/sys/mips/conf/AP96
==
--- head/sys/mips/conf/AP96 Fri Apr 13 08:52:25 2012(r234219)
+++ head/sys/mips/conf/AP96 Fri Apr 13 08:56:23 2012(r234220)
@@ -25,6 +25,8 @@ options   GEOM_UZIP
 optionsROOTDEVNAME=\"ufs:md0.uzip\"
 optionsAR71XX_REALMEM=64*1024*1024
 
+optionsAR71XX_ENV_UBOOT
+
 # options  MD_ROOT
 # options  MD_ROOT_SIZE="6144"
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2012-04-13 Thread Adrian Chadd
Author: adrian
Date: Fri Apr 13 08:52:25 2012
New Revision: 234219
URL: http://svn.freebsd.org/changeset/base/234219

Log:
  Introduce configuration files for AP94 and AP96.
  
  This uses the new firmware(9) method for squirreling away the EEPROM
  contents from SPI flash so ath(4) can get to them later.
  
  It won't work out of the box just yet - you have to add this to
  if_ath_pci.c:
  
  #define ATH_EEPROM_FIRMWARE
  
  .. until I've added it as a configuration option and updated things.

Added:
  head/sys/mips/conf/AP94   (contents, props changed)
  head/sys/mips/conf/AP94.hints   (contents, props changed)
  head/sys/mips/conf/AP96   (contents, props changed)
  head/sys/mips/conf/AP96.hints   (contents, props changed)

Added: head/sys/mips/conf/AP94
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/mips/conf/AP94 Fri Apr 13 08:52:25 2012(r234219)
@@ -0,0 +1,32 @@
+#
+# Specific board setup for the Atheros AP94 reference board.
+#
+# The AP94 has the following hardware:
+#
+# + AR7161 CPU SoC
+# + AR9223 2.4GHz 11n
+# + AR9220 5GHz 11n
+# + AR8216 10/100 switch
+# + m25p64 based 8MB flash
+# + 32mb RAM
+# + uboot environment
+
+# $FreeBSD$
+
+include"AR71XX_BASE"
+ident  "AP94"
+hints  "AP94.hints"
+
+# GEOM modules
+device geom_redboot# to get access to the SPI flash partitions
+device geom_uzip   # compressed in-memory filesystem hackery!
+optionsGEOM_UZIP
+
+optionsROOTDEVNAME=\"ufs:md0.uzip\"
+optionsAR71XX_REALMEM=32*1024*1024
+
+# options  MD_ROOT
+# options  MD_ROOT_SIZE="6144"
+
+optionsAR71XX_ATH_EEPROM
+device firmware

Added: head/sys/mips/conf/AP94.hints
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/mips/conf/AP94.hints   Fri Apr 13 08:52:25 2012
(r234219)
@@ -0,0 +1,28 @@
+# $FreeBSD$
+
+hint.arge.0.phymask=0x000c
+hint.arge.0.media=100
+hint.arge.0.fduplex=1
+
+# XXX grab these from uboot?
+# hint.arge.0.eeprommac=0x1f01fc00
+
+# The ath NICs have calibration data in flash.
+# PCI slot 17
+# hint.ath.0.eepromaddr=0x1fff1000
+# PCI slot 18
+# hint.ath.1.eepromaddr=0x1fff5000
+
+# ath0 - slot 17
+hint.pcib.0.bus.0.17.0.ath_fixup_addr=0x1fff1000
+hint.pcib.0.bus.0.17.0.ath_fixup_size=4096
+
+# ath1 - slot 18
+hint.pcib.0.bus.0.18.0.ath_fixup_addr=0x1fff5000
+hint.pcib.0.bus.0.18.0.ath_fixup_size=4096
+
+# .. and now, telling each ath(4) NIC where to find the firmware
+# image.
+hint.ath.0.eeprom_firmware="pcib.0.bus.0.17.0.eeprom_firmware"
+hint.ath.1.eeprom_firmware="pcib.0.bus.0.18.0.eeprom_firmware"
+

Added: head/sys/mips/conf/AP96
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/mips/conf/AP96 Fri Apr 13 08:52:25 2012(r234219)
@@ -0,0 +1,32 @@
+#
+# Specific board setup for the Atheros AP96 reference board.
+#
+# The AP96 has the following hardware:
+#
+# + AR7161 CPU SoC
+# + AR9223 2.4GHz 11n
+# + AR9220 5GHz 11n
+# + AR8316 10/100/1000 switch
+# + m25p64 based 8MB flash
+# + 64mb RAM
+# + uboot environment
+
+# $FreeBSD$
+
+include"AR71XX_BASE"
+ident  "AP96"
+hints  "AP96.hints"
+
+# GEOM modules
+device geom_redboot# to get access to the SPI flash partitions
+device geom_uzip   # compressed in-memory filesystem hackery!
+optionsGEOM_UZIP
+
+optionsROOTDEVNAME=\"ufs:md0.uzip\"
+optionsAR71XX_REALMEM=64*1024*1024
+
+# options  MD_ROOT
+# options  MD_ROOT_SIZE="6144"
+
+optionsAR71XX_ATH_EEPROM
+device firmware

Added: head/sys/mips/conf/AP96.hints
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/mips/conf/AP96.hints   Fri Apr 13 08:52:25 2012
(r234219)
@@ -0,0 +1,28 @@
+# $FreeBSD$
+
+hint.arge.0.phymask=0x000c
+hint.arge.0.media=100
+hint.arge.0.fduplex=1
+
+# XXX grab these from uboot?
+# hint.arge.0.eeprommac=0x1f01fc00
+
+# The ath NICs have calibration data in flash.
+# PCI slot 17
+# hint.ath.0.eepromaddr=0x1fff1000
+# PCI slot 18
+# hint.ath.1.eepromaddr=0x1fff5000
+
+# ath0 - slot 17
+hint.pcib.0.bus.0.17.0.ath_fixup_addr=0x1fff1000
+hint.pcib.0.bus.0.17.0.ath_fixup_size=4096
+
+# ath1 - slot 18
+hint.pcib.0.bus.0.18.0.ath_fixup_addr=0x1fff5000
+hint.pcib.0.bus.0.18.0.ath_fixup_size=4096
+
+# .. and now, telling each ath(4) NIC where to find the firmware
+# image.
+hint.ath.0.eeprom_firmware="pcib.0.bus.0.17.0.eeprom_firmware"
+hint.ath.1.eeprom_firmware="pcib.0.bus.0.18.0.eeprom_firmwar

svn commit: r234218 - head/sys/dev/ath

2012-04-13 Thread Adrian Chadd
Author: adrian
Date: Fri Apr 13 08:48:38 2012
New Revision: 234218
URL: http://svn.freebsd.org/changeset/base/234218

Log:
  Introduce the ability to grab local EEPROM data from the firmware(9)
  interface.
  
  * Introduce a device hint, 'eeprom_firmware', which is the name of firmware
to lookup.
  * If the lookup succeeds, take a copy of it and use it as the eeprom data.
  
  This isn't enabled by default - you have to define ATH_EEPROM_FIRMWARE.
  I'll add it to the configuration variables in a later commit.
  
  TODO:
  
  * just keep a firmware reference in ath_softc, and remove the need to
waste the extra memory in having sc_eepromdata be a malloc()ed block.

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

Modified: head/sys/dev/ath/if_ath_pci.c
==
--- head/sys/dev/ath/if_ath_pci.c   Fri Apr 13 08:45:50 2012
(r234217)
+++ head/sys/dev/ath/if_ath_pci.c   Fri Apr 13 08:48:38 2012
(r234218)
@@ -60,6 +60,14 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+/* #define ATH_EEPROM_FIRMWARE */
+
+/* For EEPROM firmware */
+#ifdef ATH_EEPROM_FIRMWARE
+#include 
+#include 
+#endif /* ATH_EEPROM_FIRMWARE */
+
 /*
  * PCI glue.
  */
@@ -123,6 +131,10 @@ ath_pci_attach(device_t dev)
struct ath_softc *sc = &psc->sc_sc;
int error = ENXIO;
int rid;
+#ifdef ATH_EEPROM_FIRMWARE
+   const struct firmware *fw = NULL;
+   const char *buf;
+#endif
 
sc->sc_dev = dev;
 
@@ -191,6 +203,37 @@ ath_pci_attach(device_t dev)
goto bad3;
}
 
+#ifdef ATH_EEPROM_FIRMWARE
+   /*
+* If there's an EEPROM firmware image, load that in.
+*/
+   if (resource_string_value(device_get_name(dev), device_get_unit(dev),
+   "eeprom_firmware", &buf) == 0) {
+   if (bootverbose)
+   device_printf(dev, "%s: looking up firmware @ '%s'\n",
+   __func__, buf);
+
+   fw = firmware_get(buf);
+   if (fw == NULL) {
+   device_printf(dev, "%s: couldn't find firmware\n",
+   __func__);
+   goto bad3;
+   }
+
+   device_printf(dev, "%s: EEPROM firmware @ %p\n",
+   __func__, fw->data);
+   sc->sc_eepromdata =
+   malloc(fw->datasize, M_TEMP, M_WAITOK | M_ZERO);
+   if (! sc->sc_eepromdata) {
+   device_printf(dev, "%s: can't malloc eepromdata\n",
+   __func__);
+   goto bad3;
+   }
+   memcpy(sc->sc_eepromdata, fw->data, fw->datasize);
+   firmware_put(fw, 0);
+   }
+#endif /* ATH_EEPROM_FIRMWARE */
+
ATH_LOCK_INIT(sc);
ATH_PCU_LOCK_INIT(sc);
 
@@ -234,6 +277,9 @@ ath_pci_detach(device_t dev)
bus_dma_tag_destroy(sc->sc_dmat);
bus_release_resource(dev, SYS_RES_MEMORY, BS_BAR, psc->sc_sr);
 
+   if (sc->sc_eepromdata)
+   free(sc->sc_eepromdata, M_TEMP);
+
ATH_PCU_LOCK_DESTROY(sc);
ATH_LOCK_DESTROY(sc);
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2012-04-13 Thread Adrian Chadd
Author: adrian
Date: Fri Apr 13 08:45:50 2012
New Revision: 234217
URL: http://svn.freebsd.org/changeset/base/234217

Log:
  (ab)Use the firmware API to store away EEPROM calibration data for
  future use by the ath(4) driver.
  
  These embedded devices put the calibration/PCI bootstrap data on the
  on board SPI flash rather than on an EEPROM connected to the NIC.
  For some boards, there's two NICs and two sets of EEPROM data in the
  main SPI flash.
  
  The particulars:
  
  * Introduce ath_fixup_size, which is the size of the EEPROM area in
bytes.
  * Create a firmware image with a name based on the PCI device identifier
(bus/slot/device/function).
  * Hide some verbose debugging behind 'bootverbose'.
  
  ath(4) can then use this to load in the EEPROM data.
  
  This requires AR71XX_ATH_EEPROM to be defined.

Modified:
  head/sys/mips/atheros/ar71xx_pci.c

Modified: head/sys/mips/atheros/ar71xx_pci.c
==
--- head/sys/mips/atheros/ar71xx_pci.c  Fri Apr 13 08:11:14 2012
(r234216)
+++ head/sys/mips/atheros/ar71xx_pci.c  Fri Apr 13 08:45:50 2012
(r234217)
@@ -60,6 +60,11 @@ __FBSDID("$FreeBSD$");
 
 #include 
 
+#ifdef AR71XX_ATH_EEPROM
+#include 
+#include 
+#endif /* AR71XX_ATH_EEPROM */
+
 #undef AR71XX_PCI_DEBUG
 #ifdef AR71XX_PCI_DEBUG
 #define dprintf printf
@@ -266,8 +271,9 @@ ar71xx_pci_fixup(device_t dev, u_int bus
uint16_t *cal_data = (uint16_t *) MIPS_PHYS_TO_KSEG1(flash_addr);
uint32_t reg, val, bar0;
 
-   printf("%s: flash_addr=%lx, cal_data=%p\n",
-   __func__, flash_addr, cal_data);
+   if (bootverbose)
+   device_printf(dev, "%s: flash_addr=%lx, cal_data=%p\n",
+   __func__, flash_addr, cal_data);
 
/* XXX check 0xa55a */
/* Save bar(0) address - just to flush bar(0) (SoC WAR) ? */
@@ -284,7 +290,8 @@ ar71xx_pci_fixup(device_t dev, u_int bus
reg = *cal_data++;
val = *cal_data++;
val |= (*cal_data++) << 16;
-   printf("  reg: %x, val=%x\n", reg, val);
+   if (bootverbose)
+   printf("  reg: %x, val=%x\n", reg, val);
 
/* Write eeprom fixup data to device memory */
ATH_WRITE_REG(AR71XX_PCI_MEM_BASE + reg, val);
@@ -299,6 +306,62 @@ ar71xx_pci_fixup(device_t dev, u_int bus
ar71xx_pci_write_config(dev, bus, slot, func, PCIR_BAR(0), bar0, 4);
 }
 
+/*
+ * Take a copy of the EEPROM contents and squirrel it away in a firmware.
+ * The SPI flash will eventually cease to be memory-mapped, so we need
+ * to take a copy of this before the SPI driver initialises.
+ */
+static void
+ar71xx_pci_slot_create_eeprom_firmware(device_t dev, u_int bus, u_int slot,
+u_int func, long int flash_addr)
+{
+   char buf[64];
+   uint16_t *cal_data = (uint16_t *) MIPS_PHYS_TO_KSEG1(flash_addr);
+   void *eeprom = NULL;
+   const struct firmware *fw = NULL;
+   int len;
+
+   snprintf(buf, sizeof(buf), "bus.%d.%d.%d.ath_fixup_size",
+   bus, slot, func);
+
+   if (resource_int_value(device_get_name(dev), device_get_unit(dev),
+   buf, &len) != 0) {
+   device_printf(dev, "%s: missing hint '%s', aborting EEPROM\n",
+   __func__, buf);
+   return;
+   }
+
+   device_printf(dev, "EEPROM firmware: 0x%lx @ %d bytes\n",
+   flash_addr, len);
+
+   eeprom = malloc(len, M_DEVBUF, M_WAITOK | M_ZERO);
+   if (! eeprom) {
+   device_printf(dev,
+   "%s: malloc failed for '%s', aborting EEPROM\n",
+   __func__, buf);
+   return;
+   }
+
+   memcpy(eeprom, cal_data, len);
+
+   /*
+* Generate a flash EEPROM 'firmware' from the given memory
+* region.  Since the SPI controller will eventually
+* go into port-IO mode instead of memory-mapped IO
+* mode, a copy of the EEPROM contents is required.
+*/
+   snprintf(buf, sizeof(buf), "%s.%d.bus.%d.%d.%d.eeprom_firmware",
+   device_get_name(dev), device_get_unit(dev), bus, slot, func);
+   fw = firmware_register(buf, eeprom, len, 1, NULL);
+   if (fw == NULL) {
+   device_printf(dev, "%s: firmware_register (%s) failed\n",
+   __func__, buf);
+   free(eeprom, M_DEVBUF);
+   return;
+   }
+   device_printf(dev, "device EEPROM '%s' registered\n", buf);
+}
+
 static void
 ar71xx_pci_slot_fixup(device_t dev, u_int bus, u_int slot, u_int func)
 {
@@ -308,16 +371,19 @@ ar71xx_pci_slot_fixup(device_t dev, u_in
/*
 * Check whether the given slot has a hint to poke.
 */
-   printf("%s: checking dev %s, %d/%d/%d\n",
+   if (bootverbose)
+   device_printf(dev, "%s: checking dev %s, %d/%d/%d\n",
__func__, device_get_nameunit(dev),

svn commit: r234208 - in head/sys: amd64/amd64 i386/i386

2012-04-13 Thread Andriy Gapon
Author: avg
Date: Fri Apr 13 07:18:19 2012
New Revision: 234208
URL: http://svn.freebsd.org/changeset/base/234208

Log:
  add actual interrupt counters to back ipi_invlcache_counts
  
  Otherwise one could run into a panic with COUNT_IPIS when cache
  invalidation actually happened.
  
  Reviewed by:  jhb
  MFC after:1 week

Modified:
  head/sys/amd64/amd64/mp_machdep.c
  head/sys/i386/i386/mp_machdep.c

Modified: head/sys/amd64/amd64/mp_machdep.c
==
--- head/sys/amd64/amd64/mp_machdep.c   Fri Apr 13 07:15:40 2012
(r234207)
+++ head/sys/amd64/amd64/mp_machdep.c   Fri Apr 13 07:18:19 2012
(r234208)
@@ -1471,6 +1471,8 @@ mp_ipi_intrcnt(void *dummy)
intrcnt_add(buf, &ipi_invlrng_counts[i]);
snprintf(buf, sizeof(buf), "cpu%d:invlpg", i);
intrcnt_add(buf, &ipi_invlpg_counts[i]);
+   snprintf(buf, sizeof(buf), "cpu%d:invlcache", i);
+   intrcnt_add(buf, &ipi_invlcache_counts[i]);
snprintf(buf, sizeof(buf), "cpu%d:preempt", i);
intrcnt_add(buf, &ipi_preempt_counts[i]);
snprintf(buf, sizeof(buf), "cpu%d:ast", i);

Modified: head/sys/i386/i386/mp_machdep.c
==
--- head/sys/i386/i386/mp_machdep.c Fri Apr 13 07:15:40 2012
(r234207)
+++ head/sys/i386/i386/mp_machdep.c Fri Apr 13 07:18:19 2012
(r234208)
@@ -1530,6 +1530,8 @@ mp_ipi_intrcnt(void *dummy)
intrcnt_add(buf, &ipi_invlrng_counts[i]);
snprintf(buf, sizeof(buf), "cpu%d:invlpg", i);
intrcnt_add(buf, &ipi_invlpg_counts[i]);
+   snprintf(buf, sizeof(buf), "cpu%d:invlcache", i);
+   intrcnt_add(buf, &ipi_invlcache_counts[i]);
snprintf(buf, sizeof(buf), "cpu%d:preempt", i);
intrcnt_add(buf, &ipi_preempt_counts[i]);
snprintf(buf, sizeof(buf), "cpu%d:ast", i);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r234207 - in head/sys: amd64/include i386/include

2012-04-13 Thread Andriy Gapon
Author: avg
Date: Fri Apr 13 07:15:40 2012
New Revision: 234207
URL: http://svn.freebsd.org/changeset/base/234207

Log:
  bump INTRCNT_COUNT values to reflect actual numbers of IPI counters
  
  Maybe the numbers should be conditionalized on COUNT_IPIS
  
  Reviewed by:  jhb
  MFC after:1 week

Modified:
  head/sys/amd64/include/intr_machdep.h
  head/sys/i386/include/intr_machdep.h

Modified: head/sys/amd64/include/intr_machdep.h
==
--- head/sys/amd64/include/intr_machdep.h   Fri Apr 13 06:15:51 2012
(r234206)
+++ head/sys/amd64/include/intr_machdep.h   Fri Apr 13 07:15:40 2012
(r234207)
@@ -60,10 +60,10 @@
  * - 1 ??? dummy counter.
  * - 2 counters for each I/O interrupt.
  * - 1 counter for each CPU for lapic timer.
- * - 7 counters for each CPU for IPI counters for SMP.
+ * - 8 counters for each CPU for IPI counters for SMP.
  */
 #ifdef SMP
-#defineINTRCNT_COUNT   (1 + NUM_IO_INTS * 2 + (1 + 7) * MAXCPU)
+#defineINTRCNT_COUNT   (1 + NUM_IO_INTS * 2 + (1 + 8) * MAXCPU)
 #else
 #defineINTRCNT_COUNT   (1 + NUM_IO_INTS * 2 + 1)
 #endif

Modified: head/sys/i386/include/intr_machdep.h
==
--- head/sys/i386/include/intr_machdep.hFri Apr 13 06:15:51 2012
(r234206)
+++ head/sys/i386/include/intr_machdep.hFri Apr 13 07:15:40 2012
(r234207)
@@ -60,10 +60,10 @@
  * - 1 ??? dummy counter.
  * - 2 counters for each I/O interrupt.
  * - 1 counter for each CPU for lapic timer.
- * - 7 counters for each CPU for IPI counters for SMP.
+ * - 9 counters for each CPU for IPI counters for SMP.
  */
 #ifdef SMP
-#defineINTRCNT_COUNT   (1 + NUM_IO_INTS * 2 + (1 + 7) * MAXCPU)
+#defineINTRCNT_COUNT   (1 + NUM_IO_INTS * 2 + (1 + 9) * MAXCPU)
 #else
 #defineINTRCNT_COUNT   (1 + NUM_IO_INTS * 2 + 1)
 #endif
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"