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

2013-08-30 Thread Konstantin Belousov
Author: kib
Date: Fri Aug 30 07:37:45 2013
New Revision: 255057
URL: http://svnweb.freebsd.org/changeset/base/255057

Log:
  Move the definition of the struct unrhdr into a separate header file,
  to allow embedding the struct.  Add init_unrhdr(9) initializer, which
  sets up preallocated unrhdr.
  
  Reviewed by:  alc
  Tested by:pho, bf

Added:
  head/sys/sys/_unrhdr.h   (contents, props changed)
Modified:
  head/sys/kern/subr_unit.c
  head/sys/sys/systm.h

Modified: head/sys/kern/subr_unit.c
==
--- head/sys/kern/subr_unit.c   Fri Aug 30 06:21:00 2013(r255056)
+++ head/sys/kern/subr_unit.c   Fri Aug 30 07:37:45 2013(r255057)
@@ -68,8 +68,8 @@
  */
 
 #include 
-#include 
 #include 
+#include 
 
 #ifdef _KERNEL
 
@@ -187,22 +187,6 @@ CTASSERT(sizeof(struct unr) == sizeof(st
 /* Number of bits in the bitmap */
 #define NBITS  ((int)sizeof(((struct unrb *)NULL)->map) * 8)
 
-/* Header element for a unr number space. */
-
-struct unrhdr {
-   TAILQ_HEAD(unrhd,unr)   head;
-   u_int   low;/* Lowest item */
-   u_int   high;   /* Highest item */
-   u_int   busy;   /* Count of allocated items */
-   u_int   alloc;  /* Count of memory allocations */
-   u_int   first;  /* items in allocated from start */
-   u_int   last;   /* items free at end */
-   struct mtx  *mtx;
-   TAILQ_HEAD(unrfr,unr)   ppfree; /* Items to be freed after mtx
-  lock dropped */
-};
-
-
 #if defined(DIAGNOSTIC) || !defined(_KERNEL)
 /*
  * Consistency check function.
@@ -315,20 +299,12 @@ clean_unrhdr(struct unrhdr *uh)
mtx_unlock(uh->mtx);
 }
 
-/*
- * Allocate a new unrheader set.
- *
- * Highest and lowest valid values given as parameters.
- */
-
-struct unrhdr *
-new_unrhdr(int low, int high, struct mtx *mutex)
+void
+init_unrhdr(struct unrhdr *uh, int low, int high, struct mtx *mutex)
 {
-   struct unrhdr *uh;
 
KASSERT(low >= 0 && low <= high,
("UNR: use error: new_unrhdr(%d, %d)", low, high));
-   uh = Malloc(sizeof *uh);
if (mutex != NULL)
uh->mtx = mutex;
else
@@ -340,6 +316,21 @@ new_unrhdr(int low, int high, struct mtx
uh->first = 0;
uh->last = 1 + (high - low);
check_unrhdr(uh, __LINE__);
+}
+
+/*
+ * Allocate a new unrheader set.
+ *
+ * Highest and lowest valid values given as parameters.
+ */
+
+struct unrhdr *
+new_unrhdr(int low, int high, struct mtx *mutex)
+{
+   struct unrhdr *uh;
+
+   uh = Malloc(sizeof *uh);
+   init_unrhdr(uh, low, high, mutex);
return (uh);
 }
 

Added: head/sys/sys/_unrhdr.h
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/sys/_unrhdr.h  Fri Aug 30 07:37:45 2013(r255057)
@@ -0,0 +1,51 @@
+/*-
+ * Copyright (c) 2004 Poul-Henning Kamp
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _SYS_UNRHDR_H
+#define _SYS_UNRHDR_H
+
+#include 
+
+struct mtx;
+
+/* Header element for a unr number space. */
+
+struct unrhdr {
+   TAILQ_HEAD(unrhd,unr)   head;
+   u_int   low;/* Lowest item */
+   u_int   high;   /* Highest item */
+   u_int   busy;   /* Count of allocated items */
+   u_int   alloc;  /* Count of memory allocations */
+   u_int   first;  /* items in allocated from start */
+   u_int

svn commit: r255058 - head/sys/amd64/include

2013-08-30 Thread Konstantin Belousov
Author: kib
Date: Fri Aug 30 07:42:38 2013
New Revision: 255058
URL: http://svnweb.freebsd.org/changeset/base/255058

Log:
  Provide a wrapper for the INVPCID instruction, definition of the
  descriptor and symbolic names for the operation types.
  
  Sponsored by: The FreeBSD Foundation
  Reviewed by:  alc
  Tested by:pho, bf

Modified:
  head/sys/amd64/include/cpufunc.h

Modified: head/sys/amd64/include/cpufunc.h
==
--- head/sys/amd64/include/cpufunc.hFri Aug 30 07:37:45 2013
(r255057)
+++ head/sys/amd64/include/cpufunc.hFri Aug 30 07:42:38 2013
(r255058)
@@ -472,6 +472,26 @@ invlpg(u_long addr)
__asm __volatile("invlpg %0" : : "m" (*(char *)addr) : "memory");
 }
 
+#defineINVPCID_ADDR0
+#defineINVPCID_CTX 1
+#defineINVPCID_CTXGLOB 2
+#defineINVPCID_ALLCTX  3
+
+struct invpcid_descr {
+   uint64_tpcid:12 __packed;
+   uint64_tpad:52 __packed;
+   uint64_taddr;
+} __packed;
+
+static __inline void
+invpcid(struct invpcid_descr *d, int type)
+{
+
+   /* invpcid (%rdx),%rax */
+   __asm __volatile(".byte 0x66,0x0f,0x38,0x82,0x02"
+   : : "d" (d), "a" ((u_long)type) : "memory");
+}
+
 static __inline u_short
 rfs(void)
 {
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r255059 - head/sys/sys

2013-08-30 Thread Konstantin Belousov
Author: kib
Date: Fri Aug 30 07:43:34 2013
New Revision: 255059
URL: http://svnweb.freebsd.org/changeset/base/255059

Log:
  Add BIT_AND_ATOMIC() and CPU_AND_ATOMIC().
  
  Sponsored by: The FreeBSD Foundation
  Reviewed by:  alc
  Tested by:pho, bf

Modified:
  head/sys/sys/bitset.h
  head/sys/sys/cpuset.h

Modified: head/sys/sys/bitset.h
==
--- head/sys/sys/bitset.h   Fri Aug 30 07:42:38 2013(r255058)
+++ head/sys/sys/bitset.h   Fri Aug 30 07:43:34 2013(r255059)
@@ -135,7 +135,14 @@
atomic_set_long(&(p)->__bits[__bitset_word(_s, n)], \
__bitset_mask((_s), n))
 
-/* Convenience functions catering special cases. */ 
+/* Convenience functions catering special cases. */
+#defineBIT_AND_ATOMIC(_s, d, s) do {   
\
+   __size_t __i;   \
+   for (__i = 0; __i < __bitset_words((_s)); __i++)\
+   atomic_clear_long(&(d)->__bits[__i],\
+   ~(s)->__bits[__i]); \
+} while (0)
+
 #defineBIT_OR_ATOMIC(_s, d, s) do {
\
__size_t __i;   \
for (__i = 0; __i < __bitset_words((_s)); __i++)\

Modified: head/sys/sys/cpuset.h
==
--- head/sys/sys/cpuset.h   Fri Aug 30 07:42:38 2013(r255058)
+++ head/sys/sys/cpuset.h   Fri Aug 30 07:43:34 2013(r255059)
@@ -55,6 +55,7 @@
 #defineCPU_NAND(d, s)  BIT_NAND(CPU_SETSIZE, d, s)
 #defineCPU_CLR_ATOMIC(n, p)BIT_CLR_ATOMIC(CPU_SETSIZE, n, 
p)
 #defineCPU_SET_ATOMIC(n, p)BIT_SET_ATOMIC(CPU_SETSIZE, n, 
p)
+#defineCPU_AND_ATOMIC(n, p)BIT_AND_ATOMIC(CPU_SETSIZE, n, 
p)
 #defineCPU_OR_ATOMIC(d, s) BIT_OR_ATOMIC(CPU_SETSIZE, d, s)
 #defineCPU_COPY_STORE_REL(f, t)BIT_COPY_STORE_REL(CPU_SETSIZE, 
f, t)
 #defineCPU_FFS(p)  BIT_FFS(CPU_SETSIZE, p)
___
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: r255060 - in head/sys/amd64: amd64 include

2013-08-30 Thread Konstantin Belousov
Author: kib
Date: Fri Aug 30 07:59:49 2013
New Revision: 255060
URL: http://svnweb.freebsd.org/changeset/base/255060

Log:
  Implement support for the process-context identifiers ('PCID') on
  Intel CPUs.  The feature tags TLB entries with the Id of the address
  space and allows to avoid TLB invalidation on the context switch, it
  is available only in the long mode.  In the microbenchmarks, using the
  PCID decreased latency of the context switches by ~30% on SandyBridge
  class desktop CPUs, measured with the lat_ctx program from lmbench.
  
  If available, use INVPCID instruction when a TLB entry in non-current
  address space needs to be invalidated.  The instruction is typically
  available on the Haswell.
  
  If needed, the use of PCID can be turned off with the
  vm.pmap.pcid_enabled loader tunable set to 0.  The state of the
  feature is reported by the vm.pmap.pcid_enabled sysctl.  The sysctl
  vm.pmap.pcid_save_cnt reports the number of context switches which
  avoided invalidating the TLB; compare with the total number of context
  switches, available as sysctl vm.stats.sys.v_swtch.
  
  Sponsored by: The FreeBSD Foundation
  Reviewed by:  alc
  Tested by:pho, bf

Modified:
  head/sys/amd64/amd64/apic_vector.S
  head/sys/amd64/amd64/cpu_switch.S
  head/sys/amd64/amd64/genassym.c
  head/sys/amd64/amd64/machdep.c
  head/sys/amd64/amd64/mp_machdep.c
  head/sys/amd64/amd64/pmap.c
  head/sys/amd64/amd64/vm_machdep.c
  head/sys/amd64/include/pcpu.h
  head/sys/amd64/include/pmap.h
  head/sys/amd64/include/smp.h

Modified: head/sys/amd64/amd64/apic_vector.S
==
--- head/sys/amd64/amd64/apic_vector.S  Fri Aug 30 07:43:34 2013
(r255059)
+++ head/sys/amd64/amd64/apic_vector.S  Fri Aug 30 07:59:49 2013
(r255060)
@@ -43,6 +43,12 @@
 
 #include "assym.s"
 
+#ifdef SMP
+#define LK lock ;
+#else
+#define LK
+#endif
+
 /*
  * I/O Interrupt Entry Point.  Rather than having one entry point for
  * each interrupt source, we use one entry point for each 32-bit word
@@ -149,6 +155,38 @@ IDTVEC(xen_intr_upcall)
  * Global address space TLB shootdown.
  */
.text
+
+#defineNAKE_INTR_CS24
+
+   SUPERALIGN_TEXT
+global_invltlb:
+   movl%cr4,%eax
+   andl$~0x80,%eax
+   movl%eax,%cr4
+   orl $0x80,%eax
+   movl%eax,%cr4
+invltlb_ret_clear_pm_save:
+   movqsmp_tlb_pmap,%rdx
+   testq   %rdx,%rdx
+   jz  invltlb_ret
+   testb   $SEL_RPL_MASK,NAKE_INTR_CS(%rsp)
+   jz  1f
+   swapgs
+1:
+   movlPCPU(CPUID),%eax
+   jz  2f
+   swapgs
+2:
+   LK btcl %eax,PM_SAVE(%rdx)
+   SUPERALIGN_TEXT
+invltlb_ret:
+   movqlapic, %rax
+   movl$0, LA_EOI(%rax)/* End Of Interrupt to APIC */
+   LK incl smp_tlb_wait
+   popq%rdx
+   popq%rax
+   jmp doreti_iret
+
SUPERALIGN_TEXT
 IDTVEC(invltlb)
 #if defined(COUNT_XINVLTLB_HITS) || defined(COUNT_IPIS)
@@ -165,18 +203,44 @@ IDTVEC(invltlb)
 #endif
 
pushq   %rax
+   pushq   %rdx
 
-   movq%cr3, %rax  /* invalidate the TLB */
-   movq%rax, %cr3
-
-   movqlapic, %rax
-   movl$0, LA_EOI(%rax)/* End Of Interrupt to APIC */
-
-   lock
-   inclsmp_tlb_wait
-
-   popq%rax
-   jmp doreti_iret
+   movq%cr3,%rax
+   cmpl$0,pmap_pcid_enabled
+   je  2f
+
+   movq$smp_tlb_invpcid,%rdx
+   cmpl$0,(%rdx)
+   je  global_invltlb
+   cmpl$-1,(%rdx)
+   je  global_invltlb
+
+   /*
+* Non-zero smp_tlb_invpcid, only invalidate TLB for entries with
+* current PCID.
+*/
+   cmpl$0,invpcid_works
+   je  1f
+   /* Use invpcid if available. */
+   movl$1,%eax /* INVPCID_CTX */
+   /* invpcid (%rdx),%rax */
+   .byte 0x66,0x0f,0x38,0x82,0x02
+   jmp invltlb_ret_clear_pm_save
+1:
+   /* Otherwise reload %cr3 twice. */
+   movqpcid_cr3,%rdx
+   cmpq%rax,%rdx
+   je  2f
+   movq%rdx,%cr3   /* Invalidate, bit 63 is zero. */
+   btsq$63,%rax
+
+   /*
+* Invalidate the TLB if PCID is not enabled.
+* Restore the old address space.
+*/
+2:
+   movq%rax,%cr3
+   jmp invltlb_ret_clear_pm_save
 
 /*
  * Single page TLB shootdown
@@ -198,18 +262,54 @@ IDTVEC(invlpg)
 #endif
 
pushq   %rax
-
-   movqsmp_tlb_addr1, %rax
-   invlpg  (%rax)  /* invalidate single page */
-
-   movqlapic, %rax
-   movl$0, LA_EOI(%rax)/* End Of Interrupt to APIC */
-
-   lock
-   inclsmp_tlb_wait
-
-   popq%rax
-   jmp doreti_iret
+   pushq   %rdx
+   movq$smp_tlb_invpcid,%rdx
+   cmpl$0,pmap_pcid_enabled
+   je  3f
+   cmpl$0,invpcid_w

svn commit: r255064 - head/sbin/etherswitchcfg

2013-08-30 Thread Sergey Kandaurov
Author: pluknet
Date: Fri Aug 30 10:01:19 2013
New Revision: 255064
URL: http://svnweb.freebsd.org/changeset/base/255064

Log:
  Typo in strtol(3).
  
  Noticed by:   bde

Modified:
  head/sbin/etherswitchcfg/etherswitchcfg.8

Modified: head/sbin/etherswitchcfg/etherswitchcfg.8
==
--- head/sbin/etherswitchcfg/etherswitchcfg.8   Fri Aug 30 08:38:04 2013
(r255063)
+++ head/sbin/etherswitchcfg/etherswitchcfg.8   Fri Aug 30 10:01:19 2013
(r255064)
@@ -69,7 +69,7 @@ is usually the port number, and
 is the register number.
 Both can be provided as decimal, octal or hexadecimal numbers in any of the 
formats
 understood by
-.Xr strtol 4 .
+.Xr strtol 3 .
 To set the register value, use the form instance.register=value.
 .Ss port
 The port command selects one of the ports of the switch.
___
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: r255067 - head/sys/kern

2013-08-30 Thread Hans Petter Selasky
Author: hselasky
Date: Fri Aug 30 10:39:56 2013
New Revision: 255067
URL: http://svnweb.freebsd.org/changeset/base/255067

Log:
  Simplify pause_sbt() logic. Don't call DELAY() if remainder is less
  than or equal to zero.

Modified:
  head/sys/kern/kern_synch.c

Modified: head/sys/kern/kern_synch.c
==
--- head/sys/kern/kern_synch.c  Fri Aug 30 10:10:22 2013(r255066)
+++ head/sys/kern/kern_synch.c  Fri Aug 30 10:39:56 2013(r255067)
@@ -356,10 +356,7 @@ msleep_spin_sbt(void *ident, struct mtx 
 int
 pause_sbt(const char *wmesg, sbintime_t sbt, sbintime_t pr, int flags)
 {
-   int sbt_sec;
-
-   sbt_sec = sbintime_getsec(sbt);
-   KASSERT(sbt_sec >= 0, ("pause: timo must be >= 0"));
+   KASSERT(sbt >= 0, ("pause: timeout must be >= 0"));
 
/* silently convert invalid timeouts */
if (sbt == 0)
@@ -370,11 +367,14 @@ pause_sbt(const char *wmesg, sbintime_t 
 * We delay one second at a time to avoid overflowing the
 * system specific DELAY() function(s):
 */
-   while (sbt_sec > 0) {
+   while (sbt >= SBT_1S) {
DELAY(100);
-   sbt_sec--;
+   sbt -= SBT_1S;
}
-   DELAY((sbt & 0x) / SBT_1US);
+   /* Do the delay remainder, if any */
+   sbt = (sbt + SBT_1US - 1) / SBT_1US;
+   if (sbt > 0)
+   DELAY(sbt);
return (0);
}
return (_sleep(&pause_wchan[curcpu], NULL, 0, wmesg, sbt, pr, flags));
___
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: r255068 - head/bin/sh

2013-08-30 Thread Jilles Tjoelker
Author: jilles
Date: Fri Aug 30 10:45:02 2013
New Revision: 255068
URL: http://svnweb.freebsd.org/changeset/base/255068

Log:
  sh: Cast -1 to pointer rather than pointer to variable of wrong type.
  
  NEOF needs to be a non-null pointer distinct from valid union node pointers.
  It is not dereferenced.
  
  The new NEOF is much like SIG_ERR except that it is an object pointer
  instead of a function pointer.
  
  The variable tokpushback can now be static.

Modified:
  head/bin/sh/parser.c
  head/bin/sh/parser.h

Modified: head/bin/sh/parser.c
==
--- head/bin/sh/parser.cFri Aug 30 10:39:56 2013(r255067)
+++ head/bin/sh/parser.cFri Aug 30 10:45:02 2013(r255068)
@@ -96,7 +96,7 @@ static struct heredoc *heredoclist;   /* l
 static int doprompt;   /* if set, prompt the user */
 static int needprompt; /* true if interactive and at start of line */
 static int lasttoken;  /* last token read */
-int tokpushback;   /* last token pushed back */
+static int tokpushback;/* last token pushed back */
 static char *wordtext; /* text of last word returned by readtoken */
 static int checkkwd;
 static struct nodelist *backquotelist;

Modified: head/bin/sh/parser.h
==
--- head/bin/sh/parser.hFri Aug 30 10:39:56 2013(r255067)
+++ head/bin/sh/parser.hFri Aug 30 10:45:02 2013(r255068)
@@ -68,11 +68,9 @@
 
 /*
  * NEOF is returned by parsecmd when it encounters an end of file.  It
- * must be distinct from NULL, so we use the address of a variable that
- * happens to be handy.
+ * must be distinct from NULL.
  */
-extern int tokpushback;
-#define NEOF ((union node *)&tokpushback)
+#define NEOF ((union node *)-1)
 extern int whichprompt;/* 1 == PS1, 2 == PS2 */
 extern const char *const parsekwd[];
 
___
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: r255069 - head/lib/libutil

2013-08-30 Thread Sergey Kandaurov
Author: pluknet
Date: Fri Aug 30 11:21:52 2013
New Revision: 255069
URL: http://svnweb.freebsd.org/changeset/base/255069

Log:
  The round of expand_number() cleanups.
  o Fix range error checking to detect overflow when uint64_t < uintmax_t.
  o Remove a non-functional check for no valid digits as pointed out by Bruce.
  o Remove a rather pointless comment describing what the function does.
  o Clean up a bunch of style bugs.
  
  Brucified by: bde

Modified:
  head/lib/libutil/expand_number.c

Modified: head/lib/libutil/expand_number.c
==
--- head/lib/libutil/expand_number.cFri Aug 30 10:45:02 2013
(r255068)
+++ head/lib/libutil/expand_number.cFri Aug 30 11:21:52 2013
(r255069)
@@ -35,42 +35,24 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-/*
- * Convert an expression of the following forms to a uint64_t.
- * 1) A positive decimal number.
- * 2) A positive decimal number followed by a 'b' or 'B' (mult by 1).
- * 3) A positive decimal number followed by a 'k' or 'K' (mult by 1 << 10).
- * 4) A positive decimal number followed by a 'm' or 'M' (mult by 1 << 20).
- * 5) A positive decimal number followed by a 'g' or 'G' (mult by 1 << 30).
- * 6) A positive decimal number followed by a 't' or 'T' (mult by 1 << 40).
- * 7) A positive decimal number followed by a 'p' or 'P' (mult by 1 << 50).
- * 8) A positive decimal number followed by a 'e' or 'E' (mult by 1 << 60).
- */
 int
 expand_number(const char *buf, uint64_t *num)
 {
+   char *endptr;
+   uintmax_t umaxval;
uint64_t number;
-   int saved_errno;
unsigned shift;
-   char *endptr;
+   int serrno;
 
-   saved_errno = errno;
+   serrno = errno;
errno = 0;
-
-   number = strtoumax(buf, &endptr, 0);
-
-   if (number == UINTMAX_MAX && errno == ERANGE) {
-   return (-1);
-   }
-
-   if (errno == 0)
-   errno = saved_errno;
-
-   if (endptr == buf) {
-   /* No valid digits. */
-   errno = EINVAL;
+   umaxval = strtoumax(buf, &endptr, 0);
+   if (umaxval > UINT64_MAX)
+   errno = ERANGE;
+   if (errno != 0)
return (-1);
-   }
+   errno = serrno;
+   number = umaxval;
 
switch (tolower((unsigned char)*endptr)) {
case 'e':
@@ -106,7 +88,6 @@ expand_number(const char *buf, uint64_t 
errno = ERANGE;
return (-1);
}
-
*num = number << shift;
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: r255072 - in head: bin/sh tools/regression/bin/sh/builtins

2013-08-30 Thread Jilles Tjoelker
Author: jilles
Date: Fri Aug 30 12:09:59 2013
New Revision: 255072
URL: http://svnweb.freebsd.org/changeset/base/255072

Log:
  sh: Recognize "--" as end of options in type builtin.
  
  This implementation makes minimal changes: command names starting with "-"
  (other than "--") can still be queried normally.

Added:
  head/tools/regression/bin/sh/builtins/type3.0   (contents, props changed)
Modified:
  head/bin/sh/exec.c

Modified: head/bin/sh/exec.c
==
--- head/bin/sh/exec.c  Fri Aug 30 11:42:57 2013(r255071)
+++ head/bin/sh/exec.c  Fri Aug 30 12:09:59 2013(r255072)
@@ -762,5 +762,7 @@ typecmd_impl(int argc, char **argv, int 
 int
 typecmd(int argc, char **argv)
 {
+   if (argc > 2 && strcmp(argv[1], "--") == 0)
+   argc--, argv++;
return typecmd_impl(argc, argv, TYPECMD_TYPE, bltinlookup("PATH", 1));
 }

Added: head/tools/regression/bin/sh/builtins/type3.0
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/tools/regression/bin/sh/builtins/type3.0   Fri Aug 30 12:09:59 
2013(r255072)
@@ -0,0 +1,3 @@
+# $FreeBSD$
+
+[ "$(type type)" = "$(type -- type)" ]
___
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: r255073 - head/bin/sh

2013-08-30 Thread Jilles Tjoelker
Author: jilles
Date: Fri Aug 30 13:25:15 2013
New Revision: 255073
URL: http://svnweb.freebsd.org/changeset/base/255073

Log:
  sh: Add a function for the case where one token is required in the parse.

Modified:
  head/bin/sh/parser.c

Modified: head/bin/sh/parser.c
==
--- head/bin/sh/parser.cFri Aug 30 12:09:59 2013(r255072)
+++ head/bin/sh/parser.cFri Aug 30 13:25:15 2013(r255073)
@@ -121,6 +121,7 @@ static int readtoken(void);
 static int xxreadtoken(void);
 static int readtoken1(int, const char *, const char *, int);
 static int noexpand(char *);
+static void consumetoken(int);
 static void synexpect(int) __dead2;
 static void synerror(const char *) __dead2;
 static void setprompt(int);
@@ -413,8 +414,7 @@ command(void)
n1->type = NIF;
if ((n1->nif.test = list(0, 0)) == NULL)
synexpect(-1);
-   if (readtoken() != TTHEN)
-   synexpect(TTHEN);
+   consumetoken(TTHEN);
n1->nif.ifpart = list(0, 0);
n2 = n1;
while (readtoken() == TELIF) {
@@ -423,8 +423,7 @@ command(void)
n2->type = NIF;
if ((n2->nif.test = list(0, 0)) == NULL)
synexpect(-1);
-   if (readtoken() != TTHEN)
-   synexpect(TTHEN);
+   consumetoken(TTHEN);
n2->nif.ifpart = list(0, 0);
}
if (lasttoken == TELSE)
@@ -433,27 +432,20 @@ command(void)
n2->nif.elsepart = NULL;
tokpushback++;
}
-   if (readtoken() != TFI)
-   synexpect(TFI);
+   consumetoken(TFI);
checkkwd = CHKKWD | CHKALIAS;
break;
case TWHILE:
-   case TUNTIL: {
-   int got;
+   case TUNTIL:
n1 = (union node *)stalloc(sizeof (struct nbinary));
n1->type = (lasttoken == TWHILE)? NWHILE : NUNTIL;
if ((n1->nbinary.ch1 = list(0, 0)) == NULL)
synexpect(-1);
-   if ((got=readtoken()) != TDO) {
-TRACE(("expecting DO got %s %s\n", tokname[got], got == TWORD ? wordtext : 
""));
-   synexpect(TDO);
-   }
+   consumetoken(TDO);
n1->nbinary.ch2 = list(0, 0);
-   if (readtoken() != TDONE)
-   synexpect(TDONE);
+   consumetoken(TDONE);
checkkwd = CHKKWD | CHKALIAS;
break;
-   }
case TFOR:
if (readtoken() != TWORD || quoteflag || ! goodname(wordtext))
synerror("Bad for loop variable");
@@ -501,15 +493,13 @@ TRACE(("expecting DO got %s %s\n", tokna
else
synexpect(-1);
n1->nfor.body = list(0, 0);
-   if (readtoken() != t)
-   synexpect(t);
+   consumetoken(t);
checkkwd = CHKKWD | CHKALIAS;
break;
case TCASE:
n1 = (union node *)stalloc(sizeof (struct ncase));
n1->type = NCASE;
-   if (readtoken() != TWORD)
-   synexpect(TWORD);
+   consumetoken(TWORD);
n1->ncase.expr = n2 = (union node *)stalloc(sizeof (struct 
narg));
n2->type = NARG;
n2->narg.text = wordtext;
@@ -562,15 +552,13 @@ TRACE(("expecting DO got %s %s\n", tokna
n1->type = NSUBSHELL;
n1->nredir.n = list(0, 0);
n1->nredir.redirect = NULL;
-   if (readtoken() != TRP)
-   synexpect(TRP);
+   consumetoken(TRP);
checkkwd = CHKKWD | CHKALIAS;
is_subshell = 1;
break;
case TBEGIN:
n1 = list(0, 0);
-   if (readtoken() != TEND)
-   synexpect(TEND);
+   consumetoken(TEND);
checkkwd = CHKKWD | CHKALIAS;
break;
/* A simple command must have at least one redirection or word. */
@@ -659,8 +647,7 @@ simplecmd(union node **rpp, union node *
} else if (lasttoken == TLP && app == &args->narg.next
&& rpp == orig_rpp) {
/* We have a function */
-   if (readtoken() != TRP)
-   synexpect(TRP);
+   consumetoken(TRP);
funclinno = plinno;
/*
 * - Require plain text.
@@ -734,8 +721,7 @@ parsefname(void)
 {
union node *n = redirnode;
 
-   if (readtoke

Re: svn commit: r255067 - head/sys/kern

2013-08-30 Thread Andriy Gapon
on 30/08/2013 13:39 Hans Petter Selasky said the following:
> Author: hselasky
> Date: Fri Aug 30 10:39:56 2013
> New Revision: 255067
> URL: http://svnweb.freebsd.org/changeset/base/255067
> 
> Log:
>   Simplify pause_sbt() logic. Don't call DELAY() if remainder is less
>   than or equal to zero.

Discussed with?
Reviewed by?
Tested by?

Asking just because this change seems to be outside of your typical area and in
the quite important infrastructural code.

> Modified:
>   head/sys/kern/kern_synch.c
> 
> Modified: head/sys/kern/kern_synch.c
> ==
> --- head/sys/kern/kern_synch.cFri Aug 30 10:10:22 2013
> (r255066)
> +++ head/sys/kern/kern_synch.cFri Aug 30 10:39:56 2013
> (r255067)
> @@ -356,10 +356,7 @@ msleep_spin_sbt(void *ident, struct mtx 
>  int
>  pause_sbt(const char *wmesg, sbintime_t sbt, sbintime_t pr, int flags)
>  {
> - int sbt_sec;
> -
> - sbt_sec = sbintime_getsec(sbt);
> - KASSERT(sbt_sec >= 0, ("pause: timo must be >= 0"));
> + KASSERT(sbt >= 0, ("pause: timeout must be >= 0"));
>  
>   /* silently convert invalid timeouts */
>   if (sbt == 0)
> @@ -370,11 +367,14 @@ pause_sbt(const char *wmesg, sbintime_t 
>* We delay one second at a time to avoid overflowing the
>* system specific DELAY() function(s):
>*/
> - while (sbt_sec > 0) {
> + while (sbt >= SBT_1S) {
>   DELAY(100);
> - sbt_sec--;
> + sbt -= SBT_1S;
>   }
> - DELAY((sbt & 0x) / SBT_1US);
> + /* Do the delay remainder, if any */
> + sbt = (sbt + SBT_1US - 1) / SBT_1US;
> + if (sbt > 0)
> + DELAY(sbt);
>   return (0);
>   }
>   return (_sleep(&pause_wchan[curcpu], NULL, 0, wmesg, sbt, pr, flags));
> 


-- 
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: r255067 - head/sys/kern

2013-08-30 Thread Hans Petter Selasky

On 08/30/13 15:37, Andriy Gapon wrote:

on 30/08/2013 13:39 Hans Petter Selasky said the following:

Author: hselasky
Date: Fri Aug 30 10:39:56 2013
New Revision: 255067
URL: http://svnweb.freebsd.org/changeset/base/255067

Log:
   Simplify pause_sbt() logic. Don't call DELAY() if remainder is less
   than or equal to zero.


Discussed with?
Reviewed by?
Tested by?



Hi,

I've checked MAINTAINERS first.

A patch was sent to the freebsd-current mailing list, See XHCI USB 
debugging thread.


Could probably have been discussed a bit more. The cold case logic for 
pause() is mainly used by the USB code and was factored out from 
usb_pause_mtx() a long while ago by me.


Do you see anything technically wrong about my patch?

--HPS

___
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: r255067 - head/sys/kern

2013-08-30 Thread Andriy Gapon
on 30/08/2013 16:49 Hans Petter Selasky said the following:
> On 08/30/13 15:37, Andriy Gapon wrote:
>> on 30/08/2013 13:39 Hans Petter Selasky said the following:
>>> Author: hselasky
>>> Date: Fri Aug 30 10:39:56 2013
>>> New Revision: 255067
>>> URL: http://svnweb.freebsd.org/changeset/base/255067
>>>
>>> Log:
>>>Simplify pause_sbt() logic. Don't call DELAY() if remainder is less
>>>than or equal to zero.
>>
>> Discussed with?
>> Reviewed by?
>> Tested by?
>>
> 
> Hi,
> 
> I've checked MAINTAINERS first.
> 
> A patch was sent to the freebsd-current mailing list, See XHCI USB debugging
> thread.

I noticed that you committed the patch just a few minutes after making it
public.  And later noticed that the patch did not result in any improvement.

> Could probably have been discussed a bit more.

Indeed.

> The cold case logic for pause()
> is mainly used by the USB code and was factored out from usb_pause_mtx() a 
> long
> while ago by me.

Oh, I see.

> Do you see anything technically wrong about my patch?

I don't feel qualified enough.

-- 
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: r254882 - head/sys/dev/pci

2013-08-30 Thread Jean-Sébastien Pédron
On 29.08.2013 16:07, John Baldwin wrote:
> Here is an untested cut at this, it only changes these functions and doesn't
> fix the callers to work with the returned struct resource, etc.:

I attached an updated patch including changes to pcivar.h and radeon.
However, BUS_ALLOC_RESOURCE() returns NULL in my tests.

-- 
Jean-Sébastien Pédron
diff --git a/sys/dev/drm2/radeon/radeon_bios.c b/sys/dev/drm2/radeon/radeon_bios.c
index b9ee4d1..11e9be4 100644
--- a/sys/dev/drm2/radeon/radeon_bios.c
+++ b/sys/dev/drm2/radeon/radeon_bios.c
@@ -100,6 +100,7 @@ static bool igp_read_bios_from_vram(struct radeon_device *rdev)
 
 static bool radeon_read_bios(struct radeon_device *rdev)
 {
+	struct resource *res;
 	uint8_t __iomem *bios;
 	size_t size;
 
@@ -107,10 +108,13 @@ static bool radeon_read_bios(struct radeon_device *rdev)
 
 	rdev->bios = NULL;
 	/* XXX: some cards may return 0 for rom size? ddx has a workaround */
-	bios = vga_pci_map_bios(rdev->dev, &size);
-	if (!bios) {
+	res = vga_pci_map_bios(rdev->dev);
+	DRM_INFO("%s: res=%p\n", __func__, res);
+	if (!res) {
 		return false;
 	}
+	bios = rman_get_virtual(res);
+	size = rman_get_size(res);
 	DRM_INFO("%s: Map address: %p (%zu bytes)\n", __func__, bios, size);
 
 	if (size == 0 || bios[0] != 0x55 || bios[1] != 0xaa) {
@@ -120,11 +124,11 @@ static bool radeon_read_bios(struct radeon_device *rdev)
 			DRM_INFO("%s: Incorrect BIOS signature: 0x%02X%02X\n",
 			__func__, bios[0], bios[1]);
 		}
-		vga_pci_unmap_bios(rdev->dev, bios);
+		vga_pci_unmap_bios(rdev->dev, res);
 	}
 	rdev->bios = malloc(size, DRM_MEM_DRIVER, M_WAITOK);
 	memcpy(rdev->bios, bios, size);
-	vga_pci_unmap_bios(rdev->dev, bios);
+	vga_pci_unmap_bios(rdev->dev, res);
 	return true;
 }
 
diff --git a/sys/dev/pci/pcivar.h b/sys/dev/pci/pcivar.h
index d733e3b..a8148e9 100644
--- a/sys/dev/pci/pcivar.h
+++ b/sys/dev/pci/pcivar.h
@@ -520,8 +520,8 @@ int	pci_bar_enabled(device_t dev, struct pci_map *pm);
 #define	VGA_PCI_BIOS_SHADOW_ADDR	0xC
 #define	VGA_PCI_BIOS_SHADOW_SIZE	131072
 
-int	vga_pci_is_boot_display(device_t dev);
-void *	vga_pci_map_bios(device_t dev, size_t *size);
-void	vga_pci_unmap_bios(device_t dev, void *bios);
+int			vga_pci_is_boot_display(device_t dev);
+struct resource *	vga_pci_map_bios(device_t dev);
+void			vga_pci_unmap_bios(device_t dev, struct resource *res);
 
 #endif /* _PCIVAR_H_ */
diff --git a/sys/dev/pci/vga_pci.c b/sys/dev/pci/vga_pci.c
index 94c64c0..59c954e 100644
--- a/sys/dev/pci/vga_pci.c
+++ b/sys/dev/pci/vga_pci.c
@@ -46,11 +46,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-#if defined(__amd64__) || defined(__i386__) || defined(__ia64__)
-#include 
-#include 
-#endif
-
 #include 
 #include 
 
@@ -72,95 +67,6 @@ TUNABLE_INT("hw.pci.default_vgapci_unit", &vga_pci_default_unit);
 SYSCTL_INT(_hw_pci, OID_AUTO, default_vgapci_unit, CTLFLAG_RDTUN,
 &vga_pci_default_unit, -1, "Default VGA-compatible display");
 
-int
-vga_pci_is_boot_display(device_t dev)
-{
-
-	/*
-	 * Return true if the given device is the default display used
-	 * at boot time.
-	 */
-
-	return (
-	(pci_get_class(dev) == PCIC_DISPLAY ||
-	 (pci_get_class(dev) == PCIC_OLD &&
-	  pci_get_subclass(dev) == PCIS_OLD_VGA)) &&
-	device_get_unit(dev) == vga_pci_default_unit);
-}
-
-void *
-vga_pci_map_bios(device_t dev, size_t *size)
-{
-	int rid;
-	struct resource *res;
-
-#if defined(__amd64__) || defined(__i386__) || defined(__ia64__)
-	if (vga_pci_is_boot_display(dev)) {
-		/*
-		 * On x86, the System BIOS copy the default display
-		 * device's Video BIOS at a fixed location in system
-		 * memory (0xC, 128 kBytes long) at boot time.
-		 *
-		 * We use this copy for the default boot device, because
-		 * the original ROM may not be valid after boot.
-		 */
-
-		*size = VGA_PCI_BIOS_SHADOW_SIZE;
-		return (pmap_mapbios(VGA_PCI_BIOS_SHADOW_ADDR, *size));
-	}
-#endif
-
-	rid = PCIR_BIOS;
-	res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, RF_ACTIVE);
-	if (res == NULL) {
-		return (NULL);
-	}
-
-	*size = rman_get_size(res);
-	return (rman_get_virtual(res));
-}
-
-void
-vga_pci_unmap_bios(device_t dev, void *bios)
-{
-	int rid;
-	struct resource *res;
-
-	if (bios == NULL) {
-		return;
-	}
-
-#if defined(__amd64__) || defined(__i386__) || defined(__ia64__)
-	if (vga_pci_is_boot_display(dev)) {
-		/* We mapped the BIOS shadow copy located at 0xC. */
-		pmap_unmapdev((vm_offset_t)bios, VGA_PCI_BIOS_SHADOW_SIZE);
-
-		return;
-	}
-#endif
-
-	/*
-	 * FIXME: We returned only the virtual address of the resource
-	 * to the caller. Now, to get the resource struct back, we
-	 * allocate it again: the struct exists once in memory in
-	 * device softc. Therefore, we release twice now to release the
-	 * reference we just obtained to get the structure back and the
-	 * caller's reference.
-	 */
-
-	rid = PCIR_BIOS;
-	res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, RF_ACTIVE);
-
-	KASSERT(res != NULL,
-	("%s: Can't get BIOS resource back", __func__))

Re: svn commit: r255067 - head/sys/kern

2013-08-30 Thread Ian Lepore
On Fri, 2013-08-30 at 16:55 +0300, Andriy Gapon wrote:
> on 30/08/2013 16:49 Hans Petter Selasky said the following:
> > On 08/30/13 15:37, Andriy Gapon wrote:
> >> on 30/08/2013 13:39 Hans Petter Selasky said the following:
> >>> Author: hselasky
> >>> Date: Fri Aug 30 10:39:56 2013
> >>> New Revision: 255067
> >>> URL: http://svnweb.freebsd.org/changeset/base/255067
> >>>
> >>> Log:
> >>>Simplify pause_sbt() logic. Don't call DELAY() if remainder is less
> >>>than or equal to zero.
> >>
> >> Discussed with?
> >> Reviewed by?
> >> Tested by?
> >>
> > 
> > Hi,
> > 
> > I've checked MAINTAINERS first.
> > 
> > A patch was sent to the freebsd-current mailing list, See XHCI USB debugging
> > thread.
> 
> I noticed that you committed the patch just a few minutes after making it
> public.  And later noticed that the patch did not result in any improvement.
> 
> > Could probably have been discussed a bit more.
> 
> Indeed.
> 
> > The cold case logic for pause()
> > is mainly used by the USB code and was factored out from usb_pause_mtx() a 
> > long
> > while ago by me.
> 
> Oh, I see.
> 
> > Do you see anything technically wrong about my patch?
> 
> I don't feel qualified enough.
> 

What I want to know is why a DELAY() loop needs to function well with
delay values longer than 1 second.  Are we really doing that?

-- Ian


___
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: r255067 - head/sys/kern

2013-08-30 Thread Hans Petter Selasky
Hi Ian,

Just do a:

grep -r DELAY sys

Mostly when kernel is in panic mode and at the end of shutdown.

--HPS 
 
-Original message-
> From:Ian Lepore mailto:i...@freebsd.org> >
> Sent: Friday 30th August 2013 16:53
> To: Andriy Gapon mailto:a...@freebsd.org> >
> Cc: Hans Petter Selasky   >; src-committ...@freebsd.org 
>  ; svn-src-...@freebsd.org 
>  ; svn-src-head@FreeBSD.org 
>  
> Subject: Re: svn commit: r255067 - head/sys/kern
> 

> 
> What I want to know is why a DELAY() loop needs to function well with
> delay values longer than 1 second.  Are we really doing that?
> 
> -- Ian
> 
> 
> 

___
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: r255074 - head/sys/dev/uart

2013-08-30 Thread Marcel Moolenaar
Author: marcel
Date: Fri Aug 30 15:26:45 2013
New Revision: 255074
URL: http://svnweb.freebsd.org/changeset/base/255074

Log:
  A final test with unmodified code has shown that a delay of 150ms
  is not giving us a 100% success rate. Bump the delay to 200ms as
  that seems to do the trick.
  
  Note that during testing the delay was added to uart_bus_attach()
  in uart_core.c. While having the delay in a different place can
  change the behaviour, it was not expected. Having to bump the
  delay with another 50ms could therefore be an indication that
  the problem can not be solved with delays.
  
  Reported by: kevlo@
  Tested by: kevlo@

Modified:
  head/sys/dev/uart/uart_dev_ns8250.c

Modified: head/sys/dev/uart/uart_dev_ns8250.c
==
--- head/sys/dev/uart/uart_dev_ns8250.c Fri Aug 30 13:25:15 2013
(r255073)
+++ head/sys/dev/uart/uart_dev_ns8250.c Fri Aug 30 15:26:45 2013
(r255074)
@@ -465,7 +465,7 @@ ns8250_bus_attach(struct uart_softc *sc)
 * accidental manner as before. More analysis is warranted, but
 * at least now we fixed a known regression.
 */
-   DELAY(150);
+   DELAY(200);
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"


Re: svn commit: r252841 - in head/sys: dev/mem kern sys

2013-08-30 Thread Jase Thew

On 05/07/2013 22:31, Jamie Gritton wrote:

Author: jamie
Date: Fri Jul  5 21:31:16 2013
New Revision: 252841
URL: http://svnweb.freebsd.org/changeset/base/252841

Log:
   Add new privileges, PRIV_KMEM_READ and PRIV_KMEM_WRITE, used in opening
   /dev/kmem and /dev/mem (in addition to traditional file permission checks).
   PRIV_KMEM_READ is different from other PRIV_* checks in that it's allowed
   by default.

   Reviewed by: kib, mckusick



Hi Jamie,

As a result of this commit (and r252845), it is no longer possible to 
access /dev/mem and /dev/kmem inside of a jail - is this behaviour 
intentional?


# dd if=/dev/mem bs=64 count=1
dd: /dev/mem: Operation not permitted

Regards,

Jase.

--
Jase Thew
j...@freebsd.org
FreeBSD Ports Committer

___
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: r252841 - in head/sys: dev/mem kern sys

2013-08-30 Thread Jamie Gritton
On 08/30/13 11:13, Jase Thew wrote:
> On 05/07/2013 22:31, Jamie Gritton wrote:
>> Author: jamie
>> Date: Fri Jul  5 21:31:16 2013
>> New Revision: 252841
>> URL: http://svnweb.freebsd.org/changeset/base/252841
>>
>> Log:
>>Add new privileges, PRIV_KMEM_READ and PRIV_KMEM_WRITE, used in
>> opening
>>/dev/kmem and /dev/mem (in addition to traditional file permission
>> checks).
>>PRIV_KMEM_READ is different from other PRIV_* checks in that it's
>> allowed
>>by default.
>>
>>Reviewed by:kib, mckusick
>>
> 
> Hi Jamie,
> 
> As a result of this commit (and r252845), it is no longer possible to
> access /dev/mem and /dev/kmem inside of a jail - is this behaviour
> intentional?
> 
> # dd if=/dev/mem bs=64 count=1
> dd: /dev/mem: Operation not permitted

It's intentional, but it's not intended to be the full solution. I also
need to add a permission flag to jails to allow kmem access. However I
didn't intend to disrupt read permission, though clearly it does since
it now passes through prison_priv_check. So I ought to add some code in
prison_priv_check that mirrors the code in priv_check_cred to allow
PRIV_KMEM_READ by default.

- Jamie
___
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: r255076 - head/contrib/llvm/lib/Transforms/InstCombine

2013-08-30 Thread Dimitry Andric
Author: dim
Date: Fri Aug 30 18:29:25 2013
New Revision: 255076
URL: http://svnweb.freebsd.org/changeset/base/255076

Log:
  Pull in r189672 from upstream llvm trunk:
  
InstCombine: Check for zero shift amounts before subtracting one
causing integer overflow.
  
PR17026. Also avoid undefined shifts and shift amounts larger than 64
bits (those are always undef because we can't represent integer types
that large).
  
  This should fix assertion failures when building the emulators/xmame
  port.
  
  Reported by:  bapt

Modified:
  head/contrib/llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp

Modified: 
head/contrib/llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp
==
--- 
head/contrib/llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp
Fri Aug 30 17:47:53 2013(r255075)
+++ 
head/contrib/llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp
Fri Aug 30 18:29:25 2013(r255076)
@@ -845,21 +845,26 @@ Value *InstCombiner::SimplifyDemandedUse
 Value *InstCombiner::SimplifyShrShlDemandedBits(Instruction *Shr,
   Instruction *Shl, APInt DemandedMask, APInt &KnownZero, APInt &KnownOne) {
 
-  unsigned ShlAmt = cast(Shl->getOperand(1))->getZExtValue();
-  unsigned ShrAmt = cast(Shr->getOperand(1))->getZExtValue();
+  const APInt &ShlOp1 = cast(Shl->getOperand(1))->getValue();
+  const APInt &ShrOp1 = cast(Shr->getOperand(1))->getValue();
+  if (!ShlOp1 || !ShrOp1)
+  return 0; // Noop.
+
+  Value *VarX = Shr->getOperand(0);
+  Type *Ty = VarX->getType();
+  unsigned BitWidth = Ty->getIntegerBitWidth();
+  if (ShlOp1.uge(BitWidth) || ShrOp1.uge(BitWidth))
+return 0; // Undef.
+
+  unsigned ShlAmt = ShlOp1.getZExtValue();
+  unsigned ShrAmt = ShrOp1.getZExtValue();
 
   KnownOne.clearAllBits();
   KnownZero = APInt::getBitsSet(KnownZero.getBitWidth(), 0, ShlAmt-1);
   KnownZero &= DemandedMask;
 
-  if (ShlAmt == 0 || ShrAmt == 0)
-return 0;
-
-  Value *VarX = Shr->getOperand(0);
-  Type *Ty = VarX->getType();
-
-  APInt BitMask1(APInt::getAllOnesValue(Ty->getIntegerBitWidth()));
-  APInt BitMask2(APInt::getAllOnesValue(Ty->getIntegerBitWidth()));
+  APInt BitMask1(APInt::getAllOnesValue(BitWidth));
+  APInt BitMask2(APInt::getAllOnesValue(BitWidth));
 
   bool isLshr = (Shr->getOpcode() == Instruction::LShr);
   BitMask1 = isLshr ? (BitMask1.lshr(ShrAmt) << ShlAmt) :
___
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: r255077 - head/sys/dev/acpica

2013-08-30 Thread Jean-Sebastien Pedron
Author: dumbbell
Date: Fri Aug 30 19:21:12 2013
New Revision: 255077
URL: http://svnweb.freebsd.org/changeset/base/255077

Log:
  acpi_thermal: Warn about insane _TMP temperature only once
  
  A warning is emitted again if the temperature became briefly valid
  meanwhile. This avoids spamming the user when the sensor is broken.
  
  Other values (ie. not _TMP) always raise a warning.

Modified:
  head/sys/dev/acpica/acpi_thermal.c

Modified: head/sys/dev/acpica/acpi_thermal.c
==
--- head/sys/dev/acpica/acpi_thermal.c  Fri Aug 30 18:29:25 2013
(r255076)
+++ head/sys/dev/acpica/acpi_thermal.c  Fri Aug 30 19:21:12 2013
(r255077)
@@ -111,6 +111,7 @@ struct acpi_tz_softc {
 
 struct acpi_tz_zonetz_zone;/*Thermal zone parameters*/
 inttz_validchecks;
+inttz_insane_tmp_notified;
 
 /* passive cooling */
 struct proc*tz_cooling_proc;
@@ -161,6 +162,8 @@ static driver_t acpi_tz_driver = {
 sizeof(struct acpi_tz_softc),
 };
 
+static char *acpi_tz_tmp_name = "_TMP";
+
 static devclass_t acpi_tz_devclass;
 DRIVER_MODULE(acpi_tz, acpi, acpi_tz_driver, acpi_tz_devclass, 0, 0);
 MODULE_DEPEND(acpi_tz, acpi, 1, 1, 1);
@@ -456,12 +459,11 @@ acpi_tz_get_temperature(struct acpi_tz_s
 {
 inttemp;
 ACPI_STATUSstatus;
-static char*tmp_name = "_TMP";
 
 ACPI_FUNCTION_NAME ("acpi_tz_get_temperature");
 
 /* Evaluate the thermal zone's _TMP method. */
-status = acpi_GetInteger(sc->tz_handle, tmp_name, &temp);
+status = acpi_GetInteger(sc->tz_handle, acpi_tz_tmp_name, &temp);
 if (ACPI_FAILURE(status)) {
ACPI_VPRINT(sc->tz_dev, acpi_device_get_parent_softc(sc->tz_dev),
"error fetching current temperature -- %s\n",
@@ -470,7 +472,7 @@ acpi_tz_get_temperature(struct acpi_tz_s
 }
 
 /* Check it for validity. */
-acpi_tz_sanity(sc, &temp, tmp_name);
+acpi_tz_sanity(sc, &temp, acpi_tz_tmp_name);
 if (temp == -1)
return (FALSE);
 
@@ -696,10 +698,29 @@ static void
 acpi_tz_sanity(struct acpi_tz_softc *sc, int *val, char *what)
 {
 if (*val != -1 && (*val < TZ_ZEROC || *val > TZ_ZEROC + 2000)) {
-   device_printf(sc->tz_dev, "%s value is absurd, ignored (%d.%dC)\n",
- what, TZ_KELVTOC(*val));
+   /*
+* If the value we are checking is _TMP, warn the user only
+* once. This avoids spamming messages if, for instance, the
+* sensor is broken and always returns an invalid temperature.
+*
+* This is only done for _TMP; other values always emit a
+* warning.
+*/
+   if (what != acpi_tz_tmp_name || !sc->tz_insane_tmp_notified) {
+   device_printf(sc->tz_dev, "%s value is absurd, ignored (%d.%dC)\n",
+ what, TZ_KELVTOC(*val));
+
+   /* Don't warn the user again if the read value doesn't improve. */
+   if (what == acpi_tz_tmp_name)
+   sc->tz_insane_tmp_notified = 1;
+   }
*val = -1;
+   return;
 }
+
+/* This value is correct. Warn if it's incorrect again. */
+if (what == acpi_tz_tmp_name)
+   sc->tz_insane_tmp_notified = 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: r255080 - head/sys/dev/md

2013-08-30 Thread Konstantin Belousov
Author: kib
Date: Fri Aug 30 20:12:23 2013
New Revision: 255080
URL: http://svnweb.freebsd.org/changeset/base/255080

Log:
  Give the page allocations initiated by the swap-backed md(4) a higher
  priority.  If the write is requested by a system daemon, sleeping
  there would starve resources and cause deadlock.
  
  Reported and tested by:   pho
  Sponsored by: The FreeBSD Foundation

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

Modified: head/sys/dev/md/md.c
==
--- head/sys/dev/md/md.cFri Aug 30 20:10:01 2013(r255079)
+++ head/sys/dev/md/md.cFri Aug 30 20:12:23 2013(r255080)
@@ -826,7 +826,7 @@ mdstart_swap(struct md_s *sc, struct bio
vm_object_pip_add(sc->object, 1);
for (i = bp->bio_offset / PAGE_SIZE; i <= lastp; i++) {
len = ((i == lastp) ? lastend : PAGE_SIZE) - offs;
-   m = vm_page_grab(sc->object, i, VM_ALLOC_NORMAL);
+   m = vm_page_grab(sc->object, i, VM_ALLOC_SYSTEM);
if (bp->bio_cmd == BIO_READ) {
if (m->valid == VM_PAGE_BITS_ALL)
rv = VM_PAGER_OK;
___
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: r255081 - head/bin/sh

2013-08-30 Thread Jilles Tjoelker
Author: jilles
Date: Fri Aug 30 20:13:33 2013
New Revision: 255081
URL: http://svnweb.freebsd.org/changeset/base/255081

Log:
  sh: Use makename() where possible.

Modified:
  head/bin/sh/parser.c

Modified: head/bin/sh/parser.c
==
--- head/bin/sh/parser.cFri Aug 30 20:12:23 2013(r255080)
+++ head/bin/sh/parser.cFri Aug 30 20:13:33 2013(r255081)
@@ -457,10 +457,7 @@ command(void)
if (lasttoken == TWORD && ! quoteflag && equal(wordtext, "in")) 
{
app = ≈
while (readtoken() == TWORD) {
-   n2 = (union node *)stalloc(sizeof (struct 
narg));
-   n2->type = NARG;
-   n2->narg.text = wordtext;
-   n2->narg.backquote = backquotelist;
+   n2 = makename();
*app = n2;
app = &n2->narg.next;
}
@@ -500,11 +497,7 @@ command(void)
n1 = (union node *)stalloc(sizeof (struct ncase));
n1->type = NCASE;
consumetoken(TWORD);
-   n1->ncase.expr = n2 = (union node *)stalloc(sizeof (struct 
narg));
-   n2->type = NARG;
-   n2->narg.text = wordtext;
-   n2->narg.backquote = backquotelist;
-   n2->narg.next = NULL;
+   n1->ncase.expr = makename();
while (readtoken() == TNL);
if (lasttoken != TWORD || ! equal(wordtext, "in"))
synerror("expecting \"in\"");
@@ -517,10 +510,7 @@ command(void)
if (lasttoken == TLP)
readtoken();
for (;;) {
-   *app = ap = (union node *)stalloc(sizeof 
(struct narg));
-   ap->type = NARG;
-   ap->narg.text = wordtext;
-   ap->narg.backquote = backquotelist;
+   *app = ap = makename();
checkkwd = CHKNL | CHKKWD;
if (readtoken() != TPIPE)
break;
@@ -632,10 +622,7 @@ simplecmd(union node **rpp, union node *
for (;;) {
checkkwd = savecheckkwd;
if (readtoken() == TWORD) {
-   n = (union node *)stalloc(sizeof (struct narg));
-   n->type = NARG;
-   n->narg.text = wordtext;
-   n->narg.backquote = backquotelist;
+   n = makename();
*app = n;
app = &n->narg.next;
if (savecheckkwd != 0 && !isassignment(wordtext))
@@ -772,11 +759,7 @@ parseheredoc(void)
}
readtoken1(pgetc(), here->here->type == NHERE? SQSYNTAX : 
DQSYNTAX,
here->eofmark, here->striptabs);
-   n = (union node *)stalloc(sizeof (struct narg));
-   n->narg.type = NARG;
-   n->narg.next = NULL;
-   n->narg.text = wordtext;
-   n->narg.backquote = backquotelist;
+   n = makename();
here->here->nhere.doc = n;
}
 }
___
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: r255079 - head/sys/amd64/amd64

2013-08-30 Thread Konstantin Belousov
Author: kib
Date: Fri Aug 30 20:10:01 2013
New Revision: 255079
URL: http://svnweb.freebsd.org/changeset/base/255079

Log:
  The pm_save should be cleared on the pmap initialization, and not on
  the activation.
  
  Noted by: alc

Modified:
  head/sys/amd64/amd64/pmap.c

Modified: head/sys/amd64/amd64/pmap.c
==
--- head/sys/amd64/amd64/pmap.c Fri Aug 30 19:42:25 2013(r255078)
+++ head/sys/amd64/amd64/pmap.c Fri Aug 30 20:10:01 2013(r255079)
@@ -1863,6 +1863,7 @@ pmap_pinit0(pmap_t pmap)
pmap->pm_pml4 = (pml4_entry_t *)PHYS_TO_DMAP(KPML4phys);
pmap->pm_root.rt_root = 0;
CPU_ZERO(&pmap->pm_active);
+   CPU_ZERO(&pmap->pm_save);
PCPU_SET(curpmap, pmap);
TAILQ_INIT(&pmap->pm_pvchunk);
bzero(&pmap->pm_stats, sizeof pmap->pm_stats);
@@ -5939,7 +5940,6 @@ pmap_activate(struct thread *td)
critical_enter();
pmap = vmspace_pmap(td->td_proc->p_vmspace);
oldpmap = PCPU_GET(curpmap);
-   CPU_ZERO(&pmap->pm_save);
cpuid = PCPU_GET(cpuid);
 #ifdef SMP
CPU_CLR_ATOMIC(cpuid, &oldpmap->pm_active);
___
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: r255078 - head/sys/sys

2013-08-30 Thread Pawel Jakub Dawidek
Author: pjd
Date: Fri Aug 30 19:42:25 2013
New Revision: 255078
URL: http://svnweb.freebsd.org/changeset/base/255078

Log:
  Style cleanups.

Modified:
  head/sys/sys/sysctl.h

Modified: head/sys/sys/sysctl.h
==
--- head/sys/sys/sysctl.h   Fri Aug 30 19:21:12 2013(r255077)
+++ head/sys/sys/sysctl.h   Fri Aug 30 19:42:25 2013(r255078)
@@ -48,7 +48,7 @@ struct thread;
  * respective subsystem header files.
  */
 
-#define CTL_MAXNAME24  /* largest number of components supported */
+#defineCTL_MAXNAME 24  /* largest number of components 
supported */
 
 /*
  * Each subsystem defined by sysctl defines a list of variables
@@ -59,10 +59,10 @@ struct thread;
  */
 struct ctlname {
char*ctl_name;  /* subsystem name */
-   int ctl_type;   /* type of name */
+   int  ctl_type;  /* type of name */
 };
 
-#define CTLTYPE0xf /* Mask for the type */
+#defineCTLTYPE 0xf /* mask for the type */
 #defineCTLTYPE_NODE1   /* name is a node */
 #defineCTLTYPE_INT 2   /* name describes an integer */
 #defineCTLTYPE_STRING  3   /* name describes a string */
@@ -74,35 +74,35 @@ struct ctlname {
 #defineCTLTYPE_ULONG   8   /* name describes an unsigned long */
 #defineCTLTYPE_U64 9   /* name describes an unsigned 64-bit 
number */
 
-#define CTLFLAG_RD 0x8000  /* Allow reads of variable */
-#define CTLFLAG_WR 0x4000  /* Allow writes to the variable */
-#define CTLFLAG_RW (CTLFLAG_RD|CTLFLAG_WR)
-#define CTLFLAG_ANYBODY0x1000  /* All users can set this var */
-#define CTLFLAG_SECURE 0x0800  /* Permit set only if securelevel<=0 */
-#define CTLFLAG_PRISON 0x0400  /* Prisoned roots can fiddle */
-#define CTLFLAG_DYN0x0200  /* Dynamic oid - can be freed */
-#define CTLFLAG_SKIP   0x0100  /* Skip this sysctl when listing */
-#define CTLMASK_SECURE 0x00F0  /* Secure level */
-#define CTLFLAG_TUN0x0008  /* Tunable variable */
+#defineCTLFLAG_RD  0x8000  /* Allow reads of variable */
+#defineCTLFLAG_WR  0x4000  /* Allow writes to the variable 
*/
+#defineCTLFLAG_RW  (CTLFLAG_RD|CTLFLAG_WR)
+#defineCTLFLAG_ANYBODY 0x1000  /* All users can set this var */
+#defineCTLFLAG_SECURE  0x0800  /* Permit set only if 
securelevel<=0 */
+#defineCTLFLAG_PRISON  0x0400  /* Prisoned roots can fiddle */
+#defineCTLFLAG_DYN 0x0200  /* Dynamic oid - can be freed */
+#defineCTLFLAG_SKIP0x0100  /* Skip this sysctl when 
listing */
+#defineCTLMASK_SECURE  0x00F0  /* Secure level */
+#defineCTLFLAG_TUN 0x0008  /* Tunable variable */
 #defineCTLFLAG_RDTUN   (CTLFLAG_RD|CTLFLAG_TUN)
 #defineCTLFLAG_RWTUN   (CTLFLAG_RW|CTLFLAG_TUN)
-#define CTLFLAG_MPSAFE 0x0004  /* Handler is MP safe */
-#define CTLFLAG_VNET   0x0002  /* Prisons with vnet can fiddle */
-#defineCTLFLAG_DYING   0x0001  /* oid is being removed */
-#define CTLFLAG_CAPRD  0x8000  /* Can be read in capability mode */
-#define CTLFLAG_CAPWR  0x4000  /* Can be written in capability mode */
-#define CTLFLAG_STATS  0x2000  /* Statistics, not a tuneable */
-#define CTLFLAG_CAPRW  (CTLFLAG_CAPRD|CTLFLAG_CAPWR)
+#defineCTLFLAG_MPSAFE  0x0004  /* Handler is MP safe */
+#defineCTLFLAG_VNET0x0002  /* Prisons with vnet can fiddle 
*/
+#defineCTLFLAG_DYING   0x0001  /* Oid is being removed */
+#defineCTLFLAG_CAPRD   0x8000  /* Can be read in capability 
mode */
+#defineCTLFLAG_CAPWR   0x4000  /* Can be written in capability 
mode */
+#defineCTLFLAG_STATS   0x2000  /* Statistics, not a tuneable */
+#defineCTLFLAG_CAPRW   (CTLFLAG_CAPRD|CTLFLAG_CAPWR)
 
 /*
- * Secure level.   Note that CTLFLAG_SECURE == CTLFLAG_SECURE1.  
+ * Secure level.   Note that CTLFLAG_SECURE == CTLFLAG_SECURE1.
  *
  * Secure when the securelevel is raised to at least N.
  */
-#define CTLSHIFT_SECURE20
-#define CTLFLAG_SECURE1(CTLFLAG_SECURE | (0 << CTLSHIFT_SECURE))
-#define CTLFLAG_SECURE2(CTLFLAG_SECURE | (1 << CTLSHIFT_SECURE))
-#define CTLFLAG_SECURE3(CTLFLAG_SECURE | (2 << CTLSHIFT_SECURE))
+#defineCTLSHIFT_SECURE 20
+#defineCTLFLAG_SECURE1 (CTLFLAG_SECURE | (0 << CTLSHIFT_SECURE))
+#defineCTLFLAG_SECURE2 (CTLFLAG_SECURE | (1 << CTLSHIFT_SECURE))
+#defineCTLFLAG_SECURE3 (CTLFLAG_SECURE | (2 << CTLSHIFT_SECURE))
 
 /*
  * USE THIS instead of a hardwired number from the categories below
@@ -110,19 +110,19 @@ struct ctlname {
  * technology. This is the way

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

2013-08-30 Thread Joel Dahl
Author: joel (doc committer)
Date: Fri Aug 30 20:20:06 2013
New Revision: 255082
URL: http://svnweb.freebsd.org/changeset/base/255082

Log:
  mdoc: add missing El.

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

Modified: head/share/man/man4/vmx.4
==
--- head/share/man/man4/vmx.4   Fri Aug 30 20:13:33 2013(r255081)
+++ head/share/man/man4/vmx.4   Fri Aug 30 20:20:06 2013(r255082)
@@ -100,6 +100,7 @@ Number of receive descriptors per ring a
 The default value is 256.
 The value must be a multiple of 32, and the maximum is 2048.
 There are two rings so the actual usage is doubled.
+.El
 .Sh EXAMPLES
 The following entry must be added to the VMware configuration file
 to provide the
___
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: r255083 - head/sys/mips/malta

2013-08-30 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Fri Aug 30 20:28:35 2013
New Revision: 255083
URL: http://svnweb.freebsd.org/changeset/base/255083

Log:
  Add PCI bus space implementation that converts all 2 and 4 bytes
  values to/from little endian according to PCI spec.

Added:
  head/sys/mips/malta/gt_pci_bus_space.c   (contents, props changed)
  head/sys/mips/malta/gt_pci_bus_space.h   (contents, props changed)
Modified:
  head/sys/mips/malta/files.malta
  head/sys/mips/malta/gt_pci.c

Modified: head/sys/mips/malta/files.malta
==
--- head/sys/mips/malta/files.malta Fri Aug 30 20:20:06 2013
(r255082)
+++ head/sys/mips/malta/files.malta Fri Aug 30 20:28:35 2013
(r255083)
@@ -1,6 +1,7 @@
 # $FreeBSD$
 mips/malta/gt.cstandard
 mips/malta/gt_pci.cstandard
+mips/malta/gt_pci_bus_space.c  standard
 mips/malta/obio.c  optional uart
 mips/malta/uart_cpu_maltausart.c   optional uart
 mips/malta/uart_bus_maltausart.c   optional uart

Modified: head/sys/mips/malta/gt_pci.c
==
--- head/sys/mips/malta/gt_pci.cFri Aug 30 20:20:06 2013
(r255082)
+++ head/sys/mips/malta/gt_pci.cFri Aug 30 20:28:35 2013
(r255083)
@@ -75,6 +75,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include "pcib_if.h"
 
+#include 
 
 #defineICU_LEN 16  /* number of ISA IRQs */
 
@@ -635,7 +636,6 @@ gt_pci_alloc_resource(device_t bus, devi
struct gt_pci_softc *sc = device_get_softc(bus);
struct resource *rv = NULL;
struct rman *rm;
-   bus_space_tag_t bt = 0;
bus_space_handle_t bh = 0;
 
switch (type) {
@@ -644,12 +644,10 @@ gt_pci_alloc_resource(device_t bus, devi
break;
case SYS_RES_MEMORY:
rm = &sc->sc_mem_rman;
-   bt = sc->sc_st;
bh = sc->sc_mem;
break;
case SYS_RES_IOPORT:
rm = &sc->sc_io_rman;
-   bt = sc->sc_st;
bh = sc->sc_io;
break;
default:
@@ -663,7 +661,7 @@ gt_pci_alloc_resource(device_t bus, devi
if (type != SYS_RES_IRQ) {
bh += (rman_get_start(rv));
 
-   rman_set_bustag(rv, bt);
+   rman_set_bustag(rv, gt_pci_bus_space);
rman_set_bushandle(rv, bh);
if (flags & RF_ACTIVE) {
if (bus_activate_resource(child, type, *rid, rv)) {

Added: head/sys/mips/malta/gt_pci_bus_space.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/mips/malta/gt_pci_bus_space.c  Fri Aug 30 20:28:35 2013
(r255083)
@@ -0,0 +1,409 @@
+/*  $NetBSD: bus.h,v 1.12 1997/10/01 08:25:15 fvdl Exp $*/
+/*-
+ * $Id: bus.h,v 1.6 2007/08/09 11:23:32 katta Exp $
+ *
+ * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
+ * NASA Ames Research Center.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *must display the following acknowledgement:
+ * This product includes software developed by the NetBSD
+ * Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ *contributors may be used to endorse or promote products derived
+ *from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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 

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

2013-08-30 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Fri Aug 30 20:30:33 2013
New Revision: 255084
URL: http://svnweb.freebsd.org/changeset/base/255084

Log:
  Add bpf(4) to config file to get dhclient working

Modified:
  head/sys/mips/conf/MALTA

Modified: head/sys/mips/conf/MALTA
==
--- head/sys/mips/conf/MALTAFri Aug 30 20:28:35 2013(r255083)
+++ head/sys/mips/conf/MALTAFri Aug 30 20:30:33 2013(r255084)
@@ -65,5 +65,6 @@ deviceloop
 device ether
 device le
 device miibus
+device bpf
 device md
 device uart
___
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: r255085 - head/bin/sh

2013-08-30 Thread Jilles Tjoelker
Author: jilles
Date: Fri Aug 30 20:37:52 2013
New Revision: 255085
URL: http://svnweb.freebsd.org/changeset/base/255085

Log:
  sh: Separate out nbinary allocation into a function.

Modified:
  head/bin/sh/parser.c

Modified: head/bin/sh/parser.c
==
--- head/bin/sh/parser.cFri Aug 30 20:30:33 2013(r255084)
+++ head/bin/sh/parser.cFri Aug 30 20:37:52 2013(r255085)
@@ -114,6 +114,7 @@ static union node *pipeline(void);
 static union node *command(void);
 static union node *simplecmd(union node **, union node *);
 static union node *makename(void);
+static union node *makebinary(int type, union node *n1, union node *n2);
 static void parsefname(void);
 static void parseheredoc(void);
 static int peektoken(void);
@@ -257,17 +258,11 @@ list(int nlflag, int erflag)
if (ntop == NULL)
ntop = n2;
else if (n1 == NULL) {
-   n1 = (union node *)stalloc(sizeof (struct nbinary));
-   n1->type = NSEMI;
-   n1->nbinary.ch1 = ntop;
-   n1->nbinary.ch2 = n2;
+   n1 = makebinary(NSEMI, ntop, n2);
ntop = n1;
}
else {
-   n3 = (union node *)stalloc(sizeof (struct nbinary));
-   n3->type = NSEMI;
-   n3->nbinary.ch1 = n1->nbinary.ch2;
-   n3->nbinary.ch2 = n2;
+   n3 = makebinary(NSEMI, n1->nbinary.ch2, n2);
n1->nbinary.ch2 = n3;
n1 = n3;
}
@@ -312,10 +307,10 @@ list(int nlflag, int erflag)
 static union node *
 andor(void)
 {
-   union node *n1, *n2, *n3;
+   union node *n;
int t;
 
-   n1 = pipeline();
+   n = pipeline();
for (;;) {
if ((t = readtoken()) == TAND) {
t = NAND;
@@ -323,14 +318,9 @@ andor(void)
t = NOR;
} else {
tokpushback++;
-   return n1;
+   return n;
}
-   n2 = pipeline();
-   n3 = (union node *)stalloc(sizeof (struct nbinary));
-   n3->type = t;
-   n3->nbinary.ch1 = n1;
-   n3->nbinary.ch2 = n2;
-   n1 = n3;
+   n = makebinary(t, n, pipeline());
}
 }
 
@@ -437,12 +427,11 @@ command(void)
break;
case TWHILE:
case TUNTIL:
-   n1 = (union node *)stalloc(sizeof (struct nbinary));
-   n1->type = (lasttoken == TWHILE)? NWHILE : NUNTIL;
-   if ((n1->nbinary.ch1 = list(0, 0)) == NULL)
+   t = lasttoken;
+   if ((n1 = list(0, 0)) == NULL)
synexpect(-1);
consumetoken(TDO);
-   n1->nbinary.ch2 = list(0, 0);
+   n1 = makebinary((t == TWHILE)? NWHILE : NUNTIL, n1, list(0, 0));
consumetoken(TDONE);
checkkwd = CHKKWD | CHKALIAS;
break;
@@ -682,6 +671,18 @@ makename(void)
return n;
 }
 
+static union node *
+makebinary(int type, union node *n1, union node *n2)
+{
+   union node *n;
+
+   n = (union node *)stalloc(sizeof (struct nbinary));
+   n->type = type;
+   n->nbinary.ch1 = n1;
+   n->nbinary.ch2 = n2;
+   return (n);
+}
+
 void
 fixredir(union node *n, const char *text, int err)
 {
___
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: r254882 - head/sys/dev/pci

2013-08-30 Thread John Baldwin
On Friday, August 30, 2013 10:51:08 am Jean-Sébastien Pédron wrote:
> On 29.08.2013 16:07, John Baldwin wrote:
> > Here is an untested cut at this, it only changes these functions and doesn't
> > fix the callers to work with the returned struct resource, etc.:
> 
> I attached an updated patch including changes to pcivar.h and radeon.
> However, BUS_ALLOC_RESOURCE() returns NULL in my tests.

Hmm, can you get devinfo -u output?  I wonder if orm0 is eating this
resource.

-- 
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"


svn commit: r255087 - head/bin/sh

2013-08-30 Thread Jilles Tjoelker
Author: jilles
Date: Fri Aug 30 20:50:28 2013
New Revision: 255087
URL: http://svnweb.freebsd.org/changeset/base/255087

Log:
  sh: Simplify list() in the parser.
  
  The erflag argument was only used by old-style (``) command substitutions.
  We can remove it and handle the special case in the command substitution
  code.

Modified:
  head/bin/sh/parser.c

Modified: head/bin/sh/parser.c
==
--- head/bin/sh/parser.cFri Aug 30 20:46:01 2013(r255086)
+++ head/bin/sh/parser.cFri Aug 30 20:50:28 2013(r255087)
@@ -108,7 +108,7 @@ static int funclinno;   /* line # where t
 static struct parser_temp *parser_temp;
 
 
-static union node *list(int, int);
+static union node *list(int);
 static union node *andor(void);
 static union node *pipeline(void);
 static union node *command(void);
@@ -225,18 +225,18 @@ parsecmd(int interact)
if (t == TNL)
return NULL;
tokpushback++;
-   return list(1, 1);
+   return list(1);
 }
 
 
 static union node *
-list(int nlflag, int erflag)
+list(int nlflag)
 {
union node *ntop, *n1, *n2, *n3;
int tok;
 
checkkwd = CHKNL | CHKKWD | CHKALIAS;
-   if (!nlflag && !erflag && tokendlist[peektoken()])
+   if (!nlflag && tokendlist[peektoken()])
return NULL;
ntop = n1 = NULL;
for (;;) {
@@ -283,8 +283,7 @@ list(int nlflag, int erflag)
tokpushback++;
}
checkkwd = CHKNL | CHKKWD | CHKALIAS;
-   if (!nlflag && (erflag ? peektoken() == TEOF :
-   tokendlist[peektoken()]))
+   if (!nlflag && tokendlist[peektoken()])
return ntop;
break;
case TEOF:
@@ -294,7 +293,7 @@ list(int nlflag, int erflag)
pungetc();  /* push back EOF on 
input */
return ntop;
default:
-   if (nlflag || erflag)
+   if (nlflag)
synexpect(-1);
tokpushback++;
return ntop;
@@ -402,22 +401,22 @@ command(void)
case TIF:
n1 = (union node *)stalloc(sizeof (struct nif));
n1->type = NIF;
-   if ((n1->nif.test = list(0, 0)) == NULL)
+   if ((n1->nif.test = list(0)) == NULL)
synexpect(-1);
consumetoken(TTHEN);
-   n1->nif.ifpart = list(0, 0);
+   n1->nif.ifpart = list(0);
n2 = n1;
while (readtoken() == TELIF) {
n2->nif.elsepart = (union node *)stalloc(sizeof (struct 
nif));
n2 = n2->nif.elsepart;
n2->type = NIF;
-   if ((n2->nif.test = list(0, 0)) == NULL)
+   if ((n2->nif.test = list(0)) == NULL)
synexpect(-1);
consumetoken(TTHEN);
-   n2->nif.ifpart = list(0, 0);
+   n2->nif.ifpart = list(0);
}
if (lasttoken == TELSE)
-   n2->nif.elsepart = list(0, 0);
+   n2->nif.elsepart = list(0);
else {
n2->nif.elsepart = NULL;
tokpushback++;
@@ -428,10 +427,10 @@ command(void)
case TWHILE:
case TUNTIL:
t = lasttoken;
-   if ((n1 = list(0, 0)) == NULL)
+   if ((n1 = list(0)) == NULL)
synexpect(-1);
consumetoken(TDO);
-   n1 = makebinary((t == TWHILE)? NWHILE : NUNTIL, n1, list(0, 0));
+   n1 = makebinary((t == TWHILE)? NWHILE : NUNTIL, n1, list(0));
consumetoken(TDONE);
checkkwd = CHKKWD | CHKALIAS;
break;
@@ -478,7 +477,7 @@ command(void)
t = TEND;
else
synexpect(-1);
-   n1->nfor.body = list(0, 0);
+   n1->nfor.body = list(0);
consumetoken(t);
checkkwd = CHKKWD | CHKALIAS;
break;
@@ -509,7 +508,7 @@ command(void)
ap->narg.next = NULL;
if (lasttoken != TRP)
synexpect(TRP);
-   cp->nclist.body = list(0, 0);
+   cp->nclist.body = list(0);
 
checkkwd = CHKNL | CHKKWD | CHKALIAS;
if ((t = readtoken()) != TESAC) {
@@ -529,14 +528,14 @@ command(void)
case TLP:
n1 = (union node *)stalloc(sizeof (struct nredir));
n1->type = NS

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

2013-08-30 Thread Hiren Panchasara
Author: hiren
Date: Fri Aug 30 20:46:01 2013
New Revision: 255086
URL: http://svnweb.freebsd.org/changeset/base/255086

Log:
  Add device PicoStation M2HP support.
  This is a nice small outdoor/indoor AP from Ubiquity Networks.
  
  The device has:
  AR7241 CPU SoC
  AR9287 Wifi
  8MB flash
  32MB RAM
  
  wifi has been tested to work along with leds.
  
  Submitted by:   loos
  Approved by:sbruno (mentor, implicit)
  Tested by:  hiren

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

Added: head/sys/mips/conf/PICOSTATION_M2HP
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/mips/conf/PICOSTATION_M2HP Fri Aug 30 20:46:01 2013
(r255086)
@@ -0,0 +1,68 @@
+#
+# Specific board setup for the Picostation M2 HP board.
+#
+# This board has the following hardware:
+#
+# + AR7241 CPU SoC
+# + AR9287 Wifi
+# + Integrated switch (XXX speed?)
+# + 8MB flash
+# + 32MB RAM
+# + uboot environment
+
+# $FreeBSD$
+
+include"AR724X_BASE"
+ident  "PICOSTATION_M2HP"
+hints  "PICOSTATION_M2HP.hints"
+
+optionsAR71XX_REALMEM=32*1024*1024
+
+optionsAR71XX_ENV_UBOOT
+
+# Limit inlines
+makeoptionsINLINE_LIMIT=768
+
+# We bite the performance overhead for now; the kernel won't
+# fit if the mutexes are inlined.
+optionsMUTEX_NOINLINE
+optionsRWLOCK_NOINLINE
+optionsSX_NOINLINE
+
+# There's no need to enable swapping on this platform.
+optionsNO_SWAPPING
+
+# For DOS - enable if required
+# options  MSDOSFS
+
+# uncompress - to boot read-only lzma natively from flash
+device geom_uncompress
+optionsGEOM_UNCOMPRESS
+optionsROOTDEVNAME=\"ufs:/dev/map/rootfs.uncompress\"
+
+# Not enough space for these..
+nooptions  INVARIANTS
+nooptions  INVARIANT_SUPPORT
+nooptions  WITNESS
+nooptions  WITNESS_SKIPSPIN
+nooptions  DEBUG_REDZONE
+nooptions  DEBUG_MEMGUARD
+
+# Used for the static uboot partition map
+device  geom_map
+
+# Options needed for the EEPROM based calibration/PCI configuration data.
+optionsAR71XX_ATH_EEPROM   # Fetch EEPROM/PCI config from flash
+optionsATH_EEPROM_FIRMWARE # Use EEPROM from flash
+device firmware# Used by the above
+
+# Options required for miiproxy and mdiobus
+optionsARGE_MDIO   # Export an MDIO bus separate from arge
+device miiproxy# MDIO bus <-> MII PHY rendezvous
+
+device etherswitch
+device arswitch
+
+# Enable GPIO
+device gpio
+device gpioled

Added: head/sys/mips/conf/PICOSTATION_M2HP.hints
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/mips/conf/PICOSTATION_M2HP.hints   Fri Aug 30 20:46:01 2013
(r255086)
@@ -0,0 +1,103 @@
+# $FreeBSD$
+
+# arge1 MDIO bus
+hint.argemdio.0.at="nexus0"
+hint.argemdio.0.maddr=0x1a00
+hint.argemdio.0.msize=0x1000
+hint.argemdio.0.order=0
+
+# Override MAC Address with the one on EEPROM
+hint.arge.0.eeprommac=0x1fff
+
+# arge0: dedicated switch port; RMII; dedicated PHY 4 on switch, connected
+# via internal switch MDIO bus.
+hint.arge.0.media=100   # Map to 100/full
+hint.arge.0.fduplex=1   #
+hint.arge.0.phymask=0x10# PHY4
+hint.arge.0.mdio=mdioproxy1 # .. off of the switch mdiobus
+
+# arge1: nail to 1000/full, RMII - connected to the switch
+hint.arge.1.media=1000  # Map to 1000/full
+hint.arge.1.fduplex=1   #
+hint.arge.1.phymask=0x0 # no directly mapped PHYs
+
+#
+# AR7240 switch config
+#
+hint.arswitch.0.at="mdio0"
+hint.arswitch.0.is_7240=1   # We need to be explicitly told this
+hint.arswitch.0.numphys=4   # 4 active switch PHYs (PHY 0 -> 3)
+hint.arswitch.0.phy4cpu=1   # Yes, PHY 4 == dedicated PHY
+hint.arswitch.0.is_rgmii=0  # No, not RGMII
+hint.arswitch.0.is_gmii=0   # No, not GMII
+
+# ath0 hint - pcie slot 0
+hint.pcib.0.bus.0.0.0.ath_fixup_addr=0x1fff1000
+hint.pcib.0.bus.0.0.0.ath_fixup_size=4096
+
+# ath
+hint.ath.0.eeprom_firmware="pcib.0.bus.0.0.0.eeprom_firmware"
+
+# GPIO pins
+# Pin 0: red led (sig1)
+# Pin 1: yellow led (sig2)
+# Pin 11: green len (sig3)
+# Pin 7: green len (sig4)
+# Pin 12: Reset switch
+hint.gpio.0.pinmask=0x1883
+
+# Signal leds
+hint.gpioled.0.at="gpiobus0"
+hint.gpioled.0.name="sig1"
+hint.gpioled.0.pins=0x0001 # pin 0
+hint.gpioled.1.at="gpiobus0"
+hint.gpioled.1.name="sig2"
+hint.gpioled.1.pins=0x0002 # pin 1
+hint.gpioled.2.at="gpiobus0"
+hint.gpioled.2.name="sig3"
+hint.gpioled.2.pins=0x0800 # pin 11
+hint.gpioled.3.at="gpiobus0"
+hint.gpioled.3.name="sig4"
+hint.gpioled.3.pins=0x0080 # 

Re: svn commit: r254585 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2013-08-30 Thread Xin Li
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA512

Hi, Davide,

On 08/28/13 03:19, Davide Italiano wrote:
> On Wed, Aug 28, 2013 at 3:02 AM, Xin Li 
> wrote: On 08/27/13 01:59, Davide Italiano wrote:
 I've written a patch that attempts to fix the second
 problem. 
 http://people.freebsd.org/~davide/review/zfsrename_recycle.diff
 The culprit is that we're dereferencing sdvp without the
 vnode lock held, so data-stability is not guaranteed. tdvp,
 instead, is locked at the entry point of VOP_RENAME() (at
 least according to vop_rename_pre()) so it can be safely
 used. As pointed out by Andriy ZFS has some different
 mechanisms wrt other file systems that allow the vnode to not
 be recycled when it's referenced (ZFS_ENTER), so once we get
 zfsvfs_t * from tdzp we can call ZFS_ENTER and dereference
 sdvp in a safe manner.
> 
> I'm not sure that this is right.  Now we have:
> 
> tdzp = VTOZ(tdvp); ZFS_VERIFY_ZP(tdzp); zfsvfs = tdzp->z_zfsvfs; 
> ZFS_ENTER(zfsvfs);  // tdzp's z_zfsvfs entered zilog =
> zfsvfs->z_log; sdzp = VTOZ(sdvp); ZFS_VERIFY_ZP(sdzp);
> // (*)
> 
>> Well, if your concern is that the running thread can exit from a 
>> different context than the one it entered, maybe partly inlining 
>> ZFS_VERIFY_ZP() might workaround the problem.
> 
>> if (sdzp->z_sa_hdl == NULL) { ZFS_EXIT(zfsvfs); /* this is the
>> right context */ return (EIO); }
> 
>> Does this make sense for you? If not, can you propose an
>> alternative? I'll be away for a couple of days but I will be
>> happy to discuss this further when I'll come back.
> 
> 
> Note that in the (*) step, when sdzp is invalid and sdzp have 
> different z_zfsvfs than tdzp (for instance when the node is in the 
> snapshot directory; the code later would test this), we could end
> up with ZFS_EXIT()'ing the wrong z_zfsvfs.

I've re-examined the code with some instruments and it looks like the
case where tdzp and sdzp have different z_zfsvfs were caught by upper
layer in our VFS.

We probably should assert this fact in our version though, as it's not
very obvious for reader.  Note that this also means we can define out
the EXDEV check along with the VOP_REALVP call, as they do not apply
to FreeBSD.

Will you commit the change against the tree?

Cheers,
- -- 
Xin LI https://www.delphij.net/
FreeBSD - The Power to Serve!   Live free or die
-BEGIN PGP SIGNATURE-
Version: GnuPG v2.0.21 (FreeBSD)

iQEcBAEBCgAGBQJSIRzwAAoJEG80Jeu8UPuzDA4H/R5UEFJveI9lDKIwM8ldCQbV
dayXCPDSE7b3T098LMh5gA5FlDz60E633qb7Uu9eFb8Ln+vmCaBGV88AKjv+P1c4
6NIU+oJLt4uKHXqn3C+9CC5zZFZLRIoGalwtCxHEoePteF+HOwmfFOEEM0v2cSro
KJgFsNIeQfWtIfeZgMNXYGeKmp26baJm9AqTmUh/tOTu7lg0i5IUV4Xv0TnsBFeX
OJ+Oan/2lBRvDnxZxkHKQlRTok7Lq3aD0qhit1aOFkdPGQ+9yzrPS1/B86e2JcoA
riasxJbvdTccGANj/KKiRebuoCt6v9Mwt6CaYb6UlDKotXIm1oLBD52BmdSkolk=
=vvE0
-END PGP SIGNATURE-
___
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: r255088 - head/sys/mips/malta

2013-08-30 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Sat Aug 31 01:24:05 2013
New Revision: 255088
URL: http://svnweb.freebsd.org/changeset/base/255088

Log:
  YAMON is 32-bit application and uses 32-bit pointers to pass kernel
  arguments and environment names/values. Cast values to proper pointer type
  to make MALTA kernel 64-bit compatible

Modified:
  head/sys/mips/malta/malta_machdep.c

Modified: head/sys/mips/malta/malta_machdep.c
==
--- head/sys/mips/malta/malta_machdep.c Fri Aug 30 20:50:28 2013
(r255087)
+++ head/sys/mips/malta/malta_machdep.c Sat Aug 31 01:24:05 2013
(r255088)
@@ -269,8 +269,8 @@ platform_start(__register_t a0, __regist
vm_offset_t kernend;
uint64_t platform_counter_freq;
int argc = a0;
-   char **argv = (char **)a1;
-   char **envp = (char **)a2;
+   int32_t *argv = (int32_t*)a1;
+   int32_t *envp = (int32_t*)a2;
unsigned int memsize = a3;
int i;
 
@@ -289,15 +289,20 @@ platform_start(__register_t a0, __regist
printf("entry: platform_start()\n");
 
bootverbose = 1;
+   /* 
+* YAMON uses 32bit pointers to strings so
+* convert them to proper type manually
+*/
if (bootverbose) {
printf("cmd line: ");
for (i = 0; i < argc; i++)
-   printf("%s ", argv[i]);
+   printf("%s ", (char*)(intptr_t)argv[i]);
printf("\n");
 
printf("envp:\n");
for (i = 0; envp[i]; i += 2)
-   printf("\t%s = %s\n", envp[i], envp[i+1]);
+   printf("\t%s = %s\n", (char*)(intptr_t)envp[i],
+   (char*)(intptr_t)envp[i+1]);
 
printf("memsize = %08x\n", memsize);
}
___
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: r255089 - head/sys/mips/conf

2013-08-30 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Sat Aug 31 01:30:01 2013
New Revision: 255089
URL: http://svnweb.freebsd.org/changeset/base/255089

Log:
  - Set proper KERNLOADADDR
  - Add bpf(4) required by dhclient

Modified:
  head/sys/mips/conf/MALTA64

Modified: head/sys/mips/conf/MALTA64
==
--- head/sys/mips/conf/MALTA64  Sat Aug 31 01:24:05 2013(r255088)
+++ head/sys/mips/conf/MALTA64  Sat Aug 31 01:30:01 2013(r255089)
@@ -31,6 +31,8 @@ makeoptions   MODULES_OVERRIDE=""
 optionsTICK_USE_YAMON_FREQ=defined
 #options   TICK_USE_MALTA_RTC=defined
 
+makeoptionsKERNLOADADDR=0x8010
+
 include"../malta/std.malta"
 
 hints  "MALTA.hints"   #Default places to look for devices.
@@ -66,4 +68,5 @@ deviceether
 device le
 device miibus
 device md
+device bpf
 device uart
___
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: r255090 - in head/sys: dev/usb netgraph/bluetooth/drivers/ubt

2013-08-30 Thread Hans Petter Selasky
Author: hselasky
Date: Sat Aug 31 06:47:53 2013
New Revision: 255090
URL: http://svnweb.freebsd.org/changeset/base/255090

Log:
  Sync USB bluetooth product list with Linux.
  
  MFC after:1 week

Modified:
  head/sys/dev/usb/usbdevs
  head/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c

Modified: head/sys/dev/usb/usbdevs
==
--- head/sys/dev/usb/usbdevsSat Aug 31 01:30:01 2013(r255089)
+++ head/sys/dev/usb/usbdevsSat Aug 31 06:47:53 2013(r255090)
@@ -515,11 +515,13 @@ vendor USR0x0baf  U.S. Robotics
 vendor AMBIT   0x0bb2  Ambit Microsystems
 vendor HTC 0x0bb4  HTC
 vendor REALTEK 0x0bda  Realtek
+vendor ERICSSON2   0x0bdb  Ericsson
 vendor MEI 0x0bed  MEI
 vendor ADDONICS2   0x0bf6  Addonics Technology
 vendor FSC 0x0bf8  Fujitsu Siemens Computers
 vendor AGATE   0x0c08  Agate Technologies
 vendor DMI 0x0c0b  DMI
+vendor CANYON  0x0c10  Canyon
 vendor ICOM0x0c26  Icom Inc.
 vendor GNOTOMETRICS0x0c33  GN Otometrics
 vendor CHICONY20x0c45  Chicony

Modified: head/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c
==
--- head/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.cSat Aug 31 01:30:01 
2013(r255089)
+++ head/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.cSat Aug 31 06:47:53 
2013(r255090)
@@ -437,6 +437,66 @@ static const STRUCT_USB_HOST_ID ubt_devs
  USB_IFACE_CLASS(UICLASS_VENDOR),
  USB_IFACE_SUBCLASS(UDSUBCLASS_RF),
  USB_IFACE_PROTOCOL(UDPROTO_BLUETOOTH) },
+
+   /* Apple-specific (Broadcom) devices */
+   { USB_VENDOR(USB_VENDOR_APPLE),
+ USB_IFACE_CLASS(UICLASS_VENDOR),
+ USB_IFACE_SUBCLASS(UDSUBCLASS_RF),
+ USB_IFACE_PROTOCOL(UDPROTO_BLUETOOTH) },
+
+   /* Foxconn - Hon Hai */
+   { USB_VENDOR(USB_VENDOR_FOXCONN),
+ USB_IFACE_CLASS(UICLASS_VENDOR),
+ USB_IFACE_SUBCLASS(UDSUBCLASS_RF),
+ USB_IFACE_PROTOCOL(UDPROTO_BLUETOOTH) },
+
+   /* MediaTek MT76x0E */
+   { USB_VPI(USB_VENDOR_MEDIATEK, 0x763f, 0) },
+
+   /* Broadcom SoftSailing reporting vendor specific */
+   { USB_VPI(USB_VENDOR_BROADCOM, 0x21e1, 0) },
+
+   /* Apple MacBookPro 7,1 */
+   { USB_VPI(USB_VENDOR_APPLE, 0x8213, 0) },
+
+   /* Apple iMac11,1 */
+   { USB_VPI(USB_VENDOR_APPLE, 0x8215, 0) },
+
+   /* Apple MacBookPro6,2 */
+   { USB_VPI(USB_VENDOR_APPLE, 0x8218, 0) },
+
+   /* Apple MacBookAir3,1, MacBookAir3,2 */
+   { USB_VPI(USB_VENDOR_APPLE, 0x821b, 0) },
+
+   /* Apple MacBookAir4,1 */
+   { USB_VPI(USB_VENDOR_APPLE, 0x821f, 0) },
+
+   /* MacBookAir6,1 */
+   { USB_VPI(USB_VENDOR_APPLE, 0x828f, 0) },
+
+   /* Apple MacBookPro8,2 */
+   { USB_VPI(USB_VENDOR_APPLE, 0x821a, 0) },
+
+   /* Apple MacMini5,1 */
+   { USB_VPI(USB_VENDOR_APPLE, 0x8281, 0) },
+
+   /* Bluetooth Ultraport Module from IBM */
+   { USB_VPI(USB_VENDOR_TDK, 0x030a, 0) },
+
+   /* ALPS Modules with non-standard ID */
+   { USB_VPI(USB_VENDOR_ALPS, 0x3001, 0) },
+   { USB_VPI(USB_VENDOR_ALPS, 0x3002, 0) },
+
+   { USB_VPI(USB_VENDOR_ERICSSON2, 0x1002, 0) },
+
+   /* Canyon CN-BTU1 with HID interfaces */
+   { USB_VPI(USB_VENDOR_CANYON, 0x, 0) },
+
+   /* Broadcom BCM20702A0 */
+   { USB_VPI(USB_VENDOR_ASUS, 0x17b5, 0) },
+   { USB_VPI(USB_VENDOR_LITEON, 0x2003, 0) },
+   { USB_VPI(USB_VENDOR_FOXCONN, 0xe042, 0) },
+   { USB_VPI(USB_VENDOR_DELL, 0x8197, 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"