svn commit: r245450 - in head/sys: arm/allwinner arm/conf boot/fdt/dts

2013-01-15 Thread Ganbold Tsagaankhuu
Author: ganbold (doc committer)
Date: Tue Jan 15 08:26:16 2013
New Revision: 245450
URL: http://svnweb.freebsd.org/changeset/base/245450

Log:
  Initial support for Allwinner A10 SoC (Cubieboard)
Add simple console driver
Add interrupt handling and timer codes
Add kernel config file
Add dts file
  Approved by: gonzo

Added:
  head/sys/arm/allwinner/
  head/sys/arm/allwinner/a10_machdep.c   (contents, props changed)
  head/sys/arm/allwinner/aintc.c   (contents, props changed)
  head/sys/arm/allwinner/bus_space.c   (contents, props changed)
  head/sys/arm/allwinner/common.c   (contents, props changed)
  head/sys/arm/allwinner/console.c   (contents, props changed)
  head/sys/arm/allwinner/files.a10   (contents, props changed)
  head/sys/arm/allwinner/std.a10   (contents, props changed)
  head/sys/arm/allwinner/timer.c   (contents, props changed)
  head/sys/arm/conf/CUBIEBOARD   (contents, props changed)
  head/sys/boot/fdt/dts/cubieboard.dts   (contents, props changed)

Added: head/sys/arm/allwinner/a10_machdep.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/arm/allwinner/a10_machdep.cTue Jan 15 08:26:16 2013
(r245450)
@@ -0,0 +1,122 @@
+/*-
+ * Copyright (c) 2012 Ganbold Tsagaankhuu. ganb...@gmail.com
+ * All rights reserved.
+ *
+ * This code is derived from software written for Brini by Mark Brinicombe
+ *
+ * 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.
+ *
+ * from: FreeBSD: //depot/projects/arm/src/sys/arm/ti/ti_machdep.c
+ */
+
+#include opt_ddb.h
+#include opt_platform.h
+
+#include sys/cdefs.h
+__FBSDID($FreeBSD$);
+
+#define _ARM32_BUS_DMA_PRIVATE
+#include sys/param.h
+#include sys/systm.h
+#include sys/bus.h
+
+#include vm/vm.h
+#include vm/pmap.h
+
+#include machine/bus.h
+#include machine/frame.h /* For trapframe_t, used in machine/machdep.h */
+#include machine/machdep.h
+#include machine/pmap.h
+
+#include dev/fdt/fdt_common.h
+
+/* Start of address space used for bootstrap map */
+#define DEVMAP_BOOTSTRAP_MAP_START  0xE000
+
+void (*a10_cpu_reset)(void);
+
+vm_offset_t
+initarm_lastaddr(void)
+{
+
+   a10_cpu_reset = NULL;
+   return (DEVMAP_BOOTSTRAP_MAP_START - ARM_NOCACHE_KVA_SIZE);
+}
+
+void
+initarm_gpio_init(void)
+{
+}
+
+void
+initarm_late_init(void)
+{
+}
+
+#define FDT_DEVMAP_MAX (1 + 2 + 1 + 1)
+static struct pmap_devmap fdt_devmap[FDT_DEVMAP_MAX] = {
+   { 0, 0, 0, 0, 0, }
+};
+
+/*
+ * Construct pmap_devmap[] with DT-derived config data.
+ */
+int
+platform_devmap_init(void)
+{
+   int i = 0;
+
+   fdt_devmap[i].pd_va =   0xE1C0;
+   fdt_devmap[i].pd_pa =   0x01C0;
+   fdt_devmap[i].pd_size = 0x0040; /* 4 MB */
+   fdt_devmap[i].pd_prot = VM_PROT_READ | VM_PROT_WRITE;
+   fdt_devmap[i].pd_cache = PTE_DEVICE;
+
+   i++;
+
+   pmap_devmap_bootstrap_table = fdt_devmap[0];
+
+   return (0);
+}
+
+struct arm32_dma_range *
+bus_dma_get_range(void)
+{
+   return (NULL);
+}
+
+int
+bus_dma_get_range_nb(void)
+{
+   return (0);
+}
+
+void
+cpu_reset()
+{
+   if (a10_cpu_reset)
+   (*a10_cpu_reset)();
+   else
+   printf(no cpu_reset implementation\n);
+   printf(Reset failed!\n);
+   while (1);
+}

Added: head/sys/arm/allwinner/aintc.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/arm/allwinner/aintc.c  Tue Jan 15 08:26:16 2013
(r245450)
@@ -0,0 +1,211 @@
+/*-
+ * Copyright (c) 2012 Ganbold Tsagaankhuu ganb...@gmail.com
+ * All rights reserved.
+ 

Re: svn commit: r245450 - in head/sys: arm/allwinner arm/conf boot/fdt/dts

2013-01-15 Thread Alexander Motin
On 15.01.2013 10:26, Ganbold Tsagaankhuu wrote:
 Author: ganbold (doc committer)
 Date: Tue Jan 15 08:26:16 2013
 New Revision: 245450
 URL: http://svnweb.freebsd.org/changeset/base/245450
 
 Log:
   Initial support for Allwinner A10 SoC (Cubieboard)
   Add simple console driver
   Add interrupt handling and timer codes
   Add kernel config file
   Add dts file
   Approved by: gonzo

 +/* Set desired frequency in event timer and timecounter */
 + sc-et.et_frequency = (uint64_t)freq;
 + sc-clkfreq = (uint64_t)freq;
 + sc-et.et_name = a10_timer Eventtimer;
 + sc-et.et_flags = ET_FLAGS_ONESHOT | ET_FLAGS_PERIODIC;
 + sc-et.et_quality = 1000;
 + sc-et.et_min_period.sec = 0;
 + sc-et.et_min_period.frac =
 + ((0x0002LLU  32) / sc-et.et_frequency)  32;
 + sc-et.et_max_period.sec = 0xfff0U / sc-et.et_frequency;
 + sc-et.et_max_period.frac =
 + ((0xfffeLLU  32) / sc-et.et_frequency)  32;
 + sc-et.et_start = a10_timer_timer_start;
 + sc-et.et_stop = a10_timer_timer_stop;
 + sc-et.et_priv = sc;
 + et_register(sc-et);


 +static int
 +a10_timer_timer_start(struct eventtimer *et, struct bintime *first,
 +struct bintime *period)
 +{
 + struct a10_timer_softc *sc;
 + uint32_t clo, count;
 +
 + sc = (struct a10_timer_softc *)et-et_priv;
 +
 + if (first != NULL) {
 + count = (sc-et.et_frequency * (first-frac  32))  32;
 + if (first-sec != 0)
 + count += sc-et.et_frequency * first-sec;
 +
 + /* clear */
 + timer_write_4(sc, SW_TIMER0_CUR_VALUE_REG, 0);
 + clo = timer_read_4(sc, SW_TIMER0_CUR_VALUE_REG);
 + clo += count;
 + timer_write_4(sc, SW_TIMER0_CUR_VALUE_REG, clo);
 +
 + return (0);
 + }
 +
 + return (EINVAL);
 +}

It seems like you've announced periodic mode support above, but haven't
implemented it here.

-- 
Alexander Motin
___
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: r245453 - head/sys/arm/allwinner

2013-01-15 Thread Ganbold Tsagaankhuu
Author: ganbold (doc committer)
Date: Tue Jan 15 09:31:13 2013
New Revision: 245453
URL: http://svnweb.freebsd.org/changeset/base/245453

Log:
  Fix license to follow standard license template
  
  Reviewed by: joel

Modified:
  head/sys/arm/allwinner/a10_machdep.c
  head/sys/arm/allwinner/bus_space.c
  head/sys/arm/allwinner/common.c
  head/sys/arm/allwinner/console.c
  head/sys/arm/allwinner/timer.c

Modified: head/sys/arm/allwinner/a10_machdep.c
==
--- head/sys/arm/allwinner/a10_machdep.cTue Jan 15 09:17:07 2013
(r245452)
+++ head/sys/arm/allwinner/a10_machdep.cTue Jan 15 09:31:13 2013
(r245453)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2012 Ganbold Tsagaankhuu. ganb...@gmail.com
+ * Copyright (c) 2012 Ganbold Tsagaankhuu ganb...@gmail.com
  * All rights reserved.
  *
  * This code is derived from software written for Brini by Mark Brinicombe

Modified: head/sys/arm/allwinner/bus_space.c
==
--- head/sys/arm/allwinner/bus_space.c  Tue Jan 15 09:17:07 2013
(r245452)
+++ head/sys/arm/allwinner/bus_space.c  Tue Jan 15 09:31:13 2013
(r245453)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (C) 2012 Ganbold Tsagaankhuu ganb...@gmail.com
+ * Copyright (c) 2012 Ganbold Tsagaankhuu ganb...@gmail.com
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -10,14 +10,11 @@
  * 2. Redistributions in binary form must reproduce the above copyright
  *notice, this list of conditions and the following disclaimer in the
  *documentation and/or other materials provided with the distribution.
- * 3. Neither the name of MARVELL nor the names of contributors
- *may be used to endorse or promote products derived from this software
- *without specific prior written permission.
  *
- * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * 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 AUTHOR OR CONTRIBUTORS BE LIABLE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)

Modified: head/sys/arm/allwinner/common.c
==
--- head/sys/arm/allwinner/common.c Tue Jan 15 09:17:07 2013
(r245452)
+++ head/sys/arm/allwinner/common.c Tue Jan 15 09:31:13 2013
(r245453)
@@ -1,9 +1,7 @@
 /*-
- * Copyright (c) 2012 Ganbold Tsagaankhuu
+ * Copyright (c) 2012 Ganbold Tsagaankhuu ganb...@gmail.com
  * All rights reserved.
  *
- * Developed by Ganbold Tsagaankhuu ganb...@gmail.com
- *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:

Modified: head/sys/arm/allwinner/console.c
==
--- head/sys/arm/allwinner/console.cTue Jan 15 09:17:07 2013
(r245452)
+++ head/sys/arm/allwinner/console.cTue Jan 15 09:31:13 2013
(r245453)
@@ -5,11 +5,11 @@
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
- * 1.  Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2.  Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
  *
  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE

Modified: head/sys/arm/allwinner/timer.c
==
--- head/sys/arm/allwinner/timer.c  Tue Jan 15 09:17:07 2013
(r245452)
+++ head/sys/arm/allwinner/timer.c  Tue Jan 15 09:31:13 2013
(r245453)
@@ -5,11 +5,11 @@
  * Redistribution and use in source and binary forms, with or without
  * 

svn commit: r245454 - head/sys/arm/allwinner

2013-01-15 Thread Ganbold Tsagaankhuu
Author: ganbold (doc committer)
Date: Tue Jan 15 09:39:11 2013
New Revision: 245454
URL: http://svnweb.freebsd.org/changeset/base/245454

Log:
  Fix formatting of license according to share/examples/etc/bsd-style-copyright
  
  Reviewed by: joel

Modified:
  head/sys/arm/allwinner/a10_machdep.c
  head/sys/arm/allwinner/bus_space.c
  head/sys/arm/allwinner/common.c
  head/sys/arm/allwinner/console.c
  head/sys/arm/allwinner/timer.c

Modified: head/sys/arm/allwinner/a10_machdep.c
==
--- head/sys/arm/allwinner/a10_machdep.cTue Jan 15 09:31:13 2013
(r245453)
+++ head/sys/arm/allwinner/a10_machdep.cTue Jan 15 09:39:11 2013
(r245454)
@@ -16,7 +16,7 @@
  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)

Modified: head/sys/arm/allwinner/bus_space.c
==
--- head/sys/arm/allwinner/bus_space.c  Tue Jan 15 09:31:13 2013
(r245453)
+++ head/sys/arm/allwinner/bus_space.c  Tue Jan 15 09:39:11 2013
(r245454)
@@ -14,7 +14,7 @@
  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)

Modified: head/sys/arm/allwinner/common.c
==
--- head/sys/arm/allwinner/common.c Tue Jan 15 09:31:13 2013
(r245453)
+++ head/sys/arm/allwinner/common.c Tue Jan 15 09:39:11 2013
(r245454)
@@ -14,7 +14,7 @@
  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)

Modified: head/sys/arm/allwinner/console.c
==
--- head/sys/arm/allwinner/console.cTue Jan 15 09:31:13 2013
(r245453)
+++ head/sys/arm/allwinner/console.cTue Jan 15 09:39:11 2013
(r245454)
@@ -14,7 +14,7 @@
  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)

Modified: head/sys/arm/allwinner/timer.c
==
--- head/sys/arm/allwinner/timer.c  Tue Jan 15 09:31:13 2013
(r245453)
+++ head/sys/arm/allwinner/timer.c  Tue Jan 15 09:39:11 2013
(r245454)
@@ -14,7 +14,7 @@
  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  * OR SERVICES; LOSS OF USE, DATA, OR 

svn commit: r245455 - head/sys/arm/allwinner

2013-01-15 Thread Ganbold Tsagaankhuu
Author: ganbold (doc committer)
Date: Tue Jan 15 09:56:20 2013
New Revision: 245455
URL: http://svnweb.freebsd.org/changeset/base/245455

Log:
  Add mistakenly removed third clause to license
  
  Reviewed by: joel

Modified:
  head/sys/arm/allwinner/bus_space.c

Modified: head/sys/arm/allwinner/bus_space.c
==
--- head/sys/arm/allwinner/bus_space.c  Tue Jan 15 09:39:11 2013
(r245454)
+++ head/sys/arm/allwinner/bus_space.c  Tue Jan 15 09:56:20 2013
(r245455)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2012 Ganbold Tsagaankhuu ganb...@gmail.com
+ * Copyright (C) 2012 FreeBSD Foundation
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -10,11 +10,14 @@
  * 2. Redistributions in binary form must reproduce the above copyright
  *notice, this list of conditions and the following disclaimer in the
  *documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of MARVELL nor the names of contributors
+ *may be used to endorse or promote products derived from this software
+ *without specific prior written permission.
  *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL 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)
___
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: r245456 - in head: sbin/geom/class/raid3 sys/geom/raid3

2013-01-15 Thread Alexander Motin
Author: mav
Date: Tue Jan 15 10:06:35 2013
New Revision: 245456
URL: http://svnweb.freebsd.org/changeset/base/245456

Log:
  Allow to insert new component to geom_raid3 without specifying number.
  
  PR:   kern/160562
  MFC after:2 weeks

Modified:
  head/sbin/geom/class/raid3/geom_raid3.c
  head/sbin/geom/class/raid3/graid3.8
  head/sys/geom/raid3/g_raid3_ctl.c

Modified: head/sbin/geom/class/raid3/geom_raid3.c
==
--- head/sbin/geom/class/raid3/geom_raid3.c Tue Jan 15 09:56:20 2013
(r245455)
+++ head/sbin/geom/class/raid3/geom_raid3.c Tue Jan 15 10:06:35 2013
(r245456)
@@ -76,7 +76,7 @@ struct g_command class_commands[] = {
{ insert, G_FLAG_VERBOSE, NULL,
{
{ 'h', hardcode, NULL, G_TYPE_BOOL },
-   { 'n', number, NULL, G_TYPE_NUMBER },
+   { 'n', number, G_VAL_OPTIONAL, G_TYPE_NUMBER },
G_OPT_SENTINEL
},
[-hv] -n number name prov

Modified: head/sbin/geom/class/raid3/graid3.8
==
--- head/sbin/geom/class/raid3/graid3.8 Tue Jan 15 09:56:20 2013
(r245455)
+++ head/sbin/geom/class/raid3/graid3.8 Tue Jan 15 10:06:35 2013
(r245456)
@@ -24,7 +24,7 @@
 .\
 .\ $FreeBSD$
 .\
-.Dd January 5, 2010
+.Dd January 15, 2012
 .Dt GRAID3 8
 .Os
 .Sh NAME
@@ -53,7 +53,7 @@
 .Nm
 .Cm insert
 .Op Fl hv
-.Fl n Ar number
+.Op Fl n Ar number
 .Ar name
 .Ar prov
 .Nm
@@ -171,6 +171,8 @@ Add the given component to the existing 
 removed previously with the
 .Cm remove
 command or if one component is missing and will not be connected again.
+If no number is given, new component will be added instead of first missed
+component.
 .Pp
 Additional options include:
 .Bl -tag -width .Fl h

Modified: head/sys/geom/raid3/g_raid3_ctl.c
==
--- head/sys/geom/raid3/g_raid3_ctl.c   Tue Jan 15 09:56:20 2013
(r245455)
+++ head/sys/geom/raid3/g_raid3_ctl.c   Tue Jan 15 10:06:35 2013
(r245456)
@@ -404,7 +404,7 @@ g_raid3_ctl_insert(struct gctl_req *req,
u_char *sector;
off_t compsize;
intmax_t *no;
-   int *hardcode, *nargs, error;
+   int *hardcode, *nargs, error, autono;
 
nargs = gctl_get_paraml(req, nargs, sizeof(*nargs));
if (nargs == NULL) {
@@ -425,11 +425,10 @@ g_raid3_ctl_insert(struct gctl_req *req,
gctl_error(req, No 'arg%u' argument., 1);
return;
}
-   no = gctl_get_paraml(req, number, sizeof(*no));
-   if (no == NULL) {
-   gctl_error(req, No '%s' argument., no);
-   return;
-   }
+   if (gctl_get_param(req, number, NULL) != NULL)
+   no = gctl_get_paraml(req, number, sizeof(*no));
+   else
+   no = NULL;
if (strncmp(name, /dev/, 5) == 0)
name += 5;
g_topology_lock();
@@ -465,16 +464,30 @@ g_raid3_ctl_insert(struct gctl_req *req,
gctl_error(req, No such device: %s., name);
goto end;
}
-   if (*no = sc-sc_ndisks) {
-   sx_xunlock(sc-sc_lock);
-   gctl_error(req, Invalid component number.);
-   goto end;
-   }
-   disk = sc-sc_disks[*no];
-   if (disk-d_state != G_RAID3_DISK_STATE_NODISK) {
-   sx_xunlock(sc-sc_lock);
-   gctl_error(req, Component %jd is already connected., *no);
-   goto end;
+   if (no != NULL) {
+   if (*no  0 || *no = sc-sc_ndisks) {
+   sx_xunlock(sc-sc_lock);
+   gctl_error(req, Invalid component number.);
+   goto end;
+   }
+   disk = sc-sc_disks[*no];
+   if (disk-d_state != G_RAID3_DISK_STATE_NODISK) {
+   sx_xunlock(sc-sc_lock);
+   gctl_error(req, Component %jd is already connected.,
+   *no);
+   goto end;
+   }
+   } else {
+   disk = NULL;
+   for (autono = 0; autono  sc-sc_ndisks  disk == NULL; 
autono++)
+   if (sc-sc_disks[autono].d_state ==
+   G_RAID3_DISK_STATE_NODISK)
+   disk = sc-sc_disks[autono];
+   if (disk == NULL) {
+   sx_xunlock(sc-sc_lock);
+   gctl_error(req, No disconnected components.);
+   goto end;
+   }
}
if (((sc-sc_sectorsize / (sc-sc_ndisks - 1)) % pp-sectorsize) != 0) {
sx_xunlock(sc-sc_lock);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to 

Re: svn commit: r245222 - head/sys/sys

2013-01-15 Thread Gleb Smirnoff
On Thu, Jan 10, 2013 at 09:31:28AM +1100, Bruce Evans wrote:
B  On Wed, Jan 09, 2013 at 09:09:09AM +, Hans Petter Selasky wrote:
B  H Log:
B  H   Fix compile warning when using GCC:
B  H   Comparison between signed and unsigned.
B 
B o Add 3 style bugs:
B   2 sets of excessive parentheses
B   1 line longer than 80 columns

Bruce,

can you please look at attached patch, that fixes problems you
describe? It

- fixes mentioned style bugs in param.h
- adds int casts to MHLEN and MLEN
- removes extra casts from (void *) to (struct mbuf *)
- removes extra declarations of inlined functions
- uninlines and moves m_get2() and m_getjcl() to uipc_mbuf.c
- size argument of m_get2() swicthed back to int

-- 
Totus tuus, Glebius.
Index: sys/param.h
===
--- sys/param.h	(revision 245450)
+++ sys/param.h	(working copy)
@@ -156,8 +156,8 @@
  * MCLBYTES must be no larger than PAGE_SIZE.
  */
 #ifndef	MSIZE
-#define MSIZE		256		/* size of an mbuf */
-#endif	/* MSIZE */
+#define	MSIZE		256		/* size of an mbuf */
+#endif
 
 #ifndef	MCLSHIFT
 #define MCLSHIFT	11		/* convert bytes to mbuf clusters */
Index: sys/mbuf.h
===
--- sys/mbuf.h	(revision 245450)
+++ sys/mbuf.h	(working copy)
@@ -52,11 +52,14 @@
  * stored.  Additionally, it is possible to allocate a separate buffer
  * externally and attach it to the mbuf in a way similar to that of mbuf
  * clusters.
+ *
+ * MLEN is data length in a normal mbuf.
+ * MHLEN is data length in an mbuf with pktheader.
+ * MINCLSIZE is a smallest amount of data that should be put into cluster.
  */
-#define	MLEN		(MSIZE - sizeof(struct m_hdr))	/* normal data len */
-#define	MHLEN		(MLEN - sizeof(struct pkthdr))	/* data len w/pkthdr */
-#define	MINCLSIZE	(MHLEN + 1)	/* smallest amount to put in cluster */
-#define	M_MAXCOMPRESS	(MHLEN / 2)	/* max amount to copy for compression */
+#define	MLEN		((int)(MSIZE - sizeof(struct m_hdr)))
+#define	MHLEN		((int)(MLEN - sizeof(struct pkthdr)))
+#define	MINCLSIZE	(MHLEN + 1)
 
 #ifdef _KERNEL
 /*-
@@ -393,23 +396,10 @@
 extern uma_zone_t	zone_jumbo16;
 extern uma_zone_t	zone_ext_refcnt;
 
-static __inline struct mbuf	*m_getcl(int how, short type, int flags);
-static __inline struct mbuf	*m_get(int how, short type);
-static __inline struct mbuf	*m_get2(int how, short type, int flags,
-u_int size);
-static __inline struct mbuf	*m_gethdr(int how, short type);
-static __inline struct mbuf	*m_getjcl(int how, short type, int flags,
-int size);
-static __inline struct mbuf	*m_getclr(int how, short type);	/* XXX */
-static __inline int		 m_init(struct mbuf *m, uma_zone_t zone,
-int size, int how, short type, int flags);
-static __inline struct mbuf	*m_free(struct mbuf *m);
-static __inline void		 m_clget(struct mbuf *m, int how);
-static __inline void		*m_cljget(struct mbuf *m, int how, int size);
-static __inline void		 m_chtype(struct mbuf *m, short new_type);
-void mb_free_ext(struct mbuf *);
-static __inline struct mbuf	*m_last(struct mbuf *m);
-int m_pkthdr_init(struct mbuf *m, int how);
+struct mbuf	*m_get2(int how, short type, int flags, int size);
+struct mbuf	*m_getjcl(int how, short type, int flags, int size);
+void		 mb_free_ext(struct mbuf *);
+int		 m_pkthdr_init(struct mbuf *m, int how);
 
 static __inline int
 m_gettype(int size)
@@ -502,7 +492,7 @@
 
 	args.flags = 0;
 	args.type = type;
-	return ((struct mbuf *)(uma_zalloc_arg(zone_mbuf, args, how)));
+	return (uma_zalloc_arg(zone_mbuf, args, how));
 }
 
 /*
@@ -529,7 +519,7 @@
 
 	args.flags = M_PKTHDR;
 	args.type = type;
-	return ((struct mbuf *)(uma_zalloc_arg(zone_mbuf, args, how)));
+	return (uma_zalloc_arg(zone_mbuf, args, how));
 }
 
 static __inline struct mbuf *
@@ -539,87 +529,9 @@
 
 	args.flags = flags;
 	args.type = type;
-	return ((struct mbuf *)(uma_zalloc_arg(zone_pack, args, how)));
+	return (uma_zalloc_arg(zone_pack, args, how));
 }
 
-/*
- * m_get2() allocates minimum mbuf that would fit size argument.
- *
- * XXX: This is rather large, should be real function maybe.
- */
-static __inline struct mbuf *
-m_get2(int how, short type, int flags, u_int size)
-{
-	struct mb_args args;
-	struct mbuf *m, *n;
-	uma_zone_t zone;
-
-	args.flags = flags;
-	args.type = type;
-
-	if (size = MHLEN || (size = MLEN  (flags  M_PKTHDR) == 0))
-		return ((struct mbuf *)(uma_zalloc_arg(zone_mbuf, args, how)));
-	if (size = MCLBYTES)
-		return ((struct mbuf *)(uma_zalloc_arg(zone_pack, args, how)));
-
-	if (size  MJUM16BYTES)
-		return (NULL);
-
-	m = uma_zalloc_arg(zone_mbuf, args, how);
-	if (m == NULL)
-		return (NULL);
-
-#if MJUMPAGESIZE != MCLBYTES
-	if (size = MJUMPAGESIZE)
-		zone = zone_jumbop;
-	else
-#endif
-	if (size = MJUM9BYTES)
-		zone = zone_jumbo9;
-	else
-		zone = zone_jumbo16;
-
-	n = uma_zalloc_arg(zone, m, how);
-	if (n == NULL) {
-		uma_zfree(zone_mbuf, m);
-		return (NULL);
-	}
-
-	return (m);
-}

Re: svn commit: r245222 - head/sys/sys

2013-01-15 Thread Bruce Evans

On Tue, 15 Jan 2013, Gleb Smirnoff wrote:


On Thu, Jan 10, 2013 at 09:31:28AM +1100, Bruce Evans wrote:
B  On Wed, Jan 09, 2013 at 09:09:09AM +, Hans Petter Selasky wrote:
B  H Log:
B  H   Fix compile warning when using GCC:
B  H   Comparison between signed and unsigned.
B
B o Add 3 style bugs:
B2 sets of excessive parentheses
B1 line longer than 80 columns

Bruce,

can you please look at attached patch, that fixes problems you
describe? It

- fixes mentioned style bugs in param.h
- adds int casts to MHLEN and MLEN
- removes extra casts from (void *) to (struct mbuf *)
- removes extra declarations of inlined functions
- uninlines and moves m_get2() and m_getjcl() to uipc_mbuf.c
- size argument of m_get2() swicthed back to int


Looks mostly good.

% ...
% Index: sys/mbuf.h
% ===
% --- sys/mbuf.h(revision 245450)
% +++ sys/mbuf.h(working copy)
% @@ -52,11 +52,14 @@
%   * stored.  Additionally, it is possible to allocate a separate buffer
%   * externally and attach it to the mbuf in a way similar to that of mbuf
%   * clusters.
% + *
% + * MLEN is data length in a normal mbuf.
% + * MHLEN is data length in an mbuf with pktheader.
% + * MINCLSIZE is a smallest amount of data that should be put into cluster.
%   */

The comment needs indent protection if you want to preserve the line
structure of the new comments.  I don't see any better way to format these
lines as bullet points.  A separate paragraph for each would be too verbose.

% -#define  MLEN(MSIZE - sizeof(struct m_hdr))  /* normal data 
len */
% -#define  MHLEN   (MLEN - sizeof(struct pkthdr))  /* data len 
w/pkthdr */
% -#define  MINCLSIZE   (MHLEN + 1) /* smallest amount to put in 
cluster */
% -#define  M_MAXCOMPRESS   (MHLEN / 2) /* max amount to copy for 
compression */
% +#define  MLEN((int)(MSIZE - sizeof(struct m_hdr)))
% +#define  MHLEN   ((int)(MLEN - sizeof(struct pkthdr)))
% +#define  MINCLSIZE   (MHLEN + 1)

These never needed to be sorted non-alphabetically.

I hope this doesn't cause any problems.  MHLEN, etc., are used just a few
times outside of mbuf.h where we can't control this, mostly in specialized
code.  One interesting use in non-specialized code is in tcp_output():

if (len = MHLEN - hdrlen - max_linkhdr) {

Here len has type long, MHLEN has type size_t (before this change) and type 
int (after this change), hdrlen has type unsigned (misspelled as that instead

of u_int), and max_linkhdr has type int.  So the type combinations are
nonsense, and there is a good chance of getting different compiler warnings
about this before and after the change.  Having just one unsigned type in
the mix tends to promote everything to unsigned, except on 64-bit systems
with one u_int but no size_t, the long has highest rank so everything
gets promoted to long.

% ...
% @@ -393,23 +396,10 @@
%  extern uma_zone_tzone_jumbo16;
%  extern uma_zone_tzone_ext_refcnt;
% 
% -static __inline struct mbuf	*m_getcl(int how, short type, int flags);

% ...
% -static __inline void *m_cljget(struct mbuf *m, int how, int size);
% -static __inline void  m_chtype(struct mbuf *m, short new_type);
% -void  mb_free_ext(struct mbuf *);
% -static __inline struct mbuf  *m_last(struct mbuf *m);
% -int   m_pkthdr_init(struct mbuf *m, int how);
% +struct mbuf  *m_get2(int how, short type, int flags, int size);
% +struct mbuf  *m_getjcl(int how, short type, int flags, int size);
% +void  mb_free_ext(struct mbuf *);

This one is still missing a parameter name, unlike all (?) the others.

% +int   m_pkthdr_init(struct mbuf *m, int how);

The 2 new non-inline prototypes should be moved to the general section
for non-inline prototypes.  The 2 old ones must remain early since
they are used in the inlines.

After moving the 2 new ones, also remove their parameter names to match
the (worse) nearby style.  This leaves only 1 nearby other for mb_free_ext()
to be mismatched with.

The general prototype section has a fairly uniform style, with the only
obvious bugs being:
- m_copyup() has parameter names
- m_sanity() is misindented by 1 space
- m_unshare() has 1 parameter name but 2 parameters.

There is another section for non-inline prototypes for packet tag routines.
This has the same style as the general section, except it is unsorted at
the end.  It is placed _before_ the packet tag inlines instead of after
them.  This has the technical advantage that you don't have to split up
the non-inline prototypes.

There is another section for non-inline prototypes and other things for
MBUF_PROFILING.  This has about 3 style bugs per line.

Bruce
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, 

Re: svn commit: r245222 - head/sys/sys

2013-01-15 Thread Gleb Smirnoff
  Bruce,

On Tue, Jan 15, 2013 at 11:13:36PM +1100, Bruce Evans wrote:
B  can you please look at attached patch, that fixes problems you
B  describe? It
B 
B  - fixes mentioned style bugs in param.h
B  - adds int casts to MHLEN and MLEN
B  - removes extra casts from (void *) to (struct mbuf *)
B  - removes extra declarations of inlined functions
B  - uninlines and moves m_get2() and m_getjcl() to uipc_mbuf.c
B  - size argument of m_get2() swicthed back to int
B 
B Looks mostly good.
B 
B % ...
B % Index: sys/mbuf.h
B % ===
B % --- sys/mbuf.h (revision 245450)
B % +++ sys/mbuf.h (working copy)
B % @@ -52,11 +52,14 @@
B %   * stored.  Additionally, it is possible to allocate a separate buffer
B %   * externally and attach it to the mbuf in a way similar to that of mbuf
B %   * clusters.
B % + *
B % + * MLEN is data length in a normal mbuf.
B % + * MHLEN is data length in an mbuf with pktheader.
B % + * MINCLSIZE is a smallest amount of data that should be put into cluster.
B %   */
B 
B The comment needs indent protection if you want to preserve the line
B structure of the new comments.  I don't see any better way to format these
B lines as bullet points.  A separate paragraph for each would be too verbose.
B 
B % -#define   MLEN(MSIZE - sizeof(struct m_hdr))  /* normal data 
len */
B % -#define   MHLEN   (MLEN - sizeof(struct pkthdr))  /* data len 
w/pkthdr */
B % -#define   MINCLSIZE   (MHLEN + 1) /* smallest amount to put in 
cluster */
B % -#define   M_MAXCOMPRESS   (MHLEN / 2) /* max amount to copy for 
compression */
B % +#define   MLEN((int)(MSIZE - sizeof(struct m_hdr)))
B % +#define   MHLEN   ((int)(MLEN - sizeof(struct pkthdr)))
B % +#define   MINCLSIZE   (MHLEN + 1)
B 
B These never needed to be sorted non-alphabetically.

Sorting alphabetically moves MLEN to the bottom, but the above macros
are defined via MLEN. IMO, it is more easy to read when we move from
most simple macro to ones that are derived from it, not in alphabetical
order.

B I hope this doesn't cause any problems.  MHLEN, etc., are used just a few
B times outside of mbuf.h where we can't control this, mostly in specialized
B code.  One interesting use in non-specialized code is in tcp_output():
B 
B  if (len = MHLEN - hdrlen - max_linkhdr) {
B 
B Here len has type long, MHLEN has type size_t (before this change) and type 
B int (after this change), hdrlen has type unsigned (misspelled as that instead
B of u_int), and max_linkhdr has type int.  So the type combinations are
B nonsense, and there is a good chance of getting different compiler warnings
B about this before and after the change.  Having just one unsigned type in
B the mix tends to promote everything to unsigned, except on 64-bit systems
B with one u_int but no size_t, the long has highest rank so everything
B gets promoted to long.

I think here we can do:

-   unsigned ipoptlen, optlen, hdrlen;
+   int ipoptlen, optlen, hdrlen;

These three take their values from:
- ip6_optlen()
- m_len (from mbuf header)
- tcp_addoptions()
... , which all are ints.
- sizeof(), which can be casted.

I left the ipsec_optlen unsigned. Its type originates from
ipsec_hdrsiz_internal(), which returns result of sizeof().

Patch attached.

This leads to (len = MHLEN - hdrlen - max_linkhdr) comparing
long and (int - int - int). This also fixes many other places in
tcp_output, where values od ipoptlen, optlen, hdrlen are assigned
to int variables or supplied as int arguments. 

B % ...
B % @@ -393,23 +396,10 @@
B %  extern uma_zone_t zone_jumbo16;
B %  extern uma_zone_t zone_ext_refcnt;
B % 
B % -static __inline struct mbuf   *m_getcl(int how, short type, int 
flags);
B % ...
B % -static __inline void  *m_cljget(struct mbuf *m, int how, int 
size);
B % -static __inline void   m_chtype(struct mbuf *m, short 
new_type);
B % -void   mb_free_ext(struct mbuf *);
B % -static __inline struct mbuf   *m_last(struct mbuf *m);
B % -intm_pkthdr_init(struct mbuf *m, int how);
B % +struct mbuf   *m_get2(int how, short type, int flags, int size);
B % +struct mbuf   *m_getjcl(int how, short type, int flags, int size);
B % +void   mb_free_ext(struct mbuf *);
B 
B This one is still missing a parameter name, unlike all (?) the others.
B 
B % +intm_pkthdr_init(struct mbuf *m, int how);
B 
B The 2 new non-inline prototypes should be moved to the general section
B for non-inline prototypes.  The 2 old ones must remain early since
B they are used in the inlines.
B 
B After moving the 2 new ones, also remove their parameter names to match
B the (worse) nearby style.  This leaves only 1 nearby other for mb_free_ext()
B to be mismatched with.
B 
B The general prototype section has a fairly uniform style, with the only
B obvious bugs being:
B - 

svn commit: r245457 - head/sys/kern

2013-01-15 Thread Andrey Zonov
Author: zont
Date: Tue Jan 15 14:05:59 2013
New Revision: 245457
URL: http://svnweb.freebsd.org/changeset/base/245457

Log:
  - Detect when we are in KVM.
  
  Silence on:   emulation
  Approved by:  kib (mentor)
  MFC after:1 week

Modified:
  head/sys/kern/subr_param.c

Modified: head/sys/kern/subr_param.c
==
--- head/sys/kern/subr_param.c  Tue Jan 15 10:06:35 2013(r245456)
+++ head/sys/kern/subr_param.c  Tue Jan 15 14:05:59 2013(r245457)
@@ -161,6 +161,7 @@ static const char *const vm_bnames[] = {
Bochs,/* Bochs */
Xen,  /* Xen */
BHYVE,/* bhyve */
+   Seabios,  /* KVM */
NULL
 };
 
@@ -169,6 +170,7 @@ static const char *const vm_pnames[] = {
Virtual Machine,  /* Microsoft VirtualPC */
VirtualBox,   /* Sun xVM VirtualBox */
Parallels Virtual Platform,   /* Parallels VM */
+   KVM,  /* KVM */
NULL
 };
 
___
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: r245458 - head/lib/libc/sys

2013-01-15 Thread Andrey Zonov
Author: zont
Date: Tue Jan 15 14:09:08 2013
New Revision: 245458
URL: http://svnweb.freebsd.org/changeset/base/245458

Log:
  - Use standard RETURN VALUES section.
  
  Approved by:  kib (mentor)
  MFC after:1 week

Modified:
  head/lib/libc/sys/chroot.2

Modified: head/lib/libc/sys/chroot.2
==
--- head/lib/libc/sys/chroot.2  Tue Jan 15 14:05:59 2013(r245457)
+++ head/lib/libc/sys/chroot.2  Tue Jan 15 14:09:08 2013(r245458)
@@ -92,12 +92,8 @@ system call.
 Any other value for
 .Ql kern.chroot_allow_open_directories
 will bypass the check for open directories
-.Pp
-Upon successful completion, a value of 0 is returned.
-Otherwise,
-a value of -1 is returned and
-.Va errno
-is set to indicate an error.
+.Sh RETURN VALUES
+.Rv -std
 .Sh ERRORS
 The
 .Fn chroot
___
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: r245463 - head/share/misc

2013-01-15 Thread Rene Ladan
Author: rene (doc,ports committer)
Date: Tue Jan 15 17:17:54 2013
New Revision: 245463
URL: http://svnweb.freebsd.org/changeset/base/245463

Log:
  Add gjb as my co-mentor now that I have a full doc/www bit.
  
  Approved by:  remko (mentor)

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

Modified: head/share/misc/committers-doc.dot
==
--- head/share/misc/committers-doc.dot  Tue Jan 15 16:46:51 2013
(r245462)
+++ head/share/misc/committers-doc.dot  Tue Jan 15 17:17:54 2013
(r245463)
@@ -116,6 +116,7 @@ gabor - issyl0
 gabor - ebrandi
 
 gjb - wblock
+gjb - rene
 
 hrs - ryusuke
 
___
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: r245464 - head/sys/net80211

2013-01-15 Thread Adrian Chadd
Author: adrian
Date: Tue Jan 15 17:50:07 2013
New Revision: 245464
URL: http://svnweb.freebsd.org/changeset/base/245464

Log:
  Remove the use of the ifnet send queue and if_start() in the power
  save queue code.
  
  Instead, use if_transmit() directly - and handle the cases where frame
  transmission fails.
  
  I don't necessarily like this and I think at this point the M_ENCAP check,
  node freeing upon fail and the actual if_transmit() call should be done
  in methods in ieee80211_freebsd.c, but I digress slightly..
  
  This removes one of the last few uses of if_start() and the ifnet
  if_snd queue.  The last major offender is ieee80211_output.c, where
  ieee80211_start() implements if_start() and uses the ifnet queue
  directly.
  
  (There's a couple of gotchas here, where the if_start pointer is
  compared to ieee80211_start(), but that's a later problem.)

Modified:
  head/sys/net80211/ieee80211_power.c

Modified: head/sys/net80211/ieee80211_power.c
==
--- head/sys/net80211/ieee80211_power.c Tue Jan 15 17:17:54 2013
(r245463)
+++ head/sys/net80211/ieee80211_power.c Tue Jan 15 17:50:07 2013
(r245464)
@@ -416,6 +416,8 @@ pwrsave_flushq(struct ieee80211_node *ni
struct ieee80211vap *vap = ni-ni_vap;
struct ieee80211_psq_head *qhead;
struct ifnet *parent, *ifp;
+   struct mbuf *parent_q = NULL, *ifp_q = NULL;
+   struct mbuf *m;
 
IEEE80211_NOTE(vap, IEEE80211_MSG_POWER, ni,
flush ps queue, %u packets queued, psq-psq_len);
@@ -427,8 +429,7 @@ pwrsave_flushq(struct ieee80211_node *ni
parent = vap-iv_ic-ic_ifp;
/* XXX need different driver interface */
/* XXX bypasses q max and OACTIVE */
-   IF_PREPEND_LIST(parent-if_snd, qhead-head, qhead-tail,
-   qhead-len);
+   parent_q = qhead-head;
qhead-head = qhead-tail = NULL;
qhead-len = 0;
} else
@@ -439,8 +440,7 @@ pwrsave_flushq(struct ieee80211_node *ni
ifp = vap-iv_ifp;
/* XXX need different driver interface */
/* XXX bypasses q max and OACTIVE */
-   IF_PREPEND_LIST(ifp-if_snd, qhead-head, qhead-tail,
-   qhead-len);
+   ifp_q = qhead-head;
qhead-head = qhead-tail = NULL;
qhead-len = 0;
} else
@@ -450,10 +450,34 @@ pwrsave_flushq(struct ieee80211_node *ni
 
/* NB: do this outside the psq lock */
/* XXX packets might get reordered if parent is OACTIVE */
-   if (parent != NULL)
-   if_start(parent);
-   if (ifp != NULL)
-   if_start(ifp);
+   /* parent frames, should be encapsulated */
+   if (parent != NULL) {
+   while (parent_q != NULL) {
+   m = parent_q;
+   parent_q = m-m_nextpkt;
+   /* must be encapsulated */
+   KASSERT((m-m_flags  M_ENCAP),
+   (%s: parentq with non-M_ENCAP frame!\n,
+   __func__));
+   /*
+* For encaped frames, we need to free the node
+* reference upon failure.
+*/
+   if (parent-if_transmit(parent, m) != 0)
+   ieee80211_free_node(ni);
+   }
+   }
+
+   /* VAP frames, aren't encapsulated */
+   if (ifp != NULL) {
+   while (ifp_q != NULL) {
+   m = ifp_q;
+   ifp_q = m-m_nextpkt;
+   KASSERT((!(m-m_flags  M_ENCAP)),
+   (%s: vapq with M_ENCAP frame!\n, __func__));
+   (void) ifp-if_transmit(ifp, m);
+   }
+   }
 }
 
 /*
___
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: r245269 - head/share/mk

2013-01-15 Thread Steve Kargl
On Tue, Jan 15, 2013 at 06:08:36PM +0100, Dag-Erling Smørgrav wrote:
 Steve Kargl s...@troutmask.apl.washington.edu writes:
  I suggest adding a blurb to src/UPDATING to help others with memory
  loss issues.
 
 Thanks, can you commit that patch?
 

Yes.

But, I found that your commit only indirectly caused the
problem.  The system that showed the problem with NO_KERBEROS
in /etc/make.conf never had kerberos installed, so your change
actually caused my buildworld to try to build kerberos.  It
appears that usr.bin/compile_et is needed to bootstrap kerberos.
compile_et is not installed as a bootstrap-tool, so it must be
picking up a previously installed compile_et.  At the moment,
I'm stumped as how to compile_et.

-- 
Steve
___
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: r245465 - head/sys/dev/ath

2013-01-15 Thread Adrian Chadd
Author: adrian
Date: Tue Jan 15 18:01:23 2013
New Revision: 245465
URL: http://svnweb.freebsd.org/changeset/base/245465

Log:
  Implement frame (data) transmission using if_transmit(), rather than
  if_start().
  
  This removes the overlapping data path TX from occuring, which
  solves quite a number of the potential TX queue races in ath(4).
  It doesn't fix the net80211 layer TX queue races and it doesn't
  fix the raw TX path yet, but it's an important step towards this.
  
  This hasn't dropped the TX performance in my testing; primarily
  because now the TX path can quickly queue frames and continue
  along processing.
  
  This involves a few rather deep changes:
  
  * Use the ath_buf as a queue placeholder for now, as we need to be
able to support queuing a list of mbufs (ie, when transmitting
fragments) and m_nextpkt can't be used here (because it's what is
joining the fragments together)
  
  * if_transmit() now simply allocates the ath_buf and queues it to
a driver TX staging queue.
  
  * TX is now moved into a taskqueue function.
  
  * The TX taskqueue function now dequeues and transmits frames.
  
  * Fragments are handled correctly here - as the current API passes
the fragment list as one mbuf list (joined with m_nextpkt) through
to the driver if_transmit().
  
  * For the couple of places where ath_start() may be called (mostly
from net80211 when starting the VAP up again), just reimplement
it using the new enqueue and taskqueue methods.
  
  What I don't like (about this work and the TX code in general):
  
  * I'm using the same lock for the staging TX queue management and the
actual TX.  This isn't required; I'm just being slack.
  
  * I haven't yet moved TX to a separate taskqueue (but the taskqueue is
created); it's easy enough to do this later if necessary.  I just need
to make sure it's a higher priority queue, so TX has the same
behaviour as it used to (where it would preempt existing RX..)
  
  * I need to re-review the TX path a little more and make sure that
ieee80211_node_*() functions aren't called within the TX lock.
When queueing, I should just push failed frames into a queue and
when I'm wrapping up the TX code, unlock the TX lock and
call ieee80211_node_free() on each.
  
  * It would be nice if I could hold the TX lock for the entire
TX and TX completion, rather than this release/re-acquire behaviour.
But that requires that I shuffle around the TX completion code
to handle actual ath_buf free and net80211 callback/free outside
of the TX lock.  That's one of my next projects.
  
  * the ic_raw_xmit() path doesn't use this yet - so it still has
sequencing problems with parallel, overlapping calls to the
data path.  I'll fix this later.
  
  Tested:
  
  * Hostap - AR9280, AR9220
  * STA - AR5212, AR9280, AR5416

Modified:
  head/sys/dev/ath/if_ath.c
  head/sys/dev/ath/if_ath_misc.h
  head/sys/dev/ath/if_ath_sysctl.c
  head/sys/dev/ath/if_ath_tx.c
  head/sys/dev/ath/if_athvar.h

Modified: head/sys/dev/ath/if_ath.c
==
--- head/sys/dev/ath/if_ath.c   Tue Jan 15 17:50:07 2013(r245464)
+++ head/sys/dev/ath/if_ath.c   Tue Jan 15 18:01:23 2013(r245465)
@@ -152,7 +152,6 @@ static void ath_init(void *);
 static voidath_stop_locked(struct ifnet *);
 static voidath_stop(struct ifnet *);
 static int ath_reset_vap(struct ieee80211vap *, u_long);
-static voidath_start_queue(struct ifnet *ifp);
 static int ath_media_change(struct ifnet *);
 static voidath_watchdog(void *);
 static int ath_ioctl(struct ifnet *, u_long, caddr_t);
@@ -213,6 +212,14 @@ static voidath_dfs_tasklet(void *, int)
 static voidath_node_powersave(struct ieee80211_node *, int);
 static int ath_node_set_tim(struct ieee80211_node *, int);
 
+static int ath_transmit(struct ifnet *ifp, struct mbuf *m);
+static voidath_qflush(struct ifnet *ifp);
+
+static voidath_txq_qinit(struct ifnet *ifp);
+static voidath_txq_qflush(struct ifnet *ifp);
+static int ath_txq_qadd(struct ifnet *ifp, struct mbuf *m0);
+static voidath_txq_qrun(struct ifnet *ifp);
+
 #ifdef IEEE80211_SUPPORT_TDMA
 #include dev/ath/if_ath_tdma.h
 #endif
@@ -429,12 +436,20 @@ ath_attach(u_int16_t devid, struct ath_s
taskqueue_start_threads(sc-sc_tq, 1, PI_NET,
%s taskq, ifp-if_xname);
 
+   sc-sc_tx_tq = taskqueue_create(ath_tx_taskq, M_NOWAIT,
+   taskqueue_thread_enqueue, sc-sc_tx_tq);
+   taskqueue_start_threads(sc-sc_tx_tq, 1, PI_NET,
+   %s TX taskq, ifp-if_xname);
+
TASK_INIT(sc-sc_rxtask, 0, sc-sc_rx.recv_tasklet, sc);
TASK_INIT(sc-sc_bmisstask, 0, ath_bmiss_proc, sc);
TASK_INIT(sc-sc_bstucktask,0, ath_bstuck_proc, sc);
TASK_INIT(sc-sc_resettask,0, ath_reset_proc, sc);
-   TASK_INIT(sc-sc_txqtask,0, 

svn commit: r245466 - head/sys/conf

2013-01-15 Thread Adrian Chadd
Author: adrian
Date: Tue Jan 15 18:04:15 2013
New Revision: 245466
URL: http://svnweb.freebsd.org/changeset/base/245466

Log:
  Add some new debugging options for the ath(4) and ath_hal(4) drivers.

Modified:
  head/sys/conf/options

Modified: head/sys/conf/options
==
--- head/sys/conf/options   Tue Jan 15 18:01:23 2013(r245465)
+++ head/sys/conf/options   Tue Jan 15 18:04:15 2013(r245466)
@@ -775,6 +775,8 @@ ATH_ENABLE_11N  opt_ath.h
 ATH_ENABLE_DFS opt_ath.h
 ATH_EEPROM_FIRMWAREopt_ath.h
 ATH_ENABLE_RADIOTAP_VENDOR_EXT opt_ath.h
+ATH_DEBUG_ALQ  opt_ath.h
+ATH_KTR_INTR_DEBUG opt_ath.h
 
 # options for the Atheros hal
 AH_SUPPORT_AR5416  opt_ah.h
@@ -794,7 +796,7 @@ AH_NEED_DESC_SWAP   opt_ah.h
 AH_USE_INIPDGAIN   opt_ah.h
 AH_MAXCHAN opt_ah.h
 AH_RXCFG_SDMAMW_4BYTES opt_ah.h
-
+AH_INTERRUPT_DEBUGGING opt_ah.h
 # AR5416 and later interrupt mitigation
 # XXX do not use this for AR9130
 AH_AR5416_INTERRUPT_MITIGATION opt_ah.h
___
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: r245269 - head/share/mk

2013-01-15 Thread Steve Kargl
On Tue, Jan 15, 2013 at 09:59:41AM -0800, Steve Kargl wrote:
 On Tue, Jan 15, 2013 at 06:08:36PM +0100, Dag-Erling Smørgrav wrote:
  Steve Kargl s...@troutmask.apl.washington.edu writes:
   I suggest adding a blurb to src/UPDATING to help others with memory
   loss issues.
  
  Thanks, can you commit that patch?
  
 
 Yes.
 
 But, I found that your commit only indirectly caused the
 problem.  The system that showed the problem with NO_KERBEROS
 in /etc/make.conf never had kerberos installed, so your change
 actually caused my buildworld to try to build kerberos.  It
 appears that usr.bin/compile_et is needed to bootstrap kerberos.
 compile_et is not installed as a bootstrap-tool, so it must be
 picking up a previously installed compile_et.  At the moment,
 I'm stumped as how to compile_et.

On a system with kerberos installed and after a buildworld, 
I find

% cd /usr/src
% make buildenv
Entering world for amd64:amd64
# which compile_et
/usr/bin/compile_et
# exit

-- 
Steve
___
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: r245467 - head/sys/dev/cxgbe/tom

2013-01-15 Thread Navdeep Parhar
Author: np
Date: Tue Jan 15 18:38:51 2013
New Revision: 245467
URL: http://svnweb.freebsd.org/changeset/base/245467

Log:
  cxgbe/tom: Add support for fully offloaded TCP/IPv6 connections (active open).
  
  MFC after:1 week

Modified:
  head/sys/dev/cxgbe/tom/t4_connect.c

Modified: head/sys/dev/cxgbe/tom/t4_connect.c
==
--- head/sys/dev/cxgbe/tom/t4_connect.c Tue Jan 15 18:04:15 2013
(r245466)
+++ head/sys/dev/cxgbe/tom/t4_connect.c Tue Jan 15 18:38:51 2013
(r245467)
@@ -29,6 +29,7 @@
 __FBSDID($FreeBSD$);
 
 #include opt_inet.h
+#include opt_inet6.h
 
 #ifdef TCP_OFFLOAD
 #include sys/param.h
@@ -220,10 +221,9 @@ do_act_open_rpl(struct sge_iq *iq, const
  * Options2 for active open.
  */
 static uint32_t
-calc_opt2a(struct socket *so)
+calc_opt2a(struct socket *so, struct toepcb *toep)
 {
struct tcpcb *tp = so_sototcpcb(so);
-   struct toepcb *toep = tp-t_toe;
struct port_info *pi = toep-port;
struct adapter *sc = pi-adapter;
uint32_t opt2 = 0;
@@ -260,6 +260,12 @@ t4_init_connect_cpl_handlers(struct adap
t4_register_cpl_handler(sc, CPL_ACT_OPEN_RPL, do_act_open_rpl);
 }
 
+#define DONT_OFFLOAD_ACTIVE_OPEN(x)do { \
+   reason = __LINE__; \
+   rc = (x); \
+   goto failed; \
+} while (0)
+
 /*
  * active open (soconnect).
  *
@@ -275,20 +281,19 @@ t4_connect(struct toedev *tod, struct so
 struct sockaddr *nam)
 {
struct adapter *sc = tod-tod_softc;
+   struct tom_data *td = tod_td(tod);
struct toepcb *toep = NULL;
struct wrqe *wr = NULL;
-   struct cpl_act_open_req *cpl;
-   struct l2t_entry *e = NULL;
struct ifnet *rt_ifp = rt-rt_ifp;
struct port_info *pi;
-   int atid = -1, mtu_idx, rscale, qid_atid, rc = ENOMEM;
+   int mtu_idx, rscale, qid_atid, rc, isipv6;
struct inpcb *inp = sotoinpcb(so);
struct tcpcb *tp = intotcpcb(inp);
+   int reason;
 
INP_WLOCK_ASSERT(inp);
-
-   if (nam-sa_family != AF_INET)
-   CXGBE_UNIMPLEMENTED(IPv6 connect);
+   KASSERT(nam-sa_family == AF_INET || nam-sa_family == AF_INET6,
+   (%s: dest addr %p has family %u, __func__, nam, nam-sa_family));
 
if (rt_ifp-if_type == IFT_ETHER)
pi = rt_ifp-if_softc;
@@ -297,30 +302,29 @@ t4_connect(struct toedev *tod, struct so
 
pi = ifp-if_softc;
} else if (rt_ifp-if_type == IFT_IEEE8023ADLAG)
-   return (ENOSYS);/* XXX: implement lagg support */
+   DONT_OFFLOAD_ACTIVE_OPEN(ENOSYS); /* XXX: implement lagg+TOE */
else
-   return (ENOTSUP);
+   DONT_OFFLOAD_ACTIVE_OPEN(ENOTSUP);
 
toep = alloc_toepcb(pi, -1, -1, M_NOWAIT);
if (toep == NULL)
-   goto failed;
+   DONT_OFFLOAD_ACTIVE_OPEN(ENOMEM);
 
-   atid = alloc_atid(sc, toep);
-   if (atid  0)
-   goto failed;
+   toep-tid = alloc_atid(sc, toep);
+   if (toep-tid  0)
+   DONT_OFFLOAD_ACTIVE_OPEN(ENOMEM);
 
-   e = t4_l2t_get(pi, rt_ifp,
+   toep-l2te = t4_l2t_get(pi, rt_ifp,
rt-rt_flags  RTF_GATEWAY ? rt-rt_gateway : nam);
-   if (e == NULL)
-   goto failed;
+   if (toep-l2te == NULL)
+   DONT_OFFLOAD_ACTIVE_OPEN(ENOMEM);
 
-   wr = alloc_wrqe(sizeof(*cpl), toep-ctrlq);
+   isipv6 = nam-sa_family == AF_INET6;
+   wr = alloc_wrqe(isipv6 ? sizeof(struct cpl_act_open_req6) :
+   sizeof(struct cpl_act_open_req), toep-ctrlq);
if (wr == NULL)
-   goto failed;
-   cpl = wrtod(wr);
+   DONT_OFFLOAD_ACTIVE_OPEN(ENOMEM);
 
-   toep-tid = atid;
-   toep-l2te = e;
if (sc-tt.ddp  (so-so_options  SO_NO_DDP) == 0)
set_tcpddp_ulp_mode(toep);
else
@@ -330,8 +334,6 @@ t4_connect(struct toedev *tod, struct so
toep-rx_credits = min(select_rcv_wnd(so)  10, M_RCV_BUFSIZ);
SOCKBUF_UNLOCK(so-so_rcv);
 
-   offload_socket(so, toep);
-
/*
 * The kernel sets request_r_scale based on sb_max whereas we need to
 * take hardware's MAX_RCV_WND into account too.  This is normally a
@@ -342,39 +344,78 @@ t4_connect(struct toedev *tod, struct so
else
rscale = 0;
mtu_idx = find_best_mtu_idx(sc, inp-inp_inc, 0);
-   qid_atid = (toep-ofld_rxq-iq.abs_id  14) | atid;
+   qid_atid = (toep-ofld_rxq-iq.abs_id  14) | toep-tid;
 
-   INIT_TP_WR(cpl, 0);
-   OPCODE_TID(cpl) = htobe32(MK_OPCODE_TID(CPL_ACT_OPEN_REQ, qid_atid));
-   inp_4tuple_get(inp, cpl-local_ip, cpl-local_port, cpl-peer_ip,
-   cpl-peer_port);
-   cpl-opt0 = calc_opt0(so, pi, e, mtu_idx, rscale, toep-rx_credits,
-   toep-ulp_mode);
-   cpl-params = select_ntuple(pi, e, sc-filter_mode);
-   cpl-opt2 = calc_opt2a(so);
+   if 

svn commit: r245468 - head/sys/dev/cxgbe/tom

2013-01-15 Thread Navdeep Parhar
Author: np
Date: Tue Jan 15 18:50:40 2013
New Revision: 245468
URL: http://svnweb.freebsd.org/changeset/base/245468

Log:
  cxgbe/tom: Add support for fully offloaded TCP/IPv6 connections (passive 
open).
  
  MFC after:1 week

Modified:
  head/sys/dev/cxgbe/tom/t4_listen.c

Modified: head/sys/dev/cxgbe/tom/t4_listen.c
==
--- head/sys/dev/cxgbe/tom/t4_listen.c  Tue Jan 15 18:38:51 2013
(r245467)
+++ head/sys/dev/cxgbe/tom/t4_listen.c  Tue Jan 15 18:50:40 2013
(r245468)
@@ -29,6 +29,7 @@
 __FBSDID($FreeBSD$);
 
 #include opt_inet.h
+#include opt_inet6.h
 
 #ifdef TCP_OFFLOAD
 #include sys/param.h
@@ -50,6 +51,8 @@ __FBSDID($FreeBSD$);
 #include netinet/in.h
 #include netinet/in_pcb.h
 #include netinet/ip.h
+#include netinet/ip6.h
+#include netinet6/scope6_var.h
 #include netinet/tcp_timer.h
 #include netinet/tcp_var.h
 #define TCPSTATES
@@ -194,7 +197,7 @@ alloc_lctx(struct adapter *sc, struct in
if (lctx == NULL)
return (NULL);
 
-   lctx-stid = alloc_stid(sc, lctx, inp-inp_inc.inc_flags  INC_ISIPV6);
+   lctx-stid = alloc_stid(sc, lctx, inp-inp_vflag  INP_IPV6);
if (lctx-stid  0) {
free(lctx, M_CXGBE);
return (NULL);
@@ -399,7 +402,7 @@ create_server(struct adapter *sc, struct
 {
struct wrqe *wr;
struct cpl_pass_open_req *req;
-   struct in_conninfo *inc = lctx-inp-inp_inc;
+   struct inpcb *inp = lctx-inp;
 
wr = alloc_wrqe(sizeof(*req), lctx-ctrlq);
if (wr == NULL) {
@@ -410,9 +413,9 @@ create_server(struct adapter *sc, struct
 
INIT_TP_WR(req, 0);
OPCODE_TID(req) = htobe32(MK_OPCODE_TID(CPL_PASS_OPEN_REQ, lctx-stid));
-   req-local_port = inc-inc_lport;
+   req-local_port = inp-inp_lport;
req-peer_port = 0;
-   req-local_ip = inc-inc_laddr.s_addr;
+   req-local_ip = inp-inp_laddr.s_addr;
req-peer_ip = 0;
req-opt0 = htobe64(V_TX_CHAN(lctx-ctrlq-eq.tx_chan));
req-opt1 = htobe64(V_CONN_POLICY(CPL_CONN_POLICY_ASK) |
@@ -423,6 +426,36 @@ create_server(struct adapter *sc, struct
 }
 
 static int
+create_server6(struct adapter *sc, struct listen_ctx *lctx)
+{
+   struct wrqe *wr;
+   struct cpl_pass_open_req6 *req;
+   struct inpcb *inp = lctx-inp;
+
+   wr = alloc_wrqe(sizeof(*req), lctx-ctrlq);
+   if (wr == NULL) {
+   log(LOG_ERR, %s: allocation failure, __func__);
+   return (ENOMEM);
+   }
+   req = wrtod(wr);
+
+   INIT_TP_WR(req, 0);
+   OPCODE_TID(req) = htobe32(MK_OPCODE_TID(CPL_PASS_OPEN_REQ6, 
lctx-stid));
+   req-local_port = inp-inp_lport;
+   req-peer_port = 0;
+   req-local_ip_hi = *(uint64_t *)inp-in6p_laddr.s6_addr[0];
+   req-local_ip_lo = *(uint64_t *)inp-in6p_laddr.s6_addr[8];
+   req-peer_ip_hi = 0;
+   req-peer_ip_lo = 0;
+   req-opt0 = htobe64(V_TX_CHAN(lctx-ctrlq-eq.tx_chan));
+   req-opt1 = htobe64(V_CONN_POLICY(CPL_CONN_POLICY_ASK) |
+   F_SYN_RSS_ENABLE | V_SYN_RSS_QUEUE(lctx-ofld_rxq-iq.abs_id));
+
+   t4_wrq_tx(sc, wr);
+   return (0);
+}
+
+static int
 destroy_server(struct adapter *sc, struct listen_ctx *lctx)
 {
struct wrqe *wr;
@@ -458,13 +491,10 @@ t4_listen_start(struct toedev *tod, stru
struct port_info *pi;
struct inpcb *inp = tp-t_inpcb;
struct listen_ctx *lctx;
-   int i;
+   int i, rc;
 
INP_WLOCK_ASSERT(inp);
 
-   if ((inp-inp_vflag  INP_IPV4) == 0)
-   return (0);
-
 #if 0
ADAPTER_LOCK(sc);
if (IS_BUSY(sc)) {
@@ -481,8 +511,9 @@ t4_listen_start(struct toedev *tod, stru
goto done;  /* no port that's UP with IFCAP_TOE enabled */
 
/*
-* Find a running port with IFCAP_TOE4.  We'll use the first such port's
-* queues to send the passive open and receive the reply to it.
+* Find a running port with IFCAP_TOE (4 or 6).  We'll use the first
+* such port's queues to send the passive open and receive the reply to
+* it.
 *
 * XXX: need a way to mark a port in use by offload.  if_cxgbe should
 * then reject any attempt to bring down such a port (and maybe reject
@@ -490,7 +521,7 @@ t4_listen_start(struct toedev *tod, stru
 */
for_each_port(sc, i) {
if (isset(sc-open_device_map, i) 
-   sc-port[i]-ifp-if_capenable  IFCAP_TOE4)
+   sc-port[i]-ifp-if_capenable  IFCAP_TOE)
break;
}
KASSERT(i  sc-params.nports,
@@ -509,12 +540,17 @@ t4_listen_start(struct toedev *tod, stru
}
listen_hash_add(sc, lctx);
 
-   CTR5(KTR_CXGBE, %s: stid %u (%s), lctx %p, inp %p, __func__,
-   lctx-stid, tcpstates[tp-t_state], lctx, inp);
+   CTR6(KTR_CXGBE, %s: stid %u (%s), lctx %p, inp %p vflag 0x%x,
+   

Re: svn commit: r245450 - in head/sys: arm/allwinner arm/conf boot/fdt/dts

2013-01-15 Thread John-Mark Gurney
Ganbold Tsagaankhuu wrote this message on Tue, Jan 15, 2013 at 08:26 +:
 + * Copyright (c) 2012 Ganbold Tsagaankhuu. ganb...@gmail.com

Also, (c) doesn't add anything.  It needs to be either Copyright (which
you have) or a c in a circle, the parens around a c have not been given
legal force...

-- 
  John-Mark Gurney  Voice: +1 415 225 5579

 All that I will do, has been done, All that I have, has not.
___
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: r245469 - head/sys/kern

2013-01-15 Thread Alfred Perlstein
Author: alfred
Date: Tue Jan 15 19:26:17 2013
New Revision: 245469
URL: http://svnweb.freebsd.org/changeset/base/245469

Log:
  Do not autotune ncallout to be greater than 18508.
  
  When maxusers was unrestricted and maxfiles was allowed to autotune
  much higher the result was that ncallout which was based on maxfiles
  and maxproc grew much higher than was needed.
  
  To fix this clip autotuning to the same number we would get with
  the old maxusers algorithm which would stop scaling at 384
  maxusers.
  
  Growing ncalout higher is not likely to be needed since most consumers
  of timeout(9) are gone and any higher value for ncallout causes the
  callwheel hashes to be much larger than will even be needed for
  most applications.
  
  MFC after:  1 month
  
  Reviewed by:  mav

Modified:
  head/sys/kern/subr_param.c

Modified: head/sys/kern/subr_param.c
==
--- head/sys/kern/subr_param.c  Tue Jan 15 18:50:40 2013(r245468)
+++ head/sys/kern/subr_param.c  Tue Jan 15 19:26:17 2013(r245469)
@@ -326,8 +326,11 @@ init_param2(long physpages)
 
/*
 * XXX: Does the callout wheel have to be so big?
+*
+* Clip callout to result of previous function of maxusers maximum
+* 384.  This is still huge, but acceptable.
 */
-   ncallout = 16 + maxproc + maxfiles;
+   ncallout = imin(16 + maxproc + maxfiles, 18508);
TUNABLE_INT_FETCH(kern.ncallout, ncallout);
 
/*
___
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: r245471 - head/sys/dev/puc

2013-01-15 Thread John Baldwin
Author: jhb
Date: Tue Jan 15 20:13:25 2013
New Revision: 245471
URL: http://svnweb.freebsd.org/changeset/base/245471

Log:
  Do not require a filter-only interrupt handler for puc ports that are not
  serial devices (such as printer ports).  This allows ppc devices attached
  to puc to correctly setup an interrupt handler and work.
  
  Tested by:Andre Albsmeier  andre.albsme...@siemens.com
  MFC after:1 week

Modified:
  head/sys/dev/puc/puc.c

Modified: head/sys/dev/puc/puc.c
==
--- head/sys/dev/puc/puc.c  Tue Jan 15 20:10:49 2013(r245470)
+++ head/sys/dev/puc/puc.c  Tue Jan 15 20:13:25 2013(r245471)
@@ -622,7 +622,7 @@ puc_bus_setup_intr(device_t dev, device_
if (cookiep == NULL || res != port-p_ires)
return (EINVAL);
/* We demand that serdev devices use filter_only interrupts. */
-   if (ihand != NULL)
+   if (port-p_type == PUC_TYPE_SERIAL  ihand != NULL)
return (ENXIO);
if (rman_get_device(port-p_ires) != originator)
return (ENXIO);
___
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: r245450 - in head/sys: arm/allwinner arm/conf boot/fdt/dts

2013-01-15 Thread Eitan Adler
On 15 January 2013 14:00, John-Mark Gurney j...@funkthat.com wrote:
 Ganbold Tsagaankhuu wrote this message on Tue, Jan 15, 2013 at 08:26 +:
 + * Copyright (c) 2012 Ganbold Tsagaankhuu. ganb...@gmail.com

 Also, (c) doesn't add anything.  It needs to be either Copyright (which
 you have) or a c in a circle, the parens around a c have not been given
 legal force...

I am not a lawyer however I do not believe your statement has been
true since the Berne Convention.  Nothing is required to assert
copyright.  A c in a circle, p in a circle, (c), and copyright are
*all* optional.

That said (c) is widely recognized is a copyright symbol (imho) and
may serve to increase damages from willful infringement.  That said,
this being BSD licensed code the damages are likely to be minimal
anyways.

-- 
Eitan Adler
Source, Ports, Doc committer
Bugmeister, Ports Security teams
___
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: r245475 - head/sys/arm/include

2013-01-15 Thread Olivier Houchard
Author: cognet
Date: Tue Jan 15 22:08:03 2013
New Revision: 245475
URL: http://svnweb.freebsd.org/changeset/base/245475

Log:
  Don't define rel/acq variants of some atomic operations as the regular
  version for armv6.

Modified:
  head/sys/arm/include/atomic.h

Modified: head/sys/arm/include/atomic.h
==
--- head/sys/arm/include/atomic.h   Tue Jan 15 21:25:01 2013
(r245474)
+++ head/sys/arm/include/atomic.h   Tue Jan 15 22:08:03 2013
(r245475)
@@ -677,6 +677,17 @@ atomic_readandclear_32(volatile u_int32_
 #define atomic_store_rel_long  atomic_store_long
 #define atomic_load_acq_32 atomic_load_32
 #define atomic_load_acq_long   atomic_load_long
+#define atomic_add_acq_longatomic_add_long
+#define atomic_add_rel_longatomic_add_long
+#define atomic_subtract_acq_long   atomic_subtract_long
+#define atomic_subtract_rel_long   atomic_subtract_long
+#define atomic_clear_acq_long  atomic_clear_long
+#define atomic_clear_rel_long  atomic_clear_long
+#define atomic_set_acq_longatomic_set_long
+#define atomic_set_rel_longatomic_set_long
+#define atomic_cmpset_acq_long atomic_cmpset_long
+#define atomic_cmpset_rel_long atomic_cmpset_long
+#define atomic_load_acq_long   atomic_load_long
 #undef __with_interrupts_disabled
 
 static __inline void
@@ -758,25 +769,13 @@ atomic_store_long(volatile u_long *dst, 
*dst = src;
 }
 
-#define atomic_add_acq_longatomic_add_long
-#define atomic_add_rel_longatomic_add_long
-#define atomic_subtract_acq_long   atomic_subtract_long
-#define atomic_subtract_rel_long   atomic_subtract_long
-#define atomic_clear_acq_long  atomic_clear_long
-#define atomic_clear_rel_long  atomic_clear_long
-#define atomic_set_acq_longatomic_set_long
-#define atomic_set_rel_longatomic_set_long
-#define atomic_cmpset_acq_long atomic_cmpset_long
-#define atomic_cmpset_rel_long atomic_cmpset_long
-#define atomic_load_acq_long   atomic_load_long
-
 #define atomic_clear_ptr   atomic_clear_32
 #define atomic_set_ptr atomic_set_32
 #define atomic_cmpset_ptr  atomic_cmpset_32
 #define atomic_cmpset_rel_ptr  atomic_cmpset_rel_32
 #define atomic_cmpset_acq_ptr  atomic_cmpset_acq_32
 #define atomic_store_ptr   atomic_store_32
-#define atomic_store_rel_ptr   atomic_store_ptr
+#define atomic_store_rel_ptr   atomic_store_rel_32
 
 #define atomic_add_int atomic_add_32
 #define atomic_add_acq_int atomic_add_acq_32
___
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: r245476 - in head/sys: fs/nfs nfsclient

2013-01-15 Thread John Baldwin
Author: jhb
Date: Tue Jan 15 22:08:17 2013
New Revision: 245476
URL: http://svnweb.freebsd.org/changeset/base/245476

Log:
  - More properly handle interrupted NFS requests on an interruptible mount
by returning an error of EINTR rather than EACCES.
  - While here, bring back some (but not all) of the NFS RPC statistics lost
when krpc was committed.
  
  Reviewed by:  rmacklem
  MFC after:1 week

Modified:
  head/sys/fs/nfs/nfs_commonkrpc.c
  head/sys/nfsclient/nfs_krpc.c

Modified: head/sys/fs/nfs/nfs_commonkrpc.c
==
--- head/sys/fs/nfs/nfs_commonkrpc.cTue Jan 15 22:08:03 2013
(r245475)
+++ head/sys/fs/nfs/nfs_commonkrpc.cTue Jan 15 22:08:17 2013
(r245476)
@@ -767,12 +767,18 @@ tryagain:
if (stat == RPC_SUCCESS) {
error = 0;
} else if (stat == RPC_TIMEDOUT) {
+   NFSINCRGLOBAL(newnfsstats.rpctimeouts);
error = ETIMEDOUT;
} else if (stat == RPC_VERSMISMATCH) {
+   NFSINCRGLOBAL(newnfsstats.rpcinvalid);
error = EOPNOTSUPP;
} else if (stat == RPC_PROGVERSMISMATCH) {
+   NFSINCRGLOBAL(newnfsstats.rpcinvalid);
error = EPROTONOSUPPORT;
+   } else if (stat == RPC_INTR) {
+   error = EINTR;
} else {
+   NFSINCRGLOBAL(newnfsstats.rpcinvalid);
error = EACCES;
}
if (error) {

Modified: head/sys/nfsclient/nfs_krpc.c
==
--- head/sys/nfsclient/nfs_krpc.c   Tue Jan 15 22:08:03 2013
(r245475)
+++ head/sys/nfsclient/nfs_krpc.c   Tue Jan 15 22:08:17 2013
(r245476)
@@ -549,14 +549,21 @@ tryagain:
 */
if (stat == RPC_SUCCESS)
error = 0;
-   else if (stat == RPC_TIMEDOUT)
+   else if (stat == RPC_TIMEDOUT) {
+   nfsstats.rpctimeouts++;
error = ETIMEDOUT;
-   else if (stat == RPC_VERSMISMATCH)
+   } else if (stat == RPC_VERSMISMATCH) {
+   nfsstats.rpcinvalid++;
error = EOPNOTSUPP;
-   else if (stat == RPC_PROGVERSMISMATCH)
+   } else if (stat == RPC_PROGVERSMISMATCH) {
+   nfsstats.rpcinvalid++;
error = EPROTONOSUPPORT;
-   else
+   } else if (stat == RPC_INTR) {
+   error = EINTR;
+   } else {
+   nfsstats.rpcinvalid++;
error = EACCES;
+   }
if (error)
goto nfsmout;
 
@@ -572,6 +579,7 @@ tryagain:
if (error == ENOMEM) {
m_freem(mrep);
AUTH_DESTROY(auth);
+   nfsstats.rpcinvalid++;
return (error);
}
 
___
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: r245477 - head/sys/arm/arm

2013-01-15 Thread Olivier Houchard
Author: cognet
Date: Tue Jan 15 22:09:11 2013
New Revision: 245477
URL: http://svnweb.freebsd.org/changeset/base/245477

Log:
  Only spin on the blocked_lock for SCHED_ULE+SMP, as it's done on the other
  arches.

Modified:
  head/sys/arm/arm/swtch.S

Modified: head/sys/arm/arm/swtch.S
==
--- head/sys/arm/arm/swtch.STue Jan 15 22:08:17 2013(r245476)
+++ head/sys/arm/arm/swtch.STue Jan 15 22:09:11 2013(r245477)
@@ -79,6 +79,7 @@
  */
 
 #include assym.s
+#include opt_sched.h
 
 #include machine/asm.h
 #include machine/asmacros.h
@@ -428,6 +429,7 @@ ENTRY(cpu_switch)
 
/* Release the old thread */
str r6, [r4, #TD_LOCK]
+#if defined(SCHED_ULE)  defined(SMP)
ldr r6, .Lblocked_lock
GET_CURTHREAD_PTR(r3)
 
@@ -435,6 +437,7 @@ ENTRY(cpu_switch)
ldr r4, [r3, #TD_LOCK]
cmp r4, r6
beq 1b
+#endif

/* XXXSCW: Safe to re-enable FIQs here */
 
___
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: r245478 - head/sys/arm/arm

2013-01-15 Thread Olivier Houchard
Author: cognet
Date: Tue Jan 15 22:11:28 2013
New Revision: 245478
URL: http://svnweb.freebsd.org/changeset/base/245478

Log:
  Use armv7_drain_writebuf() and armv7_context_switch, instead of the arm11
  variants.

Modified:
  head/sys/arm/arm/cpufunc.c

Modified: head/sys/arm/arm/cpufunc.c
==
--- head/sys/arm/arm/cpufunc.c  Tue Jan 15 22:09:11 2013(r245477)
+++ head/sys/arm/arm/cpufunc.c  Tue Jan 15 22:11:28 2013(r245478)
@@ -1146,7 +1146,7 @@ struct cpu_functions cortexa_cpufuncs = 
/* Other functions */

cpufunc_nullop, /* flush_prefetchbuf*/
-   arm11_drain_writebuf,   /* drain_writebuf   */
+   armv7_drain_writebuf,   /* drain_writebuf   */
cpufunc_nullop, /* flush_brnchtgt_C */
(void *)cpufunc_nullop, /* flush_brnchtgt_E */

@@ -1157,7 +1157,7 @@ struct cpu_functions cortexa_cpufuncs = 
cpufunc_null_fixup, /* dataabt_fixup*/
cpufunc_null_fixup, /* prefetchabt_fixup*/

-   arm11_context_switch,   /* context_switch   */
+   armv7_context_switch,   /* context_switch   */

cortexa_setup /* cpu setup*/
 };
___
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: r245479 - head/cddl/contrib/opensolaris/lib/libzfs/common

2013-01-15 Thread Steven Hartland
Author: smh
Date: Tue Jan 15 23:34:24 2013
New Revision: 245479
URL: http://svnweb.freebsd.org/changeset/base/245479

Log:
  Reports pools which have a removed l2cache disk under -x as this is what
  happens when a cache device is dropped for any reason.
  
  Reviewed by:  pjd
  Approved by:  pjd (mentor)
  MFC after:2 weeks

Modified:
  head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_status.c

Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_status.c
==
--- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_status.c Tue Jan 
15 22:11:28 2013(r245478)
+++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_status.c Tue Jan 
15 23:34:24 2013(r245479)
@@ -150,6 +150,16 @@ find_vdev_problem(nvlist_t *vdev, int (*
return (B_TRUE);
}
 
+   /*
+* Check any L2 cache devs
+*/
+   if (nvlist_lookup_nvlist_array(vdev, ZPOOL_CONFIG_L2CACHE, child,
+   children) == 0) {
+   for (c = 0; c  children; c++)
+   if (find_vdev_problem(child[c], func))
+   return (B_TRUE);
+   }
+
return (B_FALSE);
 }
 
___
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: r245450 - in head/sys: arm/allwinner arm/conf boot/fdt/dts

2013-01-15 Thread Ganbold Tsagaankhuu
On Wed, Jan 16, 2013 at 12:21 AM, Wojciech A. Koszek
wkos...@freebsd.org wrote:
 On Tue, Jan 15, 2013 at 08:26:16AM +, Ganbold Tsagaankhuu wrote:
 Author: ganbold (doc committer)
 Date: Tue Jan 15 08:26:16 2013
 New Revision: 245450
 URL: http://svnweb.freebsd.org/changeset/base/245450

 Log:
   Initial support for Allwinner A10 SoC (Cubieboard)
   Add simple console driver
   Add interrupt handling and timer codes
   Add kernel config file
   Add dts file
   Approved by: gonzo

 Ganbold,

 Thanks for this commit. Comments below.


 Added: head/sys/arm/allwinner/a10_machdep.c
 ==
 --- /dev/null 00:00:00 1970   (empty, because file is newly added)
 +++ head/sys/arm/allwinner/a10_machdep.c  Tue Jan 15 08:26:16 2013   
  (r245450)
 @@ -0,0 +1,122 @@
 +/*-
 + * Copyright (c) 2012 Ganbold Tsagaankhuu. ganb...@gmail.com

 Dot '.' after name isn't necessary.

 I'd really appreciate having PDF filename of the documentation from which
 the code was derived in the comments, e.g.:

 This file is derived from X.PDF, ver1.0, date 2012/Y/Z

 + *
 + * from: FreeBSD: //depot/projects/arm/src/sys/arm/ti/ti_machdep.c
 + */
 +

 [..]

 +int
 +platform_devmap_init(void)
 +{
 + int i = 0;
 +
 + fdt_devmap[i].pd_va =   0xE1C0;
 + fdt_devmap[i].pd_pa =   0x01C0;
 + fdt_devmap[i].pd_size = 0x0040; /* 4 MB */

 Do you think you could comment on what these mean (or pages in the PDF where
 can I find them) next to these variables?


 Added: head/sys/arm/allwinner/console.c
 ==
 --- /dev/null 00:00:00 1970   (empty, because file is newly added)
 +++ head/sys/arm/allwinner/console.c  Tue Jan 15 08:26:16 2013
 (r245450)
 @@ -0,0 +1,146 @@
 [..]
 +#ifndef  A10_UART_BASE
 +#define  A10_UART_BASE   0xe1c28000  /* UART0 */
 +#endif
 +
 +int reg_shift = 2;

 Could you make it static and move it below defines?

 +#define UART_DLL0   /* Out: Divisor Latch Low */
 +#define UART_DLM1   /* Out: Divisor Latch High */
 +#define UART_FCR2   /* Out: FIFO Control Register */
 +#define UART_LCR3   /* Out: Line Control Register */
 +#define UART_MCR4   /* Out: Modem Control Register */
 +#define UART_LSR5   /* In:  Line Status Register */
 +#define UART_LSR_THRE   0x20/* Transmit-hold-register empty */
 +#define UART_LSR_DR 0x01/* Receiver data ready */
 +#define UART_MSR6   /* In:  Modem Status Register */
 +#define UART_SCR7   /* I/O: Scratch Register */
 +
 +
 +/*
 + * uart related funcs
 + */
 +static u_int32_t
 +uart_getreg(u_int32_t *bas)
 +{
 + return *((volatile u_int32_t *)(bas))  0xff;
 +}
 +
 +static void
 +uart_setreg(u_int32_t *bas, u_int32_t val)
 +{
 + *((volatile u_int32_t *)(bas)) = (u_int32_t)val;
 +}
 +
 +static int
 +ub_getc(void)
 +{
 + while ((uart_getreg((u_int32_t *)(A10_UART_BASE +
 + (UART_LSR  reg_shift)))  UART_LSR_DR) == 0);
 + __asm __volatile(nop);
 +
 + return (uart_getreg((u_int32_t *)A10_UART_BASE)  0xff);
 +}
 +
 +static void
 +ub_putc(unsigned char c)
 +{
 + if (c == '\n')
 + ub_putc('\r');
 +
 + while ((uart_getreg((u_int32_t *)(A10_UART_BASE +
 + (UART_LSR  reg_shift)))  UART_LSR_THRE) == 0)
 + __asm __volatile(nop);
 +
 + uart_setreg((u_int32_t *)A10_UART_BASE, c);
 +}

 Why aren't bus_* methods used here for accessing memory?

This is just initial support of the SoC so eventually I hope it will
be improved.

sorry for the noise and thanks for the comments,

Ganbold


 +#
 +#
 +options  PHYSADDR=0x4000
 +
 +makeoptions  KERNPHYSADDR=0x4020

 Two tabs?

 +options  KERNPHYSADDR=0x4020
 +makeoptions  KERNVIRTADDR=0xc020
 +options  KERNVIRTADDR=0xc020
 +
 +options  STARTUP_PAGETABLE_ADDR=0x4800
 +
 +files../allwinner/files.a10



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

 --
 Wojciech A. Koszek
 wkos...@freebsd.czest.pl
 http://FreeBSD.czest.pl/~wkoszek/
___
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: r245485 - head/sys/pci

2013-01-15 Thread Pyun YongHyeon
Author: yongari
Date: Wed Jan 16 01:30:46 2013
New Revision: 245485
URL: http://svnweb.freebsd.org/changeset/base/245485

Log:
  Add D-Link DFE-520TX rev C1.
  
  Tested by:Ruslan Makhmatkhanov  cvs-src  yandex dot ru 
  MFC After:1 week

Modified:
  head/sys/pci/if_rl.c
  head/sys/pci/if_rlreg.h

Modified: head/sys/pci/if_rl.c
==
--- head/sys/pci/if_rl.cWed Jan 16 00:54:51 2013(r245484)
+++ head/sys/pci/if_rl.cWed Jan 16 01:30:46 2013(r245485)
@@ -148,6 +148,8 @@ static const struct rl_type rl_devs[] = 
Delta Electronics 8139 10/100BaseTX },
{ ADDTRON_VENDORID, ADDTRON_DEVICEID_8139, RL_8139,
Addtron Technology 8139 10/100BaseTX },
+   { DLINK_VENDORID, DLINK_DEVICEID_520TX_REVC1, RL_8139,
+   D-Link DFE-520TX (rev. C1) 10/100BaseTX },
{ DLINK_VENDORID, DLINK_DEVICEID_530TXPLUS, RL_8139,
D-Link DFE-530TX+ 10/100BaseTX },
{ DLINK_VENDORID, DLINK_DEVICEID_690TXD, RL_8139,

Modified: head/sys/pci/if_rlreg.h
==
--- head/sys/pci/if_rlreg.h Wed Jan 16 00:54:51 2013(r245484)
+++ head/sys/pci/if_rlreg.h Wed Jan 16 01:30:46 2013(r245485)
@@ -1048,6 +1048,11 @@ struct rl_softc {
 #defineDLINK_DEVICEID_530TXPLUS0x1300
 
 /*
+ * D-Link DFE-520TX rev. C1 device ID
+ */
+#defineDLINK_DEVICEID_520TX_REVC1  0x4200
+
+/*
  * D-Link DFE-5280T device ID
  */
 #defineDLINK_DEVICEID_528T 0x4300
___
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: r245450 - in head/sys: arm/allwinner arm/conf boot/fdt/dts

2013-01-15 Thread Ian Lepore
On Wed, 2013-01-16 at 09:22 +0800, Ganbold Tsagaankhuu wrote:
 On Wed, Jan 16, 2013 at 12:21 AM, Wojciech A. Koszek
 wkos...@freebsd.org wrote:
  On Tue, Jan 15, 2013 at 08:26:16AM +, Ganbold Tsagaankhuu wrote:
  Author: ganbold (doc committer)
  Date: Tue Jan 15 08:26:16 2013
  New Revision: 245450
  URL: http://svnweb.freebsd.org/changeset/base/245450
 
  Log:
Initial support for Allwinner A10 SoC (Cubieboard)
Add simple console driver
Add interrupt handling and timer codes
Add kernel config file
Add dts file
Approved by: gonzo
 
  Ganbold,
 
  Thanks for this commit. Comments below.
 
 
  Added: head/sys/arm/allwinner/a10_machdep.c
  ==
  --- /dev/null 00:00:00 1970   (empty, because file is newly added)
  +++ head/sys/arm/allwinner/a10_machdep.c  Tue Jan 15 08:26:16 2013 
 (r245450)
  @@ -0,0 +1,122 @@
  +/*-
  + * Copyright (c) 2012 Ganbold Tsagaankhuu. ganb...@gmail.com
 
  Dot '.' after name isn't necessary.
 
  I'd really appreciate having PDF filename of the documentation from which
  the code was derived in the comments, e.g.:
 
  This file is derived from X.PDF, ver1.0, date 2012/Y/Z
 
  + *
  + * from: FreeBSD: //depot/projects/arm/src/sys/arm/ti/ti_machdep.c
  + */
  +
 
  [..]
 
  +int
  +platform_devmap_init(void)
  +{
  + int i = 0;
  +
  + fdt_devmap[i].pd_va =   0xE1C0;
  + fdt_devmap[i].pd_pa =   0x01C0;
  + fdt_devmap[i].pd_size = 0x0040; /* 4 MB */
 
  Do you think you could comment on what these mean (or pages in the PDF where
  can I find them) next to these variables?
 
 
  Added: head/sys/arm/allwinner/console.c
  ==
  --- /dev/null 00:00:00 1970   (empty, because file is newly added)
  +++ head/sys/arm/allwinner/console.c  Tue Jan 15 08:26:16 2013
  (r245450)
  @@ -0,0 +1,146 @@
  [..]
  +#ifndef  A10_UART_BASE
  +#define  A10_UART_BASE   0xe1c28000  /* UART0 */
  +#endif
  +
  +int reg_shift = 2;
 
  Could you make it static and move it below defines?
 
  +#define UART_DLL0   /* Out: Divisor Latch Low */
  +#define UART_DLM1   /* Out: Divisor Latch High */
  +#define UART_FCR2   /* Out: FIFO Control Register */
  +#define UART_LCR3   /* Out: Line Control Register */
  +#define UART_MCR4   /* Out: Modem Control Register */
  +#define UART_LSR5   /* In:  Line Status Register */
  +#define UART_LSR_THRE   0x20/* Transmit-hold-register empty */
  +#define UART_LSR_DR 0x01/* Receiver data ready */
  +#define UART_MSR6   /* In:  Modem Status Register */
  +#define UART_SCR7   /* I/O: Scratch Register */
  +
  +
  +/*
  + * uart related funcs
  + */
  +static u_int32_t
  +uart_getreg(u_int32_t *bas)
  +{
  + return *((volatile u_int32_t *)(bas))  0xff;
  +}
  +
  +static void
  +uart_setreg(u_int32_t *bas, u_int32_t val)
  +{
  + *((volatile u_int32_t *)(bas)) = (u_int32_t)val;
  +}
  +
  +static int
  +ub_getc(void)
  +{
  + while ((uart_getreg((u_int32_t *)(A10_UART_BASE +
  + (UART_LSR  reg_shift)))  UART_LSR_DR) == 0);
  + __asm __volatile(nop);
  +
  + return (uart_getreg((u_int32_t *)A10_UART_BASE)  0xff);
  +}
  +
  +static void
  +ub_putc(unsigned char c)
  +{
  + if (c == '\n')
  + ub_putc('\r');
  +
  + while ((uart_getreg((u_int32_t *)(A10_UART_BASE +
  + (UART_LSR  reg_shift)))  UART_LSR_THRE) == 0)
  + __asm __volatile(nop);
  +
  + uart_setreg((u_int32_t *)A10_UART_BASE, c);
  +}
 
  Why aren't bus_* methods used here for accessing memory?
 
 This is just initial support of the SoC so eventually I hope it will
 be improved.
 
 sorry for the noise and thanks for the comments,
 
 Ganbold
 

Actually these are console uart routines, which have to work before the
bus_space system is available, hence the direct hardware access.

-- Ian


 
  +#
  +#
  +options  PHYSADDR=0x4000
  +
  +makeoptions  KERNPHYSADDR=0x4020
 
  Two tabs?
 
  +options  KERNPHYSADDR=0x4020
  +makeoptions  KERNVIRTADDR=0xc020
  +options  KERNVIRTADDR=0xc020
  +
  +options  STARTUP_PAGETABLE_ADDR=0x4800
  +
  +files../allwinner/files.a10
 
 
 
  *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
 
  --
  Wojciech A. Koszek
  wkos...@freebsd.czest.pl
  http://FreeBSD.czest.pl/~wkoszek/


___
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: r245487 - head/share/man/man4

2013-01-15 Thread Pyun YongHyeon
Author: yongari
Date: Wed Jan 16 02:22:56 2013
New Revision: 245487
URL: http://svnweb.freebsd.org/changeset/base/245487

Log:
  Add D-Link DFE-520TX (rev. C1) to HARDWARE section.
  
  MFC After:1 week

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

Modified: head/share/man/man4/rl.4
==
--- head/share/man/man4/rl.4Wed Jan 16 01:49:07 2013(r245486)
+++ head/share/man/man4/rl.4Wed Jan 16 02:22:56 2013(r245487)
@@ -30,7 +30,7 @@
 .\
 .\ $FreeBSD$
 .\
-.Dd August 22, 2010
+.Dd January 16, 2013
 .Dt RL 4
 .Os
 .Sh NAME
@@ -155,6 +155,8 @@ Corega FEther CB-TXD
 .It
 Corega FEtherII CB-TXD
 .It
+D-Link DFE-520TX (rev. C1)
+.It
 D-Link DFE-528TX
 .It
 D-Link DFE-530TX+
___
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: r245491 - head/usr.sbin/cpucontrol

2013-01-15 Thread Eitan Adler
Author: eadler
Date: Wed Jan 16 05:00:51 2013
New Revision: 245491
URL: http://svnweb.freebsd.org/changeset/base/245491

Log:
  Avoid clobbering errno with a call to fprintf
  
  PR:   bin/173923
  Submitted by: Garrett Cooper yaneg...@gmail.com
  Approved by:  cperciva
  MFC After:3 days

Modified:
  head/usr.sbin/cpucontrol/intel.c
  head/usr.sbin/cpucontrol/via.c

Modified: head/usr.sbin/cpucontrol/intel.c
==
--- head/usr.sbin/cpucontrol/intel.cWed Jan 16 04:45:45 2013
(r245490)
+++ head/usr.sbin/cpucontrol/intel.cWed Jan 16 05:00:51 2013
(r245491)
@@ -33,6 +33,7 @@ __FBSDID($FreeBSD$);
 #include unistd.h
 #include fcntl.h
 #include err.h
+#include errno.h
 
 #include sys/types.h
 #include sys/stat.h
@@ -266,7 +267,9 @@ matched:
args.size = data_size;
error = ioctl(devfd, CPUCTL_UPDATE, args);
if (error  0) {
+   error = errno;
fprintf(stderr, failed.\n);
+   errno = error;
WARN(0, ioctl());
goto fail;
}

Modified: head/usr.sbin/cpucontrol/via.c
==
--- head/usr.sbin/cpucontrol/via.c  Wed Jan 16 04:45:45 2013
(r245490)
+++ head/usr.sbin/cpucontrol/via.c  Wed Jan 16 05:00:51 2013
(r245491)
@@ -33,6 +33,7 @@ __FBSDID($FreeBSD$);
 #include unistd.h
 #include fcntl.h
 #include err.h
+#include errno.h
 
 #include sys/types.h
 #include sys/stat.h
@@ -203,7 +204,9 @@ via_update(const char *dev, const char *
args.size = data_size;
error = ioctl(devfd, CPUCTL_UPDATE, args);
if (error  0) {
+   error = errno;
fprintf(stderr, failed.\n);
+   errno = error;
WARN(0, ioctl());
goto fail;
}
___
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: r245492 - head/sbin/setkey

2013-01-15 Thread Eitan Adler
Author: eadler
Date: Wed Jan 16 05:03:46 2013
New Revision: 245492
URL: http://svnweb.freebsd.org/changeset/base/245492

Log:
  Correct prefix for locally installed things
  
  Approved by:  cperciva
  MFC After:3 days

Modified:
  head/sbin/setkey/Makefile

Modified: head/sbin/setkey/Makefile
==
--- head/sbin/setkey/Makefile   Wed Jan 16 05:00:51 2013(r245491)
+++ head/sbin/setkey/Makefile   Wed Jan 16 05:03:46 2013(r245492)
@@ -61,7 +61,7 @@ CLEANFILES+=  scriptdump y.tab.h
 
 #SCRIPTS= scriptdump
 
-LOCALPREFIX=   /usr
+LOCALPREFIX=   /usr/local
 
 scriptdump: scriptdump.pl
sed -e 's#@LOCALPREFIX@#${LOCALPREFIX}#'  $  scriptdump
___
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: r245493 - head/usr.sbin/pw

2013-01-15 Thread Eitan Adler
Author: eadler
Date: Wed Jan 16 05:03:49 2013
New Revision: 245493
URL: http://svnweb.freebsd.org/changeset/base/245493

Log:
  Remove unused variables
  
  Approved by:  cperciva
  MFC After:3 days

Modified:
  head/usr.sbin/pw/pw_log.c

Modified: head/usr.sbin/pw/pw_log.c
==
--- head/usr.sbin/pw/pw_log.c   Wed Jan 16 05:03:46 2013(r245492)
+++ head/usr.sbin/pw/pw_log.c   Wed Jan 16 05:03:49 2013(r245493)
@@ -47,7 +47,6 @@ pw_log(struct userconf * cnf, int mode, 
}
if (logfile != NULL) {
va_list argp;
-   int l;
time_t  now = time(NULL);
struct tm  *t = localtime(now);
charnfmt[256];
@@ -57,7 +56,6 @@ pw_log(struct userconf * cnf, int mode, 
name = unknown;
/* ISO 8601 International Standard Date format */
strftime(nfmt, sizeof nfmt, %Y-%m-%d %T , t);
-   l = strlen(nfmt);
sprintf(nfmt + strlen(nfmt), [%s:%s%s] %s\n, name, 
Which[which], Modes[mode], fmt);
va_start(argp, fmt);
vfprintf(logfile, nfmt, argp);
___
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: r245494 - head/bin/pwait

2013-01-15 Thread Eitan Adler
Author: eadler
Date: Wed Jan 16 05:03:52 2013
New Revision: 245494
URL: http://svnweb.freebsd.org/changeset/base/245494

Log:
  Free memory before exiting in order to silence a warning from the clang
  static analyzer
  
  Approved by:  cperciva
  MFC after:3 days

Modified:
  head/bin/pwait/pwait.c

Modified: head/bin/pwait/pwait.c
==
--- head/bin/pwait/pwait.c  Wed Jan 16 05:03:49 2013(r245493)
+++ head/bin/pwait/pwait.c  Wed Jan 16 05:03:52 2013(r245494)
@@ -141,5 +141,6 @@ main(int argc, char *argv[])
nleft -= n;
}
 
+   free(e);
return 0;
 }
___
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: r245495 - head/sys/fs/nullfs

2013-01-15 Thread Konstantin Belousov
Author: kib
Date: Wed Jan 16 05:32:49 2013
New Revision: 245495
URL: http://svnweb.freebsd.org/changeset/base/245495

Log:
  Remove the filtering of the acceptable mount options for nullfs, added
  in r245004.  Although the report was for noatime option which is
  non-functional for the nullfs, other standard options like nosuid or
  noexec are useful with it.
  
  Reported by:  Dewayne Geraghty dewayne.gerag...@heuristicsystems.com.au
  MFC after:3 days

Modified:
  head/sys/fs/nullfs/null_vfsops.c

Modified: head/sys/fs/nullfs/null_vfsops.c
==
--- head/sys/fs/nullfs/null_vfsops.cWed Jan 16 05:03:52 2013
(r245494)
+++ head/sys/fs/nullfs/null_vfsops.cWed Jan 16 05:32:49 2013
(r245495)
@@ -67,15 +67,6 @@ static vfs_vget_tnullfs_vget;
 static vfs_extattrctl_tnullfs_extattrctl;
 static vfs_reclaim_lowervp_t nullfs_reclaim_lowervp;
 
-/* Mount options that we support. */
-static const char *nullfs_opts[] = {
-   cache,
-   export,
-   from,
-   target,
-   NULL
-};
-
 /*
  * Mount null layer
  */
@@ -97,8 +88,6 @@ nullfs_mount(struct mount *mp)
return (EPERM);
if (mp-mnt_flag  MNT_ROOTFS)
return (EOPNOTSUPP);
-   if (vfs_filteropt(mp-mnt_optnew, nullfs_opts))
-   return (EINVAL);
 
/*
 * Update is a no-op
___
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: r245450 - in head/sys: arm/allwinner arm/conf boot/fdt/dts

2013-01-15 Thread Bruce Evans

On Tue, 15 Jan 2013, Wojciech A. Koszek wrote:


On Tue, Jan 15, 2013 at 08:26:16AM +, Ganbold Tsagaankhuu wrote:

...
Added: head/sys/arm/allwinner/console.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/arm/allwinner/console.cTue Jan 15 08:26:16 2013
(r245450)
@@ -0,0 +1,146 @@

[..]

+#ifndefA10_UART_BASE
+#defineA10_UART_BASE   0xe1c28000  /* UART0 */
+#endif
+
+int reg_shift = 2;


Could you make it static and move it below defines?


+#define UART_DLL0   /* Out: Divisor Latch Low */
+#define UART_DLM1   /* Out: Divisor Latch High */
+#define UART_FCR2   /* Out: FIFO Control Register */
+#define UART_LCR3   /* Out: Line Control Register */
+#define UART_MCR4   /* Out: Modem Control Register */
+#define UART_LSR5   /* In:  Line Status Register */
+#define UART_LSR_THRE   0x20/* Transmit-hold-register empty */
+#define UART_LSR_DR 0x01/* Receiver data ready */
+#define UART_MSR6   /* In:  Modem Status Register */
+#define UART_SCR7   /* I/O: Scratch Register */


These are ordinary 16450 values which are defined in ic/ns16550.h.

This is misformatted with a space instead of a tab after #define.

Since it's a 16450, uart(4) can probably handle the entire console driver,
with fewer bugs (some locking is required in a general console driver).
Of course, it's easier to write a primitive console driver by hacking on
the raw registers than to interface with uart.


+
+
+/*
+ * uart related funcs
+ */


Style bugs (extra and missing blank lines, and comment punctuation).


+static u_int32_t
+uart_getreg(u_int32_t *bas)
+{
+   return *((volatile u_int32_t *)(bas))  0xff;
+}


It's better to put the reg_shift complications at the lowest level.

reg_shift could probably be const or #defined so that all the calculations
with it can be done at runtime.


+
+static void
+uart_setreg(u_int32_t *bas, u_int32_t val)
+{
+   *((volatile u_int32_t *)(bas)) = (u_int32_t)val;
+}


Bogus cast.  val already has type u_int32_t.  u_int32_t should be spelled
uint32_t in new code.


+
+static int
+ub_getc(void)
+{
+   while ((uart_getreg((u_int32_t *)(A10_UART_BASE +
+   (UART_LSR  reg_shift)))  UART_LSR_DR) == 0);
+   __asm __volatile(nop);
+
+   return (uart_getreg((u_int32_t *)A10_UART_BASE)  0xff);
+}
+
+static void
+ub_putc(unsigned char c)
+{
+   if (c == '\n')
+   ub_putc('\r');


The normal console driver does this in upper layers.  Is this driver
only for a very specialized console driver for use at boot time?
I'm not sure if uart(4) works then.


+
+   while ((uart_getreg((u_int32_t *)(A10_UART_BASE +
+   (UART_LSR  reg_shift)))  UART_LSR_THRE) == 0)
+   __asm __volatile(nop);
+
+   uart_setreg((u_int32_t *)A10_UART_BASE, c);
+}


Why aren't bus_* methods used here for accessing memory?


They don't support reg_shift, but should work otherwise.  You do the
shifting somewhere and then use bus-space at the level of uart_getreg()
above.

Bruce
___
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: r245494 - head/bin/pwait

2013-01-15 Thread Xin LI
This doesn't seem right -- you should never release memory before exit,
especially for memory allocated in main(), unless this main is intended
for different purpose like a monolithic shell that wants to avoid exec().
 Note that pwait(1) have multiple exit points I don't think it's practical.

Would you mind if I commit this changeset instead?  I have the return -
exit change in my queue long ago but only noticed it today...

Index: pwait.c
===
--- pwait.c (revision 245497)
+++ pwait.c (working copy)
@@ -141,6 +141,5 @@ main(int argc, char *argv[])
nleft -= n;
}

-   free(e);
-   return 0;
+   exit(EX_OK);
 }

Cheers,


On Tue, Jan 15, 2013 at 9:03 PM, Eitan Adler ead...@freebsd.org wrote:

 Author: eadler
 Date: Wed Jan 16 05:03:52 2013
 New Revision: 245494
 URL: http://svnweb.freebsd.org/changeset/base/245494

 Log:
   Free memory before exiting in order to silence a warning from the clang
   static analyzer

   Approved by:  cperciva
   MFC after:3 days

 Modified:
   head/bin/pwait/pwait.c

 Modified: head/bin/pwait/pwait.c

 ==
 --- head/bin/pwait/pwait.c  Wed Jan 16 05:03:49 2013(r245493)
 +++ head/bin/pwait/pwait.c  Wed Jan 16 05:03:52 2013(r245494)
 @@ -141,5 +141,6 @@ main(int argc, char *argv[])
 nleft -= n;
 }

 +   free(e);
 return 0;
  }




-- 
Xin LI delp...@delphij.net https://www.delphij.net/
FreeBSD - The Power to Serve! Live free or die
___
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