svn commit: r259498 - head/contrib/llvm/tools/clang/lib/Headers

2013-12-17 Thread Dimitry Andric
Author: dim
Date: Tue Dec 17 07:59:00 2013
New Revision: 259498
URL: http://svnweb.freebsd.org/changeset/base/259498

Log:
  Pull in r197399 from upstream clang trunk:
  
Add bit_FXSAVE as an alias for bit_FXSR, for gcc compat.
  
  MFC after:3 days

Modified:
  head/contrib/llvm/tools/clang/lib/Headers/cpuid.h

Modified: head/contrib/llvm/tools/clang/lib/Headers/cpuid.h
==
--- head/contrib/llvm/tools/clang/lib/Headers/cpuid.h   Tue Dec 17 07:47:27 
2013(r259497)
+++ head/contrib/llvm/tools/clang/lib/Headers/cpuid.h   Tue Dec 17 07:59:00 
2013(r259498)
@@ -79,6 +79,7 @@
 #define bit_ACPI0x0040
 #define bit_MMX 0x0080
 #define bit_FXSR0x0100
+#define bit_FXSAVE  bit_FXSR/* for gcc compat */
 #define bit_SSE 0x0200
 #define bit_SSE20x0400
 #define bit_SS  0x0800
___
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: r259502 - head/sbin/iscontrol

2013-12-17 Thread Edward Tomasz Napierala
Author: trasz
Date: Tue Dec 17 10:33:27 2013
New Revision: 259502
URL: http://svnweb.freebsd.org/changeset/base/259502

Log:
  Reword the part about mutual CHAP.
  
  MFC after:2 weeks
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sbin/iscontrol/iscsi.conf.5

Modified: head/sbin/iscontrol/iscsi.conf.5
==
--- head/sbin/iscontrol/iscsi.conf.5Tue Dec 17 10:03:04 2013
(r259501)
+++ head/sbin/iscontrol/iscsi.conf.5Tue Dec 17 10:33:27 2013
(r259502)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd October 10, 2013
+.Dd December 17, 2013
 .Dt ISCSI.CONF 5
 .Os
 .Sh NAME
@@ -145,10 +145,9 @@ the chap-name, defaults to
 .Em hostname .
 .It Cm chapDigest
 can be MD5 or SHA1.
-.It Cm tgtChapSecret/tgtChapName
-same as the none
-.Em tgt
-counterpart, but to authenticate the target.
+.It Cm tgtChapName/tgtChapSecret
+name and secret used for mutual CHAP; by default, mutual CHAP
+is not used.
 .El
 .Sh FILES
 .Bl -tag -width indent
___
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: r259503 - head/sys/netinet6

2013-12-17 Thread Andrey V. Elsukov
Author: ae
Date: Tue Dec 17 10:53:17 2013
New Revision: 259503
URL: http://svnweb.freebsd.org/changeset/base/259503

Log:
  Free mbuf in case of error.
  
  MFC after:1 week

Modified:
  head/sys/netinet6/send.c

Modified: head/sys/netinet6/send.c
==
--- head/sys/netinet6/send.cTue Dec 17 10:33:27 2013(r259502)
+++ head/sys/netinet6/send.cTue Dec 17 10:53:17 2013(r259503)
@@ -163,6 +163,7 @@ send_output(struct mbuf *m, struct ifnet
nd6_ra_input(m, sizeof(struct ip6_hdr), icmp6len);
break;
default:
+   m_freem(m);
return (ENOSYS);
}
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: r259412 - in head/sys: conf dev/netmap modules/netmap net

2013-12-17 Thread Sergey Kandaurov
On 15 December 2013 12:37, Luigi Rizzo  wrote:
> Author: luigi
> Date: Sun Dec 15 08:37:24 2013
> New Revision: 259412
> URL: http://svnweb.freebsd.org/changeset/base/259412
>
> Log:
>   split netmap code according to functions:
>   - netmap.cbase code
>   - netmap_freebsd.cFreeBSD-specific code
>   - netmap_generic.cemulate netmap over standard drivers
>   - netmap_mbq.csimple mbuf tailq
>   - netmap_mem2.c   memory management
>   - netmap_vale.c   VALE switch
>
>   simplify devce-specific code
>

This breaks VIMAGE due to removal of necessary includes in netmap.c.



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

2013-12-17 Thread Attilio Rao
Author: attilio
Date: Tue Dec 17 13:37:02 2013
New Revision: 259509
URL: http://svnweb.freebsd.org/changeset/base/259509

Log:
  - Assert for not leaking readers rw locks counter on userland return.
  - Use a correct spin_cnt for KDTRACE_HOOK case in rw read lock.
  
  Sponsored by: EMC / Isilon storage division

Modified:
  head/sys/kern/kern_rwlock.c
  head/sys/kern/subr_trap.c

Modified: head/sys/kern/kern_rwlock.c
==
--- head/sys/kern/kern_rwlock.c Tue Dec 17 13:18:41 2013(r259508)
+++ head/sys/kern/kern_rwlock.c Tue Dec 17 13:37:02 2013(r259509)
@@ -440,6 +440,9 @@ __rw_rlock(volatile uintptr_t *c, const 
break;
cpu_spinwait();
}
+#ifdef KDTRACE_HOOKS
+   spin_cnt += rowner_loops - i;
+#endif
if (i != rowner_loops)
continue;
}

Modified: head/sys/kern/subr_trap.c
==
--- head/sys/kern/subr_trap.c   Tue Dec 17 13:18:41 2013(r259508)
+++ head/sys/kern/subr_trap.c   Tue Dec 17 13:37:02 2013(r259509)
@@ -152,6 +152,9 @@ userret(struct thread *td, struct trapfr
("userret: Returning in a critical section"));
KASSERT(td->td_locks == 0,
("userret: Returning with %d locks held", td->td_locks));
+   KASSERT(td->td_rw_rlocks == 0,
+   ("userret: Returning with %d rwlocks held in read mode",
+   td->td_rw_rlocks));
KASSERT((td->td_pflags & TDP_NOFAULTING) == 0,
("userret: Returning with pagefaults disabled"));
KASSERT(td->td_no_sleeping == 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: r259513 - in head/sys: dev/ofw powerpc/ofw

2013-12-17 Thread Nathan Whitehorn
Author: nwhitehorn
Date: Tue Dec 17 14:50:35 2013
New Revision: 259513
URL: http://svnweb.freebsd.org/changeset/base/259513

Log:
  Configure interrupt sense based on device tree information. This extends
  the OF interrupt map API to return sense information to the caller and
  the PowerPC Open Firmware PCI base driver to use it to program the PIC.

Modified:
  head/sys/dev/ofw/ofw_bus_subr.c
  head/sys/powerpc/ofw/ofw_pci.c

Modified: head/sys/dev/ofw/ofw_bus_subr.c
==
--- head/sys/dev/ofw/ofw_bus_subr.c Tue Dec 17 13:49:35 2013
(r259512)
+++ head/sys/dev/ofw/ofw_bus_subr.c Tue Dec 17 14:50:35 2013
(r259513)
@@ -285,7 +285,7 @@ ofw_bus_lookup_imap(phandle_t node, stru
  * maskbuf must point to a buffer of length physsz + intrsz.
  * The interrupt is returned in result, which must point to a buffer of length
  * rintrsz (which gives the expected size of the mapped interrupt).
- * Returns 1 if a mapping was found, 0 otherwise.
+ * Returns number of cells in the interrupt if a mapping was found, 0 
otherwise.
  */
 int
 ofw_bus_search_intrmap(void *intr, int intrsz, void *regs, int physsz,
@@ -325,19 +325,13 @@ ofw_bus_search_intrmap(void *intr, int i
tsz = physsz + intrsz + sizeof(phandle_t) + pintrsz;
KASSERT(i >= tsz, ("ofw_bus_search_intrmap: truncated map"));
 
-   /*
-* XXX: Apple hardware uses a second cell to set information
-* on the interrupt trigger type.  This information should
-* be used somewhere to program the PIC.
-*/
-
if (bcmp(ref, mptr, physsz + intrsz) == 0) {
bcopy(mptr + physsz + intrsz + sizeof(parent),
-   result, rintrsz);
+   result, MIN(rintrsz, pintrsz));
 
if (iparent != NULL)
*iparent = parent;
-   return (1);
+   return (pintrsz/sizeof(pcell_t));
}
mptr += tsz;
i -= tsz;

Modified: head/sys/powerpc/ofw/ofw_pci.c
==
--- head/sys/powerpc/ofw/ofw_pci.c  Tue Dec 17 13:49:35 2013
(r259512)
+++ head/sys/powerpc/ofw/ofw_pci.c  Tue Dec 17 14:50:35 2013
(r259513)
@@ -256,7 +256,8 @@ ofw_pci_route_interrupt(device_t bus, de
 {
struct ofw_pci_softc *sc;
struct ofw_pci_register reg;
-   uint32_t pintr, mintr;
+   uint32_t pintr, mintr[2];
+   int intrcells;
phandle_t iparent;
uint8_t maskbuf[sizeof(reg) + sizeof(pintr)];
 
@@ -269,10 +270,15 @@ ofw_pci_route_interrupt(device_t bus, de
(pci_get_slot(dev) << OFW_PCI_PHYS_HI_DEVICESHIFT) |
(pci_get_function(dev) << OFW_PCI_PHYS_HI_FUNCTIONSHIFT);
 
-   if (ofw_bus_lookup_imap(ofw_bus_get_node(dev), &sc->sc_pci_iinfo, ®,
-   sizeof(reg), &pintr, sizeof(pintr), &mintr, sizeof(mintr),
-   &iparent, maskbuf))
-   return (ofw_bus_map_intr(dev, iparent, mintr));
+   intrcells = ofw_bus_lookup_imap(ofw_bus_get_node(dev),
+   &sc->sc_pci_iinfo, ®, sizeof(reg), &pintr, sizeof(pintr),
+   mintr, sizeof(mintr), &iparent, maskbuf);
+   if (intrcells) {
+   pintr = ofw_bus_map_intr(dev, iparent, mintr[0]);
+   if (intrcells == 2)
+   ofw_bus_config_intr(dev, pintr, mintr[1]);
+   return (pintr);
+   }
 
/* Maybe it's a real interrupt, not an intpin */
if (pin > 4)
___
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: r259514 - head/sys/dev/fdt

2013-12-17 Thread Nathan Whitehorn
Author: nwhitehorn
Date: Tue Dec 17 14:51:47 2013
New Revision: 259514
URL: http://svnweb.freebsd.org/changeset/base/259514

Log:
  Remove dead code. Most of this was in an #if 0 block; the rest is not
  used and duplicates functionality in dev/ofw.

Modified:
  head/sys/dev/fdt/fdt_common.h
  head/sys/dev/fdt/fdt_pci.c

Modified: head/sys/dev/fdt/fdt_common.h
==
--- head/sys/dev/fdt/fdt_common.h   Tue Dec 17 14:50:35 2013
(r259513)
+++ head/sys/dev/fdt/fdt_common.h   Tue Dec 17 14:51:47 2013
(r259514)
@@ -47,14 +47,6 @@ struct fdt_pci_range {
u_long  len;
 };
 
-struct fdt_pci_intr {
-   int addr_cells;
-   int intr_cells;
-   int map_len;
-   pcell_t *map;
-   pcell_t *mask;
-};
-
 struct fdt_sense_level {
enum intr_trigger   trig;
enum intr_polarity  pol;
@@ -110,11 +102,9 @@ int fdt_is_enabled(phandle_t);
 int fdt_pm_is_enabled(phandle_t);
 int fdt_is_type(phandle_t, const char *);
 int fdt_parent_addr_cells(phandle_t);
-int fdt_pci_intr_info(phandle_t, struct fdt_pci_intr *);
 int fdt_pci_ranges(phandle_t, struct fdt_pci_range *, struct fdt_pci_range *);
 int fdt_pci_ranges_decode(phandle_t, struct fdt_pci_range *,
 struct fdt_pci_range *);
-int fdt_pci_route_intr(int, int, int, int, struct fdt_pci_intr *, int *);
 int fdt_ranges_verify(pcell_t *, int, int, int, int);
 int fdt_reg_to_rl(phandle_t, struct resource_list *);
 int fdt_pm(phandle_t);

Modified: head/sys/dev/fdt/fdt_pci.c
==
--- head/sys/dev/fdt/fdt_pci.c  Tue Dec 17 14:50:35 2013(r259513)
+++ head/sys/dev/fdt/fdt_pci.c  Tue Dec 17 14:51:47 2013(r259514)
@@ -180,159 +180,6 @@ fdt_pci_ranges(phandle_t node, struct fd
return (0);
 }
 
-static int
-fdt_addr_cells(phandle_t node, int *addr_cells)
-{
-   pcell_t cell;
-   int cell_size;
-
-   cell_size = sizeof(cell);
-   if (OF_getprop(node, "#address-cells", &cell, cell_size) < cell_size)
-   return (EINVAL);
-   *addr_cells = fdt32_to_cpu((int)cell);
-
-   if (*addr_cells > 3)
-   return (ERANGE);
-   return (0);
-}
-
-static int
-fdt_interrupt_cells(phandle_t node)
-{
-   pcell_t intr_cells;
-
-   if (OF_getprop(node, "#interrupt-cells", &intr_cells,
-   sizeof(intr_cells)) <= 0) {
-   debugf("no intr-cells defined, defaulting to 1\n");
-   intr_cells = 1;
-   }
-   intr_cells = fdt32_to_cpu(intr_cells);
-
-   return ((int)intr_cells);
-}
-
-int
-fdt_pci_intr_info(phandle_t node, struct fdt_pci_intr *intr_info)
-{
-   void *map, *mask;
-   int acells, icells;
-   int error, len;
-
-   error = fdt_addr_cells(node, &acells);
-   if (error)
-   return (error);
-
-   icells = fdt_interrupt_cells(node);
-
-   /*
-* Retrieve the interrupt map and mask properties.
-*/
-   len = OF_getprop_alloc(node, "interrupt-map-mask", 1, &mask);
-   if (len / sizeof(pcell_t) != (acells + icells)) {
-   debugf("bad mask len = %d\n", len);
-   goto err;
-   }
-
-   len = OF_getprop_alloc(node, "interrupt-map", 1, &map);
-   if (len <= 0) {
-   debugf("bad map len = %d\n", len);
-   goto err;
-   }
-
-   intr_info->map_len = len;
-   intr_info->map = map;
-   intr_info->mask = mask;
-   intr_info->addr_cells = acells;
-   intr_info->intr_cells = icells;
-
-   debugf("acells=%u, icells=%u, map_len=%u\n", acells, icells, len);
-   return (0);
-
-err:
-   free(mask, M_OFWPROP);
-   return (ENXIO);
-}
-
-int
-fdt_pci_route_intr(int bus, int slot, int func, int pin,
-struct fdt_pci_intr *intr_info, int *interrupt)
-{
-   pcell_t child_spec[4], masked[4];
-   phandle_t iph;
-   pcell_t intr_par;
-   pcell_t *map_ptr;
-   uint32_t addr;
-   int i, j, map_len;
-   int par_intr_cells, par_addr_cells, child_spec_cells, row_cells;
-   int par_idx, spec_idx, err, trig, pol;
-
-   child_spec_cells = intr_info->addr_cells + intr_info->intr_cells;
-   if (child_spec_cells > sizeof(child_spec) / sizeof(pcell_t))
-   return (ENOMEM);
-
-   addr = (bus << 16) | (slot << 11) | (func << 8);
-   child_spec[0] = addr;
-   child_spec[1] = 0;
-   child_spec[2] = 0;
-   child_spec[3] = pin;
-
-   map_len = intr_info->map_len;
-   map_ptr = intr_info->map;
-
-   par_idx = child_spec_cells;
-   i = 0;
-   while (i < map_len) {
-   iph = fdt32_to_cpu(map_ptr[par_idx]);
-   intr_par = OF_xref_phandle(iph);
-
-   err = fdt_addr_cells(intr_par, &par_addr_cells);
-   if (err != 0) {
-   debugf("could not retrieve intr parent #addr-cells\n");
-

svn commit: r259516 - in head/sys: arm/mv dev/ofw powerpc/ofw sparc64/ebus sparc64/isa sparc64/pci

2013-12-17 Thread Nathan Whitehorn
Author: nwhitehorn
Date: Tue Dec 17 15:11:24 2013
New Revision: 259516
URL: http://svnweb.freebsd.org/changeset/base/259516

Log:
  Simplify the ofw_bus_lookup_imap() API slightly: make it allocate maskbuf
  internally instead of requiring the caller to allocate it.

Modified:
  head/sys/arm/mv/mv_pci.c
  head/sys/dev/ofw/ofw_bus_subr.c
  head/sys/dev/ofw/ofw_bus_subr.h
  head/sys/powerpc/ofw/ofw_pci.c
  head/sys/powerpc/ofw/ofw_pcib_pci.c
  head/sys/sparc64/ebus/ebus.c
  head/sys/sparc64/isa/ofw_isa.c
  head/sys/sparc64/pci/fire.c
  head/sys/sparc64/pci/ofw_pcib_subr.c
  head/sys/sparc64/pci/psycho.c
  head/sys/sparc64/pci/schizo.c

Modified: head/sys/arm/mv/mv_pci.c
==
--- head/sys/arm/mv/mv_pci.cTue Dec 17 14:55:23 2013(r259515)
+++ head/sys/arm/mv/mv_pci.cTue Dec 17 15:11:24 2013(r259516)
@@ -884,7 +884,6 @@ mv_pcib_route_interrupt(device_t bus, de
struct ofw_pci_register reg;
uint32_t pintr, mintr;
phandle_t iparent;
-   uint8_t maskbuf[sizeof(reg) + sizeof(pintr)];
 
sc = device_get_softc(bus);
pintr = pin;
@@ -897,7 +896,7 @@ mv_pcib_route_interrupt(device_t bus, de
 
if (ofw_bus_lookup_imap(ofw_bus_get_node(dev), &sc->sc_pci_iinfo, ®,
sizeof(reg), &pintr, sizeof(pintr), &mintr, sizeof(mintr),
-   &iparent, maskbuf))
+   &iparent))
return (ofw_bus_map_intr(dev, iparent, mintr));
 
/* Maybe it's a real interrupt, not an intpin */

Modified: head/sys/dev/ofw/ofw_bus_subr.c
==
--- head/sys/dev/ofw/ofw_bus_subr.c Tue Dec 17 14:55:23 2013
(r259515)
+++ head/sys/dev/ofw/ofw_bus_subr.c Tue Dec 17 15:11:24 2013
(r259516)
@@ -251,8 +251,9 @@ ofw_bus_setup_iinfo(phandle_t node, stru
 int
 ofw_bus_lookup_imap(phandle_t node, struct ofw_bus_iinfo *ii, void *reg,
 int regsz, void *pintr, int pintrsz, void *mintr, int mintrsz,
-phandle_t *iparent, void *maskbuf)
+phandle_t *iparent)
 {
+   uint8_t maskbuf[regsz + pintrsz];
int rv;
 
if (ii->opi_imapsz <= 0)

Modified: head/sys/dev/ofw/ofw_bus_subr.h
==
--- head/sys/dev/ofw/ofw_bus_subr.h Tue Dec 17 14:55:23 2013
(r259515)
+++ head/sys/dev/ofw/ofw_bus_subr.h Tue Dec 17 15:11:24 2013
(r259516)
@@ -68,7 +68,7 @@ bus_child_pnpinfo_str_t   ofw_bus_gen_chil
 /* Routines for processing firmware interrupt maps */
 void   ofw_bus_setup_iinfo(phandle_t, struct ofw_bus_iinfo *, int);
 intofw_bus_lookup_imap(phandle_t, struct ofw_bus_iinfo *, void *, int,
-   void *, int, void *, int, phandle_t *, void *);
+   void *, int, void *, int, phandle_t *);
 intofw_bus_search_intrmap(void *, int, void *, int, void *, int, void *,
void *, void *, int, phandle_t *);
 

Modified: head/sys/powerpc/ofw/ofw_pci.c
==
--- head/sys/powerpc/ofw/ofw_pci.c  Tue Dec 17 14:55:23 2013
(r259515)
+++ head/sys/powerpc/ofw/ofw_pci.c  Tue Dec 17 15:11:24 2013
(r259516)
@@ -259,7 +259,6 @@ ofw_pci_route_interrupt(device_t bus, de
uint32_t pintr, mintr[2];
int intrcells;
phandle_t iparent;
-   uint8_t maskbuf[sizeof(reg) + sizeof(pintr)];
 
sc = device_get_softc(bus);
pintr = pin;
@@ -272,7 +271,7 @@ ofw_pci_route_interrupt(device_t bus, de
 
intrcells = ofw_bus_lookup_imap(ofw_bus_get_node(dev),
&sc->sc_pci_iinfo, ®, sizeof(reg), &pintr, sizeof(pintr),
-   mintr, sizeof(mintr), &iparent, maskbuf);
+   mintr, sizeof(mintr), &iparent);
if (intrcells) {
pintr = ofw_bus_map_intr(dev, iparent, mintr[0]);
if (intrcells == 2)

Modified: head/sys/powerpc/ofw/ofw_pcib_pci.c
==
--- head/sys/powerpc/ofw/ofw_pcib_pci.c Tue Dec 17 14:55:23 2013
(r259515)
+++ head/sys/powerpc/ofw/ofw_pcib_pci.c Tue Dec 17 15:11:24 2013
(r259516)
@@ -134,9 +134,9 @@ ofw_pcib_pci_route_interrupt(device_t br
struct ofw_pcib_softc *sc;
struct ofw_bus_iinfo *ii;
struct ofw_pci_register reg;
-   cell_t pintr, mintr;
+   cell_t pintr, mintr[2];
+   int intrcells;
phandle_t iparent;
-   uint8_t maskbuf[sizeof(reg) + sizeof(pintr)];
 
sc = device_get_softc(bridge);
ii = &sc->ops_iinfo;
@@ -149,15 +149,20 @@ ofw_pcib_pci_route_interrupt(device_t br
(pci_get_slot(dev) << OFW_PCI_PHYS_HI_DEVICESHIFT) |
(pci_get_function(dev) << OFW_PCI_PHYS_HI_FUNCTIONSHIFT);
 
-   if (ofw_bus_lookup_imap(ofw_bus_get_node(dev), ii, ®,
-   sizeof(reg), &pintr, 

svn commit: r259517 - in head/sys/arm: broadcom/bcm2835 conf

2013-12-17 Thread Aleksandr Rybalko
Author: ray
Date: Tue Dec 17 15:23:47 2013
New Revision: 259517
URL: http://svnweb.freebsd.org/changeset/base/259517

Log:
  Add vt support for RPi. (No early stage yet.)
  
  Sponsored by: The FreeBSD Foundation

Added:
  head/sys/arm/broadcom/bcm2835/bcm2835_fbd.c
 - copied, changed from r259364, head/sys/arm/broadcom/bcm2835/bcm2835_fb.c
Modified:
  head/sys/arm/broadcom/bcm2835/files.bcm2835
  head/sys/arm/conf/RPI-B

Copied and modified: head/sys/arm/broadcom/bcm2835/bcm2835_fbd.c (from r259364, 
head/sys/arm/broadcom/bcm2835/bcm2835_fb.c)
==
--- head/sys/arm/broadcom/bcm2835/bcm2835_fb.c  Fri Dec 13 23:56:53 2013
(r259364, copy source)
+++ head/sys/arm/broadcom/bcm2835/bcm2835_fbd.c Tue Dec 17 15:23:47 2013
(r259517)
@@ -60,47 +60,14 @@ __FBSDID("$FreeBSD$");
 #include 
 
 #include 
-#include 
+#include 
 
 #include 
 #include 
 
+#include "fb_if.h"
 #include "mbox_if.h"
 
-#defineBCMFB_FONT_HEIGHT   16
-
-struct argb {
-   uint8_t a;
-   uint8_t r;
-   uint8_t g;
-   uint8_t b;
-};
-
-static struct argb bcmfb_palette[16] = {
-   {0x00, 0x00, 0x00, 0x00},
-   {0x00, 0x00, 0x00, 0xaa},
-   {0x00, 0x00, 0xaa, 0x00},
-   {0x00, 0x00, 0xaa, 0xaa},
-   {0x00, 0xaa, 0x00, 0x00},
-   {0x00, 0xaa, 0x00, 0xaa},
-   {0x00, 0xaa, 0x55, 0x00},
-   {0x00, 0xaa, 0xaa, 0xaa},
-   {0x00, 0x55, 0x55, 0x55},
-   {0x00, 0x55, 0x55, 0xff},
-   {0x00, 0x55, 0xff, 0x55},
-   {0x00, 0x55, 0xff, 0xff},
-   {0x00, 0xff, 0x55, 0x55},
-   {0x00, 0xff, 0x55, 0xff},
-   {0x00, 0xff, 0xff, 0x55},
-   {0x00, 0xff, 0xff, 0xff}
-};
-
-/* mouse pointer from dev/syscons/scgfbrndr.c */
-static u_char mouse_pointer[16] = {
-0x00, 0x40, 0x60, 0x70, 0x78, 0x7c, 0x7e, 0x68,
-0x0c, 0x0c, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00
-};
-
 #define FB_WIDTH   640
 #define FB_HEIGHT  480
 #define FB_DEPTH   24
@@ -121,8 +88,7 @@ struct bcm_fb_config {
 
 struct bcmsc_softc {
device_tdev;
-   struct cdev *   cdev;
-   struct mtx  mtx;
+   struct fb_info  *info;
bus_dma_tag_t   dma_tag;
bus_dmamap_tdma_map;
struct bcm_fb_config*   fb_config;
@@ -131,56 +97,34 @@ struct bcmsc_softc {
 
 };
 
-struct video_adapter_softc {
-   /* Videoadpater part */
-   video_adapter_t va;
-   int console;
-
-   intptr_tfb_addr;
-   intptr_tfb_paddr;
-   unsigned intfb_size;
-
-   unsigned intheight;
-   unsigned intwidth;
-   unsigned intdepth;
-   unsigned intstride;
-
-   unsigned intxmargin;
-   unsigned intymargin;
-
-   unsigned char   *font;
-   int initialized;
-};
-
-static struct bcmsc_softc *bcmsc_softc;
-static struct video_adapter_softc va_softc;
-
-#definebcm_fb_lock(_sc)mtx_lock(&(_sc)->mtx)
-#definebcm_fb_unlock(_sc)  mtx_unlock(&(_sc)->mtx)
-#definebcm_fb_lock_assert(sc)  mtx_assert(&(_sc)->mtx, MA_OWNED)
-
 static int bcm_fb_probe(device_t);
 static int bcm_fb_attach(device_t);
 static void bcm_fb_dmamap_cb(void *arg, bus_dma_segment_t *segs, int nseg, int 
err);
-static void bcmfb_update_margins(video_adapter_t *adp);
-static int bcmfb_configure(int);
 
 static void
 bcm_fb_init(void *arg)
 {
struct bcmsc_softc *sc = arg;
-   struct video_adapter_softc *va_sc = &va_softc;
-   int err;
volatile struct bcm_fb_config*  fb_config = sc->fb_config;
+   struct fb_info *info;
phandle_t node;
pcell_t cell;
device_t mbox;
+   device_t fbd;
+   int err = 0;
 
node = ofw_bus_get_node(sc->dev);
 
fb_config->xres = 0;
fb_config->yres = 0;
fb_config->bpp = 0;
+   fb_config->vxres = 0;
+   fb_config->vyres = 0;
+   fb_config->xoffset = 0;
+   fb_config->yoffset = 0;
+   fb_config->base = 0;
+   fb_config->pitch = 0;
+   fb_config->screen_size = 0;
 
if ((OF_getprop(node, "broadcom,width", &cell, sizeof(cell))) > 0)
fb_config->xres = (int)fdt32_to_cpu(cell);
@@ -197,14 +141,6 @@ bcm_fb_init(void *arg)
if (fb_config->bpp == 0)
fb_config->bpp = FB_DEPTH;
 
-   fb_config->vxres = 0;
-   fb_config->vyres = 0;
-   fb_config->xoffset = 0;
-   fb_config->yoffset = 0;
-   fb_config->base = 0;
-   fb_config->pitch = 0;
-   fb_config->screen_size = 0;
-
bus_dmamap_sync(sc->dma_tag, sc->dma_map,
BUS_DMASYNC_PREWRITE | BUS_DMASYNC_PREREAD);
 
@@ -228,17 +164,33 @@ bcm_fb_init(void *arg)
fb_config->pitch, fb_config->base,
fb_config->screen_size);
 
-   va_sc->fb_addr = (intptr_t)p

svn commit: r259518 - head/sys/arm/broadcom/bcm2835

2013-12-17 Thread Aleksandr Rybalko
Author: ray
Date: Tue Dec 17 15:34:38 2013
New Revision: 259518
URL: http://svnweb.freebsd.org/changeset/base/259518

Log:
  Fix copyright and some style(9) things.
  
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/arm/broadcom/bcm2835/bcm2835_fbd.c

Modified: head/sys/arm/broadcom/bcm2835/bcm2835_fbd.c
==
--- head/sys/arm/broadcom/bcm2835/bcm2835_fbd.c Tue Dec 17 15:23:47 2013
(r259517)
+++ head/sys/arm/broadcom/bcm2835/bcm2835_fbd.c Tue Dec 17 15:34:38 2013
(r259518)
@@ -1,7 +1,11 @@
 /*-
  * Copyright (c) 2012 Oleksandr Tymoshenko 
+ * Copyright (c) 2012, 2013 The FreeBSD Foundation
  * All rights reserved.
  *
+ * Portions of this software were developed by Oleksandr Rybalko
+ * under sponsorship from the FreeBSD Foundation.
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
@@ -99,13 +103,14 @@ struct bcmsc_softc {
 
 static int bcm_fb_probe(device_t);
 static int bcm_fb_attach(device_t);
-static void bcm_fb_dmamap_cb(void *arg, bus_dma_segment_t *segs, int nseg, int 
err);
+static void bcm_fb_dmamap_cb(void *arg, bus_dma_segment_t *segs, int nseg,
+int err);
 
 static void
 bcm_fb_init(void *arg)
 {
-   struct bcmsc_softc *sc = arg;
-   volatile struct bcm_fb_config*  fb_config = sc->fb_config;
+   volatile struct bcm_fb_config *fb_config;
+   struct bcmsc_softc *sc;
struct fb_info *info;
phandle_t node;
pcell_t cell;
@@ -113,6 +118,8 @@ bcm_fb_init(void *arg)
device_t fbd;
int err = 0;
 
+   sc = arg;
+   fb_config = sc->fb_config;
node = ofw_bus_get_node(sc->dev);
 
fb_config->xres = 0;
@@ -153,23 +160,25 @@ bcm_fb_init(void *arg)
BUS_DMASYNC_POSTREAD);
 
if (fb_config->base != 0) {
-   device_printf(sc->dev, "%dx%d(%dx%d@%d,%d) %dbpp\n", 
+   device_printf(sc->dev, "%dx%d(%dx%d@%d,%d) %dbpp\n",
fb_config->xres, fb_config->yres,
fb_config->vxres, fb_config->vyres,
fb_config->xoffset, fb_config->yoffset,
fb_config->bpp);
 
 
-   device_printf(sc->dev, "pitch %d, base 0x%08x, screen_size 
%d\n", 
+   device_printf(sc->dev, "pitch %d, base 0x%08x, screen_size 
%d\n",
fb_config->pitch, fb_config->base,
fb_config->screen_size);
 
 
 
 
-   info = malloc(sizeof(struct fb_info), M_DEVBUF, M_WAITOK | 
M_ZERO);
+   info = malloc(sizeof(struct fb_info), M_DEVBUF,
+   M_WAITOK | M_ZERO);
info->fb_name = device_get_nameunit(sc->dev);
-   info->fb_vbase = (intptr_t)pmap_mapdev(fb_config->base, 
fb_config->screen_size);
+   info->fb_vbase = (intptr_t)pmap_mapdev(fb_config->base,
+   fb_config->screen_size);
info->fb_pbase = fb_config->base;
info->fb_size = fb_config->screen_size;
info->fb_bpp = info->fb_depth = fb_config->bpp;
@@ -179,7 +188,8 @@ bcm_fb_init(void *arg)
 
sc->info = info;
 
-   fbd = device_add_child(sc->dev, "fbd", 
device_get_unit(sc->dev));
+   fbd = device_add_child(sc->dev, "fbd",
+   device_get_unit(sc->dev));
if (fbd == NULL) {
device_printf(sc->dev, "Failed to add fbd child\n");
return;
@@ -244,8 +254,8 @@ bcm_fb_attach(device_t dev)
goto fail;
}
 
-   /* 
-* We have to wait until interrupts are enabled. 
+   /*
+* We have to wait until interrupts are enabled.
 * Mailbox relies on it to get data from VideoCore
 */
 sc->init_hook.ich_func = bcm_fb_init;
___
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: r259520 - head/sys/kern

2013-12-17 Thread Andrey V. Elsukov
Author: ae
Date: Tue Dec 17 16:45:19 2013
New Revision: 259520
URL: http://svnweb.freebsd.org/changeset/base/259520

Log:
  Fix copy/paste typo.
  
  MFC after:1 week

Modified:
  head/sys/kern/kern_jail.c

Modified: head/sys/kern/kern_jail.c
==
--- head/sys/kern/kern_jail.c   Tue Dec 17 16:10:59 2013(r259519)
+++ head/sys/kern/kern_jail.c   Tue Dec 17 16:45:19 2013(r259520)
@@ -3047,7 +3047,7 @@ prison_restrict_ip6(struct prison *pr, s
ii++;
continue;
}
-   switch (ij >= ppr->pr_ip4s ? -1 :
+   switch (ij >= ppr->pr_ip6s ? -1 :
qcmp_v6(&pr->pr_ip6[ii], &ppr->pr_ip6[ij])) {
case -1:
bcopy(pr->pr_ip6 + ii + 1, pr->pr_ip6 + ii,
___
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: r259521 - head/sys/fs/fifofs

2013-12-17 Thread Konstantin Belousov
Author: kib
Date: Tue Dec 17 17:28:02 2013
New Revision: 259521
URL: http://svnweb.freebsd.org/changeset/base/259521

Log:
  Do not allow O_EXEC opens for fifo, return EINVAL.
  
  Besides not making sense, open(O_EXEC) for fifo creates fifoinfo with
  zero readers and writers counts, which causes premature free of pipes.
  
  Reported and tested by:   pho
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week

Modified:
  head/sys/fs/fifofs/fifo_vnops.c

Modified: head/sys/fs/fifofs/fifo_vnops.c
==
--- head/sys/fs/fifofs/fifo_vnops.c Tue Dec 17 16:45:19 2013
(r259520)
+++ head/sys/fs/fifofs/fifo_vnops.c Tue Dec 17 17:28:02 2013
(r259521)
@@ -143,7 +143,7 @@ fifo_open(ap)
fp = ap->a_fp;
td = ap->a_td;
ASSERT_VOP_ELOCKED(vp, "fifo_open");
-   if (fp == NULL)
+   if (fp == NULL || (ap->a_mode & FEXEC) != 0)
return (EINVAL);
if ((fip = vp->v_fifoinfo) == NULL) {
error = pipe_named_ctor(&fpipe, td);
___
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: r259522 - head/sys/kern

2013-12-17 Thread Konstantin Belousov
Author: kib
Date: Tue Dec 17 17:31:16 2013
New Revision: 259522
URL: http://svnweb.freebsd.org/changeset/base/259522

Log:
  If vn_open_vnode() succeeded in opening the vnode, but subsequent
  advisory lock cannot be obtained, prevent double-close of the vnode in
  vn_close() called from the fdrop(), by resetting file' f_ops methods.
  
  Reported and tested by:   pho
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week

Modified:
  head/sys/kern/vfs_vnops.c

Modified: head/sys/kern/vfs_vnops.c
==
--- head/sys/kern/vfs_vnops.c   Tue Dec 17 17:28:02 2013(r259521)
+++ head/sys/kern/vfs_vnops.c   Tue Dec 17 17:31:16 2013(r259522)
@@ -313,6 +313,9 @@ vn_open_vnode(struct vnode *vp, int fmod
vn_lock(vp, lock_flags | LK_RETRY);
(void)VOP_CLOSE(vp, fmode, cred, td);
vn_finished_write(mp);
+   /* Prevent second close from fdrop()->vn_close(). */
+   if (fp != NULL)
+   fp->f_ops= &badfileops;
return (error);
}
fp->f_flag |= FHASLOCK;
___
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: r259407 - head/sys/kern

2013-12-17 Thread John Baldwin
On Saturday, December 14, 2013 11:11:43 pm Mateusz Guzik wrote:
> Author: mjg
> Date: Sun Dec 15 04:11:43 2013
> New Revision: 259407
> URL: http://svnweb.freebsd.org/changeset/base/259407
> 
> Log:
>   proc exit: don't take PROC_LOCK while freeing rlimits
>   
>   Code wishing to check rlimits of some process should check whether it
>   is exiting first, which current consumers do.

Does this measurably reduce contention?

-- 
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: r259010 - in head/sys: conf powerpc/fpu

2013-12-17 Thread John Baldwin
On Monday, December 16, 2013 8:32:39 am Dag-Erling Smørgrav wrote:
> John Baldwin  writes:
> > Dag-Erling Smørgrav  writes:
> > > John Baldwin  writes:
> > > > LINT64 is yet another kernel config covered by 'make tinderbox',
> > > > but not by the periodic tinderbox.  It is probably worth adding to
> > > > the periodic tinderbox (someday it'd be nice if the two
> > > > tinderboxes built the same set of things).
> > > Some day it would be nice if people talked to me directly instead of
> > > sniping from the sidelines.
> > Ah, but when people have raised this exact issue before (that tcbuild
> > and 'make tinderbox' build different things), you have blown them off
> > repeatedly.
> 
> I have no idea what tcbuild is.

I meant it as the name of your scripts (probably have ports-mgmt/tinderbox on 
the brain too much).

> I blow people off when they complain that the tinderbox doesn't work
> exactly like 'make tinderbox' because it's not intended to.

I just want it to build the same things and report errors when they are 
broken.  In that sense they should both do the same thing.

> > > Oh, and 'make tinderbox' should die.
> > No, it is very developer friendly as it Just Works(tm) as a single
> > command from an existing source tree checkout.
> 
> We already had 'make universe'.
> 
> The story behind 'make tinderbox' is that Alfred threw a fit over a
> tinderbox breakage and insisted, despite being provided with ample proof
> to the contrary, that my tinderbox was a black box which nobody knew how
> worked and nobody could reproduce and that tinderbox reports were
> therefore worthless.  He then proceeded to implement 'make tinderbox'
> purely to piss me off.  It serves no other purpose and needs to die.

Ah, a bit touchy I see.  While that might have been Alfred's initial
motivation, the points still remain that:

1) 'make tinderbox' Just Works as a single command from an existing source
   tree checkout.  I don't have to track down some other thing from some
   other SVN tree to checkout and configure.  It's also easy to reproduce
   a single failed build step in the same tree by doing 'make buildkernel'
   etc. so I can fix an issue that pops up and do quick turnaround testing
   and do a final 'make tinderbox' to make sure all is still well.

2) 'make tinderbox' provides a summary of what failed.  'make universe'
   does not.  You have to go check all the log files by hand to see if
   anything failed.  That is less helpful.

It definitely serves a useful purpose for many developers, and I for one
don't sit and cackle maniacally while rubbing my hands each time I invoke
it because I think that somehow my doing so is pissing you off.

> > It also happens to build more of the tree than the periodic tinderbox
> > (by building more kernel configs, albeit doing quite a bit of
> > duplicate work for platforms like arm in the process).
> 
> That's simply not true.  The tinderbox builds exactly the same kernels
> as 'make tinderbox' if they're present.  The issue here is that a bug in
> the source tree prevents some of these kernel configurations from being
> generated, hence the tinderbox cannot build them.

Ah, I thought at one point it only built GENERIC and LINT type configs,
but presumably that has changed?  As long as they build the same things
I'm happy.  I just want to avoid running into unrelated breakages when I
do a 'make tinderbox' on a patched tree (the unrelated breakage thing is
what I recently ran into with LINT64).

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

2013-12-17 Thread Mateusz Guzik
On Tue, Dec 17, 2013 at 11:41:49AM -0500, John Baldwin wrote:
> On Saturday, December 14, 2013 11:11:43 pm Mateusz Guzik wrote:
> > Author: mjg
> > Date: Sun Dec 15 04:11:43 2013
> > New Revision: 259407
> > URL: http://svnweb.freebsd.org/changeset/base/259407
> > 
> > Log:
> >   proc exit: don't take PROC_LOCK while freeing rlimits
> >   
> >   Code wishing to check rlimits of some process should check whether it
> >   is exiting first, which current consumers do.
> 
> Does this measurably reduce contention?
> 

No, this is just a cosmetic change I did while doing some other work
with rlimits.

It would use some more cosmetic work (e.g. no reason not to
lim_free(p->plimit); p->p_limit = NULL) and maybe I'll get to that
later unless this kind of stuff is unwanted.

-- 
Mateusz Guzik 
___
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: r259525 - in head/contrib/gcc: . config/rs6000

2013-12-17 Thread Pedro F. Giffuni
Author: pfg
Date: Tue Dec 17 20:53:22 2013
New Revision: 259525
URL: http://svnweb.freebsd.org/changeset/base/259525

Log:
  gcc: fix ICE in rs600 when using -fno-trapping-math.
  
  Solves GCC-PR target/30485
  
  Obtained from:gcc 4.3 (rev. 120902; GPLv2)
  MFC after:2 weeks

Modified:
  head/contrib/gcc/ChangeLog.gcc43
  head/contrib/gcc/config/rs6000/rs6000.c

Modified: head/contrib/gcc/ChangeLog.gcc43
==
--- head/contrib/gcc/ChangeLog.gcc43Tue Dec 17 18:44:46 2013
(r259524)
+++ head/contrib/gcc/ChangeLog.gcc43Tue Dec 17 20:53:22 2013
(r259525)
@@ -399,6 +399,12 @@
(override_options): Add PTA_CX16 flag.  Set x86_cmpxchg16b
for CPUs that have PTA_CX16 set.
 
+2007-01-18  Josh Conner   (r120902)
+
+   PR target/30485
+   * config/rs6000/rs6000.c (rs6000_emit_vector_compare): Add
+   support for UNLE, UNLT, UNGE, and UNGT.
+
 2007-01-17  Eric Christopher   (r120846)
 
* config.gcc: Support core2 processor.

Modified: head/contrib/gcc/config/rs6000/rs6000.c
==
--- head/contrib/gcc/config/rs6000/rs6000.c Tue Dec 17 18:44:46 2013
(r259524)
+++ head/contrib/gcc/config/rs6000/rs6000.c Tue Dec 17 20:53:22 2013
(r259525)
@@ -11738,10 +11738,18 @@ rs6000_emit_vector_compare (enum rtx_cod
  try_again = true;
  break;
case NE:
- /* Treat A != B as ~(A==B).  */
+   case UNLE:
+   case UNLT:
+   case UNGE:
+   case UNGT:
+ /* Invert condition and try again.
+e.g., A != B becomes ~(A==B).  */
  {
+   enum rtx_code rev_code;
enum insn_code nor_code;
-   rtx eq_rtx = rs6000_emit_vector_compare (EQ, op0, op1,
+
+   rev_code = reverse_condition_maybe_unordered (rcode);
+   rtx eq_rtx = rs6000_emit_vector_compare (rev_code, op0, op1,
 dest_mode);
 
nor_code = one_cmpl_optab->handlers[(int)dest_mode].insn_code;
___
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: r259523 - head/share/mk

2013-12-17 Thread Ed Maste
Author: emaste
Date: Tue Dec 17 18:30:37 2013
New Revision: 259523
URL: http://svnweb.freebsd.org/changeset/base/259523

Log:
  Require a C++11 compiler to build LLDB
  
  In practice the old test (using MK_CLANG_IS_CC) is similar, but
  COMPILER_FEATURES provides the information we actually want to test.
  
  Sponsored by: DARPA, AFRL

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

Modified: head/share/mk/bsd.own.mk
==
--- head/share/mk/bsd.own.mkTue Dec 17 17:31:16 2013(r259522)
+++ head/share/mk/bsd.own.mkTue Dec 17 18:30:37 2013(r259523)
@@ -552,10 +552,6 @@ MK_CLANG_EXTRAS:= no
 MK_CLANG_FULL:= no
 .endif
 
-.if ${MK_CLANG_IS_CC} == "no"
-MK_LLDB:= no
-.endif
-
 .if defined(NO_TESTS)
 # This should be handled above along the handling of all other NO_*  options.
 # However, the above is broken when WITH_*=yes are passed to make(1) as
@@ -650,6 +646,10 @@ MK_${var}:=no
 .endif
 .endfor
 
+.if !${COMPILER_FEATURES:Mc++11}
+MK_LLDB:=  no
+.endif
+
 .if ${MK_CTF} != "no"
 CTFCONVERT_CMD=${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
 .elif defined(.PARSEDIR) || (defined(MAKE_VERSION) && ${MAKE_VERSION} >= 
520300)
___
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: r259407 - head/sys/kern

2013-12-17 Thread John Baldwin
On Tuesday, December 17, 2013 1:17:45 pm Mateusz Guzik wrote:
> On Tue, Dec 17, 2013 at 11:41:49AM -0500, John Baldwin wrote:
> > On Saturday, December 14, 2013 11:11:43 pm Mateusz Guzik wrote:
> > > Author: mjg
> > > Date: Sun Dec 15 04:11:43 2013
> > > New Revision: 259407
> > > URL: http://svnweb.freebsd.org/changeset/base/259407
> > > 
> > > Log:
> > >   proc exit: don't take PROC_LOCK while freeing rlimits
> > >   
> > >   Code wishing to check rlimits of some process should check whether it
> > >   is exiting first, which current consumers do.
> > 
> > Does this measurably reduce contention?
> > 
> 
> No, this is just a cosmetic change I did while doing some other work
> with rlimits.
> 
> It would use some more cosmetic work (e.g. no reason not to
> lim_free(p->plimit); p->p_limit = NULL) and maybe I'll get to that
> later unless this kind of stuff is unwanted.

I find it useful to leave the locking in place so it is clear that p_limit is
always written to with the lock held.  If we ever got a static analyzer that
understood locking rules then leaving this locking in would reduce false 
positives.  When I first did locking for fields in struct proc I did it by 
hand based on grepping the source tree for all uses of a field and ensuring 
they were locked.  I think it might be more confusing later on for another
reader to see unlocked access and then have to think about why that is safe.

-- 
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: r259526 - head/contrib/gcc/config/rs6000

2013-12-17 Thread Pedro F. Giffuni
Author: pfg
Date: Tue Dec 17 21:39:40 2013
New Revision: 259526
URL: http://svnweb.freebsd.org/changeset/base/259526

Log:
  gcc: fix ICE in rs600 when using -fno-trapping-math.
  
  Solve build issue with previous change.
  
  Obtained from:gcc 4.3 (rev. 120902; GPLv2)
  MFC after:2 weeks

Modified:
  head/contrib/gcc/config/rs6000/rs6000.c

Modified: head/contrib/gcc/config/rs6000/rs6000.c
==
--- head/contrib/gcc/config/rs6000/rs6000.c Tue Dec 17 20:53:22 2013
(r259525)
+++ head/contrib/gcc/config/rs6000/rs6000.c Tue Dec 17 21:39:40 2013
(r259526)
@@ -11747,10 +11747,11 @@ rs6000_emit_vector_compare (enum rtx_cod
  {
enum rtx_code rev_code;
enum insn_code nor_code;
+   rtx eq_rtx;
 
rev_code = reverse_condition_maybe_unordered (rcode);
-   rtx eq_rtx = rs6000_emit_vector_compare (rev_code, op0, op1,
-dest_mode);
+   eq_rtx = rs6000_emit_vector_compare (rev_code, op0, op1,
+dest_mode);
 
nor_code = one_cmpl_optab->handlers[(int)dest_mode].insn_code;
gcc_assert (nor_code != CODE_FOR_nothing);
___
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: r259527 - head/sys/dev/cxgbe/tom

2013-12-17 Thread Navdeep Parhar
Author: np
Date: Tue Dec 17 21:41:23 2013
New Revision: 259527
URL: http://svnweb.freebsd.org/changeset/base/259527

Log:
  Do not create a hardware IPv6 server if the listen address is not
  in6addr_any and is not in the CLIP table either.  This fixes a reported
  TOE+IPv6 NULL-dereference panic in do_pass_open_rpl().
  
  While here, stop creating hardware servers for any loopback address.
  It's just a waste of server tids.
  
  MFC after:1 week

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

Modified: head/sys/dev/cxgbe/tom/t4_listen.c
==
--- head/sys/dev/cxgbe/tom/t4_listen.c  Tue Dec 17 21:39:40 2013
(r259526)
+++ head/sys/dev/cxgbe/tom/t4_listen.c  Tue Dec 17 21:41:23 2013
(r259527)
@@ -203,6 +203,17 @@ alloc_lctx(struct adapter *sc, struct in
return (NULL);
}
 
+   if (inp->inp_vflag & INP_IPV6 &&
+   !IN6_ARE_ADDR_EQUAL(&in6addr_any, &inp->in6p_laddr)) {
+   struct tom_data *td = sc->tom_softc;
+
+   lctx->ce = hold_lip(td, &inp->in6p_laddr);
+   if (lctx->ce == NULL) {
+   free(lctx, M_CXGBE);
+   return (NULL);
+   }
+   }
+
lctx->ctrlq = &sc->sge.ctrlq[pi->port_id];
lctx->ofld_rxq = &sc->sge.ofld_rxq[pi->first_ofld_rxq];
refcount_init(&lctx->refcount, 1);
@@ -219,6 +230,7 @@ static int
 free_lctx(struct adapter *sc, struct listen_ctx *lctx)
 {
struct inpcb *inp = lctx->inp;
+   struct tom_data *td = sc->tom_softc;
 
INP_WLOCK_ASSERT(inp);
KASSERT(lctx->refcount == 0,
@@ -230,6 +242,8 @@ free_lctx(struct adapter *sc, struct lis
CTR4(KTR_CXGBE, "%s: stid %u, lctx %p, inp %p",
__func__, lctx->stid, lctx, lctx->inp);
 
+   if (lctx->ce)
+   release_lip(td, lctx->ce);
free_stid(sc, lctx);
free(lctx, M_CXGBE);
 
@@ -495,6 +509,12 @@ t4_listen_start(struct toedev *tod, stru
 
INP_WLOCK_ASSERT(inp);
 
+   /* Don't start a hardware listener for any loopback address. */
+   if (inp->inp_vflag & INP_IPV6 && IN6_IS_ADDR_LOOPBACK(&inp->in6p_laddr))
+   return (0);
+   if (!(inp->inp_vflag & INP_IPV6) &&
+   IN_LOOPBACK(ntohl(inp->inp_laddr.s_addr)))
+   return (0);
 #if 0
ADAPTER_LOCK(sc);
if (IS_BUSY(sc)) {

Modified: head/sys/dev/cxgbe/tom/t4_tom.h
==
--- head/sys/dev/cxgbe/tom/t4_tom.h Tue Dec 17 21:39:40 2013
(r259526)
+++ head/sys/dev/cxgbe/tom/t4_tom.h Tue Dec 17 21:41:23 2013
(r259527)
@@ -176,6 +176,7 @@ struct listen_ctx {
struct inpcb *inp;  /* listening socket's inp */
struct sge_wrq *ctrlq;
struct sge_ofld_rxq *ofld_rxq;
+   struct clip_entry *ce;
TAILQ_HEAD(, synq_entry) synq;
 };
 
___
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: r259528 - head/sys/net

2013-12-17 Thread Alexander V. Chernikov
Author: melifaro
Date: Tue Dec 17 22:16:27 2013
New Revision: 259528
URL: http://svnweb.freebsd.org/changeset/base/259528

Log:
  Simplify contiguous mask checking.
  
  Suggested by: glebius
  MFC after:2 weeks

Modified:
  head/sys/net/radix.c

Modified: head/sys/net/radix.c
==
--- head/sys/net/radix.cTue Dec 17 21:41:23 2013(r259527)
+++ head/sys/net/radix.cTue Dec 17 22:16:27 2013(r259528)
@@ -484,13 +484,13 @@ on1:
 struct radix_node *
 rn_addmask(void *n_arg, struct radix_node_head *maskhead, int search, int skip)
 {
-   caddr_t netmask = (caddr_t)n_arg;
-   register struct radix_node *x;
-   register caddr_t cp, cplim;
-   register int b = 0, mlen, j;
+   unsigned char *netmask = n_arg;
+   unsigned char *cp, *cplim;
+   struct radix_node *x;
+   int b = 0, mlen, j;
int maskduplicated, isnormal;
struct radix_node *saved_x;
-   char addmask_key[RADIX_MAX_KEY_LEN];
+   unsigned char addmask_key[RADIX_MAX_KEY_LEN];
 
if ((mlen = LEN(netmask)) > RADIX_MAX_KEY_LEN)
mlen = RADIX_MAX_KEY_LEN;
@@ -532,20 +532,18 @@ rn_addmask(void *n_arg, struct radix_nod
 * Calculate index of mask, and check for normalcy.
 * First find the first byte with a 0 bit, then if there are
 * more bits left (remember we already trimmed the trailing 0's),
-* the pattern must be one of those in normal_chars[], or we have
+* the bits should be contiguous, otherwise we have got
 * a non-contiguous mask.
 */
+#defineCONTIG(_c)  (((~(_c) + 1) & (_c)) == (unsigned char)(~(_c) 
+ 1))
cplim = netmask + mlen;
isnormal = 1;
for (cp = netmask + skip; (cp < cplim) && *(u_char *)cp == 0xff;)
cp++;
if (cp != cplim) {
-   static char normal_chars[] = {
-   0, 0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc, 0xfe, 0xff};
-
for (j = 0x80; (j & *cp) != 0; j >>= 1)
b++;
-   if (*cp != normal_chars[b] || cp != (cplim - 1))
+   if (!CONTIG(*cp) || cp != (cplim - 1))
isnormal = 0;
}
b += (cp - netmask) << 3;
___
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: r259529 - in head/contrib/gcc: . cp doc

2013-12-17 Thread Pedro F. Giffuni
Author: pfg
Date: Tue Dec 17 23:31:51 2013
New Revision: 259529
URL: http://svnweb.freebsd.org/changeset/base/259529

Log:
  gcc: small merges from upstream
  
  Solves GCC issues:
  PR middle-end/32602
  PR middle-end/32603
  
  Updates the to documentation and processing
  improvement.
  
  Obtained from:gcc 4.3 (rev. 119427, 126278, 126422; GPLv2)
  MFC after:2 weeks

Modified:
  head/contrib/gcc/ChangeLog.gcc43
  head/contrib/gcc/calls.c
  head/contrib/gcc/cp/ChangeLog.gcc43
  head/contrib/gcc/cp/decl.c
  head/contrib/gcc/cp/method.c
  head/contrib/gcc/cp/parser.c
  head/contrib/gcc/doc/cppopts.texi
  head/contrib/gcc/doc/invoke.texi

Modified: head/contrib/gcc/ChangeLog.gcc43
==
--- head/contrib/gcc/ChangeLog.gcc43Tue Dec 17 22:16:27 2013
(r259528)
+++ head/contrib/gcc/ChangeLog.gcc43Tue Dec 17 23:31:51 2013
(r259529)
@@ -45,6 +45,20 @@
* flags.h (force_align_functions_log): Delete.
* toplev.c (force_align_functions_log): Delete.
 
+2007-07-06  Josh Conner   (r126422)
+
+   PR middle-end/32602
+   PR middle-end/32603
+   * calls.c (store_one_arg): Handle arguments which are partially
+   on the stack when detecting argument overlap.
+
+2007-07-03  Eric Christopher   (r126278)
+
+   * doc/cppopts.texi: Add conflicting option note to -dM.
+   * doc/invoke.texi: Add note about possible conflicts with
+   -E for -dCHARS and note that -dM will not produce
+   any results if there is no machine dependent reorg.
+   
 2007-06-28  Geoffrey Keating   (r126088)
 
* doc/invoke.texi (C++ Dialect Options): Document

Modified: head/contrib/gcc/calls.c
==
--- head/contrib/gcc/calls.cTue Dec 17 22:16:27 2013(r259528)
+++ head/contrib/gcc/calls.cTue Dec 17 23:31:51 2013(r259529)
@@ -4297,6 +4297,7 @@ store_one_arg (struct arg_data *arg, rtx
 
  /* expand_call should ensure this.  */
  gcc_assert (!arg->locate.offset.var
+ && arg->locate.size.var == 0
  && GET_CODE (size_rtx) == CONST_INT);
 
  if (arg->locate.offset.constant > i)
@@ -4306,7 +4307,21 @@ store_one_arg (struct arg_data *arg, rtx
}
  else if (arg->locate.offset.constant < i)
{
- if (i < arg->locate.offset.constant + INTVAL (size_rtx))
+ /* Use arg->locate.size.constant instead of size_rtx
+because we only care about the part of the argument
+on the stack.  */
+ if (i < (arg->locate.offset.constant
+  + arg->locate.size.constant))
+   sibcall_failure = 1;
+   }
+ else
+   {
+ /* Even though they appear to be at the same location,
+if part of the outgoing argument is in registers,
+they aren't really at the same location.  Check for
+this by making sure that the incoming size is the
+same as the outgoing size.  */
+ if (arg->locate.size.constant != INTVAL (size_rtx))
sibcall_failure = 1;
}
}

Modified: head/contrib/gcc/cp/ChangeLog.gcc43
==
--- head/contrib/gcc/cp/ChangeLog.gcc43 Tue Dec 17 22:16:27 2013
(r259528)
+++ head/contrib/gcc/cp/ChangeLog.gcc43 Tue Dec 17 23:31:51 2013
(r259529)
@@ -62,6 +62,18 @@
* semantics.c (finish_unary_op_expr): Warn only if result
overflowed and operands did not.
 
+2006-12-01  Geoffrey Keating   (r119427)
+
+   * decl.c (poplevel): Check DECL_INITIAL invariant.
+   (duplicate_decls): Preserve DECL_INITIAL when eliminating
+   a new definition in favour of an old declaration.
+   (start_preparsed_function): Define and document value of
+   DECL_INITIAL before and after routine.
+   (finish_function): Check DECL_INITIAL invariant.
+   * parser.c 
+   (cp_parser_function_definition_from_specifiers_and_declarator): 
+   Skip duplicate function definitions.
+
 2006-10-31  Geoffrey Keating   (r118360)
 
* name-lookup.c (get_anonymous_namespace_name): New.

Modified: head/contrib/gcc/cp/decl.c
==
--- head/contrib/gcc/cp/decl.c  Tue Dec 17 22:16:27 2013(r259528)
+++ head/contrib/gcc/cp/decl.c  Tue Dec 17 23:31:51 2013(r259529)
@@ -758,7 +758,12 @@ poplevel (int keep, int reverse, int fun
 
   leave_scope ();
   if (functionbody)
-DECL_INITIAL (current_function_decl) = block;
+{
+  /* The current function is being defined, so its DECL_INITIAL
+should be error_mark

svn commit: r259531 - head/contrib/gcc

2013-12-17 Thread Pedro F. Giffuni
Author: pfg
Date: Wed Dec 18 00:10:30 2013
New Revision: 259531
URL: http://svnweb.freebsd.org/changeset/base/259531

Log:
  gcc: point to our address for bug reports.
  
  As recommended by the FSF in gcc/version.c :
  
  "If you distribute a modified version of GCC, please change
  this to refer to a document giving instructions for reporting
  bugs to you, not us."
  
  MFC after:2 weeks

Modified:
  head/contrib/gcc/version.c

Modified: head/contrib/gcc/version.c
==
--- head/contrib/gcc/version.c  Wed Dec 18 00:07:52 2013(r259530)
+++ head/contrib/gcc/version.c  Wed Dec 18 00:10:30 2013(r259531)
@@ -18,7 +18,7 @@
forward us bugs reported to you, if you determine that they are
not bugs in your modifications.)  */
 
-const char bug_report_url[] = "http://gcc.gnu.org/bugs.html>";
+const char bug_report_url[] = "http://www.freebsd.org/send-pr.html>";
 
 /* The complete version string, assembled from several pieces.
BASEVER, DATESTAMP, and DEVPHASE are defined by the Makefile.  */
___
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: r259532 - head/sys/dev/vt

2013-12-17 Thread Aleksandr Rybalko
Author: ray
Date: Wed Dec 18 00:14:58 2013
New Revision: 259532
URL: http://svnweb.freebsd.org/changeset/base/259532

Log:
  Skip processing of R.Alt as a second Alt key, if sysctl kern.vt.enable_altgr 
is
  not zero.
  
  Submitted by: andreast
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/dev/vt/vt_core.c

Modified: head/sys/dev/vt/vt_core.c
==
--- head/sys/dev/vt/vt_core.c   Wed Dec 18 00:10:30 2013(r259531)
+++ head/sys/dev/vt/vt_core.c   Wed Dec 18 00:14:58 2013(r259532)
@@ -113,6 +113,7 @@ const struct terminal_class vt_termclass
 int sc_txtmouse_no_retrace_wait;
 
 static SYSCTL_NODE(_kern, OID_AUTO, vt, CTLFLAG_RD, 0, "Newcons parameters");
+VT_SYSCTL_INT(enable_altgr, 0, "Enable AltGr key (Do not assume R.Alt as 
Alt)");
 VT_SYSCTL_INT(debug, 0, "Newcons debug level");
 VT_SYSCTL_INT(deadtimer, 15, "Time to wait busy process in VT_PROCESS mode");
 VT_SYSCTL_INT(suspendswitch, 1, "Switch to VT0 before suspend");
@@ -404,6 +405,8 @@ vt_processkey(keyboard_t *kbd, struct vt
if (c & RELKEY) {
switch (c & ~RELKEY) {
case (SPCLKEY | RALT):
+   if (vt_enable_altgr != 0)
+   break;
case (SPCLKEY | LALT):
vd->vd_kbstate &= ~ALKED;
}
___
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: r259532 - head/sys/dev/vt

2013-12-17 Thread Baptiste Daroussin
On Wed, Dec 18, 2013 at 12:14:58AM +, Aleksandr Rybalko wrote:
> Author: ray
> Date: Wed Dec 18 00:14:58 2013
> New Revision: 259532
> URL: http://svnweb.freebsd.org/changeset/base/259532
> 
> Log:
>   Skip processing of R.Alt as a second Alt key, if sysctl 
> kern.vt.enable_altgr is
>   not zero.
>   
>   Submitted by:   andreast
>   Sponsored by:   The FreeBSD Foundation

altgr support should probably be 1 by default in that case, many keyboards need
that key by default.

Example on french keyboard it is used for:
#{[|`\^@]}

Without those, very hard to hack or just use a console :)

regards,
Bapt


pgpE7NuQFFZOb.pgp
Description: PGP signature


Re: svn commit: r259016 - in head/sys: conf dev/drm2 dev/drm2/i915 dev/drm2/radeon dev/fb dev/vt kern modules/drm2/i915kms modules/drm2/radeonkms sparc64/sparc64 sys teken

2013-12-17 Thread Aleksandr Rybalko
On Tue, 10 Dec 2013 23:49:38 +0100
Andreas Tobler  wrote:

> On 10.12.13 14:43, Tijl Coosemans wrote:
> > On Tue, 10 Dec 2013 15:31:44 +0200 Aleksandr Rybalko wrote:
> >> That keyboards have no Shift key for that? :)
> >> I will be glad to apply your changes, but I have to know how it
> >> should be controlled.
> >>
> >> RU and UA PC keyboards have same 3 symbols '2', '"', '@'
> >> To get '2' i have to press only '2'
> >> To get '@' I have to press Shift+'2'
> >> To get '"' I have to switch to UA or RU and press Shift+'2'
> >>
> >> Ahh, or use some called Third-Level (IIRC) in Xorg terms. Temporary
> >> lang switch. Which commonly mapped to one of Alt. Right?
> >> So R-Alt+Shift+'2'?
> > 
> > https://en.wikipedia.org/wiki/AltGr
> 
> Thanks Tijl!
> 
> To get the @ I have to press AltGr + '2'.
> There are combinations where I have to press AltGr+Shift. e.g to get
> the 'broken bar, ¦', AltGr+Shift+'7'.
> 
> Andreas
> 

Hello Andreas and Tijl!

Since I think not a whole world have AltGr key (read as "not most
keyboards on the Earth") :)
Think it is OK to use R.Alt as an Alt by default, and enable AltGr with
sysctl kern.vt.enable_altgr.

Committed at r259532.

Any other opinions are welcomed! 

WBW
-- 
Aleksandr Rybalko 
___
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: r259016 - in head/sys: conf dev/drm2 dev/drm2/i915 dev/drm2/radeon dev/fb dev/vt kern modules/drm2/i915kms modules/drm2/radeonkms sparc64/sparc64 sys teken

2013-12-17 Thread Baptiste Daroussin
On Wed, Dec 18, 2013 at 02:21:56AM +0200, Aleksandr Rybalko wrote:
> On Tue, 10 Dec 2013 23:49:38 +0100
> Andreas Tobler  wrote:
> 
> > On 10.12.13 14:43, Tijl Coosemans wrote:
> > > On Tue, 10 Dec 2013 15:31:44 +0200 Aleksandr Rybalko wrote:
> > >> That keyboards have no Shift key for that? :)
> > >> I will be glad to apply your changes, but I have to know how it
> > >> should be controlled.
> > >>
> > >> RU and UA PC keyboards have same 3 symbols '2', '"', '@'
> > >> To get '2' i have to press only '2'
> > >> To get '@' I have to press Shift+'2'
> > >> To get '"' I have to switch to UA or RU and press Shift+'2'
> > >>
> > >> Ahh, or use some called Third-Level (IIRC) in Xorg terms. Temporary
> > >> lang switch. Which commonly mapped to one of Alt. Right?
> > >> So R-Alt+Shift+'2'?
> > > 
> > > https://en.wikipedia.org/wiki/AltGr
> > 
> > Thanks Tijl!
> > 
> > To get the @ I have to press AltGr + '2'.
> > There are combinations where I have to press AltGr+Shift. e.g to get
> > the 'broken bar, ¦', AltGr+Shift+'7'.
> > 
> > Andreas
> > 
> 
> Hello Andreas and Tijl!
> 
> Since I think not a whole world have AltGr key (read as "not most
> keyboards on the Earth") :)
> Think it is OK to use R.Alt as an Alt by default, and enable AltGr with
> sysctl kern.vt.enable_altgr.
> 
I tend to disagree with you, lots of keyboards mapping are concerned here.

Bapt


pgp20WRAFpH66.pgp
Description: PGP signature


svn commit: r259535 - in head/sys: cddl/contrib/opensolaris/uts/intel/dtrace kern

2013-12-17 Thread Mark Johnston
Author: markj
Date: Wed Dec 18 01:41:52 2013
New Revision: 259535
URL: http://svnweb.freebsd.org/changeset/base/259535

Log:
  The fasttrap fork handler is responsible for removing tracepoints in the
  child process that were inherited from its parent. However, this should
  not be done in the case of a vfork, since the fork handler ends up removing
  the tracepoints from the shared vm space, and userland DTrace probes in the
  parent will no longer fire as a result.
  
  Now the child of a vfork may trigger userland DTrace probes enabled in its
  parent, so modify the fasttrap probe handler to handle this case and handle
  the child process in the same way that it would handle the traced process.
  In particular, if once traces function foo() in a process that vforks, and
  the child calls foo(), fasttrap will treat this call as having come from the
  parent. This is the behaviour of the upstream code.
  
  While here, add #ifdef guards to some code that isn't present upstream.
  
  MFC after:1 month

Modified:
  head/sys/cddl/contrib/opensolaris/uts/intel/dtrace/fasttrap_isa.c
  head/sys/kern/kern_fork.c

Modified: head/sys/cddl/contrib/opensolaris/uts/intel/dtrace/fasttrap_isa.c
==
--- head/sys/cddl/contrib/opensolaris/uts/intel/dtrace/fasttrap_isa.c   Wed Dec 
18 01:27:30 2013(r259534)
+++ head/sys/cddl/contrib/opensolaris/uts/intel/dtrace/fasttrap_isa.c   Wed Dec 
18 01:41:52 2013(r259535)
@@ -1001,6 +1001,9 @@ int
 fasttrap_pid_probe(struct reg *rp)
 {
proc_t *p = curproc;
+#if !defined(sun)
+   proc_t *pp;
+#endif
uintptr_t pc = rp->r_rip - 1;
uintptr_t new_pc = 0;
fasttrap_bucket_t *bucket;
@@ -1036,24 +1039,32 @@ fasttrap_pid_probe(struct reg *rp)
curthread->t_dtrace_regv = 0;
 #endif
 
-#if defined(sun)
/*
 * Treat a child created by a call to vfork(2) as if it were its
 * parent. We know that there's only one thread of control in such a
 * process: this one.
 */
+#if defined(sun)
while (p->p_flag & SVFORK) {
p = p->p_parent;
}
-#endif
 
-   PROC_LOCK(p);
-   _PHOLD(p);
pid = p->p_pid;
-#if defined(sun)
pid_mtx = &cpu_core[CPU->cpu_id].cpuc_pid_lock;
mutex_enter(pid_mtx);
+#else
+   pp = p;
+   sx_slock(&proctree_lock);
+   while (pp->p_vmspace == pp->p_pptr->p_vmspace)
+   pp = pp->p_pptr;
+   pid = pp->p_pid;
+   sx_sunlock(&proctree_lock);
+   pp = NULL;
+
+   PROC_LOCK(p);
+   _PHOLD(p);
 #endif
+
bucket = &fasttrap_tpoints.fth_table[FASTTRAP_TPOINTS_INDEX(pid, pc)];
 
/*
@@ -1073,9 +1084,10 @@ fasttrap_pid_probe(struct reg *rp)
if (tp == NULL) {
 #if defined(sun)
mutex_exit(pid_mtx);
-#endif
+#else
_PRELE(p);
PROC_UNLOCK(p);
+#endif
return (-1);
}
 
@@ -1197,9 +1209,10 @@ fasttrap_pid_probe(struct reg *rp)
 * tracepoint again later if we need to light up any return probes.
 */
tp_local = *tp;
-   PROC_UNLOCK(p);
 #if defined(sun)
mutex_exit(pid_mtx);
+#else
+   PROC_UNLOCK(p);
 #endif
tp = &tp_local;
 
@@ -1749,7 +1762,7 @@ fasttrap_pid_probe(struct reg *rp)
 #if defined(sun)
if (fasttrap_copyout(scratch, (char *)addr, i)) {
 #else
-   if (uwrite(curproc, scratch, i, addr)) {
+   if (uwrite(p, scratch, i, addr)) {
 #endif
fasttrap_sigtrap(p, curthread, pc);
new_pc = pc;
@@ -1808,10 +1821,12 @@ done:
 
rp->r_rip = new_pc;
 
+#if !defined(sun)
PROC_LOCK(p);
proc_write_regs(curthread, rp);
_PRELE(p);
PROC_UNLOCK(p);
+#endif
 
return (0);
 }

Modified: head/sys/kern/kern_fork.c
==
--- head/sys/kern/kern_fork.c   Wed Dec 18 01:27:30 2013(r259534)
+++ head/sys/kern/kern_fork.c   Wed Dec 18 01:41:52 2013(r259535)
@@ -676,12 +676,12 @@ do_fork(struct thread *td, int flags, st
 
 #ifdef KDTRACE_HOOKS
/*
-* Tell the DTrace fasttrap provider about the new process
-* if it has registered an interest. We have to do this only after
-* p_state is PRS_NORMAL since the fasttrap module will use pfind()
-* later on.
+* Tell the DTrace fasttrap provider about the new process so that any
+* tracepoints inherited from the parent can be removed. We have to do
+* this only after p_state is PRS_NORMAL since the fasttrap module will
+* use pfind() later on.
 */
-   if (dtrace_fasttrap_fork)
+   if ((flags & RFMEM) == 0 && dtrace_fasttrap_fork)
dtrace_fasttrap_fork(p1, p2);
 #endif
if ((p1->p_flag & (P_TRACED | P_FOLLOWFORK)) == (P_TRACED |

svn commit: r259537 - in head: lib/libvmmapi usr.sbin/bhyve

2013-12-17 Thread Neel Natu
Author: neel
Date: Wed Dec 18 03:58:51 2013
New Revision: 259537
URL: http://svnweb.freebsd.org/changeset/base/259537

Log:
  Rename the ambiguously named 'vm_setup_msi()' and 'vm_setup_msix()' to
  'vm_setup_pptdev_msi()' and 'vm_setup_pptdev_msix()' respectively.
  
  It should now be clear that these functions operate on passthru devices.

Modified:
  head/lib/libvmmapi/vmmapi.c
  head/lib/libvmmapi/vmmapi.h
  head/usr.sbin/bhyve/pci_passthru.c

Modified: head/lib/libvmmapi/vmmapi.c
==
--- head/lib/libvmmapi/vmmapi.c Wed Dec 18 03:51:04 2013(r259536)
+++ head/lib/libvmmapi/vmmapi.c Wed Dec 18 03:58:51 2013(r259537)
@@ -563,8 +563,8 @@ vm_map_pptdev_mmio(struct vmctx *ctx, in
 }
 
 int
-vm_setup_msi(struct vmctx *ctx, int vcpu, int bus, int slot, int func,
-uint64_t addr, uint64_t msg, int numvec)
+vm_setup_pptdev_msi(struct vmctx *ctx, int vcpu, int bus, int slot, int func,
+uint64_t addr, uint64_t msg, int numvec)
 {
struct vm_pptdev_msi pptmsi;
 
@@ -581,8 +581,8 @@ vm_setup_msi(struct vmctx *ctx, int vcpu
 }
 
 int
-vm_setup_msix(struct vmctx *ctx, int vcpu, int bus, int slot, int func,
- int idx, uint64_t addr, uint64_t msg, uint32_t vector_control)
+vm_setup_pptdev_msix(struct vmctx *ctx, int vcpu, int bus, int slot, int func,
+int idx, uint64_t addr, uint64_t msg, uint32_t vector_control)
 {
struct vm_pptdev_msix pptmsix;
 

Modified: head/lib/libvmmapi/vmmapi.h
==
--- head/lib/libvmmapi/vmmapi.h Wed Dec 18 03:51:04 2013(r259536)
+++ head/lib/libvmmapi/vmmapi.h Wed Dec 18 03:58:51 2013(r259537)
@@ -82,10 +82,11 @@ int vm_assign_pptdev(struct vmctx *ctx, 
 intvm_unassign_pptdev(struct vmctx *ctx, int bus, int slot, int func);
 intvm_map_pptdev_mmio(struct vmctx *ctx, int bus, int slot, int func,
   vm_paddr_t gpa, size_t len, vm_paddr_t hpa);
-intvm_setup_msi(struct vmctx *ctx, int vcpu, int bus, int slot, int func,
-   uint64_t addr, uint64_t msg, int numvec);
-intvm_setup_msix(struct vmctx *ctx, int vcpu, int bus, int slot, int func,
-   int idx, uint64_t addr, uint64_t msg, uint32_t vector_control);
+intvm_setup_pptdev_msi(struct vmctx *ctx, int vcpu, int bus, int slot,
+   int func, uint64_t addr, uint64_t msg, int numvec);
+intvm_setup_pptdev_msix(struct vmctx *ctx, int vcpu, int bus, int slot,
+   int func, int idx, uint64_t addr, uint64_t msg,
+   uint32_t vector_control);
 
 /*
  * Return a pointer to the statistics buffer. Note that this is not MT-safe.

Modified: head/usr.sbin/bhyve/pci_passthru.c
==
--- head/usr.sbin/bhyve/pci_passthru.c  Wed Dec 18 03:51:04 2013
(r259536)
+++ head/usr.sbin/bhyve/pci_passthru.c  Wed Dec 18 03:58:51 2013
(r259537)
@@ -345,12 +345,10 @@ msix_table_write(struct vmctx *ctx, int 
/* If the entry is masked, don't set it up */
if ((entry->vector_control & PCIM_MSIX_VCTRL_MASK) == 0 ||
(vector_control & PCIM_MSIX_VCTRL_MASK) == 0) {
-   error = vm_setup_msix(ctx, vcpu, sc->psc_sel.pc_bus,
- sc->psc_sel.pc_dev, 
- sc->psc_sel.pc_func,
- index, entry->addr,
- entry->msg_data, 
- entry->vector_control);
+   error = vm_setup_pptdev_msix(ctx, vcpu,
+   sc->psc_sel.pc_bus, sc->psc_sel.pc_dev, 
+   sc->psc_sel.pc_func, index, entry->addr,
+   entry->msg_data, entry->vector_control);
}
}
 }
@@ -652,12 +650,12 @@ passthru_cfgwrite(struct vmctx *ctx, int
if (msicap_access(sc, coff)) {
msicap_cfgwrite(pi, sc->psc_msi.capoff, coff, bytes, val);
 
-   error = vm_setup_msi(ctx, vcpu, sc->psc_sel.pc_bus,
+   error = vm_setup_pptdev_msi(ctx, vcpu, sc->psc_sel.pc_bus,
sc->psc_sel.pc_dev, sc->psc_sel.pc_func,
pi->pi_msi.addr, pi->pi_msi.msg_data,
pi->pi_msi.maxmsgnum);
if (error != 0) {
-   printf("vm_setup_msi returned error %d\r\n", errno);
+   printf("vm_setup_pptdev_msi error %d\r\n", errno);
exit(1);
}
return (0);
@@ -668,7 +666,7 @@ passthru_cfgwrite(struct vmctx *ctx, int
if (pi->pi_msix.enabled) {
msix_table_entries = pi->pi_msix.table_count;
for (i = 0; i < msix_table_entr

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

2013-12-17 Thread Gleb Smirnoff
Author: glebius
Date: Wed Dec 18 04:36:35 2013
New Revision: 259538
URL: http://svnweb.freebsd.org/changeset/base/259538

Log:
  Fix build.

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

Modified: head/sys/dev/netmap/netmap.c
==
--- head/sys/dev/netmap/netmap.cWed Dec 18 03:58:51 2013
(r259537)
+++ head/sys/dev/netmap/netmap.cWed Dec 18 04:36:35 2013
(r259538)
@@ -151,6 +151,7 @@ ports attached to the switch)
 #include/* bus_dmamap_* */
 #include 
 #include 
+#include 
 
 
 /* reduce conditional code */
___
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: r259539 - head/lib/libstand

2013-12-17 Thread Marcel Moolenaar
Author: marcel
Date: Wed Dec 18 04:44:38 2013
New Revision: 259539
URL: http://svnweb.freebsd.org/changeset/base/259539

Log:
  Support long filenames.
  
  Obtained from:Juniper Networks, Inc.

Modified:
  head/lib/libstand/dosfs.c

Modified: head/lib/libstand/dosfs.c
==
--- head/lib/libstand/dosfs.c   Wed Dec 18 04:36:35 2013(r259538)
+++ head/lib/libstand/dosfs.c   Wed Dec 18 04:44:38 2013(r259539)
@@ -381,21 +381,32 @@ dos_readdir(struct open_file *fd, struct
if (dd.de.name[0] == 0xe5)
continue;
 
-   /* Skip volume labels */
-   if (dd.de.attr & FA_LABEL)
-   continue;
-
-   if ((dd.de.attr & FA_MASK) == FA_XDE) {
-   if (dd.xde.seq & 0x40)
-   chk = dd.xde.chk;
-   else if (dd.xde.seq != xdn - 1 || dd.xde.chk != chk)
-   continue;
-   x = dd.xde.seq & ~0x40;
-   if (x < 1 || x > 20) {
-   x = 0;
+   /* Check if directory entry is volume label */
+   if (dd.de.attr & FA_LABEL) {
+   /* 
+* If volume label set, check if the current entry is
+* extended entry (FA_XDE) for long file names.
+*/
+   if ((dd.de.attr & FA_MASK) == FA_XDE) {
+   /*
+* Read through all following extended entries
+* to get the long file name. 0x40 marks the
+* last entry containing part of long file name.
+*/
+   if (dd.xde.seq & 0x40)
+   chk = dd.xde.chk;
+   else if (dd.xde.seq != xdn - 1 || dd.xde.chk != chk)
+   continue;
+   x = dd.xde.seq & ~0x40;
+   if (x < 1 || x > 20) {
+   x = 0;
+   continue;
+   }
+   cp_xdnm(fn, &dd.xde);
+   } else {
+   /* skip only volume label entries */
continue;
}
-   cp_xdnm(fn, &dd.xde);
} else {
if (xdn == 1) {
x = 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: r259540 - head/lib/libstand

2013-12-17 Thread Marcel Moolenaar
Author: marcel
Date: Wed Dec 18 04:52:30 2013
New Revision: 259540
URL: http://svnweb.freebsd.org/changeset/base/259540

Log:
  Clear f_rabuf after freeing the memory it points to. This prevents a
  possible double free.
  
  Obtained from:Juniper Networks, Inc.

Modified:
  head/lib/libstand/close.c

Modified: head/lib/libstand/close.c
==
--- head/lib/libstand/close.c   Wed Dec 18 04:44:38 2013(r259539)
+++ head/lib/libstand/close.c   Wed Dec 18 04:52:30 2013(r259540)
@@ -75,8 +75,10 @@ close(int fd)
errno = EBADF;
return (-1);
 }
-if (f->f_rabuf != NULL)
+if (f->f_rabuf != NULL) {
free(f->f_rabuf);
+   f->f_rabuf = NULL;
+}
 if (!(f->f_flags & F_RAW) && f->f_ops)
err1 = (f->f_ops->fo_close)(f);
 if (!(f->f_flags & F_NODEV) && f->f_dev)
___
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: r259542 - head/sys/amd64/vmm/intel

2013-12-17 Thread Neel Natu
Author: neel
Date: Wed Dec 18 06:24:21 2013
New Revision: 259542
URL: http://svnweb.freebsd.org/changeset/base/259542

Log:
  Use vmcs_read() and vmcs_write() in preference to vmread() and vmwrite()
  respectively. The vmcs_xxx() functions provide inline error checking of
  all accesses to the VMCS.

Modified:
  head/sys/amd64/vmm/intel/vmcs.c
  head/sys/amd64/vmm/intel/vmcs.h
  head/sys/amd64/vmm/intel/vmx.c
  head/sys/amd64/vmm/intel/vmx_genassym.c

Modified: head/sys/amd64/vmm/intel/vmcs.c
==
--- head/sys/amd64/vmm/intel/vmcs.c Wed Dec 18 05:20:53 2013
(r259541)
+++ head/sys/amd64/vmm/intel/vmcs.c Wed Dec 18 06:24:21 2013
(r259542)
@@ -41,8 +41,8 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include "vmm_host.h"
-#include "vmcs.h"
 #include "vmx_cpufunc.h"
+#include "vmcs.h"
 #include "ept.h"
 #include "vmx.h"
 
@@ -454,19 +454,6 @@ done:
return (error);
 }
 
-uint64_t
-vmcs_read(uint32_t encoding)
-{
-   int error;
-   uint64_t val;
-
-   error = vmread(encoding, &val);
-   if (error != 0)
-   panic("vmcs_read(%u) error %d", encoding, error);
-
-   return (val);
-}
-
 #ifdef DDB
 extern int vmxon_enabled[];
 

Modified: head/sys/amd64/vmm/intel/vmcs.h
==
--- head/sys/amd64/vmm/intel/vmcs.h Wed Dec 18 05:20:53 2013
(r259541)
+++ head/sys/amd64/vmm/intel/vmcs.h Wed Dec 18 06:24:21 2013
(r259542)
@@ -58,7 +58,26 @@ int  vmcs_getdesc(struct vmcs *vmcs, int 
 struct seg_desc *desc);
 intvmcs_setdesc(struct vmcs *vmcs, int ident,
 struct seg_desc *desc);
-uint64_t vmcs_read(uint32_t encoding);
+
+static __inline uint64_t
+vmcs_read(uint32_t encoding)
+{
+   int error;
+   uint64_t val;
+
+   error = vmread(encoding, &val);
+   KASSERT(error == 0, ("vmcs_read(%u) error %d", encoding, error));
+   return (val);
+}
+
+static __inline void
+vmcs_write(uint32_t encoding, uint64_t val)
+{
+   int error;
+
+   error = vmwrite(encoding, val);
+   KASSERT(error == 0, ("vmcs_write(%u) error %d", encoding, error));
+}
 
 #definevmexit_instruction_length() 
vmcs_read(VMCS_EXIT_INSTRUCTION_LENGTH)
 #definevmcs_guest_rip()vmcs_read(VMCS_GUEST_RIP)

Modified: head/sys/amd64/vmm/intel/vmx.c
==
--- head/sys/amd64/vmm/intel/vmx.c  Wed Dec 18 05:20:53 2013
(r259541)
+++ head/sys/amd64/vmm/intel/vmx.c  Wed Dec 18 06:24:21 2013
(r259542)
@@ -324,9 +324,8 @@ vmx_setjmp_trace(struct vmx *vmx, int vc
VCPU_CTR2((vmx)->vm, (vcpu), "setjmp return code %s(%d)",
 vmx_setjmp_rc2str(rc), rc);
 
-   host_rsp = host_rip = ~0;
-   vmread(VMCS_HOST_RIP, &host_rip);
-   vmread(VMCS_HOST_RSP, &host_rsp);
+   host_rip = vmcs_read(VMCS_HOST_RIP);
+   host_rsp = vmcs_read(VMCS_HOST_RSP);
VCPU_CTR2((vmx)->vm, (vcpu), "vmcs host_rip 0x%016lx, host_rsp %#lx",
 host_rip, host_rsp);
 
@@ -909,10 +908,10 @@ vmx_astpending_trace(struct vmx *vmx, in
 #endif
 }
 
-static int
+static void
 vmx_set_pcpu_defaults(struct vmx *vmx, int vcpu)
 {
-   int error, lastcpu;
+   int lastcpu;
struct vmxstate *vmxstate;
struct invvpid_desc invvpid_desc = { 0 };
 
@@ -920,24 +919,14 @@ vmx_set_pcpu_defaults(struct vmx *vmx, i
lastcpu = vmxstate->lastcpu;
vmxstate->lastcpu = curcpu;
 
-   if (lastcpu == curcpu) {
-   error = 0;
-   goto done;
-   }
+   if (lastcpu == curcpu)
+   return;
 
vmm_stat_incr(vmx->vm, vcpu, VCPU_MIGRATIONS, 1);
 
-   error = vmwrite(VMCS_HOST_TR_BASE, vmm_get_host_trbase());
-   if (error != 0)
-   goto done;
-
-   error = vmwrite(VMCS_HOST_GDTR_BASE, vmm_get_host_gdtrbase());
-   if (error != 0)
-   goto done;
-
-   error = vmwrite(VMCS_HOST_GS_BASE, vmm_get_host_gsbase());
-   if (error != 0)
-   goto done;
+   vmcs_write(VMCS_HOST_TR_BASE, vmm_get_host_trbase());
+   vmcs_write(VMCS_HOST_GDTR_BASE, vmm_get_host_gdtrbase());
+   vmcs_write(VMCS_HOST_GS_BASE, vmm_get_host_gsbase());
 
/*
 * If we are using VPIDs then invalidate all mappings tagged with 'vpid'
@@ -958,18 +947,6 @@ vmx_set_pcpu_defaults(struct vmx *vmx, i
invvpid_desc.vpid = vmxstate->vpid;
invvpid(INVVPID_TYPE_SINGLE_CONTEXT, invvpid_desc);
}
-done:
-   return (error);
-}
-
-static void 
-vm_exit_update_rip(struct vm_exit *vmexit)
-{
-   int error;
-
-   error = vmwrite(VMCS_GUEST_RIP, vmexit->rip + vmexit->inst_length);
-   if (error)
-   panic("vmx_run: error %d writing to VMCS_GUEST_RIP", error);
 }
 
 /*
@@ -980,6

svn commit: r259543 - head/sys/dev/ae

2013-12-17 Thread Pyun YongHyeon
Author: yongari
Date: Wed Dec 18 07:23:42 2013
New Revision: 259543
URL: http://svnweb.freebsd.org/changeset/base/259543

Log:
  Failed m_devget(9) indicates lack of free mbuf cluster.  Update
  if_iqdrops counter for that case since the received frame is ok.
  While here, simplify updating counter logic.

Modified:
  head/sys/dev/ae/if_ae.c

Modified: head/sys/dev/ae/if_ae.c
==
--- head/sys/dev/ae/if_ae.c Wed Dec 18 06:24:21 2013(r259542)
+++ head/sys/dev/ae/if_ae.c Wed Dec 18 07:23:42 2013(r259543)
@@ -135,7 +135,7 @@ static void ae_mac_config(ae_softc_t *sc
 static int ae_intr(void *arg);
 static voidae_int_task(void *arg, int pending);
 static voidae_tx_intr(ae_softc_t *sc);
-static int ae_rxeof(ae_softc_t *sc, ae_rxd_t *rxd);
+static voidae_rxeof(ae_softc_t *sc, ae_rxd_t *rxd);
 static voidae_rx_intr(ae_softc_t *sc);
 static voidae_watchdog(ae_softc_t *sc);
 static voidae_tick(void *arg);
@@ -1884,7 +1884,7 @@ ae_tx_intr(ae_softc_t *sc)
BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
 }
 
-static int
+static void
 ae_rxeof(ae_softc_t *sc, ae_rxd_t *rxd)
 {
struct ifnet *ifp;
@@ -1903,12 +1903,15 @@ ae_rxeof(ae_softc_t *sc, ae_rxd_t *rxd)
size = le16toh(rxd->len) - ETHER_CRC_LEN;
if (size < (ETHER_MIN_LEN - ETHER_CRC_LEN - ETHER_VLAN_ENCAP_LEN)) {
if_printf(ifp, "Runt frame received.");
-   return (EIO);
+   ifp->if_ierrors++;
+   return;
}
 
m = m_devget(&rxd->data[0], size, ETHER_ALIGN, ifp, NULL);
-   if (m == NULL)
-   return (ENOBUFS);
+   if (m == NULL) {
+   ifp->if_iqdrops++;
+   return;
+   }
 
if ((ifp->if_capenable & IFCAP_VLAN_HWTAGGING) != 0 &&
(flags & AE_RXD_HAS_VLAN) != 0) {
@@ -1916,14 +1919,13 @@ ae_rxeof(ae_softc_t *sc, ae_rxd_t *rxd)
m->m_flags |= M_VLANTAG;
}
 
+   ifp->if_ipackets++;
/*
 * Pass it through.
 */
AE_UNLOCK(sc);
(*ifp->if_input)(ifp, m);
AE_LOCK(sc);
-
-   return (0);
 }
 
 static void
@@ -1932,7 +1934,7 @@ ae_rx_intr(ae_softc_t *sc)
ae_rxd_t *rxd;
struct ifnet *ifp;
uint16_t flags;
-   int count, error;
+   int count;
 
KASSERT(sc != NULL, ("[ae, %d]: sc is NULL!", __LINE__));
 
@@ -1960,17 +1962,10 @@ ae_rx_intr(ae_softc_t *sc)
 */
sc->rxd_cur = (sc->rxd_cur + 1) % AE_RXD_COUNT_DEFAULT;
 
-   if ((flags & AE_RXD_SUCCESS) == 0) {
-   ifp->if_ierrors++;
-   continue;
-   }
-   error = ae_rxeof(sc, rxd);
-   if (error != 0) {
+   if ((flags & AE_RXD_SUCCESS) != 0)
+   ae_rxeof(sc, rxd);
+   else
ifp->if_ierrors++;
-   continue;
-   } else {
-   ifp->if_ipackets++;
-   }
}
 
if (count > 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: r259544 - head/sys/dev/usb/wlan

2013-12-17 Thread Kevin Lo
Author: kevlo
Date: Wed Dec 18 07:34:57 2013
New Revision: 259544
URL: http://svnweb.freebsd.org/changeset/base/259544

Log:
  Add support to IQ calibration.

Modified:
  head/sys/dev/usb/wlan/if_run.c
  head/sys/dev/usb/wlan/if_runreg.h

Modified: head/sys/dev/usb/wlan/if_run.c
==
--- head/sys/dev/usb/wlan/if_run.c  Wed Dec 18 07:23:42 2013
(r259543)
+++ head/sys/dev/usb/wlan/if_run.c  Wed Dec 18 07:34:57 2013
(r259544)
@@ -345,6 +345,7 @@ static int  run_write(struct run_softc *,
 static int run_write_region_1(struct run_softc *, uint16_t,
const uint8_t *, int);
 static int run_set_region_4(struct run_softc *, uint16_t, uint32_t, int);
+static int run_efuse_read(struct run_softc *, uint16_t, uint16_t *, int);
 static int run_efuse_read_2(struct run_softc *, uint16_t, uint16_t *);
 static int run_eeprom_read_2(struct run_softc *, uint16_t, uint16_t *);
 static int run_rt2870_rf_write(struct run_softc *, uint32_t);
@@ -391,6 +392,7 @@ static int  run_raw_xmit(struct ieee80211
const struct ieee80211_bpf_params *);
 static voidrun_start(struct ifnet *);
 static int run_ioctl(struct ifnet *, u_long, caddr_t);
+static voidrun_iq_calib(struct run_softc *, u_int);
 static voidrun_set_agc(struct run_softc *, uint8_t);
 static voidrun_select_chan_group(struct run_softc *, int);
 static voidrun_set_rx_antenna(struct run_softc *, int);
@@ -436,6 +438,28 @@ static voidrun_init_locked(struct run_s
 static voidrun_stop(void *);
 static voidrun_delay(struct run_softc *, u_int);
 
+static const struct rt2860_rate {
+   uint8_t rate;
+   uint8_t mcs;
+   enumieee80211_phytype phy;
+   uint8_t ctl_ridx;
+   uint16_tsp_ack_dur;
+   uint16_tlp_ack_dur;
+} rt2860_rates[] = {
+   {   2, 0, IEEE80211_T_DS,   0, 314, 314 },
+   {   4, 1, IEEE80211_T_DS,   1, 258, 162 },
+   {  11, 2, IEEE80211_T_DS,   2, 223, 127 },
+   {  22, 3, IEEE80211_T_DS,   3, 213, 117 },
+   {  12, 0, IEEE80211_T_OFDM, 4,  60,  60 },
+   {  18, 1, IEEE80211_T_OFDM, 4,  52,  52 },
+   {  24, 2, IEEE80211_T_OFDM, 6,  48,  48 },
+   {  36, 3, IEEE80211_T_OFDM, 6,  44,  44 },
+   {  48, 4, IEEE80211_T_OFDM, 8,  44,  44 },
+   {  72, 5, IEEE80211_T_OFDM, 8,  40,  40 },
+   {  96, 6, IEEE80211_T_OFDM, 8,  40,  40 },
+   { 108, 7, IEEE80211_T_OFDM, 8,  40,  40 }
+};
+
 static const struct {
uint16_treg;
uint32_tval;
@@ -1249,9 +1273,8 @@ run_set_region_4(struct run_softc *sc, u
return (error);
 }
 
-/* Read 16-bit from eFUSE ROM (RT3070 only.) */
 static int
-run_efuse_read_2(struct run_softc *sc, uint16_t addr, uint16_t *val)
+run_efuse_read(struct run_softc *sc, uint16_t addr, uint16_t *val, int count)
 {
uint32_t tmp;
uint16_t reg;
@@ -1260,7 +1283,8 @@ run_efuse_read_2(struct run_softc *sc, u
if ((error = run_read(sc, RT3070_EFUSE_CTRL, &tmp)) != 0)
return (error);
 
-   addr *= 2;
+   if (count == 2)
+   addr *= 2;
/*-
 * Read one 16-byte block into registers EFUSE_DATA[0-3]:
 * DATA0: F E D C
@@ -1290,10 +1314,23 @@ run_efuse_read_2(struct run_softc *sc, u
if ((error = run_read(sc, reg, &tmp)) != 0)
return (error);
 
-   *val = (addr & 2) ? tmp >> 16 : tmp & 0x;
+   if (count == 2)
+   *val = (addr & 2) ? tmp >> 16 : tmp & 0x;
+   else {
+   tmp >>= (8 *(addr & 0x3));
+   memmove(val, &tmp, sizeof(*val));
+   }
return (0);
 }
 
+
+/* Read 16-bit from eFUSE ROM (RT3070 only.) */
+static int
+run_efuse_read_2(struct run_softc *sc, uint16_t addr, uint16_t *val)
+{
+   return (run_efuse_read(sc, addr, val, 2));
+}
+
 static int
 run_eeprom_read_2(struct run_softc *sc, uint16_t addr, uint16_t *val)
 {
@@ -3600,6 +3637,107 @@ run_ioctl(struct ifnet *ifp, u_long cmd,
 }
 
 static void
+run_iq_calib(struct run_softc *sc, u_int chan)
+{
+   uint16_t val;
+
+   /* Tx0 IQ gain. */
+   run_bbp_write(sc, 158, 0x2c);
+   if (chan <= 14)
+   run_efuse_read(sc, RT5390_EEPROM_IQ_GAIN_CAL_TX0_2GHZ, &val, 1);
+   else if (chan <= 64) {
+   run_efuse_read(sc,
+   RT5390_EEPROM_IQ_GAIN_CAL_TX0_CH36_TO_CH64_5GHZ,
+   &val, 1);
+   } else if (chan <= 138) {
+   run_efuse_read(sc,
+   RT5390_EEPROM_IQ_GAIN_CAL_TX0_CH100_TO_CH138_5GHZ,
+   &val, 1);
+   } else if (chan <= 165) {
+   run_efuse_read(sc,
+   RT5390_EEPROM_IQ_GAIN_CAL_TX0_CH140_TO_CH165_5GHZ,
+   &val, 1);
+   } else
+   val = 0;
+   run_bbp_write(sc, 159, val & 0xff);
+
+   /* Tx0 IQ phase. */

svn commit: r259545 - head/sys/dev/usb/wlan

2013-12-17 Thread Kevin Lo
Author: kevlo
Date: Wed Dec 18 07:47:50 2013
New Revision: 259545
URL: http://svnweb.freebsd.org/changeset/base/259545

Log:
  Fix typo in comment.

Modified:
  head/sys/dev/usb/wlan/if_run.c

Modified: head/sys/dev/usb/wlan/if_run.c
==
--- head/sys/dev/usb/wlan/if_run.c  Wed Dec 18 07:34:57 2013
(r259544)
+++ head/sys/dev/usb/wlan/if_run.c  Wed Dec 18 07:47:50 2013
(r259545)
@@ -4471,7 +4471,7 @@ run_set_chan(struct run_softc *sc, struc
 
run_delay(sc, 10);
 
-   /* Perform IQ calibrations. */
+   /* Perform IQ calibration. */
if (sc->mac_ver >= 0x5392)
run_iq_calib(sc, chan);
 
___
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"