Re: svn commit: r238622 - head/etc/rc.d

2012-08-03 Thread Andrey Zonov

On 8/3/12 2:22 AM, Maksim Yevmenkin wrote:



i just wanted to make sure that there is a way to absolutely make sure
that there is no default address selection policy installed. the wide
know rule 9 of rfc 3484 is really messing things up for dns-style load
balancing. even when ipv6 is not used.


Did you try an empty config file?



Maksim, can you say more about this? Or point me to a reference that has
the discussion?


of course :) we have ipv4 systems in production that make use of
getaddrinfo(3) api. when a particular dns name is resolved, and,
multiple A records are returned, the results get sorted according to
the "default" address selection policy. rfc3484 has a set of rules
according to which results should be sorted. all of the rules do not
apply in our case, except one - the rule #9. the idea is that ipv4
addresses are "converted" to ipv6 addresses and then longest prefix
match sorting is applied. in other words, if your system ip address
happens to share high bits with the ip address from the A record, the
IP address from the A record will always be preferred. of course,
longest prefix match is performed  without any extra information such
as netmask and/or cidr. it really is just matching high bits of the
address.

so, what we found out, is that some systems tend to favor a particular
ip address (from a bunch of ip addresses returned by name resolution)
because 4 high bits were the same. basically, round-robin dns was
completely shot.


RFC3484 completely breaks round-robin DNS.  It's clearly that rule #9 
should not apply if resolved name has only A records.  That problem was 
discussed many times at ietf.org, but authors don't want to understand 
people.  For example, for us the problem will be huge when Windows users 
will update their systems.


PS: It would be very useful to have a chance to turn off rule #9 in FreeBSD.

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


svn commit: r239005 - head/sys/kern

2012-08-03 Thread Alexander Motin
Author: mav
Date: Fri Aug  3 09:08:20 2012
New Revision: 239005
URL: http://svn.freebsd.org/changeset/base/239005

Log:
  Microoptimize time math.  As soon as our event periods are always below ome
  second we may not add intereger parts by using bintime_addx() instead of
  bintime_add().  Profiling shows handleevents() time redction by 15%.

Modified:
  head/sys/kern/kern_clocksource.c

Modified: head/sys/kern/kern_clocksource.c
==
--- head/sys/kern/kern_clocksource.cFri Aug  3 05:39:32 2012
(r239004)
+++ head/sys/kern/kern_clocksource.cFri Aug  3 09:08:20 2012
(r239005)
@@ -205,19 +205,21 @@ handleevents(struct bintime *now, int fa
 
runs = 0;
while (bintime_cmp(now, &state->nexthard, >=)) {
-   bintime_add(&state->nexthard, &hardperiod);
+   bintime_addx(&state->nexthard, hardperiod.frac);
runs++;
}
-   if ((timer->et_flags & ET_FLAGS_PERCPU) == 0 &&
-   bintime_cmp(&state->nexthard, &nexthard, >))
-   nexthard = state->nexthard;
-   if (runs && fake < 2) {
-   hardclock_cnt(runs, usermode);
-   done = 1;
+   if (runs) {
+   if ((timer->et_flags & ET_FLAGS_PERCPU) == 0 &&
+   bintime_cmp(&state->nexthard, &nexthard, >))
+   nexthard = state->nexthard;
+   if (fake < 2) {
+   hardclock_cnt(runs, usermode);
+   done = 1;
+   }
}
runs = 0;
while (bintime_cmp(now, &state->nextstat, >=)) {
-   bintime_add(&state->nextstat, &statperiod);
+   bintime_addx(&state->nextstat, statperiod.frac);
runs++;
}
if (runs && fake < 2) {
@@ -227,7 +229,7 @@ handleevents(struct bintime *now, int fa
if (profiling) {
runs = 0;
while (bintime_cmp(now, &state->nextprof, >=)) {
-   bintime_add(&state->nextprof, &profperiod);
+   bintime_addx(&state->nextprof, profperiod.frac);
runs++;
}
if (runs && !fake) {
@@ -356,7 +358,7 @@ timercb(struct eventtimer *et, void *arg
next = &nexttick;
if (periodic) {
now = *next;/* Ex-next tick time becomes present time. */
-   bintime_add(next, &timerperiod); /* Next tick in 1 period. */
+   bintime_addx(next, timerperiod.frac); /* Next tick in 1 period. 
*/
} else {
binuptime(&now);/* Get present time from hardware. */
next->sec = -1; /* Next tick is not scheduled yet. */
@@ -433,7 +435,7 @@ loadtimer(struct bintime *now, int start
new.sec = 0;
new.frac = timerperiod.frac - tmp;
if (new.frac < tmp) /* Left less then passed. */
-   bintime_add(&new, &timerperiod);
+   bintime_addx(&new, timerperiod.frac);
CTR5(KTR_SPARE2, "load p at %d:   now %d.%08x first in 
%d.%08x",
curcpu, now->sec, (unsigned int)(now->frac >> 32),
new.sec, (unsigned int)(new.frac >> 32));
@@ -531,7 +533,7 @@ configtimer(int start)
if (start) {
/* Initialize time machine parameters. */
next = now;
-   bintime_add(&next, &timerperiod);
+   bintime_addx(&next, timerperiod.frac);
if (periodic)
nexttick = next;
else
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r239006 - stable/8/sys/dev/puc

2012-08-03 Thread Max Khon
Author: fjoe
Date: Fri Aug  3 11:22:09 2012
New Revision: 239006
URL: http://svn.freebsd.org/changeset/base/239006

Log:
  MFC: r238933
  
  - Change back "d_ofs" to int8_t to not pessimize padding and size of "struct 
puc_cfg"
  - Use "puc_config_moxa" for Moxa boards that need d_ofs greater than 0x7f

Modified:
  stable/8/sys/dev/puc/puc_cfg.h
  stable/8/sys/dev/puc/pucdata.c
Directory Properties:
  stable/8/   (props changed)
  stable/8/sys/   (props changed)
  stable/8/sys/dev/   (props changed)

Modified: stable/8/sys/dev/puc/puc_cfg.h
==
--- stable/8/sys/dev/puc/puc_cfg.h  Fri Aug  3 09:08:20 2012
(r239005)
+++ stable/8/sys/dev/puc/puc_cfg.h  Fri Aug  3 11:22:09 2012
(r239006)
@@ -79,7 +79,7 @@ struct puc_cfg {
int8_t  ports;
int8_t  rid;/* Rid of first port */
int8_t  d_rid;  /* Delta rid of next ports */
-   int16_t d_ofs;  /* Delta offset of next ports */
+   int8_t  d_ofs;  /* Delta offset of next ports */
puc_config_f*config_function;
 };
 

Modified: stable/8/sys/dev/puc/pucdata.c
==
--- stable/8/sys/dev/puc/pucdata.c  Fri Aug  3 09:08:20 2012
(r239005)
+++ stable/8/sys/dev/puc/pucdata.c  Fri Aug  3 11:22:09 2012
(r239006)
@@ -510,13 +510,15 @@ const struct puc_cfg puc_pci_devices[] =
{   0x1393, 0x1024, 0x, 0,
"Moxa Technologies, Smartio CP-102E/PCIe",
DEFAULT_RCLK * 8,
-   PUC_PORT_2S, 0x14, 0, 0x200
+   PUC_PORT_2S, 0x14, 0, -1,
+   .config_function = puc_config_moxa
},
 
{   0x1393, 0x1025, 0x, 0,
"Moxa Technologies, Smartio CP-102EL/PCIe",
DEFAULT_RCLK * 8,
-   PUC_PORT_2S, 0x14, 0, 0x200,
+   PUC_PORT_2S, 0x14, 0, -1,
+   .config_function = puc_config_moxa
},
 
{   0x1393, 0x1040, 0x, 0,
@@ -572,7 +574,8 @@ const struct puc_cfg puc_pci_devices[] =
{   0x1393, 0x1182, 0x, 0,
"Moxa Technologies, Smartio CP-118EL-A/PCIe",
DEFAULT_RCLK * 8,
-   PUC_PORT_8S, 0x14, 0, 0x200,
+   PUC_PORT_8S, 0x14, 0, -1,
+   .config_function = puc_config_moxa
},
 
{   0x1393, 0x1680, 0x, 0,
@@ -596,7 +599,8 @@ const struct puc_cfg puc_pci_devices[] =
{   0x1393, 0x1683, 0x, 0,
"Moxa Technologies, Smartio CP-168EL-A/PCIe",
DEFAULT_RCLK * 8,
-   PUC_PORT_8S, 0x14, 0, 0x200,
+   PUC_PORT_8S, 0x14, 0, -1,
+   .config_function = puc_config_moxa
},
 
{   0x13a8, 0x0152, 0x, 0,
@@ -1153,7 +1157,12 @@ puc_config_moxa(struct puc_softc *sc, en
 intptr_t *res)
 {
if (cmd == PUC_CFG_GET_OFS) {
-   *res = ((port == 3) ? 7 : port) * 0x200;
+   const struct puc_cfg *cfg = sc->sc_cfg;
+
+   if (port == 3 && (cfg->device == 0x1045 || cfg->device == 
0x1144))
+   port = 7;
+   *res = port * 0x200;
+
return 0;
}
return (ENXIO);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r239007 - head/sys/netgraph

2012-08-03 Thread Alexander Motin
Author: mav
Date: Fri Aug  3 12:55:31 2012
New Revision: 239007
URL: http://svn.freebsd.org/changeset/base/239007

Log:
  Remove duplicate check.
  
  Submitted by: Dmitry Luhtionov 

Modified:
  head/sys/netgraph/ng_pptpgre.c

Modified: head/sys/netgraph/ng_pptpgre.c
==
--- head/sys/netgraph/ng_pptpgre.c  Fri Aug  3 11:22:09 2012
(r239006)
+++ head/sys/netgraph/ng_pptpgre.c  Fri Aug  3 12:55:31 2012
(r239007)
@@ -562,7 +562,7 @@ ng_pptpgre_xmit(hpriv_p hpriv, item_p it
}
 
/* Sanity check frame length */
-   if (m != NULL && m->m_pkthdr.len > PPTP_MAX_PAYLOAD) {
+   if (m->m_pkthdr.len > PPTP_MAX_PAYLOAD) {
priv->stats.xmitTooBig++;
ERROUT(EMSGSIZE);
}
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r239008 - in head/sys: powerpc/powerpc x86/x86

2012-08-03 Thread John Baldwin
Author: jhb
Date: Fri Aug  3 13:50:29 2012
New Revision: 239008
URL: http://svn.freebsd.org/changeset/base/239008

Log:
  Improve the handling of static DMA buffers that use non-default memory
  attributes (currently just BUS_DMA_NOCACHE):
  - Don't call pmap_change_attr() on the returned address, instead use
kmem_alloc_contig() to ask the VM system for memory with the requested
attribute.
  - As a result, always use kmem_alloc_contig() for non-default memory
attributes, even for sub-page allocations.  This requires adjusting
bus_dmamem_free()'s logic for determining which free routine to use.
  - For x86, add a new dummy bus_dmamap that is used for static DMA
buffers allocated via kmem_alloc_contig().  bus_dmamem_free() can then
use the map pointer to determine which free routine to use.
  - For powerpc, add a new flag to the allocated map (bus_dmamem_alloc()
always creates a real map on powerpc) to indicate which free routine
should be used.
  
  Note that the BUS_DMA_NOCACHE handling in powerpc is currently #ifdef'd out.
  I have left it disabled but updated it to match x86.
  
  Reviewed by:  scottl
  MFC after:1 month

Modified:
  head/sys/powerpc/powerpc/busdma_machdep.c
  head/sys/x86/x86/busdma_machdep.c

Modified: head/sys/powerpc/powerpc/busdma_machdep.c
==
--- head/sys/powerpc/powerpc/busdma_machdep.c   Fri Aug  3 12:55:31 2012
(r239007)
+++ head/sys/powerpc/powerpc/busdma_machdep.c   Fri Aug  3 13:50:29 2012
(r239008)
@@ -46,6 +46,8 @@ __FBSDID("$FreeBSD$");
 #include 
 
 #include 
+#include 
+#include 
 #include 
 #include 
 
@@ -130,6 +132,7 @@ struct bus_dmamap {
bus_dmamap_callback_t *callback;
void  *callback_arg;
STAILQ_ENTRY(bus_dmamap) links;
+   intcontigalloc;
 };
 
 static STAILQ_HEAD(, bus_dmamap) bounce_map_waitinglist;
@@ -489,6 +492,7 @@ int
 bus_dmamem_alloc(bus_dma_tag_t dmat, void** vaddr, int flags,
 bus_dmamap_t *mapp)
 {
+   vm_memattr_t attr;
int mflags;
 
if (flags & BUS_DMA_NOWAIT)
@@ -500,6 +504,12 @@ bus_dmamem_alloc(bus_dma_tag_t dmat, voi
 
if (flags & BUS_DMA_ZERO)
mflags |= M_ZERO;
+#ifdef NOTYET
+   if (flags & BUS_DMA_NOCACHE)
+   attr = VM_MEMATTR_UNCACHEABLE;
+   else
+#endif
+   attr = VM_MEMATTR_DEFAULT;
 
/* 
 * XXX:
@@ -511,7 +521,8 @@ bus_dmamem_alloc(bus_dma_tag_t dmat, voi
 */
if ((dmat->maxsize <= PAGE_SIZE) &&
   (dmat->alignment < dmat->maxsize) &&
-   dmat->lowaddr >= ptoa((vm_paddr_t)Maxmem)) {
+   dmat->lowaddr >= ptoa((vm_paddr_t)Maxmem) &&
+   attr == VM_MEMATTR_DEFAULT) {
*vaddr = malloc(dmat->maxsize, M_DEVBUF, mflags);
} else {
/*
@@ -520,9 +531,10 @@ bus_dmamem_alloc(bus_dma_tag_t dmat, voi
 * multi-seg allocations yet though.
 * XXX Certain AGP hardware does.
 */
-   *vaddr = contigmalloc(dmat->maxsize, M_DEVBUF, mflags,
-   0ul, dmat->lowaddr, dmat->alignment? dmat->alignment : 1ul,
-   dmat->boundary);
+   *vaddr = (void *)kmem_alloc_contig(kernel_map, dmat->maxsize,
+   mflags, 0ul, dmat->lowaddr, dmat->alignment ?
+   dmat->alignment : 1ul, dmat->boundary, attr);
+   (*mapp)->contigalloc = 1;
}
if (*vaddr == NULL) {
CTR4(KTR_BUSDMA, "%s: tag %p tag flags 0x%x error %d",
@@ -531,11 +543,6 @@ bus_dmamem_alloc(bus_dma_tag_t dmat, voi
} else if (vtophys(*vaddr) & (dmat->alignment - 1)) {
printf("bus_dmamem_alloc failed to align memory properly.\n");
}
-#ifdef NOTYET
-   if (flags & BUS_DMA_NOCACHE)
-   pmap_change_attr((vm_offset_t)*vaddr, dmat->maxsize,
-   VM_MEMATTR_UNCACHEABLE);
-#endif
CTR4(KTR_BUSDMA, "%s: tag %p tag flags 0x%x error %d",
__func__, dmat, dmat->flags, 0);
return (0);
@@ -548,18 +555,12 @@ bus_dmamem_alloc(bus_dma_tag_t dmat, voi
 void
 bus_dmamem_free(bus_dma_tag_t dmat, void *vaddr, bus_dmamap_t map)
 {
-   bus_dmamap_destroy(dmat, map);
 
-#ifdef NOTYET
-   pmap_change_attr((vm_offset_t)vaddr, dmat->maxsize, VM_MEMATTR_DEFAULT);
-#endif
-   if ((dmat->maxsize <= PAGE_SIZE) &&
-  (dmat->alignment < dmat->maxsize) &&
-   dmat->lowaddr >= ptoa((vm_paddr_t)Maxmem))
+   if (!map->contigalloc)
free(vaddr, M_DEVBUF);
-   else {
-   contigfree(vaddr, dmat->maxsize, M_DEVBUF);
-   }
+   else
+   kmem_free(kernel_map, (vm_offset_t)vaddr, dmat->maxsize);
+   bus_dmamap_destroy(dmat, map);
CTR3(KTR_BUSDMA, "%s: tag %p flags 0x%x", __func__, dmat, dmat->flags);
 }
 

Modified: head/sys

svn commit: r239009 - head/sys/conf

2012-08-03 Thread Luigi Rizzo
Author: luigi
Date: Fri Aug  3 14:00:26 2012
New Revision: 239009
URL: http://svn.freebsd.org/changeset/base/239009

Log:
  support building vtnet as an embedded driver

Modified:
  head/sys/conf/files

Modified: head/sys/conf/files
==
--- head/sys/conf/files Fri Aug  3 13:50:29 2012(r239008)
+++ head/sys/conf/files Fri Aug  3 14:00:26 2012(r239009)
@@ -2210,6 +2210,16 @@ dev/utopia/idtphy.c  optional utopia
 dev/utopia/suni.c  optional utopia
 dev/utopia/utopia.coptional utopia
 dev/vge/if_vge.c   optional vge
+#
+# virtio support
+#
+dev/virtio/pci/virtio_pci.coptional vtnet
+dev/virtio/virtio.coptional vtnet
+dev/virtio/virtqueue.c optional vtnet
+dev/virtio/network/if_vtnet.c  optional vtnet
+dev/virtio/virtio_bus_if.m optional vtnet
+dev/virtio/virtio_if.m optional vtnet
+
 dev/vkbd/vkbd.coptional vkbd
 dev/vr/if_vr.c optional vr pci
 dev/vte/if_vte.c   optional vte pci
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r239010 - head/sys/dev/isp

2012-08-03 Thread Matt Jacob
Author: mjacob
Date: Fri Aug  3 14:25:35 2012
New Revision: 239010
URL: http://svn.freebsd.org/changeset/base/239010

Log:
  Oops. We only do allocate room for extended commands
  and responses for 2300 cards are newer.
  
  Sponsored by: Spectralogic
  Noticed by:   Our Friend Manfred
  MFC after:1 month
  X-MFC: 238869

Modified:
  head/sys/dev/isp/isp_pci.c

Modified: head/sys/dev/isp/isp_pci.c
==
--- head/sys/dev/isp/isp_pci.c  Fri Aug  3 14:00:26 2012(r239009)
+++ head/sys/dev/isp/isp_pci.c  Fri Aug  3 14:25:35 2012(r239010)
@@ -1482,16 +1482,18 @@ imc(void *arg, bus_dma_segment_t *segs, 
segs->ds_addr += ISP_QUEUE_SIZE(RESULT_QUEUE_LEN(imushp->isp));
imushp->vbase += ISP_QUEUE_SIZE(RESULT_QUEUE_LEN(imushp->isp));
 
-   imushp->isp->isp_osinfo.ecmd_dma = segs->ds_addr;
-   imushp->isp->isp_osinfo.ecmd_free = (isp_ecmd_t *)imushp->vbase;
-   imushp->isp->isp_osinfo.ecmd_base = imushp->isp->isp_osinfo.ecmd_free;
-   for (ecmd = imushp->isp->isp_osinfo.ecmd_free; ecmd < 
&imushp->isp->isp_osinfo.ecmd_free[N_XCMDS]; ecmd++) {
-   if (ecmd == &imushp->isp->isp_osinfo.ecmd_free[N_XCMDS - 1]) {
-   ecmd->next = NULL;
-   } else {
-   ecmd->next = ecmd + 1;
-   }
-   }
+   if (imushp->isp->isp_type >= ISP_HA_FC_2300) {
+imushp->isp->isp_osinfo.ecmd_dma = segs->ds_addr;
+imushp->isp->isp_osinfo.ecmd_free = (isp_ecmd_t *)imushp->vbase;
+imushp->isp->isp_osinfo.ecmd_base = imushp->isp->isp_osinfo.ecmd_free;
+for (ecmd = imushp->isp->isp_osinfo.ecmd_free; ecmd < 
&imushp->isp->isp_osinfo.ecmd_free[N_XCMDS]; ecmd++) {
+if (ecmd == &imushp->isp->isp_osinfo.ecmd_free[N_XCMDS - 1]) {
+ecmd->next = NULL;
+} else {
+ecmd->next = ecmd + 1;
+}
+}
+}
 #ifdef ISP_TARGET_MODE
segs->ds_addr += (N_XCMDS * XCMD_SIZE);
imushp->vbase += (N_XCMDS * XCMD_SIZE);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r239012 - in head: sbin/geom/class/multipath sys/geom/multipath

2012-08-03 Thread Thomas Quinot
Author: thomas
Date: Fri Aug  3 14:55:35 2012
New Revision: 239012
URL: http://svn.freebsd.org/changeset/base/239012

Log:
  New command "gmultipath prefer" to force selection of a specified
  provider in an Active/Passive configuration.
  
  Reviewed by:  mav
  MFC after:4 weeks

Modified:
  head/sbin/geom/class/multipath/geom_multipath.c
  head/sbin/geom/class/multipath/gmultipath.8
  head/sys/geom/multipath/g_multipath.c

Modified: head/sbin/geom/class/multipath/geom_multipath.c
==
--- head/sbin/geom/class/multipath/geom_multipath.c Fri Aug  3 14:49:18 
2012(r239011)
+++ head/sbin/geom/class/multipath/geom_multipath.c Fri Aug  3 14:55:35 
2012(r239012)
@@ -49,6 +49,7 @@ uint32_t version = G_MULTIPATH_VERSION;
 static void mp_main(struct gctl_req *, unsigned int);
 static void mp_label(struct gctl_req *);
 static void mp_clear(struct gctl_req *);
+static void mp_prefer(struct gctl_req *);
 
 struct g_command class_commands[] = {
{
@@ -87,6 +88,10 @@ struct g_command class_commands[] = {
"[-v] name prov"
},
{
+   "prefer", G_FLAG_VERBOSE, mp_main, G_NULL_OPTS,
+   "[-v] prov ..."
+   },
+   {
"fail", G_FLAG_VERBOSE, NULL, G_NULL_OPTS,
"[-v] name prov"
},
@@ -131,6 +136,8 @@ mp_main(struct gctl_req *req, unsigned i
mp_label(req);
} else if (strcmp(name, "clear") == 0) {
mp_clear(req);
+   } else if (strcmp(name, "prefer") == 0) {
+   mp_prefer(req);
} else {
gctl_error(req, "Unknown command: %s.", name);
}
@@ -294,3 +301,22 @@ mp_clear(struct gctl_req *req)
}
 }
 
+static void
+mp_prefer(struct gctl_req *req)
+{
+   const char *name, *comp, *errstr;
+   int nargs;
+
+   nargs = gctl_get_int(req, "nargs");
+   if (nargs != 2) {
+   gctl_error(req, "Usage: prefer GEOM PROVIDER");
+   return;
+   }
+   name = gctl_get_ascii(req, "arg0");
+   comp = gctl_get_ascii(req, "arg1");
+   errstr = gctl_issue (req);
+   if (errstr != NULL) {
+   fprintf(stderr, "Can't set %s preferred provider to %s: %s.\n",
+   name, comp, errstr);
+   }
+}

Modified: head/sbin/geom/class/multipath/gmultipath.8
==
--- head/sbin/geom/class/multipath/gmultipath.8 Fri Aug  3 14:49:18 2012
(r239011)
+++ head/sbin/geom/class/multipath/gmultipath.8 Fri Aug  3 14:55:35 2012
(r239012)
@@ -66,6 +66,11 @@
 .Op Fl v
 .Ar name
 .Nm
+.Cm prefer
+.Op Fl v
+.Ar name
+.Ar prov
+.Nm
 .Cm getactive
 .Op Fl v
 .Ar name
@@ -171,7 +176,9 @@ If there are other paths present, new re
 Mark specified provider as a path of the specified multipath device as
 operational, allowing it to handle requests.
 .It Cm rotate
-Change the active provider/path in Active/Passive mode.
+Change the active provider/path to the next available provider in 
Active/Passive mode.
+.It Cm prefer
+Change the active provider/path to the specified provider in Active/Passive 
mode.
 .It Cm getactive
 Get the currently active provider(s)/path(s).
 .It Cm destroy

Modified: head/sys/geom/multipath/g_multipath.c
==
--- head/sys/geom/multipath/g_multipath.c   Fri Aug  3 14:49:18 2012
(r239011)
+++ head/sys/geom/multipath/g_multipath.c   Fri Aug  3 14:55:35 2012
(r239012)
@@ -849,6 +849,78 @@ g_multipath_ctl_add_name(struct gctl_req
 }
 
 static void
+g_multipath_ctl_prefer(struct gctl_req *req, struct g_class *mp)
+{
+   struct g_geom *gp;
+   struct g_multipath_softc *sc;
+   struct g_consumer *cp;
+   const char *name, *mpname;
+   static const char devpf[6] = "/dev/";
+   int *nargs;
+
+   g_topology_assert();
+
+   mpname = gctl_get_asciiparam(req, "arg0");
+if (mpname == NULL) {
+gctl_error(req, "No 'arg0' argument");
+return;
+}
+   gp = g_multipath_find_geom(mp, mpname);
+   if (gp == NULL) {
+   gctl_error(req, "Device %s is invalid", mpname);
+   return;
+   }
+   sc = gp->softc;
+
+   nargs = gctl_get_paraml(req, "nargs", sizeof(*nargs));
+   if (nargs == NULL) {
+   gctl_error(req, "No 'nargs' argument");
+   return;
+   }
+   if (*nargs != 2) {
+   gctl_error(req, "missing device");
+   return;
+   }
+
+   name = gctl_get_asciiparam(req, "arg1");
+   if (name == NULL) {
+   gctl_error(req, "No 'arg1' argument");
+   return;
+   }
+   if (strncmp(name, devpf, 5) == 0) {
+   name += 5;
+   }
+
+   LIST_FOREACH(cp, &gp->consumer, consumer) {
+ 

svn commit: r239013 - head/sys/x86/x86

2012-08-03 Thread Alexander Motin
Author: mav
Date: Fri Aug  3 15:19:59 2012
New Revision: 239013
URL: http://svn.freebsd.org/changeset/base/239013

Log:
  Microoptimize LAPIC timer routines to avoid reading from hardware during
  programming using earlier cached values. This makes respective routines to
  disappear from PMC top and reduces total number of active CPU cycles on idle
  24-core system by 10%.

Modified:
  head/sys/x86/x86/local_apic.c

Modified: head/sys/x86/x86/local_apic.c
==
--- head/sys/x86/x86/local_apic.c   Fri Aug  3 14:55:35 2012
(r239012)
+++ head/sys/x86/x86/local_apic.c   Fri Aug  3 15:19:59 2012
(r239013)
@@ -119,6 +119,7 @@ struct lapic {
u_long *la_timer_count;
u_long la_timer_period;
u_int la_timer_mode;
+   uint32_t lvt_timer_cache;
/* Include IDT_SYSCALL to make indexing easier. */
int la_ioint_irqs[APIC_NUM_IOINTS + 1];
 } static lapics[MAX_APIC_ID + 1];
@@ -160,9 +161,11 @@ static struct eventtimer lapic_et;
 
 static voidlapic_enable(void);
 static voidlapic_resume(struct pic *pic);
-static voidlapic_timer_oneshot(u_int count, int enable_int);
-static voidlapic_timer_periodic(u_int count, int enable_int);
-static voidlapic_timer_stop(void);
+static voidlapic_timer_oneshot(struct lapic *,
+   u_int count, int enable_int);
+static voidlapic_timer_periodic(struct lapic *,
+   u_int count, int enable_int);
+static voidlapic_timer_stop(struct lapic *);
 static voidlapic_timer_set_divisor(u_int divisor);
 static uint32_tlvt_mode(struct lapic *la, u_int pin, uint32_t value);
 static int lapic_et_start(struct eventtimer *et,
@@ -370,7 +373,8 @@ lapic_setup(int boot)
lapic->lvt_pcint = lvt_mode(la, LVT_PMC, lapic->lvt_pcint);
 
/* Program timer LVT and setup handler. */
-   lapic->lvt_timer = lvt_mode(la, LVT_TIMER, lapic->lvt_timer);
+   la->lvt_timer_cache = lapic->lvt_timer =
+   lvt_mode(la, LVT_TIMER, lapic->lvt_timer);
if (boot) {
snprintf(buf, sizeof(buf), "cpu%d:timer", PCPU_GET(cpuid));
intrcnt_add(buf, &la->la_timer_count);
@@ -382,9 +386,9 @@ lapic_setup(int boot)
lapic_id()));
lapic_timer_set_divisor(lapic_timer_divisor);
if (la->la_timer_mode == 1)
-   lapic_timer_periodic(la->la_timer_period, 1);
+   lapic_timer_periodic(la, la->la_timer_period, 1);
else
-   lapic_timer_oneshot(la->la_timer_period, 1);
+   lapic_timer_oneshot(la, la->la_timer_period, 1);
}
 
/* Program error LVT and clear any existing errors. */
@@ -489,13 +493,14 @@ lapic_et_start(struct eventtimer *et,
struct lapic *la;
u_long value;
 
+   la = &lapics[PCPU_GET(apic_id)];
if (et->et_frequency == 0) {
/* Start off with a divisor of 2 (power on reset default). */
lapic_timer_divisor = 2;
/* Try to calibrate the local APIC timer. */
do {
lapic_timer_set_divisor(lapic_timer_divisor);
-   lapic_timer_oneshot(APIC_TIMER_MAX_COUNT, 0);
+   lapic_timer_oneshot(la, APIC_TIMER_MAX_COUNT, 0);
DELAY(100);
value = APIC_TIMER_MAX_COUNT - lapic->ccr_timer;
if (value != APIC_TIMER_MAX_COUNT)
@@ -515,22 +520,22 @@ lapic_et_start(struct eventtimer *et,
et->et_max_period.frac =
((0xfffeLLU << 32) / et->et_frequency) << 32;
}
-   lapic_timer_set_divisor(lapic_timer_divisor);
-   la = &lapics[lapic_id()];
+   if (la->la_timer_mode == 0)
+   lapic_timer_set_divisor(lapic_timer_divisor);
if (period != NULL) {
la->la_timer_mode = 1;
la->la_timer_period =
(et->et_frequency * (period->frac >> 32)) >> 32;
if (period->sec != 0)
la->la_timer_period += et->et_frequency * period->sec;
-   lapic_timer_periodic(la->la_timer_period, 1);
+   lapic_timer_periodic(la, la->la_timer_period, 1);
} else {
la->la_timer_mode = 2;
la->la_timer_period =
(et->et_frequency * (first->frac >> 32)) >> 32;
if (first->sec != 0)
la->la_timer_period += et->et_frequency * first->sec;
-   lapic_timer_oneshot(la->la_timer_period, 1);
+   lapic_timer_oneshot(la, la->la_timer_period, 1);
}
return (0);
 }
@@ -538,10 +543,10 @@ lapic_et_start(struct eventtimer *et,
 static int
 lapic_et_stop(struct eventtimer *et)
 {
-   struct lapic *la = &lapics[lapic_id()];
+   stru

Re: svn commit: r238622 - head/etc/rc.d

2012-08-03 Thread Maksim Yevmenkin
On Fri, Aug 3, 2012 at 1:17 AM, Andrey Zonov  wrote:
> On 8/3/12 2:22 AM, Maksim Yevmenkin wrote:
>>>
>>>
 i just wanted to make sure that there is a way to absolutely make sure
 that there is no default address selection policy installed. the wide
 know rule 9 of rfc 3484 is really messing things up for dns-style load
 balancing. even when ipv6 is not used.
>
> Did you try an empty config file?

no, but it would not matter. please see my commit to libc, i.e.

http://svnweb.FreeBSD.org/base?view=revision&revision=238599

before that, results were still sorted according to the rule 9. the
only "hidden" sorting that remains in libc is that if name resolution
contains both  and A records,  records are put before A
records, and, thus, get preferred. however, records order with in a
particular group ( or A) should be unchanged. application has
control over this by giving desired family to getaddrinfo(). it is
reasonable, imo, to return  records when application uses
AF_UNSPEC.

>>> Maksim, can you say more about this? Or point me to a reference that has
>>> the discussion?
>>
>> of course :) we have ipv4 systems in production that make use of
>> getaddrinfo(3) api. when a particular dns name is resolved, and,
>> multiple A records are returned, the results get sorted according to
>> the "default" address selection policy. rfc3484 has a set of rules
>> according to which results should be sorted. all of the rules do not
>> apply in our case, except one - the rule #9. the idea is that ipv4
>> addresses are "converted" to ipv6 addresses and then longest prefix
>> match sorting is applied. in other words, if your system ip address
>> happens to share high bits with the ip address from the A record, the
>> IP address from the A record will always be preferred. of course,
>> longest prefix match is performed  without any extra information such
>> as netmask and/or cidr. it really is just matching high bits of the
>> address.
>>
>> so, what we found out, is that some systems tend to favor a particular
>> ip address (from a bunch of ip addresses returned by name resolution)
>> because 4 high bits were the same. basically, round-robin dns was
>> completely shot.
>
>
> RFC3484 completely breaks round-robin DNS.  It's clearly that rule #9 should
> not apply if resolved name has only A records.  That problem was discussed
> many times at ietf.org, but authors don't want to understand people.  For
> example, for us the problem will be huge when Windows users will update
> their systems.

yes, it does :) but it does not have to be :) yes, sometimes
application has to change, but it ok, imo.

> PS: It would be very useful to have a chance to turn off rule #9 in FreeBSD.

well, may be. my commits to libc and ip6addrctl rc script address our
particular problem and, hopefully, do not break things and/or
introduce unwanted/unexpected behavior

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


svn commit: r239019 - head/libexec/rtld-elf

2012-08-03 Thread Alexander Kabaev
Author: kan
Date: Fri Aug  3 17:04:41 2012
New Revision: 239019
URL: http://svn.freebsd.org/changeset/base/239019

Log:
  Parse notes only after object structure had been allocated.
  
  Reported by: kargl
  Reviewed by: kib (sans whitespace)

Modified:
  head/libexec/rtld-elf/map_object.c

Modified: head/libexec/rtld-elf/map_object.c
==
--- head/libexec/rtld-elf/map_object.c  Fri Aug  3 16:18:20 2012
(r239018)
+++ head/libexec/rtld-elf/map_object.c  Fri Aug  3 17:04:41 2012
(r239019)
@@ -153,7 +153,6 @@ map_object(int fd, const char *path, con
break;
note_start = (Elf_Addr)(char *)hdr + phdr->p_offset;
note_end = note_start + phdr->p_filesz;
-   digest_notes(obj, note_start, note_end);
break;
}
 
@@ -291,7 +290,8 @@ map_object(int fd, const char *path, con
 obj->stack_flags = stack_flags;
 obj->relro_page = obj->relocbase + trunc_page(relro_page);
 obj->relro_size = round_page(relro_size);
-
+if (note_start < note_end)
+   digest_notes(obj, note_start, note_end);
 munmap(hdr, PAGE_SIZE);
 return (obj);
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r239020 - head/sys/x86/x86

2012-08-03 Thread John Baldwin
Author: jhb
Date: Fri Aug  3 18:40:44 2012
New Revision: 239020
URL: http://svn.freebsd.org/changeset/base/239020

Log:
  Correct function name in comment.
  
  Submitted by: alc

Modified:
  head/sys/x86/x86/busdma_machdep.c

Modified: head/sys/x86/x86/busdma_machdep.c
==
--- head/sys/x86/x86/busdma_machdep.c   Fri Aug  3 17:04:41 2012
(r239019)
+++ head/sys/x86/x86/busdma_machdep.c   Fri Aug  3 18:40:44 2012
(r239020)
@@ -567,7 +567,7 @@ bus_dmamem_free(bus_dma_tag_t dmat, void
/*
 * dmamem does not need to be bounced, so the map should be
 * NULL if malloc() was used and contig_dmamap if
-* contigmalloc() was used.
+* kmem_alloc_contig() was used.
 */
if (!(map == NULL || map == &contig_dmamap))
panic("bus_dmamem_free: Invalid map freed\n");
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r239021 - head/sys/geom/virstor

2012-08-03 Thread Jim Harris
Author: jimharris
Date: Fri Aug  3 20:24:16 2012
New Revision: 239021
URL: http://svn.freebsd.org/changeset/base/239021

Log:
  In virstor_ctl_stop(), check for a valid softc before trying to update
   metadata.
  
  Sponsored by: Intel
  Reported and tested by:   Marcelo Gondim 
  PR:   kern/170199
  MFC after:3 days

Modified:
  head/sys/geom/virstor/g_virstor.c

Modified: head/sys/geom/virstor/g_virstor.c
==
--- head/sys/geom/virstor/g_virstor.c   Fri Aug  3 18:40:44 2012
(r239020)
+++ head/sys/geom/virstor/g_virstor.c   Fri Aug  3 20:24:16 2012
(r239021)
@@ -235,6 +235,12 @@ virstor_ctl_stop(struct gctl_req *req, s
return;
}
sc = virstor_find_geom(cp, name);
+   if (sc == NULL) {
+   gctl_error(req, "Don't know anything about '%s'", name);
+   g_topology_unlock();
+   return;
+   }
+
LOG_MSG(LVL_INFO, "Stopping %s by the userland command",
sc->geom->name);
update_metadata(sc);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r239022 - head/sbin/geom/class/virstor

2012-08-03 Thread Jim Harris
Author: jimharris
Date: Fri Aug  3 20:30:40 2012
New Revision: 239022
URL: http://svn.freebsd.org/changeset/base/239022

Log:
  Document "destroy" as an alias for "stop".

Modified:
  head/sbin/geom/class/virstor/gvirstor.8

Modified: head/sbin/geom/class/virstor/gvirstor.8
==
--- head/sbin/geom/class/virstor/gvirstor.8 Fri Aug  3 20:24:16 2012
(r239021)
+++ head/sbin/geom/class/virstor/gvirstor.8 Fri Aug  3 20:30:40 2012
(r239022)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd January 24, 2011
+.Dd August 3, 2012
 .Dt GVIRSTOR 8
 .Os
 .Sh NAME
@@ -43,6 +43,10 @@
 .Op Fl fv
 .Ar name ...
 .Nm
+.Cm destroy
+.Op Fl fv
+.Ar name ...
+.Nm
 .Cm add
 .Op Fl vh
 .Ar name prov ...
@@ -107,6 +111,9 @@ Turn off an existing virtual device with
 .Ar name .
 This command does not touch on-disk metadata.
 As with other GEOM classes, stopped geoms cannot be started manually.
+.It Cm destroy
+Same as
+.Cm stop.
 .It Cm add
 Adds new components to existing virtual device with the given
 .Ar name .
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r239023 - head/sys/dev/isp

2012-08-03 Thread Matt Jacob
Author: mjacob
Date: Sat Aug  4 00:00:30 2012
New Revision: 239023
URL: http://svn.freebsd.org/changeset/base/239023

Log:
  Add detach logic to SBus variant.
  
  Obtained from:Marius
  MFC after:1 month

Modified:
  head/sys/dev/isp/isp_sbus.c

Modified: head/sys/dev/isp/isp_sbus.c
==
--- head/sys/dev/isp/isp_sbus.c Fri Aug  3 20:30:40 2012(r239022)
+++ head/sys/dev/isp/isp_sbus.c Sat Aug  4 00:00:30 2012(r239023)
@@ -78,19 +78,22 @@ static struct ispmdvec mdvec = {
 
 static int isp_sbus_probe (device_t);
 static int isp_sbus_attach (device_t);
+static int isp_sbus_detach (device_t);
 
 
 #defineISP_SBD(isp)((struct isp_sbussoftc *)isp)->sbus_dev
 struct isp_sbussoftc {
ispsoftc_t  sbus_isp;
device_tsbus_dev;
-   struct resource *   sbus_reg;
+   struct resource *   regs;
+   void *  irq;
+   int iqd;
+   int rgd;
void *  ih;
int16_t sbus_poff[_NREG_BLKS];
sdparam sbus_param;
struct isp_spi  sbus_spi;
struct ispmdvec sbus_mdvec;
-   struct resource *   sbus_ires;
 };
 
 
@@ -98,6 +101,7 @@ static device_method_t isp_sbus_methods[
/* Device interface */
DEVMETHOD(device_probe, isp_sbus_probe),
DEVMETHOD(device_attach,isp_sbus_attach),
+   DEVMETHOD(device_detach,isp_sbus_detach),
{ 0, 0 }
 };
 
@@ -136,13 +140,21 @@ isp_sbus_probe(device_t dev)
 static int
 isp_sbus_attach(device_t dev)
 {
-   struct resource *regs;
-   int tval, iqd, isp_debug, role, rid, ispburst, default_id;
+   int tval, isp_debug, role, ispburst, default_id;
struct isp_sbussoftc *sbs;
ispsoftc_t *isp = NULL;
int locksetup = 0;
int ints_setup = 0;
 
+   sbs = device_get_softc(dev);
+   if (sbs == NULL) {
+   device_printf(dev, "cannot get softc\n");
+   return (ENOMEM);
+   }
+
+   sbs->sbus_dev = dev;
+   sbs->sbus_mdvec = mdvec;
+
/*
 * Figure out if we're supposed to skip this one.
 * If we are, we actually go to ISP_ROLE_NONE.
@@ -165,23 +177,15 @@ isp_sbus_attach(device_t dev)
role = ISP_DEFAULT_ROLES;
}
 
-   sbs = malloc(sizeof (*sbs), M_DEVBUF, M_NOWAIT | M_ZERO);
-   if (sbs == NULL) {
-   device_printf(dev, "cannot allocate softc\n");
-   return (ENOMEM);
-   }
+   sbs->irq = sbs->regs = NULL;
+   sbs->rgd = sbs->iqd = 0;
 
-   regs = NULL;
-   iqd = 0;
-   rid = 0;
-   regs = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, RF_ACTIVE);
-   if (regs == 0) {
+   sbs->regs = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &sbs->rgd,
+   RF_ACTIVE);
+   if (sbs->regs == NULL) {
device_printf(dev, "unable to map registers\n");
goto bad;
}
-   sbs->sbus_dev = dev;
-   sbs->sbus_reg = regs;
-   sbs->sbus_mdvec = mdvec;
 
sbs->sbus_poff[BIU_BLOCK >> _BLK_REG_SHFT] = BIU_REGS_OFF;
sbs->sbus_poff[MBOX_BLOCK >> _BLK_REG_SHFT] = SBUS_MBOX_REGS_OFF;
@@ -189,8 +193,8 @@ isp_sbus_attach(device_t dev)
sbs->sbus_poff[RISC_BLOCK >> _BLK_REG_SHFT] = SBUS_RISC_REGS_OFF;
sbs->sbus_poff[DMA_BLOCK >> _BLK_REG_SHFT] = DMA_REGS_OFF;
isp = &sbs->sbus_isp;
-   isp->isp_bus_tag = rman_get_bustag(regs);
-   isp->isp_bus_handle = rman_get_bushandle(regs);
+   isp->isp_bus_tag = rman_get_bustag(sbs->regs);
+   isp->isp_bus_handle = rman_get_bushandle(sbs->regs);
isp->isp_mdvec = &sbs->sbus_mdvec;
isp->isp_bustype = ISP_BT_SBUS;
isp->isp_type = ISP_HA_SCSI_UNKNOWN;
@@ -244,7 +248,6 @@ isp_sbus_attach(device_t dev)
SDPARAM(isp, 0)->isp_ptisp = 1;
}
 
-
isp->isp_osinfo.fw = firmware_get("isp_1000");
if (isp->isp_osinfo.fw) {
union {
@@ -280,16 +283,15 @@ isp_sbus_attach(device_t dev)
mtx_init(&isp->isp_osinfo.lock, "isp", NULL, MTX_DEF);
locksetup++;
 
-   iqd = 0;
-   sbs->sbus_ires = bus_alloc_resource_any(dev, SYS_RES_IRQ, &iqd,
+   sbs->irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &sbs->iqd,
RF_ACTIVE | RF_SHAREABLE);
-   if (sbs->sbus_ires == NULL) {
+   if (sbs->irq == NULL) {
device_printf(dev, "could not allocate interrupt\n");
goto bad;
}
 
-   if (isp_setup_intr(dev, sbs->sbus_ires, ISP_IFLAGS, NULL,
-   isp_platform_intr, isp, &sbs->ih)) {
+   if (isp_setup_intr(dev, sbs->irq, ISP_IFLAGS, NULL, isp_platform_intr,
+   isp, &sbs->ih

svn commit: r239027 - in head/sys: conf powerpc/conf powerpc/powermac

2012-08-03 Thread Justin Hibbits
Author: jhibbits
Date: Sat Aug  4 03:05:01 2012
New Revision: 239027
URL: http://svn.freebsd.org/changeset/base/239027

Log:
  Add backlight support for nVidia-based PowerBooks/iBooks/iMacs.
  
  Approved by:  nwhitehorn (mentor)
  MFC after:9.1-RELEASE

Added:
  head/sys/powerpc/powermac/nvbl.c   (contents, props changed)
Modified:
  head/sys/conf/files.powerpc
  head/sys/powerpc/conf/GENERIC
  head/sys/powerpc/conf/GENERIC64

Modified: head/sys/conf/files.powerpc
==
--- head/sys/conf/files.powerpc Sat Aug  4 02:38:05 2012(r239026)
+++ head/sys/conf/files.powerpc Sat Aug  4 03:05:01 2012(r239027)
@@ -160,6 +160,7 @@ powerpc/powermac/hrowpic.c  optionalpowe
 powerpc/powermac/kiic.coptionalpowermac kiic
 powerpc/powermac/macgpio.c optionalpowermac pci 
 powerpc/powermac/macio.c   optionalpowermac pci
+powerpc/powermac/nvbl.coptionalpowermac nvbl
 powerpc/powermac/openpic_macio.c optional  powermac pci
 powerpc/powermac/platform_powermac.c optional  powermac
 powerpc/powermac/powermac_thermal.c optional   powermac

Modified: head/sys/powerpc/conf/GENERIC
==
--- head/sys/powerpc/conf/GENERIC   Sat Aug  4 02:38:05 2012
(r239026)
+++ head/sys/powerpc/conf/GENERIC   Sat Aug  4 03:05:01 2012
(r239027)
@@ -197,6 +197,7 @@ device  powermac_nvram  # Open Firmware c
 device smu # Apple System Management Unit
 device windtunnel  # Apple G4 MDD fan controller
 device atibl   # ATI-based backlight driver for 
PowerBooks/iBooks
+device nvbl# nVidia-based backlight driver for 
PowerBooks/iBooks
 
 # ADB support
 device adb

Modified: head/sys/powerpc/conf/GENERIC64
==
--- head/sys/powerpc/conf/GENERIC64 Sat Aug  4 02:38:05 2012
(r239026)
+++ head/sys/powerpc/conf/GENERIC64 Sat Aug  4 03:05:01 2012
(r239027)
@@ -194,6 +194,7 @@ device  max6690 # PowerMac7,2 temperatu
 device powermac_nvram  # Open Firmware configuration NVRAM
 device smu # Apple System Management Unit
 device atibl   # ATI-based backlight driver for 
PowerBooks/iBooks
+device nvbl# nVidia-based backlight driver for 
PowerBooks/iBooks
 
 # ADB support
 device adb

Added: head/sys/powerpc/powermac/nvbl.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/powerpc/powermac/nvbl.cSat Aug  4 03:05:01 2012
(r239027)
@@ -0,0 +1,197 @@
+/*-
+ * Copyright (c) 2012 Justin Hibbits
+ * 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 ``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 BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#include 
+
+#define NVIDIA_BRIGHT_MIN (0x0ec)
+#define NVIDIA_BRIGHT_MAX (0x538)
+#define NVIDIA_BRIGHT_SCALE   ((NVIDIA_BRIGHT_MAX - NVIDIA_BRIGHT_MIN)/100)
+/* nVidia's MMIO registers are at PCI BAR[0] */
+#define NVIDIA_MMIO_PMC   (0x0)
+#define  NVIDIA_PMC_OFF (NVIDIA_MMIO_PMC + 0x10f0)
+#define   NVIDIA_PMC_BL_SHIFT(16)
+#define   NVIDIA_PMC_BL_EN   (1 << 31)
+
+
+struct nvbl_softc {
+   device_t dev;
+   struct resource *sc_memr;
+};
+
+static void nvbl_identify(driver_t *driver, device_t parent);
+static int nvbl_probe(device_t dev);
+static int nvbl_attach(device

svn commit: r239031 - head/libexec/rtld-elf/arm

2012-08-03 Thread Andrew Turner
Author: andrew
Date: Sat Aug  4 05:30:20 2012
New Revision: 239031
URL: http://svn.freebsd.org/changeset/base/239031

Log:
  Ensure we align the stack to 8 bytes in rtld.
  
  This is not strictly required with the current ABI but will be when we
  switch to the ARM EABI. The aapcs requires the stack to be 4 byte aligned
  at all times and 8 byte aligned when calling a public subroutine where the
  current ABI only requires sp to be a multiple of 4.

Modified:
  head/libexec/rtld-elf/arm/rtld_start.S

Modified: head/libexec/rtld-elf/arm/rtld_start.S
==
--- head/libexec/rtld-elf/arm/rtld_start.S  Sat Aug  4 04:30:26 2012
(r239030)
+++ head/libexec/rtld-elf/arm/rtld_start.S  Sat Aug  4 05:30:20 2012
(r239031)
@@ -37,6 +37,8 @@ __FBSDID("$FreeBSD$");
.globl  .rtld_start
.type   .rtld_start,%function
 .rtld_start:
+   mov r6, sp  /* save the stack pointer */
+   bic sp, sp, #7  /* align the stack pointer */
sub sp, sp, #8  /* make room for obj_main & exit proc */
mov r4, r0  /* save ps_strings */
ldr sl, .L2
@@ -52,13 +54,13 @@ __FBSDID("$FreeBSD$");
bl  _rtld_relocate_nonplt_self
mov r1, sp
add r2, sp, #4
-   add r0, sp, #8
+   mov r0, r6  /* load the sp the kernel gave us */
bl  _rtld   /* call the shared loader */
mov r3, r0  /* save entry point */
 
ldr r2, [sp, #0]/* r2 = cleanup */
ldr r1, [sp, #4]/* r1 = obj_main */
-   add sp, sp, #8  /* restore stack */
+   mov sp, r6  /* restore stack */
mov r0, r4  /* restore ps_strings */
mov pc, r3  /* jump to the entry point */
 .L2:
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r239032 - head/sys/arm/arm

2012-08-03 Thread Andrew Turner
Author: andrew
Date: Sat Aug  4 05:31:26 2012
New Revision: 239032
URL: http://svn.freebsd.org/changeset/base/239032

Log:
  Ensure we align the stack to 8 bytes in system calls.
  
  This is not strictly required with the current ABI but will be when we
  switch to the ARM EABI. The aapcs requires the stack to be 4 byte aligned
  at all times and 8 byte aligned when calling a public subroutine where the
  current ABI only requires sp to be a multiple of 4.

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

Modified: head/sys/arm/arm/exception.S
==
--- head/sys/arm/arm/exception.SSat Aug  4 05:30:20 2012
(r239031)
+++ head/sys/arm/arm/exception.SSat Aug  4 05:31:26 2012
(r239032)
@@ -80,7 +80,10 @@ ASENTRY_NP(swi_entry)
PUSHFRAME
 
mov r0, sp  /* Pass the frame to any function */
+   mov r6, sp  /* Backup the stack pointer */
+   bic sp, sp, #7  /* Align the stack pointer */
bl  _C_LABEL(swi_handler)   /* It's a SWI ! */
+   mov sp, r6  /* Restore the stack */
 
DO_AST
PULLFRAME
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r239033 - head/sys/arm/arm

2012-08-03 Thread Andrew Turner
Author: andrew
Date: Sat Aug  4 05:38:25 2012
New Revision: 239033
URL: http://svn.freebsd.org/changeset/base/239033

Log:
  Correctly return EFAULT in copyin & copyout on a fault. This fixes NFS
  when running FreeBSD on QEMU emulating a Gumstix board.
  
  While here remove the use of a magic number in the not-XScale version.
  
  Pointed out by:   kib
  Reviewed by:  stas

Modified:
  head/sys/arm/arm/bcopyinout.S
  head/sys/arm/arm/bcopyinout_xscale.S

Modified: head/sys/arm/arm/bcopyinout.S
==
--- head/sys/arm/arm/bcopyinout.S   Sat Aug  4 05:31:26 2012
(r239032)
+++ head/sys/arm/arm/bcopyinout.S   Sat Aug  4 05:38:25 2012
(r239033)
@@ -39,6 +39,7 @@
 #include "assym.s"
 
 #include 
+#include 
 
 .L_arm_memcpy:
.word   _C_LABEL(_arm_memcpy)
@@ -310,7 +311,7 @@ ENTRY(copyin)
RET
 
 .Lcopyfault:
-   mov r0, #14 /* EFAULT */
+   ldr r0, =EFAULT
str r5, [r4, #PCB_ONFAULT]
RESTORE_REGS
 

Modified: head/sys/arm/arm/bcopyinout_xscale.S
==
--- head/sys/arm/arm/bcopyinout_xscale.SSat Aug  4 05:31:26 2012
(r239032)
+++ head/sys/arm/arm/bcopyinout_xscale.SSat Aug  4 05:38:25 2012
(r239033)
@@ -108,6 +108,7 @@ ENTRY(copyin)
ldmfd   sp!, {r10-r11, pc}
 
 .Lcopyin_fault:
+   ldr r0, =EFAULT
str r11, [r10, #PCB_ONFAULT]
cmp r3, #0x00
ldmgtfd sp!, {r4-r7}/* r3 > 0 Restore r4-r7 */
@@ -559,6 +560,7 @@ ENTRY(copyout)
ldmfd   sp!, {r10-r11, pc}
 
 .Lcopyout_fault:
+   ldr r0, =EFAULT
str r11, [r10, #PCB_ONFAULT]
cmp r3, #0x00
ldmgtfd sp!, {r4-r7}/* r3 > 0 Restore r4-r7 */
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"