Re: svn commit: r246245 - head/sys/netgraph

2013-02-04 Thread Marko Zec
On Monday 04 February 2013 08:41:32 Andriy Gapon wrote:
 on 04/02/2013 02:37 Mark Johnston said the following:
  On Sat, Feb 02, 2013 at 11:54:00AM +, Andriy Gapon wrote:
  Author: avg
  Date: Sat Feb  2 11:54:00 2013
  New Revision: 246245
  URL: http://svnweb.freebsd.org/changeset/base/246245
 
  Log:
ng_ether: track interface renaming
 
Also sanitize interface names that can potentially contain
  characters that are prohibited in netgraph names.
 
PR:  kern/154850 (sanitizing of names)
Discussed with:  eri, melifaro
Submitted by:Nikolay Denev nde...@gmail.com (sanitizing code)
Reviewed by: eri, glebius
MFC after:   17 days
 
  Modified:
head/sys/netgraph/ng_ether.c
 
  Hi Andriy,
 
  This commit seems to cause a panic during boot when creating the
  loopback interface. I couldn't get a core dump but the problem seems to
  happen when dereferencing ifp-if_l2com in the IFP2NG macro in
  ng_ether_ifnet_arrival_event(). In the case of lo(4) this pointer seems
  to be NULL (I suppose because lo(4) doesn't register itself in the
  if_com_alloc/free tables).
 
  The patch below fixes the panic for me.

 Mark,

 thank you for the report and sorry for the breakage.
 Could you please try the following patch (slightly different from your
 patch)?

 diff --git a/sys/netgraph/ng_ether.c b/sys/netgraph/ng_ether.c
 index 6266f40..05ea402 100644
 --- a/sys/netgraph/ng_ether.c
 +++ b/sys/netgraph/ng_ether.c
 @@ -410,11 +410,16 @@ static void
  ng_ether_ifnet_arrival_event(void *arg __unused, struct ifnet *ifp)
  {
   char name[IFNAMSIZ];
 - node_p node = IFP2NG(ifp);
 + node_p node;
 +
 + /* Only ethernet interfaces are of interest. */
 + if (ifp-if_type != IFT_ETHER)
 + return;


And what about IFT_FDDI, IFT_XETHER, IFT_ISO88025, IFT_L2VLAN, IFT_BRIDGE, 
IFT_ARCNET, IFT_IEEE8023ADLAG, IFT_IEEE80211?

Marko


   /*
* Just return if it's a new interface without an ng_ether companion.
*/
 + node = IFP2NG(ifp);
   if (node == NULL)
   return;

  diff --git a/sys/netgraph/ng_ether.c b/sys/netgraph/ng_ether.c
  index 6266f40..f566346 100644
  --- a/sys/netgraph/ng_ether.c
  +++ b/sys/netgraph/ng_ether.c
  @@ -410,7 +410,12 @@ static void
   ng_ether_ifnet_arrival_event(void *arg __unused, struct ifnet *ifp)
   {
  char name[IFNAMSIZ];
  -   node_p node = IFP2NG(ifp);
  +   node_p node;
  +
  +   if (ifp-if_l2com == NULL)
  +   return;
  +
  +   node = IFP2NG(ifp);
 
  /*
   * Just return if it's a new interface without an ng_ether companion.


___
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: r246314 - in head/contrib: gcc/config/arm libstdc++/libsupc++

2013-02-04 Thread Andrew Turner
Author: andrew
Date: Mon Feb  4 09:28:36 2013
New Revision: 246314
URL: http://svnweb.freebsd.org/changeset/base/246314

Log:
  Allow the unwind functions int libgcc_s to interact correctly with libthr.
  
  _Unwind_ForcedUnwind in libgcc_s takes as one of it's parameters a stop
  function to tell it when to stop unwinding. One of the stop function's
  parameters is a _Unwind_Exception_Class. On most architectures this is an
  int64_t, however on ARM EABI the gcc developers have made this a char array
  with 8 items. While both of these take the same space they are passed into
  the stop function differently, an int64_t is passed in in registers r2 and
  r3, while the char[8] is passed in as a pointer to the first item in
  register r2.
  
  Because libthr expects the value to be an int64_t we would get incorrect
  results when it passes a function that take an int64_t but libgcc passes in
  a pointer to a char array including crashing.
  
  The fix is to update libgcc_s to make it pass an int64_t to the stop
  function and to libstdc++ as it expects _Unwind_Exception_Class to be an
  array.

Modified:
  head/contrib/gcc/config/arm/unwind-arm.h
  head/contrib/libstdc++/libsupc++/unwind-cxx.h

Modified: head/contrib/gcc/config/arm/unwind-arm.h
==
--- head/contrib/gcc/config/arm/unwind-arm.hMon Feb  4 08:53:51 2013
(r246313)
+++ head/contrib/gcc/config/arm/unwind-arm.hMon Feb  4 09:28:36 2013
(r246314)
@@ -87,7 +87,7 @@ extern C {
 
   struct _Unwind_Control_Block
 {
-  char exception_class[8];
+  unsigned  exception_class __attribute__((__mode__(__DI__)));
   void (*exception_cleanup)(_Unwind_Reason_Code, _Unwind_Control_Block *);
   /* Unwinder cache, private fields for the unwinder's use */
   struct
@@ -186,7 +186,7 @@ extern C {
 
   /* Support functions for the PR.  */
 #define _Unwind_Exception _Unwind_Control_Block
-  typedef char _Unwind_Exception_Class[8];
+  typedef unsigned _Unwind_Exception_Class __attribute__((__mode__(__DI__)));
 
   void * _Unwind_GetLanguageSpecificData (_Unwind_Context *);
   _Unwind_Ptr _Unwind_GetRegionStart (_Unwind_Context *);

Modified: head/contrib/libstdc++/libsupc++/unwind-cxx.h
==
--- head/contrib/libstdc++/libsupc++/unwind-cxx.h   Mon Feb  4 08:53:51 
2013(r246313)
+++ head/contrib/libstdc++/libsupc++/unwind-cxx.h   Mon Feb  4 09:28:36 
2013(r246314)
@@ -173,7 +173,7 @@ __get_exception_header_from_ue (_Unwind_
   return reinterpret_cast__cxa_exception *(exc + 1) - 1;
 }
 
-#ifdef __ARM_EABI_UNWINDER__
+#if defined(__ARM_EABI_UNWINDER__)  !defined(__FreeBSD__)
 static inline bool
 __is_gxx_exception_class(_Unwind_Exception_Class c)
 {
@@ -200,13 +200,7 @@ __GXX_INIT_EXCEPTION_CLASS(_Unwind_Excep
   c[6] = '+';
   c[7] = '\0';
 }
-
-static inline void*
-__gxx_caught_object(_Unwind_Exception* eo)
-{
-  return (void*)eo-barrier_cache.bitpattern[0];
-}
-#else // !__ARM_EABI_UNWINDER__
+#else // !__ARM_EABI_UNWINDER__ || __FreeBSD__
 // This is the exception class we report -- GNUCC++\0.
 const _Unwind_Exception_Class __gxx_exception_class
 = _Unwind_Exception_Class) 'G' 
@@ -223,8 +217,16 @@ __is_gxx_exception_class(_Unwind_Excepti
 {
   return c == __gxx_exception_class;
 }
-
 #define __GXX_INIT_EXCEPTION_CLASS(c) c = __gxx_exception_class
+#endif
+
+#ifdef __ARM_EABI_UNWINDER__
+static inline void*
+__gxx_caught_object(_Unwind_Exception* eo)
+{
+  return (void*)eo-barrier_cache.bitpattern[0];
+}
+#else // !__ARM_EABI_UNWINDER__
 
 // GNU C++ personality routine, Version 0.
 extern C _Unwind_Reason_Code __gxx_personality_v0
___
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: r246316 - in head/sys: kern vm

2013-02-04 Thread Marius Strobl
Author: marius
Date: Mon Feb  4 09:35:48 2013
New Revision: 246316
URL: http://svnweb.freebsd.org/changeset/base/246316

Log:
  Try to improve r242655 take III: move these SYSCTLs describing the kernel
  map, which is defined and initialized in vm/vm_kern.c, to the latter.
  
  Submitted by: alc

Modified:
  head/sys/kern/kern_malloc.c
  head/sys/vm/vm_kern.c

Modified: head/sys/kern/kern_malloc.c
==
--- head/sys/kern/kern_malloc.c Mon Feb  4 09:34:25 2013(r246315)
+++ head/sys/kern/kern_malloc.c Mon Feb  4 09:35:48 2013(r246316)
@@ -186,17 +186,6 @@ struct {
  */
 static uma_zone_t mt_zone;
 
-SYSCTL_ULONG(_vm, OID_AUTO, min_kernel_address, CTLFLAG_RD, NULL,
-VM_MIN_KERNEL_ADDRESS, Min kernel address);
-
-SYSCTL_ULONG(_vm, OID_AUTO, max_kernel_address, CTLFLAG_RD,
-#ifndef __sparc64__
-NULL, VM_MAX_KERNEL_ADDRESS,
-#else
-vm_max_kernel_address, 0,
-#endif
-Max kernel address);
-
 u_long vm_kmem_size;
 SYSCTL_ULONG(_vm, OID_AUTO, kmem_size, CTLFLAG_RDTUN, vm_kmem_size, 0,
 Size of kernel memory);

Modified: head/sys/vm/vm_kern.c
==
--- head/sys/vm/vm_kern.c   Mon Feb  4 09:34:25 2013(r246315)
+++ head/sys/vm/vm_kern.c   Mon Feb  4 09:35:48 2013(r246316)
@@ -94,6 +94,17 @@ vm_map_t buffer_map=0;
 const void *zero_region;
 CTASSERT((ZERO_REGION_SIZE  PAGE_MASK) == 0);
 
+SYSCTL_ULONG(_vm, OID_AUTO, min_kernel_address, CTLFLAG_RD,
+NULL, VM_MIN_KERNEL_ADDRESS, Min kernel address);
+
+SYSCTL_ULONG(_vm, OID_AUTO, max_kernel_address, CTLFLAG_RD,
+#ifdef __sparc64__
+vm_max_kernel_address, 0,
+#else
+NULL, VM_MAX_KERNEL_ADDRESS,
+#endif
+Max kernel address);
+
 /*
  * kmem_alloc_nofault:
  *
___
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: r245848 - head/sys/boot/i386/libi386

2013-02-04 Thread Sergey Kandaurov
On 23 January 2013 22:34, John Baldwin j...@freebsd.org wrote:
 Author: jhb
 Date: Wed Jan 23 18:34:21 2013
 New Revision: 245848
 URL: http://svnweb.freebsd.org/changeset/base/245848

 Log:
   Always update the hw.uart.console hint anytime a change is made to the
   comconsole setup.  Previously the hint would be set when if you set a
   custom port, but it would not be updated if you later set a custom speed.

   Also, leave the hw.uart.console hint mutable so it can be overridden or
   unset by the user if needed.

   Reviewed by:  kib (earlier version)
   MFC after:1 week

Looks like this results in something wrong.
I have a serial console at COM2 (uart1), but it chooses uart0
(1016 == 0x3F8), compare .flags and the final hw.uart.console value.

hint.uart.0.at=isa
hint.uart.0.irq=4
hint.uart.0.port=0x3F8
hint.uart.1.at=isa
hint.uart.1.flags=0x10
hint.uart.1.irq=3
hint.uart.1.port=0x2F8
hw.uart.console=io:1016,br:9600

Or even:
hint.uart.0.at=isa
hint.uart.0.disabled=1
hint.uart.0.irq=4
hint.uart.0.port=0x3F8
hint.uart.1.at=isa
hint.uart.1.flags=0x10
hint.uart.1.irq=3
hint.uart.1.port=0x2F8
hw.uart.console=io:1016,br:9600


 Modified:
   head/sys/boot/i386/libi386/comconsole.c

 Modified: head/sys/boot/i386/libi386/comconsole.c
 ==
 --- head/sys/boot/i386/libi386/comconsole.c Wed Jan 23 18:19:50 2013  
   (r245847)
 +++ head/sys/boot/i386/libi386/comconsole.c Wed Jan 23 18:34:21 2013  
   (r245848)
 @@ -50,7 +50,6 @@ static intcomc_init(int arg);
  static voidcomc_putchar(int c);
  static int comc_getchar(void);
  static int comc_getspeed(void);
 -static voidset_hw_console_hint(void);
  static int comc_ischar(void);
  static int comc_parseint(const char *string);
  static uint32_t comc_parse_pcidev(const char *string);
 @@ -202,27 +201,14 @@ comc_port_set(struct env_var *ev, int fl
  }

  if ((comconsole.c_flags  (C_ACTIVEIN | C_ACTIVEOUT)) != 0 
 -   comc_port != port) {
 +   comc_port != port)
 comc_setup(comc_curspeed, port);
 -   set_hw_console_hint();
 -}

  env_setenv(ev-ev_name, flags | EV_NOHOOK, value, NULL, NULL);

  return (CMD_OK);
  }

 -static void
 -set_hw_console_hint(void)
 -{
 -   char intbuf[64];
 -
 -   unsetenv(hw.uart.console);
 -   sprintf(intbuf, io:%d,br:%d, comc_port, comc_curspeed);
 -   env_setenv(hw.uart.console, EV_VOLATILE, intbuf,
 -   env_noset, env_nounset);
 -}
 -
  /*
   * Input: bus:dev:func[:bar]. If bar is not specified, it is 0x10.
   * Output: bar[24:16] bus[15:8] dev[7:3] func[2:0]
 @@ -288,7 +274,6 @@ comc_pcidev_handle(uint32_t locator)
comc_port_set, env_nounset);

 comc_setup(comc_curspeed, port);
 -   set_hw_console_hint();
 comc_locator = locator;

 return (CMD_OK);
 @@ -318,8 +303,10 @@ static void
  comc_setup(int speed, int port)
  {
  static int TRY_COUNT = 100;
 +char intbuf[64];
  int tries;

 +unsetenv(hw.uart.console);
  comc_curspeed = speed;
  comc_port = port;

 @@ -334,9 +321,11 @@ comc_setup(int speed, int port)
  inb(comc_port + com_data);
  while (inb(comc_port + com_lsr)  LSR_RXRDY  ++tries  TRY_COUNT);

 -if (tries  TRY_COUNT)
 +if (tries  TRY_COUNT) {
 comconsole.c_flags |= (C_PRESENTIN | C_PRESENTOUT);
 -else
 +   sprintf(intbuf, io:%d,br:%d, comc_port, comc_curspeed);
 +   env_setenv(hw.uart.console, EV_VOLATILE, intbuf, NULL, NULL);
 +} else
 comconsole.c_flags = ~(C_PRESENTIN | C_PRESENTOUT);
  }




-- 
wbr,
pluknet
___
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: r246318 - head/sys/arm/arm

2013-02-04 Thread Andrew Turner
Author: andrew
Date: Mon Feb  4 09:48:50 2013
New Revision: 246318
URL: http://svnweb.freebsd.org/changeset/base/246318

Log:
  Use the STACKALIGN macro to alight the stack rather than with a magic mask.
  
  Submitted by: Christoph Mallon christoph.mallon gmx.de

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

Modified: head/sys/arm/arm/vm_machdep.c
==
--- head/sys/arm/arm/vm_machdep.c   Mon Feb  4 09:42:12 2013
(r246317)
+++ head/sys/arm/arm/vm_machdep.c   Mon Feb  4 09:48:50 2013
(r246318)
@@ -362,8 +362,8 @@ cpu_set_upcall_kse(struct thread *td, vo
 {
struct trapframe *tf = td-td_frame;
 
-   tf-tf_usr_sp = ((int)stack-ss_sp + stack-ss_size
-   - sizeof(struct trapframe))  ~7;
+   tf-tf_usr_sp = STACKALIGN((int)stack-ss_sp + stack-ss_size
+   - sizeof(struct trapframe));
tf-tf_pc = (int)entry;
tf-tf_r0 = (int)arg;
tf-tf_spsr = PSR_USR32_MODE;
@@ -396,14 +396,13 @@ cpu_thread_alloc(struct thread *td)
 {
td-td_pcb = (struct pcb *)(td-td_kstack + td-td_kstack_pages *
PAGE_SIZE) - 1;
-   td-td_frame = (struct trapframe *)
-   ((u_int)td-td_kstack + USPACE_SVC_STACK_TOP - sizeof(struct pcb)) 
- 1;
/*
 * Ensure td_frame is aligned to an 8 byte boundary as it will be
 * placed into the stack pointer which must be 8 byte aligned in
 * the ARM EABI.
 */
-   td-td_frame = (struct trapframe *)((u_int)td-td_frame  ~7);
+   td-td_frame = (struct trapframe *)STACKALIGN((u_int)td-td_kstack +
+   USPACE_SVC_STACK_TOP - sizeof(struct pcb) - 1);
 #ifdef __XSCALE__
 #ifndef CPU_XSCALE_CORE3
pmap_use_minicache(td-td_kstack, td-td_kstack_pages * PAGE_SIZE);
___
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: r246245 - head/sys/netgraph

2013-02-04 Thread Marko Zec
On Monday 04 February 2013 10:42:31 Andriy Gapon wrote:
 on 04/02/2013 10:27 Marko Zec said the following:
  On Monday 04 February 2013 08:41:32 Andriy Gapon wrote:
  +  /* Only ethernet interfaces are of interest. */
  +  if (ifp-if_type != IFT_ETHER)
  +  return;
 
  And what about IFT_FDDI, IFT_XETHER, IFT_ISO88025, IFT_L2VLAN,
  IFT_BRIDGE, IFT_ARCNET, IFT_IEEE8023ADLAG, IFT_IEEE80211?

 Oh, I didn't realize that many drivers changed if_type after if_alloc.
 Honestly, the networking code is not my strong skill, I ventured here
 only because nobody else did...

 So what do you suggest?  if_alloctype or a different approach?
 I'd like to prevent if_l2com being mis-interpreted as struct arpcom.

We already have this in vnet_ng_ether_init():

865 TAILQ_FOREACH(ifp, V_ifnet, if_link) {
866 if (ifp-if_type == IFT_ETHER
867 || ifp-if_type == IFT_L2VLAN)
868 ng_ether_attach(ifp);
869 }

So at least in ng_ether_ifnet_arrival_event() we should do a check 
consistent to the above code.  OTOH we don't check for interface types on 
entry into ng_ether_attach(), and perhaps a better strategy would be to 
move your ifp-if_type check there.  Perhaps the check could be #defined as 
a macro to ensure consistency between vnet_ng_ether_init() and 
ng_ether_attach()?

Marko
___
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: r246319 - head/usr.bin/join

2013-02-04 Thread Andrew Turner
Author: andrew
Date: Mon Feb  4 10:05:55 2013
New Revision: 246319
URL: http://svnweb.freebsd.org/changeset/base/246319

Log:
  Cast *tabchar, a wchar_t, to a wint_t as it is the type the %lc printf
  format string expects. This is only an issue on ARM EABI where wint_t is
  different to wchar_t.

Modified:
  head/usr.bin/join/join.c

Modified: head/usr.bin/join/join.c
==
--- head/usr.bin/join/join.cMon Feb  4 09:48:50 2013(r246318)
+++ head/usr.bin/join/join.cMon Feb  4 10:05:55 2013(r246319)
@@ -516,7 +516,7 @@ static void
 outfield(LINE *lp, u_long fieldno, int out_empty)
 {
if (needsep++)
-   (void)printf(%lc, *tabchar);
+   (void)printf(%lc, (wint_t)*tabchar);
if (!ferror(stdout)) {
if (lp-fieldcnt = fieldno || out_empty) {
if (empty != 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


Re: svn commit: r246245 - head/sys/netgraph

2013-02-04 Thread Andriy Gapon
on 04/02/2013 11:58 Marko Zec said the following:
 On Monday 04 February 2013 10:42:31 Andriy Gapon wrote:
 on 04/02/2013 10:27 Marko Zec said the following:
 On Monday 04 February 2013 08:41:32 Andriy Gapon wrote:
 +  /* Only ethernet interfaces are of interest. */
 +  if (ifp-if_type != IFT_ETHER)
 +  return;

 And what about IFT_FDDI, IFT_XETHER, IFT_ISO88025, IFT_L2VLAN,
 IFT_BRIDGE, IFT_ARCNET, IFT_IEEE8023ADLAG, IFT_IEEE80211?

 Oh, I didn't realize that many drivers changed if_type after if_alloc.
 Honestly, the networking code is not my strong skill, I ventured here
 only because nobody else did...

 So what do you suggest?  if_alloctype or a different approach?
 I'd like to prevent if_l2com being mis-interpreted as struct arpcom.
 
 We already have this in vnet_ng_ether_init():
 
 865 TAILQ_FOREACH(ifp, V_ifnet, if_link) {
 866 if (ifp-if_type == IFT_ETHER
 867 || ifp-if_type == IFT_L2VLAN)
 868 ng_ether_attach(ifp);
 869 }
 
 So at least in ng_ether_ifnet_arrival_event() we should do a check 
 consistent to the above code.

OK, that makes sense.
Although I am not sure if perhaps that check should be extended too.
But that's not something for me to worry about.

 OTOH we don't check for interface types on 
 entry into ng_ether_attach(), and perhaps a better strategy would be to 
 move your ifp-if_type check there.

Definitely not move, perhaps copy...
OTOH, ng_ether_attach is invoked via a different mechanism (an explicit hook),
directly from ether_ifattach.
And so, as you note, there seems to be an inconsistency between
ether_ifattach-ng_ether_attach and vnet_ng_ether_init.  If a bridge is created
after ng_ether is loaded, then there would be ng_ether node for the bridge.
If ng_ether is loaded after a bridge is created, then there would be no ng_ether
node for it.  Unless I miss something.
But I don't know if we actually want ng_ether for a bridge (or something else of
the types you listed)...

 Perhaps the check could be #defined as 
 a macro to ensure consistency between vnet_ng_ether_init() and 
 ng_ether_attach()?

Perhaps...

-- 
Andriy Gapon
___
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: r246245 - head/sys/netgraph

2013-02-04 Thread Mark Johnston
On Mon, Feb 04, 2013 at 09:41:32AM +0200, Andriy Gapon wrote:
 on 04/02/2013 02:37 Mark Johnston said the following:
  On Sat, Feb 02, 2013 at 11:54:00AM +, Andriy Gapon wrote:
  Author: avg
  Date: Sat Feb  2 11:54:00 2013
  New Revision: 246245
  URL: http://svnweb.freebsd.org/changeset/base/246245
 
  Log:
ng_ether: track interface renaming

Also sanitize interface names that can potentially contain characters
that are prohibited in netgraph names.

PR:  kern/154850 (sanitizing of names)
Discussed with:  eri, melifaro
Submitted by:Nikolay Denev nde...@gmail.com (sanitizing code)
Reviewed by: eri, glebius
MFC after:   17 days
 
  Modified:
head/sys/netgraph/ng_ether.c
 
  
  Hi Andriy,
  
  This commit seems to cause a panic during boot when creating the
  loopback interface. I couldn't get a core dump but the problem seems to
  happen when dereferencing ifp-if_l2com in the IFP2NG macro in
  ng_ether_ifnet_arrival_event(). In the case of lo(4) this pointer seems
  to be NULL (I suppose because lo(4) doesn't register itself in the
  if_com_alloc/free tables).
  
  The patch below fixes the panic for me.
 
 Mark,
 
 thank you for the report and sorry for the breakage.
 Could you please try the following patch (slightly different from your patch)?

Thanks, I can confirm that this one works too.

 
 diff --git a/sys/netgraph/ng_ether.c b/sys/netgraph/ng_ether.c
 index 6266f40..05ea402 100644
 --- a/sys/netgraph/ng_ether.c
 +++ b/sys/netgraph/ng_ether.c
 @@ -410,11 +410,16 @@ static void
  ng_ether_ifnet_arrival_event(void *arg __unused, struct ifnet *ifp)
  {
   char name[IFNAMSIZ];
 - node_p node = IFP2NG(ifp);
 + node_p node;
 +
 + /* Only ethernet interfaces are of interest. */
 + if (ifp-if_type != IFT_ETHER)
 + return;
 
   /*
* Just return if it's a new interface without an ng_ether companion.
*/
 + node = IFP2NG(ifp);
   if (node == NULL)
   return;
 
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r246324 - head/sys/netgraph

2013-02-04 Thread Andriy Gapon
Author: avg
Date: Mon Feb  4 17:29:13 2013
New Revision: 246324
URL: http://svnweb.freebsd.org/changeset/base/246324

Log:
  ng_ether_ifnet_arrival_event: check interface type before using IFP2NG
  
  The check is copied from vnet_ng_ether_init.
  Not sure if it covers all the types that we want to support with
  ng_ether.
  
  Reported by:  markj
  Discussed with:   zec
  MFC after:10 days
  X-MFC with:   r246245

Modified:
  head/sys/netgraph/ng_ether.c

Modified: head/sys/netgraph/ng_ether.c
==
--- head/sys/netgraph/ng_ether.cMon Feb  4 16:20:13 2013
(r246323)
+++ head/sys/netgraph/ng_ether.cMon Feb  4 17:29:13 2013
(r246324)
@@ -410,11 +410,17 @@ static void
 ng_ether_ifnet_arrival_event(void *arg __unused, struct ifnet *ifp)
 {
char name[IFNAMSIZ];
-   node_p node = IFP2NG(ifp);
+   node_p node;
+
+   /* Only ethernet interfaces are of interest. */
+   if (ifp-if_type != IFT_ETHER
+ifp-if_type != IFT_L2VLAN)
+   return;
 
/*
 * Just return if it's a new interface without an ng_ether companion.
 */
+   node = IFP2NG(ifp);
if (node == NULL)
return;
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r246325 - in head/usr.bin/bmake: . unit-tests

2013-02-04 Thread Simon J. Gerraty
Author: sjg
Date: Mon Feb  4 17:41:17 2013
New Revision: 246325
URL: http://svnweb.freebsd.org/changeset/base/246325

Log:
  Missed adding Makefile.config and unit-tests/Makefile should
  allow FreeBSD make to do 'obj'.
  
  Approved by:  marcel (mentor)

Added:
  head/usr.bin/bmake/Makefile.config   (contents, props changed)
Modified:
  head/usr.bin/bmake/unit-tests/Makefile

Added: head/usr.bin/bmake/Makefile.config
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/usr.bin/bmake/Makefile.config  Mon Feb  4 17:41:17 2013
(r246325)
@@ -0,0 +1,21 @@
+# This is a generated file, do NOT edit!
+# See contrib/bmake/bsd.after-import.mk
+#
+# $FreeBSD$
+
+SRCTOP?= ${.CURDIR:H:H}
+
+# things set by configure
+
+prefix= /usr
+srcdir= ${SRCTOP}/contrib/bmake
+CC?= gcc
+DEFAULT_SYS_PATH= .../share/mk:/usr/share/mk
+
+CPPFLAGS+= 
+CFLAGS+= ${CPPFLAGS} -DHAVE_CONFIG_H
+LDFLAGS= 
+LIBOBJS=  ${LIBOBJDIR}stresep$U.o
+LDADD= 
+USE_META= yes
+FILEMON_H= /usr/include/dev/filemon/filemon.h

Modified: head/usr.bin/bmake/unit-tests/Makefile
==
--- head/usr.bin/bmake/unit-tests/Makefile  Mon Feb  4 17:29:13 2013
(r246324)
+++ head/usr.bin/bmake/unit-tests/Makefile  Mon Feb  4 17:41:17 2013
(r246325)
@@ -79,10 +79,12 @@ TOOL_TR?= tr
 TOOL_DIFF?= diff
 DIFF_FLAGS?= -u
 
+.if defined(.PARSEDIR)
 # ensure consistent results from sort(1)
 LC_ALL= C
 LANG= C
 .export LANG LC_ALL
+.endif
 
 # The driver.
 # We always pretend .MAKE was called 'make' 
___
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: r246329 - head/sbin/recoverdisk

2013-02-04 Thread Xin LI
Author: delphij
Date: Mon Feb  4 19:17:15 2013
New Revision: 246329
URL: http://svnweb.freebsd.org/changeset/base/246329

Log:
  Use stripesize as smallest block size if it's available.
  
  MFC after:2 weeks

Modified:
  head/sbin/recoverdisk/recoverdisk.c

Modified: head/sbin/recoverdisk/recoverdisk.c
==
--- head/sbin/recoverdisk/recoverdisk.c Mon Feb  4 19:05:53 2013
(r246328)
+++ head/sbin/recoverdisk/recoverdisk.c Mon Feb  4 19:17:15 2013
(r246329)
@@ -156,6 +156,7 @@ main(int argc, char * const argv[])
int error, state;
u_char *buf;
u_int sectorsize;
+   u_int stripesize;
time_t t1, t2;
struct stat sb;
u_int n, snapshot = 60;
@@ -201,6 +202,10 @@ main(int argc, char * const argv[])
if (error  0)
err(1, DIOCGSECTORSIZE failed);
 
+   error = ioctl(fdr, DIOCGSTRIPESIZE, stripesize);
+   if (error == 0  stripesize  sectorsize)
+   sectorsize = stripesize;
+
minsize = sectorsize;
bigsize = (bigsize / sectorsize) * sectorsize;
 
___
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: r245848 - head/sys/boot/i386/libi386

2013-02-04 Thread John Baldwin
On Monday, February 04, 2013 4:43:36 am Sergey Kandaurov wrote:
 On 23 January 2013 22:34, John Baldwin j...@freebsd.org wrote:
  Author: jhb
  Date: Wed Jan 23 18:34:21 2013
  New Revision: 245848
  URL: http://svnweb.freebsd.org/changeset/base/245848
 
  Log:
Always update the hw.uart.console hint anytime a change is made to the
comconsole setup.  Previously the hint would be set when if you set a
custom port, but it would not be updated if you later set a custom speed.
 
Also, leave the hw.uart.console hint mutable so it can be overridden or
unset by the user if needed.
 
Reviewed by:  kib (earlier version)
MFC after:1 week
 
 Looks like this results in something wrong.
 I have a serial console at COM2 (uart1), but it chooses uart0
 (1016 == 0x3F8), compare .flags and the final hw.uart.console value.

Do you have a working console in the loader?  It is setting the hint based
on what the loader uses.  I use this to use COM2 for both loader and
kernel:

console=comconsole vidconsole
comconsole_port=0x2f8

Note that when hw.uart.console is set, any flags set in hint.uart.X.flags
to set the console are ignored.  If you are not using -h in /boot.config or
setting 'console' for the loader to enable a serial console then the loader
should not be setting hw.uart.console (if it is, that is a bug to be fixed).
However, configuring the kernel to use a different serial console from the
loader seems very odd.  You should be able to manually set hw.uart.console in
loader.conf if you are doing that.

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

2013-02-04 Thread Andriy Gapon
on 04/02/2013 21:29 John Baldwin said the following:
 On Sunday, February 03, 2013 4:57:39 am Andriy Gapon wrote:
 Author: avg
 Date: Sun Feb  3 09:57:39 2013
 New Revision: 246282
 URL: http://svnweb.freebsd.org/changeset/base/246282

 Log:
   allow for large KTR_ENTRIES values by allocating ktr_buf using malloc(9)
   
   Only during very early boot, before malloc(9) is functional (SI_SUB_KMEM),
   the static ktr_buf_init is used.  Size of the static buffer is determined
   by a new kernel option KTR_BOOT_ENTRIES.  Its default value is 1024.
   
   This commit builds on top of r243046.
 
 Does this lose early entries once the SYSINIT runs?  It doesn't seem to 
 make 
 any effort to copy the existing entries over to the new buffer?

Yes, this is true and glebius has also noticed that...
I think that a simple bcopy should be fine here?

-- 
Andriy Gapon
___
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: r246330 - head/sys/kern

2013-02-04 Thread Andriy Gapon
Author: avg
Date: Mon Feb  4 21:50:55 2013
New Revision: 246330
URL: http://svnweb.freebsd.org/changeset/base/246330

Log:
  ktr: copy content from the early static buffer if KTR_ENTRIES !=
  KTR_BOOT_ENTRIES
  
  Reported by:  glebius, jhb
  Pointyhat to: avg
  MFC after:14 days
  X-MFC with:   r246282

Modified:
  head/sys/kern/kern_ktr.c

Modified: head/sys/kern/kern_ktr.c
==
--- head/sys/kern/kern_ktr.cMon Feb  4 19:17:15 2013(r246329)
+++ head/sys/kern/kern_ktr.cMon Feb  4 21:50:55 2013(r246330)
@@ -213,6 +213,7 @@ ktr_entries_initializer(void *dummy __un
ktr_mask = 0;
ktr_buf = malloc(sizeof(*ktr_buf) * KTR_ENTRIES, M_KTR,
M_WAITOK | M_ZERO);
+   memcpy(ktr_buf, ktr_buf_init, sizeof(ktr_buf_init));
ktr_entries = KTR_ENTRIES;
ktr_mask = mask;
 }
___
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: r246331 - head/sys/kern

2013-02-04 Thread Andriy Gapon
Author: avg
Date: Mon Feb  4 21:58:57 2013
New Revision: 246331
URL: http://svnweb.freebsd.org/changeset/base/246331

Log:
  ktr: prevent possible footshooting with KTR_ENTRIES and KTR_BOOT_ENTRIES
  
  Suggested by: adrian
  MFC after:14 days
  X-MFC with:   r246282

Modified:
  head/sys/kern/kern_ktr.c

Modified: head/sys/kern/kern_ktr.c
==
--- head/sys/kern/kern_ktr.cMon Feb  4 21:50:55 2013(r246330)
+++ head/sys/kern/kern_ktr.cMon Feb  4 21:58:57 2013(r246331)
@@ -198,7 +198,7 @@ SYSCTL_PROC(_debug_ktr, OID_AUTO, mask, 
 sysctl_debug_ktr_mask, IU,
 Bitmask of KTR event classes for which logging is enabled);
 
-#if KTR_ENTRIES != KTR_BOOT_ENTRIES
+#if KTR_ENTRIES  KTR_BOOT_ENTRIES
 /*
  * A simplified version of sysctl_debug_ktr_entries.
  * No need to care about SMP, scheduling, etc.
___
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: r246341 - head/sys/dev/age

2013-02-04 Thread Pyun YongHyeon
Author: yongari
Date: Tue Feb  5 00:37:45 2013
New Revision: 246341
URL: http://svnweb.freebsd.org/changeset/base/246341

Log:
  Rework jumbo frame handling.  QAC confirmed that the controller
  requires 8 bytes alignment on RX buffer.  Given that non-jumbo
  frame works on any alignments I guess this DMA limitation for RX
  buffer could be jumbo frame specific one.  Also I'm not sure
  whether this DMA limitation is related with 64bit DMA.  Previously
  age(4) disabled 64bit DMA addressing due to silent data corruption.
  So we may need more testing on re-enabling 64bit DMA in future.
  
  While I'm here, change mbuf chaining algorithm to use fixed sized
  buffer and force software checksum if controller reports length
  error. According to QAC, RFD is not updated at all for jumbo frame
  so it works just like alc(4) controllers.  This change also added
  alignment fixup for strict alignment architectures.  Because I'm
  not aware of any non-x86 machines that use age(4) controllers it's
  just for completeness at this moment.
  
  Wit this change, jumbo frame should work with age(4).
  
  Tested by:Christian Gusenbauer  c47g  gmx dot at 
  MFC after:1 week

Modified:
  head/sys/dev/age/if_age.c
  head/sys/dev/age/if_agevar.h

Modified: head/sys/dev/age/if_age.c
==
--- head/sys/dev/age/if_age.c   Tue Feb  5 00:33:32 2013(r246340)
+++ head/sys/dev/age/if_age.c   Tue Feb  5 00:37:45 2013(r246341)
@@ -142,6 +142,9 @@ static int age_init_rx_ring(struct age_s
 static void age_init_rr_ring(struct age_softc *);
 static void age_init_cmb_block(struct age_softc *);
 static void age_init_smb_block(struct age_softc *);
+#ifndef __NO_STRICT_ALIGNMENT
+static struct mbuf *age_fixup_rx(struct ifnet *, struct mbuf *);
+#endif
 static int age_newbuf(struct age_softc *, struct age_rxdesc *);
 static void age_rxvlan(struct age_softc *);
 static void age_rxfilter(struct age_softc *);
@@ -1133,7 +1136,7 @@ again:
/* Create tag for Rx buffers. */
error = bus_dma_tag_create(
sc-age_cdata.age_buffer_tag, /* parent */
-   1, 0,   /* alignment, boundary */
+   AGE_RX_BUF_ALIGN, 0,/* alignment, boundary */
BUS_SPACE_MAXADDR,  /* lowaddr */
BUS_SPACE_MAXADDR,  /* highaddr */
NULL, NULL, /* filter, filterarg */
@@ -2268,16 +2271,53 @@ age_txintr(struct age_softc *sc, int tpd
}
 }
 
+#ifndef __NO_STRICT_ALIGNMENT
+static struct mbuf *
+age_fixup_rx(struct ifnet *ifp, struct mbuf *m)
+{
+   struct mbuf *n;
+int i;
+uint16_t *src, *dst;
+
+   src = mtod(m, uint16_t *);
+   dst = src - 3;
+
+   if (m-m_next == NULL) {
+   for (i = 0; i  (m-m_len / sizeof(uint16_t) + 1); i++)
+   *dst++ = *src++;
+   m-m_data -= 6;
+   return (m);
+   }
+   /*
+* Append a new mbuf to received mbuf chain and copy ethernet
+* header from the mbuf chain. This can save lots of CPU
+* cycles for jumbo frame.
+*/
+   MGETHDR(n, M_NOWAIT, MT_DATA);
+   if (n == NULL) {
+   ifp-if_iqdrops++;
+   m_freem(m);
+   return (NULL);
+   }
+   bcopy(m-m_data, n-m_data, ETHER_HDR_LEN);
+   m-m_data += ETHER_HDR_LEN;
+   m-m_len -= ETHER_HDR_LEN;
+   n-m_len = ETHER_HDR_LEN;
+   M_MOVE_PKTHDR(n, m);
+   n-m_next = m;
+   return (n);
+}
+#endif
+
 /* Receive a frame. */
 static void
 age_rxeof(struct age_softc *sc, struct rx_rdesc *rxrd)
 {
struct age_rxdesc *rxd;
-   struct rx_desc *desc;
struct ifnet *ifp;
struct mbuf *mp, *m;
uint32_t status, index, vtag;
-   int count, nsegs, pktlen;
+   int count, nsegs;
int rx_cons;
 
AGE_LOCK_ASSERT(sc);
@@ -2289,9 +2329,7 @@ age_rxeof(struct age_softc *sc, struct r
nsegs = AGE_RX_NSEGS(index);
 
sc-age_cdata.age_rxlen = AGE_RX_BYTES(le32toh(rxrd-len));
-   if ((status  AGE_RRD_ERROR) != 0 
-   (status  (AGE_RRD_CRC | AGE_RRD_CODE | AGE_RRD_DRIBBLE |
-   AGE_RRD_RUNT | AGE_RRD_OFLOW | AGE_RRD_TRUNC)) != 0) {
+   if ((status  (AGE_RRD_ERROR | AGE_RRD_LENGTH_NOK)) != 0) {
/*
 * We want to pass the following frames to upper
 * layer regardless of error status of Rx return
@@ -2301,33 +2339,31 @@ age_rxeof(struct age_softc *sc, struct r
 *  o frame length and protocol specific length
 * does not match.
 */
-   sc-age_cdata.age_rx_cons += nsegs;
-   sc-age_cdata.age_rx_cons %= AGE_RX_RING_CNT;
-   return;
+   status |= AGE_RRD_IPCSUM_NOK | AGE_RRD_TCP_UDPCSUM_NOK;
+   if ((status  (AGE_RRD_CRC | AGE_RRD_CODE | AGE_RRD_DRIBBLE |
+   

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

2013-02-04 Thread Ganbold Tsagaankhuu
Author: ganbold (doc committer)
Date: Tue Feb  5 02:25:13 2013
New Revision: 246342
URL: http://svnweb.freebsd.org/changeset/base/246342

Log:
  Add gpio driver and update dts and kernel config accordingly.
  
  Approved by: gonzo@

Added:
  head/sys/arm/allwinner/a10_gpio.c   (contents, props changed)
Modified:
  head/sys/arm/allwinner/files.a10
  head/sys/arm/conf/CUBIEBOARD
  head/sys/boot/fdt/dts/cubieboard.dts

Added: head/sys/arm/allwinner/a10_gpio.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/arm/allwinner/a10_gpio.c   Tue Feb  5 02:25:13 2013
(r246342)
@@ -0,0 +1,521 @@
+/*-
+ * Copyright (c) 2013 Ganbold Tsagaankhuu ganb...@gmail.com
+ * Copyright (c) 2012 Oleksandr Tymoshenko go...@freebsd.org
+ * Copyright (c) 2012 Luiz Otavio O Souza.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ */
+#include sys/cdefs.h
+__FBSDID($FreeBSD$);
+
+#include sys/param.h
+#include sys/systm.h
+#include sys/bus.h
+
+#include sys/kernel.h
+#include sys/module.h
+#include sys/rman.h
+#include sys/lock.h
+#include sys/mutex.h
+#include sys/gpio.h
+
+#include machine/bus.h
+#include machine/cpu.h
+#include machine/cpufunc.h
+#include machine/resource.h
+#include machine/fdt.h
+#include machine/frame.h
+#include machine/intr.h
+
+#include dev/fdt/fdt_common.h
+#include dev/ofw/ofw_bus.h
+#include dev/ofw/ofw_bus_subr.h
+
+#include gpio_if.h
+
+/*
+ * A10 have 9 banks of gpio.
+ * 32 pins per bank:
+ * PA0 - PA17 | PB0 - PB23 | PC0 - PC24
+ * PD0 - PD27 | PE0 - PE31 | PF0 - PF5
+ * PG0 - PG9 | PH0 - PH27 | PI0 - PI12
+ */
+
+#defineA10_GPIO_PINS   288
+#defineA10_GPIO_DEFAULT_CAPS   (GPIO_PIN_INPUT | GPIO_PIN_OUTPUT | 
\
+GPIO_PIN_PULLUP | GPIO_PIN_PULLDOWN)
+
+struct a10_gpio_softc {
+   device_tsc_dev;
+   struct mtx  sc_mtx;
+   struct resource *   sc_mem_res;
+   struct resource *   sc_irq_res;
+   bus_space_tag_t sc_bst;
+   bus_space_handle_t  sc_bsh;
+   void *  sc_intrhand;
+   int sc_gpio_npins;
+   struct gpio_pin sc_gpio_pins[A10_GPIO_PINS];
+};
+
+enum a10_gpio_fsel {
+   A10_GPIO_INPUT,
+   A10_GPIO_OUTPUT,
+};
+
+enum a10_gpio_pud {
+   A10_GPIO_NONE,
+   A10_GPIO_PULLDOWN,
+   A10_GPIO_PULLUP,
+};
+
+#defineA10_GPIO_LOCK(_sc)  mtx_lock(_sc-sc_mtx)
+#defineA10_GPIO_UNLOCK(_sc)mtx_unlock(_sc-sc_mtx)
+#defineA10_GPIO_LOCK_ASSERT(_sc)   mtx_assert(_sc-sc_mtx, 
MA_OWNED)
+
+#defineA10_GPIO_GP_CFG(_bank, _pin)0x00 + ((_bank) * 0x24) + 
((_pin)2)
+#defineA10_GPIO_GP_DAT(_bank)  0x10 + ((_bank) * 0x24)
+#defineA10_GPIO_GP_DRV(_bank, _pin)0x14 + ((_bank) * 0x24) + 
((_pin)2)
+#defineA10_GPIO_GP_PUL(_bank, _pin)0x1c + ((_bank) * 0x24) + 
((_pin)2)
+
+#defineA10_GPIO_GP_INT_CFG00x200
+#defineA10_GPIO_GP_INT_CFG10x204
+#defineA10_GPIO_GP_INT_CFG20x208
+#defineA10_GPIO_GP_INT_CFG30x20c
+
+#defineA10_GPIO_GP_INT_CTL 0x210
+#defineA10_GPIO_GP_INT_STA 0x214
+#defineA10_GPIO_GP_INT_DEB 0x218
+
+#defineA10_GPIO_WRITE(_sc, _off, _val) \
+bus_space_write_4(_sc-sc_bst, _sc-sc_bsh, _off, _val)
+#defineA10_GPIO_READ(_sc, _off)\
+bus_space_read_4(_sc-sc_bst, _sc-sc_bsh, _off)
+
+static uint32_t
+a10_gpio_get_function(struct a10_gpio_softc *sc, uint32_t pin)
+{
+   uint32_t 

svn commit: r246346 - head/usr.sbin/crunch/crunchgen

2013-02-04 Thread Pedro F. Giffuni
Author: pfg
Date: Tue Feb  5 02:57:59 2013
New Revision: 246346
URL: http://svnweb.freebsd.org/changeset/base/246346

Log:
  crunchgen: Permit use of alternative linkers.
  
  Submitted by: Pete Chou
  MFC after:1 week

Modified:
  head/usr.sbin/crunch/crunchgen/crunchgen.c

Modified: head/usr.sbin/crunch/crunchgen/crunchgen.c
==
--- head/usr.sbin/crunch/crunchgen/crunchgen.c  Tue Feb  5 02:45:02 2013
(r246345)
+++ head/usr.sbin/crunch/crunchgen/crunchgen.c  Tue Feb  5 02:57:59 2013
(r246346)
@@ -979,6 +979,7 @@ top_makefile_rules(FILE *outmk)
 {
prog_t *p;
 
+   fprintf(outmk, LD?= ld\n);
if ( subtract_strlst(libs, libs_so) )
fprintf(outmk, # NOTE: Some LIBS declarations below overridden 
by LIBS_SO\n);
 
@@ -1108,7 +1109,7 @@ prog_makefile_rules(FILE *outmk, prog_t 
fprintf(outmk,  $(%s_LIBS), p-ident);
 
fprintf(outmk, \n);
-   fprintf(outmk, \tld -dc -r -o %s.lo %s_stub.o $(%s_OBJPATHS),
+   fprintf(outmk, \t$(LD) -dc -r -o %s.lo %s_stub.o $(%s_OBJPATHS),
p-name, p-name, p-ident);
if (p-libs)
fprintf(outmk,  $(%s_LIBS), p-ident);
___
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: r246347 - head/sys/fs/ext2fs

2013-02-04 Thread Pedro F. Giffuni
Author: pfg
Date: Tue Feb  5 03:01:04 2013
New Revision: 246347
URL: http://svnweb.freebsd.org/changeset/base/246347

Log:
  ext2fs: Use EXT2_LINK_MAX instead of LINK_MAX
  
  Submitted by: Christoph Mallon
  MFC after:2 weeks

Modified:
  head/sys/fs/ext2fs/ext2_vnops.c

Modified: head/sys/fs/ext2fs/ext2_vnops.c
==
--- head/sys/fs/ext2fs/ext2_vnops.c Tue Feb  5 02:57:59 2013
(r246346)
+++ head/sys/fs/ext2fs/ext2_vnops.c Tue Feb  5 03:01:04 2013
(r246347)
@@ -730,7 +730,7 @@ ext2_link(ap)
goto out;
}
ip = VTOI(vp);
-   if ((nlink_t)ip-i_nlink = LINK_MAX) {
+   if ((nlink_t)ip-i_nlink = EXT2_LINK_MAX) {
error = EMLINK;
goto out;
}
@@ -841,7 +841,7 @@ abortit:
goto abortit;
dp = VTOI(fdvp);
ip = VTOI(fvp);
-   if (ip-i_nlink = LINK_MAX) {
+   if (ip-i_nlink = EXT2_LINK_MAX) {
VOP_UNLOCK(fvp, 0);
error = EMLINK;
goto abortit;
@@ -939,7 +939,7 @@ abortit:
 * parent we don't fool with the link count.
 */
if (doingdirectory  newparent) {
-   if ((nlink_t)dp-i_nlink = LINK_MAX) {
+   if ((nlink_t)dp-i_nlink = EXT2_LINK_MAX) {
error = EMLINK;
goto bad;
}
@@ -1160,7 +1160,7 @@ ext2_mkdir(ap)
panic(ext2_mkdir: no name);
 #endif
dp = VTOI(dvp);
-   if ((nlink_t)dp-i_nlink = LINK_MAX) {
+   if ((nlink_t)dp-i_nlink = EXT2_LINK_MAX) {
error = EMLINK;
goto out;
}
@@ -1524,7 +1524,7 @@ ext2_pathconf(ap)
 
switch (ap-a_name) {
case _PC_LINK_MAX:
-   *ap-a_retval = LINK_MAX;
+   *ap-a_retval = EXT2_LINK_MAX;
return (0);
case _PC_NAME_MAX:
*ap-a_retval = NAME_MAX;
___
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: r246349 - head/sys/fs/ext2fs

2013-02-04 Thread Pedro F. Giffuni
Author: pfg
Date: Tue Feb  5 03:13:05 2013
New Revision: 246349
URL: http://svnweb.freebsd.org/changeset/base/246349

Log:
  ext2fs: Correct off-by-one errors in FFTODT() and DDTOFT().
  
  Submitted by: Christoph Mallon
  MFC after:2 weeks

Modified:
  head/sys/fs/ext2fs/ext2_lookup.c

Modified: head/sys/fs/ext2fs/ext2_lookup.c
==
--- head/sys/fs/ext2fs/ext2_lookup.cTue Feb  5 03:08:56 2013
(r246348)
+++ head/sys/fs/ext2fs/ext2_lookup.cTue Feb  5 03:13:05 2013
(r246349)
@@ -89,7 +89,7 @@ static u_char ext2_ft_to_dt[] = {
DT_LNK, /* EXT2_FT_SYMLINK */
 };
 #defineFTTODT(ft) \
-((ft)  nitems(ext2_ft_to_dt) ? DT_UNKNOWN : ext2_ft_to_dt[(ft)])
+((ft)  nitems(ext2_ft_to_dt) ? ext2_ft_to_dt[(ft)] : DT_UNKNOWN)
 
 static u_char dt_to_ext2_ft[] = {
EXT2_FT_UNKNOWN,/* DT_UNKNOWN */
@@ -109,7 +109,7 @@ static u_char dt_to_ext2_ft[] = {
EXT2_FT_UNKNOWN,/* DT_WHT */
 };
 #defineDTTOFT(dt) \
-((dt)  nitems(dt_to_ext2_ft) ? EXT2_FT_UNKNOWN : dt_to_ext2_ft[(dt)])
+((dt)  nitems(dt_to_ext2_ft) ? dt_to_ext2_ft[(dt)] : EXT2_FT_UNKNOWN)
 
 static int ext2_dirbadentry(struct vnode *dp, struct ext2fs_direct_2 *de,
int entryoffsetinblock);
___
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: r246350 - head/sys/fs/ext2fs

2013-02-04 Thread Pedro F. Giffuni
Author: pfg
Date: Tue Feb  5 03:17:41 2013
New Revision: 246350
URL: http://svnweb.freebsd.org/changeset/base/246350

Log:
  ext2fs: Remove useless rootino local variable.
  
  Submitted by: Christoph Mallon
  MFC after:2 weeks

Modified:
  head/sys/fs/ext2fs/ext2_lookup.c

Modified: head/sys/fs/ext2fs/ext2_lookup.c
==
--- head/sys/fs/ext2fs/ext2_lookup.cTue Feb  5 03:13:05 2013
(r246349)
+++ head/sys/fs/ext2fs/ext2_lookup.cTue Feb  5 03:17:41 2013
(r246350)
@@ -1086,7 +1086,7 @@ ext2_checkpath(source, target, cred)
struct ucred *cred;
 {
struct vnode *vp;
-   int error, rootino, namlen;
+   int error, namlen;
struct dirtemplate dirbuf;
 
vp = ITOV(target);
@@ -1094,9 +1094,8 @@ ext2_checkpath(source, target, cred)
error = EEXIST;
goto out;
}
-   rootino = EXT2_ROOTINO;
error = 0;
-   if (target-i_number == rootino)
+   if (target-i_number == EXT2_ROOTINO)
goto out;
 
for (;;) {
@@ -1121,7 +1120,7 @@ ext2_checkpath(source, target, cred)
error = EINVAL;
break;
}
-   if (dirbuf.dotdot_ino == rootino)
+   if (dirbuf.dotdot_ino == EXT2_ROOTINO)
break;
vput(vp);
if ((error = VFS_VGET(vp-v_mount, dirbuf.dotdot_ino,
___
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: r246351 - head/sys/fs/ext2fs

2013-02-04 Thread Pedro F. Giffuni
Author: pfg
Date: Tue Feb  5 03:23:56 2013
New Revision: 246351
URL: http://svnweb.freebsd.org/changeset/base/246351

Log:
  ext2fs: Remove unused em_e2fsb definition..
  
  Submitted by: Christoph Mallon
  MFC after:2 weeks

Modified:
  head/sys/fs/ext2fs/ext2_mount.h

Modified: head/sys/fs/ext2fs/ext2_mount.h
==
--- head/sys/fs/ext2fs/ext2_mount.h Tue Feb  5 03:17:41 2013
(r246350)
+++ head/sys/fs/ext2fs/ext2_mount.h Tue Feb  5 03:23:56 2013
(r246351)
@@ -48,7 +48,6 @@ struct ext2mount {
struct  vnode *um_devvp;/* block device mounted vnode */
 
struct  m_ext2fs *um_e2fs;  /* EXT2FS */
-#define em_e2fsb um_e2fs-e2fs
 
u_long  um_nindir;  /* indirect ptrs per block */
u_long  um_bptrtodb;/* indir ptr to disk block */
___
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: r246352 - head/sys/fs/ext2fs

2013-02-04 Thread Pedro F. Giffuni
Author: pfg
Date: Tue Feb  5 03:26:34 2013
New Revision: 246352
URL: http://svnweb.freebsd.org/changeset/base/246352

Log:
  ext2fs: move assignment where it is not dead.
  
  Submitted by: Christoph Mallon
  MFC after:2 weeks

Modified:
  head/sys/fs/ext2fs/ext2_lookup.c

Modified: head/sys/fs/ext2fs/ext2_lookup.c
==
--- head/sys/fs/ext2fs/ext2_lookup.cTue Feb  5 03:23:56 2013
(r246351)
+++ head/sys/fs/ext2fs/ext2_lookup.cTue Feb  5 03:26:34 2013
(r246352)
@@ -1094,9 +1094,10 @@ ext2_checkpath(source, target, cred)
error = EEXIST;
goto out;
}
-   error = 0;
-   if (target-i_number == EXT2_ROOTINO)
+   if (target-i_number == EXT2_ROOTINO) {
+   error = 0;
goto out;
+   }
 
for (;;) {
if (vp-v_type != VDIR) {
___
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: r246353 - head/sys/arm/allwinner

2013-02-04 Thread Ganbold Tsagaankhuu
Author: ganbold (doc committer)
Date: Tue Feb  5 04:13:34 2013
New Revision: 246353
URL: http://svnweb.freebsd.org/changeset/base/246353

Log:
  Remove two dead assignments and
  make use of sc more explicit and clear
  
  Submitted by: Christoph Mallon
  Approved by: gonzo@

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

Modified: head/sys/arm/allwinner/a10_clk.c
==
--- head/sys/arm/allwinner/a10_clk.cTue Feb  5 03:26:34 2013
(r246352)
+++ head/sys/arm/allwinner/a10_clk.cTue Feb  5 04:13:34 2013
(r246353)
@@ -62,10 +62,10 @@ struct a10_ccm_softc {
 
 static struct a10_ccm_softc *a10_ccm_sc = NULL;
 
-#define ccm_read_4(reg)\
-   bus_space_read_4(a10_ccm_sc-bst, a10_ccm_sc-bsh, reg)
-#define ccm_write_4(reg, val)  \
-   bus_space_write_4(a10_ccm_sc-bst, a10_ccm_sc-bsh, reg, val)
+#define ccm_read_4(sc, reg)\
+   bus_space_read_4((sc)-bst, (sc)-bsh, (reg))
+#define ccm_write_4(sc, reg, val)  \
+   bus_space_write_4((sc)-bst, (sc)-bsh, (reg), (val))
 
 static int
 a10_ccm_probe(device_t dev)
@@ -121,24 +121,24 @@ int
 a10_clk_usb_activate(void)
 {
struct a10_ccm_softc *sc = a10_ccm_sc;
-   uint32_t reg_value = 0;
+   uint32_t reg_value;
 
if (sc == NULL)
return ENXIO;
 
/* Gating AHB clock for USB */
-   reg_value = ccm_read_4(CCM_AHB_GATING0);
+   reg_value = ccm_read_4(sc, CCM_AHB_GATING0);
reg_value |= CCM_AHB_GATING_USB0; /* AHB clock gate usb0 */
reg_value |= CCM_AHB_GATING_EHCI1; /* AHB clock gate ehci1 */
-   ccm_write_4(CCM_AHB_GATING0, reg_value);
+   ccm_write_4(sc, CCM_AHB_GATING0, reg_value);
 
/* Enable clock for USB */
-   reg_value = ccm_read_4(CCM_USB_CLK);
+   reg_value = ccm_read_4(sc, CCM_USB_CLK);
reg_value |= CCM_USB_PHY; /* USBPHY */
reg_value |= CCM_USB0_RESET; /* disable reset for USB0 */
reg_value |= CCM_USB1_RESET; /* disable reset for USB1 */
reg_value |= CCM_USB2_RESET; /* disable reset for USB2 */
-   ccm_write_4(CCM_USB_CLK, reg_value);
+   ccm_write_4(sc, CCM_USB_CLK, reg_value);
 
return (0);
 }
@@ -147,24 +147,24 @@ int
 a10_clk_usb_deactivate(void)
 {
struct a10_ccm_softc *sc = a10_ccm_sc;
-   uint32_t reg_value = 0;
+   uint32_t reg_value;
 
if (sc == NULL)
return ENXIO;
 
/* Disable clock for USB */
-   reg_value = ccm_read_4(CCM_USB_CLK);
+   reg_value = ccm_read_4(sc, CCM_USB_CLK);
reg_value = ~CCM_USB_PHY; /* USBPHY */
reg_value = ~CCM_USB0_RESET; /* reset for USB0 */
reg_value = ~CCM_USB1_RESET; /* reset for USB1 */
reg_value = ~CCM_USB2_RESET; /* reset for USB2 */
-   ccm_write_4(CCM_USB_CLK, reg_value);
+   ccm_write_4(sc, CCM_USB_CLK, reg_value);
 
/* Disable gating AHB clock for USB */
-   reg_value = ccm_read_4(CCM_AHB_GATING0);
+   reg_value = ccm_read_4(sc, CCM_AHB_GATING0);
reg_value = ~CCM_AHB_GATING_USB0; /* disable AHB clock gate usb0 */
reg_value = ~CCM_AHB_GATING_EHCI1; /* disable AHB clock gate ehci1 */
-   ccm_write_4(CCM_AHB_GATING0, reg_value);
+   ccm_write_4(sc, CCM_AHB_GATING0, reg_value);
 
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: r246354 - head/share/mk

2013-02-04 Thread Andrew Turner
Author: andrew
Date: Tue Feb  5 05:16:02 2013
New Revision: 246354
URL: http://svnweb.freebsd.org/changeset/base/246354

Log:
  Build clang for little-endian arm by default. Due to size issues when built
  with gcc disable CLANG_FULL for now.

Modified:
  head/share/mk/bsd.own.mk

Modified: head/share/mk/bsd.own.mk
==
--- head/share/mk/bsd.own.mkTue Feb  5 04:13:34 2013(r246353)
+++ head/share/mk/bsd.own.mkTue Feb  5 05:16:02 2013(r246354)
@@ -389,9 +389,13 @@ __T=${TARGET_ARCH}
 .else
 __T=${MACHINE_ARCH}
 .endif
-# Clang is only for x86 and powerpc right now, by default.
+# Clang is only for x86, powerpc and little-endian arm right now, by default.
 .if ${__T} == amd64 || ${__T} == i386 || ${__T:Mpowerpc*}
 __DEFAULT_YES_OPTIONS+=CLANG CLANG_FULL
+.elif ${__T} == arm || ${__T} == armv6
+__DEFAULT_YES_OPTIONS+=CLANG
+# GCC is unable to build the full clang on arm, disable it by default.
+__DEFAULT_NO_OPTIONS+=CLANG_FULL
 .else
 __DEFAULT_NO_OPTIONS+=CLANG CLANG_FULL
 .endif
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


Re: svn commit: r246251 - head/sys/dev/acpica

2013-02-04 Thread Alexey Dokuchaev
On Sun, Feb 03, 2013 at 12:23:25PM +0200, Andriy Gapon wrote:
 on 02/02/2013 17:11 Alexey Dokuchaev said the following:
  On Sat, Feb 02, 2013 at 12:51:22PM +, Alexey Dokuchaev wrote:
  On Sat, Feb 02, 2013 at 12:44:20PM +, Andriy Gapon wrote:
  New Revision: 246251
  URL: http://svnweb.freebsd.org/changeset/base/246251
 
  Log:
acpi: clear power button status bit after waking up...
so that it is not confused for a new power off request.
  
  Andriy, it appears to me that ACPI code is substantially different between
  8-stable and head, so the patch cannot be applied as is. [...]
 
 P.S. logically the new block of code seems to belong to acpi_sleep_machdep()
 before intr_restore() call.

OK, thanks, I will try to cook something up and report how would it go.

./danfe
___
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: r245848 - head/sys/boot/i386/libi386

2013-02-04 Thread Sergey Kandaurov
On 4 February 2013 23:46, John Baldwin j...@freebsd.org wrote:
 On Monday, February 04, 2013 4:43:36 am Sergey Kandaurov wrote:
 On 23 January 2013 22:34, John Baldwin j...@freebsd.org wrote:
  Author: jhb
  Date: Wed Jan 23 18:34:21 2013
  New Revision: 245848
  URL: http://svnweb.freebsd.org/changeset/base/245848
 
  Log:
Always update the hw.uart.console hint anytime a change is made to the
comconsole setup.  Previously the hint would be set when if you set a
custom port, but it would not be updated if you later set a custom speed.
 
Also, leave the hw.uart.console hint mutable so it can be overridden or
unset by the user if needed.
 
Reviewed by:  kib (earlier version)
MFC after:1 week

 Looks like this results in something wrong.
 I have a serial console at COM2 (uart1), but it chooses uart0
 (1016 == 0x3F8), compare .flags and the final hw.uart.console value.

 Do you have a working console in the loader?  It is setting the hint based
 on what the loader uses.  I use this to use COM2 for both loader and
 kernel:

 console=comconsole vidconsole
 comconsole_port=0x2f8

Yep, with new changes I still have a working console in the loader.
I don't see output starting from kernel boot until login prompt.

 Note that when hw.uart.console is set, any flags set in hint.uart.X.flags
 to set the console are ignored.  If you are not using -h in /boot.config or
 setting 'console' for the loader to enable a serial console then the loader
 should not be setting hw.uart.console (if it is, that is a bug to be fixed).
 However, configuring the kernel to use a different serial console from the
 loader seems very odd.  You should be able to manually set hw.uart.console in
 loader.conf if you are doing that.

Err.. No, I haven't set hw.uart.console. Sorry for being misleading.
The cited snippet from my previous mail was to demonstrate how the
resulting hw.uart.console value depends (or rather not :)) on hints.
All I have (changed) wrt console is:

/boot/device.hints
#hint.uart.0.flags=0x10
hint.uart.1.flags=0x10

/boot/loader.conf
boot_multicons=YES
boot_serial=YES
boot_verbose=YES
console=comconsole,vidconsole

This setup worked for ages. To isolate this problem I took /boot/loader
from my older current machine (also with COM2) to replace it here,
and it started to work again.

-- 
wbr,
pluknet
___
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